Browse Source

办事指南增删改查

master
zhaoqifeng 4 years ago
parent
commit
5716a47e0a
  1. 3
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java
  2. 17
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/OrgFormDTO.java
  3. 10
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java
  4. 13
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java
  5. 12
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java
  6. 9
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java
  7. 14
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java
  8. 22
      epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/AttachmentDTO.java
  9. 56
      epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/ExternalLinkDTO.java
  10. 17
      epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/GuideDTO.java
  11. 5
      epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/GuideExternalLinkDTO.java
  12. 58
      epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/ModuleDTO.java
  13. 61
      epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/GuideAddFormDTO.java
  14. 70
      epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/GuideEditFormDTO.java
  15. 39
      epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/GuideFormDTO.java
  16. 31
      epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/GuideListFormDTO.java
  17. 17
      epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/GetCategoryResultDTO.java
  18. 67
      epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/GuideDetailResultDTO.java
  19. 35
      epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/GuideListResultDTO.java
  20. 102
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/GuideController.java
  21. 30
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/GuideDao.java
  22. 12
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/GuideModuleDao.java
  23. 23
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/GuideEntity.java
  24. 8
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/GuideExternalLinkEntity.java
  25. 19
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/GuideAttachmentService.java
  26. 19
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/GuideExternalLinkService.java
  27. 20
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/GuideModuleService.java
  28. 60
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/GuideService.java
  29. 49
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/GuideAttachmentServiceImpl.java
  30. 45
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/GuideExternalLinkServiceImpl.java
  31. 32
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/GuideModuleServiceImpl.java
  32. 282
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/GuideServiceImpl.java
  33. 42
      epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/GuideDao.xml
  34. 13
      epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/GuideModuleDao.xml

3
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java

@ -155,7 +155,8 @@ public enum EpmetErrorCode {
EXISTED_SPECIAL_PROJECT(8807, "已经添加过此专题"),
CAN_NOT_DEL_SPECIAL_PROJECT(8808, "您没有权限删除此专题"),
TAG_NOT_EXIST(8809,"标签不存在"),
GUIDE_IS_NULL(8810,"指南内容不能为空"),
GUIDE_IS_NOT_YOURS(8811,"只能删除自己创建的指南"),
//公众号 865..开头的码
PUBLIC_NOT_EXISTS(8651,"手机号未注册,请先完成信息注册"),
SELECT_CUSTOMER_ERROR(8652,"未查询到注册客户信息"),

17
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/OrgFormDTO.java

@ -0,0 +1,17 @@
package com.epmet.dto.form;
import lombok.Data;
import java.io.Serializable;
/**
* @Description
* @Author zhaoqifeng
* @Date 2021/9/7 15:41
*/
@Data
public class OrgFormDTO implements Serializable {
private static final long serialVersionUID = -5975063766883885089L;
private String orgId;
private String orgType;
}

10
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java

@ -417,4 +417,14 @@ public interface GovOrgOpenFeignClient {
*/
@PostMapping("/gov/org/customerstaffagency/queryOrgStaffs")
Result<Set<String>> queryOrgStaffs(@RequestBody OrgStaffFormDTO formDTO);
/**
* @Description 根据组织或网格或吧部门获取组织信息
* @Param formDTO
* @Return {@link Result<OrgResultDTO>}
* @Author zhaoqifeng
* @Date 2021/9/7 15:27
*/
@PostMapping("/gov/org/customeragency/getAgencyInfo")
Result<OrgResultDTO> getAgencyInfo(@RequestBody OrgFormDTO formDTO);
}

13
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java

@ -248,6 +248,19 @@ public class GovOrgOpenFeignClientFallback implements GovOrgOpenFeignClient {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "queryOrgStaffs", formDTO);
}
/**
* @param formDTO
* @Description 根据组织或网格或吧部门获取组织信息
* @Param formDTO
* @Return {@link Result<OrgResultDTO>}
* @Author zhaoqifeng
* @Date 2021/9/7 15:27
*/
@Override
public Result<OrgResultDTO> getAgencyInfo(OrgFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getAgencyInfo", formDTO);
}
@Override
public Result<String> selectPidsByGridId(String gridId) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "selectPidsByGridId", gridId);

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

@ -312,4 +312,16 @@ public class CustomerAgencyController {
return new Result<ExtStaffPermissionResultDTO>().ok(customerAgencyService.staffPermissionExt(tokenDto.getUserId()));
}
/**
* @Description 根据组织或网格或吧部门获取组织信息
* @Param formDTO
* @Return {@link Result<OrgResultDTO>}
* @Author zhaoqifeng
* @Date 2021/9/7 15:27
*/
@PostMapping("getAgencyInfo")
public Result<OrgResultDTO> getAgencyInfo(@RequestBody OrgFormDTO formDTO) {
return new Result<OrgResultDTO>().ok(customerAgencyService.getAgencyInfo(formDTO));
}
}

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

@ -236,4 +236,13 @@ public interface CustomerAgencyService extends BaseService<CustomerAgencyEntity>
OrganizeTreeResultDTO organizeTree(String agencyId);
void checkAgencyName(String agencyName,String customerId,String agencyId,String parentAgencyId);
/**
* 根据组织或网格或吧部门获取组织信息
* @Param formDTO
* @Return {@link OrgResultDTO}
* @Author zhaoqifeng
* @Date 2021/9/7 15:28
*/
OrgResultDTO getAgencyInfo(OrgFormDTO formDTO);
}

14
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java

@ -1075,4 +1075,18 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl<CustomerAgencyDao
}
}
/**
* 根据组织或网格或吧部门获取组织信息
*
* @param formDTO
* @Param formDTO
* @Return {@link OrgResultDTO}
* @Author zhaoqifeng
* @Date 2021/9/7 15:28
*/
@Override
public OrgResultDTO getAgencyInfo(OrgFormDTO formDTO) {
return baseDao.selectAgencyDetail(formDTO.getOrgId(), formDTO.getOrgType());
}
}

