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/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..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 @@ -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,28 @@ 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); + if (!"agency".equals(formDTO.getOrgType()) && !"grid".equals(formDTO.getOrgType())) { + return new Result().error("参数错误,orgType值类型错误!"); + } + 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 5ecbf7aedb..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,11 +1,7 @@ package com.epmet.service; -import com.epmet.dto.form.StaffSinAgencyFormDTO; -import com.epmet.dto.form.StaffSinDeptFormDTO; -import com.epmet.dto.form.StaffSinGridFormDTO; -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; @@ -38,4 +34,16 @@ public interface OpenUpService { * @date 2020/8/17 9:59 上午 */ List staffSinAgency(StaffSinAgencyFormDTO formDTO); + + /** + * @Description 对外接口-根据组织Id获取组织信息 + * @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 38120535b9..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 @@ -6,9 +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.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; @@ -123,4 +121,30 @@ 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(result.getInternalMsg()); + } + return result.getData(); + } + + /** + * @Description 外挂-获取当前组织及部门、网格数据,递归查询所有下级数据 + * @author sun + **/ + @Override + public OrganizeTreeResultDTO organizeTree(OrganizeTreeFormDTO formDTO) { + Result result = govOrgOpenFeignClient.organizeTree(formDTO.getAgencyId()); + if (!result.success()){ + throw new RenException(result.getInternalMsg()); + } + return result.getData(); + } + } 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/WxmpMessageController.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/WxmpMessageController.java index 71776b7e47..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 @@ -24,15 +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 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; @@ -144,15 +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); - 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 b6ffa1fc2f..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,15 @@ 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; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -11,6 +17,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 +27,43 @@ 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(); + } + + /** + * @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/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/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 368235246a..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,9 +1,12 @@ 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.dto.form.WxSubscribeMessageFormDTO; -import com.epmet.dto.form.WxmpMessagePushFormDTO; +import com.epmet.constant.ExtConstant; +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; import org.springframework.beans.BeanUtils; @@ -23,21 +26,58 @@ 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) { - 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); + } + + /** + * @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 3e834efdf1..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 @@ -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; } @@ -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; - } - } 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 '调用者'; diff --git a/epmet-module/epmet-oss/epmet-oss-server/pom.xml b/epmet-module/epmet-oss/epmet-oss-server/pom.xml index c930531360..053711dccd 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); + } } 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..2d751240cb --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AgencyInfoFormDTO.java @@ -0,0 +1,32 @@ +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; + +/** + * 对外接口-根据组织Id获取组织信息-接口入参 + * @Author sun + */ +@Data +public class AgencyInfoFormDTO implements Serializable { + + private static final long serialVersionUID = -1719033407335647411L; + + /** + * 组织或网格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/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/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 2856183dd3..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 @@ -259,4 +259,20 @@ public interface GovOrgOpenFeignClient { */ @PostMapping("/gov/org/agency/subagencylist") Result subAgencyList(@RequestBody SubAgencyFormDTO formDTO); + + /** + * @param formDTO + * @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 b132ebec6a..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 @@ -151,4 +151,14 @@ 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); + } + + @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 c8b2350e16..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 @@ -242,4 +242,22 @@ 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)); + } + + /** + * @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 b7a556c5b0..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 @@ -213,4 +213,16 @@ public interface CustomerAgencyService extends BaseService * @Description 工作端-查询当前人员所属组织及所有下级组织 **/ StaffInAgencyListResultDTO staffInAgencyList(String staffId); + + /** + * @Description 对外接口-根据组织Id获取组织信息 + * @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 db160cba61..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 @@ -994,4 +994,40 @@ 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{} +}