Selaa lähdekoodia

Merge branch 'wanjing' into develop

tags/v1.0.0^2
wanjing 1 vuosi sitten
vanhempi
commit
78c6737dc6
9 muutettua tiedostoa jossa 209 lisäystä ja 46 poistoa
  1. +36
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/UserController.java
  2. +48
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/code/user/QueryUserListByDeptIdCodeEnum.java
  3. +2
    -2
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/code/workorder/DistributionWorkorderCodeEnum.java
  4. +0
    -18
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/interceptor/UserInterceptor.java
  5. +0
    -25
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/impl/UserServiceImpl.java
  6. +6
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/user/IUserService.java
  7. +37
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/user/UserServiceImpl.java
  8. +79
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/user/query/QueryUserListByDeptIdService.java
  9. +1
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/workorder/distribution/DistributionWorkorderService.java

+ 36
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/UserController.java Näytä tiedosto

@@ -0,0 +1,36 @@
package com.tuoheng.admin.controller;

import com.tuoheng.admin.service.user.IUserService;
import com.tuoheng.common.core.utils.JsonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
* 用户前端控制器
*
* @author wanjing
* @team tuoheng
* @date 2022-12-08
*/
@Slf4j
@RestController
@RequestMapping("/user")
public class UserController {

@Autowired
private IUserService userService;

/**
* 根据部门id查询用户列表
*/
@GetMapping("/list/dept/{deptId}")
public JsonResult getListByDeptId(@PathVariable("deptId") String deptId) {
log.info("进入根据部门id查询用户列表接口, deptId:{}", deptId);
return userService.getListByDeptId(deptId);
}

}

+ 48
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/code/user/QueryUserListByDeptIdCodeEnum.java Näytä tiedosto

@@ -0,0 +1,48 @@
package com.tuoheng.admin.enums.code.user;

/**
* 根据部门ID查询用户列表返回码
* 模块代码:10(部门管理)
* 接口代码:01 (据部门ID查询用户列表)
*
* @author wanjing
* @team tuoheng
* @date 2022-12-08
*/
public enum QueryUserListByDeptIdCodeEnum {

DEPT_ID_IS_NULL(1100101, "部门ID为空"),
DEPT_IS_NOT_EXIST(1100102, "部门不存在");

/**
* 错误码
*/
private int code;

/**
* 错误信息
*/
private String msg;

QueryUserListByDeptIdCodeEnum(int code, String msg){
this.code = code;
this.msg = msg;
}

public int getCode() {
return code;
}

public void setCode(int code) {
this.code = code;
}

public String getMsg() {
return msg;
}

public void setMsg(String msg) {
this.msg = msg;
}

}

+ 2
- 2
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/code/workorder/DistributionWorkorderCodeEnum.java Näytä tiedosto