22
epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/AttachmentDTO.java

@ -0,0 +1,22 @@
package com.epmet.dto;
import lombok.Data;
import java.io.Serializable;
/**
* @Description
* @Author zhaoqifeng
* @Date 2021/9/7 16:21
*/
@Data
public class AttachmentDTO implements Serializable {
private static final long serialVersionUID = 6505979559566901869L;
private String name;
private String format;
private String type;
private String url;
private Integer size;
private Integer duration;
}

56
epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/ExternalLinkDTO.java

@ -0,0 +1,56 @@
/**
* 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;
import lombok.Data;
import java.io.Serializable;
/**
* 指南外链表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-09-06
*/
@Data
public class ExternalLinkDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String id;
/**
* 链接说明
*/
private String description;
/**
* 外部链接
*/
private String externalLink;
/**
* 外部链接
*/
private Integer sort;
}

17
epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/GuideDTO.java

@ -17,9 +17,10 @@
package com.epmet.dto;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
@ -43,10 +44,20 @@ public class GuideDTO implements Serializable {
*/
private String customerId;
/**
* 发布单位类型 机关agency 网格grid 部门dept
*/
private String orgType;
/**
* 发布单位ID
*/
private String agencyId;
private String orgId;
/**
* 发布单位名称
*/
private String orgName;
/**
* 所属组织机构IDcustomer_agency.id
@ -66,7 +77,7 @@ public class GuideDTO implements Serializable {
/**
* 分类ID
*/
private String categoryId;
private String categoryCode;
/**
* 删除标识:0.未删除 1.已删除

5
epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/GuideExternalLinkDTO.java

@ -58,6 +58,11 @@ public class GuideExternalLinkDTO implements Serializable {
*/
private String externalLink;
/**
* 排序
*/
private Integer sort;
/**
* 删除标识 0未删除1已删除
*/

58
epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/ModuleDTO.java

@ -0,0 +1,58 @@
/**
* 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;
import lombok.Data;
import java.io.Serializable;
/**
* 指南模块字典表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-09-06
*/
@Data
public class ModuleDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String guideModuleId;
/**
* 主键
*/
private String moduleId;
/**
* 模块key
*/
private String moduleValue;
/**
* 模块名
*/
private String moduleName;
/**
* 模块内容
*/
private String moduleContent;
}

61
epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/GuideAddFormDTO.java

@ -0,0 +1,61 @@
package com.epmet.dto.form;
import com.epmet.dto.AttachmentDTO;
import com.epmet.dto.ExternalLinkDTO;
import com.epmet.dto.ModuleDTO;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.List;
/**
* @Description
* @Author zhaoqifeng
* @Date 2021/9/7 10:24
*/
@NoArgsConstructor
@Data
public class GuideAddFormDTO implements Serializable {
private static final long serialVersionUID = -7750999102010191460L;
/**
* 标题
*/
@NotBlank(message = "标题不能为空")
private String title;
/**
* 标题
*/
@NotBlank(message = "分类不能为空")
private String categoryCode;
/**
* 机关类型 机关agency 网格grid 部门dept
*/
@NotBlank(message = "所属机关类型不能为空")
private String orgType;
/**
* 所属机关
*/
@NotBlank(message = "所属机关ID不能为空")
private String orgId;
/**
* 所属机关
*/
@NotBlank(message = "所属机关名不能为空")
private String orgName;
/**
* 外部链接
*/
private List<ExternalLinkDTO> externalLinks;
/**
* 内容模块
*/
private List<ModuleDTO> moduleList;
/**
* 附件
*/
private List<AttachmentDTO> attachmentList;
}

70
epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/GuideEditFormDTO.java

@ -0,0 +1,70 @@
package com.epmet.dto.form;
import com.epmet.dto.AttachmentDTO;
import com.epmet.dto.ExternalLinkDTO;
import com.epmet.dto.ModuleDTO;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.List;
/**
* @Description
* @Author zhaoqifeng
* @Date 2021/9/7 10:24
*/
@NoArgsConstructor
@Data
public class GuideEditFormDTO implements Serializable {
private static final long serialVersionUID = -7750999102010191460L;
/**
* 工作人员ID
*/
private String staffId;
/**
* 指南ID
*/
@NotBlank(message = "指南id不能为空")
private String guideId;
/**
* 标题
*/
@NotBlank(message = "标题不能为空")
private String title;
/**
* 标题
*/
@NotBlank(message = "分类不能为空")
private String categoryCode;
/**
* 机关类型 机关agency 网格grid 部门dept
*/
@NotBlank(message = "所属机关类型不能为空")
private String orgType;
/**
* 所属机关
*/
@NotBlank(message = "所属机关ID不能为空")
private String orgId;
/**
* 所属机关
*/
@NotBlank(message = "所属机关名不能为空")
private String orgName;
/**
* 外部链接
*/
private List<ExternalLinkDTO> externalLinks;
/**
* 内容模块
*/
private List<ModuleDTO> moduleList;
/**
* 附件
*/
private List<AttachmentDTO> attachmentList;
}

39
epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/GuideFormDTO.java

@ -0,0 +1,39 @@
package com.epmet.dto.form;
import com.epmet.dto.ExternalLinkDTO;
import com.epmet.dto.GuideAttachmentDTO;
import com.epmet.dto.ModuleDTO;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.List;
/**
* @Description
* @Author zhaoqifeng
* @Date 2021/9/7 10:24
*/
@NoArgsConstructor
@Data
public class GuideFormDTO implements Serializable {
private static final long serialVersionUID = -7750999102010191460L;
/**
* 标题
*/
@NotBlank(message = "指南id不能为空")
private String guideId;
/**
* 工作人员
*/
private String staffId;
/**
* 客户ID
*/
private String customerId;
}

