干扰源功能:用户管理

This commit is contained in:
qijian
2022-11-14 15:52:39 +08:00
parent 6dc3c76120
commit a119908bc0
10 changed files with 381 additions and 24 deletions

View File

@@ -1,22 +1,26 @@
package com.njcn.process.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.constant.OperateType;
import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.process.pojo.param.LoadTypeUserParam;
import com.njcn.process.pojo.param.LoadTypeUserSearchParam;
import com.njcn.process.pojo.param.LoadTypeUserUploadParam;
import com.njcn.process.pojo.po.RLoadTypeUserManage;
import com.njcn.process.pojo.vo.RLoadTypeUserManageVO;
import com.njcn.process.service.LoadTypeUserManageService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
/**
* 干扰源用户管理
@@ -35,17 +39,70 @@ public class LoadTypeUserManageController extends BaseController {
private final LoadTypeUserManageService loadTypeUserManageService;
/**
* 查询所有数据
* 查询所有干扰源用户
* @author qijian
* @date 2022/11/11
*/
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@GetMapping("/getAll")
@PostMapping("/getLoadTypeUserList")
@ApiOperation("查询所有数据")
public HttpResult<List<RLoadTypeUserManageVO>> getAll(){
String methodDescribe = getMethodDescribe("getAll");
List<RLoadTypeUserManageVO> list = loadTypeUserManageService.getAll();
@ApiImplicitParam(name = "loadTypeUserSearchParam", value = "干扰源用户入参", required = true)
public HttpResult<Page<RLoadTypeUserManageVO>> getLoadTypeUserList(@RequestBody @Validated LoadTypeUserSearchParam loadTypeUserSearchParam){
String methodDescribe = getMethodDescribe("getLoadTypeUserList");
Page<RLoadTypeUserManageVO> list = loadTypeUserManageService.getLoadTypeUserList(loadTypeUserSearchParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
}
/**
* 根据id查询干扰源用户
* @author qijian
* @date 2022/11/14
*/
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@GetMapping("/getLoadTypeUserById")
@ApiOperation("根据id查询干扰源用户")
@ApiImplicitParam(name = "id", value = "id", required = true)
public HttpResult<RLoadTypeUserManage> getLoadTypeUserById(@RequestParam("id") String id){
String methodDescribe = getMethodDescribe("getLoadTypeUserById");
RLoadTypeUserManage rLoadTypeUserManage = loadTypeUserManageService.getLoadTypeUserById(id);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, rLoadTypeUserManage, methodDescribe);
}
/**
* 新增干扰源用户
* @author qijian
* @date 2022/11/14
*/
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType= OperateType.ADD)
@PostMapping("/addLoadTypeUser")
@ApiOperation("新增干扰源用户")
@ApiImplicitParam(name = "loadTypeUserParam", value = "实体参数", required = true)
public HttpResult<Boolean> addLoadTypeUser(@RequestBody @Validated LoadTypeUserParam loadTypeUserParam){
String methodDescribe = getMethodDescribe("addLoadTypeUser");
boolean res = loadTypeUserManageService.addLoadTypeUser(loadTypeUserParam);
if(res){
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}else {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
}
}
/**
* 上传干扰源用户入网报告
* @author qijian
* @date 2022/11/14
*/
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType= OperateType.ADD)
@PostMapping("/uploadLoadTypeUser")
@ApiOperation("上传干扰源用户入网报告")
@ApiImplicitParam(name = "loadTypeUserUploadParam", value = "实体参数", required = true)
public HttpResult<Boolean> uploadLoadTypeUser(@RequestBody @Validated LoadTypeUserUploadParam loadTypeUserUploadParam){
String methodDescribe = getMethodDescribe("uploadLoadTypeUser");
boolean res = loadTypeUserManageService.uploadLoadTypeUser(loadTypeUserUploadParam);
if(res){
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}else {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
}
}
}

View File