@@ -12,10 +12,10 @@ package com.tuoheng.admin.enums.code.workorder;
public enum DistributionWorkorderCodeEnum {

DISTRIBUTION_IS_FAILED(1260400, "分配工单失败"),
ID_LIST_IS_NULL(1260401, "工单id列表为空"),
ID_LIST_IS_NULL(1260401, "工单id为空"),
WORK_ORDER_IS_NOT_EXIST(1260402, "工单不存在"),
ASSIGN_DEPT_ID_IS_NULL(1260403, "指派部门ID为空"),
ASSIGN_USER_ID_IS_NULL(1260404, "指派负责人"),
ASSIGN_USER_ID_IS_NULL(1260404, "指派负责人为空"),
ASSIGN_USER_ID_IS_NOT_EXIST(1260405, "指派负责人不存在"),
SUPER_ADMIN_NOT_DISTRIBUTION(1260406, "超级管理员不能分配工单"),
ADMIN_NOT_DISTRIBUTION_CHILD_DEPT_WORK_ORDER(1260407, "管理员不能分配子部门工单"),

+ 0
- 18
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/interceptor/UserInterceptor.java Näytä tiedosto

@@ -2,24 +2,6 @@

package com.tuoheng.admin.interceptor;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.tuoheng.admin.entity.User;
import com.tuoheng.admin.service.IUserService;
import com.tuoheng.common.core.exception.ServiceException;
import com.tuoheng.common.core.utils.SecurityUserUtils;
import com.tuoheng.common.core.utils.StringUtils;
import com.tuoheng.common.core.utils.ThreadLocalUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;
import org.springframework.web.context.support.WebApplicationContextUtils;
import org.springframework.web.servlet.HandlerInterceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

//@Component
//@Slf4j
//public class UserInterceptor implements HandlerInterceptor {

+ 0
- 25
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/impl/UserServiceImpl.java Näytä tiedosto

@@ -1,25 +0,0 @@
package com.tuoheng.admin.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.tuoheng.admin.entity.User;
import com.tuoheng.admin.mapper.UserMapper;
import com.tuoheng.admin.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
* <p>
* 后台用户管理表 服务实现类
* </p>
*
* @author 拓恒
* @since 2020-10-30
*/
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IUserService {

@Autowired
private UserMapper userMapper;

}

tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/IUserService.java → tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/user/IUserService.java Näytä tiedosto

@@ -1,7 +1,8 @@
package com.tuoheng.admin.service;
package com.tuoheng.admin.service.user;

import com.baomidou.mybatisplus.extension.service.IService;
import com.tuoheng.admin.entity.User;
import com.tuoheng.common.core.utils.JsonResult;

/**
* <p>
@@ -13,5 +14,9 @@ import com.tuoheng.admin.entity.User;
*/
public interface IUserService extends IService<User> {

/**
* 根据部门id查询用户列表
*/
JsonResult getListByDeptId(String deptId);

}

+ 37
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/user/UserServiceImpl.java Näytä tiedosto

@@ -0,0 +1,37 @@
package com.tuoheng.admin.service.user;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.tuoheng.admin.entity.User;
import com.tuoheng.admin.mapper.UserMapper;
import com.tuoheng.admin.service.user.IUserService;
import com.tuoheng.admin.service.user.query.QueryUserListByDeptIdService;
import com.tuoheng.common.core.utils.JsonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
* <p>
* 后台用户管理表 服务实现类
* </p>
*
* @author 拓恒
* @since 2020-10-30
*/
@Slf4j
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IUserService {

@Autowired
private QueryUserListByDeptIdService queryUserListByDeptIdService;

/**
* 根据部门id查询用户列表
*/
@Override
public JsonResult getListByDeptId(String deptId) {
return queryUserListByDeptIdService.getListByDeptId(deptId);
}

}

+ 79
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/user/query/QueryUserListByDeptIdService.java Näytä tiedosto

@@ -0,0 +1,79 @@
package com.tuoheng.admin.service.user.query;

import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tuoheng.admin.entity.Dept;
import com.tuoheng.admin.entity.User;
import com.tuoheng.admin.enums.code.dept.QueryDeptChildListCodeEnum;
import com.tuoheng.admin.enums.code.user.QueryUserListByDeptIdCodeEnum;
import com.tuoheng.admin.mapper.DeptMapper;
import com.tuoheng.admin.mapper.UserMapper;
import com.tuoheng.common.core.utils.JsonResult;
import com.tuoheng.common.core.utils.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* 根据部门id查询用户列表业务层处理
*
* @author wanjing
* @team tuoheng
* @date 2022-12-08
*/
@Slf4j
@Service
public class QueryUserListByDeptIdService {

@Autowired
private UserMapper userMapper;

@Autowired
private DeptMapper deptMapper;

/**
* 获取部门树形列表
*
* @return
*/
public JsonResult getListByDeptId(String deptId) {
log.info("进入根据部门id查询用户列表业业务");
JsonResult result = this.check(deptId);
if (0 != result.getCode()) {
log.info("根据根据部门id查询用户列表业业务:校验失败:{}", result.getMsg());
return result;
}

List<User> userList = userMapper.selectList(new LambdaQueryWrapper<User>()
.eq(User::getDeptId, deptId)
.eq(User::getMark, 1));
if (CollectionUtil.isEmpty(userList)) {
log.info("根据部门id查询用户列表业:获取用户列表为空");
}
return JsonResult.success(userList);
}

/**
* 检查参数
*
* @param deptId
* @return
*/
private JsonResult check(String deptId) {
// 判断id是否为空
if (StringUtils.isEmpty(deptId)) {
return JsonResult.error(QueryUserListByDeptIdCodeEnum.DEPT_ID_IS_NULL.getCode(), QueryUserListByDeptIdCodeEnum.DEPT_ID_IS_NULL.getMsg());
}

// 判断部门是否存在
Integer count = deptMapper.selectCount(new LambdaQueryWrapper<Dept>()
.eq(Dept::getId, deptId)
.eq(Dept::getMark, 1));
if (count <= 0) {
return JsonResult.error(QueryUserListByDeptIdCodeEnum.DEPT_IS_NOT_EXIST.getCode(), QueryUserListByDeptIdCodeEnum.DEPT_IS_NOT_EXIST.getMsg());
}
return JsonResult.success();
}
}

+ 1
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/workorder/distribution/DistributionWorkorderService.java Näytä tiedosto

@@ -150,6 +150,7 @@ public class DistributionWorkorderService {
workOrder.setStatus(WorkOrderStatusEnum.PROCESSING.getCode());
workOrder.setAssignDeptId(request.getAssignDeptId());
workOrder.setAssignUser(request.getAssignUserIds());
workOrder.setAssignTime(DateUtils.now());
Integer rowCount = workOrderMapper.update(workOrder);
if (rowCount <= 0) {
log.info("修改工单状态, 确认失败");

Loading…
Peruuta
Tallenna