diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/ThirdLoginServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/ThirdLoginServiceImpl.java index 9e50e6b796..d1cc70552e 100644 --- a/epmet-auth/src/main/java/com/epmet/service/impl/ThirdLoginServiceImpl.java +++ b/epmet-auth/src/main/java/com/epmet/service/impl/ThirdLoginServiceImpl.java @@ -86,7 +86,7 @@ public class ThirdLoginServiceImpl implements ThirdLoginService { String token = this.generateToken(formDTO, userId); //4.存放Redis - this.saveTokenDto(formDTO, userId, userWechatDTO, token); + this.saveTokenDto(formDTO, userId, userWechatDTO, token, userWechatDTO.getCustomerId()); //5.接口返参 UserTokenResultDTO userTokenResultDTO = new UserTokenResultDTO(); @@ -111,9 +111,10 @@ public class ThirdLoginServiceImpl implements ThirdLoginService { /** * @Description 将token存入redis **/ - private String saveTokenDto(LoginCommonFormDTO formDTO, String userId, UserWechatDTO userWechatDTO, String token) { + private String saveTokenDto(LoginCommonFormDTO formDTO, String userId, UserWechatDTO userWechatDTO, String token, String customerId) { int expire = jwtTokenProperties.getExpire(); TokenDto tokenDto = new TokenDto(); + tokenDto.setCustomerId(customerId); tokenDto.setApp(formDTO.getApp()); tokenDto.setClient(formDTO.getClient()); tokenDto.setUserId(userId); diff --git a/epmet-commons/epmet-commons-rocketmq/pom.xml b/epmet-commons/epmet-commons-rocketmq/pom.xml new file mode 100644 index 0000000000..41ee2e97e1 --- /dev/null +++ b/epmet-commons/epmet-commons-rocketmq/pom.xml @@ -0,0 +1,21 @@ + + + + epmet-commons + com.epmet + 2.0.0 + + 4.0.0 + + epmet-commons-rocketmq + + + + org.apache.rocketmq + rocketmq-spring-boot-starter + 2.1.1 + + + \ No newline at end of file diff --git a/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/ConsomerGroupConstants.java b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/ConsomerGroupConstants.java new file mode 100644 index 0000000000..0bcf7d4aa6 --- /dev/null +++ b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/ConsomerGroupConstants.java @@ -0,0 +1,21 @@ +package com.epmet.commons.rocketmq.constants; + +/** + * 消费者组常量 + */ +public interface ConsomerGroupConstants { + + /** + * 初始化客户角色消费者组 + */ + String INIT_CUSTOMER_ROLES_GROUP = "init_customer_roles_group"; + /** + * 初始化客户自定义消费者组 + */ + String INIT_CUSTOMER_CUSTOMIZE_GROUP = "init_customer_customize_group"; + /** + * 初始化客户组织机构信息分组 + */ + String INIT_CUSTOMER_ORG_GROUP = "init_customer_org_group"; + +} diff --git a/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/TopicConstants.java b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/TopicConstants.java new file mode 100644 index 0000000000..d95a829b8f --- /dev/null +++ b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/TopicConstants.java @@ -0,0 +1,5 @@ +package com.epmet.commons.rocketmq.constants; + +public interface TopicConstants { + String INIT_CUSTOMER = "init_customer_topic"; +} diff --git a/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/InitCustomerMQMsg.java b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/InitCustomerMQMsg.java new file mode 100644 index 0000000000..104d77581c --- /dev/null +++ b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/InitCustomerMQMsg.java @@ -0,0 +1,148 @@ +package com.epmet.commons.rocketmq.messages; + +public class InitCustomerMQMsg { + + private String customerId; + + private InitCustomerAgency agency; + + private InitCustomerStaff staff; + + public static class InitCustomerStaff { + private String agencyId; + private Integer gender; + private String mobile; + private String name; + private String workType; + + public String getAgencyId() { + return agencyId; + } + + public void setAgencyId(String agencyId) { + this.agencyId = agencyId; + } + + public Integer getGender() { + return gender; + } + + public void setGender(Integer gender) { + this.gender = gender; + } + + public String getMobile() { + return mobile; + } + + public void setMobile(String mobile) { + this.mobile = mobile; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getWorkType() { + return workType; + } + + public void setWorkType(String workType) { + this.workType = workType; + } + } + + public static class InitCustomerAgency { + private String agencyId; + private String organizationName; + private String level; + private String areaCode; + private String province; + private String city; + private String district; + + public String getAgencyId() { + return agencyId; + } + + public void setAgencyId(String agencyId) { + this.agencyId = agencyId; + } + + public String getOrganizationName() { + return organizationName; + } + + public void setOrganizationName(String organizationName) { + this.organizationName = organizationName; + } + + public String getLevel() { + return level; + } + + public void setLevel(String level) { + this.level = level; + } + + public String getAreaCode() { + return areaCode; + } + + public void setAreaCode(String areaCode) { + this.areaCode = areaCode; + } + + public String getProvince() { + return province; + } + + public void setProvince(String province) { + this.province = province; + } + + public String getCity() { + return city; + } + + public void setCity(String city) { + this.city = city; + } + + public String getDistrict() { + return district; + } + + public void setDistrict(String district) { + this.district = district; + } + } + + public String getCustomerId() { + return customerId; + } + + public void setCustomerId(String customerId) { + this.customerId = customerId; + } + + public InitCustomerAgency getAgency() { + return agency; + } + + public void setAgency(InitCustomerAgency agency) { + this.agency = agency; + } + + public InitCustomerStaff getStaff() { + return staff; + } + + public void setStaff(InitCustomerStaff staff) { + this.staff = staff; + } +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java index 4d3c107de3..e3a02b4696 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java @@ -20,6 +20,7 @@ public enum EpmetErrorCode { ERR10006(10006, "登录超时,请重新登录"), ERR10007(10007, "当前帐号已在别处登录"), ERR10019(10019, "验证码不正确"), + SYSTEM_MQ_MSG_SEND_FAIL(10020, "MQ消息发送失败"), ERR401(401, "未授权"), INTERNAL_VALIDATE_ERROR(7000, "内部数据校验异常"), SERVER_ERROR(8000, "服务器开小差了..."), diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/scan/param/VideoScanParamDTO.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/scan/param/VideoScanParamDTO.java new file mode 100644 index 0000000000..07f0962a89 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/scan/param/VideoScanParamDTO.java @@ -0,0 +1,35 @@ +package com.epmet.commons.tools.scan.param; + +import lombok.Data; + +import javax.validation.Valid; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.List; + +/** + * (异步检测)请求参数 + * + * @author yinzuomei@elink-cn.com + * @date 2021/1/10 21:05 + */ +@Data +public class VideoScanParamDTO implements Serializable { + private static final long serialVersionUID = -7261993744367287072L; + /** + * 是否开启回调 + */ + @NotNull(message = "openCallBack必填,true开启;false不开启") + private Boolean openCallBack; + + /** + * 异步检测结果回调地址,执行异步审查内容时 必填 + * openCallBack=true时,callback必填 + */ + private String callback; + + @Valid + @NotEmpty(message = "任务列表不能为空") + private List tasks; +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/scan/param/VideoTaskDTO.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/scan/param/VideoTaskDTO.java new file mode 100644 index 0000000000..6a71d5daf4 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/scan/param/VideoTaskDTO.java @@ -0,0 +1,32 @@ +package com.epmet.commons.tools.scan.param; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * (异步检测)请求参数 + * + * @author yinzuomei@elink-cn.com + * @date 2021/1/10 21:06 + */ +@Data +public class VideoTaskDTO implements Serializable { + private static final long serialVersionUID = -5268462578193403270L; + /** + * 不必填 + * 要检测的数据id 非必填 + * 检测对象对应的数据ID。 + * 由大小写英文字母、数字、下划线(_)、短划线(-)、英文句号(.)组成,不超过128个字符,可以用于唯一标识您的业务数据。 + * */ + @NotBlank(message = "dataId不能为空") + private String dataId; + + /** + * 必填 + * 待检测视频的URL。该字段不能和frames同时为空,也不能和frames同时有值。 + */ + @NotBlank(message = "音频URL不能为空") + private String url; +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/scan/result/AsyncScanResult.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/scan/result/AsyncScanResult.java index 77cabbfed7..6f8c33aa5c 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/scan/result/AsyncScanResult.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/scan/result/AsyncScanResult.java @@ -8,7 +8,7 @@ import java.util.List; /** * 语音异步检测 返参 - * + * 视频异步检测 返参通用 * @author yinzuomei@elink-cn.com * @date 2020/12/18 10:09 */ diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/scan/result/VideoAsyncScanResultDTO.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/scan/result/VideoAsyncScanResultDTO.java new file mode 100644 index 0000000000..86445a83e5 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/scan/result/VideoAsyncScanResultDTO.java @@ -0,0 +1,47 @@ +package com.epmet.commons.tools.scan.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +/** + * 视频异步检测结果查询接口返参 + * 正在检测中的不返回,调用方继续轮询查询结果 + * @author yinzuomei@elink-cn.com + * @date 2020/12/29 15:37 + */ +@Data +public class VideoAsyncScanResultDTO implements Serializable { + private static final long serialVersionUID = -7302168989456734818L; + /** + * 执行成功的任务Id集合 + * code=200,且所有语音+视频所有场景返回结果都为pass时则为成功 + */ + private List passDataIds = new ArrayList<>(); + /** + * 执行失败的任务Id集合 + */ + private List noPassDataIds = new ArrayList<>(); + + private List passTaskIds = new ArrayList<>(); + private List noPassTaskIds = new ArrayList<>(); + + /** + * desc:阿里内容审核API返回结果详情 + */ + private List details = new ArrayList<>(); + + /** + * 本地是否全部通过 + */ + private Boolean isAllPass; + + public boolean isAllPass() { + if (noPassTaskIds.isEmpty() && !passTaskIds.isEmpty()) { + return true; + } + return isAllPass; + } +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/scan/result/VideoScanDetailDTO.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/scan/result/VideoScanDetailDTO.java new file mode 100644 index 0000000000..59b047a73b --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/scan/result/VideoScanDetailDTO.java @@ -0,0 +1,56 @@ +package com.epmet.commons.tools.scan.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * + * @author yinzuomei@elink-cn.com + * @date 2021/1/10 21:24 + */ +@Data +public class VideoScanDetailDTO implements Serializable { + /** + * 错误码,和HTTP状态码一致。 + * 更多信息,请参见公共错误码。 + */ + private Integer code; + + private String codeDesc; + + /** + * 错误描述信息。 + */ + private String msg; + /** + * 检测对象对应的数据ID。 + */ + private String dataId; + + /** + * 检测任务的ID + */ + private String taskId; + + /** + * 返回结果,调用成功时(code=200),返回结果中包含一个或多个元素。每个元素是个结构体,具体结构描述,请参见result。 + * 说明 视频流检测场景中,code返回280表示在检测中,返回200表示检测完成。在检测中状态时,检测结果中包含从开始检测到当前时间的检测到结果。 + */ + private List results; + + /** + * 视频语音检测结果。具体结构描述,请参见audioScanResult。 + */ + private List audioScanResults; + + + @Data + public static class ResultDetail { + private String scene; + private String label; + private String suggestion; + private Float rate; + } +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/ScanContentUtils.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/ScanContentUtils.java index effd25ccd6..6427301a18 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/ScanContentUtils.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/ScanContentUtils.java @@ -8,6 +8,7 @@ import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.scan.param.*; import com.epmet.commons.tools.scan.result.AsyncScanResult; import com.epmet.commons.tools.scan.result.SyncScanResult; +import com.epmet.commons.tools.scan.result.VideoAsyncScanResultDTO; import com.epmet.commons.tools.scan.result.VoiceResultDTO; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; @@ -136,6 +137,65 @@ public class ScanContentUtils { } } + /** + * @param url 视频地址 + * @param param + * @author yinzuomei + * @description 异步检测-提交检测任务 + **/ + public static Result videoAsyncScan(String url, VideoScanParamDTO param){ + log.debug("videoAsyncScan param:{}", JSON.toJSONString(param)); + if (StringUtils.isBlank(url) || param == null) { + throw new RenException("参数错误"); + } + if (param.getOpenCallBack() && StringUtils.isBlank(param.getCallback())) { + throw new RenException("参数错误,开启回调,callback必填"); + } + try { + Result result = HttpClientManager.getInstance().sendPostByJSON(url, JSON.toJSONString(param)); + log.debug("videoAsyncScan result:{}", JSON.toJSONString(result)); + if (result.success()) { + return JSON.parseObject(result.getData(),new TypeReference>(){}); + } + Result resultResult = new Result<>(); + resultResult.error(result.getCode(),result.getMsg()); + resultResult.setInternalMsg(result.getInternalMsg()); + return resultResult; + } catch (Exception e) { + log.error("videoAsyncScan exception:", e); + throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(), e.getMessage()); + } + } + + /** + * @param url + * @param taskIds + * @author yinzuomei + * @description 查询视频检测结果 + **/ + public static Result videoResults(String url, List taskIds) { + if (StringUtils.isBlank(url) || CollectionUtils.isEmpty(taskIds)) { + throw new RenException("参数错误"); + } + if (taskIds.size() > NumConstant.ONE_HUNDRED) { + throw new RenException("参数错误,查询检测任务最大不能超过100"); + } + try { + Result result = HttpClientManager.getInstance().sendPostByJSON(url, JSON.toJSONString(taskIds)); + log.debug("videoResults result:{}", JSON.toJSONString(result)); + if (result.success()) { + return JSON.parseObject(result.getData(), new TypeReference>() { + }); + } + Result resultResult = new Result<>(); + resultResult.error(result.getCode(), result.getMsg()); + resultResult.setInternalMsg(result.getInternalMsg()); + return resultResult; + } catch (Exception e) { + log.error("voiceResults exception:", e); + throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(), e.getMessage()); + } + } public static void main(String[] args) { //测试文本检测 @@ -143,7 +203,11 @@ public class ScanContentUtils { //测试语音检测 // testVoiceAsyncScan(); //语音检测结果 - testVoiceResults(); + // testVoiceResults(); + //视频检测任务提交 + // testVideoAsyncScan(); + //查询视频检测结果 + testVideoResults(); } public static void testTextSyncScan(){ @@ -200,4 +264,26 @@ public class ScanContentUtils { Result> asyncScanResultResult = ScanContentUtils.voiceResults(url, taskIds); System.out.println("================" + JSON.toJSONString(asyncScanResultResult)); } + + public static void testVideoAsyncScan(){ + String url = "http://localhost:8107/epmetscan/api/videoAsyncScan"; + VideoTaskDTO p = new VideoTaskDTO(); + p.setDataId("1"); + p.setUrl("https://elink-esua-epdc.oss-cn-qingdao.aliyuncs.com/epmet/test/20210111/e996a68b9f0144a3843666c430f73086.mp4"); + List list = new ArrayList<>(); + list.add(p); + VideoScanParamDTO param = new VideoScanParamDTO(); + param.setTasks(list); + param.setOpenCallBack(false); + Result asyncScanResultResult = ScanContentUtils.videoAsyncScan(url, param); + System.out.println(JSON.toJSONString(asyncScanResultResult)); + } + + public static void testVideoResults(){ + String url = "http://localhost:8107/epmetscan/api/videoResults"; + List taskIds=new ArrayList<>(); + taskIds.add("vi6ZatqnJEkqf5m@FZ7Ka0AU-1tKYdk"); + Result result = ScanContentUtils.videoResults(url, taskIds); + System.out.println("================" + JSON.toJSONString(result)); + } } diff --git a/epmet-commons/pom.xml b/epmet-commons/pom.xml index d4b8e270b4..0bf8dd9c9f 100644 --- a/epmet-commons/pom.xml +++ b/epmet-commons/pom.xml @@ -23,6 +23,7 @@ epmet-commons-tools-wx-mp epmet-commons-service-call epmet-commons-extapp-auth + epmet-commons-rocketmq 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 2ee22426f6..6a88ccf73e 100644 --- a/epmet-gateway/src/main/java/com/epmet/auth/InternalAuthProcessor.java +++ b/epmet-gateway/src/main/java/com/epmet/auth/InternalAuthProcessor.java @@ -111,7 +111,7 @@ public class InternalAuthProcessor extends AuthProcessor { .header(AppClientConstant.CLIENT,baseTokenDto.getClient()) .header(AppClientConstant.USER_ID,baseTokenDto.getUserId()); - if (StringUtils.equals(baseTokenDto.getApp(), "gov")) {//工作端 + if (StringUtils.equalsAny(baseTokenDto.getApp(), AppClientConstant.APP_GOV, AppClientConstant.APP_RESI)) {//工作端/居民端 if(StringUtils.isNotBlank(customerId)){ exchange.getRequest().mutate().header(AppClientConstant.CUSTOMER_ID, customerId); } diff --git a/epmet-module/data-aggregator/data-aggregator-server/pom.xml b/epmet-module/data-aggregator/data-aggregator-server/pom.xml index 3c4d3a685c..c1e47d3b7e 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/pom.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/pom.xml @@ -318,28 +318,28 @@ - + epmet_gov_issue_user EpmEt-db-UsEr - + epmet_gov_project_user EpmEt-db-UsEr - + epmet_resi_group_user EpmEt-db-UsEr - + epmet_user_user EpmEt-db-UsEr diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govissue/impl/GovIssueServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govissue/impl/GovIssueServiceImpl.java index 3f77c42158..87ff2a6dd9 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govissue/impl/GovIssueServiceImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govissue/impl/GovIssueServiceImpl.java @@ -280,8 +280,7 @@ public class GovIssueServiceImpl implements GovIssueService { shiftProject.setStatus(project.getStatus()); return shiftProject; })).collect(Collectors.toList()); - List result = resultList.stream().sorted(Comparator.comparing(ShiftProjectIssueListResultDTO::getCount, Comparator.reverseOrder()).thenComparing(ShiftProjectIssueListResultDTO::getShiftedTime, Comparator.reverseOrder())).collect(Collectors.toList()); - return result; + return resultList; } /** diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govissue/IssueDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govissue/IssueDao.xml index 93d5b12ce0..96475ca863 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govissue/IssueDao.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govissue/IssueDao.xml @@ -75,7 +75,7 @@ AND i.issue_status = 'shift_project' AND i.org_id_path like concat('%', #{agencyId}, '%') ORDER BY - count DESC, i.created_time ASC + count DESC, i.shifted_time DESC LIMIT #{pageNo}, #{pageSize} diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govproject/ProjectDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govproject/ProjectDao.xml index 7d3ccb3dd7..a85b784273 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govproject/ProjectDao.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govproject/ProjectDao.xml @@ -40,19 +40,19 @@ @@ -79,10 +79,10 @@ AND ps.DEL_FLAG = '0' AND p.`STATUS` = 'pending' AND ps.IS_HANDLE = 'unhandled' - AND + AND( - p.ORIGIN_ID = #{issueId} - + p.ORIGIN_ID = #{issueId} + ) SELECT - ORG_NAME AS agencyName, - RESPONSE_RATIO, - RESOLVED_RATIO, - GOVERN_RATIO, - SATISFACTION_RATIO + rankData.ORG_NAME AS agencyName, + rankData.RESPONSE_RATIO, + rankData.RESOLVED_RATIO, + rankData.GOVERN_RATIO, + rankData.SATISFACTION_RATIO, + agency.AGENCY_NAME AS parentAgencyName FROM - screen_govern_rank_data + screen_govern_rank_data rankData + LEFT JOIN + screen_customer_agency agency + ON rankData.PARENT_ID = agency.AGENCY_ID AND agency.DEL_FLAG = '0' AND agency.AGENCY_ID = #{agencyId} WHERE - DEL_FLAG = '0' - AND PARENT_ID = #{agencyId} - AND MONTH_ID = #{monthId} + rankData.DEL_FLAG = '0' + AND rankData.PARENT_ID = #{agencyId} + AND rankData.MONTH_ID = #{monthId} ORDER BY - (RESPONSE_RATIO + RESOLVED_RATIO + GOVERN_RATIO + SATISFACTION_RATIO) DESC,RESPONSE_RATIO DESC,RESOLVED_RATIO DESC,GOVERN_RATIO DESC,SATISFACTION_RATIO DESC + (rankData.RESPONSE_RATIO + rankData.RESOLVED_RATIO + rankData.GOVERN_RATIO + rankData.SATISFACTION_RATIO) DESC,rankData.RESPONSE_RATIO DESC,rankData.RESOLVED_RATIO DESC,rankData.GOVERN_RATIO DESC,rankData.SATISFACTION_RATIO DESC \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenOrgRankDataDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenOrgRankDataDao.xml index 310320029e..bc1fa8f0aa 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenOrgRankDataDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenOrgRankDataDao.xml @@ -6,28 +6,31 @@ diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPartyBranchDataDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPartyBranchDataDao.xml index 0ee2a6a315..a2d09bf0b3 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPartyBranchDataDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPartyBranchDataDao.xml @@ -32,6 +32,7 @@ AND ORG_ID = #{agencyId} AND TYPE = #{category} AND MONTH_ID = ]]> #{bottomMonthId} + AND MEET_CATEGORY_NAME IS NOT NULL ORDER BY MONTH_ID DESC , MEET_CATEGORY_NAME diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPartyLinkMassesDataDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPartyLinkMassesDataDao.xml index 7a59c7f16d..7f4520f8ff 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPartyLinkMassesDataDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPartyLinkMassesDataDao.xml @@ -15,5 +15,8 @@ WHERE md.del_flag = '0' AND md.parent_id = #{agencyId} + + AND md.ORG_TYPE = + CASE WHEN sca.LEVEL = 'community' THEN 'grid' ELSE 'agency' END \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPioneerDataDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPioneerDataDao.xml index 992c347f9b..505ca018a8 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPioneerDataDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPioneerDataDao.xml @@ -15,7 +15,9 @@ resolved_project_total AS resolvedProjectTotal, resolved_project_ratio AS resolvedProjectRatioA, publish_issue_total AS publishIssueTotal, - publish_issue_ratio AS publishIssueRatioA + publish_issue_ratio AS publishIssueRatioA, + PLAT_ISSUE_TOTAL AS platIssueTotal, + PLAT_JOIN_PARTY_RATIO AS platJoinPartyRatio FROM screen_pioneer_data WHERE @@ -24,4 +26,4 @@ ORDER BY data_end_time DESC LIMIT 1 - \ No newline at end of file + diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPublicPartiTotalDataDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPublicPartiTotalDataDao.xml index 1a94210725..277e6c17dc 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPublicPartiTotalDataDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPublicPartiTotalDataDao.xml @@ -6,24 +6,29 @@ \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenan/ScreenAnGrassRootsGovernMonthlyDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenan/ScreenAnGrassRootsGovernMonthlyDao.xml index f88612d078..4f4e7e96c5 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenan/ScreenAnGrassRootsGovernMonthlyDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenan/ScreenAnGrassRootsGovernMonthlyDao.xml @@ -16,16 +16,37 @@ AND MONTH_ID = #{monthId} - \ No newline at end of file + diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenan/ScreenAnGrassRootsOrgMonthlyDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenan/ScreenAnGrassRootsOrgMonthlyDao.xml index 05c17e1378..9bf5d9a061 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenan/ScreenAnGrassRootsOrgMonthlyDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenan/ScreenAnGrassRootsOrgMonthlyDao.xml @@ -14,14 +14,33 @@ AND MONTH_ID = #{monthId} - \ No newline at end of file + diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenan/ScreenAnGrassRootsPmTotalMonthlyDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenan/ScreenAnGrassRootsPmTotalMonthlyDao.xml index 6fee665d7f..58b7001046 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenan/ScreenAnGrassRootsPmTotalMonthlyDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screenan/ScreenAnGrassRootsPmTotalMonthlyDao.xml @@ -15,20 +15,37 @@ - \ No newline at end of file + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java index 32a113f464..9b700fb365 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java @@ -20,7 +20,6 @@ import com.epmet.dto.AgencySubTreeDto; import com.epmet.dto.extract.form.ExtractOriginFormDTO; import com.epmet.dto.extract.form.ExtractScreenFormDTO; import com.epmet.dto.indexcal.CalculateCommonFormDTO; -import com.epmet.dto.screen.form.ScreenCentralZoneDataFormDTO; import com.epmet.dto.stats.form.CustomerIdAndDateIdFormDTO; import com.epmet.entity.evaluationindex.indexcoll.FactIndexGovrnAblityGridMonthlyEntity; import com.epmet.entity.evaluationindex.indexcoll.FactIndexPartyAblityGridMonthlyEntity; @@ -47,7 +46,6 @@ import org.springframework.web.bind.annotation.*; import java.math.BigDecimal; import java.time.LocalDateTime; import java.util.List; -import java.util.Map; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Future; @@ -660,12 +658,21 @@ public class DemoController { @Autowired private PublicPartiTotalDataExtractService publicPartiTotalDataExtractService; @PostMapping("insertScreenPioneerData") - public Result insertScreenPioneerData(@RequestParam("customerId") String customerId, @RequestParam("dateId") String dateId) { + public Result insertScreenPioneerData(@RequestParam("customerId") String customerId, @RequestParam("dateId") String dateId,@RequestParam("type") String type) { if (StringUtils.isNotBlank(customerId) && StringUtils.isNotBlank(dateId)) { - pioneerDataExtractService.extractGridPioneerData(customerId, dateId); - pioneerDataExtractService.extractCommunityPioneerData(customerId, dateId); - pioneerDataExtractService.extractExceptCommunityPioneerData(customerId, dateId); - } else { + if ("grid".equals(type)) { + pioneerDataExtractService.extractGridPioneerData(customerId, dateId); + } else if ("community".equals(type)) { + pioneerDataExtractService.extractCommunityPioneerData(customerId, dateId); + } else if ("exceptcommunity".equals(type)) { + pioneerDataExtractService.extractExceptCommunityPioneerData(customerId, dateId); + } else { + pioneerDataExtractService.extractGridPioneerData(customerId, dateId); + pioneerDataExtractService.extractCommunityPioneerData(customerId, dateId); + pioneerDataExtractService.extractExceptCommunityPioneerData(customerId, dateId); + } + } + /*else { QueryWrapper customerEntityQueryWrapper = new QueryWrapper<>(); List customerEntityList = dimCustomerDao.selectList(customerEntityQueryWrapper); for (DimCustomerEntity customerEntity : customerEntityList) { @@ -673,8 +680,8 @@ public class DemoController { pioneerDataExtractService.extractCommunityPioneerData(customerEntity.getId(), "20200926"); pioneerDataExtractService.extractExceptCommunityPioneerData(customerEntity.getId(), "20200926"); } - } - return new Result(); + }*/ + return new Result().ok("调用成功"); } @PostMapping("extractPublicPartiTotalData") diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactOriginExtractController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactOriginExtractController.java index 2abcd81edd..9542bdc580 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactOriginExtractController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactOriginExtractController.java @@ -1,5 +1,7 @@ package com.epmet.controller; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.extract.form.ExtractOriginFormDTO; @@ -11,6 +13,8 @@ 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; + /** * 原始数据清洗 @@ -114,7 +118,15 @@ public class FactOriginExtractController { **/ @PostMapping("groupdatacleaning") public Result groupDataCleaning(@RequestBody ExtractOriginFormDTO param) { - groupExtractService.extractGroupData(param); + if(StringUtils.isNotBlank(param.getStartDate()) && StringUtils.isNotBlank(param.getEndDate())){ + List finalDaysBetween = DateUtils.getDaysBetween(param.getStartDate(), param.getEndDate()); + ExtractOriginFormDTO paramNew = ConvertUtils.sourceToTarget(param, ExtractOriginFormDTO.class); + for (int i = 0; i < finalDaysBetween.size(); i++) { + String dateDimId = finalDaysBetween.get(i); + paramNew.setDateId(dateDimId); + groupExtractService.extractGroupData(paramNew); + } + }else groupExtractService.extractGroupData(param); return new Result(); } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginGroupMainDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginGroupMainDailyDao.java index 12e6151f3f..911d8b7993 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginGroupMainDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginGroupMainDailyDao.java @@ -18,13 +18,11 @@ package com.epmet.dao.evaluationindex.extract; import com.epmet.commons.mybatis.dao.BaseDao; -import com.epmet.dto.extract.form.ScreenPartyLinkMassesDataFormDTO; -import com.epmet.dto.extract.result.OrgStatisticsResultDTO; -import com.epmet.dto.extract.result.PartyCreateGroupCountResultDTO; import com.epmet.dto.extract.FactOriginGroupMainDailyDTO; import com.epmet.dto.extract.form.GridHeartedFormDTO; import com.epmet.dto.extract.form.ScreenPartyLinkMassesDataFormDTO; import com.epmet.dto.extract.result.GridGroupUserCountResultDTO; +import com.epmet.dto.extract.result.OrgStatisticsResultDTO; import com.epmet.dto.extract.result.PartyCreateGroupCountResultDTO; import com.epmet.dto.group.result.ExtractGroupMemberActionRecordResultDTO; import com.epmet.entity.evaluationindex.extract.FactOriginGroupMainDailyEntity; @@ -164,12 +162,11 @@ public interface FactOriginGroupMainDailyDao extends BaseDao selectPartyCreateGroupInfo(@Param("customerId") String customerId, @Param("monthId") String monthId, @Param("gridIds") List gridIds); + List selectPartyCreateGroupInfo(@Param("customerId") String customerId, @Param("gridIds") List gridIds); /** * desc: 获取所有网格的组中成员人数 去重 @@ -202,4 +199,4 @@ public interface FactOriginGroupMainDailyDao extends BaseDao selectOrgGroupCount(@Param("customerId") String customerId, @Param("monthId") String monthId, @Param("level") String level); -} \ No newline at end of file +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginIssueLogDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginIssueLogDailyDao.java index 9dd9089d97..7154f5997e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginIssueLogDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginIssueLogDailyDao.java @@ -108,11 +108,26 @@ public interface FactOriginIssueLogDailyDao extends BaseDao * @author LiuJanJun * @date 2020/9/27 1:58 下午 */ List getVoteCount(@Param("customerId") String customerId, @Param("monthId") String monthId, @Param("groupField") String groupField); + + /** + * @param customerId + * @param gridId + * @param agencyPath + * @param isParty + * @return int + * @author yinzuomei + * @description 大屏:先锋模范:计算 平台参与议事总人数、平台参与议事党员数 + * @Date 2021/1/12 15:08 + **/ + int selectPlatJoinUserTotal(@Param("customerId") String customerId, + @Param("gridId") String gridId, + @Param("communityId") String communityId, + @Param("agencyPath") String agencyPath, + @Param("isParty") String isParty); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectOrgPeriodDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectOrgPeriodDailyDao.java index d107e0e2fe..70a1fee036 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectOrgPeriodDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectOrgPeriodDailyDao.java @@ -63,7 +63,7 @@ public interface FactOriginProjectOrgPeriodDailyDao extends BaseDao list); + void deleteByProjectIds(@Param("list") List list,@Param("customerId") String customerId); /** * @Description 批量插入 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenPioneerDataEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenPioneerDataEntity.java index c03d32f1df..2100e779bb 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenPioneerDataEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenPioneerDataEntity.java @@ -67,7 +67,12 @@ public class ScreenPioneerDataEntity extends BaseEpmetEntity { */ private Integer issueTotal; - /** + /** + * 01.12新增:PLAT_ISSUE_TOTAL 平台参与议事总数 + */ + private Integer platIssueTotal; + + /** * 党员参与议事占比 */ private BigDecimal issueRatio; @@ -77,6 +82,11 @@ public class ScreenPioneerDataEntity extends BaseEpmetEntity { */ private Integer topicTotal; + /** + * 01.12新增:PLAT_TOPIC_TOTAL 当前组织维度,话题总数,TOPIC_RATIO的分母 + */ + private Integer platTopicTotal; + /** * 党员发布话题占比 */ @@ -87,6 +97,11 @@ public class ScreenPioneerDataEntity extends BaseEpmetEntity { */ private Integer publishIssueTotal; + /** + * 01.12新增:PLAT_PUBLISH_ISSUE_TOTAL 当前组织维度,发布议题总数,PUBLISH_ISSUE_RATIO的分母,SHIFT_PROJECT_RATIO的分母 + */ + private Integer platPublishIssueTotal; + /** * 党员发布议题占比 */ @@ -107,6 +122,10 @@ public class ScreenPioneerDataEntity extends BaseEpmetEntity { */ private Integer resolvedProjectTotal; + /** + * 01.12新增:PLAT_CLOSED_PROJECT_TOTAL 当前组织维度,所有结案项目数,RESOLVED_PROJECT_RATIO的分母 + */ + private Integer platClosedProjectTotal; /** * 解决项目总数占比 */ @@ -124,4 +143,20 @@ public class ScreenPioneerDataEntity extends BaseEpmetEntity { private String pid; private String agencyPids; private String agencyPath; + + /** + * PLAT_JOIN_USER_TOTAL 平台参与议事总人数 + */ + private Integer platJoinUserTotal; + + /** + * PLAT_JOIN_PARTY_TOTAL 平台参与议事党员数 + */ + private Integer platJoinPartyTotal; + + /** + * PLAT_JOIN PARTY_RATIO 平台参与议事的党员占比 + */ + private BigDecimal platJoinPartyRatio; + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginGroupMainDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginGroupMainDailyService.java index c9a74e31b8..730acde2c8 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginGroupMainDailyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginGroupMainDailyService.java @@ -68,12 +68,11 @@ public interface FactOriginGroupMainDailyService extends BaseService selectPartyCreateGroupInfo(String customerId, String monthId, List gridIds); + List selectPartyCreateGroupInfo(String customerId, List gridIds); /** * desc: 获取客户下每个网格小组内的 去重人数 @@ -106,4 +105,4 @@ public interface FactOriginGroupMainDailyService extends BaseService */ List getOrgGroupCount(String customerId, String monthId, String level); -} \ No newline at end of file +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginIssueLogDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginIssueLogDailyService.java index 591ff23f55..5bb46392f6 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginIssueLogDailyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginIssueLogDailyService.java @@ -65,4 +65,16 @@ public interface FactOriginIssueLogDailyService extends BaseService getVoteCount(String customerId, String monthId, String groupField); + + /** + * @return java.lang.Integer + * @param customerId + * @param gridId + * @param agencyPath + * @param isParty + * @author yinzuomei + * @description 计算 平台参与议事总人数、平台参与议事党员数 + * @Date 2021/1/12 15:02 + **/ + int calPlatJoinUserTotal(String customerId, String gridId, String communityId,String agencyPath, String isParty); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginGroupMainDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginGroupMainDailyServiceImpl.java index ab3efce8b4..94fadea5fe 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginGroupMainDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginGroupMainDailyServiceImpl.java @@ -21,8 +21,8 @@ import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.dao.evaluationindex.extract.FactOriginGroupMainDailyDao; import com.epmet.dto.extract.FactOriginGroupMainDailyDTO; import com.epmet.dto.extract.form.ScreenPartyLinkMassesDataFormDTO; -import com.epmet.dto.extract.result.OrgStatisticsResultDTO; import com.epmet.dto.extract.result.GridGroupUserCountResultDTO; +import com.epmet.dto.extract.result.OrgStatisticsResultDTO; import com.epmet.dto.group.result.ExtractGroupMemberActionRecordResultDTO; import com.epmet.entity.evaluationindex.extract.FactOriginGroupMainDailyEntity; import com.epmet.service.evaluationindex.extract.todata.FactOriginGroupMainDailyService; @@ -85,19 +85,21 @@ public class FactOriginGroupMainDailyServiceImpl extends BaseServiceImpl originGroupData, List memberList,List missing) { - if (isFirst) { - //isFirst - baseDao.deleteBatchMemberByCustomerId(customerId,null,null); - } else { - if(StringUtils.isNotBlank(dateId)){ - baseDao.deleteBatchMemberByCustomerId(customerId,dateId,"date"); + if(!CollectionUtils.isEmpty(originGroupData)) { + if (isFirst) { + //isFirst + baseDao.deleteBatchMemberByCustomerId(customerId, null, null); + } else { + if (StringUtils.isNotBlank(dateId)) { + baseDao.deleteBatchMemberByCustomerId(customerId, dateId, "date"); + } } - } - //删除要插入的组主表数据 - baseDao.deleteBatchByGroupId(customerId,originGroupData.stream().map(FactOriginGroupMainDailyDTO :: getId).distinct().collect(Collectors.toList())); + //删除要插入的组主表数据 + baseDao.deleteBatchByGroupId(customerId, originGroupData.stream().map(FactOriginGroupMainDailyDTO::getId).distinct().collect(Collectors.toList())); - baseDao.insertBatchMain(originGroupData); - baseDao.insertBatchMembers(memberList); + baseDao.insertBatchMain(originGroupData); + baseDao.insertBatchMembers(memberList); + } if(!CollectionUtils.isEmpty(missing)){ baseDao.deleteBatchByGroupId(customerId,missing); baseDao.deleteMemberByGroupList(customerId,missing); @@ -106,16 +108,15 @@ public class FactOriginGroupMainDailyServiceImpl extends BaseServiceImpl selectPartyCreateGroupInfo(String customerId, String monthId, List gridIds) { + public List selectPartyCreateGroupInfo(String customerId, List gridIds) { if (!CollectionUtils.isEmpty(gridIds)) { - return baseDao.selectPartyCreateGroupInfo(customerId, monthId, gridIds); + return baseDao.selectPartyCreateGroupInfo(customerId, gridIds); } return new ArrayList<>(); } @@ -135,4 +136,4 @@ public class FactOriginGroupMainDailyServiceImpl extends BaseServiceImpl getVoteCount(String customerId, String monthId, String groupField) { return baseDao.getVoteCount(customerId, monthId, groupField); } + + /** + * @param customerId + * @param gridId + * @param agencyPath + * @param isParty + * @return java.lang.Integer + * @author yinzuomei + * @description 计算 平台参与议事总人数、平台参与议事党员数 + * @Date 2021/1/12 15:02 + **/ + @Override + public int calPlatJoinUserTotal(String customerId, String gridId,String communityId, String agencyPath, String isParty) { + return baseDao.selectPlatJoinUserTotal(customerId,gridId,communityId,agencyPath,isParty); + } } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/GroupExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/GroupExtractServiceImpl.java index dedb5bc3a3..6f6451114d 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/GroupExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/GroupExtractServiceImpl.java @@ -1,5 +1,6 @@ package com.epmet.service.evaluationindex.extract.todata.impl; +import com.alibaba.fastjson.JSON; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.utils.DateUtils; @@ -84,10 +85,10 @@ public class GroupExtractServiceImpl implements GroupExtractService { List originGroupData = groupDataService.extractGroupData( count <= NumConstant.ZERO, param.getCustomerId(), param.getDateId()); - + log.info("extractGroupData extractGroupData:result:{},param:{}", JSON.toJSONString(originGroupData), JSON.toJSONString(param)); List memberList = new LinkedList<>(); if (!CollectionUtils.isEmpty(originGroupData)) { - List gridList = dimGridService.getGridAttributes(param.getCustomerId(),originGroupData.stream().map(FactOriginGroupMainDailyDTO::getGridId).distinct().collect(Collectors.toList())); + List gridList = dimGridService.getGridAttributes(param.getCustomerId(),null); if (!CollectionUtils.isEmpty(gridList)) { Map gridMap = @@ -160,7 +161,7 @@ public class GroupExtractServiceImpl implements GroupExtractService { factOriginGroupMainDailyService.insertExtractedData( - count <= NumConstant.ZERO ? true : false, + count <= NumConstant.ZERO, param.getCustomerId(), param.getDateId(), originGroupData, diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/IssueExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/IssueExtractServiceImpl.java index 20169ae538..b7b4532f4f 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/IssueExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/IssueExtractServiceImpl.java @@ -22,6 +22,7 @@ import com.epmet.service.evaluationindex.extract.todata.IssueExtractService; import com.epmet.service.topic.TopicService; import com.epmet.service.user.UserService; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -129,7 +130,11 @@ public class IssueExtractServiceImpl implements IssueExtractService { agencyInfoList.forEach(pid -> { if (r.getAgencyId().equals(pid.getAgencyId())){ r.setPid(pid.getPid()); - r.setPids(pid.getPids().concat(":").concat(r.getAgencyId())); + if (StringUtils.isNotBlank(pid.getPids())) { + r.setPids(pid.getPids().concat(":").concat(r.getAgencyId())); + } else { + r.setPids(r.getAgencyId()); + } } }); }); @@ -231,7 +236,11 @@ public class IssueExtractServiceImpl implements IssueExtractService { agencyInfoList.forEach(agency -> { if (r.getAgencyId().equals(agency.getAgencyId())){ r.setPid(agency.getPid()); - r.setPids(agency.getPids().concat(":").concat(r.getAgencyId())); + if(StringUtils.isNotBlank(agency.getPids())){ + r.setPids(agency.getPids().concat(":").concat(r.getAgencyId())); + }else{ + r.setPids(r.getAgencyId()); + } } }); }); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/ProjectExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/ProjectExtractServiceImpl.java index 63b158e72c..35b5bbd577 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/ProjectExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/ProjectExtractServiceImpl.java @@ -439,7 +439,7 @@ public class ProjectExtractServiceImpl implements ProjectExtractService { if(!CollectionUtils.isEmpty(formattingData)) { List projectIds = formattingData.stream().map(FactOriginProjectOrgPeriodDailyEntity::getProjectId).distinct().collect(Collectors.toList()); if (!CollectionUtils.isEmpty(projectIds)) { - factOriginProjectOrgPeriodDailyDao.deleteByProjectIds(projectIds); + factOriginProjectOrgPeriodDailyDao.deleteByProjectIds(null,param.getCustomerId()); factOriginProjectOrgPeriodDailyDao.insertBatch(formattingData); } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PartyBaseInfoServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PartyBaseInfoServiceImpl.java index f0999a4605..a7435b914e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PartyBaseInfoServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PartyBaseInfoServiceImpl.java @@ -129,7 +129,8 @@ public class PartyBaseInfoServiceImpl implements PartyBaseInfoService { form.setAgeLevel4(party.stream().collect(Collectors.summingInt(PartyBaseInfoFormDTO::getAgeLevel4))); form.setAgeLevel5(party.stream().collect(Collectors.summingInt(PartyBaseInfoFormDTO::getAgeLevel5))); form.setAgeLevel6(party.stream().collect(Collectors.summingInt(PartyBaseInfoFormDTO::getAgeLevel6))); - form.setPartyMemberCount(party.stream().collect(Collectors.summingInt(PartyBaseInfoFormDTO::getPartyMemberCount))); +// form.setPartyMemberCount(party.stream().collect(Collectors.summingInt(PartyBaseInfoFormDTO::getPartyMemberCount))); + form.setPartyMemberCount(calPartyMemberCount(form)); form.setResiTotal(party.stream().collect(Collectors.summingInt(PartyBaseInfoFormDTO::getResiTotal))); form.setRegisterUserCount(party.stream().collect(Collectors.summingInt(PartyBaseInfoFormDTO::getRegisterUserCount))); result.add(form); @@ -175,6 +176,7 @@ public class PartyBaseInfoServiceImpl implements PartyBaseInfoService { form.setAgeLevel4(disposeAgeArea(partyInfos,NumConstant.FORTY_ONE,NumConstant.FIFTY)); form.setAgeLevel5(disposeAgeArea(partyInfos,NumConstant.FIFTY_ONE,NumConstant.SIXTY)); form.setAgeLevel6(disposeAge(partyInfos,NumConstant.SIXTY,true)); + form.setPartyMemberCount(calPartyMemberCount(form)); form.setCustomerId(customerId); form.setDataEndTime(dateId); form.setParentId(partyInfos.get(NumConstant.ZERO).getAgencyId()); @@ -183,7 +185,7 @@ public class PartyBaseInfoServiceImpl implements PartyBaseInfoService { if (gridId.equals(user.getOrgId())){ form.setResiTotal(user.getResiTotal()); form.setRegisterUserCount(user.getRegisterUserCount()); - form.setPartyMemberCount(user.getPartyMemberCount()); +// form.setPartyMemberCount(user.getPartyMemberCount()); } }); } @@ -210,7 +212,8 @@ public class PartyBaseInfoServiceImpl implements PartyBaseInfoService { form.setAgeLevel4(partyInfoList.stream().collect(Collectors.summingInt(PartyInfoResultDTO::getAgeLevel4))); form.setAgeLevel5(partyInfoList.stream().collect(Collectors.summingInt(PartyInfoResultDTO::getAgeLevel5))); form.setAgeLevel6(partyInfoList.stream().collect(Collectors.summingInt(PartyInfoResultDTO::getAgeLevel6))); - form.setPartyMemberCount(partyInfoList.stream().collect(Collectors.summingInt(PartyInfoResultDTO::getPartyMemberCount))); +// form.setPartyMemberCount(partyInfoList.stream().collect(Collectors.summingInt(PartyInfoResultDTO::getPartyMemberCount))); + form.setPartyMemberCount(calPartyMemberCount(form)); form.setResiTotal(partyInfoList.stream().collect(Collectors.summingInt(PartyInfoResultDTO::getResiTotal))); form.setRegisterUserCount(partyInfoList.stream().collect(Collectors.summingInt(PartyInfoResultDTO::getRegisterUserCount))); result.add(form); @@ -361,6 +364,7 @@ public class PartyBaseInfoServiceImpl implements PartyBaseInfoService { form.setAgeLevel3(disposeAgeArea(partyInfos,NumConstant.THIRTY_ONE,NumConstant.FORTY)); form.setAgeLevel4(disposeAgeArea(partyInfos,NumConstant.FORTY_ONE,NumConstant.FIFTY)); form.setAgeLevel5(disposeAgeArea(partyInfos,NumConstant.FIFTY_ONE,NumConstant.SIXTY)); + form.setPartyMemberCount(calPartyMemberCount(form)); form.setAgeLevel6(disposeAge(partyInfos,NumConstant.SIXTY,true)); form.setCustomerId(customerId); form.setDataEndTime(dateId); @@ -370,7 +374,7 @@ public class PartyBaseInfoServiceImpl implements PartyBaseInfoService { if (gridId.equals(user.getOrgId())){ form.setResiTotal(user.getResiTotal()); form.setRegisterUserCount(user.getRegisterUserCount()); - form.setPartyMemberCount(user.getPartyMemberCount()); +// form.setPartyMemberCount(user.getPartyMemberCount()); } }); } @@ -379,4 +383,9 @@ public class PartyBaseInfoServiceImpl implements PartyBaseInfoService { } return new GridPartyDTO(orgIds, result); } + + public Integer calPartyMemberCount(PartyBaseInfoFormDTO form){ + Integer result = form.getAgeLevel1() + form.getAgeLevel2() + form.getAgeLevel3() + form.getAgeLevel4() + form.getAgeLevel5() + form.getAgeLevel6(); + return result; + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PartyGuideServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PartyGuideServiceImpl.java index 74f7b84d27..2e31f8ae4a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PartyGuideServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PartyGuideServiceImpl.java @@ -1,11 +1,9 @@ package com.epmet.service.evaluationindex.extract.toscreen.impl; -import com.alibaba.fastjson.JSON; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.constant.ScreenConstant; import com.epmet.dto.extract.form.ExtractScreenFormDTO; -import com.epmet.dto.extract.form.ScreenExtractFormDTO; import com.epmet.dto.extract.form.ScreenPartyBranchDataFormDTO; import com.epmet.dto.extract.form.ScreenPartyLinkMassesDataFormDTO; import com.epmet.dto.extract.result.*; @@ -185,22 +183,22 @@ public class PartyGuideServiceImpl implements PartyGuideService { // 判断当前级别agency是否为空 if (!CollectionUtils.isEmpty(agencyIdList)){ // 获取agencyIds - List orgIds = agencyIdList.stream().map(m -> m.getAgencyId()).collect(Collectors.toList()); - if (isGrid == true){ + List orgIds = agencyIdList.stream().map(CustomerAgencyInfoResultDTO::getAgencyId).collect(Collectors.toList()); + if (isGrid) { agencyIdList.forEach(agency -> { // 计算社区级别的下级(实际就是网格) - GridPartyGuideDTO gridPartyGuideDTO = communityLevelSubGrid(customerId, monthId, agency); + GridPartyGuideDTO gridPartyGuideDTO = communityLevelSubGrid(customerId, agency); orgIds.addAll(gridPartyGuideDTO.getOrgIds()); result.addAll(gridPartyGuideDTO.getResult()); }); // 根据agencyId分组,计算各个社区的 Map> groupByAgency = result.stream().collect(Collectors.groupingBy(ScreenPartyLinkMassesDataFormDTO::getParentId)); - groupByAgency.forEach((agencyId,gridList) -> { + groupByAgency.forEach((agencyId, gridList) -> { ScreenPartyLinkMassesDataFormDTO form = new ScreenPartyLinkMassesDataFormDTO(); List orgNameAgencyList = agencyService.selectOrgNameAgency(orgIds); if (!CollectionUtils.isEmpty(orgNameAgencyList)){ orgNameAgencyList.forEach(name -> { - if (agencyId.equals(name.getAgencyId())){ + if (agencyId.equals(name.getAgencyId())) { form.setOrgName(name.getAgencyName()); form.setParentId(name.getParentId()); } @@ -210,8 +208,8 @@ public class PartyGuideServiceImpl implements PartyGuideService { form.setCustomerId(customerId); form.setDataEndTime(monthId); form.setOrgType(ScreenConstant.AGENCY); - form.setCreateGroupTotal(gridList.stream().collect(Collectors.summingInt(ScreenPartyLinkMassesDataFormDTO::getCreateGroupTotal))); - form.setGroupUserTotal(gridList.stream().collect(Collectors.summingInt(ScreenPartyLinkMassesDataFormDTO::getGroupUserTotal))); + form.setCreateGroupTotal(gridList.stream().mapToInt(ScreenPartyLinkMassesDataFormDTO::getCreateGroupTotal).sum()); + form.setGroupUserTotal(gridList.stream().mapToInt(ScreenPartyLinkMassesDataFormDTO::getGroupUserTotal).sum()); result.add(form); }); delAndInsertLink(result,customerId,monthId,orgIds); @@ -227,15 +225,15 @@ public class PartyGuideServiceImpl implements PartyGuideService { } }); // 不为空 存在直属网格 - if (!CollectionUtils.isEmpty(disGridIds)){ + if (!CollectionUtils.isEmpty(disGridIds)) { List gridResult = new ArrayList<>(); // 查询党员创建组,组内成员数 - List partyLinkMassesDataList = groupMainService.selectPartyCreateGroupInfo(customerId, monthId, disGridIds); - List orgNameList = agencyService.selectOrgNameGrid(partyLinkMassesDataList.stream().map(m -> m.getOrgId()).collect(Collectors.toList())); - if (!CollectionUtils.isEmpty(partyLinkMassesDataList)){ + List partyLinkMassesDataList = groupMainService.selectPartyCreateGroupInfo(customerId, disGridIds); + List orgNameList = agencyService.selectOrgNameGrid(partyLinkMassesDataList.stream().map(ScreenPartyLinkMassesDataFormDTO::getOrgId).collect(Collectors.toList())); + if (!CollectionUtils.isEmpty(partyLinkMassesDataList)) { partyLinkMassesDataList.forEach(party -> { orgNameList.forEach(org -> { - if (party.getOrgId().equals(org.getGridId())){ + if (party.getOrgId().equals(org.getGridId())) { party.setOrgName(org.getGridName()); } }); @@ -246,10 +244,10 @@ public class PartyGuideServiceImpl implements PartyGuideService { delAndInsertLink(gridResult,customerId,monthId,disGridIds); } // 查询直属网格的信息 + 下级机关的信息 = agency的机关信息 - List screenPartyLinkMassesDataGrid = groupMainService.selectPartyCreateGroupInfo(customerId, monthId, disGridIds); + List screenPartyLinkMassesDataGrid = groupMainService.selectPartyCreateGroupInfo(customerId, disGridIds); List screenPartyLinkMassesDataList = linkMassesDataService.selectPartyLinkMassesInfo(customerId, monthId, agencyId); screenPartyLinkMassesDataList.addAll(screenPartyLinkMassesDataGrid); - if (!CollectionUtils.isEmpty(screenPartyLinkMassesDataList)){ + if (!CollectionUtils.isEmpty(screenPartyLinkMassesDataList)) { ScreenPartyLinkMassesDataFormDTO form = new ScreenPartyLinkMassesDataFormDTO(); form.setOrgId(agencyId); form.setOrgType(ScreenConstant.AGENCY); @@ -257,8 +255,8 @@ public class PartyGuideServiceImpl implements PartyGuideService { form.setCustomerId(customerId); form.setDataEndTime(monthId); form.setParentId(screenPartyLinkMassesDataList.get(NumConstant.ZERO).getParentId()); - form.setGroupUserTotal(screenPartyLinkMassesDataList.stream().collect(Collectors.summingInt(ScreenPartyLinkMassesDataFormDTO::getGroupUserTotal))); - form.setCreateGroupTotal(screenPartyLinkMassesDataList.stream().collect(Collectors.summingInt(ScreenPartyLinkMassesDataFormDTO::getCreateGroupTotal))); + form.setGroupUserTotal(screenPartyLinkMassesDataList.stream().mapToInt(ScreenPartyLinkMassesDataFormDTO::getGroupUserTotal).sum()); + form.setCreateGroupTotal(screenPartyLinkMassesDataList.stream().mapToInt(ScreenPartyLinkMassesDataFormDTO::getCreateGroupTotal).sum()); result.add(form); } }); @@ -431,24 +429,23 @@ public class PartyGuideServiceImpl implements PartyGuideService { } /** - * @Description 社区级别的处理 + * @Description 社区级别的处理 * @Param customerId - * @Param monthId * @Param agency * @author zxc * @date 2020/9/25 10:06 上午 */ - public GridPartyGuideDTO communityLevelSubGrid(String customerId, String monthId, CustomerAgencyInfoResultDTO agency){ + public GridPartyGuideDTO communityLevelSubGrid(String customerId, CustomerAgencyInfoResultDTO agency) { String agencyId = agency.getAgencyId(); // 获取下级所有agencyId【根据agencyMap中的level判断下级orgId是否是gridId】(此处直接作为gridId) Map agencyMap = agencyService.selectAllSubAgencyId(agencyId, customerId); List gridIds = (List) agencyMap.get(agencyId); - List partyLinkMassesDataList = groupMainService.selectPartyCreateGroupInfo(customerId, monthId, gridIds); + List partyLinkMassesDataList = groupMainService.selectPartyCreateGroupInfo(customerId, gridIds); List orgIds = partyLinkMassesDataList.stream().map(m -> m.getOrgId()).collect(Collectors.toList()); List orgNameList = agencyService.selectOrgNameGrid(orgIds); partyLinkMassesDataList.forEach(party -> { orgNameList.forEach(orgName -> { - if (party.getOrgId().equals(orgName.getGridId())){ + if (party.getOrgId().equals(orgName.getGridId())) { party.setOrgName(orgName.getGridName()); } }); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PioneerDataExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PioneerDataExtractServiceImpl.java index f41366eb13..3041ba742e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PioneerDataExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PioneerDataExtractServiceImpl.java @@ -66,56 +66,76 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService //何为参与: 议题的表决行为次数总计 //1、党员参与议事 entity.setIssueTotal(calPartyPartiIssueTotal(customerId,gridId,null,null,NumConstant.ONE_STR)); + log.info("extractGridPioneerData 当前网格id=" + gridId + ";党员参与议事issueTotal="+entity.getIssueTotal()); + + //01.12新增:平台参与议事总数 + int issueTotal=calPartyPartiIssueTotal(customerId,gridId,null,null,null); + entity.setPlatIssueTotal(issueTotal); + log.info("extractGridPioneerData 当前网格id=" + gridId + ";参与议事总数issueTotal=" + issueTotal); + + //2、党员参与议事占比 if(entity.getIssueTotal()==0){ entity.setIssueRatio(BigDecimal.ZERO); }else{ - //2、党员参与议事占比 - int issueTotal=calPartyPartiIssueTotal(customerId,gridId,null,null,null); - BigDecimal issueRatio=new BigDecimal(entity.getIssueTotal()/issueTotal).multiply(new BigDecimal(NumConstant.ONE_HUNDRED)); + BigDecimal issueRatio = new BigDecimal((double) entity.getIssueTotal() / issueTotal).multiply(new BigDecimal(NumConstant.ONE_HUNDRED)); + log.info("extractGridPioneerData 当前网格id=" + gridId + ";issueRatio=" + issueRatio); entity.setIssueRatio(issueRatio.setScale(NumConstant.SIX,RoundingMode.HALF_UP)); } //3、党员发布话题: entity.setTopicTotal(getTopicTotal(customerId, gridId, null)); + log.info("extractGridPioneerData 当前网格id=" + gridId + ";党员发布话题topicTotal"+entity.getTopicTotal()); + + //当前网格内所有话题总数 + int gridTopicTotal = getGridOrCommunityTopicTotal(customerId, gridId, null); + log.info("extractGridPioneerData 当前网格id=" + gridId + ";当前网格内所有话题总数gridTopicTotal="+gridTopicTotal); + //01.12新增:PLAT_TOPIC_TOTAL 当前组织维度,话题总数 + entity.setPlatTopicTotal(gridTopicTotal); + //4、党员发布话题占比: 网格内注册党员发布的话题总数占 网格内话题总数的 比率 if (entity.getTopicTotal() == NumConstant.ZERO) { entity.setTopicRatio(BigDecimal.ZERO); } else { - //当前网格内所有话题总数 - int gridTopicTotal = getGridOrCommunityTopicTotal(customerId, gridId, null); if(gridTopicTotal == NumConstant.ZERO){ entity.setTopicRatio(BigDecimal.ZERO); }else{ - BigDecimal topicRatio=new BigDecimal(entity.getTopicTotal() / gridTopicTotal).multiply(new BigDecimal(NumConstant.ONE_HUNDRED)); + BigDecimal topicRatio = new BigDecimal((double) entity.getTopicTotal() / gridTopicTotal).multiply(new BigDecimal(NumConstant.ONE_HUNDRED)); + log.info("extractGridPioneerData 当前网格id=" + gridId + ";党员发布话题占比topicRatio="+topicRatio); entity.setTopicRatio(topicRatio.setScale(NumConstant.SIX, RoundingMode.HALF_UP)); } } //当前网格内所有议题总数 int gridIssueTotal = getGridOrCommunityIssueTotal(customerId, gridId, null); + log.info("extractGridPioneerData 当前网格id=" + gridId + ";当前网格内所有议题总数=" + gridIssueTotal); + //01.12新增:PLAT_PUBLISH_ISSUE_TOTAL 当前组织维度,发布议题总数 + entity.setPlatPublishIssueTotal(gridIssueTotal); + if (gridIssueTotal != NumConstant.ZERO) { //5、党员发布议题 entity.setPublishIssueTotal(getParyPublishIssueTotal(customerId, gridId, null)); + log.info("extractGridPioneerData 当前网格id=" + gridId + ";党员发布议题publishIssueTotal"+entity.getPublishIssueTotal()); //6、党员发布议题占比 : 占网格内所有议题的比率 if (entity.getPublishIssueTotal() == NumConstant.ZERO) { entity.setPublishIssueRatio(BigDecimal.ZERO); }else{ - BigDecimal publishIssueRatio=new BigDecimal(entity.getPublishIssueTotal() / gridIssueTotal).multiply(new BigDecimal(NumConstant.ONE_HUNDRED)); + BigDecimal publishIssueRatio=new BigDecimal((double)entity.getPublishIssueTotal() / gridIssueTotal).multiply(new BigDecimal(NumConstant.ONE_HUNDRED)); entity.setPublishIssueRatio(publishIssueRatio.setScale(NumConstant.SIX, RoundingMode.HALF_UP)); } //7、议题转项目数 entity.setShiftProjectTotal(getGridOrCommunityShiftProjectTotal(customerId, gridId, null)); + log.info("extractGridPioneerData 当前网格id=" + gridId +";议题转项目数shiftProjectTotal="+entity.getShiftProjectTotal()); //8、议题转项目占比 : 占网格内议题总数的比率 if(entity.getShiftProjectTotal() == NumConstant.ZERO){ entity.setShiftProjectRatio(BigDecimal.ZERO); }else{ - BigDecimal shiftProjectRatio=new BigDecimal(entity.getShiftProjectTotal() / gridIssueTotal).multiply(new BigDecimal(NumConstant.ONE_HUNDRED)); + BigDecimal shiftProjectRatio = new BigDecimal((double) entity.getShiftProjectTotal() / gridIssueTotal).multiply(new BigDecimal(NumConstant.ONE_HUNDRED)); entity.setShiftProjectRatio(shiftProjectRatio.setScale(NumConstant.SIX, RoundingMode.HALF_UP)); } }else{ -// log.info("当前网格内所有议题总数="+gridIssueTotal); + log.info("extractGridPioneerData 当前网格id="+gridId+";当前网格内所有议题总数 gridIssueTotal =0 "); entity.setPublishIssueTotal(NumConstant.ZERO); entity.setPublishIssueRatio(BigDecimal.ZERO); entity.setShiftProjectTotal(NumConstant.ZERO); @@ -125,18 +145,34 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService // 9、已解决项目 entity.setResolvedProjectTotal(getGridOrCommunityClosedProjectTotal(customerId, gridId, null, DimObjectStatusConstant.RESOLVED)); + log.info("extractGridPioneerData 当前网格id="+gridId+";已解决项目resolvedProjectTotal="+entity.getResolvedProjectTotal()); + + int closedProjectTotal = getGridOrCommunityClosedProjectTotal(customerId, gridId, null, null); + log.info("extractGridPioneerData 当前网格id="+gridId+";总结项目closedProjectTotal="+closedProjectTotal); + // 01.12新增:PLAT_CLOSED_PROJECT_TOTAL 当前组织维度,所有结案项目数 + entity.setPlatClosedProjectTotal(closedProjectTotal); + + // 10、占总结项目 if (entity.getResolvedProjectTotal() == NumConstant.ZERO) { entity.setResolvedProjectRatio(BigDecimal.ZERO); } else { - // 10、占总结项目 - int closedProjectTotal = getGridOrCommunityClosedProjectTotal(customerId, gridId, null, null); if(closedProjectTotal == NumConstant.ZERO){ entity.setResolvedProjectRatio(BigDecimal.ZERO); }else { - BigDecimal resolvedProjectRatio=new BigDecimal(entity.getResolvedProjectTotal() / closedProjectTotal).multiply(new BigDecimal(NumConstant.ONE_HUNDRED)); + BigDecimal resolvedProjectRatio = new BigDecimal((double) entity.getResolvedProjectTotal() / closedProjectTotal).multiply(new BigDecimal(NumConstant.ONE_HUNDRED)); entity.setResolvedProjectRatio(resolvedProjectRatio.setScale(NumConstant.SIX, RoundingMode.HALF_UP)); } } + //01.12: 新增指标:平台参与议事总人数、平台参与议事党员数、平台参与议事的党员占比 + entity.setPlatJoinUserTotal(factOriginIssueLogDailyService.calPlatJoinUserTotal(customerId, gridId, null, null,null)); + entity.setPlatJoinPartyTotal(factOriginIssueLogDailyService.calPlatJoinUserTotal(customerId, gridId, null, null,NumConstant.ONE_STR)); + if (entity.getPlatJoinPartyTotal() == NumConstant.ZERO) { + entity.setPlatJoinPartyRatio(BigDecimal.ZERO); + } else { + BigDecimal platJoinPartyRatio = new BigDecimal((double) entity.getPlatJoinPartyTotal() / entity.getPlatJoinUserTotal()).multiply(new BigDecimal(NumConstant.ONE_HUNDRED)); + entity.setPlatJoinPartyRatio(platJoinPartyRatio.setScale(NumConstant.SIX, RoundingMode.HALF_UP)); + } + }); screenPioneerDataService.delAndSavePioneerData(customerId, OrgTypeConstant.GRID, IndexCalConstant.DELETE_SIZE, gridList); } @@ -172,42 +208,60 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService String communityId = entity.getOrgId(); //1、党员参与议事 entity.setIssueTotal(calPartyPartiIssueTotal(customerId,null,communityId,null,NumConstant.ONE_STR)); + log.info("extractCommunityPioneerData 当前communityId="+communityId+";党员参与议事issueTotal="+entity.getIssueTotal()); + + //01.12新增 + int issueTotal=calPartyPartiIssueTotal(customerId,null,communityId,null,null); + log.info("extractCommunityPioneerData 当前communityId="+communityId+";参与议事总数issueTotal="+issueTotal); + entity.setPlatIssueTotal(issueTotal); + if(entity.getIssueTotal()==0){ entity.setIssueRatio(BigDecimal.ZERO); }else{ //2、党员参与议事占比 - int issueTotal=calPartyPartiIssueTotal(customerId,null,communityId,null,null); - entity.setIssueRatio(new BigDecimal(entity.getIssueTotal()/issueTotal).setScale(NumConstant.SIX,RoundingMode.HALF_UP)); + entity.setIssueRatio(new BigDecimal((double)entity.getIssueTotal()/issueTotal).multiply(new BigDecimal(NumConstant.ONE_HUNDRED)).setScale(NumConstant.SIX,RoundingMode.HALF_UP)); } //3、党员发布话题: entity.setTopicTotal(getTopicTotal(customerId, null, communityId)); + log.info("extractCommunityPioneerData 当前communityId="+communityId+";党员发布话题topicTotal="+entity.getTopicTotal()); + + //01.12新增 + //当前社区内所有话题总数 + int communityTopicTotal = getGridOrCommunityTopicTotal(customerId, null, communityId); + log.info("extractCommunityPioneerData 当前communityId="+communityId+";当前社区内所有话题总数communityTopicTotal="+communityTopicTotal); + entity.setPlatTopicTotal(communityTopicTotal); + //4、党员发布话题占比: 社区内注册党员发布的话题总数占 社区内话题总数的 比率 if (entity.getTopicTotal() == NumConstant.ZERO) { entity.setTopicRatio(BigDecimal.ZERO); } else { - //当前社区内所有话题总数 - int communityTopicTotal = getGridOrCommunityTopicTotal(customerId, null, communityId); - entity.setTopicRatio(communityTopicTotal == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal(entity.getTopicTotal() / communityTopicTotal).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); + entity.setTopicRatio(communityTopicTotal == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal((double)entity.getTopicTotal() / communityTopicTotal).multiply(new BigDecimal(NumConstant.ONE_HUNDRED)).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); } + //01.12新增 //当前社区内所有议题总数 int communityIssueTotal = getGridOrCommunityIssueTotal(customerId, null, communityId); + log.info("extractCommunityPioneerData 当前communityId="+communityId+";当前社区内所有议题总数communityIssueTotal="+communityIssueTotal); + entity.setPlatPublishIssueTotal(communityIssueTotal); + if (communityIssueTotal != NumConstant.ZERO) { //5、党员发布议题 entity.setPublishIssueTotal(getParyPublishIssueTotal(customerId, null, communityId)); + log.info("extractCommunityPioneerData 当前communityId="+communityId+";党员发布议题publishIssueTotal="+entity.getPublishIssueTotal()); //6、党员发布议题占比 : 占社区内所有议题的比率 if (entity.getPublishIssueTotal() == NumConstant.ZERO) { entity.setPublishIssueRatio(BigDecimal.ZERO); } - entity.setPublishIssueRatio(communityIssueTotal == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal(entity.getPublishIssueTotal() / communityIssueTotal).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); + entity.setPublishIssueRatio(communityIssueTotal == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal((double)entity.getPublishIssueTotal() / communityIssueTotal).multiply(new BigDecimal(NumConstant.ONE_HUNDRED)).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); //7、议题转项目数 entity.setShiftProjectTotal(getGridOrCommunityShiftProjectTotal(customerId, null, communityId)); + log.info("extractCommunityPioneerData 当前communityId="+communityId+";议题转项目数shiftProjectTotal="+entity.getShiftProjectTotal()); //8、议题转项目占比 : 占社区内议题总数的比率 - entity.setShiftProjectRatio(entity.getShiftProjectTotal() == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal(entity.getShiftProjectTotal() / communityIssueTotal).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); + entity.setShiftProjectRatio(entity.getShiftProjectTotal() == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal((double)entity.getShiftProjectTotal() / communityIssueTotal).multiply(new BigDecimal(NumConstant.ONE_HUNDRED)).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); }else{ -// log.info("当前社区内所有议题总数="+communityIssueTotal); + log.info("extractCommunityPioneerData 当前communityId="+communityId+"communityIssueTotal =0"); entity.setPublishIssueTotal(NumConstant.ZERO); entity.setPublishIssueRatio(BigDecimal.ZERO); entity.setShiftProjectTotal(NumConstant.ZERO); @@ -217,12 +271,28 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService // 9、已解决项目 entity.setResolvedProjectTotal(getGridOrCommunityClosedProjectTotal(customerId, null, communityId, DimObjectStatusConstant.RESOLVED)); + log.info("extractCommunityPioneerData 当前communityId="+communityId+";已解决项目resolvedProjectTotal="+entity.getResolvedProjectTotal()); + + //01.12新增 + int closedProjectTotal = getGridOrCommunityClosedProjectTotal(customerId, null, communityId, null); + log.info("extractCommunityPioneerData 当前communityId="+communityId+";总结项目closedProjectTotal="+closedProjectTotal); + entity.setPlatClosedProjectTotal(closedProjectTotal); + if (entity.getResolvedProjectTotal() == NumConstant.ZERO) { entity.setResolvedProjectRatio(BigDecimal.ZERO); } else { // 10、占总结项目 - int closedProjectTotal = getGridOrCommunityClosedProjectTotal(customerId, null, communityId, null); - entity.setResolvedProjectRatio(closedProjectTotal == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal(entity.getResolvedProjectTotal() / closedProjectTotal).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); + entity.setResolvedProjectRatio(closedProjectTotal == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal((double)entity.getResolvedProjectTotal() / closedProjectTotal).multiply(new BigDecimal(NumConstant.ONE_HUNDRED)).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); + } + + //01.12: 新增指标:平台参与议事总人数、平台参与议事党员数、平台参与议事的党员占比 + entity.setPlatJoinUserTotal(factOriginIssueLogDailyService.calPlatJoinUserTotal(customerId, null, communityId,null, null)); + entity.setPlatJoinPartyTotal(factOriginIssueLogDailyService.calPlatJoinUserTotal(customerId, null, communityId,null, NumConstant.ONE_STR)); + if (entity.getPlatJoinPartyTotal() == NumConstant.ZERO) { + entity.setPlatJoinPartyRatio(BigDecimal.ZERO); + } else { + BigDecimal platJoinPartyRatio = new BigDecimal((double) entity.getPlatJoinPartyTotal() / entity.getPlatJoinUserTotal()).multiply(new BigDecimal(NumConstant.ONE_HUNDRED)); + entity.setPlatJoinPartyRatio(platJoinPartyRatio.setScale(NumConstant.SIX, RoundingMode.HALF_UP)); } }); screenPioneerDataService.delAndSavePioneerData(customerId, OrgTypeConstant.AGENCY, IndexCalConstant.DELETE_SIZE, communityList); @@ -243,44 +313,63 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService } else { entity.setAgencyPath(entity.getAgencyPids().concat(StrConstant.COLON).concat(entity.getOrgId())); } + log.info("extractExceptCommunityPioneerData 当前orgId="+entity.getOrgId()+";agencyPath="+entity.getAgencyPath()); //1、党员参与议事 entity.setIssueTotal(calPartyPartiIssueTotal(customerId,null,null,entity.getAgencyPath(),NumConstant.ONE_STR)); + log.info("extractExceptCommunityPioneerData 党员参与议事issueTotal="+entity.getIssueTotal()); + + //01.12新增 + int issueTotal=calPartyPartiIssueTotal(customerId,null,null,entity.getAgencyPath(),null); + log.info("extractExceptCommunityPioneerData 平台参与议事issueTotal="+issueTotal); + entity.setPlatIssueTotal(issueTotal); + if(entity.getIssueTotal()==0){ entity.setIssueRatio(BigDecimal.ZERO); }else{ //2、党员参与议事占比 - int issueTotal=calPartyPartiIssueTotal(customerId,null,null,entity.getAgencyPath(),null); - entity.setIssueRatio(new BigDecimal(entity.getIssueTotal()/issueTotal).setScale(NumConstant.SIX,RoundingMode.HALF_UP)); + entity.setIssueRatio(new BigDecimal((double)entity.getIssueTotal()/issueTotal).multiply(new BigDecimal(NumConstant.ONE_HUNDRED)).setScale(NumConstant.SIX,RoundingMode.HALF_UP)); } //3、党员发布话题: entity.setTopicTotal(getAgencyTopicTotal(customerId, entity.getAgencyPath(),NumConstant.ONE_STR)); + log.info("extractExceptCommunityPioneerData 党员发布话题topicTotal="+entity.getTopicTotal()); + + //01.12新增 + //当前组织内所有话题总数 + int agencyTopicTotal = getAgencyTopicTotal(customerId, entity.getAgencyPath(),null); + log.info("extractExceptCommunityPioneerData 当前组织内所有话题总数agencyTopicTotal="+agencyTopicTotal); + entity.setPlatTopicTotal(agencyTopicTotal); + //4、党员发布话题占比: 组织内注册党员发布的话题总数占 组织内话题总数的 比率 if (entity.getTopicTotal() == NumConstant.ZERO) { entity.setTopicRatio(BigDecimal.ZERO); } else { - //当前组织内所有话题总数 - int agencyTopicTotal = getAgencyTopicTotal(customerId, entity.getAgencyPath(),null); - entity.setTopicRatio(agencyTopicTotal == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal(entity.getTopicTotal() / agencyTopicTotal).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); + entity.setTopicRatio(agencyTopicTotal == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal((double)entity.getTopicTotal() / agencyTopicTotal).multiply(new BigDecimal(NumConstant.ONE_HUNDRED)).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); } + //01.12新增 //当前组织内所有议题总数 int agencyIssueTotal = getAgencyIssueTotal(customerId, entity.getAgencyPath()); + log.info("extractExceptCommunityPioneerData 当前组织内所有议题总数agencyIssueTotal="+agencyIssueTotal); + entity.setPlatPublishIssueTotal(agencyIssueTotal); + if (agencyIssueTotal != NumConstant.ZERO) { //5、党员发布议题 entity.setPublishIssueTotal(getAgencyParyPublishIssueTotal(customerId, entity.getAgencyPath())); + log.info("extractExceptCommunityPioneerData 党员发布议题publishIssueTotal="+entity.getPublishIssueTotal()); //6、党员发布议题占比 : 占社区内所有议题的比率 if (entity.getPublishIssueTotal() == NumConstant.ZERO) { entity.setPublishIssueRatio(BigDecimal.ZERO); } - entity.setPublishIssueRatio(agencyIssueTotal == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal(entity.getPublishIssueTotal() / agencyIssueTotal).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); + entity.setPublishIssueRatio(agencyIssueTotal == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal((double)entity.getPublishIssueTotal() / agencyIssueTotal).multiply(new BigDecimal(NumConstant.ONE_HUNDRED)).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); //7、议题转项目数 entity.setShiftProjectTotal(getAgencyShiftProjectTotal(customerId, entity.getAgencyPath())); + log.info("extractExceptCommunityPioneerData 议题转项目数shiftProjectTotal="+entity.getShiftProjectTotal()); //8、议题转项目占比 : 占网格内议题总数的比率 - entity.setShiftProjectRatio(entity.getShiftProjectTotal() == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal(entity.getShiftProjectTotal() / agencyIssueTotal).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); + entity.setShiftProjectRatio(entity.getShiftProjectTotal() == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal((double)entity.getShiftProjectTotal() / agencyIssueTotal).multiply(new BigDecimal(NumConstant.ONE_HUNDRED)).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); }else{ -// log.info("当前组织内所有议题总数="+agencyIssueTotal); + log.info("extractExceptCommunityPioneerData 当前组织内所有议题总数agencyIssueTotal=0"); entity.setPublishIssueTotal(NumConstant.ZERO); entity.setPublishIssueRatio(BigDecimal.ZERO); entity.setShiftProjectTotal(NumConstant.ZERO); @@ -290,13 +379,30 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService // 9、已解决项目 entity.setResolvedProjectTotal(getAgencyClosedProjectTotal(customerId, entity.getAgencyPath(), DimObjectStatusConstant.RESOLVED)); + log.info("extractExceptCommunityPioneerData 已解决项目resolvedProjectTotal="+entity.getResolvedProjectTotal()); + + //01.12新增 + int closedProjectTotal = getAgencyClosedProjectTotal(customerId, entity.getAgencyPath(), null); + log.info("extractExceptCommunityPioneerData 总结项目closedProjectTotal="+closedProjectTotal); + entity.setPlatClosedProjectTotal(closedProjectTotal); + if (entity.getResolvedProjectTotal() == NumConstant.ZERO) { entity.setResolvedProjectRatio(BigDecimal.ZERO); } else { // 10、占总结项目 - int closedProjectTotal = getAgencyClosedProjectTotal(customerId, entity.getAgencyPath(), null); - entity.setResolvedProjectRatio(closedProjectTotal == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal(entity.getResolvedProjectTotal() / closedProjectTotal).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); + entity.setResolvedProjectRatio(closedProjectTotal == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal((double)entity.getResolvedProjectTotal() / closedProjectTotal).multiply(new BigDecimal(NumConstant.ONE_HUNDRED)).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); } + + //01.12: 新增指标:平台参与议事总人数、平台参与议事党员数、平台参与议事的党员占比 + entity.setPlatJoinUserTotal(factOriginIssueLogDailyService.calPlatJoinUserTotal(customerId, null, null, entity.getAgencyPath(), null)); + entity.setPlatJoinPartyTotal(factOriginIssueLogDailyService.calPlatJoinUserTotal(customerId, null, null, entity.getAgencyPath(), NumConstant.ONE_STR)); + if (entity.getPlatJoinPartyTotal() == NumConstant.ZERO) { + entity.setPlatJoinPartyRatio(BigDecimal.ZERO); + } else { + BigDecimal platJoinPartyRatio = new BigDecimal((double) entity.getPlatJoinPartyTotal() / entity.getPlatJoinUserTotal()).multiply(new BigDecimal(NumConstant.ONE_HUNDRED)); + entity.setPlatJoinPartyRatio(platJoinPartyRatio.setScale(NumConstant.SIX, RoundingMode.HALF_UP)); + } + }); screenPioneerDataService.delAndSavePioneerData(customerId, OrgTypeConstant.AGENCY, IndexCalConstant.DELETE_SIZE, agencyList); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenGrassrootsGovernDataAbsorptionServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenGrassrootsGovernDataAbsorptionServiceImpl.java index d0ab7c49a8..5a560cd05c 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenGrassrootsGovernDataAbsorptionServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenGrassrootsGovernDataAbsorptionServiceImpl.java @@ -184,6 +184,8 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr List imgList = new LinkedList<>(); imgMap.values().forEach(list -> {imgList.addAll(list);}); + difficulties.removeIf( diff -> StringUtils.isBlank(diff.getLatestOperateDesc())); + screenDifficultyDataService.dataClean(param.getCustomerId(),difficulties,imgList); log.info("【大屏数据抽取-难点赌点执行完毕】 客户Id{} 难点赌点数据{}",param.getCustomerId(),JSON.toJSONString(difficulties)); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimGridServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimGridServiceImpl.java index 5062b8e94f..a08e0af4ba 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimGridServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimGridServiceImpl.java @@ -186,7 +186,7 @@ public class DimGridServiceImpl extends BaseServiceImpl getGridAttributes(String customerId,List gridIds) { - if(CollectionUtils.isEmpty(gridIds)) return Collections.EMPTY_LIST; + return baseDao.selectGridAttributes(customerId,gridIds); } } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginGroupMainDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginGroupMainDailyDao.xml index 2717a8cb5e..db5dc8b583 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginGroupMainDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginGroupMainDailyDao.xml @@ -97,7 +97,7 @@ - + DELETE FROM fact_origin_group_main_daily @@ -287,8 +287,8 @@ WHERE DEL_FLAG = '0' AND CUSTOMER_ID = #{customerId} - AND MONTH_ID = #{monthId} AND GROUP_STATE = 'approved' + AND IS_OWNER_PARTY = 1 AND ( @@ -338,4 +338,4 @@ AND f.GROUP_STATE = 'approved' GROUP BY f.AGENCY_ID - \ No newline at end of file + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueLogDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueLogDailyDao.xml index d54794d323..521ef174e4 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueLogDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginIssueLogDailyDao.xml @@ -153,4 +153,28 @@ and m.PIDS LIKE CONCAT(#{pids},'%') + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectOrgPeriodDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectOrgPeriodDailyDao.xml index a01747d444..d607aac0d0 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectOrgPeriodDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectOrgPeriodDailyDao.xml @@ -39,9 +39,12 @@ fact_origin_project_org_period_daily WHERE DEL_FLAG = '0' - - PROJECT_ID = #{item} - + AND CUSTOMER_ID = #{customerId} + + + PROJECT_ID = #{item} + + \ No newline at end of file diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/constant/AreaCodeConstant.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/constant/AreaCodeConstant.java index 742c73993a..3ee44fec5f 100644 --- a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/constant/AreaCodeConstant.java +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/constant/AreaCodeConstant.java @@ -24,4 +24,6 @@ public interface AreaCodeConstant { String ROOT_AGENCY_LEVEL_IS_LEVEL = "RootAreaLevel为空......"; + String LEVEL_ERROR = "RootAreaLevel填写错误【%s】"; + } diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/AreaCodeServiceImpl.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/AreaCodeServiceImpl.java index 7898516b33..b511cab2c0 100644 --- a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/AreaCodeServiceImpl.java +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/AreaCodeServiceImpl.java @@ -313,6 +313,8 @@ public class AreaCodeServiceImpl extends BaseServiceImplfeign-httpclient 10.3.0 + + com.epmet + resi-group-client + 2.0.0 + compile + diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/TopicAutoAuditService.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/TopicAutoAuditService.java new file mode 100644 index 0000000000..0102b54370 --- /dev/null +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/TopicAutoAuditService.java @@ -0,0 +1,12 @@ +package com.epmet.service; + +import com.epmet.commons.tools.utils.Result; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/12/29 17:45 + */ +public interface TopicAutoAuditService { + Result autoAudit(); +} diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/TopicAutoAuditServiceImpl.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/TopicAutoAuditServiceImpl.java new file mode 100644 index 0000000000..2e497497e0 --- /dev/null +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/TopicAutoAuditServiceImpl.java @@ -0,0 +1,24 @@ +package com.epmet.service.impl; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.resi.group.feign.ResiGroupOpenFeignClient; +import com.epmet.service.TopicAutoAuditService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/12/29 17:46 + */ +@Service +public class TopicAutoAuditServiceImpl implements TopicAutoAuditService { + + @Autowired + private ResiGroupOpenFeignClient resiGroupOpenFeignClient; + + @Override + public Result autoAudit() { + return resiGroupOpenFeignClient.autoAudit(); + } +} diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/TopicAutoAuditTask.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/TopicAutoAuditTask.java new file mode 100644 index 0000000000..6bc7bb3c4b --- /dev/null +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/TopicAutoAuditTask.java @@ -0,0 +1,31 @@ +package com.epmet.task; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.service.TopicAutoAuditService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/12/29 17:43 + */ +@Slf4j +@Component("topicAutoAuditTask") +public class TopicAutoAuditTask implements ITask { + + @Autowired + private TopicAutoAuditService topicAutoAuditService; + + @Override + public void run(String params) { + log.info("TopicAutoAuditTask定时任务正在执行,参数为:{}", params); + Result result = topicAutoAuditService.autoAudit(); + if (result.success()) { + log.info("TopicAutoAuditTask定时任务执行成功"); + } else { + log.error("TopicAutoAuditTask定时任务执行失败:" + result.getMsg()); + } + } +} diff --git a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/constant/SmsTemplateConstant.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/constant/SmsTemplateConstant.java index 3bfac0e8f7..c5647e5edf 100644 --- a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/constant/SmsTemplateConstant.java +++ b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/constant/SmsTemplateConstant.java @@ -27,4 +27,14 @@ public interface SmsTemplateConstant { * 修改密码验证码 */ String CHANGE_PASSWORD = "SMS_150731393"; + + /** + * 项目被吹哨提醒 + */ + String PROJECT_TRANSFER = "SMS_200187239"; + + /** + * 项目滞留提醒 + */ + String PROJECT_OVERDUE = "SMS_206885207"; } diff --git a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/constant/SysSmsConstant.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/constant/SysSmsConstant.java new file mode 100644 index 0000000000..32be48a287 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/constant/SysSmsConstant.java @@ -0,0 +1,19 @@ +package com.epmet.constant; + +/** + * @Author zxc + * @DateTime 2021/1/4 下午1:42 + */ +public interface SysSmsConstant { + + String IS_NULL_PARAM_LIST = "项目流转或滞留推送短信提醒入参集合为空......"; + + String SELECT_PARAMETER_INFO_FAILURE = "查询客户配置参数失败......"; + + String PARAMETER_INFO_IS_ZERO = "未查到客户配置参数......"; + + String NOT_ENOUGH_BALANCE = "客户:%s ,当前余额为:%s"; + + String NOT_ON_SWITCH = "客户:%s ,【%s】开关未开启"; + +} diff --git a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/constant/SystemMessageSendApproach.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/constant/SystemMessageSendApproach.java new file mode 100644 index 0000000000..7406175d87 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/constant/SystemMessageSendApproach.java @@ -0,0 +1,7 @@ +package com.epmet.constant; + +public interface SystemMessageSendApproach { + + String MQ = "mq"; + +} diff --git a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/constant/SystemMessageType.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/constant/SystemMessageType.java new file mode 100644 index 0000000000..382b96e275 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/constant/SystemMessageType.java @@ -0,0 +1,13 @@ +package com.epmet.constant; + +/** + * 系统消息类型 + */ +public interface SystemMessageType { + + /** + * 初始化客户 + */ + String INIT_CUSTOMER = "init_customer"; + +} diff --git a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/constant/WxmpMessageConstant.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/constant/WxmpMessageConstant.java new file mode 100644 index 0000000000..5c8b364e1f --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/constant/WxmpMessageConstant.java @@ -0,0 +1,88 @@ +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 GOV_REDIS = "work"; + + String GOV_DB = "gov"; + + String ACCESS_TOKEN = "access_token"; + + String TOUSER = "touser"; + + String TEMPLATE_ID = "template_id"; + /*站内信模板start*/ + String MESSAGE_TEMPLATE_TYPE = "1832"; + String MESSAGE_TITLE = "thing5"; + String MESSAGE_CONTENT = "thing4"; + String MESSAGE_TIME = "date2"; + /*站内信模板end*/ + + /**关注更新提醒模板start**/ + String CONCERN_UPDATE_TEMPLATE_TYPE = "8171"; + String CONCERN_UPDATE_TITLE = "thing5"; + String CONCERN_UPDATE_TITLE_TEXT = "话题状态提醒"; + String CONCERN_UPDATE_CONTENT = "thing7"; + String CONCERN_UPDATE_CONTENT_TEXT = "你关注的话题已被转为议题,请点击查看。"; + String CONCERN_UPDATE_TIME = "time6"; + /**关注更新提醒模板end**/ + + /**内容更新消息通知模板start**/ + String CONTENT_UPDATE_TEMPLATE_TYPE = "2092"; + String CONTENT_UPDATE_TITLE = "name4"; + String CONTENT_UPDATE_TITLE_TEXT = "新评论提醒"; + String CONTENT_UPDATE_CONTENT = "thing9"; + String CONTENT_UPDATE_CONTENT_TEXT = "你关注的话题收到新评论,请点击查看。"; + String CONTENT_UPDATE_TIME = "date3"; + /**内容更新消息通知模板end**/ + + /** 消息来源start**/ + //话题 + String SOURCE_TYPE_TOPIC = "topic"; + //议题 + String SOURCE_TYPE_ISSUE = "issue"; + /** 消息来源end**/ + + String PAGE = "page"; + + String MESSAGE_PAGE_URL = "/subpages/mine/pages/message/skip"; + + String UPDATE_PAGE_URL = "/pages/index/subscribe?id="; + + int TITLE_LIMIT = 20; + + int MESSAGE_CONTENT_LIMIT = 20; + + String DATA = "data"; + + String MINIPROGRAM_STATE = "miniprogram_state"; + + String SUCCESS = "success"; + + String ERROR = "error"; + + String STATE_DEV = "developer"; + + String STATE_TEST = "trial"; + +} diff --git a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/WxmpUpdateSendDataDTO.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/WxmpUpdateSendDataDTO.java new file mode 100644 index 0000000000..75696d1a4e --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/WxmpUpdateSendDataDTO.java @@ -0,0 +1,111 @@ +/** + * 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 qu qu@elink-cn.com + * @since v1.0.0 2021-01-04 + */ +@Data +public class WxmpUpdateSendDataDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 来源类型 (话题:topic 议题:issue 项目project 爱心互助heart 党建声音voice) + */ + private String sourceType; + + /** + * 来源对应ID + */ + private String sourceId; + + /** + * 客户ID + */ + private String customerId; + + /** + * 组织ID agencyId + */ + private String agencyId; + + /** + * 网格ID + */ + private String gridId; + + /** + * 小组Id + */ + private String groupId; + + /** + * 工作人员Id + */ + private String staffId; + + /** + * 消息接收者 + */ + private String msgUserId; + + /** + * 删除标识 0未删除、1已删除 + */ + private String 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/WxmpUpdateSendRecordDTO.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/WxmpUpdateSendRecordDTO.java new file mode 100644 index 0000000000..a1e8a23d8e --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/WxmpUpdateSendRecordDTO.java @@ -0,0 +1,131 @@ +/** + * 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 qu qu@elink-cn.com + * @since v1.0.0 2020-12-30 + */ +@Data +public class WxmpUpdateSendRecordDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 客户Id + */ + private String customerId; + + /** + * 网格Id (居民端跟网格有关的则有值,工作端以及一些居民端和网格没关的存*) + */ + private String gridId; + + /** + * 所属端类型 居民端:resi 工作端:gov + */ + private String clientType; + + /** + * 消息模板Id + */ + private String templateId; + + /** + * 用户Id + */ + private String userId; + + /** + * openId + */ + private String wxOpenId; + + /** + * 行为类型: 关注更新提醒、内容更新消息通知 + */ + private String behaviorType; + + /** + * 消息标题 + */ + private String title; + + /** + * 消息内容 + */ + private String content; + + /** + * 消息时间 + */ + private Date time; + + /** + * 发送结果(成功:success 失败:error) + */ + private String result; + + /** + * 发送失败的原因,成功可以不记录 + */ + private String reason; + + /** + * 删除标识 + */ + private String 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/ProjectSendMsgFormDTO.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/ProjectSendMsgFormDTO.java new file mode 100644 index 0000000000..cd1e10f820 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/ProjectSendMsgFormDTO.java @@ -0,0 +1,43 @@ +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 + */ +@Data +public class ProjectSendMsgFormDTO implements Serializable { + private static final long serialVersionUID = 8894395590639206399L; + /** + * 手机号 + */ + @NotBlank(message = "手机号不能为空", groups = {AddUserInternalGroup.class, AddUserShowGroup.class}) + private String mobile; + /** + * 场景: + */ + @NotBlank(message = "短信模板编码不能为空", groups = {AddUserInternalGroup.class}) + private String aliyunTemplateCode; + + /** + * 客户ID + */ + @NotBlank(message = "客户ID不能为空", groups = {AddUserInternalGroup.class}) + private String customerId; + + /** + * 参数KEY(发短信:send_msg;) + */ + @NotBlank(message = "参数KEY不能为空", groups = {AddUserInternalGroup.class}) + private String parameterKey; + + public interface AddUserInternalGroup {} + + public interface AddUserShowGroup extends CustomerClientShowGroup {} +} diff --git a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/SystemMsgFormDTO.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/SystemMsgFormDTO.java new file mode 100644 index 0000000000..c0fc9308b8 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/SystemMsgFormDTO.java @@ -0,0 +1,15 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotNull; + +@Data +public class SystemMsgFormDTO { + + @NotNull(message = "消息类型不能为空") + private String messageType; + + @NotNull(message = "消息内容不能为空") + private Object content; +} diff --git a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/WxSubscribeUpdateFormDTO.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/WxSubscribeUpdateFormDTO.java new file mode 100644 index 0000000000..3361ed6295 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/WxSubscribeUpdateFormDTO.java @@ -0,0 +1,86 @@ +package com.epmet.dto.form; + +import lombok.Data; + +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 WxSubscribeUpdateFormDTO 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; + + /** + * 来源类型 (话题:topic 议题:issue 项目project 爱心互助heart 党建声音voice)等 + */ + @NotBlank(message = "来源类型不能为空") + private String sourceType; + /** + * 来源对应id + */ + @NotBlank(message = "来源id不能为空") + private String sourceId; + + /** + * 行为类型 传模板的tid + */ + @NotBlank(message = "行为类型不能为空") + private String behaviorType; + + @NotBlank(message = "消息标题不能为空") + private String messageTitle; + + /** + * 消息内容 + */ + @NotBlank(message = "消息内容不能为空") + private String messageContent; + + /** + * 消息时间 + */ + @NotNull(message = "消息时间不能为空") + private Date messageTime; + + /** + * 网格id + */ + private String gridId; + /** + * 工作人员id + */ + private String staffId; + + /** + * 群id + */ + private String groupId; + /** + * 组织id + */ + private String agencyId; + + +} 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 1035ab1552..ff085c7bc0 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 @@ -3,9 +3,12 @@ package com.epmet.feign; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.SysSmsDTO; +import com.epmet.dto.form.ProjectSendMsgFormDTO; import com.epmet.dto.form.SendVerificationCodeFormDTO; +import com.epmet.dto.form.SystemMsgFormDTO; import com.epmet.dto.form.UserMessageFormDTO; import com.epmet.dto.form.WxSubscribeMessageFormDTO; +import com.epmet.dto.form.WxSubscribeUpdateFormDTO; import com.epmet.dto.result.SendVerificationCodeResultDTO; import com.epmet.feign.fallback.EpmetMessageOpenFeignClientFallback; import org.springframework.cloud.openfeign.FeignClient; @@ -77,4 +80,30 @@ public interface EpmetMessageOpenFeignClient { **/ @PostMapping(value = "message/wxmpmessage/sendwxsubscribemessage", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) Result sendWxSubscribeMessage(List msgList); + + /** + * @param formDTOList + * @author sun + * @description 项目流转或滞留推送短信提醒 + **/ + @PostMapping(value = "message/sms/projectsendmsg", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) + Result projectSendMsg(List formDTOList); + + /** + * @param msgList + * @return com.epmet.commons.tools.utils.Result + * @Author liushaowen + * @Description 发送微信订阅消息 + **/ + @PostMapping(value = "message/wxmpmessage/sendwxsubscribeupdate", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) + Result sendWxSubscribeUpdate(List msgList); + + /** + * @Description 通过mq发送系统消息 + * @return + * @author wxz + * @date 2021.01.06 15:16 + */ + @PostMapping("/message/system/send-by-mq") + Result sendSystemMsgByMQ(@RequestBody SystemMsgFormDTO form); } 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 889569147f..a77d9152db 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 @@ -4,9 +4,12 @@ import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.ModuleUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.SysSmsDTO; +import com.epmet.dto.form.ProjectSendMsgFormDTO; import com.epmet.dto.form.SendVerificationCodeFormDTO; +import com.epmet.dto.form.SystemMsgFormDTO; import com.epmet.dto.form.UserMessageFormDTO; import com.epmet.dto.form.WxSubscribeMessageFormDTO; +import com.epmet.dto.form.WxSubscribeUpdateFormDTO; import com.epmet.dto.result.SendVerificationCodeResultDTO; import com.epmet.feign.EpmetMessageOpenFeignClient; import org.springframework.stereotype.Component; @@ -51,4 +54,19 @@ public class EpmetMessageOpenFeignClientFallback implements EpmetMessageOpenFeig public Result sendWxSubscribeMessage(List msgList) { return ModuleUtils.feignConError(ServiceConstant.EPMET_MESSAGE_SERVER, "sendWxSubscribeMessage", msgList); } + + @Override + public Result projectSendMsg(List formDTOList) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_MESSAGE_SERVER, "projectSendMsg", formDTOList); + } + + @Override + public Result sendWxSubscribeUpdate(List msgList) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_MESSAGE_SERVER, "sendWxSubscribeUpdate", msgList); + } + + @Override + public Result sendSystemMsgByMQ(SystemMsgFormDTO form) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_MESSAGE_SERVER, "sendSystemMsgByMQ", form); + } } diff --git a/epmet-module/epmet-message/epmet-message-server/pom.xml b/epmet-module/epmet-message/epmet-message-server/pom.xml index 6a10b4724d..ccfcf76ec3 100644 --- a/epmet-module/epmet-message/epmet-message-server/pom.xml +++ b/epmet-module/epmet-message/epmet-message-server/pom.xml @@ -112,6 +112,19 @@ 2.0.0 compile + + + com.epmet + oper-crm-client + 2.0.0 + + + + + com.epmet + epmet-commons-rocketmq + 2.0.0 + @@ -178,6 +191,10 @@ SEC080aac67ff78e79fdaba132aa51e3fb3f6060dec99492feaac82cabf9f8b6a19 + + + 192.168.1.130:9876;192.168.1.132:9876 + epmet_message @@ -222,6 +239,10 @@ SEC080aac67ff78e79fdaba132aa51e3fb3f6060dec99492feaac82cabf9f8b6a19 + + + 192.168.1.130:9876;192.168.1.132:9876 + epmet_message @@ -266,6 +287,10 @@ SEC080aac67ff78e79fdaba132aa51e3fb3f6060dec99492feaac82cabf9f8b6a19 + + + 192.168.10.161:9876 + epmet_message @@ -307,6 +332,10 @@ SEC95f4f40b533ad379ea6a6d1af6dd37029383cfe1b7cd96dfac2678be2c1c3ed1 + + + 192.168.11.187:9876;192.168.11.184:9876 + epmet_message 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 deleted file mode 100644 index 62c9e16dcb..0000000000 --- a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/constant/WxmpMessageConstant.java +++ /dev/null @@ -1,63 +0,0 @@ -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 GOV_REDIS = "work"; - - String GOV_DB = "gov"; - - String ACCESS_TOKEN = "access_token"; - - String TOUSER = "touser"; - - String TEMPLATE_ID = "template_id"; - - String TEMPLATE_TYPE = "1832"; - - String PAGE = "page"; - - String PAGE_URL = "/subpages/mine/pages/message/skip"; - - String TITLE = "thing5"; - - int TITLE_LIMIT = 20; - - String MESSAGE_CONTENT = "thing4"; - - int MESSAGE_CONTENT_LIMIT = 20; - - String MESSAGE_TIME = "date2"; - - String DATA = "data"; - - String MINIPROGRAM_STATE = "miniprogram_state"; - - String SUCCESS = "success"; - - String ERROR = "error"; - - String STATE_DEV = "developer"; - - String STATE_TEST = "trial"; - -} diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/SmsController.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/SmsController.java index 0a0f534a0a..8f3ced6845 100644 --- a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/SmsController.java +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/SmsController.java @@ -16,6 +16,7 @@ import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.group.AliyunGroup; import com.epmet.commons.tools.validator.group.QcloudGroup; import com.epmet.dto.SysSmsDTO; +import com.epmet.dto.form.ProjectSendMsgFormDTO; import com.epmet.dto.form.SendVerificationCodeFormDTO; import com.epmet.dto.result.SendVerificationCodeResultDTO; import com.epmet.enums.PlatformEnum; @@ -32,6 +33,7 @@ import org.springframework.web.bind.annotation.*; import springfox.documentation.annotations.ApiIgnore; import java.util.Arrays; +import java.util.List; import java.util.Map; /** @@ -139,4 +141,19 @@ public class SmsController { SendVerificationCodeResultDTO resultDTO=sysSmsService.sendVerificationCode(formDTO); return new Result().ok(resultDTO); } + + /** + * @param formDTOList + * @author sun + * @description 项目流转或滞留推送短信提醒 + **/ + @PostMapping("projectsendmsg") + public Result projectSendMsg(@RequestBody List formDTOList) { + for (ProjectSendMsgFormDTO formDTO : formDTOList) { + ValidatorUtils.validateEntity(formDTO, ProjectSendMsgFormDTO.AddUserShowGroup.class, ProjectSendMsgFormDTO.AddUserInternalGroup.class); + } + sysSmsService.projectSendMsg(formDTOList); + return new Result(); + } + } diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/SystemMessageController.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/SystemMessageController.java new file mode 100644 index 0000000000..7a31e91785 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/SystemMessageController.java @@ -0,0 +1,27 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dto.form.SystemMsgFormDTO; +import com.epmet.service.SystemMessageService; +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; + +@RestController +@RequestMapping("system") +public class SystemMessageController { + + @Autowired + private SystemMessageService systemMessageService; + + @PostMapping("send-by-mq") + public Result sendSystemMsgByMQ(@RequestBody SystemMsgFormDTO form) { + ValidatorUtils.validateEntity(form); + systemMessageService.sendMQMessage(form.getMessageType(), form.getContent()); + return new Result(); + } + +} 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 index b600285971..1847afb396 100644 --- 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 @@ -21,11 +21,9 @@ import com.epmet.commons.tools.exception.ExceptionUtils; 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.ActivationSubscribeFormDTO; -import com.epmet.dto.form.GetTemplateListFormDTO; -import com.epmet.dto.form.WxMsgAuthInfoFormDTO; -import com.epmet.dto.form.WxSubscribeMessageFormDTO; +import com.epmet.dto.form.*; import com.epmet.dto.result.GetTemplateListResultDTO; +import com.epmet.dto.result.TemplateListV2ResultDTO; import com.epmet.dto.result.WxMsgAuthInfoResultDTO; import com.epmet.service.WxmpMessageService; import org.slf4j.Logger; @@ -100,9 +98,27 @@ public class WxmpMessageController { return new Result(); } + @PostMapping("sendwxsubscribeupdate") + public Result sendWxSubscribeUpdate(@RequestBody List msgList){ + for (WxSubscribeUpdateFormDTO wxSubscribeUpdateFormDTO : msgList) { + ValidatorUtils.validateEntity(wxSubscribeUpdateFormDTO); + } + executorService.execute(() -> { + try { + long startTs = System.currentTimeMillis(); + wxmpMessageService.sendWxSubscribeUpdate(msgList); + long endTs = System.currentTimeMillis(); + logger.info("异步发送消息成功,执行时长:{}", endTs - startTs); + } catch (Exception e) { + logger.error("异步发送消息失败,错误信息:{}", ExceptionUtils.getErrorStackTrace(e)); + } + }); + return new Result(); + } + /** * @return - * @Description 居民端、工作端-获取客户小程序模板列表 + * @Description 居民端、工作端-获取客户小程序模板列表(只有站内信模板) * @author sun */ @PostMapping("templatelist") @@ -110,6 +126,18 @@ public class WxmpMessageController { ValidatorUtils.validateEntity(formDTO, GetTemplateListFormDTO.AddUserInternalGroup.class); return new Result>().ok(wxmpMessageService.templateList(formDTO)); } + /** + * @Description 居民端、工作端-获取客户小程序模板列表(除了站内信模板) + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author liushaowen + * @Date 2020/12/29 13:18 + */ + @PostMapping("templatelistv2") + public Result> templateListV2(@RequestBody TemplateListV2FormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO); + return new Result>().ok(wxmpMessageService.templateListV2(formDTO)); + } /** * @Description 查询用户授权信息 @@ -159,4 +187,4 @@ public class WxmpMessageController { return new Result(); } -} \ No newline at end of file +} diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/WxmpUpdateSendDataController.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/WxmpUpdateSendDataController.java new file mode 100644 index 0000000000..0704f912c6 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/WxmpUpdateSendDataController.java @@ -0,0 +1,98 @@ +/** + * 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.WxmpUpdateSendDataDTO; +import com.epmet.excel.WxmpUpdateSendDataExcel; +import com.epmet.service.WxmpUpdateSendDataService; +import org.apache.commons.lang3.StringUtils; +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 qu qu@elink-cn.com + * @since v1.0.0 2021-01-04 + */ +@RestController +@RequestMapping("wxmpupdatesenddata") +public class WxmpUpdateSendDataController { + + @Autowired + private WxmpUpdateSendDataService wxmpUpdateSendDataService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = wxmpUpdateSendDataService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + if (StringUtils.isBlank(id) || "undefined".equals(id)){ + return new Result().error(8000,"id不能为空"); + } + WxmpUpdateSendDataDTO data = wxmpUpdateSendDataService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody WxmpUpdateSendDataDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + wxmpUpdateSendDataService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody WxmpUpdateSendDataDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + wxmpUpdateSendDataService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + wxmpUpdateSendDataService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = wxmpUpdateSendDataService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, WxmpUpdateSendDataExcel.class); + } + +} diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/WxmpUpdateSendRecordController.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/WxmpUpdateSendRecordController.java new file mode 100644 index 0000000000..42daed9b09 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/WxmpUpdateSendRecordController.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.WxmpUpdateSendRecordDTO; +import com.epmet.excel.WxmpUpdateSendRecordExcel; +import com.epmet.service.WxmpUpdateSendRecordService; +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 qu qu@elink-cn.com + * @since v1.0.0 2020-12-30 + */ +@RestController +@RequestMapping("wxmpupdatesendrecord") +public class WxmpUpdateSendRecordController { + + @Autowired + private WxmpUpdateSendRecordService wxmpUpdateSendRecordService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = wxmpUpdateSendRecordService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + WxmpUpdateSendRecordDTO data = wxmpUpdateSendRecordService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody WxmpUpdateSendRecordDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + wxmpUpdateSendRecordService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody WxmpUpdateSendRecordDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + wxmpUpdateSendRecordService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + wxmpUpdateSendRecordService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = wxmpUpdateSendRecordService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, WxmpUpdateSendRecordExcel.class); + } + +} \ No newline at end of file diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/SystemMessageDao.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/SystemMessageDao.java new file mode 100644 index 0000000000..7770c58547 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/SystemMessageDao.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.SystemMessageEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 系统消息表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-01-06 + */ +@Mapper +public interface SystemMessageDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/WxmpUpdateSendDataDao.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/WxmpUpdateSendDataDao.java new file mode 100644 index 0000000000..89af78b681 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/WxmpUpdateSendDataDao.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.WxmpUpdateSendDataEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 订阅消息发送数据表(内容更新消息提醒、关注更新提醒) + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2021-01-04 + */ +@Mapper +public interface WxmpUpdateSendDataDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/WxmpUpdateSendRecordDao.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/WxmpUpdateSendRecordDao.java new file mode 100644 index 0000000000..63b8812bb0 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/WxmpUpdateSendRecordDao.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.WxmpUpdateSendRecordEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 订阅消息发送记录表(内容更新消息提醒、关注更新提醒) + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2020-12-30 + */ +@Mapper +public interface WxmpUpdateSendRecordDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/SystemMessageEntity.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/SystemMessageEntity.java new file mode 100644 index 0000000000..effdb2d59b --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/SystemMessageEntity.java @@ -0,0 +1,57 @@ +/** + * 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 org.omg.CORBA.StringHolder; + +import java.util.Date; + +/** + * 系统消息表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-01-06 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("system_message") +public class SystemMessageEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 消息类型 + */ + private String msgType; + + /** + * 发送途径 + */ + private String sendApproach; + + /** + * 消息内容 + */ + private String content; + +} diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/WxmpUpdateSendDataEntity.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/WxmpUpdateSendDataEntity.java new file mode 100644 index 0000000000..a4395a1bf9 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/WxmpUpdateSendDataEntity.java @@ -0,0 +1,81 @@ +/** + * 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 qu qu@elink-cn.com + * @since v1.0.0 2021-01-04 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("wxmp_update_send_data") +public class WxmpUpdateSendDataEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 来源类型 (话题:topic 议题:issue 项目project 爱心互助heart 党建声音voice) + */ + private String sourceType; + + /** + * 来源对应ID + */ + private String sourceId; + + /** + * 客户ID + */ + private String customerId; + + /** + * 组织ID agencyId + */ + private String agencyId; + + /** + * 网格ID + */ + private String gridId; + + /** + * 小组Id + */ + private String groupId; + + /** + * 工作人员Id + */ + private String staffId; + + /** + * 消息接收者 + */ + private String msgUserId; + +} diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/WxmpUpdateSendRecordEntity.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/WxmpUpdateSendRecordEntity.java new file mode 100644 index 0000000000..9497a3475e --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/WxmpUpdateSendRecordEntity.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.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 qu qu@elink-cn.com + * @since v1.0.0 2020-12-30 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("wxmp_update_send_record") +public class WxmpUpdateSendRecordEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户Id + */ + private String customerId; + + /** + * 网格Id (居民端跟网格有关的则有值,工作端以及一些居民端和网格没关的存*) + */ + private String gridId; + + /** + * 所属端类型 居民端:resi 工作端:gov + */ + private String clientType; + + /** + * 消息模板Id + */ + private String templateId; + + /** + * 用户Id + */ + private String userId; + + /** + * openId + */ + private String wxOpenId; + + /** + * 行为类型: 关注更新提醒、内容更新消息通知 + */ + private String behaviorType; + + /** + * 消息标题 + */ + private String title; + + /** + * 消息内容 + */ + private String content; + + /** + * 消息时间 + */ + private Date time; + + /** + * 发送结果(成功:success 失败:error) + */ + private String result; + + /** + * 发送失败的原因,成功可以不记录 + */ + private String reason; + +} diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/excel/WxmpUpdateSendDataExcel.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/excel/WxmpUpdateSendDataExcel.java new file mode 100644 index 0000000000..5c1c3f07f3 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/excel/WxmpUpdateSendDataExcel.java @@ -0,0 +1,80 @@ +/** + * 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 qu qu@elink-cn.com + * @since v1.0.0 2021-01-04 + */ +@Data +public class WxmpUpdateSendDataExcel { + + @Excel(name = "主键") + private String id; + + @Excel(name = "来源类型 (话题:topic 议题:issue 项目project 爱心互助heart 党建声音voice)") + private String sourceType; + + @Excel(name = "来源对应ID") + private String sourceId; + + @Excel(name = "客户ID") + private String customerId; + + @Excel(name = "组织ID agencyId") + private String agencyId; + + @Excel(name = "网格ID ") + private String gridId; + + @Excel(name = "小组Id") + private String groupId; + + @Excel(name = "工作人员Id") + private String staffId; + + @Excel(name = "消息接收者") + private String msgUserId; + + @Excel(name = "删除标识 0未删除、1已删除") + private String 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/WxmpUpdateSendRecordExcel.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/excel/WxmpUpdateSendRecordExcel.java new file mode 100644 index 0000000000..bec6cbe551 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/excel/WxmpUpdateSendRecordExcel.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.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 订阅消息发送记录表(内容更新消息提醒、关注更新提醒) + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2020-12-30 + */ +@Data +public class WxmpUpdateSendRecordExcel { + + @Excel(name = "主键") + private String id; + + @Excel(name = "客户Id ") + private String customerId; + + @Excel(name = "网格Id (居民端跟网格有关的则有值,工作端以及一些居民端和网格没关的存*)") + private String gridId; + + @Excel(name = "所属端类型 居民端:resi 工作端:gov") + private String clientType; + + @Excel(name = "消息模板Id ") + private String templateId; + + @Excel(name = "用户Id") + private String userId; + + @Excel(name = "openId ") + private String wxOpenId; + + @Excel(name = "行为类型: 关注更新提醒、内容更新消息通知") + private String behaviorType; + + @Excel(name = "消息标题 ") + private String title; + + @Excel(name = "消息内容 ") + private String content; + + @Excel(name = "消息时间 ") + private Date time; + + @Excel(name = "发送结果(成功:success 失败:error)") + private String result; + + @Excel(name = "发送失败的原因,成功可以不记录") + private String reason; + + @Excel(name = "删除标识") + private String 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/redis/WxmpUpdateSendDataRedis.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/redis/WxmpUpdateSendDataRedis.java new file mode 100644 index 0000000000..48cc7ac397 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/redis/WxmpUpdateSendDataRedis.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 qu qu@elink-cn.com + * @since v1.0.0 2021-01-04 + */ +@Component +public class WxmpUpdateSendDataRedis { + @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/WxmpUpdateSendRecordRedis.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/redis/WxmpUpdateSendRecordRedis.java new file mode 100644 index 0000000000..05235661a1 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/redis/WxmpUpdateSendRecordRedis.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 qu qu@elink-cn.com + * @since v1.0.0 2020-12-30 + */ +@Component +public class WxmpUpdateSendRecordRedis { + @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/SysSmsService.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/SysSmsService.java index 1e67125423..8bb9cb2a8e 100644 --- a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/SysSmsService.java +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/SysSmsService.java @@ -12,11 +12,13 @@ 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.SysSmsDTO; +import com.epmet.dto.form.ProjectSendMsgFormDTO; import com.epmet.dto.form.SendVerificationCodeFormDTO; import com.epmet.dto.result.SendVerificationCodeResultDTO; import com.epmet.entity.SysSmsEntity; import java.util.LinkedHashMap; +import java.util.List; import java.util.Map; /** @@ -58,5 +60,13 @@ public interface SysSmsService extends BaseService { * @Date 2020/6/23 21:07 **/ SendVerificationCodeResultDTO sendVerificationCode(SendVerificationCodeFormDTO formDTO); + + /** + * @param formDTOList + * @author sun + * @description 项目流转或滞留推送短信提醒 + **/ + void projectSendMsg(List formDTOList); + } diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/SystemMessageService.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/SystemMessageService.java new file mode 100644 index 0000000000..2985b550c9 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/SystemMessageService.java @@ -0,0 +1,7 @@ +package com.epmet.service; + +public interface SystemMessageService { + + void sendMQMessage(String messageType, Object content); + +} 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 index 315bf5c6d6..c2e3439bc2 100644 --- 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 @@ -17,10 +17,9 @@ package com.epmet.service; -import com.epmet.dto.form.ActivationSubscribeFormDTO; -import com.epmet.dto.form.GetTemplateListFormDTO; -import com.epmet.dto.form.WxSubscribeMessageFormDTO; +import com.epmet.dto.form.*; import com.epmet.dto.result.GetTemplateListResultDTO; +import com.epmet.dto.result.TemplateListV2ResultDTO; import com.epmet.dto.result.WxMsgAuthInfoResultDTO; import java.util.List; @@ -41,7 +40,7 @@ public interface WxmpMessageService { String behaviorType, String userId); /** - * @Description 发送订阅消息 + * @Description 发送站内信订阅消息 * @param msgList * @return void * @Author liushaowen @@ -51,7 +50,7 @@ public interface WxmpMessageService { /** * @return - * @Description 居民端、工作端-获取客户小程序模板列表 + * @Description 居民端、工作端-获取客户小程序模板列表(只有站内信消息模板) * @author sun */ List templateList(GetTemplateListFormDTO formDTO); @@ -62,4 +61,21 @@ public interface WxmpMessageService { * @author sun */ void activationSubscribe(ActivationSubscribeFormDTO formDTO); + /** + * @Description 居民端、工作端-获取客户小程序模板列表(不包括站内信消息模板) + * @param formDTO + * @return java.util.List + * @Author liushaowen + * @Date 2020/12/29 13:26 + */ + List templateListV2(TemplateListV2FormDTO formDTO); + + /** + * @Description 发送(内容更新消息提醒、关注更新提醒)订阅消息 + * @param msgList + * @return void + * @Author liushaowen + * @Date 2020/12/30 13:36 + */ + void sendWxSubscribeUpdate(List msgList); } diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/WxmpUpdateSendDataService.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/WxmpUpdateSendDataService.java new file mode 100644 index 0000000000..5d21093d61 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/WxmpUpdateSendDataService.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.WxmpUpdateSendDataDTO; +import com.epmet.entity.WxmpUpdateSendDataEntity; + +import java.util.List; +import java.util.Map; + +/** + * 订阅消息发送数据表(内容更新消息提醒、关注更新提醒) + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2021-01-04 + */ +public interface WxmpUpdateSendDataService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2021-01-04 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2021-01-04 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return WxmpUpdateSendDataDTO + * @author generator + * @date 2021-01-04 + */ + WxmpUpdateSendDataDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2021-01-04 + */ + void save(WxmpUpdateSendDataDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2021-01-04 + */ + void update(WxmpUpdateSendDataDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2021-01-04 + */ + 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/WxmpUpdateSendRecordService.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/WxmpUpdateSendRecordService.java new file mode 100644 index 0000000000..cf67d914fe --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/WxmpUpdateSendRecordService.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.WxmpUpdateSendRecordDTO; +import com.epmet.entity.WxmpUpdateSendRecordEntity; + +import java.util.List; +import java.util.Map; + +/** + * 订阅消息发送记录表(内容更新消息提醒、关注更新提醒) + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2020-12-30 + */ +public interface WxmpUpdateSendRecordService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-12-30 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-12-30 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return WxmpUpdateSendRecordDTO + * @author generator + * @date 2020-12-30 + */ + WxmpUpdateSendRecordDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-12-30 + */ + void save(WxmpUpdateSendRecordDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-12-30 + */ + void update(WxmpUpdateSendRecordDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-12-30 + */ + 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/SysSmsServiceImpl.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/SysSmsServiceImpl.java index 2c254701d2..fe270e280c 100644 --- a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/SysSmsServiceImpl.java +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/SysSmsServiceImpl.java @@ -17,14 +17,20 @@ import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.ErrorCode; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; +import com.epmet.constant.SysSmsConstant; import com.epmet.dao.SysSmsDao; import com.epmet.dto.SysSmsDTO; +import com.epmet.dto.form.CrmParameterFormDTO; +import com.epmet.dto.form.ProjectSendMsgFormDTO; import com.epmet.dto.form.SendVerificationCodeFormDTO; +import com.epmet.dto.result.CrmParameterResultDTO; import com.epmet.dto.result.SendVerificationCodeResultDTO; import com.epmet.entity.SysSmsEntity; import com.epmet.exception.ModuleErrorCode; import com.epmet.feign.EpmetMessageOpenFeignClient; +import com.epmet.feign.OperCrmOpenFeignClient; import com.epmet.service.SysSmsService; import com.epmet.sms.AbstractSmsService; import com.epmet.sms.SmsFactory; @@ -35,10 +41,13 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; import java.util.HashMap; import java.util.LinkedHashMap; +import java.util.List; import java.util.Map; +import java.util.stream.Collectors; @Service public class SysSmsServiceImpl extends BaseServiceImpl implements SysSmsService { @@ -47,6 +56,8 @@ public class SysSmsServiceImpl extends BaseServiceImpl @Autowired private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient; + @Autowired + private OperCrmOpenFeignClient operCrmOpenFeignClient; @Override public PageData page(Map params) { @@ -181,4 +192,99 @@ public class SysSmsServiceImpl extends BaseServiceImpl } return data; } + + /** + * @param formDTOList + * @author sun + * @description 项目流转或滞留推送短信提醒 + **/ + @Override + public void projectSendMsg(List formDTOList) { + if (CollectionUtils.isEmpty(formDTOList)){ + logger.error(SysSmsConstant.IS_NULL_PARAM_LIST); + return; + } + Map> groupByCustomer = formDTOList.stream().collect(Collectors.groupingBy(ProjectSendMsgFormDTO::getCustomerId)); + List formDTOS = ConvertUtils.sourceToTarget(formDTOList, CrmParameterFormDTO.class); + List parameterFormDTOS = formDTOS.stream().distinct().collect(Collectors.toList()); + Result> listResult = operCrmOpenFeignClient.selectParamInfo(parameterFormDTOS); + if (!listResult.success()){ + throw new RenException(SysSmsConstant.SELECT_PARAMETER_INFO_FAILURE); + } + List parameterResult = listResult.getData(); + if (CollectionUtils.isEmpty(parameterResult)){ + logger.error(SysSmsConstant.PARAMETER_INFO_IS_ZERO); + return; + } + groupByCustomer.forEach((customerId,v) -> { + parameterResult.forEach(p -> { + if (customerId.equals(p.getCustomerId())){ + p.setBalanceStatus(Integer.valueOf(p.getParameterValue()) >= v.size() ? true : false); + p.setSubtractParameterValue(String.valueOf(Integer.valueOf(p.getParameterValue()) - v.size())); + } + }); + }); + try { + groupByCustomer.forEach((customerId,v) -> { + parameterResult.forEach(p -> { + if (customerId.equals(p.getCustomerId())){ + // 判断参数开关是否打开,false:未打开 + if (p.getSwitchStatus() == false){ + logger.error(String.format(SysSmsConstant.NOT_ON_SWITCH,customerId,p.getParameterKey())); + }else { + // 判断余额状态 false:余额不足 + if (p.getBalanceStatus() == false){ + logger.error(String.format(SysSmsConstant.NOT_ENOUGH_BALANCE,customerId,p.getParameterValue())); + }else { + v.forEach(dto->{ + SysSmsDTO sysSmsDTO = new SysSmsDTO(); + sysSmsDTO.setMobile(dto.getMobile()); + sysSmsDTO.setAliyunTemplateCode(dto.getAliyunTemplateCode()); + //推送短信 + this.sendMsg(sysSmsDTO); + }); + } + } + } + }); + }); + }catch (RenException e){ + logger.error(e.getInternalMsg()); + } + Map> groupBySwitch = parameterResult.stream().collect(Collectors.groupingBy(CrmParameterResultDTO::getSwitchStatus)); + List crmParameterTrue = groupBySwitch.get(true); + if (!CollectionUtils.isEmpty(crmParameterTrue)){ + Map> groupByStatus = crmParameterTrue.stream().collect(Collectors.groupingBy(CrmParameterResultDTO::getBalanceStatus)); + List crmParameterResultDTOS = groupByStatus.get(true); + // 把参数开关打开的,已发送短信的客户更新余额 + if (!CollectionUtils.isEmpty(crmParameterResultDTOS)){ + operCrmOpenFeignClient.updateParamInfo(crmParameterResultDTOS); + } + } + } + + /** + * @author sun + * @description 推送短信信箱,出错不中断 + **/ + private void sendMsg(SysSmsDTO sysSmsDTO) { + logger.info(String.format("固定短信模板推送短信信息接口入参:%s", JSON.toJSONString(sysSmsDTO))); + LinkedHashMap map = null; + try { + //短信服务 + AbstractSmsService service = SmsFactory.build(); + if (service == null) { + logger.error("发送短信异常,ErrorCode:%s,异常AbstractSmsService is null", ModuleErrorCode.SMS_CONFIG); + } + //发送短信 + if (StringUtils.isNotBlank(sysSmsDTO.getAliyunTemplateCode())) { + service.sendSmsByAliyunTemplateCode(sysSmsDTO.getMobile(), map, sysSmsDTO.getAliyunTemplateCode()); + } else { + service.sendSms(sysSmsDTO.getMobile(), map); + } + } catch (Exception e) { + logger.error(String.format("项目提醒发送短信失败,失败手机号:%s,ErrorCode:%s", sysSmsDTO.getMobile(), e.getMessage())); + } + } + } diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/SystemMessageServiceImpl.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/SystemMessageServiceImpl.java new file mode 100644 index 0000000000..64a067af56 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/SystemMessageServiceImpl.java @@ -0,0 +1,70 @@ +package com.epmet.service.impl; + +import com.alibaba.fastjson.JSON; +import com.epmet.commons.rocketmq.constants.TopicConstants; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.ExceptionUtils; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.constant.SystemMessageSendApproach; +import com.epmet.constant.SystemMessageType; +import com.epmet.dao.SystemMessageDao; +import com.epmet.entity.SystemMessageEntity; +import com.epmet.service.SystemMessageService; +import org.apache.rocketmq.common.message.Message; +import org.apache.rocketmq.remoting.common.RemotingHelper; +import org.apache.rocketmq.spring.core.RocketMQTemplate; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class SystemMessageServiceImpl implements SystemMessageService { + + private Logger logger = LoggerFactory.getLogger(getClass()); + + @Autowired + private SystemMessageDao systemMessageDao; + + @Autowired + private RocketMQTemplate rocketMQTemplate; + + @Transactional(rollbackFor = Exception.class) + @Override + public void sendMQMessage(String messageType, Object content) { + String contentStr = JSON.toJSONString(content); + //存储消息到表 + SystemMessageEntity systemMessageEntity = new SystemMessageEntity(); + systemMessageEntity.setMsgType(messageType); + systemMessageEntity.setSendApproach(SystemMessageSendApproach.MQ); + systemMessageEntity.setContent(contentStr); + systemMessageDao.insert(systemMessageEntity); + + //发送mq消息 + try { + Message meMessage = new Message(getTopicByMsgType(messageType), contentStr.getBytes(RemotingHelper.DEFAULT_CHARSET)); + rocketMQTemplate.getProducer().send(meMessage); + } catch (Exception e) { + String errorStackTrace = ExceptionUtils.getErrorStackTrace(e); + logger.error("发送系统消息失败,堆栈信息:{}", errorStackTrace); + throw new RenException(EpmetErrorCode.SYSTEM_MQ_MSG_SEND_FAIL.getCode()); + } + } + + /** + * @Description 根据消息类型获取topic + * @return + * @author wxz + * @date 2021.01.06 13:42 + */ + private String getTopicByMsgType(String msgType) { + String topic = null; + switch (msgType) { + case SystemMessageType.INIT_CUSTOMER: + topic = TopicConstants.INIT_CUSTOMER; + break; + } + return topic; + } +} 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 index 0d390bfc31..c5e1bf1ec6 100644 --- 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 @@ -40,6 +40,8 @@ import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.redis.WxmpMessageRedis; import com.epmet.service.WxmpMessageService; import com.epmet.service.WxmpMsgSendRecordService; +import com.epmet.service.WxmpUpdateSendDataService; +import com.epmet.service.WxmpUpdateSendRecordService; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -49,10 +51,7 @@ import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; /** * 微信消息订阅Service @@ -82,9 +81,15 @@ public class WxmpMessageServiceImpl implements WxmpMessageService { @Autowired private WxmpMsgSendRecordService wxmpMsgSendRecordService; + @Autowired + private WxmpUpdateSendRecordService wxmpUpdateSendRecordService; + @Autowired private WxmpUserSubscribeRecordDao subscribeRecordDao; + @Autowired + private WxmpUpdateSendDataService wxmpUpdateSendDataService; + /** * @return void * @Description 保存系统授权信息 @@ -125,7 +130,7 @@ public class WxmpMessageServiceImpl implements WxmpMessageService { /** * @param msgList * @return void - * @Description 发送订阅消息 + * @Description 发送站内信订阅消息 * @Author liushaowen * @Date 2020/10/21 15:34 */ @@ -139,7 +144,7 @@ public class WxmpMessageServiceImpl implements WxmpMessageService { // 获取templateId CustomerTemplateListFormDTO customerTemplateListFormDTO = new CustomerTemplateListFormDTO(); customerTemplateListFormDTO.setCustomerId(msgList.get(0).getCustomerId()); - customerTemplateListFormDTO.setPublicId(WxmpMessageConstant.TEMPLATE_TYPE); + customerTemplateListFormDTO.setPublicId(WxmpMessageConstant.MESSAGE_TEMPLATE_TYPE); List customerTemplateListResultDTOS = customerTemplateList(customerTemplateListFormDTO); // 获取AccessToken Map accessTokenMap = getAccessToken(msgList.get(0).getCustomerId()); @@ -151,32 +156,7 @@ public class WxmpMessageServiceImpl implements WxmpMessageService { String templateId = null; String openId = null; //通过userId获取openId - try { - if (WxmpMessageConstant.RESI.equals(clientType)) { - UserBasicInfoFormDTO userBasicInfoFormDTO = new UserBasicInfoFormDTO(); - userBasicInfoFormDTO.setUserId(userId); - Result userBasicInfo = epmetUserOpenFeignClient.getUserBasicInfo(userBasicInfoFormDTO); - if (userBasicInfo.getCode() != 0){ - throw new Exception(userBasicInfo.getInternalMsg()); - }else { - openId = userBasicInfo.getData().getOpenId(); - } - } else if (WxmpMessageConstant.GOV_DB.equals(clientType)) { - StaffBasicInfoFormDTO staffBasicInfoFormDTO = new StaffBasicInfoFormDTO(); - staffBasicInfoFormDTO.setStaffId(userId); - Result staffBasicInfo = epmetUserOpenFeignClient.getStaffBasicInfo(staffBasicInfoFormDTO);; - if (staffBasicInfo.getCode() != 0){ - throw new Exception(staffBasicInfo.getInternalMsg()); - }else { - openId = staffBasicInfo.getData().getOpenId(); - } - } else { - throw new WxSubscribeException("clientType有误", "", openId); - } - } catch (Exception e) { - e.printStackTrace(); - throw new WxSubscribeException("获取openId失败:" + e.getMessage(), "", ""); - } + openId = getUserOpenId(userId, clientType, openId); if (StringUtils.isBlank(openId)) { throw new WxSubscribeException("该userId未查询到关联的openId", "", ""); @@ -234,7 +214,7 @@ public class WxmpMessageServiceImpl implements WxmpMessageService { String title = "您有一条" + msg.getBehaviorType(); JSONObject titleJson = new JSONObject(); titleJson.put("value", title.length() > WxmpMessageConstant.TITLE_LIMIT ? title.substring(0, WxmpMessageConstant.TITLE_LIMIT) : title); - data.put(WxmpMessageConstant.TITLE, titleJson); + data.put(WxmpMessageConstant.MESSAGE_TITLE, titleJson); //内容 JSONObject contentJson = new JSONObject(); contentJson.put("value", msg.getMessageContent().length() > WxmpMessageConstant.MESSAGE_CONTENT_LIMIT ? msg.getMessageContent().substring(0, WxmpMessageConstant.MESSAGE_CONTENT_LIMIT) : msg.getMessageContent()); @@ -247,11 +227,11 @@ public class WxmpMessageServiceImpl implements WxmpMessageService { EnvEnum envEnum = EnvEnum.getCurrentEnv(); //选填项 if (WxmpMessageConstant.RESI.equals(clientType)) { - StringBuilder resiPage = new StringBuilder(WxmpMessageConstant.PAGE_URL); + StringBuilder resiPage = new StringBuilder(WxmpMessageConstant.MESSAGE_PAGE_URL); resiPage.append("?customerId=").append(customerId).append("&gridId=").append(msg.getGridId()); jsonObject.put(WxmpMessageConstant.PAGE, resiPage.toString()); } else if (WxmpMessageConstant.GOV_DB.equals(clientType)) { - StringBuilder govPage = new StringBuilder(WxmpMessageConstant.PAGE_URL); + StringBuilder govPage = new StringBuilder(WxmpMessageConstant.MESSAGE_PAGE_URL); govPage.append("?customerId=").append(customerId).append("&staffId=").append(userId); jsonObject.put(WxmpMessageConstant.PAGE, govPage.toString()); } @@ -281,7 +261,7 @@ public class WxmpMessageServiceImpl implements WxmpMessageService { logger.warn("消息{}发送成功但订阅条数-1失败", JSON.toJSONString(msg)); } //存表 - int saveRes = wxmpMsgSendRecordService.saveRecord(initRecord(msg, templateId, openId, WxmpMessageConstant.SUCCESS)); + int saveRes = wxmpMsgSendRecordService.saveRecord(initWxmpMsgSendRecord(msg, templateId, openId, WxmpMessageConstant.SUCCESS)); if (saveRes == 0) { logger.warn("消息{}发送成功但存入记录表失败", JSON.toJSONString(msg)); } @@ -312,7 +292,7 @@ public class WxmpMessageServiceImpl implements WxmpMessageService { // } if (e instanceof WxSubscribeException) { //存表 - WxmpMsgSendRecordEntity wxmpMsgSendRecordEntity = initRecord(msg, ((WxSubscribeException) e).getTemplateId(), ((WxSubscribeException) e).getOpenId(), WxmpMessageConstant.ERROR); + WxmpMsgSendRecordEntity wxmpMsgSendRecordEntity = initWxmpMsgSendRecord(msg, ((WxSubscribeException) e).getTemplateId(), ((WxSubscribeException) e).getOpenId(), WxmpMessageConstant.ERROR); wxmpMsgSendRecordEntity.setReason(errMsg); int saveRes = wxmpMsgSendRecordService.saveRecord(wxmpMsgSendRecordEntity); if (saveRes == 0) { @@ -328,7 +308,7 @@ public class WxmpMessageServiceImpl implements WxmpMessageService { } //初始化记录对象 - private WxmpMsgSendRecordEntity initRecord(WxSubscribeMessageFormDTO msg, String templateId, String openId, String status) { + private WxmpMsgSendRecordEntity initWxmpMsgSendRecord(WxSubscribeMessageFormDTO msg, String templateId, String openId, String status) { WxmpMsgSendRecordEntity wxmpMsgSendRecordEntity = new WxmpMsgSendRecordEntity(); wxmpMsgSendRecordEntity.setCustomerId(msg.getCustomerId()); wxmpMsgSendRecordEntity.setClientType(msg.getClientType()); @@ -345,6 +325,215 @@ public class WxmpMessageServiceImpl implements WxmpMessageService { return wxmpMsgSendRecordEntity; } + /** + * @param msgList + * @return void + * @Description 发送(内容更新消息提醒、关注更新提醒)订阅消息 + * @Author liushaowen + * @Date 2020/12/30 13:36 + */ + @Override + public void sendWxSubscribeUpdate(List msgList) { + if (msgList.size() == 0){ + return; + } + // 获取templateId + TemplateListV2FormDTO templateListV2FormDTO = new TemplateListV2FormDTO(); + templateListV2FormDTO.setCustomerId(msgList.get(0).getCustomerId()); + //获取工作端的 + templateListV2FormDTO.setApp(WxmpMessageConstant.GOV_REDIS); + List workTemplates = templateListV2(templateListV2FormDTO); + //获取居民端的 + templateListV2FormDTO.setApp(WxmpMessageConstant.RESI); + List resiTemplates = templateListV2(templateListV2FormDTO); + + //获取AccessToken + Map accessTokenMap = getAccessToken(msgList.get(0).getCustomerId()); + + for (WxSubscribeUpdateFormDTO msg : msgList) { + //生成属性表id + String dataId = UUID.randomUUID().toString().replace("-",""); + try { + String userId = msg.getUserId(); + String clientType = msg.getClientType(); + String customerId = msg.getCustomerId(); + String templateId = null; + String openId = null; + //通过userId获取openId + openId = getUserOpenId(userId, clientType, openId); + if (StringUtils.isBlank(openId)) { + throw new WxSubscribeException("该userId未查询到关联的openId", "", ""); + } + + //获取模板id + if (WxmpMessageConstant.GOV_DB.equals(msg.getClientType())&& workTemplates.size() > NumConstant.ZERO) { + for (TemplateListV2ResultDTO workTemplate : workTemplates) { + if (workTemplate.getTid().equals(msg.getBehaviorType())){ + templateId = workTemplate.getTemplateId(); + break; + }; + } + } else if (WxmpMessageConstant.RESI.equals(msg.getClientType())&& resiTemplates.size() > NumConstant.ZERO) { + for (TemplateListV2ResultDTO resiTemplate : resiTemplates) { + if (resiTemplate.getTid().equals(msg.getBehaviorType())){ + templateId = resiTemplate.getTemplateId(); + break; + }; + } + }else { + throw new WxSubscribeException("获取模板id失败", "", openId); + } + if (StringUtils.isBlank(templateId)) { + throw new WxSubscribeException("获取模板id失败", "", openId); + } + + //获取accessToken + String accessToken = null; + if (WxmpMessageConstant.RESI.equals(clientType)) { + accessToken = accessTokenMap.get("resiToken"); + } else if (WxmpMessageConstant.GOV_DB.equals(clientType)) { + accessToken = accessTokenMap.get("govToken"); + } + if (StringUtils.isBlank(accessToken)) { + throw new WxSubscribeException("accessToken获取失败"+accessTokenMap.get("errorMsg"), "", 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); + //标题 + JSONObject titleJson = new JSONObject(); + titleJson.put("value", msg.getMessageTitle().length() > WxmpMessageConstant.TITLE_LIMIT ? msg.getMessageTitle().substring(0, WxmpMessageConstant.TITLE_LIMIT) : msg.getMessageTitle()); + //内容 + JSONObject contentJson = new JSONObject(); + contentJson.put("value", msg.getMessageContent().length() > WxmpMessageConstant.MESSAGE_CONTENT_LIMIT ? msg.getMessageContent().substring(0, WxmpMessageConstant.MESSAGE_CONTENT_LIMIT) : msg.getMessageContent()); + //时间 + JSONObject timeJson = new JSONObject(); + timeJson.put("value", new SimpleDateFormat("yyyy-MM-dd HH:mm").format(msg.getMessageTime())); + + if (WxmpMessageConstant.CONCERN_UPDATE_TEMPLATE_TYPE.equals(msg.getBehaviorType())){ + data.put(WxmpMessageConstant.CONCERN_UPDATE_TITLE, titleJson); + data.put(WxmpMessageConstant.CONCERN_UPDATE_CONTENT, contentJson); + data.put(WxmpMessageConstant.CONCERN_UPDATE_TIME ,timeJson); + } + if (WxmpMessageConstant.CONTENT_UPDATE_TEMPLATE_TYPE.equals(msg.getBehaviorType())){ + data.put(WxmpMessageConstant.CONTENT_UPDATE_TITLE, titleJson); + data.put(WxmpMessageConstant.CONTENT_UPDATE_CONTENT, contentJson); + data.put(WxmpMessageConstant.CONTENT_UPDATE_TIME, timeJson); + } + // + jsonObject.put(WxmpMessageConstant.DATA, data); + EnvEnum envEnum = EnvEnum.getCurrentEnv(); + //选填项 + if (WxmpMessageConstant.RESI.equals(clientType)) { + StringBuilder resiPage = new StringBuilder(WxmpMessageConstant.UPDATE_PAGE_URL); + resiPage.append(dataId); + jsonObject.put(WxmpMessageConstant.PAGE, resiPage.toString()); + } else if (WxmpMessageConstant.GOV_DB.equals(clientType)) { + StringBuilder govPage = new StringBuilder(WxmpMessageConstant.UPDATE_PAGE_URL); + govPage.append(dataId); + jsonObject.put(WxmpMessageConstant.PAGE, govPage.toString()); + } + //开发环境 + 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)) { + //发送成功 + //存数据表 + WxmpUpdateSendDataEntity wxmpUpdateSendDataEntity = new WxmpUpdateSendDataEntity(); + wxmpUpdateSendDataEntity.setId(dataId); + wxmpUpdateSendDataEntity.setMsgUserId(userId); + wxmpUpdateSendDataEntity.setAgencyId(msg.getAgencyId()); + wxmpUpdateSendDataEntity.setCustomerId(customerId); + wxmpUpdateSendDataEntity.setGridId(msg.getGridId()); + wxmpUpdateSendDataEntity.setGroupId(msg.getGroupId()); + wxmpUpdateSendDataEntity.setSourceId(msg.getSourceId()); + wxmpUpdateSendDataEntity.setSourceType(msg.getSourceType()); + wxmpUpdateSendDataEntity.setStaffId(msg.getStaffId()); + wxmpUpdateSendDataService.insert(wxmpUpdateSendDataEntity); + //存记录表 + wxmpUpdateSendRecordService.insert(initWxmpUpdateSendRecord(msg, templateId, openId, WxmpMessageConstant.SUCCESS)); + + } else { + //发送失败 + //抛出错误 + throw new WxSubscribeException(String.valueOf(resultMap.get(WxmpMessageConstant.ERR_MSG)), templateId, openId); + } + }catch (Exception e){ + String errMsg = e.getMessage(); + if (e instanceof WxSubscribeException) { + //存表 + WxmpUpdateSendRecordEntity wxmpUpdateSendRecordEntity = initWxmpUpdateSendRecord(msg, ((WxSubscribeException) e).getTemplateId(), ((WxSubscribeException) e).getOpenId(), WxmpMessageConstant.ERROR); + wxmpUpdateSendRecordEntity.setReason(errMsg); + wxmpUpdateSendRecordService.insert(wxmpUpdateSendRecordEntity); + } + logger.warn("消息:{}发送失败,原因是:{}", JSON.toJSONString(msg), errMsg); + continue; + } + } + } + + private WxmpUpdateSendRecordEntity initWxmpUpdateSendRecord(WxSubscribeUpdateFormDTO msg, String templateId, String openId, String status) { + WxmpUpdateSendRecordEntity wxmpUpdateSendRecordEntity = new WxmpUpdateSendRecordEntity(); + wxmpUpdateSendRecordEntity.setCustomerId(msg.getCustomerId()); + wxmpUpdateSendRecordEntity.setClientType(msg.getClientType()); + wxmpUpdateSendRecordEntity.setTemplateId(templateId); + wxmpUpdateSendRecordEntity.setGridId(msg.getGridId() == null ? "" : msg.getGridId()); + wxmpUpdateSendRecordEntity.setUserId(msg.getUserId()); + wxmpUpdateSendRecordEntity.setWxOpenId(openId); + wxmpUpdateSendRecordEntity.setBehaviorType(msg.getBehaviorType()); + wxmpUpdateSendRecordEntity.setTitle(msg.getMessageTitle()); + wxmpUpdateSendRecordEntity.setContent(msg.getMessageContent()); + wxmpUpdateSendRecordEntity.setTime(msg.getMessageTime()); + wxmpUpdateSendRecordEntity.setResult(status); + return wxmpUpdateSendRecordEntity; + } + + + private String getUserOpenId(String userId, String clientType, String openId) throws WxSubscribeException { + try { + if (WxmpMessageConstant.RESI.equals(clientType)) { + UserBasicInfoFormDTO userBasicInfoFormDTO = new UserBasicInfoFormDTO(); + userBasicInfoFormDTO.setUserId(userId); + Result userBasicInfo = epmetUserOpenFeignClient.getUserBasicInfo(userBasicInfoFormDTO); + if (userBasicInfo.getCode() != 0){ + throw new Exception(userBasicInfo.getInternalMsg()); + }else { + openId = userBasicInfo.getData().getOpenId(); + } + } else if (WxmpMessageConstant.GOV_DB.equals(clientType)) { + StaffBasicInfoFormDTO staffBasicInfoFormDTO = new StaffBasicInfoFormDTO(); + staffBasicInfoFormDTO.setStaffId(userId); + Result staffBasicInfo = epmetUserOpenFeignClient.getStaffBasicInfo(staffBasicInfoFormDTO);; + if (staffBasicInfo.getCode() != 0){ + throw new Exception(staffBasicInfo.getInternalMsg()); + }else { + openId = staffBasicInfo.getData().getOpenId(); + } + } else { + throw new WxSubscribeException("clientType有误", "", openId); + } + } catch (Exception e) { + e.printStackTrace(); + throw new WxSubscribeException("获取openId失败:" + e.getMessage(), "", ""); + } + return openId; + } + + + //获取AccessToken private Map getAccessToken(String customerId) { EnvEnum envEnum = EnvEnum.getCurrentEnv(); @@ -398,7 +587,7 @@ public class WxmpMessageServiceImpl implements WxmpMessageService { /** * @return - * @Description 居民端、工作端-获取客户小程序模板列表 + * @Description 居民端、工作端-获取客户小程序模板列表(只包含站内信消息模板) * @author sun */ @Override @@ -430,6 +619,39 @@ public class WxmpMessageServiceImpl implements WxmpMessageService { return list;*/ } + /** + * @param formDTO + * @return java.util.List + * @Description 居民端、工作端-获取客户小程序模板列表(不包括站内信消息模板) + * @Author liushaowen + * @Date 2020/12/29 13:26 + */ + @Override + public List templateListV2(TemplateListV2FormDTO formDTO) { + String url = "https://epmet-cloud.elinkservice.cn/api/third/personaltemplate/templatelistv2"; +// String url = "http://localhost:8110/third/personaltemplate/templatelistv2"; + String data = HttpClientManager.getInstance().sendPostByJSON(url, JSON.toJSONString(formDTO)).getData(); + logger.info("ThirdLoginServiceImpl.templatelistv2: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(); + List list = new ArrayList<>(); + //必须转换 + for(Object f:resultList){ + JSONObject json = JSON.parseObject(f.toString()); + TemplateListV2ResultDTO ff = ConvertUtils.mapToEntity(json, TemplateListV2ResultDTO.class); + list.add(ff); + } + return list; + } + /** * @return * @Description 查询客户两个端小程序对应的站内信模板Id diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpUpdateSendDataServiceImpl.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpUpdateSendDataServiceImpl.java new file mode 100644 index 0000000000..a3e1718233 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpUpdateSendDataServiceImpl.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.WxmpUpdateSendDataDao; +import com.epmet.dto.WxmpUpdateSendDataDTO; +import com.epmet.entity.WxmpUpdateSendDataEntity; +import com.epmet.redis.WxmpUpdateSendDataRedis; +import com.epmet.service.WxmpUpdateSendDataService; +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 qu qu@elink-cn.com + * @since v1.0.0 2021-01-04 + */ +@Service +public class WxmpUpdateSendDataServiceImpl extends BaseServiceImpl implements WxmpUpdateSendDataService { + + @Autowired + private WxmpUpdateSendDataRedis wxmpUpdateSendDataRedis; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, WxmpUpdateSendDataDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, WxmpUpdateSendDataDTO.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 WxmpUpdateSendDataDTO get(String id) { + WxmpUpdateSendDataEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, WxmpUpdateSendDataDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(WxmpUpdateSendDataDTO dto) { + WxmpUpdateSendDataEntity entity = ConvertUtils.sourceToTarget(dto, WxmpUpdateSendDataEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(WxmpUpdateSendDataDTO dto) { + WxmpUpdateSendDataEntity entity = ConvertUtils.sourceToTarget(dto, WxmpUpdateSendDataEntity.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/WxmpUpdateSendRecordServiceImpl.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpUpdateSendRecordServiceImpl.java new file mode 100644 index 0000000000..98b61d4444 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpUpdateSendRecordServiceImpl.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.WxmpUpdateSendRecordDao; +import com.epmet.dto.WxmpUpdateSendRecordDTO; +import com.epmet.entity.WxmpUpdateSendRecordEntity; +import com.epmet.redis.WxmpUpdateSendRecordRedis; +import com.epmet.service.WxmpUpdateSendRecordService; +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 qu qu@elink-cn.com + * @since v1.0.0 2020-12-30 + */ +@Service +public class WxmpUpdateSendRecordServiceImpl extends BaseServiceImpl implements WxmpUpdateSendRecordService { + + @Autowired + private WxmpUpdateSendRecordRedis wxmpUpdateSendRecordRedis; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, WxmpUpdateSendRecordDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, WxmpUpdateSendRecordDTO.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 WxmpUpdateSendRecordDTO get(String id) { + WxmpUpdateSendRecordEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, WxmpUpdateSendRecordDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(WxmpUpdateSendRecordDTO dto) { + WxmpUpdateSendRecordEntity entity = ConvertUtils.sourceToTarget(dto, WxmpUpdateSendRecordEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(WxmpUpdateSendRecordDTO dto) { + WxmpUpdateSendRecordEntity entity = ConvertUtils.sourceToTarget(dto, WxmpUpdateSendRecordEntity.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/bootstrap.yml b/epmet-module/epmet-message/epmet-message-server/src/main/resources/bootstrap.yml index fc82a1608a..0639ecbfd2 100644 --- a/epmet-module/epmet-message/epmet-message-server/src/main/resources/bootstrap.yml +++ b/epmet-module/epmet-message/epmet-message-server/src/main/resources/bootstrap.yml @@ -137,4 +137,9 @@ dingTalk: shutdown: graceful: enable: true #是否开启优雅停机 - waitTimeSecs: 30 # 优雅停机等待时间,超过30秒,发出告警 \ No newline at end of file + waitTimeSecs: 30 # 优雅停机等待时间,超过30秒,发出告警 + +rocketmq: + name-server: @rocketmq.nameserver@ + producer: + group: @rocketmq.producer.group@ \ No newline at end of file diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/resources/db/migration/V0.3.12.6__add_subscribe_update.sql b/epmet-module/epmet-message/epmet-message-server/src/main/resources/db/migration/V0.3.12.6__add_subscribe_update.sql new file mode 100644 index 0000000000..a14887a385 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/resources/db/migration/V0.3.12.6__add_subscribe_update.sql @@ -0,0 +1,41 @@ +CREATE TABLE `wxmp_update_send_record` ( + `ID` varchar(64) NOT NULL COMMENT '主键', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户Id ', + `GRID_ID` varchar(64) DEFAULT NULL COMMENT '网格Id (居民端跟网格有关的则有值,工作端以及一些居民端和网格没关的存*)', + `CLIENT_TYPE` varchar(64) NOT NULL COMMENT '所属端类型 居民端:resi 工作端:gov', + `TEMPLATE_ID` varchar(64) NOT NULL COMMENT '消息模板Id ', + `USER_ID` varchar(64) NOT NULL COMMENT '用户Id', + `WX_OPEN_ID` varchar(64) DEFAULT NULL COMMENT 'openId ', + `BEHAVIOR_TYPE` varchar(128) NOT NULL COMMENT '行为类型: 关注更新提醒、内容更新消息通知', + `TITLE` varchar(128) NOT NULL COMMENT '消息标题 ', + `CONTENT` varchar(1024) NOT NULL COMMENT '消息内容 ', + `TIME` datetime NOT NULL COMMENT '消息时间 ', + `RESULT` varchar(32) NOT NULL COMMENT '发送结果(成功:success 失败:error)', + `REASON` varchar(1024) DEFAULT NULL COMMENT '发送失败的原因,成功可以不记录', + `DEL_FLAG` varchar(1) NOT NULL COMMENT '删除标识', + `REVISION` int(11) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='订阅消息发送记录表(内容更新消息提醒、关注更新提醒)'; + +CREATE TABLE `wxmp_update_send_data` ( + `ID` varchar(32) NOT NULL COMMENT '主键', + `SOURCE_TYPE` varchar(32) NOT NULL COMMENT '来源类型 (话题:topic 议题:issue 项目project 爱心互助heart 党建声音voice)', + `SOURCE_ID` varchar(32) NOT NULL COMMENT '来源对应ID', + `CUSTOMER_ID` varchar(32) NOT NULL COMMENT '客户ID', + `AGENCY_ID` varchar(32) DEFAULT NULL COMMENT '组织ID agencyId', + `GRID_ID` varchar(32) DEFAULT NULL COMMENT '网格ID ', + `GROUP_ID` varchar(32) DEFAULT NULL COMMENT '小组Id', + `STAFF_ID` varchar(32) DEFAULT NULL COMMENT '工作人员Id', + `MSG_USER_ID` varchar(1024) DEFAULT NULL COMMENT '消息接收者', + `DEL_FLAG` varchar(1) NOT NULL DEFAULT '0' COMMENT '删除标识 0未删除、1已删除', + `REVISION` int(11) NOT NULL DEFAULT '0' COMMENT '乐观锁', + `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='订阅消息发送数据表(内容更新消息提醒、关注更新提醒)'; diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/resources/db/migration/V0.3.13__create_sys_msg_table.sql b/epmet-module/epmet-message/epmet-message-server/src/main/resources/db/migration/V0.3.13__create_sys_msg_table.sql new file mode 100644 index 0000000000..4796003268 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/resources/db/migration/V0.3.13__create_sys_msg_table.sql @@ -0,0 +1,13 @@ +CREATE TABLE `system_message` ( + `ID` varchar(64) NOT NULL COMMENT '主键', + `MSG_TYPE` varchar(32) NOT NULL COMMENT '消息类型。init_customer:客户初始化', + `SEND_APPROACH` varchar(32) NOT NULL COMMENT '消息发送途径', + `CONTENT` varchar(1024) NOT NULL COMMENT '消息内容', + `REVISION` int(11) DEFAULT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人(发布消息的人)', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + `DEL_FLAG` varchar(1) NOT NULL COMMENT '删除标记 0:未删除,1:已删除', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT COMMENT='系统消息表' \ No newline at end of file diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/SystemMessageDao.xml b/epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/SystemMessageDao.xml new file mode 100644 index 0000000000..a5ce6d9da5 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/SystemMessageDao.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/WxmpUpdateSendDataDao.xml b/epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/WxmpUpdateSendDataDao.xml new file mode 100644 index 0000000000..3067841eaf --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/WxmpUpdateSendDataDao.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/WxmpUpdateSendRecordDao.xml b/epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/WxmpUpdateSendRecordDao.xml new file mode 100644 index 0000000000..481ec4beea --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/WxmpUpdateSendRecordDao.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/ResiAroundPartyPointRankFormDTO.java b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/ResiAroundPartyPointRankFormDTO.java new file mode 100644 index 0000000000..ea20744f4c --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/ResiAroundPartyPointRankFormDTO.java @@ -0,0 +1,49 @@ +package com.epmet.dto.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import java.io.Serializable; +import java.util.List; + +/** + * @Description 身边党员 积分排行接口 入参 + * @Auth zy + */ +@Data +public class ResiAroundPartyPointRankFormDTO implements Serializable { + private static final long serialVersionUID = 1534061512200591149L; + + /** + * 页码 + * */ + @Min(value = 1) + private Integer pageNo = 1; + + /** + * 每页数据条数 + * */ + private Integer pageSize = 10; + + /** + * 身边党员 grid 社区党员community + * */ + private String scope; + + /** + * 本月 monthly 总排行 all; + * */ + private String type; + + /** + * 当前网格id + * */ + private String gridId; + + /** + * 通过网格id,获取到的 网格下的 认证成功的党员 的用户id + * */ + private List userIds; +} diff --git a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/ResiAroundPartyPointRankResultDTO.java b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/ResiAroundPartyPointRankResultDTO.java new file mode 100644 index 0000000000..33c9ba5ffb --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/ResiAroundPartyPointRankResultDTO.java @@ -0,0 +1,39 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description 身边党员 积分排行接口返参DTO + * @Auth zy + */ +@Data +public class ResiAroundPartyPointRankResultDTO implements Serializable { + private static final long serialVersionUID = 685408245193506541L; + + /** + * 排序 + * */ + private Integer ranking; + + /** + * 积分 + * */ + private Integer point; + + /** + * 头像 + * */ + private String userHeadPhoto; + + /** + * 名称 + * */ + private String realName; + + /** + * 用户id + * */ + private String userId; +} diff --git a/epmet-module/epmet-point/epmet-point-server/pom.xml b/epmet-module/epmet-point/epmet-point-server/pom.xml index 1b9ea82526..d582216f11 100644 --- a/epmet-module/epmet-point/epmet-point-server/pom.xml +++ b/epmet-module/epmet-point/epmet-point-server/pom.xml @@ -240,7 +240,7 @@ --> 8112 - test + prod diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/common/enu/AroundPartyConstant.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/common/enu/AroundPartyConstant.java new file mode 100644 index 0000000000..43a1a8498a --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/common/enu/AroundPartyConstant.java @@ -0,0 +1,28 @@ +/** + * Copyright (c) 2018 人人开源 All rights reserved. + * + * https://www.renren.io + * + * 版权所有,侵权必究! + */ + +package com.epmet.common.enu; + +import com.epmet.commons.tools.constant.Constant; + +/** + * 身边党员-积分排行 入参常量 + * + * @author Mark sunlightcs@gmail.com + * @since 1.1.0 + */ +public interface AroundPartyConstant extends Constant { + + String ALL = "all"; + + String MONTHLY = "monthly"; + + String GRID = "grid"; + + String COMMUNITY = "community"; +} diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/AdjustmentController.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/AdjustmentController.java index 535b717e0c..f610a25df6 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/AdjustmentController.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/AdjustmentController.java @@ -97,4 +97,3 @@ public class AdjustmentController { return new Result(); } } - diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/ResiPointController.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/ResiPointController.java index f4e5ce6bb4..5c3b666fa1 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/ResiPointController.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/ResiPointController.java @@ -6,11 +6,9 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.form.CommonPageUserFormDTO; import com.epmet.dto.form.CommonUserFormDTO; +import com.epmet.dto.form.ResiAroundPartyPointRankFormDTO; import com.epmet.dto.form.ResiPointRankFormDTO; -import com.epmet.dto.result.PointExchangeResponseResultDTO; -import com.epmet.dto.result.ResiPointDetailResultDTO; -import com.epmet.dto.result.ResiPointLogListResultDTO; -import com.epmet.dto.result.ResiPointRankListResultDTO; +import com.epmet.dto.result.*; import com.epmet.service.PointVerificationLogService; import com.epmet.service.UserPointActionLogService; import com.epmet.service.UserPointStatisticalDailyService; @@ -141,4 +139,21 @@ public class ResiPointController { public Result exchangeCallback(@LoginUser TokenDto tokenDto){ return new Result().ok(pointVerificationLogService.resiExchangeCallback(tokenDto.getUserId())); } + + /** + * 身边党员-积分排行 + * 查询规则: scope : grid && type :monthly 表示:按网格统计,对本月党员增加的积分 进行排序 + * scope : grid && type :all 表示:按网格统计,对党员累计可用积分 排序 + * scope : community && type :monthly 表示:按社区统计,对本月党员增加的积分 进行排序 + * scope : community && type :all 表示:按社区统计,对党员累计可用积分 排序 + * @param formDTO + * @return com.epmet.commons.tools.utils.Result> + * @Author zhangyong + * @Date 16:17 2020-12-28 + **/ + @PostMapping("aroundparty") + public Result> aroundPartyPointRank( @RequestBody ResiAroundPartyPointRankFormDTO formDTO){ + List resultDTOS = userPointStatisticalDailyService.listAroundPartyPointRank(formDTO); + return new Result>().ok(resultDTOS); + } } diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/UserPointStatisticalDailyDao.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/UserPointStatisticalDailyDao.java index 9f9783797d..63a3e68c1c 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/UserPointStatisticalDailyDao.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/UserPointStatisticalDailyDao.java @@ -18,6 +18,8 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.form.ResiAroundPartyPointRankFormDTO; +import com.epmet.dto.result.ResiAroundPartyPointRankResultDTO; import com.epmet.dto.result.ResiPointRankResultDTO; import com.epmet.entity.UserPointStatisticalDailyEntity; import org.apache.ibatis.annotations.Mapper; @@ -62,4 +64,22 @@ public interface UserPointStatisticalDailyDao extends BaseDao + * @Author zhangyong + * @Date 09:24 2020-12-29 + **/ + List selectListGridPartyRankByUsablePoint(ResiAroundPartyPointRankFormDTO formDTO); + + /** + * 身边党员-积分排行 :按网格统计,对本月党员增加的积分 进行排序 + * @param formDTO + * @return java.util.List + * @Author zhangyong + * @Date 09:24 2020-12-29 + **/ + List selectListGridPartyRankByMonth(ResiAroundPartyPointRankFormDTO formDTO); +} diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/UserPointStatisticalDailyService.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/UserPointStatisticalDailyService.java index 9d3f2d3ecf..6630a87891 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/UserPointStatisticalDailyService.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/UserPointStatisticalDailyService.java @@ -20,7 +20,9 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; import com.epmet.dto.UserPointStatisticalDailyDTO; +import com.epmet.dto.form.ResiAroundPartyPointRankFormDTO; import com.epmet.dto.form.ResiPointRankFormDTO; +import com.epmet.dto.result.ResiAroundPartyPointRankResultDTO; import com.epmet.dto.result.ResiPointRankListResultDTO; import com.epmet.entity.UserPointStatisticalDailyEntity; @@ -114,4 +116,13 @@ public interface UserPointStatisticalDailyService extends BaseService> + * @Author zhangyong + * @Date 16:17 2020-12-28 + **/ + List listAroundPartyPointRank(ResiAroundPartyPointRankFormDTO formDTO); +} diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointStatisticalDailyServiceImpl.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointStatisticalDailyServiceImpl.java index a36a0c39d9..8b0b408d8a 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointStatisticalDailyServiceImpl.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointStatisticalDailyServiceImpl.java @@ -19,21 +19,23 @@ package com.epmet.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.common.enu.AroundPartyConstant; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; -import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.utils.Result; import com.epmet.dao.UserPointStatisticalDailyDao; import com.epmet.dto.UserPointStatisticalDailyDTO; +import com.epmet.dto.form.ResiAroundPartyPointRankFormDTO; import com.epmet.dto.form.ResiPointRankFormDTO; -import com.epmet.dto.result.ResiPointRankListResultDTO; -import com.epmet.dto.result.ResiPointRankResultDTO; -import com.epmet.dto.result.ResiPointRankingResultDTO; -import com.epmet.dto.result.UserBaseInfoResultDTO; +import com.epmet.dto.result.*; import com.epmet.entity.UserPointStatisticalDailyEntity; import com.epmet.feign.EpmetUserOpenFeignClient; +import com.epmet.feign.GovOrgOpenFeignClient; +import com.epmet.resi.partymember.dto.partymember.PartymemberInfoDTO; +import com.epmet.resi.partymember.feign.ResiPartyMemberOpenFeignClient; import com.epmet.service.UserPointStatisticalDailyService; import com.epmet.utils.DimIdGenerator; import com.epmet.utils.ModuleConstant; @@ -59,6 +61,10 @@ public class UserPointStatisticalDailyServiceImpl extends BaseServiceImpl page(Map params) { @@ -230,5 +236,104 @@ public class UserPointStatisticalDailyServiceImpl extends BaseServiceImpl listAroundPartyPointRank(ResiAroundPartyPointRankFormDTO formDTO) { + // 0、查询条件 + formDTO.setPageNo((formDTO.getPageNo() - NumConstant.ONE) * formDTO.getPageSize()); + List resultDTOS = new ArrayList<>(); + + // 增加边界条件 + if (StringUtils.isBlank(formDTO.getGridId()) || StringUtils.isBlank(formDTO.getScope()) || StringUtils.isBlank(formDTO.getType())){ + log.warn("入参错误 gridId:{} ; scope:{} ; type:{} ;", formDTO.getGridId(), formDTO.getScope(), formDTO.getType()); + return resultDTOS; + } + + List gridList = new ArrayList<>(); + // 1-1、获取参数中的网格id + if (AroundPartyConstant.GRID.equals(formDTO.getScope())){ + gridList.add(formDTO.getGridId()); + } + + // 1-2、获取社区(下的所有网格) 的网格id + if (AroundPartyConstant.COMMUNITY.equals(formDTO.getScope())){ + Result> gridInCommunity = govOrgOpenFeignClient.getGridIdsInCommunity(formDTO.getGridId()); + if (gridInCommunity.success() && null != gridInCommunity.getData() && gridInCommunity.getData().isEmpty()){ + log.warn("根据" + formDTO.getGridId() + "网格id, 查询不到同属于一个社区下的所有网格id"); + return resultDTOS; + } + gridList = gridInCommunity.getData(); + } + + // 2.根据网格id,获取网格下的所有党员(认证通过) + Result> partymemberInfo = resiPartyMemberOpenFeignClient.getPartymemberInfoByGridId(gridList); + if (partymemberInfo.success() && null != partymemberInfo.getData() && partymemberInfo.getData().isEmpty()){ + log.warn("根据" + formDTO.getGridId() + "网格id, 查询不到党员信息"); + return resultDTOS; + } + + // 2.1.获取认证通过党员的 用户id + List userIds = getUserIds(partymemberInfo.getData()); + formDTO.setUserIds(userIds); + + // 3.根据用户id(所有),查询积分信息,进行排名 + if (AroundPartyConstant.ALL.equals(formDTO.getType())){ + // type :all 表示:按网格(一个网格 或 社区下的所有网格)统计,对党员累计可用积分 排序 + resultDTOS = baseDao.selectListGridPartyRankByUsablePoint(formDTO); + + } else if (AroundPartyConstant.MONTHLY.equals(formDTO.getType())){ + // type :monthly 表示:按网格(一个网格 或 社区下的所有网格)统计,对本月党员增加的积分 进行排序 + resultDTOS = baseDao.selectListGridPartyRankByMonth(formDTO); + } -} \ No newline at end of file + // 4.给排好序的 身边党员-积分排行, 赋值 【头像、真实姓名】 + resultDTOS = getPartyBaseInfo(resultDTOS); + return resultDTOS; + } + + /** + * 获取认证通过的党员的 用户id + * + * @param partymemberInfo + * @return java.util.List + * @Author zhangyong + * @Date 14:11 2020-12-29 + **/ + private List getUserIds(List partymemberInfo){ + List userIds = new ArrayList<>(); + for (PartymemberInfoDTO dto : partymemberInfo){ + userIds.add(dto.getUserId()); + } + return userIds; + } + + /** + * 给排好序的 身边党员-积分排行, 赋值 【头像、真实姓名】 + * @param rankResultDTOS + * @return java.util.List + * @Author zhangyong + * @Date 10:14 2020-12-29 + **/ + private List getPartyBaseInfo(List rankResultDTOS){ + // 1.获取当前党员Id + List userIdParam = new LinkedList<>(); + for (ResiAroundPartyPointRankResultDTO formDTO : rankResultDTOS){ + userIdParam.add(formDTO.getUserId()); + } + if (userIdParam.size() == NumConstant.ZERO){ + return rankResultDTOS; + } + // 2.获取用户基本信息 + Result> myResiInfoResult = epmetUserOpenFeignClient.queryUserBaseInfo(userIdParam); + if(myResiInfoResult.success() && null != myResiInfoResult.getData() && !myResiInfoResult.getData().isEmpty()){ + for (UserBaseInfoResultDTO resiInfo : myResiInfoResult.getData()){ + for (ResiAroundPartyPointRankResultDTO formDTO : rankResultDTOS){ + if (formDTO.getUserId().equals(resiInfo.getUserId())){ + formDTO.setUserHeadPhoto(resiInfo.getHeadImgUrl()); + formDTO.setRealName(resiInfo.getRealName()); + } + } + } + } + return rankResultDTOS; + } +} diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/resources/db/migration/V0.0.4__addNewRuleTemplate.sql b/epmet-module/epmet-point/epmet-point-server/src/main/resources/db/migration/V0.0.4__addNewRuleTemplate.sql index 069008ec48..6c8838b5cf 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/resources/db/migration/V0.0.4__addNewRuleTemplate.sql +++ b/epmet-module/epmet-point/epmet-point-server/src/main/resources/db/migration/V0.0.4__addNewRuleTemplate.sql @@ -23,13 +23,13 @@ INSERT INTO point_rule_default ( VALUES ( '3','发布话题', - '对小组内话题进行15字以上评论','publish_one_topic', + '楼院小组内通过我有话说功能发布话题','publish_one_topic', '1','plus', 15,'每天上限为15分',null,'day',5,'time','0','0',0,'APP_USER',now(),'APP_USER',now() ), ( '4','参与话题', - '楼院小组内通过我有话说功能发布话题','participate_one_topic', + '对小组内话题进行15字以上评论','participate_one_topic', '1','plus', 6,'每天上限为6分',null,'day',2,'time','0','0',0,'APP_USER',now(),'APP_USER',now() ), diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/resources/db/migration/V0.0.5__editResiGroupRuleCode.sql b/epmet-module/epmet-point/epmet-point-server/src/main/resources/db/migration/V0.0.5__editResiGroupRuleCode.sql new file mode 100644 index 0000000000..4c3e4183f3 --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-server/src/main/resources/db/migration/V0.0.5__editResiGroupRuleCode.sql @@ -0,0 +1,4 @@ +update `point_rule_default` set event_code = 'invite_new_into_group' where event_code = 'invite_new_resident_into_group'; +update `point_rule_default` set event_code = 'invite_resi_into_group' where event_code = 'invite_resident_into_group'; +update `point_rule_default` set event_code = 'topic_to_issue' where event_code = 'topic_shifted_to_issue'; +update `point_rule_default` set event_code = 'topic_to_project' where event_code = 'topic_shifted_to_project'; \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/resources/db/migration/V0.0.6__editResiGroupRuleUpLimitDesc.sql b/epmet-module/epmet-point/epmet-point-server/src/main/resources/db/migration/V0.0.6__editResiGroupRuleUpLimitDesc.sql new file mode 100644 index 0000000000..04ae7bf19d --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-server/src/main/resources/db/migration/V0.0.6__editResiGroupRuleUpLimitDesc.sql @@ -0,0 +1,4 @@ +update `point_rule_default` set up_limit_desc = '每日该项所得积分总和上限,为0时表示没有积分上限' where event_code = 'publish_one_topic'; +update `point_rule_default` set up_limit_desc = '每日该项所得积分总和上限,为0时表示没有积分上限' where event_code = 'participate_one_topic'; +update `point_rule_default` set up_limit_desc = '每日该项所得积分总和上限,为0时表示没有积分上限' where event_code = 'shift_topic_to_issue'; +update `point_rule_default` set up_limit_desc = '每日该项所得积分总和上限,为0时表示没有积分上限' where event_code = 'invite_resi_into_group'; \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/resources/db/migration/V0.0.7__updateAllRuleLimitDesc.sql b/epmet-module/epmet-point/epmet-point-server/src/main/resources/db/migration/V0.0.7__updateAllRuleLimitDesc.sql new file mode 100644 index 0000000000..a298e20369 --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-server/src/main/resources/db/migration/V0.0.7__updateAllRuleLimitDesc.sql @@ -0,0 +1,2 @@ +update `point_rule_default` set up_limit_desc = '每日该项所得积分总和上限,为0时表示没有积分上限'; +update `point_rule` set up_limit_desc = '每日该项所得积分总和上限,为0时表示没有积分上限' \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/resources/db/migration/V0.0.8__updateRuleDesc.sql b/epmet-module/epmet-point/epmet-point-server/src/main/resources/db/migration/V0.0.8__updateRuleDesc.sql new file mode 100644 index 0000000000..b56029ee46 --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-server/src/main/resources/db/migration/V0.0.8__updateRuleDesc.sql @@ -0,0 +1,13 @@ +update `point_rule_default` set rule_desc = '通过话题/议题分享链接邀请新用户入组,且注册居民成功入组' where event_code = 'invite_new_into_group' and rule_name = '邀请新人入组'; + +update `point_rule_default` set rule_desc = '通过话题/议题分享链接邀请已注册用户入组,且通过入组审核' where event_code = 'invite_resi_into_group' and rule_name = '邀请入组'; + +update `point_rule_default` set rule_desc = '小组中发布的话题被组长转为议题,又被网格员转为项目' where event_code = 'topic_to_project' and rule_name = '话题被转为项目'; + + + +update `point_rule` set rule_desc = '通过话题/议题分享链接邀请新用户入组,且注册居民成功入组' where event_code = 'invite_new_into_group' and rule_name = '邀请新人入组'; + +update `point_rule` set rule_desc = '通过话题/议题分享链接邀请已注册用户入组,且通过入组审核' where event_code = 'invite_resi_into_group' and rule_name = '邀请入组'; + +update `point_rule` set rule_desc = '小组中发布的话题被组长转为议题,又被网格员转为项目' where event_code = 'topic_to_project' and rule_name = '话题被转为项目'; \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointStatisticalDailyDao.xml b/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointStatisticalDailyDao.xml index 9bb759ed72..983301e016 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointStatisticalDailyDao.xml +++ b/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointStatisticalDailyDao.xml @@ -130,4 +130,53 @@ - \ No newline at end of file + + + + + + diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/constant/ThirdConstant.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/constant/ThirdConstant.java new file mode 100644 index 0000000000..b72939808a --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/constant/ThirdConstant.java @@ -0,0 +1,17 @@ +package com.epmet.constant; + +/** + * @author zhaoqifeng + * @dscription + * @date 2021/1/19 9:43 + */ +public interface ThirdConstant { + /** + * 小程序 + */ + String MINI = "mini"; + /** + * 第三方app + */ + String APP = "app"; +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PaCustomerDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PaCustomerDTO.java index 8beef22698..c06721dc55 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PaCustomerDTO.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PaCustomerDTO.java @@ -48,6 +48,11 @@ public class PaCustomerDTO implements Serializable { */ private Integer isInitialize; + /** + * 客户类型 mini 微信小程序客户 app 第三方app客户 + */ + private String type; + /** * 数据来源(dev:开发 test:体验 prod:生产) */ diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/AddTemplateFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/AddTemplateFormDTO.java index edb391eb73..16491eb32e 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/AddTemplateFormDTO.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/AddTemplateFormDTO.java @@ -48,4 +48,9 @@ public class AddTemplateFormDTO implements Serializable { * 关键字名称 */ private List nameList; + + /** + * 是否同步到所有客户 + */ + private Boolean isSync = true; } diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/DelPersonalTempFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/DelPersonalTempFormDTO.java new file mode 100644 index 0000000000..9c49eeeccf --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/DelPersonalTempFormDTO.java @@ -0,0 +1,31 @@ +package com.epmet.dto.form; + +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.List; + +/** + * @author zhaoqifeng + * @dscription + * @date 2021/1/11 14:53 + */ +@NoArgsConstructor +@Data +public class DelPersonalTempFormDTO implements Serializable { + + private static final long serialVersionUID = -1445036628319660147L; + /** + * 客户ID + */ + private String customerId; + /** + * 所属端 居民端resi 工作端work + */ + private String clientType; + /** + * 模板id + */ + private List tempIdList; +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/InitAllFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/InitAllFormDTO.java new file mode 100644 index 0000000000..ed476cc3b6 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/InitAllFormDTO.java @@ -0,0 +1,26 @@ +package com.epmet.dto.form; + +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * @author zhaoqifeng + * @dscription + * @date 2021/1/11 14:47 + */ +@NoArgsConstructor +@Data +public class InitAllFormDTO implements Serializable { + + private static final long serialVersionUID = 5198153778356904936L; + /** + * 测试号APPID + */ + private String appId; + /** + * 模板ID + */ + private String tempId; +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/InitFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/InitFormDTO.java index ab154a196a..196128aff2 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/InitFormDTO.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/InitFormDTO.java @@ -36,4 +36,9 @@ public class InitFormDTO implements Serializable { * 工作端需要同步的模板id数组 */ private List workTempIdList; + + /** + * 1 已同步,0 未同步 + */ + private String sync; } diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/TemplateDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/TemplateDTO.java index 0229316e01..1fccf69f2d 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/TemplateDTO.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/TemplateDTO.java @@ -17,9 +17,14 @@ public class TemplateDTO implements Serializable { */ private String id; /** - * 模板ID + * 公共模板ID */ private String tmplId; + private String personalId; + /** + * 客户模板ID + */ + private String personalTempId; /** * 标题 */ diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/PaCustomerController.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/PaCustomerController.java index de5cc61d7a..d546f37046 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/PaCustomerController.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/PaCustomerController.java @@ -6,6 +6,8 @@ import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.group.DefaultGroup; +import com.epmet.dto.CustomerMpDTO; +import com.epmet.dto.PaCustomerDTO; import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.service.*; @@ -35,6 +37,12 @@ public class PaCustomerController { @Autowired private CustomerMpService customerMpService; + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + PaCustomerDTO data = paCustomerService.get(id); + return new Result().ok(data); + } + /** * @param formDTO * @return diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/SubscribeController.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/SubscribeController.java index 47d3b6d653..63a31e73b2 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/SubscribeController.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/SubscribeController.java @@ -146,4 +146,30 @@ public class SubscribeController { CustomerTempResultDTO result = subscribeService.getCustomerTemplate(formDTO); return new Result().ok(result); } + + /** + * 同步单一模板到所有客户 + * @author zhaoqifeng + * @date 2021/1/11 14:49 + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + */ + @PostMapping("initall") + public Result initAll(@RequestBody InitAllFormDTO formDTO) { + subscribeService.initAll(formDTO); + return new Result(); + } + + /** + * 删除客户模板 + * @author zhaoqifeng + * @date 2021/1/11 14:54 + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + */ + @PostMapping("delpersonaltemp") + public Result delPersonalTemp(@RequestBody DelPersonalTempFormDTO formDTO) { + subscribeService.delPersonalTemp(formDTO); + return new Result(); + } } 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 93fe3d2d95..054712bea0 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 @@ -105,4 +105,6 @@ public interface PersonalTemplateDao extends BaseDao { List selectListByKey(@Param("appId") String appId, @Param("tid") String tid, @Param("keyIds") String keyIds); List selectTemplateListV2(TemplateListV2FormDTO formDTO); + + PersonalTemplateDTO getTempByPid(); } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/PaCustomerEntity.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/PaCustomerEntity.java index 71a5cf6fc4..d2731cf9bd 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/PaCustomerEntity.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/PaCustomerEntity.java @@ -48,6 +48,11 @@ public class PaCustomerEntity extends BaseEpmetEntity { */ private Integer isInitialize; + /** + * 客户类型 mini 微信小程序客户 app 第三方app客户 + */ + private String type; + /** * 数据来源(dev:开发 test:体验 prod:生产) */ 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 1f3540a90f..a586844667 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 @@ -156,4 +156,14 @@ public interface PersonalTemplateService extends BaseService getListByKey(String appId, String tid, String keyIds); List templateListV2(TemplateListV2FormDTO formDTO); + + /** + * 获取个人模板 + * @author zhaoqifeng + * @date 2021/1/11 15:32 + * @param customerId + * @param pid + * @return com.epmet.dto.PersonalTemplateDTO + */ + PersonalTemplateDTO getTempByPid(String customerId, String pid); } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/SubscribeService.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/SubscribeService.java index c56d17487a..6790a2aa15 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/SubscribeService.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/SubscribeService.java @@ -102,4 +102,22 @@ public interface SubscribeService { */ CustomerTempResultDTO getCustomerTemplate(InitFormDTO formDTO); + /** + * 同步单一模板到所有客户 + * @author zhaoqifeng + * @date 2021/1/11 14:49 + * @param formDTO + * @return void + */ + void initAll(InitAllFormDTO formDTO); + + /** + * 删除客户模板 + * @author zhaoqifeng + * @date 2021/1/11 14:54 + * @param formDTO + * @return void + */ + void delPersonalTemp(DelPersonalTempFormDTO formDTO); + } 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 e230b87f3b..adabeb3a69 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 @@ -141,15 +141,19 @@ public class CodeServiceImpl implements CodeService { if(CodeConstant.RESI.equals(formDTO.getClientType())) { resiName = getNickName(authInfo.getAuthorizerAppid()); AuthorizationInfoDTO workAuthInfo = authorizationInfoDao.getAuthInfoByCustomer(formDTO.getCustomerId(), CodeConstant.WORK); - workName = getNickName(workAuthInfo.getAuthorizerAppid()); + if (null != workAuthInfo) { + workName = getNickName(workAuthInfo.getAuthorizerAppid()); + miniInfoDao.updateNickName(formDTO.getCustomerId(), CodeConstant.WORK, workName); + } miniInfoDao.updateNickName(formDTO.getCustomerId(), formDTO.getClientType(), resiName); - miniInfoDao.updateNickName(formDTO.getCustomerId(), CodeConstant.WORK, workName); } else { workName = getNickName(authInfo.getAuthorizerAppid()); AuthorizationInfoDTO resiAuthInfo = authorizationInfoDao.getAuthInfoByCustomer(formDTO.getCustomerId(), CodeConstant.RESI); - resiName = getNickName(resiAuthInfo.getAuthorizerAppid()); + if (null != resiAuthInfo) { + resiName = getNickName(resiAuthInfo.getAuthorizerAppid()); + miniInfoDao.updateNickName(formDTO.getCustomerId(), CodeConstant.RESI, resiName); + } miniInfoDao.updateNickName(formDTO.getCustomerId(), formDTO.getClientType(), workName); - miniInfoDao.updateNickName(formDTO.getCustomerId(), CodeConstant.RESI, resiName); } //获取小程序居民端与工作端名称 @@ -828,6 +832,7 @@ public class CodeServiceImpl implements CodeService { } private String getNickName(String appId) { + String nickName = ""; JSONObject jsonObject = new JSONObject(); jsonObject.put(ModuleConstant.COMPONENT_APP_ID,componentAppId); jsonObject.put(ModuleConstant.AUTHORIZER_APP_ID,appId); @@ -835,8 +840,10 @@ public class CodeServiceImpl implements CodeService { String data = HttpClientManager.getInstance().sendPostByJSON(WxMaCodeConstant.API_GET_AUTHORIZER_INFO + componentAccessToken , JSON.toJSONString(jsonObject)).getData(); Map map = JSON.parseObject(data, Map.class); Map authInfo = (Map) map.get(ModuleConstant.AUTHORIZER_INFO); - ConvertUtils.mapToEntity(authInfo, MiniInfoFormDTO.class).getNick_name(); - return ConvertUtils.mapToEntity(authInfo, MiniInfoFormDTO.class).getNick_name(); + if (StringUtils.isNotEmpty(ConvertUtils.mapToEntity(authInfo, MiniInfoFormDTO.class).getNick_name())) { + nickName = ConvertUtils.mapToEntity(authInfo, MiniInfoFormDTO.class).getNick_name(); + } + return nickName; } } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CustomerMpServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CustomerMpServiceImpl.java index b716dff1b9..f19b241bef 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CustomerMpServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CustomerMpServiceImpl.java @@ -142,6 +142,9 @@ public class CustomerMpServiceImpl extends BaseServiceImpl templateListV2(TemplateListV2FormDTO formDTO) { return baseDao.selectTemplateListV2(formDTO); } + + /** + * 获取个人模板 + * + * @param customerId + * @param pid + * @return com.epmet.dto.PersonalTemplateDTO + * @author zhaoqifeng + * @date 2021/1/11 15:32 + */ + @Override + public PersonalTemplateDTO getTempByPid(String customerId, String pid) { + return baseDao.selectSetTemp(customerId, pid); + } } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/SubscribeServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/SubscribeServiceImpl.java index 6d212b75ee..b51c32632e 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/SubscribeServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/SubscribeServiceImpl.java @@ -199,44 +199,46 @@ public class SubscribeServiceImpl implements SubscribeService { personalTemplateDTO.setKeyWords(keywords); personalTemplateDTO.setType(formDTO.getType()); personalTemplateService.save(personalTemplateDTO); - //获取客户列表 - List customerList = paCustomerService.getCustomerListByTestId(authInfo.getCustomerId()); - List customerNames = new ArrayList<>(); - if (null != customerList && customerList.size() > NumConstant.ZERO) { - for (PaCustomerDTO paCustomerDTO : customerList) { - //获取小程序调用令牌 - AuthorizationInfoDTO authDTO = authorizationInfoDao.getAuthInfoByCustomer(paCustomerDTO.getId(), authInfo.getClientType()); - if (null == authDTO) { - log.error("客户[" + paCustomerDTO.getCustomerName() + "]未授权"); - customerNames.add(paCustomerDTO.getCustomerName()); - continue; - } - WxResult wxResult1 = wxMaSubscribeService.addTemplate(authDTO.getAuthorizerAccessToken(), request); - if (!wxResult1.success()) { - log.error("客户[" + paCustomerDTO.getCustomerName() + "]添加模板失败,原因:" + wxResult1.getErrorCode() + wxResult1.getErrorMsg()); - customerNames.add(paCustomerDTO.getCustomerName()); - continue; + if (formDTO.getIsSync()) { + //获取客户列表 + List customerList = paCustomerService.getCustomerListByTestId(authInfo.getCustomerId()); + List customerNames = new ArrayList<>(); + if (null != customerList && customerList.size() > NumConstant.ZERO) { + for (PaCustomerDTO paCustomerDTO : customerList) { + //获取小程序调用令牌 + AuthorizationInfoDTO authDTO = authorizationInfoDao.getAuthInfoByCustomer(paCustomerDTO.getId(), authInfo.getClientType()); + if (null == authDTO) { + log.error("客户[" + paCustomerDTO.getCustomerName() + "]未授权"); + customerNames.add(paCustomerDTO.getCustomerName()); + continue; + } + WxResult wxResult1 = wxMaSubscribeService.addTemplate(authDTO.getAuthorizerAccessToken(), request); + if (!wxResult1.success()) { + log.error("客户[" + paCustomerDTO.getCustomerName() + "]添加模板失败,原因:" + wxResult1.getErrorCode() + wxResult1.getErrorMsg()); + customerNames.add(paCustomerDTO.getCustomerName()); + continue; + } + String tmplId = wxResult1.getData(); + PersonalTemplateDTO templateDTO = new PersonalTemplateDTO(); + templateDTO.setCustomerId(paCustomerDTO.getId()); + templateDTO.setClientType(authInfo.getClientType()); + templateDTO.setAppId(authDTO.getAuthorizerAppid()); + templateDTO.setPid(priTmplId); + templateDTO.setPriTmplId(tmplId); + templateDTO.setTid(formDTO.getTid()); + templateDTO.setKeyIds(keyIds); + templateDTO.setTitle(formDTO.getTitle()); + templateDTO.setSceneDesc(formDTO.getSceneDesc()); + templateDTO.setKeyWords(keywords); + templateDTO.setType(formDTO.getType()); + personalTemplateService.save(templateDTO); } - String tmplId = wxResult1.getData(); - PersonalTemplateDTO templateDTO = new PersonalTemplateDTO(); - templateDTO.setCustomerId(paCustomerDTO.getId()); - templateDTO.setClientType(authInfo.getClientType()); - templateDTO.setAppId(authDTO.getAuthorizerAppid()); - templateDTO.setPid(priTmplId); - templateDTO.setPriTmplId(tmplId); - templateDTO.setTid(formDTO.getTid()); - templateDTO.setKeyIds(keyIds); - templateDTO.setTitle(formDTO.getTitle()); - templateDTO.setSceneDesc(formDTO.getSceneDesc()); - templateDTO.setKeyWords(keywords); - templateDTO.setType(formDTO.getType()); - personalTemplateService.save(templateDTO); } - } - if (customerNames.size() > NumConstant.ZERO) { - String names = String.join(",", customerNames); - throw new RenException("客户[" + names + "]添加模板失败"); + if (customerNames.size() > NumConstant.ZERO) { + String names = String.join(",", customerNames); + throw new RenException("客户[" + names + "]添加模板失败"); + } } } @@ -348,7 +350,6 @@ public class SubscribeServiceImpl implements SubscribeService { log.error("居民端同步失败:" + wxResult.getErrorCode() + wxResult.getErrorMsg()); } }); - resultDTO.setResiList(resiList); AuthorizationInfoDTO workAuthDTO = authorizationInfoDao.getAuthInfoByCustomer(formDTO.getCustomerId(), "work"); if (null == workAuthDTO) { @@ -371,10 +372,100 @@ public class SubscribeServiceImpl implements SubscribeService { log.error("工作端同步失败:" + wxResult.getErrorCode() + wxResult.getErrorMsg()); } }); + +// resultDTO.setResiList(resiList.stream().filter(item -> formDTO.getSync().equals(item.getState())).collect(Collectors.toList())); +// resultDTO.setWorkList(workList.stream().filter(item -> formDTO.getSync().equals(item.getState())).collect(Collectors.toList())); + resultDTO.setResiList(resiList); resultDTO.setWorkList(workList); return resultDTO; } + /** + * 同步单一模板到所有客户 + * + * @param formDTO + * @return void + * @author zhaoqifeng + * @date 2021/1/11 14:49 + */ + @Override + public void initAll(InitAllFormDTO formDTO) { + AuthorizationInfoDTO authInfo = authorizationInfoDao.selectInfoByAppId(formDTO.getAppId()); + PersonalTemplateDTO publicDTO = personalTemplateService.getTempByPid(authInfo.getCustomerId(), formDTO.getTempId()); + + //获取客户列表 + List customerList = paCustomerService.getCustomerListByTestId(authInfo.getCustomerId()); + List customerNames = new ArrayList<>(); + if (null != customerList && customerList.size() > NumConstant.ZERO) { + for (PaCustomerDTO paCustomerDTO : customerList) { + PersonalTemplateDTO personalTemplateDTO = personalTemplateService.getTempByPid(paCustomerDTO.getId(), publicDTO.getPriTmplId()); + if (null == personalTemplateDTO) { + //获取小程序调用令牌 + AuthorizationInfoDTO authDTO = authorizationInfoDao.getAuthInfoByCustomer(paCustomerDTO.getId(), authInfo.getClientType()); + + List keyIds = Arrays.asList(publicDTO.getKeyIds().split(",")); + List keyIdList = keyIds.stream().map(Integer::parseInt).collect(Collectors.toList()); + WxAddTemplateReq request = new WxAddTemplateReq(); + request.setTid(publicDTO.getTid()); + request.setKidList(keyIdList); + request.setSceneDesc(publicDTO.getSceneDesc()); + WxResult wxResult = wxMaSubscribeService.addTemplate(authInfo.getAuthorizerAccessToken(), request); + if (null == authDTO) { + log.error("客户[" + paCustomerDTO.getCustomerName() + "]未授权"); + customerNames.add(paCustomerDTO.getCustomerName()); + continue; + } + + String tmplId = wxResult.getData(); + PersonalTemplateDTO templateDTO = new PersonalTemplateDTO(); + templateDTO.setCustomerId(paCustomerDTO.getId()); + templateDTO.setClientType(authInfo.getClientType()); + templateDTO.setAppId(authDTO.getAuthorizerAppid()); + templateDTO.setPid(publicDTO.getPriTmplId()); + templateDTO.setPriTmplId(tmplId); + templateDTO.setTid(publicDTO.getTid()); + templateDTO.setKeyIds(publicDTO.getKeyIds()); + templateDTO.setTitle(publicDTO.getTitle()); + templateDTO.setSceneDesc(publicDTO.getSceneDesc()); + templateDTO.setKeyWords(publicDTO.getKeyWords()); + templateDTO.setType(publicDTO.getType()); + personalTemplateService.save(templateDTO); + } + } + } + + if (customerNames.size() > NumConstant.ZERO) { + String names = String.join(",", customerNames); + log.error("客户[" + names + "]添加模板失败"); + } + } + + /** + * 删除客户模板 + * + * @param formDTO + * @return void + * @author zhaoqifeng + * @date 2021/1/11 14:54 + */ + @Override + public void delPersonalTemp(DelPersonalTempFormDTO formDTO) { + AuthorizationInfoDTO authInfo = authorizationInfoDao.getAuthInfoByCustomer(formDTO.getCustomerId(), formDTO.getClientType()); + if (null == authInfo) { + throw new RenException("未授权或token已过期"); + } + formDTO.getTempIdList().forEach(tempId -> { + PersonalTemplateDTO dto = personalTemplateService.get(tempId); + WxDelTemplateReq request = new WxDelTemplateReq(); + request.setPriTmplId(dto.getPriTmplId()); + WxResult wxResult = wxMaSubscribeService.delTemplate(authInfo.getAuthorizerAccessToken(), request); + if (!wxResult.success()) { + throw new RenException(wxResult.getErrorCode(), wxResult.getErrorMsg()); + } + personalTemplateService.deleteById(dto.getId()); + }); + } + private WxGetCategoryResult getCategoryResult(String accessToken) { WxResult wxResult = wxMaSubscribeService.getCategory(accessToken); diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/db/migration/V0.0.12__alter_pa_customer.sql b/epmet-module/epmet-third/epmet-third-server/src/main/resources/db/migration/V0.0.12__alter_pa_customer.sql new file mode 100644 index 0000000000..b7b4f4f770 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/db/migration/V0.0.12__alter_pa_customer.sql @@ -0,0 +1,3 @@ +ALTER TABLE `pa_customer` +ADD COLUMN `TYPE` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT 'mini' +COMMENT '客户类型 mini 微信小程序客户 app 第三方app客户' AFTER `IS_INITIALIZE`; \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaCustomerDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaCustomerDao.xml index 9926104565..ae01037bc0 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaCustomerDao.xml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaCustomerDao.xml @@ -102,7 +102,8 @@ AND ai.CLIENT_TYPE = #{clientType} ORDER BY - pc.CUSTOMER_NAME, + pc.created_time DESC, + ai.CLIENT_TYPE 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 26c12ac4ec..644cda2bc6 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 @@ -39,7 +39,17 @@ + + + diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectProcessServiceImpl.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectProcessServiceImpl.java index 549b58fdbe..8575f2d4a8 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectProcessServiceImpl.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectProcessServiceImpl.java @@ -35,11 +35,13 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.ScanContentUtils; import com.epmet.constant.ProjectConstant; import com.epmet.constant.ReadFlagConstant; +import com.epmet.constant.SmsTemplateConstant; import com.epmet.constant.UserMessageConstant; import com.epmet.dao.ProjectOrgRelationDao; import com.epmet.dao.ProjectDao; import com.epmet.dao.ProjectProcessDao; import com.epmet.dao.ProjectStaffDao; +import com.epmet.dto.CustomerStaffDTO; import com.epmet.dto.ProjectDTO; import com.epmet.dto.ProjectProcessDTO; import com.epmet.dto.ProjectStaffDTO; @@ -305,6 +307,7 @@ public class ProjectProcessServiceImpl extends BaseServiceImpl smsList = new ArrayList<>(); + staffList.forEach(staff -> { + CustomerStaffDTO staffDTO = new CustomerStaffDTO(); + staffDTO.setUserId(staff.getStaffId()); + Result staffResult = epmetUserFeignClient.getCustomerStaffInfoByUserId(staffDTO); + if (staffResult.success() && null != staffResult.getData()) { + ProjectSendMsgFormDTO sms = new ProjectSendMsgFormDTO(); + sms.setCustomerId(staffResult.getData().getCustomerId()); + sms.setMobile(staffResult.getData().getMobile()); + sms.setAliyunTemplateCode(SmsTemplateConstant.PROJECT_TRANSFER); + sms.setParameterKey("send_msg"); + smsList.add(sms); + } + }); + Result result = epmetMessageOpenFeignClient.projectSendMsg(smsList); + if (!result.success()) { + logger.error("项目流转,发送手机短信失败" + JSON.toJSONString(result)); + } + } /** @@ -684,6 +708,26 @@ public class ProjectProcessServiceImpl extends BaseServiceImpl smsList = new ArrayList<>(); + staffList.forEach(staff -> { + CustomerStaffDTO staffDTO = new CustomerStaffDTO(); + staffDTO.setUserId(staff.getStaffId()); + Result staffResult = epmetUserFeignClient.getCustomerStaffInfoByUserId(staffDTO); + if (staffResult.success() && null != staffResult.getData()) { + ProjectSendMsgFormDTO sms = new ProjectSendMsgFormDTO(); + sms.setCustomerId(staffResult.getData().getCustomerId()); + sms.setMobile(staffResult.getData().getMobile()); + sms.setAliyunTemplateCode(SmsTemplateConstant.PROJECT_TRANSFER); + sms.setParameterKey("send_msg"); + smsList.add(sms); + } + }); + Result result = epmetMessageOpenFeignClient.projectSendMsg(smsList); + if (!result.success()) { + logger.error("项目流转,发送手机短信失败" + JSON.toJSONString(result)); + } } } \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java index 1a93868918..a72ad4c6f2 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java @@ -33,6 +33,7 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.ScanContentUtils; import com.epmet.constant.ParameterKeyConstant; import com.epmet.constant.ProjectConstant; +import com.epmet.constant.SmsTemplateConstant; import com.epmet.constant.UserMessageConstant; import com.epmet.dao.ProjectDao; import com.epmet.dao.ProjectOrgRelationDao; @@ -767,6 +768,24 @@ public class ProjectServiceImpl extends BaseServiceImpl smsList = new ArrayList<>(); + CustomerStaffDTO staffDTO = new CustomerStaffDTO(); + staffDTO.setUserId(projectStaffDTO.getStaffId()); + Result staffResult = epmetUserFeignClient.getCustomerStaffInfoByUserId(staffDTO); + if (staffResult.success() && null != staffResult.getData()) { + ProjectSendMsgFormDTO sms = new ProjectSendMsgFormDTO(); + sms.setCustomerId(staffResult.getData().getCustomerId()); + sms.setMobile(staffResult.getData().getMobile()); + sms.setAliyunTemplateCode(SmsTemplateConstant.PROJECT_TRANSFER); + sms.setParameterKey("send_msg"); + smsList.add(sms); + } + result = epmetMessageOpenFeignClient.projectSendMsg(smsList); + if (!result.success()) { + logger.error("项目退回,发送手机短信失败" + JSON.toJSONString(result)); + } } @Override @@ -993,6 +1012,25 @@ public class ProjectServiceImpl extends BaseServiceImpl smsList = new ArrayList<>(); + staffList.forEach(staff -> { + CustomerStaffDTO staffDTO = new CustomerStaffDTO(); + staffDTO.setUserId(staff.getStaffId()); + Result staffDTOResult = epmetUserFeignClient.getCustomerStaffInfoByUserId(staffDTO); + if (staffDTOResult.success() && null != staffDTOResult.getData()) { + ProjectSendMsgFormDTO sms = new ProjectSendMsgFormDTO(); + sms.setCustomerId(staffDTOResult.getData().getCustomerId()); + sms.setMobile(staffDTOResult.getData().getMobile()); + sms.setAliyunTemplateCode(SmsTemplateConstant.PROJECT_TRANSFER); + sms.setParameterKey("send_msg"); + smsList.add(sms); + } + }); + Result result = epmetMessageOpenFeignClient.projectSendMsg(smsList); + if (!result.success()) { + logger.error("项目吹哨,发送手机短信失败" + JSON.toJSONString(result)); + } return issueProjectResultDTO; } @@ -1380,6 +1418,8 @@ public class ProjectServiceImpl extends BaseServiceImpl msgList = new ArrayList<>(); //10.29 项目滞留提醒添加推送微信消息 sun List wxmpMsgList = new ArrayList<>(); + //短信消息 + List smsList = new ArrayList<>(); list.forEach(dto -> { String title; String msg; @@ -1429,6 +1469,19 @@ public class ProjectServiceImpl extends BaseServiceImpl staffDTOResult = epmetUserFeignClient.getCustomerStaffInfoByUserId(staffDTO); + if (staffDTOResult.success() && null != staffDTOResult.getData()) { + ProjectSendMsgFormDTO sms = new ProjectSendMsgFormDTO(); + sms.setCustomerId(staffDTOResult.getData().getCustomerId()); + sms.setMobile(staffDTOResult.getData().getMobile()); + sms.setAliyunTemplateCode(SmsTemplateConstant.PROJECT_OVERDUE); + sms.setParameterKey("send_msg"); + smsList.add(sms); + } }); messageFeignClient.saveUserMessageList(msgList); logger.info("项目滞留提醒,开始推送微信订阅消息"); @@ -1436,6 +1489,10 @@ public class ProjectServiceImpl extends BaseServiceImpl smsList = new ArrayList<>(); + CustomerStaffDTO staffDTO = new CustomerStaffDTO(); + staffDTO.setUserId(projectStaffDTO.getStaffId()); + Result staffResult = epmetUserFeignClient.getCustomerStaffInfoByUserId(staffDTO); + if (staffResult.success() && null != staffResult.getData()) { + ProjectSendMsgFormDTO sms = new ProjectSendMsgFormDTO(); + sms.setCustomerId(staffResult.getData().getCustomerId()); + sms.setMobile(staffResult.getData().getMobile()); + sms.setAliyunTemplateCode(SmsTemplateConstant.PROJECT_TRANSFER); + sms.setParameterKey("send_msg"); + smsList.add(sms); + } + result = epmetMessageOpenFeignClient.projectSendMsg(smsList); + if (!result.success()) { + logger.error("项目退回,发送手机短信失败" + JSON.toJSONString(result)); + } } /** diff --git a/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/CustomerParameterDTO.java b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/CustomerParameterDTO.java new file mode 100644 index 0000000000..187553f93a --- /dev/null +++ b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/CustomerParameterDTO.java @@ -0,0 +1,82 @@ +package com.epmet.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * @Author zxc + * @DateTime 2021/1/4 上午10:59 + */ +@Data +public class CustomerParameterDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 唯一标识 + */ + private String id; + + /** + * 客户ID + */ + private String customerId; + + /** + * 参数KEY值 + */ + private String parameterKey; + + /** + * 参数名称 + */ + private String parameterName; + + /** + * 参数VALUE值 + */ + private String parameterValue; + + /** + * 参数开关:开启:on,关闭:off + */ + private String parameterSwitch; + + /** + * 说明 + */ + private String description; + + /** + * 删除标识:0.未删除 1.已删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} diff --git a/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/form/CrmParameterFormDTO.java b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/form/CrmParameterFormDTO.java new file mode 100644 index 0000000000..ab31d56ae7 --- /dev/null +++ b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/form/CrmParameterFormDTO.java @@ -0,0 +1,28 @@ +package com.epmet.dto.form; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2021/1/4 上午10:44 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class CrmParameterFormDTO implements Serializable { + + private static final long serialVersionUID = -1892384189805073724L; + + public interface CrmParameterForm{} + + @NotBlank(message = "客户ID不能为空",groups = {CrmParameterForm.class}) + private String customerId; + + @NotBlank(message = "参数KEY值不能为空",groups = {CrmParameterForm.class}) + private String parameterKey; +} diff --git a/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/result/CrmParameterResultDTO.java b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/result/CrmParameterResultDTO.java new file mode 100644 index 0000000000..23cca7c0d9 --- /dev/null +++ b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/result/CrmParameterResultDTO.java @@ -0,0 +1,49 @@ +package com.epmet.dto.result; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2021/1/4 上午10:46 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class CrmParameterResultDTO implements Serializable { + + private static final long serialVersionUID = 8082721392714934568L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 参数KEY值 + */ + private String parameterKey; + + /** + * 参数VALUE值 + */ + private String parameterValue; + + /** + * 余额状态【parameterValue】true:充足,false:不足 + */ + private Boolean balanceStatus = true; + + /** + * 新的参数VALUE值 + */ + private String subtractParameterValue; + + /** + * 参数开关状态 true:开启,false:关闭 + */ + private Boolean switchStatus; +} diff --git a/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/OperCrmOpenFeignClient.java b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/OperCrmOpenFeignClient.java index 27d5c239d4..496dcd636a 100644 --- a/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/OperCrmOpenFeignClient.java +++ b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/OperCrmOpenFeignClient.java @@ -4,9 +4,11 @@ import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerAppDTO; import com.epmet.dto.CustomerDTO; +import com.epmet.dto.form.CrmParameterFormDTO; import com.epmet.dto.form.CustomerAppSecretFormDTO; import com.epmet.dto.form.CustomerManagerFormDTO; import com.epmet.dto.form.GridCountFormDTO; +import com.epmet.dto.result.CrmParameterResultDTO; import com.epmet.dto.result.GridCountResultDTO; import com.epmet.feign.fallback.OperCrmOpenFeignClientFallback; import org.springframework.cloud.openfeign.FeignClient; @@ -22,7 +24,7 @@ import java.util.List; * @date 2020/6/4 13:25 */ @FeignClient(name = ServiceConstant.OPER_CRM_SERVER, fallback = OperCrmOpenFeignClientFallback.class) -//@FeignClient(name = ServiceConstant.OPER_CRM_SERVER, fallback = OperCrmOpenFeignClientFallback.class, url = "118.190.150.119:48080/api") +//@FeignClient(name = ServiceConstant.OPER_CRM_SERVER, fallback = OperCrmOpenFeignClientFallback.class, url = "localhost:8090") public interface OperCrmOpenFeignClient { /** * 获取客户信息 @@ -74,4 +76,22 @@ public interface OperCrmOpenFeignClient { */ @PostMapping("/oper/crm/customer/getgridcount") Result getGridCount(@RequestBody GridCountFormDTO formDTO); + + /** + * @Description 查询客户配置信息 + * @Param formDTO + * @author zxc + * @date 2021/1/4 上午11:20 + */ + @PostMapping("/oper/crm/parameter/parameterinfo") + Result> selectParamInfo(@RequestBody List formDTOs); + + /** + * @Description 更新客户配置信息 + * @Param formDTOS + * @author zxc + * @date 2021/1/4 下午4:23 + */ + @PostMapping("/oper/crm/parameter/parameterupdate") + Result updateParamInfo(@RequestBody List formDTOS); } diff --git a/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/fallback/OperCrmOpenFeignClientFallback.java b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/fallback/OperCrmOpenFeignClientFallback.java index f4ad95f4ca..d18f98065a 100644 --- a/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/fallback/OperCrmOpenFeignClientFallback.java +++ b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/fallback/OperCrmOpenFeignClientFallback.java @@ -5,9 +5,11 @@ import com.epmet.commons.tools.utils.ModuleUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerAppDTO; import com.epmet.dto.CustomerDTO; +import com.epmet.dto.form.CrmParameterFormDTO; import com.epmet.dto.form.CustomerAppSecretFormDTO; import com.epmet.dto.form.CustomerManagerFormDTO; import com.epmet.dto.form.GridCountFormDTO; +import com.epmet.dto.result.CrmParameterResultDTO; import com.epmet.dto.result.GridCountResultDTO; import com.epmet.feign.OperCrmOpenFeignClient; import org.springframework.stereotype.Component; @@ -57,4 +59,14 @@ public class OperCrmOpenFeignClientFallback implements OperCrmOpenFeignClient { public Result getGridCount(GridCountFormDTO formDTO) { return ModuleUtils.feignConError(ServiceConstant.OPER_CRM_SERVER, "getGridCount", formDTO); } + + @Override + public Result> selectParamInfo(List formDTOs) { + return ModuleUtils.feignConError(ServiceConstant.OPER_CRM_SERVER, "selectParamInfo", formDTOs); + } + + @Override + public Result updateParamInfo(List formDTOS) { + return ModuleUtils.feignConError(ServiceConstant.OPER_CRM_SERVER, "updateParamInfo", formDTOS); + } } diff --git a/epmet-module/oper-crm/oper-crm-server/pom.xml b/epmet-module/oper-crm/oper-crm-server/pom.xml index 1ee199269a..610cdd9734 100644 --- a/epmet-module/oper-crm/oper-crm-server/pom.xml +++ b/epmet-module/oper-crm/oper-crm-server/pom.xml @@ -87,6 +87,18 @@ 2.0.0 compile + + + com.epmet + epmet-message-client + 2.0.0 + + + + com.epmet + epmet-commons-rocketmq + 2.0.0 + diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerParameterController.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerParameterController.java new file mode 100644 index 0000000000..006080bd6b --- /dev/null +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerParameterController.java @@ -0,0 +1,53 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dto.form.CrmParameterFormDTO; +import com.epmet.dto.result.CrmParameterResultDTO; +import com.epmet.service.CustomerParameterService; +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 zxc + * @DateTime 2021/1/4 上午10:51 + */ +@RestController +@RequestMapping("parameter") +public class CustomerParameterController { + + @Autowired + private CustomerParameterService parameterService; + + /** + * @Description 查询客户配置信息 + * @Param formDTO + * @author zxc + * @date 2021/1/4 上午11:20 + */ + @PostMapping("parameterinfo") + public Result> selectParamInfo(@RequestBody List formDTOs){ + formDTOs.forEach(formDTO -> { + ValidatorUtils.validateEntity(formDTO, CrmParameterFormDTO.CrmParameterForm.class); + }); + return new Result>().ok(parameterService.selectParamInfo(formDTOs)); + } + + /** + * @Description 更新客户配置信息 + * @Param formDTOS + * @author zxc + * @date 2021/1/4 下午4:23 + */ + @PostMapping("parameterupdate") + public Result updateParamInfo(@RequestBody List formDTOS){ + parameterService.updateParamInfo(formDTOS); + return new Result(); + } + +} diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/dao/CustomerParameterDao.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/dao/CustomerParameterDao.java new file mode 100644 index 0000000000..5d11da7f96 --- /dev/null +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/dao/CustomerParameterDao.java @@ -0,0 +1,34 @@ +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.form.CrmParameterFormDTO; +import com.epmet.dto.result.CrmParameterResultDTO; +import com.epmet.entity.CustomerParameterEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * @Author zxc + * @DateTime 2021/1/4 上午11:01 + */ +@Mapper +public interface CustomerParameterDao extends BaseDao { + + /** + * @Description 查询客户的配置信息 + * @Param customerIds + * @author zxc + * @date 2021/1/4 上午11:07 + */ + List selectParamInfo(@Param("formDTOS")List formDTOS); + + /** + * @Description 更新客户配置信息 + * @Param formDTOS + * @author zxc + * @date 2021/1/4 下午4:12 + */ + void updateParamInfo(@Param("formDTOS")List formDTOS); +} diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/entity/CustomerParameterEntity.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/entity/CustomerParameterEntity.java new file mode 100644 index 0000000000..9ed4ae997a --- /dev/null +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/entity/CustomerParameterEntity.java @@ -0,0 +1,49 @@ +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * @Author zxc + * @DateTime 2021/1/4 上午11:03 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("customer_parameter") +public class CustomerParameterEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 参数KEY值 + */ + private String parameterKey; + + /** + * 参数名称 + */ + private String parameterName; + + /** + * 参数VALUE值 + */ + private String parameterValue; + + /** + * 参数开关:开启:on,关闭:off + */ + private String parameterSwitch; + + /** + * 说明 + */ + private String description; + +} diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerParameterService.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerParameterService.java new file mode 100644 index 0000000000..4ab868a9c1 --- /dev/null +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerParameterService.java @@ -0,0 +1,30 @@ +package com.epmet.service; + +import com.epmet.dto.form.CrmParameterFormDTO; +import com.epmet.dto.result.CrmParameterResultDTO; + +import java.util.List; + +/** + * @Author zxc + * @DateTime 2021/1/4 上午10:52 + */ +public interface CustomerParameterService { + + /** + * @Description 查询客户配置信息 + * @Param formDTO + * @author zxc + * @date 2021/1/4 上午11:20 + */ + List selectParamInfo(List formDTOs); + + /** + * @Description 更新客户配置信息 + * @Param formDTOS + * @author zxc + * @date 2021/1/4 下午4:10 + */ + void updateParamInfo(List formDTOS); + +} diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerParameterServiceImpl.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerParameterServiceImpl.java new file mode 100644 index 0000000000..001fab6aff --- /dev/null +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerParameterServiceImpl.java @@ -0,0 +1,57 @@ +package com.epmet.service.impl; + +import com.epmet.dao.CustomerParameterDao; +import com.epmet.dto.form.CrmParameterFormDTO; +import com.epmet.dto.result.CrmParameterResultDTO; +import com.epmet.service.CustomerParameterService; +import lombok.extern.slf4j.Slf4j; +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.ArrayList; +import java.util.List; + +/** + * @Author zxc + * @DateTime 2021/1/4 上午10:53 + */ +@Service +@Slf4j +public class CustomerParameterServiceImpl implements CustomerParameterService { + + @Autowired + private CustomerParameterDao parameterDao; + + /** + * @Description 查询客户配置信息 + * @Param formDTO + * @author zxc + * @date 2021/1/4 上午11:20 + */ + @Override + public List selectParamInfo(List formDTOs) { + if (CollectionUtils.isEmpty(formDTOs)){ + return new ArrayList<>(); + } + List result = parameterDao.selectParamInfo(formDTOs); + if (CollectionUtils.isEmpty(result)){ + return new ArrayList<>(); + } + return result; + } + + /** + * @Description 更新客户配置信息 + * @Param formDTOS + * @author zxc + * @date 2021/1/4 下午4:11 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void updateParamInfo(List formDTOS) { + if (CollectionUtils.isEmpty(formDTOS))return; + parameterDao.updateParamInfo(formDTOS); + } +} diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java index 9857f910c5..9080d1573f 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java @@ -22,6 +22,7 @@ import com.alibaba.fastjson.JSONObject; 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.rocketmq.messages.InitCustomerMQMsg; import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.exception.EpmetErrorCode; @@ -32,6 +33,7 @@ import com.epmet.commons.tools.utils.HttpClientManager; import com.epmet.commons.tools.utils.Result; import com.epmet.constant.ModuleConstant; import com.epmet.constant.RoleKeyConstants; +import com.epmet.constant.SystemMessageType; import com.epmet.constant.UserWorkType; import com.epmet.dao.CustomerDao; import com.epmet.dto.*; @@ -80,6 +82,8 @@ public class CustomerServiceImpl extends BaseServiceImpl page(Map params) { @@ -468,48 +472,62 @@ public class CustomerServiceImpl extends BaseServiceImpl getAllList() { List list = baseDao.getAllList(); diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/resources/db/migration/V0.0.3__customer_parameter.sql b/epmet-module/oper-crm/oper-crm-server/src/main/resources/db/migration/V0.0.3__customer_parameter.sql new file mode 100644 index 0000000000..1eda6e2cdf --- /dev/null +++ b/epmet-module/oper-crm/oper-crm-server/src/main/resources/db/migration/V0.0.3__customer_parameter.sql @@ -0,0 +1,52 @@ +CREATE TABLE `customer_parameter` +( + `ID` varchar(64) NOT NULL COMMENT '唯一标识', + `CUSTOMER_ID` varchar(32) NOT NULL COMMENT '客户ID', + `PARAMETER_KEY` varchar(32) NOT NULL COMMENT '参数KEY值(发短信:send_msg;)', + `PARAMETER_NAME` varchar(32) DEFAULT NULL COMMENT '参数名称(短信)', + `PARAMETER_VALUE` varchar(32) DEFAULT NULL COMMENT '参数VALUE值', + `DESCRIPTION` varchar(32) DEFAULT NULL COMMENT '说明', + `DEL_FLAG` int(11) NOT NULL COMMENT '删除标识:0.未删除 1.已删除', + `REVISION` int(11) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE = InnoDB + DEFAULT CHARSET = utf8mb4 + ROW_FORMAT = COMPACT COMMENT ='客户配置表'; + + +#=================== 数据初始化 ============================ +INSERT INTO customer_parameter ( + ID, + CUSTOMER_ID, + PARAMETER_KEY, + PARAMETER_NAME, + PARAMETER_VALUE, + DESCRIPTION, + DEL_FLAG, + REVISION, + CREATED_BY, + CREATED_TIME, + UPDATED_BY, + UPDATED_TIME +) +SELECT + MD5(uuid() + FLOOR(RAND() * 999999)), + id, + 'send_msg', + '短信', + '5000', + '客户短信可发送次数配置', + '0', + '0', + 'app_user', + NOW(), + 'app_user', + NOW() +FROM + customer +WHERE + DEL_FLAG = '0' \ No newline at end of file diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/resources/db/migration/V0.0.4__new_customer_parameter.sql b/epmet-module/oper-crm/oper-crm-server/src/main/resources/db/migration/V0.0.4__new_customer_parameter.sql new file mode 100644 index 0000000000..96754ce4d2 --- /dev/null +++ b/epmet-module/oper-crm/oper-crm-server/src/main/resources/db/migration/V0.0.4__new_customer_parameter.sql @@ -0,0 +1,49 @@ +DROP TABLE IF EXISTS `customer_parameter`; +CREATE TABLE `customer_parameter` +( + `ID` varchar(64) NOT NULL COMMENT '唯一标识', + `CUSTOMER_ID` varchar(32) NOT NULL COMMENT '客户ID', + `PARAMETER_KEY` varchar(32) NOT NULL COMMENT '参数KEY值(发短信:send_msg;)', + `PARAMETER_NAME` varchar(32) DEFAULT NULL COMMENT '参数名称(短信)', + `PARAMETER_SWITCH` varchar(255) DEFAULT NULL COMMENT '参数开关:开启:on,关闭:off', + `PARAMETER_VALUE` varchar(32) DEFAULT NULL COMMENT '参数VALUE值', + `DESCRIPTION` varchar(32) DEFAULT NULL COMMENT '说明', + `DEL_FLAG` int(11) NOT NULL COMMENT '删除标识:0.未删除 1.已删除', + `REVISION` int(11) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE = InnoDB + DEFAULT CHARSET = utf8mb4 + ROW_FORMAT = COMPACT COMMENT ='客户配置表'; + + +#=================== 数据初始化 ============================ +INSERT INTO customer_parameter (ID, + CUSTOMER_ID, + PARAMETER_KEY, + PARAMETER_NAME, + PARAMETER_VALUE, + DESCRIPTION, + DEL_FLAG, + REVISION, + CREATED_BY, + CREATED_TIME, + UPDATED_BY, + UPDATED_TIME) +SELECT MD5(uuid() + FLOOR(RAND() * 999999)), + id, + 'send_msg', + '短信', + '5000', + '客户短信可发送次数配置', + '0', + '0', + 'app_user', + NOW(), + 'app_user', + NOW() +FROM customer +WHERE DEL_FLAG = '0' \ No newline at end of file diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/resources/db/migration/V0.0.5__insert_customer_parameter.sql b/epmet-module/oper-crm/oper-crm-server/src/main/resources/db/migration/V0.0.5__insert_customer_parameter.sql new file mode 100644 index 0000000000..6aa4f84bba --- /dev/null +++ b/epmet-module/oper-crm/oper-crm-server/src/main/resources/db/migration/V0.0.5__insert_customer_parameter.sql @@ -0,0 +1,32 @@ +DELETE FROM customer_parameter; + + +#=================== 数据初始化 ============================ +INSERT INTO customer_parameter (ID, + CUSTOMER_ID, + PARAMETER_KEY, + PARAMETER_NAME, + PARAMETER_SWITCH, + PARAMETER_VALUE, + DESCRIPTION, + DEL_FLAG, + REVISION, + CREATED_BY, + CREATED_TIME, + UPDATED_BY, + UPDATED_TIME) +SELECT MD5(uuid() + FLOOR(RAND() * 999999)), + id, + 'send_msg', + '短信', + 'off', + '5000', + '客户短信可发送次数配置', + '0', + '0', + 'app_user', + NOW(), + 'app_user', + NOW() +FROM customer +WHERE DEL_FLAG = '0' \ No newline at end of file diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/resources/mapper/CustomerParameterDao.xml b/epmet-module/oper-crm/oper-crm-server/src/main/resources/mapper/CustomerParameterDao.xml new file mode 100644 index 0000000000..2a5c38a13d --- /dev/null +++ b/epmet-module/oper-crm/oper-crm-server/src/main/resources/mapper/CustomerParameterDao.xml @@ -0,0 +1,33 @@ + + + + + + + + UPDATE customer_parameter + SET PARAMETER_VALUE = #{f.subtractParameterValue} + + DEL_FLAG = 0 + AND CUSTOMER_ID = #{f.customerId} + AND PARAMETER_KEY = #{f.parameterKey} + + + + + + + \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/pom.xml b/epmet-module/oper-customize/oper-customize-server/pom.xml index a36f6d46d1..5bd66523f2 100644 --- a/epmet-module/oper-customize/oper-customize-server/pom.xml +++ b/epmet-module/oper-customize/oper-customize-server/pom.xml @@ -70,6 +70,13 @@ 2.0.0 compile + + + + com.epmet + epmet-commons-rocketmq + 2.0.0 + @@ -129,6 +136,10 @@ SEC080aac67ff78e79fdaba132aa51e3fb3f6060dec99492feaac82cabf9f8b6a19 + + + 192.168.1.130:9876;192.168.1.132:9876 + epmet_message @@ -167,6 +178,10 @@ SEC080aac67ff78e79fdaba132aa51e3fb3f6060dec99492feaac82cabf9f8b6a19 + + + 192.168.1.130:9876;192.168.1.132:9876 + epmet_message @@ -205,6 +220,10 @@ SEC080aac67ff78e79fdaba132aa51e3fb3f6060dec99492feaac82cabf9f8b6a19 + + + 192.168.10.161:9876 + epmet_message @@ -241,6 +260,10 @@ SEC95f4f40b533ad379ea6a6d1af6dd37029383cfe1b7cd96dfac2678be2c1c3ed1 + + + 192.168.11.187:9876;192.168.11.184:9876 + epmet_message diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerHomeDao.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerHomeDao.java index 42bc2824b4..c804d757ed 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerHomeDao.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerHomeDao.java @@ -21,6 +21,7 @@ import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.form.HomeDesignFormDTO; import com.epmet.entity.CustomerHomeEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; import java.util.List; @@ -43,4 +44,6 @@ public interface CustomerHomeDao extends BaseDao { * @date 2020/3/16 14:02 **/ List selectCustomerHomeList(HomeDesignFormDTO formDTO); + + int countByCustomerId(@Param("customerId") String customerId); } \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/mq/listener/InitCustomerCustomizeListener.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/mq/listener/InitCustomerCustomizeListener.java new file mode 100644 index 0000000000..df2fea0902 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/mq/listener/InitCustomerCustomizeListener.java @@ -0,0 +1,54 @@ +package com.epmet.mq.listener; + +import com.alibaba.fastjson.JSON; +import com.epmet.commons.rocketmq.constants.ConsomerGroupConstants; +import com.epmet.commons.rocketmq.constants.TopicConstants; +import com.epmet.commons.rocketmq.messages.InitCustomerMQMsg; +import com.epmet.commons.tools.exception.ExceptionUtils; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.dto.CustomerHomeDTO; +import com.epmet.service.CustomerHomeService; +import org.apache.rocketmq.common.message.MessageExt; +import org.apache.rocketmq.spring.annotation.MessageModel; +import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; +import org.apache.rocketmq.spring.core.RocketMQListener; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 监听初始化客户动作,为客户初始化角色列表 + */ +@RocketMQMessageListener(topic = TopicConstants.INIT_CUSTOMER, + consumerGroup = ConsomerGroupConstants.INIT_CUSTOMER_CUSTOMIZE_GROUP, + messageModel = MessageModel.CLUSTERING, + selectorExpression = "*") +@Component +public class InitCustomerCustomizeListener implements RocketMQListener { + + private Logger logger = LoggerFactory.getLogger(getClass()); + + @Autowired + private CustomerHomeService customerHomeService; + + @Override + public void onMessage(MessageExt messageExt) { + String msg = new String(messageExt.getBody()); + logger.info("初始化客户-初始化客户自定义信息-收到消息内容:{}", msg); + InitCustomerMQMsg msgObj = JSON.parseObject(msg, InitCustomerMQMsg.class); + + CustomerHomeDTO customerHomeDTO = new CustomerHomeDTO(); + customerHomeDTO.setCustomerId(msgObj.getCustomerId()); + try { + customerHomeService.init(customerHomeDTO); + } catch (RenException e) { + // 如果是我们手动抛出的异常,说明在业务可控范围内。目前不需要MQ重试 + logger.error("【RocketMQ】初始化客户组件失败:".concat(ExceptionUtils.getErrorStackTrace(e))); + } catch (Exception e) { + // 不是我们自己抛出的异常,可以让MQ重试 + logger.error("【RocketMQ】初始化客户组件失败:".concat(ExceptionUtils.getErrorStackTrace(e))); + throw e; + } + } +} \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerHomeServiceImpl.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerHomeServiceImpl.java index 8ba5ba26bd..7b326bfbb3 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerHomeServiceImpl.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerHomeServiceImpl.java @@ -20,6 +20,8 @@ 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.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.constant.FieldConstant; @@ -119,6 +121,11 @@ public class CustomerHomeServiceImpl extends BaseServiceImpl 0) { + throw new RenException("用户Home组件已存在,请勿重复初始化"); + } + //居民端模板 List resiTempList = customerHomeTemplateService.getTemplateByClient(OperCustomizeConstant.RESIDENT); //居民端草稿 diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/resources/bootstrap.yml b/epmet-module/oper-customize/oper-customize-server/src/main/resources/bootstrap.yml index 988bd0c217..d9b167d150 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/resources/bootstrap.yml +++ b/epmet-module/oper-customize/oper-customize-server/src/main/resources/bootstrap.yml @@ -124,6 +124,9 @@ dingTalk: webHook: @dingTalk.robot.webHook@ secret: @dingTalk.robot.secret@ +rocketmq: + name-server: @rocketmq.nameserver@ + # 停机选项 shutdown: graceful: diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerHomeDao.xml b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerHomeDao.xml index 3bc7dfdb23..76b5f185ef 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerHomeDao.xml +++ b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerHomeDao.xml @@ -29,5 +29,11 @@ AND DEL_FLAG = '0' + + \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/TopicConstant.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/TopicConstant.java index 7937a708e7..5aa7c8d3a30 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/TopicConstant.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/TopicConstant.java @@ -95,10 +95,10 @@ public interface TopicConstant { String REJECTED = "rejected"; String APPROVED = "approved"; String SUBMIT = "submit"; - String IMAGE = " image"; - String VIDEO = " video"; - String VOICE = " voice"; - String DOC = " doc"; + String IMAGE = "image"; + String VIDEO = "video"; + String VOICE = "voice"; + String DOC = "doc"; String GROUP_INFO_FAILURE = "根据groupId未查询到组信息......"; @@ -107,4 +107,14 @@ public interface TopicConstant { String COMMENT_TOPIC_FAILURE = "评论话题加分失败......"; String GET_CUSTOMER_ID_FAILURE = "查询客户ID失败......"; + + /** + * 字段 附件类型 小写 驼峰 + */ + String FIELD_TOPIC_ATTACHMENT_TYPE_HUMP = "attachmentType"; + + /** + * 字段 附件类型 大写 下划线 + */ + String FIELD_TOPIC_ATTACHMENT_TYPE = "ATTACHMENT_TYPE"; } diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/FileDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/FileDTO.java index eb187299e0..1288ebeac1 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/FileDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/FileDTO.java @@ -1,5 +1,6 @@ package com.epmet.resi.group.dto.topic.form; +import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.Data; import lombok.NoArgsConstructor; @@ -15,10 +16,14 @@ import java.io.Serializable; public class FileDTO implements Serializable { private static final long serialVersionUID = -3930520724652521552L; + @JsonIgnore private String name; private String url; + @JsonIgnore private String type; + @JsonIgnore private String format; + @JsonIgnore private Integer size; private Integer duration; } diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/SendWxmpUpdateSubscribeFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/SendWxmpUpdateSubscribeFormDTO.java new file mode 100644 index 0000000000..4247d7c266 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/SendWxmpUpdateSubscribeFormDTO.java @@ -0,0 +1,23 @@ +package com.epmet.resi.group.dto.topic.form; + +import com.epmet.commons.tools.security.dto.TokenDto; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.io.Serializable; + +/** + * @description: + * @author: liushaowen + * @date: 2021/1/12 13:44 + */ +@Data +public class SendWxmpUpdateSubscribeFormDTO implements Serializable { + @NotNull + private TokenDto tokenDto; + @NotBlank + private String sourceId; + @NotBlank + private String sourceType; +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/ShareLinkTypeFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/ShareLinkTypeFormDTO.java new file mode 100644 index 0000000000..da7887bc8d --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/ShareLinkTypeFormDTO.java @@ -0,0 +1,25 @@ +package com.epmet.resi.group.dto.topic.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Description 分享链接类型和Id入参 + * @ClassName ShareLinkTypefFormDTO + * @Auth wangc + * @Date 2020-12-29 14:53 + */ +@Data +public class ShareLinkTypeFormDTO implements Serializable { + + @NotBlank(message = "链接Id不能为空") + private String id; + + @NotBlank(message = "链接类型不能为空") + private String type; + + @NotBlank(message = "用户Id不能为空") + private String userId; +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/TopicEventFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/TopicEventFormDTO.java new file mode 100644 index 0000000000..c6443c9d4a --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/TopicEventFormDTO.java @@ -0,0 +1,45 @@ +package com.epmet.resi.group.dto.topic.form; + +import com.epmet.commons.tools.enums.EventEnum; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.io.Serializable; + +/** + * @Description 话题相关积分入参dto + * @ClassName TopicEventFormDTO + * @Auth wangc + * @Date 2021-01-04 16:37 + */ +@Data +public class TopicEventFormDTO implements Serializable { + private static final long serialVersionUID = 2297474207576464905L; + + /** + * 话题Id + */ + @NotBlank(message = "话题Id不能为空") + private String topicId; + + /** + * 话题作者Id + */ + //private String topicAuthorId; + + /** + * 议题发起人Id + */ + private String issuePublisherId; + + /** + * 事件枚举 + */ + @NotNull(message = "楼院小组事件枚举类型不能为空") + private EventEnum event; + + /** + * 后续相关参数可再添加 + */ +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/DraftDetailResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/DraftDetailResultDTO.java index cd0772719d..ed04fa23ac 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/DraftDetailResultDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/DraftDetailResultDTO.java @@ -1,5 +1,6 @@ package com.epmet.resi.group.dto.topic.result; +import com.epmet.resi.group.dto.topic.form.FileDTO; import lombok.Data; import lombok.NoArgsConstructor; @@ -16,6 +17,7 @@ import java.util.List; public class DraftDetailResultDTO implements Serializable { private static final long serialVersionUID = -7445417689558651158L; + private String groupId; /** * 话题草稿id */ @@ -54,6 +56,6 @@ public class DraftDetailResultDTO implements Serializable { /** * 音频附件集合 */ - private List voiceList; - private List videoList; + private List voiceList; + private List videoList; } diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/MemberRelationBetweenGroupAndGridResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/MemberRelationBetweenGroupAndGridResultDTO.java new file mode 100644 index 0000000000..e3b0446113 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/MemberRelationBetweenGroupAndGridResultDTO.java @@ -0,0 +1,31 @@ +package com.epmet.resi.group.dto.topic.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description 通过链接进入小程序的用户与链接所在的小组与网格的关系 + * @ClassName MemberRelationBetweenGroupAndGridResultDTO + * @Auth wangc + * @Date 2020-12-29 14:58 + */ +@Data +public class MemberRelationBetweenGroupAndGridResultDTO implements Serializable { + private static final long serialVersionUID = -5389490307870064071L; + + /** + * 是否存在入组待审核记录,true:存在,false:不存在 + */ + private Boolean awaitAudit = false; + + /** + * 是否在群内标志,已经在群内:true, 不在群内:false + */ + private Boolean inGroup = false; + + /** + * 此人有没有加入所在小组所属网格下的任何一个小组,true:加入,false:未加入 + */ + private Boolean inAnyGroup = false; +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/TopicBelongGroupResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/TopicBelongGroupResultDTO.java index 275813b5c6..f9de2af12b 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/TopicBelongGroupResultDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/TopicBelongGroupResultDTO.java @@ -18,4 +18,6 @@ public class TopicBelongGroupResultDTO implements Serializable { private static final long serialVersionUID = 8180287697221964032L; private String groupId; + + private String gridId; } diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/ResiGroupOpenFeignClient.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/ResiGroupOpenFeignClient.java index ad9a19903f..c8b884b664 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/ResiGroupOpenFeignClient.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/ResiGroupOpenFeignClient.java @@ -14,6 +14,7 @@ import com.epmet.resi.group.dto.topic.form.*; import com.epmet.resi.group.dto.topic.result.*; import com.epmet.resi.group.feign.fallback.ResiGroupOpenFeignClientFallback; import com.epmet.resi.mine.dto.from.MyPartProjectsFormDTO; +import com.epmet.resi.group.dto.group.form.CreateGroupCodeFormDTO; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.PostMapping; @@ -22,6 +23,7 @@ import org.springframework.web.bind.annotation.RequestParam; import java.util.HashMap; import java.util.List; +import org.springframework.http.MediaType; /** * 本服务对外开放的API,其他服务通过引用此client调用该服务 @@ -142,6 +144,15 @@ public interface ResiGroupOpenFeignClient { @PostMapping("resi/group/topic/fetchtopicinfowhenauditissue") Result fetchTopicInfoWhenAuditIssue(@RequestBody ResiTopicTurnIssueFromDTO param); + /** + * @Description 发送内容更新类的微信订阅 + * @return void + * @Author liushaowen + * @Date 2021/1/12 11:22 + */ + @PostMapping("resi/group/topic/sendwxmpupdatesubscribe") + Result sendWxmpUpdateSubscribe(@RequestBody SendWxmpUpdateSubscribeFormDTO fromDTO); + /** * @Description 查询话题所属小组 * @Param formDTO @@ -164,4 +175,24 @@ public interface ResiGroupOpenFeignClient { */ @PostMapping("resi/group/topicsharelinkvisitrecord/checkinviterelationship") Result checkInviteRelationship(@RequestBody SharableTopicAndInviteeFormDTO param); + + + /** + * 自动审核 + * @author zhaoqifeng + * @date 2020/12/30 10:11 + * @return com.epmet.commons.tools.utils.Result + */ + @PostMapping("resi/group/topicdraft/autoAudit") + Result autoAudit(); + + /** + * @Description 根据事件枚举发送积分事件 + * @param param + * @return void + * @author wangc + * @date 2021.01.04 16:41 + */ + @PostMapping("resi/group/topic/sendevent") + Result sendEvent(@RequestBody TopicEventFormDTO param); } diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/fallback/ResiGroupOpenFeignClientFallback.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/fallback/ResiGroupOpenFeignClientFallback.java index 1b6f214fa0..9a14845822 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/fallback/ResiGroupOpenFeignClientFallback.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/fallback/ResiGroupOpenFeignClientFallback.java @@ -1,6 +1,7 @@ package com.epmet.resi.group.feign.fallback; import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ModuleUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.resi.group.dto.group.ResiGroupDTO; @@ -101,6 +102,12 @@ public class ResiGroupOpenFeignClientFallback implements ResiGroupOpenFeignClien return ModuleUtils.feignConError(ServiceConstant.RESI_GROUP_SERVER, "fetchTopicInfoWhenAuditIssue",param); } + @Override + public Result sendWxmpUpdateSubscribe(SendWxmpUpdateSubscribeFormDTO fromDTO) { + return ModuleUtils.feignConError(ServiceConstant.RESI_GROUP_SERVER, "sendWxmpUpdateSubscribe",fromDTO); + } + + @Override public Result selectTopicBelongGroup(TopicBelongGroupFormDTO formDTO) { return ModuleUtils.feignConError(ServiceConstant.RESI_GROUP_SERVER, "selectTopicBelongGroup",formDTO); @@ -110,4 +117,21 @@ public class ResiGroupOpenFeignClientFallback implements ResiGroupOpenFeignClien public Result checkInviteRelationship(SharableTopicAndInviteeFormDTO param) { return ModuleUtils.feignConError(ServiceConstant.RESI_GROUP_SERVER, "selectTopicBelongGroup", param); } + + /** + * 自动审核 + * + * @return com.epmet.commons.tools.utils.Result + * @author zhaoqifeng + * @date 2020/12/30 10:11 + */ + @Override + public Result autoAudit() { + return ModuleUtils.feignConError(ServiceConstant.RESI_GROUP_SERVER, "autoAudit"); + } + + @Override + public Result sendEvent(TopicEventFormDTO param) { + return ModuleUtils.feignConError(ServiceConstant.RESI_GROUP_SERVER, "sendEvent",param); + } } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/constant/WxmpSubscribeConstant.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/constant/WxmpSubscribeConstant.java new file mode 100644 index 0000000000..0c9c5f28b9 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/constant/WxmpSubscribeConstant.java @@ -0,0 +1,6 @@ +package com.epmet.modules.constant; + +public interface WxmpSubscribeConstant { + String TYPE_COMMENT = "comment"; + String TYPE_SHIFT_ISSUE = "shiftIssue"; +} diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/GroupMemeberOperationServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/GroupMemeberOperationServiceImpl.java index 8f4deee6c3..11760b07b3 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/GroupMemeberOperationServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/GroupMemeberOperationServiceImpl.java @@ -48,6 +48,7 @@ import com.epmet.modules.member.dao.ResiGroupMemberDao; import com.epmet.modules.member.entity.GroupMemeberOperationEntity; import com.epmet.modules.member.entity.ResiGroupMemberEntity; import com.epmet.modules.member.redis.GroupMemeberOperationRedis; +import com.epmet.modules.member.redis.ResiGroupMemberRedis; import com.epmet.modules.member.service.GroupMemeberOperationService; import com.epmet.modules.member.service.ResiGroupMemberService; import com.epmet.modules.topic.dao.ResiTopicDao; @@ -64,6 +65,7 @@ import com.epmet.resi.group.dto.group.ResiGroupDTO; import com.epmet.resi.group.dto.group.ResiGroupInfoRedisDTO; import com.epmet.resi.group.dto.member.GroupMemeberOperationDTO; import com.epmet.resi.group.dto.member.ResiGroupMemberDTO; +import com.epmet.resi.group.dto.member.ResiGroupMemberInfoRedisDTO; import com.epmet.resi.group.dto.member.form.JoinGroupByShareLinkFormDTO; import com.epmet.resi.group.dto.member.form.RemoveMemberFormDTO; import com.epmet.resi.group.dto.member.result.JoinGroupApplyRealTimeResultDTO; @@ -107,6 +109,8 @@ public class GroupMemeberOperationServiceImpl extends BaseServiceImpl> userResponse = userClient.queryUserBaseInfo(userParam); if(userResponse.success() && !CollectionUtils.isEmpty(userResponse.getData())){ UserBaseInfoResultDTO user = userResponse.getData().get(NumConstant.ZERO); - pointEventMsg.setRemark( new StringBuilder("邀请").append("加入") + pointEventMsg.setRemark( new StringBuilder("邀请") .append(user.getStreet()).append("-").append(user.getSurname()) .append(StringUtils.equals(NumConstant.ONE_STR,user.getGender()) ? "先生" : StringUtils.equals(NumConstant.TWO_STR,user.getGender()) ? "女士" : "先生/女士") + .append("加入") .append(resiGroupDTO.getGroupName()).append("小组").toString()); } pointEventMsgList.add(pointEventMsg); diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/ResiGroupMemberServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/ResiGroupMemberServiceImpl.java index ae48951046..9207200b6e 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/ResiGroupMemberServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/ResiGroupMemberServiceImpl.java @@ -545,10 +545,11 @@ public class ResiGroupMemberServiceImpl extends BaseServiceImpl> userResponse = userOpenFeignClient.queryUserBaseInfo(userParam); if(userResponse.success() && !CollectionUtils.isEmpty(userResponse.getData())){ UserBaseInfoResultDTO user = userResponse.getData().get(NumConstant.ZERO); - pointEventMsg.setRemark( new StringBuilder("邀请").append("加入") + pointEventMsg.setRemark( new StringBuilder("邀请") .append(user.getStreet()).append("-").append(user.getSurname()) .append(StringUtils.equals(NumConstant.ONE_STR,user.getGender()) ? "先生" : StringUtils.equals(NumConstant.TWO_STR,user.getGender()) ? "女士" : "先生/女士") + .append("加入") .append(resiGroupDTO.getGroupName()).append("小组").toString()); } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/ResiTopicController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/ResiTopicController.java index d6e3bf75a6..564e43b98e 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/ResiTopicController.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/ResiTopicController.java @@ -1,5 +1,6 @@ package com.epmet.modules.topic.controller; +import com.baomidou.mybatisplus.extension.api.R; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.epmet.commons.tools.annotation.LoginUser; @@ -258,7 +259,7 @@ public class ResiTopicController { ValidatorUtils.validateEntity(topicTurnIssueFromDTO); return new Result().ok(topicService.shiftIssueV2(topicTurnIssueFromDTO)); } - + /** * @Description 话题转议题-重新编辑提交 * @param tokenDto @@ -357,6 +358,18 @@ public class ResiTopicController { return new Result().ok(topicService.selectMyPartTopic(myPartIssueFormDTO)); } + /** + * @Description 发送内容更新类的微信订阅 + * @return void + * @Author liushaowen + * @Date 2021/1/12 11:21 + */ + @PostMapping("sendwxmpupdatesubscribe") + public Result sendWxmpUpdateSubscribe(@RequestBody SendWxmpUpdateSubscribeFormDTO fromDTO){ + topicService.sendWxmpUpdateSubscribe(fromDTO.getTokenDto(),fromDTO.getSourceId(),fromDTO.getSourceType()); + return new Result(); + } + /** * @return com.epmet.commons.tools.utils.Result @@ -402,4 +415,18 @@ public class ResiTopicController { return new Result().ok(topicService.topicAttachmentList(formDTO)); } + /** + * @Description 根据事件枚举发送积分事件 + * @param param + * @return void + * @author wangc + * @date 2021.01.04 16:41 + */ + @PostMapping("sendevent") + public Result sendEvent(@RequestBody TopicEventFormDTO param){ + ValidatorUtils.validateEntity(param); + topicService.sendTopicPointEventByEventType(param); + return new Result(); + } + } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/TopicDraftController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/TopicDraftController.java index 89081680fd..1c99d983c3 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/TopicDraftController.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/TopicDraftController.java @@ -180,4 +180,16 @@ public class TopicDraftController { formDTO.setUserId(tokenDto.getUserId()); return new Result>().ok(topicDraftService.myAuditingList(formDTO)); } + + /** + * 自动审核 + * @author zhaoqifeng + * @date 2020/12/30 10:11 + * @return com.epmet.commons.tools.utils.Result + */ + @PostMapping("autoAudit") + public Result autoAudit() { + topicDraftService.autoAudit(); + return new Result(); + } } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/TopicShareLinkRecordController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/TopicShareLinkRecordController.java index d8e9614ff2..bd138b5583 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/TopicShareLinkRecordController.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/TopicShareLinkRecordController.java @@ -10,11 +10,14 @@ import com.epmet.commons.tools.validator.group.AddGroup; import com.epmet.commons.tools.validator.group.DefaultGroup; import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.modules.topic.service.TopicShareLinkRecordService; +import com.epmet.modules.topic.service.TopicShareLinkVisitRecordService; import com.epmet.resi.group.dto.topic.TopicShareLinkRecordDTO; import com.epmet.resi.group.dto.topic.form.CreateUrlFormDTO; +import com.epmet.resi.group.dto.topic.form.ShareLinkTypeFormDTO; import com.epmet.resi.group.dto.topic.form.TopicBelongGroupFormDTO; import com.epmet.resi.group.dto.topic.form.TopicVisitFormDTO; import com.epmet.resi.group.dto.topic.result.CreateUrlResultDTO; +import com.epmet.resi.group.dto.topic.result.MemberRelationBetweenGroupAndGridResultDTO; import com.epmet.resi.group.dto.topic.result.TopicBelongGroupResultDTO; import com.epmet.resi.group.dto.topic.result.TopicVisitResultDTO; import org.springframework.beans.factory.annotation.Autowired; @@ -108,4 +111,18 @@ public class TopicShareLinkRecordController { return new Result().ok(topicShareLinkRecordService.topicVisit(formDTO,tokenDto)); } + /** + * @Description 根据链接信息查询被邀请人在组/网格内的状态 + * @param param + * @return com.epmet.resi.group.dto.topic.result.MemberRelationBetweenGroupAndGridResultDTO + * @author wangc + * @date 2020.12.29 15:01 + */ + @PostMapping("getstatus") + public Result getStatus(@LoginUser TokenDto token, @RequestBody ShareLinkTypeFormDTO param){ + param.setUserId(token.getUserId()); + ValidatorUtils.validateEntity(param); + return new Result().ok(topicShareLinkRecordService.getStatusByLinkAndInvitee(param)); + } + } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/dao/TopicDraftScanTaskDao.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/dao/TopicDraftScanTaskDao.java index 15be6e2e7c..ea0029cb1b 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/dao/TopicDraftScanTaskDao.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/dao/TopicDraftScanTaskDao.java @@ -19,7 +19,9 @@ package com.epmet.modules.topic.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.modules.topic.entity.TopicDraftScanTaskEntity; +import com.epmet.resi.group.dto.topic.TopicDraftScanTaskDTO; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; /** * 话题附件检测任务表 @@ -29,5 +31,15 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface TopicDraftScanTaskDao extends BaseDao { + void updateByTask(TopicDraftScanTaskEntity entity); + + /** + * 获取检测任务信息 + * @author zhaoqifeng + * @date 2020/12/29 14:30 + * @param taskId + * @return com.epmet.resi.group.dto.topic.TopicDraftScanTaskDTO + */ + TopicDraftScanTaskDTO selectScanByTask(@Param("taskId") String taskId); } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/ResiTopicService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/ResiTopicService.java index 347f960f6e..6e8769177d 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/ResiTopicService.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/ResiTopicService.java @@ -258,7 +258,7 @@ public interface ResiTopicService extends BaseService { * @date 2020.11.20 10:26 */ FirstTopicShiftedToIssueApplicationResultDTO shiftIssueV2(ResiTopicTurnIssueFromDTO param); - + /** * @Description 工作端审核议题通过时获取一些议题相关信息 * @param param @@ -267,7 +267,7 @@ public interface ResiTopicService extends BaseService { * @date 2020.11.20 18:09 */ IssueShiftedFromTopicFormDTO getIssueInfoWhenAudit(ResiTopicTurnIssueFromDTO param); - + /** * @Description 政府端查看议题详情时的话题相关信息 * @param govTopicIssueInfoFormDTO @@ -331,4 +331,23 @@ public interface ResiTopicService extends BaseService { * @Description 获取话题附件信息 **/ TopicAttachmentResultDTO topicAttachmentList(TopicAttachmentFormDTO formDTO); -} \ No newline at end of file + /** + * @Description 向关注话题的人发送微信订阅 + * @param tokenDto + * @param id + * @param type 订阅类型 comment / shiftIssue + * @return void + * @Author liushaowen + * @Date 2020/12/31 10:28 + */ + void sendWxmpUpdateSubscribe(TokenDto tokenDto, String id, String type); + + /** + * @Description 根据事件枚举发送积分事件 + * @param param + * @return void + * @author wangc + * @date 2021.01.04 16:41 + */ + void sendTopicPointEventByEventType(TopicEventFormDTO param); +} diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/TopicDraftScanTaskService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/TopicDraftScanTaskService.java index 91ae43076d..003b716a97 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/TopicDraftScanTaskService.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/TopicDraftScanTaskService.java @@ -94,4 +94,16 @@ public interface TopicDraftScanTaskService extends BaseService + */ + List getScanTaskList(String draftId, String status); } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/TopicDraftService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/TopicDraftService.java index 87b99bc51c..b6646cf19c 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/TopicDraftService.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/TopicDraftService.java @@ -153,4 +153,13 @@ public interface TopicDraftService extends BaseService { * @Description 个人中心-我发表的话题-审核中列表 **/ List myAuditingList(MyAuditingListFormDTO formDTO); + + /** + * 自动审核 + * @author zhaoqifeng + * @date 2020/12/29 17:51 + * @param + * @return void + */ + void autoAudit(); } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/TopicShareLinkRecordService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/TopicShareLinkRecordService.java index c52f23d862..ec3bd6000d 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/TopicShareLinkRecordService.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/TopicShareLinkRecordService.java @@ -6,9 +6,11 @@ import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.modules.topic.entity.TopicShareLinkRecordEntity; import com.epmet.resi.group.dto.topic.TopicShareLinkRecordDTO; import com.epmet.resi.group.dto.topic.form.CreateUrlFormDTO; +import com.epmet.resi.group.dto.topic.form.ShareLinkTypeFormDTO; import com.epmet.resi.group.dto.topic.form.TopicBelongGroupFormDTO; import com.epmet.resi.group.dto.topic.form.TopicVisitFormDTO; import com.epmet.resi.group.dto.topic.result.CreateUrlResultDTO; +import com.epmet.resi.group.dto.topic.result.MemberRelationBetweenGroupAndGridResultDTO; import com.epmet.resi.group.dto.topic.result.TopicBelongGroupResultDTO; import com.epmet.resi.group.dto.topic.result.TopicVisitResultDTO; @@ -107,4 +109,13 @@ public interface TopicShareLinkRecordService extends BaseService NumConstant.FIFTEEN){ //mq的事件类型 MqBaseMsgDTO mqBaseMsgDTO = new MqBaseMsgDTO(); @@ -248,6 +253,20 @@ public class ResiTopicCommentServiceImpl extends BaseServiceImpl NumConstant.TEN ? + (content.substring(NumConstant.ZERO,NumConstant.TEN) + "…") : + content); + builder.append("\""); + }else builder.append("语音话题"); + + pointEventMsg.setRemark(builder.toString()); pointEventMsgList.add(pointEventMsg); mqBaseMsgDTO.setMsg(JSON.toJSONString(pointEventMsgList)); @@ -258,6 +277,8 @@ public class ResiTopicCommentServiceImpl extends BaseServiceImpl wrapper = new QueryWrapper<>(); wrapper.eq(FieldConstant.DEL_FLAG,NumConstant.ZERO_STR); wrapper.eq(TopicConstant.TOPIC_ID,topicId); + wrapper.eq(TopicConstant.FIELD_TOPIC_ATTACHMENT_TYPE,"image"); wrapper.orderByAsc(TopicConstant.SORT); List attachments = resiTopicAttachmentDao.selectList(wrapper); List attachmentUrls = new ArrayList<>(); @@ -1247,6 +1262,7 @@ public class ResiTopicServiceImpl extends BaseServiceImpl wrapper = new QueryWrapper<>(); wrapper.eq(FieldConstant.DEL_FLAG,NumConstant.ZERO_STR); wrapper.eq(TopicConstant.TOPIC_ID,formDTO.getTopicId()); + wrapper.eq(TopicConstant.FIELD_TOPIC_ATTACHMENT_TYPE,"image"); wrapper.orderByAsc(TopicConstant.SORT); List attachments = resiTopicAttachmentDao.selectList(wrapper); if (attachments.size() != NumConstant.ZERO){ @@ -1580,8 +1596,56 @@ public class ResiTopicServiceImpl extends BaseServiceImpl pointEventMsgList = new ArrayList<>(); //1.话题被转为议题 组内成员 + + BasePointEventMsg pointEventMsg = new BasePointEventMsg(); + pointEventMsg.setCustomerId(groupCache.getCustomerId()); + pointEventMsg.setUserId(group.getTopicAuthorId()); + pointEventMsg.setActionFlag(MqConstant.PLUS); + pointEventMsg.setIsCommon(false); + pointEventMsg.setEventTag(EventEnum.TOPIC_SHIFTED_TO_ISSUE.getEventTag()); + //某某小组中发布的话题“某某某…” (前十个字后面省略号) 被转为议题 + String content = CharMatcher.WHITESPACE.trimFrom(topic.getTopicContent()); + pointEventMsg.setRemark(new StringBuilder(groupCache.getGroupName()).append("小组中发布的") + .append( + StringUtils.isBlank(content) + || StringUtils.equals("语音话题",content)? "语音话题" : + "话题\"" + + content + .substring(NumConstant.ZERO,content.length() < NumConstant.TEN ? content.length() : NumConstant.TEN) + + (NumConstant.TEN > content.length() ? "\"" : "…\"") + ).append("被转为议题").toString()); + pointEventMsgList.add(pointEventMsg); + //2.转话题为议题 组长 + BasePointEventMsg pointEventMsg2 = new BasePointEventMsg(); + pointEventMsg2.setCustomerId(groupCache.getCustomerId()); + pointEventMsg2.setUserId(topicTurnIssueFromDTO.getUserId()); + pointEventMsg2.setActionFlag(MqConstant.PLUS); + pointEventMsg2.setIsCommon(false); + pointEventMsg2.setEventTag(EventEnum.SHIFT_TOPIC_TO_ISSUE.getEventTag()); + //将话题“某某某…” (前十个字后面省略号) 转为议题 + pointEventMsg2.setRemark(new StringBuilder("将") + .append( + new StringBuilder(new StringBuilder(pointEventMsg.getRemark().replaceFirst(new StringBuilder(groupCache.getGroupName()).append("小组中发布的").toString(),"")) + .reverse().toString() + .replaceFirst("题议为转被","")).reverse() + ).append("转为议题").toString()); + pointEventMsgList.add(pointEventMsg2); + + mqBaseMsgDTO.setMsg(JSON.toJSONString(pointEventMsgList)); + if(!SendMqMsgUtils.sendMsg(mqBaseMsgDTO).success()){ + log.error("话题转议题事件发送失败,参数:{}",JSON.toJSONString(topicTurnIssueFromDTO)); + } } else { ValidatorUtils.validateEntity(result, FirstTopicShiftedToIssueApplicationResultDTO.AllowAuditionGroup.class); @@ -1664,10 +1728,61 @@ public class ResiTopicServiceImpl extends BaseServiceImpl pointEventMsgList = new ArrayList<>(); + //1.话题被转为议题 组内成员 + + BasePointEventMsg pointEventMsg = new BasePointEventMsg(); + pointEventMsg.setCustomerId(groupCache.getCustomerId()); + pointEventMsg.setUserId(group.getTopicAuthorId()); + pointEventMsg.setActionFlag(MqConstant.PLUS); + pointEventMsg.setIsCommon(false); + pointEventMsg.setEventTag(EventEnum.TOPIC_SHIFTED_TO_ISSUE.getEventTag()); + //某某小组中发布的话题“某某某…” (前十个字后面省略号) 被转为议题 + String content = CharMatcher.WHITESPACE.trimFrom(topic.getTopicContent()); + pointEventMsg.setRemark(new StringBuilder(groupCache.getGroupName()).append("小组中发布的") + .append( + StringUtils.isBlank(content) + || StringUtils.equals("语音话题",content)? "语音话题" : + "话题\"" + + content + .substring(NumConstant.ZERO,content.length() < NumConstant.TEN ? content.length() : NumConstant.TEN) + + (NumConstant.TEN > content.length() ? "\"" : "…\"") + ).append("被转为议题").toString()); + pointEventMsgList.add(pointEventMsg); + + //2.转话题为议题 组长 + BasePointEventMsg pointEventMsg2 = new BasePointEventMsg(); + pointEventMsg2.setCustomerId(groupCache.getCustomerId()); + pointEventMsg2.setUserId(param.getUserId()); + pointEventMsg2.setActionFlag(MqConstant.PLUS); + pointEventMsg2.setIsCommon(false); + pointEventMsg2.setEventTag(EventEnum.SHIFT_TOPIC_TO_ISSUE.getEventTag()); + //将话题“某某某…” (前十个字后面省略号) 转为议题 + pointEventMsg2.setRemark(new StringBuilder("将") + .append( + new StringBuilder(new StringBuilder(pointEventMsg.getRemark().replaceFirst(new StringBuilder(groupCache.getGroupName()).append("小组中发布的").toString(),"")).reverse() + .toString().replaceFirst("题议为转被","")).reverse() + ).append("转为议题").toString()); + pointEventMsgList.add(pointEventMsg2); + + mqBaseMsgDTO.setMsg(JSON.toJSONString(pointEventMsgList)); + if(!SendMqMsgUtils.sendMsg(mqBaseMsgDTO).success()){ + log.error("话题转议题事件发送失败,参数:{}",JSON.toJSONString(param)); + } } return issueInfo; } - /** * @Description 政府端查看议题详情时的话题相关信息 * @param govTopicIssueInfoFormDTO @@ -1858,6 +1973,85 @@ public class ResiTopicServiceImpl extends BaseServiceImpl() + .eq("del_flag",0) + .eq("issue_id",sourceId)); + } + if (resiTopicEntity == null){ + log.warn("sendWxmpUpdateSubscribe根据topicid获取议题详情为空"); + return; + } + String groupId = resiTopicEntity.getGroupId(); + String createdBy = resiTopicEntity.getCreatedBy(); + //获取对应的customerId,gridId + ResiGroupEntity resiGroupEntity = resiGroupDao.selectById(groupId); + String customerId = resiGroupEntity.getCustomerId(); + String gridId = resiGroupEntity.getGridId(); + //获取所有关心这个话题的userId列表(发布者+评论者) + ResiQueryCommentFormDTO resiQueryCommentFormDTO = new ResiQueryCommentFormDTO(); + resiQueryCommentFormDTO.setTopicId(resiTopicEntity.getId()); + resiQueryCommentFormDTO.setPageNo(1); + resiQueryCommentFormDTO.setPageSize(10000); + List commentList = resiTopicCommentService.getCommentList(tokenDto, resiQueryCommentFormDTO).getData(); + Set toUsers = commentList.stream().map(item -> item.getUserId()).collect(Collectors.toSet()); + toUsers.add(createdBy); + //不给发起操作的人推送 + toUsers.remove(tokenDto.getUserId()); + logger.info("推送的userid列表:"+JSON.toJSONString(toUsers)); + List msgList = new ArrayList<>(); + Date now = new Date(); + for (String toUser : toUsers) { + WxSubscribeUpdateFormDTO subscribeUpdateFormDTO = new WxSubscribeUpdateFormDTO(); + if (WxmpSubscribeConstant.TYPE_COMMENT.equals(type)){ + subscribeUpdateFormDTO.setSourceType(WxmpMessageConstant.SOURCE_TYPE_TOPIC); + subscribeUpdateFormDTO.setBehaviorType(WxmpMessageConstant.CONTENT_UPDATE_TEMPLATE_TYPE); + subscribeUpdateFormDTO.setMessageTitle(WxmpMessageConstant.CONTENT_UPDATE_TITLE_TEXT); + subscribeUpdateFormDTO.setMessageContent(WxmpMessageConstant.CONTENT_UPDATE_CONTENT_TEXT); + } + if (WxmpSubscribeConstant.TYPE_SHIFT_ISSUE.equals(type)){ + subscribeUpdateFormDTO.setSourceType(WxmpMessageConstant.SOURCE_TYPE_ISSUE); + subscribeUpdateFormDTO.setBehaviorType(WxmpMessageConstant.CONCERN_UPDATE_TEMPLATE_TYPE); + subscribeUpdateFormDTO.setMessageTitle(WxmpMessageConstant.CONCERN_UPDATE_TITLE_TEXT); + subscribeUpdateFormDTO.setMessageContent(WxmpMessageConstant.CONCERN_UPDATE_CONTENT_TEXT); + } + subscribeUpdateFormDTO.setGroupId(groupId); + subscribeUpdateFormDTO.setClientType(WxmpMessageConstant.RESI); + subscribeUpdateFormDTO.setCustomerId(customerId); + subscribeUpdateFormDTO.setGridId(gridId); + subscribeUpdateFormDTO.setSourceId(sourceId); + subscribeUpdateFormDTO.setMessageTime(now); + subscribeUpdateFormDTO.setUserId(toUser); + msgList.add(subscribeUpdateFormDTO); + } + if(msgList.size()>0){ + epmetMessageOpenFeignClient.sendWxSubscribeUpdate(msgList); + } + }catch (Exception e){ + logger.warn("话题相关 发送微信订阅失败,"+e.getMessage()+",sourceId="+sourceId+" 类型="+type); + } + } /** * @param formDTO * @return @@ -1896,6 +2090,61 @@ public class ResiTopicServiceImpl extends BaseServiceImpl pointEventMsgList = new ArrayList<>(); + //话题被转为项目 话题作者 + + BasePointEventMsg pointEventMsg = new BasePointEventMsg(); + pointEventMsg.setCustomerId(group.getCustomerId()); + pointEventMsg.setUserId(topic.getCreatedBy()); + pointEventMsg.setActionFlag(MqConstant.PLUS); + pointEventMsg.setIsCommon(false); + pointEventMsg.setEventTag(EventEnum.TOPIC_SHIFTED_TO_PROJECT.getEventTag()); + //某某小组中发布的话题“某某某…” (前十个字后面省略号) 被转为议题 + String content = CharMatcher.WHITESPACE.trimFrom(topic.getTopicContent()); + pointEventMsg.setRemark(new StringBuilder(group.getGroupName()).append("小组中发布的") + .append( + StringUtils.isBlank(content) || + StringUtils.equals("语音话题",content) ? "语音话题" : + "话题\"" + + content + .substring(NumConstant.ZERO,content.length() < NumConstant.TEN ? content.length() : NumConstant.TEN) + + (NumConstant.TEN > content.length() ? "\"" : "…\"") + ).append("被转为项目").toString()); + pointEventMsgList.add(pointEventMsg); + mqBaseMsgDTO.setMsg(JSON.toJSONString(pointEventMsgList)); + if(!SendMqMsgUtils.sendMsg(mqBaseMsgDTO).success()){ + log.error("话题转议题事件发送失败,参数:{}",JSON.toJSONString(param)); + } + } + } + } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/TopicDraftScanTaskServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/TopicDraftScanTaskServiceImpl.java index eeac8f4389..9890bf5c79 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/TopicDraftScanTaskServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/TopicDraftScanTaskServiceImpl.java @@ -26,6 +26,7 @@ import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.modules.topic.dao.TopicDraftScanTaskDao; import com.epmet.modules.topic.entity.TopicDraftScanTaskEntity; import com.epmet.modules.topic.service.TopicDraftScanTaskService; +import com.epmet.resi.group.constant.TopicConstant; import com.epmet.resi.group.dto.topic.TopicDraftScanTaskDTO; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; @@ -102,4 +103,26 @@ public class TopicDraftScanTaskServiceImpl extends BaseServiceImpl + * @author zhaoqifeng + * @date 2020/12/29 17:57 + */ + @Override + public List getScanTaskList(String draftId, String status) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(draftId), "TOPIC_DRAFT_ID", draftId); + wrapper.eq(StringUtils.isNotBlank(status),"STATUS", status); + List entityList = baseDao.selectList(wrapper); + return ConvertUtils.sourceToTarget(entityList, TopicDraftScanTaskDTO.class); + + } + } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/TopicDraftServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/TopicDraftServiceImpl.java index edac718249..4ee3f577b9 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/TopicDraftServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/TopicDraftServiceImpl.java @@ -72,6 +72,7 @@ import com.epmet.resi.group.dto.topic.form.*; import com.epmet.resi.group.dto.topic.result.DraftDetailResultDTO; import com.epmet.resi.group.dto.topic.result.MyAuditingListResultDTO; import com.epmet.resi.group.dto.topic.result.TopicAuditResultDTO; +import com.google.common.base.CharMatcher; import com.google.common.util.concurrent.ThreadFactoryBuilder; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; @@ -239,6 +240,110 @@ public class TopicDraftServiceImpl extends BaseServiceImpl taskList = topicDraftScanTaskService.getScanTaskList(null, TopicConstant.AUDITING); + if (CollectionUtils.isNotEmpty(taskList)) { + List taskIds = taskList.stream().map(TopicDraftScanTaskDTO :: getTaskId).collect(Collectors.toList()); + List draftIds = taskList.stream().map(TopicDraftScanTaskDTO :: getTopicDraftId).collect(Collectors.toList()); + Result> voiceResults = ScanContentUtils.voiceResults(scanApiUrl.concat(voiceResultsMethod), taskIds); + if (voiceResults.success()) { + List list = voiceResults.getData(); + for (VoiceResultDTO item : list) { + TopicDraftScanTaskDTO taskDTO = topicDraftScanTaskService.getScanByTask(item.getTaskId()); + if (TopicConstant.REVIEW.equals(item.getSuggestion())) { + //结果不确定 + TopicDraftAttachmentDTO dto = new TopicDraftAttachmentDTO(); + dto.setId(taskDTO.getTopicDraftAttachmentId()); + dto.setStatus(TopicConstant.REVIEW); + dto.setReason(item.getLabelDesc()); + topicDraftAttachmentService.update(dto); + + taskDTO.setStatus(TopicConstant.REVIEW); + topicDraftScanTaskService.update(taskDTO); + + } else if (TopicConstant.BLOCK.equals(item.getSuggestion())) { + //结果违规 + TopicDraftAttachmentDTO dto = new TopicDraftAttachmentDTO(); + dto.setId(taskDTO.getTopicDraftAttachmentId()); + dto.setStatus(TopicConstant.BLOCK); + dto.setReason(item.getLabelDesc()); + topicDraftAttachmentService.update(dto); + + taskDTO.setStatus(TopicConstant.BLOCK); + topicDraftScanTaskService.update(taskDTO); + } else { + //审核通过 + TopicDraftAttachmentDTO dto = new TopicDraftAttachmentDTO(); + dto.setId(taskDTO.getTopicDraftAttachmentId()); + dto.setStatus(TopicConstant.AUTO_PASSED); + dto.setReason(item.getLabelDesc()); + topicDraftAttachmentService.update(dto); + + taskDTO.setStatus(TopicConstant.AUTO_PASSED); + topicDraftScanTaskService.update(taskDTO); + } + } + + //判断草稿是否审核完成 + draftIds.forEach(draftId -> { + List tasks = topicDraftScanTaskService.getScanTaskList(draftId, null); + String status = TopicConstant.AUTO_PASSED; + for (TopicDraftScanTaskDTO task : tasks) { + if (TopicConstant.AUDITING.equals(task.getStatus())) { + status = TopicConstant.AUDITING; + break; + } else if(TopicConstant.BLOCK.equals(task.getStatus())) { + status = TopicConstant.BLOCK; + } else if(TopicConstant.REVIEW.equals(task.getStatus())) { + if (!TopicConstant.BLOCK.equals(status)) { + status = TopicConstant.REVIEW; + } + } else { + if (!TopicConstant.BLOCK.equals(status) && !TopicConstant.REVIEW.equals(status)) { + status = TopicConstant.AUTO_PASSED; + } + } + } + + if (TopicConstant.BLOCK.equals(status)) { + //草稿状态更新为block + TopicDraftEntity draftEntity = new TopicDraftEntity(); + draftEntity.setId(draftId); + draftEntity.setDraftStatus(TopicConstant.BLOCK); + draftEntity.setDraftReason("语音存在违规内容"); + baseDao.updateById(draftEntity); + + } else if(TopicConstant.REVIEW.equals(status)) { + //草稿状态更新为review + TopicDraftEntity draftEntity = new TopicDraftEntity(); + draftEntity.setId(draftId); + draftEntity.setDraftStatus(TopicConstant.REVIEW); + draftEntity.setDraftReason("需要人工审核"); + baseDao.updateById(draftEntity); + + } else if(TopicConstant.AUTO_PASSED.equals(status)) { + //草稿状态更新为auto_passed + AuditDraftTopicFormDTO formDTO = new AuditDraftTopicFormDTO(); + formDTO.setTopicDraftId(draftId); + formDTO.setAuditType(TopicConstant.AUTO_PASSED); + audit(null, formDTO); + } + }); + + + } + } + } + /** * 发布话题 * @@ -251,7 +356,7 @@ public class TopicDraftServiceImpl extends BaseServiceImpl imageDTOList = new ArrayList<>(); if(CollectionUtils.isNotEmpty(formDTO.getImageList())){ - TopicDraftAttachmentDTO attachment = new TopicDraftAttachmentDTO(); int sort = 0; for(String url : formDTO.getImageList()){ + TopicDraftAttachmentDTO attachment = new TopicDraftAttachmentDTO(); attachment.setCustomerId(formDTO.getCustomerId()); attachment.setAttachmentUrl(url); attachment.setTopicDraftId(topic.getId()); @@ -298,10 +406,10 @@ public class TopicDraftServiceImpl extends BaseServiceImpl voiceDTOList = new ArrayList<>(); - if(CollectionUtils.isNotEmpty(formDTO.getVideoList())){ - TopicDraftAttachmentDTO attachment = new TopicDraftAttachmentDTO(); + if(CollectionUtils.isNotEmpty(formDTO.getVoiceList())){ int sort = 0; - for(FileDTO file : formDTO.getVideoList()){ + for(FileDTO file : formDTO.getVoiceList()){ + TopicDraftAttachmentDTO attachment = new TopicDraftAttachmentDTO(); attachment.setCustomerId(formDTO.getCustomerId()); attachment.setAttachmentUrl(file.getUrl()); attachment.setTopicDraftId(topic.getId()); @@ -309,6 +417,7 @@ public class TopicDraftServiceImpl extends BaseServiceImpl { - while (true) { - Result> voiceResults = ScanContentUtils.voiceResults(scanApiUrl.concat(voiceResultsMethod), taskIds); - if (voiceResults.success()) { - boolean isAllPass = true; - List list = voiceResults.getData(); - for (VoiceResultDTO item : list) { - if (TopicConstant.REVIEW.equals(item.getSuggestion())) { - //结果不确定 - TopicDraftAttachmentDTO dto = new TopicDraftAttachmentDTO(); - dto.setId(item.getDataId()); - dto.setStatus(TopicConstant.REVIEW); - dto.setReason(item.getLabelDesc()); - topicDraftAttachmentService.update(dto); - - TopicDraftScanTaskDTO taskDTO = new TopicDraftScanTaskDTO(); - taskDTO.setTaskId(item.getTaskId()); - taskDTO.setStatus(TopicConstant.REVIEW); - topicDraftScanTaskService.updateByTask(taskDTO); - isAllPass = false; - } else if (TopicConstant.BLOCK.equals(item.getSuggestion())) { - //结果违规 - TopicDraftAttachmentDTO dto = new TopicDraftAttachmentDTO(); - dto.setId(item.getDataId()); - dto.setStatus(TopicConstant.BLOCK); - dto.setReason(item.getLabelDesc()); - topicDraftAttachmentService.update(dto); - - TopicDraftScanTaskDTO taskDTO = new TopicDraftScanTaskDTO(); - taskDTO.setTaskId(item.getTaskId()); - taskDTO.setStatus(TopicConstant.BLOCK); - topicDraftScanTaskService.updateByTask(taskDTO); - isAllPass = false; - } else { - //审核通过 - TopicDraftAttachmentDTO dto = new TopicDraftAttachmentDTO(); - dto.setId(item.getDataId()); - dto.setStatus(TopicConstant.AUTO_PASSED); - dto.setReason(item.getLabelDesc()); - topicDraftAttachmentService.update(dto); - - TopicDraftScanTaskDTO taskDTO = new TopicDraftScanTaskDTO(); - taskDTO.setTaskId(item.getTaskId()); - taskDTO.setStatus(TopicConstant.AUTO_PASSED); - topicDraftScanTaskService.updateByTask(taskDTO); - } - //审核通过,发布话题 - if(isAllPass) { - saveTopic(tokenDto, formDTO, topic.getId()); - } - } - break; - } - try { - Thread.sleep(600000); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - }); +// Result> voiceResults = ScanContentUtils.voiceResults(scanApiUrl.concat(voiceResultsMethod), taskIds); +// if (voiceResults.success()) { +// boolean isAllPass = true; +// List list = voiceResults.getData(); +// for (VoiceResultDTO item : list) { +// TopicDraftScanTaskDTO taskDTO = topicDraftScanTaskService.getScanByTask(item.getTaskId()); +// if (TopicConstant.REVIEW.equals(item.getSuggestion())) { +// //结果不确定 +// TopicDraftAttachmentDTO dto = new TopicDraftAttachmentDTO(); +// dto.setId(taskDTO.getTopicDraftAttachmentId()); +// dto.setStatus(TopicConstant.REVIEW); +// dto.setReason(item.getLabelDesc()); +// topicDraftAttachmentService.update(dto); +// +// taskDTO.setStatus(TopicConstant.REVIEW); +// topicDraftScanTaskService.update(taskDTO); +// +// TopicDraftEntity draftEntity = new TopicDraftEntity(); +// draftEntity.setId(topic.getId()); +// draftEntity.setDraftStatus(TopicConstant.REVIEW); +// draftEntity.setDraftReason("需要人工审核"); +// baseDao.updateById(draftEntity); +// +// isAllPass = false; +// } else if (TopicConstant.BLOCK.equals(item.getSuggestion())) { +// //结果违规 +// TopicDraftAttachmentDTO dto = new TopicDraftAttachmentDTO(); +// dto.setId(taskDTO.getTopicDraftAttachmentId()); +// dto.setStatus(TopicConstant.BLOCK); +// dto.setReason(item.getLabelDesc()); +// topicDraftAttachmentService.update(dto); +// +// taskDTO.setStatus(TopicConstant.BLOCK); +// topicDraftScanTaskService.update(taskDTO); +// +// TopicDraftEntity draftEntity = new TopicDraftEntity(); +// draftEntity.setId(topic.getId()); +// draftEntity.setDraftStatus(TopicConstant.BLOCK); +// draftEntity.setDraftReason(item.getLabelDesc()); +// baseDao.updateById(draftEntity); +// +// isAllPass = false; +// } else { +// //审核通过 +// TopicDraftAttachmentDTO dto = new TopicDraftAttachmentDTO(); +// dto.setId(taskDTO.getTopicDraftAttachmentId()); +// dto.setStatus(TopicConstant.AUTO_PASSED); +// dto.setReason(item.getLabelDesc()); +// topicDraftAttachmentService.update(dto); +// +// taskDTO.setStatus(TopicConstant.AUTO_PASSED); +// topicDraftScanTaskService.update(taskDTO); +// } +// //审核通过,发布话题 +// if (isAllPass) { +// saveTopic(tokenDto, formDTO, topic.getId()); +// } +// } +// +// } } } else { @@ -560,6 +668,7 @@ public class TopicDraftServiceImpl extends BaseServiceImpl voiceUrls = topicDraftAttachmentService.getFileList(formDTO.getTopicDraftId(), TopicConstant.VOICE).stream().map(TopicDraftAttachmentDTO::getAttachmentUrl).collect(Collectors.toList()); + List voiceUrls = + topicDraftAttachmentService.getFileList(formDTO.getTopicDraftId(), TopicConstant.VOICE).stream().map(item ->{ + FileDTO fileDTO = new FileDTO(); + fileDTO.setUrl(item.getAttachmentUrl()); + fileDTO.setDuration(item.getDuration()); + return fileDTO; + }).collect(Collectors.toList()); result.setVoiceList(voiceUrls); //3.拿取用户信息 @@ -594,6 +709,7 @@ public class TopicDraftServiceImpl extends BaseServiceImpl attachmentList = topicDraftAttachmentService.getFileList(formDTO.getTopicDraftId(), null); List topicAttachments = ConvertUtils.sourceToTarget(attachmentList, ResiTopicAttachmentEntity.class); topicAttachments.forEach(item -> { item.setId(null); + item.setTopicId(resiTopic.getId()); + item.setCreatedBy(draft.getCreatedBy()); + item.setUpdatedBy(draft.getCreatedBy()); }); resiTopicAttachmentDao.insertBatch(topicAttachments); //将音频状态改为approved - List voiceList = - attachmentList.stream().filter(item -> TopicConstant.VOICE.equals(item.getAttachmentType()) && TopicConstant.REVIEW.equals(item.getStatus())).collect(Collectors.toList()); - if (CollectionUtils.isNotEmpty(voiceList)) { - voiceList.forEach(item -> item.setStatus(TopicConstant.APPROVED)); - topicDraftAttachmentService.updateBatchById(ConvertUtils.sourceToTarget(voiceList, TopicDraftAttachmentEntity.class)); + if (TopicConstant.APPROVED.equals(formDTO.getAuditType())) { + List voiceList = + attachmentList.stream().filter(item -> TopicConstant.VOICE.equals(item.getAttachmentType()) && TopicConstant.REVIEW.equals(item.getStatus())).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(voiceList)) { + voiceList.forEach(item -> item.setStatus(TopicConstant.APPROVED)); + topicDraftAttachmentService.updateBatchById(ConvertUtils.sourceToTarget(voiceList, TopicDraftAttachmentEntity.class)); + } } + //发送积分 - sendMqMsg(draft.getCreatedBy(), draft.getCustomerId()); + StringBuilder breviary = new StringBuilder(); + String content = CharMatcher.WHITESPACE.trimFrom(draft.getTopicContent()); + if(!StringUtils.isBlank(content)){ + breviary.append("\""); + breviary.append(content.length() > NumConstant.TEN ? (content.substring(NumConstant.TEN) + "…") : content); + breviary.append("\""); + }else { + breviary.append("话题"); + } + sendMqMsg(draft.getCreatedBy(), draft.getCustomerId(),draft.getCreatedTime(),resiGroupRedis.get(draft.getGroupId()).getGroupName(),breviary.toString()); } //记录操作记录 entity = baseDao.selectById(formDTO.getTopicDraftId()); @@ -646,7 +785,7 @@ public class TopicDraftServiceImpl extends BaseServiceImpl NumConstant.TEN ? (content.substring(NumConstant.ZERO,NumConstant.TEN) + "…") : content); + breviary.append("\""); + }else breviary.append("语音话题"); + sendMqMsg(tokenDto.getUserId(), formDTO.getCustomerId(),draft.getCreatedTime(),resiGroupRedis.get(draft.getGroupId()).getGroupName(),breviary.toString()); } - private void sendMqMsg(String userId, String customerId) { + /** + * @Description 发送积分事件 + * @param userId + * @param customerId + * @param targetDate 可为空 + * @param groupName + * @param topicBreviary 话题内容摘要"内容…" 如果没有文字则是"语音话题" + * @return void + * @author wangc + * @date 2020.12.25 15:45 + */ + private void sendMqMsg(String userId, String customerId, Date targetDate, String groupName, String topicBreviary) { //6.发送积分 MqBaseMsgDTO mqBaseMsgDTO=new MqBaseMsgDTO(); //mq的事件类型 @@ -765,6 +929,9 @@ public class TopicDraftServiceImpl extends BaseServiceImpl implements TopicShareLinkRecordService { @Autowired @@ -48,7 +61,12 @@ public class TopicShareLinkRecordServiceImpl extends BaseServiceImpl page(Map params) { IPage page = baseDao.selectPage( @@ -146,6 +164,7 @@ public class TopicShareLinkRecordServiceImpl extends BaseServiceImpl issueShareLinkInfo = issueClient.shareLinkInfo(param.getId()); + if(issueShareLinkInfo.success() && null != issueShareLinkInfo.getData()){ + String issueId = issueShareLinkInfo.getData().getIssueId(); + if(StringUtils.isNotBlank(issueId)){ + group = topicDao.selectGroupIdByIssueId(issueId); + } + } + } + if(StringUtils.isBlank(group)) throw new RenException("根据分享链接Id没有找到对应的组Id"); + String userId = param.getUserId(); + + GroupMemeberOperationDTO applyRecord = groupMemeberOperationDao.selectLatestRecord(group, userId); + if(null != applyRecord && StringUtils.equals(ModuleConstant.GROUP_STATUS_UNDER_AUDITTING,applyRecord.getOperateStatus())){ + //under_auditing + relation.setAwaitAudit(true); + } + if(null != applyRecord && StringUtils.equals(ModuleConstant.AUDITING_OPERATION_APPROVAL,applyRecord.getOperateStatus())){ + //approved + relation.setInGroup(true); + relation.setInAnyGroup(true); + } + if(!relation.getInAnyGroup()) { + ResiGroupEntity groupEntity = groupDao.selectById(group); + if(null == groupEntity || StringUtils.isBlank(groupEntity.getGridId())) + throw new RenException("没有找到相应的组记录"); + List groups = resiGroupMemberDao.getGroupIdByUserIdAndGridId(groupEntity.getGridId(), userId, NumConstant.ONE_STR); + if(!CollectionUtils.isEmpty(groups)){ + relation.setInAnyGroup(true); + if(groups.contains(group)){ + relation.setInGroup(true); + log.error("查出用户{}是组{}中成员,但是没有对应的入群记录",param.getUserId(),group); + } + } + } + + return relation; + } + } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/TopicShareLinkVisitRecordServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/TopicShareLinkVisitRecordServiceImpl.java index 34d9be5bb5..949cfd6bab 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/TopicShareLinkVisitRecordServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/TopicShareLinkVisitRecordServiceImpl.java @@ -6,12 +6,18 @@ import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.feign.GovIssueOpenFeignClient; +import com.epmet.modules.member.dao.GroupMemeberOperationDao; +import com.epmet.modules.member.dao.ResiGroupMemberDao; import com.epmet.modules.topic.dao.TopicShareLinkVisitRecordDao; import com.epmet.modules.topic.entity.TopicShareLinkVisitRecordEntity; import com.epmet.modules.topic.service.TopicShareLinkVisitRecordService; import com.epmet.resi.group.dto.topic.TopicShareLinkVisitRecordDTO; import com.epmet.resi.group.dto.topic.form.SharableTopicAndInviteeFormDTO; +import com.epmet.resi.group.dto.topic.form.ShareLinkTypeFormDTO; +import com.epmet.resi.group.dto.topic.result.MemberRelationBetweenGroupAndGridResultDTO; import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -107,5 +113,4 @@ public class TopicShareLinkVisitRecordServiceImpl extends BaseServiceImpl SELECT ID AS topicDraftId, TOPIC_CONTENT AS topicContent, - CREATED_BY AS userName, - UNIX_TIMESTAMP(CREATED_TIME) AS releaseTime + + UNIX_TIMESTAMP(CREATED_TIME) AS releaseTime, + + + UNIX_TIMESTAMP(UPDATED_TIME) AS releaseTime, + + CREATED_BY AS userName FROM topic_draft WHERE @@ -41,6 +46,13 @@ AND (DRAFT_STATUS = 'block' OR DRAFT_STATUS = 'rejected') + ORDER BY + + CREATED_TIME DESC + + + UPDATED_TIME DESC + + select ID, + CUSTOMER_ID, + TOPIC_DRAFT_ID, + TOPIC_DRAFT_ATTACHMENT_ID, + TASK_ID, + STATUS, + ATTACHMENT_TYPE, + DEL_FLAG, + REVISION, + CREATED_BY, + CREATED_TIME, + UPDATED_BY, + UPDATED_TIME + from topic_draft_scan_task + where TASK_ID = #{taskId} + \ No newline at end of file diff --git a/epmet-module/resi-guide/resi-guide-client/src/main/java/com/epmet/dto/form/PublicCustomerGridListFormDTO.java b/epmet-module/resi-guide/resi-guide-client/src/main/java/com/epmet/dto/form/PublicCustomerGridListFormDTO.java index 6e26721f28..6bdf608ae0 100644 --- a/epmet-module/resi-guide/resi-guide-client/src/main/java/com/epmet/dto/form/PublicCustomerGridListFormDTO.java +++ b/epmet-module/resi-guide/resi-guide-client/src/main/java/com/epmet/dto/form/PublicCustomerGridListFormDTO.java @@ -15,11 +15,18 @@ import java.io.Serializable; public class PublicCustomerGridListFormDTO implements Serializable { private static final long serialVersionUID = 1L; - public interface AddUserInternalGroup { - } - - public interface AddUserShowGroup extends CustomerClientShowGroup { - } + /** + * 地区码 + * */ + @NotBlank(message = "自动定位地区码不能为空", groups = {AreaCode.class}) + private String areaCode; + /** + * 选定地区编码 + * */ + @NotBlank(message = "手动定位地区码不能为空", groups = {SelectedAreaCode.class}) + private String selectedAreaCode; + public interface AddUserInternalGroup {} + public interface AddUserShowGroup extends CustomerClientShowGroup {} /** * 小程序appId @@ -37,15 +44,9 @@ public class PublicCustomerGridListFormDTO implements Serializable { * */ private Integer pageSize = 20; - /** - * 地区码 - * */ - private String areaCode; + public interface AreaCode extends CustomerClientShowGroup {} - /** - * 选定地区编码 - * */ - private String selectedAreaCode; + public interface SelectedAreaCode extends CustomerClientShowGroup {} /** * 是否首次位置授权(0:是 1:否) diff --git a/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/controller/StrangerResiGuideController.java b/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/controller/StrangerResiGuideController.java index dac2615943..f190314b1c 100644 --- a/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/controller/StrangerResiGuideController.java +++ b/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/controller/StrangerResiGuideController.java @@ -117,7 +117,7 @@ public class StrangerResiGuideController { **/ @PostMapping("publiclocationgridlist") Result> publicLocationGridList(@RequestBody PublicCustomerGridListFormDTO formDTO){ - ValidatorUtils.validateEntity(formDTO); + ValidatorUtils.validateEntity(formDTO, PublicCustomerGridListFormDTO.AddUserShowGroup.class, PublicCustomerGridListFormDTO.AreaCode.class); return strangerAccessRecordService.thirdCustomerGridList(formDTO); } @@ -128,7 +128,7 @@ public class StrangerResiGuideController { **/ @PostMapping("publiclelectcdgridlist") Result> publicLelectcdGridList(@RequestBody PublicCustomerGridListFormDTO formDTO){ - ValidatorUtils.validateEntity(formDTO); + ValidatorUtils.validateEntity(formDTO, PublicCustomerGridListFormDTO.AddUserShowGroup.class, PublicCustomerGridListFormDTO.SelectedAreaCode.class); return strangerAccessRecordService.thirdCustomerGridList(formDTO); } diff --git a/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/feign/ResiPartyMemberOpenFeignClient.java b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/feign/ResiPartyMemberOpenFeignClient.java index bd54ec1604..f823096f15 100644 --- a/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/feign/ResiPartyMemberOpenFeignClient.java +++ b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/feign/ResiPartyMemberOpenFeignClient.java @@ -84,4 +84,14 @@ public interface ResiPartyMemberOpenFeignClient { **/ @PostMapping(value = "/resi/partymember/partymemberinfo/queryPartymemberInfoByUserId", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) Result> queryPartymemberInfoByUserId(@RequestBody List userIdList); + + /** + * @return com.epmet.commons.tools.utils.Result> + * @param gridIdList + * @author zy + * @description 根据网格id查询认证通过的党员信息 + * @Date 2020/7/22 12:14 + **/ + @PostMapping(value = "/resi/partymember/partymemberinfo/getPartymemberInfoByGridId", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) + Result> getPartymemberInfoByGridId(@RequestBody List gridIdList); } diff --git a/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/feign/fallback/ResiPartyMemberOpenFeignClientFallback.java b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/feign/fallback/ResiPartyMemberOpenFeignClientFallback.java index df60a30abc..3f3ebb8c97 100644 --- a/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/feign/fallback/ResiPartyMemberOpenFeignClientFallback.java +++ b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/feign/fallback/ResiPartyMemberOpenFeignClientFallback.java @@ -60,5 +60,8 @@ public class ResiPartyMemberOpenFeignClientFallback implements ResiPartyMemberOp return ModuleUtils.feignConError(ServiceConstant.RESI_PARTYMEMBER_SERVER, "queryPartymemberInfoByUserId", userIdList); } - + @Override + public Result> getPartymemberInfoByGridId(List gridIdList) { + return ModuleUtils.feignConError(ServiceConstant.RESI_PARTYMEMBER_SERVER, "getPartymemberInfoByGridId", gridIdList); + } } diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/controller/PartymemberInfoController.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/controller/PartymemberInfoController.java index 89b9d7c135..5d7d081e13 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/controller/PartymemberInfoController.java +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/controller/PartymemberInfoController.java @@ -42,7 +42,7 @@ import java.util.Map; /** - * 党员认证信息表 + * 党员认证信息表 * * @author generator generator@elink-cn.com * @since v1.0.0 2020-03-30 @@ -50,7 +50,7 @@ import java.util.Map; @RestController @RequestMapping("partymemberinfo") public class PartymemberInfoController { - + @Autowired private PartymemberInfoService partymemberInfoService; @@ -144,4 +144,17 @@ public class PartymemberInfoController { List list = partymemberInfoService.queryPartymemberInfoByUserId(userIdList); return new Result>().ok(list); } -} \ No newline at end of file + + /** + * @return com.epmet.commons.tools.utils.Result> + * @param gridIdList + * @author zy + * @description 根据网格id查询认证通过的党员信息 + * @Date 2020/7/22 12:14 + **/ + @PostMapping(value = "getPartymemberInfoByGridId") + Result> getPartymemberInfoByGridId(@RequestBody List gridIdList) { + List list = partymemberInfoService.listPartymemberInfoByGridId(gridIdList); + return new Result>().ok(list); + } +} diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/dao/PartymemberInfoDao.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/dao/PartymemberInfoDao.java index 660cbfa957..f395beac8b 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/dao/PartymemberInfoDao.java +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/dao/PartymemberInfoDao.java @@ -86,4 +86,13 @@ public interface PartymemberInfoDao extends BaseDao { * @Date 2020/12/25 14:02 **/ List selectCountAuditting(@Param("gridIdList") List gridIdList); -} \ No newline at end of file + + /** + * @return com.epmet.commons.tools.utils.Result> + * @param gridIdList + * @author zy + * @description 根据网格id查询认证通过的党员信息 + * @Date 2020/7/22 12:14 + **/ + List selectListPartymemberInfoByGridId(@Param("gridIdList") List gridIdList); +} diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/PartymemberInfoService.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/PartymemberInfoService.java index b8b0b39694..3290cb084f 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/PartymemberInfoService.java +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/PartymemberInfoService.java @@ -31,7 +31,7 @@ import java.util.List; import java.util.Map; /** - * 党员认证信息表 + * 党员认证信息表 * * @author generator generator@elink-cn.com * @since v1.0.0 2020-03-30 @@ -153,4 +153,13 @@ public interface PartymemberInfoService extends BaseService queryPartymemberInfoByUserId(List userIdList); -} \ No newline at end of file + + /** + * @return com.epmet.commons.tools.utils.Result> + * @param gridIdList + * @author zy + * @description 根据网格id查询认证通过的党员信息 + * @Date 2020/7/22 12:14 + **/ + List listPartymemberInfoByGridId(List gridIdList); +} 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 c30e9aca9f..eae2c74317 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 @@ -185,6 +185,9 @@ public class PartyMemberConfirmServiceImpl implements PartyMemberConfirmService PartymemberConfirmAutoDTO confirmAutoDTO = partymemberBaseInfoService.getPartyMemberBaseInfo(partyMemberInfoDTO); + //判断是否已注册居民,如果没有则注册居民 + isResiRegister(partyMemberInfoDTO); + //党员信息存入党员认证信息表 PartymemberInfoEntity partyMemberInfoEntity = ConvertUtils.sourceToTarget(partyMemberInfoDTO, PartymemberInfoEntity.class); @@ -264,9 +267,6 @@ public class PartyMemberConfirmServiceImpl implements PartyMemberConfirmService PartymemberConfirmAutoEntity.class)); } } - // - //判断是否已注册居民,如果没有则注册居民 - isResiRegister(partyMemberInfoDTO); //将身份证号更新到用户基础信息表中 UserBaseInfoDTO baseInfo = new UserBaseInfoDTO(); diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/PartymemberInfoServiceImpl.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/PartymemberInfoServiceImpl.java index ddc22a04b1..c6ce32113b 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/PartymemberInfoServiceImpl.java +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/PartymemberInfoServiceImpl.java @@ -230,5 +230,9 @@ public class PartymemberInfoServiceImpl extends BaseServiceImpl listPartymemberInfoByGridId(List gridIdList) { + List list = baseDao.selectListPartymemberInfoByGridId(gridIdList); + return list; + } +} 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 e47b1a142d..876e1102f0 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 @@ -135,4 +135,38 @@ group by pi.GRID_ID - \ No newline at end of file + + + + diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/CommonErrorCodeEnum.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/CommonErrorCodeEnum.java new file mode 100644 index 0000000000..8ebed5781f --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/CommonErrorCodeEnum.java @@ -0,0 +1,68 @@ +package com.epmet.openapi.scan.common.enu; + +import com.epmet.commons.tools.constant.StrConstant; + +/** + * 公共错误码 + * + * @author yinzuomei@elink-cn.com + * @date 2021/1/10 19:43 + */ +public enum CommonErrorCodeEnum { + OK(200, "请求成功。"), + PROCESSING(280, "任务正在执行中,建议您等待一段时间(例如5s)后再查询结果。"), + BAD_REQUEST(400, "请求有误,通常由于请求参数不正确导致,请仔细检查请求参数。"), + NOT_ALLOWED(401, "请求失败,通常是由于使用了不安全的图片、视频、语音链接地址。"), + FORBIDDEN(403, "请求访问失败,通常由于您的图片、视频、语音链接无法访问导致,请确认公网是否可访问,并且无防盗链策略。"), + NOT_FOUND(404, "待检测内容未找到,通常是由于您的图片、视频、语音内容无法下载导致,请确认内容可通过公网访问到。"), + DOWNLOAD_FAILED(480, "下载失败,请确认待检测内容的大小、分辨率(如果有)在API的限制范围内。"), + GENERAL_ERROR(500, "一般是服务端临时出错。建议重试,若持续返回该错误码,请通过工单联系我们。"), + DB_FAILED(580, "数据库操作失败。建议重试,若持续返回该错误码,请通过工单联系我们。"), + TIMEOUT(581, "超时。建议重试,若持续返回该错误码,请通过工单联系我们。"), + CACHE_FAILED(585, "缓存出错。建议重试,若持续返回该错误码,请通过工单联系我们。"), + ALGO_FAILED(586, "算法出错。请通过工单联系我们。"), + MQ_FAILED(587, "中间件出错。请通过工单联系我们。"), + EXCEED_QUOTA(588, "请求频率超出配额。默认配额:图片检测50张/秒,视频检测20路/秒,语音检测20路/秒,文本检测100条/秒。如果需要调整配额,请通过工单联系我们。"), + TOO_LARGE(589, "待检测内容过大,请确保检测的内容在API的限制范围内。建议重试,若持续返回该错误码,请通过工单联系我们。"), + BAD_FORMAT(590, "待检测内容格式错误,请确保检测的内容在API的限制范围内。"), + CONNECTION_POOL_FULL(591, "连接池满。请通过工单联系我们。"), + DOWNLOAD_TIMEOUT(592, "下载超时,下载时间限制为3s,请确保检测的内容大小在API的限制范围内。"), + EXPIRED(594, "任务过期,如taskId过期。"), + CATCH_FRAME_FAILED(595, "截帧失败,请通过工单联系我们。"), + PERMISSION_DENY(596, "账号未授权、账号欠费、账号未开通、账号被禁等原因,具体可以参考返回的msg。"); + + + private Integer code; + private String desc; + + CommonErrorCodeEnum(Integer code, String desc) { + this.code = code; + this.desc = desc; + } + + public Integer getCode() { + return code; + } + + public void setCode(Integer code) { + this.code = code; + } + + public String getDesc() { + return desc; + } + + public void setDesc(String desc) { + this.desc = desc; + } + + public static String getErrorMsg(Integer value) { + CommonErrorCodeEnum[] codeEnums = values(); + for (CommonErrorCodeEnum commonErrorCodeEnum : codeEnums) { + if (commonErrorCodeEnum.getCode().equals(value)) { + return commonErrorCodeEnum.getDesc(); + } + } + return StrConstant.EPMETY_STR; + } +} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/VideoSceneEnum.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/VideoSceneEnum.java new file mode 100644 index 0000000000..864d137dd2 --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/VideoSceneEnum.java @@ -0,0 +1,50 @@ +package com.epmet.openapi.scan.common.enu; + +import java.util.ArrayList; +import java.util.List; + +/** + * desc:视频检测场景 + * @author yinzuomei@elink-cn.com + * @date 2020/12/29 13:47 + **/ +public enum VideoSceneEnum { + PORN("porn", "视频智能鉴黄"), + TERRORISM("terrorism", "视频暴恐涉政"), + LIVE("live","视频不良场景"), + LOGO("logo","视频logo"), + AD("ad","视频图文违规"); + + private String code; + private String desc; + + VideoSceneEnum(String code, String desc) { + this.code = code; + this.desc = desc; + } + + public static List getVideoSceneList() { + List result = new ArrayList<>(); + VideoSceneEnum[] values = VideoSceneEnum.values(); + for (VideoSceneEnum v : values) { + result.add(v.getCode()); + } + return result; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getDesc() { + return desc; + } + + public void setDesc(String desc) { + this.desc = desc; + } +} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/controller/ScanController.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/controller/ScanController.java index 27965201ac..cee27d28b8 100644 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/controller/ScanController.java +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/controller/ScanController.java @@ -2,14 +2,20 @@ package com.epmet.openapi.scan.controller; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.openapi.scan.common.constant.SysConstant; +import com.epmet.openapi.scan.common.enu.SysResponseEnum; import com.epmet.openapi.scan.service.impl.ScanService; import com.epmet.openapi.scan.support.param.ImgScanParam; import com.epmet.openapi.scan.support.param.TextScanParam; import com.epmet.openapi.scan.support.param.VoiceAsyncScanParam; +import com.epmet.openapi.scan.support.param.video.VideoAsyncScanParam; import com.epmet.openapi.scan.support.result.ImgAsyncScanResult; import com.epmet.openapi.scan.support.result.SyncScanResult; import com.epmet.openapi.scan.support.result.VoiceAsyncScanResult; import com.epmet.openapi.scan.support.result.VoiceAsyncScanTaskResult; +import com.epmet.openapi.scan.support.result.video.VideoAsyncScanTaskResultDTO; +import com.epmet.openapi.scan.support.result.video.VideoResultDTO; +import org.apache.commons.collections4.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -81,4 +87,30 @@ public class ScanController { return scanService.voiceResults(taskIds); } + /** + * @author yinzuomei + * @description 视频检测-异步检测 + **/ + @PostMapping("videoAsyncScan") + public Result videoAsyncScan(@RequestBody VideoAsyncScanParam param) { + ValidatorUtils.validateEntity(param); + return scanService.videoAsyncScan(param); + } + + /** + * @author yinzuomei + * @description 视频异步检测结果查询接口 + **/ + @PostMapping("videoResults") + public Result videoResults(@RequestBody List taskIds) { + if (CollectionUtils.isEmpty(taskIds)) { + return new Result<>(); + } + //检测对象不能为空,且最多支持100个元素 + if (org.springframework.util.CollectionUtils.isEmpty(taskIds) || taskIds.size() > SysConstant.MAX_TASK_SIZE) { + return new Result().error(SysResponseEnum.SCAN_TASK_LIST_PARAM_ERROR.getCode(), + SysResponseEnum.SCAN_TASK_LIST_PARAM_ERROR.getMsg().concat(SysConstant.MAX_TASK_SIZE.toString())); + } + return scanService.videoResults(taskIds); + } } diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/service/impl/ScanService.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/service/impl/ScanService.java index d238ef95e5..4a3e734893 100644 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/service/impl/ScanService.java +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/service/impl/ScanService.java @@ -4,9 +4,12 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.openapi.scan.support.param.ImgScanParam; import com.epmet.openapi.scan.support.param.TextScanParam; import com.epmet.openapi.scan.support.param.VoiceAsyncScanParam; +import com.epmet.openapi.scan.support.param.video.VideoAsyncScanParam; import com.epmet.openapi.scan.support.result.SyncScanResult; import com.epmet.openapi.scan.support.result.VoiceAsyncScanResult; import com.epmet.openapi.scan.support.result.VoiceAsyncScanTaskResult; +import com.epmet.openapi.scan.support.result.video.VideoAsyncScanTaskResultDTO; +import com.epmet.openapi.scan.support.result.video.VideoResultDTO; import java.util.List; @@ -48,4 +51,19 @@ public interface ScanService { * @return com.epmet.openapi.scan.support.result.VoiceAsyncScanResult */ Result> voiceResults(List taskIds); + + /** + * desc:视频检测-异步检测 + * @param videoAsyncScanParam + * @return 异步检测)返回数据:taskId<=>dataId + */ + Result videoAsyncScan(VideoAsyncScanParam videoAsyncScanParam); + + /** + * @param taskIds + * @author yinzuomei + * @description 视频异步检测结果查询接口 + * @Date 2020/12/29 16:10 + **/ + Result videoResults(List taskIds); } diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/service/impl/ScanServiceImpl.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/service/impl/ScanServiceImpl.java index b95091abcc..44dd0da3de 100644 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/service/impl/ScanServiceImpl.java +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/service/impl/ScanServiceImpl.java @@ -4,10 +4,7 @@ import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.aliyuncs.AcsRequest; -import com.aliyuncs.green.model.v20180509.ImageSyncScanRequest; -import com.aliyuncs.green.model.v20180509.TextScanRequest; -import com.aliyuncs.green.model.v20180509.VoiceAsyncScanRequest; -import com.aliyuncs.green.model.v20180509.VoiceAsyncScanResultsRequest; +import com.aliyuncs.green.model.v20180509.*; import com.aliyuncs.http.FormatType; import com.aliyuncs.http.HttpResponse; import com.epmet.commons.tools.constant.NumConstant; @@ -20,7 +17,10 @@ import com.epmet.openapi.scan.common.exception.ExecuteHttpException; import com.epmet.openapi.scan.common.redis.RedisKeys; import com.epmet.openapi.scan.common.util.IAcsClientUtil; import com.epmet.openapi.scan.support.param.*; +import com.epmet.openapi.scan.support.param.video.VideoAsyncScanParam; +import com.epmet.openapi.scan.support.param.video.VideoAsyncScanTask; import com.epmet.openapi.scan.support.result.*; +import com.epmet.openapi.scan.support.result.video.*; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.ListUtils; import org.apache.commons.lang3.StringUtils; @@ -504,4 +504,231 @@ public class ScanServiceImpl implements ScanService { return getResultsRequest; } + /** + * desc:视频检测-异步检测 + * + * @param videoAsyncScanParam + * @return + */ + @Override + public Result videoAsyncScan(VideoAsyncScanParam videoAsyncScanParam) { + //一次至多提交100个检测对象 + List videoTasks = videoAsyncScanParam.getTasks(); + if (CollectionUtils.isEmpty(videoTasks) || videoTasks.size() > SysConstant.MAX_TASK_SIZE) { + return new Result().error(SysResponseEnum.SCAN_TASK_LIST_PARAM_ERROR.getCode(), SysResponseEnum.SCAN_TASK_LIST_PARAM_ERROR.getMsg().concat(SysConstant.MAX_TASK_SIZE.toString())); + } + //默认参数赋值 + videoAsyncScanParam.setScenes(VideoSceneEnum.getVideoSceneList()); + videoAsyncScanParam.setBizType(bizType); + videoAsyncScanParam.setAudioScenes(VoiceSceneEnum.getVoiceSceneList()); + videoAsyncScanParam.setSeed(UUID.randomUUID().toString().replace("-", "")); + //API文档没写限制多少最大多少,应该与图片一致 + if (videoTasks.size() <= SysConstant.MAX_SCAN_IMG_TASK_SIZE) { + return doScanVideo(videoAsyncScanParam); + } + log.info("videoAsyncScan tasks size:{} over 10", videoTasks.size()); + //分组调用,一次提交10个 + List> partition = ListUtils.partition(videoTasks, SysConstant.MAX_SCAN_IMG_TASK_SIZE); + VideoAsyncScanTaskResultDTO finalResult = new VideoAsyncScanTaskResultDTO(); + for (List tasks : partition) { + VideoAsyncScanParam videParam = new VideoAsyncScanParam(); + videParam.setBizType(videoAsyncScanParam.getBizType()); + videParam.setScenes(videoAsyncScanParam.getScenes()); + videParam.setTasks(tasks); + videParam.setCallback(videoAsyncScanParam.getCallback()); + videParam.setSeed(videoAsyncScanParam.getSeed()); + videParam.setAudioScenes(videoAsyncScanParam.getAudioScenes()); + Result partResult = doScanVideo(videParam); + try { + Thread.sleep(5L); + } catch (InterruptedException e) { + log.error("videoAsyncScan InterruptedException"); + } + if (partResult.success()) { + VideoAsyncScanTaskResultDTO data = partResult.getData(); + finalResult.setSeed(data.getSeed()); + finalResult.getSuccessTasks().addAll(data.getSuccessTasks()); + finalResult.getFailTasks().addAll(data.getFailTasks()); + } else { + return partResult; + } + } + return new Result().ok(finalResult); + } + + private Result doScanVideo(VideoAsyncScanParam videoAsyncScanParam) { + VideoAsyncScanRequest videoAsyncScanRequest = getVideoAsyncScanRequest(); + try { + videoAsyncScanRequest.setHttpContent(JSON.toJSONString(videoAsyncScanParam).getBytes(SysConstant.UTF8), SysConstant.UTF8, FormatType.JSON); + } catch (UnsupportedEncodingException e) { + log.error("doScanVideo parse param exception", e); + return new Result().error(SysResponseEnum.SCAN_PARAM_ERROR.getCode(), SysResponseEnum.SCAN_PARAM_ERROR.getMsg()); + } + + try { + VideoAsyncScanTaskResultDTO scanResult = executeAsyncVideo(videoAsyncScanRequest); + scanResult.setSeed(videoAsyncScanParam.getSeed()); + return new Result().ok(scanResult); + } catch (ExecuteHttpException e) { + log.error("doScanVideo execute exception,param:{},fail msg:{}", JSON.toJSONString(videoAsyncScanParam), e.getMsg()); + return new Result().error(e.getCode(), e.getMsg()); + } + } + + private VideoAsyncScanRequest getVideoAsyncScanRequest() { + VideoAsyncScanRequest videoAsyncScanRequest = new VideoAsyncScanRequest(); + videoAsyncScanRequest.setAcceptFormat(FormatType.JSON); // 指定API返回格式。 + videoAsyncScanRequest.setMethod(com.aliyuncs.http.MethodType.POST); // 指定请求方法。 + /** + * 请务必设置超时时间。 + */ + videoAsyncScanRequest.setConnectTimeout(3000); + videoAsyncScanRequest.setReadTimeout(6000); + return videoAsyncScanRequest; + } + + private VideoAsyncScanTaskResultDTO executeAsyncVideo(VideoAsyncScanRequest videoAsyncScanRequest) { + try { + HttpResponse httpResponse = IAcsClientUtil.getIAcsClient().doAction(videoAsyncScanRequest); + if (httpResponse.isSuccess()) { + JSONObject scrResponse = JSON.parseObject(new String(httpResponse.getHttpContent(), "UTF-8")); + if (HttpStatus.SC_OK == scrResponse.getInteger(SysConstant.CODE)) { + //获取data列表 + JSONArray dataResults = scrResponse.getJSONArray(SysConstant.DATA); + List dataList = dataResults.toJavaList(VideoAsyncScanTaskDataDTO.class); + VideoAsyncScanTaskResultDTO result=new VideoAsyncScanTaskResultDTO(); + dataList.forEach(data->{ + if (HttpStatus.SC_OK == data.getCode()) { + result.getSuccessTasks().add(data); + } else { + result.getFailTasks().add(data); + } + }); + return result; + } else { + log.warn("executeAsyncVideo detect not success. code:{}", scrResponse.getInteger(SysConstant.CODE)); + throw new ExecuteHttpException(SysResponseEnum.THIRD_PLATFORM_RESP_CODE_ERROR.getCode(), + SysResponseEnum.THIRD_PLATFORM_RESP_CODE_ERROR.getMsg() + ",status:" + httpResponse.getStatus()); + } + } else { + log.warn("executeAsyncVideo response status is not success. httpResponse:{}", JSON.toJSONString(httpResponse)); + throw new ExecuteHttpException(SysResponseEnum.THIRD_PLATFORM_RESP_STATUS_ERROR.getCode(), + SysResponseEnum.THIRD_PLATFORM_RESP_STATUS_ERROR.getMsg() + ",status:" + httpResponse.getStatus()); + } + } catch (Exception e) { + log.error("executeAsyncVideo exception IAcsClientUtil do action exception", e); + throw new ExecuteHttpException(SysResponseEnum.THIRD_PLATFORM_SERVER_ERROR.getCode(), SysResponseEnum.THIRD_PLATFORM_SERVER_ERROR.getMsg()); + } + } + + /** + * @param taskIds + * @author yinzuomei + * @description 视频异步检测结果查询接口 + * @Date 2020/12/29 16:10 + **/ + @Override + public Result videoResults(List taskIds) { + VideoAsyncScanResultsRequest videoAsyncScanResultsRequest = new VideoAsyncScanResultsRequest(); + videoAsyncScanResultsRequest.setAcceptFormat(FormatType.JSON); + videoAsyncScanResultsRequest.setMethod(com.aliyuncs.http.MethodType.POST); + videoAsyncScanResultsRequest.setConnectTimeout(3000); + videoAsyncScanResultsRequest.setReadTimeout(6000); + try { + videoAsyncScanResultsRequest.setHttpContent(JSON.toJSONString(taskIds).getBytes("UTF-8"), "UTF-8", FormatType.JSON); + } catch (UnsupportedEncodingException e) { + log.error("videoResults parse param exception", e); + return new Result().error(SysResponseEnum.SCAN_PARAM_ERROR.getCode(), SysResponseEnum.SCAN_PARAM_ERROR.getMsg()); + } + try { + HttpResponse httpResponse = IAcsClientUtil.getIAcsClient().doAction(videoAsyncScanResultsRequest); + if (httpResponse.isSuccess()) { + JSONObject responseObject = JSON.parseObject(new String(httpResponse.getHttpContent(), "UTF-8")); + log.info("查询视频检测结果返参"+JSON.toJSONString(responseObject)); + if (HttpStatus.SC_OK == responseObject.getInteger(SysConstant.CODE)) { + //获取data列表 + JSONArray dataResults = responseObject.getJSONArray(SysConstant.DATA); + List resultList = dataResults.toJavaList(VideoScanOriginalResultDTO.class); + //解析数据 + VideoResultDTO resultDTO = processVideoResults(resultList); + //成功返回 + return new Result().ok(resultDTO); + } else { + log.warn("查询视频检测结果,接口返回code=" + responseObject.getInteger(SysConstant.CODE)); + throw new ExecuteHttpException(SysResponseEnum.THIRD_PLATFORM_RESP_CODE_ERROR.getCode(), + SysResponseEnum.THIRD_PLATFORM_RESP_CODE_ERROR.getMsg() + ",status:" + httpResponse.getStatus()); + } + } else { + log.warn("查询视频检测结果,API返回失败"); + throw new ExecuteHttpException(SysResponseEnum.THIRD_PLATFORM_RESP_STATUS_ERROR.getCode(), + SysResponseEnum.THIRD_PLATFORM_RESP_STATUS_ERROR.getMsg() + ",status:" + httpResponse.getStatus()); + } + } catch (Exception e) { + log.error("videoResults exception ", e); + throw new ExecuteHttpException(SysResponseEnum.THIRD_PLATFORM_SERVER_ERROR.getCode(), SysResponseEnum.THIRD_PLATFORM_SERVER_ERROR.getMsg()); + } + } + + /** + * @author yinzuomei + * @description + **/ + private VideoResultDTO processVideoResults(List resultList) { + VideoResultDTO videoResultDTO = new VideoResultDTO(); + resultList.forEach(result -> { + result.setCodeDesc(CommonErrorCodeEnum.getErrorMsg(result.getCode())); + if (result.getCode().equals(CommonErrorCodeEnum.PROCESSING.getCode())) { + //任务正在检测中,继续轮询 + } else if (result.getCode().equals(CommonErrorCodeEnum.OK.getCode())) { + //成功=>分析结果 + boolean videoPassFlag = getVideoFlag(result.getResults()); + boolean voicePassFlag = getVoiceFlag(result.getAudioScanResults()); + if (videoPassFlag && voicePassFlag) { + videoResultDTO.getPassDataIds().add(result.getDataId()); + videoResultDTO.getPassTaskIds().add(result.getTaskId()); + } else { + videoResultDTO.getNoPassDataIds().add(result.getDataId()); + videoResultDTO.getNoPassTaskIds().add(result.getTaskId()); + } + } else { + //检测结果走丢了.... (*^▽^*) 默认失败 + videoResultDTO.getNoPassDataIds().add(result.getDataId()); + videoResultDTO.getNoPassTaskIds().add(result.getTaskId()); + } + }); + videoResultDTO.setDetails(resultList); + return videoResultDTO; + } + + /** + * @return boolean + * @author yinzuomei + * @description 视频检测结果判断 + **/ + private boolean getVideoFlag(List results) { + for(VideoScanOriginDetail videoRes:results){ + if (!SuggestionEnum.PASS.getCode().equals(videoRes.getSuggestion())) { + return false; + } + } + return true; + } + + /** + * @return boolean true:内容通过; 建议为内容违规或者需要人工审核的统一视为不通过,返回false + * @author yinzuomei + * @description 返回视频语音检测结果 + **/ + private boolean getVoiceFlag(List audioScanResults) { + if (CollectionUtils.isEmpty(audioScanResults)) { + return true; + } + for(VoiceAsyncScanResultDTO m:audioScanResults){ + //人工审核或者内容违规,统一视为不通过 + if (!SuggestionEnum.PASS.getCode().equals(m.getSuggestion())) { + return false; + } + } + return true; + } } diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/video/VideoAsyncScanParam.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/video/VideoAsyncScanParam.java new file mode 100644 index 0000000000..c0315f8c17 --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/video/VideoAsyncScanParam.java @@ -0,0 +1,76 @@ +package com.epmet.openapi.scan.support.param.video; + +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import java.io.Serializable; +import java.util.List; + +/** + * 视频审核-异步检测入参DTO + * + * @author yinzuomei@elink-cn.com + */ +@Data +public class VideoAsyncScanParam implements Serializable { + private static final long serialVersionUID = -7635290200099445362L; + + /** + * 是否开启回调 + */ + private Boolean openCallBack; + + /** + * 不必填 + * 该字段用于标识您的业务场景。您可以通过内容安全控制台创建业务场景(具体操作,请参见自定义机审标准),或者提交工单联系我们帮助您创建业务场景。 + */ + private String bizType; + + /** + * 不必填 + * 是否为语音流(例如直播流)检测。取值: + * true:表示语音流检测。 + * false(默认):表示音频文件检测。 + */ + private Boolean live; + + /** + * 不必填 + * 是否为近线检测模式。 取值: + * true:表示近线检测模式。近线检测模式下,您提交的任务不保证能够实时处理,但是可以排队并在24小时内开始检测。 + * false(默认):表示实时检测模式。对于超过了并发路数限制的检测请求会直接拒绝。 + * 说明 该参数仅适用于音频文件检测,不适用于语音流检测。 + */ + private Boolean offline; + + /** + * 必填 + * 指定视频检测场景。取值: + * porn:视频智能鉴黄 + * terrorism:视频暴恐涉政 + * live:视频不良场景 + * logo:视频logo + * ad:视频图文违规 + */ + private List scenes; + + /** + * 不必填 + * 指定视频语音检测场景,唯一取值:antispam,表示语音反垃圾。不传入该参数时仅检测视频图像内容;如果传入该参数,则在检测视频中图像的同时,对视频中语音进行检测。 + * 说明 如果需要检测视频语音,则不支持通过上传视频截帧序列的方式(即在task中传入frames)进行检测,您必须传入视频或视频流的URL地址(即在task中传入url)进行检测。 + */ + private List audioScenes; + + /** + * 异步检测结果回调地址,执行异步审查内容时 必填 + */ + private String callback; + + /** + * 随机字符串,该值用于回调通知请求中的签名,使用callback时 必填 + */ + private String seed; + + @NotEmpty(message = "检测对象不能为空") + private List tasks; +} \ No newline at end of file diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/video/VideoAsyncScanTask.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/video/VideoAsyncScanTask.java new file mode 100644 index 0000000000..38a4584d94 --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/video/VideoAsyncScanTask.java @@ -0,0 +1,30 @@ +package com.epmet.openapi.scan.support.param.video; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 视频审核-异步检测入参-检测对象 + * + * @author yinzuomei@elink-cn.com + */ +@Data +public class VideoAsyncScanTask implements Serializable { + /** + * 建议必填 + * 要检测的数据id 非必填 + * 检测对象对应的数据ID。 + * 由大小写英文字母、数字、下划线(_)、短划线(-)、英文句号(.)组成,不超过128个字符,可以用于唯一标识您的业务数据。 + * */ + @NotBlank(message = "dataId不能为空") + private String dataId; + + /** + * 必填 + * 待检测视频的URL。该字段不能和frames同时为空,也不能和frames同时有值。 + */ + @NotBlank(message = "音频URL不能为空") + private String url; +} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/video/VideoAsyncScanTaskDataDTO.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/video/VideoAsyncScanTaskDataDTO.java new file mode 100644 index 0000000000..1d559a31cd --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/video/VideoAsyncScanTaskDataDTO.java @@ -0,0 +1,41 @@ +package com.epmet.openapi.scan.support.result.video; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; + +import java.io.Serializable; + +/** + * 视频审核-异步检测任务提交返参详情 + * + * @author yinzuomei@elink-cn.com + * @date 2020/12/29 13:42 + */ +@Data +public class VideoAsyncScanTaskDataDTO implements Serializable { + private static final long serialVersionUID = 8430710131685814181L; + /** + * 错误码,和HTTP状态码一致。 + * 更多信息,请参见公共错误码。 + */ + private Integer code; + /** + * 错误描述信息。 + */ + private String msg; + /** + * 检测对象对应的数据ID。 + */ + private String dataId; + + /** + * 检测任务的ID + */ + private String taskId; + + /** + * 暂时没用,所以返回忽略 + */ + @JsonIgnore + private String url; +} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/video/VideoAsyncScanTaskResultDTO.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/video/VideoAsyncScanTaskResultDTO.java new file mode 100644 index 0000000000..75ecd6e84f --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/video/VideoAsyncScanTaskResultDTO.java @@ -0,0 +1,45 @@ +package com.epmet.openapi.scan.support.result.video; + +import lombok.Data; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +/** + * 视频审核-异步检测任务提交返参 + * + * @author yinzuomei@elink-cn.com + * @date 2020/12/29 13:38 + */ +@Data +public class VideoAsyncScanTaskResultDTO implements Serializable { + private static final long serialVersionUID = -467990806428860191L; + + /** + * 随机字符串,该值用于回调通知请求中的签名。 + */ + private String seed; + + /** + * 提交成功的失败对象 + */ + private List successTasks=new ArrayList<>(); + + /** + * 提交失败的检测对象 + */ + private List failTasks=new ArrayList<>(); + + /** + * 是否全部提交成功 + */ + private Boolean isAllSuccess; + + public boolean isAllSuccess() { + if (failTasks.isEmpty() && !successTasks.isEmpty()) { + return true; + } + return isAllSuccess; + } +} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/video/VideoResultDTO.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/video/VideoResultDTO.java new file mode 100644 index 0000000000..0e781bf463 --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/video/VideoResultDTO.java @@ -0,0 +1,48 @@ +package com.epmet.openapi.scan.support.result.video; + +import lombok.Data; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +/** + * 视频异步检测结果查询接口返参 + * 正在检测中的不返回,调用方继续轮询查询结果 + * @author yinzuomei@elink-cn.com + * @date 2020/12/29 15:37 + */ +@Data +public class VideoResultDTO implements Serializable { + private static final long serialVersionUID = -3451342817149956488L; + + /** + * 执行成功的任务Id集合 + * code=200,且所有语音+视频所有场景返回结果都为pass时则为成功 + */ + private List passDataIds = new ArrayList<>(); + /** + * 执行失败的任务Id集合 + */ + private List noPassDataIds = new ArrayList<>(); + + private List passTaskIds = new ArrayList<>(); + private List noPassTaskIds = new ArrayList<>(); + + /** + * desc:阿里内容审核API返回结果详情 + */ + private List details = new ArrayList<>(); + + /** + * 本地是否全部通过 + */ + private Boolean isAllPass; + + public boolean isAllPass() { + if (noPassTaskIds.isEmpty() && !passTaskIds.isEmpty()) { + return true; + } + return isAllPass; + } +} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/video/VideoScanOriginDetail.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/video/VideoScanOriginDetail.java new file mode 100644 index 0000000000..78916c1fe6 --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/video/VideoScanOriginDetail.java @@ -0,0 +1,53 @@ +package com.epmet.openapi.scan.support.result.video; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 视频异步检测结果查询接口原生返参-视频检测结果 + * + * @author yinzuomei@elink-cn.com + * @date 2020/12/29 16:39 + */ +@Data +public class VideoScanOriginDetail implements Serializable { + private static final long serialVersionUID = 5547706236158849091L; + /** + * 视频检测场景,和调用请求中的场景对应。取值: + * porn:视频智能鉴黄 + * terrorism:视频暴恐涉政 + * live:视频不良场景 + * logo:视频logo + * ad:视频图文违规 + */ + private String scene; + + /** + * 视频检测结果的分类。不同检测场景的结果分类不同,具体如下: + * 视频智能鉴黄(porn)结果分类: + * normal:正常 + * porn:色情 + * 视频暴恐涉政(terrorism)结果分类: + * normal:正常 + * terrorism:暴恐涉政 + * 视频不良场景(live)结果分类: + * normal:正常 + * live:包含不良场景 + * 视频logo(logo)结果分类: + * normal:正常 + * logo:包含logo + * 视频图文违规(ad)结果分类: + * normal:正常 + * ad:包含广告或文字违规信息 + */ + private String label; + + /** + * 建议您执行的后续操作。取值: + * pass:结果正常,无需进行其余操作。 + * review:结果不确定,需要进行人工审核。 + * block:结果违规,建议直接删除或者限制公开。 + */ + private String suggestion; +} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/video/VideoScanOriginalResultDTO.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/video/VideoScanOriginalResultDTO.java new file mode 100644 index 0000000000..8964d5fe00 --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/video/VideoScanOriginalResultDTO.java @@ -0,0 +1,51 @@ +package com.epmet.openapi.scan.support.result.video; + +import com.epmet.openapi.scan.support.result.VoiceAsyncScanResultDTO; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * 视频异步检测结果查询接口原生返参 + * + * @author yinzuomei@elink-cn.com + * @date 2020/12/29 15:48 + */ +@Data +public class VideoScanOriginalResultDTO implements Serializable { + private static final long serialVersionUID = -1565008507757551616L; + + /** + * 错误码,和HTTP状态码一致。 + * 更多信息,请参见公共错误码。 + */ + private Integer code; + + private String codeDesc; + + /** + * 错误描述信息。 + */ + private String msg; + /** + * 检测对象对应的数据ID。 + */ + private String dataId; + + /** + * 检测任务的ID + */ + private String taskId; + + /** + * 返回结果,调用成功时(code=200),返回结果中包含一个或多个元素。每个元素是个结构体,具体结构描述,请参见result。 + * 说明 视频流检测场景中,code返回280表示在检测中,返回200表示检测完成。在检测中状态时,检测结果中包含从开始检测到当前时间的检测到结果。 + */ + private List results; + + /** + * 视频语音检测结果。具体结构描述,请参见audioScanResult。 + */ + private List audioScanResults; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/UserWechatDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/UserWechatDTO.java index 0f307c3d47..1d794e0c30 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/UserWechatDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/UserWechatDTO.java @@ -110,4 +110,9 @@ public class UserWechatDTO implements Serializable{ //@JsonIgnore private String sessionKey; + + /** + * 客户ID + */ + private String customerId; } 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 b31f94ddff..494fce4e3f 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 @@ -469,4 +469,12 @@ public interface EpmetUserOpenFeignClient { @PostMapping(value = "epmetuser/staffrole/specificrolesstaffs", consumes = MediaType.APPLICATION_JSON_VALUE) Result> specificRolesStaffs(RolesUsersListFormDTO rolesUsersListFormDTO); + + /** + * 为客户初始化政府端工作人员角色 + * @param customerId + * @return + */ + @PostMapping("/epmetuser/staffrole/initrolesforcustomer/{customerId}") + Result initGovStaffRolesForCustomer(@PathVariable String customerId); } 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 69371a19cd..7137d3ad1d 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 @@ -331,4 +331,9 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien public Result> specificRolesStaffs(RolesUsersListFormDTO rolesUsersListFormDTO) { return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "specificRolesStaffs", rolesUsersListFormDTO); } + + @Override + public Result initGovStaffRolesForCustomer(String customerId) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "initGovStaffRolesForCustomer", customerId); + } } diff --git a/epmet-user/epmet-user-server/pom.xml b/epmet-user/epmet-user-server/pom.xml index 67888acc41..847367216c 100644 --- a/epmet-user/epmet-user-server/pom.xml +++ b/epmet-user/epmet-user-server/pom.xml @@ -112,6 +112,12 @@ 2.0.0 compile + + + com.epmet + epmet-commons-rocketmq + 2.0.0 + diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleDao.java index f7875d63d5..5992dfb720 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleDao.java @@ -77,4 +77,6 @@ public interface GovStaffRoleDao extends BaseDao { int updateSortById(@Param("roleId") String roleId, @Param("sort") int sort); List listRolesByRoleKey(@Param("roleKey") String roleKey); + + Integer countRolesByCustomerId(@Param("customerId") String customerId); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/mq/listener/InitCustomerRolesListener.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/mq/listener/InitCustomerRolesListener.java new file mode 100644 index 0000000000..a50da7561e --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/mq/listener/InitCustomerRolesListener.java @@ -0,0 +1,39 @@ +//package com.epmet.mq.listener; +// +//import com.alibaba.fastjson.JSON; +//import com.epmet.commons.rocketmq.constants.ConsomerGroupConstants; +//import com.epmet.commons.rocketmq.constants.TopicConstants; +//import com.epmet.commons.rocketmq.messages.InitCustomerMQMsg; +//import com.epmet.service.GovStaffRoleService; +//import org.apache.rocketmq.common.message.MessageExt; +//import org.apache.rocketmq.spring.annotation.MessageModel; +//import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; +//import org.apache.rocketmq.spring.core.RocketMQListener; +//import org.slf4j.Logger; +//import org.slf4j.LoggerFactory; +//import org.springframework.beans.factory.annotation.Autowired; +//import org.springframework.stereotype.Component; +// +///** +// * 监听初始化客户动作,为客户初始化角色列表 +// */ +//@RocketMQMessageListener(topic = TopicConstants.INIT_CUSTOMER, +// consumerGroup = ConsomerGroupConstants.INIT_CUSTOMER_ROLES_GROUP, +// messageModel = MessageModel.CLUSTERING, +// selectorExpression = "*") +//@Component +//public class InitCustomerRolesListener implements RocketMQListener { +// +// private Logger logger = LoggerFactory.getLogger(getClass()); +// +// @Autowired +// private GovStaffRoleService govStaffRoleService; +// +// @Override +// public void onMessage(MessageExt messageExt) { +// String msg = new String(messageExt.getBody()); +// logger.info("初始化客户-初始化角色列表-收到消息内容:{}", msg); +// InitCustomerMQMsg msgObj = JSON.parseObject(msg, InitCustomerMQMsg.class); +// govStaffRoleService.initGovStaffRolesForCustomer(msgObj.getCustomerId()); +// } +//} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java index 726be2370d..16c6a375e2 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java @@ -39,6 +39,8 @@ import com.epmet.feign.GovAccessFeignClient; import com.epmet.redis.GovStaffRoleRedis; import com.epmet.service.GovStaffRoleService; 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 org.springframework.transaction.annotation.Transactional; @@ -57,6 +59,8 @@ import java.util.Map; @Service public class GovStaffRoleServiceImpl extends BaseServiceImpl implements GovStaffRoleService { + private Logger logger = LoggerFactory.getLogger(getClass()); + @Autowired private GovStaffRoleRedis govStaffRoleRedis; @@ -140,8 +144,13 @@ public class GovStaffRoleServiceImpl extends BaseServiceImpl 0) { + logger.info("为客户初始化角色列表-该客户【客户ID:%s】已存在角色信息,无需再次初始化。", customerId); + return; + } // 增加角色列表 List validRoles = govStaffRoleTemplateDao.listValidateRoles(); diff --git a/epmet-user/epmet-user-server/src/main/resources/bootstrap.yml b/epmet-user/epmet-user-server/src/main/resources/bootstrap.yml index e05a958192..68f5492ae8 100644 --- a/epmet-user/epmet-user-server/src/main/resources/bootstrap.yml +++ b/epmet-user/epmet-user-server/src/main/resources/bootstrap.yml @@ -146,6 +146,9 @@ dingTalk: webHook: @dingTalk.robot.webHook@ secret: @dingTalk.robot.secret@ +rocketmq: + name-server: 192.168.1.130:9876;192.168.1.132:9876 + # 停机选项 shutdown: graceful: diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml index 40539c565f..87a5fc01e7 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml @@ -111,4 +111,10 @@ where gsr.ROLE_KEY = #{roleKey} and gsr.DEL_FLAG=0 + + \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/UserResiInfoDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/UserResiInfoDao.xml index 3e6adef055..1dca8f531b 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/UserResiInfoDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/UserResiInfoDao.xml @@ -70,7 +70,7 @@ ubi.NICKNAME as nickName FROM user_base_info ubi - LEFT JOIN user_resi_info uri ON ( ubi.USER_ID = uri.USER_ID AND uri.DEL_FLAG = '0' ) + INNER JOIN user_resi_info uri ON ( ubi.USER_ID = uri.USER_ID AND uri.DEL_FLAG = '0' ) WHERE ubi.USER_ID =#{userId} AND ubi.DEL_FLAG = '0'