Browse Source

Merge branch 'dev_wx_msg' into dev_temp

dev_shibei_match
sunyuchao 5 years ago
parent
commit
c585a25285
  1. 4
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/AppClientConstant.java
  2. 2
      epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/constant/ModuleConstant.java
  3. 29
      epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenUpController.java
  4. 20
      epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/OpenUpService.java
  5. 30
      epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/impl/OpenUpServiceImpl.java
  6. 7
      epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/UserMessageDTO.java
  7. 5
      epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/UserMessageFormDTO.java
  8. 17
      epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/WxmpMessagePushFormDTO.java
  9. 11
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/constant/ExtConstant.java
  10. 18
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/WxmpMessageController.java
  11. 40
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/WxmpMessageExtController.java
  12. 5
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/UserMessageEntity.java
  13. 5
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/excel/UserMessageExcel.java
  14. 10
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/WxmpMessageExtService.java
  15. 8
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/WxmpMessageService.java
  16. 62
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpMessageExtServiceImpl.java
  17. 23
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpMessageServiceImpl.java
  18. 1
      epmet-module/epmet-message/epmet-message-server/src/main/resources/db/migration/V0.3.12.5__alter_user_message_add_column.sql
  19. 4
      epmet-module/epmet-oss/epmet-oss-server/pom.xml
  20. 7
      epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/AbstractCloudStorageService.java
  21. 54
      epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/AliyunCloudStorageService.java
  22. 6
      epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/FastDFSCloudStorageService.java
  23. 5
      epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/LocalCloudStorageService.java
  24. 5
      epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/QcloudCloudStorageService.java
  25. 5
      epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/QiniuCloudStorageService.java
  26. 19
      epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/OssController.java
  27. 2
      epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/OssService.java
  28. 32
      epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/impl/OssServiceImpl.java
  29. 32
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AgencyInfoFormDTO.java
  30. 66
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyInfoResultDTO.java
  31. 31
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/OrganizeTreeDeptResultDTO.java
  32. 31
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/OrganizeTreeGridResultDTO.java
  33. 50
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/OrganizeTreeResultDTO.java
  34. 16
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java
  35. 10
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java
  36. 18
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java
  37. 21
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java
  38. 12
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java
  39. 36
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java
  40. 81
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml
  41. 21
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/OrganizeTreeFormDTO.java

4
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";
}

2
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服务查询组织基本信息失败";
}

29
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<AgencyInfoResultDTO> agencyInfo(@RequestBody AgencyInfoFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, AgencyInfoFormDTO.StaffIdGroup.class);
if (!"agency".equals(formDTO.getOrgType()) && !"grid".equals(formDTO.getOrgType())) {
return new Result<AgencyInfoResultDTO>().error("参数错误,orgType值类型错误!");
}
return new Result<AgencyInfoResultDTO>().ok(openUpService.agencyInfo(formDTO));
}
/**
* @Description 外挂-获取当前组织及部门网格数据递归查询所有下级数据
* @author sun
**/
@PostMapping("organizetree")
Result<OrganizeTreeResultDTO> organizeTree(@RequestBody OrganizeTreeFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, OrganizeTreeFormDTO.StaffIdGroup.class);
return new Result<OrganizeTreeResultDTO>().ok(openUpService.organizeTree(formDTO));
}
}

20
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<StaffSinAgencyResultDTO> staffSinAgency(StaffSinAgencyFormDTO formDTO);
/**
* @Description 对外接口-根据组织Id获取组织信息
* @author sun
**/
AgencyInfoResultDTO agencyInfo(AgencyInfoFormDTO formDTO);
/**
* @Description 外挂-获取当前组织及部门网格数据递归查询所有下级数据
* @author sun
**/
OrganizeTreeResultDTO organizeTree(OrganizeTreeFormDTO formDTO);
}

30
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<AgencyInfoResultDTO> 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<OrganizeTreeResultDTO> result = govOrgOpenFeignClient.organizeTree(formDTO.getAgencyId());
if (!result.success()){
throw new RenException(result.getInternalMsg());
}
return result.getData();
}
}

7
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;
}
}

5
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;
}

17
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;
}

11
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";
}

18
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<List<WxmpTemplateListResultDTO>> wxmpTemplateList(@RequestBody WxmpTemplateListFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, WxmpTemplateListFormDTO.AddUserInternalGroup.class);
return new Result<List<WxmpTemplateListResultDTO>>().ok(wxmpMessageService.wxmpTemplateList(formDTO));
}
}

