37 changed files with 1537 additions and 62 deletions
			
			
		| @ -0,0 +1,46 @@ | |||
| package com.epmet.dto.form.resi; | |||
| 
 | |||
| import lombok.Data; | |||
| 
 | |||
| import javax.validation.constraints.Min; | |||
| import javax.validation.constraints.NotBlank; | |||
| import java.io.Serializable; | |||
| 
 | |||
| /** | |||
|  * 活动内容(活动详情-已结束-回顾稿) 入参 | |||
|  * | |||
|  * @Auther: zhangyong | |||
|  * @Date: 2020-07-21 18:12 | |||
|  */ | |||
| @Data | |||
| public class ResiActContentFormDTO implements Serializable { | |||
| 
 | |||
|     private static final long serialVersionUID = 1L; | |||
| 
 | |||
|     //>>>>>>>>>>>>>>>>>校验分组开始>>>>>>>>>>>>>>>>>>>>>
 | |||
|     /** | |||
|      * 添加用户操作的内部异常分组 | |||
|      * 出现错误会提示给前端7000错误码,返回信息为:服务器开小差... | |||
|      */ | |||
|     public interface AddUserInternalGroup {} | |||
| 
 | |||
|     // <<<<<<<<<<<<<<<<<<<校验分组结束<<<<<<<<<<<<<<<<<<<<<<<<
 | |||
| 
 | |||
|     /** | |||
|      * 活动Id | |||
|      */ | |||
|     @NotBlank(message = "活动Id不能为空", groups = { ResiActBaseFormDTO.AddUserInternalGroup.class }) | |||
|     private String actId; | |||
| 
 | |||
|     /** | |||
|      * 页码,从1开始 | |||
|      */ | |||
|     @Min(value = 1, message = "页码必须大于0", groups = { ResiActBaseFormDTO.AddUserInternalGroup.class }) | |||
|     private Integer pageNo; | |||
| 
 | |||
|     /** | |||
|      * 页容量,默认20页 | |||
|      */ | |||
|     @Min(value = 1, message = "每页条数必须大于必须大于0", groups = { ResiActBaseFormDTO.AddUserInternalGroup.class }) | |||
|     private Integer pageSize; | |||
| } | |||
| @ -0,0 +1,38 @@ | |||
| package com.epmet.dto.form.resi; | |||
| 
 | |||
| import lombok.Data; | |||
| 
 | |||
| import javax.validation.constraints.NotBlank; | |||
| import java.io.Serializable; | |||
| 
 | |||
