Browse Source

爱心互助-居民端接口

master
zhangyongzhangyong 5 years ago
parent
commit
fb203f736c
  1. 93
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActInsertLiveFormDTO.java
  2. 100
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActSignInFormDTO.java
  3. 106
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiVolunteerAuthenticateFormDTO.java
  4. 31
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiActListController.java
  5. 18
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiVolunteerController.java
  6. 4
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserRelationDao.java
  7. 75
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActLiveRecService.java
  8. 71
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActSignInRecService.java
  9. 71
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/VolunteerInfoService.java
  10. 93
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActLiveRecServiceImpl.java
  11. 124
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActSignInRecServiceImpl.java
  12. 4
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActUserRelationServiceImpl.java
  13. 66
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java
  14. 5
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/utils/ActUserRelationStatusConstant.java
  15. 19
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserRelationDao.xml

93
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
* <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.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<String> images;
/**
* 用户id
*/
private String userId;
}

100
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
* <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.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<String> images;
/**
* 0不同步实况1同步到实况记录
*/
@NotBlank(message = "是否同步到实况记录不能为空", groups = { AddUserInternalGroup.class, AddUserShowGroup.class})
private Integer syncLive;
/**
* 用户id
*/
private String userId;
}

106
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;
}

31
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);
}
}

18
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);
}
}

4
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserRelationDao.java

@ -73,12 +73,12 @@ public interface ActUserRelationDao extends BaseDao<ActUserRelationEntity> {
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);
}

75
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<ActLiveRecEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<ActLiveRecDTO>
* @author generator
* @date 2020-07-19
*/
PageData<ActLiveRecDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<ActLiveRecDTO>
* @author generator
* @date 2020-07-19
*/
List<ActLiveRecDTO> list(Map<String, Object> 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<ActLiveRecEntity> {
* @Date 13:39 2020-07-21
**/
Result<ResiActLiveRecResultDTO> liveRecList(String actId);
/**
* 活动-添加实况
* 返回实况id主要是因为当签到并转发实况时表中需要存储实况ID
*
* @param tokenDto
* @param formDTO
* @return com.epmet.commons.tools.utils.Result<java.lang.String>
* @Author zhangyong
* @Date 13:40 2020-07-23
**/
Result<String> inSertlive(TokenDto tokenDto, ResiActInsertLiveFormDTO formDTO);
}

71
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<ActSignInRecEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<ActSignInRecDTO>
* @author generator
* @date 2020-07-19
*/
PageData<ActSignInRecDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<ActSignInRecDTO>
* @author generator
* @date 2020-07-19
*/
List<ActSignInRecDTO> list(Map<String, Object> 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);
}
* @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);
}

71
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<VolunteerInfoEntity> {
/**
* 默认分页
* 志愿者认证
*
* @param params
* @return PageData<VolunteerInfoDTO>
* @author generator
* @date 2020-07-19
*/
PageData<VolunteerInfoDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<VolunteerInfoDTO>
* @author generator
* @date 2020-07-19
*/
List<VolunteerInfoDTO> list(Map<String, Object> 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);
}
* @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);
}

93
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<ActLiveRecDao, ActLiv
@Autowired
private EpmetUserFeignClient epmetUserFeignClient;
@Override
public PageData<ActLiveRecDTO> page(Map<String, Object> params) {
IPage<ActLiveRecEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, ActLiveRecDTO.class);
}
@Override
public List<ActLiveRecDTO> list(Map<String, Object> params) {
List<ActLiveRecEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, ActLiveRecDTO.class);
}
private QueryWrapper<ActLiveRecEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<ActLiveRecEntity> 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<ResiActLiveRecResultDTO> liveRecList(String actId) {
@ -144,4 +95,30 @@ public class ActLiveRecServiceImpl extends BaseServiceImpl<ActLiveRecDao, ActLiv
return new Result<ResiActLiveRecResultDTO>().ok(resultDto);
}
@Override
@Transactional(rollbackFor = Exception.class)
public Result<String> 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<String> 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<String>().ok(actLiveRecEntity.getId());
}
}

124
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<ActSignInRecDao, Ac
@Autowired
private ActSignInRecRedis actSignInRecRedis;
@Override
public PageData<ActSignInRecDTO> page(Map<String, Object> params) {
IPage<ActSignInRecEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, ActSignInRecDTO.class);
}
@Override
public List<ActSignInRecDTO> list(Map<String, Object> params) {
List<ActSignInRecEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, ActSignInRecDTO.class);
}
private QueryWrapper<ActSignInRecEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<ActSignInRecEntity> 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<String> 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<String> 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();
}
}
}

4
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<ActUserRelationD
public Result cancelSignUp(TokenDto tokenDto, ResiActUserCancelSignUpFormDTO formDTO) {
//1、更新用户活动关系表 的用户状态
ActUserRelationDTO userRelationDTO = new ActUserRelationDTO();
userRelationDTO.setId(formDTO.getActId());
userRelationDTO.setActId(formDTO.getActId());
userRelationDTO.setUserId(tokenDto.getUserId());
userRelationDTO.setCancelReason(formDTO.getFailureReason());
userRelationDTO.setStatus(ActUserRelationStatusConstant.CANCELD);
baseDao.updateUserStatusToCanceld(userRelationDTO);
baseDao.updateUserRelationByActIdAndUserId(userRelationDTO);
//2、插入用户活动关系日志表
ActUserLogDTO userLogDTO = new ActUserLogDTO();

66
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java

@ -21,10 +21,13 @@ 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.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.VolunteerInfoDao;
import com.epmet.dto.VolunteerInfoDTO;
import com.epmet.dto.form.resi.ResiVolunteerAuthenticateFormDTO;
import com.epmet.entity.VolunteerInfoEntity;
import com.epmet.redis.VolunteerInfoRedis;
import com.epmet.service.VolunteerInfoService;
@ -49,56 +52,19 @@ public class VolunteerInfoServiceImpl extends BaseServiceImpl<VolunteerInfoDao,
@Autowired
private VolunteerInfoRedis volunteerInfoRedis;
@Override
public PageData<VolunteerInfoDTO> page(Map<String, Object> params) {
IPage<VolunteerInfoEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, VolunteerInfoDTO.class);
}
@Override
public List<VolunteerInfoDTO> list(Map<String, Object> params) {
List<VolunteerInfoEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, VolunteerInfoDTO.class);
}
private QueryWrapper<VolunteerInfoEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<VolunteerInfoEntity> 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));
}
}
}

5
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";
}

19
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserRelationDao.xml

@ -72,12 +72,23 @@
GROUP BY re.ACT_ID
</select>
<update id="updateUserStatusToCanceld" parameterType="com.epmet.dto.ActUserRelationDTO">
<update id="updateUserRelationByActIdAndUserId" parameterType="com.epmet.dto.ActUserRelationDTO">
UPDATE act_user_relation
SET
STATUS = #{status},
CANCEL_TIME = NOW(),
CANCEL_REASON = #{cancelReason}
<if test="status != null and status.trim() != ''">
STATUS = #{status},
</if>
<if test="cancelReason != null and cancelReason.trim() != ''">
CANCEL_TIME = NOW(),
CANCEL_REASON = #{cancelReason},
</if>
<if test="signInFlag != null and signInFlag != ''">
SIGN_IN_FLAG = #{signInFlag},
</if>
<if test="userId != null and userId != ''">
UPDATED_BY = #{userId},
</if>
UPDATED_TIME = NOW()
WHERE
DEL_FLAG = '0'
AND ACT_ID = #{actId}

Loading…
Cancel
Save