40
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<WxmpMessagePushFormDTO> 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<List<WxmpTemplateListResultDTO>> 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<List<WxmpTemplateListResultDTO>>().error("参数错误,clientType值类型错误!");
}
return new Result<List<WxmpTemplateListResultDTO>>().ok(wxmpMessageExtService.wxmpTemplateList(formDTO));
}
}

5
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;
}

5
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;
}
}

10
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<WxmpMessagePushFormDTO> dto);
/**
* @return
* @Description 消息-获取订阅消息模板列表
* @author sun
*/
List<WxmpTemplateListResultDTO> wxmpTemplateList(WxmpTemplateListFormDTO formDTO);
}

8
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<GetTemplateListResultDTO> templateList(GetTemplateListFormDTO formDTO);
/**
* @return
* @Description 消息-获取订阅消息模板列表
* @author sun
*/
List<WxmpTemplateListResultDTO> wxmpTemplateList(WxmpTemplateListFormDTO formDTO);
}

62
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<WxmpMessagePushFormDTO> dtos) {
List<WxSubscribeMessageFormDTO> msgList = new ArrayList<>();
List<WxSubscribeMessageFormDTO> wxmpMsgList = new ArrayList<>();
List<UserMessageFormDTO> 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<WxmpTemplateListResultDTO> wxmpTemplateList(WxmpTemplateListFormDTO formDTO) {
List<WxmpTemplateListResultDTO> resultList = new ArrayList<>();
CustomerTemplateListFormDTO dto = ConvertUtils.sourceToTarget(formDTO, CustomerTemplateListFormDTO.class);
List<CustomerTemplateListResultDTO> 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;
}
}

23
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<CustomerTemplateListResultDTO> customerTemplateList(CustomerTemplateListFormDTO formDTO) {
public List<CustomerTemplateListResultDTO> 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<WxmpTemplateListResultDTO> wxmpTemplateList(WxmpTemplateListFormDTO formDTO) {
List<WxmpTemplateListResultDTO> resultList = new ArrayList<>();
CustomerTemplateListFormDTO dto = ConvertUtils.sourceToTarget(formDTO, CustomerTemplateListFormDTO.class);
List<CustomerTemplateListResultDTO> list = customerTemplateList(dto);
list.forEach(l->{
if(formDTO.getClientType().equals(l.getClientType())){
WxmpTemplateListResultDTO result = ConvertUtils.sourceToTarget(l, WxmpTemplateListResultDTO.class);
resultList.add(result);
}
});
return resultList;
}
}

1
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 '调用者';

4
epmet-module/epmet-oss/epmet-oss-server/pom.xml

@ -92,6 +92,10 @@
<artifactId>fastdfs-client</artifactId>
<version>${fastdfs.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
</dependency>
</dependencies>
<build>

7
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;
}

54
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();
}
}
}

6
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 {
}
}

5
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 {
}
}

5
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 {
}
}

5
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 {
}
}

19
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<UploadImgResultDTO> extUpload(@RequestParam("byteFile") byte[] byteFile, @RequestParam("fileName") String fileName) throws IOException {
//public Result<UploadImgResultDTO> 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);
}
}

2
epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/OssService.java

@ -29,4 +29,6 @@ public interface OssService extends BaseService<OssEntity> {
int insertOssEntity(OssEntity ossEntity);
Result<UploadImgResultDTO> uploadImg(MultipartFile file);
Result<UploadImgResultDTO> extUpload(MultipartFile file, String fileName);
}

32
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<OssDao, OssEntity> implement
dto.setUrl(url);
return new Result<UploadImgResultDTO>().ok(dto);
}
@Override
public Result<UploadImgResultDTO> extUpload(MultipartFile file, String fileName) {
try {
OssFactory.build().down();
} catch (IOException e) {
e.printStackTrace();
}
if (file.isEmpty()) {
return new Result<UploadImgResultDTO>().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<UploadImgResultDTO>().ok(dto);
}
}

32
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 {
}
}

66
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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;
}

31
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;
}

31
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;
}

50
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<OrganizeTreeGridResultDTO> gridList = new ArrayList<>();
/**
* 直属机关直属部门列表
* */
private List<OrganizeTreeDeptResultDTO> departmentList = new ArrayList<>();
/**
* 子集机关列表
* */
private List<OrganizeTreeResultDTO> subAgencyList = new ArrayList<>();
}