| /** | |||
|  * 活动详情 入参 | |||
|  * | |||
|  * @Auther: zhangyong | |||
|  * @Date: 2020-07-21 18:12 | |||
|  */ | |||
| @Data | |||
| public class ResiActDetailFormDTO implements Serializable { | |||
| 
 | |||
|     private static final long serialVersionUID = 1L; | |||
| 
 | |||
|     //>>>>>>>>>>>>>>>>>校验分组开始>>>>>>>>>>>>>>>>>>>>>
 | |||
|     /** | |||
|      * 添加用户操作的内部异常分组 | |||
|      * 出现错误会提示给前端7000错误码,返回信息为:服务器开小差... | |||
|      */ | |||
|     public interface AddUserInternalGroup {} | |||
| 
 | |||
|     // <<<<<<<<<<<<<<<<<<<校验分组结束<<<<<<<<<<<<<<<<<<<<<<<<
 | |||
| 
 | |||
|     /** | |||
|      * 活动Id | |||
|      */ | |||
|     @NotBlank(message = "活动Id不能为空", groups = { ResiActBaseFormDTO.AddUserInternalGroup.class }) | |||
|     private String actId; | |||
| 
 | |||
|     /** | |||
|      * 用户id | |||
|      */ | |||
|     private String userId; | |||
| } | |||
| @ -0,0 +1,56 @@ | |||
| /** | |||
|  * 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.Date; | |||
| 
 | |||
| 
 | |||
| /** | |||
|  * 活动内容 | |||
|  * | |||
|  * @author generator generator@elink-cn.com | |||
|  * @since v1.0.0 2020-07-19 | |||
|  */ | |||
| @Data | |||
| public class ResiActContentResultDTO implements Serializable { | |||
| 
 | |||
|     private static final long serialVersionUID = 1L; | |||
| 
 | |||
|     /** | |||
|      * 主键 | |||
|      */ | |||
| 	private String actContentId; | |||
| 
 | |||
|     /** | |||
|      * 内容 | |||
|      */ | |||
| 	private String content; | |||
| 
 | |||
|     /** | |||
|      * 内容类型 图片:img;文字:text | |||
|      */ | |||
| 	private String contentType; | |||
| 
 | |||
|     /** | |||
|      * 内容顺序 从1开始 | |||
|      */ | |||
| 	private Integer orderNum; | |||
| } | |||
| @ -0,0 +1,140 @@ | |||
| /** | |||
|  * 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-20 | |||
|  */ | |||
| @Data | |||
| public class ResiActDetailResultDTO implements Serializable { | |||
| 
 | |||
|     private static final long serialVersionUID = 1L; | |||
| 
 | |||
|     /** | |||
|      * 主键 | |||
|      */ | |||
|     private String actId; | |||
| 
 | |||
|     /** | |||
|      * 标题 | |||
|      */ | |||
|     private String title; | |||
| 
 | |||
|     /** | |||
|      * 联系人 | |||
|      */ | |||
|     private String contacts; | |||
| 
 | |||
|     /** | |||
|      * 联系电话 | |||
|      */ | |||
|     private String tel; | |||
| 
 | |||
|     /** | |||
|      * 报名截止时间(yyyy-MM-dd HH:mm) | |||
|      */ | |||
|     private String signUpEndTime; | |||
| 
 | |||
|     /** | |||
|      * 活动开始时间(yyyy-MM-dd HH:mm) | |||
|      */ | |||
|     private String actStartTime; | |||
| 
 | |||
|     /** | |||
|      * 活动结束时间(yyyy-MM-dd HH:mm) | |||
|      */ | |||
|     private String actEndTime; | |||
| 
 | |||
|     /** | |||
|      * 活动地点 | |||
|      */ | |||
|     private String actAddress; | |||
| 
 | |||
|     /** | |||
|      * 活动名额类型(true:固定名额  false: 不限制名额) | |||
|      */ | |||
|     private Boolean actQuotaCategory; | |||
| 
 | |||
|     /** | |||
|      * 活动名额 | |||
|      */ | |||
|     private Integer actQuota; | |||
| 
 | |||
|     /** | |||
|      * 已报名人数 | |||
|      */ | |||
|     private Integer signupNum; | |||
| 
 | |||
|     /** | |||
|      * 积分奖励 | |||
|      */ | |||
|     private Integer reward; | |||
| 
 | |||
|     /** | |||
|      * 招募要求 | |||
|      */ | |||
|     private String requirement; | |||
| 
 | |||
|     /** | |||
|      * 活动详情 | |||
|      */ | |||
|     private List<ResiActContentResultDTO> actContent; | |||
| 
 | |||
|     /** | |||
|      * 用户当前状态(sign_up-我要报名,canceld-取消报名,enough-已报满,end_sign_up-截止报名,in_progress-已开始; finished-已结束,canceled-已取消) | |||
|      */ | |||
|     private String currentUserStatus; | |||
| 
 | |||
|     /** | |||
|      * 用户是否是志愿者身份 (true:是,false 不是) | |||
|      */ | |||
|     private Boolean userVolunteerFlag; | |||
| 
 | |||
|     /** | |||
|      * 是否需要是志愿者(true:只有志愿者才可以参加活动,false: 只要是居民就可以参加活动) | |||
|      */ | |||
|     private Boolean volunteerLimit; | |||
| 
 | |||
|     /** | |||
|      * 活动实际开始时间(yyyy-MM-dd HH:mm) | |||
|      */ | |||
|     private String actualStartTime; | |||
| 
 | |||
|     /** | |||
|      * 活动实际结束时间(yyyy-MM-dd HH:mm) | |||
|      */ | |||
|     private String actualEndTime; | |||
| 
 | |||
|     /** | |||
|      * 主办方 | |||
|      */ | |||
|     private String sponsor; | |||
| 
 | |||
|     /** | |||
|      * 是否已签到(true已签到,false未签到) | |||
|      */ | |||
|     private Boolean isSignUp; | |||
| } | |||
| @ -0,0 +1,99 @@ | |||
| /** | |||
|  * 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 ResiActRefusedDetailResultDTO implements Serializable { | |||
| 
 | |||
|     private static final long serialVersionUID = 1L; | |||
| 
 | |||
|     /** | |||
|      * 主键 | |||
|      */ | |||
|     private String actId; | |||
| 
 | |||