@@ -2,10 +2,12 @@ package com.njcn.process.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.process.pojo.param.LoadTypeUserSearchParam;
import com.njcn.process.pojo.po.RLoadTypeUserManage;
import com.njcn.process.pojo.vo.RLoadTypeUserManageVO;
import java.util.List;
import org.apache.ibatis.annotations.Param;
/**
* 干扰源用户管理Mapper
@@ -17,8 +19,10 @@ import java.util.List;
public interface LoadTypeUserManageMapper extends BaseMapper<RLoadTypeUserManage> {
/**
* 查询所有数据
* 干扰源用户分页查询
* @param page 分页参数
* @param loadTypeUserSearchParam 入参
* @return 结果
*/
List<RLoadTypeUserManageVO> getAll();
Page<RLoadTypeUserManageVO> getLoadTypeUserPage(IPage<RLoadTypeUserManageVO> page, @Param("loadTypeUserParam") LoadTypeUserSearchParam loadTypeUserSearchParam);
}

View File

@@ -2,11 +2,24 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.process.mapper.LoadTypeUserManageMapper">
<select id="getAll" resultType="RLoadTypeUserManageVO">
<select id="getLoadTypeUserPage" resultType="RLoadTypeUserManageVO">
SELECT
*
FROM
r_load_type_user_manage
r_load_type_user_manage r
where 1=1
<if test="loadTypeUserSearchParam.orgNo != null and loadTypeUserSearchParam.orgNo != ''">
and r.org_no = #{loadTypeUserSearchParam.orgNo}
</if>
<if test="loadTypeUserSearchParam.loadType != null and loadTypeUserSearchParam.loadType != ''">
and r.load_type = #{loadTypeUserSearchParam.loadType}
</if>
<if test="loadTypeUserSearchParam.userName != null and loadTypeUserSearchParam.userName != ''">
and r.user_name like CONCAT(CONCAT('%', #{loadTypeUserSearchParam.userName}), '%')
</if>
<if test="loadTypeUserSearchParam.aIsFileUpload != null and loadTypeUserSearchParam.aIsFileUpload != ''">
and r.a_is_file_upload = #{loadTypeUserSearchParam.aIsFileUpload}
</if>
</select>
</mapper>

View File

@@ -1,9 +1,12 @@
package com.njcn.process.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.process.pojo.param.LoadTypeUserParam;
import com.njcn.process.pojo.param.LoadTypeUserSearchParam;
import com.njcn.process.pojo.param.LoadTypeUserUploadParam;
import com.njcn.process.pojo.po.RLoadTypeUserManage;
import com.njcn.process.pojo.vo.RLoadTypeUserManageVO;
import java.util.List;
/**
* 干扰源用户管理
*
@@ -13,5 +16,31 @@ import java.util.List;
*/
public interface LoadTypeUserManageService {
List<RLoadTypeUserManageVO> getAll();
/**
* 干扰源用户分页查询
* @param loadTypeUserSearchParam
* @return
*/
Page<RLoadTypeUserManageVO> getLoadTypeUserList(LoadTypeUserSearchParam loadTypeUserSearchParam);
/**
* 根据id查询干扰源用户
* @param id
* @return
*/
RLoadTypeUserManage getLoadTypeUserById(String id);
/**
* 新增干扰源用户
* @param loadTypeUserParam
* @return
*/
boolean addLoadTypeUser(LoadTypeUserParam loadTypeUserParam);
/**
* 上传干扰源用户入网报告
* @param loadTypeUserUploadParam
* @return
*/
boolean uploadLoadTypeUser(LoadTypeUserUploadParam loadTypeUserUploadParam);
}

View File

@@ -1,13 +1,27 @@
package com.njcn.process.service.impl;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.minio.bo.MinIoUploadResDTO;
import com.njcn.minio.config.MinIoProperties;
import com.njcn.minio.utils.MinIoUtils;
import com.njcn.process.enums.ProcessResponseEnum;
import com.njcn.process.mapper.LoadTypeUserManageMapper;
import com.njcn.process.pojo.param.LoadTypeUserParam;
import com.njcn.process.pojo.param.LoadTypeUserSearchParam;
import com.njcn.process.pojo.param.LoadTypeUserUploadParam;
import com.njcn.process.pojo.po.RLoadTypeUserManage;
import com.njcn.process.pojo.vo.RLoadTypeUserManageVO;
import com.njcn.process.service.LoadTypeUserManageService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
import javax.annotation.Resource;
import java.util.Date;
/**
* 干扰源用户管理
@@ -23,8 +37,89 @@ public class LoadTypeUserManageServiceImpl implements LoadTypeUserManageService
private final LoadTypeUserManageMapper loadTypeUserManageMapper;
@Resource
private MinIoUtils minIoUtils;
@Resource
private MinIoProperties minIoProperties;
/**
* 干扰源用户分页查询
* @param loadTypeUserSearchParam
* @return
*/
@Override
public List<RLoadTypeUserManageVO> getAll() {
return loadTypeUserManageMapper.getAll();
public Page<RLoadTypeUserManageVO> getLoadTypeUserList(LoadTypeUserSearchParam loadTypeUserSearchParam){
Page<RLoadTypeUserManageVO> page = new Page<>(loadTypeUserSearchParam.getPageNum(), loadTypeUserSearchParam.getPageSize());
return loadTypeUserManageMapper.getLoadTypeUserPage(page,loadTypeUserSearchParam);
}
/**
* 根据id查询干扰源用户
* @param id
* @return
*/
@Override
public RLoadTypeUserManage getLoadTypeUserById(String id) {
RLoadTypeUserManage rLoadTypeUserManage = loadTypeUserManageMapper.selectById(id);
return rLoadTypeUserManage;
}
/**
* 新增干扰源用户
* @param loadTypeUserParam
* @return
*/
@Override
public boolean addLoadTypeUser(LoadTypeUserParam loadTypeUserParam) {
//参数转换
RLoadTypeUserManage rLoadTypeUserManage = new RLoadTypeUserManage();
BeanUtils.copyProperties(loadTypeUserParam, rLoadTypeUserManage);
System.out.println(rLoadTypeUserManage);
//塞入建档时间
Date date = DateUtil.parse(loadTypeUserParam.getRecordTime(), "yyyy-MM-dd HH:mm:ss");
rLoadTypeUserManage.setRecordTime(date);
loadTypeUserManageMapper.insert(rLoadTypeUserManage);
return true;
}
/**
* 上传干扰源用户入网报告
* @param loadTypeUserUploadParam
* @return
*/
@Override
public boolean uploadLoadTypeUser(LoadTypeUserUploadParam loadTypeUserUploadParam) {
RLoadTypeUserManage rLoadTypeUserManage = new RLoadTypeUserManage();
//文件上传到Minio服务器存入文件名
MinIoUploadResDTO minIoUploadResDTO = fileToMinio(loadTypeUserUploadParam.getFile());
rLoadTypeUserManage.setIFilePath(minIoUploadResDTO.getMinFileName());
rLoadTypeUserManage.setIUploadTime(new Date());
//填入数据修改
BeanUtils.copyProperties(loadTypeUserUploadParam, rLoadTypeUserManage);
rLoadTypeUserManage.setIStatus("待审核");//需要修改字典
loadTypeUserManageMapper.updateById(rLoadTypeUserManage);
return true;
}
/**
* 上传文件到Minio
*
* @param file 文件
* @return 成功标记
*/
private MinIoUploadResDTO fileToMinio(MultipartFile file) {
try {
//把名称存入数据
MinIoUploadResDTO upload = minIoUtils.upload(file, minIoProperties.getBucket(), "loadTypeUser/");
return upload;
} catch (Exception e) {
throw new BusinessException(ProcessResponseEnum.UPLOAD_FILE_ERROR);
}
}
}