From fb203f736cb253ffb6cc868602e36d2681532ac9 Mon Sep 17 00:00:00 2001 From: zhangyongzhangyong <2012005003@qq.coom> Date: Thu, 23 Jul 2020 13:51:26 +0800 Subject: [PATCH] =?UTF-8?q?=E7=88=B1=E5=BF=83=E4=BA=92=E5=8A=A9-=E5=B1=85?= =?UTF-8?q?=E6=B0=91=E7=AB=AF=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../form/resi/ResiActInsertLiveFormDTO.java | 93 +++++++++++++ .../dto/form/resi/ResiActSignInFormDTO.java | 100 ++++++++++++++ .../ResiVolunteerAuthenticateFormDTO.java | 106 +++++++++++++++ .../controller/ResiActListController.java | 31 +++++ .../controller/ResiVolunteerController.java | 18 ++- .../com/epmet/dao/ActUserRelationDao.java | 4 +- .../com/epmet/service/ActLiveRecService.java | 75 +++-------- .../epmet/service/ActSignInRecService.java | 71 ++-------- .../epmet/service/VolunteerInfoService.java | 71 ++-------- .../service/impl/ActLiveRecServiceImpl.java | 93 +++++-------- .../service/impl/ActSignInRecServiceImpl.java | 124 ++++++++++-------- .../impl/ActUserRelationServiceImpl.java | 4 +- .../impl/VolunteerInfoServiceImpl.java | 66 +++------- .../utils/ActUserRelationStatusConstant.java | 5 + .../resources/mapper/ActUserRelationDao.xml | 19 ++- 15 files changed, 530 insertions(+), 350 deletions(-) create mode 100644 epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActInsertLiveFormDTO.java create mode 100644 epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActSignInFormDTO.java create mode 100644 epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiVolunteerAuthenticateFormDTO.java diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActInsertLiveFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActInsertLiveFormDTO.java new file mode 100644 index 0000000000..d84b3b4698 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActInsertLiveFormDTO.java @@ -0,0 +1,93 @@ +/** + * 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.dto.form.resi; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; + +/** + * 活动-添加实况 入参 + * + * @author zhangyong + * @since v1.0.0 2020-07-23 + */ +@Data +public class ResiActInsertLiveFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + //>>>>>>>>>>>>>>>>>校验分组开始>>>>>>>>>>>>>>>>>>>>> + /** + * 添加用户操作的内部异常分组 + * 出现错误会提示给前端7000错误码,返回信息为:服务器开小差... + */ + public interface AddUserInternalGroup {} + + /** + * 添加用户操作的用户可见异常分组 + * 该分组用于校验需要返回给前端错误信息提示的列,需要继承CustomerClientShowGroup + * 返回错误码为8999,提示信息为DTO中具体的列的校验注解message的内容 + */ + public interface AddUserShowGroup extends CustomerClientShowGroup {} + + // <<<<<<<<<<<<<<<<<<<校验分组结束<<<<<<<<<<<<<<<<<<<<<<<< + + /** + * 活动ID + */ + @NotBlank(message = "活动ID不能为空", groups = { AddUserInternalGroup.class }) + private String actId; + + /** + * 活动签到描述 + */ + private String desc; + + /** + * 活动签到位置经度 + */ + @NotBlank(message = "活动签到位置经度不能为空", groups = { AddUserInternalGroup.class }) + private BigDecimal longitude; + + /** + * 活动签到位置纬度 + */ + @NotBlank(message = "活动签到位置纬度不能为空", groups = { AddUserInternalGroup.class }) + private BigDecimal latitude; + + /** + * 活动签到地址 + */ + @NotBlank(message = "活动签到地址不能为空", groups = { AddUserInternalGroup.class, AddUserShowGroup.class}) + private String address; + + /** + * 图片 + */ + private List images; + + /** + * 用户id + */ + private String userId; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActSignInFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActSignInFormDTO.java new file mode 100644 index 0000000000..a587969ca2 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActSignInFormDTO.java @@ -0,0 +1,100 @@ +/** + * 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.dto.form.resi; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.awt.*; +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; + +/** + * 活动签到 入参 + * + * @author zhangyong + * @since v1.0.0 2020-07-23 + */ +@Data +public class ResiActSignInFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + //>>>>>>>>>>>>>>>>>校验分组开始>>>>>>>>>>>>>>>>>>>>> + /** + * 添加用户操作的内部异常分组 + * 出现错误会提示给前端7000错误码,返回信息为:服务器开小差... + */ + public interface AddUserInternalGroup {} + + /** + * 添加用户操作的用户可见异常分组 + * 该分组用于校验需要返回给前端错误信息提示的列,需要继承CustomerClientShowGroup + * 返回错误码为8999,提示信息为DTO中具体的列的校验注解message的内容 + */ + public interface AddUserShowGroup extends CustomerClientShowGroup {} + + // <<<<<<<<<<<<<<<<<<<校验分组结束<<<<<<<<<<<<<<<<<<<<<<<< + + /** + * 活动ID + */ + @NotBlank(message = "活动ID不能为空", groups = { AddUserInternalGroup.class }) + private String actId; + + /** + * 活动签到描述 + */ + private String desc; + + /** + * 活动签到位置经度 + */ + @NotBlank(message = "活动签到位置经度不能为空", groups = { AddUserInternalGroup.class }) + private BigDecimal longitude; + + /** + * 活动签到位置纬度 + */ + @NotBlank(message = "活动签到位置纬度不能为空", groups = { AddUserInternalGroup.class }) + private BigDecimal latitude; + + /** + * 活动签到地址 + */ + @NotBlank(message = "活动签到地址不能为空", groups = { AddUserInternalGroup.class, AddUserShowGroup.class}) + private String address; + + /** + * 图片 + */ + private List images; + + /** + * 0不同步实况1同步到实况记录 + */ + @NotBlank(message = "是否同步到实况记录不能为空", groups = { AddUserInternalGroup.class, AddUserShowGroup.class}) + private Integer syncLive; + + /** + * 用户id + */ + private String userId; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiVolunteerAuthenticateFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiVolunteerAuthenticateFormDTO.java new file mode 100644 index 0000000000..26b8591599 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiVolunteerAuthenticateFormDTO.java @@ -0,0 +1,106 @@ +package com.epmet.dto.form.resi; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 志愿者认证 入参 + * + * @Auther: zhangyong + * @Date: 2020-07-23 09:57 + */ + +@Data +public class ResiVolunteerAuthenticateFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + //>>>>>>>>>>>>>>>>>校验分组开始>>>>>>>>>>>>>>>>>>>>> + /** + * 添加用户操作的内部异常分组 + * 出现错误会提示给前端7000错误码,返回信息为:服务器开小差... + */ + public interface AddUserInternalGroup {} + + /** + * 添加用户操作的用户可见异常分组 + * 该分组用于校验需要返回给前端错误信息提示的列,需要继承CustomerClientShowGroup + * 返回错误码为8999,提示信息为DTO中具体的列的校验注解message的内容 + */ + public interface AddUserShowGroup extends CustomerClientShowGroup {} + + // <<<<<<<<<<<<<<<<<<<校验分组结束<<<<<<<<<<<<<<<<<<<<<<<< + + /** + * 姓 + */ + @NotBlank(message = "姓不能为空", groups = {AddUserInternalGroup.class, AddUserShowGroup.class }) + private String surname; + + /** + * 名 + */ + @NotBlank(message = "名不能为空", groups = {AddUserInternalGroup.class, AddUserShowGroup.class }) + private String name; + + /** + * 性别(1男2女0未知) + */ + @NotBlank(message = "性别不能为空", groups = {AddUserInternalGroup.class, AddUserShowGroup.class }) + private String gender; + + /** + * 手机号 + */ + @NotBlank(message = "手机号不能为空", groups = {AddUserInternalGroup.class, AddUserShowGroup.class }) + private String mobile; + + /** + * 身份证号码 + */ + @NotBlank(message = "身份证号码不能为空", groups = {AddUserInternalGroup.class, AddUserShowGroup.class }) + private String idNum; + + /** + * 街道 + */ + @NotBlank(message = "街道不能为空", groups = {AddUserInternalGroup.class, AddUserShowGroup.class }) + private String street; + + /** + * 小区名 + */ + @NotBlank(message = "小区名不能为空", groups = {AddUserInternalGroup.class, AddUserShowGroup.class }) + private String district; + + /** + * 楼栋单元 + */ + @NotBlank(message = "楼栋单元不能为空", groups = {AddUserInternalGroup.class, AddUserShowGroup.class }) + private String buildingAddress; + + /** + * 志愿者自我介绍 + */ + private String volunteerIntroduce; + + /** + * 昵称 + */ + @NotBlank(message = "昵称不能为空", groups = {AddUserInternalGroup.class, AddUserShowGroup.class }) + private String nickname; + + /** + * 头像 + */ + @NotBlank(message = "头像不能为空", groups = {AddUserInternalGroup.class, AddUserShowGroup.class }) + private String headImgUrl; + + /** + * 志愿者签名 + */ + private String volunteerSignature; +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiActListController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiActListController.java index 478bcfaa58..7231d7132a 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiActListController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiActListController.java @@ -37,6 +37,9 @@ public class ResiActListController { @Autowired private HeartUserInfoService heartUserInfoService; + @Autowired + private ActSignInRecService actSignInRecService; + /** * 活动列表(包含状态:报名中:signing_up;已报满:enough;截止报名: end_sign_up; 已开始: in_progress; 已结束:finished;) * @@ -251,4 +254,32 @@ public class ResiActListController { return heartUserInfoService.leaderboard(formDTO); } + /** + * 活动-添加实况 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 10:29 2020-07-23 + **/ + @PostMapping("insertlive") + public Result inSertlive(@LoginUser TokenDto tokenDto, @RequestBody ResiActInsertLiveFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + return actLiveRecService.inSertlive(tokenDto, formDTO); + } + + /** + * 活动-签到 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 10:29 2020-07-23 + **/ + @PostMapping("signin") + public Result actSignIn(@LoginUser TokenDto tokenDto, @RequestBody ResiActSignInFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + return actSignInRecService.actSignIn(tokenDto, formDTO); + } + } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiVolunteerController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiVolunteerController.java index 8d3508fce6..f93e0da287 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiVolunteerController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiVolunteerController.java @@ -17,8 +17,16 @@ package com.epmet.controller; -import com.epmet.dao.VolunteerInfoDao; +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.dto.form.resi.ResiActUserCancelSignUpFormDTO; +import com.epmet.dto.form.resi.ResiVolunteerAuthenticateFormDTO; +import com.epmet.service.VolunteerInfoService; 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; @@ -34,7 +42,11 @@ import org.springframework.web.bind.annotation.RestController; public class ResiVolunteerController { @Autowired - private VolunteerInfoDao volunteerInfoDao; - + private VolunteerInfoService volunteerInfoService; + @PostMapping("authenticate") + public Result authenticate(@LoginUser TokenDto tokenDto, @RequestBody ResiVolunteerAuthenticateFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + return volunteerInfoService.authenticate(tokenDto, formDTO); + } } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserRelationDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserRelationDao.java index ccc5981b5a..1f21cd951a 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserRelationDao.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserRelationDao.java @@ -73,12 +73,12 @@ public interface ActUserRelationDao extends BaseDao { Integer selectActSignupNum(@Param("actId") String actId); /** - * 将用户与活动的状态修改为 已取消 + * 根据用户id和活动id,修改 用户活动关系表 * * @param userRelationDTO * @return void * @Author zhangyong * @Date 14:39 2020-07-22 **/ - void updateUserStatusToCanceld(ActUserRelationDTO userRelationDTO); + void updateUserRelationByActIdAndUserId(ActUserRelationDTO userRelationDTO); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActLiveRecService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActLiveRecService.java index a0b32263c4..4185eedf75 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActLiveRecService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActLiveRecService.java @@ -19,9 +19,12 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.ActLiveRecDTO; import com.epmet.dto.form.resi.ResiActContentFormDTO; +import com.epmet.dto.form.resi.ResiActInsertLiveFormDTO; +import com.epmet.dto.form.resi.ResiActSignInFormDTO; import com.epmet.dto.result.resi.ResiActLiveRecResultDTO; import com.epmet.entity.ActLiveRecEntity; @@ -36,66 +39,6 @@ import java.util.Map; */ public interface ActLiveRecService extends BaseService { - /** - * 默认分页 - * - * @param params - * @return PageData - * @author generator - * @date 2020-07-19 - */ - PageData page(Map params); - - /** - * 默认查询 - * - * @param params - * @return java.util.List - * @author generator - * @date 2020-07-19 - */ - List list(Map params); - - /** - * 单条查询 - * - * @param id - * @return ActLiveRecDTO - * @author generator - * @date 2020-07-19 - */ - ActLiveRecDTO get(String id); - - /** - * 默认保存 - * - * @param dto - * @return void - * @author generator - * @date 2020-07-19 - */ - void save(ActLiveRecDTO dto); - - /** - * 默认更新 - * - * @param dto - * @return void - * @author generator - * @date 2020-07-19 - */ - void update(ActLiveRecDTO dto); - - /** - * 批量删除 - * - * @param ids - * @return void - * @author generator - * @date 2020-07-19 - */ - void delete(String[] ids); - /** * 活动详情-已结束-现场实况列表 * @@ -105,4 +48,16 @@ public interface ActLiveRecService extends BaseService { * @Date 13:39 2020-07-21 **/ Result liveRecList(String actId); + + /** + * 活动-添加实况 + * 返回实况id,主要是因为,当签到并转发实况时,表中需要存储【实况ID】 + * + * @param tokenDto + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 13:40 2020-07-23 + **/ + Result inSertlive(TokenDto tokenDto, ResiActInsertLiveFormDTO formDTO); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActSignInRecService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActSignInRecService.java index c8119da389..84aec10141 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActSignInRecService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActSignInRecService.java @@ -19,7 +19,10 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.Result; import com.epmet.dto.ActSignInRecDTO; +import com.epmet.dto.form.resi.ResiActSignInFormDTO; import com.epmet.entity.ActSignInRecEntity; import java.util.List; @@ -32,64 +35,14 @@ import java.util.Map; * @since v1.0.0 2020-07-19 */ public interface ActSignInRecService extends BaseService { - - /** - * 默认分页 - * - * @param params - * @return PageData - * @author generator - * @date 2020-07-19 - */ - PageData page(Map params); - - /** - * 默认查询 - * - * @param params - * @return java.util.List - * @author generator - * @date 2020-07-19 - */ - List list(Map params); - - /** - * 单条查询 - * - * @param id - * @return ActSignInRecDTO - * @author generator - * @date 2020-07-19 - */ - ActSignInRecDTO get(String id); - - /** - * 默认保存 - * - * @param dto - * @return void - * @author generator - * @date 2020-07-19 - */ - void save(ActSignInRecDTO dto); - - /** - * 默认更新 - * - * @param dto - * @return void - * @author generator - * @date 2020-07-19 - */ - void update(ActSignInRecDTO dto); - /** - * 批量删除 + * 活动-签到 * - * @param ids - * @return void - * @author generator - * @date 2020-07-19 - */ - void delete(String[] ids); -} \ No newline at end of file + * @param tokenDto + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 10:29 2020-07-23 + **/ + Result actSignIn(TokenDto tokenDto, ResiActSignInFormDTO formDTO); +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/VolunteerInfoService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/VolunteerInfoService.java index e7874814d2..6938871d5b 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/VolunteerInfoService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/VolunteerInfoService.java @@ -19,7 +19,10 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.Result; import com.epmet.dto.VolunteerInfoDTO; +import com.epmet.dto.form.resi.ResiVolunteerAuthenticateFormDTO; import com.epmet.entity.VolunteerInfoEntity; import java.util.List; @@ -34,62 +37,14 @@ import java.util.Map; public interface VolunteerInfoService extends BaseService { /** - * 默认分页 + * 志愿者认证 * - * @param params - * @return PageData - * @author generator - * @date 2020-07-19 - */ - PageData page(Map params); - - /** - * 默认查询 - * - * @param params - * @return java.util.List - * @author generator - * @date 2020-07-19 - */ - List list(Map params); - - /** - * 单条查询 - * - * @param id - * @return VolunteerInfoDTO - * @author generator - * @date 2020-07-19 - */ - VolunteerInfoDTO get(String id); - - /** - * 默认保存 - * - * @param dto - * @return void - * @author generator - * @date 2020-07-19 - */ - void save(VolunteerInfoDTO dto); - - /** - * 默认更新 - * - * @param dto - * @return void - * @author generator - * @date 2020-07-19 - */ - void update(VolunteerInfoDTO dto); - - /** - * 批量删除 - * - * @param ids - * @return void - * @author generator - * @date 2020-07-19 - */ - void delete(String[] ids); -} \ No newline at end of file + * @param tokenDto + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 10:09 2020-07-23 + **/ + Result authenticate(TokenDto tokenDto, ResiVolunteerAuthenticateFormDTO formDTO); + +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActLiveRecServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActLiveRecServiceImpl.java index 967bdf16e2..b5038ce2ab 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActLiveRecServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActLiveRecServiceImpl.java @@ -17,24 +17,24 @@ package com.epmet.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.page.PageData; -import com.epmet.commons.tools.utils.ConvertUtils; -import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; +import com.epmet.dao.ActLivePicDao; import com.epmet.dao.ActLiveRecDao; +import com.epmet.dao.ActUserLogDao; +import com.epmet.dao.ActUserRelationDao; import com.epmet.dto.ActLivePicDTO; import com.epmet.dto.ActLiveRecDTO; -import com.epmet.dto.UserWechatDTO; +import com.epmet.dto.form.resi.ResiActInsertLiveFormDTO; import com.epmet.dto.result.UserBaseInfoResultDTO; import com.epmet.dto.result.resi.ResiActLiveRecResultDTO; +import com.epmet.entity.ActLivePicEntity; import com.epmet.entity.ActLiveRecEntity; import com.epmet.feign.EpmetUserFeignClient; import com.epmet.redis.ActLiveRecRedis; import com.epmet.service.ActLiveRecService; -import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -56,57 +56,8 @@ public class ActLiveRecServiceImpl extends BaseServiceImpl page(Map params) { - IPage page = baseDao.selectPage( - getPage(params, FieldConstant.CREATED_TIME, false), - getWrapper(params) - ); - return getPageData(page, ActLiveRecDTO.class); - } - - @Override - public List list(Map params) { - List entityList = baseDao.selectList(getWrapper(params)); - - return ConvertUtils.sourceToTarget(entityList, ActLiveRecDTO.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 ActLiveRecDTO get(String id) { - ActLiveRecEntity entity = baseDao.selectById(id); - return ConvertUtils.sourceToTarget(entity, ActLiveRecDTO.class); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void save(ActLiveRecDTO dto) { - ActLiveRecEntity entity = ConvertUtils.sourceToTarget(dto, ActLiveRecEntity.class); - insert(entity); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void update(ActLiveRecDTO dto) { - ActLiveRecEntity entity = ConvertUtils.sourceToTarget(dto, ActLiveRecEntity.class); - updateById(entity); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void delete(String[] ids) { - // 逻辑删除(@TableLogic 注解) - baseDao.deleteBatchIds(Arrays.asList(ids)); - } + @Autowired + private ActLivePicDao actLivePicDao; @Override public Result liveRecList(String actId) { @@ -144,4 +95,30 @@ public class ActLiveRecServiceImpl extends BaseServiceImpl().ok(resultDto); } + @Override + @Transactional(rollbackFor = Exception.class) + public Result inSertlive(TokenDto tokenDto, ResiActInsertLiveFormDTO formDTO) { + formDTO.setUserId(tokenDto.getUserId()); + // 存储活动实况记录表 + ActLiveRecEntity actLiveRecEntity = new ActLiveRecEntity(); + actLiveRecEntity.setActId(formDTO.getActId()); + actLiveRecEntity.setUserId(formDTO.getUserId()); + actLiveRecEntity.setLongitude(formDTO.getLongitude()); + actLiveRecEntity.setLatitude(formDTO.getLatitude()); + actLiveRecEntity.setAddress(formDTO.getAddress()); + actLiveRecEntity.setDesc(formDTO.getDesc()); + baseDao.insert(actLiveRecEntity); + + //存储活动实况图片 + List imgList = formDTO.getImages(); + for (int i = 0; i < imgList.size(); i++) { + String imgUrl = imgList.get(i); + ActLivePicEntity actLivePicEntity = new ActLivePicEntity(); + actLivePicEntity.setLiveId(actLiveRecEntity.getId()); + actLivePicEntity.setPicUrl(imgUrl); + actLivePicEntity.setSort(i + NumConstant.ONE); + actLivePicDao.insert(actLivePicEntity); + } + return new Result().ok(actLiveRecEntity.getId()); + } } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActSignInRecServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActSignInRecServiceImpl.java index ac608c807a..88719c0b99 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActSignInRecServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActSignInRecServiceImpl.java @@ -17,25 +17,30 @@ package com.epmet.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.page.PageData; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ConvertUtils; -import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dao.ActSignInPicDao; import com.epmet.dao.ActSignInRecDao; -import com.epmet.dto.ActSignInRecDTO; +import com.epmet.dao.ActUserLogDao; +import com.epmet.dao.ActUserRelationDao; +import com.epmet.dto.ActUserRelationDTO; +import com.epmet.dto.form.resi.ResiActInsertLiveFormDTO; +import com.epmet.dto.form.resi.ResiActSignInFormDTO; +import com.epmet.entity.ActSignInPicEntity; import com.epmet.entity.ActSignInRecEntity; +import com.epmet.entity.ActUserLogEntity; import com.epmet.redis.ActSignInRecRedis; +import com.epmet.service.ActLiveRecService; import com.epmet.service.ActSignInRecService; -import org.apache.commons.lang3.StringUtils; +import com.epmet.utils.ActUserRelationStatusConstant; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.util.Arrays; import java.util.List; -import java.util.Map; /** * 活动签到记录 @@ -49,56 +54,67 @@ public class ActSignInRecServiceImpl extends BaseServiceImpl page(Map params) { - IPage page = baseDao.selectPage( - getPage(params, FieldConstant.CREATED_TIME, false), - getWrapper(params) - ); - return getPageData(page, ActSignInRecDTO.class); - } - - @Override - public List list(Map params) { - List entityList = baseDao.selectList(getWrapper(params)); - - return ConvertUtils.sourceToTarget(entityList, ActSignInRecDTO.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; - } + @Autowired + private ActUserRelationDao actUserRelationDao; - @Override - public ActSignInRecDTO get(String id) { - ActSignInRecEntity entity = baseDao.selectById(id); - return ConvertUtils.sourceToTarget(entity, ActSignInRecDTO.class); - } + @Autowired + private ActUserLogDao actUserLogDao; - @Override - @Transactional(rollbackFor = Exception.class) - public void save(ActSignInRecDTO dto) { - ActSignInRecEntity entity = ConvertUtils.sourceToTarget(dto, ActSignInRecEntity.class); - insert(entity); - } + @Autowired + private ActSignInPicDao actSignInPicDao; - @Override - @Transactional(rollbackFor = Exception.class) - public void update(ActSignInRecDTO dto) { - ActSignInRecEntity entity = ConvertUtils.sourceToTarget(dto, ActSignInRecEntity.class); - updateById(entity); - } + @Autowired + private ActLiveRecService actLiveRecService; @Override @Transactional(rollbackFor = Exception.class) - public void delete(String[] ids) { - // 逻辑删除(@TableLogic 注解) - baseDao.deleteBatchIds(Arrays.asList(ids)); + public Result actSignIn(TokenDto tokenDto, ResiActSignInFormDTO formDTO) { + formDTO.setUserId(tokenDto.getUserId()); + // 更新用户活动关系表 SIGN_IN_FLAG字段更新为已签到 + ActUserRelationDTO actUserRelationDTO = new ActUserRelationDTO(); + actUserRelationDTO.setActId(formDTO.getActId()); + actUserRelationDTO.setUserId(formDTO.getUserId()); + actUserRelationDTO.setSignInFlag(ActUserRelationStatusConstant.SIGNED_IN); + actUserRelationDao.updateUserRelationByActIdAndUserId(actUserRelationDTO); + + // 存储用户活动关系日志表 + ActUserLogEntity actUserLogEntity = new ActUserLogEntity(); + actUserLogEntity.setActId(formDTO.getActId()); + actUserLogEntity.setUserId(formDTO.getUserId()); + actUserLogEntity.setOperationType(ActUserRelationStatusConstant.SIGNED_IN); + actUserLogDao.insert(actUserLogEntity); + + //" 实况id,当sync_live=1时此列有值" + String liveId = ""; + if (formDTO.getSyncLive() == 1){ + // 签到内容同步到实况 + ResiActInsertLiveFormDTO liveFormDTO = ConvertUtils.sourceToTarget(formDTO, ResiActInsertLiveFormDTO.class); + Result inSertlive = actLiveRecService.inSertlive(tokenDto, liveFormDTO); + liveId = inSertlive.getData(); + } + + // 存储活动签到记录表 + ActSignInRecEntity actSignInRecEntity = new ActSignInRecEntity(); + actSignInRecEntity.setActId(formDTO.getActId()); + actSignInRecEntity.setUserId(formDTO.getUserId()); + actSignInRecEntity.setLongitude(formDTO.getLongitude()); + actSignInRecEntity.setLatitude(formDTO.getLatitude()); + actSignInRecEntity.setAddress(formDTO.getAddress()); + actSignInRecEntity.setDesc(formDTO.getDesc()); + actSignInRecEntity.setSyncLive(formDTO.getSyncLive()); + actSignInRecEntity.setLiveId(liveId); + baseDao.insert(actSignInRecEntity); + + //存储活动签到图片 + List imgList = formDTO.getImages(); + for (int i = 0; i < imgList.size(); i++) { + String imgUrl = imgList.get(i); + ActSignInPicEntity actLivePicEntity = new ActSignInPicEntity(); + actLivePicEntity.setSignInId(actSignInRecEntity.getId()); + actLivePicEntity.setPicUrl(imgUrl); + actLivePicEntity.setSort(i + NumConstant.ONE); + actSignInPicDao.insert(actLivePicEntity); + } + return new Result(); } - -} \ No newline at end of file +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActUserRelationServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActUserRelationServiceImpl.java index cfea34e14e..5169f119df 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActUserRelationServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActUserRelationServiceImpl.java @@ -153,11 +153,11 @@ public class ActUserRelationServiceImpl extends BaseServiceImpl page(Map params) { - IPage page = baseDao.selectPage( - getPage(params, FieldConstant.CREATED_TIME, false), - getWrapper(params) - ); - return getPageData(page, VolunteerInfoDTO.class); - } - - @Override - public List list(Map params) { - List entityList = baseDao.selectList(getWrapper(params)); - - return ConvertUtils.sourceToTarget(entityList, VolunteerInfoDTO.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 VolunteerInfoDTO get(String id) { - VolunteerInfoEntity entity = baseDao.selectById(id); - return ConvertUtils.sourceToTarget(entity, VolunteerInfoDTO.class); + public Result authenticate(TokenDto tokenDto, ResiVolunteerAuthenticateFormDTO formDTO) { + // 检查是否是志愿者 + // 是志愿者 + // 更新志愿者信息表 + // 更新用户基础信息表 + // 更新用户微信表 + + // 不是志愿者 + // 插入志愿者信息表 + // 更新用户基础信息表 + // 更新用户微信表 + return null; } - - @Override - @Transactional(rollbackFor = Exception.class) - public void save(VolunteerInfoDTO dto) { - VolunteerInfoEntity entity = ConvertUtils.sourceToTarget(dto, VolunteerInfoEntity.class); - insert(entity); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void update(VolunteerInfoDTO dto) { - VolunteerInfoEntity entity = ConvertUtils.sourceToTarget(dto, VolunteerInfoEntity.class); - updateById(entity); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void delete(String[] ids) { - // 逻辑删除(@TableLogic 注解) - baseDao.deleteBatchIds(Arrays.asList(ids)); - } - -} \ No newline at end of file +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/utils/ActUserRelationStatusConstant.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/utils/ActUserRelationStatusConstant.java index dcde4657a7..1ecbcecca1 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/utils/ActUserRelationStatusConstant.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/utils/ActUserRelationStatusConstant.java @@ -35,4 +35,9 @@ public interface ActUserRelationStatusConstant { * 不给积分 */ String DENY = "deny"; + + /** + * 已签到 + */ + String SIGNED_IN = "signed_in"; } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserRelationDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserRelationDao.xml index 0cd324f25c..d5300a49da 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserRelationDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserRelationDao.xml @@ -72,12 +72,23 @@ GROUP BY re.ACT_ID - + UPDATE act_user_relation SET - STATUS = #{status}, - CANCEL_TIME = NOW(), - CANCEL_REASON = #{cancelReason} + + STATUS = #{status}, + + + CANCEL_TIME = NOW(), + CANCEL_REASON = #{cancelReason}, + + + SIGN_IN_FLAG = #{signInFlag}, + + + UPDATED_BY = #{userId}, + + UPDATED_TIME = NOW() WHERE DEL_FLAG = '0' AND ACT_ID = #{actId}