|     /** | |||
|      * 标题 | |||
|      */ | |||
|     private String title; | |||
| 
 | |||
|     /** | |||
|      * 报名截止时间(yyyy-MM-dd HH:mm) | |||
|      */ | |||
|     private String signUpEndTime; | |||
| 
 | |||
|     /** | |||
|      * 活动开始时间(yyyy-MM-dd HH:mm) | |||
|      */ | |||
|     private String actStartTime; | |||
| 
 | |||
|     /** | |||
|      * 活动结束时间(yyyy-MM-dd HH:mm) | |||
|      */ | |||
|     private String actEndTime; | |||
| 
 | |||
|     /** | |||
|      * 活动地点 | |||
|      */ | |||
|     private String actAddress; | |||
| 
 | |||
|     /** | |||
|      * 活动名额类型(true:固定名额  false: 不限制名额) | |||
|      */ | |||
|     private Boolean actQuotaCategory; | |||
| 
 | |||
|     /** | |||
|      * 活动名额 | |||
|      */ | |||
|     private Integer actQuota; | |||
| 
 | |||
|     /** | |||
|      * 联系人 | |||
|      */ | |||
|     private String contacts; | |||
| 
 | |||
|     /** | |||
|      * 联系电话 | |||
|      */ | |||
|     private String tel; | |||
| 
 | |||
|     /** | |||
|      * 积分奖励 | |||
|      */ | |||
|     private Integer reward; | |||
| 
 | |||
|     /** | |||
|      * 主办方 | |||
|      */ | |||
|     private String sponsor; | |||
| 
 | |||
|     /** | |||
|      * 未通过原因 | |||
|      */ | |||
|     private String failureReason; | |||
| } | |||
| @ -0,0 +1,55 @@ | |||
| /** | |||
|  * 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 generator generator@elink-cn.com | |||
|  * @since v1.0.0 2020-07-19 | |||
|  */ | |||
| @Data | |||
| public class ResiActSummaryResultDTO implements Serializable { | |||
| 
 | |||
|     private static final long serialVersionUID = 1L; | |||
| 
 | |||
|     /** | |||
|      * 主键 | |||
|      */ | |||
| 	private String summaryId; | |||
| 
 | |||
|     /** | |||
|      * 内容 | |||
|      */ | |||
| 	private String content; | |||
| 
 | |||
|     /** | |||
|      * 内容类型 图片:img;文字:text | |||
|      */ | |||
| 	private String contentType; | |||
| 
 | |||
|     /** | |||
|      * 内容顺序 从1开始 | |||
|      */ | |||
| 	private Integer orderNum; | |||
| } | |||
| @ -0,0 +1,60 @@ | |||
| /** | |||
|  * 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 generator generator@elink-cn.com | |||
|  * @since v1.0.0 2020-07-19 | |||
|  */ | |||
| @Data | |||
| public class ResiLeaderboardResultDTO implements Serializable { | |||
| 
 | |||
|     private static final long serialVersionUID = 1L; | |||
| 
 | |||
|     /** | |||
|      * 微信昵称 | |||
|      */ | |||
| 	private String nickname; | |||
| 
 | |||
|     /** | |||
|      * 微信头像 | |||
|      */ | |||
| 	private String headImg; | |||
| 
 | |||
|     /** | |||
|      * 是否是志愿者(true:是志愿者,false: 不是志愿者) | |||
|      */ | |||
| 	private Boolean volunteerFlag; | |||
| 
 | |||
|     /** | |||
|      * 爱心时长(单位:小时) | |||
|      */ | |||
| 	private Integer kindnessTime; | |||
| 
 | |||
|     /** | |||
|      * 参加次数 | |||
|      */ | |||
|     private Integer participationNum; | |||
| } | |||
| @ -0,0 +1,32 @@ | |||
| package com.epmet.feign; | |||
| 
 | |||
