diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ServiceConstant.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ServiceConstant.java index eab4df7b72..6083e647f6 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ServiceConstant.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ServiceConstant.java @@ -73,4 +73,9 @@ public interface ServiceConstant { * 消息服务 */ String EPMET_MESSAGE_SERVER = "epmet-message-server"; + + /** + * 楼院小组 + */ + String RESI_GROUP_SERVER ="resi-group-server"; } diff --git a/epmet-gateway/pom.xml b/epmet-gateway/pom.xml index a451ebf0b2..0c1bb611f6 100644 --- a/epmet-gateway/pom.xml +++ b/epmet-gateway/pom.xml @@ -154,6 +154,8 @@ http://127.0.0.1:8095 http://127.0.0.1:8096 + + http://127.0.0.1:8097 @@ -211,6 +213,8 @@ lb://resi-group-server lb://resi-partymember-server + + lb://gov-grid-server @@ -267,6 +271,8 @@ lb://resi-group-server lb://resi-partymember-server + + lb://gov-grid-server diff --git a/epmet-gateway/src/main/resources/bootstrap.yml b/epmet-gateway/src/main/resources/bootstrap.yml index dec03ba191..df1d12f050 100644 --- a/epmet-gateway/src/main/resources/bootstrap.yml +++ b/epmet-gateway/src/main/resources/bootstrap.yml @@ -167,6 +167,15 @@ spring: filters: - StripPrefix=1 - CpAuth=true + #政府端网格管理 + - id: gov-grid-server + uri: @gateway.routes.gov-grid-server.uri@ + order: 18 + predicates: + - Path=${server.servlet.context-path}/gov/grid/** + filters: + - StripPrefix=1 + - CpAuth=true nacos: discovery: server-addr: @nacos.server-addr@ @@ -206,6 +215,7 @@ renren: - /resi/mine/** - /resi/group/** - /resi/partymember/** + - /gov/grid/** management: endpoints: web: @@ -272,6 +282,7 @@ epmet: - /resi/mine/** - /resi/group/** - /resi/partymember/** + - /gov/grid/** swaggerUrls: jwt: diff --git a/epmet-module/gov-grid/gov-grid-client/pom.xml b/epmet-module/gov-grid/gov-grid-client/pom.xml new file mode 100644 index 0000000000..297cb07121 --- /dev/null +++ b/epmet-module/gov-grid/gov-grid-client/pom.xml @@ -0,0 +1,25 @@ + + + + gov-grid + com.epmet + 2.0.0 + + 4.0.0 + + gov-grid-client + + + javax.validation + validation-api + + + org.projectlombok + lombok + + + + + \ No newline at end of file diff --git a/epmet-module/gov-grid/gov-grid-client/src/main/java/com/epmet/dto/.gitkeep b/epmet-module/gov-grid/gov-grid-client/src/main/java/com/epmet/dto/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/epmet-module/gov-grid/gov-grid-client/src/main/java/com/epmet/dto/form/.gitkeep b/epmet-module/gov-grid/gov-grid-client/src/main/java/com/epmet/dto/form/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/epmet-module/gov-grid/gov-grid-client/src/main/java/com/epmet/dto/result/.gitkeep b/epmet-module/gov-grid/gov-grid-client/src/main/java/com/epmet/dto/result/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/epmet-module/gov-grid/gov-grid-server/Dockerfile b/epmet-module/gov-grid/gov-grid-server/Dockerfile new file mode 100644 index 0000000000..b0772443a7 --- /dev/null +++ b/epmet-module/gov-grid/gov-grid-server/Dockerfile @@ -0,0 +1,11 @@ +FROM java:8 + +RUN export LANG="zh_CN.UTF-8" +RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime +RUN echo 'Asia/Shanghai' > /etc/timezone + +COPY ./target/*.jar ./app.jar + +EXPOSE 8097 + +ENTRYPOINT ["java","-Xms32m","-Xmx200m","-jar","./app.jar"] \ No newline at end of file diff --git a/epmet-module/gov-grid/gov-grid-server/docker-compose.yml b/epmet-module/gov-grid/gov-grid-server/docker-compose.yml new file mode 100644 index 0000000000..add5f80e47 --- /dev/null +++ b/epmet-module/gov-grid/gov-grid-server/docker-compose.yml @@ -0,0 +1,15 @@ +version: "3.7" +services: + gov-grid-server: + container_name: gov-grid-server-dev + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-dev/gov-grid-server:0.3.0 + ports: + - "8097:8097" + network_mode: host # 使用现有网络 + volumes: + - "/opt/epmet-cloud-logs/dev:/logs" + deploy: + resources: + limits: + cpus: '0.1' + memory: 250M \ No newline at end of file diff --git a/epmet-module/gov-grid/gov-grid-server/pom.xml b/epmet-module/gov-grid/gov-grid-server/pom.xml new file mode 100644 index 0000000000..7728630e09 --- /dev/null +++ b/epmet-module/gov-grid/gov-grid-server/pom.xml @@ -0,0 +1,169 @@ + + + 4.0.0 + 0.3.0 + + com.epmet + gov-grid + 2.0.0 + + gov-grid-server + jar + + + + com.epmet + gov-grid-client + 2.0.0 + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework + spring-context-support + + + org.springframework.boot + spring-boot-starter-actuator + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-discovery + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-config + + + + io.github.openfeign + feign-httpclient + 10.3.0 + + + + + com.epmet + gov-org-client + 2.0.0 + + + com.epmet + resi-partymember-client + 2.0.0 + compile + + + com.epmet + resi-group-client + 2.0.0 + compile + + + + + ${project.artifactId} + + + org.springframework.boot + spring-boot-maven-plugin + + + org.apache.maven.plugins + maven-surefire-plugin + + true + + + + + ${project.basedir}/src/main/java + + + true + ${basedir}/src/main/resources + + + + + + + dev-local + + true + + + 8097 + dev + + + 0 + 127.0.0.1 + 6379 + 123456 + + false + 122.152.200.70:8848 + fcd6fc8f-ca3a-4b01-8026-2b05cdc5976b + + + false + + + + + dev + + + 8097 + dev + + + 0 + r-m5eoz5b6tkx09y6bpz.redis.rds.aliyuncs.com + 6379 + EpmEtrEdIs!q@w + + true + 192.168.10.150:8848 + 67e3c350-533e-4d7c-9f8f-faf1b4aa82ae + + + false + + + + + test + + + 8097 + test + + + 0 + 10.10.10.248 + 6379 + 123456 + + true + 122.152.200.70:8848 + fcd6fc8f-ca3a-4b01-8026-2b05cdc5976b + + + false + + + + + + + \ No newline at end of file diff --git a/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/GovGridApplication.java b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/GovGridApplication.java new file mode 100644 index 0000000000..ac047e4a68 --- /dev/null +++ b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/GovGridApplication.java @@ -0,0 +1,23 @@ +package com.epmet; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.client.discovery.EnableDiscoveryClient; +import org.springframework.cloud.openfeign.EnableFeignClients; + +/** + * + * + * @author Mark sunlightcs@gmail.com + * @since 1.0.0 + */ +@SpringBootApplication +@EnableDiscoveryClient +@EnableFeignClients +public class GovGridApplication { + + public static void main(String[] args) { + SpringApplication.run(GovGridApplication.class, args); + } + +} diff --git a/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/config/ModuleConfigImpl.java b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/config/ModuleConfigImpl.java new file mode 100644 index 0000000000..e15538fdaa --- /dev/null +++ b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/config/ModuleConfigImpl.java @@ -0,0 +1,26 @@ +/** + * Copyright (c) 2018 人人开源 All rights reserved. + * + * https://www.renren.io + * + * 版权所有,侵权必究! + */ + +package com.epmet.config; + +import com.epmet.commons.tools.config.ModuleConfig; +import org.springframework.stereotype.Service; + +/** + * 模块配置信息 + * + * @author Mark sunlightcs@gmail.com + * @since 1.0.0 + */ +@Service +public class ModuleConfigImpl implements ModuleConfig { + @Override + public String getName() { + return "govgrid"; + } +} diff --git a/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/config/SwaggerConfig.java b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/config/SwaggerConfig.java new file mode 100644 index 0000000000..e4ceef42ee --- /dev/null +++ b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/config/SwaggerConfig.java @@ -0,0 +1,68 @@ +/** + * Copyright (c) 2018 人人开源 All rights reserved. + * + * https://www.renren.io + * + * 版权所有,侵权必究! + */ + +package com.epmet.config; + +import com.epmet.commons.tools.constant.Constant; +import io.swagger.annotations.ApiOperation; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import springfox.documentation.builders.ApiInfoBuilder; +import springfox.documentation.builders.PathSelectors; +import springfox.documentation.builders.RequestHandlerSelectors; +import springfox.documentation.service.ApiInfo; +import springfox.documentation.service.ApiKey; +import springfox.documentation.spi.DocumentationType; +import springfox.documentation.spring.web.plugins.Docket; +import springfox.documentation.swagger2.annotations.EnableSwagger2; + +import java.util.List; + +import static com.google.common.collect.Lists.newArrayList; + +/** + * Swagger配置 + * + * @author Mark sunlightcs@gmail.com + * @since 1.0.0 + */ +@Configuration +@EnableSwagger2 +public class SwaggerConfig { + + @Bean + public Docket createRestApi() { + return new Docket(DocumentationType.SWAGGER_2) + .apiInfo(apiInfo()) + .select() + //加了ApiOperation注解的类,才生成接口文档 + .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)) + //包下的类,才生成接口文档 + //.apis(RequestHandlerSelectors.basePackage("io.renren.controller")) + .paths(PathSelectors.any()) + .build() + .directModelSubstitute(java.util.Date.class, String.class) + .securitySchemes(security()); + } + + private ApiInfo apiInfo() { + return new ApiInfoBuilder() + .title("人人开源") + .description("系统模块开发文档") + .termsOfServiceUrl("https://www.renren.io/community") + .version("1.4.0") + .build(); + } + + private List security() { + return newArrayList( + new ApiKey(Constant.TOKEN_HEADER, Constant.TOKEN_HEADER, "header") + ); + } + +} diff --git a/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/controller/ResiGroupController.java b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/controller/ResiGroupController.java new file mode 100644 index 0000000000..128c08fa0a --- /dev/null +++ b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/controller/ResiGroupController.java @@ -0,0 +1,126 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.resi.group.dto.group.form.*; +import com.epmet.resi.group.dto.group.result.ApplyingGroupDetailResultDTO; +import com.epmet.resi.group.dto.group.result.ApplyingGroupResultDTO; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.resi.group.dto.group.form.GovGroupSummarizeFromDTO; +import com.epmet.resi.group.dto.group.form.GroupAuditedFromDTO; +import com.epmet.resi.group.dto.group.result.GovGroupSummarizeResultDTO; +import com.epmet.resi.group.dto.group.result.GroupAuditedResultDTO; +import com.epmet.resi.group.dto.group.result.GroupsInGridResultDTO; +import com.epmet.service.ResiGroupService; +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; + +/** + * @Description 政府端管理楼院小组业务 + * @ClassName ResiGroupController + * @Author wangc + * @date 2020.04.16 15:30 + */ +@RestController +@RequestMapping("resi/group") +public class ResiGroupController { + @Autowired + ResiGroupService resiGroupService; + /** + * 小组审核历史列表 + * + * @param formDTO 参数 + * @return + */ + @PostMapping("audited") + public Result> audited(@RequestBody GroupAuditedFromDTO formDTO) { + return resiGroupService.audited(formDTO); + } + + /** + * 本网格小组列表 + * + * @param formDTO 参数 + * @return Result> + */ + @PostMapping("groupsingrid") + public Result> getGroupsInGrid(GroupAuditedFromDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + return resiGroupService.getGroupsInGrid(formDTO); + } + + /** + * 小组管理界面信息 + * + * @param formDTO 参数 + * @return Result + */ + @PostMapping("getgroupsummarize") + public Result getGroupSummarize(GovGroupSummarizeFromDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + return resiGroupService.getGroupSummarize(formDTO); + } + + /** + * @Description 查询小组待审核列表 + * @Param ApplyingGroupsFormDTO.class + * @return Result> + * @Author wangc + * @Date 2020.04.20 13:59 + **/ + @PostMapping("auditing") + public Result> auditing(@LoginUser TokenDto tokenDto, @RequestBody ApplyingGroupsFormDTO applyingGroupsFormDTO){ + applyingGroupsFormDTO.setUserId(tokenDto.getUserId()); + ValidatorUtils.validateEntity(applyingGroupsFormDTO); + return resiGroupService.auditing(applyingGroupsFormDTO); + } + + /** + * @Description 得到待审核/未审核小组信息的详情 + * @Param CommonGroupIdFromDTO -> String groupId + * @return Result + * @Author wangc + * @Date 2020.04.20 14:08 + **/ + @PostMapping("applygroupdetail") + public Result applyGroupDetail(@LoginUser TokenDto tokenDto, @RequestBody CommonGroupIdFromDTO groupIdFromDTO){ + groupIdFromDTO.setUserId(tokenDto.getUserId()); + ValidatorUtils.validateEntity(groupIdFromDTO); + return resiGroupService.applyGroupDetail(groupIdFromDTO); + } + + /** + * @Description 建组申请-审核通过 + * @Param AgreeApplyGroupFormDTO + * @return Result + * @Author wangc + * @Date 2020.04.20 14:25 + **/ + @PostMapping("approve") + public Result agreeApplying(@LoginUser TokenDto tokenDto, @RequestBody AgreeApplyGroupFormDTO agreeApplyGroupFormDTO){ + agreeApplyGroupFormDTO.setUserId(tokenDto.getUserId()); + ValidatorUtils.validateEntity(agreeApplyGroupFormDTO); + return resiGroupService.agreeApplying(agreeApplyGroupFormDTO); + } + + /** + * @Description 建组申请-审核驳回 + * @Param DisAgreeApplyGroupFormDTO + * @return Result + * @Author wangc + * @Date 2020.04.20 14:26 + **/ + @PostMapping("reject") + public Result disagreeApplying(@LoginUser TokenDto tokenDto, @RequestBody DisAgreeApplyGroupFormDTO disAgreeApplyGroupFormDTO){ + disAgreeApplyGroupFormDTO.setUserId(tokenDto.getUserId()); + ValidatorUtils.validateEntity(disAgreeApplyGroupFormDTO); + return resiGroupService.disagreeApplying(disAgreeApplyGroupFormDTO); + } +} diff --git a/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/controller/ResiWarmheartedController.java b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/controller/ResiWarmheartedController.java new file mode 100644 index 0000000000..47181d2db8 --- /dev/null +++ b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/controller/ResiWarmheartedController.java @@ -0,0 +1,88 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.resi.partymember.dto.warmhearted.form.*; +import com.epmet.resi.partymember.dto.warmhearted.result.ResiWarmAuditResultDTO; +import com.epmet.resi.partymember.dto.warmhearted.result.ResiWarmheartedAuditedResultDTO; +import com.epmet.service.ResiWarmheartedService; +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; + +/** + * @Description 政府端管理热心居民业务 + * @ClassName ResiWarmheartedController + * @Author wangc + * @date 2020.04.16 15:30 + */ +@RestController +@RequestMapping("resi/warmhearted") +public class ResiWarmheartedController { + + @Autowired + private ResiWarmheartedService resiWarmheartedService; + + /** + * 热心居民审核历史列表 + * + * @param formDTO 参数 + * @return + */ + @PostMapping("audited") + public Result> audited(@RequestBody ResiWarmheartedAuditedFromDTO formDTO) { + return resiWarmheartedService.audited(formDTO); + } + + /** + * @param + * @Author sun + * @Description 政府端-获取待审核的热心居民申请列表 + **/ + @PostMapping("auditing") + public Result> auditing(@LoginUser TokenDto tokenDTO, @RequestBody ResiWarmAuditFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + return resiWarmheartedService.auditing(formDTO); + } + + /** + * @param + * @Author sun + * @Description 政府端-热心居民申请-审核通过 + **/ + @PostMapping("approve") + public Result approve(@LoginUser TokenDto tokenDTO, @RequestBody ResiWarmAuditApproveFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + return resiWarmheartedService.approve(formDTO); + } + + /** + * @param + * @Author sun + * @Description 政府端-热心居民申请-审核驳回 + **/ + @PostMapping("reject") + public Result reject(@LoginUser TokenDto tokenDTO, @RequestBody ResiWarmAuditRejectFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + return resiWarmheartedService.reject(formDTO); + } + + /** + * @param + * @Author sun + * @Description 政府端-热心居民申请详情信息 + **/ + @PostMapping("getdetail") + public Result getDetail(@LoginUser TokenDto tokenDTO, @RequestBody ResiWarmGetDetailFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + return resiWarmheartedService.getDetail(formDTO); + } + + +} diff --git a/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/dao/.gitkeep b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/dao/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/entity/.gitkeep b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/entity/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/excel/.gitkeep b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/excel/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/exception/ModuleErrorCode.java b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/exception/ModuleErrorCode.java new file mode 100644 index 0000000000..f7aba2c2c7 --- /dev/null +++ b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/exception/ModuleErrorCode.java @@ -0,0 +1,16 @@ +package com.epmet.exception; + +import com.epmet.commons.tools.exception.ErrorCode; + +/** + * 模块错误编码,由9位数字组成,前6位为模块编码,后3位为业务编码 + *

+ * 如:100001001(100001代表模块,001代表业务代码) + *

