From e59701c4deb525e2790fdd8049b57b5945cf6d03 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Wed, 8 Sep 2021 15:39:29 +0800 Subject: [PATCH 1/8] =?UTF-8?q?web=E5=88=86=E7=B1=BB=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E4=B8=8D=E5=88=86=E9=A1=B5=EF=BC=8C=E5=88=86?= =?UTF-8?q?=E7=B1=BB=E4=B8=8B=E6=8B=89=E6=A1=86=E9=80=9A=E7=94=A8=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../commons/tools/constant/Constant.java | 11 +++ .../java/com/epmet/dto/GuideCategoryDTO.java | 43 ++++++---- .../form/GuideCategoryDropDownFormDTO.java | 28 +++++++ .../dto/form/GuideCategoryPageFormDTO.java | 21 +++++ .../com/epmet/dto/result/GuideDictResDTO.java | 36 +++++++++ .../controller/GuideCategoryController.java | 43 +++++++++- .../java/com/epmet/dao/GuideCategoryDao.java | 27 ++++++- .../com/epmet/entity/GuideCategoryEntity.java | 34 ++++---- .../epmet/service/GuideCategoryService.java | 25 ++++-- .../impl/GuideCategoryServiceImpl.java | 78 +++++++++++++++++-- .../resources/mapper/GuideCategoryDao.xml | 59 ++++++++++---- 11 files changed, 342 insertions(+), 63 deletions(-) create mode 100644 epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/GuideCategoryDropDownFormDTO.java create mode 100644 epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/GuideCategoryPageFormDTO.java create mode 100644 epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/GuideDictResDTO.java diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/Constant.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/Constant.java index 29a7dcda6b..400e3893e4 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/Constant.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/Constant.java @@ -160,4 +160,15 @@ public interface Constant { // resi_footbar_highlight_num // gov_footbar_highlight_num String FOOTBAR_HIGHLIGHT_NUM="_footbar_highlight_num"; + + + /** + * 未被禁用标识 + * */ + String ENABLE = "enable"; + + /** + * 被禁用标识 + * */ + String DISABLE = "disable"; } diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/GuideCategoryDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/GuideCategoryDTO.java index ccd59bc862..7d0ed1eef4 100644 --- a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/GuideCategoryDTO.java +++ b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/GuideCategoryDTO.java @@ -17,16 +17,18 @@ package com.epmet.dto; +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; + import java.io.Serializable; import java.util.Date; -import lombok.Data; /** * 指南分类 * * @author generator generator@elink-cn.com - * @since v1.0.0 2021-09-06 + * @since v1.0.0 2021-09-08 */ @Data public class GuideCategoryDTO implements Serializable { @@ -36,56 +38,67 @@ public class GuideCategoryDTO implements Serializable { /** * 主键 */ - private String id; + private String id; + + /** + * 客户id,产品默认配置此列存储default + */ + private String customerId; /** - * 客户id + * 分类名,客户内唯一 */ - private String customerId; + private String categoryName; /** - * 分类名 + * 分类编码:分类名的全拼; eg:gongjijin */ - private String categoryName; + private String categoryCode; /** * 排序 */ - private Integer sort; + private Integer sort; /** * 状态 禁用disable 启用enable */ - private String status; + private String status; /** * 删除标识 0未删除、1已删除 */ - private String delFlag; + @JsonIgnore + private String delFlag; /** * 乐观锁 */ - private Integer revision; + @JsonIgnore + private Integer revision; /** * 创建人 */ - private String createdBy; + @JsonIgnore + private String createdBy; /** * 创建时间 */ - private Date createdTime; + @JsonIgnore + private Date createdTime; /** * 更新人 */ - private String updatedBy; + @JsonIgnore + private String updatedBy; /** * 更新时间 */ - private Date updatedTime; + @JsonIgnore + private Date updatedTime; } \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/GuideCategoryDropDownFormDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/GuideCategoryDropDownFormDTO.java new file mode 100644 index 0000000000..a92e1c2e09 --- /dev/null +++ b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/GuideCategoryDropDownFormDTO.java @@ -0,0 +1,28 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Description 发布指南、编辑指南、查询指南列表 分类下拉框 + * @Author yinzuomei + * @Date 2021/9/8 2:57 下午 + */ +@Data +public class GuideCategoryDropDownFormDTO implements Serializable { + private static final long serialVersionUID = 9122708701080412461L; + public interface AddUserInternalGroup { + } + /** + * 新增指南:saveorupdate;查询指南列表:query + */ + @NotBlank(message = "新增指南:saveorupdate;查询指南列表:query",groups = AddUserInternalGroup.class) + private String queryOrigin; + + @NotBlank(message = "当前工作人员所属客户id不能为空",groups = AddUserInternalGroup.class) + private String customerId; + +} + diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/GuideCategoryPageFormDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/GuideCategoryPageFormDTO.java new file mode 100644 index 0000000000..b67686e451 --- /dev/null +++ b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/GuideCategoryPageFormDTO.java @@ -0,0 +1,21 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Description 工作端PC或者运营端分页 + * @Author yinzuomei + * @Date 2021/9/8 1:35 下午 + */ +@Data +public class GuideCategoryPageFormDTO implements Serializable { + private static final long serialVersionUID = -7551388716349439643L; + public interface AddUserInternalGroup { + } + @NotBlank(message = "客户id不能为空,运营端传default", groups = AddUserInternalGroup.class) + private String customerId; +} + diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/GuideDictResDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/GuideDictResDTO.java new file mode 100644 index 0000000000..8b1cbdf94f --- /dev/null +++ b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/GuideDictResDTO.java @@ -0,0 +1,36 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description 办事指南】可用分类列表 新增、编辑指南时的下拉框:展示未禁用的分类; 查询指南列表:如果禁用的分类下存在指南列表,则展示,不存在直接不展示 + * @Author yinzuomei + * @Date 2021/9/8 2:44 下午 + */ +@Data +public class GuideDictResDTO implements Serializable { + + /** + * 分类名,客户内唯一 + */ + private String categoryName; + + /** + * 分类编码:分类名的全拼; eg:gongjijin + */ + private String categoryCode; + + /** + * 排序 + */ + private Integer sort; + + /** + * 状态 禁用disable 启用enable + */ + private String status; +} + + diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/GuideCategoryController.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/GuideCategoryController.java index 03bd231c0b..e34e38770a 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/GuideCategoryController.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/GuideCategoryController.java @@ -17,7 +17,9 @@ package com.epmet.controller; +import com.epmet.commons.tools.annotation.LoginUser; 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,11 +27,14 @@ 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.GuideCategoryDTO; +import com.epmet.dto.form.GuideCategoryDropDownFormDTO; +import com.epmet.dto.form.GuideCategoryPageFormDTO; +import com.epmet.dto.result.GuideDictResDTO; import com.epmet.service.GuideCategoryService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; -import java.util.Map; +import java.util.List; /** @@ -45,12 +50,42 @@ public class GuideCategoryController { @Autowired private GuideCategoryService guideCategoryService; - @GetMapping("page") - public Result> page(@RequestParam Map params){ - PageData page = guideCategoryService.page(params); + /** + * 【办事指南】分类列表-工作端PC和运营端用不分页 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result> + * @author yinzuomei + * @date 2021/9/8 1:33 下午 + */ + @PostMapping("page") + public Result> page(@RequestBody GuideCategoryPageFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, GuideCategoryPageFormDTO.AddUserInternalGroup.class); + PageData page = guideCategoryService.page(formDTO); return new Result>().ok(page); } + /** + * 办事指南】可用分类列表 新增、编辑指南时的下拉框:展示未禁用的分类; 查询指南列表:如果禁用的分类下存在指南列表,则展示,不存在直接不展示 + * + * @param tokenDto + * @return com.epmet.commons.tools.utils.Result> + * @author yinzuomei + * @date 2021/9/8 2:47 下午 + */ + @PostMapping("getcategory") + public Result> getCategory(@LoginUser TokenDto tokenDto,@RequestBody GuideCategoryDropDownFormDTO formDTO){ + formDTO.setCustomerId(tokenDto.getCustomerId()); + ValidatorUtils.validateEntity(formDTO,GuideCategoryDropDownFormDTO.AddUserInternalGroup.class); + return new Result>().ok(guideCategoryService.getCategory(formDTO)); + } + + + + + + + @GetMapping("{id}") public Result get(@PathVariable("id") String id){ GuideCategoryDTO data = guideCategoryService.get(id); diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/GuideCategoryDao.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/GuideCategoryDao.java index a6b9a24cc8..02d8bcbe43 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/GuideCategoryDao.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/GuideCategoryDao.java @@ -18,8 +18,13 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.GuideCategoryDTO; +import com.epmet.dto.result.GuideDictResDTO; import com.epmet.entity.GuideCategoryEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * 指南分类 @@ -29,5 +34,25 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface GuideCategoryDao extends BaseDao { - + + /** + * 工作端PC或者运营端分类列表查询,不分页 + * + * @param customerId + * @return java.util.List + * @author yinzuomei + * @date 2021/9/8 1:57 下午 + */ + List selectPageByCid(String customerId); + + /** + * 办事指南】可用分类列表 新增、编辑指南时的下拉框:展示未禁用的分类; 查询指南列表:如果禁用的分类下存在指南列表,则展示,不存在直接不展示 + * + * @param customerId + * @param queryOrigin + * @return java.util.List + * @author yinzuomei + * @date 2021/9/8 3:15 下午 + */ + List selectCategoryDict(@Param("customerId") String customerId, @Param("queryOrigin") String queryOrigin); } \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/GuideCategoryEntity.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/GuideCategoryEntity.java index 8231f9d5ef..c13a7a3df9 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/GuideCategoryEntity.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/GuideCategoryEntity.java @@ -18,18 +18,15 @@ 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; - /** * 指南分类 * * @author generator generator@elink-cn.com - * @since v1.0.0 2021-09-06 + * @since v1.0.0 2021-09-08 */ @Data @EqualsAndHashCode(callSuper=false) @@ -38,24 +35,29 @@ public class GuideCategoryEntity extends BaseEpmetEntity { private static final long serialVersionUID = 1L; - /** - * 客户id - */ + /** + * 客户id,产品默认配置此列存储default + */ private String customerId; - /** - * 分类名 - */ + /** + * 分类名,客户内唯一 + */ private String categoryName; - /** - * 排序 - */ + /** + * 分类编码:分类名的全拼; eg:gongjijin + */ + private String categoryCode; + + /** + * 排序 + */ private Integer sort; - /** - * 状态 禁用disable 启用enable - */ + /** + * 状态 禁用disable 启用enable + */ private String status; } diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/GuideCategoryService.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/GuideCategoryService.java index 84f995d0fd..22f9ecbc61 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/GuideCategoryService.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/GuideCategoryService.java @@ -20,6 +20,9 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; import com.epmet.dto.GuideCategoryDTO; +import com.epmet.dto.form.GuideCategoryDropDownFormDTO; +import com.epmet.dto.form.GuideCategoryPageFormDTO; +import com.epmet.dto.result.GuideDictResDTO; import com.epmet.entity.GuideCategoryEntity; import java.util.List; @@ -34,14 +37,24 @@ import java.util.Map; public interface GuideCategoryService extends BaseService { /** - * 默认分页 + * 【办事指南】分类列表-工作端PC和运营端用不分页 * - * @param params - * @return PageData - * @author generator - * @date 2021-09-06 + * @param formDTO + * @return com.epmet.commons.tools.utils.Result> + * @author yinzuomei + * @date 2021/9/8 1:33 下午 + */ + PageData page(GuideCategoryPageFormDTO formDTO); + + /** + * 办事指南】可用分类列表 新增、编辑指南时的下拉框:展示未禁用的分类; 查询指南列表:如果禁用的分类下存在指南列表,则展示,不存在直接不展示 + * + * @param formDTO + * @return java.util.List + * @author yinzuomei + * @date 2021/9/8 3:06 下午 */ - PageData page(Map params); + List getCategory(GuideCategoryDropDownFormDTO formDTO); /** * 默认查询 diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/GuideCategoryServiceImpl.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/GuideCategoryServiceImpl.java index 502f18571a..32e879790a 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/GuideCategoryServiceImpl.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/GuideCategoryServiceImpl.java @@ -18,15 +18,20 @@ package com.epmet.service.impl; 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.Constant; 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.GuideCategoryDao; import com.epmet.dto.GuideCategoryDTO; +import com.epmet.dto.form.GuideCategoryDropDownFormDTO; +import com.epmet.dto.form.GuideCategoryPageFormDTO; +import com.epmet.dto.result.GuideDictResDTO; import com.epmet.entity.GuideCategoryEntity; import com.epmet.service.GuideCategoryService; +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; @@ -45,15 +50,74 @@ import java.util.Map; public class GuideCategoryServiceImpl extends BaseServiceImpl implements GuideCategoryService { + /** + * 【办事指南】分类列表-工作端PC和运营端用不分页 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result> + * @author yinzuomei + * @date 2021/9/8 1:33 下午 + */ + @Transactional(rollbackFor = Exception.class) + @Override + public PageData page(GuideCategoryPageFormDTO formDTO) { + List list = baseDao.selectPageByCid(formDTO.getCustomerId()); + if (CollectionUtils.isEmpty(list) && !formDTO.getCustomerId().equals(Constant.DEFAULT_CUSTOMER)) { + //初始化默认的给客户 + initCustomerGuideCategory(formDTO.getCustomerId()); + list = baseDao.selectPageByCid(formDTO.getCustomerId()); + } + PageInfo pageInfo = new PageInfo<>(list); + return new PageData<>(list, pageInfo.getTotal()); + } + + /** + * 产品默认分类同步给客户,已经禁用的不同步 + * + * @param customerId + * @return void + * @author yinzuomei + * @date 2021/9/8 2:17 下午 + */ + private void initCustomerGuideCategory(String customerId) { + List list = baseDao.selectPageByCid(Constant.DEFAULT_CUSTOMER); + int sort = 1; + for (GuideCategoryDTO dto : list) { + // 已经禁用的,不同步给客户 + if (Constant.DISABLE.equals(dto.getStatus())) { + continue; + } + dto.setCustomerId(customerId); + //清空主键 + dto.setId(null); + dto.setSort(sort); + GuideCategoryEntity entity = ConvertUtils.sourceToTarget(dto, GuideCategoryEntity.class); + insert(entity); + sort++; + } + } + + + /** + * 办事指南】可用分类列表 新增、编辑指南时的下拉框:展示未禁用的分类; 查询指南列表:如果禁用的分类下存在指南列表,则展示,不存在直接不展示 + * + * @param formDTO + * @return java.util.List + * @author yinzuomei + * @date 2021/9/8 3:06 下午 + */ @Override - public PageData page(Map params) { - IPage page = baseDao.selectPage( - getPage(params, FieldConstant.CREATED_TIME, false), - getWrapper(params) - ); - return getPageData(page, GuideCategoryDTO.class); + public List getCategory(GuideCategoryDropDownFormDTO formDTO) { + List list=baseDao.selectCategoryDict(formDTO.getCustomerId(),formDTO.getQueryOrigin()); + if (CollectionUtils.isEmpty(list) && !formDTO.getCustomerId().equals(Constant.DEFAULT_CUSTOMER)) { + //初始化默认的给客户 + initCustomerGuideCategory(formDTO.getCustomerId()); + list=baseDao.selectCategoryDict(formDTO.getCustomerId(),formDTO.getQueryOrigin()); + } + return list; } + @Override public List list(Map params) { List entityList = baseDao.selectList(getWrapper(params)); diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/GuideCategoryDao.xml b/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/GuideCategoryDao.xml index dad8bb6c4c..6af20116bc 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/GuideCategoryDao.xml +++ b/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/GuideCategoryDao.xml @@ -3,19 +3,50 @@ - - - - - - - - - - - - - - + + + + \ No newline at end of file From 18c04e0ced3f4a4e494c1207704bd5927b637de7 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Wed, 8 Sep 2021 15:59:44 +0800 Subject: [PATCH 2/8] =?UTF-8?q?getcategory=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/epmet/dto/result/GuideDictResDTO.java | 3 +++ .../java/com/epmet/service/impl/GuideCategoryServiceImpl.java | 2 +- .../src/main/resources/mapper/GuideCategoryDao.xml | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/GuideDictResDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/GuideDictResDTO.java index 8b1cbdf94f..00f56ad3f9 100644 --- a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/GuideDictResDTO.java +++ b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/GuideDictResDTO.java @@ -1,5 +1,6 @@ package com.epmet.dto.result; +import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.Data; import java.io.Serializable; @@ -25,11 +26,13 @@ public class GuideDictResDTO implements Serializable { /** * 排序 */ + @JsonIgnore private Integer sort; /** * 状态 禁用disable 启用enable */ + @JsonIgnore private String status; } diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/GuideCategoryServiceImpl.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/GuideCategoryServiceImpl.java index 32e879790a..c876885d6c 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/GuideCategoryServiceImpl.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/GuideCategoryServiceImpl.java @@ -81,7 +81,7 @@ public class GuideCategoryServiceImpl extends BaseServiceImpl list = baseDao.selectPageByCid(Constant.DEFAULT_CUSTOMER); - int sort = 1; + int sort = 0; for (GuideCategoryDTO dto : list) { // 已经禁用的,不同步给客户 if (Constant.DISABLE.equals(dto.getStatus())) { diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/GuideCategoryDao.xml b/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/GuideCategoryDao.xml index 6af20116bc..08243e6558 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/GuideCategoryDao.xml +++ b/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/GuideCategoryDao.xml @@ -32,12 +32,12 @@ gc.category_code, gc.`STATUS`, gc.sort, - ( SELECT count( g.id ) FROM guide g WHERE g.CUSTOMER_ID = '' AND g.DEL_FLAG = '0' AND g.CATEGORY_CODE = gc.CATEGORY_CODE ) AS guideTotal + ( SELECT count( g.id ) FROM guide g WHERE g.CUSTOMER_ID = #{customerId} AND g.DEL_FLAG = '0' AND g.CATEGORY_CODE = gc.CATEGORY_CODE ) AS guideTotal FROM guide_category gc WHERE gc.DEL_FLAG = '0' - AND CUSTOMER_ID = 'default' + AND CUSTOMER_ID = #{customerId} ) temp WHERE temp.`STATUS` = 'enable' From 005487aebaf9e1a533c3f5d0547aabf7d60e4c7f Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Wed, 8 Sep 2021 16:47:27 +0800 Subject: [PATCH 3/8] =?UTF-8?q?=E5=88=86=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tools/exception/EpmetErrorCode.java | 1 + .../dto/form/EditGuideCategoryFormDTO.java | 47 ++++++++++++++ .../epmet/dto/form/GuideCateOrderFormDTO.java | 56 ++++++++++++++++ .../controller/GuideCategoryController.java | 65 ++++++++++++++----- .../java/com/epmet/dao/GuideCategoryDao.java | 34 ++++++++++ .../epmet/service/GuideCategoryService.java | 40 ++++++------ .../impl/GuideCategoryServiceImpl.java | 59 ++++++++++++----- .../resources/mapper/GuideCategoryDao.xml | 41 ++++++++++++ 8 files changed, 294 insertions(+), 49 deletions(-) create mode 100644 epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/EditGuideCategoryFormDTO.java create mode 100644 epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/GuideCateOrderFormDTO.java 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 4d717f919e..81350a74ba 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 @@ -74,6 +74,7 @@ public enum EpmetErrorCode { AREA_CODE_ALREADY_EXISTS(8208,"组织区划已被占用,请重新选择"), AGENCY_NAME_ALREADY_EXISTS(8209,"当前组织名称已存在,请重新修改"), SET_PARENT_AREA_CODE(8210,"请先设置上级组织区划"), + HAVE_GUIDE_CANNOT_DEL(8211,"当前分类已经存在办事指南,不允许删除"), REQUIRE_PERMISSION(8301, "您没有足够的操作权限"), THIRD_PLAT_REQUEST_ERROR(8302, "请求第三方平台错误"), diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/EditGuideCategoryFormDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/EditGuideCategoryFormDTO.java new file mode 100644 index 0000000000..eedb988ffe --- /dev/null +++ b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/EditGuideCategoryFormDTO.java @@ -0,0 +1,47 @@ +package com.epmet.dto.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; +import org.hibernate.validator.constraints.Length; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Description 编辑、禁用、删除统一入参 + * @Author yinzuomei + * @Date 2021/9/8 4:15 下午 + */ +@Data +public class EditGuideCategoryFormDTO implements Serializable { + private static final long serialVersionUID = -6853534660181580456L; + + public interface AddUserInternalGroup { + } + + public interface StatusGroup { + } + + public interface UpdateInfoGroup extends CustomerClientShowGroup { + } + + public interface DelGroup { + } + @NotBlank(message = "当前操作人id不能为空", groups = AddUserInternalGroup.class) + private String staffId; + + @NotBlank(message = "客户id不能为空",groups = DelGroup.class) + private String customerId; + + @NotBlank(message = "id不能为空", groups = AddUserInternalGroup.class) + private String id; + + @NotBlank(message = "status不能为空", groups = StatusGroup.class) + private String status; + + @NotBlank(message = "分类名称不能为空不能为空", groups = UpdateInfoGroup.class) + @Length(max = 10, message = "分类名称最多填入10个字", groups = UpdateInfoGroup.class) + private String categoryName; + +} + diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/GuideCateOrderFormDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/GuideCateOrderFormDTO.java new file mode 100644 index 0000000000..6b66e9f7c5 --- /dev/null +++ b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/GuideCateOrderFormDTO.java @@ -0,0 +1,56 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import java.io.Serializable; +import java.util.List; + +/** + * @Description 分类排序入参DTO + * @Author yinzuomei + * @Date 2021/9/8 4:03 下午 + */ +@Data +public class GuideCateOrderFormDTO implements Serializable { + private static final long serialVersionUID = 8671295475212569124L; + + public interface AddUserInternalGroup { + } + + @NotBlank(message = "当前操作人id不能为空", groups = AddUserInternalGroup.class) + private String staffId; + + + @NotEmpty(message = "顺序不能为空", groups = {AddUserInternalGroup.class}) + private List orderList; + + /** + * 排序索引号dto + */ + public static class OrderIndexDTO { + private String id; + private Integer orderIndex; + + public OrderIndexDTO() { + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public Integer getOrderIndex() { + return orderIndex; + } + + public void setOrderIndex(Integer orderIndex) { + this.orderIndex = orderIndex; + } + } +} + diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/GuideCategoryController.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/GuideCategoryController.java index e34e38770a..b29c853eec 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/GuideCategoryController.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/GuideCategoryController.java @@ -21,12 +21,13 @@ import com.epmet.commons.tools.annotation.LoginUser; 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; 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.GuideCategoryDTO; +import com.epmet.dto.form.EditGuideCategoryFormDTO; +import com.epmet.dto.form.GuideCateOrderFormDTO; import com.epmet.dto.form.GuideCategoryDropDownFormDTO; import com.epmet.dto.form.GuideCategoryPageFormDTO; import com.epmet.dto.result.GuideDictResDTO; @@ -81,17 +82,58 @@ public class GuideCategoryController { } + /** + * 保存排序 + * + * @param tokenDto + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @author yinzuomei + * @date 2021/9/8 4:09 下午 + */ + @PostMapping("saveorder") + public Result saveOrder(@LoginUser TokenDto tokenDto,@RequestBody GuideCateOrderFormDTO formDTO){ + formDTO.setStaffId(tokenDto.getUserId()); + ValidatorUtils.validateEntity(formDTO,GuideCateOrderFormDTO.AddUserInternalGroup.class); + guideCategoryService.saveOrder(formDTO); + return new Result(); + } + /** + * 禁用或者启用分类 + * + * @param tokenDto + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @author yinzuomei + * @date 2021/9/8 4:19 下午 + */ + @PostMapping("disable") + public Result disable(@LoginUser TokenDto tokenDto,@RequestBody EditGuideCategoryFormDTO formDTO){ + formDTO.setStaffId(tokenDto.getUserId()); + ValidatorUtils.validateEntity(formDTO,EditGuideCategoryFormDTO.AddUserInternalGroup.class,EditGuideCategoryFormDTO.StatusGroup.class); + guideCategoryService.disableGuideCategory(formDTO); + return new Result(); + } - - - - @GetMapping("{id}") - public Result get(@PathVariable("id") String id){ - GuideCategoryDTO data = guideCategoryService.get(id); - return new Result().ok(data); + /** + * 删除分类,已经存在指南的不允许删除,给予提示 + * + * @param tokenDto + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @author yinzuomei + * @date 2021/9/8 4:45 下午 + */ + @PostMapping("delete") + public Result delete(@LoginUser TokenDto tokenDto,@RequestBody EditGuideCategoryFormDTO formDTO){ + formDTO.setStaffId(tokenDto.getUserId()); + ValidatorUtils.validateEntity(formDTO,EditGuideCategoryFormDTO.AddUserInternalGroup.class,EditGuideCategoryFormDTO.DelGroup.class); + guideCategoryService.delete(formDTO); + return new Result(); } + @PostMapping public Result save(@RequestBody GuideCategoryDTO dto){ //效验数据 @@ -108,12 +150,5 @@ public class GuideCategoryController { return new Result(); } - @DeleteMapping - public Result delete(@RequestBody String[] ids){ - //效验数据 - AssertUtils.isArrayEmpty(ids, "id"); - guideCategoryService.delete(ids); - return new Result(); - } } \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/GuideCategoryDao.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/GuideCategoryDao.java index 02d8bcbe43..7f66753eca 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/GuideCategoryDao.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/GuideCategoryDao.java @@ -55,4 +55,38 @@ public interface GuideCategoryDao extends BaseDao { * @date 2021/9/8 3:15 下午 */ List selectCategoryDict(@Param("customerId") String customerId, @Param("queryOrigin") String queryOrigin); + + /** + * 保存排序 + * + * @param id + * @param orderIndex + * @param staffId + * @return int + * @author yinzuomei + * @date 2021/9/8 4:11 下午 + */ + int updateOrder(@Param("id") String id, @Param("orderIndex") Integer orderIndex, @Param("staffId") String staffId); + + /** + * 启用或者禁用 + * + * @param id + * @param status + * @param staffId + * @return int + * @author yinzuomei + * @date 2021/9/8 4:22 下午 + */ + int updateStatus(@Param("id") String id, @Param("status")String status, @Param("staffId")String staffId); + + /** + * 查询这个分类下的项目数 + * + * @param id + * @return int + * @author yinzuomei + * @date 2021/9/8 4:36 下午 + */ + int selectGuideTotal(@Param("id") String id,@Param("customerId") String customerId); } \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/GuideCategoryService.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/GuideCategoryService.java index 22f9ecbc61..905ea44517 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/GuideCategoryService.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/GuideCategoryService.java @@ -20,13 +20,14 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; import com.epmet.dto.GuideCategoryDTO; +import com.epmet.dto.form.EditGuideCategoryFormDTO; +import com.epmet.dto.form.GuideCateOrderFormDTO; import com.epmet.dto.form.GuideCategoryDropDownFormDTO; import com.epmet.dto.form.GuideCategoryPageFormDTO; import com.epmet.dto.result.GuideDictResDTO; import com.epmet.entity.GuideCategoryEntity; import java.util.List; -import java.util.Map; /** * 指南分类 @@ -57,24 +58,25 @@ public interface GuideCategoryService extends BaseService { List getCategory(GuideCategoryDropDownFormDTO formDTO); /** - * 默认查询 + * 保存排序 * - * @param params - * @return java.util.List - * @author generator - * @date 2021-09-06 + * @param formDTO + * @return void + * @author yinzuomei + * @date 2021/9/8 4:09 下午 */ - List list(Map params); + void saveOrder(GuideCateOrderFormDTO formDTO); + /** - * 单条查询 + * 启用或者禁用分类 * - * @param id - * @return GuideCategoryDTO - * @author generator - * @date 2021-09-06 + * @param formDTO + * @return int + * @author yinzuomei + * @date 2021/9/8 4:20 下午 */ - GuideCategoryDTO get(String id); + void disableGuideCategory(EditGuideCategoryFormDTO formDTO); /** * 默认保存 @@ -97,12 +99,12 @@ public interface GuideCategoryService extends BaseService { void update(GuideCategoryDTO dto); /** - * 批量删除 + * 删除分类,存在办事指南的不允许删除,给予提示 * - * @param ids - * @return void - * @author generator - * @date 2021-09-06 + * @param formDTO + * @return void + * @author yinzuomei + * @date 2021/9/8 4:34 下午 */ - void delete(String[] ids); + void delete(EditGuideCategoryFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/GuideCategoryServiceImpl.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/GuideCategoryServiceImpl.java index c876885d6c..020ee7848b 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/GuideCategoryServiceImpl.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/GuideCategoryServiceImpl.java @@ -21,10 +21,14 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.Constant; import com.epmet.commons.tools.constant.FieldConstant; +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.utils.ConvertUtils; import com.epmet.dao.GuideCategoryDao; import com.epmet.dto.GuideCategoryDTO; +import com.epmet.dto.form.EditGuideCategoryFormDTO; +import com.epmet.dto.form.GuideCateOrderFormDTO; import com.epmet.dto.form.GuideCategoryDropDownFormDTO; import com.epmet.dto.form.GuideCategoryPageFormDTO; import com.epmet.dto.result.GuideDictResDTO; @@ -36,7 +40,6 @@ import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.util.Arrays; import java.util.List; import java.util.Map; @@ -117,12 +120,33 @@ public class GuideCategoryServiceImpl extends BaseServiceImpl list(Map params) { - List entityList = baseDao.selectList(getWrapper(params)); + public void saveOrder(GuideCateOrderFormDTO formDTO) { + for (GuideCateOrderFormDTO.OrderIndexDTO idx : formDTO.getOrderList()) { + baseDao.updateOrder(idx.getId(), idx.getOrderIndex(),formDTO.getStaffId()); + } + } - return ConvertUtils.sourceToTarget(entityList, GuideCategoryDTO.class); + /** + * 启用或者禁用分类 + * + * @param formDTO + * @return int + * @author yinzuomei + * @date 2021/9/8 4:20 下午 + */ + @Override + public void disableGuideCategory(EditGuideCategoryFormDTO formDTO) { + baseDao.updateStatus(formDTO.getId(), formDTO.getStatus(),formDTO.getStaffId()); } private QueryWrapper getWrapper(Map params){ @@ -134,12 +158,6 @@ public class GuideCategoryServiceImpl extends BaseServiceImpl0){ + throw new RenException(EpmetErrorCode.HAVE_GUIDE_CANNOT_DEL.getCode(),EpmetErrorCode.HAVE_GUIDE_CANNOT_DEL.getMsg()); + } + baseDao.deleteById(formDTO.getId()); } + } \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/GuideCategoryDao.xml b/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/GuideCategoryDao.xml index 08243e6558..6baff0aed8 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/GuideCategoryDao.xml +++ b/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/GuideCategoryDao.xml @@ -49,4 +49,45 @@ ORDER BY temp.sort ASC + + + + + update guide_category + set SORT=#{orderIndex}, + UPDATED_BY=#{staffId}, + UPDATED_TIME=NOW() + where id=#{id} + and del_flag='0' + + + + + update guide_category + set status=#{status}, + UPDATED_BY=#{staffId}, + UPDATED_TIME=NOW() + where id=#{id} + and del_flag='0' + + + + \ No newline at end of file From b0eb2dc7adb4c5533de1ce9e30de8e26adb3352f Mon Sep 17 00:00:00 2001 From: zhaoqifeng Date: Wed, 8 Sep 2021 17:13:19 +0800 Subject: [PATCH 4/8] =?UTF-8?q?=E5=AE=A2=E6=88=B7=E4=B8=8B=E7=BB=84?= =?UTF-8?q?=E7=BB=87=E6=A0=91=20=E5=B7=A5=E4=BD=9C=E4=BA=BA=E5=91=98?= =?UTF-8?q?=E6=89=80=E5=9C=A8=E7=BB=84=E7=BB=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/dto/result/AgencyTreeResultDTO.java | 31 +++++++++++ .../dto/result/StaffOrgListResultDTO.java | 27 ++++++++++ .../controller/CustomerAgencyController.java | 12 +++++ .../com/epmet/controller/StaffController.java | 12 +++++ .../java/com/epmet/dao/CustomerAgencyDao.java | 4 ++ .../epmet/service/CustomerAgencyService.java | 10 ++++ .../java/com/epmet/service/StaffService.java | 9 ++++ .../impl/CustomerAgencyServiceImpl.java | 14 +++++ .../epmet/service/impl/StaffServiceImpl.java | 51 ++++++++++++++++++- .../resources/mapper/CustomerAgencyDao.xml | 35 +++++++++++++ 10 files changed, 203 insertions(+), 2 deletions(-) create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyTreeResultDTO.java create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffOrgListResultDTO.java diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyTreeResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyTreeResultDTO.java new file mode 100644 index 0000000000..896ebfb57c --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyTreeResultDTO.java @@ -0,0 +1,31 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @Description + * @Author zhaoqifeng + * @Date 2021/9/8 15:06 + */ +@Data +public class AgencyTreeResultDTO implements Serializable { + private static final long serialVersionUID = -311212619121062367L; + /** + * 机关组织Id + */ + private String agencyId; + + /** + * 机关组织名称 + */ + private String agencyName; + + private String pid; + /** + * 下级机关组织 + */ + private List subAgencyList; +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffOrgListResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffOrgListResultDTO.java new file mode 100644 index 0000000000..2473c623fd --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffOrgListResultDTO.java @@ -0,0 +1,27 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description + * @Author zhaoqifeng + * @Date 2021/9/8 15:11 + */ +@Data +public class StaffOrgListResultDTO implements Serializable { + private static final long serialVersionUID = -7717333635633000120L; + /** + * 组织ID + */ + private String orgId; + /** + * 组织名称 + */ + private String orgName; + /** + * 组织类型机关agency 网格grid 部门dept + */ + private String orgType; +} 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 70c254ee26..11d5e13542 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 @@ -324,4 +324,16 @@ public class CustomerAgencyController { return new Result().ok(customerAgencyService.getAgencyInfo(formDTO)); } + /** + * @Description 获取客户下组织树 + * @Param tokenDTO + * @Return {@link Result< AgencyTreeResultDTO >} + * @Author zhaoqifeng + * @Date 2021/9/8 15:20 + */ + @PostMapping("agencylist") + public Result getAgencyList(@LoginUser TokenDto tokenDTO) { + return new Result().ok(customerAgencyService.getAgencyList(tokenDTO)); + } + } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/StaffController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/StaffController.java index b95b96c0b9..6d3b50b408 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/StaffController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/StaffController.java @@ -195,4 +195,16 @@ public class StaffController { return staffService.addStaffV2(fromDTO); } + /** + * @Description 用户所属组织 + * @Param tokenDto + * @Return {@link Result< StaffOrgListResultDTO>} + * @Author zhaoqifeng + * @Date 2021/9/8 16:55 + */ + @PostMapping("orgList") + public Result> staffOrgList(@LoginUser TokenDto tokenDto) { + return new Result>().ok(staffService.staffOrgList(tokenDto)); + } + } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java index b0149c28d8..145178f50f 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java @@ -239,4 +239,8 @@ public interface CustomerAgencyDao extends BaseDao { * @author sun */ OrgResultDTO selectAgencyDetail(@Param("orgId") String orgId, @Param("orgType") String orgType); + + AgencyTreeResultDTO getAllAgency(@Param("customerId") String customerId); + + List getSubAgencyList(@Param("pid") String pid); } \ 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 aaa691f239..c1a1915a72 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 @@ -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.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerAgencyDTO; import com.epmet.dto.form.*; @@ -245,4 +246,13 @@ public interface CustomerAgencyService extends BaseService * @Date 2021/9/7 15:28 */ OrgResultDTO getAgencyInfo(OrgFormDTO formDTO); + + /** + * @Description 获取客户下组织树 + * @Param tokenDTO + * @Return {@link AgencyTreeResultDTO} + * @Author zhaoqifeng + * @Date 2021/9/8 15:21 + */ + AgencyTreeResultDTO getAgencyList(TokenDto tokenDTO); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/StaffService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/StaffService.java index d88298dfbf..ccd998c0fc 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/StaffService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/StaffService.java @@ -129,4 +129,13 @@ public interface StaffService { * @author sun */ Result addStaffV2(AddStaffV2FromDTO fromDTO); + + /** + * @Description 工作人员所属组织 + * @Param tokenDto + * @Return {@link StaffOrgListResultDTO} + * @Author zhaoqifeng + * @Date 2021/9/8 16:57 + */ + List staffOrgList(TokenDto tokenDto); } 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 554d263173..4f1de1ae91 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 @@ -25,6 +25,7 @@ import com.epmet.commons.tools.constant.NumConstant; 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.security.dto.TokenDto; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.constant.CustomerAgencyConstant; @@ -1089,4 +1090,17 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl staffOrgList(TokenDto tokenDto) { + //redis获取工作人员信息 + CustomerStaffInfoCacheResult staffInfoCache = CustomerStaffRedis.getStaffInfo(tokenDto.getCustomerId(), tokenDto.getUserId()); + if (null == staffInfoCache) { + return Collections.emptyList(); + } + List list = new ArrayList<>(); + //工作人员所在组织 + StaffOrgListResultDTO agency = new StaffOrgListResultDTO(); + agency.setOrgId(staffInfoCache.getAgencyId()); + agency.setOrgName(staffInfoCache.getAgencyName()); + agency.setOrgType(OrgInfoConstant.AGENCY); + list.add(agency); + //工作人员所在部门 + if(CollectionUtils.isNotEmpty(staffInfoCache.getDeptList())) { + List deptList = staffInfoCache.getDeptList().stream().map(item -> { + StaffOrgListResultDTO dto = new StaffOrgListResultDTO(); + dto.setOrgId(item.getId()); + dto.setOrgName(item.getName()); + dto.setOrgType(OrgInfoConstant.DEPT); + return dto; + }).collect(Collectors.toList()); + list.addAll(deptList); + } + //工作人员所在网格 + if(CollectionUtils.isNotEmpty(staffInfoCache.getGridList())) { + List gridList = staffInfoCache.getGridList().stream().map(item -> { + StaffOrgListResultDTO dto = new StaffOrgListResultDTO(); + dto.setOrgId(item.getId()); + dto.setOrgName(item.getName()); + dto.setOrgType(OrgInfoConstant.GRID); + return dto; + }).collect(Collectors.toList()); + list.addAll(gridList); + } + return list; + } + } diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml index a30207d922..2799ea36a0 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml @@ -503,5 +503,40 @@ + + + + + + + + + + + + \ No newline at end of file From 6e79562bffdab748cd812f25715755892c6d9ec0 Mon Sep 17 00:00:00 2001 From: zhaoqifeng Date: Wed, 8 Sep 2021 17:26:52 +0800 Subject: [PATCH 5/8] =?UTF-8?q?=E5=8A=9E=E4=BA=8B=E6=8C=87=E5=8D=97?= =?UTF-8?q?=E9=99=84=E4=BB=B6=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/controller/OssController.java | 31 +++++++++++++++++++ .../java/com/epmet/utils/ModuleConstant.java | 1 + 2 files changed, 32 insertions(+) diff --git a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/OssController.java b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/OssController.java index 4fc64984c9..8ab04b8758 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/OssController.java +++ b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/OssController.java @@ -401,4 +401,35 @@ public class OssController { return ossService.uploadImgV2(file, PrivacyType.EXTERNAL, customerId); } + /** + * @Description 办事指南上传附件 + * @Param file + * @Param customerId + * @Return {@link Result< UploadImgResultDTO>} + * @Author zhaoqifeng + * @Date 2021/9/8 17:14 + */ + @PostMapping("upload-guide-file") + public Result uploadGuideFile(@RequestPart(value = "file") MultipartFile file, @RequestParam("customerId") String customerId) { + String fileName = file.getOriginalFilename(); + String format = "-" + fileName.substring(fileName.lastIndexOf(".") + NumConstant.ONE) + "-"; + format = format.toLowerCase(); + // 体积限制 + int sizeMb = 10; + // 大小限制10m + int sizeThreshold = sizeMb * 1024 * 1024; + if (file.getSize() > sizeThreshold) { + throw new RenException(EpmetErrorCode.OPER_UPLOAD_FILE_OVER_SIZE.getCode(), + EpmetErrorCode.OPER_UPLOAD_FILE_OVER_SIZE.getMsg().concat(",限制在").concat(String.valueOf(sizeMb)).concat("M以内")); + } + + // 格式限制,只允许png和jpeg + if (!ModuleConstant.GUIDE_FILE_DOC.contains(format)) { + throw new RenException(EpmetErrorCode.OPER_UPLOAD_FILE_TYPE_ERROR.getCode() + , EpmetErrorCode.OPER_UPLOAD_FILE_TYPE_ERROR.getMsg()); + } + + return ossService.uploadImgV2(file, PrivacyType.EXTERNAL, customerId); + } + } diff --git a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/utils/ModuleConstant.java b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/utils/ModuleConstant.java index 07a11d9ed7..71d5f177e2 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/utils/ModuleConstant.java +++ b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/utils/ModuleConstant.java @@ -43,6 +43,7 @@ public interface ModuleConstant extends Constant { * 项目附件-允许的文件类型 */ String PROJECT_FILE_DOC = "-pdf-ppt-pptx-doc-docx-xls-xlsx-"; + String GUIDE_FILE_DOC = "-pdf-doc-docx-xls-xlsx-"; /** * 项目附件-允许的音频类型 */ From 0fe294e7dc5432c2427a11bb9e7d45e60f49ba2b Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Wed, 8 Sep 2021 17:58:07 +0800 Subject: [PATCH 6/8] qihuo --- epmet-commons/epmet-commons-tools/pom.xml | 6 +++ .../tools/exception/EpmetErrorCode.java | 1 + .../commons/tools/utils}/Pinyin4jUtil.java | 13 ++--- .../epmet/model/IndexExcelDataListener.java | 2 +- .../main/java/com/epmet/model/IndexModel.java | 2 +- .../dto/form/EditGuideCategoryFormDTO.java | 10 ++-- .../controller/GuideCategoryController.java | 49 +++++++++++++------ .../java/com/epmet/dao/GuideCategoryDao.java | 6 +++ .../epmet/service/GuideCategoryService.java | 4 +- .../impl/GuideCategoryServiceImpl.java | 42 +++++++++++++--- .../resources/mapper/GuideCategoryDao.xml | 37 ++++++++++++++ .../dto/result/StaffBasicInfoResultDTO.java | 7 +++ .../java/com/epmet/dao/CustomerStaffDao.java | 2 + .../impl/CustomerStaffServiceImpl.java | 3 ++ .../resources/mapper/CustomerStaffDao.xml | 10 ++++ 15 files changed, 159 insertions(+), 35 deletions(-) rename {epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/util => epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils}/Pinyin4jUtil.java (94%) diff --git a/epmet-commons/epmet-commons-tools/pom.xml b/epmet-commons/epmet-commons-tools/pom.xml index d8073505ce..ae545279f9 100644 --- a/epmet-commons/epmet-commons-tools/pom.xml +++ b/epmet-commons/epmet-commons-tools/pom.xml @@ -163,6 +163,12 @@ com.squareup.okhttp3 okhttp + + io.github.wnjustdoit + pinyin4j + 2.6.0 + compile + 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 81350a74ba..5efb12edb9 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 @@ -75,6 +75,7 @@ public enum EpmetErrorCode { AGENCY_NAME_ALREADY_EXISTS(8209,"当前组织名称已存在,请重新修改"), SET_PARENT_AREA_CODE(8210,"请先设置上级组织区划"), HAVE_GUIDE_CANNOT_DEL(8211,"当前分类已经存在办事指南,不允许删除"), + GUIDE_CATEGORY_NAME_EXITS(8212,"分类已存在"), REQUIRE_PERMISSION(8301, "您没有足够的操作权限"), THIRD_PLAT_REQUEST_ERROR(8302, "请求第三方平台错误"), diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/util/Pinyin4jUtil.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/Pinyin4jUtil.java similarity index 94% rename from epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/util/Pinyin4jUtil.java rename to epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/Pinyin4jUtil.java index 8d392a2c21..103baa6b0d 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/util/Pinyin4jUtil.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/Pinyin4jUtil.java @@ -1,4 +1,4 @@ -package com.epmet.util; +package com.epmet.commons.tools.utils; import net.sourceforge.pinyin4j.PinyinHelper; import net.sourceforge.pinyin4j.format.HanyuPinyinCaseType; @@ -42,7 +42,7 @@ public class Pinyin4jUtil { */ public static String getFirstSpellPinYin(String src, boolean isFullSpell) { String targetStr = Pinyin4jUtil.makeStringByStringSet(Pinyin4jUtil.getPinyin(src, isFullSpell, 1)); - System.out.println(targetStr); + System.out.println("targetStr="+targetStr); String[] split = targetStr.split(","); if (split.length > 1) { targetStr = split[0]; @@ -59,7 +59,7 @@ public class Pinyin4jUtil { */ public static String getSpellPinYin(String src, boolean isFullSpell,Integer preFont) { String targetStr = Pinyin4jUtil.makeStringByStringSet(Pinyin4jUtil.getPinyin(src, isFullSpell, preFont)); - System.out.println(targetStr); + System.out.println("targetStr="+targetStr); String[] split = targetStr.split(","); if (split.length > 1) { targetStr = split[0]; @@ -196,8 +196,9 @@ public class Pinyin4jUtil { } public static void main(String[] args) { - System.out.println(getFirstSpellPinYin("区直部门",false)); - System.out.println(getSpellPinYin("党员提出话题数",false,4)); - System.out.println(getSpellPinYin("社区超期项目数",false,4)); + //System.out.println(getSpellPinYin("社区超期项目数",true,0)); + System.out.println(getFirstSpellPinYin("区直部门",true)); + //System.out.println(getSpellPinYin("党员提出话题数",false,4)); + //System.out.println(getSpellPinYin("社区超期项目数",false,4)); } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/model/IndexExcelDataListener.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/model/IndexExcelDataListener.java index 3fe392276f..690543f0d2 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/model/IndexExcelDataListener.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/model/IndexExcelDataListener.java @@ -4,6 +4,7 @@ import com.alibaba.excel.context.AnalysisContext; import com.alibaba.excel.event.AnalysisEventListener; import com.alibaba.fastjson.JSON; import com.epmet.commons.tools.constant.StrConstant; +import com.epmet.commons.tools.utils.Pinyin4jUtil; import com.epmet.commons.tools.utils.UniqueIdGenerator; import com.epmet.entity.evaluationindex.screen.IndexDictEntity; import com.epmet.entity.evaluationindex.screen.IndexGroupDetailTemplateEntity; @@ -13,7 +14,6 @@ import com.epmet.service.evaluationindex.screen.IndexGroupDetailService; import com.epmet.service.evaluationindex.screen.IndexGroupDetailTemplateService; import com.epmet.service.evaluationindex.screen.IndexGroupTemplateService; import com.epmet.support.normalizing.Correlation; -import com.epmet.util.Pinyin4jUtil; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/model/IndexModel.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/model/IndexModel.java index cc1aed7759..b1860f8dfc 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/model/IndexModel.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/model/IndexModel.java @@ -2,7 +2,7 @@ package com.epmet.model; import com.alibaba.excel.annotation.ExcelProperty; import com.epmet.commons.tools.constant.StrConstant; -import com.epmet.util.Pinyin4jUtil; +import com.epmet.commons.tools.utils.Pinyin4jUtil; import lombok.Data; @Data diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/EditGuideCategoryFormDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/EditGuideCategoryFormDTO.java index eedb988ffe..79286ba45f 100644 --- a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/EditGuideCategoryFormDTO.java +++ b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/EditGuideCategoryFormDTO.java @@ -24,23 +24,25 @@ public class EditGuideCategoryFormDTO implements Serializable { public interface UpdateInfoGroup extends CustomerClientShowGroup { } + public interface SaveInfoGroup extends CustomerClientShowGroup { + } public interface DelGroup { } @NotBlank(message = "当前操作人id不能为空", groups = AddUserInternalGroup.class) private String staffId; - @NotBlank(message = "客户id不能为空",groups = DelGroup.class) + @NotBlank(message = "客户id不能为空",groups = {DelGroup.class,UpdateInfoGroup.class,SaveInfoGroup.class}) private String customerId; - @NotBlank(message = "id不能为空", groups = AddUserInternalGroup.class) + @NotBlank(message = "id不能为空", groups = {StatusGroup.class,DelGroup.class,UpdateInfoGroup.class}) private String id; @NotBlank(message = "status不能为空", groups = StatusGroup.class) private String status; - @NotBlank(message = "分类名称不能为空不能为空", groups = UpdateInfoGroup.class) - @Length(max = 10, message = "分类名称最多填入10个字", groups = UpdateInfoGroup.class) + @NotBlank(message = "分类名称不能为空不能为空", groups = {UpdateInfoGroup.class,SaveInfoGroup.class}) + @Length(max = 10, message = "分类名称最多填入10个字", groups = {UpdateInfoGroup.class,SaveInfoGroup.class}) private String categoryName; } diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/GuideCategoryController.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/GuideCategoryController.java index b29c853eec..7015ade670 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/GuideCategoryController.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/GuideCategoryController.java @@ -22,9 +22,6 @@ 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.ValidatorUtils; -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.GuideCategoryDTO; import com.epmet.dto.form.EditGuideCategoryFormDTO; import com.epmet.dto.form.GuideCateOrderFormDTO; @@ -33,7 +30,10 @@ import com.epmet.dto.form.GuideCategoryPageFormDTO; import com.epmet.dto.result.GuideDictResDTO; import com.epmet.service.GuideCategoryService; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; import java.util.List; @@ -111,7 +111,7 @@ public class GuideCategoryController { @PostMapping("disable") public Result disable(@LoginUser TokenDto tokenDto,@RequestBody EditGuideCategoryFormDTO formDTO){ formDTO.setStaffId(tokenDto.getUserId()); - ValidatorUtils.validateEntity(formDTO,EditGuideCategoryFormDTO.AddUserInternalGroup.class,EditGuideCategoryFormDTO.StatusGroup.class); + ValidatorUtils.validateEntity(formDTO,EditGuideCategoryFormDTO.StatusGroup.class,EditGuideCategoryFormDTO.AddUserInternalGroup.class); guideCategoryService.disableGuideCategory(formDTO); return new Result(); } @@ -134,19 +134,38 @@ public class GuideCategoryController { } - @PostMapping - public Result save(@RequestBody GuideCategoryDTO dto){ - //效验数据 - ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); - guideCategoryService.save(dto); + /** + * 新增分类,名称和编码客户内唯一 + * + * @param tokenDto + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @author yinzuomei + * @date 2021/9/8 5:11 下午 + */ + @PostMapping("save") + public Result save(@LoginUser TokenDto tokenDto,@RequestBody EditGuideCategoryFormDTO formDTO){ + formDTO.setStaffId(tokenDto.getUserId()); + ValidatorUtils.validateEntity(formDTO,EditGuideCategoryFormDTO.AddUserInternalGroup.class,EditGuideCategoryFormDTO.SaveInfoGroup.class); + guideCategoryService.save(formDTO); return new Result(); } - @PutMapping - public Result update(@RequestBody GuideCategoryDTO dto){ - //效验数据 - ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); - guideCategoryService.update(dto); + + /** + * 编辑名称 + * + * @param tokenDto + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @author yinzuomei + * @date 2021/9/8 5:37 下午 + */ + @PostMapping("update") + public Result update(@LoginUser TokenDto tokenDto,@RequestBody EditGuideCategoryFormDTO formDTO){ + formDTO.setStaffId(tokenDto.getUserId()); + ValidatorUtils.validateEntity(formDTO,EditGuideCategoryFormDTO.AddUserInternalGroup.class,EditGuideCategoryFormDTO.UpdateInfoGroup.class); + guideCategoryService.update(formDTO); return new Result(); } diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/GuideCategoryDao.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/GuideCategoryDao.java index 7f66753eca..71f757fd23 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/GuideCategoryDao.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/GuideCategoryDao.java @@ -89,4 +89,10 @@ public interface GuideCategoryDao extends BaseDao { * @date 2021/9/8 4:36 下午 */ int selectGuideTotal(@Param("id") String id,@Param("customerId") String customerId); + + int selectCategoryName(@Param("categoryName") String categoryName, @Param("customerId")String customerId, @Param("excludeId") String excludeId); + + int selectCurrentOrder(String customerId); + + int selectCategoryCode(@Param("categoryCode") String categoryCode, @Param("customerId")String customerId, @Param("excludeId") String excludeId); } \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/GuideCategoryService.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/GuideCategoryService.java index 905ea44517..f652f1036a 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/GuideCategoryService.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/GuideCategoryService.java @@ -86,7 +86,7 @@ public interface GuideCategoryService extends BaseService { * @author generator * @date 2021-09-06 */ - void save(GuideCategoryDTO dto); + void save(EditGuideCategoryFormDTO dto); /** * 默认更新 @@ -96,7 +96,7 @@ public interface GuideCategoryService extends BaseService { * @author generator * @date 2021-09-06 */ - void update(GuideCategoryDTO dto); + void update(EditGuideCategoryFormDTO dto); /** * 删除分类,存在办事指南的不允许删除,给予提示 diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/GuideCategoryServiceImpl.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/GuideCategoryServiceImpl.java index 020ee7848b..44ceab9717 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/GuideCategoryServiceImpl.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/GuideCategoryServiceImpl.java @@ -25,6 +25,7 @@ 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.utils.ConvertUtils; +import com.epmet.commons.tools.utils.Pinyin4jUtil; import com.epmet.dao.GuideCategoryDao; import com.epmet.dto.GuideCategoryDTO; import com.epmet.dto.form.EditGuideCategoryFormDTO; @@ -158,20 +159,49 @@ public class GuideCategoryServiceImpl extends BaseServiceImpl 0) { + throw new RenException(EpmetErrorCode.GUIDE_CATEGORY_NAME_EXITS.getCode(), EpmetErrorCode.GUIDE_CATEGORY_NAME_EXITS.getMsg()); + } + String categoryCode = Pinyin4jUtil.getFirstSpellPinYin(dto.getCategoryName(), true); + if (baseDao.selectCategoryCode(categoryCode, dto.getCustomerId(), null) > 0) { + throw new RenException(EpmetErrorCode.GUIDE_CATEGORY_NAME_EXITS.getCode(), EpmetErrorCode.GUIDE_CATEGORY_NAME_EXITS.getMsg()); + } + GuideCategoryEntity entity = new GuideCategoryEntity(); + entity.setCustomerId(dto.getCustomerId()); + entity.setCategoryName(dto.getCategoryName()); + entity.setCategoryCode(categoryCode); + int currentMax = baseDao.selectCurrentOrder(dto.getCustomerId()); + entity.setSort(currentMax == 0 ? currentMax : currentMax + 1); + entity.setStatus(Constant.ENABLE); insert(entity); } @Override @Transactional(rollbackFor = Exception.class) - public void update(GuideCategoryDTO dto) { - GuideCategoryEntity entity = ConvertUtils.sourceToTarget(dto, GuideCategoryEntity.class); - updateById(entity); + public void update(EditGuideCategoryFormDTO dto) { + if (baseDao.selectCategoryName(dto.getCategoryName().trim(), dto.getCustomerId(), dto.getId()) > 0) { + throw new RenException(EpmetErrorCode.GUIDE_CATEGORY_NAME_EXITS.getCode(), EpmetErrorCode.GUIDE_CATEGORY_NAME_EXITS.getMsg()); + } + String categoryCode = Pinyin4jUtil.getFirstSpellPinYin(dto.getCategoryName(), true); + if (baseDao.selectCategoryCode(categoryCode, dto.getCustomerId(), dto.getId()) > 0) { + throw new RenException(EpmetErrorCode.GUIDE_CATEGORY_NAME_EXITS.getCode(), EpmetErrorCode.GUIDE_CATEGORY_NAME_EXITS.getMsg()); + } + GuideCategoryEntity origin=baseDao.selectById(dto.getId()); + origin.setCategoryCode(categoryCode); + origin.setCategoryName(dto.getCategoryName()); + updateById(origin); } - /** * 删除分类,存在办事指南的不允许删除,给予提示 * diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/GuideCategoryDao.xml b/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/GuideCategoryDao.xml index 6baff0aed8..7bd2f78df8 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/GuideCategoryDao.xml +++ b/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/GuideCategoryDao.xml @@ -90,4 +90,41 @@ AND gc.id = #{id} ) + + + + + \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/StaffBasicInfoResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/StaffBasicInfoResultDTO.java index 04962a5396..7de2636450 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/StaffBasicInfoResultDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/StaffBasicInfoResultDTO.java @@ -3,6 +3,7 @@ package com.epmet.dto.result; import lombok.Data; import java.io.Serializable; +import java.util.List; /** * 获取pc工作端登陆用户信息 @@ -60,4 +61,10 @@ public class StaffBasicInfoResultDTO implements Serializable { * 状态 0:停用 1:正常 */ private Integer status; + + /** + * 工作人员的所有角色key,09.08新增:工作端PC端用到了 + */ + private List roleList; + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java index d0679eb2b6..97e4bf7424 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java @@ -213,4 +213,6 @@ public interface CustomerStaffDao extends BaseDao { * @return */ List listDTOS(@Param("customerId") String customerId, @Param("realName") String realName, @Param("mobile") String mobile, @Param("userIds") List userIds); + + List selectStaffRoles(@Param("userId") String userId,@Param("customerId") String customerId); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java index 740b4b8d6e..989b86924d 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java @@ -703,6 +703,9 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl selectStaffBasicInfo(String userId) { StaffBasicInfoResultDTO resultDTO = baseDao.selectStaffBasicInfo(userId); + if(null!=resultDTO){ + resultDTO.setRoleList(baseDao.selectStaffRoles(userId,resultDTO.getCustomerId())); + } return new Result().ok(resultDTO); } diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml index 9e3265747c..4448cb0566 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml @@ -416,4 +416,14 @@ ) + From 1556f334df998c6eb317946eea5bb47bd557be81 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Wed, 8 Sep 2021 18:07:07 +0800 Subject: [PATCH 7/8] bugfix --- .../com/epmet/controller/GuideCategoryController.java | 10 ++++------ .../java/com/epmet/service/GuideCategoryService.java | 4 ++-- .../epmet/service/impl/GuideCategoryServiceImpl.java | 6 ++++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/GuideCategoryController.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/GuideCategoryController.java index 7015ade670..b1e8824223 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/GuideCategoryController.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/GuideCategoryController.java @@ -144,11 +144,10 @@ public class GuideCategoryController { * @date 2021/9/8 5:11 下午 */ @PostMapping("save") - public Result save(@LoginUser TokenDto tokenDto,@RequestBody EditGuideCategoryFormDTO formDTO){ + public Result save(@LoginUser TokenDto tokenDto,@RequestBody EditGuideCategoryFormDTO formDTO){ formDTO.setStaffId(tokenDto.getUserId()); ValidatorUtils.validateEntity(formDTO,EditGuideCategoryFormDTO.AddUserInternalGroup.class,EditGuideCategoryFormDTO.SaveInfoGroup.class); - guideCategoryService.save(formDTO); - return new Result(); + return new Result().ok(guideCategoryService.save(formDTO)); } @@ -162,11 +161,10 @@ public class GuideCategoryController { * @date 2021/9/8 5:37 下午 */ @PostMapping("update") - public Result update(@LoginUser TokenDto tokenDto,@RequestBody EditGuideCategoryFormDTO formDTO){ + public Result update(@LoginUser TokenDto tokenDto,@RequestBody EditGuideCategoryFormDTO formDTO){ formDTO.setStaffId(tokenDto.getUserId()); ValidatorUtils.validateEntity(formDTO,EditGuideCategoryFormDTO.AddUserInternalGroup.class,EditGuideCategoryFormDTO.UpdateInfoGroup.class); - guideCategoryService.update(formDTO); - return new Result(); + return new Result().ok(guideCategoryService.update(formDTO)); } diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/GuideCategoryService.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/GuideCategoryService.java index f652f1036a..5bde4619e6 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/GuideCategoryService.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/GuideCategoryService.java @@ -86,7 +86,7 @@ public interface GuideCategoryService extends BaseService { * @author generator * @date 2021-09-06 */ - void save(EditGuideCategoryFormDTO dto); + GuideCategoryDTO save(EditGuideCategoryFormDTO dto); /** * 默认更新 @@ -96,7 +96,7 @@ public interface GuideCategoryService extends BaseService { * @author generator * @date 2021-09-06 */ - void update(EditGuideCategoryFormDTO dto); + GuideCategoryDTO update(EditGuideCategoryFormDTO dto); /** * 删除分类,存在办事指南的不允许删除,给予提示 diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/GuideCategoryServiceImpl.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/GuideCategoryServiceImpl.java index 44ceab9717..6f3f7a082a 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/GuideCategoryServiceImpl.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/GuideCategoryServiceImpl.java @@ -169,7 +169,7 @@ public class GuideCategoryServiceImpl extends BaseServiceImpl 0) { throw new RenException(EpmetErrorCode.GUIDE_CATEGORY_NAME_EXITS.getCode(), EpmetErrorCode.GUIDE_CATEGORY_NAME_EXITS.getMsg()); } @@ -185,11 +185,12 @@ public class GuideCategoryServiceImpl extends BaseServiceImpl 0) { throw new RenException(EpmetErrorCode.GUIDE_CATEGORY_NAME_EXITS.getCode(), EpmetErrorCode.GUIDE_CATEGORY_NAME_EXITS.getMsg()); } @@ -201,6 +202,7 @@ public class GuideCategoryServiceImpl extends BaseServiceImpl Date: Wed, 8 Sep 2021 18:07:54 +0800 Subject: [PATCH 8/8] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=8A=9E=E4=BA=8B?= =?UTF-8?q?=E6=8C=87=E5=8D=97=E5=86=85=E5=AE=B9=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../GuideModuleDictDefaultService.java | 9 ++++ .../epmet/service/GuideModuleDictService.java | 10 +++++ .../GuideModuleDictDefaultServiceImpl.java | 14 ++++++ .../impl/GuideModuleDictServiceImpl.java | 43 +++++++++++++++++++ .../epmet/service/impl/GuideServiceImpl.java | 3 ++ 5 files changed, 79 insertions(+) diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/GuideModuleDictDefaultService.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/GuideModuleDictDefaultService.java index 1af3f23de9..2bf1b3aac7 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/GuideModuleDictDefaultService.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/GuideModuleDictDefaultService.java @@ -92,4 +92,13 @@ public interface GuideModuleDictDefaultService extends BaseService} + * @Author zhaoqifeng + * @Date 2021/9/8 17:44 + */ + List getList(); } \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/GuideModuleDictService.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/GuideModuleDictService.java index 50ea1e80e0..7f1ae4a0e4 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/GuideModuleDictService.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/GuideModuleDictService.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.GuideModuleDictDTO; +import com.epmet.dto.ModuleDTO; import com.epmet.entity.GuideModuleDictEntity; import java.util.List; @@ -92,4 +93,13 @@ public interface GuideModuleDictService extends BaseService} + * @Author zhaoqifeng + * @Date 2021/9/8 17:50 + */ + List getModuleList(String customerId); } \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/GuideModuleDictDefaultServiceImpl.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/GuideModuleDictDefaultServiceImpl.java index 6be5e56dc4..ecc0fff0bb 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/GuideModuleDictDefaultServiceImpl.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/GuideModuleDictDefaultServiceImpl.java @@ -97,4 +97,18 @@ public class GuideModuleDictDefaultServiceImpl extends BaseServiceImpl} + * @Author zhaoqifeng + * @Date 2021/9/8 17:44 + */ + @Override + public List getList() { + QueryWrapper wrapper = new QueryWrapper<>(); + return ConvertUtils.sourceToTarget(baseDao.selectList(wrapper), GuideModuleDictDefaultDTO.class); + } + } \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/GuideModuleDictServiceImpl.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/GuideModuleDictServiceImpl.java index c758eebdad..72bfeb9d05 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/GuideModuleDictServiceImpl.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/GuideModuleDictServiceImpl.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,15 +26,21 @@ import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.dao.GuideModuleDictDao; import com.epmet.dto.GuideModuleDictDTO; +import com.epmet.dto.GuideModuleDictDefaultDTO; +import com.epmet.dto.ModuleDTO; import com.epmet.entity.GuideModuleDictEntity; +import com.epmet.service.GuideModuleDictDefaultService; import com.epmet.service.GuideModuleDictService; +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.stream.Collectors; /** * 指南模块字典表 @@ -44,6 +51,8 @@ import java.util.Map; @Service public class GuideModuleDictServiceImpl extends BaseServiceImpl implements GuideModuleDictService { + @Resource + private GuideModuleDictDefaultService guideModuleDictDefaultService; @Override public PageData page(Map params) { @@ -97,4 +106,38 @@ public class GuideModuleDictServiceImpl extends BaseServiceImpl} + * @Author zhaoqifeng + * @Date 2021/9/8 17:50 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public List getModuleList(String customerId) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(GuideModuleDictEntity::getCustomerId, customerId); + wrapper.orderByAsc(GuideModuleDictEntity::getSort); + List list = baseDao.selectList(wrapper); + //结果为空,初始化默认配置 + if (CollectionUtils.isEmpty(list)) { + List defaultList = guideModuleDictDefaultService.getList(); + List moduleList = ConvertUtils.sourceToTarget(defaultList, GuideModuleDictEntity.class); + moduleList.forEach(item -> { + item.setCustomerId(customerId); + }); + insertBatch(moduleList); + list = baseDao.selectList(wrapper); + } + return list.stream().map(item -> { + ModuleDTO dto = new ModuleDTO(); + dto.setModuleId(item.getId()); + dto.setModuleValue(item.getModuleValue()); + dto.setModuleName(item.getModuleName()); + 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/GuideServiceImpl.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/GuideServiceImpl.java index d8a2d2deeb..ac643590eb 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 @@ -165,6 +165,7 @@ public class GuideServiceImpl extends BaseServiceImpl imp * @Date 2021/9/7 14:12 */ @Override + @Transactional(rollbackFor = Exception.class) public void guideAdd(TokenDto tokenDto, GuideAddFormDTO formDTO) { if (CollectionUtils.isEmpty(formDTO.getModuleList()) && CollectionUtils.isEmpty(formDTO.getAttachmentList()) && CollectionUtils.isEmpty(formDTO.getExternalLinks())) { @@ -251,6 +252,7 @@ public class GuideServiceImpl extends BaseServiceImpl imp * @Date 2021/9/7 14:12 */ @Override + @Transactional(rollbackFor = Exception.class) public void guideEdit(GuideEditFormDTO formDTO) { if (CollectionUtils.isEmpty(formDTO.getModuleList()) && CollectionUtils.isEmpty(formDTO.getAttachmentList()) && CollectionUtils.isEmpty(formDTO.getExternalLinks())) { @@ -342,6 +344,7 @@ public class GuideServiceImpl extends BaseServiceImpl imp * @Date 2021/9/7 14:12 */ @Override + @Transactional(rollbackFor = Exception.class) public void guideDel(GuideFormDTO formDTO) { GuideDTO guide = get(formDTO.getGuideId()); if (!formDTO.getStaffId().equals(guide.getCreatedBy())) {