| import com.epmet.commons.tools.constant.ServiceConstant; | |||
| import com.epmet.commons.tools.utils.Result; | |||
| import com.epmet.dto.result.UserBaseInfoResultDTO; | |||
| import com.epmet.feign.fallback.EpmetUserFeignClientFallBack; | |||
| import org.springframework.cloud.openfeign.FeignClient; | |||
| import org.springframework.web.bind.annotation.PostMapping; | |||
| import org.springframework.web.bind.annotation.RequestBody; | |||
| 
 | |||
| import java.util.List; | |||
| 
 | |||
| 
 | |||
| /** | |||
|  * 用户模块 | |||
|  * | |||
|  * @author zhangyong | |||
|  * @date 2020/7/22 14:51 | |||
|  */ | |||
| @FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallback = EpmetUserFeignClientFallBack.class) | |||
| public interface EpmetUserFeignClient { | |||
| 
 | |||
| 	/** | |||
| 	 * @param userIds | |||
| 	 * @return com.epmet.commons.tools.utils.Result<java.util.List < com.epmet.dto.result.UserBaseInfoResultDTO>> | |||
| 	 * @author zhangyong | |||
| 	 * @description 传入用户id集合,返回用户的基本信息(包含微信基本信息) | |||
| 	 * @Date 2020/7/22 9:30 | |||
| 	 **/ | |||
| 	@PostMapping("epmetuser/userbaseinfo/queryuserbaseinfo") | |||
| 	Result<List<UserBaseInfoResultDTO>> heartQueryUserBaseInfo(@RequestBody List<String> userIds); | |||
| } | |||
| @ -0,0 +1,25 @@ | |||
| package com.epmet.feign.fallback; | |||
| 
 | |||
| import com.epmet.commons.tools.constant.ServiceConstant; | |||
| import com.epmet.commons.tools.utils.ModuleUtils; | |||
| import com.epmet.commons.tools.utils.Result; | |||
| import com.epmet.dto.UserWechatDTO; | |||
| import com.epmet.dto.result.UserBaseInfoResultDTO; | |||
| import com.epmet.feign.EpmetUserFeignClient; | |||
| import org.springframework.stereotype.Component; | |||
| 
 | |||
| import java.util.List; | |||
| 
 | |||
| 
 | |||
| /** | |||
|  * @author zhangyong | |||
|  * @date 2020/7/22 14:51 | |||
|  */ | |||
| @Component | |||
| public class EpmetUserFeignClientFallBack implements EpmetUserFeignClient { | |||
| 
 | |||
|     @Override | |||
|     public Result<List<UserBaseInfoResultDTO>> heartQueryUserBaseInfo(List<String> userIds) { | |||
|         return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "heartQueryUserBaseInfo", userIds); | |||
|     } | |||
| } | |||
| @ -0,0 +1,40 @@ | |||
| /** | |||
|  * 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.controller; | |||
| 
 | |||
| import com.epmet.dao.VolunteerInfoDao; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| 
 | |||
| 
 | |||
| /** | |||
|  * 居民端-志愿者相关api | |||
|  * | |||
|  * @author generator generator@elink-cn.com | |||
|  * @since v1.0.0 2020-07-19 | |||
|  */ | |||
| @RestController | |||
| @RequestMapping("/resi/volunteer") | |||
| public class ResiVolunteerController { | |||
| 
 | |||
|     @Autowired | |||
|     private VolunteerInfoDao volunteerInfoDao; | |||
| 
 | |||
| 
 | |||
| } | |||
| @ -0,0 +1,38 @@ | |||
| package com.epmet.utils; | |||
| 
 | |||
