296 changed files with 10632 additions and 1310 deletions
@ -0,0 +1,49 @@ |
|||
package com.epmet.controller; |
|||
|
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.commons.tools.validator.ValidatorUtils; |
|||
import com.epmet.dto.form.LoginFormDTO; |
|||
import com.epmet.dto.result.UserTokenResultDTO; |
|||
import com.epmet.service.ThirdLoginService; |
|||
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; |
|||
|
|||
/** |
|||
* @Description 第三方-居民端、政府端登陆服务 |
|||
* @author sun |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("thirdlogin") |
|||
public class ThirdLoginController { |
|||
|
|||
@Autowired |
|||
private ThirdLoginService thirdLoginService; |
|||
|
|||
/** |
|||
* @param formDTO |
|||
* @return |
|||
* @Author sun |
|||
* @Description 单客户-居民端微信小程序登录 |
|||
**/ |
|||
@PostMapping("resilogin") |
|||
public Result<UserTokenResultDTO> resiLogin(@RequestBody LoginFormDTO formDTO) { |
|||
ValidatorUtils.validateEntity(formDTO); |
|||
return new Result<UserTokenResultDTO>().ok(thirdLoginService.resiLogin(formDTO)); |
|||
} |
|||
|
|||
/** |
|||
* @param formDTO |
|||
* @return |
|||
* @Author sun |
|||
* @Description 单客户-政府端微信小程序登录 |
|||
**/ |
|||
@PostMapping("worklogin") |
|||
public Result<UserTokenResultDTO> workLogin(@RequestBody LoginFormDTO formDTO) { |
|||
ValidatorUtils.validateEntity(formDTO); |
|||
return new Result<UserTokenResultDTO>().ok(thirdLoginService.workLogin(formDTO)); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,28 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Description 单客户-居民端微信小程序登录 |
|||
* @Author sun |
|||
*/ |
|||
@Data |
|||
public class LoginFormDTO extends LoginCommonFormDTO implements Serializable { |
|||
private static final long serialVersionUID = 7950477424010655108L; |
|||
|
|||
/** |
|||
* 小程序appId |
|||
*/ |
|||
@NotBlank(message = "appId不能为空",groups = {AddUserInternalGroup.class}) |
|||
private String appId; |
|||
|
|||
/** |
|||
* 用户微信code |
|||
*/ |
|||
@NotBlank(message = "wxCode不能为空",groups = {AddUserInternalGroup.class}) |
|||
private String wxCode; |
|||
|
|||
} |
|||
@ -0,0 +1,27 @@ |
|||
package com.epmet.service; |
|||
|
|||
import com.epmet.dto.form.LoginFormDTO; |
|||
import com.epmet.dto.result.UserTokenResultDTO; |
|||
|
|||
/** |
|||
* @Description 第三方-居民端、政府端登陆服务 |
|||
* @author sun |
|||
*/ |
|||
public interface ThirdLoginService { |
|||
|
|||
/** |
|||
* @param formDTO |
|||
* @return |
|||
* @Author sun |
|||
* @Description 单客户-居民端微信小程序登录 |
|||
**/ |
|||
UserTokenResultDTO resiLogin(LoginFormDTO formDTO); |
|||
|
|||
/** |
|||
* @param formDTO |
|||
* @return |
|||
* @Author sun |
|||
* @Description 单客户-政府端微信小程序登录 |
|||
**/ |
|||
UserTokenResultDTO workLogin(LoginFormDTO formDTO); |
|||
} |
|||
@ -0,0 +1,350 @@ |
|||
package com.epmet.service.impl; |
|||
|
|||
import com.epmet.common.token.constant.LoginConstant; |
|||
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|||
import com.epmet.commons.tools.exception.ExceptionUtils; |
|||
import com.epmet.commons.tools.exception.RenException; |
|||
import com.epmet.commons.tools.security.dto.GovTokenDto; |
|||
import com.epmet.commons.tools.security.dto.TokenDto; |
|||
import com.epmet.commons.tools.utils.ConvertUtils; |
|||
import com.epmet.commons.tools.utils.CpUserDetailRedis; |
|||
import com.epmet.commons.tools.utils.DateUtils; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.dto.CustomerAgencyDTO; |
|||
import com.epmet.dto.GovStaffRoleDTO; |
|||
import com.epmet.dto.UserDTO; |
|||
import com.epmet.dto.UserWechatDTO; |
|||
import com.epmet.dto.form.*; |
|||
import com.epmet.dto.result.DepartmentListResultDTO; |
|||
import com.epmet.dto.result.GridByStaffResultDTO; |
|||
import com.epmet.dto.result.StaffLatestAgencyResultDTO; |
|||
import com.epmet.dto.result.UserTokenResultDTO; |
|||
import com.epmet.feign.EpmetThirdFeignClient; |
|||
import com.epmet.feign.EpmetUserOpenFeignClient; |
|||
import com.epmet.feign.GovOrgOpenFeignClient; |
|||
import com.epmet.jwt.JwtTokenProperties; |
|||
import com.epmet.jwt.JwtTokenUtils; |
|||
import com.epmet.service.ThirdLoginService; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.slf4j.Logger; |
|||
import org.slf4j.LoggerFactory; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.util.CollectionUtils; |
|||
|
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.Set; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* @author sun |
|||
* @Description 第三方-居民端、政府端登陆服务 |
|||
*/ |
|||
@Slf4j |
|||
@Service |
|||
public class ThirdLoginServiceImpl implements ThirdLoginService { |
|||
|
|||
private static final Logger logger = LoggerFactory.getLogger(ThirdLoginServiceImpl.class); |
|||
@Autowired |
|||
private JwtTokenUtils jwtTokenUtils; |
|||
@Autowired |
|||
private JwtTokenProperties jwtTokenProperties; |
|||
@Autowired |
|||
private CpUserDetailRedis cpUserDetailRedis; |
|||
@Autowired |
|||
private EpmetThirdFeignClient epmetThirdFeignClient; |
|||
@Autowired |
|||
private EpmetUserOpenFeignClient epmetUserOpenFeignClient; |
|||
@Autowired |
|||
private GovOrgOpenFeignClient govOrgOpenFeignClient; |
|||
|
|||
/** |
|||
* @param formDTO |
|||
* @return |
|||
* @Author sun |
|||
* @Description 单客户-居民端微信小程序登录 |
|||
**/ |
|||
@Override |
|||
public UserTokenResultDTO resiLogin(LoginFormDTO formDTO) { |
|||
//1.调用epmet_third服务,校验appId是否有效以及是否授权,校验通过的调用微信API获取用户基本信息
|
|||
WxLoginFormDTO resiLoginFormDTO = new WxLoginFormDTO(); |
|||
resiLoginFormDTO.setAppId(formDTO.getAppId()); |
|||
resiLoginFormDTO.setWxCode(formDTO.getWxCode()); |
|||
Result<UserWechatDTO> result = epmetThirdFeignClient.resiAndWorkLogin(resiLoginFormDTO); |
|||
if (!result.success()) { |
|||
logger.error("居民端小程序登陆,调用epmet_third服务获取数据失败"); |
|||
throw new RenException(result.getCode()); |
|||
} |
|||
UserWechatDTO userWechatDTO = result.getData(); |
|||
|
|||
//2.调用epmet-user服务,新增用户信息(先判断用户是否存在,不存在则新增存在则更新)
|
|||
WxUserFormDTO wxUserFormDTO = new WxUserFormDTO(); |
|||
wxUserFormDTO.setWechatDTO(userWechatDTO); |
|||
wxUserFormDTO.setApp(formDTO.getApp()); |
|||
Result<UserDTO> userResult = epmetUserOpenFeignClient.saveWxUser(wxUserFormDTO); |
|||
if (!userResult.success()) { |
|||
throw new RenException(result.getCode()); |
|||
} |
|||
UserDTO userDTO = userResult.getData(); |
|||
|
|||
//3.生成业务token
|
|||
String userId = userDTO.getId(); |
|||
String token = this.generateToken(formDTO, userId); |
|||
|
|||
//4.存放Redis
|
|||
this.saveTokenDto(formDTO, userId, userWechatDTO, token); |
|||
|
|||
//5.接口返参
|
|||
UserTokenResultDTO userTokenResultDTO = new UserTokenResultDTO(); |
|||
userTokenResultDTO.setToken(token); |
|||
|
|||
return userTokenResultDTO; |
|||
} |
|||
|
|||
/** |
|||
* @Description 居民端登陆生成业务token的key |
|||
**/ |
|||
private String generateToken(LoginCommonFormDTO formDTO, String userId) { |
|||
Map<String, Object> map = new HashMap<>(); |
|||
map.put("app", formDTO.getApp()); |
|||
map.put("client", formDTO.getClient()); |
|||
map.put("userId", userId); |
|||
String token = jwtTokenUtils.createToken(map); |
|||
logger.info("app:" + formDTO.getApp() + ";client:" + formDTO.getClient() + ";userId:" + userId + ";生成token[" + token + "]"); |
|||
return token; |
|||
} |
|||
|
|||
/** |
|||
* @Description 将token存入redis |
|||
**/ |
|||
private String saveTokenDto(LoginCommonFormDTO formDTO, String userId, UserWechatDTO userWechatDTO, String token) { |
|||
int expire = jwtTokenProperties.getExpire(); |
|||
TokenDto tokenDto = new TokenDto(); |
|||
tokenDto.setApp(formDTO.getApp()); |
|||
tokenDto.setClient(formDTO.getClient()); |
|||
tokenDto.setUserId(userId); |
|||
tokenDto.setOpenId(userWechatDTO.getWxOpenId()); |
|||
tokenDto.setSessionKey(userWechatDTO.getSessionKey()); |
|||
tokenDto.setUnionId(userWechatDTO.getUnionId()); |
|||
tokenDto.setToken(token); |
|||
tokenDto.setUpdateTime(System.currentTimeMillis()); |
|||
tokenDto.setExpireTime(jwtTokenUtils.getExpiration(token).getTime()); |
|||
cpUserDetailRedis.set(tokenDto, expire); |
|||
logger.info("截止时间:" + DateUtils.format(jwtTokenUtils.getExpiration(token), "yyyy-MM-dd HH:mm:ss")); |
|||
return token; |
|||
} |
|||
|
|||
/** |
|||
* @param formDTO |
|||
* @return |
|||
* @Author sun |
|||
* @Description 单客户-政府端微信小程序登录 |
|||
**/ |
|||
@Override |
|||
public UserTokenResultDTO workLogin(LoginFormDTO formDTO) { |
|||
//1.调用epmet_third服务,校验appId是否有效以及是否授权,校验通过的调用微信API获取用户基本信息
|
|||
WxLoginFormDTO resiLoginFormDTO = new WxLoginFormDTO(); |
|||
resiLoginFormDTO.setAppId(formDTO.getAppId()); |
|||
resiLoginFormDTO.setWxCode(formDTO.getWxCode()); |
|||
Result<UserWechatDTO> result = epmetThirdFeignClient.resiAndWorkLogin(resiLoginFormDTO); |
|||
if (!result.success()) { |
|||
logger.error("工作端小程序登陆,调用epmet_third服务获取数据失败"); |
|||
throw new RenException(result.getCode()); |
|||
} |
|||
UserWechatDTO userWechatDTO = result.getData(); |
|||
|
|||
//2.根据openid查询用户是否存在历史登陆信息
|
|||
Result<StaffLatestAgencyResultDTO> latestStaffWechat = epmetUserOpenFeignClient.getLatestStaffWechatLoginRecord(userWechatDTO.getWxOpenId()); |
|||
if (!latestStaffWechat.success() || null == latestStaffWechat.getData()) { |
|||
logger.error(String.format("没有获取到用户最近一次登录账户信息,code[%s],msg[%s]", EpmetErrorCode.PLEASE_LOGIN.getCode(), EpmetErrorCode.PLEASE_LOGIN.getMsg())); |
|||
throw new RenException(EpmetErrorCode.PLEASE_LOGIN.getCode()); |
|||
} |
|||
StaffLatestAgencyResultDTO staffLatestAgencyResultDTO = latestStaffWechat.getData(); |
|||
|
|||
//3.记录staff_wechat
|
|||
this.savestaffwechat(staffLatestAgencyResultDTO.getStaffId(), userWechatDTO.getWxOpenId()); |
|||
|
|||
//4.记录登录日志
|
|||
this.saveStaffLoginRecord(staffLatestAgencyResultDTO); |
|||
|
|||
//5.获取用户token
|
|||
String token = this.generateGovWxmpToken(staffLatestAgencyResultDTO.getStaffId()); |
|||
|
|||
//6.保存到redis
|
|||
this.saveLatestGovTokenDto(staffLatestAgencyResultDTO, userWechatDTO, token); |
|||
UserTokenResultDTO userTokenResultDTO = new UserTokenResultDTO(); |
|||
userTokenResultDTO.setToken(token); |
|||
return userTokenResultDTO; |
|||
|
|||
} |
|||
|
|||
/** |
|||
* @param userId openid |
|||
* @return |
|||
* @Author sun |
|||
* @Description 保存微信和当前登录用户关系 |
|||
**/ |
|||
private Result savestaffwechat(String userId, String openid) { |
|||
StaffWechatFormDTO staffWechatFormDTO = new StaffWechatFormDTO(); |
|||
staffWechatFormDTO.setUserId(userId); |
|||
staffWechatFormDTO.setWxOpenId(openid); |
|||
return epmetUserOpenFeignClient.saveStaffWechat(staffWechatFormDTO); |
|||
} |
|||
|
|||
/** |
|||
* @param latestStaffWechatLoginDTO |
|||
* @return |
|||
* @Author sun |
|||
* @Description 保存登录日志 |
|||
**/ |
|||
private Result saveStaffLoginRecord(StaffLatestAgencyResultDTO latestStaffWechatLoginDTO) { |
|||
StaffLoginAgencyRecordFormDTO staffLoginAgencyRecordFormDTO = new StaffLoginAgencyRecordFormDTO(); |
|||
staffLoginAgencyRecordFormDTO.setCustomerId(latestStaffWechatLoginDTO.getCustomerId()); |
|||
staffLoginAgencyRecordFormDTO.setStaffId(latestStaffWechatLoginDTO.getStaffId()); |
|||
staffLoginAgencyRecordFormDTO.setWxOpenId(latestStaffWechatLoginDTO.getWxOpenId()); |
|||
staffLoginAgencyRecordFormDTO.setMobile(latestStaffWechatLoginDTO.getMobile()); |
|||
staffLoginAgencyRecordFormDTO.setAgencyId(latestStaffWechatLoginDTO.getAgencyId()); |
|||
Result staffLoginRecordResult = epmetUserOpenFeignClient.saveStaffLoginRecord(staffLoginAgencyRecordFormDTO); |
|||
return staffLoginRecordResult; |
|||
} |
|||
|
|||
/** |
|||
* @Description 生成政府端小程序业务token Key |
|||
* @Author sun |
|||
**/ |
|||
private String generateGovWxmpToken(String staffId) { |
|||
Map<String, Object> map = new HashMap<>(); |
|||
map.put("app", LoginConstant.APP_GOV); |
|||
map.put("client", LoginConstant.CLIENT_WXMP); |
|||
map.put("userId", staffId); |
|||
String token = jwtTokenUtils.createToken(map); |
|||
logger.info("app:" + LoginConstant.APP_GOV + ";client:" + LoginConstant.CLIENT_WXMP + ";userId:" + staffId + ";生成token[" + token + "]"); |
|||
return token; |
|||
} |
|||
|
|||
/** |
|||
* @Description 保存tokenDto到redis |
|||
* @Author sun |
|||
**/ |
|||
private void saveLatestGovTokenDto(StaffLatestAgencyResultDTO staffLatestAgency, UserWechatDTO userWechatDTO, String token) { |
|||
int expire = jwtTokenProperties.getExpire(); |
|||
GovTokenDto govTokenDto = new GovTokenDto(); |
|||
govTokenDto.setApp(LoginConstant.APP_GOV); |
|||
govTokenDto.setClient(LoginConstant.CLIENT_WXMP); |
|||
govTokenDto.setUserId(staffLatestAgency.getStaffId()); |
|||
govTokenDto.setOpenId(userWechatDTO.getWxOpenId()); |
|||
govTokenDto.setSessionKey(userWechatDTO.getSessionKey()); |
|||
govTokenDto.setUnionId(userWechatDTO.getUnionId()); |
|||
govTokenDto.setToken(token); |
|||
govTokenDto.setUpdateTime(System.currentTimeMillis()); |
|||
govTokenDto.setExpireTime(jwtTokenUtils.getExpiration(token).getTime()); |
|||
govTokenDto.setRootAgencyId(staffLatestAgency.getAgencyId()); |
|||
govTokenDto.setCustomerId(staffLatestAgency.getCustomerId()); |
|||
|
|||
//设置部门,网格,角色列表
|
|||
govTokenDto.setDeptIdList(getDeptartmentIdList(staffLatestAgency.getStaffId())); |
|||
govTokenDto.setGridIdList(getGridIdList(staffLatestAgency.getStaffId())); |
|||
CustomerAgencyDTO agency = getAgencyByStaffId(staffLatestAgency.getStaffId()); |
|||
if (agency != null) { |
|||
govTokenDto.setAgencyId(agency.getId()); |
|||
govTokenDto.setRoleList(queryGovStaffRoles(staffLatestAgency.getStaffId(), agency.getId())); |
|||
} |
|||
govTokenDto.setOrgIdPath(getOrgIdPath(staffLatestAgency.getStaffId())); |
|||
|
|||
cpUserDetailRedis.set(govTokenDto, expire); |
|||
logger.info("截止时间:" + DateUtils.format(jwtTokenUtils.getExpiration(token), "yyyy-MM-dd HH:mm:ss")); |
|||
} |
|||
|
|||
public Set<String> getDeptartmentIdList(String staffId) { |
|||
try { |
|||
Result<List<DepartmentListResultDTO>> deptListResult = govOrgOpenFeignClient.getDepartmentListByStaffId(staffId); |
|||
if (deptListResult.success()) { |
|||
if (!CollectionUtils.isEmpty(deptListResult.getData())) { |
|||
Set<String> deptIdLists = deptListResult.getData().stream().map(dept -> dept.getDepartmentId()).collect(Collectors.toSet()); |
|||
return deptIdLists; |
|||
} |
|||
} else { |
|||
logger.error("登录:查询部门列表,远程调用返回错误:{}", deptListResult.getMsg()); |
|||
} |
|||
} catch (Exception e) { |
|||
String errorStackTrace = ExceptionUtils.getErrorStackTrace(e); |
|||
logger.error("登录:查询部门列表异常:{}", errorStackTrace); |
|||
} |
|||
return null; |
|||
} |
|||
|
|||
/** |
|||
* 根据工作人员ID查询网格ID列表 |
|||
* |
|||
* @param staffId |
|||
* @return |
|||
*/ |
|||
public Set<String> getGridIdList(String staffId) { |
|||
Result<List<GridByStaffResultDTO>> result = govOrgOpenFeignClient.listGridsbystaffid(staffId); |
|||
if (!result.success()) { |
|||
logger.error("登录:查询网格列表,远程调用返回错误:{}", result.getMsg()); |
|||
return null; |
|||
} else { |
|||
List<GridByStaffResultDTO> grids = result.getData(); |
|||
return grids.stream().map(grid -> grid.getGridId()).collect(Collectors.toSet()); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 根据staffId查询所属的组织机构 |
|||
* |
|||
* @param staffId |
|||
*/ |
|||
public CustomerAgencyDTO getAgencyByStaffId(String staffId) { |
|||
Result<CustomerAgencyDTO> result = govOrgOpenFeignClient.getAgencyByStaff(staffId); |
|||
if (!result.success()) { |
|||
logger.error("登录:查询登录人所属的机关OrgIdPath失败:{}", result.getMsg()); |
|||
return null; |
|||
} |
|||
return result.getData(); |
|||
} |
|||
|
|||
/** |
|||
* 查询人员在某机关单位下的角色列表 |
|||
* |
|||
* @param staffId orgId |
|||
*/ |
|||
public List<GovTokenDto.Role> queryGovStaffRoles(String staffId, String orgId) { |
|||
StaffRoleFormDTO formDTO = new StaffRoleFormDTO(); |
|||
formDTO.setStaffId(staffId); |
|||
formDTO.setOrgId(orgId); |
|||
Result<List<GovStaffRoleDTO>> gridResult = epmetUserOpenFeignClient.getRolesOfStaff(formDTO); |
|||
if (!CollectionUtils.isEmpty(gridResult.getData())) { |
|||
//return gridResult.getData().stream().map(role -> role.getId()).collect(Collectors.toSet());
|
|||
return ConvertUtils.sourceToTarget(gridResult.getData(), GovTokenDto.Role.class); |
|||
} |
|||
return null; |
|||
} |
|||
|
|||
/** |
|||
* 查询工作人员的OrgIdPath |
|||
* |
|||
* @param staffId |
|||
* @return |
|||
*/ |
|||
public String getOrgIdPath(String staffId) { |
|||
Result<CustomerAgencyDTO> result = govOrgOpenFeignClient.getAgencyByStaff(staffId); |
|||
if (!result.success()) { |
|||
logger.error("登录:查询登录人所属的机关OrgIdPath失败:{}", result.getMsg()); |
|||
return null; |
|||
} |
|||
CustomerAgencyDTO agency = result.getData(); |
|||
if (agency != null) { |
|||
if ("0".equals(agency.getPid())) { |
|||
// 顶级
|
|||
return agency.getId(); |
|||
} else { |
|||
return agency.getPids().concat(":").concat(agency.getId()); |
|||
} |
|||
} |
|||
return null; |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,21 @@ |
|||
package com.epmet.commons.tools.config; |
|||
|
|||
import org.springframework.context.annotation.Bean; |
|||
import org.springframework.context.annotation.Configuration; |
|||
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; |
|||
|
|||
/** |
|||
* desc:应用配置 |
|||
* @author lyn |
|||
* @date 2020/7/22 14:08 |
|||
*/ |
|||
@Configuration |
|||
public class ApplicationConfig { |
|||
// 设置@Value注解取值不到忽略(不报错)
|
|||
@Bean |
|||
public static PropertySourcesPlaceholderConfigurer placeholderConfigurer() { |
|||
PropertySourcesPlaceholderConfigurer c = new PropertySourcesPlaceholderConfigurer(); |
|||
c.setIgnoreUnresolvablePlaceholders(true); |
|||
return c; |
|||
} |
|||
} |
|||
@ -0,0 +1,30 @@ |
|||
/** |
|||
* Copyright (c) 2018 人人开源 All rights reserved. |
|||
* <p> |
|||
* https://www.renren.io
|
|||
* <p> |
|||
* 版权所有,侵权必究! |
|||
*/ |
|||
|
|||
package com.epmet.commons.tools.config; |
|||
|
|||
import lombok.Data; |
|||
import org.springframework.beans.factory.annotation.Value; |
|||
import org.springframework.context.annotation.Configuration; |
|||
|
|||
/** |
|||
* 消息网关配置信息 |
|||
* |
|||
* @author Mark sunlightcs@gmail.com |
|||
* @since 1.0.0 |
|||
*/ |
|||
@Data |
|||
@Configuration |
|||
public class MqConfig { |
|||
@Value("${elink.mq.appId}") |
|||
private String appId; |
|||
@Value("${elink.mq.token}") |
|||
private String token; |
|||
@Value("${elink.mq.host}") |
|||
private String host; |
|||
} |
|||
@ -0,0 +1,30 @@ |
|||
package com.epmet.commons.tools.dto.form.mq; |
|||
|
|||
import lombok.Data; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
/** |
|||
* 消息网关基础信息 |
|||
* |
|||
* @author jianjun liu |
|||
* @date 2020-07-21 14:33 |
|||
**/ |
|||
@Data |
|||
@Component |
|||
public class MqBaseMsgDTO extends MqConfigDTO { |
|||
private static final long serialVersionUID = 8176470786428432009L; |
|||
|
|||
/** |
|||
* mq的事件类型 |
|||
*/ |
|||
private String eventClass; |
|||
/** |
|||
* 事件code |
|||
*/ |
|||
private String eventTag; |
|||
/** |
|||
* 消息体 |
|||
*/ |
|||
private String msg; |
|||
|
|||
} |
|||
@ -0,0 +1,18 @@ |
|||
package com.epmet.commons.tools.dto.form.mq; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* 消息网关基础信息 |
|||
* |
|||
* @author jianjun liu |
|||
* @date 2020-07-21 14:33 |
|||
**/ |
|||
@Data |
|||
public class MqConfigDTO implements Serializable { |
|||
private String appId; |
|||
private String token; |
|||
private String requestUrl; |
|||
} |
|||
@ -0,0 +1,19 @@ |
|||
package com.epmet.commons.tools.dto.form.mq; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* desc:消息网关返回结果 |
|||
* |
|||
* @author lyn |
|||
* @date 2020/7/21 13:38 |
|||
*/ |
|||
@Data |
|||
public class MqReturnBaseResult implements Serializable { |
|||
private static final long serialVersionUID = -7763308686382363929L; |
|||
Integer errCode; |
|||
String errMsg; |
|||
String data; |
|||
} |
|||
@ -0,0 +1,36 @@ |
|||
package com.epmet.commons.tools.dto.form.mq; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* desc: 订阅服务参数 实体类 |
|||
* |
|||
* @date: 2020/6/29 9:06 |
|||
* @author: jianjun liu |
|||
* email:liujianjun@git.elinkit.com.cn |
|||
*/ |
|||
@Data |
|||
public class MqSubscribeFormDTO implements Serializable { |
|||
|
|||
/** |
|||
* 消息接收者 |
|||
*/ |
|||
private String belongAppId; |
|||
|
|||
/** |
|||
* 密钥 |
|||
*/ |
|||
private String eventClass; |
|||
/** |
|||
* 发送内容 |
|||
*/ |
|||
private String eventTag; |
|||
|
|||
/** |
|||
* 是否at所有人 |
|||
*/ |
|||
private String callbackUrl; |
|||
|
|||
} |
|||
@ -0,0 +1,21 @@ |
|||
package com.epmet.commons.tools.dto.form.mq; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* 亿联云消息网关消息回调外层DTO |
|||
* |
|||
* @author jianjun liu |
|||
* @date 2020-07-20 8:58 |
|||
**/ |
|||
@Data |
|||
public class ReceiveMqMsg implements Serializable { |
|||
|
|||
private static final long serialVersionUID = -2776439983884650701L; |
|||
/** |
|||
* 消息体 json串 |
|||
*/ |
|||
private String msg; |
|||
} |
|||
@ -0,0 +1,42 @@ |
|||
package com.epmet.commons.tools.enums; |
|||
|
|||
/** |
|||
* 消息网关方法枚举类 |
|||
* dev|test|prod |
|||
* |
|||
* @author jianjun liu |
|||
* @date 2020-07-03 11:14 |
|||
**/ |
|||
public enum MqMethodPathEnum { |
|||
SEND_MSG("producerService/producer/sendMsg", "发送消息"), |
|||
|
|||
; |
|||
|
|||
private String code; |
|||
private String name; |
|||
|
|||
|
|||
|
|||
MqMethodPathEnum(String code, String name) { |
|||
this.code = code; |
|||
this.name = name; |
|||
} |
|||
|
|||
public static MqMethodPathEnum getEnum(String code) { |
|||
MqMethodPathEnum[] values = MqMethodPathEnum.values(); |
|||
for (MqMethodPathEnum value : values) { |
|||
if (code != null && value.getCode().equals(code)) { |
|||
return value; |
|||
} |
|||
} |
|||
return null; |
|||
} |
|||
|
|||
public String getCode() { |
|||
return code; |
|||
} |
|||
|
|||
public String getName() { |
|||
return name; |
|||
} |
|||
} |
|||
@ -0,0 +1,149 @@ |
|||
package com.epmet.commons.tools.utils; |
|||
|
|||
import lombok.extern.slf4j.Slf4j; |
|||
|
|||
import java.io.UnsupportedEncodingException; |
|||
import java.security.MessageDigest; |
|||
|
|||
@Slf4j |
|||
public class Md5Util { |
|||
/** |
|||
* 加密盐 值 |
|||
*/ |
|||
public static final String SALT = "EPMET_UMD_SALT"; |
|||
|
|||
public static String md5(String string) { |
|||
if (string == null || string.trim().length() == 0) { |
|||
return null; |
|||
} |
|||
try { |
|||
return getMD5(string.getBytes("GBK")); |
|||
} catch (UnsupportedEncodingException e) { |
|||
log.error( "md5 is error,msg={0}", e); |
|||
return null; |
|||
} |
|||
} |
|||
|
|||
private static final char hexDigits[] = { // 用来将字节转换成 16 进制表示的字符
|
|||
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}; |
|||
|
|||
private static String getMD5(byte[] source) { |
|||
String s = null; |
|||
try { |
|||
MessageDigest md = MessageDigest.getInstance("MD5"); |
|||
md.update(source); |
|||
byte tmp[] = md.digest(); // MD5 的计算结果是一个 128 位的长整数,
|
|||
// 用字节表示就是 16 个字节
|
|||
char str[] = new char[16 * 2]; // 每个字节用 16 进制表示的话,使用两个字符,
|
|||
// 所以表示成 16 进制需要 32 个字符
|
|||
int k = 0; // 表示转换结果中对应的字符位置
|
|||
for (int i = 0; i < 16; i++) { // 从第一个字节开始,对 MD5 的每一个字节
|
|||
// 转换成 16 进制字符的转换
|
|||
byte byte0 = tmp[i]; // 取第 i 个字节
|
|||
str[k++] = hexDigits[byte0 >>> 4 & 0xf]; // 取字节中高 4 位的数字转换,
|
|||
// >>> 为逻辑右移,将符号位一起右移
|
|||
str[k++] = hexDigits[byte0 & 0xf]; // 取字节中低 4 位的数字转换
|
|||
} |
|||
s = new String(str); // 换后的结果转换为字符串
|
|||
|
|||
} catch (Exception e) { |
|||
log.error("getMD5 is error,msg={0}", e); |
|||
} |
|||
return s; |
|||
} |
|||
|
|||
private static String byteArrayToHexString(byte b[]) { |
|||
StringBuffer resultSb = new StringBuffer(); |
|||
for (int i = 0; i < b.length; i++) |
|||
resultSb.append(byteToHexString(b[i])); |
|||
|
|||
return resultSb.toString(); |
|||
} |
|||
|
|||
private static String byteToHexString(byte b) { |
|||
int n = b; |
|||
if (n < 0) |
|||
n += 256; |
|||
int d1 = n / 16; |
|||
int d2 = n % 16; |
|||
return hexDigits[d1] + "" + hexDigits[d2]; |
|||
} |
|||
|
|||
public static String MD5Encode(String origin, String charsetname) { |
|||
String resultString = null; |
|||
try { |
|||
resultString = new String(origin); |
|||
MessageDigest md = MessageDigest.getInstance("MD5"); |
|||
if (charsetname == null || "".equals(charsetname)) |
|||
resultString = byteArrayToHexString(md.digest(resultString |
|||
.getBytes())); |
|||
else |
|||
resultString = byteArrayToHexString(md.digest(resultString |
|||
.getBytes(charsetname))); |
|||
} catch (Exception e) { |
|||
log.error("MD5Encode is error,msg={0}", e); |
|||
} |
|||
return resultString; |
|||
} |
|||
|
|||
|
|||
public static void main(String[] args) { |
|||
for (int i = 0; i < 5; i++) { |
|||
String uuid = "03a1dcd8cb1811eabac1c03fd56f7847"; |
|||
System.out.println(get12Char(uuid)); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 获取短字符 |
|||
* |
|||
* @param str |
|||
* @return 大写 |
|||
*/ |
|||
public static String get12Char(String str) { |
|||
String arr[] = ShortText(str); |
|||
String rst = (arr[0] + arr[1]).toUpperCase(); |
|||
return rst.substring(0, 4) + rst.substring(4, 8) + rst.substring(8, 12); |
|||
} |
|||
|
|||
private static String[] ShortText(String string) { |
|||
String[] chars = new String[]{ // 要使用生成URL的字符
|
|||
"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", |
|||
"o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", |
|||
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", |
|||
"C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", |
|||
"O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"}; |
|||
|
|||
String hex = ""; |
|||
|
|||
MessageDigest md = null; |
|||
try { |
|||
md = MessageDigest.getInstance("MD5"); |
|||
hex = byteArrayToHexString(md.digest(SALT.concat(string) |
|||
.getBytes("utf-8"))); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
} |
|||
|
|||
int hexLen = hex.length(); |
|||
int subHexLen = hexLen / 8; |
|||
String[] ShortStr = new String[4]; |
|||
|
|||
for (int i = 0; i < subHexLen; i++) { |
|||
String outChars = ""; |
|||
int j = i + 1; |
|||
String subHex = hex.substring(i * 8, j * 8); |
|||
long idx = Long.valueOf("3FFFFFFF", 16) & Long.valueOf(subHex, 16); |
|||
|
|||
for (int k = 0; k < 6; k++) { |
|||
int index = (int) (Long.valueOf("0000003D", 16) & idx); |
|||
outChars += chars[index]; |
|||
idx = idx >> 5; |
|||
} |
|||
ShortStr[i] = outChars; |
|||
} |
|||
|
|||
return ShortStr; |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,53 @@ |
|||
package com.epmet.commons.tools.utils; |
|||
|
|||
import org.springframework.web.multipart.MultipartFile; |
|||
|
|||
import java.io.File; |
|||
import java.io.FileOutputStream; |
|||
import java.io.InputStream; |
|||
import java.io.OutputStream; |
|||
|
|||
/** |
|||
* @author zhaoqifeng |
|||
* @dscription |
|||
* @date 2020/7/17 14:01 |
|||
*/ |
|||
public class MultipartFileToFileUtils { |
|||
/** |
|||
* MultipartFile 转 File |
|||
* |
|||
* @param file |
|||
* @throws Exception |
|||
*/ |
|||
public static File multipartFileToFile(MultipartFile file) throws Exception { |
|||
File toFile = null; |
|||
if (("").equals(file) || file.getSize() <= 0) { |
|||
file = null; |
|||
} else { |
|||
InputStream ins = null; |
|||
ins = file.getInputStream(); |
|||
toFile = new File(file.getOriginalFilename()); |
|||
toFile = inputStreamToFile(ins, toFile); |
|||
ins.close(); |
|||
} |
|||
return toFile; |
|||
} |
|||
|
|||
|
|||
private static File inputStreamToFile(InputStream ins, File file) { |
|||
try { |
|||
OutputStream os = new FileOutputStream(file); |
|||
int bytesRead = 0; |
|||
byte[] buffer = new byte[8192]; |
|||
while ((bytesRead = ins.read(buffer, 0, 8192)) != -1) { |
|||
os.write(buffer, 0, bytesRead); |
|||
} |
|||
os.close(); |
|||
ins.close(); |
|||
return file; |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
} |
|||
return null; |
|||
} |
|||
} |
|||
@ -0,0 +1,69 @@ |
|||
package com.epmet.commons.tools.utils; |
|||
|
|||
import com.alibaba.fastjson.JSON; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import com.epmet.commons.tools.config.MqConfig; |
|||
import com.epmet.commons.tools.constant.NumConstant; |
|||
import com.epmet.commons.tools.dto.form.mq.MqBaseMsgDTO; |
|||
import com.epmet.commons.tools.dto.form.mq.MqReturnBaseResult; |
|||
import com.epmet.commons.tools.enums.MqMethodPathEnum; |
|||
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|||
import com.epmet.commons.tools.exception.ValidateException; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
/** |
|||
* 发送亿联云消息工具类 |
|||
* |
|||
* @author jianjun liu |
|||
* @date 2020-06-08 8:28 |
|||
**/ |
|||
@Slf4j |
|||
@Component |
|||
public class SendMqMsgUtils { |
|||
private static MqConfig mqStaticConfig; |
|||
|
|||
/** |
|||
* desc:发送mq消息 |
|||
* |
|||
* @return |
|||
*/ |
|||
public static Result<String> sendMsg(MqBaseMsgDTO msg) { |
|||
if (mqStaticConfig == null) { |
|||
mqStaticConfig = SpringContextUtils.getBean(MqConfig.class); |
|||
} |
|||
log.debug("sendMsg param:{}", JSON.toJSONString(msg)); |
|||
try { |
|||
// TODO
|
|||
//ValidatorUtils.validateEntity(msg, null);
|
|||
} catch (ValidateException e) { |
|||
return new Result<String>().error(e.getMsg()); |
|||
} |
|||
msg.setAppId(mqStaticConfig.getAppId()); |
|||
msg.setRequestUrl(mqStaticConfig.getHost().concat(MqMethodPathEnum.SEND_MSG.getCode())); |
|||
msg.setToken(mqStaticConfig.getToken()); |
|||
try { |
|||
Result<String> result = HttpClientManager.getInstance().sendPostByHttps(msg.getRequestUrl(), JSON.toJSONString(msg)); |
|||
log.debug("sendMsg result:{}", JSON.toJSONString(result)); |
|||
if (result.success()) { |
|||
MqReturnBaseResult resultResult = JSON.parseObject(result.getData(), MqReturnBaseResult.class); |
|||
if (resultResult.getErrCode().equals(NumConstant.ZERO)) { |
|||
JSONObject jsonObject = JSON.parseObject(resultResult.getData()); |
|||
return new Result<String>().ok(jsonObject.getString("msgId")); |
|||
} else { |
|||
log.error("sendMsg fail,resultData:{}", JSON.toJSONString(resultResult)); |
|||
return new Result<String>().error(EpmetErrorCode.SERVER_ERROR.getCode(), resultResult.getErrMsg()); |
|||
} |
|||
} |
|||
Result<String> resultResult = new Result<>(); |
|||
resultResult.error(result.getCode(), result.getMsg()); |
|||
resultResult.setInternalMsg(result.getInternalMsg()); |
|||
return resultResult; |
|||
} catch (Exception e) { |
|||
log.debug("sendMsg exception", e); |
|||
return new Result<String>().error(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg()); |
|||
} |
|||
} |
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,81 @@ |
|||
/** |
|||
* 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 lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
import java.math.BigDecimal; |
|||
import java.util.ArrayList; |
|||
|
|||
/** |
|||
* 用户活动打卡参数 |
|||
* |
|||
* @author zhangyong |
|||
* @since v1.0.0 2020-07-14 |
|||
*/ |
|||
@Data |
|||
public class ActUserClockLogFormDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 用户ID |
|||
*/ |
|||
private String userId; |
|||
/** |
|||
* 活动ID |
|||
*/ |
|||
@NotBlank(message = "活动ID不能为空") |
|||
private String actId; |
|||
/** |
|||
* 打卡类型(0-打卡,1-更新打卡) |
|||
*/ |
|||
@NotBlank(message = "打卡类型不能为空") |
|||
private String clockType; |
|||
/** |
|||
* 打卡位置经度 |
|||
*/ |
|||
@NotBlank(message = "打卡位置经度不能为空") |
|||
private BigDecimal clockLongitude; |
|||
/** |
|||
* 打卡位置纬度 |
|||
*/ |
|||
@NotBlank(message = "打卡位置纬度不能为空") |
|||
private BigDecimal clockLatitude; |
|||
/** |
|||
* 打卡地址 |
|||
*/ |
|||
@NotBlank(message = "打卡地址不能为空") |
|||
private String clockAddress; |
|||
/** |
|||
* 打卡描述 |
|||
*/ |
|||
@NotBlank(message = "打卡描述不能为空") |
|||
private String clockDesc; |
|||
/** |
|||
* 打卡是否有效(0-否,1-是) |
|||
*/ |
|||
@NotBlank(message = "打卡是否有效不能为空") |
|||
private String effectiveFlag; |
|||
/** |
|||
* 打卡图片 |
|||
*/ |
|||
private ArrayList<String> images; |
|||
} |
|||
@ -0,0 +1,68 @@ |
|||
/** |
|||
* 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 lombok.Data; |
|||
|
|||
import javax.validation.constraints.Min; |
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* 活动列表(标准) 入参 |
|||
* |
|||
* @author zhangyong |
|||
* @since v1.0.0 2020-07-20 |
|||
*/ |
|||
@Data |
|||
public class ResiActBaseFormDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
//>>>>>>>>>>>>>>>>>校验分组开始>>>>>>>>>>>>>>>>>>>>>
|
|||
/** |
|||
* 添加用户操作的内部异常分组 |
|||
* 出现错误会提示给前端7000错误码,返回信息为:服务器开小差... |
|||
*/ |
|||
public interface AddUserInternalGroup {} |
|||
|
|||
// <<<<<<<<<<<<<<<<<<<校验分组结束<<<<<<<<<<<<<<<<<<<<<<<<
|
|||
|
|||
/** |
|||
* 客户Id |
|||
*/ |
|||
@NotBlank(message = "客户Id不能为空", groups = { AddUserInternalGroup.class }) |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 页码,从1开始 |
|||
*/ |
|||
@Min(value = 1, message = "页码必须大于0", groups = { AddUserInternalGroup.class }) |
|||
private Integer pageNo; |
|||
|
|||
/** |
|||
* 页容量,默认20页 |
|||
*/ |
|||
@Min(value = 1, message = "每页条数必须大于必须大于0", groups = { AddUserInternalGroup.class }) |
|||
private Integer pageSize; |
|||
|
|||
/** |
|||
* 用户id |
|||
*/ |
|||
private String userId; |
|||
} |
|||
@ -0,0 +1,45 @@ |
|||
package com.epmet.dto.form.resi; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* 重新定位 入参 |
|||
* |
|||
* @author zhangyong |
|||
* @since v1.0.0 2020-07-20 |
|||
*/ |
|||
@Data |
|||
public class ResiActCaculateDistanceFormDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
//>>>>>>>>>>>>>>>>>校验分组开始>>>>>>>>>>>>>>>>>>>>>
|
|||
/** |
|||
* 添加用户操作的内部异常分组 |
|||
* 出现错误会提示给前端7000错误码,返回信息为:服务器开小差... |
|||
*/ |
|||
public interface AddUserInternalGroup {} |
|||
|
|||
// <<<<<<<<<<<<<<<<<<<校验分组结束<<<<<<<<<<<<<<<<<<<<<<<<
|
|||
|
|||
/** |
|||
* 经度 |
|||
*/ |
|||
@NotBlank(message = "经度不能为空", groups = { ResiActBaseFormDTO.AddUserInternalGroup.class }) |
|||
private Double longitude; |
|||
|
|||
/** |
|||
* 纬度 |
|||
*/ |
|||
@NotBlank(message = "纬度不能为空", groups = { ResiActBaseFormDTO.AddUserInternalGroup.class }) |
|||
private Double latitude; |
|||
|
|||
/** |
|||
* 用户id |
|||
*/ |
|||
@NotBlank(message = "活动ID不能为空", groups = { ResiActBaseFormDTO.AddUserInternalGroup.class }) |
|||
private String actId; |
|||
} |
|||
@ -0,0 +1,71 @@ |
|||
/** |
|||
* 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 org.hibernate.validator.constraints.Length; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* 取消报名参数 |
|||
* |
|||
* @author zhangyong |
|||
* @since v1.0.0 2020-07-20 |
|||
*/ |
|||
@Data |
|||
public class ResiActUserCancelSignUpFormDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
//>>>>>>>>>>>>>>>>>校验分组开始>>>>>>>>>>>>>>>>>>>>>
|
|||
/** |
|||
* 添加用户操作的内部异常分组 |
|||
* 出现错误会提示给前端7000错误码,返回信息为:服务器开小差... |
|||
*/ |
|||
public interface AddUserInternalGroup {} |
|||
|
|||
/** |
|||
* 添加用户操作的用户可见异常分组 |
|||
* 该分组用于校验需要返回给前端错误信息提示的列,需要继承CustomerClientShowGroup |
|||
* 返回错误码为8999,提示信息为DTO中具体的列的校验注解message的内容 |
|||
*/ |
|||
public interface AddUserShowGroup extends CustomerClientShowGroup {} |
|||
|
|||
// <<<<<<<<<<<<<<<<<<<校验分组结束<<<<<<<<<<<<<<<<<<<<<<<<
|
|||
|
|||
/** |
|||
* 用户Id |
|||
*/ |
|||
private String userId; |
|||
|
|||
/** |
|||
* 活动ID |
|||
*/ |
|||
@NotBlank(message = "活动ID不能为空", groups = { AddUserInternalGroup.class }) |
|||
private String actId; |
|||
|
|||
/** |
|||
* 取消报名原因 |
|||
*/ |
|||
@NotBlank(message = "请输入取消报名原因", groups = { AddUserInternalGroup.class, AddUserShowGroup.class }) |
|||
@Length(max = 150, message = "取消报名原因不能超过150字", groups = { AddUserInternalGroup.class, AddUserShowGroup.class }) |
|||
private String failureReason; |
|||
} |
|||
@ -0,0 +1,57 @@ |
|||
/** |
|||
* 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 lombok.Data; |
|||
|
|||
import javax.validation.constraints.Min; |
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* 最新活动列表 入参 |
|||
* |
|||
* @author zhangyong |
|||
* @since v1.0.0 2020-07-21 |
|||
*/ |
|||
@Data |
|||
public class ResiLatestActFormDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
//>>>>>>>>>>>>>>>>>校验分组开始>>>>>>>>>>>>>>>>>>>>>
|
|||
/** |
|||
* 添加用户操作的内部异常分组 |
|||
* 出现错误会提示给前端7000错误码,返回信息为:服务器开小差... |
|||
*/ |
|||
public interface AddUserInternalGroup {} |
|||
|
|||
// <<<<<<<<<<<<<<<<<<<校验分组结束<<<<<<<<<<<<<<<<<<<<<<<<
|
|||
|
|||
/** |
|||
* 客户Id |
|||
*/ |
|||
@NotBlank(message = "客户Id不能为空", groups = { AddUserInternalGroup.class }) |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 页容量,默认20页 |
|||
*/ |
|||
@Min(value = 1, message = "每页条数必须大于必须大于0", groups = { AddUserInternalGroup.class }) |
|||
private Integer num; |
|||
} |
|||
@ -0,0 +1,62 @@ |
|||
/** |
|||
* 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 lombok.Data; |
|||
|
|||
import javax.validation.constraints.Min; |
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* 我的活动列表 入参 |
|||
* |
|||
* @author zhangyong |
|||
* @since v1.0.0 2020-07-20 |
|||
*/ |
|||
@Data |
|||
public class ResiMyActFormDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
//>>>>>>>>>>>>>>>>>校验分组开始>>>>>>>>>>>>>>>>>>>>>
|
|||
/** |
|||
* 添加用户操作的内部异常分组 |
|||
* 出现错误会提示给前端7000错误码,返回信息为:服务器开小差... |
|||
*/ |
|||
public interface AddUserInternalGroup {} |
|||
|
|||
// <<<<<<<<<<<<<<<<<<<校验分组结束<<<<<<<<<<<<<<<<<<<<<<<<
|
|||
|
|||
/** |
|||
* 页码,从1开始 |
|||
*/ |
|||
@Min(value = 1, message = "页码必须大于0", groups = { AddUserInternalGroup.class }) |
|||
private Integer pageNo; |
|||
|
|||
/** |
|||
* 页容量,默认20页 |
|||
*/ |
|||
@Min(value = 1, message = "每页条数必须大于必须大于0", groups = { AddUserInternalGroup.class }) |
|||
private Integer pageSize; |
|||
|
|||
/** |
|||
* 用户id |
|||
*/ |
|||
private String userId; |
|||
} |
|||
@ -0,0 +1,26 @@ |
|||
package com.epmet.dto.form.work; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* 活动预览-查看活动详情 |
|||
* |
|||
* @author yinzuomei@elink-cn.com |
|||
* @date 2020/7/21 17:19 |
|||
*/ |
|||
@Data |
|||
public class ActPreviewFormDTO implements Serializable { |
|||
private static final long serialVersionUID = -1603801389350245626L; |
|||
|
|||
public interface UserInternalGroup { |
|||
} |
|||
|
|||
/** |
|||
* 活动草稿id |
|||
*/ |
|||
@NotBlank(message = "活动草稿id不能为空", groups = {UserInternalGroup.class}) |
|||
private String actDraftId; |
|||
} |
|||
@ -0,0 +1,23 @@ |
|||
package com.epmet.dto.form.work; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* 报名审核-待审核列表入参 |
|||
* |
|||
* @author yinzuomei@elink-cn.com |
|||
* @date 2020/7/21 22:12 |
|||
*/ |
|||
@Data |
|||
public class AuditingActUserFormDTO implements Serializable { |
|||
private static final long serialVersionUID = 3811387419859675753L; |
|||
public interface AddUserInternalGroup {} |
|||
/** |
|||
* 活动id |
|||
*/ |
|||
@NotBlank(message = "活动id不能为空", groups = { AddUserInternalGroup.class }) |
|||
private String actId; |
|||
} |
|||
@ -0,0 +1,36 @@ |
|||
package com.epmet.dto.form.work; |
|||
|
|||
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; |
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* 活动内容 |
|||
* |
|||
* @author yinzuomei@elink-cn.com |
|||
* @date 2020/7/21 13:18 |
|||
*/ |
|||
@Data |
|||
public class DraftActContentFormDTO implements Serializable { |
|||
private static final long serialVersionUID = 5236509944250440348L; |
|||
|
|||
public interface UserInternalGroup { |
|||
} |
|||
|
|||
public interface UserShowGroup extends CustomerClientShowGroup { |
|||
} |
|||
|
|||
/** |
|||
* 内容 |
|||
*/ |
|||
@NotBlank(message = "内容不能为空", groups = {UserShowGroup.class}) |
|||
private String content; |
|||
|
|||
/** |
|||
* 内容类型 图片:img;文字:text |
|||
*/ |
|||
@NotBlank(message = "内容类型不能为空,图片:img;文字:text", groups = {UserInternalGroup.class}) |
|||
private String contentType; |
|||
} |
|||
@ -0,0 +1,168 @@ |
|||
package com.epmet.dto.form.work; |
|||
|
|||
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; |
|||
import lombok.Data; |
|||
|
|||
import javax.validation.Valid; |
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
import java.math.BigDecimal; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 预览-保存活动草稿入参DTO |
|||
* |
|||
* @author yinzuomei@elink-cn.com |
|||
* @date 2020/7/21 13:17 |
|||
*/ |
|||
@Data |
|||
public class DraftActInfoFormDTO implements Serializable { |
|||
private static final long serialVersionUID = -4967079570884814526L; |
|||
|
|||
public interface AddUserInternalGroup { |
|||
} |
|||
|
|||
public interface AddDraftUserShowGroup extends CustomerClientShowGroup { |
|||
} |
|||
|
|||
@Valid |
|||
private List<DraftActContentFormDTO> actContent; |
|||
|
|||
/** |
|||
* 活动草稿id,如果是编辑之前的活动草稿,此列是有值的 |
|||
*/ |
|||
private String actDraftId; |
|||
|
|||
|
|||
/** |
|||
* 如果是重新发布活动,此列是有值的 |
|||
*/ |
|||
private String actId; |
|||
|
|||
/** |
|||
* 客户id |
|||
*/ |
|||
@NotBlank(message = "客户id不能为空", groups = {AddUserInternalGroup.class}) |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 活动标题 |
|||
*/ |
|||
private String title; |
|||
|
|||
/** |
|||
* 封面图 |
|||
*/ |
|||
private String coverPic; |
|||
|
|||
/** |
|||
* 活动地点 |
|||
*/ |
|||
private String actAddress; |
|||
|
|||
/** |
|||
* 活动地点-经度 |
|||
*/ |
|||
private BigDecimal actLongitude; |
|||
|
|||
/** |
|||
* 活动地点-纬度 |
|||
*/ |
|||
private BigDecimal actLatitude; |
|||
|
|||
/** |
|||
* 活动预计开始时间yyyy-MM-dd HH:mm |
|||
*/ |
|||
private String actStartTime; |
|||
|
|||
/** |
|||
* 活动预计结束时间yyyy-MM-dd HH:mm |
|||
*/ |
|||
private String actEndTime; |
|||
|
|||
/** |
|||
* 活动人数 |
|||
*/ |
|||
private Integer actQuota; |
|||
|
|||
/** |
|||
* 活动积分 |
|||
*/ |
|||
private Integer reward; |
|||
|
|||
/** |
|||
* 报名审核:true:只有志愿者才可以参加活动,false: 只要是居民就可以参加活动 |
|||
*/ |
|||
private Boolean volunteerLimit; |
|||
|
|||
/** |
|||
* 报名审核: true: 需人工审核 false: 无需审核 |
|||
*/ |
|||
private Boolean auditSwitch; |
|||
|
|||
/** |
|||
* 报名截止时间:yyyy-MM-dd HH:mm |
|||
*/ |
|||
private String signUpEndTime; |
|||
|
|||
/** |
|||
* 报名条件 |
|||
*/ |
|||
private String requirement; |
|||
|
|||
/** |
|||
* 签到开始时间:yyyy-MM-dd HH:mm |
|||
*/ |
|||
private String signInStartTime; |
|||
|
|||
/** |
|||
* 签到结束时间: yyyy-MM-dd HH:mm |
|||
*/ |
|||
private String signInEndTime; |
|||
|
|||
/** |
|||
* 签到地址 |
|||
*/ |
|||
private String signInAddress; |
|||
|
|||
/** |
|||
* 签到地址-纬度 |
|||
*/ |
|||
private BigDecimal signInLatitude; |
|||
|
|||
/** |
|||
* 签到地址-经度 |
|||
*/ |
|||
private BigDecimal signInLongitude; |
|||
|
|||
/** |
|||
* 签到有效范围(米) |
|||
*/ |
|||
private Integer signInRadius; |
|||
|
|||
/** |
|||
* 主办方id |
|||
*/ |
|||
private String sponsorId; |
|||
|
|||
/** |
|||
* 主办方类型:以网格名义:grid , 以机关名义: agency |
|||
*/ |
|||
private String sponsorType; |
|||
|
|||
/** |
|||
* 主办方名称 |
|||
*/ |
|||
private String sponsorName; |
|||
|
|||
/** |
|||
* 联系人 |
|||
*/ |
|||
private String sponsorContacts; |
|||
|
|||
/** |
|||
* 联系电话 |
|||
*/ |
|||
private String sponsorTel; |
|||
|
|||
} |
|||
@ -0,0 +1,36 @@ |
|||
package com.epmet.dto.form.work; |
|||
|
|||
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; |
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* 发布活动入参 |
|||
* |
|||
* @author yinzuomei@elink-cn.com |
|||
* @date 2020/7/21 16:21 |
|||
*/ |
|||
@Data |
|||
public class PublishActContentFormDTO implements Serializable { |
|||
private static final long serialVersionUID = 7541780156596764819L; |
|||
|
|||
public interface UserInternalGroup { |
|||
} |
|||
|
|||
public interface UserShowGroup extends CustomerClientShowGroup { |
|||
} |
|||
|
|||
/** |
|||
* 内容 |
|||
*/ |
|||
@NotBlank(message = "内容不能为空", groups = {UserShowGroup.class}) |
|||
private String content; |
|||
|
|||
/** |
|||
* 内容类型 图片:img;文字:text |
|||
*/ |
|||
@NotBlank(message = "内容类型不能为空,图片:img;文字:text", groups = {UserInternalGroup.class}) |
|||
private String contentType; |
|||
} |
|||
@ -0,0 +1,193 @@ |
|||
package com.epmet.dto.form.work; |
|||
|
|||
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; |
|||
import lombok.Data; |
|||
import org.hibernate.validator.constraints.Length; |
|||
|
|||
import javax.validation.Valid; |
|||
import javax.validation.constraints.Min; |
|||
import javax.validation.constraints.NotBlank; |
|||
import javax.validation.constraints.NotNull; |
|||
import javax.validation.constraints.Size; |
|||
import java.io.Serializable; |
|||
import java.math.BigDecimal; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 发布活动-入参 |
|||
* |
|||
* @author yinzuomei@elink-cn.com |
|||
* @date 2020/7/21 16:15 |
|||
*/ |
|||
@Data |
|||
public class PublishActInfoFormDTO implements Serializable { |
|||
private static final long serialVersionUID = -2066903357493362692L; |
|||
|
|||
public interface AddUserInternalGroup { |
|||
} |
|||
|
|||
public interface AddUserShowGroup extends CustomerClientShowGroup { |
|||
} |
|||
|
|||
@Valid |
|||
@Size(min=1,message = "活动详情不能为空",groups = {AddUserShowGroup.class}) |
|||
private List<PublishActContentFormDTO> actContent; |
|||
|
|||
/** |
|||
* 活动草稿id,如果是编辑之前的活动草稿,此列是有值的 |
|||
*/ |
|||
private String actDraftId; |
|||
|
|||
/** |
|||
* 客户id |
|||
*/ |
|||
@NotBlank(message = "客户id不能为空", groups = {AddUserInternalGroup.class}) |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 活动标题 |
|||
*/ |
|||
@NotBlank(message = "活动标题不能为空", groups = {AddUserShowGroup.class}) |
|||
@Length(min=1, max=50,message = "活动标题限50字以内", groups = {AddUserShowGroup.class}) |
|||
private String title; |
|||
|
|||
/** |
|||
* 封面图 |
|||
*/ |
|||
@NotBlank(message = "封面图不能为空", groups = {AddUserShowGroup.class}) |
|||
private String coverPic; |
|||
|
|||
/** |
|||
* 活动地点 |
|||
*/ |
|||
@NotBlank(message = "活动地点不能为空", groups = {AddUserShowGroup.class}) |
|||
private String actAddress; |
|||
|
|||
/** |
|||
* 活动地点-经度 |
|||
*/ |
|||
@NotNull(message = "活动地点经度不能为空", groups = {AddUserInternalGroup.class}) |
|||
private BigDecimal actLongitude; |
|||
|
|||
/** |
|||
* 活动地点-纬度 |
|||
*/ |
|||
@NotNull(message = "活动地点经度不能为空", groups = {AddUserInternalGroup.class}) |
|||
private BigDecimal actLatitude; |
|||
|
|||
/** |
|||
* 活动预计开始时间yyyy-MM-dd HH:mm |
|||
*/ |
|||
@NotBlank(message = "活动预计开始时间不能为空", groups = {AddUserShowGroup.class}) |
|||
private String actStartTime; |
|||
|
|||
/** |
|||
* 活动预计结束时间yyyy-MM-dd HH:mm |
|||
*/ |
|||
@NotBlank(message = "活动预计结束时间不能为空", groups = {AddUserShowGroup.class}) |
|||
private String actEndTime; |
|||
|
|||
/** |
|||
* 活动人数 |
|||
*/ |
|||
@Min(0) |
|||
private Integer actQuota; |
|||
|
|||
/** |
|||
* 活动积分 |
|||
*/ |
|||
@Min(0) |
|||
private Integer reward; |
|||
|
|||
/** |
|||
* 报名审核:true:只有志愿者才可以参加活动,false: 只要是居民就可以参加活动 |
|||
*/ |
|||
@NotNull(message = "报名身份不能为空", groups = {AddUserInternalGroup.class}) |
|||
private Boolean volunteerLimit; |
|||
|
|||
/** |
|||
* 报名审核: true: 需人工审核 false: 无需审核 |
|||
*/ |
|||
@NotNull(message = "报名审核方式不能为空", groups = {AddUserInternalGroup.class}) |
|||
private Boolean auditSwitch; |
|||
|
|||
/** |
|||
* 报名截止时间:yyyy-MM-dd HH:mm |
|||
*/ |
|||
@NotBlank(message = "报名截止时间不能为空", groups = {AddUserShowGroup.class}) |
|||
private String signUpEndTime; |
|||
|
|||
/** |
|||
* 报名条件 |
|||
*/ |
|||
@NotBlank(message = "报名条件不能为空", groups = {AddUserShowGroup.class}) |
|||
@Length(min=1, max=50,message = "报名条件限200字以内", groups = {AddUserShowGroup.class}) |
|||
private String requirement; |
|||
|
|||
/** |
|||
* 签到开始时间:yyyy-MM-dd HH:mm |
|||
*/ |
|||
@NotBlank(message = "签到开始时间不能为空", groups = {AddUserShowGroup.class}) |
|||
private String signInStartTime; |
|||
|
|||
/** |
|||
* 签到结束时间: yyyy-MM-dd HH:mm |
|||
*/ |
|||
@NotBlank(message = "签到结束时间不能为空", groups = {AddUserShowGroup.class}) |
|||
private String signInEndTime; |
|||
|
|||
/** |
|||
* 签到地址 |
|||
*/ |
|||
@NotBlank(message = "签到地址不能为空", groups = {AddUserShowGroup.class}) |
|||
private String signInAddress; |
|||
|
|||
/** |
|||
* 签到地址-纬度 |
|||
*/ |
|||
@NotNull(message = "签到地址-纬度不能为空", groups = {AddUserInternalGroup.class}) |
|||
private BigDecimal signInLatitude; |
|||
|
|||
/** |
|||
* 签到地址-经度 |
|||
*/ |
|||
@NotNull(message = "签到地址-经度不能为空", groups = {AddUserInternalGroup.class}) |
|||
private BigDecimal signInLongitude; |
|||
|
|||
/** |
|||
* 签到有效范围(米) |
|||
*/ |
|||
@Min(0) |
|||
@NotNull(message = "签到有效范围不能为空", groups = {AddUserShowGroup.class}) |
|||
private Integer signInRadius; |
|||
|
|||
/** |
|||
* 主办方id |
|||
*/ |
|||
@NotBlank(message = "主办方id不能为空", groups = {AddUserInternalGroup.class}) |
|||
private String sponsorId; |
|||
|
|||
/** |
|||
* 主办方类型:以网格名义:grid , 以机关名义: agency |
|||
*/ |
|||
@NotBlank(message = "主办方类型不能为空", groups = {AddUserInternalGroup.class}) |
|||
private String sponsorType; |
|||
|
|||
/** |
|||
* 主办方名称 |
|||
*/ |
|||
@NotBlank(message = "主办方名称不能为空", groups = {AddUserShowGroup.class}) |
|||
private String sponsorName; |
|||
|
|||
/** |
|||
* 联系人 |
|||
*/ |
|||
@NotBlank(message = "联系人不能为空", groups = {AddUserShowGroup.class}) |
|||
private String sponsorContacts; |
|||
|
|||
/** |
|||
* 联系电话 |
|||
*/ |
|||
@NotBlank(message = "联系电话不能为空", groups = {AddUserShowGroup.class}) |
|||
private String sponsorTel; |
|||
} |
|||
@ -0,0 +1,48 @@ |
|||
/** |
|||
* 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.result.resi; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 打卡列表 |
|||
* |
|||
* @author zhangyong |
|||
* @since v1.0.0 2020-07-14 |
|||
*/ |
|||
@Data |
|||
public class ActClockListResultDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 活动打卡人次 |
|||
*/ |
|||
private Integer clockNum; |
|||
|
|||
/** |
|||
* 打卡列表 |
|||
*/ |
|||
private List<Object> clocks; |
|||
|
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,90 @@ |
|||
/** |
|||
* 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.result.resi; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* 活动列表(标准) 返回值 |
|||
* |
|||
* @author zhangyong |
|||
* @since v1.0.0 2020-07-20 |
|||
*/ |
|||
@Data |
|||
public class ResiActInfoResultDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 活动ID |
|||
*/ |
|||
private String actId; |
|||
|
|||
/** |
|||
* 标题 |
|||
*/ |
|||
private String title; |
|||
|
|||
|
|||
/** |
|||
* 活动封面 |
|||
*/ |
|||
private String coverPic; |
|||
|
|||
/** |
|||
* 活动开始时间 |
|||
*/ |
|||
private String actStartTime; |
|||
|
|||
/** |
|||
* 活动结束时间 |
|||
*/ |
|||
private String actEndTime; |
|||
|
|||
/** |
|||
* 活动地点 |
|||
*/ |
|||
private String actAddress; |
|||
|
|||
/** |
|||
* 活动名额类型(true:固定名额(1) false: 不限制名额(0)) |
|||
*/ |
|||
private Boolean actQuotaCategory; |
|||
|
|||
/** |
|||
* 活动名额 |
|||
*/ |
|||
private Integer actQuota; |
|||
|
|||
/** |
|||
* 已报名人数 |
|||
*/ |
|||
private Integer signupNum; |
|||
|
|||
/** |
|||
* 活动状态:(报名中:signing_up;已报满:enough;截止报名: end_sign_up; 已开始: in_progress; 已结束:finished;取消报名canceld;) |
|||
*/ |
|||
private String actCurrentState; |
|||
|
|||
/** |
|||
*用户报名状态(no_signed_up: 未报名,signed_up: 已报名) |
|||
*/ |
|||
private String signupFlag; |
|||
} |
|||
@ -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.dto.result.resi; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* 最新活动列表 返回值 |
|||
* |
|||
* @author zhangyong |
|||
* @since v1.0.0 2020-07-20 |
|||
*/ |
|||
@Data |
|||
public class ResiLatestActResultDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 主键 |
|||
*/ |
|||
private String actId; |
|||
|
|||
/** |
|||
* 标题 |
|||
*/ |
|||
private String title; |
|||
|
|||
|
|||
/** |
|||
* 活动封面 |
|||
*/ |
|||
private String coverPic; |
|||
|
|||
/** |
|||
* 活动开始时间 |
|||
*/ |
|||
private String actStartTime; |
|||
|
|||
/** |
|||
* 活动结束时间 |
|||
*/ |
|||
private String actEndTime; |
|||
|
|||
/** |
|||
* 活动地点 |
|||
*/ |
|||
private String actAddress; |
|||
|
|||
/** |
|||
* 活动名额类型(true:固定名额(1) false: 不限制名额(0)) |
|||
*/ |
|||
private Boolean actQuotaCategory; |
|||
|
|||
/** |
|||
* 活动名额 |
|||
*/ |
|||
private Integer actQuota; |
|||
|
|||
/** |
|||
* 已报名人数 |
|||
*/ |
|||
private Integer signupNum; |
|||
|
|||
/** |
|||
* 活动状态:(报名中:signing_up;已报满:enough;截止报名: end_sign_up; 已开始: in_progress;) |
|||
*/ |
|||
private String actCurrentState; |
|||
} |
|||
@ -0,0 +1,69 @@ |
|||
/** |
|||
* 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.result.resi; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* 活动回顾列表 返回值 |
|||
* |
|||
* @author zhangyong |
|||
* @since v1.0.0 2020-07-20 |
|||
*/ |
|||
@Data |
|||
public class ResiLookBackActResultDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 主键 |
|||
*/ |
|||
private String actId; |
|||
|
|||
/** |
|||
* 标题 |
|||
*/ |
|||
private String title; |
|||
|
|||
/** |
|||
* 活动封面 |
|||
*/ |
|||
private String coverPic; |
|||
|
|||
/** |
|||
* 活动开始时间 |
|||
*/ |
|||
private String actStartTime; |
|||
|
|||
/** |
|||
* 活动结束时间 |
|||
*/ |
|||
private String actEndTime; |
|||
|
|||
/** |
|||
* 活动地点 |
|||
*/ |
|||
private String actAddress; |
|||
|
|||
/** |
|||
* 活动状态:(已结束:finished;) |
|||
*/ |
|||
private String actCurrentState; |
|||
} |
|||
@ -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.dto.result.resi; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* 我的活动列表 返回值 |
|||
* |
|||
* @author zhangyong |
|||
* @since v1.0.0 2020-07-20 |
|||
*/ |
|||
@Data |
|||
public class ResiMyActResultDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 主键 |
|||
*/ |
|||
private String actId; |
|||
|
|||
/** |
|||
* 标题 |
|||
*/ |
|||
private String title; |
|||
|
|||
|
|||
/** |
|||
* 活动封面 |
|||
*/ |
|||
private String coverPic; |
|||
|
|||
/** |
|||
* 活动开始时间 |
|||
*/ |
|||
private String actStartTime; |
|||
|
|||
/** |
|||
* 活动结束时间 |
|||
*/ |
|||
private String actEndTime; |
|||
|
|||
/** |
|||
* 活动地点 |
|||
*/ |
|||
private String actAddress; |
|||
|
|||
/** |
|||
* 活动名额类型(true:固定名额(1) false: 不限制名额(0)) |
|||
*/ |
|||
private Boolean actQuotaCategory; |
|||
|
|||
/** |
|||
* 活动名额 |
|||
*/ |
|||
private Integer actQuota; |
|||
|
|||
/** |
|||
* 已报名人数 |
|||
*/ |
|||
private Integer signupNum; |
|||
|
|||
/** |
|||
* 活动当前状态(审核中auditing,审核通过passed,审核不通过refused,已结束canceld) |
|||
*/ |
|||
private String actCurrentState; |
|||
} |
|||
@ -0,0 +1,25 @@ |
|||
package com.epmet.dto.result.work; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* 活动预览详情页-活动内容详情 |
|||
* |
|||
* @author yinzuomei@elink-cn.com |
|||
* @date 2020/7/21 17:39 |
|||
*/ |
|||
@Data |
|||
public class ActPreviewContentResultDTO implements Serializable { |
|||
private static final long serialVersionUID = -3351984717336783565L; |
|||
/** |
|||
* 内容 |
|||
*/ |
|||
private String content; |
|||
|
|||
/** |
|||
* 内容类型 图片:img;文字:text |
|||
*/ |
|||
private String contentType; |
|||
} |
|||
@ -0,0 +1,92 @@ |
|||
package com.epmet.dto.result.work; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 活动预览-查看活动详情返参修改 |
|||
* |
|||
* @author yinzuomei@elink-cn.com |
|||
* @date 2020/7/21 17:23 |
|||
*/ |
|||
@Data |
|||
public class ActPreviewResultDTO implements Serializable { |
|||
private static final long serialVersionUID = 8655407962470027973L; |
|||
|
|||
/** |
|||
* 活动草稿id |
|||
*/ |
|||
private String actDraftId; |
|||
|
|||
/** |
|||
* 活动标题 |
|||
*/ |
|||
private String title; |
|||
|
|||
/** |
|||
* 活动人数 |
|||
*/ |
|||
private Integer actQuota; |
|||
|
|||
/** |
|||
* true:固定名额 false: 不限制名额 |
|||
*/ |
|||
private Boolean actQuotaCategory; |
|||
|
|||
/** |
|||
* 活动积分 |
|||
*/ |
|||
private Integer reward; |
|||
|
|||
/** |
|||
* 活动开始时间yyyy-MM-dd HH:mm |
|||
*/ |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") |
|||
private Date actStartTime; |
|||
|
|||
/** |
|||
* 活动结束时间yyyy-MM-dd HH:mm |
|||
*/ |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") |
|||
private Date actEndTime; |
|||
|
|||
/** |
|||
* 活动地点 |
|||
*/ |
|||
private String actAddress; |
|||
|
|||
/** |
|||
* 报名截止时间:yyyy-MM-dd HH:mm |
|||
*/ |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") |
|||
private Date signUpEndTime; |
|||
|
|||
/** |
|||
* 报名条件 |
|||
*/ |
|||
private String requirement; |
|||
|
|||
/** |
|||
* 主办方名称 |
|||
*/ |
|||
private String sponsorName; |
|||
|
|||
/** |
|||
* 联系人 |
|||
*/ |
|||
private String sponsorContacts; |
|||
|
|||
/** |
|||
* 联系电话 |
|||
*/ |
|||
private String sponsorTel; |
|||
|
|||
/** |
|||
* 活动详情 |
|||
*/ |
|||
private List<ActPreviewContentResultDTO> actContent; |
|||
} |
|||
@ -0,0 +1,55 @@ |
|||
package com.epmet.dto.result.work; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 报名审核-待审核列表返参 |
|||
* |
|||
* @author yinzuomei@elink-cn.com |
|||
* @date 2020/7/21 22:14 |
|||
*/ |
|||
@Data |
|||
public class AuditingActUserResultDTO implements Serializable { |
|||
private static final long serialVersionUID = 5567556309702585031L; |
|||
|
|||
/** |
|||
* 活动id |
|||
*/ |
|||
private String actId; |
|||
|
|||
/** |
|||
* 用户id |
|||
*/ |
|||
private String userId; |
|||
|
|||
/** |
|||
* 姓名 |
|||
*/ |
|||
private String realName; |
|||
|
|||
/** |
|||
* 微信昵称 |
|||
*/ |
|||
private String nickName; |
|||
|
|||
/** |
|||
* 头像 |
|||
*/ |
|||
private String headImgUrl; |
|||
|
|||
/** |
|||
* 报名时间yyyy-MM-dd HH:mm:ss |
|||
*/ |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
|||
private Date signUpTime; |
|||
|
|||
/** |
|||
* true: 是志愿者 false : 不是志愿者 |
|||
*/ |
|||
private Boolean volunteerFlag; |
|||
|
|||
} |
|||
@ -0,0 +1,51 @@ |
|||
package com.epmet.dto.result.work; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonIgnore; |
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* 居民端根据客户id获取爱心互助自定义配置-返参DTO |
|||
* |
|||
* @author yinzuomei@elink-cn.com |
|||
* @date 2020/7/21 12:45 |
|||
*/ |
|||
@Data |
|||
public class CustomerHeartConfigsResultDTO implements Serializable { |
|||
/** |
|||
* act_customized主键 |
|||
*/ |
|||
@JsonIgnore |
|||
private String actCustomizedId; |
|||
|
|||
/** |
|||
* 标题:志愿者去哪儿 |
|||
*/ |
|||
private String titleName; |
|||
|
|||
/** |
|||
* 咨询热线 |
|||
*/ |
|||
private String hotLine; |
|||
|
|||
/** |
|||
* 活动列表 |
|||
*/ |
|||
private String actListName; |
|||
|
|||
/** |
|||
* 爱心榜 |
|||
*/ |
|||
private String heartRankName; |
|||
|
|||
/** |
|||
* 活动回顾 |
|||
*/ |
|||
private String actReviewName; |
|||
|
|||
/** |
|||
* 我的活动 |
|||
*/ |
|||
private String myActName; |
|||
} |
|||
@ -1,4 +1,4 @@ |
|||
package com.epmet.dto.form.work; |
|||
package com.epmet.dto.result.work; |
|||
|
|||
import lombok.Data; |
|||
|
|||
@ -0,0 +1,17 @@ |
|||
package com.epmet.dto.result.work; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* 发布活动-返参 |
|||
* |
|||
* @author yinzuomei@elink-cn.com |
|||
* @date 2020/7/21 18:29 |
|||
*/ |
|||
@Data |
|||
public class PublishActResultDTO implements Serializable { |
|||
private static final long serialVersionUID = 4699176252192192495L; |
|||
private String actId; |
|||
} |
|||
@ -0,0 +1,21 @@ |
|||
package com.epmet.dto.result.work; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* 预览-保存活动草稿返参DTO |
|||
* |
|||
* @author yinzuomei@elink-cn.com |
|||
* @date 2020/7/21 12:53 |
|||
*/ |
|||
@Data |
|||
public class SaveActDraftResultDTO implements Serializable { |
|||
private static final long serialVersionUID = -111427814347693729L; |
|||
|
|||
/** |
|||
* 活动草稿id |
|||
*/ |
|||
private String actDraftId; |
|||
} |
|||
@ -0,0 +1,70 @@ |
|||
package com.epmet.constant; |
|||
|
|||
/** |
|||
* 描述一下 |
|||
* |
|||
* @author yinzuomei@elink-cn.com |
|||
* @date 2020/7/21 20:21 |
|||
*/ |
|||
public interface ActConstant { |
|||
/** |
|||
* 文本 |
|||
*/ |
|||
String ACT_CONTENT_TYPE_TEXT = "text"; |
|||
|
|||
/** |
|||
* 图片 |
|||
*/ |
|||
String ACT_CONTENT_TYPE_IMG="img"; |
|||
|
|||
/** |
|||
* (1)活动状态 |
|||
* act_info表中的status,已发布/报名中, |
|||
* 发布成功后自动赋值 |
|||
*/ |
|||
String ACT_STATUS_PUBLISHED="published"; |
|||
|
|||
/** |
|||
* (2)活动状态 |
|||
* 活动已取消, |
|||
* 成功取消活动后,写入act_info表中的status, |
|||
*/ |
|||
String ACT_STATUS_CANCELED="canceled"; |
|||
|
|||
/** |
|||
* (3)活动状态 |
|||
* 活动已结束 |
|||
* 活动后,写入act_info表中的status, |
|||
*/ |
|||
String ACT_STATUS_FINISHED="finished"; |
|||
|
|||
/** |
|||
* 发布活动时,选择的主办方名义,已组织名义发布 |
|||
*/ |
|||
String SPONSOR_AGENCY="agency"; |
|||
|
|||
/** |
|||
* 发布活动时,选择的主办方名义,已网格名义发布 |
|||
*/ |
|||
String SPONSOR_GRID="grid"; |
|||
|
|||
/** |
|||
* 活动操作日志:取消活动 |
|||
*/ |
|||
String ACT_OPER_TYPE_CANCEL="cancel"; |
|||
|
|||
/** |
|||
* 活动操作日志:发布活动 |
|||
*/ |
|||
String ACT_OPER_TYPE_PUBLISH="publish"; |
|||
|
|||
/** |
|||
* 活动操作日志:结束活动 |
|||
*/ |
|||
String ACT_OPER_TYPE_FINISH="finish"; |
|||
|
|||
/** |
|||
* 活动操作日志:重新发布活动 |
|||
*/ |
|||
String ACT_OPER_TYPE_UPDATE="update"; |
|||
} |
|||
@ -0,0 +1,168 @@ |
|||
package com.epmet.controller; |
|||
|
|||
import com.epmet.commons.tools.annotation.LoginUser; |
|||
import com.epmet.commons.tools.security.dto.TokenDto; |
|||
import com.epmet.commons.tools.validator.ValidatorUtils; |
|||
import com.epmet.dto.form.resi.*; |
|||
import com.epmet.dto.result.resi.*; |
|||
import com.epmet.service.ActInfoService; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 居民端-活动列表相关api |
|||
* |
|||
* @author yinzuomei@elink-cn.com |
|||
* @date 2020/7/19 23:17 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("/resi/act") |
|||
public class ResiActListController { |
|||
|
|||
@Autowired |
|||
private ActInfoService actInfoService; |
|||
|
|||
/** |
|||
* 活动列表(包含状态:报名中:signing_up;已报满:enough;截止报名: end_sign_up; 已开始: in_progress; 已结束:finished;) |
|||
* |
|||
* @param tokenDto |
|||
* @param formDto |
|||
* @return com.epmet.commons.tools.utils.Result<java.util.List<com.epmet.dto.result.resi.ResiActInfoResultDTO>> |
|||
* @Author zhangyong |
|||
* @Date 13:39 2020-07-21 |
|||
**/ |
|||
@PostMapping("list") |
|||
public Result<List<ResiActInfoResultDTO>> listAct(@LoginUser TokenDto tokenDto, @RequestBody ResiActBaseFormDTO formDto) { |
|||
return actInfoService.listAct(tokenDto, formDto); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 我的活动-审核中 |
|||
* |
|||
* @param tokenDto |
|||
* @param formDto |
|||
* @return java.util.List<com.epmet.dto.result.resi.ResiMyActResultDTO> |
|||
* @Author zhangyong |
|||
* @Date 13:53 2020-07-21 |
|||
**/ |
|||
@PostMapping("list/auditing") |
|||
public Result<List<ResiMyActResultDTO>> listAuditing(@LoginUser TokenDto tokenDto, @RequestBody ResiMyActFormDTO formDto) { |
|||
return actInfoService.myActListAuditing(tokenDto, formDto); |
|||
} |
|||
|
|||
/** |
|||
* 我的活动-未通过 |
|||
* |
|||
* @param tokenDto |
|||
* @param formDto |
|||
* @return java.util.List<com.epmet.dto.result.resi.ResiMyActResultDTO> |
|||
* @Author zhangyong |
|||
* @Date 13:53 2020-07-21 |
|||
**/ |
|||
@PostMapping("list/refused") |
|||
public Result<List<ResiMyActResultDTO>> listRefused(@LoginUser TokenDto tokenDto, @RequestBody ResiMyActFormDTO formDto) { |
|||
return actInfoService.myActListRefused(tokenDto, formDto); |
|||
} |
|||
|
|||
/** |
|||
* 我的活动-已通过 |
|||
* |
|||
* @param tokenDto |
|||
* @param formDto |
|||
* @return java.util.List<com.epmet.dto.result.resi.ResiMyActResultDTO> |
|||
* @Author zhangyong |
|||
* @Date 13:53 2020-07-21 |
|||
**/ |
|||
@PostMapping("list/passed") |
|||
public Result<List<ResiMyActResultDTO>> listPassed(@LoginUser TokenDto tokenDto, @RequestBody ResiMyActFormDTO formDto) { |
|||
return actInfoService.myActListPassed(tokenDto, formDto); |
|||
} |
|||
|
|||
/** |
|||
* 我的活动-已结束 |
|||
* |
|||
* @param tokenDto |
|||
* @param formDto |
|||
* @return java.util.List<com.epmet.dto.result.resi.ResiMyActResultDTO> |
|||
* @Author zhangyong |
|||
* @Date 13:53 2020-07-21 |
|||
**/ |
|||
@PostMapping("list/canceld") |
|||
public Result<List<ResiMyActResultDTO>> listcanceld(@LoginUser TokenDto tokenDto, @RequestBody ResiMyActFormDTO formDto) { |
|||
return actInfoService.myActListCanceld(tokenDto, formDto); |
|||
} |
|||
|
|||
/** |
|||
* 最新活动列表 |
|||
* |
|||
* @param formDto |
|||
* @return java.util.List<com.epmet.dto.result.resi.ResiLatestActResultDTO> |
|||
* @Author zhangyong |
|||
* @Date 13:53 2020-07-21 |
|||
**/ |
|||
@PostMapping("list/latestact") |
|||
public Result<List<ResiLatestActResultDTO>> latestAct(@RequestBody ResiLatestActFormDTO formDto) { |
|||
return actInfoService.latestAct(formDto); |
|||
} |
|||
|
|||
/* |
|||
* 正在进行中的活动 |
|||
* 进入活动的快捷入口, 前端只取第一条 |
|||
* |
|||
* @param tokenDto |
|||
* @return com.epmet.commons.tools.utils.Result<java.util.List<com.epmet.dto.result.resi.ResiInProgressActResultDTO>> |
|||
* @Author zhangyong |
|||
* @Date 14:56 2020-07-21 |
|||
**/ |
|||
@PostMapping("inprogress") |
|||
public Result<List<ResiInProgressActResultDTO>> inProgressAct(@LoginUser TokenDto tokenDto) { |
|||
return actInfoService.inProgressAct(tokenDto); |
|||
} |
|||
|
|||
/** |
|||
* 活动回顾列表(包含状态:已结束:finished;) |
|||
* @param formDto |
|||
* @return com.epmet.commons.tools.utils.Result<java.util.List<com.epmet.dto.result.resi.ResiLookBackActResultDTO>> |
|||
* @Author zhangyong |
|||
* @Date 13:39 2020-07-21 |
|||
**/ |
|||
@PostMapping("actlookback") |
|||
public Result<List<ResiLookBackActResultDTO>> actLookBack(@RequestBody ResiActBaseFormDTO formDto) { |
|||
return actInfoService.actLookBack(formDto); |
|||
} |
|||
|
|||
/** |
|||
* 取消活动报名 |
|||
* |
|||
* @param tokenDto |
|||
* @param formDTO |
|||
* @return com.epmet.commons.tools.utils.Result |
|||
* @Author zhangyong |
|||
* @Date 09:29 2020-07-20 |
|||
**/ |
|||
@PostMapping("cancelsignup") |
|||
public Result cancelSignUp(@LoginUser TokenDto tokenDto, @RequestBody ResiActUserCancelSignUpFormDTO formDTO) { |
|||
ValidatorUtils.validateEntity(formDTO); |
|||
return actInfoService.cancelSignUp(tokenDto, formDTO); |
|||
} |
|||
|
|||
/** |
|||
* 重新定位 |
|||
* 根据活动id、前端传的实时经纬度,与活动设置的经纬度相比较,判断用户是否已到达打卡地点 |
|||
* |
|||
* @param formDTO |
|||
* @return javax.xml.transform.Result |
|||
* @Author zhangyong |
|||
* @Date 16:48 2020-07-20 |
|||
**/ |
|||
@PostMapping("checksigninaddress") |
|||
public Result cancelSignUp(@RequestBody ResiActCaculateDistanceFormDTO formDTO) { |
|||
ValidatorUtils.validateEntity(formDTO); |
|||
return actInfoService.checkSignInAddress(formDTO); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,23 @@ |
|||
package com.epmet.service; |
|||
|
|||
import com.epmet.dto.form.work.AuditingActUserFormDTO; |
|||
import com.epmet.dto.result.work.AuditingActUserResultDTO; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 工作端:活动人员相关api |
|||
* |
|||
* @author yinzuomei@elink-cn.com |
|||
* @date 2020/7/21 22:23 |
|||
*/ |
|||
public interface WorkActUserService { |
|||
/** |
|||
* @return java.util.List<com.epmet.dto.result.work.AuditingActUserResultDTO> |
|||
* @param formDTO |
|||
* @author yinzuomei |
|||
* @description 报名审核-待审核列表 |
|||
* @Date 2020/7/21 22:25 |
|||
**/ |
|||
List<AuditingActUserResultDTO> getAuditingList(AuditingActUserFormDTO formDTO); |
|||
} |
|||
@ -0,0 +1,110 @@ |
|||
package com.epmet.service.impl; |
|||
|
|||
import com.epmet.commons.tools.constant.NumConstant; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.dto.ActUserRelationDTO; |
|||
import com.epmet.dto.HeartUserInfoDTO; |
|||
import com.epmet.dto.form.work.AuditingActUserFormDTO; |
|||
import com.epmet.dto.result.UserBaseInfoResultDTO; |
|||
import com.epmet.dto.result.work.AuditingActUserResultDTO; |
|||
import com.epmet.feign.EpmetUserOpenFeignClient; |
|||
import com.epmet.service.ActUserRelationService; |
|||
import com.epmet.service.HeartUserInfoService; |
|||
import com.epmet.service.WorkActUserService; |
|||
import org.apache.logging.log4j.LogManager; |
|||
import org.apache.logging.log4j.Logger; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 工作端:活动人员相关api |
|||
* |
|||
* @author yinzuomei@elink-cn.com |
|||
* @date 2020/7/21 22:23 |
|||
*/ |
|||
@Service |
|||
public class WorkActUserServiceImpl implements WorkActUserService { |
|||
private Logger logger = LogManager.getLogger(WorkActUserServiceImpl.class); |
|||
@Autowired |
|||
private ActUserRelationService actUserRelationService; |
|||
@Autowired |
|||
private HeartUserInfoService heartUserInfoService; |
|||
@Autowired |
|||
private EpmetUserOpenFeignClient epmetUserOpenFeignClient; |
|||
|
|||
/** |
|||
* @param formDTO |
|||
* @return java.util.List<com.epmet.dto.result.work.AuditingActUserResultDTO> |
|||
* @author yinzuomei |
|||
* @description 报名审核-待审核列表 |
|||
* @Date 2020/7/21 22:25 |
|||
**/ |
|||
@Override |
|||
public List<AuditingActUserResultDTO> getAuditingList(AuditingActUserFormDTO formDTO) { |
|||
List<AuditingActUserResultDTO> list=new ArrayList<>(); |
|||
//查询出待审核的人员列表
|
|||
List<ActUserRelationDTO> actUserRelationDTOList=actUserRelationService.getAuditingUserList(formDTO.getActId()); |
|||
if(null==actUserRelationDTOList||actUserRelationDTOList.size()==0){ |
|||
logger.info(String.format("当前活动%s没有待审核的报名人员",formDTO.getActId())); |
|||
return list; |
|||
} |
|||
//查询出待审核的人员id集合
|
|||
List<String> userIdList=actUserRelationService.getAuditingUserIds(formDTO.getActId()); |
|||
//根据待审核的人员结合,查询出用户基本信息
|
|||
List<UserBaseInfoResultDTO> userInfoList=this.queryUserBaseInfo(userIdList); |
|||
//调用epemet_user服务获取用户的基本信息
|
|||
for(ActUserRelationDTO actUserRelationDTO:actUserRelationDTOList){ |
|||
AuditingActUserResultDTO resultDTO=new AuditingActUserResultDTO(); |
|||
resultDTO.setActId(formDTO.getActId()); |
|||
resultDTO.setUserId(actUserRelationDTO.getUserId()); |
|||
resultDTO.setSignUpTime(actUserRelationDTO.getCreatedTime()); |
|||
//微信基本信息先默认为空字符串
|
|||
resultDTO.setRealName(NumConstant.EMPTY_STR); |
|||
resultDTO.setNickName(NumConstant.EMPTY_STR); |
|||
resultDTO.setHeadImgUrl(NumConstant.EMPTY_STR); |
|||
|
|||
HeartUserInfoDTO heartUserInfoDTO=heartUserInfoService.getByUserId(actUserRelationDTO.getUserId()); |
|||
//true: 是志愿者 false : 不是志愿者
|
|||
if(null!=heartUserInfoDTO){ |
|||
resultDTO.setVolunteerFlag(heartUserInfoDTO.getVolunteerFlag()); |
|||
}else{ |
|||
resultDTO.setVolunteerFlag(false); |
|||
} |
|||
//赋值基本信息
|
|||
for(UserBaseInfoResultDTO userBaseInfoResultDTO:userInfoList){ |
|||
if(actUserRelationDTO.getUserId().equals(userBaseInfoResultDTO.getUserId())){ |
|||
resultDTO.setRealName(userBaseInfoResultDTO.getRealName()); |
|||
resultDTO.setNickName(userBaseInfoResultDTO.getNickname()); |
|||
resultDTO.setHeadImgUrl(userBaseInfoResultDTO.getHeadImgUrl()); |
|||
break; |
|||
} |
|||
} |
|||
list.add(resultDTO); |
|||
} |
|||
return list; |
|||
} |
|||
|
|||
/** |
|||
* @return java.util.List<com.epmet.dto.result.UserBaseInfoResultDTO> |
|||
* @param userIdList |
|||
* @author yinzuomei |
|||
* @description 传入用户id集合,返回用户的基本信息(包含微信基本信息) |
|||
* @Date 2020/7/22 10:38 |
|||
**/ |
|||
private List<UserBaseInfoResultDTO> queryUserBaseInfo(List<String> userIdList) { |
|||
List<UserBaseInfoResultDTO> userInfoList=new ArrayList<>(); |
|||
if(null==userIdList||userIdList.size()==0){ |
|||
return userInfoList; |
|||
} |
|||
Result<List<UserBaseInfoResultDTO>> resultUserList =epmetUserOpenFeignClient.queryUserBaseInfo(userIdList); |
|||
if(resultUserList.success()&&resultUserList.getData().size()>0){ |
|||
return resultUserList.getData(); |
|||
}else{ |
|||
logger.warn("查询用户基本信息接口返回失败"); |
|||
} |
|||
return userInfoList; |
|||
} |
|||
} |
|||
@ -0,0 +1,40 @@ |
|||
package com.epmet.utils; |
|||
|
|||
|
|||
/** |
|||
* 计算两个经纬度之间相差的距离(米) |
|||
* |
|||
* @Auther: zhangyong |
|||
* @Date: 2020-07-17 14:54 |
|||
*/ |
|||
public class CaculateDistance { |
|||
|
|||
private static final double EARTH_RADIUS = 6378137; |
|||
private static double rad(double d) { |
|||
return d * Math.PI / 180.0; |
|||
} |
|||
|
|||
/** |
|||
* 根据两点间经纬度坐标(double值),计算两点间距离,单位为米 |
|||
* |
|||
* @param lng1 经度1 |
|||
* @param lat1 纬度1 |
|||
* @param lng2 经度2 |
|||
* @param lat2 纬度2 |
|||
* @return double |
|||
* @Author zhangyong |
|||
* @Date 14:56 2020-07-17 |
|||
**/ |
|||
public static double getDistance(double lng1, double lat1, double lng2, double lat2) { |
|||
double radLat1 = rad(lat1); |
|||
double radLat2 = rad(lat2); |
|||
double a = radLat1 - radLat2; |
|||
double b = rad(lng1) - rad(lng2); |
|||
double s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a/2),2) + |
|||
Math.cos(radLat1)*Math.cos(radLat2)*Math.pow(Math.sin(b/2),2))); |
|||
s = s * EARTH_RADIUS; |
|||
s = Math.round(s * 10000) / 10000; |
|||
return s; |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,13 @@ |
|||
package com.epmet.service; |
|||
|
|||
import com.epmet.commons.tools.utils.Result; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @CreateTime 2020/7/20 10:21 |
|||
*/ |
|||
public interface ComponentAccessTokenService { |
|||
|
|||
Result componentAccessTokenJob(); |
|||
|
|||
} |
|||
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue