From bbb18774f351f9ee601b1455728d71926d26b840 Mon Sep 17 00:00:00 2001 From: mashuanghui Date: Sat, 24 Aug 2024 18:06:03 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=A1=E6=A0=B8=E7=AE=A1=E7=90=86-=E5=AE=A1?= =?UTF-8?q?=E6=A0=B8=E4=BF=A1=E6=81=AF=E6=9F=A5=E8=AF=A2=E3=80=81=E5=88=86?= =?UTF-8?q?=E9=85=8D=E4=B8=9A=E5=8A=A1=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../inspection/project/dto/AssignmentDTO.java | 36 ++++ .../project/query/WrkInfoAuditQuery.java | 51 ++++++ .../inspection/work/query/ReviewedQuery.java | 3 + .../work/query/WrkAuditRuleQuery.java | 11 +- .../inspection/work/vo/WorkInfoAuditVo.java | 38 ++++ .../inspection/work/vo/WrkInfoDetailsVO.java | 2 + .../controller/WrkInfoAuditController.java | 20 ++- .../work/service/WrkAuditRuleService.java | 2 + .../work/service/WrkInfoAuditService.java | 11 ++ .../service/impl/WrkAuditRuleServiceImpl.java | 11 ++ .../service/impl/WrkInfoAuditServiceImpl.java | 170 ++++++++++++++++++ .../main/resources/mapper/WrkInfoMapper.xml | 16 +- .../system/feign/RemoteDeptService.java | 5 +- .../system/remote/RemoteDeptController.java | 6 + .../service/impl/SysUserServiceImpl.java | 3 +- 15 files changed, 380 insertions(+), 5 deletions(-) create mode 100644 chushang-modules/chushang-module-inspection/inspection-feign/src/main/java/com/chushang/inspection/project/dto/AssignmentDTO.java create mode 100644 chushang-modules/chushang-module-inspection/inspection-feign/src/main/java/com/chushang/inspection/project/query/WrkInfoAuditQuery.java create mode 100644 chushang-modules/chushang-module-inspection/inspection-feign/src/main/java/com/chushang/inspection/work/vo/WorkInfoAuditVo.java diff --git a/chushang-modules/chushang-module-inspection/inspection-feign/src/main/java/com/chushang/inspection/project/dto/AssignmentDTO.java b/chushang-modules/chushang-module-inspection/inspection-feign/src/main/java/com/chushang/inspection/project/dto/AssignmentDTO.java new file mode 100644 index 0000000..2d38019 --- /dev/null +++ b/chushang-modules/chushang-module-inspection/inspection-feign/src/main/java/com/chushang/inspection/project/dto/AssignmentDTO.java @@ -0,0 +1,36 @@ +package com.chushang.inspection.project.dto; + +import lombok.Data; + +import javax.validation.constraints.NotNull; + +/** + * @auther: zhao + * @date: 2024/6/17 18:17 + * 描述:分配信息 + */ +@Data +public class AssignmentDTO { + /** + * 审核 工单ID + */ + @NotNull(message = "工单不能为空") + private Long wrkId; + + /** + * 分配用户ID + */ + @NotNull(message = "分配用户不能为空") + private Long userId; + + /** + * 分配部门ID + */ + private Long deptId; + + /** + * 分配用户名称 + */ + private String userName; + +} diff --git a/chushang-modules/chushang-module-inspection/inspection-feign/src/main/java/com/chushang/inspection/project/query/WrkInfoAuditQuery.java b/chushang-modules/chushang-module-inspection/inspection-feign/src/main/java/com/chushang/inspection/project/query/WrkInfoAuditQuery.java new file mode 100644 index 0000000..677801d --- /dev/null +++ b/chushang-modules/chushang-module-inspection/inspection-feign/src/main/java/com/chushang/inspection/project/query/WrkInfoAuditQuery.java @@ -0,0 +1,51 @@ +package com.chushang.inspection.project.query; + +import com.chushang.common.mybatis.annotation.Condition; +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.time.LocalDateTime; +import java.util.List; + +/** + * @auther: zhao + * @date: 2024/6/17 18:17 + * 描述:分配信息查询 + */ +@Data +public class WrkInfoAuditQuery { + /** + * 审核 工单ID + */ + + @Condition(name = "wrk_id", type = Condition.ConditionType.eq) + private Long wrkId; + + /** + * 分配用户ID + */ + @Condition(name = "user_id", type = Condition.ConditionType.eq) + private Long userId; + + /** + * 分配用户名称 + */ + @Condition(name = "user_name", type = Condition.ConditionType.like) + private String userName; + + /** + * 部门ID + */ + @Condition(name = "dept_id", type = Condition.ConditionType.eq) + private Long deptId; + + @Condition(name = "create_time", type = Condition.ConditionType.between) + private List createTimes; + + /** + * 审核状态 + */ + @Condition(name = "audit_state", type = Condition.ConditionType.eq) + private Integer auditState; + +} diff --git a/chushang-modules/chushang-module-inspection/inspection-feign/src/main/java/com/chushang/inspection/work/query/ReviewedQuery.java b/chushang-modules/chushang-module-inspection/inspection-feign/src/main/java/com/chushang/inspection/work/query/ReviewedQuery.java index f98bebf..0d91b23 100644 --- a/chushang-modules/chushang-module-inspection/inspection-feign/src/main/java/com/chushang/inspection/work/query/ReviewedQuery.java +++ b/chushang-modules/chushang-module-inspection/inspection-feign/src/main/java/com/chushang/inspection/work/query/ReviewedQuery.java @@ -139,4 +139,7 @@ public class ReviewedQuery extends CommonParam { @Condition(name = "terminal_status", type = Condition.ConditionType.eq, tableName = "itr") private Integer terminalStatus; + @Condition(name = "dept_id", type = Condition.ConditionType.eq, tableName = "i") + private Integer deptId; + } diff --git a/chushang-modules/chushang-module-inspection/inspection-feign/src/main/java/com/chushang/inspection/work/query/WrkAuditRuleQuery.java b/chushang-modules/chushang-module-inspection/inspection-feign/src/main/java/com/chushang/inspection/work/query/WrkAuditRuleQuery.java index f1da731..97d2bea 100644 --- a/chushang-modules/chushang-module-inspection/inspection-feign/src/main/java/com/chushang/inspection/work/query/WrkAuditRuleQuery.java +++ b/chushang-modules/chushang-module-inspection/inspection-feign/src/main/java/com/chushang/inspection/work/query/WrkAuditRuleQuery.java @@ -29,8 +29,17 @@ public class WrkAuditRuleQuery extends CommonParam { */ @Condition(name = "status", type = Condition.ConditionType.eq) private Integer status; + /** + * 部门ID + */ + @Condition(name = "dept_id", type = Condition.ConditionType.eq) + private Long deptId; - + /** + * 规则时间 + */ + @Condition(name = "rule_time", type = Condition.ConditionType.eq) + private String ruleTime; /** * 规则名称 diff --git a/chushang-modules/chushang-module-inspection/inspection-feign/src/main/java/com/chushang/inspection/work/vo/WorkInfoAuditVo.java b/chushang-modules/chushang-module-inspection/inspection-feign/src/main/java/com/chushang/inspection/work/vo/WorkInfoAuditVo.java new file mode 100644 index 0000000..087402b --- /dev/null +++ b/chushang-modules/chushang-module-inspection/inspection-feign/src/main/java/com/chushang/inspection/work/vo/WorkInfoAuditVo.java @@ -0,0 +1,38 @@ +package com.chushang.inspection.work.vo; + +import cn.hutool.core.date.DatePattern; +import com.chushang.common.dict.annotation.DictFormat; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.time.LocalDateTime; + +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class WorkInfoAuditVo implements Serializable { + + /** + * 审核人名称 + */ + private String auditName; + + /** + * 审核时间 + */ + @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN) + private LocalDateTime auditTime; + + /** + * 分配时间 + */ + @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN) + private LocalDateTime allocateTime; + +} diff --git a/chushang-modules/chushang-module-inspection/inspection-feign/src/main/java/com/chushang/inspection/work/vo/WrkInfoDetailsVO.java b/chushang-modules/chushang-module-inspection/inspection-feign/src/main/java/com/chushang/inspection/work/vo/WrkInfoDetailsVO.java index ed8ded0..2858000 100644 --- a/chushang-modules/chushang-module-inspection/inspection-feign/src/main/java/com/chushang/inspection/work/vo/WrkInfoDetailsVO.java +++ b/chushang-modules/chushang-module-inspection/inspection-feign/src/main/java/com/chushang/inspection/work/vo/WrkInfoDetailsVO.java @@ -49,4 +49,6 @@ public class WrkInfoDetailsVO implements java.io.Serializable{ */ private FiveStoreVO fiveStoreDetails; + private WorkInfoAuditVo wrkInfoAudit; + } diff --git a/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/work/controller/WrkInfoAuditController.java b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/work/controller/WrkInfoAuditController.java index c8a6b71..22f4702 100644 --- a/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/work/controller/WrkInfoAuditController.java +++ b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/work/controller/WrkInfoAuditController.java @@ -2,12 +2,15 @@ package com.chushang.inspection.work.controller; import com.chushang.common.core.web.AjaxResult; import com.chushang.common.log.annotation.SysLog; import com.chushang.common.log.enums.BusinessType; +import com.chushang.inspection.project.dto.AssignmentDTO; import com.chushang.inspection.project.dto.AuditDTO; import com.chushang.inspection.project.service.WrkAuditService; +import com.chushang.inspection.work.po.WrkInfoAudit; import com.chushang.inspection.work.service.WrkInfoAuditService; import com.chushang.inspection.work.service.WrkInfoService; import com.chushang.security.annotation.RequiresPermissions; import lombok.extern.java.Log; +import org.springframework.beans.BeanUtils; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; @@ -19,12 +22,14 @@ import javax.annotation.Resource; * @author xxxxx */ @RestController -@RequestMapping("/wrk/audit") +@RequestMapping("/wrk/info/audit") public class WrkInfoAuditController { @Resource private WrkInfoService wrkInfoService; + @Resource + private WrkInfoAuditService wrkInfoAuditService; /** * 工单审核 @@ -36,4 +41,17 @@ public class WrkInfoAuditController { wrkInfoService.audit(audit); return AjaxResult.success(); } + + /** + * 工单分配 + */ + @PostMapping ("/assignment") + @RequiresPermissions("wrk:info:assignment") + @SysLog(value = "工单分配", businessType = BusinessType.AUDIT) + public AjaxResult assignment(@Validated @RequestBody AssignmentDTO assignmentDTO) { + WrkInfoAudit wrkInfoAudit = new WrkInfoAudit(); + BeanUtils.copyProperties(assignmentDTO,wrkInfoAudit); + wrkInfoAuditService.assignmentWrkInfo(wrkInfoAudit); + return AjaxResult.success(); + } } diff --git a/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/work/service/WrkAuditRuleService.java b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/work/service/WrkAuditRuleService.java index 262f7b2..1c239d9 100644 --- a/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/work/service/WrkAuditRuleService.java +++ b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/work/service/WrkAuditRuleService.java @@ -18,5 +18,7 @@ public interface WrkAuditRuleService extends IService { int saveOrUpdate(WrkAuditRuleDTO dto); + WrkAuditRule queryWrkAuditRule(WrkAuditRuleQuery query); + } diff --git a/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/work/service/WrkInfoAuditService.java b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/work/service/WrkInfoAuditService.java index d6010c2..0abe46b 100644 --- a/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/work/service/WrkInfoAuditService.java +++ b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/work/service/WrkInfoAuditService.java @@ -1,12 +1,23 @@ package com.chushang.inspection.work.service; +import com.chushang.common.core.web.Result; import com.chushang.inspection.project.dto.AuditDTO; +import com.chushang.inspection.project.query.WrkInfoAuditQuery; import com.chushang.inspection.work.po.WrkInfoAudit; import com.baomidou.mybatisplus.extension.service.IService; +import java.util.List; + /** * @auther: zhao * @date: 2024/6/27 18:13 */ public interface WrkInfoAuditService extends IService { + + Result assignmentWrkInfo(WrkInfoAudit entity); + + List queryWrkInfoAudits(WrkInfoAuditQuery wrkInfoAuditQuery); + + Long queryAssignmentCount(WrkInfoAuditQuery wrkInfoAuditQuery); + } diff --git a/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/work/service/impl/WrkAuditRuleServiceImpl.java b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/work/service/impl/WrkAuditRuleServiceImpl.java index aeffb21..93be641 100644 --- a/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/work/service/impl/WrkAuditRuleServiceImpl.java +++ b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/work/service/impl/WrkAuditRuleServiceImpl.java @@ -135,4 +135,15 @@ public class WrkAuditRuleServiceImpl extends ServiceImpl queryWrapper = WrapperUtils.builder(query, commonParam); + List wrkAuditRules = this.baseMapper.selectList(queryWrapper); + if (CollectionUtil.isEmpty(wrkAuditRules)){ + return null; + } + return wrkAuditRules.get(0); + } + } diff --git a/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/work/service/impl/WrkInfoAuditServiceImpl.java b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/work/service/impl/WrkInfoAuditServiceImpl.java index acfb6c9..299df82 100644 --- a/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/work/service/impl/WrkInfoAuditServiceImpl.java +++ b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/work/service/impl/WrkInfoAuditServiceImpl.java @@ -1,11 +1,41 @@ package com.chushang.inspection.work.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.chushang.common.core.constant.SecurityConstants; +import com.chushang.common.core.exception.CheckedException; +import com.chushang.common.core.util.DateUtils; +import com.chushang.common.core.util.StringUtils; +import com.chushang.common.core.web.Result; +import com.chushang.common.dict.feign.RemoteDictDataService; +import com.chushang.common.mybatis.utils.WrapperUtils; import com.chushang.inspection.project.dto.AuditDTO; +import com.chushang.inspection.project.query.WrkInfoAuditQuery; +import com.chushang.inspection.work.po.WrkAuditRule; +import com.chushang.inspection.work.po.WrkInfo; +import com.chushang.inspection.work.query.WrkAuditRuleQuery; +import com.chushang.inspection.work.service.WrkAuditRuleService; import com.chushang.inspection.work.service.WrkInfoAuditService; +import com.chushang.inspection.work.service.WrkInfoService; +import com.chushang.security.entity.po.SysDept; +import com.chushang.security.entity.po.SysUser; +import com.chushang.security.utils.SecurityUtils; +import com.chushang.system.entity.dto.ListUserDTO; +import com.chushang.system.feign.RemoteDeptService; +import com.chushang.system.feign.RemoteUserService; +import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.chushang.inspection.work.mapper.WrkInfoAuditMapper; import com.chushang.inspection.work.po.WrkInfoAudit; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.time.DayOfWeek; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; /** * @auther: zhao @@ -13,4 +43,144 @@ import com.chushang.inspection.work.po.WrkInfoAudit; */ @Service public class WrkInfoAuditServiceImpl extends ServiceImpl implements WrkInfoAuditService { + + @Resource + private WrkAuditRuleService wrkAuditRuleService; + + @Resource + private RemoteUserService remoteUserService; + + @Resource + @Lazy + private WrkInfoService wrkInfoService; + + @Resource + private RemoteDeptService deptService; + + + /** + * 分配工单 + * @param entity + * @return + */ + @Override + @Transactional + public Result assignmentWrkInfo(WrkInfoAudit entity) { + Boolean updateResult = false; + validateWrkInfoAudit(entity); + validateDept(entity); + LocalDateTime localDateTime = LocalDateTime.now(); + validateAssignmentCount(entity, localDateTime); + entity.setCreateTime(localDateTime); + entity.setCreateBy(SecurityUtils.getUsername()); + entity.setAuditState(1); + entity.setAuditTime(localDateTime); + entity.setRemark("初始分配给"+entity.getUserName()+"审核"); + Integer result = this.baseMapper.insert(entity); + if (result > 0) { + WrkInfo wrkInfo = new WrkInfo(); + wrkInfo.setWrkId(entity.getWrkId()); + wrkInfo.setWrkStatus(2); + wrkInfo.setUpdateTime(localDateTime); + wrkInfo.setUpdateBy(SecurityUtils.getUsername()); + updateResult = wrkInfoService.updateById(wrkInfo); + } + return Result.ok(updateResult==true?1:0); + } + + @Override + public List queryWrkInfoAudits(WrkInfoAuditQuery wrkInfoAuditQuery) { + LambdaQueryWrapper queryWrapper = WrapperUtils.builder(wrkInfoAuditQuery,null); + return this.baseMapper.selectList(queryWrapper); + } + + @Override + public Long queryAssignmentCount(WrkInfoAuditQuery wrkInfoAuditQuery){ + LambdaQueryWrapper queryWrapper = WrapperUtils.builder(wrkInfoAuditQuery,null); + return baseMapper.selectCount(queryWrapper); + } + + private List fetchSysUsers(Long deptId) { + ListUserDTO listUserDTO = new ListUserDTO(); + listUserDTO.setDeptId(deptId); + Result> result = remoteUserService.getSysUsers(listUserDTO); + return result.getData(); + } + + private WrkAuditRule fetchWrkAuditRule(Long deptId) { + WrkAuditRuleQuery wrkAuditRuleQuery = new WrkAuditRuleQuery(); + wrkAuditRuleQuery.setDeptId(deptId); + wrkAuditRuleQuery.setStatus(1); + wrkAuditRuleQuery.setRuleTime(LocalDate.now().getDayOfWeek().getValue() + ""); + return wrkAuditRuleService.queryWrkAuditRule(wrkAuditRuleQuery); + } + + private List createTimeRange(WrkAuditRule wrkAuditRule, LocalDateTime localDateTime) { + List createTimes = new ArrayList<>(2); + // LocalDateTime localDateTime = LocalDateTime.now(); + Integer numberType = wrkAuditRule.getNumberType(); + Integer number = wrkAuditRule.getNumber(); + LocalDateTime timeAgo = calculateTimeAgo(localDateTime, numberType, number); + createTimes.add(timeAgo); + createTimes.add(localDateTime); + return createTimes; + } + private LocalDateTime calculateTimeAgo(LocalDateTime localDateTime, Integer numberType, Integer number) { + switch (numberType) { + case 1: // 分钟 + return localDateTime.minusMinutes(number); + case 2: // 小时 + return localDateTime.minusHours(number); + case 3: // 天 + return localDateTime.minusDays(number); + case 4: // 周 + return localDateTime.minusWeeks(number); + case 5: // 月 + return localDateTime.minusMonths(number); + case 6: // 季度 + return localDateTime.minusMonths(number * 3); + default: + throw new CheckedException("无效的参数"); + } + } + + private void validateWrkInfoAudit(WrkInfoAudit entity) { + Result userInfo = remoteUserService.getInfoById(entity.getUserId(), SecurityConstants.INNER); + if (StringUtils.isEmpty(entity.getUserName())) { + entity.setUserName(userInfo.getData().getUsername()); + } + if (entity.getDeptId() == null) { + entity.setDeptId(userInfo.getData().getDeptId()); + } + } + private void validateDept(WrkInfoAudit entity) { + WrkInfo wrkInfo = wrkInfoService.getById(entity.getWrkId()); + if (wrkInfo == null) { + throw new CheckedException("工单不存在"); + } + if (!wrkInfo.getDeptId().equals(entity.getDeptId())) { + SysDept dept = deptService.getDeptById(entity.getDeptId(), SecurityConstants.INNER); + if (dept == null || !dept.getParentId().equals(entity.getDeptId())) { + throw new CheckedException("此业务员不属于分配工单所属部门"); + } + } + } + + private void validateAssignmentCount(WrkInfoAudit entity, LocalDateTime localDateTime) { + List sysUsers = fetchSysUsers(entity.getDeptId()); + if (sysUsers != null && sysUsers.size() > 1) { + WrkAuditRule wrkAuditRule = fetchWrkAuditRule(entity.getDeptId()); + if (wrkAuditRule != null) { + List createTimes = createTimeRange(wrkAuditRule,localDateTime); + WrkInfoAuditQuery query = new WrkInfoAuditQuery(); + query.setUserId(entity.getUserId()); + query.setCreateTimes(createTimes); + query.setAuditState(1); + Long assignmentCount = queryAssignmentCount(query); + if (assignmentCount > wrkAuditRule.getNumberWrk()) { + throw new CheckedException("此业务员当日工单已超过分配数量上限"); + } + } + } + } } diff --git a/chushang-modules/chushang-module-inspection/inspection-service/src/main/resources/mapper/WrkInfoMapper.xml b/chushang-modules/chushang-module-inspection/inspection-service/src/main/resources/mapper/WrkInfoMapper.xml index 7f79128..ab252a8 100644 --- a/chushang-modules/chushang-module-inspection/inspection-service/src/main/resources/mapper/WrkInfoMapper.xml +++ b/chushang-modules/chushang-module-inspection/inspection-service/src/main/resources/mapper/WrkInfoMapper.xml @@ -160,6 +160,11 @@ + + + + + diff --git a/chushang-modules/chushang-module-system/system-feign/src/main/java/com/chushang/system/feign/RemoteDeptService.java b/chushang-modules/chushang-module-system/system-feign/src/main/java/com/chushang/system/feign/RemoteDeptService.java index 0211924..427b041 100644 --- a/chushang-modules/chushang-module-system/system-feign/src/main/java/com/chushang/system/feign/RemoteDeptService.java +++ b/chushang-modules/chushang-module-system/system-feign/src/main/java/com/chushang/system/feign/RemoteDeptService.java @@ -1,6 +1,7 @@ package com.chushang.system.feign; import com.chushang.common.core.constant.SecurityConstants; +import com.chushang.security.entity.po.SysDept; import com.chushang.system.constants.SystemConstants; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.GetMapping; @@ -26,5 +27,7 @@ public interface RemoteDeptService { Map getDeptNameByIds(@RequestParam(value = "deptIds") Set deptIds, @RequestHeader(SecurityConstants.FROM_SOURCE) String source); - + @GetMapping("/dept/{deptId}") + SysDept getDeptById(@RequestParam(value = "deptId") Long deptId, + @RequestHeader(SecurityConstants.FROM_SOURCE) String source); } diff --git a/chushang-modules/chushang-module-system/system-service/src/main/java/com/chushang/system/remote/RemoteDeptController.java b/chushang-modules/chushang-module-system/system-service/src/main/java/com/chushang/system/remote/RemoteDeptController.java index e29e0f6..720e5fe 100644 --- a/chushang-modules/chushang-module-system/system-service/src/main/java/com/chushang/system/remote/RemoteDeptController.java +++ b/chushang-modules/chushang-module-system/system-service/src/main/java/com/chushang/system/remote/RemoteDeptController.java @@ -38,4 +38,10 @@ public class RemoteDeptController implements RemoteDeptService { } return Map.of(); } + + @GetMapping("/dept/{deptId}") + public SysDept getDeptById(Long deptId, String source) { + if (deptId != null) return deptService.getById(deptId); + return null; + } } diff --git a/chushang-modules/chushang-module-system/system-service/src/main/java/com/chushang/system/service/impl/SysUserServiceImpl.java b/chushang-modules/chushang-module-system/system-service/src/main/java/com/chushang/system/service/impl/SysUserServiceImpl.java index 58540ac..8adb05a 100644 --- a/chushang-modules/chushang-module-system/system-service/src/main/java/com/chushang/system/service/impl/SysUserServiceImpl.java +++ b/chushang-modules/chushang-module-system/system-service/src/main/java/com/chushang/system/service/impl/SysUserServiceImpl.java @@ -268,7 +268,8 @@ public class SysUserServiceImpl extends ServiceImpl impl List list = list(new LambdaQueryWrapper() .like(StringUtils.isNotEmpty(listUser.getPhone()),SysUser::getPhone, listUser.getPhone()). like(StringUtils.isNotEmpty(listUser.getUsername()),SysUser::getUsername, listUser.getUsername()). - like(StringUtils.isNotEmpty(listUser.getNickName()),SysUser::getNickName, listUser.getNickName())); + like(StringUtils.isNotEmpty(listUser.getNickName()),SysUser::getNickName, listUser.getNickName()) + .eq(listUser.getDeptId() != null,SysUser::getDeptId, listUser.getDeptId())); if (CollUtil.isEmpty(list)) { return null; }