diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java index aa74cd8e2a..4d717f919e 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java +++ b/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,"未查询到注册客户信息"), diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/OrgFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/OrgFormDTO.java new file mode 100644 index 0000000000..6975477321 --- /dev/null +++ b/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; +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java index e6af374fe2..7e7de0e4b2 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java @@ -417,4 +417,14 @@ public interface GovOrgOpenFeignClient { */ @PostMapping("/gov/org/customerstaffagency/queryOrgStaffs") Result> queryOrgStaffs(@RequestBody OrgStaffFormDTO formDTO); + + /** + * @Description 根据组织或网格或吧部门获取组织信息 + * @Param formDTO + * @Return {@link Result} + * @Author zhaoqifeng + * @Date 2021/9/7 15:27 + */ + @PostMapping("/gov/org/customeragency/getAgencyInfo") + Result getAgencyInfo(@RequestBody OrgFormDTO formDTO); } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java index b517c20344..38f5df4626 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java @@ -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} + * @Author zhaoqifeng + * @Date 2021/9/7 15:27 + */ + @Override + public Result getAgencyInfo(OrgFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getAgencyInfo", formDTO); + } + @Override public Result selectPidsByGridId(String gridId) { return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "selectPidsByGridId", gridId); diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java index 963c8b7b95..70c254ee26 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java @@ -312,4 +312,16 @@ public class CustomerAgencyController { return new Result().ok(customerAgencyService.staffPermissionExt(tokenDto.getUserId())); } + /** + * @Description 根据组织或网格或吧部门获取组织信息 + * @Param formDTO + * @Return {@link Result} + * @Author zhaoqifeng + * @Date 2021/9/7 15:27 + */ + @PostMapping("getAgencyInfo") + public Result getAgencyInfo(@RequestBody OrgFormDTO formDTO) { + return new Result().ok(customerAgencyService.getAgencyInfo(formDTO)); + } + } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java index fda2f4d09e..aaa691f239 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java @@ -236,4 +236,13 @@ public interface CustomerAgencyService extends BaseService 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); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java index 38c0fc85b0..554d263173 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java @@ -1075,4 +1075,18 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto; + +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; + +} \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/GuideDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/GuideDTO.java index 9d5377c34d..f5fe57d143 100644 --- a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/GuideDTO.java +++ b/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; /** * 所属组织机构ID(customer_agency.id) @@ -66,7 +77,7 @@ public class GuideDTO implements Serializable { /** * 分类ID */ - private String categoryId; + private String categoryCode; /** * 删除标识:0.未删除 1.已删除 diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/GuideExternalLinkDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/GuideExternalLinkDTO.java index 3cbc69462e..39612bb4ff 100644 --- a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/GuideExternalLinkDTO.java +++ b/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已删除 */ diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/ModuleDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/ModuleDTO.java new file mode 100644 index 0000000000..548395fd96 --- /dev/null +++ b/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 + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto; + +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; +} \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/GuideAddFormDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/GuideAddFormDTO.java new file mode 100644 index 0000000000..dd74b3fac6 --- /dev/null +++ b/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 externalLinks; + /** + * 内容模块 + */ + private List moduleList; + /** + * 附件 + */ + private List attachmentList; + +} diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/GuideEditFormDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/GuideEditFormDTO.java new file mode 100644 index 0000000000..a589c4c1ec --- /dev/null +++ b/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 externalLinks; + /** + * 内容模块 + */ + private List moduleList; + /** + * 附件 + */ + private List attachmentList; + +} diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/GuideFormDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/GuideFormDTO.java new file mode 100644 index 0000000000..48bfde8f04 --- /dev/null +++ b/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; + +} diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/GuideListFormDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/GuideListFormDTO.java new file mode 100644 index 0000000000..d4ff3bdfcb --- /dev/null +++ b/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; +} diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/GetCategoryResultDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/GetCategoryResultDTO.java new file mode 100644 index 0000000000..6bf568d65d --- /dev/null +++ b/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; +} diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/GuideDetailResultDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/GuideDetailResultDTO.java new file mode 100644 index 0000000000..2987b227a0 --- /dev/null +++ b/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 externalLinks; + /** + * 内容模块 + */ + private List moduleList; + /** + * 附件 + */ + private List attachmentList; + +} diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/GuideListResultDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/GuideListResultDTO.java new file mode 100644 index 0000000000..7cd2400afa --- /dev/null +++ b/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; +} \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/GuideController.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/GuideController.java index d484148233..602916807e 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/GuideController.java +++ b/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> page(@RequestParam Map params){ + public Result> page(@RequestParam Map params) { PageData page = guideService.page(params); return new Result>().ok(page); } @GetMapping("{id}") - public Result get(@PathVariable("id") String id){ + public Result get(@PathVariable("id") String id) { GuideDTO data = guideService.get(id); return new Result().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> guideList(@LoginUser TokenDto tokenDto, @RequestBody GuideListFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, PageFormDTO.AddUserInternalGroup.class); + PageData page = guideService.guideList(tokenDto, formDTO); + return new Result>().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 guideDetail(@LoginUser TokenDto tokenDto, @RequestBody GuideFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + formDTO.setCustomerId(tokenDto.getCustomerId()); + GuideDetailResultDTO result = guideService.guideDetail(formDTO); + return new Result().ok(result); + } + + } \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/GuideDao.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/GuideDao.java index cc5039c8d4..ec78fb5803 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/GuideDao.java +++ b/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 { - + + /** + * 指南列表 + * + * @Param formDTO + * @Return {@link List} + * @Author zhaoqifeng + * @Date 2021/9/7 14:21 + */ + List getGuideList(GuideListFormDTO formDTO); + + /** + * 指南详情 + * + * @Param guideId + * @Return {@link GuideDetailResultDTO} + * @Author zhaoqifeng + * @Date 2021/9/8 9:59 + */ + GuideDetailResultDTO getGuideDetail(@Param("guideId") String guideId); + } \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/GuideModuleDao.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/GuideModuleDao.java index d77324965b..07518e24eb 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/GuideModuleDao.java +++ b/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 { + /** + * @Description 获取指南的内容模块 + * @Param guideId + * @Return {@link List< ModuleDTO>} + * @Author zhaoqifeng + * @Date 2021/9/8 10:18 + */ + List selectByGuideId(@Param("customerId") String customerId, @Param("guideId") String guideId); } \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/GuideEntity.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/GuideEntity.java index f135e3f676..5909729866 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/GuideEntity.java +++ b/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; /** * 所属组织机构ID(customer_agency.id) @@ -66,6 +73,6 @@ public class GuideEntity extends BaseEpmetEntity { /** * 分类ID */ - private String categoryId; + private String categoryCode; } diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/GuideExternalLinkEntity.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/GuideExternalLinkEntity.java index 4113a168c5..3773c6acea 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/GuideExternalLinkEntity.java +++ b/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; + } diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/GuideAttachmentService.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/GuideAttachmentService.java index 0c56c55e62..4b297fed10 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/GuideAttachmentService.java +++ b/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} + * @Author zhaoqifeng + * @Date 2021/9/8 10:49 + */ + List getByGuideId(String guideId); } \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/GuideExternalLinkService.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/GuideExternalLinkService.java index fcb7cc5b65..e54c0d4675 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/GuideExternalLinkService.java +++ b/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} + * @Author zhaoqifeng + * @Date 2021/9/8 11:05 + */ + List getByGuideId(String guideId); } \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/GuideModuleService.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/GuideModuleService.java index e03d399b5c..52837fd28b 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/GuideModuleService.java +++ b/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 { * @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 getByGuideId(String customerId, String guideId); } \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/GuideService.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/GuideService.java index 415a968d01..2ae50707ec 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/GuideService.java +++ b/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 { * @date 2021-09-06 */ void delete(String[] ids); + + /** + * 办事指南列表 + * + * @Param formDTO + * @Return {@link PageData} + * @Author zhaoqifeng + * @Date 2021/9/7 14:00 + */ + PageData 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); } \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/GuideAttachmentServiceImpl.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/GuideAttachmentServiceImpl.java index 2f66e4b70e..43a8c41683 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/GuideAttachmentServiceImpl.java +++ b/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 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 getByGuideId(String guideId) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(GuideAttachmentEntity::getGuideId, guideId); + wrapper.orderByAsc(GuideAttachmentEntity::getSort); + List 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()); + } + } \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/GuideExternalLinkServiceImpl.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/GuideExternalLinkServiceImpl.java index a9f080965e..bd45d0b2a8 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/GuideExternalLinkServiceImpl.java +++ b/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 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 getByGuideId(String guideId) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(GuideExternalLinkEntity::getGuideId, guideId); + wrapper.orderByAsc(GuideExternalLinkEntity::getSort); + List 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()); + } + } \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/GuideModuleServiceImpl.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/GuideModuleServiceImpl.java index ce07f2e233..8a0ef25a72 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/GuideModuleServiceImpl.java +++ b/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 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 getByGuideId(String customerId, String guideId) { + return baseDao.selectByGuideId(customerId, guideId); + } + } \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/GuideServiceImpl.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/GuideServiceImpl.java index 5ac7a56e3e..d8a2d2deeb 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/GuideServiceImpl.java +++ b/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 implements GuideService { + @Resource + private GovOrgOpenFeignClient govOrgOpenFeignClient; + @Resource + private GuideModuleService guideModuleService; + @Resource + private GuideAttachmentService guideAttachmentService; + @Resource + private GuideExternalLinkService guideExternalLinkService; @Override public PageData page(Map params) { @@ -81,6 +113,7 @@ public class GuideServiceImpl extends BaseServiceImpl 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 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 guideList(TokenDto tokenDto, GuideListFormDTO formDTO) { + PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()); + List 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 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 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 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 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 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 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 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 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 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; + } + } \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/GuideDao.xml b/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/GuideDao.xml index 071bf38535..82a784dbe9 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/GuideDao.xml +++ b/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/GuideDao.xml @@ -6,11 +6,12 @@ - + + - + @@ -19,5 +20,42 @@ + + + \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/GuideModuleDao.xml b/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/GuideModuleDao.xml index a75b2d018f..3d329b642d 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/GuideModuleDao.xml +++ b/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/GuideModuleDao.xml @@ -16,6 +16,19 @@ + \ No newline at end of file