Browse Source
			
			
			
			
				
		# Conflicts: # epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/ResiGroupOpenFeignClient.java # epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/fallback/ResiGroupOpenFeignClientFallback.java # epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/utils/ModuleConstant.javafeature/evaluate
				 29 changed files with 1004 additions and 11 deletions
			
			
		@ -0,0 +1,24 @@ | 
				
			|||||
 | 
					package com.epmet.dto.form; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					import lombok.Data; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					import javax.validation.constraints.NotBlank; | 
				
			||||
 | 
					import javax.validation.constraints.NotNull; | 
				
			||||
 | 
					import java.io.Serializable; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					/** | 
				
			||||
 | 
					 * @description: | 
				
			||||
 | 
					 * @author: liushaowen | 
				
			||||
 | 
					 * @date: 2020/11/13 10:56 | 
				
			||||
 | 
					 */ | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					@Data | 
				
			||||
 | 
					public class UploadBytesFormDTO implements Serializable { | 
				
			||||
 | 
					    private static final long serialVersionUID = 1L; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    @NotNull(message = "字节数组不能为空") | 
				
			||||
 | 
					    private byte[] bytes; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    @NotBlank(message = "后缀不能为空") | 
				
			||||
 | 
					    private String extension; | 
				
			||||
 | 
					} | 
				
			||||
@ -0,0 +1,14 @@ | 
				
			|||||
 | 
					package com.epmet.resi.group.constant; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					/** | 
				
			||||
 | 
					 * @description: | 
				
			||||
 | 
					 * @author: liushaowen | 
				
			||||
 | 
					 * @date: 2020/11/13 16:23 | 
				
			||||
 | 
					 */ | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					public interface GroupCodeConstant { | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 群二维码类型-邀请 | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
					    String CODE_TYPE_INVITE = "invite"; | 
				
			||||
 | 
					} | 
				
			||||
@ -0,0 +1,96 @@ | 
				
			|||||
 | 
					/** | 
				
			||||
 | 
					 * Copyright 2018 人人开源 https://www.renren.io
 | 
				
			||||
 | 
					 * <p> | 
				
			||||
 | 
					 * This program is free software: you can redistribute it and/or modify | 
				
			||||
 | 
					 * it under the terms of the GNU General Public License as published by | 
				
			||||
 | 
					 * the Free Software Foundation, either version 3 of the License, or | 
				
			||||
 | 
					 * (at your option) any later version. | 
				
			||||
 | 
					 * <p> | 
				
			||||
 | 
					 * This program is distributed in the hope that it will be useful, | 
				
			||||
 | 
					 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
				
			||||
 | 
					 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
				
			||||
 | 
					 * GNU General Public License for more details. | 
				
			||||
 | 
					 * <p> | 
				
			||||
 | 
					 * You should have received a copy of the GNU General Public License | 
				
			||||
 | 
					 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
				
			||||
 | 
					 */ | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					package com.epmet.resi.group.dto.group; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					import java.io.Serializable; | 
				
			||||
 | 
					import java.util.Date; | 
				
			||||
 | 
					import lombok.Data; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					/** | 
				
			||||
 | 
					 * 小组二维码 小组唯一二维码,海报码和小组码是同一个二维码,长期有效的 | 
				
			||||
 | 
					 * | 
				
			||||
 | 
					 * @author qu qu@elink-cn.com | 
				
			||||
 | 
					 * @since v1.0.0 2020-11-13 | 
				
			||||
 | 
					 */ | 
				
			||||
 | 
					@Data | 
				
			||||
 | 
					public class ResiGroupCodeDTO implements Serializable { | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    private static final long serialVersionUID = 1L; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 主键 | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
						private String id; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 客户ID | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
						private String customerId; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 网格ID | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
						private String gridId; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 小组Id | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
						private String groupId; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 二维码类型 | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
						private String type; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 二维码路径 | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
						private String url; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 删除标志 | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
						private String delFlag; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 乐观锁 | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
						private Integer revision; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 创建人 | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
						private String createdBy; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 创建时间 | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
						private Date createdTime; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 更新人 | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
						private String updatedBy; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 更新时间 | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
						private Date updatedTime; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					} | 
				
			||||