16
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<SubAgencyResultDTO> subAgencyList(@RequestBody SubAgencyFormDTO formDTO);
/**
* @param formDTO
* @Author sun
* @Description 根据组织Id获取组织信息
*/
@PostMapping("/gov/org/customeragency/agencyinfo")
Result<AgencyInfoResultDTO> agencyInfo(@RequestBody AgencyInfoFormDTO formDTO);
/**
* @param agencyId
* @Author sun
* @Description 获取当前组织及部门网格数据递归查询所有下级数据
*/
@PostMapping("/gov/org/customeragency/organizetree/{agencyId}")
Result<OrganizeTreeResultDTO> organizeTree(@PathVariable("agencyId") String agencyId);
}

10
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<SubAgencyResultDTO> subAgencyList(SubAgencyFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "subAgencyList", formDTO);
}
@Override
public Result<AgencyInfoResultDTO> agencyInfo(AgencyInfoFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "agencyInfo", formDTO);
}
@Override
public Result<OrganizeTreeResultDTO> organizeTree(String agencyId) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "organizeTree", agencyId);
}
}

18
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java

@ -242,4 +242,22 @@ public class CustomerAgencyController {
public Result<StaffInAgencyListResultDTO> staffInAgencyList(@LoginUser TokenDto tokenDTO) {
return new Result<StaffInAgencyListResultDTO>().ok(customerAgencyService.staffInAgencyList(tokenDTO.getUserId()));
}
/**
* @Description 对外接口-根据组织Id获取组织信息
* @author sun
**/
@PostMapping("agencyinfo")
Result<AgencyInfoResultDTO> agencyInfo(@RequestBody AgencyInfoFormDTO formDTO) {
return new Result<AgencyInfoResultDTO>().ok(customerAgencyService.agencyInfo(formDTO));
}
/**
* @Description 外挂-获取当前组织及部门网格数据递归查询所有下级数据
* @author sun
**/
@PostMapping("organizetree/{agencyId}")
Result<OrganizeTreeResultDTO> organizeTree(@PathVariable("agencyId") String agencyId) {
return new Result<OrganizeTreeResultDTO>().ok(customerAgencyService.organizeTree(agencyId));
}
}

21
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java

@ -175,4 +175,25 @@ public interface CustomerAgencyDao extends BaseDao<CustomerAgencyEntity> {
* @Description 查询工作人员所属组织信息
**/
AgencyResultDTO selectAgencyByStaffId(@Param("staffId") String staffId);
/**
* @Description 外挂-获取当前组织及部门网格数据递归查询所有下级数据
* @author sun
**/
OrganizeTreeResultDTO selectorganizeTree(@Param("agencyId") String agencyId);
/**
* @Description 外挂-获取当前组织及部门网格数据递归查询所有下级数据
* @author sun
**/
List<OrganizeTreeGridResultDTO> selectAgencyGridList(@Param("agencyId") String agencyId);
/**
* @Description 外挂-获取当前组织及部门网格数据递归查询所有下级数据
* @author sun
**/
List<OrganizeTreeDeptResultDTO> selectAgencyDeptList(@Param("agencyId") String agencyId);
/**
* @Description 外挂-获取当前组织及部门网格数据递归查询所有下级数据
* @author sun
**/
List<OrganizeTreeResultDTO> selectAllSub(@Param("agencyId") String agencyId);
}

12
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java

@ -213,4 +213,16 @@ public interface CustomerAgencyService extends BaseService<CustomerAgencyEntity>
* @Description 工作端-查询当前人员所属组织及所有下级组织
**/
StaffInAgencyListResultDTO staffInAgencyList(String staffId);
/**
* @Description 对外接口-根据组织Id获取组织信息
* @author sun
**/
AgencyInfoResultDTO agencyInfo(AgencyInfoFormDTO formDTO);
/**
* @Description 外挂-获取当前组织及部门网格数据递归查询所有下级数据
* @author sun
**/
OrganizeTreeResultDTO organizeTree(String agencyId);
}

