From 9547cad3fda57a5db6b9f7a5cbcd75db35db1615 Mon Sep 17 00:00:00 2001 From: liushaowen <565850092@qq.com> Date: Mon, 2 Nov 2020 18:21:00 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E5=A4=96=E9=83=A8=E8=B0=83=E7=94=A8?= =?UTF-8?q?=E7=AB=99=E5=86=85=E4=BF=A1=E6=95=B4=E5=90=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/dto/UserMessageDTO.java | 7 +++- .../epmet/dto/form/UserMessageFormDTO.java | 5 +++ .../dto/form/WxmpMessagePushFormDTO.java | 17 ++++++++- .../java/com/epmet/constant/ExtConstant.java | 11 ++++++ .../controller/WxmpMessageExtController.java | 23 +++++++++++- .../com/epmet/entity/UserMessageEntity.java | 5 +++ .../com/epmet/excel/UserMessageExcel.java | 5 ++- .../impl/WxmpMessageExtServiceImpl.java | 37 +++++++++++++++---- .../service/impl/WxmpMessageServiceImpl.java | 2 +- ....3.12.5__alter_user_message_add_column.sql | 1 + 10 files changed, 98 insertions(+), 15 deletions(-) create mode 100644 epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/constant/ExtConstant.java create mode 100644 epmet-module/epmet-message/epmet-message-server/src/main/resources/db/migration/V0.3.12.5__alter_user_message_add_column.sql diff --git a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/UserMessageDTO.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/UserMessageDTO.java index f8b887c240..d44c80ae47 100644 --- a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/UserMessageDTO.java +++ b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/UserMessageDTO.java @@ -59,6 +59,11 @@ public class UserMessageDTO implements Serializable { */ private String app; + /** + * 调用者 + */ + private String referer; + /** * 消息标题 */ @@ -104,4 +109,4 @@ public class UserMessageDTO implements Serializable { */ private Date updatedTime; -} \ No newline at end of file +} diff --git a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/UserMessageFormDTO.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/UserMessageFormDTO.java index f8934cc167..f3298183d6 100644 --- a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/UserMessageFormDTO.java +++ b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/UserMessageFormDTO.java @@ -56,4 +56,9 @@ public class UserMessageFormDTO implements Serializable { */ @NotBlank(message = "readFlag不能为空") private String readFlag; + + /** + * 调用者 + */ + private String referer; } diff --git a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/WxmpMessagePushFormDTO.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/WxmpMessagePushFormDTO.java index fbd2732581..067ea3b3bb 100644 --- a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/WxmpMessagePushFormDTO.java +++ b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/WxmpMessagePushFormDTO.java @@ -25,7 +25,7 @@ public class WxmpMessagePushFormDTO implements Serializable { * 客户端类型 居民端:resi 工作端:work */ @NotBlank(message = "客户端类型不能为空") - private String clientType; + private String app; /** * 接收者(用户)的 userId @@ -37,7 +37,7 @@ public class WxmpMessagePushFormDTO implements Serializable { * 行为类型(存title字段的中间值) 入组申请、党员认证等 */ @NotBlank(message = "行为类型不能为空") - private String behaviorType; + private String title; /** * 消息内容 @@ -48,12 +48,25 @@ public class WxmpMessagePushFormDTO implements Serializable { /** * 网格id-居民端用 */ + @NotBlank(message = "网格id不能为空") private String gridId; + /** + * 已读标记 + */ + @NotBlank(message = "已读标记不能为空") + private String readFlag; + /** * 调用方 */ @NotBlank(message = "调用方不能为空") private String referer; + /** + * 推送微信订阅Flag + */ + @NotBlank(message = "是否推送订阅Flag不能为空") + private String pushWxmpFlag; + } diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/constant/ExtConstant.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/constant/ExtConstant.java new file mode 100644 index 0000000000..f8b9564e7a --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/constant/ExtConstant.java @@ -0,0 +1,11 @@ +package com.epmet.constant; + +public interface ExtConstant { + String APP_RESI = "resi"; + + String APP_WORK = "work"; + + String APP_GOV = "gov"; + + String PUSH_WXMP = "1"; +} diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/WxmpMessageExtController.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/WxmpMessageExtController.java index b6ffa1fc2f..242dfe3cb9 100644 --- a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/WxmpMessageExtController.java +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/WxmpMessageExtController.java @@ -1,9 +1,12 @@ package com.epmet.controller; +import com.epmet.commons.tools.exception.ExceptionUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.form.WxmpMessagePushFormDTO; import com.epmet.service.WxmpMessageExtService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -11,6 +14,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.List; +import java.util.concurrent.ExecutorService; /** * @description: 外部调用微信订阅controller @@ -20,14 +24,29 @@ import java.util.List; @RestController @RequestMapping("template") public class WxmpMessageExtController { + private Logger logger = LoggerFactory.getLogger(getClass()); + @Autowired private WxmpMessageExtService wxmpMessageExtService; - @PostMapping("wxmpmsgpush") + @Autowired + private ExecutorService executorService; + + @PostMapping("msgpush") public Result wxmpMsgPush(@RequestBody List dtos){ for (WxmpMessagePushFormDTO dto : dtos) { ValidatorUtils.validateEntity(dto); } - return wxmpMessageExtService.pushWxmpMessage(dtos); + executorService.execute(() -> { + try { + long startTs = System.currentTimeMillis(); + wxmpMessageExtService.pushWxmpMessage(dtos); + long endTs = System.currentTimeMillis(); + logger.info("异步发送消息成功,执行时长:{}", endTs - startTs); + } catch (Exception e) { + logger.error("异步发送消息失败,错误信息:{}", ExceptionUtils.getErrorStackTrace(e)); + } + }); + return new Result(); } } diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/UserMessageEntity.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/UserMessageEntity.java index db267d9fd7..dcdd460cde 100644 --- a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/UserMessageEntity.java +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/UserMessageEntity.java @@ -70,4 +70,9 @@ public class UserMessageEntity extends BaseEpmetEntity { */ private String readFlag; + /** + * 调用者 + */ + private String referer; + } diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/excel/UserMessageExcel.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/excel/UserMessageExcel.java index 8dbbf8249c..760e390274 100644 --- a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/excel/UserMessageExcel.java +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/excel/UserMessageExcel.java @@ -49,6 +49,9 @@ public class UserMessageExcel { @Excel(name = "消息标题") private String title; + @Excel(name = "调用者") + private String referer; + @Excel(name = "消息通知内容") private String messageContent; @@ -74,4 +77,4 @@ public class UserMessageExcel { private Date updatedTime; -} \ No newline at end of file +} diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpMessageExtServiceImpl.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpMessageExtServiceImpl.java index 368235246a..21204730c5 100644 --- a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpMessageExtServiceImpl.java +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpMessageExtServiceImpl.java @@ -2,8 +2,12 @@ package com.epmet.service.impl; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.utils.Result; +import com.epmet.constant.ExtConstant; +import com.epmet.dto.form.UserMessageFormDTO; import com.epmet.dto.form.WxSubscribeMessageFormDTO; import com.epmet.dto.form.WxmpMessagePushFormDTO; +import com.epmet.feign.EpmetMessageOpenFeignClient; +import com.epmet.service.UserMessageService; import com.epmet.service.WxmpMessageExtService; import com.epmet.service.WxmpMessageService; import org.springframework.beans.BeanUtils; @@ -24,20 +28,37 @@ public class WxmpMessageExtServiceImpl implements WxmpMessageExtService { @Autowired private WxmpMessageService wxmpMessageService; + @Autowired + private UserMessageService userMessageService; + @Override public Result pushWxmpMessage(List dtos) { - List msgList = new ArrayList<>(); + List wxmpMsgList = new ArrayList<>(); + List userMsgList = new ArrayList<>(); for (WxmpMessagePushFormDTO dto : dtos) { - WxSubscribeMessageFormDTO wxSubscribeMessageFormDTO = new WxSubscribeMessageFormDTO(); - try{ + //站内信 + UserMessageFormDTO userMessageFormDTO = new UserMessageFormDTO(); + BeanUtils.copyProperties(dto,userMessageFormDTO); + userMessageFormDTO.setTitle("您有一条"+dto.getTitle()); + userMsgList.add(userMessageFormDTO); + + //如果推送微信订阅flag为"1",推送微信订阅 + if (ExtConstant.PUSH_WXMP.equals(dto.getPushWxmpFlag())){ + WxSubscribeMessageFormDTO wxSubscribeMessageFormDTO = new WxSubscribeMessageFormDTO(); BeanUtils.copyProperties(dto,wxSubscribeMessageFormDTO); + //设置ClientType + if (ExtConstant.APP_RESI.equals(dto.getApp())){ + wxSubscribeMessageFormDTO.setClientType(ExtConstant.APP_RESI); + } + if (ExtConstant.APP_GOV.equals(dto.getApp())){ + wxSubscribeMessageFormDTO.setClientType(ExtConstant.APP_WORK); + } + wxSubscribeMessageFormDTO.setBehaviorType(dto.getTitle()); wxSubscribeMessageFormDTO.setMessageTime(new Date()); - msgList.add(wxSubscribeMessageFormDTO); - }catch (Exception e){ - throw new RenException("转换bean失败"); + wxmpMsgList.add(wxSubscribeMessageFormDTO); } } - wxmpMessageService.sendWxSubscribeMessage(msgList); - return new Result(); + wxmpMessageService.sendWxSubscribeMessage(wxmpMsgList); + return userMessageService.saveUserMessageList(userMsgList); } } diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpMessageServiceImpl.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpMessageServiceImpl.java index 3e834efdf1..7d7d68af77 100644 --- a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpMessageServiceImpl.java +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpMessageServiceImpl.java @@ -330,7 +330,7 @@ public class WxmpMessageServiceImpl implements WxmpMessageService { wxmpMsgSendRecordEntity.setMessageContent(msg.getMessageContent()); wxmpMsgSendRecordEntity.setMessageTime(msg.getMessageTime()); wxmpMsgSendRecordEntity.setResult(status); - wxmpMsgSendRecordEntity.setReferer(StringUtils.isBlank(msg.getReferer())?"epmet":msg.getReferer()); + wxmpMsgSendRecordEntity.setReferer(msg.getReferer()); return wxmpMsgSendRecordEntity; } diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/resources/db/migration/V0.3.12.5__alter_user_message_add_column.sql b/epmet-module/epmet-message/epmet-message-server/src/main/resources/db/migration/V0.3.12.5__alter_user_message_add_column.sql new file mode 100644 index 0000000000..cd2bf71d81 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/resources/db/migration/V0.3.12.5__alter_user_message_add_column.sql @@ -0,0 +1 @@ +ALTER TABLE user_message ADD REFERER VARCHAR(20) COMMENT '调用者'; From 800cc1ffe0fc8272902789ddafd02f4c9b6d9b64 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Tue, 3 Nov 2020 10:54:47 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E5=AF=B9=E5=A4=96=E6=8E=A5=E5=8F=A3-?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E7=BB=84=E7=BB=87=E5=9F=BA=E6=9C=AC=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/constant/ModuleConstant.java | 2 + .../epmet/controller/OpenUpController.java | 16 ++++- .../java/com/epmet/service/OpenUpService.java | 8 +++ .../epmet/service/impl/OpenUpServiceImpl.java | 14 ++++ .../com/epmet/dto/form/AgencyInfoFormDTO.java | 21 ++++++ .../epmet/dto/result/AgencyInfoResultDTO.java | 66 +++++++++++++++++++ .../epmet/feign/GovOrgOpenFeignClient.java | 9 +++ .../GovOrgOpenFeignClientFallback.java | 5 ++ .../controller/CustomerAgencyController.java | 9 +++ .../epmet/service/CustomerAgencyService.java | 6 ++ .../impl/CustomerAgencyServiceImpl.java | 16 +++++ 11 files changed, 170 insertions(+), 2 deletions(-) create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AgencyInfoFormDTO.java create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyInfoResultDTO.java diff --git a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/constant/ModuleConstant.java b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/constant/ModuleConstant.java index d8b34dc284..1bc1cc935a 100644 --- a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/constant/ModuleConstant.java +++ b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/constant/ModuleConstant.java @@ -14,4 +14,6 @@ public interface ModuleConstant { String ERROR_EPMET_USER = "调用epmet_user服务查询网格下的所有工作人员失败"; + String ERROR_AGENCY = "调用gov_org服务查询组织基本信息失败"; + } diff --git a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenUpController.java b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenUpController.java index 81ccddbdff..9884efe1b2 100644 --- a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenUpController.java +++ b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenUpController.java @@ -11,8 +11,10 @@ import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.feign.GovOrgOpenFeignClient; import com.epmet.service.OpenUpService; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - +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; @@ -100,5 +102,15 @@ public class OpenUpController { return govOrgOpenFeignClient.staffPermissionExt(commonStaffIdFormDTO.getStaffId()); } + /** + * @Description 对外接口-根据组织Id获取组织信息 + * @author sun + **/ + @PostMapping("agencyinfo") + Result agencyInfo(@RequestBody AgencyInfoFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, AgencyInfoFormDTO.StaffIdGroup.class); + return new Result().ok(openUpService.agencyInfo(formDTO)); + } + } diff --git a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/OpenUpService.java b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/OpenUpService.java index 5ecbf7aedb..d42e164f7e 100644 --- a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/OpenUpService.java +++ b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/OpenUpService.java @@ -1,8 +1,10 @@ package com.epmet.service; +import com.epmet.dto.form.AgencyInfoFormDTO; import com.epmet.dto.form.StaffSinAgencyFormDTO; import com.epmet.dto.form.StaffSinDeptFormDTO; import com.epmet.dto.form.StaffSinGridFormDTO; +import com.epmet.dto.result.AgencyInfoResultDTO; import com.epmet.dto.result.StaffSinAgencyResultDTO; import com.epmet.dto.result.StaffSinDeptResultDTO; import com.epmet.dto.result.StaffSinGridResultDTO; @@ -38,4 +40,10 @@ public interface OpenUpService { * @date 2020/8/17 9:59 上午 */ List staffSinAgency(StaffSinAgencyFormDTO formDTO); + + /** + * @Description 对外接口-根据组织Id获取组织信息 + * @author sun + **/ + AgencyInfoResultDTO agencyInfo(AgencyInfoFormDTO formDTO); } diff --git a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/impl/OpenUpServiceImpl.java b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/impl/OpenUpServiceImpl.java index 38120535b9..2290c84f59 100644 --- a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/impl/OpenUpServiceImpl.java +++ b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/impl/OpenUpServiceImpl.java @@ -6,6 +6,7 @@ import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.utils.Result; import com.epmet.constant.ModuleConstant; import com.epmet.dto.form.*; +import com.epmet.dto.result.AgencyInfoResultDTO; import com.epmet.dto.result.StaffSinAgencyResultDTO; import com.epmet.dto.result.StaffSinDeptResultDTO; import com.epmet.dto.result.StaffSinGridResultDTO; @@ -123,4 +124,17 @@ public class OpenUpServiceImpl implements OpenUpService { return staffInfoList.getData(); } + /** + * @Description 对外接口-根据组织Id获取组织信息 + * @author sun + **/ + @Override + public AgencyInfoResultDTO agencyInfo(AgencyInfoFormDTO formDTO) { + Result result = govOrgOpenFeignClient.agencyInfo(formDTO); + if (!result.success()){ + throw new RenException(ModuleConstant.ERROR_AGENCY); + } + return result.getData(); + } + } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AgencyInfoFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AgencyInfoFormDTO.java new file mode 100644 index 0000000000..0288dd339e --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AgencyInfoFormDTO.java @@ -0,0 +1,21 @@ +package com.epmet.dto.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2020/8/17 10:37 上午 + */ +@Data +public class AgencyInfoFormDTO implements Serializable { + + private static final long serialVersionUID = -1719033407335647411L; + @NotBlank(message = "组织Id不能为空" , groups = StaffIdGroup.class) + private String agencyId; + + public interface StaffIdGroup extends CustomerClientShowGroup {} +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyInfoResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyInfoResultDTO.java new file mode 100644 index 0000000000..7b753259e4 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyInfoResultDTO.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.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 组织信息 + * + * @author sun + */ +@Data +public class AgencyInfoResultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + /** + * 机关组织Id + */ + private String agencyId; + /** + * 机关组织名称 + */ + private String agencyName; + /** + * 所有上级名称,以-连接 + */ + private String allParentName; + /** + * 上级组织机构ID + */ + private String pid; + /** + * 所有上级组织机构ID(以英文:隔开) + */ + private String pids; + /** + * 机关级别(社区级:community,乡(镇、街道)级:street,区县级: district,市级: city省级:province) + */ + private String level; + /** + * 地区编码 + */ + private String areaCode; +} \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java index 2856183dd3..3fa6739d94 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java @@ -259,4 +259,13 @@ public interface GovOrgOpenFeignClient { */ @PostMapping("/gov/org/agency/subagencylist") Result subAgencyList(@RequestBody SubAgencyFormDTO formDTO); + + /** + * @param formDTO + * @return + * @Author sun + * @Description 根据组织Id获取组织信息 + */ + @PostMapping("/gov/org/customeragency/agencyinfo") + Result agencyInfo(@RequestBody AgencyInfoFormDTO formDTO); } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java index b132ebec6a..4e03cbdc2a 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java @@ -151,4 +151,9 @@ public class GovOrgOpenFeignClientFallback implements GovOrgOpenFeignClient { public Result subAgencyList(SubAgencyFormDTO formDTO) { return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "subAgencyList", formDTO); } + + @Override + public Result agencyInfo(AgencyInfoFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "agencyInfo", formDTO); + } } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java index c8b2350e16..a052f79c8f 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java @@ -242,4 +242,13 @@ public class CustomerAgencyController { public Result staffInAgencyList(@LoginUser TokenDto tokenDTO) { return new Result().ok(customerAgencyService.staffInAgencyList(tokenDTO.getUserId())); } + + /** + * @Description 对外接口-根据组织Id获取组织信息 + * @author sun + **/ + @PostMapping("agencyinfo") + Result agencyInfo(@RequestBody AgencyInfoFormDTO formDTO) { + return new Result().ok(customerAgencyService.agencyInfo(formDTO)); + } } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java index b7a556c5b0..8430acdf88 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java @@ -213,4 +213,10 @@ public interface CustomerAgencyService extends BaseService * @Description 工作端-查询当前人员所属组织及所有下级组织 **/ StaffInAgencyListResultDTO staffInAgencyList(String staffId); + + /** + * @Description 对外接口-根据组织Id获取组织信息 + * @author sun + **/ + AgencyInfoResultDTO agencyInfo(AgencyInfoFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java index db160cba61..65206f51a2 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java @@ -994,4 +994,20 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl Date: Tue, 3 Nov 2020 17:55:56 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E5=AF=B9=E5=A4=96=E6=8E=A5=E5=8F=A3-?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet-oss/epmet-oss-server/pom.xml | 4 ++ .../cloud/AbstractCloudStorageService.java | 7 +++ .../cloud/AliyunCloudStorageService.java | 54 +++++++++++++++++++ .../cloud/FastDFSCloudStorageService.java | 6 +++ .../epmet/cloud/LocalCloudStorageService.java | 5 ++ .../cloud/QcloudCloudStorageService.java | 5 ++ .../epmet/cloud/QiniuCloudStorageService.java | 5 ++ .../com/epmet/controller/OssController.java | 19 +++++++ .../java/com/epmet/service/OssService.java | 2 + .../epmet/service/impl/OssServiceImpl.java | 32 +++++++++++ 10 files changed, 139 insertions(+) diff --git a/epmet-module/epmet-oss/epmet-oss-server/pom.xml b/epmet-module/epmet-oss/epmet-oss-server/pom.xml index b73264233b..ffb777fe7c 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/pom.xml +++ b/epmet-module/epmet-oss/epmet-oss-server/pom.xml @@ -92,6 +92,10 @@ fastdfs-client ${fastdfs.version} + + org.springframework + spring-test + diff --git a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/AbstractCloudStorageService.java b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/AbstractCloudStorageService.java index 8eb6fb6eba..fd4002d57b 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/AbstractCloudStorageService.java +++ b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/AbstractCloudStorageService.java @@ -11,6 +11,7 @@ package com.epmet.cloud; import com.epmet.commons.tools.utils.DateUtils; import org.apache.commons.lang3.StringUtils; +import java.io.IOException; import java.io.InputStream; import java.util.Date; import java.util.UUID; @@ -75,4 +76,10 @@ public abstract class AbstractCloudStorageService { */ public abstract String uploadSuffix(InputStream inputStream, String suffix); + /** + * 文件下载 + * sun + */ + public abstract void down() throws IOException; + } diff --git a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/AliyunCloudStorageService.java b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/AliyunCloudStorageService.java index e3c3850bff..e55449ad0f 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/AliyunCloudStorageService.java +++ b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/AliyunCloudStorageService.java @@ -9,10 +9,13 @@ package com.epmet.cloud; import com.aliyun.oss.OSSClient; +import com.aliyun.oss.model.DownloadFileRequest; +import com.aliyun.oss.model.DownloadFileResult; import com.epmet.commons.tools.exception.RenException; import com.epmet.exception.ModuleErrorCode; import java.io.ByteArrayInputStream; +import java.io.IOException; import java.io.InputStream; /** @@ -54,4 +57,55 @@ public class AliyunCloudStorageService extends AbstractCloudStorageService { public String uploadSuffix(InputStream inputStream, String suffix) { return upload(inputStream, getPath(config.getAliyunPrefix(), suffix)); } + + @Override + public void down() throws IOException { + OSSClient client = new OSSClient(config.getAliyunEndPoint(), config.getAliyunAccessKeyId(), + config.getAliyunAccessKeySecret()); + try { + + /* + //方式一 + File file = new File("C:/Users/Administrator/Desktop/dd/df.jpg"); + client.getObject(new GetObjectRequest(config.getAliyunBucketName(), "epmet/test/20201103/198f3c11490a44eb964c5c8e9989a507.jpg"), file);*/ + + /* + //方式二 + OSSObject oo = client.getObject(config.getAliyunBucketName(), path); + InputStream is = oo.getObjectContent(); + OutputStream os = null; + File file = new File("C:/Users/Administrator/Desktop/dd/aa.jpg"); + try { + os = new FileOutputStream(file); + int len = 0; + byte[] buffer = new byte[8192]; + while ((len = is.read(buffer)) != -1) { + os.write(buffer, 0, len); + } + } finally { + os.close(); + is.close(); + }*/ + + //方式三 + DownloadFileRequest downloadFileRequest = new DownloadFileRequest(config.getAliyunBucketName(), "epmet/test/20201103/198f3c11490a44eb964c5c8e9989a507.jpg"); + downloadFileRequest.setDownloadFile("C:/Users/Administrator/Desktop/dd/4.jpg");// 本地下载文件名称 + downloadFileRequest.setPartSize(1 * 1024 * 1024);// 分片大小,取值范围为1B~5GB。 + downloadFileRequest.setTaskNum(10);//10个任务并发下载,默认值为1 + downloadFileRequest.setEnableCheckpoint(true);// 启动断点续传 + // 下载文件 + DownloadFileResult downloadRes = client.downloadFile(downloadFileRequest); + // 下载成功时,会返回文件元信息。 + downloadRes.getObjectMetadata(); + + // 关闭OSSClient。 + client.shutdown(); + } catch (Exception e){ + throw new RenException(ModuleErrorCode.OSS_UPLOAD_FILE_ERROR, e, ""); + } catch (Throwable throwable) { + throwable.printStackTrace(); + } + + } + } diff --git a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/FastDFSCloudStorageService.java b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/FastDFSCloudStorageService.java index eef3d53171..9661e5f054 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/FastDFSCloudStorageService.java +++ b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/FastDFSCloudStorageService.java @@ -15,6 +15,7 @@ import com.epmet.commons.tools.utils.SpringContextUtils; import com.epmet.exception.ModuleErrorCode; import java.io.ByteArrayInputStream; +import java.io.IOException; import java.io.InputStream; /** @@ -59,4 +60,9 @@ public class FastDFSCloudStorageService extends AbstractCloudStorageService { public String uploadSuffix(InputStream inputStream, String suffix) { return upload(inputStream, suffix); } + + @Override + public void down() throws IOException { + + } } diff --git a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/LocalCloudStorageService.java b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/LocalCloudStorageService.java index 211736c173..71c17580c5 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/LocalCloudStorageService.java +++ b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/LocalCloudStorageService.java @@ -53,4 +53,9 @@ public class LocalCloudStorageService extends AbstractCloudStorageService { public String uploadSuffix(InputStream inputStream, String suffix) { return upload(inputStream, getPath(config.getLocalPrefix(), suffix)); } + + @Override + public void down() throws IOException { + + } } diff --git a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/QcloudCloudStorageService.java b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/QcloudCloudStorageService.java index 03376f75eb..22d7da2219 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/QcloudCloudStorageService.java +++ b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/QcloudCloudStorageService.java @@ -83,4 +83,9 @@ public class QcloudCloudStorageService extends AbstractCloudStorageService { public String uploadSuffix(InputStream inputStream, String suffix) { return upload(inputStream, getPath(config.getQcloudPrefix(), suffix)); } + + @Override + public void down() throws IOException { + + } } diff --git a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/QiniuCloudStorageService.java b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/QiniuCloudStorageService.java index 3c51425619..0fa9ee9f7e 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/QiniuCloudStorageService.java +++ b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/QiniuCloudStorageService.java @@ -77,4 +77,9 @@ public class QiniuCloudStorageService extends AbstractCloudStorageService { public String uploadSuffix(InputStream inputStream, String suffix) { return upload(inputStream, getPath(config.getQiniuPrefix(), suffix)); } + + @Override + public void down() throws IOException { + + } } diff --git a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/OssController.java b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/OssController.java index 5b3e3bee6b..65cf6b2d2d 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/OssController.java +++ b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/OssController.java @@ -31,12 +31,17 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.apache.commons.io.FilenameUtils; +import org.apache.http.entity.ContentType; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.MediaType; +import org.springframework.mock.web.MockMultipartFile; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import springfox.documentation.annotations.ApiIgnore; +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; import java.util.Arrays; import java.util.Map; @@ -218,4 +223,18 @@ public class OssController { return ossService.uploadImg(file); } + /** + * @param byteFile fileName + * @Description 外挂-文件上传 + * @Author sun + **/ + @PostMapping("ext/upload") + public Result extUpload(@RequestParam("byteFile") byte[] byteFile, @RequestParam("fileName") String fileName) throws IOException { + //public Result extUpload(@RequestParam("file") MultipartFile file, @RequestParam("fileName") String fileName) throws IOException { + //byte[] byteFile = file.getBytes(); + InputStream inputStream = new ByteArrayInputStream(byteFile); + MultipartFile filse = new MockMultipartFile(ContentType.APPLICATION_OCTET_STREAM.toString(), inputStream); + return ossService.extUpload(filse,fileName); + } + } diff --git a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/OssService.java b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/OssService.java index 2195e4f0f1..c67fec06f2 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/OssService.java +++ b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/OssService.java @@ -29,4 +29,6 @@ public interface OssService extends BaseService { int insertOssEntity(OssEntity ossEntity); Result uploadImg(MultipartFile file); + + Result extUpload(MultipartFile file, String fileName); } diff --git a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/impl/OssServiceImpl.java b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/impl/OssServiceImpl.java index 6ca5626490..cc44456c7e 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/impl/OssServiceImpl.java +++ b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/impl/OssServiceImpl.java @@ -72,4 +72,36 @@ public class OssServiceImpl extends BaseServiceImpl implement dto.setUrl(url); return new Result().ok(dto); } + + @Override + public Result extUpload(MultipartFile file, String fileName) { + try { + OssFactory.build().down(); + } catch (IOException e) { + e.printStackTrace(); + } + + if (file.isEmpty()) { + return new Result().error(ModuleErrorCode.UPLOAD_FILE_EMPTY); + } + //上传文件 + String extension = FilenameUtils.getExtension(fileName); + String url = null; + try { + url = OssFactory.build().uploadSuffix(file.getBytes(), extension); + } catch (IOException e) { + e.printStackTrace(); + logger.error("图片上传异常"); + throw new RenException("图片上传异常"); + + } + //保存文件信息 + OssEntity ossEntity = new OssEntity(); + ossEntity.setUrl(url); + baseDao.insert(ossEntity); + //文件信息 + UploadImgResultDTO dto = new UploadImgResultDTO(); + dto.setUrl(url); + return new Result().ok(dto); + } } From 16c6c23caa0a5b6bc99986e8a87218186309ef2c Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Wed, 4 Nov 2020 17:55:22 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E5=A4=96=E6=8C=82=E6=8E=A5=E5=8F=A3-?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E7=BB=84=E7=BB=87=E9=83=A8=E9=97=A8=E7=BD=91?= =?UTF-8?q?=E6=A0=BC=E6=A0=91=E3=80=81=E6=9F=A5=E8=AF=A2=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E6=88=96=E7=BD=91=E6=A0=BC=E5=AF=B9=E5=BA=94=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/controller/OpenUpController.java | 10 +++ .../java/com/epmet/service/OpenUpService.java | 16 ++-- .../epmet/service/impl/OpenUpServiceImpl.java | 18 ++++- .../com/epmet/dto/form/AgencyInfoFormDTO.java | 21 +++-- .../dto/result/OrganizeTreeDeptResultDTO.java | 31 +++++++ .../dto/result/OrganizeTreeGridResultDTO.java | 31 +++++++ .../dto/result/OrganizeTreeResultDTO.java | 50 ++++++++++++ .../epmet/feign/GovOrgOpenFeignClient.java | 9 ++- .../GovOrgOpenFeignClientFallback.java | 5 ++ .../controller/CustomerAgencyController.java | 9 +++ .../java/com/epmet/dao/CustomerAgencyDao.java | 21 +++++ .../epmet/service/CustomerAgencyService.java | 6 ++ .../impl/CustomerAgencyServiceImpl.java | 22 ++++- .../resources/mapper/CustomerAgencyDao.xml | 81 +++++++++++++++++++ .../epmet/dto/form/OrganizeTreeFormDTO.java | 21 +++++ 15 files changed, 332 insertions(+), 19 deletions(-) create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/OrganizeTreeDeptResultDTO.java create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/OrganizeTreeGridResultDTO.java create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/OrganizeTreeResultDTO.java create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/OrganizeTreeFormDTO.java diff --git a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenUpController.java b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenUpController.java index 9884efe1b2..eecf737391 100644 --- a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenUpController.java +++ b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenUpController.java @@ -112,5 +112,15 @@ public class OpenUpController { return new Result().ok(openUpService.agencyInfo(formDTO)); } + /** + * @Description 外挂-获取当前组织及部门、网格数据,递归查询所有下级数据 + * @author sun + **/ + @PostMapping("organizetree") + Result organizeTree(@RequestBody OrganizeTreeFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, OrganizeTreeFormDTO.StaffIdGroup.class); + return new Result().ok(openUpService.organizeTree(formDTO)); + } + } diff --git a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/OpenUpService.java b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/OpenUpService.java index d42e164f7e..ceecebc6c5 100644 --- a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/OpenUpService.java +++ b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/OpenUpService.java @@ -1,13 +1,7 @@ package com.epmet.service; -import com.epmet.dto.form.AgencyInfoFormDTO; -import com.epmet.dto.form.StaffSinAgencyFormDTO; -import com.epmet.dto.form.StaffSinDeptFormDTO; -import com.epmet.dto.form.StaffSinGridFormDTO; -import com.epmet.dto.result.AgencyInfoResultDTO; -import com.epmet.dto.result.StaffSinAgencyResultDTO; -import com.epmet.dto.result.StaffSinDeptResultDTO; -import com.epmet.dto.result.StaffSinGridResultDTO; +import com.epmet.dto.form.*; +import com.epmet.dto.result.*; import java.util.List; @@ -46,4 +40,10 @@ public interface OpenUpService { * @author sun **/ AgencyInfoResultDTO agencyInfo(AgencyInfoFormDTO formDTO); + + /** + * @Description 外挂-获取当前组织及部门、网格数据,递归查询所有下级数据 + * @author sun + **/ + OrganizeTreeResultDTO organizeTree(OrganizeTreeFormDTO formDTO); } diff --git a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/impl/OpenUpServiceImpl.java b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/impl/OpenUpServiceImpl.java index 2290c84f59..8c497a9c69 100644 --- a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/impl/OpenUpServiceImpl.java +++ b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/impl/OpenUpServiceImpl.java @@ -6,10 +6,7 @@ import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.utils.Result; import com.epmet.constant.ModuleConstant; import com.epmet.dto.form.*; -import com.epmet.dto.result.AgencyInfoResultDTO; -import com.epmet.dto.result.StaffSinAgencyResultDTO; -import com.epmet.dto.result.StaffSinDeptResultDTO; -import com.epmet.dto.result.StaffSinGridResultDTO; +import com.epmet.dto.result.*; import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.feign.GovOrgOpenFeignClient; import com.epmet.service.OpenUpService; @@ -137,4 +134,17 @@ public class OpenUpServiceImpl implements OpenUpService { return result.getData(); } + /** + * @Description 外挂-获取当前组织及部门、网格数据,递归查询所有下级数据 + * @author sun + **/ + @Override + public OrganizeTreeResultDTO organizeTree(OrganizeTreeFormDTO formDTO) { + Result result = govOrgOpenFeignClient.organizeTree(formDTO.getAgencyId()); + if (!result.success()){ + throw new RenException(ModuleConstant.ERROR_AGENCY); + } + return result.getData(); + } + } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AgencyInfoFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AgencyInfoFormDTO.java index 0288dd339e..2d751240cb 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AgencyInfoFormDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AgencyInfoFormDTO.java @@ -7,15 +7,26 @@ import javax.validation.constraints.NotBlank; import java.io.Serializable; /** - * @Author zxc - * @DateTime 2020/8/17 10:37 上午 + * 对外接口-根据组织Id获取组织信息-接口入参 + * @Author sun */ @Data public class AgencyInfoFormDTO implements Serializable { private static final long serialVersionUID = -1719033407335647411L; - @NotBlank(message = "组织Id不能为空" , groups = StaffIdGroup.class) - private String agencyId; - public interface StaffIdGroup extends CustomerClientShowGroup {} + /** + * 组织或网格Id + */ + @NotBlank(message = "组织或网格Id不能为空", groups = StaffIdGroup.class) + private String orgId; + /** + * 组织或网格类型(agency/grid) + */ + @NotBlank(message = "组织或网格类型不能为空", groups = StaffIdGroup.class) + private String orgType; + public interface StaffIdGroup extends CustomerClientShowGroup { + } + + } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/OrganizeTreeDeptResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/OrganizeTreeDeptResultDTO.java new file mode 100644 index 0000000000..8249d17991 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/OrganizeTreeDeptResultDTO.java @@ -0,0 +1,31 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description 外挂-部门信息 + * @Auth sun + */ +@Data +public class OrganizeTreeDeptResultDTO implements Serializable { + private static final long serialVersionUID = 1792371558965832432L; + + /** + * 部门Id + * */ + private String deptId; + /** + * 部门名称 + * */ + private String deptName; + /** + * 所有上级组织机构ID(以英文:隔开) + */ + private String pids; + /** + * 所有上级名称,以-连接 + */ + private String allParentName; +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/OrganizeTreeGridResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/OrganizeTreeGridResultDTO.java new file mode 100644 index 0000000000..4c855f6956 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/OrganizeTreeGridResultDTO.java @@ -0,0 +1,31 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description 外挂-网格信息 + * @Auth sun + */ +@Data +public class OrganizeTreeGridResultDTO implements Serializable { + private static final long serialVersionUID = -4531574240525562587L; + + /** + * 网格Id + * */ + private String gridId; + /** + * 网格名称 + * */ + private String gridName; + /** + * 所有上级组织机构ID(以英文:隔开) + */ + private String pids; + /** + * 所有上级名称,以-连接 + */ + private String allParentName; +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/OrganizeTreeResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/OrganizeTreeResultDTO.java new file mode 100644 index 0000000000..ee06600de6 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/OrganizeTreeResultDTO.java @@ -0,0 +1,50 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +/** + * @Description 外挂-获取当前组织及部门、网格数据,递归查询所有下级数据-接口返参 + * @Auth sun + */ +@Data +public class OrganizeTreeResultDTO implements Serializable { + private static final long serialVersionUID = 2513553862809278219L; + + /** + * 直属机关Id + * */ + private String agencyId; + /** + * 直属机关名称 + * */ + private String agencyName; + /** + * 机关级别(社区级:community, 乡(镇、街道)级:street, 区县级: district, 市级: city 省级:province) + * */ + private String level; + /** + * 所有上级组织机构ID(以英文:隔开) + */ + private String pids; + /** + * 所有上级名称,以-连接 + */ + private String allParentName; + + /** + * 直属机关直属网格列表 + * */ + private List gridList = new ArrayList<>(); + /** + * 直属机关直属部门列表 + * */ + private List departmentList = new ArrayList<>(); + /** + * 子集机关列表 + * */ + private List subAgencyList = new ArrayList<>(); +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java index 3fa6739d94..82c64c24eb 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java @@ -262,10 +262,17 @@ public interface GovOrgOpenFeignClient { /** * @param formDTO - * @return * @Author sun * @Description 根据组织Id获取组织信息 */ @PostMapping("/gov/org/customeragency/agencyinfo") Result agencyInfo(@RequestBody AgencyInfoFormDTO formDTO); + + /** + * @param agencyId + * @Author sun + * @Description 获取当前组织及部门、网格数据,递归查询所有下级数据 + */ + @PostMapping("/gov/org/customeragency/organizetree/{agencyId}") + Result organizeTree(@PathVariable("agencyId") String agencyId); } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java index 4e03cbdc2a..c3811eb323 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java @@ -156,4 +156,9 @@ public class GovOrgOpenFeignClientFallback implements GovOrgOpenFeignClient { public Result agencyInfo(AgencyInfoFormDTO formDTO) { return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "agencyInfo", formDTO); } + + @Override + public Result organizeTree(String agencyId) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "organizeTree", agencyId); + } } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java index a052f79c8f..80acd68b46 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java @@ -251,4 +251,13 @@ public class CustomerAgencyController { Result agencyInfo(@RequestBody AgencyInfoFormDTO formDTO) { return new Result().ok(customerAgencyService.agencyInfo(formDTO)); } + + /** + * @Description 外挂-获取当前组织及部门、网格数据,递归查询所有下级数据 + * @author sun + **/ + @PostMapping("organizetree/{agencyId}") + Result organizeTree(@PathVariable("agencyId") String agencyId) { + return new Result().ok(customerAgencyService.organizeTree(agencyId)); + } } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java index 8c404a53c2..1c6f42456c 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java @@ -175,4 +175,25 @@ public interface CustomerAgencyDao extends BaseDao { * @Description 查询工作人员所属组织信息 **/ AgencyResultDTO selectAgencyByStaffId(@Param("staffId") String staffId); + + /** + * @Description 外挂-获取当前组织及部门、网格数据,递归查询所有下级数据 + * @author sun + **/ + OrganizeTreeResultDTO selectorganizeTree(@Param("agencyId") String agencyId); + /** + * @Description 外挂-获取当前组织及部门、网格数据,递归查询所有下级数据 + * @author sun + **/ + List selectAgencyGridList(@Param("agencyId") String agencyId); + /** + * @Description 外挂-获取当前组织及部门、网格数据,递归查询所有下级数据 + * @author sun + **/ + List selectAgencyDeptList(@Param("agencyId") String agencyId); + /** + * @Description 外挂-获取当前组织及部门、网格数据,递归查询所有下级数据 + * @author sun + **/ + List selectAllSub(@Param("agencyId") String agencyId); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java index 8430acdf88..9297e8f5f1 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java @@ -219,4 +219,10 @@ public interface CustomerAgencyService extends BaseService * @author sun **/ AgencyInfoResultDTO agencyInfo(AgencyInfoFormDTO formDTO); + + /** + * @Description 外挂-获取当前组织及部门、网格数据,递归查询所有下级数据 + * @author sun + **/ + OrganizeTreeResultDTO organizeTree(String agencyId); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java index 65206f51a2..e02cb72ddc 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java @@ -1001,7 +1001,18 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/OrganizeTreeFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/OrganizeTreeFormDTO.java new file mode 100644 index 0000000000..5f7c6b4e4f --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/OrganizeTreeFormDTO.java @@ -0,0 +1,21 @@ +package com.epmet.dto.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Description 外挂-获取当前组织及部门、网格数据,递归查询所有下级数据-接口入参 + * @Auth sun + */ +@Data +public class OrganizeTreeFormDTO implements Serializable { + + private static final long serialVersionUID = -5093758817860808310L; + @NotBlank(message = "组织Id不能为空" , groups = StaffIdGroup.class) + private String agencyId; + + public interface StaffIdGroup extends CustomerClientShowGroup{} +} From 711da11747135d8616d3d621ba2f080af9406873 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Thu, 5 Nov 2020 09:30:11 +0800 Subject: [PATCH 5/7] =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/epmet/service/impl/OpenUpServiceImpl.java | 4 ++-- .../com/epmet/service/impl/CustomerAgencyServiceImpl.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/impl/OpenUpServiceImpl.java b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/impl/OpenUpServiceImpl.java index 8c497a9c69..170c3e32c4 100644 --- a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/impl/OpenUpServiceImpl.java +++ b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/impl/OpenUpServiceImpl.java @@ -129,7 +129,7 @@ public class OpenUpServiceImpl implements OpenUpService { public AgencyInfoResultDTO agencyInfo(AgencyInfoFormDTO formDTO) { Result result = govOrgOpenFeignClient.agencyInfo(formDTO); if (!result.success()){ - throw new RenException(ModuleConstant.ERROR_AGENCY); + throw new RenException(result.getInternalMsg()); } return result.getData(); } @@ -142,7 +142,7 @@ public class OpenUpServiceImpl implements OpenUpService { public OrganizeTreeResultDTO organizeTree(OrganizeTreeFormDTO formDTO) { Result result = govOrgOpenFeignClient.organizeTree(formDTO.getAgencyId()); if (!result.success()){ - throw new RenException(ModuleConstant.ERROR_AGENCY); + throw new RenException(result.getInternalMsg()); } return result.getData(); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java index e02cb72ddc..dd3360a781 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java @@ -1007,7 +1007,7 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl Date: Thu, 5 Nov 2020 09:50:45 +0800 Subject: [PATCH 6/7] =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/commons/tools/constant/AppClientConstant.java | 4 ++++ .../src/main/java/com/epmet/controller/OpenUpController.java | 3 +++ .../java/com/epmet/controller/WxmpMessageController.java | 5 +++++ 3 files changed, 12 insertions(+) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/AppClientConstant.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/AppClientConstant.java index 65673d8e19..2d12ab77ce 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/AppClientConstant.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/AppClientConstant.java @@ -50,4 +50,8 @@ public interface AppClientConstant { * 事务流水号,每次请求串起来的多个服务拥有相同的流水号,便于日志追踪 */ String TRANSACTION_SERIAL_KEY = "Transaction-Serial"; + /** + * app类型-工作端 + */ + String APP_WORK = "work"; } diff --git a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenUpController.java b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenUpController.java index eecf737391..162b493bd3 100644 --- a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenUpController.java +++ b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenUpController.java @@ -109,6 +109,9 @@ public class OpenUpController { @PostMapping("agencyinfo") Result agencyInfo(@RequestBody AgencyInfoFormDTO formDTO) { ValidatorUtils.validateEntity(formDTO, AgencyInfoFormDTO.StaffIdGroup.class); + if (!"agency".equals(formDTO.getOrgType()) && !"grid".equals(formDTO.getOrgType())) { + return new Result().error("参数错误,orgType值类型错误!"); + } return new Result().ok(openUpService.agencyInfo(formDTO)); } diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/WxmpMessageController.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/WxmpMessageController.java index 71776b7e47..6123933c34 100644 --- a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/WxmpMessageController.java +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/WxmpMessageController.java @@ -17,6 +17,7 @@ package com.epmet.controller; +import com.epmet.commons.tools.constant.AppClientConstant; import com.epmet.commons.tools.exception.ExceptionUtils; import com.epmet.commons.tools.security.user.LoginUserUtil; import com.epmet.commons.tools.utils.Result; @@ -33,6 +34,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import sun.awt.AppContext; import java.util.List; import java.util.concurrent.ExecutorService; @@ -152,6 +154,9 @@ public class WxmpMessageController { @PostMapping("wxmptemplatelist") public Result> wxmpTemplateList(@RequestBody WxmpTemplateListFormDTO formDTO) { ValidatorUtils.validateEntity(formDTO, WxmpTemplateListFormDTO.AddUserInternalGroup.class); + if (!AppClientConstant.APP_RESI.equals(formDTO.getClientType()) && !AppClientConstant.APP_WORK.equals(formDTO.getClientType())) { + return new Result>().error("参数错误,clientType值类型错误!"); + } return new Result>().ok(wxmpMessageService.wxmpTemplateList(formDTO)); } From a836c4fe8039f44f597657b292ed31411ab15b15 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Thu, 5 Nov 2020 10:06:00 +0800 Subject: [PATCH 7/7] =?UTF-8?q?=E6=96=B9=E6=B3=95=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/WxmpMessageController.java | 23 +++----------- .../controller/WxmpMessageExtController.java | 17 ++++++++++ .../epmet/service/WxmpMessageExtService.java | 10 ++++++ .../com/epmet/service/WxmpMessageService.java | 8 ----- .../impl/WxmpMessageExtServiceImpl.java | 31 +++++++++++++++---- .../service/impl/WxmpMessageServiceImpl.java | 21 +------------ 6 files changed, 57 insertions(+), 53 deletions(-) diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/WxmpMessageController.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/WxmpMessageController.java index 6123933c34..035bc45c2d 100644 --- a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/WxmpMessageController.java +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/WxmpMessageController.java @@ -17,7 +17,6 @@ package com.epmet.controller; -import com.epmet.commons.tools.constant.AppClientConstant; import com.epmet.commons.tools.exception.ExceptionUtils; import com.epmet.commons.tools.security.user.LoginUserUtil; import com.epmet.commons.tools.utils.Result; @@ -25,16 +24,16 @@ import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.form.GetTemplateListFormDTO; import com.epmet.dto.form.WxMsgAuthInfoFormDTO; import com.epmet.dto.form.WxSubscribeMessageFormDTO; -import com.epmet.dto.form.WxmpTemplateListFormDTO; import com.epmet.dto.result.GetTemplateListResultDTO; import com.epmet.dto.result.WxMsgAuthInfoResultDTO; -import com.epmet.dto.result.WxmpTemplateListResultDTO; import com.epmet.service.WxmpMessageService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; -import sun.awt.AppContext; +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; import java.util.concurrent.ExecutorService; @@ -146,18 +145,4 @@ public class WxmpMessageController { return new Result(); } - /** - * @return - * @Description (外挂)消息-获取订阅消息模板列表 - * @author sun - */ - @PostMapping("wxmptemplatelist") - public Result> wxmpTemplateList(@RequestBody WxmpTemplateListFormDTO formDTO) { - ValidatorUtils.validateEntity(formDTO, WxmpTemplateListFormDTO.AddUserInternalGroup.class); - if (!AppClientConstant.APP_RESI.equals(formDTO.getClientType()) && !AppClientConstant.APP_WORK.equals(formDTO.getClientType())) { - return new Result>().error("参数错误,clientType值类型错误!"); - } - return new Result>().ok(wxmpMessageService.wxmpTemplateList(formDTO)); - } - } \ No newline at end of file diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/WxmpMessageExtController.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/WxmpMessageExtController.java index 242dfe3cb9..330bda57bb 100644 --- a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/WxmpMessageExtController.java +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/WxmpMessageExtController.java @@ -1,9 +1,12 @@ package com.epmet.controller; +import com.epmet.commons.tools.constant.AppClientConstant; import com.epmet.commons.tools.exception.ExceptionUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.form.WxmpMessagePushFormDTO; +import com.epmet.dto.form.WxmpTemplateListFormDTO; +import com.epmet.dto.result.WxmpTemplateListResultDTO; import com.epmet.service.WxmpMessageExtService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -49,4 +52,18 @@ public class WxmpMessageExtController { }); return new Result(); } + + /** + * @return + * @Description (外挂)消息-获取订阅消息模板列表 + * @author sun + */ + @PostMapping("wxmptemplatelist") + public Result> wxmpTemplateList(@RequestBody WxmpTemplateListFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, WxmpTemplateListFormDTO.AddUserInternalGroup.class); + if (!AppClientConstant.APP_RESI.equals(formDTO.getClientType()) && !AppClientConstant.APP_WORK.equals(formDTO.getClientType())) { + return new Result>().error("参数错误,clientType值类型错误!"); + } + return new Result>().ok(wxmpMessageExtService.wxmpTemplateList(formDTO)); + } } diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/WxmpMessageExtService.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/WxmpMessageExtService.java index 03320ded2e..598c992667 100644 --- a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/WxmpMessageExtService.java +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/WxmpMessageExtService.java @@ -2,9 +2,19 @@ package com.epmet.service; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.form.WxmpMessagePushFormDTO; +import com.epmet.dto.form.WxmpTemplateListFormDTO; +import com.epmet.dto.result.WxmpTemplateListResultDTO; import java.util.List; public interface WxmpMessageExtService { + Result pushWxmpMessage(List dto); + + /** + * @return + * @Description 消息-获取订阅消息模板列表 + * @author sun + */ + List wxmpTemplateList(WxmpTemplateListFormDTO formDTO); } diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/WxmpMessageService.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/WxmpMessageService.java index 6b07c35670..e24e572ee2 100644 --- a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/WxmpMessageService.java +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/WxmpMessageService.java @@ -19,10 +19,8 @@ package com.epmet.service; import com.epmet.dto.form.GetTemplateListFormDTO; import com.epmet.dto.form.WxSubscribeMessageFormDTO; -import com.epmet.dto.form.WxmpTemplateListFormDTO; import com.epmet.dto.result.GetTemplateListResultDTO; import com.epmet.dto.result.WxMsgAuthInfoResultDTO; -import com.epmet.dto.result.WxmpTemplateListResultDTO; import java.util.List; @@ -57,10 +55,4 @@ public interface WxmpMessageService { */ List templateList(GetTemplateListFormDTO formDTO); - /** - * @return - * @Description 消息-获取订阅消息模板列表 - * @author sun - */ - List wxmpTemplateList(WxmpTemplateListFormDTO formDTO); } diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpMessageExtServiceImpl.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpMessageExtServiceImpl.java index 21204730c5..f9d1e17a67 100644 --- a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpMessageExtServiceImpl.java +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpMessageExtServiceImpl.java @@ -1,12 +1,11 @@ package com.epmet.service.impl; -import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.constant.ExtConstant; -import com.epmet.dto.form.UserMessageFormDTO; -import com.epmet.dto.form.WxSubscribeMessageFormDTO; -import com.epmet.dto.form.WxmpMessagePushFormDTO; -import com.epmet.feign.EpmetMessageOpenFeignClient; +import com.epmet.dto.form.*; +import com.epmet.dto.result.CustomerTemplateListResultDTO; +import com.epmet.dto.result.WxmpTemplateListResultDTO; import com.epmet.service.UserMessageService; import com.epmet.service.WxmpMessageExtService; import com.epmet.service.WxmpMessageService; @@ -27,9 +26,10 @@ import java.util.List; public class WxmpMessageExtServiceImpl implements WxmpMessageExtService { @Autowired private WxmpMessageService wxmpMessageService; - @Autowired private UserMessageService userMessageService; + @Autowired + private WxmpMessageServiceImpl wxmpMessageServiceImpl; @Override public Result pushWxmpMessage(List dtos) { @@ -61,4 +61,23 @@ public class WxmpMessageExtServiceImpl implements WxmpMessageExtService { wxmpMessageService.sendWxSubscribeMessage(wxmpMsgList); return userMessageService.saveUserMessageList(userMsgList); } + + /** + * @return + * @Description 消息-获取订阅消息模板列表 + * @author sun + */ + @Override + public List wxmpTemplateList(WxmpTemplateListFormDTO formDTO) { + List resultList = new ArrayList<>(); + CustomerTemplateListFormDTO dto = ConvertUtils.sourceToTarget(formDTO, CustomerTemplateListFormDTO.class); + List list = wxmpMessageServiceImpl.customerTemplateList(dto); + list.forEach(l->{ + if(formDTO.getClientType().equals(l.getClientType())){ + WxmpTemplateListResultDTO result = ConvertUtils.sourceToTarget(l, WxmpTemplateListResultDTO.class); + resultList.add(result); + } + }); + return resultList; + } } diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpMessageServiceImpl.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpMessageServiceImpl.java index 7d7d68af77..1a8a7c3fbc 100644 --- a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpMessageServiceImpl.java +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpMessageServiceImpl.java @@ -424,7 +424,7 @@ public class WxmpMessageServiceImpl implements WxmpMessageService { * @Description 查询客户两个端小程序对应的站内信模板Id * @author sun */ - private List customerTemplateList(CustomerTemplateListFormDTO formDTO) { + public List customerTemplateList(CustomerTemplateListFormDTO formDTO) { String url = "https://epmet-cloud.elinkservice.cn/api/third/personaltemplate/customertemplatelist"; String data = HttpClientManager.getInstance().sendPostByJSON(url, JSON.toJSONString(formDTO)).getData(); logger.info("ThirdLoginServiceImpl.customerTemplateList:httpclient->url:" + url + ",结果->" + data); @@ -619,23 +619,4 @@ public class WxmpMessageServiceImpl implements WxmpMessageService { return staffBasicInfo.getOpenId(); } - /** - * @return - * @Description 消息-获取订阅消息模板列表 - * @author sun - */ - @Override - public List wxmpTemplateList(WxmpTemplateListFormDTO formDTO) { - List resultList = new ArrayList<>(); - CustomerTemplateListFormDTO dto = ConvertUtils.sourceToTarget(formDTO, CustomerTemplateListFormDTO.class); - List list = customerTemplateList(dto); - list.forEach(l->{ - if(formDTO.getClientType().equals(l.getClientType())){ - WxmpTemplateListResultDTO result = ConvertUtils.sourceToTarget(l, WxmpTemplateListResultDTO.class); - resultList.add(result); - } - }); - return resultList; - } - }