@@ -108,7 +108,7 @@ public class HttpUtils { | |||
return result.toString(); | |||
} catch (Exception e) { | |||
log.error("post请求失败,{}",e.getMessage()); | |||
return "post请求失败!"; | |||
return ""; | |||
} | |||
} | |||
@@ -1,13 +1,13 @@ | |||
package com.tuoheng.admin.controller; | |||
import com.tuoheng.admin.entity.User; | |||
import com.tuoheng.admin.request.user.QueryUserPageListRequest; | |||
import com.tuoheng.admin.request.user.UserResetPwdRequest; | |||
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; | |||
import org.springframework.web.bind.annotation.*; | |||
/** | |||
* 用户前端控制器 | |||
@@ -24,6 +24,83 @@ public class UserController { | |||
@Autowired | |||
private IUserService userService; | |||
/** | |||
* 获取用户分页列表 | |||
* | |||
* @param request 查询条件 | |||
* @return | |||
*/ | |||
@GetMapping("/page/list") | |||
public JsonResult getPageList(QueryUserPageListRequest request) { | |||
return userService.getPageList(request); | |||
} | |||
/** | |||
* 获取用户详情 | |||
* | |||
* @param id 用户ID | |||
* @return | |||
*/ | |||
@GetMapping("/detail/{id}") | |||
public JsonResult detail(@PathVariable("id") String id) { | |||
return userService.detail(id); | |||
} | |||
/** | |||
* 添加用户 | |||
* | |||
* @param entity 实体对象 | |||
* @return | |||
*/ | |||
@PostMapping("/add") | |||
public JsonResult add(@RequestBody User entity) { | |||
return userService.edit(entity); | |||
} | |||
/** | |||
* 编辑用户 | |||
* | |||
* @param entity 实体对象 | |||
* @return | |||
*/ | |||
@PutMapping("/edit") | |||
public JsonResult edit(@RequestBody User entity) { | |||
return userService.edit(entity); | |||
} | |||
/** | |||
* 删除用户 | |||
* | |||
* @param userIds 用户ID | |||
* @return | |||
*/ | |||
@DeleteMapping("/delete/{userIds}") | |||
public JsonResult deleteByIds(@PathVariable("userIds") String[] userIds) { | |||
return userService.deleteByIds(userIds); | |||
} | |||
/** | |||
* 设置状态 | |||
* | |||
* @param entity 实体对象 | |||
* @return | |||
*/ | |||
@PutMapping("/edit/status") | |||
public JsonResult status(@RequestBody User entity) { | |||
return userService.updeateStatus(entity); | |||
} | |||
/** | |||
* 重置密码 | |||
* | |||
* @param request 参数 | |||
* @return | |||
*/ | |||
@PutMapping("/resetPwd") | |||
public JsonResult resetPwd(@RequestBody UserResetPwdRequest request) { | |||
return userService.resetPwd(request); | |||
} | |||
/** | |||
* 根据部门id查询用户列表 | |||
*/ |
@@ -0,0 +1,47 @@ | |||
package com.tuoheng.admin.request.user; | |||
import com.tuoheng.common.core.common.BaseQuery; | |||
import lombok.Data; | |||
/** | |||
* 用户查询条件 | |||
*/ | |||
@Data | |||
public class QueryUserPageListRequest extends BaseQuery { | |||
/** | |||
* 用户账号 | |||
*/ | |||
private String username; | |||
/** | |||
* 真实姓名 | |||
*/ | |||
private String realname; | |||
/** | |||
* 性别:1男 2女 3保密 | |||
*/ | |||
private Integer gender; | |||
/** | |||
* 终端 1 web端 2 小程序端 | |||
*/ | |||
private Integer terminalType; | |||
/** | |||
* 用户类型 | |||
*/ | |||
private Integer type; | |||
/** | |||
* 用户状态:1在用 2停用 | |||
*/ | |||
private Integer status; | |||
/** | |||
* 角色ID | |||
*/ | |||
private Integer roleId; | |||
} |
@@ -0,0 +1,16 @@ | |||
package com.tuoheng.admin.request.user; | |||
import lombok.Data; | |||
/** | |||
* 重置密码 | |||
*/ | |||
@Data | |||
public class UserResetPwdRequest { | |||
/** | |||
* 用户ID | |||
*/ | |||
private Integer id; | |||
} |
@@ -5,7 +5,7 @@ import com.tuoheng.admin.constant.SystemConstant; | |||
import com.tuoheng.admin.entity.Tenant; | |||
import com.tuoheng.admin.enums.code.AriportCodeEnum; | |||
import com.tuoheng.admin.mapper.TenantMapper; | |||
import com.tuoheng.admin.utils.ShiroUtils; | |||
import com.tuoheng.admin.utils.CurrentUserUtil; | |||
import com.tuoheng.admin.vo.AirLineVO; | |||
import com.tuoheng.common.core.utils.HttpUtils; | |||
import com.tuoheng.common.core.utils.JacksonUtil; | |||
@@ -25,7 +25,7 @@ public class AirportServiceImpl implements AirportService { | |||
@Override | |||
public JsonResult getAirportList() { | |||
//读取不同租户的机场平台url | |||
Tenant tenant = tenantMapper.selectById(ShiroUtils.getTenantId()); | |||
Tenant tenant = tenantMapper.selectById(CurrentUserUtil.getTenantId()); | |||
if (ObjectUtil.isEmpty(tenant)) { | |||
return JsonResult.error(AriportCodeEnum.GET_NO_TENANT.getCode(), AriportCodeEnum.GET_NO_TENANT.getMsg()); | |||
@@ -50,7 +50,7 @@ public class AirportServiceImpl implements AirportService { | |||
@Override | |||
public JsonResult getAirLineList(Integer droneId) { | |||
//读取不同租户的机场平台url | |||
Tenant tenant = tenantMapper.selectById(ShiroUtils.getTenantId()); | |||
Tenant tenant = tenantMapper.selectById(CurrentUserUtil.getTenantId()); | |||
if (ObjectUtil.isEmpty(tenant)) { | |||
return JsonResult.error(AriportCodeEnum.GET_NO_TENANT.getCode(), AriportCodeEnum.GET_NO_TENANT.getMsg()); | |||
} |
@@ -8,7 +8,7 @@ import com.tuoheng.admin.mapper.RoadDeptMapper; | |||
import com.tuoheng.admin.mapper.SectionDeptMapper; | |||
import com.tuoheng.admin.request.dept.AddDeptRequest; | |||
import com.tuoheng.admin.dto.RoadSectionDto; | |||
import com.tuoheng.admin.utils.ShiroUtils; | |||
import com.tuoheng.admin.utils.CurrentUserUtil; | |||
import com.tuoheng.common.core.utils.DateUtils; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import com.tuoheng.common.core.utils.StringUtils; | |||
@@ -50,7 +50,7 @@ public class AddDeptService { | |||
*/ | |||
public JsonResult add(AddDeptRequest addDeptRequest) { | |||
log.info("进入添加部门业务接口"); | |||
String tenantId = ShiroUtils.getTenantId(); | |||
String tenantId = CurrentUserUtil.getTenantId(); | |||
JsonResult result = this.check(tenantId, addDeptRequest); | |||
if (0 != result.getCode()) { | |||
log.info("添加部门业务接口:校验失败:{}", result.getMsg()); |
@@ -7,7 +7,7 @@ import com.tuoheng.admin.mapper.DeptMapper; | |||
import com.tuoheng.admin.mapper.RoadDeptMapper; | |||
import com.tuoheng.admin.mapper.SectionDeptMapper; | |||
import com.tuoheng.admin.mapper.UserMapper; | |||
import com.tuoheng.admin.utils.ShiroUtils; | |||
import com.tuoheng.admin.utils.CurrentUserUtil; | |||
import com.tuoheng.common.core.utils.DateUtils; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import com.tuoheng.common.core.utils.StringUtils; | |||
@@ -44,7 +44,7 @@ public class DeleteDeptService { | |||
public JsonResult deleteById(String id) { | |||
log.info("进入删除部门业务接口"); | |||
String tenantId = ShiroUtils.getTenantId(); | |||
String tenantId = CurrentUserUtil.getTenantId(); | |||
JsonResult result = this.check(tenantId, id); | |||
if (0 != result.getCode()) { | |||
log.info("删除部门业务接口:校验失败:{}", result.getMsg()); |
@@ -2,21 +2,15 @@ package com.tuoheng.admin.service.dept.query; | |||
import cn.hutool.core.collection.CollectionUtil; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.core.metadata.IPage; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.tuoheng.admin.entity.Dept; | |||
import com.tuoheng.admin.enums.code.dept.QueryDeptChildListCodeEnum; | |||
import com.tuoheng.admin.mapper.DeptMapper; | |||
import com.tuoheng.admin.request.dept.QueryDeptChildPageListRequest; | |||
import com.tuoheng.admin.utils.ShiroUtils; | |||
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.ArrayList; | |||
import java.util.List; | |||
/** |
@@ -7,7 +7,7 @@ import com.tuoheng.admin.dto.RoadSectionDto; | |||
import com.tuoheng.admin.entity.*; | |||
import com.tuoheng.admin.enums.code.dept.QueryDeptInfoCodeEnum; | |||
import com.tuoheng.admin.mapper.*; | |||
import com.tuoheng.admin.utils.ShiroUtils; | |||
import com.tuoheng.admin.utils.CurrentUserUtil; | |||
import com.tuoheng.admin.vo.DeptInfoVo; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import com.tuoheng.common.core.utils.StringUtils; | |||
@@ -52,7 +52,7 @@ public class QueryDeptInfoService { | |||
public JsonResult getDeptInfo(String deptId) { | |||
log.info("进入获取部门信息业务, deptId:{}", deptId); | |||
String tenantId = ShiroUtils.getTenantId(); | |||
String tenantId = CurrentUserUtil.getTenantId(); | |||
// 校验 | |||
JsonResult result = this.check(tenantId, deptId); |
@@ -8,7 +8,7 @@ import com.tuoheng.admin.mapper.DeptMapper; | |||
import com.tuoheng.admin.mapper.RoadDeptMapper; | |||
import com.tuoheng.admin.mapper.SectionDeptMapper; | |||
import com.tuoheng.admin.request.dept.EditDeptRequest; | |||
import com.tuoheng.admin.utils.ShiroUtils; | |||
import com.tuoheng.admin.utils.CurrentUserUtil; | |||
import com.tuoheng.common.core.utils.DateUtils; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import com.tuoheng.common.core.utils.StringUtils; | |||
@@ -49,7 +49,7 @@ public class UpdateDeptService { | |||
*/ | |||
public JsonResult update(EditDeptRequest oldEditDeptRequest, EditDeptRequest newEditDeptRequest) { | |||
log.info("进入修改部门业务接口"); | |||
String tenantId = ShiroUtils.getTenantId(); | |||
String tenantId = CurrentUserUtil.getTenantId(); | |||
JsonResult result = this.check(tenantId, oldEditDeptRequest, newEditDeptRequest); | |||
if (0 != result.getCode()) { | |||
log.info("修改部门业务接口:校验失败:{}", result.getMsg()); |
@@ -9,7 +9,6 @@ import com.tuoheng.admin.mapper.FlightDataMapper; | |||
import com.tuoheng.admin.mapper.InspectionMapper; | |||
import com.tuoheng.admin.query.FlightDataQuery; | |||
import com.tuoheng.admin.service.IFlightDataService; | |||
import com.tuoheng.admin.utils.ShiroUtils; | |||
import com.tuoheng.common.core.enums.ServiceExceptionEnum; | |||
import com.tuoheng.common.core.exception.ServiceException; | |||
import com.tuoheng.common.core.utils.DateUtils; |
@@ -23,7 +23,7 @@ import com.tuoheng.admin.service.inspectionfile.query.QueryInspectionFileDistrib | |||
import com.tuoheng.admin.service.inspectionfile.query.QueryInspectionFilePageListByInspectionIdService; | |||
import com.tuoheng.admin.service.inspectionfile.query.QueryInspectionFilePageListByWorkOrderIdService; | |||
import com.tuoheng.admin.service.inspectionfile.query.QueryInspectionFilePageListService; | |||
import com.tuoheng.admin.utils.ShiroUtils; | |||
import com.tuoheng.admin.utils.CurrentUserUtil; | |||
import com.tuoheng.admin.vo.InspectionFileVo; | |||
import com.tuoheng.admin.vo.ListByDeptUserTypeVo; | |||
import com.tuoheng.common.core.enums.ServiceExceptionEnum; | |||
@@ -171,7 +171,7 @@ public class InspectionFileServiceImpl implements IInspectionFileService { | |||
if(ObjectUtil.isNull(user)){ | |||
JsonResult.error(ListByDeptUserTypeEnum.USER_IS_NULL.getCode(),ListByDeptUserTypeEnum.USER_IS_NULL.getMsg()); | |||
} | |||
String tenantId = ShiroUtils.getTenantId(); | |||
String tenantId = CurrentUserUtil.getTenantId(); | |||
//用户角色判断 1超级管理员 2部门管理员 3普通用户 | |||
if(null == user.getType()){ | |||
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); |
@@ -11,7 +11,7 @@ import com.tuoheng.admin.mapper.*; | |||
import com.tuoheng.admin.request.inspection.AddInspectionRequest; | |||
import com.tuoheng.admin.service.third.pilot.PilotService; | |||
import com.tuoheng.admin.utils.GaodeUtil; | |||
import com.tuoheng.admin.utils.ShiroUtils; | |||
import com.tuoheng.admin.utils.CurrentUserUtil; | |||
import com.tuoheng.common.core.utils.DateUtils; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import com.tuoheng.common.core.utils.StringUtils; | |||
@@ -58,8 +58,8 @@ public class AddInspectionService { | |||
*/ | |||
public JsonResult add(AddInspectionRequest addInspectionRequest) { | |||
log.info("进入添加任务业务"); | |||
String userId = ShiroUtils.getUserId(); | |||
String tenantId = ShiroUtils.getTenantId(); | |||
String userId = CurrentUserUtil.getUserId(); | |||
String tenantId = CurrentUserUtil.getTenantId(); | |||
JsonResult result = this.checkParam(userId, tenantId, addInspectionRequest); | |||
if (0 != result.getCode()) { | |||
log.info("添加任务业务:校验参数失败:{}", result.getMsg()); |
@@ -9,7 +9,7 @@ import com.tuoheng.admin.enums.InspectionStatusEnum; | |||
import com.tuoheng.admin.enums.UserTypeEnum; | |||
import com.tuoheng.admin.enums.code.inspection.DeleteInspectionCodeEnum; | |||
import com.tuoheng.admin.mapper.*; | |||
import com.tuoheng.admin.utils.ShiroUtils; | |||
import com.tuoheng.admin.utils.CurrentUserUtil; | |||
import com.tuoheng.common.core.utils.DateUtils; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import com.tuoheng.common.core.utils.StringUtils; | |||
@@ -67,8 +67,8 @@ public class DeleteInspectionService { | |||
@Transactional | |||
public JsonResult deleteById(String id) { | |||
log.info("进入删除任务业务接口"); | |||
String userId = ShiroUtils.getUserId(); | |||
String tenantId = ShiroUtils.getTenantId(); | |||
String userId = CurrentUserUtil.getUserId(); | |||
String tenantId = CurrentUserUtil.getTenantId(); | |||
JsonResult result = this.check(tenantId, id); | |||
if (0 != result.getCode()) { | |||
log.info("删除任务接口:校验失败:{}", result.getMsg()); |
@@ -13,9 +13,8 @@ import com.tuoheng.admin.mapper.InspectionHistoryMapper; | |||
import com.tuoheng.admin.mapper.InspectionMapper; | |||
import com.tuoheng.admin.mapper.TenantMapper; | |||
import com.tuoheng.admin.mapper.UserMapper; | |||
import com.tuoheng.admin.utils.ShiroUtils; | |||
import com.tuoheng.admin.utils.CurrentUserUtil; | |||
import com.tuoheng.common.core.utils.*; | |||
import lombok.Data; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
@@ -50,8 +49,8 @@ public class ExecuteInspectionService { | |||
*/ | |||
public JsonResult execute(String id) { | |||
log.info("进入立即执行任务业务"); | |||
String userId = ShiroUtils.getUserId(); | |||
String tenantId = ShiroUtils.getTenantId(); | |||
String userId = CurrentUserUtil.getUserId(); | |||
String tenantId = CurrentUserUtil.getTenantId(); | |||
JsonResult result = this.check(userId, tenantId, id); | |||
if (0 != result.getCode()) { | |||
@@ -103,7 +102,7 @@ public class ExecuteInspectionService { | |||
* @return | |||
*/ | |||
public JsonResult executeTask(String userId, String tenantId, Inspection inspection) { | |||
//读取不同租户的机场平台url | |||
// 读取不同租户的机场平台url | |||
Tenant tenant = tenantMapper.selectById(inspection.getTenantId()); | |||
if (ObjectUtil.isEmpty(tenant)) { | |||
return JsonResult.error(ExecuteInspectionCodeEnum.TENANT_IS_NOT_EXIST.getCode(), ExecuteInspectionCodeEnum.TENANT_IS_NOT_EXIST.getMsg()); |
@@ -15,7 +15,7 @@ import com.tuoheng.admin.mapper.InspectionMapper; | |||
import com.tuoheng.admin.mapper.UserMapper; | |||
import com.tuoheng.admin.request.inspection.QueryInspectionPageListRequest; | |||
import com.tuoheng.admin.service.inspection.query.handle.GenerateInspectionFieldHander; | |||
import com.tuoheng.admin.utils.ShiroUtils; | |||
import com.tuoheng.admin.utils.CurrentUserUtil; | |||
import com.tuoheng.admin.vo.InspectionVo; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import com.tuoheng.common.core.utils.StringUtils; | |||
@@ -98,8 +98,8 @@ public class QueryInspectionPageListService { | |||
public JsonResult getPageList(QueryInspectionPageListRequest request) { | |||
log.info("进入查询巡检任务分页列表业务"); | |||
String userId = ShiroUtils.getUserId(); | |||
String tenantId = ShiroUtils.getTenantId(); | |||
String userId = CurrentUserUtil.getUserId(); | |||
String tenantId = CurrentUserUtil.getTenantId(); | |||
JsonResult result = this.check(tenantId, request); | |||
if (0 != result.getCode()) { |
@@ -10,7 +10,7 @@ import com.tuoheng.admin.enums.code.inspection.ResubmitInspectionCodeEnum; | |||
import com.tuoheng.admin.mapper.*; | |||
import com.tuoheng.admin.request.inspection.EditInspectionRequest; | |||
import com.tuoheng.admin.service.third.pilot.PilotService; | |||
import com.tuoheng.admin.utils.ShiroUtils; | |||
import com.tuoheng.admin.utils.CurrentUserUtil; | |||
import com.tuoheng.common.core.utils.DateUtils; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import com.tuoheng.common.core.utils.StringUtils; | |||
@@ -54,8 +54,8 @@ public class ResubmitInspectionService { | |||
*/ | |||
public JsonResult resubmit(EditInspectionRequest request) { | |||
log.info("进入重新提交任务业务"); | |||
String userId = ShiroUtils.getUserId(); | |||
String tenantId = ShiroUtils.getTenantId(); | |||
String userId = CurrentUserUtil.getUserId(); | |||
String tenantId = CurrentUserUtil.getTenantId(); | |||
JsonResult result = this.checkParam(tenantId, request); | |||
if (0 != result.getCode()) { | |||
log.info("重新提交任务业务:校验参数失败:{}", result.getMsg()); |
@@ -9,7 +9,7 @@ import com.tuoheng.admin.enums.code.dept.AddDeptCodeEnum; | |||
import com.tuoheng.admin.enums.code.inspection.EditInspectionCodeEnum; | |||
import com.tuoheng.admin.mapper.*; | |||
import com.tuoheng.admin.request.inspection.EditInspectionRequest; | |||
import com.tuoheng.admin.utils.ShiroUtils; | |||
import com.tuoheng.admin.utils.CurrentUserUtil; | |||
import com.tuoheng.common.core.utils.DateUtils; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import com.tuoheng.common.core.utils.StringUtils; | |||
@@ -47,7 +47,7 @@ public class UpdateInspectionService { | |||
*/ | |||
public JsonResult update(EditInspectionRequest editInspectionRequest) { | |||
log.info("进入修改任务业务接口"); | |||
String tenantId = ShiroUtils.getTenantId(); | |||
String tenantId = CurrentUserUtil.getTenantId(); | |||
JsonResult result = this.check(tenantId, editInspectionRequest); | |||
if (0 != result.getCode()) { | |||
log.info("修改任务业务接口:校验失败:{}", result.getMsg()); |
@@ -2,17 +2,14 @@ package com.tuoheng.admin.service.inspectionfile.confirm; | |||
import cn.hutool.core.collection.CollectionUtil; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.tuoheng.admin.entity.Inspection; | |||
import com.tuoheng.admin.entity.InspectionFile; | |||
import com.tuoheng.admin.enums.InspectionFileStatusEnum; | |||
import com.tuoheng.admin.enums.code.inspectionfile.InspectionFileConfirmCodeEnum; | |||
import com.tuoheng.admin.enums.code.inspectionfile.InspectionFileIgnoreCodeEnum; | |||
import com.tuoheng.admin.mapper.InspectionFileMapper; | |||
import com.tuoheng.admin.mapper.InspectionMapper; | |||
import com.tuoheng.admin.utils.ShiroUtils; | |||
import com.tuoheng.admin.utils.CurrentUserUtil; | |||
import com.tuoheng.common.core.utils.DateUtils; | |||
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; | |||
@@ -40,7 +37,7 @@ public class InspectionFileConfirmService { | |||
public JsonResult confirm(List<String> idList) { | |||
log.info("进入任务问题确认业务, id:{}", idList.toString()); | |||
String userId = ShiroUtils.getUserId(); | |||
String userId = CurrentUserUtil.getUserId(); | |||
JsonResult result = this.check(idList); | |||
if (0 != result.getCode()) { | |||
log.info("进入任务问题确认业务:校验失败:{}", result.getMsg()); |
@@ -2,18 +2,14 @@ package com.tuoheng.admin.service.inspectionfile.ignore; | |||
import cn.hutool.core.collection.CollectionUtil; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.tuoheng.admin.entity.Inspection; | |||
import com.tuoheng.admin.entity.InspectionFile; | |||
import com.tuoheng.admin.enums.InspectionFileStatusEnum; | |||
import com.tuoheng.admin.enums.code.inspectionfile.InspectionFileConfirmCodeEnum; | |||
import com.tuoheng.admin.enums.code.inspectionfile.InspectionFileIgnoreCodeEnum; | |||
import com.tuoheng.admin.mapper.InspectionFileMapper; | |||
import com.tuoheng.admin.mapper.InspectionMapper; | |||
import com.tuoheng.admin.service.inspectionfile.confirm.InspectionFileConfirmService; | |||
import com.tuoheng.admin.utils.ShiroUtils; | |||
import com.tuoheng.admin.utils.CurrentUserUtil; | |||
import com.tuoheng.common.core.utils.DateUtils; | |||
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; | |||
@@ -41,7 +37,7 @@ public class InspectionFileIgnoreService { | |||
public JsonResult ignore(List<String> idList) { | |||
log.info("进入任务问题忽略业务, idList:{}", idList.toString()); | |||
String userId = ShiroUtils.getUserId(); | |||
String userId = CurrentUserUtil.getUserId(); | |||
JsonResult result = this.check(idList); | |||
if (0 != result.getCode()) { | |||
log.info("进入任务问题忽略业务:校验失败:{}", result.getMsg()); |
@@ -10,7 +10,7 @@ import com.tuoheng.admin.enums.WorkOrderStatusEnum; | |||
import com.tuoheng.admin.enums.code.inspectionfilehandle.InspectionFileProcessingCodeEnum; | |||
import com.tuoheng.admin.mapper.*; | |||
import com.tuoheng.admin.request.inspectionfile.InspectionFileProcessingRresultRequest; | |||
import com.tuoheng.admin.utils.ShiroUtils; | |||
import com.tuoheng.admin.utils.CurrentUserUtil; | |||
import com.tuoheng.common.core.utils.DateUtils; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import com.tuoheng.common.core.utils.StringUtils; | |||
@@ -49,8 +49,8 @@ public class InspectionFileProcessingService { | |||
public JsonResult processing(InspectionFileProcessingRresultRequest request) { | |||
log.info("进入任务问题处理业务:inspectionFileId:{}", request.getInspectionFileId()); | |||
String userId = ShiroUtils.getUserId(); | |||
String tenantId = ShiroUtils.getTenantId(); | |||
String userId = CurrentUserUtil.getUserId(); | |||
String tenantId = CurrentUserUtil.getTenantId(); | |||
JsonResult result = this.check(request); | |||
if (0 != result.getCode()) { |
@@ -1,25 +1,20 @@ | |||
package com.tuoheng.admin.service.inspectionfile.query; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.core.metadata.IPage; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.tuoheng.admin.conver.InspectionFileConverMapper; | |||
import com.tuoheng.admin.entity.*; | |||
import com.tuoheng.admin.enums.UserTypeEnum; | |||
import com.tuoheng.admin.enums.code.inspection.QueryInspectionPageListCodeEnum; | |||
import com.tuoheng.admin.mapper.*; | |||
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFileDistributionListRequest; | |||
import com.tuoheng.admin.utils.ShiroUtils; | |||
import com.tuoheng.admin.utils.CurrentUserUtil; | |||
import com.tuoheng.admin.vo.InspectionFileDistributionListVo; | |||
import com.tuoheng.admin.vo.InspectionFilePageListVo; | |||
import com.tuoheng.common.core.config.common.CommonConfig; | |||
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.ArrayList; | |||
import java.util.List; | |||
import java.util.Map; | |||
import java.util.function.Function; | |||
@@ -56,7 +51,7 @@ public class QueryInspectionFileDistributionListService { | |||
public JsonResult getList(QueryInspectionFileDistributionListRequest request) { | |||
log.info("进入查询任务问题分布列表业务, request:{}", request.toString()); | |||
String userId = ShiroUtils.getUserId(); | |||
String userId = CurrentUserUtil.getUserId(); | |||
JsonResult result = this.check(request); | |||
if (0 != result.getCode()) { |
@@ -4,19 +4,13 @@ import cn.hutool.core.collection.CollectionUtil; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.core.metadata.IPage; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.tuoheng.admin.conver.InspectionFileConverMapper; | |||
import com.tuoheng.admin.conver.InspectionFileHandleConverMapper; | |||
import com.tuoheng.admin.entity.*; | |||
import com.tuoheng.admin.enums.UserTypeEnum; | |||
import com.tuoheng.admin.enums.code.inspection.QueryInspectionPageListCodeEnum; | |||
import com.tuoheng.admin.enums.code.inspectionfile.QueryInspectionFilePageListByWorkOrderIdCodeEnum; | |||
import com.tuoheng.admin.mapper.*; | |||
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFileDistributionListRequest; | |||
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFileWorkOrderPageListRequest; | |||
import com.tuoheng.admin.utils.ShiroUtils; | |||
import com.tuoheng.admin.vo.InspectionFileDistributionListVo; | |||
import com.tuoheng.admin.utils.CurrentUserUtil; | |||
import com.tuoheng.admin.vo.InspectionFileHandleVo; | |||
import com.tuoheng.admin.vo.InspectionFilePageListVo; | |||
import com.tuoheng.common.core.config.common.CommonConfig; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import com.tuoheng.common.core.utils.StringUtils; | |||
@@ -68,7 +62,7 @@ public class QueryInspectionFilePageListByWorkOrderIdService { | |||
public JsonResult getPageList(QueryInspectionFileWorkOrderPageListRequest request) { | |||
log.info("进入根据工单ID查询工单问题列表表业务, workOrderId:{}", request.getWorkOrderId()); | |||
String userId = ShiroUtils.getUserId(); | |||
String userId = CurrentUserUtil.getUserId(); | |||
JsonResult result = this.check(request.getWorkOrderId()); | |||
if (0 != result.getCode()) { |
@@ -10,8 +10,7 @@ import com.tuoheng.admin.enums.UserTypeEnum; | |||
import com.tuoheng.admin.enums.code.inspection.QueryInspectionPageListCodeEnum; | |||
import com.tuoheng.admin.mapper.*; | |||
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFilePageListRequest; | |||
import com.tuoheng.admin.utils.ShiroUtils; | |||
import com.tuoheng.admin.vo.InspectionFilePageListByInspectionIdVo; | |||
import com.tuoheng.admin.utils.CurrentUserUtil; | |||
import com.tuoheng.admin.vo.InspectionFilePageListVo; | |||
import com.tuoheng.common.core.config.common.CommonConfig; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
@@ -57,7 +56,7 @@ public class QueryInspectionFilePageListService { | |||
public JsonResult getPageList(QueryInspectionFilePageListRequest request) { | |||
log.info("进入查询任务问题分页列表业务, request:{}", request.toString()); | |||
String userId = ShiroUtils.getUserId(); | |||
String userId = CurrentUserUtil.getUserId(); | |||
JsonResult result = this.check(request); | |||
if (0 != result.getCode()) { |
@@ -13,7 +13,7 @@ import com.tuoheng.admin.mapper.InspectionFileMapper; | |||
import com.tuoheng.admin.mapper.ReportMapper; | |||
import com.tuoheng.admin.mapper.TenantMapper; | |||
import com.tuoheng.admin.utils.DownloadUtil; | |||
import com.tuoheng.admin.utils.ShiroUtils; | |||
import com.tuoheng.admin.utils.CurrentUserUtil; | |||
import com.tuoheng.common.core.config.UploadFileConfig; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import com.tuoheng.common.core.utils.StringUtils; | |||
@@ -53,7 +53,7 @@ public class ExportInspectionHandleReportService { | |||
private GenerateReportWordService generateReportWordService; | |||
public JsonResult exportReport(HttpServletResponse response, String reportId) { | |||
String tenantId = ShiroUtils.getTenantId(); | |||
String tenantId = CurrentUserUtil.getTenantId(); | |||
JsonResult result = this.check(reportId); | |||
if (0 != result.getCode()) { | |||
@@ -125,7 +125,7 @@ public class ExportInspectionHandleReportService { | |||
* @return | |||
*/ | |||
private String getAreaName() { | |||
Tenant tenant = tenantMapper.selectById(ShiroUtils.getTenantId()); | |||
Tenant tenant = tenantMapper.selectById(CurrentUserUtil.getTenantId()); | |||
String areaName = ""; | |||
if (ObjectUtil.isNotNull(tenant)) { | |||
if (!StringUtils.isEmpty(tenant.getProvinceName())) { |
@@ -4,7 +4,6 @@ import cn.hutool.core.util.ObjectUtil; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.tuoheng.admin.entity.InspectionFile; | |||
import com.tuoheng.admin.entity.InspectionFileHandle; | |||
import com.tuoheng.admin.entity.Report; | |||
import com.tuoheng.admin.entity.Tenant; | |||
import com.tuoheng.admin.enums.code.report.ExportInspectionReportReportCodeEnum; | |||
@@ -13,7 +12,7 @@ import com.tuoheng.admin.mapper.InspectionFileMapper; | |||
import com.tuoheng.admin.mapper.ReportMapper; | |||
import com.tuoheng.admin.mapper.TenantMapper; | |||
import com.tuoheng.admin.utils.DownloadUtil; | |||
import com.tuoheng.admin.utils.ShiroUtils; | |||
import com.tuoheng.admin.utils.CurrentUserUtil; | |||
import com.tuoheng.common.core.config.UploadFileConfig; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import com.tuoheng.common.core.utils.StringUtils; | |||
@@ -24,7 +23,6 @@ import org.springframework.stereotype.Service; | |||
import javax.servlet.http.HttpServletResponse; | |||
import java.io.File; | |||
import java.util.List; | |||
import java.util.stream.Collectors; | |||
/** | |||
* 导出巡检报告业务层处理 | |||
@@ -53,7 +51,7 @@ public class ExportInspectionReportService { | |||
private GenerateReportWordService generateReportWordService; | |||
public JsonResult exportReport(HttpServletResponse response, String reportId) { | |||
String tenantId = ShiroUtils.getTenantId(); | |||
String tenantId = CurrentUserUtil.getTenantId(); | |||
JsonResult result = this.check(reportId); | |||
if (0 != result.getCode()) { | |||
@@ -120,7 +118,7 @@ public class ExportInspectionReportService { | |||
* @return | |||
*/ | |||
private String getAreaName() { | |||
Tenant tenant = tenantMapper.selectById(ShiroUtils.getTenantId()); | |||
Tenant tenant = tenantMapper.selectById(CurrentUserUtil.getTenantId()); | |||
String areaName = ""; | |||
if (ObjectUtil.isNotNull(tenant)) { | |||
if (!StringUtils.isEmpty(tenant.getProvinceName())) { |
@@ -1,20 +1,13 @@ | |||
package com.tuoheng.admin.service.report.generate; | |||
import cn.hutool.core.collection.CollectionUtil; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.tuoheng.admin.conver.InspectionConverMapper; | |||
import com.tuoheng.admin.conver.ReportConverMapper; | |||
import com.tuoheng.admin.entity.*; | |||
import com.tuoheng.admin.enums.InspectionFileStatusEnum; | |||
import com.tuoheng.admin.enums.InspectionStatusEnum; | |||
import com.tuoheng.admin.enums.InspectionTypeEnum; | |||
import com.tuoheng.admin.enums.code.inspection.ResubmitInspectionCodeEnum; | |||
import com.tuoheng.admin.enums.code.report.GenerateReportCodeEnum; | |||
import com.tuoheng.admin.mapper.*; | |||
import com.tuoheng.admin.request.inspection.EditInspectionRequest; | |||
import com.tuoheng.admin.service.third.pilot.PilotService; | |||
import com.tuoheng.admin.utils.ShiroUtils; | |||
import com.tuoheng.admin.utils.CurrentUserUtil; | |||
import com.tuoheng.common.core.utils.DateUtils; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import com.tuoheng.common.core.utils.StringUtils; | |||
@@ -55,8 +48,8 @@ public class GenerateReportService { | |||
*/ | |||
public JsonResult generate(String id) { | |||
log.info("进入生成报告业务"); | |||
String userId = ShiroUtils.getUserId(); | |||
String tenantId = ShiroUtils.getTenantId(); | |||
String userId = CurrentUserUtil.getUserId(); | |||
String tenantId = CurrentUserUtil.getTenantId(); | |||
JsonResult result = this.check(id); | |||
if (0 != result.getCode()) { |
@@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.tuoheng.admin.conver.InspectionFileConverMapper; | |||
import com.tuoheng.admin.conver.ReportConverMapper; | |||
import com.tuoheng.admin.entity.Dept; | |||
import com.tuoheng.admin.entity.InspectionFile; | |||
import com.tuoheng.admin.entity.InspectionFileHandle; | |||
import com.tuoheng.admin.entity.Report; | |||
@@ -13,7 +12,7 @@ import com.tuoheng.admin.enums.code.report.QueryInspectionReportCodeEnum; | |||
import com.tuoheng.admin.mapper.InspectionFileHandleMapper; | |||
import com.tuoheng.admin.mapper.InspectionFileMapper; | |||
import com.tuoheng.admin.mapper.ReportMapper; | |||
import com.tuoheng.admin.utils.ShiroUtils; | |||
import com.tuoheng.admin.utils.CurrentUserUtil; | |||
import com.tuoheng.admin.vo.InspectionFileHandleReportVo; | |||
import com.tuoheng.admin.vo.InspectionFileReportVo; | |||
import com.tuoheng.admin.vo.InspectionReportVo; | |||
@@ -54,8 +53,8 @@ public class QueryInspectionHandleReportService { | |||
public JsonResult getInspectionHandleReport(String id) { | |||
log.info("进入查看巡检处理报告业务"); | |||
String userId = ShiroUtils.getUserId(); | |||
String tenantId = ShiroUtils.getTenantId(); | |||
String userId = CurrentUserUtil.getUserId(); | |||
String tenantId = CurrentUserUtil.getTenantId(); | |||
JsonResult result = this.check(tenantId, id); | |||
if (0 != result.getCode()) { |
@@ -1,22 +1,15 @@ | |||
package com.tuoheng.admin.service.report.query; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.core.metadata.IPage; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.tuoheng.admin.conver.InspectionFileConverMapper; | |||
import com.tuoheng.admin.conver.ReportConverMapper; | |||
import com.tuoheng.admin.entity.*; | |||
import com.tuoheng.admin.enums.code.report.QueryInspectionReportCodeEnum; | |||
import com.tuoheng.admin.mapper.DeptMapper; | |||
import com.tuoheng.admin.mapper.InspectionFileMapper; | |||
import com.tuoheng.admin.mapper.ReportMapper; | |||
import com.tuoheng.admin.mapper.UserMapper; | |||
import com.tuoheng.admin.request.report.QueryReportPageListRequest; | |||
import com.tuoheng.admin.utils.ShiroUtils; | |||
import com.tuoheng.admin.vo.InspectionFileHandleVo; | |||
import com.tuoheng.admin.utils.CurrentUserUtil; | |||
import com.tuoheng.admin.vo.InspectionFileReportVo; | |||
import com.tuoheng.admin.vo.InspectionReportVo; | |||
import com.tuoheng.admin.vo.ReportPageListVo; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import com.tuoheng.common.core.utils.StringUtils; | |||
import lombok.extern.slf4j.Slf4j; | |||
@@ -45,8 +38,8 @@ public class QueryInspectionReportService { | |||
public JsonResult getInspectionReport(String id) { | |||
log.info("进入查看巡检报告业务"); | |||
String userId = ShiroUtils.getUserId(); | |||
String tenantId = ShiroUtils.getTenantId(); | |||
String userId = CurrentUserUtil.getUserId(); | |||
String tenantId = CurrentUserUtil.getTenantId(); | |||
JsonResult result = this.check(tenantId, id); | |||
if (0 != result.getCode()) { |
@@ -11,8 +11,7 @@ import com.tuoheng.admin.mapper.DeptMapper; | |||
import com.tuoheng.admin.mapper.ReportMapper; | |||
import com.tuoheng.admin.mapper.UserMapper; | |||
import com.tuoheng.admin.request.report.QueryReportPageListRequest; | |||
import com.tuoheng.admin.utils.ShiroUtils; | |||
import com.tuoheng.admin.vo.InspectionVo; | |||
import com.tuoheng.admin.utils.CurrentUserUtil; | |||
import com.tuoheng.admin.vo.ReportPageListVo; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import lombok.extern.slf4j.Slf4j; | |||
@@ -52,8 +51,8 @@ public class QueryReportPageListService { | |||
public JsonResult getPageList(QueryReportPageListRequest request) { | |||
log.info("进入查询巡检任务分页列表业务"); | |||
String userId = ShiroUtils.getUserId(); | |||
String tenantId = ShiroUtils.getTenantId(); | |||
String userId = CurrentUserUtil.getUserId(); | |||
String tenantId = CurrentUserUtil.getTenantId(); | |||
JsonResult result = this.check(tenantId, request); | |||
if (0 != result.getCode()) { |
@@ -10,7 +10,7 @@ import com.tuoheng.admin.enums.code.road.QueryRoadListByDeptIdCodeEnum; | |||
import com.tuoheng.admin.mapper.DeptMapper; | |||
import com.tuoheng.admin.mapper.RoadDeptMapper; | |||
import com.tuoheng.admin.mapper.RoadInformationMapper; | |||
import com.tuoheng.admin.utils.ShiroUtils; | |||
import com.tuoheng.admin.utils.CurrentUserUtil; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import com.tuoheng.common.core.utils.StringUtils; | |||
import lombok.extern.slf4j.Slf4j; | |||
@@ -44,7 +44,7 @@ public class QueryRoadListByDeptIdService { | |||
public JsonResult getRoadList(String deptId) { | |||
log.info("进入根据部门Id查询公路列表业务"); | |||
String tenantId = ShiroUtils.getTenantId(); | |||
String tenantId = CurrentUserUtil.getTenantId(); | |||
// 校验 | |||
JsonResult result = this.check(tenantId, deptId); |
@@ -5,7 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.tuoheng.admin.entity.*; | |||
import com.tuoheng.admin.enums.code.section.QuerySectionListByDeptIdCodeEnum; | |||
import com.tuoheng.admin.mapper.*; | |||
import com.tuoheng.admin.utils.ShiroUtils; | |||
import com.tuoheng.admin.utils.CurrentUserUtil; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import com.tuoheng.common.core.utils.StringUtils; | |||
import lombok.extern.slf4j.Slf4j; | |||
@@ -45,7 +45,7 @@ public class QuerySectionListByDeptIdService { | |||
public JsonResult getList(String id) { | |||
log.info("进入根据部门Id查询路段列表业务"); | |||
String tenantId = ShiroUtils.getTenantId(); | |||
String tenantId = CurrentUserUtil.getTenantId(); | |||
// 校验 | |||
JsonResult result = this.check(tenantId, id); |
@@ -2,24 +2,18 @@ package com.tuoheng.admin.service.section.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.RoadInformation; | |||
import com.tuoheng.admin.entity.Section; | |||
import com.tuoheng.admin.entity.SectionDept; | |||
import com.tuoheng.admin.enums.code.section.QuerySectionListByDeptIdCodeEnum; | |||
import com.tuoheng.admin.enums.code.section.QuerySectionListByRoadIdCodeEnum; | |||
import com.tuoheng.admin.mapper.*; | |||
import com.tuoheng.admin.utils.ShiroUtils; | |||
import com.tuoheng.admin.utils.CurrentUserUtil; | |||
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.HashMap; | |||
import java.util.List; | |||
import java.util.Map; | |||
import java.util.stream.Collectors; | |||
/** | |||
* 根据公路id获取该公路下路段信息列表 | |||
@@ -46,7 +40,7 @@ public class QuerySectionListByRoadIdService { | |||
public JsonResult getList(String roadId) { | |||
log.info("根据公路id获取该公路下路段信息列表业务"); | |||
String tenantId = ShiroUtils.getTenantId(); | |||
String tenantId = CurrentUserUtil.getTenantId(); | |||
// 校验 | |||
JsonResult result = this.check(tenantId, roadId); |
@@ -2,7 +2,10 @@ package com.tuoheng.admin.service.user; | |||
import com.baomidou.mybatisplus.extension.service.IService; | |||
import com.tuoheng.admin.entity.User; | |||
import com.tuoheng.admin.request.user.QueryUserPageListRequest; | |||
import com.tuoheng.admin.request.user.UserResetPwdRequest; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import org.springframework.web.bind.annotation.*; | |||
/** | |||
* <p> | |||
@@ -12,7 +15,63 @@ import com.tuoheng.common.core.utils.JsonResult; | |||
* @author 拓恒 | |||
* @since 2020-10-30 | |||
*/ | |||
public interface IUserService extends IService<User> { | |||
public interface IUserService { | |||
/** | |||
* 获取用户分页列表 | |||
* | |||
* @param request 查询条件 | |||
* @return | |||
*/ | |||
JsonResult getPageList(QueryUserPageListRequest request); | |||
/** | |||
* 获取用户详情 | |||
* | |||
* @param id 用户ID | |||
* @return | |||
*/ | |||
JsonResult detail(@PathVariable("id") String id); | |||
/** | |||
* 添加用户 | |||
* | |||
* @param entity 实体对象 | |||
* @return | |||
*/ | |||
JsonResult add(@RequestBody User entity); | |||
/** | |||
* 编辑用户 | |||
* | |||
* @param entity 实体对象 | |||
* @return | |||
*/ | |||
JsonResult edit(User entity); | |||
/** | |||
* 删除用户 | |||
* | |||
* @param userIds 用户ID | |||
* @return | |||
*/ | |||
JsonResult deleteByIds(String[] userIds); | |||
/** | |||
* 设置状态 | |||
* | |||
* @param entity 实体对象 | |||
* @return | |||
*/ | |||
JsonResult updeateStatus(User entity); | |||
/** | |||
* 重置密码 | |||
* | |||
* @param request 参数 | |||
* @return | |||
*/ | |||
JsonResult resetPwd(UserResetPwdRequest request); | |||
/** | |||
* 根据部门id查询用户列表 |
@@ -1,14 +1,16 @@ | |||
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.request.user.QueryUserPageListRequest; | |||
import com.tuoheng.admin.request.user.UserResetPwdRequest; | |||
import com.tuoheng.admin.service.user.query.QueryUserListByDeptIdService; | |||
import com.tuoheng.admin.service.user.query.QueryUserPageListService; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
import org.springframework.web.bind.annotation.PathVariable; | |||
import org.springframework.web.bind.annotation.RequestBody; | |||
/** | |||
@@ -21,11 +23,93 @@ import org.springframework.stereotype.Service; | |||
*/ | |||
@Slf4j | |||
@Service | |||
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IUserService { | |||
public class UserServiceImpl implements IUserService { | |||
@Autowired | |||
private QueryUserPageListService queryUserPageListService; | |||
@Autowired | |||
private QueryUserListByDeptIdService queryUserListByDeptIdService; | |||
/** | |||
* 获取用户分页列表 | |||
* | |||
* @param request 查询条件 | |||
* @return | |||
*/ | |||
@Override | |||
public JsonResult getPageList(QueryUserPageListRequest request) { | |||
return queryUserPageListService.getPageList(request); | |||
} | |||
/** | |||
* 获取用户详情 | |||
* | |||
* @param id 用户ID | |||
* @return | |||
*/ | |||
@Override | |||
public JsonResult detail(@PathVariable("id") String id) { | |||
return null; | |||
} | |||
/** | |||
* 添加用户 | |||
* | |||
* @param entity 实体对象 | |||
* @return | |||
*/ | |||
@Override | |||
public JsonResult add(@RequestBody User entity) { | |||
return null; | |||
} | |||
/** | |||
* 编辑用户 | |||
* | |||
* @param entity 实体对象 | |||
* @return | |||
*/ | |||
@Override | |||
public JsonResult edit(@RequestBody User entity) { | |||
return null; | |||
} | |||
/** | |||
* 删除用户 | |||
* | |||
* @param userIds 用户ID | |||
* @return | |||
*/ | |||
@Override | |||
public JsonResult deleteByIds(String[] userIds) { | |||
return null; | |||
} | |||
/** | |||
* 设置状态 | |||
* | |||
* @param entity 实体对象 | |||
* @return | |||
*/ | |||
@Override | |||
public JsonResult updeateStatus(User entity) { | |||
return null; | |||
} | |||
/** | |||
* 重置密码 | |||
* | |||
* @param request 参数 | |||
* @return | |||
*/ | |||
@Override | |||
public JsonResult resetPwd(UserResetPwdRequest request) { | |||
return null; | |||
} | |||
/** | |||
* 根据部门id查询用户列表 | |||
*/ |
@@ -0,0 +1,102 @@ | |||
package com.tuoheng.admin.service.user.query; | |||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||
import com.baomidou.mybatisplus.core.metadata.IPage; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.tuoheng.admin.entity.User; | |||
import com.tuoheng.admin.mapper.DeptMapper; | |||
import com.tuoheng.admin.mapper.UserMapper; | |||
import com.tuoheng.admin.request.user.QueryUserPageListRequest; | |||
import com.tuoheng.admin.utils.CurrentUserUtil; | |||
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; | |||
/** | |||
* 查询用户分页列表业务层处理 | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-12-08 | |||
*/ | |||
@Slf4j | |||
@Service | |||
public class QueryUserPageListService { | |||
@Autowired | |||
private UserMapper userMapper; | |||
@Autowired | |||
private DeptMapper deptMapper; | |||
/** | |||
* 获取部门树形列表 | |||
* | |||
* @return | |||
*/ | |||
public JsonResult getPageList(QueryUserPageListRequest request) { | |||
log.info("进入查询用户分页列表业务业务"); | |||
JsonResult result = this.check(request); | |||
if (0 != result.getCode()) { | |||
log.info("查询用户分页列表业务:校验失败:{}", result.getMsg()); | |||
return result; | |||
} | |||
String tenantId = CurrentUserUtil.getTenantId(); | |||
QueryWrapper<User> queryWrapper = this.buildQueryWrapper(request); | |||
// 查询分页数据 | |||
IPage<User> page = new Page<>(request.getPage(), request.getLimit()); | |||
IPage<User> pageData = userMapper.selectPage(page, queryWrapper); | |||
// if (CollectionUtil.isEmpty(pageData)) { | |||
// log.info("查询用户分页列表业务:获取用户列表为空"); | |||
// } | |||
return JsonResult.success(); | |||
} | |||
/** | |||
* 检查参数 | |||
* | |||
* @param request | |||
* @return | |||
*/ | |||
private JsonResult check(QueryUserPageListRequest request) { | |||
return JsonResult.success(); | |||
} | |||
private QueryWrapper<User> buildQueryWrapper(QueryUserPageListRequest request) { | |||
// 查询条件 | |||
QueryWrapper<User> queryWrapper = new QueryWrapper<>(); | |||
// 只显示非管理员用户 | |||
//queryWrapper.ne("is_admin", 1); | |||
// 租户ID | |||
queryWrapper.eq("tenant_id", CurrentUserUtil.getTenantId()); | |||
// 真实姓名 | |||
if (!StringUtils.isEmpty(request.getRealname())) { | |||
queryWrapper.like("realname", request.getRealname()); | |||
} | |||
// 用户账号 | |||
if (!StringUtils.isEmpty(request.getUsername())) { | |||
queryWrapper.eq("username", request.getUsername()); | |||
} | |||
//根据角色id查询 | |||
if (StringUtils.isNotNull((request.getRoleId()))) { | |||
queryWrapper.eq("role_id", request.getRoleId()); | |||
} | |||
// 状态筛选 | |||
if (StringUtils.isNotNull(request.getStatus())) { | |||
queryWrapper.eq("status", request.getStatus()); | |||
} | |||
queryWrapper.eq("mark", 1); | |||
queryWrapper.orderByDesc("create_time"); | |||
return queryWrapper; | |||
} | |||
} |
@@ -7,12 +7,10 @@ import com.tuoheng.admin.enums.UserTypeEnum; | |||
import com.tuoheng.admin.enums.WorkOrderStatusEnum; | |||
import com.tuoheng.admin.enums.code.workorder.DistributionWorkorderCodeEnum; | |||
import com.tuoheng.admin.enums.code.workorder.GenerateWorkorderCodeEnum; | |||
import com.tuoheng.admin.mapper.InspectionFileMapper; | |||
import com.tuoheng.admin.mapper.UserMapper; | |||
import com.tuoheng.admin.mapper.WorkOrderFileMapper; | |||
import com.tuoheng.admin.mapper.WorkOrderMapper; | |||
import com.tuoheng.admin.request.workorder.DistributionWorkorderRequest; | |||
import com.tuoheng.admin.utils.ShiroUtils; | |||
import com.tuoheng.admin.utils.CurrentUserUtil; | |||
import com.tuoheng.common.core.utils.DateUtils; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import com.tuoheng.common.core.utils.StringUtils; | |||
@@ -47,8 +45,8 @@ public class DistributionWorkorderService { | |||
@Transactional | |||
public JsonResult distribution(DistributionWorkorderRequest request) { | |||
log.info("进入分配工单业务, request:{}", request); | |||
String userId = ShiroUtils.getUserId(); | |||
String tenantId = ShiroUtils.getTenantId(); | |||
String userId = CurrentUserUtil.getUserId(); | |||
String tenantId = CurrentUserUtil.getTenantId(); | |||
JsonResult result = this.check(request); | |||
if (0 != result.getCode()) { | |||
log.info("进入分配工单业务:校验失败:{}", result.getMsg()); |
@@ -6,18 +6,12 @@ import com.tuoheng.admin.entity.*; | |||
import com.tuoheng.admin.enums.InspectionFileStatusEnum; | |||
import com.tuoheng.admin.enums.UserTypeEnum; | |||
import com.tuoheng.admin.enums.WorkOrderStatusEnum; | |||
import com.tuoheng.admin.enums.code.inspection.DeleteInspectionCodeEnum; | |||
import com.tuoheng.admin.enums.code.inspectionfile.InspectionFileConfirmCodeEnum; | |||
import com.tuoheng.admin.enums.code.inspectionfile.QueryInspectionFilePageListByInspectionIdCodeEnum; | |||
import com.tuoheng.admin.enums.code.workorder.GenerateWorkorderCodeEnum; | |||
import com.tuoheng.admin.mapper.*; | |||
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFilePageListByInspectionIdRequest; | |||
import com.tuoheng.admin.utils.ShiroUtils; | |||
import com.tuoheng.admin.utils.CurrentUserUtil; | |||
import com.tuoheng.common.core.utils.DateUtils; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import com.tuoheng.common.core.utils.StringUtils; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.apache.poi.ss.usermodel.Workbook; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
import org.springframework.transaction.annotation.Transactional; | |||
@@ -68,8 +62,8 @@ public class GenerateWorkorderService { | |||
@Transactional | |||
public JsonResult generate(List<String> idList) { | |||
log.info("进入生成工单业务, idList:{}", idList); | |||
String userId = ShiroUtils.getUserId(); | |||
String tenantId = ShiroUtils.getTenantId(); | |||
String userId = CurrentUserUtil.getUserId(); | |||
String tenantId = CurrentUserUtil.getTenantId(); | |||
JsonResult result = this.check(idList); | |||
if (0 != result.getCode()) { | |||
log.info("进入生成工单业务:校验失败:{}", result.getMsg()); |
@@ -1,13 +1,10 @@ | |||
package com.tuoheng.admin.service.workorder.query; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.tuoheng.admin.entity.Inspection; | |||
import com.tuoheng.admin.entity.WorkOrder; | |||
import com.tuoheng.admin.entity.WorkOrderFile; | |||
import com.tuoheng.admin.enums.code.inspectionfile.QueryInspectionFilePageListByInspectionIdCodeEnum; | |||
import com.tuoheng.admin.enums.code.workorder.QueryWorkOrderDetailsCodeEnum; | |||
import com.tuoheng.admin.mapper.*; | |||
import com.tuoheng.admin.utils.ShiroUtils; | |||
import com.tuoheng.admin.utils.CurrentUserUtil; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import com.tuoheng.common.core.utils.StringUtils; | |||
import lombok.extern.slf4j.Slf4j; | |||
@@ -37,7 +34,7 @@ public class QueryWorkOrderDetailsService { | |||
public JsonResult getDetails(String id) { | |||
log.info("进入查询工单详情业务, id:{}", id); | |||
String userId = ShiroUtils.getUserId(); | |||
String userId = CurrentUserUtil.getUserId(); | |||
JsonResult result = this.check(id); | |||
if (0 != result.getCode()) { |
@@ -11,7 +11,7 @@ import com.tuoheng.admin.enums.UserTypeEnum; | |||
import com.tuoheng.admin.enums.code.inspection.QueryInspectionPageListCodeEnum; | |||
import com.tuoheng.admin.mapper.*; | |||
import com.tuoheng.admin.request.workorder.QueryWorkOrderPageListRequest; | |||
import com.tuoheng.admin.utils.ShiroUtils; | |||
import com.tuoheng.admin.utils.CurrentUserUtil; | |||
import com.tuoheng.admin.vo.WorkOrderPageListVo; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import com.tuoheng.common.core.utils.StringUtils; | |||
@@ -54,7 +54,7 @@ public class QueryWorkOrderPageListService { | |||
public JsonResult getPageList(QueryWorkOrderPageListRequest request) { | |||
log.info("进入查询工单分页列表业务, request:{}", request.toString()); | |||
String userId = ShiroUtils.getUserId(); | |||
String userId = CurrentUserUtil.getUserId(); | |||
JsonResult result = this.check(request); | |||
if (0 != result.getCode()) { |
@@ -0,0 +1,82 @@ | |||
package com.tuoheng.admin.utils; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.tuoheng.admin.entity.Tenant; | |||
import com.tuoheng.admin.entity.User; | |||
import com.tuoheng.admin.mapper.TenantMapper; | |||
import com.tuoheng.admin.mapper.UserMapper; | |||
import com.tuoheng.common.core.exception.ServiceException; | |||
import com.tuoheng.common.core.utils.SecurityUserUtils; | |||
import org.springframework.beans.BeanUtils; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.http.HttpStatus; | |||
import javax.annotation.PostConstruct; | |||
import java.util.Optional; | |||
/** | |||
* 直接从该工具类中获取当前登录用户信息 | |||
*/ | |||
public class CurrentUserUtil { | |||
@Autowired | |||
private UserMapper userMapper; | |||
@Autowired | |||
private TenantMapper tenantMapper; | |||
private static CurrentUserUtil currentUserUtil; | |||
@PostConstruct | |||
public void init() { | |||
currentUserUtil = this; | |||
currentUserUtil.userMapper = this.userMapper; | |||
currentUserUtil.tenantMapper = this.tenantMapper; | |||
} | |||
/** | |||
* 私有构造器 | |||
**/ | |||
private CurrentUserUtil() { | |||
} | |||
/** | |||
* 获取当前用户信息 | |||
* | |||
* @return | |||
*/ | |||
public static User getUserInfo() { | |||
// String username = SecurityUserUtils.username(); | |||
String username = "admin"; | |||
User user = currentUserUtil.userMapper.selectOne(Wrappers.<User>lambdaQuery().eq(User::getMark, 1).eq(User::getStatus, 1).eq(User::getUsername, username)); | |||
if (null == user) { | |||
Tenant tenant = currentUserUtil.tenantMapper.selectOne(Wrappers.<Tenant>lambdaQuery().eq(Tenant::getMark, 1).eq(Tenant::getStatus, 1).eq(Tenant::getUsername, username)); | |||
if (null == tenant) { | |||
throw new ServiceException(HttpStatus.BAD_REQUEST.value(), "该用户并未创建"); | |||
} | |||
} | |||
return user; | |||
} | |||
/** | |||
* 获取用户编号 | |||
* | |||
* @return | |||
*/ | |||
public static String getUserId() { | |||
User user = getUserInfo(); | |||
return Optional.ofNullable(user.getId()).orElseThrow(() -> | |||
new ServiceException(HttpStatus.BAD_REQUEST.value(), "未获取到当前用户信息!")); | |||
} | |||
/** | |||
* 租户ID | |||
* | |||
* @return | |||
*/ | |||
public static String getTenantId() { | |||
User user = getUserInfo(); | |||
return Optional.ofNullable(user.getTenantId()).orElseThrow(() -> | |||
new ServiceException(HttpStatus.BAD_REQUEST.value(), "未获取到当前租户信息!")); | |||
} | |||
} |
@@ -1,52 +0,0 @@ | |||
package com.tuoheng.admin.utils; | |||
import com.tuoheng.admin.entity.User; | |||
import com.tuoheng.common.core.exception.ServiceException; | |||
import org.springframework.http.HttpStatus; | |||
import java.util.Optional; | |||
/** | |||
* Shiro工具类 | |||
*/ | |||
public class ShiroUtils { | |||
/** | |||
* 私有构造器 | |||
**/ | |||
private ShiroUtils() { | |||
} | |||
/** | |||
* 获取当前用户信息 | |||
* | |||
* @return | |||
*/ | |||
public static User getUserInfo() { | |||
// return (User) SecurityUtils.getSubject().getPrincipal(); | |||
return null; | |||
} | |||
/** | |||
* 获取用户编号 | |||
* | |||
* @return | |||
*/ | |||
public static String getUserId() { | |||
// User user = getUserInfo(); | |||
// return Optional.ofNullable(user.getId()).orElseThrow(() -> | |||
// new ServiceException(HttpStatus.BAD_REQUEST.value(), "未获取到当前用户信息!")); | |||
return "1"; | |||
} | |||
/** | |||
* 租户ID | |||
* | |||
* @return | |||
*/ | |||
public static String getTenantId() { | |||
return "0"; | |||
} | |||
} |