32 changed files with 1317 additions and 3 deletions
@ -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"; |
||||
|
|
||||
|
} |
||||
@ -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; |
||||
|
} |
||||
@ -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; |
||||
|
} |
||||
@ -0,0 +1,92 @@ |
|||||
|
/** |
||||
|
* 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.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; |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,97 @@ |
|||||
|
/** |
||||
|
* 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.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; |
||||
|
|
||||
|
} |
||||
@ -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; |
||||
|
} |
||||
@ -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; |
||||
|
|
||||
|
} |
||||
@ -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; |
||||
|
} |
||||
@ -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; |
||||
|
} |
||||
@ -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; |
||||
|
} |
||||
@ -0,0 +1,80 @@ |
|||||
|
/** |
||||
|
* 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.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<VisitResultDTO> visit(@RequestBody VisitFormDTO formDTO, @LoginUser TokenDto tokenDto) { |
||||
|
formDTO.setCustomerId(tokenDto.getCustomerId()); |
||||
|
formDTO.setUserId(tokenDto.getUserId()); |
||||
|
ValidatorUtils.validateEntity(formDTO, VisitFormDTO.VisitForm.class); |
||||
|
return new Result<VisitResultDTO>().ok(groupVisitorService.visit(formDTO)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @Description 获取当前在组模式(发话题、分享、评论时调用) |
||||
|
* 发表话题、评论话题、分享话题按下,先调用此接口 |
||||
|
* @Param formDTO |
||||
|
* @author zxc |
||||
|
* @date 2021/4/7 上午11:09 |
||||
|
*/ |
||||
|
@PostMapping("userandgrouprel") |
||||
|
public Result<UserAndGroupRelResultDTO> userAndGroupRel(@RequestBody UserAndGroupRelFormDTO formDTO,@LoginUser TokenDto tokenDto){ |
||||
|
formDTO.setUserId(tokenDto.getUserId()); |
||||
|
ValidatorUtils.validateEntity(formDTO, UserAndGroupRelFormDTO.UserAndGroupRelForm.class); |
||||
|
return new Result<UserAndGroupRelResultDTO>().ok(groupVisitorService.userAndGroupRel(formDTO)); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
||||
@ -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.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<GroupVisitRecordEntity> { |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,61 @@ |
|||||
|
/** |
||||
|
* 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.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<GroupVisitorEntity> { |
||||
|
|
||||
|
/** |
||||
|
* @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); |
||||
|
|
||||
|
} |
||||
@ -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.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; |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,66 @@ |
|||||
|
/** |
||||
|
* 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.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; |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,85 @@ |
|||||
|
/** |
||||
|
* 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.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<GroupVisitRecordEntity> { |
||||
|
|
||||
|
/** |
||||
|
* 默认分页 |
||||
|
* |
||||
|
* @param params |
||||
|
* @return PageData<GroupVisitRecordDTO> |
||||
|
* @author generator |
||||
|
* @date 2021-04-07 |
||||
|
*/ |
||||
|
PageData<GroupVisitRecordDTO> page(Map<String, Object> params); |
||||
|
|
||||
|
/** |
||||
|
* 默认查询 |
||||
|
* |
||||
|
* @param params |
||||
|
* @return java.util.List<GroupVisitRecordDTO> |
||||
|
* @author generator |
||||
|
* @date 2021-04-07 |
||||
|
*/ |
||||
|
List<GroupVisitRecordDTO> list(Map<String, Object> 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); |
||||
|
} |
||||
@ -0,0 +1,107 @@ |
|||||
|
/** |
||||
|
* 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.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<GroupVisitorEntity> { |
||||
|
|
||||
|
/** |
||||
|
* 默认分页 |
||||
|
* |
||||
|
* @param params |
||||
|
* @return PageData<GroupVisitorDTO> |
||||
|
* @author generator |
||||
|
* @date 2021-04-07 |
||||
|
*/ |
||||
|
PageData<GroupVisitorDTO> page(Map<String, Object> params); |
||||
|
|
||||
|
/** |
||||
|
* 默认查询 |
||||
|
* |
||||
|
* @param params |
||||
|
* @return java.util.List<GroupVisitorDTO> |
||||
|
* @author generator |
||||
|
* @date 2021-04-07 |
||||
|
*/ |
||||
|
List<GroupVisitorDTO> list(Map<String, Object> 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); |
||||
|
} |
||||
@ -0,0 +1,92 @@ |
|||||
|
/** |
||||
|
* 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.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<GroupVisitRecordDao, GroupVisitRecordEntity> implements GroupVisitRecordService { |
||||
|
|
||||
|
@Override |
||||
|
public PageData<GroupVisitRecordDTO> page(Map<String, Object> params) { |
||||
|
IPage<GroupVisitRecordEntity> page = baseDao.selectPage( |
||||
|
getPage(params, FieldConstant.CREATED_TIME, false), |
||||
|
getWrapper(params) |
||||
|
); |
||||
|
return getPageData(page, GroupVisitRecordDTO.class); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<GroupVisitRecordDTO> list(Map<String, Object> params) { |
||||
|
List<GroupVisitRecordEntity> entityList = baseDao.selectList(getWrapper(params)); |
||||
|
|
||||
|
return ConvertUtils.sourceToTarget(entityList, GroupVisitRecordDTO.class); |
||||
|
} |
||||
|
|
||||
|
private QueryWrapper<GroupVisitRecordEntity> getWrapper(Map<String, Object> params){ |
||||
|
String id = (String)params.get(FieldConstant.ID_HUMP); |
||||
|
|
||||
|
QueryWrapper<GroupVisitRecordEntity> 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); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,179 @@ |
|||||
|
/** |
||||
|
* 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.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<GroupVisitorDao, GroupVisitorEntity> implements GroupVisitorService { |
||||
|
|
||||
|
@Autowired |
||||
|
private GroupVisitRecordDao groupVisitRecordDao; |
||||
|
@Autowired |
||||
|
private ResiGroupService resiGroupService; |
||||
|
@Autowired |
||||
|
private ResiGroupMemberService resiGroupMemberService; |
||||
|
@Override |
||||
|
public PageData<GroupVisitorDTO> page(Map<String, Object> params) { |
||||
|
IPage<GroupVisitorEntity> page = baseDao.selectPage( |
||||
|
getPage(params, FieldConstant.CREATED_TIME, false), |
||||
|
getWrapper(params) |
||||
|
); |
||||
|
return getPageData(page, GroupVisitorDTO.class); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<GroupVisitorDTO> list(Map<String, Object> params) { |
||||
|
List<GroupVisitorEntity> entityList = baseDao.selectList(getWrapper(params)); |
||||
|
|
||||
|
return ConvertUtils.sourceToTarget(entityList, GroupVisitorDTO.class); |
||||
|
} |
||||
|
|
||||
|
private QueryWrapper<GroupVisitorEntity> getWrapper(Map<String, Object> params){ |
||||
|
String id = (String)params.get(FieldConstant.ID_HUMP); |
||||
|
|
||||
|
QueryWrapper<GroupVisitorEntity> 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; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
||||
@ -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; |
||||
@ -0,0 +1,8 @@ |
|||||
|
<?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.modules.member.dao.GroupVisitRecordDao"> |
||||
|
|
||||
|
|
||||
|
|
||||
|
</mapper> |
||||
@ -0,0 +1,35 @@ |
|||||
|
<?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.modules.member.dao.GroupVisitorDao"> |
||||
|
|
||||
|
<!-- 更新最后一次访问时间 --> |
||||
|
<update id="updateLatestTime"> |
||||
|
UPDATE group_visitor |
||||
|
SET latest_visit_time = NOW(),UPDATED_TIME=NOW() |
||||
|
WHERE DEL_FLAG = '0' |
||||
|
AND GROUP_ID = #{groupId} |
||||
|
AND user_id = #{userId} |
||||
|
</update> |
||||
|
|
||||
|
<!-- 查询小组是否允许参观:允许:open;不允许:closed --> |
||||
|
<select id="selectVisitSwitch" resultType="com.epmet.resi.group.dto.member.result.GroupInfoResultDTO"> |
||||
|
SELECT |
||||
|
visit_switch, |
||||
|
grid_id |
||||
|
FROM resi_group |
||||
|
WHERE DEL_FLAG = '0' |
||||
|
AND ID = #{groupId} |
||||
|
</select> |
||||
|
|
||||
|
<!-- 查询用户是否访问过此小组 --> |
||||
|
<select id="selectVisitCount" resultType="java.lang.Integer"> |
||||
|
SELECT |
||||
|
COUNT(ID) |
||||
|
FROM group_visitor |
||||
|
WHERE DEL_FLAG = '0' |
||||
|
AND GROUP_ID = #{groupId} |
||||
|
AND user_id = #{userId} |
||||
|
</select> |
||||
|
|
||||
|
</mapper> |
||||
Loading…
Reference in new issue