From 7045e178c1cfaa3b132e2b370fbd022f6d726832 Mon Sep 17 00:00:00 2001 From: zhaoqifeng Date: Thu, 16 Apr 2020 17:51:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20=E7=83=AD=E5=BF=83?= =?UTF-8?q?=E5=B1=85=E6=B0=91=E5=AE=A1=E6=A0=B8=E5=8E=86=E5=8F=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ResiWarmheartedController.java | 23 + .../feign/ResiPartymemberFeignClient.java | 31 ++ .../ResiPartymemberFeignClientFallBack.java | 22 + .../epmet/service/ResiWarmheartedService.java | 12 + .../impl/ResiWarmheartedServiceImpl.java | 14 + .../form/ResiWarmheartedAuditedFromDTO.java | 31 ++ .../ResiWarmheartedAuditedResultDTO.java | 46 ++ .../modules/feign/EpmetUserFeignClient.java | 20 +- .../EpmetUserFeignClientFallBack.java | 8 + .../ResiWarmheartedApplyController.java | 131 +++--- .../service/ResiWarmheartedApplyService.java | 9 + .../impl/ResiWarmheartedApplyServiceImpl.java | 403 ++++++++++-------- 12 files changed, 514 insertions(+), 236 deletions(-) create mode 100644 epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/feign/ResiPartymemberFeignClient.java create mode 100644 epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/feign/fallback/ResiPartymemberFeignClientFallBack.java create mode 100644 epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/warmhearted/form/ResiWarmheartedAuditedFromDTO.java create mode 100644 epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/warmhearted/result/ResiWarmheartedAuditedResultDTO.java 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 index a65c32168e..c24465833b 100644 --- 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 @@ -1,8 +1,17 @@ package com.epmet.controller; +import com.epmet.commons.tools.utils.Result; +import com.epmet.resi.partymember.dto.warmhearted.form.ResiWarmheartedAuditedFromDTO; +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 @@ -13,4 +22,18 @@ import org.springframework.web.bind.annotation.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); + } + } 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..40b979710a --- /dev/null +++ b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/feign/ResiPartymemberFeignClient.java @@ -0,0 +1,31 @@ +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.ResiWarmheartedAuditedFromDTO; +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, + url = "http://localhost:8096") +public interface ResiPartymemberFeignClient { + /** + * 居民端-热心居民申请-提交申请数据 + * + * @author zhaoqf + **/ + @PostMapping(value = "resi/partymember/resiwarmheartedapply/audited") + Result> audited(@RequestBody ResiWarmheartedAuditedFromDTO formDTO); + + +} 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..c56c46dd56 --- /dev/null +++ b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/feign/fallback/ResiPartymemberFeignClientFallBack.java @@ -0,0 +1,22 @@ +package com.epmet.feign.fallback; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.feign.ResiPartymemberFeignClient; +import com.epmet.resi.partymember.dto.warmhearted.form.ResiWarmheartedAuditedFromDTO; +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 null; + } +} 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 index 90c640a101..a06cf0a203 100644 --- 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 @@ -1,5 +1,11 @@ package com.epmet.service; +import com.epmet.commons.tools.utils.Result; +import com.epmet.resi.partymember.dto.warmhearted.form.ResiWarmheartedAuditedFromDTO; +import com.epmet.resi.partymember.dto.warmhearted.result.ResiWarmheartedAuditedResultDTO; + +import java.util.List; + /** * @Description * @IntefaceName ResiWarmheartedService @@ -7,4 +13,10 @@ package com.epmet.service; * @date 2020.04.16 15:37 */ public interface ResiWarmheartedService { + /** + * 热心居民审核历史列表 + * @param formDTO 参数 + * @return ResiWarmheartedAuditedResultDTO + */ + Result> audited(ResiWarmheartedAuditedFromDTO formDTO); } 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 index 7aa68bcd92..9fe0ecc8c9 100644 --- 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 @@ -1,6 +1,13 @@ 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.ResiWarmheartedAuditedFromDTO; +import com.epmet.resi.partymember.dto.warmhearted.result.ResiWarmheartedAuditedResultDTO; import com.epmet.service.ResiWarmheartedService; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.List; /** * @Description @@ -9,4 +16,11 @@ import com.epmet.service.ResiWarmheartedService; * @date 2020.04.16 15:41 */ public class ResiWarmheartedServiceImpl implements ResiWarmheartedService { + @Autowired + private ResiPartymemberFeignClient resiPartymemberFeignClient; + + @Override + public Result> audited(ResiWarmheartedAuditedFromDTO formDTO) { + return resiPartymemberFeignClient.audited(formDTO); + } } 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/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/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..d1956f935b 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,22 +5,27 @@ 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 * @date 2020/3/30 14:51 */ -@FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallback = EpmetUserFeignClientFallBack.class) +@FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallback = EpmetUserFeignClientFallBack.class, url = "http" + + "://localhost:8087") public interface EpmetUserFeignClient { /** * 查询用户注册信息 + * * @param userResiInfoFormDTO 参数 * @return Result */ @@ -29,11 +34,12 @@ public interface EpmetUserFeignClient { /** * 党员认证时,如果没有注册居民,则注册居民信息 + * * @param userResiInfoDTO * @author zhaoqifeng **/ @PostMapping("/epmetuser/userresiinfo/saveResiInfo") - Result saveResiInfo (@RequestBody UserResiInfoDTO userResiInfoDTO); + Result saveResiInfo(@RequestBody UserResiInfoDTO userResiInfoDTO); /** * 添加用户角色关系 @@ -44,4 +50,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("getuserresiinfolist") + Result> getUserResiInfoList(@RequestBody UserResiInfoListFormDTO userResiInfoListFormDTO); + } 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/warmhearted/controller/ResiWarmheartedApplyController.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/warmhearted/controller/ResiWarmheartedApplyController.java index ec08f6f466..bfa5504390 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/warmhearted/controller/ResiWarmheartedApplyController.java +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/warmhearted/controller/ResiWarmheartedApplyController.java @@ -29,8 +29,10 @@ import com.epmet.modules.warmhearted.excel.ResiWarmheartedApplyExcel; import com.epmet.modules.warmhearted.service.ResiWarmheartedApplyService; 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.ResiWarmheartedAuditedFromDTO; 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.result.ResiWarmheartedAuditedResultDTO; import com.epmet.resi.partymember.dto.warmhearted.result.ResiWarmheartedResultDTO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -50,64 +52,75 @@ import java.util.Map; @RequestMapping("resiwarmheartedapply") public class ResiWarmheartedApplyController { - @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); - } - - @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); + } + + @PostMapping("manageaudit") + public Result manageAudit(@RequestBody ResiWarmheartedAuditFormDTO formDTO) { + return resiWarmheartedApplyService.manageAudit(formDTO); + } + + /** + * 热心居民审核历史列表 + * + * @param formDTO 参数 + * @return + */ + @PostMapping("audited") + public Result> audited(@RequestBody ResiWarmheartedAuditedFromDTO formDTO) { + return resiWarmheartedApplyService.audited(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/ResiWarmheartedApplyService.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/warmhearted/service/ResiWarmheartedApplyService.java index 87fb3ffd31..6ff41edb09 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 @@ -23,8 +23,10 @@ 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.ResiWarmheartedAuditedFromDTO; 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.result.ResiWarmheartedAuditedResultDTO; import com.epmet.resi.partymember.dto.warmhearted.result.ResiWarmheartedResultDTO; import java.util.List; @@ -124,4 +126,11 @@ public interface ResiWarmheartedApplyService extends BaseService> audited(ResiWarmheartedAuditedFromDTO 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..3a4fd5c245 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; @@ -33,9 +32,9 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.constant.PartyMemberConstant; 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 com.epmet.modules.utils.ModuleConstant; import com.epmet.modules.warmhearted.constant.ResiWarmheartedVisitConstant; import com.epmet.modules.warmhearted.dao.ResiWarmheartedApplyDao; import com.epmet.modules.warmhearted.entity.ResiWarmheartedApplyEntity; @@ -44,21 +43,23 @@ 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.ResiWarmheartedAuditedFromDTO; 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.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 +70,226 @@ 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; + + @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); + } + return result; + } + + @Override + public Result> audited(ResiWarmheartedAuditedFromDTO formDTO) { + Result> result = new Result<>(); + List resultList = new ArrayList<>(); + //查询条件 + ResiWarmheartedApplyDTO applyDTO = ConvertUtils.sourceToTarget(formDTO, ResiWarmheartedApplyDTO.class); + applyDTO.setAuditStatus(PartyMemberConstant.UNDER_AUDITTING); + //获取审核列表 + List applyList = + baseDao.selectList(getWrapper(applyDTO).orderByDesc("UPDATED_TIME")); + 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); + } + + private QueryWrapper getWrapper(ResiWarmheartedApplyDTO params) { + String customerId = params.getCustomerId(); + String gridId = params.getGridId(); + String auditStatus = params.getAuditStatus(); + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(customerId), "CUSTOMER_ID", customerId) + .eq(StringUtils.isNotBlank(gridId), "GRID_ID", gridId) + .ne(StringUtils.isNotBlank(auditStatus), "AUDIT_STATUS", auditStatus); + + return wrapper; + } }