diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/resigroup/ResiGroupDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/resigroup/ResiGroupDTO.java index 43e46572bb..9b6288ab98 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/resigroup/ResiGroupDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/resigroup/ResiGroupDTO.java @@ -17,9 +17,10 @@ package com.epmet.dataaggre.dto.resigroup; +import lombok.Data; + import java.io.Serializable; import java.util.Date; -import lombok.Data; /** @@ -109,4 +110,8 @@ Ps: 如果一个小组被拒绝,当前小组的状态将永久停留在“审 */ private Date updatedTime; + /** + * VISIT_SWITCH 小组是否允许参观:允许:open;不允许:closed + */ + private String visitSwitch; } \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/resigroup/ResiGroupEntity.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/resigroup/ResiGroupEntity.java index a49d9506d7..7fc47655e4 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/resigroup/ResiGroupEntity.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/resigroup/ResiGroupEntity.java @@ -79,4 +79,8 @@ Ps: 如果一个小组被拒绝,当前小组的状态将永久停留在“审 */ private String auditSwitch; + /** + * VISIT_SWITCH 小组是否允许参观:允许:open;不允许:closed + */ + private String visitSwitch; } diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/GroupStateConstant.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/GroupStateConstant.java index ee3bcda420..6d93e5a010 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/GroupStateConstant.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/GroupStateConstant.java @@ -57,4 +57,6 @@ public interface GroupStateConstant { * 进组审核open开启;close关闭 */ String AUDIT_SWITCH_CLOSED = "close"; + + String CLOSED="closed"; } diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/GroupVisitConstant.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/GroupVisitConstant.java new file mode 100644 index 0000000000..ef0e2b92e7 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/GroupVisitConstant.java @@ -0,0 +1,23 @@ +package com.epmet.resi.group.constant; + +/** + * @Author zxc + * @DateTime 2021/4/7 下午1:47 + * @DESC + */ +public interface GroupVisitConstant { + + /** + * 小组是否允许参观:允许:open;不允许:closed + */ + String VISIT_SWITCH_OPEN = "open"; + String VISIT_SWITCH_CLOSED = "closed"; + + /** + * 参观模式:visit ; 已入组: in_group;未知:unknown + */ + String VISIT = "visit"; + String VISIT_IN_GROUP = "in_group"; + String VISIT_UNKNOWN = "unknown"; + +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/ResiGroupDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/ResiGroupDTO.java index be61d33c2a..b2d57ecc1d 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/ResiGroupDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/ResiGroupDTO.java @@ -17,9 +17,10 @@ package com.epmet.resi.group.dto.group; +import lombok.Data; + import java.io.Serializable; import java.util.Date; -import lombok.Data; /** @@ -79,6 +80,11 @@ Ps: 如果一个小组被拒绝,当前小组的状态将永久停留在“审 */ private String auditSwitch; + /** + * VISIT_SWITCH 小组是否允许参观:允许:open;不允许:closed + */ + private String visitSwitch; + /** * 删除标记 0:未删除,1:已删除 */ diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/ApplyCreateGroupFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/ApplyCreateGroupFormDTO.java index fd2b239ea8..69efcf295c 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/ApplyCreateGroupFormDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/ApplyCreateGroupFormDTO.java @@ -65,4 +65,8 @@ public class ApplyCreateGroupFormDTO implements Serializable { @NotBlank(message = "app不能为空") private String app; + /** + * 小组是否允许参观:允许:open;不允许:closed + */ + private String visitSwitch; } diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/ManageInitFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/ManageInitFormDTO.java new file mode 100644 index 0000000000..509f2bf6f1 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/ManageInitFormDTO.java @@ -0,0 +1,16 @@ +package com.epmet.resi.group.dto.group.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @author zhaoqifeng + * @dscription + * @date 2021/4/7 10:54 + */ +@Data +public class ManageInitFormDTO implements Serializable { + private static final long serialVersionUID = -5535489295806473761L; + private String groupId; +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/ManageInitResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/ManageInitResultDTO.java new file mode 100644 index 0000000000..36e9e2ad4c --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/ManageInitResultDTO.java @@ -0,0 +1,16 @@ +package com.epmet.resi.group.dto.group.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @author zhaoqifeng + * @dscription + * @date 2021/4/7 10:55 + */ +@Data +public class ManageInitResultDTO implements Serializable { + private static final long serialVersionUID = 2981099696943155870L; + private String visitSwitch; +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/GroupVisitRecordDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/GroupVisitRecordDTO.java new file mode 100644 index 0000000000..d896c8b5f9 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/GroupVisitRecordDTO.java @@ -0,0 +1,92 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.resi.group.dto.member; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * 小组参观记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-04-07 + */ +@Data +public class GroupVisitRecordDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键(点击参观,加入记录) + */ + private String id; + + /** + * 客户id + */ + private String customerId; + + /** + * 小组所属网格id + */ + private String gridId; + + /** + * 小组id + */ + private String groupId; + + /** + * 用户id + */ + private String userId; + + /** + * 删除标识 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 当前访问用户id + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/GroupVisitorDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/GroupVisitorDTO.java new file mode 100644 index 0000000000..2fc7cb896a --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/GroupVisitorDTO.java @@ -0,0 +1,97 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.resi.group.dto.member; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * 小组参观者记录 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-04-07 + */ +@Data +public class GroupVisitorDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 客户id + */ + private String customerId; + + /** + * 小组id + */ + private String groupId; + + /** + * 小组所属网格id + */ + private String gridId; + + /** + * 用户id + */ + private String userId; + + /** + * 最近一次访问的时间 + */ + private Date latestVisitTime; + + /** + * 删除标识 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 当前操作人id即组长id + */ + private String createdBy; + + /** + * 创建时间:第一次参观的时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/form/UserAndGroupRelFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/form/UserAndGroupRelFormDTO.java new file mode 100644 index 0000000000..a83ddd342d --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/form/UserAndGroupRelFormDTO.java @@ -0,0 +1,25 @@ +package com.epmet.resi.group.dto.member.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2021/4/7 上午11:02 + * @DESC + */ +@Data +public class UserAndGroupRelFormDTO implements Serializable { + + private static final long serialVersionUID = -8406731503470703549L; + + public interface UserAndGroupRelForm{} + + @NotBlank(message = "小组ID不能为空",groups = UserAndGroupRelForm.class) + private String groupId; + + @NotBlank(message = "tokenDto获取userId为空",groups = UserAndGroupRelForm.class) + private String userId; +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/form/VisitFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/form/VisitFormDTO.java new file mode 100644 index 0000000000..acb32c589c --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/form/VisitFormDTO.java @@ -0,0 +1,32 @@ +package com.epmet.resi.group.dto.member.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2021/4/7 上午10:49 + * @DESC + */ +@Data +public class VisitFormDTO implements Serializable { + + private static final long serialVersionUID = 3516659225931215600L; + + public interface VisitForm{} + + /** + * 小组ID + */ + @NotBlank(message = "小组ID不能为空",groups = VisitForm.class) + private String groupId; + + @NotBlank(message = "tokenDto获取userId为空",groups = VisitForm.class) + private String userId; + + @NotBlank(message = "tokenDto获取customerId为空",groups = VisitForm.class) + private String customerId; + +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/result/GroupInfoResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/result/GroupInfoResultDTO.java new file mode 100644 index 0000000000..7e9ae3eff8 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/result/GroupInfoResultDTO.java @@ -0,0 +1,20 @@ +package com.epmet.resi.group.dto.member.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2021/4/7 下午2:08 + * @DESC + */ +@Data +public class GroupInfoResultDTO implements Serializable { + + private static final long serialVersionUID = -6300305692117164080L; + + private String visitSwitch; + + private String gridId; +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/result/UserAndGroupRelResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/result/UserAndGroupRelResultDTO.java new file mode 100644 index 0000000000..e7b6ac3cc3 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/result/UserAndGroupRelResultDTO.java @@ -0,0 +1,21 @@ +package com.epmet.resi.group.dto.member.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2021/4/7 上午11:05 + * @DESC + */ +@Data +public class UserAndGroupRelResultDTO implements Serializable { + + private static final long serialVersionUID = 8162347909790178255L; + + /** + * 参观模式:visit ; 已入组: in_group;未知:unknown + */ + private String pattern; +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/result/VisitResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/result/VisitResultDTO.java new file mode 100644 index 0000000000..13563e27b5 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/result/VisitResultDTO.java @@ -0,0 +1,25 @@ +package com.epmet.resi.group.dto.member.result; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2021/4/7 上午10:52 + * @DESC + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class VisitResultDTO implements Serializable { + + private static final long serialVersionUID = -6532744066209112808L; + + /** + * 小组是否允许参观:允许:open;不允许:closed + */ + private String visitSwitch; +} diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupController.java index 569a9137b3..23ffab9d29 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupController.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupController.java @@ -477,4 +477,29 @@ public class ResiGroupController { return new Result>().ok(resiGroupService.getGroupInfo(groupIds)); } + /** + * 小组管理-界面初始化 + * @author zhaoqifeng + * @date 2021/4/7 10:56 + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + */ + @PostMapping("manageinit") + public Result manageInit(@RequestBody ManageInitFormDTO formDTO){ + return new Result().ok(resiGroupService.manageInit(formDTO)); + } + + /** + * 小组管理-设置是否允许参观 + * @author zhaoqifeng + * @date 2021/4/7 13:50 + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + */ + @PostMapping("setvisitswitch") + public Result setVisitSwitch(@RequestBody ManageInitFormDTO formDTO){ + resiGroupService.setVisitSwitch(formDTO); + return new Result(); + } + } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/ResiGroupEntity.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/ResiGroupEntity.java index 8dfa5e2db8..1c80c117eb 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/ResiGroupEntity.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/ResiGroupEntity.java @@ -79,4 +79,8 @@ Ps: 如果一个小组被拒绝,当前小组的状态将永久停留在“审 */ private String auditSwitch; + /** + * VISIT_SWITCH 小组是否允许参观:允许:open;不允许:closed + */ + private String visitSwitch; } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupService.java index 0fd92bf582..b4bccf14e9 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupService.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupService.java @@ -352,4 +352,22 @@ public interface ResiGroupService extends BaseService { * @Date 2020/11/23 10:03 **/ HashMap getGroupInfo(List groupIds); + + /** + * 小组管理-界面初始化 + * @author zhaoqifeng + * @date 2021/4/7 10:57 + * @param formDTO + * @return com.epmet.resi.group.dto.group.result.ManageInitResultDTO + */ + ManageInitResultDTO manageInit(ManageInitFormDTO formDTO); + + /** + * 小组管理-设置是否允许参观 + * @author zhaoqifeng + * @date 2021/4/7 13:50 + * @param formDTO + * @return void + */ + void setVisitSwitch(ManageInitFormDTO formDTO); } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java index 4ee54bcd43..26f1b8c746 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java @@ -517,6 +517,7 @@ public class ResiGroupServiceImpl extends BaseServiceImpl + * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.modules.member.controller; + +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.modules.member.service.GroupVisitorService; +import com.epmet.resi.group.dto.member.form.UserAndGroupRelFormDTO; +import com.epmet.resi.group.dto.member.form.VisitFormDTO; +import com.epmet.resi.group.dto.member.result.UserAndGroupRelResultDTO; +import com.epmet.resi.group.dto.member.result.VisitResultDTO; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + + +/** + * 小组参观者记录 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-04-07 + */ +@RestController +@RequestMapping("groupvisitor") +public class GroupVisitorController { + + @Autowired + private GroupVisitorService groupVisitorService; + + /** + * @Description 参观小组(记录日志) + * 推荐小组界面,点击参观按钮,调用此接口 如果开关开启的情况下,需要记录到 + * @Param formDTO + * @Param tokenDto + * @author zxc + * @date 2021/4/7 上午10:57 + */ + @PostMapping("visit") + public Result visit(@RequestBody VisitFormDTO formDTO, @LoginUser TokenDto tokenDto) { + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setUserId(tokenDto.getUserId()); + ValidatorUtils.validateEntity(formDTO, VisitFormDTO.VisitForm.class); + return new Result().ok(groupVisitorService.visit(formDTO)); + } + + /** + * @Description 获取当前在组模式(发话题、分享、评论时调用) + * 发表话题、评论话题、分享话题按下,先调用此接口 + * @Param formDTO + * @author zxc + * @date 2021/4/7 上午11:09 + */ + @PostMapping("userandgrouprel") + public Result userAndGroupRel(@RequestBody UserAndGroupRelFormDTO formDTO,@LoginUser TokenDto tokenDto){ + formDTO.setUserId(tokenDto.getUserId()); + ValidatorUtils.validateEntity(formDTO, UserAndGroupRelFormDTO.UserAndGroupRelForm.class); + return new Result().ok(groupVisitorService.userAndGroupRel(formDTO)); + } + + +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/dao/GroupVisitRecordDao.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/dao/GroupVisitRecordDao.java new file mode 100644 index 0000000000..729e885b7e --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/dao/GroupVisitRecordDao.java @@ -0,0 +1,33 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.modules.member.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.modules.member.entity.GroupVisitRecordEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 小组参观记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-04-07 + */ +@Mapper +public interface GroupVisitRecordDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/dao/GroupVisitorDao.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/dao/GroupVisitorDao.java new file mode 100644 index 0000000000..b3576877c9 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/dao/GroupVisitorDao.java @@ -0,0 +1,61 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.modules.member.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.modules.member.entity.GroupVisitorEntity; +import com.epmet.resi.group.dto.member.result.GroupInfoResultDTO; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +/** + * 小组参观者记录 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-04-07 + */ +@Mapper +public interface GroupVisitorDao extends BaseDao { + + /** + * @Description 查询小组是否允许参观:允许:open;不允许:closed + * @Param groupId + * @author zxc + * @date 2021/4/7 下午1:44 + */ + GroupInfoResultDTO selectVisitSwitch(@Param("groupId")String groupId); + + /** + * @Description 查询用户是否访问过此小组 + * @Param userId + * @Param groupId + * @author zxc + * @date 2021/4/7 下午2:02 + */ + Integer selectVisitCount(@Param("userId")String userId,@Param("groupId")String groupId); + + /** + * @Description 更新最后一次访问时间 + * @Param userId + * @Param groupId + * @author zxc + * @date 2021/4/7 下午2:13 + */ + void updateLatestTime(@Param("userId")String userId,@Param("groupId")String groupId); + +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/entity/GroupVisitRecordEntity.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/entity/GroupVisitRecordEntity.java new file mode 100644 index 0000000000..b4ebd7869f --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/entity/GroupVisitRecordEntity.java @@ -0,0 +1,58 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.modules.member.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 小组参观记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-04-07 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("group_visit_record") +public class GroupVisitRecordEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户id + */ + private String customerId; + + /** + * 小组所属网格id + */ + private String gridId; + + /** + * 小组id + */ + private String groupId; + + /** + * 用户id + */ + private String userId; + +} diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/entity/GroupVisitorEntity.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/entity/GroupVisitorEntity.java new file mode 100644 index 0000000000..0f72355c82 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/entity/GroupVisitorEntity.java @@ -0,0 +1,66 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.modules.member.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 generator generator@elink-cn.com + * @since v1.0.0 2021-04-07 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("group_visitor") +public class GroupVisitorEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户id + */ + private String customerId; + + /** + * 小组id + */ + private String groupId; + + /** + * 小组所属网格id + */ + private String gridId; + + /** + * 用户id + */ + private String userId; + + /** + * 最近一次访问的时间 + */ + private Date latestVisitTime; + +} diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/GroupVisitRecordService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/GroupVisitRecordService.java new file mode 100644 index 0000000000..5a1b54156c --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/GroupVisitRecordService.java @@ -0,0 +1,85 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.modules.member.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.modules.member.entity.GroupVisitRecordEntity; +import com.epmet.resi.group.dto.member.GroupVisitRecordDTO; + +import java.util.List; +import java.util.Map; + +/** + * 小组参观记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-04-07 + */ +public interface GroupVisitRecordService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2021-04-07 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2021-04-07 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return GroupVisitRecordDTO + * @author generator + * @date 2021-04-07 + */ + GroupVisitRecordDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2021-04-07 + */ + void save(GroupVisitRecordDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2021-04-07 + */ + void update(GroupVisitRecordDTO dto); +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/GroupVisitorService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/GroupVisitorService.java new file mode 100644 index 0000000000..0f6f8c4754 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/GroupVisitorService.java @@ -0,0 +1,107 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.modules.member.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.modules.member.entity.GroupVisitorEntity; +import com.epmet.resi.group.dto.member.GroupVisitorDTO; +import com.epmet.resi.group.dto.member.form.UserAndGroupRelFormDTO; +import com.epmet.resi.group.dto.member.form.VisitFormDTO; +import com.epmet.resi.group.dto.member.result.UserAndGroupRelResultDTO; +import com.epmet.resi.group.dto.member.result.VisitResultDTO; + +import java.util.List; +import java.util.Map; + +/** + * 小组参观者记录 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-04-07 + */ +public interface GroupVisitorService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2021-04-07 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2021-04-07 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return GroupVisitorDTO + * @author generator + * @date 2021-04-07 + */ + GroupVisitorDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2021-04-07 + */ + void save(GroupVisitorDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2021-04-07 + */ + void update(GroupVisitorDTO dto); + + /** + * @Description 参观小组(记录日志) + * 推荐小组界面,点击参观按钮,调用此接口 如果开关开启的情况下,需要记录到 + * @Param formDTO + * @author zxc + * @date 2021/4/7 上午10:58 + */ + VisitResultDTO visit( VisitFormDTO formDTO); + + /** + * @Description 获取当前在组模式(发话题、分享、评论时调用) + * 发表话题、评论话题、分享话题按下,先调用此接口 + * @Param formDTO + * @author zxc + * @date 2021/4/7 上午11:09 + */ + UserAndGroupRelResultDTO userAndGroupRel(UserAndGroupRelFormDTO formDTO); +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/GroupVisitRecordServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/GroupVisitRecordServiceImpl.java new file mode 100644 index 0000000000..88bb0b5778 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/GroupVisitRecordServiceImpl.java @@ -0,0 +1,92 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.modules.member.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.modules.member.dao.GroupVisitRecordDao; +import com.epmet.modules.member.entity.GroupVisitRecordEntity; +import com.epmet.modules.member.service.GroupVisitRecordService; +import com.epmet.resi.group.dto.member.GroupVisitRecordDTO; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; +import java.util.Map; + +/** + * 小组参观记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-04-07 + */ +@Service +public class GroupVisitRecordServiceImpl extends BaseServiceImpl implements GroupVisitRecordService { + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, GroupVisitRecordDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, GroupVisitRecordDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public GroupVisitRecordDTO get(String id) { + GroupVisitRecordEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, GroupVisitRecordDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(GroupVisitRecordDTO dto) { + GroupVisitRecordEntity entity = ConvertUtils.sourceToTarget(dto, GroupVisitRecordEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(GroupVisitRecordDTO dto) { + GroupVisitRecordEntity entity = ConvertUtils.sourceToTarget(dto, GroupVisitRecordEntity.class); + updateById(entity); + } + + +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/GroupVisitorServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/GroupVisitorServiceImpl.java new file mode 100644 index 0000000000..b22a79fd21 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/GroupVisitorServiceImpl.java @@ -0,0 +1,179 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.modules.member.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +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.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.modules.group.service.ResiGroupService; +import com.epmet.modules.member.dao.GroupVisitRecordDao; +import com.epmet.modules.member.dao.GroupVisitorDao; +import com.epmet.modules.member.entity.GroupVisitRecordEntity; +import com.epmet.modules.member.entity.GroupVisitorEntity; +import com.epmet.modules.member.service.GroupVisitorService; +import com.epmet.modules.member.service.ResiGroupMemberService; +import com.epmet.resi.group.constant.GroupVisitConstant; +import com.epmet.resi.group.dto.group.ResiGroupDTO; +import com.epmet.resi.group.dto.member.GroupVisitorDTO; +import com.epmet.resi.group.dto.member.ResiGroupMemberDTO; +import com.epmet.resi.group.dto.member.form.UserAndGroupRelFormDTO; +import com.epmet.resi.group.dto.member.form.VisitFormDTO; +import com.epmet.resi.group.dto.member.result.GroupInfoResultDTO; +import com.epmet.resi.group.dto.member.result.UserAndGroupRelResultDTO; +import com.epmet.resi.group.dto.member.result.VisitResultDTO; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Date; +import java.util.List; +import java.util.Map; + +/** + * 小组参观者记录 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-04-07 + */ +@Service +public class GroupVisitorServiceImpl extends BaseServiceImpl implements GroupVisitorService { + + @Autowired + private GroupVisitRecordDao groupVisitRecordDao; + @Autowired + private ResiGroupService resiGroupService; + @Autowired + private ResiGroupMemberService resiGroupMemberService; + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, GroupVisitorDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, GroupVisitorDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public GroupVisitorDTO get(String id) { + GroupVisitorEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, GroupVisitorDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(GroupVisitorDTO dto) { + GroupVisitorEntity entity = ConvertUtils.sourceToTarget(dto, GroupVisitorEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(GroupVisitorDTO dto) { + GroupVisitorEntity entity = ConvertUtils.sourceToTarget(dto, GroupVisitorEntity.class); + updateById(entity); + } + + /** + * @Description 参观小组(记录日志) + * 推荐小组界面,点击参观按钮,调用此接口 如果开关开启的情况下,需要记录到 + * @Param formDTO + * @author zxc + * @date 2021/4/7 上午10:58 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public VisitResultDTO visit(VisitFormDTO formDTO) { + // 查询小组是否允许参观,open:允许,closed:不允许 + GroupInfoResultDTO visitSwitch = baseDao.selectVisitSwitch(formDTO.getGroupId()); + if (null == visitSwitch || (null != visitSwitch && StringUtils.isNotEmpty(visitSwitch.getVisitSwitch()) && visitSwitch.equals(GroupVisitConstant.VISIT_SWITCH_CLOSED))){ + return new VisitResultDTO(visitSwitch.getVisitSwitch()); + } + Integer visitCount = baseDao.selectVisitCount(formDTO.getUserId(), formDTO.getGroupId()); + if (visitCount > NumConstant.ZERO){ + // 已存在记录,更新最近一次访问时间 + baseDao.updateLatestTime(formDTO.getUserId(),formDTO.getGroupId()); + }else { + // 插入一条新纪录 + GroupVisitorEntity entity = new GroupVisitorEntity(); + entity.setLatestVisitTime(new Date()); + entity.setCustomerId(formDTO.getCustomerId()); + entity.setGridId(visitSwitch.getGridId()); + entity.setGroupId(formDTO.getGroupId()); + entity.setUserId(formDTO.getUserId()); + baseDao.insert(entity); + } + GroupVisitRecordEntity groupVisitRecordEntity = new GroupVisitRecordEntity(); + groupVisitRecordEntity.setCustomerId(formDTO.getCustomerId()); + groupVisitRecordEntity.setGridId(visitSwitch.getGridId()); + groupVisitRecordEntity.setGroupId(formDTO.getGroupId()); + groupVisitRecordEntity.setUserId(formDTO.getUserId()); + groupVisitRecordDao.insert(groupVisitRecordEntity); + return new VisitResultDTO(visitSwitch.getVisitSwitch()); + } + + /** + * @Description 获取当前在组模式(发话题、分享、评论时调用) + * 发表话题、评论话题、分享话题按下,先调用此接口 + * @Param formDTO + * @author zxc + * @date 2021/4/7 上午11:09 + */ + @Override + public UserAndGroupRelResultDTO userAndGroupRel(UserAndGroupRelFormDTO formDTO) { + ResiGroupDTO resiGroupDTO = resiGroupService.get(formDTO.getGroupId()); + if (null == resiGroupDTO) { + throw new RenException(EpmetErrorCode.GROUP_NOT_EXISTS.getCode(), EpmetErrorCode.GROUP_NOT_EXISTS.getMsg()); + } + UserAndGroupRelResultDTO result = new UserAndGroupRelResultDTO(); + result.setPattern(GroupVisitConstant.VISIT_UNKNOWN); + ResiGroupMemberDTO resiGroupMemberDTO = resiGroupMemberService.getResiGroupMember(formDTO.getGroupId(), formDTO.getUserId()); + if (null != resiGroupMemberDTO) { + result.setPattern(GroupVisitConstant.VISIT_IN_GROUP); + } else { + if (baseDao.selectVisitCount(formDTO.getUserId(), formDTO.getGroupId()) > NumConstant.ZERO) { + result.setPattern(GroupVisitConstant.VISIT); + } + } + return result; + } + + +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.14__visit_group.sql b/epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.14__visit_group.sql new file mode 100644 index 0000000000..3cfae6815c --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.14__visit_group.sql @@ -0,0 +1,36 @@ +DROP TABLE IF EXISTS `group_visitor`; +CREATE TABLE `group_visitor` ( + `ID` varchar(64) NOT NULL COMMENT '主键', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户id', + `GROUP_ID` varchar(64) NOT NULL COMMENT '小组id', + `GRID_ID` varchar(64) NOT NULL COMMENT '小组所属网格id', + `USER_ID` varchar(64) NOT NULL COMMENT '用户id', + `LATEST_VISIT_TIME` datetime NOT NULL COMMENT '最近一次访问的时间', + `DEL_FLAG` varchar(1) NOT NULL DEFAULT '0' COMMENT '删除标识', + `REVISION` int(11) NOT NULL DEFAULT '0' COMMENT '乐观锁', + `CREATED_BY` varchar(64) NOT NULL COMMENT '当前操作人id即组长id', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间:第一次参观的时间', + `UPDATED_BY` varchar(64) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='小组参观者记录'; + +DROP TABLE IF EXISTS `group_visit_record`; +CREATE TABLE `group_visit_record` ( + `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', + `USER_ID` varchar(64) NOT NULL COMMENT '用户id', + `DEL_FLAG` varchar(1) NOT NULL DEFAULT '0' COMMENT '删除标识', + `REVISION` int(11) NOT NULL DEFAULT '0' COMMENT '乐观锁', + `CREATED_BY` varchar(64) NOT NULL COMMENT '当前访问用户id', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(64) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='小组参观记录表'; + + +alter table resi_group add COLUMN VISIT_SWITCH VARCHAR(6) +NOT NULL DEFAULT 'closed' comment '小组是否允许参观:允许:open;不允许:closed' AFTER AUDIT_SWITCH; \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/member/GroupVisitRecordDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/member/GroupVisitRecordDao.xml new file mode 100644 index 0000000000..f4b395b5a5 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/member/GroupVisitRecordDao.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/member/GroupVisitorDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/member/GroupVisitorDao.xml new file mode 100644 index 0000000000..ef77eeb936 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/member/GroupVisitorDao.xml @@ -0,0 +1,35 @@ + + + + + + + + UPDATE group_visitor + SET latest_visit_time = NOW(),UPDATED_TIME=NOW() + WHERE DEL_FLAG = '0' + AND GROUP_ID = #{groupId} + AND user_id = #{userId} + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/member/ResiGroupMemberDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/member/ResiGroupMemberDao.xml index 183de49bad..620bac3066 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/member/ResiGroupMemberDao.xml +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/member/ResiGroupMemberDao.xml @@ -162,7 +162,7 @@ WHERE DEL_FLAG = '0' AND CUSTOMER_USER_ID = #{userId} AND RESI_GROUP_ID = #{groupId} - AND `STATUS` = 'approved' + AND `STATUS` != 'removed'