31
epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/GuideListFormDTO.java

@ -0,0 +1,31 @@
package com.epmet.dto.form;
import com.epmet.commons.tools.dto.form.PageFormDTO;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @Description
* @Author zhaoqifeng
* @Date 2021/9/7 9:38
*/
@NoArgsConstructor
@Data
public class GuideListFormDTO extends PageFormDTO implements Serializable {
private static final long serialVersionUID = -4471422632936288213L;
/**
* 组织ID
*/
private String agencyId;
/**
* 分类
*/
private String categoryId;
/**
* 标题
*/
private String guideTitle;
}

17
epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/GetCategoryResultDTO.java

@ -0,0 +1,17 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Description
* @Author zhaoqifeng
* @Date 2021/9/7 10:52
*/
@Data
public class GetCategoryResultDTO implements Serializable {
private static final long serialVersionUID = 3527239091132653541L;
private String categoryId;
private String categoryName;
}

67
epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/GuideDetailResultDTO.java

@ -0,0 +1,67 @@
package com.epmet.dto.result;
import com.epmet.dto.AttachmentDTO;
import com.epmet.dto.ExternalLinkDTO;
import com.epmet.dto.ModuleDTO;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.List;
/**
* @Description
* @Author zhaoqifeng
* @Date 2021/9/7 10:24
*/
@NoArgsConstructor
@Data
public class GuideDetailResultDTO implements Serializable {
private static final long serialVersionUID = -7750999102010191460L;
/**
* 标题
*/
private String guideId;
/**
* 标题
*/
private String title;
/**
* 分类ID
*/
private String categoryId;
/**
* 分类名
*/
private String categoryName;
/**
* 机关类型 机关agency 网格grid 部门dept
*/
private String orgType;
/**
* 所属机关
*/
private String orgId;
/**
* 所属机关名
*/
private String orgName;
/**
* 是否收藏 1是 0否
*/
private String collectionFlag;
/**
* 外部链接
*/
private List<ExternalLinkDTO> externalLinks;
/**
* 内容模块
*/
private List<ModuleDTO> moduleList;
/**
* 附件
*/
private List<AttachmentDTO> attachmentList;
}

35
epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/GuideListResultDTO.java

@ -0,0 +1,35 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* @author Administrator
*/
@Data
public class GuideListResultDTO implements Serializable {
private static final long serialVersionUID = -1360741408368601140L;
private String guideId;
/**
* 标题
*/
private String title;
/**
* 分类
*/
private String categoryName;
/**
* 创建人ID
*/
private String createdId;
/**
* 创建人姓名
*/
private String createdName;
/**
* 更新时间
*/
private Date updatedTime;
}

102
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/GuideController.java

@ -17,7 +17,10 @@
package com.epmet.controller;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.dto.form.PageFormDTO;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
import com.epmet.commons.tools.validator.ValidatorUtils;
@ -25,6 +28,12 @@ import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.dto.GuideDTO;
import com.epmet.dto.form.GuideAddFormDTO;
import com.epmet.dto.form.GuideEditFormDTO;
import com.epmet.dto.form.GuideFormDTO;
import com.epmet.dto.form.GuideListFormDTO;
import com.epmet.dto.result.GuideDetailResultDTO;
import com.epmet.dto.result.GuideListResultDTO;
import com.epmet.service.GuideService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -33,7 +42,7 @@ import java.util.Map;
/**
* 办事指南表
* 办事指南表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-09-06
@ -41,24 +50,24 @@ import java.util.Map;
@RestController
@RequestMapping("guide")
public class GuideController {
@Autowired
private GuideService guideService;
@GetMapping("page")
public Result<PageData<GuideDTO>> page(@RequestParam Map<String, Object> params){
public Result<PageData<GuideDTO>> page(@RequestParam Map<String, Object> params) {
PageData<GuideDTO> page = guideService.page(params);
return new Result<PageData<GuideDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<GuideDTO> get(@PathVariable("id") String id){
public Result<GuideDTO> get(@PathVariable("id") String id) {
GuideDTO data = guideService.get(id);
return new Result<GuideDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody GuideDTO dto){
public Result save(@RequestBody GuideDTO dto) {
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
guideService.save(dto);
@ -66,7 +75,7 @@ public class GuideController {
}
@PutMapping
public Result update(@RequestBody GuideDTO dto){
public Result update(@RequestBody GuideDTO dto) {
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
guideService.update(dto);
@ -74,11 +83,90 @@ public class GuideController {
}
@DeleteMapping
public Result delete(@RequestBody String[] ids){
public Result delete(@RequestBody String[] ids) {
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
guideService.delete(ids);
return new Result();
}
/**
* @Description 办事指南列表
* @Param formDTO
* @Return {@link Result< PageData< GuideListResultDTO>>}
* @Author zhaoqifeng
* @Date 2021/9/7 13:59
*/
@PostMapping("list")
public Result<PageData<GuideListResultDTO>> guideList(@LoginUser TokenDto tokenDto, @RequestBody GuideListFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, PageFormDTO.AddUserInternalGroup.class);
PageData<GuideListResultDTO> page = guideService.guideList(tokenDto, formDTO);
return new Result<PageData<GuideListResultDTO>>().ok(page);
}
/**
* @Description 添加指南
* @Param tokenDto
* @Param formDTO
* @Return {@link Result}
* @Author zhaoqifeng
* @Date 2021/9/7 14:13
*/
@PostMapping("add")
public Result guideAdd(@LoginUser TokenDto tokenDto, @RequestBody GuideAddFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO);
guideService.guideAdd(tokenDto, formDTO);
return new Result();
}
/**
* @Description 修改指南
* @Param tokenDto
* @Param formDTO
* @Return {@link Result}
* @Author zhaoqifeng
* @Date 2021/9/7 14:13
*/
@PostMapping("edit")
public Result guideEdit(@LoginUser TokenDto tokenDto, @RequestBody GuideEditFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO);
formDTO.setStaffId(tokenDto.getUserId());
guideService.guideEdit(formDTO);
return new Result();
}
/**
* @Description 删除指南
* @Param tokenDto
* @Param formDTO
* @Return {@link Result}
* @Author zhaoqifeng
* @Date 2021/9/7 14:13
*/
@PostMapping("del")
public Result guideDel(@LoginUser TokenDto tokenDto, @RequestBody GuideFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO);
formDTO.setStaffId(tokenDto.getUserId());
guideService.guideDel(formDTO);
return new Result();
}
/**
* @Description 指南详情
* @Param tokenDto
* @Param formDTO
* @Return {@link Result< GuideDetailResultDTO>}
* @Author zhaoqifeng
* @Date 2021/9/7 14:13
*/
@PostMapping("detail")
public Result<GuideDetailResultDTO> guideDetail(@LoginUser TokenDto tokenDto, @RequestBody GuideFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO);
formDTO.setCustomerId(tokenDto.getCustomerId());
GuideDetailResultDTO result = guideService.guideDetail(formDTO);
return new Result<GuideDetailResultDTO>().ok(result);
}
}