| /** | |||
|  * @Description 用户活动关系表当前状态 | |||
|  * @Auther: zhangyong | |||
|  * @Date: 2020-07-21 17:36 | |||
|  */ | |||
| public interface ActUserRelationStatusConstant { | |||
| 	/** | |||
| 	 * 已报名/待审核 | |||
| 	 */ | |||
| 	String AUDITING="auditing"; | |||
| 
 | |||
| 	/** | |||
| 	 * 审核通过 | |||
| 	 */ | |||
| 	String PASSED="passed"; | |||
| 
 | |||
| 	/** | |||
| 	 * 审核不通过 | |||
| 	 */ | |||
| 	String REFUSED = "refused"; | |||
| 
 | |||
| 	/** | |||
| 	 * 取消报名 | |||
| 	 */ | |||
| 	String CANCELD = "canceld"; | |||
| 
 | |||
| 	/** | |||
| 	 * 给积分 | |||
| 	 */ | |||
| 	String AGREE = "agree"; | |||
| 
 | |||
| 	/** | |||
| 	 * 不给积分 | |||
| 	 */ | |||
| 	String DENY = "deny"; | |||
| } | |||
| @ -0,0 +1,49 @@ | |||
| package com.epmet.utils; | |||
| 
 | |||
| /** | |||
|  * 用户当前状态(sign_up-我要报名,canceld-取消报名,enough-已报满,end_sign_up-截止报名,in_progress-已开始; finished-已结束,canceled-已取消,points_confirm-已确认积分) | |||
|  * @Auther: zhangyong | |||
|  * @Date: 2020-07-21 17:36 | |||
|  */ | |||
| public interface ActUserStatusConstant { | |||
| 
 | |||
|     /** | |||
|      * 我要报名 | |||
|      */ | |||
|     String SIGN_UP = "sign_up"; | |||
| 
 | |||
|     /** | |||
|      * 取消报名 | |||
|      */ | |||
|     String CANCELD = "canceld"; | |||
| 
 | |||
|     /** | |||
|      * 已报满 | |||
|      */ | |||
|     String ENOUGH = "enough"; | |||
| 
 | |||
|     /** | |||
|      * 截止报名 | |||
|      */ | |||
|     String END_SIGN_UP = "end_sign_up"; | |||
| 
 | |||
|     /** | |||
|      * 已开始 | |||
|      */ | |||
|     String IN_PROGRESS = "in_progress"; | |||
| 
 | |||
|     /** | |||
|      * 已结束 | |||
|      */ | |||
|     String FINISHED = "finished"; | |||
| 
 | |||
|     /** | |||
|      * 已取消 | |||
|      */ | |||
|     String CANCELED = "canceled"; | |||
| 
 | |||
|     /** | |||
|      * 已确认积分 | |||
|      */ | |||
|     String POINTS_CONFIRM = "points_confirm"; | |||
| } | |||
| @ -0,0 +1,90 @@ | |||
| package com.epmet.utils; | |||
| 
 | |||
| import com.alibaba.nacos.client.utils.StringUtils; | |||
| import com.epmet.commons.tools.constant.NumConstant; | |||
| import com.epmet.commons.tools.exception.EpmetErrorCode; | |||
| import com.epmet.commons.tools.exception.RenException; | |||
| import com.epmet.commons.tools.scan.param.ImgScanParamDTO; | |||
| import com.epmet.commons.tools.scan.param.ImgTaskDTO; | |||
| import com.epmet.commons.tools.scan.param.TextScanParamDTO; | |||
| import com.epmet.commons.tools.scan.param.TextTaskDTO; | |||
| import com.epmet.commons.tools.scan.result.SyncScanResult; | |||
| import com.epmet.commons.tools.utils.Result; | |||
| import com.epmet.commons.tools.utils.ScanContentUtils; | |||
| import org.springframework.beans.factory.annotation.Value; | |||
| import lombok.extern.slf4j.Slf4j; | |||
| 
 | |||
