diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/BaseRequestLogAspect.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/BaseRequestLogAspect.java index 3e7af3ced6..b8a38908a0 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/BaseRequestLogAspect.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/BaseRequestLogAspect.java @@ -12,7 +12,6 @@ import org.springframework.dao.DuplicateKeyException; import javax.servlet.http.HttpServletRequest; import java.time.Duration; import java.time.LocalDateTime; -import java.util.UUID; /** * 日志切面 diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java index 9de850cdfd..463ec06427 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java @@ -337,6 +337,16 @@ public class RedisKeys { return rootPrefix.concat("stats:calflag"); } + /** + * footbar缓存key + * @param customerId + * @param appType + * @return + */ + public static String getCustomerFootbarKey(String customerId, String appType) { + return rootPrefix.concat("footbar").concat(":").concat(customerId).concat(":").concat(appType); + } + /** * 插入大屏指标数据分布式锁 key */ diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/IpUtils.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/IpUtils.java index b100daac7a..d051717d8d 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/IpUtils.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/IpUtils.java @@ -8,12 +8,17 @@ package com.epmet.commons.tools.utils; +import com.epmet.commons.tools.constant.StrConstant; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.http.HttpHeaders; +import org.springframework.http.server.reactive.ServerHttpRequest; import javax.servlet.http.HttpServletRequest; import java.net.InetAddress; +import java.net.UnknownHostException; +import java.util.Optional; import java.util.regex.Pattern; /** @@ -24,43 +29,87 @@ import java.util.regex.Pattern; */ public class IpUtils { private static Logger logger = LoggerFactory.getLogger(IpUtils.class); - public static final String LOCALHOST = "127.0.0.1"; + private static final String LOCALHOST = "127.0.0.1"; - public static final String ANYHOST = "0.0.0.0"; + private static final String ANYHOST = "0.0.0.0"; + + private static final String IP_UNKNOWN = "unknown"; private static final Pattern IP_PATTERN = Pattern.compile("\\d{1,3}(\\.\\d{1,3}){3,5}$"); public static String getIpAddr(HttpServletRequest request) { + String ip = null; try { ip = request.getHeader("x-forwarded-for"); - logger.debug("x-forwarded-for:"+ip); - if (StringUtils.isEmpty(ip) || "unknown".equalsIgnoreCase(ip)) { + logger.debug("x-forwarded-for:" + ip); + if (StringUtils.isEmpty(ip) || IP_UNKNOWN.equalsIgnoreCase(ip)) { ip = request.getHeader("Proxy-Client-IP"); } - if (StringUtils.isEmpty(ip) || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { + if (StringUtils.isEmpty(ip) || ip.length() == 0 || IP_UNKNOWN.equalsIgnoreCase(ip)) { ip = request.getHeader("WL-Proxy-Client-IP"); } - if (StringUtils.isEmpty(ip) || "unknown".equalsIgnoreCase(ip)) { + if (StringUtils.isEmpty(ip) || IP_UNKNOWN.equalsIgnoreCase(ip)) { ip = request.getHeader("HTTP_CLIENT_IP"); } - if (StringUtils.isEmpty(ip) || "unknown".equalsIgnoreCase(ip)) { + if (StringUtils.isEmpty(ip) || IP_UNKNOWN.equalsIgnoreCase(ip)) { ip = request.getHeader("HTTP_X_FORWARDED_FOR"); } - if (StringUtils.isEmpty(ip) || "unknown".equalsIgnoreCase(ip)) { + if (StringUtils.isEmpty(ip) || IP_UNKNOWN.equalsIgnoreCase(ip)) { ip = request.getHeader("X-Real-IP"); } - if (StringUtils.isEmpty(ip) || "unknown".equalsIgnoreCase(ip)) { + if (StringUtils.isEmpty(ip) || IP_UNKNOWN.equalsIgnoreCase(ip)) { ip = request.getRemoteAddr(); } //对于通过多个代理的情况,第一个IP为客户端真实IP,多个IP按照','分割 if (ip != null) { //"***.***.***.***".length() = 15 - if (ip.indexOf(",") > 0) { - ip = ip.substring(0, ip.indexOf(",")); + if (ip.indexOf(StrConstant.COMMA) > 0) { + ip = ip.split(StrConstant.COMMA)[0]; + ; + } + } + } catch (Exception e) { + logger.error("IpUtils getIpAddr ERROR ", e); + } + + return ip; + } + + public static String getClientIp(ServerHttpRequest request) { + String ip = null; + try { + HttpHeaders headers = request.getHeaders(); + String ipAddress = headers.getFirst("x-forwarded-for"); + if (ipAddress == null || ipAddress.length() == 0 || IP_UNKNOWN.equalsIgnoreCase(ipAddress)) { + ipAddress = headers.getFirst("Proxy-Client-IP"); + } + if (ipAddress == null || ipAddress.length() == 0 || IP_UNKNOWN.equalsIgnoreCase(ipAddress)) { + ipAddress = headers.getFirst("WL-Proxy-Client-IP"); + } + if (ipAddress == null || ipAddress.length() == 0 || IP_UNKNOWN.equalsIgnoreCase(ipAddress)) { + ipAddress = Optional.ofNullable(request.getRemoteAddress()) + .map(address -> address.getAddress().getHostAddress()) + .orElse(""); + if (LOCALHOST.equals(ipAddress)) { + // 根据网卡取本机配置的IP + try { + InetAddress inet = InetAddress.getLocalHost(); + ipAddress = inet.getHostAddress(); + } catch (UnknownHostException e) { + // ignore + } + } + } + + // 对于通过多个代理的情况,第一个IP为客户端真实IP,多个IP按照','分割 + if (ip != null) { //"***.***.***.***".length() = 15 + if (ip.indexOf(StrConstant.COMMA) > 0) { + ip = ip.substring(0, ip.indexOf(StrConstant.COMMA)); } } + return ipAddress; } catch (Exception e) { - logger.error("IpUtils ERROR ", e); + logger.error("IpUtils getIpAddr ERROR ", e); } return ip; diff --git a/epmet-gateway/src/main/java/com/epmet/auth/AuthProcessor.java b/epmet-gateway/src/main/java/com/epmet/auth/AuthProcessor.java index 4ef47a2eae..e5a2027e56 100644 --- a/epmet-gateway/src/main/java/com/epmet/auth/AuthProcessor.java +++ b/epmet-gateway/src/main/java/com/epmet/auth/AuthProcessor.java @@ -13,14 +13,6 @@ import java.nio.charset.StandardCharsets; public abstract class AuthProcessor { - abstract Mono auth(ServerWebExchange exchange, GatewayFilterChain chain); - - protected Mono response(ServerWebExchange exchange, Object object) { - String json = JSON.toJSONString(object); - DataBuffer buffer = exchange.getResponse().bufferFactory().wrap(json.getBytes(StandardCharsets.UTF_8)); - exchange.getResponse().getHeaders().setContentType(MediaType.APPLICATION_JSON_UTF8); - exchange.getResponse().setStatusCode(HttpStatus.OK); - return exchange.getResponse().writeWith(Flux.just(buffer)); - } + abstract ServerWebExchange auth(ServerWebExchange exchange, GatewayFilterChain chain); } diff --git a/epmet-gateway/src/main/java/com/epmet/auth/ExternalAuthProcessor.java b/epmet-gateway/src/main/java/com/epmet/auth/ExternalAuthProcessor.java index baf5151766..18854a8776 100644 --- a/epmet-gateway/src/main/java/com/epmet/auth/ExternalAuthProcessor.java +++ b/epmet-gateway/src/main/java/com/epmet/auth/ExternalAuthProcessor.java @@ -50,7 +50,7 @@ public class ExternalAuthProcessor extends AuthProcessor { private CpProperty cpProperty; @Override - public Mono auth(ServerWebExchange exchange, GatewayFilterChain chain) { + public ServerWebExchange auth(ServerWebExchange exchange, GatewayFilterChain chain) { ServerHttpRequest request = exchange.getRequest(); // 只有在外部应用urls中的url才会允许外部应用访问,否则不允许访问 @@ -92,12 +92,14 @@ public class ExternalAuthProcessor extends AuthProcessor { throw new RenException(EpmetErrorCode.OPER_EXTERNAL_APP_AUTH_ERROR.getCode(), "未知的外部认证类型"); } } catch (RenException e) { - return response(exchange, new Result<>().error(e.getCode(), e.getMsg())); + //return response(exchange, new Result<>().error(e.getCode(), e.getMsg())); + throw new RenException(e.getCode(),e.getMsg()); } catch (Exception e) { logger.error("外部应用请求认证发生未知错误:" + ExceptionUtils.getErrorStackTrace(e)); - return response(exchange, new Result<>().error("外部应用请求认证发生未知错误")); + //return response(exchange, new Result<>().error("外部应用请求认证发生未知错误")); + throw new RenException("外部应用请求认证发生未知错误"); } - return chain.filter(exchange); + return exchange; } } diff --git a/epmet-gateway/src/main/java/com/epmet/auth/InternalAuthProcessor.java b/epmet-gateway/src/main/java/com/epmet/auth/InternalAuthProcessor.java index c87f9dbe6b..43895ce9af 100644 --- a/epmet-gateway/src/main/java/com/epmet/auth/InternalAuthProcessor.java +++ b/epmet-gateway/src/main/java/com/epmet/auth/InternalAuthProcessor.java @@ -8,7 +8,6 @@ import com.epmet.commons.tools.security.dto.BaseTokenDto; import com.epmet.commons.tools.security.dto.GovTokenDto; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.CpUserDetailRedis; -import com.epmet.commons.tools.utils.Result; import com.epmet.filter.CpProperty; import com.epmet.jwt.JwtTokenUtils; import io.jsonwebtoken.Claims; @@ -22,7 +21,6 @@ import org.springframework.http.server.reactive.ServerHttpRequest; import org.springframework.stereotype.Component; import org.springframework.util.AntPathMatcher; import org.springframework.web.server.ServerWebExchange; -import reactor.core.publisher.Mono; /** * 内部认证处理器 @@ -44,11 +42,10 @@ public class InternalAuthProcessor extends AuthProcessor { private CpProperty cpProperty; @Override - public Mono auth(ServerWebExchange exchange, GatewayFilterChain chain) { + public ServerWebExchange auth(ServerWebExchange exchange, GatewayFilterChain chain) { ServerHttpRequest request = exchange.getRequest(); String requestUri = request.getPath().pathWithinApplication().value(); - logger.info("CpAuthGatewayFilterFactory当前requestUri=[" + requestUri + "]CpAuthGatewayFilterFactory拦截成功"); String token = getTokenFromRequest(request); //BaseTokenDto baseTokenDto = StringUtils.isNotBlank(token) ? getBaseTokenDto(token, jwtTokenUtils) : null; BaseTokenDto baseTokenDto; @@ -56,7 +53,8 @@ public class InternalAuthProcessor extends AuthProcessor { try{ baseTokenDto = getBaseTokenDto(token, jwtTokenUtils); }catch(RenException e){ - return response(exchange,new Result<>().error(e.getCode(),e.getMsg())); + //return response(exchange,new Result<>().error(e.getCode(),e.getMsg())); + throw new RenException(e.getCode(), e.getMsg()); } }else{ baseTokenDto = null; @@ -92,12 +90,14 @@ public class InternalAuthProcessor extends AuthProcessor { if (needAuth(requestUri)) { // 校验token if (StringUtils.isBlank(token)) { - return response(exchange, new Result<>().error(EpmetErrorCode.ERR10005.getCode(), EpmetErrorCode.ERR10005.getMsg())); + //return response(exchange, new Result<>().error(EpmetErrorCode.ERR10005.getCode(), EpmetErrorCode.ERR10005.getMsg())); + throw new RenException(EpmetErrorCode.ERR10005.getCode(), EpmetErrorCode.ERR10005.getMsg()); } try { validateTokenDto(baseTokenDto, token); } catch (RenException e) { - return response(exchange, new Result<>().error(e.getCode(), e.getMsg())); + //return response(exchange, new Result<>().error(e.getCode(), e.getMsg())); + throw new RenException(e.getCode(), e.getMsg()); } } @@ -119,10 +119,10 @@ public class InternalAuthProcessor extends AuthProcessor { exchange.getRequest().mutate().header(AppClientConstant.CUSTOMER_ID, customerId); } ServerHttpRequest build = exchange.getRequest().mutate().build(); - return chain.filter(exchange.mutate().request(build).build()); + return exchange.mutate().request(build).build(); } - return chain.filter(exchange); + return exchange; } /** diff --git a/epmet-gateway/src/main/java/com/epmet/constant/AuthTypeConstant.java b/epmet-gateway/src/main/java/com/epmet/constant/AuthTypeConstant.java index d2123966f6..5b75030ae7 100644 --- a/epmet-gateway/src/main/java/com/epmet/constant/AuthTypeConstant.java +++ b/epmet-gateway/src/main/java/com/epmet/constant/AuthTypeConstant.java @@ -1,6 +1,7 @@ package com.epmet.constant; public class AuthTypeConstant { + public static final String AUTH_TYPE_ALL = "all"; public static final String AUTH_TYPE_INTERNAL = "internal"; public static final String AUTH_TYPE_EXTERNAL = "external"; public static final String AUTH_TYPE_NO_NEED = "no_need"; diff --git a/epmet-gateway/src/main/java/com/epmet/filter/CpAuthGatewayFilterFactory.java b/epmet-gateway/src/main/java/com/epmet/filter/CpAuthGatewayFilterFactory.java index 971f4938b1..bb97dc2be7 100644 --- a/epmet-gateway/src/main/java/com/epmet/filter/CpAuthGatewayFilterFactory.java +++ b/epmet-gateway/src/main/java/com/epmet/filter/CpAuthGatewayFilterFactory.java @@ -5,9 +5,8 @@ import com.alibaba.fastjson.JSON; import com.epmet.auth.ExternalAuthProcessor; import com.epmet.auth.InternalAuthProcessor; import com.epmet.commons.tools.constant.AppClientConstant; -import com.epmet.commons.tools.constant.Constant; -import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.utils.IpUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.constant.AuthTypeConstant; import com.epmet.constant.TokenHeaderKeyConstant; @@ -23,7 +22,6 @@ import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.server.reactive.ServerHttpRequest; import org.springframework.stereotype.Component; -import org.springframework.util.AntPathMatcher; import org.springframework.web.server.ServerWebExchange; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -71,13 +69,21 @@ public class CpAuthGatewayFilterFactory extends AbstractGatewayFilterFactory().error(e.getCode(), e.getMessage())); @@ -105,7 +111,14 @@ public class CpAuthGatewayFilterFactory extends AbstractGatewayFilterFactory + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 消息发送记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-10-21 + */ +@Data +public class WxmpMsgSendRecordDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 客户Id 客户Id + */ + private String customerId; + + /** + * 所属端类型 居民端:resi 工作端:work + */ + private String clientType; + + /** + * 消息模板Id 消息模板Id + */ + private String templateId; + + /** + * 用户Id 用户Id + */ + private String userId; + + /** + * openId openId + */ + private String wxOpenId; + + /** + * 行为类型(存title字段的中间值) 入组申请、党员认证等 + */ + private String behaviorType; + + /** + * 消息标题 消息标题 + */ + private String title; + + /** + * 消息内容 消息内容 + */ + private String messageContent; + + /** + * 消息时间 消息时间 + */ + private Date messageTime; + + /** + * 发送结果(成功:success 失败:error) + */ + private String result; + + /** + * 发送失败的原因,成功可以不记录 + */ + private String reason; + + /** + * 删除标识 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} diff --git a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/WxmpResiUserSubscribeDTO.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/WxmpResiUserSubscribeDTO.java new file mode 100644 index 0000000000..e8b2f2a1fb --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/WxmpResiUserSubscribeDTO.java @@ -0,0 +1,101 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 居民端用户订阅模板消息次数记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-10-21 + */ +@Data +public class WxmpResiUserSubscribeDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 客户Id 客户Id + */ + private String customerId; + + /** + * 消息模板Id 消息模板Id + */ + private String templateId; + + /** + * 用户Id 用户Id + */ + private String userId; + + /** + * openId openId + */ + private String wxOpenId; + + /** + * wx订阅状态 订阅状态(订阅:subscribe 取消订阅:unsubscribe) + */ + private String wxSubscribeStatus; + + /** + * 可用推送次数 可用推送次数 + */ + private Integer count; + + /** + * 删除标识 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/WxmpTemplateMsgSubscribeStatusDTO.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/WxmpTemplateMsgSubscribeStatusDTO.java new file mode 100644 index 0000000000..00dc07a199 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/WxmpTemplateMsgSubscribeStatusDTO.java @@ -0,0 +1,106 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 用户模板消息订阅授权状态表(记录我们自己和微信的授权页用户勾选的状态) + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-10-21 + */ +@Data +public class WxmpTemplateMsgSubscribeStatusDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 客户Id 客户Id + */ + private String customerId; + + /** + * 所属端类型 居民端:resi 工作端:work + */ + private String clientType; + + /** + * 用户Id 用户Id + */ + private String userId; + + /** + * 是否总是访问 是:yes 否:no + */ + private String alwaysVisit; + + /** + * 订阅状态 订阅状态(订阅:subscribe 取消订阅:unsubscribe) + */ + private String subscribeStatus; + + /** + * wx是否总是访问 是:yes 否:no + */ + private String wxAlwaysVisit; + + /** + * wx订阅状态 订阅状态(订阅:subscribe 取消订阅:unsubscribe) + */ + private String wxSubscribeStatus; + + /** + * 删除标识 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/WxmpUserSubscribeRecordDTO.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/WxmpUserSubscribeRecordDTO.java new file mode 100644 index 0000000000..901023e9ea --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/WxmpUserSubscribeRecordDTO.java @@ -0,0 +1,106 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 用户触发订阅的行为记录表(同时记录微信授权页每次勾选的状态) + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-10-21 + */ +@Data +public class WxmpUserSubscribeRecordDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 客户Id 客户Id + */ + private String customerId; + + /** + * 消息模板Id 消息模板Id + */ + private String templateId; + + /** + * 用户Id 用户Id + */ + private String userId; + + /** + * openId openId + */ + private String wxOpenId; + + /** + * 行为类型(存title字段的中间值) 入组申请、党员认证等 + */ + private String behaviorType; + + /** + * wx是否总是访问 是:yes 否:no + */ + private String wxAlwaysVisit; + + /** + * wx订阅状态 订阅状态(订阅:subscribe 取消订阅:unsubscribe) + */ + private String wxSubscribeStatus; + + /** + * 删除标识 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/WxmpWorkUserSubscribeDTO.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/WxmpWorkUserSubscribeDTO.java new file mode 100644 index 0000000000..632c9ecf84 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/WxmpWorkUserSubscribeDTO.java @@ -0,0 +1,101 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 工作端用户订阅模板消息有效次数记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-10-21 + */ +@Data +public class WxmpWorkUserSubscribeDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 客户Id 客户Id + */ + private String customerId; + + /** + * 消息模板Id 消息模板Id + */ + private String templateId; + + /** + * 用户Id 用户Id + */ + private String userId; + + /** + * openId openId + */ + private String wxOpenId; + + /** + * wx订阅状态 订阅状态(订阅:subscribe 取消订阅:unsubscribe) + */ + private String wxSubscribeStatus; + + /** + * 可用推送次数 可用推送次数 + */ + private Integer count; + + /** + * 删除标识 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/TemplateListFormDTO.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/TemplateListFormDTO.java new file mode 100644 index 0000000000..87b3ff0cad --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/TemplateListFormDTO.java @@ -0,0 +1,31 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Description 获取客户小程序模板列表-接口入参 + * @Author sun + */ +@Data +public class TemplateListFormDTO implements Serializable { + + /** + * 客户Id + */ + @NotBlank(message="客户Id不能为空", groups = {TemplateListFormDTO.AddUserInternalGroup.class}) + private String customerId; + /** + * 小程序Id + */ + @NotBlank(message="小程序appId不能为空", groups = {TemplateListFormDTO.AddUserInternalGroup.class}) + private String appId; + /** + * 模板类型(站内信提醒) + */ + private String templateType; + public interface AddUserInternalGroup {} +} + diff --git a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/WxMsgAuthInfoFormDTO.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/WxMsgAuthInfoFormDTO.java new file mode 100644 index 0000000000..11d70e506d --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/WxMsgAuthInfoFormDTO.java @@ -0,0 +1,24 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +@Data +public class WxMsgAuthInfoFormDTO { + + public interface SaveSysAuthInfoGroup {} + + @NotBlank(message = "客户id不能为空", groups = { SaveSysAuthInfoGroup.class }) + private String customerId; + + @NotBlank(message = "客户端类型不能为空", groups = { SaveSysAuthInfoGroup.class }) + private String clientType; + + @NotBlank(message = "是否总是字段不能为空", groups = { SaveSysAuthInfoGroup.class }) + private String alwaysVisit; + + @NotBlank(message = "是否去订阅字段不能为空", groups = { SaveSysAuthInfoGroup.class }) + private String subscribeStatus; + +} diff --git a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/WxSubscribeMessageFormDTO.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/WxSubscribeMessageFormDTO.java new file mode 100644 index 0000000000..1dc30e2f8c --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/WxSubscribeMessageFormDTO.java @@ -0,0 +1,51 @@ +package com.epmet.dto.form; + +import com.alibaba.fastjson.annotation.JSONField; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.Date; + +/** + * @description: 微信订阅消息FormDTO + * @author: liushaowen + * @date: 2020/10/21 14:29 + */ +@Data +public class WxSubscribeMessageFormDTO implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 客户id + */ + @NotBlank(message = "客户id不能为空") + private String customerId; + /** + * 客户端类型 居民端:resi 工作端:work + */ + @NotBlank(message = "客户端类型不能为空") + private String clientType; + + /** + * 接收者(用户)的 userId + */ + @NotBlank(message = "接收用户id不能为空") + private String userId; + + /** + * 行为类型(存title字段的中间值) 入组申请、党员认证等 + */ + @NotBlank(message = "行为类型不能为空") + private String behaviorType; + + /** + * 消息内容 + */ + @NotBlank(message = "消息内容不能为空") + private String messageContent; + +} diff --git a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/result/WxMsgAuthInfoResultDTO.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/result/WxMsgAuthInfoResultDTO.java new file mode 100644 index 0000000000..13988b5411 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/result/WxMsgAuthInfoResultDTO.java @@ -0,0 +1,41 @@ +package com.epmet.dto.result; + +import lombok.Data; + +@Data +public class WxMsgAuthInfoResultDTO { + /** + * 客户Id 客户Id + */ + private String customerId; + + /** + * 所属端类型 居民端:resi 工作端:work + */ + private String clientType; + + /** + * 用户Id 用户Id + */ + private String userId; + + /** + * 是否总是访问 是:yes 否:no + */ + private String alwaysVisit; + + /** + * 订阅状态 订阅状态(订阅:subscribe 取消订阅:unsubscribe) + */ + private String subscribeStatus; + + /** + * wx是否总是访问 是:yes 否:no + */ + private String wxAlwaysVisit; + + /** + * wx订阅状态 订阅状态(订阅:subscribe 取消订阅:unsubscribe) + */ + private String wxSubscribeStatus; +} diff --git a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/feign/EpmetMessageOpenFeignClient.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/feign/EpmetMessageOpenFeignClient.java index b8f1def9d3..1035ab1552 100644 --- a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/feign/EpmetMessageOpenFeignClient.java +++ b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/feign/EpmetMessageOpenFeignClient.java @@ -5,6 +5,7 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.dto.SysSmsDTO; import com.epmet.dto.form.SendVerificationCodeFormDTO; import com.epmet.dto.form.UserMessageFormDTO; +import com.epmet.dto.form.WxSubscribeMessageFormDTO; import com.epmet.dto.result.SendVerificationCodeResultDTO; import com.epmet.feign.fallback.EpmetMessageOpenFeignClientFallback; import org.springframework.cloud.openfeign.FeignClient; @@ -67,4 +68,13 @@ public interface EpmetMessageOpenFeignClient { **/ @PostMapping(value = "message/usermessage/saveusermessagelist", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) Result saveUserMessageList(List msgList); + + /** + * @param msgList + * @return com.epmet.commons.tools.utils.Result + * @Author liushaowen + * @Description 发送微信订阅消息 + **/ + @PostMapping(value = "message/wxmpmessage/sendwxsubscribemessage", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) + Result sendWxSubscribeMessage(List msgList); } diff --git a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/feign/fallback/EpmetMessageOpenFeignClientFallback.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/feign/fallback/EpmetMessageOpenFeignClientFallback.java index 3cc5a5c5eb..889569147f 100644 --- a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/feign/fallback/EpmetMessageOpenFeignClientFallback.java +++ b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/feign/fallback/EpmetMessageOpenFeignClientFallback.java @@ -6,6 +6,7 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.dto.SysSmsDTO; import com.epmet.dto.form.SendVerificationCodeFormDTO; import com.epmet.dto.form.UserMessageFormDTO; +import com.epmet.dto.form.WxSubscribeMessageFormDTO; import com.epmet.dto.result.SendVerificationCodeResultDTO; import com.epmet.feign.EpmetMessageOpenFeignClient; import org.springframework.stereotype.Component; @@ -45,4 +46,9 @@ public class EpmetMessageOpenFeignClientFallback implements EpmetMessageOpenFeig public Result saveUserMessageList(List msgList) { return ModuleUtils.feignConError(ServiceConstant.EPMET_MESSAGE_SERVER, "saveUserMessageList", msgList); } + + @Override + public Result sendWxSubscribeMessage(List msgList) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_MESSAGE_SERVER, "sendWxSubscribeMessage", msgList); + } } diff --git a/epmet-module/epmet-message/epmet-message-server/pom.xml b/epmet-module/epmet-message/epmet-message-server/pom.xml index 1322ad2243..28f44f4962 100644 --- a/epmet-module/epmet-message/epmet-message-server/pom.xml +++ b/epmet-module/epmet-message/epmet-message-server/pom.xml @@ -96,6 +96,17 @@ flyway-core + + com.epmet + epmet-user-client + 2.0.0 + + + com.epmet + epmet-third-client + 2.0.0 + compile + diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/constant/WxmpMessageConstant.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/constant/WxmpMessageConstant.java new file mode 100644 index 0000000000..667a8b3bfc --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/constant/WxmpMessageConstant.java @@ -0,0 +1,61 @@ +package com.epmet.constant; + +import java.util.HashMap; +import java.util.Map; + +/** + * @description: 微信订阅消息常量 + * @author: liushaowen + * @date: 2020/10/21 17:45 + */ + +public interface WxmpMessageConstant { + String SEND_MESSAGE = "https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token="; + + String ERR_CODE = "errcode"; + + String ERR_MSG = "errmsg"; + + int USER_REFUSED = 43101; + + String AUTHORIZER_ACCESS_TOKEN = "authorizerAccessToken"; + + String RESI = "resi"; + + String WORK = "work"; + + String ACCESS_TOKEN = "access_token"; + + String TOUSER = "touser"; + + String TEMPLATE_ID = "template_id"; + + String PAGE = "page"; + + String TITLE = "title"; + + int TITLE_LIMIT = 20; + + String MESSAGE_CONTENT = "message_content"; + + int MESSAGE_CONTENT_LIMIT = 20; + + String MESSAGE_TIME = "message_time"; + + String DATA = "data"; + + String MINIPROGRAM_STATE = "miniprogram_state"; + + String SUCCESS = "success"; + + String ERROR = "error"; + + String PAGE_RESI = ""; + + String PAGE_WORK = ""; + + String STATE_DEV = "developer"; + + String STATE_TEST = "trial"; + +} diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/UserMessageController.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/UserMessageController.java index 82cc047ea8..a176b3f2ca 100644 --- a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/UserMessageController.java +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/UserMessageController.java @@ -162,4 +162,4 @@ public class UserMessageController { List list = userMessageService.queryStaffMessage(formDTO); return new Result>().ok(list); } -} \ No newline at end of file +} diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/WxmpMessageController.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/WxmpMessageController.java new file mode 100644 index 0000000000..7e06c80b0a --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/WxmpMessageController.java @@ -0,0 +1,92 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.controller; + +import com.epmet.commons.tools.security.user.LoginUserUtil; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dto.form.GetTemplateListFormDTO; +import com.epmet.dto.form.WxMsgAuthInfoFormDTO; +import com.epmet.dto.form.WxSubscribeMessageFormDTO; +import com.epmet.dto.result.GetTemplateListResultDTO; +import com.epmet.service.WxmpMessageService; +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; + +import java.util.List; + + +/** + * 微信消息订阅controller + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-10-21 + */ +@RestController +@RequestMapping("wxmpmessage") +public class WxmpMessageController { + + @Autowired + private WxmpMessageService wxmpMessageService; + + @Autowired + private LoginUserUtil loginUserUtil; + + /** + * @Description 保存系统自身的弹框授权信息 + * @return com.epmet.commons.tools.utils.Result + * @author wxz + * @date 2020.10.21 17:32 + */ + @PostMapping("save-sys-authorizeinfo") + public Result saveSysAuthorizationInfo(@RequestBody WxMsgAuthInfoFormDTO form) { + ValidatorUtils.validateEntity(form, WxMsgAuthInfoFormDTO.SaveSysAuthInfoGroup.class); + + String alwaysVisit = form.getAlwaysVisit(); + String clientType = form.getClientType(); + String customerId = form.getCustomerId(); + String subscribeStatus = form.getSubscribeStatus(); + + wxmpMessageService.saveSysAuthorizeInfo(customerId, clientType, alwaysVisit, subscribeStatus, loginUserUtil.getLoginUserId()); + + return new Result(); + } + @PostMapping("sendwxsubscribemessage") + public Result sendWxSubscribeMessage(@RequestBody List msgList){ + for (WxSubscribeMessageFormDTO wxSubscribeMessageFormDTO : msgList) { + ValidatorUtils.validateEntity(wxSubscribeMessageFormDTO); + } + wxmpMessageService.sendWxSubscribeMessage(msgList); + return new Result(); + } + + /** + * @return + * @Description 居民端、工作端-获取客户小程序模板列表 + * @author sun + */ + @PostMapping("templatelist") + public Result> templateList(@RequestBody GetTemplateListFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, GetTemplateListFormDTO.AddUserInternalGroup.class); + return new Result>().ok(wxmpMessageService.templateList(formDTO)); + } + +} diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/WxmpMsgSendRecordController.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/WxmpMsgSendRecordController.java new file mode 100644 index 0000000000..ad71a5db81 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/WxmpMsgSendRecordController.java @@ -0,0 +1,94 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.controller; + +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ExcelUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.AssertUtils; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.commons.tools.validator.group.AddGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; +import com.epmet.commons.tools.validator.group.DefaultGroup; +import com.epmet.dto.WxmpMsgSendRecordDTO; +import com.epmet.excel.WxmpMsgSendRecordExcel; +import com.epmet.service.WxmpMsgSendRecordService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Map; + + +/** + * 消息发送记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-10-21 + */ +@RestController +@RequestMapping("wxmpmsgsendrecord") +public class WxmpMsgSendRecordController { + + @Autowired + private WxmpMsgSendRecordService wxmpMsgSendRecordService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = wxmpMsgSendRecordService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + WxmpMsgSendRecordDTO data = wxmpMsgSendRecordService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody WxmpMsgSendRecordDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + wxmpMsgSendRecordService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody WxmpMsgSendRecordDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + wxmpMsgSendRecordService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + wxmpMsgSendRecordService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = wxmpMsgSendRecordService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, WxmpMsgSendRecordExcel.class); + } + +} \ No newline at end of file diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/WxmpResiUserSubscribeController.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/WxmpResiUserSubscribeController.java new file mode 100644 index 0000000000..e4c38f9478 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/WxmpResiUserSubscribeController.java @@ -0,0 +1,94 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.controller; + +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ExcelUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.AssertUtils; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.commons.tools.validator.group.AddGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; +import com.epmet.commons.tools.validator.group.DefaultGroup; +import com.epmet.dto.WxmpResiUserSubscribeDTO; +import com.epmet.excel.WxmpResiUserSubscribeExcel; +import com.epmet.service.WxmpResiUserSubscribeService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Map; + + +/** + * 居民端用户订阅模板消息次数记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-10-21 + */ +@RestController +@RequestMapping("wxmpresiusersubscribe") +public class WxmpResiUserSubscribeController { + + @Autowired + private WxmpResiUserSubscribeService wxmpResiUserSubscribeService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = wxmpResiUserSubscribeService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + WxmpResiUserSubscribeDTO data = wxmpResiUserSubscribeService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody WxmpResiUserSubscribeDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + wxmpResiUserSubscribeService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody WxmpResiUserSubscribeDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + wxmpResiUserSubscribeService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + wxmpResiUserSubscribeService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = wxmpResiUserSubscribeService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, WxmpResiUserSubscribeExcel.class); + } + +} \ No newline at end of file diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/WxmpTemplateMsgSubscribeStatusController.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/WxmpTemplateMsgSubscribeStatusController.java new file mode 100644 index 0000000000..a80fd35b58 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/WxmpTemplateMsgSubscribeStatusController.java @@ -0,0 +1,94 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.controller; + +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ExcelUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.AssertUtils; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.commons.tools.validator.group.AddGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; +import com.epmet.commons.tools.validator.group.DefaultGroup; +import com.epmet.dto.WxmpTemplateMsgSubscribeStatusDTO; +import com.epmet.excel.WxmpTemplateMsgSubscribeStatusExcel; +import com.epmet.service.WxmpTemplateMsgSubscribeStatusService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Map; + + +/** + * 用户模板消息订阅授权状态表(记录我们自己和微信的授权页用户勾选的状态) + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-10-21 + */ +@RestController +@RequestMapping("wxmptemplatemsgsubscribestatus") +public class WxmpTemplateMsgSubscribeStatusController { + + @Autowired + private WxmpTemplateMsgSubscribeStatusService wxmpTemplateMsgSubscribeStatusService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = wxmpTemplateMsgSubscribeStatusService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + WxmpTemplateMsgSubscribeStatusDTO data = wxmpTemplateMsgSubscribeStatusService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody WxmpTemplateMsgSubscribeStatusDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + wxmpTemplateMsgSubscribeStatusService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody WxmpTemplateMsgSubscribeStatusDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + wxmpTemplateMsgSubscribeStatusService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + wxmpTemplateMsgSubscribeStatusService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = wxmpTemplateMsgSubscribeStatusService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, WxmpTemplateMsgSubscribeStatusExcel.class); + } + +} \ No newline at end of file diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/WxmpUserSubscribeRecordController.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/WxmpUserSubscribeRecordController.java new file mode 100644 index 0000000000..e30eace2f5 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/WxmpUserSubscribeRecordController.java @@ -0,0 +1,94 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.controller; + +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ExcelUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.AssertUtils; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.commons.tools.validator.group.AddGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; +import com.epmet.commons.tools.validator.group.DefaultGroup; +import com.epmet.dto.WxmpUserSubscribeRecordDTO; +import com.epmet.excel.WxmpUserSubscribeRecordExcel; +import com.epmet.service.WxmpUserSubscribeRecordService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Map; + + +/** + * 用户触发订阅的行为记录表(同时记录微信授权页每次勾选的状态) + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-10-21 + */ +@RestController +@RequestMapping("wxmpusersubscriberecord") +public class WxmpUserSubscribeRecordController { + + @Autowired + private WxmpUserSubscribeRecordService wxmpUserSubscribeRecordService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = wxmpUserSubscribeRecordService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + WxmpUserSubscribeRecordDTO data = wxmpUserSubscribeRecordService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody WxmpUserSubscribeRecordDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + wxmpUserSubscribeRecordService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody WxmpUserSubscribeRecordDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + wxmpUserSubscribeRecordService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + wxmpUserSubscribeRecordService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = wxmpUserSubscribeRecordService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, WxmpUserSubscribeRecordExcel.class); + } + +} \ No newline at end of file diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/WxmpWorkUserSubscribeController.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/WxmpWorkUserSubscribeController.java new file mode 100644 index 0000000000..be838ea49d --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/WxmpWorkUserSubscribeController.java @@ -0,0 +1,94 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.controller; + +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ExcelUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.AssertUtils; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.commons.tools.validator.group.AddGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; +import com.epmet.commons.tools.validator.group.DefaultGroup; +import com.epmet.dto.WxmpWorkUserSubscribeDTO; +import com.epmet.excel.WxmpWorkUserSubscribeExcel; +import com.epmet.service.WxmpWorkUserSubscribeService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Map; + + +/** + * 工作端用户订阅模板消息有效次数记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-10-21 + */ +@RestController +@RequestMapping("wxmpworkusersubscribe") +public class WxmpWorkUserSubscribeController { + + @Autowired + private WxmpWorkUserSubscribeService wxmpWorkUserSubscribeService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = wxmpWorkUserSubscribeService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + WxmpWorkUserSubscribeDTO data = wxmpWorkUserSubscribeService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody WxmpWorkUserSubscribeDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + wxmpWorkUserSubscribeService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody WxmpWorkUserSubscribeDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + wxmpWorkUserSubscribeService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + wxmpWorkUserSubscribeService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = wxmpWorkUserSubscribeService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, WxmpWorkUserSubscribeExcel.class); + } + +} \ No newline at end of file diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/WxmpMsgSendRecordDao.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/WxmpMsgSendRecordDao.java new file mode 100644 index 0000000000..17aacf2a79 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/WxmpMsgSendRecordDao.java @@ -0,0 +1,34 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.WxmpMsgSendRecordEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 消息发送记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-10-21 + */ +@Mapper +public interface WxmpMsgSendRecordDao extends BaseDao { + + int saveRecord(WxmpMsgSendRecordEntity entity); +} diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/WxmpResiUserSubscribeDao.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/WxmpResiUserSubscribeDao.java new file mode 100644 index 0000000000..c1a6e83d2f --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/WxmpResiUserSubscribeDao.java @@ -0,0 +1,77 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.WxmpResiUserSubscribeEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +/** + * 居民端用户订阅模板消息次数记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-10-21 + */ +@Mapper +public interface WxmpResiUserSubscribeDao extends BaseDao { + + /** + * @Description 根据openId获取剩余订阅条数 + * @param openId + * @param templateId + * @param customerId + * @return java.lang.Integer + * @Author liushaowen + * @Date 2020/10/22 9:30 + */ + Integer getResiSubscribeInfo(@Param("openId") String openId, @Param("templateId") String templateId, @Param("customerId") String customerId); + + /** + * @Description 减少订阅条数 + * @param openId + * @param customerId + * @param templateId + * @param i 减少的数量 + * @return int + * @Author liushaowen + * @Date 2020/10/22 9:38 + */ + int decreaseResiSubscribeCount(@Param("openId") String openId, @Param("templateId") String templateId, @Param("customerId") String customerId,@Param("num") int i); + + /** + * @Description 清空订阅条数,修改订阅状态 + * @param openId + * @param customerId + * @param templateId + * @return int + * @Author liushaowen + * @Date 2020/10/22 13:23 + */ + int clearResiSubscribeCount(@Param("openId") String openId, @Param("templateId") String templateId, @Param("customerId") String customerId); + /** + * @Description 获取模板id + * @param openId + * @param templateId + * @param customerId + * @return java.lang.Integer + * @Author liushaowen + * @Date 2020/10/23 10:53 + */ + String getResiSubscribeTemplateId(@Param("openId") String openId, @Param("templateId") String templateId, @Param("customerId") String customerId); +} diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/WxmpTemplateMsgSubscribeStatusDao.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/WxmpTemplateMsgSubscribeStatusDao.java new file mode 100644 index 0000000000..df2764868c --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/WxmpTemplateMsgSubscribeStatusDao.java @@ -0,0 +1,42 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.result.WxMsgAuthInfoResultDTO; +import com.epmet.entity.WxmpTemplateMsgSubscribeStatusEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +/** + * 用户模板消息订阅授权状态表(记录我们自己和微信的授权页用户勾选的状态) + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-10-21 + */ +@Mapper +public interface WxmpTemplateMsgSubscribeStatusDao extends BaseDao { + + WxMsgAuthInfoResultDTO getUserSubscribeStatusDTO(@Param("userId") String userId, + @Param("customerId") String customerId, + @Param("clientType") String clientType); + + WxmpTemplateMsgSubscribeStatusEntity getUserSubscribeStatusEntity(@Param("userId") String userId, + @Param("customerId") String customerId, + @Param("clientType") String clientType); +} \ No newline at end of file diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/WxmpUserSubscribeRecordDao.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/WxmpUserSubscribeRecordDao.java new file mode 100644 index 0000000000..75a67bf727 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/WxmpUserSubscribeRecordDao.java @@ -0,0 +1,33 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.WxmpUserSubscribeRecordEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 用户触发订阅的行为记录表(同时记录微信授权页每次勾选的状态) + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-10-21 + */ +@Mapper +public interface WxmpUserSubscribeRecordDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/WxmpWorkUserSubscribeDao.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/WxmpWorkUserSubscribeDao.java new file mode 100644 index 0000000000..0638e2bfc4 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/WxmpWorkUserSubscribeDao.java @@ -0,0 +1,78 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.WxmpWorkUserSubscribeEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +/** + * 工作端用户订阅模板消息有效次数记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-10-21 + */ +@Mapper +public interface WxmpWorkUserSubscribeDao extends BaseDao { + + /** + * @Description 根据openId获取剩余订阅条数 + * @param openId + * @param templateId + * @param customerId + * @return java.lang.Integer + * @Author liushaowen + * @Date 2020/10/22 9:31 + */ + Integer getWorkSubscribeInfo(@Param("openId") String openId, @Param("templateId") String templateId, @Param("customerId") String customerId); + + /** + * @Description 减少订阅条数 + * @param openId + * @param templateId + * @param customerId + * @param i 减少的数量 + * @return int + * @Author liushaowen + * @Date 2020/10/22 9:38 + */ + int decreaseWorkSubscribeCount(@Param("openId") String openId, @Param("templateId") String templateId, @Param("customerId") String customerId, @Param("num") int i); + + /** + * @Description 清空订阅数,修改订阅状态 + * @param openId + * @param customerId + * @param templateId + * @return int + * @Author liushaowen + * @Date 2020/10/22 13:22 + */ + int clearWorkSubscribeCount(@Param("openId") String openId, @Param("templateId") String templateId, @Param("customerId") String customerId); + + /** + * @Description 获取模板id + * @param openId + * @param templateId + * @param customerId + * @return java.lang.String + * @Author liushaowen + * @Date 2020/10/23 10:54 + */ + String getWorkSubscribeTemplateId(@Param("openId") String openId, @Param("templateId") String templateId, @Param("customerId") String customerId); +} diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/WxmpMsgSendRecordEntity.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/WxmpMsgSendRecordEntity.java new file mode 100644 index 0000000000..89e1837475 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/WxmpMsgSendRecordEntity.java @@ -0,0 +1,96 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 消息发送记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-10-21 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("wxmp_msg_send_record") +public class WxmpMsgSendRecordEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户Id 客户Id + */ + private String customerId; + + /** + * 所属端类型 居民端:resi 工作端:work + */ + private String clientType; + + /** + * 消息模板Id 消息模板Id + */ + private String templateId; + + /** + * 用户Id 用户Id + */ + private String userId; + + /** + * openId openId + */ + private String wxOpenId; + + /** + * 行为类型(存title字段的中间值) 入组申请、党员认证等 + */ + private String behaviorType; + + /** + * 消息标题 消息标题 + */ + private String title; + + /** + * 消息内容 消息内容 + */ + private String messageContent; + + /** + * 消息时间 消息时间 + */ + private Date messageTime; + + /** + * 发送结果(成功:success 失败:error) + */ + private String result; + + /** + * 发送失败的原因,成功可以不记录 + */ + private String reason; + +} diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/WxmpResiUserSubscribeEntity.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/WxmpResiUserSubscribeEntity.java new file mode 100644 index 0000000000..cff96c779d --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/WxmpResiUserSubscribeEntity.java @@ -0,0 +1,71 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 居民端用户订阅模板消息次数记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-10-21 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("wxmp_resi_user_subscribe") +public class WxmpResiUserSubscribeEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户Id 客户Id + */ + private String customerId; + + /** + * 消息模板Id 消息模板Id + */ + private String templateId; + + /** + * 用户Id 用户Id + */ + private String userId; + + /** + * openId openId + */ + private String wxOpenId; + + /** + * wx订阅状态 订阅状态(订阅:subscribe 取消订阅:unsubscribe) + */ + private String wxSubscribeStatus; + + /** + * 可用推送次数 可用推送次数 + */ + private Integer count; + +} diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/WxmpTemplateMsgSubscribeStatusEntity.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/WxmpTemplateMsgSubscribeStatusEntity.java new file mode 100644 index 0000000000..991ed157f1 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/WxmpTemplateMsgSubscribeStatusEntity.java @@ -0,0 +1,76 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 用户模板消息订阅授权状态表(记录我们自己和微信的授权页用户勾选的状态) + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-10-21 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("wxmp_template_msg_subscribe_status") +public class WxmpTemplateMsgSubscribeStatusEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户Id 客户Id + */ + private String customerId; + + /** + * 所属端类型 居民端:resi 工作端:work + */ + private String clientType; + + /** + * 用户Id 用户Id + */ + private String userId; + + /** + * 是否总是访问 是:yes 否:no + */ + private String alwaysVisit; + + /** + * 订阅状态 订阅状态(订阅:subscribe 取消订阅:unsubscribe) + */ + private String subscribeStatus; + + /** + * wx是否总是访问 是:yes 否:no + */ + private String wxAlwaysVisit; + + /** + * wx订阅状态 订阅状态(订阅:subscribe 取消订阅:unsubscribe) + */ + private String wxSubscribeStatus; + +} diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/WxmpUserSubscribeRecordEntity.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/WxmpUserSubscribeRecordEntity.java new file mode 100644 index 0000000000..8d40463334 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/WxmpUserSubscribeRecordEntity.java @@ -0,0 +1,76 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 用户触发订阅的行为记录表(同时记录微信授权页每次勾选的状态) + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-10-21 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("wxmp_user_subscribe_record") +public class WxmpUserSubscribeRecordEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户Id 客户Id + */ + private String customerId; + + /** + * 消息模板Id 消息模板Id + */ + private String templateId; + + /** + * 用户Id 用户Id + */ + private String userId; + + /** + * openId openId + */ + private String wxOpenId; + + /** + * 行为类型(存title字段的中间值) 入组申请、党员认证等 + */ + private String behaviorType; + + /** + * wx是否总是访问 是:yes 否:no + */ + private String wxAlwaysVisit; + + /** + * wx订阅状态 订阅状态(订阅:subscribe 取消订阅:unsubscribe) + */ + private String wxSubscribeStatus; + +} diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/WxmpWorkUserSubscribeEntity.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/WxmpWorkUserSubscribeEntity.java new file mode 100644 index 0000000000..124a450386 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/WxmpWorkUserSubscribeEntity.java @@ -0,0 +1,71 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 工作端用户订阅模板消息有效次数记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-10-21 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("wxmp_work_user_subscribe") +public class WxmpWorkUserSubscribeEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户Id 客户Id + */ + private String customerId; + + /** + * 消息模板Id 消息模板Id + */ + private String templateId; + + /** + * 用户Id 用户Id + */ + private String userId; + + /** + * openId openId + */ + private String wxOpenId; + + /** + * wx订阅状态 订阅状态(订阅:subscribe 取消订阅:unsubscribe) + */ + private String wxSubscribeStatus; + + /** + * 可用推送次数 可用推送次数 + */ + private Integer count; + +} diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/excel/WxmpMsgSendRecordExcel.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/excel/WxmpMsgSendRecordExcel.java new file mode 100644 index 0000000000..a0d474ba82 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/excel/WxmpMsgSendRecordExcel.java @@ -0,0 +1,89 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 消息发送记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-10-21 + */ +@Data +public class WxmpMsgSendRecordExcel { + + @Excel(name = "主键") + private String id; + + @Excel(name = "客户Id 客户Id") + private String customerId; + + @Excel(name = "所属端类型 居民端:resi 工作端:work") + private String clientType; + + @Excel(name = "消息模板Id 消息模板Id") + private String templateId; + + @Excel(name = "用户Id 用户Id") + private String userId; + + @Excel(name = "openId openId") + private String wxOpenId; + + @Excel(name = "行为类型(存title字段的中间值) 入组申请、党员认证等") + private String behaviorType; + + @Excel(name = "消息标题 消息标题") + private String title; + + @Excel(name = "消息内容 消息内容") + private String messageContent; + + @Excel(name = "消息时间 消息时间") + private Date messageTime; + + @Excel(name = "发送结果") + private String result; + + @Excel(name = "发送失败的原因") + private String reason; + + @Excel(name = "删除标识") + private Integer delFlag; + + @Excel(name = "乐观锁") + private Integer revision; + + @Excel(name = "创建人") + private String createdBy; + + @Excel(name = "创建时间") + private Date createdTime; + + @Excel(name = "更新人") + private String updatedBy; + + @Excel(name = "更新时间") + private Date updatedTime; + + +} \ No newline at end of file diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/excel/WxmpResiUserSubscribeExcel.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/excel/WxmpResiUserSubscribeExcel.java new file mode 100644 index 0000000000..b72c75dd7f --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/excel/WxmpResiUserSubscribeExcel.java @@ -0,0 +1,74 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 居民端用户订阅模板消息次数记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-10-21 + */ +@Data +public class WxmpResiUserSubscribeExcel { + + @Excel(name = "主键") + private String id; + + @Excel(name = "客户Id 客户Id") + private String customerId; + + @Excel(name = "消息模板Id 消息模板Id") + private String templateId; + + @Excel(name = "用户Id 用户Id") + private String userId; + + @Excel(name = "openId openId") + private String wxOpenId; + + @Excel(name = "wx订阅状态 订阅状态(订阅:subscribe 取消订阅:unsubscribe)") + private String wxSubscribeStatus; + + @Excel(name = "可用推送次数 可用推送次数") + private Integer count; + + @Excel(name = "删除标识") + private Integer delFlag; + + @Excel(name = "乐观锁") + private Integer revision; + + @Excel(name = "创建人") + private String createdBy; + + @Excel(name = "创建时间") + private Date createdTime; + + @Excel(name = "更新人") + private String updatedBy; + + @Excel(name = "更新时间") + private Date updatedTime; + + +} \ No newline at end of file diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/excel/WxmpTemplateMsgSubscribeStatusExcel.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/excel/WxmpTemplateMsgSubscribeStatusExcel.java new file mode 100644 index 0000000000..7c39312da3 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/excel/WxmpTemplateMsgSubscribeStatusExcel.java @@ -0,0 +1,77 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 用户模板消息订阅授权状态表(记录我们自己和微信的授权页用户勾选的状态) + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-10-21 + */ +@Data +public class WxmpTemplateMsgSubscribeStatusExcel { + + @Excel(name = "主键") + private String id; + + @Excel(name = "客户Id 客户Id") + private String customerId; + + @Excel(name = "所属端类型 居民端:resi 工作端:work") + private String clientType; + + @Excel(name = "用户Id 用户Id") + private String userId; + + @Excel(name = "是否总是访问 是:yes 否:no") + private String alwaysVisit; + + @Excel(name = "订阅状态 订阅状态(订阅:subscribe 取消订阅:unsubscribe)") + private String subscribeStatus; + + @Excel(name = "wx是否总是访问 是:yes 否:no") + private String wxAlwaysVisit; + + @Excel(name = "wx订阅状态 订阅状态(订阅:subscribe 取消订阅:unsubscribe)") + private String wxSubscribeStatus; + + @Excel(name = "删除标识") + private Integer delFlag; + + @Excel(name = "乐观锁") + private Integer revision; + + @Excel(name = "创建人") + private String createdBy; + + @Excel(name = "创建时间") + private Date createdTime; + + @Excel(name = "更新人") + private String updatedBy; + + @Excel(name = "更新时间") + private Date updatedTime; + + +} \ No newline at end of file diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/excel/WxmpUserSubscribeRecordExcel.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/excel/WxmpUserSubscribeRecordExcel.java new file mode 100644 index 0000000000..b52a82b5cf --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/excel/WxmpUserSubscribeRecordExcel.java @@ -0,0 +1,77 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 用户触发订阅的行为记录表(同时记录微信授权页每次勾选的状态) + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-10-21 + */ +@Data +public class WxmpUserSubscribeRecordExcel { + + @Excel(name = "主键") + private String id; + + @Excel(name = "客户Id 客户Id") + private String customerId; + + @Excel(name = "消息模板Id 消息模板Id") + private String templateId; + + @Excel(name = "用户Id 用户Id") + private String userId; + + @Excel(name = "openId openId") + private String wxOpenId; + + @Excel(name = "行为类型(存title字段的中间值) 入组申请、党员认证等") + private String behaviorType; + + @Excel(name = "wx是否总是访问 是:yes 否:no") + private String wxAlwaysVisit; + + @Excel(name = "wx订阅状态 订阅状态(订阅:subscribe 取消订阅:unsubscribe)") + private String wxSubscribeStatus; + + @Excel(name = "删除标识") + private Integer delFlag; + + @Excel(name = "乐观锁") + private Integer revision; + + @Excel(name = "创建人") + private String createdBy; + + @Excel(name = "创建时间") + private Date createdTime; + + @Excel(name = "更新人") + private String updatedBy; + + @Excel(name = "更新时间") + private Date updatedTime; + + +} \ No newline at end of file diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/excel/WxmpWorkUserSubscribeExcel.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/excel/WxmpWorkUserSubscribeExcel.java new file mode 100644 index 0000000000..7397f5dfa3 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/excel/WxmpWorkUserSubscribeExcel.java @@ -0,0 +1,74 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 工作端用户订阅模板消息有效次数记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-10-21 + */ +@Data +public class WxmpWorkUserSubscribeExcel { + + @Excel(name = "主键") + private String id; + + @Excel(name = "客户Id 客户Id") + private String customerId; + + @Excel(name = "消息模板Id 消息模板Id") + private String templateId; + + @Excel(name = "用户Id 用户Id") + private String userId; + + @Excel(name = "openId openId") + private String wxOpenId; + + @Excel(name = "wx订阅状态 订阅状态(订阅:subscribe 取消订阅:unsubscribe)") + private String wxSubscribeStatus; + + @Excel(name = "可用推送次数 可用推送次数") + private Integer count; + + @Excel(name = "删除标识") + private Integer delFlag; + + @Excel(name = "乐观锁") + private Integer revision; + + @Excel(name = "创建人") + private String createdBy; + + @Excel(name = "创建时间") + private Date createdTime; + + @Excel(name = "更新人") + private String updatedBy; + + @Excel(name = "更新时间") + private Date updatedTime; + + +} \ No newline at end of file diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/exception/WxSubscribeException.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/exception/WxSubscribeException.java new file mode 100644 index 0000000000..e6fdee6127 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/exception/WxSubscribeException.java @@ -0,0 +1,43 @@ +package com.epmet.exception; + +/** + * @description: + * @author: liushaowen + * @date: 2020/10/22 11:07 + */ + +public class WxSubscribeException extends Exception { + private String openId; + private String templateId; + + /** + * Constructs a new exception with the specified detail message. The + * cause is not initialized, and may subsequently be initialized by + * a call to {@link #initCause}. + * + * @param message the detail message. The detail message is saved for + * later retrieval by the {@link #getMessage()} method. + */ + public WxSubscribeException(String message, String templateId, String openId) { + super(message); + this.openId = openId; + this.templateId = templateId; + } + + public String getTemplateId() { + return templateId; + } + + public void setTemplateId(String templateId) { + this.templateId = templateId; + } + + public String getOpenId() { + return openId; + } + + public void setOpenId(String openId) { + this.openId = openId; + } + +} diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/redis/WxmpMessageRedis.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/redis/WxmpMessageRedis.java new file mode 100644 index 0000000000..a0672e7d58 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/redis/WxmpMessageRedis.java @@ -0,0 +1,30 @@ +package com.epmet.redis; + +import com.epmet.commons.tools.redis.RedisUtils; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.Map; + +/** + * @description: 微信订阅Redis + * @author: liushaowen + * @date: 2020/10/21 15:28 + */ +@Slf4j +@Component +public class WxmpMessageRedis { + @Autowired + private RedisUtils redisUtils; + + /** + * @Description 获取刷新 + * @param key = epmet:wechartthird:authorizerrefreshtoken:customerId:clientType 前缀+客户ID+客户端类型 + * @author zxc + */ + public Map getAuthorizerRefreshToken(String key){ + Map result = redisUtils.hGetAll("epmet:wechartthird:authorizerrefreshtoken:" + key); + return result; + } +} diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/redis/WxmpMsgSendRecordRedis.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/redis/WxmpMsgSendRecordRedis.java new file mode 100644 index 0000000000..68ba610368 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/redis/WxmpMsgSendRecordRedis.java @@ -0,0 +1,47 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.redis; + +import com.epmet.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 消息发送记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-10-21 + */ +@Component +public class WxmpMsgSendRecordRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} \ No newline at end of file diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/redis/WxmpResiUserSubscribeRedis.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/redis/WxmpResiUserSubscribeRedis.java new file mode 100644 index 0000000000..ee0081e5db --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/redis/WxmpResiUserSubscribeRedis.java @@ -0,0 +1,47 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.redis; + +import com.epmet.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 居民端用户订阅模板消息次数记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-10-21 + */ +@Component +public class WxmpResiUserSubscribeRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} \ No newline at end of file diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/redis/WxmpTemplateMsgSubscribeStatusRedis.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/redis/WxmpTemplateMsgSubscribeStatusRedis.java new file mode 100644 index 0000000000..67de7a368b --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/redis/WxmpTemplateMsgSubscribeStatusRedis.java @@ -0,0 +1,47 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.redis; + +import com.epmet.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 用户模板消息订阅授权状态表(记录我们自己和微信的授权页用户勾选的状态) + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-10-21 + */ +@Component +public class WxmpTemplateMsgSubscribeStatusRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} \ No newline at end of file diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/redis/WxmpUserSubscribeRecordRedis.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/redis/WxmpUserSubscribeRecordRedis.java new file mode 100644 index 0000000000..6cf0c8eb72 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/redis/WxmpUserSubscribeRecordRedis.java @@ -0,0 +1,47 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.redis; + +import com.epmet.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 用户触发订阅的行为记录表(同时记录微信授权页每次勾选的状态) + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-10-21 + */ +@Component +public class WxmpUserSubscribeRecordRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} \ No newline at end of file diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/redis/WxmpWorkUserSubscribeRedis.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/redis/WxmpWorkUserSubscribeRedis.java new file mode 100644 index 0000000000..f6cfcea0c2 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/redis/WxmpWorkUserSubscribeRedis.java @@ -0,0 +1,47 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.redis; + +import com.epmet.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 工作端用户订阅模板消息有效次数记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-10-21 + */ +@Component +public class WxmpWorkUserSubscribeRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} \ No newline at end of file diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/WxmpMessageService.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/WxmpMessageService.java new file mode 100644 index 0000000000..fdde63f2a5 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/WxmpMessageService.java @@ -0,0 +1,51 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service; + +import com.epmet.dto.form.GetTemplateListFormDTO; +import com.epmet.dto.form.WxSubscribeMessageFormDTO; +import com.epmet.dto.result.GetTemplateListResultDTO; + +import java.util.List; + +/** + * 微信消息订阅Service + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-10-21 + */ +public interface WxmpMessageService { + + void saveSysAuthorizeInfo(String customerId, String clientType, String alwaysVisit, String subscribeStatus, String userId); + + /** + * @Description 发送订阅消息 + * @param msgList + * @return void + * @Author liushaowen + * @Date 2020/10/21 15:34 + */ + void sendWxSubscribeMessage(List msgList); + + /** + * @return + * @Description 居民端、工作端-获取客户小程序模板列表 + * @author sun + */ + List templateList(GetTemplateListFormDTO formDTO); +} diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/WxmpMsgSendRecordService.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/WxmpMsgSendRecordService.java new file mode 100644 index 0000000000..882848002b --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/WxmpMsgSendRecordService.java @@ -0,0 +1,105 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.WxmpMsgSendRecordDTO; +import com.epmet.entity.WxmpMsgSendRecordEntity; + +import java.util.List; +import java.util.Map; + +/** + * 消息发送记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-10-21 + */ +public interface WxmpMsgSendRecordService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-10-21 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-10-21 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return WxmpMsgSendRecordDTO + * @author generator + * @date 2020-10-21 + */ + WxmpMsgSendRecordDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-10-21 + */ + void save(WxmpMsgSendRecordDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-10-21 + */ + void update(WxmpMsgSendRecordDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-10-21 + */ + void delete(String[] ids); + + /** + * 保存 + * + * @param entity + * @return int + * @author liushaowen + * @date 2020-10-22 + */ + int saveRecord(WxmpMsgSendRecordEntity entity); +} diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/WxmpResiUserSubscribeService.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/WxmpResiUserSubscribeService.java new file mode 100644 index 0000000000..eeee48bc3a --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/WxmpResiUserSubscribeService.java @@ -0,0 +1,95 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.WxmpResiUserSubscribeDTO; +import com.epmet.entity.WxmpResiUserSubscribeEntity; + +import java.util.List; +import java.util.Map; + +/** + * 居民端用户订阅模板消息次数记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-10-21 + */ +public interface WxmpResiUserSubscribeService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-10-21 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-10-21 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return WxmpResiUserSubscribeDTO + * @author generator + * @date 2020-10-21 + */ + WxmpResiUserSubscribeDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-10-21 + */ + void save(WxmpResiUserSubscribeDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-10-21 + */ + void update(WxmpResiUserSubscribeDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-10-21 + */ + void delete(String[] ids); +} diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/WxmpTemplateMsgSubscribeStatusService.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/WxmpTemplateMsgSubscribeStatusService.java new file mode 100644 index 0000000000..c719aa0c9b --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/WxmpTemplateMsgSubscribeStatusService.java @@ -0,0 +1,95 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.WxmpTemplateMsgSubscribeStatusDTO; +import com.epmet.entity.WxmpTemplateMsgSubscribeStatusEntity; + +import java.util.List; +import java.util.Map; + +/** + * 用户模板消息订阅授权状态表(记录我们自己和微信的授权页用户勾选的状态) + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-10-21 + */ +public interface WxmpTemplateMsgSubscribeStatusService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-10-21 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-10-21 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return WxmpTemplateMsgSubscribeStatusDTO + * @author generator + * @date 2020-10-21 + */ + WxmpTemplateMsgSubscribeStatusDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-10-21 + */ + void save(WxmpTemplateMsgSubscribeStatusDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-10-21 + */ + void update(WxmpTemplateMsgSubscribeStatusDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-10-21 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/WxmpUserSubscribeRecordService.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/WxmpUserSubscribeRecordService.java new file mode 100644 index 0000000000..eda8ee4a3f --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/WxmpUserSubscribeRecordService.java @@ -0,0 +1,95 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.WxmpUserSubscribeRecordDTO; +import com.epmet.entity.WxmpUserSubscribeRecordEntity; + +import java.util.List; +import java.util.Map; + +/** + * 用户触发订阅的行为记录表(同时记录微信授权页每次勾选的状态) + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-10-21 + */ +public interface WxmpUserSubscribeRecordService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-10-21 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-10-21 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return WxmpUserSubscribeRecordDTO + * @author generator + * @date 2020-10-21 + */ + WxmpUserSubscribeRecordDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-10-21 + */ + void save(WxmpUserSubscribeRecordDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-10-21 + */ + void update(WxmpUserSubscribeRecordDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-10-21 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/WxmpWorkUserSubscribeService.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/WxmpWorkUserSubscribeService.java new file mode 100644 index 0000000000..60c482cd2e --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/WxmpWorkUserSubscribeService.java @@ -0,0 +1,95 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.WxmpWorkUserSubscribeDTO; +import com.epmet.entity.WxmpWorkUserSubscribeEntity; + +import java.util.List; +import java.util.Map; + +/** + * 工作端用户订阅模板消息有效次数记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-10-21 + */ +public interface WxmpWorkUserSubscribeService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-10-21 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-10-21 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return WxmpWorkUserSubscribeDTO + * @author generator + * @date 2020-10-21 + */ + WxmpWorkUserSubscribeDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-10-21 + */ + void save(WxmpWorkUserSubscribeDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-10-21 + */ + void update(WxmpWorkUserSubscribeDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-10-21 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpMessageServiceImpl.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpMessageServiceImpl.java new file mode 100644 index 0000000000..bf9d8ed39c --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpMessageServiceImpl.java @@ -0,0 +1,322 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.impl; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.enums.EnvEnum; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.exception.ValidateException; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.HttpClientManager; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.constant.WxmpMessageConstant; +import com.epmet.dao.WxmpResiUserSubscribeDao; +import com.epmet.dao.WxmpTemplateMsgSubscribeStatusDao; +import com.epmet.dao.WxmpWorkUserSubscribeDao; +import com.epmet.dto.form.GetTemplateListFormDTO; +import com.epmet.dto.form.StaffBasicInfoFormDTO; +import com.epmet.dto.form.UserBasicInfoFormDTO; +import com.epmet.dto.form.WxSubscribeMessageFormDTO; +import com.epmet.dto.result.GetTemplateListResultDTO; +import com.epmet.entity.WxmpMsgSendRecordEntity; +import com.epmet.entity.WxmpTemplateMsgSubscribeStatusEntity; +import com.epmet.exception.WxSubscribeException; +import com.epmet.feign.EpmetUserOpenFeignClient; +import com.epmet.redis.WxmpMessageRedis; +import com.epmet.service.WxmpMessageService; +import com.epmet.service.WxmpMsgSendRecordService; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 微信消息订阅Service + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-10-21 + */ +@Service +public class WxmpMessageServiceImpl implements WxmpMessageService { + private Logger logger = LoggerFactory.getLogger(getClass()); + + @Autowired + private WxmpTemplateMsgSubscribeStatusDao msgSubscribeStatusDao; + + @Autowired + private EpmetUserOpenFeignClient epmetUserOpenFeignClient; + + @Autowired + private WxmpMessageRedis wxmpMessageRedis; + + @Resource + private WxmpResiUserSubscribeDao wxmpResiUserSubscribeDao; + + @Resource + private WxmpWorkUserSubscribeDao wxmpWorkUserSubscribeDao; + + @Autowired + private WxmpMsgSendRecordService wxmpMsgSendRecordService; + + /** + * @return void + * @Description 保存系统授权信息 + * @author wxz + * @date 2020.10.21 17:29 + */ + @Override + public void saveSysAuthorizeInfo(String customerId, String clientType, String alwaysVisit, String subscribeStatus, String userId) { + WxmpTemplateMsgSubscribeStatusEntity userSubscribeStatusEntity = msgSubscribeStatusDao.getUserSubscribeStatusEntity(userId, customerId, clientType); + if (userSubscribeStatusEntity != null) { + userSubscribeStatusEntity.setAlwaysVisit(alwaysVisit); + userSubscribeStatusEntity.setSubscribeStatus(subscribeStatus); + msgSubscribeStatusDao.updateById(userSubscribeStatusEntity); + return; + } + + userSubscribeStatusEntity = new WxmpTemplateMsgSubscribeStatusEntity(); + userSubscribeStatusEntity.setCustomerId(customerId); + userSubscribeStatusEntity.setClientType(clientType); + userSubscribeStatusEntity.setAlwaysVisit(alwaysVisit); + userSubscribeStatusEntity.setSubscribeStatus(subscribeStatus); + userSubscribeStatusEntity.setUserId(userId); + msgSubscribeStatusDao.insert(userSubscribeStatusEntity); + } + + /** + * @param msgList + * @return void + * @Description 发送订阅消息 + * @Author liushaowen + * @Date 2020/10/21 15:34 + */ + @Override + public void sendWxSubscribeMessage(List msgList) { + logger.info("待发送订阅消息数量:{}", msgList.size()); + int succecssCount = 0; + for (WxSubscribeMessageFormDTO msg : msgList) { + try { + String userId = msg.getUserId(); + String clientType = msg.getClientType(); + String customerId = msg.getCustomerId(); + String templateId = null; + String openId = null; + //通过userId获取openId + try { + if (WxmpMessageConstant.RESI.equals(clientType)) { + UserBasicInfoFormDTO userBasicInfoFormDTO = new UserBasicInfoFormDTO(); + userBasicInfoFormDTO.setUserId(userId); + openId = epmetUserOpenFeignClient.getUserBasicInfo(userBasicInfoFormDTO).getData().getOpenId(); + } else if (WxmpMessageConstant.WORK.equals(clientType)) { + StaffBasicInfoFormDTO staffBasicInfoFormDTO = new StaffBasicInfoFormDTO(); + staffBasicInfoFormDTO.setStaffId(userId); + openId = epmetUserOpenFeignClient.getStaffBasicInfo(staffBasicInfoFormDTO).getData().getOpenId(); + } else { + throw new WxSubscribeException("clientType有误", "", openId); + } + } catch (Exception e) { + throw new WxSubscribeException("连接User服务失败", "", ""); + } + + if (StringUtils.isBlank(openId)) { + throw new WxSubscribeException("openId获取失败", "", ""); + } + + //获取accessToken + StringBuilder key = new StringBuilder(msg.getCustomerId()).append(":").append(msg.getClientType()); + Map authorizerRefreshToken = new HashMap<>(); + try { + authorizerRefreshToken = wxmpMessageRedis.getAuthorizerRefreshToken(key.toString()); + } catch (Exception e) { + throw new WxSubscribeException("连接缓存服务器失败", "", openId); + } + String accessToken = (String) authorizerRefreshToken.get(WxmpMessageConstant.AUTHORIZER_ACCESS_TOKEN); + if (StringUtils.isBlank(accessToken)) { + throw new WxSubscribeException("accessToken获取失败", "", openId); + } + + //获取模板id + if (WxmpMessageConstant.RESI.equals(clientType)) { + templateId = wxmpResiUserSubscribeDao.getResiSubscribeTemplateId(openId, templateId, customerId); + } else if (WxmpMessageConstant.WORK.equals(clientType)) { + templateId = wxmpWorkUserSubscribeDao.getWorkSubscribeTemplateId(openId, templateId, customerId); + } + if (StringUtils.isBlank(templateId)) { + throw new WxSubscribeException("获取模板id失败", "", openId); + } + + //判断用户是否有次数 + Integer count = null; + if (WxmpMessageConstant.RESI.equals(clientType)) { + count = wxmpResiUserSubscribeDao.getResiSubscribeInfo(openId, templateId, customerId); + } else if (WxmpMessageConstant.WORK.equals(clientType)) { + count = wxmpWorkUserSubscribeDao.getWorkSubscribeInfo(openId, templateId, customerId); + } + if (count == null) { + //用户未订阅 + throw new WxSubscribeException("用户未订阅", templateId, openId); + } + if (count == 0) { + throw new WxSubscribeException("用户可用额度不足", templateId, openId); + } + + //发送消息 + JSONObject jsonObject = new JSONObject(); + JSONObject data = new JSONObject(); + //必填项 + jsonObject.put(WxmpMessageConstant.ACCESS_TOKEN, accessToken); + jsonObject.put(WxmpMessageConstant.TOUSER, openId); + jsonObject.put(WxmpMessageConstant.TEMPLATE_ID, templateId); + data.put(WxmpMessageConstant.TITLE, new JSONObject().put("value", ("您有一条" + msg.getBehaviorType()).substring(0, WxmpMessageConstant.TITLE_LIMIT))); + data.put(WxmpMessageConstant.MESSAGE_CONTENT, new JSONObject().put("value", msg.getMessageContent().substring(0, WxmpMessageConstant.MESSAGE_CONTENT_LIMIT))); + data.put(WxmpMessageConstant.MESSAGE_TIME, new JSONObject().put("value", new SimpleDateFormat("yyyy-MM-dd HH:mm").format(new Date()))); + jsonObject.put(WxmpMessageConstant.DATA, data); + EnvEnum envEnum = EnvEnum.getCurrentEnv(); + //选填项 + if (WxmpMessageConstant.RESI.equals(clientType)) { + jsonObject.put(WxmpMessageConstant.PAGE, WxmpMessageConstant.PAGE_RESI); + } else if (WxmpMessageConstant.WORK.equals(clientType)) { + jsonObject.put(WxmpMessageConstant.PAGE, WxmpMessageConstant.PAGE_WORK); + } + //开发环境 + if ("dev".equals(envEnum.getCode())) { + jsonObject.put(WxmpMessageConstant.MINIPROGRAM_STATE, WxmpMessageConstant.STATE_DEV); + } + //测试环境 + if ("test".equals(envEnum.getCode())) { + jsonObject.put(WxmpMessageConstant.MINIPROGRAM_STATE, WxmpMessageConstant.STATE_TEST); + } + + String resultStr = HttpClientManager.getInstance().sendPostByJSON(WxmpMessageConstant.SEND_MESSAGE + accessToken, JSON.toJSONString(jsonObject)).getData(); + Map resultMap = JSON.parseObject(resultStr, Map.class); + Object errcode = resultMap.get(WxmpMessageConstant.ERR_CODE); + if (errcode.equals(NumConstant.ZERO)) { + //发送成功 + + //订阅条数-1 + int decrease = 0; + if (WxmpMessageConstant.RESI.equals(clientType)) { + decrease = wxmpResiUserSubscribeDao.decreaseResiSubscribeCount(openId, templateId, customerId, 1); + } else if (WxmpMessageConstant.WORK.equals(clientType)) { + decrease = wxmpWorkUserSubscribeDao.decreaseWorkSubscribeCount(openId, templateId, customerId, 1); + } + if (decrease == 0) { + logger.error("消息{}发送成功但订阅条数-1失败", JSON.toJSONString(msg)); + } + //存表 + int saveRes = wxmpMsgSendRecordService.saveRecord(initRecord(msg, templateId, openId, WxmpMessageConstant.SUCCESS)); + if (saveRes == 0) { + logger.error("消息{}发送成功但存入记录表失败", JSON.toJSONString(msg)); + } + } else { + //发送失败 + //用户拒绝,需清空订阅表条数,修改订阅状态 + if (errcode.equals(WxmpMessageConstant.USER_REFUSED)) { + int clear = 0; + if (WxmpMessageConstant.RESI.equals(clientType)) { + clear = wxmpResiUserSubscribeDao.clearResiSubscribeCount(openId, templateId, customerId); + } else if (WxmpMessageConstant.WORK.equals(clientType)) { + clear = wxmpWorkUserSubscribeDao.clearWorkSubscribeCount(openId, templateId, customerId); + } + if (clear == 0) { + logger.error("消息{}发送失败且清空订阅条数失败", JSON.toJSONString(msg)); + } + } + + //抛出错误 + throw new WxSubscribeException(String.valueOf(resultMap.get(WxmpMessageConstant.ERR_MSG)),templateId, openId); + } + + succecssCount++; + } catch (Exception e) { + String errMsg = e.getMessage(); + //ValidateException错误信息为getMsg +// if (StringUtils.isBlank(errMsg) && e instanceof ValidateException) { +// errMsg = ((ValidateException) e).getMsg(); +// } + if (e instanceof WxSubscribeException) { + //存表 + WxmpMsgSendRecordEntity wxmpMsgSendRecordEntity = initRecord(msg, ((WxSubscribeException) e).getTemplateId(), ((WxSubscribeException) e).getOpenId(), WxmpMessageConstant.ERROR); + wxmpMsgSendRecordEntity.setReason(errMsg); + int saveRes = wxmpMsgSendRecordService.saveRecord(wxmpMsgSendRecordEntity); + if (saveRes == 0) { + logger.error("消息{}发送失败且存入记录表失败", JSON.toJSONString(msg)); + } + } + + logger.error("消息:{}发送失败,原因是:{}", JSON.toJSONString(msg), errMsg); + continue; + } + } + logger.info("{}条消息中的{}条发送成功", msgList.size(), succecssCount); + } + + //初始化记录对象 + private WxmpMsgSendRecordEntity initRecord(WxSubscribeMessageFormDTO msg, String templateId, String openId, String status) { + WxmpMsgSendRecordEntity wxmpMsgSendRecordEntity = new WxmpMsgSendRecordEntity(); + wxmpMsgSendRecordEntity.setCustomerId(msg.getCustomerId()); + wxmpMsgSendRecordEntity.setClientType(msg.getClientType()); + wxmpMsgSendRecordEntity.setTemplateId(templateId); + wxmpMsgSendRecordEntity.setUserId(msg.getUserId()); + wxmpMsgSendRecordEntity.setWxOpenId(openId); + wxmpMsgSendRecordEntity.setBehaviorType(msg.getBehaviorType()); + wxmpMsgSendRecordEntity.setTitle("您有一条" + msg.getBehaviorType()); + wxmpMsgSendRecordEntity.setMessageContent(msg.getMessageContent()); + wxmpMsgSendRecordEntity.setMessageTime(new Date()); + wxmpMsgSendRecordEntity.setResult(status); + return wxmpMsgSendRecordEntity; + } + + /** + * @return + * @Description 居民端、工作端-获取客户小程序模板列表 + * @author sun + */ + @Override + public List templateList(GetTemplateListFormDTO formDTO) { + GetTemplateListFormDTO dto = ConvertUtils.sourceToTarget(formDTO, GetTemplateListFormDTO.class); + String url = "https://epmet-cloud.elinkservice.cn/api/third/personaltemplate/templatelist"; + //String url = "http://localhost:8080/api/third/personaltemplate/templatelist"; + String data = HttpClientManager.getInstance().sendPostByJSON(url, JSON.toJSONString(dto)).getData(); + logger.info("ThirdLoginServiceImpl.getUserWeChat:httpclient->url:"+url+",结果->"+data); + JSONObject toResult = JSON.parseObject(data); + Result mapToResult = ConvertUtils.mapToEntity(toResult, Result.class); + if (null != toResult.get("code")) { + mapToResult.setCode(((Integer) toResult.get("code")).intValue()); + } + if (!mapToResult.success()) { + logger.error("调用epmet_third服务获取小程序消息订阅模板数据失败"); + throw new RenException(mapToResult.getCode()); + } + List resultList = (List) mapToResult.getData(); + return resultList; + } + +} diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpMsgSendRecordServiceImpl.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpMsgSendRecordServiceImpl.java new file mode 100644 index 0000000000..62fdc10b0d --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpMsgSendRecordServiceImpl.java @@ -0,0 +1,109 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.dao.WxmpMsgSendRecordDao; +import com.epmet.dto.WxmpMsgSendRecordDTO; +import com.epmet.entity.WxmpMsgSendRecordEntity; +import com.epmet.redis.WxmpMsgSendRecordRedis; +import com.epmet.service.WxmpMsgSendRecordService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 消息发送记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-10-21 + */ +@Service +public class WxmpMsgSendRecordServiceImpl extends BaseServiceImpl implements WxmpMsgSendRecordService { + + @Autowired + private WxmpMsgSendRecordRedis wxmpMsgSendRecordRedis; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, WxmpMsgSendRecordDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, WxmpMsgSendRecordDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public WxmpMsgSendRecordDTO get(String id) { + WxmpMsgSendRecordEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, WxmpMsgSendRecordDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(WxmpMsgSendRecordDTO dto) { + WxmpMsgSendRecordEntity entity = ConvertUtils.sourceToTarget(dto, WxmpMsgSendRecordEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(WxmpMsgSendRecordDTO dto) { + WxmpMsgSendRecordEntity entity = ConvertUtils.sourceToTarget(dto, WxmpMsgSendRecordEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public int saveRecord(WxmpMsgSendRecordEntity entity) { + return baseDao.saveRecord(entity); + } +} diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpResiUserSubscribeServiceImpl.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpResiUserSubscribeServiceImpl.java new file mode 100644 index 0000000000..2c317e037b --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpResiUserSubscribeServiceImpl.java @@ -0,0 +1,104 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.dao.WxmpResiUserSubscribeDao; +import com.epmet.dto.WxmpResiUserSubscribeDTO; +import com.epmet.entity.WxmpResiUserSubscribeEntity; +import com.epmet.redis.WxmpResiUserSubscribeRedis; +import com.epmet.service.WxmpResiUserSubscribeService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 居民端用户订阅模板消息次数记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-10-21 + */ +@Service +public class WxmpResiUserSubscribeServiceImpl extends BaseServiceImpl implements WxmpResiUserSubscribeService { + + @Autowired + private WxmpResiUserSubscribeRedis wxmpResiUserSubscribeRedis; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, WxmpResiUserSubscribeDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, WxmpResiUserSubscribeDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public WxmpResiUserSubscribeDTO get(String id) { + WxmpResiUserSubscribeEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, WxmpResiUserSubscribeDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(WxmpResiUserSubscribeDTO dto) { + WxmpResiUserSubscribeEntity entity = ConvertUtils.sourceToTarget(dto, WxmpResiUserSubscribeEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(WxmpResiUserSubscribeDTO dto) { + WxmpResiUserSubscribeEntity entity = ConvertUtils.sourceToTarget(dto, WxmpResiUserSubscribeEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + +} \ No newline at end of file diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpTemplateMsgSubscribeStatusServiceImpl.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpTemplateMsgSubscribeStatusServiceImpl.java new file mode 100644 index 0000000000..5ea81bdd63 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpTemplateMsgSubscribeStatusServiceImpl.java @@ -0,0 +1,104 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.dao.WxmpTemplateMsgSubscribeStatusDao; +import com.epmet.dto.WxmpTemplateMsgSubscribeStatusDTO; +import com.epmet.entity.WxmpTemplateMsgSubscribeStatusEntity; +import com.epmet.redis.WxmpTemplateMsgSubscribeStatusRedis; +import com.epmet.service.WxmpTemplateMsgSubscribeStatusService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 用户模板消息订阅授权状态表(记录我们自己和微信的授权页用户勾选的状态) + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-10-21 + */ +@Service +public class WxmpTemplateMsgSubscribeStatusServiceImpl extends BaseServiceImpl implements WxmpTemplateMsgSubscribeStatusService { + + @Autowired + private WxmpTemplateMsgSubscribeStatusRedis wxmpTemplateMsgSubscribeStatusRedis; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, WxmpTemplateMsgSubscribeStatusDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, WxmpTemplateMsgSubscribeStatusDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public WxmpTemplateMsgSubscribeStatusDTO get(String id) { + WxmpTemplateMsgSubscribeStatusEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, WxmpTemplateMsgSubscribeStatusDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(WxmpTemplateMsgSubscribeStatusDTO dto) { + WxmpTemplateMsgSubscribeStatusEntity entity = ConvertUtils.sourceToTarget(dto, WxmpTemplateMsgSubscribeStatusEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(WxmpTemplateMsgSubscribeStatusDTO dto) { + WxmpTemplateMsgSubscribeStatusEntity entity = ConvertUtils.sourceToTarget(dto, WxmpTemplateMsgSubscribeStatusEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + +} \ No newline at end of file diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpUserSubscribeRecordServiceImpl.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpUserSubscribeRecordServiceImpl.java new file mode 100644 index 0000000000..9326681fe4 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpUserSubscribeRecordServiceImpl.java @@ -0,0 +1,104 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.dao.WxmpUserSubscribeRecordDao; +import com.epmet.dto.WxmpUserSubscribeRecordDTO; +import com.epmet.entity.WxmpUserSubscribeRecordEntity; +import com.epmet.redis.WxmpUserSubscribeRecordRedis; +import com.epmet.service.WxmpUserSubscribeRecordService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 用户触发订阅的行为记录表(同时记录微信授权页每次勾选的状态) + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-10-21 + */ +@Service +public class WxmpUserSubscribeRecordServiceImpl extends BaseServiceImpl implements WxmpUserSubscribeRecordService { + + @Autowired + private WxmpUserSubscribeRecordRedis wxmpUserSubscribeRecordRedis; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, WxmpUserSubscribeRecordDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, WxmpUserSubscribeRecordDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public WxmpUserSubscribeRecordDTO get(String id) { + WxmpUserSubscribeRecordEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, WxmpUserSubscribeRecordDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(WxmpUserSubscribeRecordDTO dto) { + WxmpUserSubscribeRecordEntity entity = ConvertUtils.sourceToTarget(dto, WxmpUserSubscribeRecordEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(WxmpUserSubscribeRecordDTO dto) { + WxmpUserSubscribeRecordEntity entity = ConvertUtils.sourceToTarget(dto, WxmpUserSubscribeRecordEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + +} \ No newline at end of file diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpWorkUserSubscribeServiceImpl.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpWorkUserSubscribeServiceImpl.java new file mode 100644 index 0000000000..93a3ad4147 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpWorkUserSubscribeServiceImpl.java @@ -0,0 +1,104 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.dao.WxmpWorkUserSubscribeDao; +import com.epmet.dto.WxmpWorkUserSubscribeDTO; +import com.epmet.entity.WxmpWorkUserSubscribeEntity; +import com.epmet.redis.WxmpWorkUserSubscribeRedis; +import com.epmet.service.WxmpWorkUserSubscribeService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 工作端用户订阅模板消息有效次数记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-10-21 + */ +@Service +public class WxmpWorkUserSubscribeServiceImpl extends BaseServiceImpl implements WxmpWorkUserSubscribeService { + + @Autowired + private WxmpWorkUserSubscribeRedis wxmpWorkUserSubscribeRedis; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, WxmpWorkUserSubscribeDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, WxmpWorkUserSubscribeDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public WxmpWorkUserSubscribeDTO get(String id) { + WxmpWorkUserSubscribeEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, WxmpWorkUserSubscribeDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(WxmpWorkUserSubscribeDTO dto) { + WxmpWorkUserSubscribeEntity entity = ConvertUtils.sourceToTarget(dto, WxmpWorkUserSubscribeEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(WxmpWorkUserSubscribeDTO dto) { + WxmpWorkUserSubscribeEntity entity = ConvertUtils.sourceToTarget(dto, WxmpWorkUserSubscribeEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + +} \ No newline at end of file diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/WxmpMsgSendRecordDao.xml b/epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/WxmpMsgSendRecordDao.xml new file mode 100644 index 0000000000..da33d13106 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/WxmpMsgSendRecordDao.xml @@ -0,0 +1,48 @@ + + + + + + + insert into wxmp_msg_send_record + (id, + customer_id, + client_type, + template_id, + user_id, + wx_open_id, + behavior_type, + title, + message_content, + message_time, + result, + reason, + del_flag, + revision, + created_by, + created_time, + updated_by, + updated_time) + values + (MD5(replace(UUID(),'-','')), + #{customerId}, + #{clientType}, + #{templateId}, + #{userId}, + #{wxOpenId}, + #{behaviorType}, + #{title}, + #{messageContent}, + #{messageTime}, + #{result}, + #{reason}, + 0, + 0, + 'sys', + now(), + 'sys', + now() + ) + + + diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/WxmpResiUserSubscribeDao.xml b/epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/WxmpResiUserSubscribeDao.xml new file mode 100644 index 0000000000..2a1df8a057 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/WxmpResiUserSubscribeDao.xml @@ -0,0 +1,53 @@ + + + + + + + + + update Wxmp_Resi_User_Subscribe + set count = if(count 1, 0, count - ${num} ) + where + del_flag = 0 + and customer_id = #{customerId} + and template_id = #{templateId} + and wx_open_id = #{openId} + and wx_subscribe_status = 'subscribe' + + + + update Wxmp_Resi_User_Subscribe + set count = 0, + wx_subscribe_status = 'unsubscribe' + where + del_flag = 0 + and customer_id = #{customerId} + and template_id = #{templateId} + and wx_open_id = #{openId} + + + + + diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/WxmpTemplateMsgSubscribeStatusDao.xml b/epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/WxmpTemplateMsgSubscribeStatusDao.xml new file mode 100644 index 0000000000..d1fde2360a --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/WxmpTemplateMsgSubscribeStatusDao.xml @@ -0,0 +1,47 @@ + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/WxmpUserSubscribeRecordDao.xml b/epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/WxmpUserSubscribeRecordDao.xml new file mode 100644 index 0000000000..042c8f94a0 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/WxmpUserSubscribeRecordDao.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/WxmpWorkUserSubscribeDao.xml b/epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/WxmpWorkUserSubscribeDao.xml new file mode 100644 index 0000000000..efa31174f9 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/WxmpWorkUserSubscribeDao.xml @@ -0,0 +1,49 @@ + + + + + + + + + update Wxmp_Work_User_Subscribe + set count = if(count < 1, 0, count - ${num} ) + where + del_flag =0 + and customer_id = #{customerId} + and template_id = #{templateId} + and wx_open_id = #{openId} + and wx_subscribe_status = 'subscribe' + + + update Wxmp_Work_User_Subscribe + set count = 0, + wx_subscribe_status = 'unsubscribe' + where + del_flag =0 + and customer_id = #{customerId} + and template_id = #{templateId} + and wx_open_id = #{openId} + + + diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/AddToTemplateFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/AddToTemplateFormDTO.java new file mode 100644 index 0000000000..10de3b3d28 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/AddToTemplateFormDTO.java @@ -0,0 +1,16 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/10/28 9:55 + */ +@Data +public class AddToTemplateFormDTO implements Serializable { + private static final long serialVersionUID = -7759275805971446460L; + private String draftId; +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CustomerTemplateListFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CustomerTemplateListFormDTO.java new file mode 100644 index 0000000000..9dbabbfdbe --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CustomerTemplateListFormDTO.java @@ -0,0 +1,27 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Description 获取客户小程序模板列表-接口入参 + * @Author sun + */ +@Data +public class CustomerTemplateListFormDTO implements Serializable { + + /** + * 客户Id + */ + @NotBlank(message="客户Id不能为空", groups = {AddUserInternalGroup.class}) + private String customerId; + /** + * 微信公共模板库模板Id + */ + @NotBlank(message="公共模板Id不能为空", groups = {AddUserInternalGroup.class}) + private String publicId; + public interface AddUserInternalGroup {} +} + diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/DeleteTemplateFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/DeleteTemplateFormDTO.java new file mode 100644 index 0000000000..843d17a0eb --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/DeleteTemplateFormDTO.java @@ -0,0 +1,16 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/10/28 9:57 + */ +@Data +public class DeleteTemplateFormDTO implements Serializable { + private static final long serialVersionUID = -6516706760708801090L; + private String templateId; +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/GetTemplateListFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/GetTemplateListFormDTO.java new file mode 100644 index 0000000000..09fb259376 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/GetTemplateListFormDTO.java @@ -0,0 +1,31 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Description 获取客户小程序模板列表-接口入参 + * @Author sun + */ +@Data +public class GetTemplateListFormDTO implements Serializable { + + /** + * 客户Id + */ + @NotBlank(message="客户Id不能为空", groups = {AddUserInternalGroup.class}) + private String customerId; + /** + * 小程序Id + */ + @NotBlank(message="小程序appId不能为空", groups = {AddUserInternalGroup.class}) + private String appId; + /** + * 模板类型(站内信提醒) + */ + private String templateType; + public interface AddUserInternalGroup {} +} + diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/CustomerTemplateListResultDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/CustomerTemplateListResultDTO.java new file mode 100644 index 0000000000..e6d92fd8f3 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/CustomerTemplateListResultDTO.java @@ -0,0 +1,30 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description 获取客户小程序模板列表-接口返参 + * @Author sun + */ +@Data +public class CustomerTemplateListResultDTO implements Serializable { + private static final long serialVersionUID = 6856602932571839314L; + + /** + * 模板Id + */ + private String templateId; + + /** + * 模板类型(站内信提醒) + */ + private String templateType; + + /** + * 所属端(居民端:resi 工作端:work) + */ + private String clientType; + +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/GetTemplateListResultDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/GetTemplateListResultDTO.java new file mode 100644 index 0000000000..d95e482c6f --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/GetTemplateListResultDTO.java @@ -0,0 +1,25 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description 获取客户小程序模板列表-接口返参 + * @Author sun + */ +@Data +public class GetTemplateListResultDTO implements Serializable { + private static final long serialVersionUID = 6856602932571839314L; + + /** + * 模板Id + */ + private String templateId; + + /** + * 模板类型(站内信提醒) + */ + private String templateType; + +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/TemplateDraftListResultDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/TemplateDraftListResultDTO.java new file mode 100644 index 0000000000..f5908d773d --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/TemplateDraftListResultDTO.java @@ -0,0 +1,34 @@ +package com.epmet.dto.result; + +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/10/28 9:52 + */ +@NoArgsConstructor +@Data +public class TemplateDraftListResultDTO implements Serializable { + + private static final long serialVersionUID = 8249448254837721428L; + /** + * 开发者上传草稿时间戳 + */ + private String createTime; + /** + * 版本号,开发者自定义字段 + */ + private String userVersion; + /** + * 版本描述 开发者自定义字段 + */ + private String userDesc; + /** + * 草稿 id + */ + private String draftId; +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/CodeController.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/CodeController.java index cdaa2a6742..c7457e048f 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/CodeController.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/CodeController.java @@ -251,5 +251,44 @@ public class CodeController { return new Result<>(); } + /** + * 获取代码草稿列表 + * @author zhaoqifeng + * @date 2020/10/28 9:59 + * @param + * @return com.epmet.commons.tools.utils.Result> + */ + @PostMapping("gettemplatedraftlist") + public Result> getTemplateDraftList() { + List list = codeService.getTemplateDraftList(); + return new Result>().ok(list); + } + + /** + * 将草稿添加到代码模板库 + * @author zhaoqifeng + * @date 2020/10/28 10:00 + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + */ + @PostMapping("addtotemplate") + public Result addToTemplate(@RequestBody AddToTemplateFormDTO formDTO) { + codeService.addToTemplate(formDTO); + return new Result<>(); + } + + /** + * 删除指定代码模板 + * @author zhaoqifeng + * @date 2020/10/28 10:03 + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + */ + @PostMapping("deletetemplate") + public Result deleteTemplate(@RequestBody DeleteTemplateFormDTO formDTO) { + codeService.deleteTemplate(formDTO); + return new Result<>(); + } + } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/PersonalTemplateController.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/PersonalTemplateController.java new file mode 100644 index 0000000000..dc6099d9fe --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/PersonalTemplateController.java @@ -0,0 +1,52 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dto.form.CustomerTemplateListFormDTO; +import com.epmet.dto.form.GetTemplateListFormDTO; +import com.epmet.dto.result.CustomerTemplateListResultDTO; +import com.epmet.dto.result.GetTemplateListResultDTO; +import com.epmet.service.PersonalTemplateService; +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; + +import java.util.List; + +/** + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-09-09 + */ +@RestController +@RequestMapping("personaltemplate") +public class PersonalTemplateController { + + @Autowired + private PersonalTemplateService personalTemplateService; + + /** + * @return + * @Description 居民端、工作端-获取客户小程序模板列表 + * @author sun + */ + @PostMapping("templatelist") + public Result> templateList(@RequestBody GetTemplateListFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, GetTemplateListFormDTO.AddUserInternalGroup.class); + return new Result>().ok(personalTemplateService.templateList(formDTO)); + } + + /** + * @return + * @Description 获取客户两个端站内信模板Id + * @author sun + */ + @PostMapping("customertemplatelist") + public Result> customerTemplateList(@RequestBody CustomerTemplateListFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, CustomerTemplateListFormDTO.AddUserInternalGroup.class); + return new Result>().ok(personalTemplateService.customerTemplateList(formDTO)); + } + + +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PersonalTemplateDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PersonalTemplateDao.java index bd77f6ffea..6e229dc052 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PersonalTemplateDao.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PersonalTemplateDao.java @@ -19,7 +19,11 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.PersonalTemplateDTO; +import com.epmet.dto.form.CustomerTemplateListFormDTO; +import com.epmet.dto.form.GetTemplateListFormDTO; import com.epmet.dto.result.CustomerTempResultDTO; +import com.epmet.dto.result.CustomerTemplateListResultDTO; +import com.epmet.dto.result.GetTemplateListResultDTO; import com.epmet.dto.result.TemplateDTO; import com.epmet.entity.PersonalTemplateEntity; import org.apache.ibatis.annotations.Mapper; @@ -76,4 +80,18 @@ public interface PersonalTemplateDao extends BaseDao { */ List selectListByCustomerId(@Param("appId") String appId, @Param("customerId") String customerId, @Param("clientType") String clientType); + + /** + * @return + * @Description 居民端、工作端-获取客户小程序模板列表 + * @author sun + */ + List selectTemplateList(GetTemplateListFormDTO formDTO); + + /** + * @return + * @Description 获取客户两个端站内信模板Id + * @author sun + */ + List selectCustomerTemplateList(CustomerTemplateListFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/CodeService.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/CodeService.java index 38e409d79b..32fce29360 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/CodeService.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/CodeService.java @@ -217,4 +217,31 @@ public interface CodeService { */ void revertCodeRelease(CodeCommonFormDTO formDTO); + /** + * 获取代码草稿列表 + * @author zhaoqifeng + * @date 2020/10/28 10:02 + * @param + * @return java.util.List + */ + List getTemplateDraftList(); + + /** + * 将草稿添加到代码模板库 + * @author zhaoqifeng + * @date 2020/10/28 10:02 + * @param formDTO + * @return void + */ + void addToTemplate(AddToTemplateFormDTO formDTO); + + /** + * 删除指定代码模板 + * @author zhaoqifeng + * @date 2020/10/28 10:03 + * @param formDTO + * @return void + */ + void deleteTemplate(DeleteTemplateFormDTO formDTO); + } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PersonalTemplateService.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PersonalTemplateService.java index 447e6dd388..f3f0da9b49 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PersonalTemplateService.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PersonalTemplateService.java @@ -20,6 +20,10 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; import com.epmet.dto.PersonalTemplateDTO; +import com.epmet.dto.form.CustomerTemplateListFormDTO; +import com.epmet.dto.form.GetTemplateListFormDTO; +import com.epmet.dto.result.CustomerTemplateListResultDTO; +import com.epmet.dto.result.GetTemplateListResultDTO; import com.epmet.dto.result.TemplateDTO; import com.epmet.entity.PersonalTemplateEntity; @@ -123,4 +127,18 @@ public interface PersonalTemplateService extends BaseService getListByCustomer(String appId, String customerId, String clientType); + + /** + * @return + * @Description 居民端、工作端-获取客户小程序模板列表 + * @author sun + */ + List templateList(GetTemplateListFormDTO formDTO); + + /** + * @return + * @Description 获取客户两个端站内信模板Id + * @author sun + */ + List customerTemplateList(CustomerTemplateListFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeServiceImpl.java index c8f51e8e40..7e1208dcc4 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeServiceImpl.java @@ -741,6 +741,77 @@ public class CodeServiceImpl implements CodeService { codeCustomerService.deleteById(codeCustomerDTO.getId()); } + /** + * 获取代码草稿列表 + * + * @return java.util.List + * @author zhaoqifeng + * @date 2020/10/28 10:02 + */ + @Override + public List getTemplateDraftList() { + List resultList = new ArrayList<>(); + //获取COMPONENT_ACCESS_TOKEN + String accessToken = componentAccessTokenDao.getComponentAccessToken(); + //调用微信API获取模板列表 + WxResult wxResult = wxMaCodeService.getTemplateDraftList(accessToken); + if (!wxResult.success()) { + throw new RenException(wxResult.getErrorCode(), wxResult.getErrorMsg()); + } + if (null == wxResult.getData() || wxResult.getData().getDraftList().size() == NumConstant.ZERO) { + return resultList; + } + wxResult.getData().getDraftList().forEach(temp -> { + TemplateDraftListResultDTO dto = new TemplateDraftListResultDTO(); + dto.setDraftId(temp.getDraftId()); + dto.setUserVersion(temp.getUserVersion()); + dto.setUserDesc(temp.getUserDesc()); + dto.setCreateTime(DateUtils.formatTimestamp(temp.getCreateTime(), DateUtils.DATE_TIME_PATTERN)); + resultList.add(dto); + }); + return resultList; + } + + /** + * 将草稿添加到代码模板库 + * + * @param formDTO + * @return void + * @author zhaoqifeng + * @date 2020/10/28 10:02 + */ + @Override + public void addToTemplate(AddToTemplateFormDTO formDTO) { + //获取COMPONENT_ACCESS_TOKEN + String accessToken = componentAccessTokenDao.getComponentAccessToken(); + WxAddToTemplateReq request = new WxAddToTemplateReq(); + request.setDraftId(formDTO.getDraftId()); + WxResult result = wxMaCodeService.addToTemplate(accessToken, request); + if (!result.success()) { + throw new RenException(result.getErrorCode(), result.getErrorMsg()); + } + } + + /** + * 删除指定代码模板 + * + * @param formDTO + * @return void + * @author zhaoqifeng + * @date 2020/10/28 10:03 + */ + @Override + public void deleteTemplate(DeleteTemplateFormDTO formDTO) { + //获取COMPONENT_ACCESS_TOKEN + String accessToken = componentAccessTokenDao.getComponentAccessToken(); + WxDeleteTemplateReq request = new WxDeleteTemplateReq(); + request.setTemplateId(formDTO.getTemplateId()); + WxResult result = wxMaCodeService.deleteTemplate(accessToken, request); + if (!result.success()) { + throw new RenException(result.getErrorCode(), result.getErrorMsg()); + } + } + private void saveOperation(String customerId, String clientType, String codeId, String version, String operation, String describe) { CodeOperationHistoryDTO operationDTO = new CodeOperationHistoryDTO(); operationDTO.setCustomerId(customerId); diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PersonalTemplateServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PersonalTemplateServiceImpl.java index f7b5589f43..154cca9082 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PersonalTemplateServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PersonalTemplateServiceImpl.java @@ -25,6 +25,10 @@ import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.dao.PersonalTemplateDao; import com.epmet.dto.PersonalTemplateDTO; +import com.epmet.dto.form.CustomerTemplateListFormDTO; +import com.epmet.dto.form.GetTemplateListFormDTO; +import com.epmet.dto.result.CustomerTemplateListResultDTO; +import com.epmet.dto.result.GetTemplateListResultDTO; import com.epmet.dto.result.TemplateDTO; import com.epmet.entity.PersonalTemplateEntity; import com.epmet.service.PersonalTemplateService; @@ -116,4 +120,25 @@ public class PersonalTemplateServiceImpl extends BaseServiceImpl templateList(GetTemplateListFormDTO formDTO) { + //根据客户Id、appId、模板类型查询小程序订阅消息模板列表 + return baseDao.selectTemplateList(formDTO); + } + + /** + * @return + * @Description 获取客户两个端站内信模板Id + * @author sun + */ + @Override + public List customerTemplateList(CustomerTemplateListFormDTO formDTO) { + return baseDao.selectCustomerTemplateList(formDTO); + } + } \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/constant/WxMaCodeConstant.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/constant/WxMaCodeConstant.java index c0d11dca5b..7d1263e3b3 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/constant/WxMaCodeConstant.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/constant/WxMaCodeConstant.java @@ -185,4 +185,19 @@ public interface WxMaCodeConstant { * 加急审核申请 */ String SPEED_UP_AUDIT_URL = "https://api.weixin.qq.com/wxa/speedupaudit"; + + /** + * 获取代码草稿列表 + */ + String GET_TEMPLATE_DRAFT_LIST_URL = "https://api.weixin.qq.com/wxa/gettemplatedraftlist"; + + /** + * 将草稿添加到代码模板库 + */ + String ADD_TO_TEMPLATE_URL = "https://api.weixin.qq.com/wxa/addtotemplate"; + + /** + * 获取代码草稿列表 + */ + String DELETE_TEMPLATE_URL = "https://api.weixin.qq.com/wxa/deletetemplate"; } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/enums/WxMaErrorMsgEnum.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/enums/WxMaErrorMsgEnum.java index 29e341df7a..1e9425c7ec 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/enums/WxMaErrorMsgEnum.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/enums/WxMaErrorMsgEnum.java @@ -476,6 +476,17 @@ public enum WxMaErrorMsgEnum { CODE_85012(85012, "无效的审核 id"), + CODE_87006(87006, "小游戏不能提交"), + CODE_86007(86007, "小程序禁止提交"), + CODE_85051(85012, "version_desc或者preview_info超限"), + CODE_85092(85092, "preview_info格式错误"), + CODE_85093(85093, "preview_info 视频或者图片个数超限"), + CODE_85094(85094, "需提供审核机制说明信息"), + CODE_86009(86009, "服务商新增小程序代码提审能力被限制"), + CODE_86010(86010, "服务商迭代小程序代码提审能力被限制"), + CODE_9400001(9400001, "该开发小程序已开通小程序直播权限,不支持发布版本。如需发版,请解绑开发小程序后再操作"), + CODE_9402202(9402202, "请勿频繁提交,待上一次操作完成后再提交"), + CODE_87013(87013, "撤回次数达到上限(每天一次,每个月 10 次)"), CODE_85019(85019, "没有审核版本"), @@ -539,6 +550,38 @@ public enum WxMaErrorMsgEnum { CODE_200020(200020, "关键词列表 kidList 参数错误"), CODE_200021(200021, "场景描述 sceneDesc 参数错误"), + + CODE_20002(20002, "商品id不存在"), + CODE_1003(1003, "POST参数非法"), + CODE_40005(40005, "上传素材文件格式不对"), + CODE_40006(40006, "上传素材文件大小超出限制"), + CODE_40008(40008, "不合法的消息类型"), + CODE_40010(40010, "不合法的语音文件大小"), + CODE_40011(40011, "不合法的视频文件大小"), + CODE_40012(40012, "不合法的缩略图文件大小"), + CODE_40015(40015, "不合法的菜单类型"), + CODE_40016(40016, "不合法的按钮个数"), + CODE_40017(40017, "不合法的按钮类型"), + CODE_40018(40018, "不合法的按钮名字长度"), + CODE_40019(40019, "不合法的按钮 KEY 长度"), + CODE_40020(40020, "不合法的按钮 URL 长度"), + CODE_40021(40021, "不合法的菜单版本号"), + CODE_40022(40022, "不合法的子菜单级数"), + CODE_40023(40023, "不合法的子菜单按钮个数"), + CODE_40024(40024, "不合法的子菜单按钮类型"), + CODE_40025(40025, "不合法的子菜单按钮名字长度"), + CODE_40026(40026, "不合法的子菜单按钮 KEY 长度"), + CODE_40027(40027, "不合法的子菜单按钮 URL 长度"), + CODE_40028(40028, "不合法的自定义菜单使用用户"), + CODE_40030(40030, "不合法的 refresh_token"), + CODE_40031(40031, "不合法的 openid 列表"), + CODE_40032(40032, "不合法的 openid 列表长度"), + CODE_40033(40033, "不合法的请求字符,不能包含 \\uxxxx 格式的字符"), + CODE_40034(40034, "无效的模板大小"), + CODE_40035(40035, "不合法的参数"), + CODE_40036(40036, "不合法的 template_id 长度"), + CODE_40038(40038, "不合法的请求格式"), + ; private int code; diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxAddToTemplateReq.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxAddToTemplateReq.java new file mode 100644 index 0000000000..997f959342 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxAddToTemplateReq.java @@ -0,0 +1,18 @@ +package com.epmet.wxapi.param; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; + +import java.io.Serializable; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/10/28 10:20 + */ +@Data +public class WxAddToTemplateReq implements Serializable { + private static final long serialVersionUID = -4667328954236033227L; + @SerializedName("draft_id") + private String draftId; +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxDeleteTemplateReq.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxDeleteTemplateReq.java new file mode 100644 index 0000000000..1a70b18e9e --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxDeleteTemplateReq.java @@ -0,0 +1,18 @@ +package com.epmet.wxapi.param; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; + +import java.io.Serializable; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/10/28 10:21 + */ +@Data +public class WxDeleteTemplateReq implements Serializable { + private static final long serialVersionUID = 3099244896895201612L; + @SerializedName("template_id") + private String templateId; +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/result/WxTemplateDraftListResult.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/result/WxTemplateDraftListResult.java new file mode 100644 index 0000000000..e77437af53 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/result/WxTemplateDraftListResult.java @@ -0,0 +1,51 @@ +package com.epmet.wxapi.result; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.List; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/10/28 10:12 + */ + +@NoArgsConstructor +@Data +public class WxTemplateDraftListResult implements Serializable { + private static final long serialVersionUID = -7316579770340890368L; + /** + * 错误码 + */ + private Integer errcode; + /** + * 错误信息 + */ + private String errmsg; + @SerializedName("draft_list") + private List draftList; + + public boolean success(){ + return errcode == 0; + } + + @NoArgsConstructor + @Data + public static class DraftListBean { + /** + * create_time + */ + @SerializedName("create_time") + private Long createTime; + @SerializedName("user_version") + private String userVersion; + @SerializedName("user_desc") + private String userDesc; + @SerializedName("draft_id") + private String draftId; + } + +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/WxMaCodeService.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/WxMaCodeService.java index 1918e79603..452ad866e1 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/WxMaCodeService.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/WxMaCodeService.java @@ -202,4 +202,33 @@ public interface WxMaCodeService { * @return com.epmet.wxapi.result.WxResult */ WxResult revertCodeRelease(String accessToken); + + /** + * 获取代码草稿列表 + * @author zhaoqifeng + * @date 2020/10/28 10:18 + * @param accessToken + * @return com.epmet.wxapi.result.WxResult + */ + WxResult getTemplateDraftList(String accessToken); + + /** + * 将草稿添加到代码模板库 + * @author zhaoqifeng + * @date 2020/10/28 10:23 + * @param accessToken + * @param request + * @return com.epmet.wxapi.result.WxResult + */ + WxResult addToTemplate(String accessToken, WxAddToTemplateReq request); + + /** + * 删除指定代码模板 + * @author zhaoqifeng + * @date 2020/10/28 10:23 + * @param accessToken + * @param request + * @return com.epmet.wxapi.result.WxResult + */ + WxResult deleteTemplate(String accessToken, WxDeleteTemplateReq request); } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/impl/WxMaCodeServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/impl/WxMaCodeServiceImpl.java index 1ce1c55b68..8c859debec 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/impl/WxMaCodeServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/impl/WxMaCodeServiceImpl.java @@ -387,6 +387,89 @@ public class WxMaCodeServiceImpl implements WxMaCodeService { return result; } + /** + * 获取代码草稿列表 + * + * @param accessToken + * @return com.epmet.wxapi.result.WxResult + * @author zhaoqifeng + * @date 2020/10/28 10:18 + */ + @Override + public WxResult getTemplateDraftList(String accessToken) { + WxResult result = new WxResult<>(); + String url = WxMaCodeConstant.GET_TEMPLATE_DRAFT_LIST_URL + "?" + "access_token=" + accessToken; + Result templateListResult = HttpClientManager.getInstance().sendGet(url, null); + if (!templateListResult.success()) { + result.setErrorCode(templateListResult.getCode()); + result.setErrorMsg(templateListResult.getMsg()); + return result; + } + Gson gson = new Gson(); + WxTemplateDraftListResult templateList = gson.fromJson(templateListResult.getData(), WxTemplateDraftListResult.class); + result.setErrorCode(templateList.getErrcode()); + result.setErrorMsg(WxMaErrorMsgEnum.findMsgByCode(templateList.getErrcode())); + result.setData(templateList); + WxTemplateDraftListResult draftListResult = JSONObject.parseObject(templateListResult.getData(), WxTemplateDraftListResult.class); + if (!draftListResult.success()) { + result.setErrorCode(draftListResult.getErrcode()); + result.setErrorMsg(WxMaErrorMsgEnum.findMsgByCode(draftListResult.getErrcode())); + return result; + } + result.ok(draftListResult); + return result; + } + + /** + * 将草稿添加到代码模板库 + * + * @param accessToken + * @param request + * @return com.epmet.wxapi.result.WxResult + * @author zhaoqifeng + * @date 2020/10/28 10:23 + */ + @Override + public WxResult addToTemplate(String accessToken, WxAddToTemplateReq request) { + WxResult result = new WxResult(); + String url = WxMaCodeConstant.ADD_TO_TEMPLATE_URL + "?" + "access_token=" + accessToken; + Result submitResult = HttpClientManager.getInstance().sendPostByJSON(url, toJson(request)); + if (!submitResult.success()) { + result.setErrorCode(submitResult.getCode()); + result.setErrorMsg(submitResult.getMsg()); + return result; + } + JSONObject jsonObject = JSONObject.parseObject(submitResult.getData()); + result.setErrorCode(jsonObject.getInteger(ERR_CODE)); + result.setErrorMsg(WxMaErrorMsgEnum.findMsgByCode(jsonObject.getInteger(ERR_CODE))); + return result; + } + + /** + * 删除指定代码模板 + * + * @param accessToken + * @param request + * @return com.epmet.wxapi.result.WxResult + * @author zhaoqifeng + * @date 2020/10/28 10:23 + */ + @Override + public WxResult deleteTemplate(String accessToken, WxDeleteTemplateReq request) { + WxResult result = new WxResult(); + String url = WxMaCodeConstant.DELETE_TEMPLATE_URL + "?" + "access_token=" + accessToken; + Result submitResult = HttpClientManager.getInstance().sendPostByJSON(url, toJson(request)); + if (!submitResult.success()) { + result.setErrorCode(submitResult.getCode()); + result.setErrorMsg(submitResult.getMsg()); + return result; + } + JSONObject jsonObject = JSONObject.parseObject(submitResult.getData()); + result.setErrorCode(jsonObject.getInteger(ERR_CODE)); + result.setErrorMsg(WxMaErrorMsgEnum.findMsgByCode(jsonObject.getInteger(ERR_CODE))); + return result; + } + private String toJson(Object object) { GsonBuilder gsonBuilder = new GsonBuilder(); gsonBuilder.setPrettyPrinting(); diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PersonalTemplateDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PersonalTemplateDao.xml index f3b46b3c42..7eab9a2e63 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PersonalTemplateDao.xml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PersonalTemplateDao.xml @@ -75,5 +75,33 @@ ON t1.PRI_TMPL_ID = t2.PID + + + \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/CustomerFootBarController.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/CustomerFootBarController.java index 5b9c7a0da8..924dbc5b4b 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/CustomerFootBarController.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/CustomerFootBarController.java @@ -18,6 +18,8 @@ package com.epmet.controller; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.redis.RedisKeys; +import com.epmet.commons.tools.redis.RedisUtils; import com.epmet.commons.tools.utils.ExcelUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.AssertUtils; @@ -31,8 +33,12 @@ import com.epmet.dto.result.CustomerFootBarResultDTO; import com.epmet.entity.CustomerFootBarEntity; import com.epmet.excel.CustomerFootBarExcel; import com.epmet.service.CustomerFootBarService; +import com.epmet.service.impl.CustomerFunctionDetailServiceImpl; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.util.CollectionUtils; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; @@ -51,9 +57,14 @@ import java.util.Map; @RequestMapping("customerfootbar") public class CustomerFootBarController { + private Logger logger = LogManager.getLogger(CustomerFootBarController.class); + @Autowired private CustomerFootBarService customerFootBarService; + @Autowired + private RedisUtils redisUtils; + @GetMapping("page") public Result> page(@RequestParam Map params){ PageData page = customerFootBarService.page(params); @@ -107,6 +118,13 @@ public class CustomerFootBarController { String customerId = formDTO.getCustomerId(); String appType = formDTO.getAppType(); + // 优先查询缓存 + List bars = (List)redisUtils.get(RedisKeys.getCustomerFootbarKey(customerId, appType)); + if (bars != null) { + new Result>().ok(bars); + } + + // 查询db List footbars = customerFootBarService.listCustomerFootBars(customerId, appType); List barDTOS = new LinkedList<>(); footbars.forEach(barEntity -> { @@ -117,6 +135,12 @@ public class CustomerFootBarController { barDTO.setDefaultBarName(defaultFootBarEntity.getBarName()); barDTOS.add(barDTO); }); + + try { + redisUtils.set(RedisKeys.getCustomerFootbarKey(customerId, appType), barDTOS); + } catch (Exception e) { + logger.error("将客户footbar放入缓存失败,customerId:{}, appType:{}", customerId, appType); + } return new Result>().ok(barDTOS); } diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerFootBarServiceImpl.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerFootBarServiceImpl.java index 594674b283..5205059bc0 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerFootBarServiceImpl.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerFootBarServiceImpl.java @@ -23,6 +23,8 @@ import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.redis.RedisKeys; +import com.epmet.commons.tools.redis.RedisUtils; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.dao.CustomerFootBarDao; @@ -36,10 +38,12 @@ import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; import java.util.Arrays; import java.util.List; import java.util.Map; +import java.util.Optional; /** * APP底部菜单栏信息 @@ -53,6 +57,9 @@ public class CustomerFootBarServiceImpl extends BaseServiceImpl page(Map params) { IPage page = baseDao.selectPage( @@ -160,6 +167,7 @@ public class CustomerFootBarServiceImpl extends BaseServiceImpl { + // 删除缓存中的footbar。若缓存删除失败,则事务回滚,db中的不应该成功 + redisUtils.delete(RedisKeys.getCustomerFootbarKey(c.getCustomerId(), c.getAppType())); + }); + } + } @Override @@ -204,9 +227,17 @@ public class CustomerFootBarServiceImpl extends BaseServiceImpl { + // 删除缓存中的footbar。若缓存删除失败,则事务回滚,db中的不应该成功 + redisUtils.delete(RedisKeys.getCustomerFootbarKey(c.getCustomerId(), c.getAppType())); + }); } @Transactional @@ -230,10 +261,14 @@ public class CustomerFootBarServiceImpl extends BaseServiceImpl msgList = new ArrayList<>(); + msgList.add(wxSubscribeMessageFormDTO); + epmetMessageOpenFeignClient.sendWxSubscribeMessage(msgList); } /** @@ -500,7 +511,7 @@ public class ResiGroupMemberServiceImpl extends BaseServiceImpl msgList = new ArrayList<>(); + msgList.add(wxSubscribeMessageFormDTO); + epmetMessageOpenFeignClient.sendWxSubscribeMessage(msgList); } /** diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/PartyMemberConfirmServiceImpl.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/PartyMemberConfirmServiceImpl.java index 7713b97928..eeddca8fda 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/PartyMemberConfirmServiceImpl.java +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/PartyMemberConfirmServiceImpl.java @@ -23,6 +23,7 @@ import com.epmet.modules.feign.ResiGroupFeignClient; import com.epmet.modules.partymember.entity.*; import com.epmet.modules.partymember.redis.PartymemberInfoRedis; import com.epmet.modules.partymember.service.*; +import com.epmet.modules.warmhearted.constant.ResiWarmUserMessageConstant; import com.epmet.modules.warmhearted.constant.ResiWarmheartedConstant; import com.epmet.modules.warmhearted.constant.ResiWarmheartedVisitConstant; import com.epmet.redis.ResiPartyMemberRedis; @@ -97,7 +98,7 @@ public class PartyMemberConfirmServiceImpl implements PartyMemberConfirmService // 获取党员认证信息,判断是否提交认证 PartymemberInfoDTO partyMemberInfoParam = new PartymemberInfoDTO(); partyMemberInfoParam.setCustomerId(fromDto.getCustomerId()); - partyMemberInfoParam.setGridId(fromDto.getGridId()); + //partyMemberInfoParam.setGridId(fromDto.getGridId()); partyMemberInfoParam.setUserId(fromDto.getUserId()); PartymemberInfoDTO partyMemberInfoResult = partymemberInfoService.getPartyMemberInfo(partyMemberInfoParam); // 若已提交,获取提交的党员信息 @@ -644,6 +645,17 @@ public class PartyMemberConfirmServiceImpl implements PartyMemberConfirmService String messageContent = String.format(userMsg, gridName); userMessageFormDTO.setMessageContent(messageContent); userMessageFormDTO.setReadFlag(ReadFlagConstant.UN_READ); + + //发送微信订阅消息 + WxSubscribeMessageFormDTO wxSubscribeMessageFormDTO = new WxSubscribeMessageFormDTO(); + wxSubscribeMessageFormDTO.setCustomerId(formDTO.getCustomerId()); + wxSubscribeMessageFormDTO.setUserId(formDTO.getUserId()); + wxSubscribeMessageFormDTO.setClientType(AppClientConstant.APP_RESI); + wxSubscribeMessageFormDTO.setBehaviorType(ResiWarmUserMessageConstant.WX_WARMHEARTED_BEHAVIOR); + wxSubscribeMessageFormDTO.setMessageContent(messageContent); + List msgList = new ArrayList<>(); + msgList.add(wxSubscribeMessageFormDTO); + epmetMessageOpenFeignClient.sendWxSubscribeMessage(msgList); //保存消息 return epmetMessageOpenFeignClient.saveUserMessage(userMessageFormDTO); } diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/warmhearted/constant/ResiWarmUserMessageConstant.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/warmhearted/constant/ResiWarmUserMessageConstant.java index 15cb42bd63..13e1231a2a 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/warmhearted/constant/ResiWarmUserMessageConstant.java +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/warmhearted/constant/ResiWarmUserMessageConstant.java @@ -26,4 +26,9 @@ public interface ResiWarmUserMessageConstant { */ String AUDIT_REJECT_MSG = "您好,您申请的%s热心居民,已被驳回,原因:%s"; + /** + * 热心居民申请-微信订阅behavior + */ + String WX_WARMHEARTED_BEHAVIOR = "热心居民申请消息"; + } diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/warmhearted/service/impl/ResiWarmheartedApplyServiceImpl.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/warmhearted/service/impl/ResiWarmheartedApplyServiceImpl.java index c00077dd1f..26beee052c 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/warmhearted/service/impl/ResiWarmheartedApplyServiceImpl.java +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/warmhearted/service/impl/ResiWarmheartedApplyServiceImpl.java @@ -39,6 +39,7 @@ import com.epmet.dto.form.*; import com.epmet.dto.result.AgencyAndStaffsResultDTO; import com.epmet.dto.result.GovStaffRoleResultDTO; import com.epmet.dto.result.UserResiInfoResultDTO; +import com.epmet.feign.EpmetMessageOpenFeignClient; import com.epmet.modules.feign.EpmetMessageFeignClient; import com.epmet.modules.feign.EpmetUserFeignClient; import com.epmet.modules.feign.GovOrgFeignClient; @@ -90,6 +91,8 @@ public class ResiWarmheartedApplyServiceImpl extends BaseServiceImpl msgList = new ArrayList<>(); + msgList.add(wxSubscribeMessageFormDTO); + epmetMessageOpenFeignClient.sendWxSubscribeMessage(msgList); + //保存消息 return epmetMessageFeignClient.saveUserMessage(userMessageFormDTO); } diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partymember/PartymemberInfoDao.xml b/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partymember/PartymemberInfoDao.xml index 35447099f8..ece58ea009 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partymember/PartymemberInfoDao.xml +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partymember/PartymemberInfoDao.xml @@ -38,7 +38,6 @@ AND pcm.DEL_FLAG = 0 WHERE pi.CUSTOMER_ID = #{customerId} - AND pi.GRID_ID = #{gridId} AND pi.USER_ID = #{userId} AND pi.CONFIRM_RESULT = 'auto_confirm_failed' AND pi.DEL_FLAG = 0 diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StaffBasicInfoFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StaffBasicInfoFormDTO.java new file mode 100644 index 0000000000..5548431919 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StaffBasicInfoFormDTO.java @@ -0,0 +1,23 @@ +package com.epmet.dto.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Author sun + * @Description 工作端-查询用户基础信息-接口入参 + **/ +@Data +public class StaffBasicInfoFormDTO implements Serializable{ + private static final long serialVersionUID = -7994579456530273809L; + /** + * 用户Id + * */ + @NotBlank(message = "用户Id不能为空" , groups = { StaffBasicInfoGroup.class }) + private String staffId; + public interface StaffBasicInfoGroup {} + +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/UserBasicInfoFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/UserBasicInfoFormDTO.java new file mode 100644 index 0000000000..cfe7f721c8 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/UserBasicInfoFormDTO.java @@ -0,0 +1,22 @@ +package com.epmet.dto.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Author sun + * @Description 居民端-查询用户基础信息-接口入参 + **/ +@Data +public class UserBasicInfoFormDTO implements Serializable{ + private static final long serialVersionUID = -7994579456530273809L; + /** + * 用户Id + * */ + @NotBlank(message = "用户Id不能为空" , groups = { UserBasicInfoGroup.class }) + private String userId; + public interface UserBasicInfoGroup {} +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/StaffBasicInfo.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/StaffBasicInfo.java new file mode 100644 index 0000000000..89e3e3f5ca --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/StaffBasicInfo.java @@ -0,0 +1,39 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author sun + * @Description 工作端-查询用户基础信息-接口返参 + **/ +@Data +public class StaffBasicInfo implements Serializable { + + /** + * 客户Id + */ + private String customerId; + + /** + * 用户Id + */ + private String staffId; + + /** + * wx_open_id + */ + private String openId; + + /** + * 是否禁用(未禁用enable,已禁用disabled) + */ + private String enableFlag; + + /** + * 手机号 + */ + private String mobile; + +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserBasicInfo.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserBasicInfo.java new file mode 100644 index 0000000000..955848ee20 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserBasicInfo.java @@ -0,0 +1,24 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author sun + * @Description 居民端-查询用户基础信息-接口返参 + **/ +@Data +public class UserBasicInfo implements Serializable { + + /** + * 用户Id + */ + private String userId; + + /** + * wx_open_id + */ + private String openId; + +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java index c5a50bc818..5f7c301ad0 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java @@ -313,4 +313,18 @@ public interface EpmetUserOpenFeignClient { **/ @PostMapping("epmetuser/role/getuserrolekeylist") Result> getUserRoleKeyList(@RequestBody GetRoleKeyListFormDTO dto); + + /** + * @Author sun + * @Description 居民端-查询用户基础信息 + **/ + @PostMapping(value = "epmetuser/user/getuserbasicinfo") + Result getUserBasicInfo(@RequestBody UserBasicInfoFormDTO formDTO); + + /** + * @Author sun + * @Description 工作端-查询用户基础信息 + **/ + @PostMapping(value = "epmetuser/staffagencyvisited/getstaffbasicinfo") + Result getStaffBasicInfo(@RequestBody StaffBasicInfoFormDTO formDTO); } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java index 2a6db644e7..64985eab15 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java @@ -210,4 +210,14 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien public Result> getUserRoleKeyList(GetRoleKeyListFormDTO dto) { return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getUserRoleKeyList", dto); } + + @Override + public Result getUserBasicInfo(UserBasicInfoFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getUserBasicInfo", formDTO); + } + + @Override + public Result getStaffBasicInfo(StaffBasicInfoFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getStaffBasicInfo", formDTO); + } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffAgencyVisitedController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffAgencyVisitedController.java index 71ad8f1962..40f45a45ba 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffAgencyVisitedController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffAgencyVisitedController.java @@ -18,8 +18,13 @@ package com.epmet.controller; import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dto.form.StaffBasicInfoFormDTO; import com.epmet.dto.form.StaffLoginAgencyRecordFormDTO; +import com.epmet.dto.form.WxMsgAuthInfoFormDTO; +import com.epmet.dto.result.StaffBasicInfo; import com.epmet.dto.result.StaffLatestAgencyResultDTO; +import com.epmet.dto.result.UserBasicInfo; import com.epmet.service.StaffAgencyVisitedService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -62,5 +67,14 @@ public class StaffAgencyVisitedController { return staffAgencyVisitedService.saveStaffLoginRecord(formDTO); } + /** + * @Author sun + * @Description 工作端-查询用户基础信息 + **/ + @PostMapping(value = "getstaffbasicinfo") + public Result getStaffBasicInfo(@RequestBody StaffBasicInfoFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, StaffBasicInfoFormDTO.StaffBasicInfoGroup.class); + return new Result().ok(staffAgencyVisitedService.getStaffBasicInfo(formDTO)); + } } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserController.java index d607eba501..a524f9f0c9 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserController.java @@ -143,4 +143,15 @@ public class UserController { ValidatorUtils.validateEntity(wxUserInfoFormDTO); return userService.updateWxUserInfo(wxUserInfoFormDTO); } + + /** + * @Author sun + * @Description 居民端-查询用户基础信息 + **/ + @PostMapping("getuserbasicinfo") + public Result getUserBasicInfo(@RequestBody UserBasicInfoFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, UserBasicInfoFormDTO.UserBasicInfoGroup.class); + return new Result().ok(userService.getUserBasicInfo(formDTO)); + } + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffAgencyVisitedDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffAgencyVisitedDao.java index 4358e4910e..99d95420ae 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffAgencyVisitedDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffAgencyVisitedDao.java @@ -18,6 +18,8 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.form.StaffBasicInfoFormDTO; +import com.epmet.dto.result.StaffBasicInfo; import com.epmet.dto.result.StaffLatestAgencyResultDTO; import com.epmet.entity.StaffAgencyVisitedEntity; import org.apache.ibatis.annotations.Mapper; @@ -39,5 +41,9 @@ public interface StaffAgencyVisitedDao extends BaseDao **/ StaffLatestAgencyResultDTO selectLatestStaffWechatLoginRecord(String openId); - + /** + * @Author sun + * @Description 工作端-查询用户基础信息 + **/ + StaffBasicInfo selectStaffBasicInfo(StaffBasicInfoFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserDao.java index 64f5d8fd8b..7dc2a768d8 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserDao.java @@ -2,9 +2,11 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.form.CreatedTimeByUserIdFormDTO; +import com.epmet.dto.form.UserBasicInfoFormDTO; import com.epmet.dto.result.CreatedTimeByUserIdResultDTO; import com.epmet.dto.result.MyselfMsgResultDTO; import com.epmet.dto.result.PasswordLoginUserInfoResultDTO; +import com.epmet.dto.result.UserBasicInfo; import com.epmet.entity.UserEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -44,4 +46,10 @@ public interface UserDao extends BaseDao { * @date 2020.05.22 19:19 **/ MyselfMsgResultDTO getMyselfMsg(@Param("userId")String userId); + + /** + * @Author sun + * @Description 居民端-查询用户基础信息 + **/ + UserBasicInfo selectUserBasicInfo(UserBasicInfoFormDTO formDTO); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffAgencyVisitedService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffAgencyVisitedService.java index 9d584aa2e6..2789052963 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffAgencyVisitedService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffAgencyVisitedService.java @@ -21,7 +21,9 @@ import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.StaffAgencyVisitedDTO; +import com.epmet.dto.form.StaffBasicInfoFormDTO; import com.epmet.dto.form.StaffLoginAgencyRecordFormDTO; +import com.epmet.dto.result.StaffBasicInfo; import com.epmet.dto.result.StaffLatestAgencyResultDTO; import com.epmet.entity.StaffAgencyVisitedEntity; @@ -114,5 +116,9 @@ public interface StaffAgencyVisitedService extends BaseService { * @Description 小程序微信用户登陆,新增或更新用户信息 **/ UserDTO saveWxUser(WxUserFormDTO formDTO); + + /** + * @Author sun + * @Description 居民端-查询用户基础信息 + **/ + UserBasicInfo getUserBasicInfo(UserBasicInfoFormDTO formDTO); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffAgencyVisitedServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffAgencyVisitedServiceImpl.java index 8118bbe6f6..a8ea0e718e 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffAgencyVisitedServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffAgencyVisitedServiceImpl.java @@ -26,7 +26,9 @@ import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.dao.StaffAgencyVisitedDao; import com.epmet.dto.StaffAgencyVisitedDTO; +import com.epmet.dto.form.StaffBasicInfoFormDTO; import com.epmet.dto.form.StaffLoginAgencyRecordFormDTO; +import com.epmet.dto.result.StaffBasicInfo; import com.epmet.dto.result.StaffLatestAgencyResultDTO; import com.epmet.entity.StaffAgencyVisitedEntity; import com.epmet.feign.OperCrmFeignClient; @@ -127,6 +129,14 @@ public class StaffAgencyVisitedServiceImpl extends BaseServiceImpl implem return resultDTO; } + /** + * @Author sun + * @Description 居民端-查询用户基础信息 + **/ + @Override + public UserBasicInfo getUserBasicInfo(UserBasicInfoFormDTO formDTO) { + return baseDao.selectUserBasicInfo(formDTO); + } + } diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/StaffAgencyVisitedDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/StaffAgencyVisitedDao.xml index faaa5757e9..d287af8fcd 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/StaffAgencyVisitedDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/StaffAgencyVisitedDao.xml @@ -36,4 +36,26 @@ LIMIT 1 + + \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/UserDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/UserDao.xml index 6822515ed6..c1f8791e16 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/UserDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/UserDao.xml @@ -52,4 +52,19 @@ AND user.FROM_APP = 'resi' + +