30
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/GuideDao.java

@ -18,16 +18,42 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.form.GuideListFormDTO;
import com.epmet.dto.result.GuideDetailResultDTO;
import com.epmet.dto.result.GuideListResultDTO;
import com.epmet.entity.GuideEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 办事指南表
* 办事指南表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-09-06
*/
@Mapper
public interface GuideDao extends BaseDao<GuideEntity> {
/**
* 指南列表
*
* @Param formDTO
* @Return {@link List<GuideListResultDTO>}
* @Author zhaoqifeng
* @Date 2021/9/7 14:21
*/
List<GuideListResultDTO> getGuideList(GuideListFormDTO formDTO);
/**
* 指南详情
*
* @Param guideId
* @Return {@link GuideDetailResultDTO}
* @Author zhaoqifeng
* @Date 2021/9/8 9:59
*/
GuideDetailResultDTO getGuideDetail(@Param("guideId") String guideId);
}

12
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/GuideModuleDao.java

@ -18,8 +18,12 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.ModuleDTO;
import com.epmet.entity.GuideModuleEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 指南模块关联表
@ -29,5 +33,13 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface GuideModuleDao extends BaseDao<GuideModuleEntity> {
/**
* @Description 获取指南的内容模块
* @Param guideId
* @Return {@link List< ModuleDTO>}
* @Author zhaoqifeng
* @Date 2021/9/8 10:18
*/
List<ModuleDTO> selectByGuideId(@Param("customerId") String customerId, @Param("guideId") String guideId);
}

23
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/GuideEntity.java

@ -18,13 +18,10 @@
package com.epmet.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 办事指南表
*
@ -43,10 +40,20 @@ public class GuideEntity extends BaseEpmetEntity {
*/
private String customerId;
/**
* 发布单位ID
*/
private String agencyId;
/**
* 发布单位类型 机关agency 网格grid 部门dept
*/
private String orgType;
/**
* 发布单位ID
*/
private String orgId;
/**
* 发布单位名称
*/
private String orgName;
/**
* 所属组织机构IDcustomer_agency.id
@ -66,6 +73,6 @@ public class GuideEntity extends BaseEpmetEntity {
/**
* 分类ID
*/
private String categoryId;
private String categoryCode;
}

8
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/GuideExternalLinkEntity.java

@ -18,13 +18,10 @@
package com.epmet.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 指南外链表
*
@ -58,4 +55,9 @@ public class GuideExternalLinkEntity extends BaseEpmetEntity {
*/
private String externalLink;
/**
* 排序
*/
private Integer sort;
}

19
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/GuideAttachmentService.java

@ -19,6 +19,7 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.AttachmentDTO;
import com.epmet.dto.GuideAttachmentDTO;
import com.epmet.entity.GuideAttachmentEntity;
@ -92,4 +93,22 @@ public interface GuideAttachmentService extends BaseService<GuideAttachmentEntit
* @date 2021-09-06
*/
void delete(String[] ids);
/**
* @Description 删除指南附件
* @Param guideId
* @Return
* @Author zhaoqifeng
* @Date 2021/9/7 17:16
*/
void deleteByGuideId(String guideId);
/**
* @Description 获取指南附件
* @Param guideId
* @Return {@link List< AttachmentDTO>}
* @Author zhaoqifeng
* @Date 2021/9/8 10:49
*/
List<AttachmentDTO> getByGuideId(String guideId);
}

19
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/GuideExternalLinkService.java

@ -19,6 +19,7 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.ExternalLinkDTO;
import com.epmet.dto.GuideExternalLinkDTO;
import com.epmet.entity.GuideExternalLinkEntity;
@ -92,4 +93,22 @@ public interface GuideExternalLinkService extends BaseService<GuideExternalLinkE
* @date 2021-09-06
*/
void delete(String[] ids);
/**
* @Description 删除指南外链
* @Param guideId
* @Return
* @Author zhaoqifeng
* @Date 2021/9/7 17:20
*/
void deleteByGuideId(String guideId);
/**
* @Description 获取指南外链
* @Param guideId
* @Return {@link List< ExternalLinkDTO>}
* @Author zhaoqifeng
* @Date 2021/9/8 11:05
*/
List<ExternalLinkDTO> getByGuideId(String guideId);
}

20
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/GuideModuleService.java