+ * + * @author Mark sunlightcs@gmail.com + * @since 1.0.0 + */ +public interface ModuleErrorCode extends ErrorCode { + +} diff --git a/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/feign/ResiGroupFeignClient.java b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/feign/ResiGroupFeignClient.java new file mode 100644 index 0000000000..346f0d86d8 --- /dev/null +++ b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/feign/ResiGroupFeignClient.java @@ -0,0 +1,94 @@ +package com.epmet.feign; + +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.utils.Result; +import com.epmet.feign.fallback.ResiGroupFeignClientFallBack; +import com.epmet.resi.group.dto.group.form.GovGroupSummarizeFromDTO; +import com.epmet.resi.group.dto.group.form.GroupAuditedFromDTO; +import com.epmet.resi.group.dto.group.result.GovGroupSummarizeResultDTO; +import com.epmet.resi.group.dto.group.form.*; +import com.epmet.resi.group.dto.group.result.ApplyingGroupDetailResultDTO; +import com.epmet.resi.group.dto.group.result.ApplyingGroupResultDTO; +import com.epmet.resi.group.dto.group.result.GroupAuditedResultDTO; +import com.epmet.resi.group.dto.group.result.GroupsInGridResultDTO; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.PostMapping; + +import java.util.List; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/4/17 15:24 + */ +@FeignClient(name = ServiceConstant.RESI_GROUP_SERVER, fallback = ResiGroupFeignClientFallBack.class) +public interface ResiGroupFeignClient { + /** + * 小组审核历史列表 + * + * @param formDTO 参数 + * @return Result> + */ + @PostMapping("/resi/group/group/audited") + Result> audited(GroupAuditedFromDTO formDTO); + + /** + * 本网格小组列表 + * + * @param formDTO 参数 + * @return Result> + */ + @PostMapping("/resi/group/group/groupsingrid") + Result> getGroupsInGrid(GroupAuditedFromDTO formDTO); + + /** + * 小组管理界面信息 + * + * @param formDTO 参数 + * @return Result + */ + @PostMapping("/resi/group/group/getgovgroupsummarize") + Result getGovGroupSummarize(GovGroupSummarizeFromDTO formDTO); + + /** + * @Description 得到小组待审核列表,用户信息不注入TokenDTO,通过外部服务调用直接传入参数 + * @Param ApplyingGroupsFormDTO.class + * @return Result> + * @Author wangc + * @Date 2020.04.20 13:59 + **/ + @PostMapping("/resi/group/group/getapplyinggroups") + Result> getApplyingGroups(ApplyingGroupsFormDTO applyingGroupsFormDTO); + + /** + * @Description 得到待审核/未审核小组信息的详情 + * @Param CommonGroupIdFromDTO -> String groupId + * @return Result + * @Author wangc + * @Date 2020.04.20 14:08 + **/ + @PostMapping("/resi/group/group/getapplyinggroupdetail") + Result getApplyingGroupDetail(CommonGroupIdFromDTO groupId); + + /** + * @Description 建组申请-审核通过 + * @Param AgreeApplyGroupFormDTO + * @return Result + * @Author wangc + * @Date 2020.04.20 14:25 + **/ + @PostMapping("/resi/group/group/agreeapplying") + Result agreeApplying(AgreeApplyGroupFormDTO agreeApplyGroupFormDTO); + + /** + * @Description 建组申请-审核驳回 + * @Param DisAgreeApplyGroupFormDTO + * @return Result + * @Author wangc + * @Date 2020.04.20 14:26 + **/ + @PostMapping("/resi/group/group/disagreeapplying") + Result disagreeApplying(DisAgreeApplyGroupFormDTO disAgreeApplyGroupFormDTO); + + +} diff --git a/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/feign/ResiPartymemberFeignClient.java b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/feign/ResiPartymemberFeignClient.java new file mode 100644 index 0000000000..eeb8fedf84 --- /dev/null +++ b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/feign/ResiPartymemberFeignClient.java @@ -0,0 +1,66 @@ +package com.epmet.feign; + +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.utils.Result; +import com.epmet.feign.fallback.ResiPartymemberFeignClientFallBack; +import com.epmet.resi.partymember.dto.warmhearted.form.*; +import com.epmet.resi.partymember.dto.warmhearted.result.ResiWarmAuditResultDTO; +import com.epmet.resi.partymember.dto.warmhearted.result.ResiWarmheartedAuditedResultDTO; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; + +import java.util.List; + +/** + * 调用epmet-user服务 + * + * @author 赵奇风 + */ +@FeignClient(name = ServiceConstant.RESI_PARTYMEMBER_SERVER, fallback = ResiPartymemberFeignClientFallBack.class) +public interface ResiPartymemberFeignClient { + /** + * 居民端-热心居民申请-提交申请数据 + * + * @author zhaoqf + **/ + @PostMapping(value = "resi/partymember/resiwarmheartedapply/audited") + Result> audited(@RequestBody ResiWarmheartedAuditedFromDTO formDTO); + + /** + * 政府端-获取待审核的热心居民申请列表 + * @param + * @return void + * @author sun + */ + @PostMapping(value = "resi/partymember/resiwarmheartedapply/auditing") + Result> auditing(@RequestBody ResiWarmAuditFormDTO formDTO); + + /** + * 政府端-热心居民申请-审核通过 + * @param + * @return void + * @author sun + */ + @PostMapping(value = "resi/partymember/resiwarmheartedapply/approve") + Result approve(@RequestBody ResiWarmAuditApproveFormDTO formDTO); + + /** + * 政府端-热心居民申请-审核驳回 + * @param + * @return void + * @author sun + */ + @PostMapping(value = "resi/partymember/resiwarmheartedapply/reject") + Result reject(@RequestBody ResiWarmAuditRejectFormDTO formDTO); + + /** + * 政府端-获取待审核的热心居民申请列表 + * @param + * @return void + * @author sun + */ + @PostMapping(value = "resi/partymember/resiwarmheartedapply/getdetail") + Result getDetail(@RequestBody ResiWarmGetDetailFormDTO formDTO); + +} diff --git a/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/feign/fallback/.gitkeep b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/feign/fallback/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/feign/fallback/ResiGroupFeignClientFallBack.java b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/feign/fallback/ResiGroupFeignClientFallBack.java new file mode 100644 index 0000000000..8fab3c64bd --- /dev/null +++ b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/feign/fallback/ResiGroupFeignClientFallBack.java @@ -0,0 +1,88 @@ +package com.epmet.feign.fallback; + +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.utils.ModuleUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.feign.ResiGroupFeignClient; +import com.epmet.resi.group.dto.group.form.GovGroupSummarizeFromDTO; +import com.epmet.resi.group.dto.group.form.GroupAuditedFromDTO; +import com.epmet.resi.group.dto.group.result.GovGroupSummarizeResultDTO; +import com.epmet.resi.group.dto.group.form.*; +import com.epmet.resi.group.dto.group.result.ApplyingGroupDetailResultDTO; +import com.epmet.resi.group.dto.group.result.ApplyingGroupResultDTO; +import com.epmet.resi.group.dto.group.result.GroupAuditedResultDTO; +import com.epmet.resi.group.dto.group.result.GroupsInGridResultDTO; +import org.springframework.stereotype.Component; + +import java.util.List; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/4/17 15:27 + */ +@Component +public class ResiGroupFeignClientFallBack implements ResiGroupFeignClient { + @Override + public Result> audited(GroupAuditedFromDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.RESI_GROUP_SERVER, "audited", formDTO); + } + + @Override + public Result> getGroupsInGrid(GroupAuditedFromDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.RESI_GROUP_SERVER, "getGroupsInGrid", formDTO); + } + + @Override + public Result getGovGroupSummarize(GovGroupSummarizeFromDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.RESI_GROUP_SERVER, "getGovGroupSummarize", formDTO); + } + + /** + * @Description 得到小组待审核列表,用户信息不注入TokenDTO,通过外部服务调用直接传入参数 + * @Param ApplyingGroupsFormDTO.class + * @return Result> + * @Author wangc + * @Date 2020.04.20 13:59 + **/ + @Override + public Result> getApplyingGroups(ApplyingGroupsFormDTO applyingGroupsFormDTO) { + return ModuleUtils.feignConError(ServiceConstant.RESI_GROUP_SERVER, "getApplyingGroups", applyingGroupsFormDTO); + } + + /** + * @Description 得到待审核/未审核小组信息的详情 + * @Param CommonGroupIdFromDTO -> String groupId + * @return Result + * @Author wangc + * @Date 2020.04.20 14:08 + **/ + @Override + public Result getApplyingGroupDetail(CommonGroupIdFromDTO groupId) { + return ModuleUtils.feignConError(ServiceConstant.RESI_GROUP_SERVER, "getApplyingGroupDetail", groupId); + } + + /** + * @Description 建组申请-审核通过 + * @Param AgreeApplyGroupFormDTO + * @return Result + * @Author wangc + * @Date 2020.04.20 14:25 + **/ + @Override + public Result agreeApplying(AgreeApplyGroupFormDTO agreeApplyGroupFormDTO) { + return ModuleUtils.feignConError(ServiceConstant.RESI_GROUP_SERVER, "agreeApplying", agreeApplyGroupFormDTO); + } + + /** + * @Description 建组申请-审核驳回 + * @Param DisAgreeApplyGroupFormDTO + * @return Result + * @Author wangc + * @Date 2020.04.20 14:26 + **/ + @Override + public Result disagreeApplying(DisAgreeApplyGroupFormDTO disAgreeApplyGroupFormDTO) { + return ModuleUtils.feignConError(ServiceConstant.RESI_GROUP_SERVER, "disagreeApplying", disAgreeApplyGroupFormDTO); + } +} diff --git a/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/feign/fallback/ResiPartymemberFeignClientFallBack.java b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/feign/fallback/ResiPartymemberFeignClientFallBack.java new file mode 100644 index 0000000000..7d6fea0e70 --- /dev/null +++ b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/feign/fallback/ResiPartymemberFeignClientFallBack.java @@ -0,0 +1,46 @@ +package com.epmet.feign.fallback; + +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.utils.ModuleUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.feign.ResiPartymemberFeignClient; +import com.epmet.resi.partymember.dto.warmhearted.form.*; +import com.epmet.resi.partymember.dto.warmhearted.result.ResiWarmAuditResultDTO; +import com.epmet.resi.partymember.dto.warmhearted.result.ResiWarmheartedAuditedResultDTO; +import org.springframework.stereotype.Component; + +import java.util.List; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/4/16 17:01 + */ +@Component +public class ResiPartymemberFeignClientFallBack implements ResiPartymemberFeignClient { + @Override + public Result> audited(ResiWarmheartedAuditedFromDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.RESI_PARTYMEMBER_SERVER, "audited", formDTO); + } + + @Override + public Result> auditing(ResiWarmAuditFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.RESI_PARTYMEMBER_SERVER, "auditing", formDTO); + } + + @Override + public Result approve(ResiWarmAuditApproveFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.RESI_PARTYMEMBER_SERVER, "approve", formDTO); + } + + @Override + public Result reject(ResiWarmAuditRejectFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.RESI_PARTYMEMBER_SERVER, "reject", formDTO); + } + + @Override + public Result getDetail(ResiWarmGetDetailFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.RESI_PARTYMEMBER_SERVER, "getDetail", formDTO); + } + +} diff --git a/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/redis/.gitkeep b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/redis/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/service/ResiGroupService.java b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/service/ResiGroupService.java new file mode 100644 index 0000000000..bc605971c0 --- /dev/null +++ b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/service/ResiGroupService.java @@ -0,0 +1,81 @@ +package com.epmet.service; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.resi.group.dto.group.form.GovGroupSummarizeFromDTO; +import com.epmet.resi.group.dto.group.form.GroupAuditedFromDTO; +import com.epmet.resi.group.dto.group.result.GovGroupSummarizeResultDTO; +import com.epmet.resi.group.dto.group.form.*; +import com.epmet.resi.group.dto.group.result.ApplyingGroupDetailResultDTO; +import com.epmet.resi.group.dto.group.result.ApplyingGroupResultDTO; +import com.epmet.resi.group.dto.group.result.GroupAuditedResultDTO; +import com.epmet.resi.group.dto.group.result.GroupsInGridResultDTO; + +import java.util.List; + +/** + * @Description + * @IntefaceName ResiGroupService + * @Author wangc + * @date 2020.04.16 15:40 + */ +public interface ResiGroupService { + /** + * 小组审核历史列表 + * @param formDTO 参数 + * @return Result> + */ + Result> audited(GroupAuditedFromDTO formDTO); + + /** + * 本网格小组列表 + * + * @param formDTO 参数 + * @return Result> + */ + Result> getGroupsInGrid(GroupAuditedFromDTO formDTO); + + /** + * 小组管理界面信息 + * + * @param formDTO 参数 + * @return Result + */ + Result getGroupSummarize(GovGroupSummarizeFromDTO formDTO); + + /** + * @Description 查询小组待审核列表-调用resi-group服务 + * @Param ApplyingGroupsFormDTO.class + * @return Result> + * @Author wangc + * @Date 2020.04.20 13:59 + **/ + Result> auditing(ApplyingGroupsFormDTO applyingGroupsFormDTO); + + /** + * @Description 得到待审核/未审核小组信息的详情-调用resi-group服务 + * @Param CommonGroupIdFromDTO -> String groupId + * @return Result + * @Author wangc + * @Date 2020.04.20 14:08 + **/ + Result applyGroupDetail(CommonGroupIdFromDTO groupIdFromDTO); + + /** + * @Description 建组申请-审核通过-调用resi-group服务 + * @Param AgreeApplyGroupFormDTO + * @return Result + * @Author wangc + * @Date 2020.04.20 14:25 + **/ + Result agreeApplying(AgreeApplyGroupFormDTO agreeApplyGroupFormDTO); + + /** + * @Description 建组申请-审核驳回-调用resi-group服务 + * @Param DisAgreeApplyGroupFormDTO + * @return Result + * @Author wangc + * @Date 2020.04.20 14:26 + **/ + Result disagreeApplying(DisAgreeApplyGroupFormDTO disAgreeApplyGroupFormDTO); + +} diff --git a/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/service/ResiWarmheartedService.java b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/service/ResiWarmheartedService.java new file mode 100644 index 0000000000..05c905b87d --- /dev/null +++ b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/service/ResiWarmheartedService.java @@ -0,0 +1,61 @@ +package com.epmet.service; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.resi.partymember.dto.warmhearted.form.*; +import com.epmet.resi.partymember.dto.warmhearted.result.ResiWarmAuditResultDTO; +import com.epmet.resi.partymember.dto.warmhearted.result.ResiWarmheartedAuditedResultDTO; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * @Description + * @IntefaceName ResiWarmheartedService + * @Author wangc + * @date 2020.04.16 15:37 + */ +@Service +public interface ResiWarmheartedService { + /** + * 热心居民审核历史列表 + * @param formDTO 参数 + * @return ResiWarmheartedAuditedResultDTO + */ + Result> audited(ResiWarmheartedAuditedFromDTO formDTO); + + /** + * 政府端-获取待审核的热心居民申请列表 + * + * @param + * @return void + * @author sun + */ + Result> auditing(ResiWarmAuditFormDTO formDTO); + + /** + * 政府端-热心居民申请-审核通过 + * + * @param + * @return void + * @author sun + */ + Result approve(ResiWarmAuditApproveFormDTO formDTO); + + /** + * 政府端-热心居民申请-审核驳回 + * + * @param + * @return void + * @author sun + */ + Result reject(ResiWarmAuditRejectFormDTO formDTO); + + /** + * 政府端-热心居民申请详情信息 + * + * @param + * @return void + * @author sun + */ + Result getDetail(ResiWarmGetDetailFormDTO formDTO); +} diff --git a/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/service/impl/ResiGroupServiceImpl.java b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/service/impl/ResiGroupServiceImpl.java new file mode 100644 index 0000000000..f05619c012 --- /dev/null +++ b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/service/impl/ResiGroupServiceImpl.java @@ -0,0 +1,65 @@ +package com.epmet.service.impl; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.feign.ResiGroupFeignClient; +import com.epmet.resi.group.dto.group.form.GovGroupSummarizeFromDTO; +import com.epmet.resi.group.dto.group.form.GroupAuditedFromDTO; +import com.epmet.resi.group.dto.group.result.GovGroupSummarizeResultDTO; +import com.epmet.resi.group.dto.group.form.*; +import com.epmet.resi.group.dto.group.result.ApplyingGroupDetailResultDTO; +import com.epmet.resi.group.dto.group.result.ApplyingGroupResultDTO; +import com.epmet.resi.group.dto.group.result.GroupAuditedResultDTO; +import com.epmet.resi.group.dto.group.result.GroupsInGridResultDTO; +import com.epmet.service.ResiGroupService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * @Description + * @ClassName ResiGroupServiceImpl + * @Author wangc + * @date 2020.04.16 15:38 + */ +@Service +public class ResiGroupServiceImpl implements ResiGroupService{ + @Autowired + private ResiGroupFeignClient resiGroupFeignClient; + @Override + public Result> audited(GroupAuditedFromDTO formDTO) { + return resiGroupFeignClient.audited(formDTO); + } + + @Override + public Result> getGroupsInGrid(GroupAuditedFromDTO formDTO) { + return resiGroupFeignClient.getGroupsInGrid(formDTO); + } + + @Override + public Result getGroupSummarize(GovGroupSummarizeFromDTO formDTO) { + return resiGroupFeignClient.getGovGroupSummarize(formDTO); + } + + @Override + public Result> auditing(ApplyingGroupsFormDTO applyingGroupsFormDTO) { + return resiGroupFeignClient.getApplyingGroups(applyingGroupsFormDTO); + } + + @Override + public Result applyGroupDetail(CommonGroupIdFromDTO groupIdFromDTO) { + return resiGroupFeignClient.getApplyingGroupDetail(groupIdFromDTO); + } + + @Override + public Result agreeApplying(AgreeApplyGroupFormDTO agreeApplyGroupFormDTO) { + return resiGroupFeignClient.agreeApplying(agreeApplyGroupFormDTO); + } + + @Override + public Result disagreeApplying(DisAgreeApplyGroupFormDTO disAgreeApplyGroupFormDTO) { + return resiGroupFeignClient.disagreeApplying(disAgreeApplyGroupFormDTO); + } + + +} diff --git a/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/service/impl/ResiWarmheartedServiceImpl.java b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/service/impl/ResiWarmheartedServiceImpl.java new file mode 100644 index 0000000000..52a9c7b556 --- /dev/null +++ b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/service/impl/ResiWarmheartedServiceImpl.java @@ -0,0 +1,78 @@ +package com.epmet.service.impl; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.feign.ResiPartymemberFeignClient; +import com.epmet.resi.partymember.dto.warmhearted.form.*; +import com.epmet.resi.partymember.dto.warmhearted.result.ResiWarmAuditResultDTO; +import com.epmet.resi.partymember.dto.warmhearted.result.ResiWarmheartedAuditedResultDTO; +import com.epmet.service.ResiWarmheartedService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * @Description + * @ClassName ResiWarmheartedServiceImpl + * @Author wangc + * @date 2020.04.16 15:41 + */ +@Service +public class ResiWarmheartedServiceImpl implements ResiWarmheartedService { + @Autowired + private ResiPartymemberFeignClient resiPartymemberFeignClient; + + @Override + public Result> audited(ResiWarmheartedAuditedFromDTO formDTO) { + return resiPartymemberFeignClient.audited(formDTO); + } + + /** + * 政府端-获取待审核的热心居民申请列表 + * + * @param + * @return void + * @author sun + */ + @Override + public Result> auditing(ResiWarmAuditFormDTO formDTO) { + return resiPartymemberFeignClient.auditing(formDTO); + } + + /** + * 政府端-热心居民申请-审核通过 + * + * @param + * @return void + * @author sun + */ + @Override + public Result approve(ResiWarmAuditApproveFormDTO formDTO) { + return resiPartymemberFeignClient.approve(formDTO); + } + + /** + * 政府端-热心居民申请-审核驳回 + * + * @param + * @return void + * @author sun + */ + @Override + public Result reject(ResiWarmAuditRejectFormDTO formDTO) { + return resiPartymemberFeignClient.reject(formDTO); + } + + /** + * 政府端-热心居民申请详情信息 + * + * @param + * @return void + * @author sun + */ + @Override + public Result getDetail(ResiWarmGetDetailFormDTO formDTO) { + return resiPartymemberFeignClient.getDetail(formDTO); + } + +} diff --git a/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/util/ModuleConstant.java b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/util/ModuleConstant.java new file mode 100644 index 0000000000..b32ebc8649 --- /dev/null +++ b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/util/ModuleConstant.java @@ -0,0 +1,10 @@ +package com.epmet.util; + +/** + * @Description 网格管理模块常量类 + * @IntefaceName ModuleConstant + * @Author wangc + * @date 2020.04.16 15:42 + */ +public interface ModuleConstant { +} diff --git a/epmet-module/gov-grid/gov-grid-server/src/main/resources/bootstrap.yml b/epmet-module/gov-grid/gov-grid-server/src/main/resources/bootstrap.yml new file mode 100644 index 0000000000..1df1097460 --- /dev/null +++ b/epmet-module/gov-grid/gov-grid-server/src/main/resources/bootstrap.yml @@ -0,0 +1,71 @@ +server: + port: @server.port@ + servlet: + context-path: /gov/grid + +spring: + main: + allow-bean-definition-overriding: true + application: + name: gov-grid-server + #环境 dev|test|prod + profiles: + active: dev + messages: + encoding: UTF-8 + basename: i18n/messages_common + jackson: + time-zone: GMT+8 + date-format: yyyy-MM-dd HH:mm:ss + redis: + database: @spring.redis.index@ + host: @spring.redis.host@ + port: @spring.redis.port@ + password: @spring.redis.password@ + timeout: 30s + cloud: + nacos: + discovery: + server-addr: @nacos.server-addr@ + #nacos的命名空间ID,默认是public + namespace: @nacos.discovery.namespace@ + #不把自己注册到注册中心的地址 + register-enabled: @nacos.register-enabled@ + ip: @nacos.ip@ + config: + enabled: @nacos.config-enabled@ + server-addr: @nacos.server-addr@ + namespace: @nacos.config.namespace@ + group: @nacos.config.group@ + file-extension: yaml +management: + endpoints: + web: + exposure: + include: "*" + endpoint: + health: + show-details: ALWAYS + + +feign: + hystrix: + enabled: true + client: + config: + default: + loggerLevel: BASIC + httpclient: + enabled: true + +hystrix: + command: + default: + execution: + isolation: + thread: + timeoutInMilliseconds: 60000 #缺省为1000 + +ribbon: + ReadTimeout: 300000 + ConnectTimeout: 300000 diff --git a/epmet-module/gov-grid/gov-grid-server/src/main/resources/logback-spring.xml b/epmet-module/gov-grid/gov-grid-server/src/main/resources/logback-spring.xml new file mode 100644 index 0000000000..1c80278558 --- /dev/null +++ b/epmet-module/gov-grid/gov-grid-server/src/main/resources/logback-spring.xml @@ -0,0 +1,159 @@ + + + + + + + + + + + + + + debug + + + ${CONSOLE_LOG_PATTERN} + + UTF-8 + + + + + + + + ${log.path}/debug.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + + ${log.path}/debug-%d{yyyy-MM-dd}.%i.log + + 100MB + + + 15 + + + + debug + ACCEPT + DENY + + + + + + + ${log.path}/info.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + + ${log.path}/info-%d{yyyy-MM-dd}.%i.log + + 100MB + + + 15 + + + + info + ACCEPT + DENY + + + + + + + ${log.path}/warn.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + ${log.path}/warn-%d{yyyy-MM-dd}.%i.log + + 100MB + + + 15 + + + + warn + ACCEPT + DENY + + + + + + + ${log.path}/error.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + ${log.path}/error-%d{yyyy-MM-dd}.%i.log + + 100MB + + + 15 + + + + ERROR + ACCEPT + DENY + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/epmet-module/gov-grid/gov-grid-server/src/main/resources/mapper/.gitkeep b/epmet-module/gov-grid/gov-grid-server/src/main/resources/mapper/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/epmet-module/gov-grid/pom.xml b/epmet-module/gov-grid/pom.xml new file mode 100644 index 0000000000..5c0bc36a59 --- /dev/null +++ b/epmet-module/gov-grid/pom.xml @@ -0,0 +1,20 @@ + + + + epmet-module + com.epmet + 2.0.0 + + 4.0.0 + + gov-grid + pom + + gov-grid-client + gov-grid-server + + + + \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerStaffGridController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerStaffGridController.java index ec584efb56..b5e68ade89 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerStaffGridController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerStaffGridController.java @@ -23,8 +23,8 @@ 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.commons.tools.validator.group.UpdateGroup; import com.epmet.dto.CustomerStaffGridDTO; import com.epmet.excel.CustomerStaffGridExcel; import com.epmet.service.CustomerStaffGridService; diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerStaffGridService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerStaffGridService.java index a0b273fb76..712a45deff 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerStaffGridService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerStaffGridService.java @@ -26,7 +26,7 @@ import java.util.List; import java.util.Map; /** - * 网格人员关系表 + * 网格人员关系表 * * @author generator generator@elink-cn.com * @since v1.0.0 2020-04-20 @@ -92,4 +92,5 @@ public interface CustomerStaffGridService extends BaseService getWrapper(Map params){ - String id = (String)params.get(FieldConstant.ID_HUMP); + 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); diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/util/ModuleConstant.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/util/ModuleConstant.java index ed987de678..761b3c3781 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/util/ModuleConstant.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/util/ModuleConstant.java @@ -1,6 +1,4 @@ -package com.epmet.util;/** - * Created by 11 on 2020/3/23. - */ +package com.epmet.util; /** * @Description diff --git a/epmet-module/pom.xml b/epmet-module/pom.xml index f48d428c3e..81243917bf 100644 --- a/epmet-module/pom.xml +++ b/epmet-module/pom.xml @@ -27,6 +27,7 @@ resi-mine resi-group resi-partymember + gov-grid 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 0097751804..9d9971ccf3 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 @@ -67,4 +67,9 @@ public interface TopicConstant { * 构造queryWrapper 附件排序 * */ String SORT = "SORT"; + + /** + * 构造queryWrapper 用户Id + * */ + String CUSTOMER_USER_ID = "CUSTOMER_USER_ID"; } diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/ResiGroupOperationDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/ResiGroupOperationDTO.java index fd59a8a46b..35f15243dc 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/ResiGroupOperationDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/ResiGroupOperationDTO.java @@ -87,4 +87,14 @@ public class ResiGroupOperationDTO implements Serializable { * OPERATE_USER_ID操作人id */ private String operateUserId; + + /** + * 审核人员已读未读标识 (未读:unread; 已读:read) + * */ + private String readFlag; + + /** + * 消息通知内容 + * */ + private String messageText; } diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/ApplyingGroupsFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/ApplyingGroupsFormDTO.java new file mode 100644 index 0000000000..a30ecae5ef --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/ApplyingGroupsFormDTO.java @@ -0,0 +1,47 @@ +package com.epmet.resi.group.dto.group.form; + +import lombok.Data; + +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Description 政府端查询待审核的小组 + * @ClassName ApplyingGroupsFormDTO + * @Author wangc + * @date 2020.04.17 14:59 + */ +@Data +public class ApplyingGroupsFormDTO implements Serializable{ + private static final long serialVersionUID = 1L; + + /** + * 客户Id + * */ + @NotBlank(message = "客户Id不能为空") + private String customerId; + + /** + * 网格Id + * */ + @NotBlank(message = "网格Id不能为空") + private String gridId; + + /** + * 请求页码 最小是1 + * */ + @Min(value = 1) + private Integer pageNo; + + /** + * 每页数据 默认20 + * */ + private Integer pageSize = 20; + + /** + * 用户Id + * */ + @NotBlank(message = "用户Id不能为空") + private String userId; +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/CommonGroupIdFromDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/CommonGroupIdFromDTO.java new file mode 100644 index 0000000000..2dbfe636dd --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/CommonGroupIdFromDTO.java @@ -0,0 +1,29 @@ +package com.epmet.resi.group.dto.group.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Description 通用的传参DTO 只传groupId和userId + * @ClassName CommonGroupIdFromDTO + * @Author wangc + * @date 2020.04.20 14:04 + */ +@Data +public class CommonGroupIdFromDTO implements Serializable{ + private static final long serialVersionUID = 1L; + + /** + * 组Id + * */ + @NotBlank(message = "组Id不能为空") + private String groupId; + + /** + * 用户Id + * */ + @NotBlank(message = "用户Id不能为空") + private String userId; +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/GovGroupSummarizeFromDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/GovGroupSummarizeFromDTO.java new file mode 100644 index 0000000000..7757d54e37 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/GovGroupSummarizeFromDTO.java @@ -0,0 +1,19 @@ +package com.epmet.resi.group.dto.group.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/4/20 9:30 + */ +@Data +public class GovGroupSummarizeFromDTO implements Serializable { + private static final long serialVersionUID = 1L; + /** + * 小组id + */ + private String groupId; +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/GroupAuditedFromDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/GroupAuditedFromDTO.java new file mode 100644 index 0000000000..f1401ff8df --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/GroupAuditedFromDTO.java @@ -0,0 +1,36 @@ +package com.epmet.resi.group.dto.group.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/4/17 13:39 + */ +@Data +public class GroupAuditedFromDTO implements Serializable { + private static final long serialVersionUID = 1L; + /** + * 客户id + */ + @NotBlank(message = "客户id不能为空") + private String customerId; + /** + * 网格id + */ + @NotBlank(message = "网格id不能为空") + private String gridId; + /** + * 页码 + */ + @NotBlank(message = "页码不能为空") + private Integer pageNo; + /** + * 每页显示数量 + */ + @NotBlank(message = "每页显示数量不能为空") + private Integer pageSize; +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/ApplyingGroupDetailResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/ApplyingGroupDetailResultDTO.java new file mode 100644 index 0000000000..f8747baee9 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/ApplyingGroupDetailResultDTO.java @@ -0,0 +1,78 @@ +package com.epmet.resi.group.dto.group.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * @Description 建组申请详情 + * @ClassName ApplyingGroupDetailResultDTO + * @Author wangc + * @date 2020.04.17 16:13 + */ +@Data +public class ApplyingGroupDetailResultDTO implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 组Id + * */ + private String groupId; + + /** + * 组名称 + * */ + private String groupName; + + /** + * 组头像 + * */ + private String groupHeadPhoto; + + /** + * 组介绍 + * */ + private String groupIntroduction; + + /** + * 申请时间 + * */ + private Date createdTime; + + /** + * 组长名称 + * */ + private String groupLeaderName; + + /** + * 已同意该申请approved 、已驳回rejected + * */ + private String status; + + /** + * 驳回理由 + * */ + private String rejectReason; + + /** + * 从数据库中获取组长的用户Id,方便获取组长用户信息,返回时将此值置为NULL + * */ + private String leaderId; + + /** + * 街道 + * */ + private String street; + + /** + * 未读已读标识 unread read + * */ + private String readFlag; + + /** + * 从数据库中获取组操作记录Id,返回时将此值置为NULL + * */ + private String operationId; + +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/ApplyingGroupResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/ApplyingGroupResultDTO.java new file mode 100644 index 0000000000..3683f760c5 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/ApplyingGroupResultDTO.java @@ -0,0 +1,50 @@ +package com.epmet.resi.group.dto.group.result; + +import lombok.Data; + +import java.io.Serializable; + + +/** + * @Description 政府端查询待审核的小组 + * @ClassName ApplyingGroupResultDTO + * @Author wangc + * @date 2020.04.17 15:20 + */ +@Data +public class ApplyingGroupResultDTO implements Serializable{ + private static final long serialVersionUID = 1L; + + /** + * 组Id + * */ + private String groupId; + + /** + * 组名称 + * */ + private String groupName; + + /** + * 组头像 + * */ + private String groupHeadPhoto; + + /** + * 申请时间 + * */ + private String createdTime; + + /** + * 审核人员已读未读标识(未读:unread ; 已读:read ) + * */ + private String readFlag; + + /** + * 消息通知内容 + * */ + private String messageText; + + + +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/GovGroupSummarizeResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/GovGroupSummarizeResultDTO.java new file mode 100644 index 0000000000..e0b0c2fd4c --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/GovGroupSummarizeResultDTO.java @@ -0,0 +1,43 @@ +package com.epmet.resi.group.dto.group.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/4/20 9:24 + */ +@Data +public class GovGroupSummarizeResultDTO implements Serializable { + private static final long serialVersionUID = 1L; + /** + * 组id + */ + private String groupId; + /** + * 组头像 + */ + private String groupHeadPhoto; + /** + * 组名 + */ + private String groupName; + /** + * 成员总数 + */ + private Integer totalMember; + /** + * 组长名称 + */ + private String leaderName; + /** + * 组介绍 + */ + private String groupIntroduction; + /** + * 话题总数 + */ + private Integer totalTopics; +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/GroupAuditedResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/GroupAuditedResultDTO.java new file mode 100644 index 0000000000..8c2f0cd7cf --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/GroupAuditedResultDTO.java @@ -0,0 +1,45 @@ +package com.epmet.resi.group.dto.group.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/4/17 13:40 + */ +@Data +public class GroupAuditedResultDTO implements Serializable { + private static final long serialVersionUID = 1L; + /** + * 小组ID + */ + private String groupId; + /** + * 小组名称 + */ + private String groupName; + /** + * 小组头像 + */ + private String groupHeadPhoto; + /** + * 小组介绍 + */ + private String groupIntroduction; + /** + * 小组状态已驳回rejected ,已通过approved + */ + private String status; + /** + * 审核时间HH:mm + */ + private Date auditedTime; + /** + * 消息通知内容 + */ + private String messageText; + +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/GroupsInGridResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/GroupsInGridResultDTO.java new file mode 100644 index 0000000000..fa4d22740a --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/result/GroupsInGridResultDTO.java @@ -0,0 +1,41 @@ +package com.epmet.resi.group.dto.group.result; + +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/4/17 15:53 + */ +@NoArgsConstructor +@Data +public class GroupsInGridResultDTO implements Serializable { + private static final long serialVersionUID = 1L; + /** + * 小组id + */ + private String groupId; + /** + * 小组名称 + */ + private String groupName; + /** + * 小组头像 + */ + private String groupHeadPhoto; + /** + * 成员总数 + */ + private Integer totalMember; + /** + * 党员总数 + */ + private Integer totalPartyMember; + /** + * 当前状态审核通过 - approved 、 审核中 - under_auditting、 审核未通过 - rejected 、 已屏蔽 - hidden、 已关闭 - closed + */ + private String status; +} diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupController.java index ef1bbd22c8..0dfa43e4bd 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupController.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupController.java @@ -22,14 +22,10 @@ import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; -import com.epmet.dto.form.UserResiInfoFormDTO; import com.epmet.modules.group.service.ResiGroupService; import com.epmet.modules.utils.ModuleConstant; import com.epmet.resi.group.dto.group.form.*; -import com.epmet.resi.group.dto.group.result.CreatedResultDTO; -import com.epmet.resi.group.dto.group.result.GroupSummarizeResultDTO; -import com.epmet.resi.group.dto.group.result.MyGroupResultDTO; -import com.epmet.resi.group.dto.group.result.RecommendGroupResultDTO; +import com.epmet.resi.group.dto.group.result.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -52,10 +48,11 @@ public class ResiGroupController { private ResiGroupService resiGroupService; @GetMapping("test/{test}") - public Result test(@PathVariable("test")String test){ - int result=1/0; + public Result test(@PathVariable("test") String test) { + int result = 1 / 0; return new Result().ok("请求成功啦❤"); } + /** * @param tokenDto * @param myGroupFormDTO @@ -220,4 +217,84 @@ public class ResiGroupController { ValidatorUtils.validateEntity(disAgreeApplyGroupFormDTO); return resiGroupService.disagreeApplyGroup(disAgreeApplyGroupFormDTO); } + + /** + * 小组审核历史列表 + * + * @param formDTO 参数 + * @return Result> + */ + @PostMapping("audited") + public Result> audited(GroupAuditedFromDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + return resiGroupService.audited(formDTO); + } + + /** + * 本网格小组列表 + * + * @param formDTO 参数 + * @return Result> + */ + @PostMapping("groupsingrid") + public Result> getGroupsInGrid(GroupAuditedFromDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + return resiGroupService.getGroupsInGrid(formDTO); + } + + /** + * 小组管理界面信息 + * + * @param formDTO 参数 + * @return Result + */ + @PostMapping("getgovgroupsummarize") + public Result getGovGroupSummarize(GovGroupSummarizeFromDTO formDTO) { + return resiGroupService.getGovGroupSummarize(formDTO); + } + + /** + * @Description 得到小组待审核列表,用户信息不注入TokenDTO,通过外部服务调用直接传入参数 + * @Param ApplyingGroupsFormDTO.class + * @return Result> + * @Author wangc + * @Date 2020.04.20 13:59 + **/ + @PostMapping("getapplyinggroups") + public Result> getApplyingGroups(@RequestBody ApplyingGroupsFormDTO applyingGroupsFormDTO){ + ValidatorUtils.validateEntity(applyingGroupsFormDTO); + return resiGroupService.getApplyingGroups(applyingGroupsFormDTO); + } + + /** + * @Description 得到待审核/未审核小组信息的详情 + * @Param CommonGroupIdFromDTO -> String groupId; String userId + * @return Result + * @Author wangc + * @Date 2020.04.20 14:08 + **/ + @PostMapping("getapplyinggroupdetail") + public Result getApplyingGroupDetail(@RequestBody CommonGroupIdFromDTO groupIdFromDTO){ + ValidatorUtils.validateEntity(groupIdFromDTO); + return resiGroupService.getApplyingGroupDetail(groupIdFromDTO); + } + + @PostMapping("agreeapplying") + public Result agreeApplying( @RequestBody AgreeApplyGroupFormDTO agreeApplyGroupFormDTO) { + ValidatorUtils.validateEntity(agreeApplyGroupFormDTO); + return resiGroupService.agreeApplyGroup(agreeApplyGroupFormDTO); + } + + /** + * @Description 建组申请-审核驳回-供外部服务调用,当前用户Id需要调用时一并传入 + * @Param DisAgreeApplyGroupFormDTO + * @return Result + * @Author wangc + * @Date 2020.04.20 14:26 + **/ + @PostMapping("disagreeapplying") + public Result disagreeApplying(@RequestBody DisAgreeApplyGroupFormDTO disAgreeApplyGroupFormDTO) { + ValidatorUtils.validateEntity(disAgreeApplyGroupFormDTO); + return resiGroupService.disagreeApplyGroup(disAgreeApplyGroupFormDTO); + } } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/ResiGroupDao.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/ResiGroupDao.java index bf67a9ebd5..4bc70f4762 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/ResiGroupDao.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/ResiGroupDao.java @@ -23,6 +23,7 @@ import com.epmet.resi.group.dto.group.form.*; import com.epmet.resi.group.dto.group.result.*; import com.epmet.resi.group.dto.member.ResiGroupMemberDTO; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; import java.util.List; @@ -106,4 +107,36 @@ public interface ResiGroupDao extends BaseDao { * @Date 2020/3/30 16:03 **/ List checkResiGroupName(ApplyCreateGroupFormDTO applyCreateGroupFormDTO); + + /** + * 查询小组审核历史列表 + * @param formDTO + * @return + */ + List selectAuditedGroupList(GroupAuditedFromDTO formDTO); + + /** + * 查询网格小组列表 + * @param formDTO + * @return + */ + List selectGroupsByGridId(GroupAuditedFromDTO formDTO); + + /** + * @Description 查询申请中的的小组 + * @Param ApplyingGroupsFormDTO + * @return List + * @Author wangc + * @Date 2020.04.20 00:11 + **/ + List getApplyingGroupsByCustIdAndGridId(ApplyingGroupsFormDTO applyingGroupsFormDTO); + + /** + * @Description 获取组审核信息详情:已审核/未审核通用 + * @Param groupId + * @return ApplyingGroupDetailResultDTO + * @Author wangc + * @Date 2020.04.20 11:17 + **/ + ApplyingGroupDetailResultDTO getApplyingGroupDetailByGroupId(@Param("groupId") String groupId); } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/ResiGroupOperationEntity.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/ResiGroupOperationEntity.java index 90e74625bc..b3d2c0151f 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/ResiGroupOperationEntity.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/ResiGroupOperationEntity.java @@ -57,4 +57,14 @@ public class ResiGroupOperationEntity extends BaseEpmetEntity { * OPERATE_USER_ID操作人id */ private String operateUserId; + + /** + * 审核人员已读未读标识 (未读:unread; 已读:read) + * */ + private String readFlag; + + /** + * 消息通知内容 + * */ + private String messageText; } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/redis/ResiGroupRedis.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/redis/ResiGroupRedis.java index 12d4ab4d7a..8971aae9dc 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/redis/ResiGroupRedis.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/redis/ResiGroupRedis.java @@ -17,13 +17,24 @@ package com.epmet.modules.group.redis; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.redis.RedisKeys; import com.epmet.commons.tools.redis.RedisUtils; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.modules.group.service.ResiGroupService; +import com.epmet.modules.group.service.ResiGroupStatisticalService; +import com.epmet.resi.group.constant.TopicConstant; +import com.epmet.resi.group.dto.group.ResiGroupDTO; import com.epmet.resi.group.dto.group.ResiGroupInfoRedisDTO; +import com.epmet.resi.group.dto.group.ResiGroupStatisticalDTO; +import com.epmet.resi.group.dto.group.ResiGroupStatisticalInfoRedisDTO; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import java.util.*; + /** * 群组信息表 * @@ -35,6 +46,13 @@ public class ResiGroupRedis { @Autowired private RedisUtils redisUtils; + @Autowired + private ResiGroupService groupService; + + @Autowired + private ResiGroupStatisticalService statisticalService; + + public void delete(Object[] ids) { } @@ -51,10 +69,75 @@ public class ResiGroupRedis { } } + /** + * @Description 查询组的缓存信息,如果有直接返回,如果没有,则从数据库中查询,将数据放入缓存并返回 + * @Param + * @return + * @Author wangc + * @Date 2020.04.18 12:00 + **/ public ResiGroupInfoRedisDTO get(String groupId){ + if(StringUtils.isNotBlank(groupId)){ ResiGroupInfoRedisDTO groupCache = (ResiGroupInfoRedisDTO) redisUtils.get(RedisKeys.getResiGroupInfoKey(groupId)); + if(null == groupCache || StringUtils.isBlank(groupCache.getGroupId())){ + //如果缓存中没有该组信息,从数据库中查询并放入缓存 + ResiGroupDTO groupMySql = groupService.get(groupId); + if(null != groupMySql && StringUtils.isNotBlank(groupMySql.getId())){ + ResiGroupInfoRedisDTO groupRedis = ConvertUtils.sourceToTarget(groupMySql,ResiGroupInfoRedisDTO.class); + groupRedis.setGroupId(groupMySql.getId()); + groupRedis.setGroupState(groupMySql.getState()); + Map param = new HashMap<>(); + param.put(TopicConstant.RESI_GROUP_ID,groupId); + param.put(FieldConstant.DEL_FLAG, NumConstant.ZERO_STR); + List statisticalMySql = statisticalService.list(param); + if(null != statisticalMySql && statisticalMySql.size() >= 1){ + if(statisticalMySql.size() > 1){ + /* + Collections.sort(statisticalMySql, new Comparator() { + @Override + public int compare(ResiGroupStatisticalDTO o1, ResiGroupStatisticalDTO o2) { + if(null != o1.getCreatedTime() && null != o2.getCreatedTime()){ + return + o1.getCreatedTime().getTime() > o2.getCreatedTime().getTime() ? + -1 : (o1.getCreatedTime().getTime() == o2.getCreatedTime().getTime() ? + 0: 1); + }else{ + return 0; + } + } + }); + + statisticalMySql.sort((ResiGroupStatisticalDTO o1, ResiGroupStatisticalDTO o2) -> + o1.getCreatedTime().compareTo(o2.getCreatedTime()) + ); + //升序 + statisticalMySql.sort(Comparator.comparing(e -> e.getCreatedTime())); + + statisticalMySql.sort(Comparator.comparing(ResiGroupStatisticalDTO :: getCreatedTime, + (o1 , o2) -> { + return o2.compareTo(o 1); + })); + */ + + //按照createdTime降序排序 + statisticalMySql.sort(Comparator.comparing(ResiGroupStatisticalDTO :: getCreatedTime, + Collections.reverseOrder())); + } + ResiGroupStatisticalDTO statistical = statisticalMySql.get(0); + ResiGroupStatisticalInfoRedisDTO statisticalRedis = + ConvertUtils.sourceToTarget(statistical,ResiGroupStatisticalInfoRedisDTO.class); + statisticalRedis.setTotalEarnestMembers(statistical.getTotalEarnestMemebers()); + statisticalRedis.setTotalNormalMembers(statistical.getTotalNormalMemebers()); + groupRedis.setGroupStatisticalInfo(statisticalRedis); + } + //将从数据库中查询出的数据放入缓存 + set(groupRedis); + //返回数据 + return groupRedis; + } + } return groupCache; } return null; diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupService.java index 39bac55512..8d3f760279 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupService.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupService.java @@ -20,17 +20,12 @@ package com.epmet.modules.group.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; -import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; -import com.epmet.dto.form.UserResiInfoFormDTO; import com.epmet.modules.group.entity.ResiGroupEntity; import com.epmet.resi.group.dto.UserRoleDTO; import com.epmet.resi.group.dto.group.ResiGroupDTO; import com.epmet.resi.group.dto.group.form.*; -import com.epmet.resi.group.dto.group.result.CreatedResultDTO; -import com.epmet.resi.group.dto.group.result.GroupSummarizeResultDTO; -import com.epmet.resi.group.dto.group.result.MyGroupResultDTO; -import com.epmet.resi.group.dto.group.result.RecommendGroupResultDTO; +import com.epmet.resi.group.dto.group.result.*; import java.util.List; import java.util.Map; @@ -176,8 +171,8 @@ public interface ResiGroupService extends BaseService { Result initApplyCreatedGroup(InitApplyCreatedGroupFormDTO initApplyCreatedGroupFormDTO); /** - * @return com.epmet.commons.tools.utils.Result * @param agreeApplyGroupFormDTO + * @return com.epmet.commons.tools.utils.Result * @Author yinzuomei * @Description 审核(同意)群申请-测试用后面会放到政府端 * @Date 2020/3/31 12:44 @@ -185,8 +180,8 @@ public interface ResiGroupService extends BaseService { Result agreeApplyGroup(AgreeApplyGroupFormDTO agreeApplyGroupFormDTO); /** - * @return com.epmet.commons.tools.utils.Result * @param disAgreeApplyGroupFormDTO + * @return com.epmet.commons.tools.utils.Result * @Author yinzuomei * @Description 审核(拒绝)群申请-测试用后面会放到政府端 * @Date 2020/3/31 13:22 @@ -194,14 +189,56 @@ public interface ResiGroupService extends BaseService { Result disagreeApplyGroup(DisAgreeApplyGroupFormDTO disAgreeApplyGroupFormDTO); /** - * @return com.epmet.resi.group.dto.UserRoleDTO * @param app * @param userId * @param customerId * @param gridId + * @return com.epmet.resi.group.dto.UserRoleDTO * @Author yinzuomei * @Description 判断用户当前角色 * @Date 2020/4/1 0:00 **/ UserRoleDTO checkPartyMemberOrWarmHeated(String app, String userId, String customerId, String gridId); + + /** + * 小组审核历史列表 + * + * @param formDTO 参数 + * @return Result> + */ + Result> audited(GroupAuditedFromDTO formDTO); + + /** + * 本网格小组列表 + * + * @param formDTO 参数 + * @return Result> + */ + Result> getGroupsInGrid(GroupAuditedFromDTO formDTO); + + /** + * 小组管理界面信息 + * + * @param formDTO 参数 + * @return Result + */ + Result getGovGroupSummarize(GovGroupSummarizeFromDTO formDTO); + + /** + * @Description 查询待审核的小组 + * @Param ApplyingGroupsFormDTO + * @return Result> + * @Author wangc + * @Date 2020.04.18 10:17 + **/ + Result> getApplyingGroups(ApplyingGroupsFormDTO applyingGroupsFormDTO); + + /** + * @Description 建组申请详情 + * @Param AgreeApplyGroupFormDTO + * @return Result + * @Author wangc + * @Date 2020.04.19 23:32 + **/ + Result getApplyingGroupDetail(CommonGroupIdFromDTO groupId); } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java index 5d1a0ac277..4c21340893 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java @@ -30,20 +30,22 @@ import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.form.UserResiInfoFormDTO; +import com.epmet.dto.form.UserResiInfoListFormDTO; import com.epmet.dto.form.UserRoleFormDTO; import com.epmet.dto.result.UserResiInfoResultDTO; import com.epmet.dto.result.UserRoleResultDTO; -import com.epmet.modules.exception.ModuleErrorCode; import com.epmet.modules.feign.EpmetUserFeignClient; import com.epmet.modules.group.dao.ResiGroupDao; import com.epmet.modules.group.dao.ResiGroupOperationDao; import com.epmet.modules.group.entity.ResiGroupEntity; +import com.epmet.modules.group.entity.ResiGroupOperationEntity; import com.epmet.modules.group.redis.ResiGroupRedis; import com.epmet.modules.group.service.ResiGroupOperationService; import com.epmet.modules.group.service.ResiGroupService; import com.epmet.modules.group.service.ResiGroupStatisticalService; import com.epmet.modules.member.dao.GroupMemeberOperationDao; import com.epmet.modules.member.dao.ResiGroupMemberDao; +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.utils.ModuleConstant; @@ -54,12 +56,10 @@ import com.epmet.resi.group.constant.MemberStateConstant; import com.epmet.resi.group.dto.UserRoleDTO; import com.epmet.resi.group.dto.group.*; import com.epmet.resi.group.dto.group.form.*; -import com.epmet.resi.group.dto.group.result.CreatedResultDTO; -import com.epmet.resi.group.dto.group.result.GroupSummarizeResultDTO; -import com.epmet.resi.group.dto.group.result.MyGroupResultDTO; -import com.epmet.resi.group.dto.group.result.RecommendGroupResultDTO; +import com.epmet.resi.group.dto.group.result.*; 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 org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -107,6 +107,9 @@ public class ResiGroupServiceImpl extends BaseServiceImpl page(Map params) { @@ -314,7 +317,7 @@ public class ResiGroupServiceImpl extends BaseServiceImpl param = new HashMap<>(); - param.put("resiGroupId",resiGroupDTO.getId()); + //6、新增小组缓存信息、组员缓存信息 + Map param = new HashMap<>(); + param.put(ModuleConstant.RESI_GROUP_ID_CAMEL, resiGroupDTO.getId()); + param.put(FieldConstant.DEL_FLAG,NumConstant.ZERO_STR); List statisticalList = resiGroupStatisticalService.list(param); - if(null != statisticalList && statisticalList.size() > 0){ - ResiGroupInfoRedisDTO groupRedis = transferToGroupInfoRedis(resiGroupDTO,statisticalList.get(0)); + if (null != statisticalList && statisticalList.size() > 0) { + ResiGroupInfoRedisDTO groupRedis = transferToGroupInfoRedis(resiGroupDTO, statisticalList.get(0)); resiGroupRedis.set(groupRedis); - }else{ - //当没有查询到组统计信息时 - UserRoleFormDTO userRoleFormDTO = new UserRoleFormDTO(); - userRoleFormDTO.setApp("resi"); - userRoleFormDTO.setCustomerId(resiGroupDTO.getCustomerId()); - userRoleFormDTO.setUserId(agreeApplyGroupFormDTO.getUserId()); - //userRoleFormDTO.setGridId - //epmetUserFeignClient.getUserRoleInfo(userRoleFormDTO); + + ResiGroupMemberInfoRedisDTO memberRedis = new ResiGroupMemberInfoRedisDTO(); + memberRedis.setUserId(resiGroupMemberDTO.getCustomerUserId()); + memberRedis.setGroupLeaderFlag("leader"); + memberRedis.setEnterGroupType(resiGroupMemberDTO.getEnterGroupType()); + memberRedis.setMemberStatus(resiGroupMemberDTO.getStatus()); + memberRedis.setGroupId(resiGroupMemberDTO.getResiGroupId()); + + UserResiInfoFormDTO userParam = new UserResiInfoFormDTO(); + userParam.setUserId(resiGroupMemberDTO.getCustomerUserId()); + userParam.setCustomerId(resiGroupDTO.getCustomerId()); + Result userInfo = + epmetUserFeignClient.getUserResiInfoDTO(userParam); + if(userInfo.success() && null != userInfo.getData()){ + memberRedis.setUserShowName(userInfo.getData().getShowName()); + memberRedis.setUserHeadPhoto(userInfo.getData().getHeadPhoto()); + }else{ + logger.warn(ModuleConstant.USER_INFO_LIST_NOT_FOUND); + } + resiGroupMemberRedis.set(memberRedis); + } else { + /* + 当没有查询到组统计信息时,需要自己封装统计信息 + @param UserRoleFormDTO::getApp + @param UserRoleFormDTO::getCustomerId + @param UserRoleFormDTO::getUserId + @param UserRoleFormDTO::getGridId + 查询用户身份信息[热心居民/党员] + epmetUserFeignClient.getUserRoleInfo(userRoleFormDTO); + */ + logger.warn(ModuleConstant.NO_SUCH_GROUP_STASTICAL_INFO); } @@ -502,11 +529,11 @@ public class ResiGroupServiceImpl extends BaseServiceImpl> audited(GroupAuditedFromDTO formDTO) { + Result> result = new Result<>(); + //查询条件 + int pageIndex = (formDTO.getPageNo() - NumConstant.ONE) * formDTO.getPageSize(); + formDTO.setPageNo(pageIndex); + //获取审核列表 + List resultList = baseDao.selectAuditedGroupList(formDTO); + + return result.ok(resultList); + } + + @Override + public Result> getGroupsInGrid(GroupAuditedFromDTO formDTO) { + List resultList = new ArrayList<>(); + //查询条件 + int pageIndex = (formDTO.getPageNo() - NumConstant.ONE) * formDTO.getPageSize(); + formDTO.setPageNo(pageIndex); + List list = baseDao.selectGroupsByGridId(formDTO); + list.forEach(i -> { + //缓存中获取组信息 + ResiGroupInfoRedisDTO resiGroupInfoRedisDTO = resiGroupRedis.get(i.getId()); + GroupsInGridResultDTO groupsInGridResultDTO = new GroupsInGridResultDTO(); + groupsInGridResultDTO.setGroupId(resiGroupInfoRedisDTO.getGroupId()); + groupsInGridResultDTO.setGroupName(resiGroupInfoRedisDTO.getGroupName()); + groupsInGridResultDTO.setGroupHeadPhoto(resiGroupInfoRedisDTO.getGroupHeadPhoto()); + groupsInGridResultDTO.setStatus(resiGroupInfoRedisDTO.getGroupState()); + groupsInGridResultDTO.setTotalMember(resiGroupInfoRedisDTO.getGroupStatisticalInfo().getTotalMembers()); + groupsInGridResultDTO.setTotalPartyMember(resiGroupInfoRedisDTO.getGroupStatisticalInfo().getTotalPartyMembers()); + resultList.add(groupsInGridResultDTO); + }); + + return new Result>().ok(resultList); + } + + @Override + public Result getGovGroupSummarize(GovGroupSummarizeFromDTO formDTO) { + GovGroupSummarizeResultDTO resultDTO = new GovGroupSummarizeResultDTO(); + //从缓存中获取组相关信息 + ResiGroupInfoRedisDTO resiGroupInfoRedisDTO = resiGroupRedis.get(formDTO.getGroupId()); + resultDTO.setGroupId(resiGroupInfoRedisDTO.getGroupId()); + resultDTO.setGroupHeadPhoto(resiGroupInfoRedisDTO.getGroupHeadPhoto()); + resultDTO.setGroupIntroduction(resiGroupInfoRedisDTO.getGroupIntroduction()); + resultDTO.setGroupName(resiGroupInfoRedisDTO.getGroupName()); + resultDTO.setTotalMember(resiGroupInfoRedisDTO.getGroupStatisticalInfo().getTotalMembers()); + resultDTO.setTotalTopics(resiGroupInfoRedisDTO.getGroupStatisticalInfo().getTotalTopics()); + + //获取组长信息 + Result groupLeaderUserInfo = this.getGroupLeaderUserInfo(formDTO.getGroupId()); + if (groupLeaderUserInfo.success() && null != groupLeaderUserInfo.getData()) { + resultDTO.setLeaderName(groupLeaderUserInfo.getData().getShowName()); + } else { + logger.info("组长注册信息查询失败" + groupLeaderUserInfo.getMsg()); + } + + return new Result().ok(resultDTO); + } + /** + * @return ResiGroupInfoRedisDTO * @Description 将ResiGroupDTO与ResiGroupStatisticalDTO转换成ResiGroupInfoRedisDTO * @Param ResiGroupDTO * @Param ResiGroupStatisticalDTO - * @return ResiGroupInfoRedisDTO * @Author wangc * @Date 2020.04.13 16:36 **/ - private ResiGroupInfoRedisDTO transferToGroupInfoRedis(ResiGroupDTO groupDTO,ResiGroupStatisticalDTO statisticalDTO){ + private ResiGroupInfoRedisDTO transferToGroupInfoRedis(ResiGroupDTO groupDTO, ResiGroupStatisticalDTO statisticalDTO) { ResiGroupStatisticalInfoRedisDTO statisticalObjct = - ConvertUtils.sourceToTarget(statisticalDTO,ResiGroupStatisticalInfoRedisDTO.class); + ConvertUtils.sourceToTarget(statisticalDTO, ResiGroupStatisticalInfoRedisDTO.class); statisticalObjct.setTotalEarnestMembers(statisticalDTO.getTotalEarnestMemebers()); statisticalObjct.setTotalNormalMembers(statisticalDTO.getTotalNormalMemebers()); ResiGroupInfoRedisDTO targetObject = - ConvertUtils.sourceToTarget(groupDTO,ResiGroupInfoRedisDTO.class); + ConvertUtils.sourceToTarget(groupDTO, ResiGroupInfoRedisDTO.class); targetObject.setGroupId(groupDTO.getId()); targetObject.setGroupState(groupDTO.getState()); SimpleDateFormat format = new SimpleDateFormat(DateUtils.DATE_TIME_PATTERN); - if(null != groupDTO.getLatestTopicPublishDate()){ + if (null != groupDTO.getLatestTopicPublishDate()) { targetObject.setLatestTopicPublishDate(format.format(groupDTO.getLatestTopicPublishDate())); } targetObject.setGroupStatisticalInfo(statisticalObjct); return targetObject; } + /** + * @Description 查询待审核的小组 (不从缓存中取,这时还没有成功建组,缓存中没有组数据) + * @Param ApplyingGroupsFormDTO + * @return Result> + * @Author wangc + * @Date 2020.04.18 10:18 + **/ + @Override + public Result> getApplyingGroups(ApplyingGroupsFormDTO params){ + if(null == params.getPageNo()){ + throw new RenException(ModuleConstant.PAGE_INDEX_NOT_NULL); + } + params.setPageNo((params.getPageNo() - NumConstant.ONE) * params.getPageSize()); + return new Result>().ok(baseDao.getApplyingGroupsByCustIdAndGridId(params)); + } + + /** + * @Description 建组申请详情 已审核(更新已读未读标识)/未审核 + * @Param AgreeApplyGroupFormDTO + * @return Result + * @Author wangc + * @Date 2020.04.19 23:32 + **/ + @Override + public Result getApplyingGroupDetail(CommonGroupIdFromDTO groupId){ + //1.查询小组信息 + //注意,这里查询出的组申请详情中,无论是已审核还是未审核,都是将该组信息关联到初始化组时状态为[待审核、审核通过、拒绝]其中之一的组操作记录上,并读取审核的已读未读信息,上述三种状态在一个组的所有操作记录当中只可能存在一种,与之后的屏蔽、取消屏蔽、关闭无关,如果查出多条说明建组的逻辑有问题 + ApplyingGroupDetailResultDTO detail = baseDao.getApplyingGroupDetailByGroupId(groupId.getGroupId()); + //2.查询用户信息(TODO 先走数据库,之后改成走缓存) + List userId = new ArrayList<>(); + userId.add(detail.getLeaderId()); + Result> userInfoResult = + epmetUserFeignClient.getUserResiInfoList(new UserResiInfoListFormDTO(userId)); + if(userInfoResult.success() && null != userInfoResult.getData() && userInfoResult.getData().size() >= 1){ + detail.setGroupHeadPhoto(userInfoResult.getData().get(0).getHeadPhoto()); + //姓氏+先生/女士 注:在数据库中拼接成[街道+显示名称]默认格式,故要进行截取 + //detail.setGroupLeaderName(userInfoResult.getData().get(0).getShowName().split("-")[NumConstant.ONE]); + //姓氏+名称 + detail.setGroupLeaderName(userInfoResult.getData().get(0).getSurname() + userInfoResult.getData().get(0).getName()); + detail.setStreet(userInfoResult.getData().get(0).getStreet()); + }else{ + logger.warn(ModuleConstant.USER_INFO_LIST_NOT_FOUND); + } + //3.未读改成已读 + if(StringUtils.equals(detail.getReadFlag(),ModuleConstant.UNREAD)){ + ResiGroupOperationEntity operationEntity = new ResiGroupOperationEntity(); + operationEntity.setId(detail.getOperationId()); + operationEntity.setReadFlag(ModuleConstant.READ); + operationEntity.setUpdatedBy(groupId.getUserId()); + resiGroupOperationDao.updateById(operationEntity); + } + //4.将组长用户Id隐藏 + detail.setLeaderId(null); + detail.setOperationId(null); + + return new Result().ok(detail); + } + } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/redis/ResiGroupMemberRedis.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/redis/ResiGroupMemberRedis.java index 9285e70f54..d59e819155 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/redis/ResiGroupMemberRedis.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/redis/ResiGroupMemberRedis.java @@ -17,15 +17,26 @@ package com.epmet.modules.member.redis; -import cn.hutool.core.bean.BeanUtil; -import cn.hutool.core.map.MapUtil; + +import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.redis.RedisKeys; import com.epmet.commons.tools.redis.RedisUtils; -import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.UserResiInfoFormDTO; +import com.epmet.dto.result.UserResiInfoResultDTO; +import com.epmet.modules.feign.EpmetUserFeignClient; +import com.epmet.modules.group.service.ResiGroupService; +import com.epmet.modules.member.service.ResiGroupMemberService; +import com.epmet.modules.utils.ModuleConstant; +import com.epmet.resi.group.constant.TopicConstant; +import com.epmet.resi.group.dto.member.ResiGroupMemberDTO; import com.epmet.resi.group.dto.member.ResiGroupMemberInfoRedisDTO; import com.epmet.resi.group.dto.member.result.ResiGroupMemberInfoRedisResultDTO; 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.Component; @@ -42,6 +53,17 @@ public class ResiGroupMemberRedis { @Autowired private RedisUtils redisUtils; + @Autowired + private ResiGroupMemberService memberService; + + @Autowired + private EpmetUserFeignClient epmetUserFeignClient; + + @Autowired + private ResiGroupService groupService; + + private Logger logger = LoggerFactory.getLogger(getClass()); + public void delete(Object[] ids) { } @@ -70,14 +92,54 @@ public class ResiGroupMemberRedis { * @Date 2020.04.13 23:36 **/ public ResiGroupMemberInfoRedisDTO get(String groupId ,String userId){ - /* - Map map = redisUtils.hGetAll(); - if (MapUtil.isEmpty(map)) { - return null; + + ResiGroupMemberInfoRedisDTO memberCache = + (ResiGroupMemberInfoRedisDTO) redisUtils.get(RedisKeys.getResiGroupMemberInfoKey(groupId,userId)); + //如果缓存中没有该成员数据 + if(null == memberCache && StringUtils.isNotBlank(memberCache.getUserId())){ + Map param = new HashMap<>(); + param.put(TopicConstant.CUSTOMER_USER_ID,userId); + param.put(TopicConstant.RESI_GROUP_ID,groupId); + param.put(FieldConstant.DEL_FLAG, NumConstant.ZERO_STR); + List memberList = memberService.list(param); + if(null != memberList && memberList.size() >= 1){ + if(memberList.size() > 1) { + memberList.sort(Comparator.comparing(ResiGroupMemberDTO::getCreatedTime, Collections.reverseOrder())); + } + ResiGroupMemberDTO memberMySql = memberList.get(0); + ResiGroupMemberInfoRedisDTO memberRedis = ConvertUtils.sourceToTarget(memberMySql,ResiGroupMemberInfoRedisDTO.class); + + memberRedis.setUserId(memberMySql.getCustomerUserId()); + memberRedis.setGroupId(memberMySql.getResiGroupId()); + memberRedis.setMemberStatus(memberMySql.getStatus()); + + + UserResiInfoFormDTO userParam = new UserResiInfoFormDTO(); + userParam.setUserId(memberMySql.getCustomerUserId()); + userParam.setCustomerId(groupService.get(groupId).getCustomerId()); + Result userInfo = epmetUserFeignClient.getUserResiInfoDTO(userParam); + if(userInfo.success()){ + if(null != userInfo.getData()){ + memberRedis.setUserShowName(userInfo.getData().getShowName()); + memberRedis.setUserHeadPhoto(userInfo.getData().getHeadPhoto()); + } + }else{ + logger.warn(ModuleConstant.USER_INFO_LIST_NOT_FOUND); + } + + set(memberRedis); + return memberRedis; + }else{ + //日志打印效果:找不到组员信息,组Id: ********,用户Id:******** + logger.warn(ModuleConstant.GROUO_MEMBER_INFO_NOT_FOUND + .concat(ModuleConstant.GROUP_ID) + .concat(groupId) + .concat(ModuleConstant.USER_ID) + .concat(userId)); + } } - //map to bean - ResiGroupMemberInfoRedisDTO member = BeanUtil.mapToBean(map, ResiGroupMemberInfoRedisDTO.class, true);*/ - return (ResiGroupMemberInfoRedisDTO) redisUtils.get(RedisKeys.getResiGroupMemberInfoKey(groupId,userId)); + + return memberCache; } 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 e02a61318e..33da2273dd 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 @@ -132,7 +132,7 @@ public class ResiGroupMemberServiceImpl extends BaseServiceImpl wrapper = new QueryWrapper<>(); wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); - + wrapper.eq(FieldConstant.DEL_FLAG,NumConstant.ZERO_STR); return wrapper; } @@ -176,6 +176,7 @@ public class ResiGroupMemberServiceImpl extends BaseServiceImpl wrapper = new QueryWrapper<>(); wrapper.eq(StringUtils.isNotBlank(groupId), "RESI_GROUP_ID", groupId) .eq(StringUtils.isNotBlank(userId), "CUSTOMER_USER_ID", userId); + wrapper.eq(FieldConstant.DEL_FLAG,NumConstant.ZERO_STR); List list = baseDao.selectList(wrapper); if (null == list || list.size() == 0) { return null; @@ -358,6 +359,8 @@ public class ResiGroupMemberServiceImpl extends BaseServiceImpl paramsMap = new HashMap<>(); paramsMap.put(TopicConstant.RESI_GROUP_ID,groupMemeberOperationDTO.getGroupId()); + paramsMap.put(FieldConstant.DEL_FLAG, NumConstant.ZERO_STR); + //不再进行计算,直接从数据库中拉取更新过的数据(在同一个事务中) List statisticalDTO = resiGroupStatisticalService.list(paramsMap); if(null != statisticalDTO && statisticalDTO.size() > 0){ ResiGroupStatisticalInfoRedisDTO statisticalObjct = diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicCommentServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicCommentServiceImpl.java index 67fd903074..9fc3289632 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicCommentServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicCommentServiceImpl.java @@ -98,7 +98,7 @@ public class ResiTopicCommentServiceImpl extends BaseServiceImpl wrapper = new QueryWrapper<>(); wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); - + wrapper.eq(FieldConstant.DEL_FLAG,NumConstant.ZERO_STR); return wrapper; } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java index 1925d2b28b..c4af44761f 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java @@ -138,6 +138,7 @@ public class ResiTopicServiceImpl extends BaseServiceImpl wrapper = new QueryWrapper<>(); + wrapper.eq(FieldConstant.DEL_FLAG,NumConstant.ZERO_STR); wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); return wrapper; @@ -235,6 +236,7 @@ public class ResiTopicServiceImpl extends BaseServiceImpl wrapper = new QueryWrapper<>(); + wrapper.eq(FieldConstant.DEL_FLAG,NumConstant.ZERO_STR); wrapper.eq(TopicConstant.RESI_GROUP_ID,resiTopicPublishFormDTO.getGroupId()); List statistical = resiGroupStatisticalDao.selectList(wrapper); if(null != statistical && statistical.size() >= NumConstant.ONE){ @@ -524,6 +526,7 @@ public class ResiTopicServiceImpl extends BaseServiceImpl wrapper = new QueryWrapper<>(); + wrapper.eq(FieldConstant.DEL_FLAG,NumConstant.ZERO_STR); wrapper.eq(TopicConstant.TOPIC_ID,topicId); wrapper.orderByAsc(TopicConstant.SORT); List attachments = resiTopicAttachmentDao.selectList(wrapper); @@ -818,6 +821,7 @@ public class ResiTopicServiceImpl extends BaseServiceImpl + + + + + + + + + + diff --git a/epmet-module/resi-guide/resi-guide-server/pom.xml b/epmet-module/resi-guide/resi-guide-server/pom.xml index b4688e19d9..312ad1d2b0 100644 --- a/epmet-module/resi-guide/resi-guide-server/pom.xml +++ b/epmet-module/resi-guide/resi-guide-server/pom.xml @@ -76,6 +76,11 @@ 2.0.0 compile + + org.yaml + snakeyaml + ${snakeyaml.version} + diff --git a/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/service/impl/StrangerAccessRecordServiceImpl.java b/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/service/impl/StrangerAccessRecordServiceImpl.java index 729ce30565..edc0784fa5 100644 --- a/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/service/impl/StrangerAccessRecordServiceImpl.java +++ b/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/service/impl/StrangerAccessRecordServiceImpl.java @@ -101,6 +101,7 @@ public class StrangerAccessRecordServiceImpl extends BaseServiceImpl wrapper = new QueryWrapper<>(); wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + wrapper.eq(FieldConstant.DEL_FLAG,NumConstant.ZERO_STR); Calendar before3daysDate = Calendar.getInstance(); before3daysDate.setTime(new Date()); before3daysDate.add(Calendar.DATE, -3); diff --git a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/warmhearted/controller/ResiWarmheartedController.java b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/warmhearted/controller/ResiWarmheartedController.java index 03283c179a..943a096740 100644 --- a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/warmhearted/controller/ResiWarmheartedController.java +++ b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/warmhearted/controller/ResiWarmheartedController.java @@ -43,6 +43,7 @@ public class ResiWarmheartedController { **/ @PostMapping("submit") public Result submit(@LoginUser TokenDto tokenDTO, @RequestBody ResiWarmheartedSubmitFormDTO formDTO) { + formDTO.setApp(tokenDTO.getApp()); ValidatorUtils.validateEntity(formDTO); return resiWarmheartedService.submit(tokenDTO, formDTO); } diff --git a/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/warmhearted/ResiWarmheartedApplyDTO.java b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/warmhearted/ResiWarmheartedApplyDTO.java index 31c92d0a34..4f301d4ba1 100644 --- a/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/warmhearted/ResiWarmheartedApplyDTO.java +++ b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/warmhearted/ResiWarmheartedApplyDTO.java @@ -69,6 +69,16 @@ public class ResiWarmheartedApplyDTO implements Serializable { */ private String refuseReason; + /** + * 审核人员已读未读标识(未读:unread 界面显示红点; 已读:read 不显示红点) + */ + private String readFlag; + + /** + * 消息通知内容 + */ + private String messageText; + /** * 热心居民申请行为记录表Id (resi_warmhearted_visit.id) */ diff --git a/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/warmhearted/form/ResiWarmAuditApproveFormDTO.java b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/warmhearted/form/ResiWarmAuditApproveFormDTO.java new file mode 100644 index 0000000000..058627678a --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/warmhearted/form/ResiWarmAuditApproveFormDTO.java @@ -0,0 +1,51 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.resi.partymember.dto.warmhearted.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + + +/** + * 政府端-人工审核热心居民申请-审核通过-入参配置 + * @author sun + */ +@Data +public class ResiWarmAuditApproveFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 热心居民申请id + */ + @NotBlank(message = "申请ID不能为空") + private String applyId; + + /** + * 用户Id + */ + private String userId; + + /** + * 所属端 app + */ + private String app; + +} \ No newline at end of file diff --git a/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/warmhearted/form/ResiWarmAuditFormDTO.java b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/warmhearted/form/ResiWarmAuditFormDTO.java new file mode 100644 index 0000000000..844fdee598 --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/warmhearted/form/ResiWarmAuditFormDTO.java @@ -0,0 +1,66 @@ +/** + * 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.resi.partymember.dto.warmhearted.form; + + +import lombok.Data; + +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + + +/** + * 政府端-获取待审核的热心居民申请列表-入参配置 + * + * @author sun + */ +@Data +public class ResiWarmAuditFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 用户当前所在网格所属客户id + */ + @NotBlank(message = "客户id不能为空") + private String customerId; + + /** + * 用户当前所在网格id + */ + @NotBlank(message = "网格id不能为空") + private String gridId; + + /** + * 页码 + */ + @Min(1) + private Integer pageNo; + + /** + * 每页显示条数 + */ + private Integer pageSize = 10; + + /** + * 审核状态 【key:audit_status,value:(under_auditting:待审核,approved:通过,rejected :未通过)】 + */ + private String auditStatus; + +} \ No newline at end of file diff --git a/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/warmhearted/form/ResiWarmheartedAuditFormDTO.java b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/warmhearted/form/ResiWarmAuditRejectFormDTO.java similarity index 74% rename from epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/warmhearted/form/ResiWarmheartedAuditFormDTO.java rename to epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/warmhearted/form/ResiWarmAuditRejectFormDTO.java index 707e41f30f..6f19739bcc 100644 --- a/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/warmhearted/form/ResiWarmheartedAuditFormDTO.java +++ b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/warmhearted/form/ResiWarmAuditRejectFormDTO.java @@ -24,11 +24,11 @@ import java.io.Serializable; /** - * 政府端-人工审核热心居民申请-配置入参 + * 政府端-人工审核热心居民申请-审核驳回-入参配置 * @author sun */ @Data -public class ResiWarmheartedAuditFormDTO implements Serializable { +public class ResiWarmAuditRejectFormDTO implements Serializable { private static final long serialVersionUID = 1L; @@ -36,28 +36,22 @@ public class ResiWarmheartedAuditFormDTO implements Serializable { * 热心居民申请id */ @NotBlank(message = "申请ID不能为空") - private String resiWarmApplyId; - - /** - * 审核状态(0:取消驳回 1:审核通过) - */ - @NotBlank(message = "审核状态不能为空") - private String auditStatus; + private String applyId; /** * 驳回理由 */ + @NotBlank(message = "驳回理由不能为空") private String refuseReason; /** - * 客户Id CUSTOMER.id + * 用户Id */ - @NotBlank(message = "客户ID不能为空") - private String customerId; + private String userId; /** - * 用户Id + * 所属端 app */ - private String userId; + private String app; } \ No newline at end of file diff --git a/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/warmhearted/form/ResiWarmGetDetailFormDTO.java b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/warmhearted/form/ResiWarmGetDetailFormDTO.java new file mode 100644 index 0000000000..97bb2b4f44 --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/warmhearted/form/ResiWarmGetDetailFormDTO.java @@ -0,0 +1,42 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.resi.partymember.dto.warmhearted.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + + +/** + * 政府端-热心居民申请详情信息-入参配置 + * + * @author sun + */ +@Data +public class ResiWarmGetDetailFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 热心居民申请id + */ + @NotBlank(message = "申请ID不能为空") + private String applyId; + +} \ No newline at end of file diff --git a/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/warmhearted/form/ResiWarmheartedAuditedFromDTO.java b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/warmhearted/form/ResiWarmheartedAuditedFromDTO.java new file mode 100644 index 0000000000..c7a9b8bacd --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/warmhearted/form/ResiWarmheartedAuditedFromDTO.java @@ -0,0 +1,31 @@ +package com.epmet.resi.partymember.dto.warmhearted.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @author zhaoqifeng + * @dscription 热心居民-审核历史请求参数 + * @date 2020/4/16 13:51 + */ +@Data +public class ResiWarmheartedAuditedFromDTO implements Serializable { + private static final long serialVersionUID = -7290137219142856024L; + /** + * 客户id + */ + private String customerId; + /** + * 网格id + */ + private String gridId; + /** + * 页码 + */ + private Integer pageNo; + /** + * 每页显示数量 + */ + private Integer pageSize; +} diff --git a/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/warmhearted/form/ResiWarmheartedSubmitFormDTO.java b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/warmhearted/form/ResiWarmheartedSubmitFormDTO.java index 38adf78eae..7ce698f0af 100644 --- a/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/warmhearted/form/ResiWarmheartedSubmitFormDTO.java +++ b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/warmhearted/form/ResiWarmheartedSubmitFormDTO.java @@ -61,4 +61,14 @@ public class ResiWarmheartedSubmitFormDTO implements Serializable { */ private String userId; + /** + * 所属端 app + */ + private String app; + + /** + * 消息内容 + */ + private String messageText; + } \ No newline at end of file diff --git a/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/warmhearted/result/ResiWarmAuditResultDTO.java b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/warmhearted/result/ResiWarmAuditResultDTO.java new file mode 100644 index 0000000000..8e00af9ca4 --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/warmhearted/result/ResiWarmAuditResultDTO.java @@ -0,0 +1,106 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.resi.partymember.dto.warmhearted.result; + + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * 政府端-获取待审核的热心居民申请列表-返参配置 + * + * @author sun + */ +@Data +public class ResiWarmAuditResultDTO implements Serializable { + + private static final long serialVersionUID = -1L; + + /** + * 申请单Id + */ + private String applyId; + + /** + * 客户Id (customer.id) + */ + private String customerId; + + /** + * 网格Id (customer_grid.id) + */ + private String gridId; + + /** + * 申请用户id + */ + private String userId; + + /** + * 热心居民申请理由 (300字) + */ + private String reason; + + /** + * 审核状态 【key:audit_status,value:(under_auditting:待审核,approved:通过,rejected :未通过)】 + */ + private String auditStatus; + + /** + * 拒绝理由 + */ + private String refuseReason; + + /** + * 申请用户头像 + */ + private String userHeadPhoto; + + /** + * 申请用户的显示昵称 + */ + private String userNickName; + + /** + * 阅读标记 未读unread 界面显示红点,已读read不显示红点 + */ + private String readFlag; + + /** + * 消息通知内容 + */ + private String messageText; + + /** + * 热心居民申请行为记录表Id (resi_warmhearted_visit.id) + */ + private String resiWarmVisitId; + + /** + * 申请时间 + */ + private Date applyTime; + + /** + * 街道 + */ + private String street; + +} \ No newline at end of file diff --git a/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/warmhearted/result/ResiWarmheartedAuditedResultDTO.java b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/warmhearted/result/ResiWarmheartedAuditedResultDTO.java new file mode 100644 index 0000000000..7b8a147be8 --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/warmhearted/result/ResiWarmheartedAuditedResultDTO.java @@ -0,0 +1,46 @@ +package com.epmet.resi.partymember.dto.warmhearted.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * @author zhaoqifeng + * @dscription 热心居民-审核历史返回值 + * @date 2020/4/16 13:52 + */ +@Data +public class ResiWarmheartedAuditedResultDTO implements Serializable { + private static final long serialVersionUID = 4109086860497055842L; + /** + * 申请单id + */ + private String applyId; + /** + * 申请用户id + */ + private String userId; + /** + * 申请用户头像 + */ + private String userHeadPhoto; + /** + * 申请用户显示昵称 + */ + private String userNickName; + /** + * 申请时间HH:mm + */ + private Date applyTime; + /** + * 已驳回rejected ,已通过approved + */ + private String status; + /** + * 消息通知内容 + */ + private String messageText; + + +} diff --git a/epmet-module/resi-partymember/resi-partymember-server/pom.xml b/epmet-module/resi-partymember/resi-partymember-server/pom.xml index 1b3efe725e..0ac1f5db89 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/pom.xml +++ b/epmet-module/resi-partymember/resi-partymember-server/pom.xml @@ -81,6 +81,18 @@ RELEASE compile + + com.epmet + epmet-message-client + 2.0.0 + compile + + + com.epmet + gov-org-client + 2.0.0 + compile + diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/feign/EpmetMessageFeignClient.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/feign/EpmetMessageFeignClient.java index b39f6bbea2..50b8cf9bb5 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/feign/EpmetMessageFeignClient.java +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/feign/EpmetMessageFeignClient.java @@ -2,10 +2,13 @@ package com.epmet.modules.feign; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.UserMessageFormDTO; import com.epmet.modules.feign.fallback.EpmetMessageFeignClientFallback; import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; /** * @author kamui @@ -21,4 +24,13 @@ public interface EpmetMessageFeignClient { @GetMapping(value = "message/sms/captcha/{mobile}") Result sendSmsCaptcha(@PathVariable String mobile); + /** + * @param formDto + * @return com.epmet.commons.tools.utils.Result + * @Author sun + * @Description 新增未读消息 + **/ + @PostMapping(value = "message/usermessage/saveusermessage", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) + Result saveUserMessage(UserMessageFormDTO formDto); + } \ No newline at end of file diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/feign/EpmetUserFeignClient.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/feign/EpmetUserFeignClient.java index 30cb07eb4b..6f15d6b399 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/feign/EpmetUserFeignClient.java +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/feign/EpmetUserFeignClient.java @@ -5,12 +5,15 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.dto.UserResiInfoDTO; import com.epmet.dto.UserRoleDTO; import com.epmet.dto.form.UserResiInfoFormDTO; +import com.epmet.dto.form.UserResiInfoListFormDTO; import com.epmet.dto.result.UserResiInfoResultDTO; import com.epmet.modules.feign.fallback.EpmetUserFeignClientFallBack; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; +import java.util.List; + /** * @author zhaoqifeng * @dscription @@ -21,6 +24,7 @@ public interface EpmetUserFeignClient { /** * 查询用户注册信息 + * * @param userResiInfoFormDTO 参数 * @return Result */ @@ -29,11 +33,12 @@ public interface EpmetUserFeignClient { /** * 党员认证时,如果没有注册居民,则注册居民信息 + * * @param userResiInfoDTO * @author zhaoqifeng **/ @PostMapping("/epmetuser/userresiinfo/saveResiInfo") - Result saveResiInfo (@RequestBody UserResiInfoDTO userResiInfoDTO); + Result saveResiInfo(@RequestBody UserResiInfoDTO userResiInfoDTO); /** * 添加用户角色关系 @@ -44,4 +49,14 @@ public interface EpmetUserFeignClient { @PostMapping("/epmetuser/userrole/saveUserRole") Result saveUserRole(@RequestBody UserRoleDTO userRoleDTO); + /** + * 根据userId集合查询用户注册信息 + * + * @param userResiInfoListFormDTO + * @return com.epmet.commons.tools.utils.Result> + * @Date 2020/4/7 18:24 + **/ + @PostMapping("/epmetuser/userresiinfo/getuserresiinfolist") + Result> getUserResiInfoList(@RequestBody UserResiInfoListFormDTO userResiInfoListFormDTO); + } diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/feign/GovOrgFeignClient.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/feign/GovOrgFeignClient.java new file mode 100644 index 0000000000..620bd1feaf --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/feign/GovOrgFeignClient.java @@ -0,0 +1,35 @@ +package com.epmet.modules.feign; + + +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.CustomerGridDTO; +import com.epmet.dto.form.CustomerGridFormDTO; +import com.epmet.dto.form.ListCustomerGridFormDTO; +import com.epmet.modules.feign.fallback.GovOrgFeignClientFallBack; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; + + +/** + * @Description Feign调用gov-org-server模块 + * @ClassName GovOrgFeginFallBack + * @Author sun + */ +@FeignClient(name = ServiceConstant.GOV_ORG_SERVER, fallback = GovOrgFeignClientFallBack.class) +public interface GovOrgFeignClient { + + /** + * 根据网格Id查询网格信息 + * @param customerGridFormDTO + * @return + */ + @PostMapping("/gov/org/customergrid/getcustomergridbygridid") + Result getCustomerGridByGridId(@RequestBody CustomerGridFormDTO customerGridFormDTO); + + + + + +} diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/feign/fallback/EpmetMessageFeignClientFallback.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/feign/fallback/EpmetMessageFeignClientFallback.java index e87f27e4d3..f588f55781 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/feign/fallback/EpmetMessageFeignClientFallback.java +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/feign/fallback/EpmetMessageFeignClientFallback.java @@ -3,6 +3,7 @@ package com.epmet.modules.feign.fallback; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.ModuleUtils; import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.UserMessageFormDTO; import com.epmet.modules.feign.EpmetMessageFeignClient; import org.springframework.stereotype.Component; @@ -18,4 +19,9 @@ public class EpmetMessageFeignClientFallback implements EpmetMessageFeignClient return ModuleUtils.feignConError(ServiceConstant.EPMET_MESSAGE_SERVER, "sendSmsCaptcha", mobile); } + @Override + public Result saveUserMessage(UserMessageFormDTO formDto) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_MESSAGE_SERVER, "saveUserMessage", formDto); + } + } diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/feign/fallback/EpmetUserFeignClientFallBack.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/feign/fallback/EpmetUserFeignClientFallBack.java index 93e9d3cf20..1203bc053d 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/feign/fallback/EpmetUserFeignClientFallBack.java +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/feign/fallback/EpmetUserFeignClientFallBack.java @@ -6,10 +6,13 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.dto.UserResiInfoDTO; import com.epmet.dto.UserRoleDTO; import com.epmet.dto.form.UserResiInfoFormDTO; +import com.epmet.dto.form.UserResiInfoListFormDTO; import com.epmet.dto.result.UserResiInfoResultDTO; import com.epmet.modules.feign.EpmetUserFeignClient; import org.springframework.stereotype.Component; +import java.util.List; + /** * @author zhaoqifeng * @dscription @@ -31,4 +34,9 @@ public class EpmetUserFeignClientFallBack implements EpmetUserFeignClient { public Result saveUserRole(UserRoleDTO userRoleDTO) { return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "saveUserRole", userRoleDTO); } + + @Override + public Result> getUserResiInfoList(UserResiInfoListFormDTO userResiInfoListFormDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getUserResiInfoList", userResiInfoListFormDTO); + } } diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/feign/fallback/GovOrgFeignClientFallBack.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/feign/fallback/GovOrgFeignClientFallBack.java new file mode 100644 index 0000000000..f1f0195374 --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/feign/fallback/GovOrgFeignClientFallBack.java @@ -0,0 +1,28 @@ +package com.epmet.modules.feign.fallback; + +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.utils.ModuleUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.CustomerGridDTO; +import com.epmet.dto.form.CustomerGridFormDTO; +import com.epmet.modules.feign.GovOrgFeignClient; +import org.springframework.stereotype.Component; + +/** + * @Description Feign + * @ClassName GovOrgFeginFallBack + * @Author sun + */ +@Component +public class GovOrgFeignClientFallBack implements GovOrgFeignClient { + + /** + * 根据网格Id查询网格信息 + * @param customerGridFormDTO + * @return + */ + @Override + public Result getCustomerGridByGridId(CustomerGridFormDTO customerGridFormDTO) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getCustomerGridByGridId",customerGridFormDTO); + } +} 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 54e7dc19f4..28959478c1 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 @@ -153,7 +153,7 @@ public class PartyMemberConfirmServiceImpl implements PartyMemberConfirmService PartymemberInfoEntity partyMemberInfoEntity = ConvertUtils.sourceToTarget(partyMemberInfoDTO, PartymemberInfoEntity.class); - if (confirmAutoDTO == null || (confirmAutoDTO.getResult().compareTo(PartyMemberConstant.BENCHMARK) < 0 && !confirmAutoDTO.getComparisonResults())) { + if (confirmAutoDTO == null || !confirmAutoDTO.getComparisonResults()) { //将访问记录更新到热心居民申请行为记录表 saveOrUpdateVisit(partyMemberInfoDTO.getPartymemberVisitId(), null, PartyMemberConstant.OPERATE_AUTO_FAILED); diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/PartymemberBaseInfoServiceImpl.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/PartymemberBaseInfoServiceImpl.java index 2f8e281b68..8d0381e8a3 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/PartymemberBaseInfoServiceImpl.java +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/PartymemberBaseInfoServiceImpl.java @@ -40,6 +40,9 @@ import org.springframework.transaction.annotation.Transactional; import java.util.*; import java.util.stream.Collectors; +import java.util.stream.Stream; + +import static java.util.stream.Collectors.toList; /** * 党员库基本信息表 @@ -125,25 +128,58 @@ public class PartymemberBaseInfoServiceImpl extends BaseServiceImpl 0) { //优先判断身份证和手机号 - Optional matchingResult = - idCardList.stream().filter(baseInfo -> baseInfo.getMobile().equals(partyMemberInfo.getMobile())).findFirst(); - - if (matchingResult.isPresent()) { - confirmAutoDTO = getResult(matchingResult.get(), partyMemberInfo, true); - return confirmAutoDTO; + List matchingList = idCardList.stream().filter(baseInfo -> + baseInfo.getMobile().equals(partyMemberInfo.getMobile())).collect(toList()); + + if (matchingList.size() > 0) { + //姓名匹配度是01(含)以上 + List nameMatchingList = idCardList.stream().filter(baseInfo -> + getOneSimilarity(baseInfo.getName(), name, + PartyMemberConstant.NAME_SMALL)).collect(toList()); + if (nameMatchingList.size() > 0) { + //获取匹配度最高的一条 + PartymemberBaseInfoEntity baseInfoEntity = + nameMatchingList.stream().sorted(Comparator.comparing((PartymemberBaseInfoEntity p) -> + getSimilarity(p, partyMemberInfo)).reversed()).collect(toList()).get(0); + confirmAutoDTO = getResult(baseInfoEntity, partyMemberInfo, true); + return confirmAutoDTO; + } } //判断身份证和姓名 - matchingResult = idCardList.stream().filter(baseInfo -> baseInfo.getName().equals(name)).findFirst(); - - if (matchingResult.isPresent()) { - confirmAutoDTO = getResult(matchingResult.get(), partyMemberInfo, true); + matchingList = idCardList.stream().filter(baseInfo -> baseInfo.getName().equals(name)).collect(toList()); + + if (matchingList.size() > 0) { + //手机号匹配度是01(含)以上 + List mobileMatchingList = idCardList.stream().filter(baseInfo -> + getOneSimilarity(baseInfo.getMobile(), partyMemberInfo.getMobile(), + PartyMemberConstant.MOBILE_SMALL)).collect(toList()); + if (mobileMatchingList.size() > 0) { + //获取匹配度最高的一条 + PartymemberBaseInfoEntity baseInfoEntity = + mobileMatchingList.stream().sorted(Comparator.comparing((PartymemberBaseInfoEntity p) -> + getSimilarity(p, partyMemberInfo)).reversed()).collect(toList()).get(0); + confirmAutoDTO = getResult(baseInfoEntity, partyMemberInfo, true); + return confirmAutoDTO; + } + } + //有一项是11的情况下,另外两项需要是10(含)以上,可以认证通过; + matchingList = idCardList.stream().filter(baseInfo -> + getOneSimilarity(baseInfo.getMobile(), partyMemberInfo.getMobile(), + PartyMemberConstant.MOBILE_MOST) && getOneSimilarity(baseInfo.getName(), + name, PartyMemberConstant.NAME_MOST)).collect(toList()); + + if (matchingList.size() > 0) { + //获取匹配度最高的一条 + PartymemberBaseInfoEntity baseInfoEntity = + matchingList.stream().sorted(Comparator.comparing((PartymemberBaseInfoEntity p) -> + getSimilarity(p, partyMemberInfo)).reversed()).collect(toList()).get(0); + confirmAutoDTO = getResult(baseInfoEntity, partyMemberInfo, true); return confirmAutoDTO; } - //获取匹配度最高的数据 sortList.add(idCardList.stream().sorted(Comparator.comparing((PartymemberBaseInfoEntity p) -> - getSimilarity(p, partyMemberInfo)).reversed()).collect(Collectors.toList()).get(0)); + getSimilarity(p, partyMemberInfo)).reversed()).collect(toList()).get(0)); } else { //根据手机号匹配数据 @@ -151,32 +187,63 @@ public class PartymemberBaseInfoServiceImpl extends BaseServiceImpl 0) { //判断手机号和姓名 - Optional matchingResult = - mobileList.stream().filter(baseInfo -> baseInfo.getName().equals(name)).findFirst(); - - if (matchingResult.isPresent()) { - confirmAutoDTO = getResult(matchingResult.get(), partyMemberInfo, true); + List matchingList = + mobileList.stream().filter(baseInfo -> baseInfo.getName().equals(name)).collect(toList()); + + if (matchingList.size() > 0) { + //身份证匹配度是01(含)以上 + List idCardMatchingList = mobileList.stream().filter(baseInfo -> + getOneSimilarity(baseInfo.getIdCard(), partyMemberInfo.getIdCard(), + PartyMemberConstant.ID_SMALL)).collect(toList()); + if (idCardMatchingList.size() > 0) { + //获取匹配度最高的一条 + PartymemberBaseInfoEntity baseInfoEntity = + idCardMatchingList.stream().sorted(Comparator.comparing((PartymemberBaseInfoEntity p) -> + getSimilarity(p, partyMemberInfo)).reversed()).collect(toList()).get(0); + confirmAutoDTO = getResult(baseInfoEntity, partyMemberInfo, true); + return confirmAutoDTO; + } + } + //有一项是11的情况下,另外两项需要是10(含)以上,可以认证通过; + matchingList = mobileList.stream().filter(baseInfo -> + getOneSimilarity(baseInfo.getIdCard(), partyMemberInfo.getIdCard(), + PartyMemberConstant.ID_MOST) && getOneSimilarity(baseInfo.getName(), + name, PartyMemberConstant.NAME_MOST)).collect(toList()); + + if (matchingList.size() > 0) { + //获取匹配度最高的一条 + PartymemberBaseInfoEntity baseInfoEntity = + matchingList.stream().sorted(Comparator.comparing((PartymemberBaseInfoEntity p) -> + getSimilarity(p, partyMemberInfo)).reversed()).collect(toList()).get(0); + confirmAutoDTO = getResult(baseInfoEntity, partyMemberInfo, true); return confirmAutoDTO; } - //获取匹配度最高的数据 sortList.add(mobileList.stream().sorted(Comparator.comparing((PartymemberBaseInfoEntity p) -> - getSimilarity(p, partyMemberInfo)).reversed()).collect(Collectors.toList()).get(0)); + getSimilarity(p, partyMemberInfo)).reversed()).collect(toList()).get(0)); } else { //根据姓名匹配数据 List nameList = baseDao.selectBaseInfoByName(partyMemberInfo); if (null != nameList && nameList.size() > 0) { + //有一项是11的情况下,另外两项需要是10(含)以上,可以认证通过; + List matchingList = nameList.stream().filter(baseInfo -> + getOneSimilarity(baseInfo.getIdCard(), partyMemberInfo.getIdCard(), + PartyMemberConstant.ID_MOST) && getOneSimilarity(baseInfo.getMobile(), + partyMemberInfo.getMobile(), PartyMemberConstant.MOBILE_MOST)).collect(toList()); + + if (matchingList.size() > 0) { + //获取匹配度最高的一条 + PartymemberBaseInfoEntity baseInfoEntity = + matchingList.stream().sorted(Comparator.comparing((PartymemberBaseInfoEntity p) -> + getSimilarity(p, partyMemberInfo)).reversed()).collect(toList()).get(0); + confirmAutoDTO = getResult(baseInfoEntity, partyMemberInfo, true); + return confirmAutoDTO; + } + //获取匹配度最高的数据 sortList.add(nameList.stream().sorted(Comparator.comparing((PartymemberBaseInfoEntity p) -> - getSimilarity(p, partyMemberInfo)).reversed()).collect(Collectors.toList()).get(0)); - - PartymemberBaseInfoEntity similar = - nameList.stream().sorted(Comparator.comparing((PartymemberBaseInfoEntity p) -> - getSimilarity(p, partyMemberInfo)).reversed()).collect(Collectors.toList()).get(0); - - confirmAutoDTO = getResult(similar, partyMemberInfo, false); - return confirmAutoDTO; + getSimilarity(p, partyMemberInfo)).reversed()).collect(toList()).get(0)); } else { return null; @@ -184,9 +251,9 @@ public class PartymemberBaseInfoServiceImpl extends BaseServiceImpl - getSimilarity(p, partyMemberInfo)).reversed()).collect(Collectors.toList()).get(0); + getSimilarity(p, partyMemberInfo)).reversed()).collect(toList()).get(0); return getResult(similar, partyMemberInfo, false); } @@ -274,4 +341,15 @@ public class PartymemberBaseInfoServiceImpl extends BaseServiceImpl> page(@RequestParam Map params) { - PageData page = resiWarmheartedApplyService.page(params); - return new Result>().ok(page); - } - - @GetMapping("{id}") - public Result get(@PathVariable("id") String id) { - ResiWarmheartedApplyDTO data = resiWarmheartedApplyService.get(id); - return new Result().ok(data); - } - - @PostMapping - public Result save(@RequestBody ResiWarmheartedApplyDTO dto) { - //效验数据 - ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); - resiWarmheartedApplyService.save(dto); - return new Result(); - } - - @PutMapping - public Result update(@RequestBody ResiWarmheartedApplyDTO dto) { - //效验数据 - ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); - resiWarmheartedApplyService.update(dto); - return new Result(); - } - - @DeleteMapping - public Result delete(@RequestBody String[] ids) { - //效验数据 - AssertUtils.isArrayEmpty(ids, "id"); - resiWarmheartedApplyService.delete(ids); - return new Result(); - } - - @GetMapping("export") - public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { - List list = resiWarmheartedApplyService.list(params); - ExcelUtils.exportExcelToTarget(response, null, list, ResiWarmheartedApplyExcel.class); - } - - @PostMapping("init") - public Result init(@RequestBody ResiWarmheartedFormDTO formDTO) { - return resiWarmheartedApplyService.init(formDTO); - } - - @PostMapping("submit") - public Result submit(@RequestBody ResiWarmheartedSubmitFormDTO formDTO) { - return resiWarmheartedApplyService.submit(formDTO); - } - - @PostMapping("manageaudit") - public Result manageAudit(@RequestBody ResiWarmheartedAuditFormDTO formDTO) { - return resiWarmheartedApplyService.manageAudit(formDTO); - } + @Autowired + private ResiWarmheartedApplyService resiWarmheartedApplyService; + + @GetMapping("page") + public Result> page(@RequestParam Map params) { + PageData page = resiWarmheartedApplyService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id) { + ResiWarmheartedApplyDTO data = resiWarmheartedApplyService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody ResiWarmheartedApplyDTO dto) { + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + resiWarmheartedApplyService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody ResiWarmheartedApplyDTO dto) { + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + resiWarmheartedApplyService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids) { + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + resiWarmheartedApplyService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = resiWarmheartedApplyService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, ResiWarmheartedApplyExcel.class); + } + + @PostMapping("init") + public Result init(@RequestBody ResiWarmheartedFormDTO formDTO) { + return resiWarmheartedApplyService.init(formDTO); + } + + @PostMapping("submit") + public Result submit(@RequestBody ResiWarmheartedSubmitFormDTO formDTO) { + return resiWarmheartedApplyService.submit(formDTO); + } + + /** + * 热心居民审核历史列表 + * + * @param formDTO 参数 + * @return + */ + @PostMapping("audited") + public Result> audited(@RequestBody ResiWarmheartedAuditedFromDTO formDTO) { + return resiWarmheartedApplyService.audited(formDTO); + } + + /** + * @param + * @Author sun + * @Description 政府端-获取待审核的热心居民申请列表 + **/ + @PostMapping("auditing") + public Result> auditing(@LoginUser TokenDto tokenDTO, @RequestBody ResiWarmAuditFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + return resiWarmheartedApplyService.auditing(formDTO); + } + + /** + * @param + * @Author sun + * @Description 政府端-热心居民申请-审核通过 + **/ + @PostMapping("approve") + public Result approve(@LoginUser TokenDto tokenDTO, @RequestBody ResiWarmAuditApproveFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + return resiWarmheartedApplyService.approve(formDTO); + } + + /** + * @param + * @Author sun + * @Description 政府端-热心居民申请-审核驳回 + **/ + @PostMapping("reject") + public Result reject(@LoginUser TokenDto tokenDTO, @RequestBody ResiWarmAuditRejectFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + return resiWarmheartedApplyService.reject(formDTO); + } + + /** + * @param + * @Author sun + * @Description 政府端-热心居民申请详情信息 + **/ + @PostMapping("getdetail") + public Result getDetail(@LoginUser TokenDto tokenDTO, @RequestBody ResiWarmGetDetailFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + return resiWarmheartedApplyService.getDetail(formDTO); + } } \ No newline at end of file diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/warmhearted/dao/ResiWarmheartedApplyDao.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/warmhearted/dao/ResiWarmheartedApplyDao.java index 843eac1b54..5467173db1 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/warmhearted/dao/ResiWarmheartedApplyDao.java +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/warmhearted/dao/ResiWarmheartedApplyDao.java @@ -18,12 +18,16 @@ package com.epmet.modules.warmhearted.dao; import com.epmet.commons.mybatis.dao.BaseDao; -import com.epmet.commons.tools.utils.Result; import com.epmet.modules.warmhearted.entity.ResiWarmheartedApplyEntity; import com.epmet.resi.partymember.dto.warmhearted.ResiWarmheartedApplyDTO; +import com.epmet.resi.partymember.dto.warmhearted.form.ResiWarmAuditFormDTO; +import com.epmet.resi.partymember.dto.warmhearted.form.ResiWarmheartedAuditedFromDTO; import com.epmet.resi.partymember.dto.warmhearted.form.ResiWarmheartedFormDTO; +import com.epmet.resi.partymember.dto.warmhearted.result.ResiWarmAuditResultDTO; import org.apache.ibatis.annotations.Mapper; +import java.util.List; + /** * 热心居民申请表 * @@ -40,4 +44,12 @@ public interface ResiWarmheartedApplyDao extends BaseDao selectAuditedApplyList(ResiWarmheartedAuditedFromDTO params); + + /** + * 查询待审核状态的热心居民申请 + * @param formDTO + * @return + */ + List selectResiWarmAuditList(ResiWarmAuditFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/warmhearted/entity/ResiWarmheartedApplyEntity.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/warmhearted/entity/ResiWarmheartedApplyEntity.java index 6c5545dabf..4df8b1c43c 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/warmhearted/entity/ResiWarmheartedApplyEntity.java +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/warmhearted/entity/ResiWarmheartedApplyEntity.java @@ -68,6 +68,16 @@ public class ResiWarmheartedApplyEntity extends BaseEpmetEntity { */ private String refuseReason; + /** + * 审核人员已读未读标识(未读:unread 界面显示红点; 已读:read 不显示红点) + */ + private String readFlag; + + /** + * 消息通知内容 + */ + private String messageText; + /** * 热心居民申请行为记录表Id (resi_warmhearted_visit.id) */ diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/warmhearted/excel/ResiWarmheartedApplyExcel.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/warmhearted/excel/ResiWarmheartedApplyExcel.java index cee8444ca4..f04c5afcaa 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/warmhearted/excel/ResiWarmheartedApplyExcel.java +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/warmhearted/excel/ResiWarmheartedApplyExcel.java @@ -52,6 +52,12 @@ public class ResiWarmheartedApplyExcel { @Excel(name = "拒绝理由") private String refuseReason; + @Excel(name = "阅读标记") + private String readFlag; + + @Excel(name = "消息通知内容") + private String messageText; + @Excel(name = "热心居民申请行为记录表Id (resi_warmhearted_visit.id)") private String resiWarmVisitId; diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/warmhearted/service/ResiWarmheartedApplyService.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/warmhearted/service/ResiWarmheartedApplyService.java index 87fb3ffd31..0fba6e16ff 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/warmhearted/service/ResiWarmheartedApplyService.java +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/warmhearted/service/ResiWarmheartedApplyService.java @@ -22,9 +22,9 @@ import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.Result; import com.epmet.modules.warmhearted.entity.ResiWarmheartedApplyEntity; import com.epmet.resi.partymember.dto.warmhearted.ResiWarmheartedApplyDTO; -import com.epmet.resi.partymember.dto.warmhearted.form.ResiWarmheartedAuditFormDTO; -import com.epmet.resi.partymember.dto.warmhearted.form.ResiWarmheartedFormDTO; -import com.epmet.resi.partymember.dto.warmhearted.form.ResiWarmheartedSubmitFormDTO; +import com.epmet.resi.partymember.dto.warmhearted.form.*; +import com.epmet.resi.partymember.dto.warmhearted.result.ResiWarmAuditResultDTO; +import com.epmet.resi.partymember.dto.warmhearted.result.ResiWarmheartedAuditedResultDTO; import com.epmet.resi.partymember.dto.warmhearted.result.ResiWarmheartedResultDTO; import java.util.List; @@ -117,11 +117,45 @@ public interface ResiWarmheartedApplyService extends BaseService> audited(ResiWarmheartedAuditedFromDTO formDTO); + + /** + * 政府端-获取待审核的热心居民申请列表 + * + * @param + * @return void + * @author sun + */ + Result> auditing(ResiWarmAuditFormDTO formDTO); + + /** + * 政府端-热心居民申请-审核通过 + * + * @param + * @return void + * @author sun + */ + Result approve(ResiWarmAuditApproveFormDTO formDTO); + + /** + * 政府端-热心居民申请-审核驳回 + * + * @param + * @return void + * @author sun + */ + Result reject(ResiWarmAuditRejectFormDTO formDTO); + + /** + * 政府端-热心居民申请详情信息 * * @param * @return void * @author sun */ - Result manageAudit(ResiWarmheartedAuditFormDTO formDTO); + Result getDetail(ResiWarmGetDetailFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/warmhearted/service/impl/ResiWarmheartedApplyServiceImpl.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/warmhearted/service/impl/ResiWarmheartedApplyServiceImpl.java index cae8a76100..b78ffa53eb 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/warmhearted/service/impl/ResiWarmheartedApplyServiceImpl.java +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/warmhearted/service/impl/ResiWarmheartedApplyServiceImpl.java @@ -19,7 +19,6 @@ package com.epmet.modules.warmhearted.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.core.toolkit.IdWorker; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.AppClientConstant; import com.epmet.commons.tools.constant.EpmetRoleKeyConstant; @@ -31,11 +30,18 @@ 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.PartyMemberConstant; +import com.epmet.constant.ReadFlagConstant; +import com.epmet.dto.CustomerGridDTO; import com.epmet.dto.UserRoleDTO; +import com.epmet.dto.form.CustomerGridFormDTO; +import com.epmet.dto.form.UserMessageFormDTO; import com.epmet.dto.form.UserResiInfoFormDTO; +import com.epmet.dto.form.UserResiInfoListFormDTO; import com.epmet.dto.result.UserResiInfoResultDTO; +import com.epmet.modules.feign.EpmetMessageFeignClient; import com.epmet.modules.feign.EpmetUserFeignClient; -import com.epmet.modules.utils.ModuleConstant; +import com.epmet.modules.feign.GovOrgFeignClient; +import com.epmet.modules.warmhearted.constant.ResiWarmUserMessageConstant; import com.epmet.modules.warmhearted.constant.ResiWarmheartedVisitConstant; import com.epmet.modules.warmhearted.dao.ResiWarmheartedApplyDao; import com.epmet.modules.warmhearted.entity.ResiWarmheartedApplyEntity; @@ -43,22 +49,22 @@ import com.epmet.modules.warmhearted.redis.ResiWarmheartedApplyRedis; import com.epmet.modules.warmhearted.service.ResiWarmheartedApplyService; import com.epmet.modules.warmhearted.service.ResiWarmheartedVisitService; import com.epmet.resi.partymember.dto.warmhearted.ResiWarmheartedApplyDTO; -import com.epmet.resi.partymember.dto.warmhearted.form.ResiWarmheartedAuditFormDTO; -import com.epmet.resi.partymember.dto.warmhearted.form.ResiWarmheartedFormDTO; -import com.epmet.resi.partymember.dto.warmhearted.form.ResiWarmheartedSubmitFormDTO; +import com.epmet.resi.partymember.dto.warmhearted.form.*; +import com.epmet.resi.partymember.dto.warmhearted.result.ResiWarmAuditResultDTO; +import com.epmet.resi.partymember.dto.warmhearted.result.ResiWarmheartedAuditedResultDTO; import com.epmet.resi.partymember.dto.warmhearted.result.ResiWarmheartedResultDTO; 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; +import java.util.ArrayList; import java.util.Arrays; -import java.util.Date; import java.util.List; import java.util.Map; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import java.util.stream.Collectors; /** * 热心居民申请表 @@ -69,174 +75,391 @@ import org.slf4j.LoggerFactory; @Service public class ResiWarmheartedApplyServiceImpl extends BaseServiceImpl implements ResiWarmheartedApplyService { - private static final Logger logger = LoggerFactory.getLogger(ResiWarmheartedApplyServiceImpl.class); - @Autowired - private ResiWarmheartedApplyRedis resiWarmheartedApplyRedis; - @Autowired - private ResiWarmheartedVisitService resiWarmheartedVisitService; - @Autowired - private ResiWarmheartedApplyDao resiWarmheartedApplyDao; - @Autowired - private EpmetUserFeignClient epmetUserFeignClient; - - @Override - public PageData page(Map params) { - IPage page = baseDao.selectPage( - getPage(params, FieldConstant.CREATED_TIME, false), - getWrapper(params) - ); - return getPageData(page, ResiWarmheartedApplyDTO.class); - } - - @Override - public List list(Map params) { - List entityList = baseDao.selectList(getWrapper(params)); - - return ConvertUtils.sourceToTarget(entityList, ResiWarmheartedApplyDTO.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 ResiWarmheartedApplyDTO get(String id) { - ResiWarmheartedApplyEntity entity = baseDao.selectById(id); - return ConvertUtils.sourceToTarget(entity, ResiWarmheartedApplyDTO.class); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void save(ResiWarmheartedApplyDTO dto) { - ResiWarmheartedApplyEntity entity = ConvertUtils.sourceToTarget(dto, ResiWarmheartedApplyEntity.class); - insert(entity); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void update(ResiWarmheartedApplyDTO dto) { - ResiWarmheartedApplyEntity entity = ConvertUtils.sourceToTarget(dto, ResiWarmheartedApplyEntity.class); - updateById(entity); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void delete(String[] ids) { - // 逻辑删除(@TableLogic 注解) - baseDao.deleteBatchIds(Arrays.asList(ids)); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public Result init(ResiWarmheartedFormDTO formDTO) { - Result result = new Result(); - //0:先判断该用户是否是已注册居民 - UserResiInfoFormDTO userResiInfoFormDTO = new UserResiInfoFormDTO(); - userResiInfoFormDTO.setCustomerId(formDTO.getCustomerId()); - userResiInfoFormDTO.setUserId(formDTO.getUserId()); - Result result1 = epmetUserFeignClient.getUserResiInfoDTO(userResiInfoFormDTO); - if (!result1.success() || null == result1.getData()) { - result.setCode(EpmetErrorCode.CANNOT_AUDIT_WARM.getCode()); - result.setMsg(EpmetErrorCode.CANNOT_AUDIT_WARM.getMsg()); - return result; - } - //1:热心居民申请行为记录表新增数据 - result = resiWarmheartedVisitService.saveResiWarmheartedVisit(formDTO); - if (!result.success()) { - logger.error(ResiWarmheartedVisitConstant.OPERATION_EXCEPTION); - } - ResiWarmheartedResultDTO resiWarmheartedResultDTO = result.getData(); - //2:查询是否已申请热心居民(不查询审核未通过的) - formDTO.setAuditStatus(ResiWarmheartedVisitConstant.REJECTED); - ResiWarmheartedApplyDTO resiWarmheartedApplyDTO = resiWarmheartedApplyDao.selectResiWarmheartedApply(formDTO); - if (null == resiWarmheartedApplyDTO || StringUtils.isEmpty(resiWarmheartedApplyDTO.getId())) { - //是否已申请热心居民 0:否, 1:是 - resiWarmheartedResultDTO.setIsApplied(NumConstant.ZERO_STR); - } else { - resiWarmheartedResultDTO.setIsApplied(NumConstant.ONE_STR); - result.setCode(NumConstant.ZERO); - result.setMsg(ResiWarmheartedVisitConstant.RESI_WARM_INIT); - } - return result.ok(resiWarmheartedResultDTO); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public Result submit(ResiWarmheartedSubmitFormDTO formDTO) { - Result result = new Result(); - //0:为防止前台点击多次提交 先查询一下是否有已提交数据 - ResiWarmheartedFormDTO ResiWarmheartedFormDTO = ConvertUtils.sourceToTarget(formDTO, ResiWarmheartedFormDTO.class); - ResiWarmheartedFormDTO.setAuditStatus(ResiWarmheartedVisitConstant.REJECTED); - ResiWarmheartedApplyDTO resiWarmheartedApplyDTO = resiWarmheartedApplyDao.selectResiWarmheartedApply(ResiWarmheartedFormDTO); - if (null != resiWarmheartedApplyDTO) { - logger.error(ResiWarmheartedVisitConstant.REPEAT_EXCEPTION); - throw new RenException(ResiWarmheartedVisitConstant.REPEAT_EXCEPTION); - }else{ - //1:将申请记录存入热心居民申请表中 - saveResiWarmApply(formDTO); - //2:将最后一次操作行为更新到热心居民申请行为记录表中 - resiWarmheartedVisitService.updateResiWarmVisit(formDTO); - result.setCode(NumConstant.ZERO); - result.setMsg(ResiWarmheartedVisitConstant.RESI_WARM_SUBMIT); - } - return result; - } - - /** - * 热心居民申请表新增数据 - * - * @param formDTO - * @return - */ - public void saveResiWarmApply(ResiWarmheartedSubmitFormDTO formDTO) { - ResiWarmheartedApplyEntity entity = new ResiWarmheartedApplyEntity(); - entity.setCustomerId(formDTO.getCustomerId()); - entity.setGridId(formDTO.getGridId()); - entity.setUserId(formDTO.getUserId()); - entity.setReason(formDTO.getReason()); - entity.setResiWarmVisitId(formDTO.getResiWarmVisitId()); - entity.setAuditStatus(ResiWarmheartedVisitConstant.UNDER_AUDITTING); - baseDao.insert(entity); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public Result manageAudit(ResiWarmheartedAuditFormDTO formDTO) { - Result result = new Result(); - //1:更新热心居民申请表数据 - ResiWarmheartedApplyEntity entity = new ResiWarmheartedApplyEntity(); - entity.setId(formDTO.getResiWarmApplyId()); - if (NumConstant.ZERO_STR.equals(formDTO.getAuditStatus())) { - //审核状态-未通过 - entity.setAuditStatus(PartyMemberConstant.REJECTED); - } else { - //审核状态-通过 - entity.setAuditStatus(PartyMemberConstant.APPROVED); - } - if (!StringUtils.isBlank(formDTO.getRefuseReason())) { - entity.setRefuseReason(formDTO.getRefuseReason()); - } - int num = baseDao.updateById(entity); - //2:审核通过的添加热心居民的角色 - if (num > NumConstant.ZERO && NumConstant.ONE_STR.equals(formDTO.getAuditStatus())) { - //查询需要添加热心居民角色的userId - ResiWarmheartedApplyEntity resiWarmheartedApplyEntity = baseDao.selectById(formDTO.getResiWarmApplyId()); - UserRoleDTO dto = new UserRoleDTO(); - dto.setCustomerId(formDTO.getCustomerId()); - dto.setUserId(resiWarmheartedApplyEntity.getUserId()); - //所属端-居民端 - dto.setApp(AppClientConstant.APP_RESI); - //角色-热心居民 - dto.setRoleKey(EpmetRoleKeyConstant.WARMHEARTED); - //角色表新增网格Id - dto.setGridId(resiWarmheartedApplyEntity.getGridId()); - result = epmetUserFeignClient.saveUserRole(dto); + private static final Logger logger = LoggerFactory.getLogger(ResiWarmheartedApplyServiceImpl.class); + @Autowired + private ResiWarmheartedApplyRedis resiWarmheartedApplyRedis; + @Autowired + private ResiWarmheartedVisitService resiWarmheartedVisitService; + @Autowired + private ResiWarmheartedApplyDao resiWarmheartedApplyDao; + @Autowired + private EpmetUserFeignClient epmetUserFeignClient; + @Autowired + private EpmetMessageFeignClient epmetMessageFeignClient; + @Autowired + private GovOrgFeignClient govOrgFeignClient; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, ResiWarmheartedApplyDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, ResiWarmheartedApplyDTO.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 ResiWarmheartedApplyDTO get(String id) { + ResiWarmheartedApplyEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, ResiWarmheartedApplyDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(ResiWarmheartedApplyDTO dto) { + ResiWarmheartedApplyEntity entity = ConvertUtils.sourceToTarget(dto, ResiWarmheartedApplyEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(ResiWarmheartedApplyDTO dto) { + ResiWarmheartedApplyEntity entity = ConvertUtils.sourceToTarget(dto, ResiWarmheartedApplyEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Result init(ResiWarmheartedFormDTO formDTO) { + Result result = new Result(); + //0:先判断该用户是否是已注册居民 + UserResiInfoFormDTO userResiInfoFormDTO = new UserResiInfoFormDTO(); + userResiInfoFormDTO.setCustomerId(formDTO.getCustomerId()); + userResiInfoFormDTO.setUserId(formDTO.getUserId()); + Result result1 = epmetUserFeignClient.getUserResiInfoDTO(userResiInfoFormDTO); + if (!result1.success() || null == result1.getData()) { + result.setCode(EpmetErrorCode.CANNOT_AUDIT_WARM.getCode()); + result.setMsg(EpmetErrorCode.CANNOT_AUDIT_WARM.getMsg()); + return result; + } + //1:热心居民申请行为记录表新增数据 + result = resiWarmheartedVisitService.saveResiWarmheartedVisit(formDTO); + if (!result.success()) { + logger.error(ResiWarmheartedVisitConstant.OPERATION_EXCEPTION); + } + ResiWarmheartedResultDTO resiWarmheartedResultDTO = result.getData(); + //2:查询是否已申请热心居民(不查询审核未通过的) + formDTO.setAuditStatus(ResiWarmheartedVisitConstant.REJECTED); + ResiWarmheartedApplyDTO resiWarmheartedApplyDTO = resiWarmheartedApplyDao.selectResiWarmheartedApply(formDTO); + if (null == resiWarmheartedApplyDTO || StringUtils.isEmpty(resiWarmheartedApplyDTO.getId())) { + //是否已申请热心居民 0:否, 1:是 + resiWarmheartedResultDTO.setIsApplied(NumConstant.ZERO_STR); + } else { + resiWarmheartedResultDTO.setIsApplied(NumConstant.ONE_STR); + result.setCode(NumConstant.ZERO); + result.setMsg(ResiWarmheartedVisitConstant.RESI_WARM_INIT); + } + return result.ok(resiWarmheartedResultDTO); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Result submit(ResiWarmheartedSubmitFormDTO formDTO) { + Result result = new Result(); + //0:为防止前台点击多次提交 先查询一下是否有已提交数据 + ResiWarmheartedFormDTO ResiWarmheartedFormDTO = ConvertUtils.sourceToTarget(formDTO, ResiWarmheartedFormDTO.class); + ResiWarmheartedFormDTO.setAuditStatus(ResiWarmheartedVisitConstant.REJECTED); + ResiWarmheartedApplyDTO resiWarmheartedApplyDTO = resiWarmheartedApplyDao.selectResiWarmheartedApply(ResiWarmheartedFormDTO); + if (null != resiWarmheartedApplyDTO) { + logger.error(ResiWarmheartedVisitConstant.REPEAT_EXCEPTION); + throw new RenException(ResiWarmheartedVisitConstant.REPEAT_EXCEPTION); + } else { + //0:调用user服务获取申请人的基本信息 + UserResiInfoFormDTO resiInfoParam = new UserResiInfoFormDTO(); + resiInfoParam.setCustomerId(formDTO.getCustomerId()); + resiInfoParam.setUserId(formDTO.getUserId()); + Result resultUserInfo = epmetUserFeignClient.getUserResiInfoDTO(resiInfoParam); + if (!resultUserInfo.success() || null == resultUserInfo.getData()) { + throw new RenException(ResiWarmheartedVisitConstant.SELECT_USERINFO_EXCEPTION); + } + String showName = resultUserInfo.getData().getShowName(); + String messageContent = String.format(ResiWarmUserMessageConstant.RESIWARM_APPLY_MSG, showName); + formDTO.setMessageText(messageContent); + //1:将申请记录存入热心居民申请表中 + saveResiWarmApply(formDTO); + //2:将最后一次操作行为更新到热心居民申请行为记录表中 + resiWarmheartedVisitService.updateResiWarmVisit(formDTO); + //3:添加消息信息,给网格长发消息 + saveResiWarmUserMessage(formDTO); + result.setCode(NumConstant.ZERO); + result.setMsg(ResiWarmheartedVisitConstant.RESI_WARM_SUBMIT); + } + return result; + } + /** + * 热心居民申请表新增数据 + * + * @param formDTO + * @return + */ + public void saveResiWarmApply(ResiWarmheartedSubmitFormDTO formDTO) { + ResiWarmheartedApplyEntity entity = new ResiWarmheartedApplyEntity(); + entity.setCustomerId(formDTO.getCustomerId()); + entity.setGridId(formDTO.getGridId()); + entity.setUserId(formDTO.getUserId()); + entity.setReason(formDTO.getReason()); + entity.setResiWarmVisitId(formDTO.getResiWarmVisitId()); + entity.setAuditStatus(ResiWarmheartedVisitConstant.UNDER_AUDITTING); + entity.setReadFlag(ResiWarmheartedVisitConstant.UN_READ); + entity.setMessageText(formDTO.getMessageText()); + baseDao.insert(entity); + } + /** + * 热心居民申请像网格长发送消息 + * + * @param formDTO + * @return + * @Author sun + */ + private void saveResiWarmUserMessage(ResiWarmheartedSubmitFormDTO formDTO) { + UserMessageFormDTO userMessageFormDTO = new UserMessageFormDTO(); + userMessageFormDTO.setCustomerId(formDTO.getCustomerId()); + userMessageFormDTO.setGridId(formDTO.getGridId()); + //网格长用户Id TODO + //userMessageFormDTO.setUserId(); + userMessageFormDTO.setUserId(formDTO.getUserId());//先在token中取一个默认值 + userMessageFormDTO.setApp(formDTO.getApp()); + userMessageFormDTO.setTitle(ResiWarmUserMessageConstant.GROUP_TITLE); + userMessageFormDTO.setMessageContent(formDTO.getMessageText()); + userMessageFormDTO.setReadFlag(ReadFlagConstant.UN_READ); + //保存消息 + epmetMessageFeignClient.saveUserMessage(userMessageFormDTO); + } + + @Override + public Result> audited(ResiWarmheartedAuditedFromDTO formDTO) { + Result> result = new Result<>(); + List resultList = new ArrayList<>(); + //查询条件 + int pageIndex = (formDTO.getPageNo() - NumConstant.ONE) * formDTO.getPageSize(); + formDTO.setPageNo(pageIndex); + //获取审核列表 + List applyList = baseDao.selectAuditedApplyList(formDTO); + if (null == applyList || applyList.size() == 0) { + return result.ok(resultList); + } + //提取所有userID + List userIds = + applyList.stream().map(ResiWarmheartedApplyEntity::getUserId).collect(Collectors.toList()); + //获取用户昵称,头像 + UserResiInfoListFormDTO userResiInfoListFormDTO = new UserResiInfoListFormDTO(); + userResiInfoListFormDTO.setUserIdList(userIds); + List userResiInfoList = + epmetUserFeignClient.getUserResiInfoList(userResiInfoListFormDTO).getData(); + if (null == userResiInfoList || userResiInfoList.size() == 0) { + return result.ok(resultList); } - return result; - } + resultList = applyList.stream().flatMap(apply -> userResiInfoList.stream().filter(user -> + apply.getUserId().equals(user.getUserId())).map(userInfo -> { + ResiWarmheartedAuditedResultDTO resultDTO = new ResiWarmheartedAuditedResultDTO(); + resultDTO.setApplyId(apply.getId()); + resultDTO.setUserId(apply.getUserId()); + resultDTO.setStatus(apply.getAuditStatus()); + resultDTO.setApplyTime(apply.getUpdatedTime()); + resultDTO.setMessageText(apply.getMessageText()); + resultDTO.setUserNickName(userInfo.getShowName()); + resultDTO.setUserHeadPhoto(userInfo.getHeadPhoto()); + return resultDTO; + })).collect(Collectors.toList()); + + return result.ok(resultList); + } + + /** + * 政府端-获取待审核的热心居民申请列表 + * + * @param + * @return void + * @author sun + */ + @Override + public Result> auditing(ResiWarmAuditFormDTO formDTO) { + Result> result = new Result<>(); + List applyList = new ArrayList<>(); + //1:查询待审核状态的热心居民申请 + formDTO.setAuditStatus(PartyMemberConstant.UNDER_AUDITTING); + formDTO.setPageNo((formDTO.getPageNo() - NumConstant.ONE) * formDTO.getPageSize()); + applyList = baseDao.selectResiWarmAuditList(formDTO); + if (null == applyList || applyList.size() < NumConstant.ONE) { + return result.ok(applyList); + } + //2:调用epmet-user服务 获取用户头像 昵称 + //遍历获取所有的userId + List userIds = applyList.stream().map(ResiWarmAuditResultDTO::getUserId).collect(Collectors.toList()); + //获取所有用户的头像 昵称 + UserResiInfoListFormDTO userResiInfoListFormDTO = new UserResiInfoListFormDTO(); + userResiInfoListFormDTO.setUserIdList(userIds); + List userResiInfoList = epmetUserFeignClient.getUserResiInfoList(userResiInfoListFormDTO).getData(); + if (null == userResiInfoList || userResiInfoList.size() < NumConstant.ONE) { + return result.ok(applyList); + } + //3:将每个用户的头像 昵称放到对应实体中返回给前台 + List resultList = applyList.stream().flatMap(apply -> userResiInfoList.stream().filter(user -> + apply.getUserId().equals(user.getUserId())).map(userInfo -> { + ResiWarmAuditResultDTO resultDTO = ConvertUtils.sourceToTarget(apply, ResiWarmAuditResultDTO.class); + resultDTO.setUserNickName(null == userInfo.getShowName() ? "" : userInfo.getShowName()); + resultDTO.setUserHeadPhoto(null == userInfo.getHeadPhoto() ? "" : userInfo.getHeadPhoto()); + return resultDTO; + })).collect(Collectors.toList()); + + return result.ok(resultList); + } + + /** + * 政府端-热心居民申请-审核通过 + * + * @param + * @return void + * @author sun + */ + @Override + @Transactional(rollbackFor = Exception.class) + public Result approve(ResiWarmAuditApproveFormDTO formDTO) { + Result result = new Result(); + //0:先校验数据是否是未审核状态,防止接口测试调用多次 + ResiWarmheartedApplyEntity entity = baseDao.selectById(formDTO.getApplyId()); + if (null == entity || !ResiWarmheartedVisitConstant.UNDER_AUDITTING.equals(entity.getAuditStatus())) { + result.error(ResiWarmheartedVisitConstant.AUDIT_EXCEPTION); + return result; + } + //1:更新热心居民申请表数据 + //审核状态-通过 + entity.setAuditStatus(PartyMemberConstant.APPROVED); + int num = baseDao.updateById(entity); + //2:审核通过的添加热心居民的角色 + if (num < NumConstant.ONE) { + result.error(ResiWarmheartedVisitConstant.UPDATE_EXCEPTION); + return result; + } + //查询需要添加热心居民角色的userId + UserRoleDTO dto = new UserRoleDTO(); + dto.setCustomerId(entity.getCustomerId()); + dto.setUserId(entity.getUserId()); + //所属端-居民端 + dto.setApp(AppClientConstant.APP_RESI); + //角色-热心居民 + dto.setRoleKey(EpmetRoleKeyConstant.WARMHEARTED); + //角色表新增网格Id + dto.setGridId(entity.getGridId()); + result = epmetUserFeignClient.saveUserRole(dto); + //3:为申请人发送审核通过消息提示 + result = auditMessage(entity, ResiWarmUserMessageConstant.AUDIT_APPROVE_MSG); + return result; + } + /** + * 热心居民申请审核通过向申请人发送消息 + * @Author sun + * @param formDTO + * @param userMsg 消息模板 + */ + private Result auditMessage(ResiWarmheartedApplyEntity formDTO, String userMsg) { + UserMessageFormDTO userMessageFormDTO = new UserMessageFormDTO(); + userMessageFormDTO.setCustomerId(formDTO.getCustomerId()); + userMessageFormDTO.setGridId(formDTO.getGridId()); + userMessageFormDTO.setUserId(formDTO.getUserId()); + userMessageFormDTO.setApp(AppClientConstant.APP_RESI); + userMessageFormDTO.setTitle(ResiWarmUserMessageConstant.GROUP_TITLE); + //调用gov-org服务查询网格信息 + CustomerGridFormDTO customerGridFormDTO = new CustomerGridFormDTO(); + customerGridFormDTO.setGridId(formDTO.getGridId()); + Result result = govOrgFeignClient.getCustomerGridByGridId(customerGridFormDTO); + String gridName = null; + if (result.success() && null != result.getData()) { + gridName = result.getData().getGridName(); + } + String messageContent = String.format(userMsg, gridName); + userMessageFormDTO.setMessageContent(messageContent); + userMessageFormDTO.setReadFlag(ReadFlagConstant.UN_READ); + //保存消息 + return epmetMessageFeignClient.saveUserMessage(userMessageFormDTO); + } + /** + * 政府端-热心居民申请-审核驳回 + * + * @param + * @return void + * @author sun + */ + @Override + @Transactional(rollbackFor = Exception.class) + public Result reject(ResiWarmAuditRejectFormDTO formDTO) { + Result result = new Result(); + //0:先校验数据是否是未审核状态,防止接口测试调用多次 + ResiWarmheartedApplyEntity entity = baseDao.selectById(formDTO.getApplyId()); + if (null == entity || !ResiWarmheartedVisitConstant.UNDER_AUDITTING.equals(entity.getAuditStatus())) { + result.error(ResiWarmheartedVisitConstant.AUDIT_EXCEPTION); + return result; + } + //1:更新热心居民申请表数据 + //审核状态-未通过 + entity.setAuditStatus(PartyMemberConstant.REJECTED); + entity.setRefuseReason(formDTO.getRefuseReason()); + baseDao.updateById(entity); + //2:为申请人发送审核驳回消息提示 + //查询申请信息 + auditMessage(entity, ResiWarmUserMessageConstant.AUDIT_REJECT_MSG); + return result; + } + + /** + * 政府端-热心居民申请详情信息 + * + * @param + * @return void + * @author sun + */ + @Override + public Result getDetail(ResiWarmGetDetailFormDTO formDTO) { + Result result = new Result<>(); + //1:根据申请Id查询热心居民申请审核详情 + ResiWarmheartedApplyEntity entity = baseDao.selectById(formDTO.getApplyId()); + if (null == entity) { + result.error(ResiWarmheartedVisitConstant.SELECT_EXCEPTION); + return result; + } + //2:修改申请数据状态为已读 + if(!ResiWarmheartedVisitConstant.READ.equals(entity.getReadFlag())){ + entity.setReadFlag(ResiWarmheartedVisitConstant.READ); + baseDao.updateById(entity); + } + //3:调用epmet-user服务查询用户头像 昵称信息 + UserResiInfoFormDTO userResiInfoFormDTO = new UserResiInfoFormDTO(); + userResiInfoFormDTO.setCustomerId(entity.getCustomerId()); + userResiInfoFormDTO.setUserId(entity.getUserId()); + Result resultUserInfo = epmetUserFeignClient.getUserResiInfoDTO(userResiInfoFormDTO); + if (!resultUserInfo.success() || null == resultUserInfo.getData()) { + result.error(ResiWarmheartedVisitConstant.SELECT_EXCEPTION); + return result; + } + UserResiInfoResultDTO userInfo = resultUserInfo.getData(); + ResiWarmAuditResultDTO resultDTO = ConvertUtils.sourceToTarget(entity, ResiWarmAuditResultDTO.class); + resultDTO.setApplyTime(entity.getUpdatedTime()); + resultDTO.setUserNickName(null == userInfo.getShowName() ? "" : userInfo.getShowName()); + resultDTO.setUserHeadPhoto(null == userInfo.getHeadPhoto() ? "" : userInfo.getHeadPhoto()); + resultDTO.setStreet(userInfo.getStreet()); + return result.ok(resultDTO); + } } diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/warmhearted/ResiWarmheartedApplyDao.xml b/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/warmhearted/ResiWarmheartedApplyDao.xml index ba8099f0fb..7056d086e8 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/warmhearted/ResiWarmheartedApplyDao.xml +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/warmhearted/ResiWarmheartedApplyDao.xml @@ -56,6 +56,48 @@ AND rw.audit_status != #{auditStatus} + + \ No newline at end of file diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/redis/migration/db.sql b/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/redis/migration/db.sql new file mode 100644 index 0000000000..a60097daac --- /dev/null +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/redis/migration/db.sql @@ -0,0 +1,5 @@ +#epmet_resi_partymember数据库-热心居民申请表新增字段 +ALTER TABLE resi_warmhearted_apply ADD ( + READ_FLAG VARCHAR (255) DEFAULT NULL COMMENT '审核人员已读未读标识(未读:unread 界面显示红点; 已读:read 不显示红点)', + MESSAGE_TEXT VARCHAR (500) DEFAULT NULL COMMENT '消息通知内容' +); \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/RegisterRelationServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/RegisterRelationServiceImpl.java index 3defd336ac..e2f315d22f 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/RegisterRelationServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/RegisterRelationServiceImpl.java @@ -172,6 +172,7 @@ public class RegisterRelationServiceImpl extends BaseServiceImpl wrapper = new QueryWrapper<>(); wrapper.eq(UserCustomerConstant.CUSTOMER_ID,enterGridFormDTO.getCustomerId()); wrapper.eq(UserCustomerConstant.USER_ID,enterGridFormDTO.getUserId()); + wrapper.eq(FieldConstant.DEL_FLAG,NumConstant.ZERO_STR); //1.查找用户注册关系表,如果没有表示当前用户为陌生人(拉取用户微信表信息),如果有表示当前用户已经进行居民认证