资料维护开发

This commit is contained in:
zhangqinlin
2021-09-03 18:33:34 +08:00
parent 6b51502347
commit 1a1fcaca9d
10 changed files with 253 additions and 59 deletions
@@ -43,8 +43,6 @@ import io.swagger.annotations.ApiOperation;
public class PayDataDirectoryController extends JeroController<PayDataDirectory, IPayDataDirectoryService> {
@Autowired
private IPayDataDirectoryService payDataDirectoryService;
@Resource
private PayDataDirectoryMapper payDataDirectoryMapper;
ArrayList<String> list = new ArrayList<>();
ArrayList<PayDataDirectory> list2 = new ArrayList<>();
@@ -218,7 +216,7 @@ public class PayDataDirectoryController extends JeroController<PayDataDirectory,
PayDataDirectory one = payDataDirectoryService.getOne(lambdaQueryWrapper);
if (!ObjectUtils.isEmpty(one)&&!list2.contains(one)) {
list2.add(one);
if (!"0".equals(one.getId())) {
if (!"0".equals(one.getParentId())) {
findToTree(one);
}
@@ -1,27 +1,33 @@
package com.jero.data.controller;
import java.util.ArrayList;
import java.util.Arrays;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.jero.common.api.vo.Result;
import com.jero.common.aspect.annotation.AutoLog;
import com.jero.common.system.base.controller.JeroController;
import com.jero.common.system.query.QueryGenerator;
import com.jero.data.entity.PayDataFile;
import com.jero.common.system.vo.LoginUser;
import com.jero.data.entity.*;
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.jero.data.entity.QueryFileList2;
import com.jero.data.mapper.PayDataFileMapper;
import com.jero.data.service.IPayDataDirectoryService;
import com.jero.data.service.IPayDataFileService;
import com.jero.modules.oss.mapper.OSSFileMapper;
import com.jero.data.service.IPayFileDownloadRecordService;
import com.jero.modules.oss.service.IOSSFileService;
import io.swagger.annotations.ApiImplicitParam;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import io.swagger.annotations.Api;
@@ -38,6 +44,9 @@ import io.swagger.annotations.ApiOperation;
@RequestMapping("/payDataFile/payDataFile")
@Slf4j
public class PayDataFileController extends JeroController<PayDataFile, IPayDataFileService> {
@Autowired
private IPayDataDirectoryService payDataDirectoryService;
@Autowired
private IPayDataFileService payDataFileService;
@@ -45,25 +54,31 @@ public class PayDataFileController extends JeroController<PayDataFile, IPayDataF
private PayDataFileMapper payDataFileMapper;
@Resource
private OSSFileMapper ossFileMapper;
private IOSSFileService iossFileService;
StringBuffer stringBuffer;
@Autowired
private IPayFileDownloadRecordService payFileDownloadRecordService;
/**
* 分页列表查询
*
* @return
*
*/
@AutoLog(value = "资料维护(资料列表)-根据文件夹id分页列表查询")
@ApiOperation(value="资料维护(资料列表)-根据文件夹id分页列表查询", notes="资料维护(资料列表)-根据文件夹id分页列表查询")
@GetMapping(value = "/list")
@ApiImplicitParam(name = "id", value = "目录id", dataType = "String", required = true)
public Result<?> queryPageList(
@RequestParam(name="id",required =true) String id,
@RequestParam(name="id") String id,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
@RequestParam(name="id",required =false) String fileName
@RequestParam(name="fileName",required =false) String fileName
) {
QueryWrapper<Object> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("pf.id",id);
queryWrapper.eq(StringUtils.isNotBlank(fileName),"of.fileName",fileName);
queryWrapper.eq("pd.id",id);
queryWrapper.like(StringUtils.isNotBlank(fileName),"of.fileName",fileName);
queryWrapper.orderByDesc("pf.create_time");
Page<PayDataFile> page = new Page<>(pageNo, pageSize);
IPage<QueryFileList2> pageList = payDataFileMapper.pageData(page, queryWrapper);
@@ -71,77 +86,159 @@ public class PayDataFileController extends JeroController<PayDataFile, IPayDataF
}
/**
* 添加
* 分页列表查询
*
*
* @param payDataFile
* @return
*/
@AutoLog(value = "资料维护-添加")
@ApiOperation(value="资料维护-添加", notes="资料维护-添加")
@AutoLog(value = "资料维护(会议列表)-根据文件夹id分页列表查询")
@ApiOperation(value="资料维护(会议列表)-根据文件夹id分页列表查询", notes="资料维护(会议列表)-根据文件夹id分页列表查询")
@GetMapping(value = "/listMeeting")
@ApiImplicitParam(name = "id", value = "目录id", dataType = "String", required = true)
public Result<?> queryPageListMeeting(
@RequestParam(name="id") String id,
QueryFileListBySearch queryFileListBySearch,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<QueryFileListBySearch> queryWrapper = QueryGenerator.initQueryWrapper(queryFileListBySearch, req.getParameterMap());
Page<PayDataFile> page = new Page<>(pageNo, pageSize);
queryWrapper.eq("pd.type",2);
queryWrapper.orderByDesc("pf.create_time");
queryWrapper.eq("pd.id",id);
// QueryWrapper<Object> queryWrapper = new QueryWrapper<>();
// queryWrapper.eq("pf.id",id);
// queryWrapper.like(StringUtils.isNotBlank(fileName),"of.fileName",fileName);
// queryWrapper.like(StringUtils.isNotBlank(meetingName),"of.fileName",meetingName);
// queryWrapper.orderByDesc("pf.create_time");
// queryWrapper.eq("pd.type",2);
// Page<PayDataFile> page = new Page<>(pageNo, pageSize);
IPage<QueryFileList> pageList = payDataFileMapper.pageDataMeeting(page,queryWrapper);
return Result.OK(pageList);
}
/**
* 资料列表添加
*
*/
@AutoLog(value = "资料维护(资料和会议)-添加")
@ApiOperation(value="资料维护(资料和会议)-添加", notes="资料维护(资料和会议)-添加")
@PostMapping(value = "/add")
public Result<?> add(@RequestBody PayDataFile payDataFile) {
payDataFileService.save(payDataFile);
@Transactional
public Result<?> add(@RequestParam(name="dataId") String dataId,
@RequestParam(name="fileIds") String fileIds,
@RequestParam(name="dataType") int dataType) {
ArrayList<String> fileIdList = new ArrayList<>(Arrays.asList(fileIds.split(",")));
ArrayList<PayDataFile> list = new ArrayList<>();
stringBuffer = new StringBuffer();
findToTree(dataId,dataType);
stringBuffer.deleteCharAt(stringBuffer.lastIndexOf("/"));
for ( String id:fileIdList){
PayDataFile payDataFile = new PayDataFile();
payDataFile.setFilePath(stringBuffer.toString());
payDataFile.setFileId(id);
payDataFile.setDataId(dataId);
list.add(payDataFile);
}
payDataFileService.saveBatch(list);
return Result.OK("添加成功!");
}
//拼接目录层级
private void findToTree(String id,int dataType) {
LoginUser sysUser =(LoginUser) SecurityUtils.getSubject().getPrincipal();
LambdaQueryWrapper<PayDataDirectory> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(PayDataDirectory::getId, id);
lambdaQueryWrapper.eq(PayDataDirectory::getType, dataType);
lambdaQueryWrapper.eq(PayDataDirectory::getCreateBy, sysUser.getUsername());
PayDataDirectory one = payDataDirectoryService.getOne(lambdaQueryWrapper);
if (!ObjectUtils.isEmpty(one)) {
if (!"0".equals(one.getParentId())) {
findToTree(one.getParentId(),dataType);
}
stringBuffer.append(one.getName()).append("/");
}
}
/**
* 编辑
*
* @param payDataFile
* @return
*/
@AutoLog(value = "资料维护-编辑")
@ApiOperation(value="资料维护-编辑", notes="资料维护-编辑")
@PutMapping(value = "/edit")
public Result<?> edit(@RequestBody PayDataFile payDataFile) {
payDataFileService.updateById(payDataFile);
@AutoLog(value = "资料维护(资料和会议)-编辑")
@ApiOperation(value="资料维护(资料和会议)-编辑", notes="资料维护(资料和会议)-编辑")
@PostMapping(value = "/edit")
@Transactional
@ApiImplicitParam(name = "dataId", value = "目录id", dataType = "String", required = true)
public Result<?> edit(@RequestParam(name="dataId") String dataId,
@RequestParam(name="oldFileId") String oldFileId,
@RequestParam(name="newFileId") String newFileId,
@RequestParam(name="dataType") int dataType) {
iossFileService.removeById(oldFileId);
stringBuffer = new StringBuffer();
findToTree(dataId,dataType);
stringBuffer.deleteCharAt(stringBuffer.lastIndexOf("/"));
PayDataFile payDataFile = new PayDataFile();
payDataFile.setFilePath(stringBuffer.toString());
payDataFile.setFileId(newFileId);
payDataFile.setDataId(dataId);
payDataFileService.save(payDataFile);
return Result.OK("编辑成功!");
}
/**
* 通过id删除
*
* @param id
* @return
*/
@AutoLog(value = "资料维护-通过id删除")
@ApiOperation(value="资料维护-通过id删除", notes="资料维护-通过id删除")
@DeleteMapping(value = "/delete")
public Result<?> delete(@RequestParam(name="id",required=true) String id,@RequestParam(name="dataId",required=true) String dataId) {
LambdaQueryWrapper<PayDataFile> lambdaQueryWrapper = new LambdaQueryWrapper();
@AutoLog(value = "资料维护(资料和会议)-通过id删除")
@ApiOperation(value="资料维护(资料和会议)-通过id删除", notes="资料维护(资料和会议)-通过id删除")
@GetMapping(value = "/delete")
@Transactional
@ApiImplicitParam(name = "id", value = "目录主键", dataType = "String", required = true)
public Result<?> delete(@RequestParam(name="id") String id,@RequestParam(name="dataId") String dataId) {
LambdaQueryWrapper<PayDataFile> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(PayDataFile::getFileId,id);
payDataFileService.remove(lambdaQueryWrapper);
ossFileMapper.deleteById(id);
iossFileService.removeById(id);
LambdaQueryWrapper<PayFileDownloadRecord> lambdaQueryWrapper2 = new LambdaQueryWrapper<>();
lambdaQueryWrapper2.eq(PayFileDownloadRecord::getFileId,dataId);
payFileDownloadRecordService.remove(lambdaQueryWrapper2);
return Result.OK("删除成功!");
}
/**
* 批量删除
*
* @param ids
* @return
*/
@AutoLog(value = "资料维护-批量删除")
@ApiOperation(value="资料维护-批量删除", notes="资料维护-批量删除")
@DeleteMapping(value = "/deleteBatch")
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids,@RequestParam(name="dataIds",required=true) String dataIds) {
@AutoLog(value = "资料维护(资料和会议)-批量删除")
@ApiOperation(value="资料维护(资料和会议)-批量删除", notes="资料维护(资料和会议)-批量删除")
@GetMapping(value = "/deleteBatch")
public Result<?> deleteBatch(@RequestParam(name="ids") String ids,@RequestParam(name="dataIds") String dataIds) {
ArrayList<String> strings = new ArrayList<>(Arrays.asList(ids.split(",")));
payDataFileMapper.deleteBatchIds(strings);
payDataFileService.removeByIds(strings);
ArrayList<String> strings2 = new ArrayList<>(Arrays.asList(dataIds.split(",")));
ossFileMapper.deleteBatchIds(strings2);
iossFileService.removeByIds(strings2);
LambdaQueryWrapper<PayFileDownloadRecord> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(PayFileDownloadRecord::getFileId,strings2);
payFileDownloadRecordService.remove(lambdaQueryWrapper);
return Result.OK("批量删除成功!");
}
/**
* 分发
*
*/
@AutoLog(value = "资料维护(资料和会议)-分发")
@ApiOperation(value="资料维护(资料和会议)-分发", notes="资料维护(资料和会议)-分发")
@GetMapping(value = "/distribute")
public Result<?> distribute(@RequestParam(name="ids") String ids,@RequestParam(name="dataIds") String dataIds) {
return Result.OK("批量删除成功!");
}
/**
* 通过id查询
*
* @param id
* @return
*/
@AutoLog(value = "资料维护-通过id查询")
@ApiOperation(value="资料维护-通过id查询", notes="资料维护-通过id查询")
@GetMapping(value = "/queryById")
public Result<?> queryById(@RequestParam(name="id",required=true) String id) {
public Result<?> queryById(@RequestParam(name="id") String id) {
PayDataFile payDataFile = payDataFileService.getById(id);
if(payDataFile==null) {
return Result.error("未找到对应数据");
@@ -149,11 +246,36 @@ public class PayDataFileController extends JeroController<PayDataFile, IPayDataF
return Result.OK(payDataFile);
}
/**
* 会议上传文件
*
*/
@AutoLog(value = "会议上传文件")
@ApiOperation(value="会议上传文件", notes="会议上传文件")
@PostMapping(value = "/addMeetingFile")
@Transactional
public Result<?> addMeetingFile(@RequestParam(name="dataId") String dataId,
@RequestParam(name="fileIds") String fileIds,
@RequestParam(name="dataType") int dataType) {
ArrayList<String> fileIdList = new ArrayList<>(Arrays.asList(fileIds.split(",")));
ArrayList<PayDataFile> list = new ArrayList<>();
stringBuffer = new StringBuffer();
findToTree(dataId,dataType);
stringBuffer.deleteCharAt(stringBuffer.lastIndexOf("/"));
for ( String id:fileIdList){
PayDataFile payDataFile = new PayDataFile();
payDataFile.setFilePath(stringBuffer.toString());
payDataFile.setFileId(id);
payDataFile.setDataId(dataId);
list.add(payDataFile);
}
payDataFileService.saveBatch(list);
return Result.OK("添加成功!");
}
/**
* 导出excel
*
* @param request
* @param payDataFile
*/
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, PayDataFile payDataFile) {
@@ -163,9 +285,7 @@ public class PayDataFileController extends JeroController<PayDataFile, IPayDataF
/**
* 通过excel导入数据
*
* @param request
* @param response
* @return
*
*/
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
@@ -24,6 +24,6 @@ public class PayDataDirectoryDTO {
@ApiModelProperty(value = "备注")
private java.lang.String remarks;
@ApiModelProperty(value = "类型(1:分标委,2:会议),此接口为1")
@ApiModelProperty(value = "类型(1:分标委,2:会议)")
private java.lang.Integer type;
}
@@ -7,9 +7,12 @@ import lombok.Data;
@Data
@ApiModel(value = "资料(会议)列表")
public class QueryFileList {
@ApiModelProperty(value = "资料id")
@ApiModelProperty(value = "主键id")
private java.lang.String id;
@ApiModelProperty(value = "资料id")
private java.lang.String dataId;
@ApiModelProperty(value = "资料名称")
private java.lang.String fileName;
@@ -20,13 +23,13 @@ public class QueryFileList {
private java.lang.String meetingName;
@ApiModelProperty(value = "会议时间")
private java.lang.String meetingTime;
private java.util.Date meetingTime;
@ApiModelProperty(value = "下载次数")
private java.lang.String downLodeTime;
@ApiModelProperty(value = "上传时间")
private java.lang.String upLodeTime;
private java.util.Date upLodeTime;
@ApiModelProperty(value = "上传人")
private java.lang.String upLodePeople;
@@ -24,7 +24,7 @@ public class QueryFileList2 {
private java.lang.String downLodeTime;
@ApiModelProperty(value = "上传时间")
private java.lang.String upLodeTime;
private java.util.Date upLodeTime;
@ApiModelProperty(value = "上传人")
private java.lang.String upLodePeople;
@@ -0,0 +1,34 @@
package com.jero.data.entity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(value = "资料(会议)列表")
public class QueryFileListBySearch {
@ApiModelProperty(value = "资料id")
private java.lang.String dataId;
@ApiModelProperty(value = "资料名称")
private java.lang.String fileName;
@ApiModelProperty(value = "目录层级")
private java.lang.String filePath;
@ApiModelProperty(value = "会议名称")
private java.lang.String meetingName;
@ApiModelProperty(value = "会议时间")
private java.util.Date meetingTime;
@ApiModelProperty(value = "下载次数")
private java.lang.String downLodeTime;
@ApiModelProperty(value = "上传时间")
private java.util.Date upLodeTime;
@ApiModelProperty(value = "上传人")
private java.lang.String upLodePeople;
}
@@ -6,7 +6,9 @@ import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jero.data.entity.PayDataFile;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jero.data.entity.QueryFileList;
import com.jero.data.entity.QueryFileList2;
import com.jero.data.entity.QueryFileListBySearch;
import org.apache.ibatis.annotations.Param;
/**
@@ -19,4 +21,5 @@ public interface PayDataFileMapper extends BaseMapper<PayDataFile> {
IPage<QueryFileList2> pageData(Page<PayDataFile> page, @Param(Constants.WRAPPER) QueryWrapper<Object> queryWrapper);
IPage<QueryFileList> pageDataMeeting(Page<PayDataFile> page, @Param(Constants.WRAPPER) QueryWrapper<QueryFileListBySearch> queryWrapper);
}
@@ -10,6 +10,22 @@
pf.create_by as upLodePeople,
pf.create_time as upLodeTime
FROM pay_data_file pf LEFT JOIN oss_file of on(pf.file_id=of.id) LEFT JOIN (SELECT file_id,count(file_id) as downLodeTime
FROM pay_file_download_record GROUP BY file_id) dt on (pf.file_id=dt.file_id) LEFT JOIN pay_data_directory pd on(pf.data_id=pd.id)
${ew.customSqlSegment}
</select>
<select id="pageDataMeeting" resultType="com.jero.data.entity.QueryFileList">
SELECT pf.id as id,
pf.file_id as dataId,
pf.file_path as filePath,
of.file_name as fileName,
pm.meeting_name as meetingName,
pm.start_time as meetingTime,
dt.downLodeTime,
pf.create_by as upLodePeople,
pf.create_time as upLodeTime
FROM pay_data_file pf LEFT JOIN pay_data_directory pd on(pf.data_id=pd.id) LEFT JOIN pay_meeting as pm on(pd.meeting_id=pm.id) left join
oss_file of on(pf.file_id=of.id) LEFT JOIN (SELECT file_id,count(file_id) as downLodeTime
FROM pay_file_download_record GROUP BY file_id) dt on (pf.file_id=dt.file_id)
${ew.customSqlSegment}
</select>
@@ -5,6 +5,8 @@ import java.util.List;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.jero.common.api.vo.Result;
import com.jero.common.system.query.QueryGenerator;
import com.jero.meeting.entity.PayMeetingSituation;
@@ -63,6 +65,24 @@ public class PayMeetingSituationController extends JeroController<PayMeetingSitu
return Result.OK(list);
}
/**
* @description: 根据会议id查询参会企业列表
* @author: zhangqinlin
* @date: 2021-09-03
* @version: V1.0
*/
@AutoLog(value = "根据会议id查询参会企业列表")
@ApiOperation(value="根据会议id查询参会企业列表", notes="根据会议id查询参会企业列表")
@GetMapping(value = "/queryListByMeetingId")
public Result<List<PayMeetingSituation>> queryListByMeetingId(
@RequestParam(name="meetingId") Integer meetingId
) {
LambdaQueryWrapper<PayMeetingSituation> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(PayMeetingSituation::getMeetingId, meetingId);
List<PayMeetingSituation> list = payMeetingSituationService.list(lambdaQueryWrapper);
return Result.OK(list);
}
/**
* 添加
*/
@@ -487,7 +487,7 @@ public class SystemAPIController {
/**
* 37根据多个用户id(逗号分隔),查询返回多个用户信息
* @param usernames
* @param ids
* @return
*/
@GetMapping("/queryUsersByIds")