36
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<CustomerAgencyDao
return resultDTO;
}
/**
* @Description 对外接口-根据组织Id获取组织信息
* @author sun
**/
@Override
public AgencyInfoResultDTO agencyInfo(AgencyInfoFormDTO formDTO) {
AgencyInfoResultDTO resultDTO = new AgencyInfoResultDTO();
String agencyId = formDTO.getOrgId();
//1.判断是否为网格类型,是网格则查询网格基本信息
if("grid".equals(formDTO.getOrgType())){
CustomerGridEntity gridEntity = customerGridDao.selectById(formDTO.getOrgId());
if(null == gridEntity){
logger.error(String.format("根据网格Id未查询到网格数据,网格Id:%s", formDTO.getOrgId()));
throw new RenException("获取网格数据失败,根据网格Id未查询到网格数据");
}
agencyId = gridEntity.getPid();
}
//2.查询组织基本信息
CustomerAgencyEntity entity = baseDao.selectById(agencyId);
if(entity!=null){
resultDTO = ConvertUtils.sourceToTarget(entity, AgencyInfoResultDTO.class);
resultDTO.setAgencyId(entity.getId());
resultDTO.setAgencyName(entity.getOrganizationName());
}
return resultDTO;
}
/**
* @Description 外挂-获取当前组织及部门网格数据递归查询所有下级数据
* @author sun
**/
@Override
public OrganizeTreeResultDTO organizeTree(String agencyId) {
return baseDao.selectorganizeTree(agencyId);
}
}

81
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml

@ -292,4 +292,85 @@
AND csa.user_id = #{staffId}
</select>
<!-- sql递归 查询组织、组织下部门、组织下网格基本信息及递归查询下级信息 start-->
<resultMap id="organizeTree" type="com.epmet.dto.result.OrganizeTreeResultDTO">
<id column="agencyId" property="agencyId"/>
<result column="agencyName" property="agencyName"/>
<result column="level" property="level"/>
<result column="pids" property="pids"/>
<result column="allParentName" property="allParentName"/>
<collection property="gridList" column="agencyId" ofType="com.epmet.dto.result.OrganizeTreeGridResultDTO" select="selectAgencyGridList">
<id column="gridId" property="gridId"/>
<result column="gridName" property="gridName"/>
<result column="pids" property="pids"/>
<result column="allParentName" property="allParentName"/>
</collection>
<collection property="departmentList" column="agencyId" ofType="com.epmet.dto.result.OrganizeTreeDeptResultDTO" select="selectAgencyDeptList">
<id column="deptId" property="deptId"/>
<result column="deptName" property="deptName"/>
<result column="pids" property="pids"/>
<result column="allParentName" property="allParentName"/>
</collection>
<collection property="subAgencyList" column="agencyId" ofType="com.epmet.dto.result.ExtStaffPermissionResultDTO" select="selectAllSub">
</collection>
</resultMap>
<select id="selectorganizeTree" resultMap="organizeTree">
SELECT
ca.id AS agencyId,
ca.organization_name AS agencyName,
ca.level AS level,
ca.pids AS pids,
ca.all_parent_name AS allParentName
FROM
customer_agency ca
WHERE
ca.del_flag = '0'
AND ca.id = #{agencyId}
</select>
<select id="selectAgencyGridList" resultType="com.epmet.dto.result.OrganizeTreeGridResultDTO">
SELECT
cg.id AS gridId,
cg.grid_name AS gridName,
CONCAT(ca.pids,if(ca.pids="","",":"),ca.id) AS pids,
CONCAT(ca.all_parent_name,if(ca.all_parent_name="","","-"),ca.organization_name) AS allParentName
FROM
customer_grid cg
LEFT JOIN customer_agency ca ON cg.pid = ca.id
WHERE
cg.del_flag = '0'
AND ca.del_flag = '0'
AND cg.pid = #{agencyId}
</select>
<select id="selectAgencyDeptList" resultType="com.epmet.dto.result.OrganizeTreeDeptResultDTO">
SELECT
cd.id AS deptId,
cd.department_name AS deptName,
CONCAT(ca.pids,if(ca.pids="","",":"),ca.id) AS pids,
CONCAT(ca.all_parent_name,if(ca.all_parent_name="","","-"),ca.organization_name) AS allParentName
FROM
customer_department cd
LEFT JOIN customer_agency ca ON cd.agency_id = ca.id
WHERE
cd.del_flag = '0'
AND ca.del_flag = '0'
AND cd.agency_id = #{agencyId}
</select>
<select id="selectAllSub" resultMap="organizeTree">
SELECT
ca.id AS agencyId,
ca.organization_name AS agencyName,
ca.level AS level,
ca.pids AS pids,
ca.all_parent_name AS allParentName
FROM
customer_agency ca
WHERE
ca.del_flag = '0'
AND ca.pid = #{agencyId}
</select>
<!-- sql递归 查询组织、组织下部门、组织下网格基本信息及递归查询下级信息 end-->
</mapper>

21
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{}
}
Loading…
Cancel
Save