@ -20,6 +20,7 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.GuideModuleDTO;
import com.epmet.dto.ModuleDTO;
import com.epmet.entity.GuideModuleEntity;
import java.util.List;
@ -92,4 +93,23 @@ public interface GuideModuleService extends BaseService<GuideModuleEntity> {
* @date 2021-09-06
*/
void delete(String[] ids);
/**
* @Description 删除指南的内容模块
* @Param guideId
* @Return
* @Author zhaoqifeng
* @Date 2021/9/7 17:01
*/
void deleteByGuideId(String guideId);
/**
* @Description
* @Param customerId
* @Param guideId
* @Return {@link ModuleDTO}
* @Author zhaoqifeng
* @Date 2021/9/8 10:13
*/
List<ModuleDTO> getByGuideId(String customerId, String guideId);
}

60
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/GuideService.java

@ -19,14 +19,21 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.dto.GuideDTO;
import com.epmet.dto.form.GuideAddFormDTO;
import com.epmet.dto.form.GuideEditFormDTO;
import com.epmet.dto.form.GuideFormDTO;
import com.epmet.dto.form.GuideListFormDTO;
import com.epmet.dto.result.GuideDetailResultDTO;
import com.epmet.dto.result.GuideListResultDTO;
import com.epmet.entity.GuideEntity;
import java.util.List;
import java.util.Map;
/**
* 办事指南表
* 办事指南表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-09-06
@ -92,4 +99,55 @@ public interface GuideService extends BaseService<GuideEntity> {
* @date 2021-09-06
*/
void delete(String[] ids);
/**
* 办事指南列表
*
* @Param formDTO
* @Return {@link PageData<GuideListResultDTO>}
* @Author zhaoqifeng
* @Date 2021/9/7 14:00
*/
PageData<GuideListResultDTO> guideList(TokenDto tokenDto, GuideListFormDTO formDTO);
/**
* 添加指南
*
* @Param tokenDto
* @Param formDTO
* @Return
* @Author zhaoqifeng
* @Date 2021/9/7 14:12
*/
void guideAdd(TokenDto tokenDto, GuideAddFormDTO formDTO);
/**
* 修改指南
*
* @Param formDTO
* @Return
* @Author zhaoqifeng
* @Date 2021/9/7 14:12
*/
void guideEdit(GuideEditFormDTO formDTO);
/**
* 删除指南
*
* @Param formDTO
* @Return
* @Author zhaoqifeng
* @Date 2021/9/7 14:12
*/
void guideDel(GuideFormDTO formDTO);
/**
* 指南详情
*
* @Param formDTO
* @Return {@link GuideDetailResultDTO}
* @Author zhaoqifeng
* @Date 2021/9/7 14:12
*/
GuideDetailResultDTO guideDetail(GuideFormDTO formDTO);
}

49
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/GuideAttachmentServiceImpl.java

@ -17,6 +17,7 @@
package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
@ -24,16 +25,20 @@ import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.dao.GuideAttachmentDao;
import com.epmet.dto.AttachmentDTO;
import com.epmet.dto.GuideAttachmentDTO;
import com.epmet.entity.GuideAttachmentEntity;
import com.epmet.service.GuideAttachmentService;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 办事指南附件
@ -97,4 +102,48 @@ public class GuideAttachmentServiceImpl extends BaseServiceImpl<GuideAttachmentD
baseDao.deleteBatchIds(Arrays.asList(ids));
}
/**
* @param guideId
* @Description 删除指南附件
* @Param guideId
* @Return
* @Author zhaoqifeng
* @Date 2021/9/7 17:16
*/
@Override
public void deleteByGuideId(String guideId) {
LambdaQueryWrapper<GuideAttachmentEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(GuideAttachmentEntity::getGuideId, guideId);
baseDao.delete(wrapper);
}
/**
* @param guideId
* @Description 获取指南附件
* @Param guideId
* @Return {@link List< AttachmentDTO >}
* @Author zhaoqifeng
* @Date 2021/9/8 10:49
*/
@Override
public List<AttachmentDTO> getByGuideId(String guideId) {
LambdaQueryWrapper<GuideAttachmentEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(GuideAttachmentEntity::getGuideId, guideId);
wrapper.orderByAsc(GuideAttachmentEntity::getSort);
List<GuideAttachmentEntity> list = baseDao.selectList(wrapper);
if (CollectionUtils.isEmpty(list)) {
return Collections.emptyList();
}
return list.stream().map(item -> {
AttachmentDTO dto = new AttachmentDTO();
dto.setName(item.getAttachmentName());
dto.setType(item.getAttachmentType());
dto.setUrl(item.getAttachmentUrl());
dto.setSize(item.getAttachmentSize());
dto.setFormat(item.getAttachmentFormat());
dto.setDuration(item.getDuration());
return dto;
}).collect(Collectors.toList());
}
}

45
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/GuideExternalLinkServiceImpl.java

@ -17,6 +17,7 @@
package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
@ -24,16 +25,20 @@ import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.dao.GuideExternalLinkDao;
import com.epmet.dto.ExternalLinkDTO;
import com.epmet.dto.GuideExternalLinkDTO;
import com.epmet.entity.GuideExternalLinkEntity;
import com.epmet.service.GuideExternalLinkService;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 指南外链表
@ -97,4 +102,44 @@ public class GuideExternalLinkServiceImpl extends BaseServiceImpl<GuideExternalL
baseDao.deleteBatchIds(Arrays.asList(ids));
}
/**
* @param guideId
* @Description 删除指南外链
* @Param guideId
* @Return
* @Author zhaoqifeng
* @Date 2021/9/7 17:20
*/
@Override
public void deleteByGuideId(String guideId) {
LambdaQueryWrapper<GuideExternalLinkEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(GuideExternalLinkEntity::getGuideId, guideId);
baseDao.delete(wrapper);
}
/**
* @param guideId
* @Description 获取指南外链
* @Param guideId
* @Return {@link List< ExternalLinkDTO >}
* @Author zhaoqifeng
* @Date 2021/9/8 11:05
*/
@Override
public List<ExternalLinkDTO> getByGuideId(String guideId) {
LambdaQueryWrapper<GuideExternalLinkEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(GuideExternalLinkEntity::getGuideId, guideId);
wrapper.orderByAsc(GuideExternalLinkEntity::getSort);
List<GuideExternalLinkEntity> list = baseDao.selectList(wrapper);
if (CollectionUtils.isEmpty(list)) {
return Collections.emptyList();
}
return list.stream().map(item -> {
ExternalLinkDTO dto = new ExternalLinkDTO();
dto.setExternalLink(item.getExternalLink());
dto.setDescription(item.getDescription());
return dto;
}).collect(Collectors.toList());
}
}