@ -0,0 +1,40 @@ | 
				
			|||||
 | 
					package com.epmet.resi.group.dto.group.form; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					import lombok.Data; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					import javax.validation.constraints.NotBlank; | 
				
			||||
 | 
					import java.io.Serializable; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					/** | 
				
			||||
 | 
					 * @description: | 
				
			||||
 | 
					 * @author: liushaowen | 
				
			||||
 | 
					 * @date: 2020/11/13 16:22 | 
				
			||||
 | 
					 */ | 
				
			||||
 | 
					@Data | 
				
			||||
 | 
					public class CreateGroupCodeFormDTO implements Serializable { | 
				
			||||
 | 
					    private static final long serialVersionUID = 1L; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 客户id | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
					    @NotBlank(message = "客户id不能为空") | 
				
			||||
 | 
					    private String customerId; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 网格id | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
					    @NotBlank(message = "网格id不能为空") | 
				
			||||
 | 
					    private String gridId; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 组id | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
					    @NotBlank(message = "群组id不能为空") | 
				
			||||
 | 
					    private String groupId; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 类型 GroupCodeConstant中的类型 | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
					    @NotBlank(message = "二维码类型不能为空") | 
				
			||||
 | 
					    private String type; | 
				
			||||
 | 
					} | 
				
			||||
@ -0,0 +1,40 @@ | 
				
			|||||
 | 
					package com.epmet.resi.group.dto.group.form; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					import lombok.Data; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					import javax.validation.constraints.NotBlank; | 
				
			||||
 | 
					import java.io.Serializable; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					/** | 
				
			||||
 | 
					 * @description: | 
				
			||||
 | 
					 * @author: liushaowen | 
				
			||||
 | 
					 * @date: 2020/11/16 9:31 | 
				
			||||
 | 
					 */ | 
				
			||||
 | 
					@Data | 
				
			||||
 | 
					public class GetGroupCodeFormDTO implements Serializable { | 
				
			||||
 | 
					    private static final long serialVersionUID = 1L; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 客户id | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
					    @NotBlank(message = "客户id不能为空") | 
				
			||||
 | 
					    private String customerId; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 网格id | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
					    @NotBlank(message = "网格id不能为空") | 
				
			||||
 | 
					    private String gridId; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 组id | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
					    @NotBlank(message = "群组id不能为空") | 
				
			||||
 | 
					    private String groupId; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 类型 GroupCodeConstant中的类型 | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
					    @NotBlank(message = "二维码类型不能为空") | 
				
			||||
 | 
					    private String type; | 
				
			||||
 | 
					} | 
				
			||||
