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 @@ ) +