32
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/GuideModuleServiceImpl.java

@ -17,6 +17,7 @@
package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
@ -25,13 +26,16 @@ import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.dao.GuideModuleDao;
import com.epmet.dto.GuideModuleDTO;
import com.epmet.dto.ModuleDTO;
import com.epmet.entity.GuideModuleEntity;
import com.epmet.service.GuideModuleService;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
@ -97,4 +101,32 @@ public class GuideModuleServiceImpl extends BaseServiceImpl<GuideModuleDao, Guid
baseDao.deleteBatchIds(Arrays.asList(ids));
}
/**
* @param guideId
* @Description 删除指南的内容模块
* @Param guideId
* @Return
* @Author zhaoqifeng
* @Date 2021/9/7 17:01
*/
@Override
public void deleteByGuideId(String guideId) {
LambdaQueryWrapper<GuideModuleEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(GuideModuleEntity::getGuideId, guideId);
baseDao.delete(wrapper);
}
/**
* @param guideId
* @Description 获取指南的内容模块
* @Param guideId
* @Return {@link ModuleDTO}
* @Author zhaoqifeng
* @Date 2021/9/8 10:13
*/
@Override
public List<ModuleDTO> getByGuideId(String customerId, String guideId) {
return baseDao.selectByGuideId(customerId, guideId);
}
}

282
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/GuideServiceImpl.java