@ -0,0 +1,102 @@ | 
				
			|||||
 | 
					/** | 
				
			||||
 | 
					 * Copyright 2018 人人开源 https://www.renren.io
 | 
				
			||||
 | 
					 * <p> | 
				
			||||
 | 
					 * This program is free software: you can redistribute it and/or modify | 
				
			||||
 | 
					 * it under the terms of the GNU General Public License as published by | 
				
			||||
 | 
					 * the Free Software Foundation, either version 3 of the License, or | 
				
			||||
 | 
					 * (at your option) any later version. | 
				
			||||
 | 
					 * <p> | 
				
			||||
 | 
					 * This program is distributed in the hope that it will be useful, | 
				
			||||
 | 
					 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
				
			||||
 | 
					 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
				
			||||
 | 
					 * GNU General Public License for more details. | 
				
			||||
 | 
					 * <p> | 
				
			||||
 | 
					 * You should have received a copy of the GNU General Public License | 
				
			||||
 | 
					 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
				
			||||
 | 
					 */ | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					package com.epmet.modules.group.controller; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					import com.epmet.commons.tools.page.PageData; | 
				
			||||
 | 
					import com.epmet.commons.tools.utils.ExcelUtils; | 
				
			||||
 | 
					import com.epmet.commons.tools.utils.Result; | 
				
			||||
 | 
					import com.epmet.commons.tools.validator.AssertUtils; | 
				
			||||
 | 
					import com.epmet.commons.tools.validator.ValidatorUtils; | 
				
			||||
 | 
					import com.epmet.commons.tools.validator.group.AddGroup; | 
				
			||||
 | 
					import com.epmet.commons.tools.validator.group.DefaultGroup; | 
				
			||||
 | 
					import com.epmet.commons.tools.validator.group.UpdateGroup; | 
				
			||||
 | 
					import com.epmet.modules.group.service.ResiGroupCodeService; | 
				
			||||
 | 
					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 org.springframework.beans.factory.annotation.Autowired; | 
				
			||||
 | 
					import org.springframework.web.bind.annotation.*; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					import javax.servlet.http.HttpServletResponse; | 
				
			||||
 | 
					import java.util.List; | 
				
			||||
 | 
					import java.util.Map; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					/** | 
				
			||||
 | 
					 * 小组二维码 小组唯一二维码,海报码和小组码是同一个二维码,长期有效的 | 
				
			||||
 | 
					 * | 
				
			||||
 | 
					 * @author qu qu@elink-cn.com | 
				
			||||
 | 
					 * @since v1.0.0 2020-11-13 | 
				
			||||
 | 
					 */ | 
				
			||||
 | 
					@RestController | 
				
			||||
 | 
					@RequestMapping("resigroupcode") | 
				
			||||
 | 
					public class ResiGroupCodeController { | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    @Autowired | 
				
			||||
 | 
					    private ResiGroupCodeService resiGroupCodeService; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    @GetMapping("page") | 
				
			||||
 | 
					    public Result<PageData<ResiGroupCodeDTO>> page(@RequestParam Map<String, Object> params){ | 
				
			||||
 | 
					        PageData<ResiGroupCodeDTO> page = resiGroupCodeService.page(params); | 
				
			||||
 | 
					        return new Result<PageData<ResiGroupCodeDTO>>().ok(page); | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    @GetMapping("{id}") | 
				
			||||
 | 
					    public Result<ResiGroupCodeDTO> get(@PathVariable("id") String id){ | 
				
			||||
 | 
					        ResiGroupCodeDTO data = resiGroupCodeService.get(id); | 
				
			||||
 | 
					        return new Result<ResiGroupCodeDTO>().ok(data); | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    @PostMapping | 
				
			||||
 | 
					    public Result save(@RequestBody ResiGroupCodeDTO dto){ | 
				
			||||
 | 
					        //效验数据
 | 
				
			||||
 | 
					        ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); | 
				
			||||
 | 
					        resiGroupCodeService.save(dto); | 
				
			||||
 | 
					        return new Result(); | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    @PutMapping | 
				
			||||
 | 
					    public Result update(@RequestBody ResiGroupCodeDTO dto){ | 
				
			||||
 | 
					        //效验数据
 | 
				
			||||
 | 
					        ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); | 
				
			||||
 | 
					        resiGroupCodeService.update(dto); | 
				
			||||
 | 
					        return new Result(); | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    @DeleteMapping | 
				
			||||
 | 
					    public Result delete(@RequestBody String[] ids){ | 
				
			||||
 | 
					        //效验数据
 | 
				
			||||
 | 
					        AssertUtils.isArrayEmpty(ids, "id"); | 
				
			||||
 | 
					        resiGroupCodeService.delete(ids); | 
				
			||||
 | 
					        return new Result(); | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    @RequestMapping("creategroupcode") | 
				
			||||
 | 
					    public Result<String> createGroupCode(@RequestBody CreateGroupCodeFormDTO dto){ | 
				
			||||
 | 
					        ValidatorUtils.validateEntity(dto); | 
				
			||||
 | 
					        return new Result<String>().ok(resiGroupCodeService.createGroupCode(dto)); | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    @RequestMapping("getgroupcode") | 
				
			||||
 | 
					    public Result<String> getGroupCode(@RequestBody GetGroupCodeFormDTO dto){ | 
				
			||||
 | 
					        ValidatorUtils.validateEntity(dto); | 
				
			||||
 | 
					        return resiGroupCodeService.getGroupCode(dto); | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					} | 
				
			||||
@ -0,0 +1,33 @@ | 
				
			|||||
 | 
					/** | 
				
			||||
 | 
					 * Copyright 2018 人人开源 https://www.renren.io
 | 
				
			||||
 | 
					 * <p> | 
				
			||||
 | 
					 * This program is free software: you can redistribute it and/or modify | 
				
			||||
 | 
					 * it under the terms of the GNU General Public License as published by | 
				
			||||
 | 
					 * the Free Software Foundation, either version 3 of the License, or | 
				
			||||
 | 
					 * (at your option) any later version. | 
				
			||||
 | 
					 * <p> | 
				
			||||
 | 
					 * This program is distributed in the hope that it will be useful, | 
				
			||||
 | 
					 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
				
			||||
 | 
					 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
				
			||||
 | 
					 * GNU General Public License for more details. | 
				
			||||
 | 
					 * <p> | 
				
			||||
 | 
					 * You should have received a copy of the GNU General Public License | 
				
			||||
 | 
					 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
				
			||||
 | 
					 */ | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					package com.epmet.modules.group.dao; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					import com.epmet.commons.mybatis.dao.BaseDao; | 
				
			||||
 | 
					import com.epmet.modules.group.entity.ResiGroupCodeEntity; | 
				
			||||
 | 
					import org.apache.ibatis.annotations.Mapper; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					/** | 
				
			||||
 | 
					 * 小组二维码 小组唯一二维码,海报码和小组码是同一个二维码,长期有效的 | 
				
			||||
 | 
					 * | 
				
			||||
 | 
					 * @author qu qu@elink-cn.com | 
				
			||||
 | 
					 * @since v1.0.0 2020-11-13 | 
				
			||||
 | 
					 */ | 
				
			||||
 | 
					@Mapper | 
				
			||||
 | 
					public interface ResiGroupCodeDao extends BaseDao<ResiGroupCodeEntity> { | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					} | 
				
			||||
@ -0,0 +1,67 @@ | 
				
			|||||
 | 
					/** | 
				
			||||
 | 
					 * Copyright 2018 人人开源 https://www.renren.io
 | 
				
			||||
 | 
					 * <p> | 
				
			||||
 | 
					 * This program is free software: you can redistribute it and/or modify | 
				
			||||
 | 
					 * it under the terms of the GNU General Public License as published by | 
				
			||||
 | 
					 * the Free Software Foundation, either version 3 of the License, or | 
				
			||||
 | 
					 * (at your option) any later version. | 
				
			||||
 | 
					 * <p> | 
				
			||||
 | 
					 * This program is distributed in the hope that it will be useful, | 
				
			||||
 | 
					 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
				
			||||
 | 
					 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
				
			||||
 | 
					 * GNU General Public License for more details. | 
				
			||||
 | 
					 * <p> | 
				
			||||
 | 
					 * You should have received a copy of the GNU General Public License | 
				
			||||
 | 
					 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
				
			||||
 | 
					 */ | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					package com.epmet.modules.group.entity; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					import com.baomidou.mybatisplus.annotation.TableName; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					import com.epmet.commons.mybatis.entity.BaseEpmetEntity; | 
				
			||||
 | 
					import lombok.Data; | 
				
			||||
 | 
					import lombok.EqualsAndHashCode; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					import java.util.Date; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					/** | 
				
			||||
 | 
					 * 小组二维码 小组唯一二维码,海报码和小组码是同一个二维码,长期有效的 | 
				
			||||
 | 
					 * | 
				
			||||
 | 
					 * @author qu qu@elink-cn.com | 
				
			||||
 | 
					 * @since v1.0.0 2020-11-13 | 
				
			||||
 | 
					 */ | 
				
			||||
 | 
					@Data | 
				
			||||
 | 
					@EqualsAndHashCode(callSuper=false) | 
				
			||||
 | 
					@TableName("resi_group_code") | 
				
			||||
 | 
					public class ResiGroupCodeEntity extends BaseEpmetEntity { | 
				
			||||
 | 
					
 | 
				
			||||
 | 
						private static final long serialVersionUID = 1L; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 客户ID | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
						private String customerId; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 网格ID | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
						private String gridId; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 小组Id | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
						private String groupId; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 二维码类型 | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
						private String type; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 二维码路径 | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
						private String url; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					} | 
				
			||||
@ -0,0 +1,58 @@ | 
				
			|||||
 | 
					/** | 
				
			||||
 | 
					 * Copyright 2018 人人开源 https://www.renren.io
 | 
				
			||||
 | 
					 * <p> | 
				
			||||
 | 
					 * This program is free software: you can redistribute it and/or modify | 
				
			||||
 | 
					 * it under the terms of the GNU General Public License as published by | 
				
			||||
 | 
					 * the Free Software Foundation, either version 3 of the License, or | 
				
			||||
 | 
					 * (at your option) any later version. | 
				
			||||
 | 
					 * <p> | 
				
			||||
 | 
					 * This program is distributed in the hope that it will be useful, | 
				
			||||
 | 
					 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
				
			||||
 | 
					 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
				
			||||
 | 
					 * GNU General Public License for more details. | 
				
			||||
 | 
					 * <p> | 
				
			||||
 | 
					 * You should have received a copy of the GNU General Public License | 
				
			||||
 | 
					 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
				
			||||
 | 
					 */ | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					package com.epmet.modules.group.redis; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					import com.epmet.commons.tools.redis.RedisUtils; | 
				
			||||
 | 
					import org.springframework.beans.factory.annotation.Autowired; | 
				
			||||
 | 
					import org.springframework.stereotype.Component; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					import java.util.Map; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					/** | 
				
			||||
 | 
					 * 小组二维码 小组唯一二维码,海报码和小组码是同一个二维码,长期有效的 | 
				
			||||
 | 
					 * | 
				
			||||
 | 
					 * @author qu qu@elink-cn.com | 
				
			||||
 | 
					 * @since v1.0.0 2020-11-13 | 
				
			||||
 | 
					 */ | 
				
			||||
 | 
					@Component | 
				
			||||
 | 
					public class ResiGroupCodeRedis { | 
				
			||||
 | 
					    @Autowired | 
				
			||||
 | 
					    private RedisUtils redisUtils; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    public void delete(Object[] ids) { | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    public void set(){ | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    public String get(String id){ | 
				
			||||
 | 
					        return null; | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * @Description  获取刷新 | 
				
			||||
 | 
					     * @param key = epmet:wechartthird:authorizerrefreshtoken:customerId:clientType 前缀+客户ID+客户端类型 | 
				
			||||
 | 
					     * @author zxc | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
					    public Map<String,Object> getAuthorizerRefreshToken(String key){ | 
				
			||||
 | 
					        Map<String, Object> result = redisUtils.hGetAll("epmet:wechartthird:authorizerrefreshtoken:" + key); | 
				
			||||
 | 
					        return result; | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					} | 
				
			||||
@ -0,0 +1,117 @@ | 
				
			|||||
 | 
					/** | 
				
			||||
 | 
					 * Copyright 2018 人人开源 https://www.renren.io
 | 
				
			||||
 | 
					 * <p> | 
				
			||||
 | 
					 * This program is free software: you can redistribute it and/or modify | 
				
			||||
 | 
					 * it under the terms of the GNU General Public License as published by | 
				
			||||
 | 
					 * the Free Software Foundation, either version 3 of the License, or | 
				
			||||
 | 
					 * (at your option) any later version. | 
				
			||||
 | 
					 * <p> | 
				
			||||
 | 
					 * This program is distributed in the hope that it will be useful, | 
				
			||||
 | 
					 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
				
			||||
 | 
					 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
				
			||||
 | 
					 * GNU General Public License for more details. | 
				
			||||
 | 
					 * <p> | 
				
			||||
 | 
					 * You should have received a copy of the GNU General Public License | 
				
			||||
 | 
					 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
				
			||||
 | 
					 */ | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					package com.epmet.modules.group.service; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					import com.epmet.commons.mybatis.service.BaseService; | 
				
			||||
 | 
					import com.epmet.commons.tools.page.PageData; | 
				
			||||
 | 
					import com.epmet.commons.tools.utils.Result; | 
				
			||||
 | 
					import com.epmet.modules.group.entity.ResiGroupCodeEntity; | 
				
			||||
 | 
					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 java.util.List; | 
				
			||||
 | 
					import java.util.Map; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					/** | 
				
			||||
 | 
					 * 小组二维码 小组唯一二维码,海报码和小组码是同一个二维码,长期有效的 | 
				
			||||
 | 
					 * | 
				
			||||
 | 
					 * @author qu qu@elink-cn.com | 
				
			||||
 | 
					 * @since v1.0.0 2020-11-13 | 
				
			||||
 | 
					 */ | 
				
			||||
 | 
					public interface ResiGroupCodeService extends BaseService<ResiGroupCodeEntity> { | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 默认分页 | 
				
			||||
 | 
					     * | 
				
			||||
 | 
					     * @param params | 
				
			||||
 | 
					     * @return PageData<ResiGroupCodeDTO> | 
				
			||||
 | 
					     * @author generator | 
				
			||||
 | 
					     * @date 2020-11-13 | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
					    PageData<ResiGroupCodeDTO> page(Map<String, Object> params); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 默认查询 | 
				
			||||
 | 
					     * | 
				
			||||
 | 
					     * @param params | 
				
			||||
 | 
					     * @return java.util.List<ResiGroupCodeDTO> | 
				
			||||
 | 
					     * @author generator | 
				
			||||
 | 
					     * @date 2020-11-13 | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
					    List<ResiGroupCodeDTO> list(Map<String, Object> params); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 单条查询 | 
				
			||||
 | 
					     * | 
				
			||||
 | 
					     * @param id | 
				
			||||
 | 
					     * @return ResiGroupCodeDTO | 
				
			||||
 | 
					     * @author generator | 
				
			||||
 | 
					     * @date 2020-11-13 | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
					    ResiGroupCodeDTO get(String id); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 默认保存 | 
				
			||||
 | 
					     * | 
				
			||||
 | 
					     * @param dto | 
				
			||||
 | 
					     * @return void | 
				
			||||
 | 
					     * @author generator | 
				
			||||
 | 
					     * @date 2020-11-13 | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
					    void save(ResiGroupCodeDTO dto); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 默认更新 | 
				
			||||
 | 
					     * | 
				
			||||
 | 
					     * @param dto | 
				
			||||
 | 
					     * @return void | 
				
			||||
 | 
					     * @author generator | 
				
			||||
 | 
					     * @date 2020-11-13 | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
					    void update(ResiGroupCodeDTO dto); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 批量删除 | 
				
			||||
 | 
					     * | 
				
			||||
 | 
					     * @param ids | 
				
			||||
 | 
					     * @return void | 
				
			||||
 | 
					     * @author generator | 
				
			||||
 | 
					     * @date 2020-11-13 | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
					    void delete(String[] ids); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * @Description 创建群组二维码 | 
				
			||||
 | 
					     * @param dto | 
				
			||||
 | 
					     * @return String | 
				
			||||
 | 
					     * @Author liushaowen | 
				
			||||
 | 
					     * @Date 2020/11/13 16:32 | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
					    String createGroupCode(CreateGroupCodeFormDTO dto); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * @Description 获取群组二维码 | 
				
			||||
 | 
					     * @param dto | 
				
			||||
 | 
					     * @return com.epmet.commons.tools.utils.Result<java.lang.String> | 
				
			||||
 | 
					     * @Author liushaowen | 
				
			||||
 | 
					     * @Date 2020/11/16 9:37 | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
					    Result<String> getGroupCode(GetGroupCodeFormDTO dto); | 
				
			||||
 | 
					} | 
				
			||||
@ -0,0 +1,255 @@ | 
				
			|||||
 | 
					/** | 
				
			||||
 | 
					 * Copyright 2018 人人开源 https://www.renren.io
 | 
				
			||||
 | 
					 * <p> | 
				
			||||
 | 
					 * This program is free software: you can redistribute it and/or modify | 
				
			||||
 | 
					 * it under the terms of the GNU General Public License as published by | 
				
			||||
 | 
					 * the Free Software Foundation, either version 3 of the License, or | 
				
			||||
 | 
					 * (at your option) any later version. | 
				
			||||
 | 
					 * <p> | 
				
			||||
 | 
					 * This program is distributed in the hope that it will be useful, | 
				
			||||
 | 
					 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
				
			||||
 | 
					 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
				
			||||
 | 
					 * GNU General Public License for more details. | 
				
			||||
 | 
					 * <p> | 
				
			||||
 | 
					 * You should have received a copy of the GNU General Public License | 
				
			||||
 | 
					 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
				
			||||
 | 
					 */ | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					package com.epmet.modules.group.service.impl; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					import com.alibaba.fastjson.JSON; | 
				
			||||
 | 
					import com.alibaba.fastjson.JSONObject; | 
				
			||||
 | 
					import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
				
			||||
 | 
					import com.baomidou.mybatisplus.core.metadata.IPage; | 
				
			||||
 | 
					import com.baomidou.mybatisplus.extension.api.R; | 
				
			||||
 | 
					import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; | 
				
			||||
 | 
					import com.epmet.commons.tools.constant.FieldConstant; | 
				
			||||
 | 
					import com.epmet.commons.tools.enums.EnvEnum; | 
				
			||||
 | 
					import com.epmet.commons.tools.exception.RenException; | 
				
			||||
 | 
					import com.epmet.commons.tools.page.PageData; | 
				
			||||
 | 
					import com.epmet.commons.tools.utils.ConvertUtils; | 
				
			||||
 | 
					import com.epmet.commons.tools.utils.HttpClientManager; | 
				
			||||
 | 
					import com.epmet.commons.tools.utils.Result; | 
				
			||||
 | 
					import com.epmet.dto.form.UploadBytesFormDTO; | 
				
			||||
 | 
					import com.epmet.dto.result.CustomerTokensResultDTO; | 
				
			||||
 | 
					import com.epmet.dto.result.UploadImgResultDTO; | 
				
			||||
 | 
					import com.epmet.feign.OssFeignClient; | 
				
			||||
 | 
					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.utils.ModuleConstant; | 
				
			||||
 | 
					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 org.apache.commons.lang3.StringUtils; | 
				
			||||
 | 
					import org.slf4j.Logger; | 
				
			||||
 | 
					import org.slf4j.LoggerFactory; | 
				
			||||
 | 
					import org.springframework.beans.BeanUtils; | 
				
			||||
 | 
					import org.springframework.beans.factory.annotation.Autowired; | 
				
			||||
 | 
					import org.springframework.stereotype.Service; | 
				
			||||
 | 
					import org.springframework.transaction.annotation.Transactional; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					import java.io.UnsupportedEncodingException; | 
				
			||||
 | 
					import java.util.Arrays; | 
				
			||||
 | 
					import java.util.HashMap; | 
				
			||||
 | 
					import java.util.List; | 
				
			||||
 | 
					import java.util.Map; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					/** | 
				
			||||
 | 
					 * 小组二维码 小组唯一二维码,海报码和小组码是同一个二维码,长期有效的 | 
				
			||||
 | 
					 * | 
				
			||||
 | 
					 * @author qu qu@elink-cn.com | 
				
			||||
 | 
					 * @since v1.0.0 2020-11-13 | 
				
			||||
 | 
					 */ | 
				
			||||
 | 
					@Service | 
				
			||||
 | 
					public class ResiGroupCodeServiceImpl extends BaseServiceImpl<ResiGroupCodeDao, ResiGroupCodeEntity> implements ResiGroupCodeService { | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    private static final Logger logger = LoggerFactory.getLogger(ResiGroupCodeServiceImpl.class); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    @Autowired | 
				
			||||
 | 
					    private ResiGroupCodeRedis resiGroupCodeRedis; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    @Autowired | 
				
			||||
 | 
					    private OssFeignClient ossFeignClient; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    @Override | 
				
			||||
 | 
					    public PageData<ResiGroupCodeDTO> page(Map<String, Object> params) { | 
				
			||||
 | 
					        IPage<ResiGroupCodeEntity> page = baseDao.selectPage( | 
				
			||||
 | 
					                getPage(params, FieldConstant.CREATED_TIME, false), | 
				
			||||
 | 
					                getWrapper(params) | 
				
			||||
 | 
					        ); | 
				
			||||
 | 
					        return getPageData(page, ResiGroupCodeDTO.class); | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    @Override | 
				
			||||
 | 
					    public List<ResiGroupCodeDTO> list(Map<String, Object> params) { | 
				
			||||
 | 
					        List<ResiGroupCodeEntity> entityList = baseDao.selectList(getWrapper(params)); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					        return ConvertUtils.sourceToTarget(entityList, ResiGroupCodeDTO.class); | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    private QueryWrapper<ResiGroupCodeEntity> getWrapper(Map<String, Object> params) { | 
				
			||||
 | 
					        String id = (String) params.get(FieldConstant.ID_HUMP); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					        QueryWrapper<ResiGroupCodeEntity> wrapper = new QueryWrapper<>(); | 
				
			||||
 | 
					        wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					        return wrapper; | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    @Override | 
				
			||||
 | 
					    public ResiGroupCodeDTO get(String id) { | 
				
			||||
 | 
					        ResiGroupCodeEntity entity = baseDao.selectById(id); | 
				
			||||
 | 
					        return ConvertUtils.sourceToTarget(entity, ResiGroupCodeDTO.class); | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    @Override | 
				
			||||
 | 
					    @Transactional(rollbackFor = Exception.class) | 
				
			||||
 | 
					    public void save(ResiGroupCodeDTO dto) { | 
				
			||||
 | 
					        ResiGroupCodeEntity entity = ConvertUtils.sourceToTarget(dto, ResiGroupCodeEntity.class); | 
				
			||||
 | 
					        insert(entity); | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    @Override | 
				
			||||
 | 
					    @Transactional(rollbackFor = Exception.class) | 
				
			||||
 | 
					    public void update(ResiGroupCodeDTO dto) { | 
				
			||||
 | 
					        ResiGroupCodeEntity entity = ConvertUtils.sourceToTarget(dto, ResiGroupCodeEntity.class); | 
				
			||||
 | 
					        updateById(entity); | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    @Override | 
				
			||||
 | 
					    @Transactional(rollbackFor = Exception.class) | 
				
			||||
 | 
					    public void delete(String[] ids) { | 
				
			||||
 | 
					        // 逻辑删除(@TableLogic 注解)
 | 
				
			||||
 | 
					        baseDao.deleteBatchIds(Arrays.asList(ids)); | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * @param dto | 
				
			||||
 | 
					     * @return void | 
				
			||||
 | 
					     * @Description 创建群组二维码 | 
				
			||||
 | 
					     * @Author liushaowen | 
				
			||||
 | 
					     * @Date 2020/11/13 16:32 | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
					    @Override | 
				
			||||
 | 
					    public String createGroupCode(CreateGroupCodeFormDTO dto) { | 
				
			||||
 | 
					        String result = ""; | 
				
			||||
 | 
					        ResiGroupCodeEntity codeByGroupId = getCode(dto.getGroupId(), dto.getType()); | 
				
			||||
 | 
					        if (codeByGroupId != null) { | 
				
			||||
 | 
					            logger.error("本群组该类型二维码已存在,请勿重复添加。groupId:{},type:{}", dto.getGroupId(), dto.getType()); | 
				
			||||
 | 
					            throw new RenException("本群组该类型二维码已存在,请勿重复添加。"); | 
				
			||||
 | 
					        } else { | 
				
			||||
 | 
					            //向微信获取二维码
 | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					            // 获取AccessToken
 | 
				
			||||
 | 
					            String accessToken = getAccessToken(dto.getCustomerId()); | 
				
			||||
 | 
					            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()); | 
				
			||||
 | 
					            //需要发送的Json
 | 
				
			||||
 | 
					            JSONObject data = new JSONObject(); | 
				
			||||
 | 
					            data.put("path", path.toString()); | 
				
			||||
 | 
					            data.put("width", 400); | 
				
			||||
 | 
					            //发送
 | 
				
			||||
 | 
					            byte[] buffer = HttpClientManager.getInstance().getMediaByteArray(ModuleConstant.GET_CODE_URL + accessToken, JSON.toJSONString(data)).getData(); | 
				
			||||
 | 
					            if (buffer != null && buffer.length < 500) { | 
				
			||||
 | 
					                String wxResult = ""; | 
				
			||||
 | 
					                try { | 
				
			||||
 | 
					                    wxResult = new String(buffer, "UTF-8"); | 
				
			||||
 | 
					                    if (-1 != wxResult.indexOf("errcode")) { | 
				
			||||
 | 
					                        logger.error("获取二维码接口返回错误:{}", wxResult); | 
				
			||||
 | 
					                        throw new RenException("获取二维码失败"); | 
				
			||||
 | 
					                    } | 
				
			||||
 | 
					                } catch (UnsupportedEncodingException e) { | 
				
			||||
 | 
					                    e.printStackTrace(); | 
				
			||||
 | 
					                } | 
				
			||||
 | 
					            } | 
				
			||||
 | 
					            //上传
 | 
				
			||||
 | 
					            UploadBytesFormDTO uploadBytesFormDTO = new UploadBytesFormDTO(); | 
				
			||||
 | 
					            uploadBytesFormDTO.setBytes(buffer); | 
				
			||||
 | 
					            uploadBytesFormDTO.setExtension("jpg"); | 
				
			||||
 | 
					            Result<UploadImgResultDTO> uploadResult = ossFeignClient.uploadBytes(uploadBytesFormDTO); | 
				
			||||
 | 
					            if (uploadResult.success()) { | 
				
			||||
 | 
					                result = uploadResult.getData().getUrl(); | 
				
			||||
 | 
					                //存表
 | 
				
			||||
 | 
					                ResiGroupCodeEntity entity = new ResiGroupCodeEntity(); | 
				
			||||
 | 
					                BeanUtils.copyProperties(dto, entity); | 
				
			||||
 | 
					                entity.setUrl(uploadResult.getData().getUrl()); | 
				
			||||
 | 
					                baseDao.insert(entity); | 
				
			||||
 | 
					            } else { | 
				
			||||
 | 
					                logger.error("上传图片失败:{}", uploadResult.getMsg()); | 
				
			||||
 | 
					                throw new RenException("上传图片失败"); | 
				
			||||
 | 
					            } | 
				
			||||
 | 
					        } | 
				
			||||
 | 
					        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; | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					} | 
				
			||||
@ -0,0 +1,15 @@ | 
				
			|||||
 | 
					CREATE TABLE `resi_group_code` ( | 
				
			||||
 | 
					  `ID` varchar(64) NOT NULL COMMENT '主键', | 
				
			||||
 | 
					  `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户ID', | 
				
			||||
 | 
					  `GRID_ID` varchar(64) NOT NULL COMMENT '网格ID', | 
				
			||||
 | 
					  `GROUP_ID` varchar(64) NOT NULL COMMENT '小组Id', | 
				
			||||
 | 
					  `TYPE` varchar(32) NOT NULL COMMENT '二维码类型 邀请:invite', | 
				
			||||
 | 
					  `URL` varchar(128) NOT NULL COMMENT '二维码路径', | 
				
			||||
 | 
					  `DEL_FLAG` varchar(1) NOT NULL COMMENT '删除标志', | 
				
			||||
 | 
					  `REVISION` int(11) NOT NULL COMMENT '乐观锁', | 
				
			||||
 | 
					  `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', | 
				
			||||
 | 
					  `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', | 
				
			||||
 | 
					  `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', | 
				
			||||
 | 
					  `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', | 
				
			||||
 | 
					  PRIMARY KEY (`ID`) | 
				
			||||
 | 
					) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='小组二维码 小组唯一二维码,海报码和小组码是同一个二维码,长期有效的'; | 
				
			||||
@ -0,0 +1,22 @@ | 
				
			|||||
 | 
					<?xml version="1.0" encoding="UTF-8"?> | 
				
			||||
 | 
					<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					<mapper namespace="com.epmet.resi.group.dto.group.ResiGroupCodeDTO"> | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    <resultMap type="com.epmet.modules.group.entity.ResiGroupCodeEntity" id="resiGroupCodeMap"> | 
				
			||||
 | 
					        <result property="id" column="ID"/> | 
				
			||||
 | 
					        <result property="customerId" column="CUSTOMER_ID"/> | 
				
			||||
 | 
					        <result property="gridId" column="GRID_ID"/> | 
				
			||||
 | 
					        <result property="groupId" column="GROUP_ID"/> | 
				
			||||
 | 
					        <result property="type" column="TYPE"/> | 
				
			||||
 | 
					        <result property="url" column="URL"/> | 
				
			||||
 | 
					        <result property="delFlag" column="DEL_FLAG"/> | 
				
			||||
 | 
					        <result property="revision" column="REVISION"/> | 
				
			||||
 | 
					        <result property="createdBy" column="CREATED_BY"/> | 
				
			||||
 | 
					        <result property="createdTime" column="CREATED_TIME"/> | 
				
			||||
 | 
					        <result property="updatedBy" column="UPDATED_BY"/> | 
				
			||||
 | 
					        <result property="updatedTime" column="UPDATED_TIME"/> | 
				
			||||
 | 
					    </resultMap> | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					</mapper> | 
				
			||||
					Loading…
					
					
				
		Reference in new issue