| import java.util.List; | |||
| import java.util.UUID; | |||
| 
 | |||
| /** | |||
|  * 文字、图片合法性校验 | |||
|  * | |||
|  * @author zhangyong | |||
|  * @date 2020-07-15 14:26 | |||
|  */ | |||
| @Slf4j | |||
| public class ValidityVerification { | |||
| 
 | |||
|     @Value("${openapi.scan.server.url}") | |||
|     private String scanApiUrl; | |||
|     @Value("${openapi.scan.method.textSyncScan}") | |||
|     private String textSyncScanMethod; | |||
|     @Value("${openapi.scan.method.imgSyncScan}") | |||
|     private String imgSyncScanMethod; | |||
| 
 | |||
|     /** | |||
|      * 文本校验 | |||
|      * @param context  被校验的文本,,不能超过10000 | |||
|      * @param businessEnum 业务枚举,定义校验失败后,输出的日志信息 | |||
|      * @return void | |||
|      * @auther zhangyong | |||
|      * @Date 14:42 2020-07-15 | |||
|      **/ | |||
|     public void textScanVerification(String context, String businessEnum){ | |||
|         if (StringUtils.isNotBlank(context)) { | |||
|             TextScanParamDTO textScanParamDTO = new TextScanParamDTO(); | |||
|             TextTaskDTO taskDTO = new TextTaskDTO(); | |||
|             taskDTO.setContent(context); | |||
|             taskDTO.setDataId(UUID.randomUUID().toString().replace("-", "")); | |||
|             textScanParamDTO.getTasks().add(taskDTO); | |||
|             Result<SyncScanResult> textSyncScanResult = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScanParamDTO); | |||
|             if (!textSyncScanResult.success()) { | |||
|                 throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); | |||
|             } else { | |||
|                 if (!textSyncScanResult.getData().isAllPass()) { | |||
|                     // 业务枚举:例如:评论话题失败,评论内容为:%s"
 | |||
|                     log.error(String.format(businessEnum, context)); | |||
|                     throw new RenException(EpmetErrorCode.TEXT_SCAN_FAILED.getCode()); | |||
|                 } | |||
|             } | |||
|         } | |||
|     } | |||
| 
 | |||
|     /** | |||
|      * 图片列表校验 | |||
|      * @param imgList  被校验的图片列表 | |||
|      * @return void | |||
|      * @auther zhangyong | |||
|      * @Date 14:42 2020-07-15 | |||
|      **/ | |||
|     public void imgScanVerification(List<String> imgList){ | |||
|         if (NumConstant.ZERO != imgList.size()){ | |||
|             ImgScanParamDTO imgScanParamDTO = new ImgScanParamDTO(); | |||
|             imgList.forEach(url -> { | |||
|                 ImgTaskDTO task = new ImgTaskDTO(); | |||
|                 task.setDataId(UUID.randomUUID().toString().replace("-", "")); | |||
|                 task.setUrl(url); | |||
|                 imgScanParamDTO.getTasks().add(task); | |||
|             }); | |||
|             Result<SyncScanResult> imgScanResult = ScanContentUtils.imgSyncScan(scanApiUrl.concat(imgSyncScanMethod), imgScanParamDTO); | |||
|             if (!imgScanResult.success()){ | |||
|                 throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); | |||
|             } else { | |||
|                 if (!imgScanResult.getData().isAllPass()) { | |||
|                     throw new RenException(EpmetErrorCode.IMG_SCAN_FAILED.getCode()); | |||
|                 } | |||
|             } | |||
|         } | |||
|     } | |||
| } | |||
					Loading…
					
					
				
		Reference in new issue