@ -21,19 +21,43 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.OrgInfoConstant;
import com.epmet.dao.GuideDao;
import com.epmet.dto.GuideDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.GuideDetailResultDTO;
import com.epmet.dto.result.GuideListResultDTO;
import com.epmet.dto.result.OrgResultDTO;
import com.epmet.entity.GuideAttachmentEntity;
import com.epmet.entity.GuideEntity;
import com.epmet.entity.GuideExternalLinkEntity;
import com.epmet.entity.GuideModuleEntity;
import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.service.GuideAttachmentService;
import com.epmet.service.GuideExternalLinkService;
import com.epmet.service.GuideModuleService;
import com.epmet.service.GuideService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
/**
* 办事指南表
@ -44,6 +68,14 @@ import java.util.Map;
@Service
public class GuideServiceImpl extends BaseServiceImpl<GuideDao, GuideEntity> implements GuideService {
@Resource
private GovOrgOpenFeignClient govOrgOpenFeignClient;
@Resource
private GuideModuleService guideModuleService;
@Resource
private GuideAttachmentService guideAttachmentService;
@Resource
private GuideExternalLinkService guideExternalLinkService;
@Override
public PageData<GuideDTO> page(Map<String, Object> params) {
@ -81,6 +113,7 @@ public class GuideServiceImpl extends BaseServiceImpl<GuideDao, GuideEntity> imp
public void save(GuideDTO dto) {
GuideEntity entity = ConvertUtils.sourceToTarget(dto, GuideEntity.class);
insert(entity);
ConvertUtils.sourceToTarget(entity, GuideDTO.class);
}
@Override
@ -97,4 +130,253 @@ public class GuideServiceImpl extends BaseServiceImpl<GuideDao, GuideEntity> imp
baseDao.deleteBatchIds(Arrays.asList(ids));
}
/**
* 办事指南列表
*
* @param formDTO
* @Param formDTO
* @Return {@link PageData< GuideListResultDTO >}
* @Author zhaoqifeng
* @Date 2021/9/7 14:00
*/
@Override
public PageData<GuideListResultDTO> guideList(TokenDto tokenDto, GuideListFormDTO formDTO) {
PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize());
List<GuideListResultDTO> list = baseDao.getGuideList(formDTO);
list.forEach(item -> {
CustomerStaffInfoCacheResult staffInfoCache = CustomerStaffRedis.getStaffInfo(tokenDto.getCustomerId(), item.getCreatedId());
if (null == staffInfoCache) {
item.setCategoryName("");
} else {
item.setCreatedName(staffInfoCache.getRealName());
}
});
PageInfo<GuideListResultDTO> pageInfo = new PageInfo<>(list);
return new PageData<>(list, pageInfo.getTotal());
}
/**
* 添加指南
*
* @param tokenDto
* @Param formDTO
* @Return
* @Author zhaoqifeng
* @Date 2021/9/7 14:12
*/
@Override
public void guideAdd(TokenDto tokenDto, GuideAddFormDTO formDTO) {
if (CollectionUtils.isEmpty(formDTO.getModuleList()) && CollectionUtils.isEmpty(formDTO.getAttachmentList()) &&
CollectionUtils.isEmpty(formDTO.getExternalLinks())) {
throw new RenException(EpmetErrorCode.GUIDE_IS_NULL.getCode());
}
//保存办事指南表
GuideDTO guideDTO = new GuideDTO();
guideDTO.setCustomerId(tokenDto.getCustomerId());
guideDTO.setOrgId(formDTO.getOrgId());
guideDTO.setOrgType(formDTO.getOrgType());
guideDTO.setOrgName(formDTO.getOrgName());
guideDTO.setCategoryCode(formDTO.getCategoryCode());
guideDTO.setTitle(formDTO.getTitle());
OrgFormDTO orgFormDTO = new OrgFormDTO();
orgFormDTO.setOrgId(formDTO.getOrgId());
orgFormDTO.setOrgType(formDTO.getOrgType());
//获取组织的pId和pIds
Result<OrgResultDTO> result = govOrgOpenFeignClient.getAgencyInfo(orgFormDTO);
if (!result.success() || null == result.getData()) {
throw new RenException(result.getCode(), result.getMsg());
}
if (OrgInfoConstant.AGENCY.equals(formDTO.getOrgType())) {
guideDTO.setPid(result.getData().getPid());
} else {
guideDTO.setPid(result.getData().getAgencyId());
}
guideDTO.setPids(result.getData().getPids().concat(":").concat(result.getData().getAgencyId()));
save(guideDTO);
//保存办事指南内容模块
if (CollectionUtils.isNotEmpty(formDTO.getModuleList())) {
List<GuideModuleEntity> guideModuleList = formDTO.getModuleList().stream().map(item -> {
GuideModuleEntity entity = new GuideModuleEntity();
entity.setCustomerId(tokenDto.getCustomerId());
entity.setGuideId(guideDTO.getId());
entity.setModuleId(item.getModuleId());
entity.setModuleContent(item.getModuleContent());
return entity;
}).collect(Collectors.toList());
guideModuleService.insertBatch(guideModuleList);
}
//保存附件
if (CollectionUtils.isNotEmpty(formDTO.getAttachmentList())) {
AtomicInteger i = new AtomicInteger(1);
List<GuideAttachmentEntity> attachmentList = formDTO.getAttachmentList().stream().map(item -> {
GuideAttachmentEntity entity = new GuideAttachmentEntity();
entity.setCustomerId(tokenDto.getCustomerId());
entity.setGuideId(guideDTO.getId());
entity.setAttachmentName(item.getName());
entity.setAttachmentFormat(item.getFormat());
entity.setAttachmentSize(item.getSize());
entity.setAttachmentType(item.getType());
entity.setAttachmentUrl(item.getUrl());
entity.setDuration(item.getDuration());
entity.setSort(i.getAndIncrement());
return entity;
}).collect(Collectors.toList());
guideAttachmentService.insertBatch(attachmentList);
}
//保存外链地址
if (CollectionUtils.isNotEmpty(formDTO.getExternalLinks())) {
AtomicInteger i = new AtomicInteger(1);
List<GuideExternalLinkEntity> linkList = formDTO.getExternalLinks().stream().map(item -> {
GuideExternalLinkEntity entity = new GuideExternalLinkEntity();
entity.setCustomerId(tokenDto.getCustomerId());
entity.setGuideId(guideDTO.getId());
entity.setExternalLink(item.getExternalLink());
entity.setDescription(item.getDescription());
entity.setSort(i.getAndIncrement());
return entity;
}).collect(Collectors.toList());
guideExternalLinkService.insertBatch(linkList);
}
}
/**
* 修改指南
*
* @param formDTO
* @Param formDTO
* @Return
* @Author zhaoqifeng
* @Date 2021/9/7 14:12
*/
@Override
public void guideEdit(GuideEditFormDTO formDTO) {
if (CollectionUtils.isEmpty(formDTO.getModuleList()) && CollectionUtils.isEmpty(formDTO.getAttachmentList()) &&
CollectionUtils.isEmpty(formDTO.getExternalLinks())) {
throw new RenException(EpmetErrorCode.GUIDE_IS_NULL.getCode());
}
//保存办事指南表
GuideDTO guideDTO = get(formDTO.getGuideId());
if (!formDTO.getStaffId().equals(guideDTO.getCreatedBy())) {
throw new RenException(EpmetErrorCode.GUIDE_IS_NOT_YOURS.getCode());
}
guideDTO.setOrgId(formDTO.getOrgId());
guideDTO.setOrgType(formDTO.getOrgType());
guideDTO.setCategoryCode(formDTO.getCategoryCode());
guideDTO.setTitle(formDTO.getTitle());
OrgFormDTO orgFormDTO = new OrgFormDTO();
orgFormDTO.setOrgId(formDTO.getOrgId());
orgFormDTO.setOrgType(formDTO.getOrgType());
guideDTO.setOrgName(formDTO.getOrgName());
//获取组织的pId和pIds
Result<OrgResultDTO> result = govOrgOpenFeignClient.getAgencyInfo(orgFormDTO);
if (!result.success() || null == result.getData()) {
throw new RenException(result.getCode(), result.getMsg());
}
if (OrgInfoConstant.AGENCY.equals(formDTO.getOrgType())) {
guideDTO.setPid(result.getData().getPid());
} else {
guideDTO.setPid(result.getData().getAgencyId());
}
guideDTO.setPids(result.getData().getPids().concat(":").concat(result.getData().getAgencyId()));
update(guideDTO);
//保存办事指南内容模块
if (CollectionUtils.isNotEmpty(formDTO.getModuleList())) {
List<GuideModuleEntity> guideModuleList = formDTO.getModuleList().stream().map(item -> {
GuideModuleEntity entity = new GuideModuleEntity();
entity.setCustomerId(guideDTO.getCustomerId());
entity.setId(item.getGuideModuleId());
entity.setGuideId(guideDTO.getId());
entity.setModuleId(item.getModuleId());
entity.setModuleContent(item.getModuleContent());
return entity;
}).collect(Collectors.toList());
guideModuleService.insertBatch(guideModuleList.stream().filter(item -> null == item.getId()).collect(Collectors.toList()));
guideModuleService.updateBatchById(guideModuleList.stream().filter(item -> null != item.getId()).collect(Collectors.toList()));
}
//保存附件
guideAttachmentService.deleteByGuideId(formDTO.getGuideId());
if (CollectionUtils.isNotEmpty(formDTO.getAttachmentList())) {
AtomicInteger i = new AtomicInteger(1);
List<GuideAttachmentEntity> attachmentList = formDTO.getAttachmentList().stream().map(item -> {
GuideAttachmentEntity entity = new GuideAttachmentEntity();
entity.setCustomerId(guideDTO.getCustomerId());
entity.setGuideId(guideDTO.getId());
entity.setAttachmentName(item.getName());
entity.setAttachmentFormat(item.getFormat());
entity.setAttachmentSize(item.getSize());
entity.setAttachmentType(item.getType());
entity.setAttachmentUrl(item.getUrl());
entity.setDuration(item.getDuration());
entity.setSort(i.getAndIncrement());
return entity;
}).collect(Collectors.toList());
guideAttachmentService.insertBatch(attachmentList);
}
//保存外链地址
guideExternalLinkService.deleteByGuideId(formDTO.getGuideId());
if (CollectionUtils.isNotEmpty(formDTO.getExternalLinks())) {
AtomicInteger i = new AtomicInteger(1);
List<GuideExternalLinkEntity> linkList = formDTO.getExternalLinks().stream().map(item -> {
GuideExternalLinkEntity entity = new GuideExternalLinkEntity();
entity.setCustomerId(guideDTO.getCustomerId());
entity.setGuideId(guideDTO.getId());
entity.setExternalLink(item.getExternalLink());
entity.setDescription(item.getDescription());
entity.setSort(i.getAndIncrement());
return entity;
}).collect(Collectors.toList());
guideExternalLinkService.insertBatch(linkList);
}
}
/**
* 删除指南
*
* @param formDTO
* @Param formDTO
* @Return
* @Author zhaoqifeng
* @Date 2021/9/7 14:12
*/
@Override
public void guideDel(GuideFormDTO formDTO) {
GuideDTO guide = get(formDTO.getGuideId());
if (!formDTO.getStaffId().equals(guide.getCreatedBy())) {
throw new RenException(EpmetErrorCode.GUIDE_IS_NOT_YOURS.getCode());
}
//删除主表
baseDao.deleteById(formDTO.getGuideId());
//删除内容模块
guideModuleService.deleteByGuideId(formDTO.getGuideId());
//删除附件
guideAttachmentService.deleteByGuideId(formDTO.getGuideId());
//删除外链
guideExternalLinkService.deleteByGuideId(formDTO.getGuideId());
}
/**
* 指南详情
*
* @param formDTO
* @Param formDTO
* @Return {@link GuideDetailResultDTO}
* @Author zhaoqifeng
* @Date 2021/9/7 14:12
*/
@Override
public GuideDetailResultDTO guideDetail(GuideFormDTO formDTO) {
//获取指南详情
GuideDetailResultDTO result = baseDao.getGuideDetail(formDTO.getGuideId());
//获取指南内容模块
result.setModuleList(guideModuleService.getByGuideId(formDTO.getCustomerId(), formDTO.getGuideId()));
//获取指南附件
result.setAttachmentList(guideAttachmentService.getByGuideId(formDTO.getGuideId()));
//获取指南外链地址
result.setExternalLinks(guideExternalLinkService.getByGuideId(formDTO.getGuideId()));
return result;
}
}

42
epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/GuideDao.xml

@ -6,11 +6,12 @@
<resultMap type="com.epmet.entity.GuideEntity" id="guideMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="agencyId" column="AGENCY_ID"/>
<result property="orgType" column="ORG_TYPE"/>
<result property="orgId" column="ORG_ID"/>
<result property="pid" column="PID"/>
<result property="pids" column="PIDS"/>
<result property="title" column="TITLE"/>
<result property="categoryId" column="CATEGORY_ID"/>
<result property="categoryCode" column="CATEGORY_CODE"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
@ -19,5 +20,42 @@
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<select id="getGuideList" resultType="com.epmet.dto.result.GuideListResultDTO">
SELECT
g.ID AS "guideId",
g.TITLE AS "title",
gc.CATEGORY_NAME AS categoryName,
g.CREATED_BY AS createdId,
g.UPDATED_TIME AS updatedTime,
FROM
guide g
INNER JOIN guide_category gc ON g.CATEGORY_ID = gc.ID
WHERE g.DEL_FLAG = 0
<if test='null != agencyId and "" != agencyId'>
AND g.PIDS LIKE CONCAT( '%', #{agencyId}, '%' )
</if>
<if test='null != guideTitle and "" != guideTitle'>
AND g.TITLE LIKE CONCAT( '%', #{guideTitle}, '%' )
</if>
<if test='null != categoryId and "" != categoryId'>
AND g.CATEGORY_ID = #{categoryId}
</if>
</select>
<select id="getGuideDetail" resultType="com.epmet.dto.result.GuideDetailResultDTO">
SELECT
g.ID AS "guideId",
ORG_TYPE,
ORG_ID,
ORG_NAME,
TITLE,
CATEGORY_CODE
CATEGORY_NAME
FROM
guide g
INNER JOIN guide_category gc ON g.CATEGORY_CODE = gc.CATEGORY_CODE
WHERE
g.ID = #{guideId}
</select>
</mapper>

13
epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/GuideModuleDao.xml

@ -16,6 +16,19 @@
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<select id="selectByGuideId" resultType="com.epmet.dto.ModuleDTO">
SELECT
gm.ID AS "guideModuleId",
gmd.ID AS "moduleId",
gmd.MODULE_VALUE,
gmd.MODULE_NAME,
gm.MODULE_CONTENT
FROM guide_module_dict gmd
LEFT JOIN guide_module gm ON gmd.ID = gm.MODULE_ID AND gm.DEL_FLAG = 0 AND gm.GUIDE_ID = #{guideId}
WHERE gmd.DEL_FLAG = 0
AND gmd.CUSTOMER_ID = #{customerId}
ORDER BY gmd.SORT ASC
</select>
</mapper>
Loading…
Cancel
Save