初步完成
This commit is contained in:
@@ -4,14 +4,12 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import com.ruoyi.common.config.RuoYiConfig;
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
@@ -23,13 +21,12 @@ import com.ruoyi.framework.config.ServerConfig;
|
||||
|
||||
/**
|
||||
* 通用请求处理
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/common")
|
||||
public class CommonController
|
||||
{
|
||||
public class CommonController {
|
||||
private static final Logger log = LoggerFactory.getLogger(CommonController.class);
|
||||
|
||||
@Autowired
|
||||
@@ -39,17 +36,14 @@ public class CommonController
|
||||
|
||||
/**
|
||||
* 通用下载请求
|
||||
*
|
||||
*
|
||||
* @param fileName 文件名称
|
||||
* @param delete 是否删除
|
||||
* @param delete 是否删除
|
||||
*/
|
||||
@GetMapping("/download")
|
||||
public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!FileUtils.checkAllowDownload(fileName))
|
||||
{
|
||||
public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request) {
|
||||
try {
|
||||
if (!FileUtils.checkAllowDownload(fileName)) {
|
||||
throw new Exception(StringUtils.format("文件名称({})非法,不允许下载。 ", fileName));
|
||||
}
|
||||
String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1);
|
||||
@@ -58,13 +52,10 @@ public class CommonController
|
||||
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
|
||||
FileUtils.setAttachmentResponseHeader(response, realFileName);
|
||||
FileUtils.writeBytes(filePath, response.getOutputStream());
|
||||
if (delete)
|
||||
{
|
||||
if (delete) {
|
||||
FileUtils.deleteFile(filePath);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
} catch (Exception e) {
|
||||
log.error("下载文件失败", e);
|
||||
}
|
||||
}
|
||||
@@ -73,10 +64,8 @@ public class CommonController
|
||||
* 通用上传请求(单个)
|
||||
*/
|
||||
@PostMapping("/upload")
|
||||
public AjaxResult uploadFile(MultipartFile file) throws Exception
|
||||
{
|
||||
try
|
||||
{
|
||||
public AjaxResult uploadFile(MultipartFile file) throws Exception {
|
||||
try {
|
||||
// 上传文件路径
|
||||
String filePath = RuoYiConfig.getUploadPath();
|
||||
// 上传并返回新文件名称
|
||||
@@ -88,9 +77,7 @@ public class CommonController
|
||||
ajax.put("newFileName", FileUtils.getName(fileName));
|
||||
ajax.put("originalFilename", file.getOriginalFilename());
|
||||
return ajax;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
} catch (Exception e) {
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
@@ -99,18 +86,15 @@ public class CommonController
|
||||
* 通用上传请求(多个)
|
||||
*/
|
||||
@PostMapping("/uploads")
|
||||
public AjaxResult uploadFiles(List<MultipartFile> files) throws Exception
|
||||
{
|
||||
try
|
||||
{
|
||||
public AjaxResult uploadFiles(List<MultipartFile> files) throws Exception {
|
||||
try {
|
||||
// 上传文件路径
|
||||
String filePath = RuoYiConfig.getUploadPath();
|
||||
List<String> urls = new ArrayList<String>();
|
||||
List<String> fileNames = new ArrayList<String>();
|
||||
List<String> newFileNames = new ArrayList<String>();
|
||||
List<String> originalFilenames = new ArrayList<String>();
|
||||
for (MultipartFile file : files)
|
||||
{
|
||||
for (MultipartFile file : files) {
|
||||
// 上传并返回新文件名称
|
||||
String fileName = FileUploadUtils.upload(filePath, file);
|
||||
String url = serverConfig.getUrl() + fileName;
|
||||
@@ -125,9 +109,7 @@ public class CommonController
|
||||
ajax.put("newFileNames", StringUtils.join(newFileNames, FILE_DELIMETER));
|
||||
ajax.put("originalFilenames", StringUtils.join(originalFilenames, FILE_DELIMETER));
|
||||
return ajax;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
} catch (Exception e) {
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
@@ -137,12 +119,9 @@ public class CommonController
|
||||
*/
|
||||
@GetMapping("/download/resource")
|
||||
public void resourceDownload(String resource, HttpServletRequest request, HttpServletResponse response)
|
||||
throws Exception
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!FileUtils.checkAllowDownload(resource))
|
||||
{
|
||||
throws Exception {
|
||||
try {
|
||||
if (!FileUtils.checkAllowDownload(resource)) {
|
||||
throw new Exception(StringUtils.format("资源文件({})非法,不允许下载。 ", resource));
|
||||
}
|
||||
// 本地资源路径
|
||||
@@ -154,9 +133,7 @@ public class CommonController
|
||||
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
|
||||
FileUtils.setAttachmentResponseHeader(response, downloadName);
|
||||
FileUtils.writeBytes(downloadPath, response.getOutputStream());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
} catch (Exception e) {
|
||||
log.error("下载文件失败", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.ruoyi.web.controller.cxxm;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.entity.SysDictData;
|
||||
import com.ruoyi.common.core.domain.entity.SysDictType;
|
||||
import com.ruoyi.common.core.page.PageDomain;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.cxxm.domain.TaskCheckAudit;
|
||||
import com.ruoyi.cxxm.domain.vo.AppTypeVo;
|
||||
import com.ruoyi.cxxm.mapper.AppTypeMapper;
|
||||
import com.ruoyi.system.service.ISysDictDataService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
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;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/cxxm/app/type")
|
||||
public class AppTypeController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private AppTypeMapper appTypeMapper;
|
||||
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list()
|
||||
{
|
||||
LambdaQueryWrapper<AppTypeVo> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(AppTypeVo::getDictType,"task_lx");
|
||||
List<AppTypeVo> appTypeVos = appTypeMapper.selectList(queryWrapper);
|
||||
return getDataTable(appTypeVos);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.ruoyi.web.controller.cxxm;
|
||||
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
|
||||
import com.ruoyi.system.domain.CxxmUser;
|
||||
import com.ruoyi.system.domain.CxxmUserXJ;
|
||||
import com.ruoyi.system.service.ISysUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
import static com.ruoyi.common.core.domain.AjaxResult.success;
|
||||
import static com.ruoyi.common.utils.SecurityUtils.getUsername;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/cxxm/user")
|
||||
public class CxxmUserController {
|
||||
|
||||
@Autowired
|
||||
private ISysUserService userService;
|
||||
|
||||
@Log(title = "用户管理", businessType = BusinessType.IMPORT)
|
||||
@PreAuthorize("@ss.hasPermi('system:user:import')")
|
||||
@PostMapping("/importData")
|
||||
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception {
|
||||
ExcelUtil<CxxmUser> util = new ExcelUtil<CxxmUser>(CxxmUser.class);
|
||||
List<CxxmUser> userList = util.importExcel(file.getInputStream());
|
||||
String operName = getUsername();
|
||||
String message = userService.importCxxmUser(userList, updateSupport, operName);
|
||||
return success(message);
|
||||
}
|
||||
|
||||
@PostMapping("/importTemplate")
|
||||
public void importTemplate(HttpServletResponse response) {
|
||||
ExcelUtil<CxxmUser> util = new ExcelUtil<CxxmUser>(CxxmUser.class);
|
||||
util.importTemplateExcel(response, "用户数据");
|
||||
}
|
||||
|
||||
@PostMapping("/importTemplateXJ")
|
||||
public void importTemplateXJ(HttpServletResponse response) {
|
||||
ExcelUtil<CxxmUserXJ> util = new ExcelUtil<CxxmUserXJ>(CxxmUserXJ.class);
|
||||
util.importTemplateExcel(response, "用户数据");
|
||||
}
|
||||
}
|
||||
+15
-9
@@ -4,6 +4,8 @@ import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -31,7 +33,7 @@ import com.ruoyi.common.core.page.TableDataInfo;
|
||||
* @date 2024-03-28
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/cxxm/audit")
|
||||
@RequestMapping("/cxxm/taskCheckAudit")
|
||||
public class TaskCheckAuditController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
@@ -40,7 +42,7 @@ public class TaskCheckAuditController extends BaseController
|
||||
/**
|
||||
* 查询任务巡查审核列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('cxxm:audit:list')")
|
||||
@PreAuthorize("@ss.hasPermi('cxxm:taskCheckAudit:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(TaskCheckAudit taskCheckAudit, PageDomain pageDomain)
|
||||
{
|
||||
@@ -52,7 +54,7 @@ public class TaskCheckAuditController extends BaseController
|
||||
/**
|
||||
* 导出任务巡查审核列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('cxxm:audit:export')")
|
||||
@PreAuthorize("@ss.hasPermi('cxxm:taskCheckAudit:export')")
|
||||
@Log(title = "任务巡查审核", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, TaskCheckAudit taskCheckAudit)
|
||||
@@ -65,7 +67,7 @@ public class TaskCheckAuditController extends BaseController
|
||||
/**
|
||||
* 获取任务巡查审核详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('cxxm:audit:query')")
|
||||
@PreAuthorize("@ss.hasPermi('cxxm:taskCheckAudit:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
@@ -75,29 +77,33 @@ public class TaskCheckAuditController extends BaseController
|
||||
/**
|
||||
* 新增任务巡查审核
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('cxxm:audit:add')")
|
||||
@PreAuthorize("@ss.hasPermi('cxxm:taskCheckAudit:add')")
|
||||
@Log(title = "任务巡查审核", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody TaskCheckAudit taskCheckAudit)
|
||||
{
|
||||
return toAjax(taskCheckAuditService.save(taskCheckAudit));
|
||||
taskCheckAudit.setShsj(DateUtils.getNowDate());
|
||||
taskCheckAudit.setShryId(SecurityUtils.getUserId());
|
||||
return toAjax(taskCheckAuditService.saveOrUpdate(taskCheckAudit));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改任务巡查审核
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('cxxm:audit:edit')")
|
||||
@PreAuthorize("@ss.hasPermi('cxxm:taskCheckAudit:edit')")
|
||||
@Log(title = "任务巡查审核", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody TaskCheckAudit taskCheckAudit)
|
||||
{
|
||||
return toAjax(taskCheckAuditService.updateById(taskCheckAudit));
|
||||
taskCheckAudit.setShsj(DateUtils.getNowDate());
|
||||
taskCheckAudit.setShryId(SecurityUtils.getUserId());
|
||||
return toAjax(taskCheckAuditService.saveOrUpdate(taskCheckAudit));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除任务巡查审核
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('cxxm:audit:remove')")
|
||||
@PreAuthorize("@ss.hasPermi('cxxm:taskCheckAudit:remove')")
|
||||
@Log(title = "任务巡查审核", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable List<Long> ids)
|
||||
|
||||
@@ -1,9 +1,23 @@
|
||||
package com.ruoyi.web.controller.cxxm;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.common.utils.bean.BeanUtils;
|
||||
import com.ruoyi.cxxm.domain.*;
|
||||
import com.ruoyi.cxxm.domain.enums.SFSB;
|
||||
import com.ruoyi.cxxm.domain.dto.TaskCheckSubmit;
|
||||
import com.ruoyi.cxxm.domain.vo.TaskCheckLog;
|
||||
import com.ruoyi.cxxm.domain.vo.TaskCheckSubmitVo;
|
||||
import com.ruoyi.cxxm.service.*;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -11,7 +25,6 @@ import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
@@ -19,10 +32,10 @@ import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.PageDomain;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.cxxm.domain.TaskCheck;
|
||||
import com.ruoyi.cxxm.service.ITaskCheckService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
|
||||
/**
|
||||
* 任务巡查记录Controller
|
||||
@@ -31,19 +44,27 @@ import com.ruoyi.common.core.page.TableDataInfo;
|
||||
* @date 2024-03-28
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/cxxm/check")
|
||||
public class TaskCheckController extends BaseController
|
||||
{
|
||||
@RequestMapping("/cxxm/taskCheck")
|
||||
public class TaskCheckController extends BaseController {
|
||||
@Autowired
|
||||
private ITaskCheckService taskCheckService;
|
||||
@Autowired
|
||||
private ITaskService taskService;
|
||||
@Autowired
|
||||
private ITaskCheckImageService taskCheckImageService;
|
||||
@Autowired
|
||||
private ITaskCheckVideoService taskCheckVideoService;
|
||||
@Autowired
|
||||
private ITbxxService tbxxService;
|
||||
@Autowired
|
||||
private ITaskCheckAuditService taskCheckAuditService;
|
||||
|
||||
/**
|
||||
* 查询任务巡查记录列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('cxxm:check:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(TaskCheck taskCheck, PageDomain pageDomain)
|
||||
{
|
||||
/**
|
||||
* 查询任务巡查记录列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('cxxm:taskCheck:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(TaskCheck taskCheck, PageDomain pageDomain) {
|
||||
startPage();
|
||||
List<TaskCheck> list = taskCheckService.list(new QueryWrapper<>(taskCheck));
|
||||
return getDataTable(list);
|
||||
@@ -52,57 +73,136 @@ public class TaskCheckController extends BaseController
|
||||
/**
|
||||
* 导出任务巡查记录列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('cxxm:check:export')")
|
||||
@Log(title = "任务巡查记录", businessType = BusinessType.EXPORT)
|
||||
@PreAuthorize("@ss.hasPermi('cxxm:taskCheck:export')")
|
||||
@Log(title = "任务巡查记录导出", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, TaskCheck taskCheck)
|
||||
{
|
||||
public void export(HttpServletResponse response, TaskCheck taskCheck) {
|
||||
List<TaskCheck> list = taskCheckService.list(new QueryWrapper<>(taskCheck));
|
||||
ExcelUtil<TaskCheck> util = new ExcelUtil<TaskCheck>(TaskCheck.class);
|
||||
util.exportExcel(response, list, "任务巡查记录数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取任务巡查记录详细信息
|
||||
* 根据taskId获取任务巡查记录详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('cxxm:check:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return AjaxResult.success(taskCheckService.getById(id));
|
||||
@PreAuthorize("@ss.hasPermi('cxxm:taskCheck:query')")
|
||||
@GetMapping(value = "/{taskId}")
|
||||
public AjaxResult getInfoByTaskId(@PathVariable("taskId") Long taskId) {
|
||||
TaskCheckSubmitVo taskCheckSubmitVo = new TaskCheckSubmitVo();
|
||||
// 最后一条填报内容
|
||||
LambdaQueryWrapper<TaskCheck> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(TaskCheck::getTaskId, taskId);
|
||||
queryWrapper.eq(TaskCheck::getSfsb, SFSB.YSB.getValue());
|
||||
queryWrapper.orderByDesc(TaskCheck::getId);
|
||||
queryWrapper.last("limit 1");
|
||||
TaskCheck taskCheck = taskCheckService.getOne(queryWrapper);
|
||||
if (taskCheck == null) {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
BeanUtils.copyProperties(taskCheck, taskCheckSubmitVo);
|
||||
// 图片
|
||||
LambdaQueryWrapper<TaskCheckImage> tcImagesQueryWrapper = new LambdaQueryWrapper<>();
|
||||
tcImagesQueryWrapper.eq(TaskCheckImage::getTcId, taskCheck.getId());
|
||||
List<TaskCheckImage> taskCheckImages = taskCheckImageService.list(tcImagesQueryWrapper);
|
||||
taskCheckSubmitVo.setTaskCheckImages(taskCheckImages);
|
||||
// 视频
|
||||
LambdaQueryWrapper<TaskCheckVideo> tcVideosQueryWrapper = new LambdaQueryWrapper<>();
|
||||
tcVideosQueryWrapper.eq(TaskCheckVideo::getTcId, taskCheck.getId());
|
||||
List<TaskCheckVideo> taskCheckVideos = taskCheckVideoService.list(tcVideosQueryWrapper);
|
||||
taskCheckSubmitVo.setTaskCheckVideos(taskCheckVideos);
|
||||
// 图斑信息
|
||||
Task task = taskService.getById(taskCheck.getTaskId());
|
||||
Tbxx tbxx = tbxxService.selectTbxxByTbbh(task.getTbbh());
|
||||
taskCheckSubmitVo.setTbxx(tbxx);
|
||||
// 填报记录列表
|
||||
LambdaQueryWrapper<TaskCheck> tcLogQueryWrapper = new LambdaQueryWrapper<>();
|
||||
tcLogQueryWrapper.eq(TaskCheck::getTaskId, taskId);
|
||||
tcLogQueryWrapper.orderByDesc(TaskCheck::getId);
|
||||
List<TaskCheck> tcList = taskCheckService.list(tcLogQueryWrapper);
|
||||
List<TaskCheckLog> tcLogList = new ArrayList<>();
|
||||
for (TaskCheck item : tcList) {
|
||||
// 跳过未上报,且非本人巡查的记录
|
||||
if (Objects.equals(item.getSfsb(), SFSB.WSB.getValue()) && !Objects.equals(item.getXcryId(), SecurityUtils.getUserId())) {
|
||||
continue;
|
||||
}
|
||||
TaskCheckLog taskCheckLog = new TaskCheckLog();
|
||||
BeanUtils.copyProperties(item, taskCheckLog);
|
||||
taskCheckLog.setTcId(item.getId());
|
||||
// 填报记录图片
|
||||
LambdaQueryWrapper<TaskCheckImage> tcLogImagesQueryWrapper = new LambdaQueryWrapper<>();
|
||||
tcLogImagesQueryWrapper.eq(TaskCheckImage::getTcId, item.getId());
|
||||
List<TaskCheckImage> tcLogImages = taskCheckImageService.list(tcLogImagesQueryWrapper);
|
||||
taskCheckLog.setTaskCheckImages(tcLogImages);
|
||||
// 填报记录视频
|
||||
LambdaQueryWrapper<TaskCheckVideo> tcLogVideosQueryWrapper = new LambdaQueryWrapper<>();
|
||||
tcLogVideosQueryWrapper.eq(TaskCheckVideo::getTcId, item.getId());
|
||||
List<TaskCheckVideo> tcLogVideos = taskCheckVideoService.list(tcLogVideosQueryWrapper);
|
||||
taskCheckLog.setTaskCheckVideos(tcLogVideos);
|
||||
// 填报记录审核
|
||||
LambdaQueryWrapper<TaskCheckAudit> tcAuditQueryWrapper = new LambdaQueryWrapper<>();
|
||||
tcAuditQueryWrapper.eq(TaskCheckAudit::getTcId, item.getId());
|
||||
TaskCheckAudit taskCheckAudit = taskCheckAuditService.getOne(tcAuditQueryWrapper);
|
||||
taskCheckLog.setTaskCheckAudit(taskCheckAudit);
|
||||
tcLogList.add(taskCheckLog);
|
||||
}
|
||||
taskCheckSubmitVo.setTaskCheckLogs(tcLogList);
|
||||
return AjaxResult.success(taskCheckSubmitVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增任务巡查记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('cxxm:check:add')")
|
||||
@Log(title = "任务巡查记录", businessType = BusinessType.INSERT)
|
||||
@PreAuthorize("@ss.hasPermi('cxxm:taskCheck:add')")
|
||||
@Log(title = "任务巡查记录填报", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody TaskCheck taskCheck)
|
||||
{
|
||||
return toAjax(taskCheckService.save(taskCheck));
|
||||
public AjaxResult add(MultipartHttpServletRequest request, List<MultipartFile> files) throws IOException {
|
||||
String taskCheckSubmitStr = request.getParameter("taskCheckSubmit");
|
||||
TaskCheckSubmit taskCheckSubmit = JSONObject.parseObject(taskCheckSubmitStr, TaskCheckSubmit.class);
|
||||
taskCheckService.saveTaskCheckSubmitAndFiles(taskCheckSubmit, files);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改任务巡查记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('cxxm:check:edit')")
|
||||
@Log(title = "任务巡查记录", businessType = BusinessType.UPDATE)
|
||||
@PreAuthorize("@ss.hasPermi('cxxm:taskCheck:edit')")
|
||||
@Log(title = "任务巡查记录修改", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody TaskCheck taskCheck)
|
||||
{
|
||||
return toAjax(taskCheckService.updateById(taskCheck));
|
||||
public AjaxResult edit(MultipartHttpServletRequest request, List<MultipartFile> files) throws IOException {
|
||||
String taskCheckSubmitStr = request.getParameter("taskCheckSubmit");
|
||||
TaskCheckSubmit taskCheckSubmit = JSONObject.parseObject(taskCheckSubmitStr, TaskCheckSubmit.class);
|
||||
taskCheckService.saveTaskCheckSubmitAndFiles(taskCheckSubmit, files);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除任务巡查记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('cxxm:check:remove')")
|
||||
@Log(title = "任务巡查记录", businessType = BusinessType.DELETE)
|
||||
@PreAuthorize("@ss.hasPermi('cxxm:taskCheck:remove')")
|
||||
@Log(title = "任务巡查记录删除", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable List<Long> ids)
|
||||
{
|
||||
public AjaxResult remove(@PathVariable List<Long> ids) {
|
||||
return toAjax(taskCheckService.removeByIds(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 上报任务巡查记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('cxxm:taskCheck:edit')")
|
||||
@Log(title = "任务巡查记录上报", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/report/{tcId}")
|
||||
public AjaxResult report(@PathVariable Long tcId) {
|
||||
return toAjax(taskCheckService.reportTaskCheckInfo(tcId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消上报任务巡查记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('cxxm:taskCheck:edit')")
|
||||
@Log(title = "任务巡查记录上报", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/cancelReport/{tcId}")
|
||||
public AjaxResult cancelReport(@PathVariable Long tcId) {
|
||||
return toAjax(taskCheckService.cancelReportTaskCheckInfo(tcId));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
-108
@@ -1,108 +0,0 @@
|
||||
package com.ruoyi.web.controller.cxxm;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.PageDomain;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.cxxm.domain.TaskCheckImage;
|
||||
import com.ruoyi.cxxm.service.ITaskCheckImageService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 任务巡查图片Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-03-28
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/cxxm/image")
|
||||
public class TaskCheckImageController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ITaskCheckImageService taskCheckImageService;
|
||||
|
||||
/**
|
||||
* 查询任务巡查图片列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('cxxm:image:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(TaskCheckImage taskCheckImage, PageDomain pageDomain)
|
||||
{
|
||||
startPage();
|
||||
List<TaskCheckImage> list = taskCheckImageService.list(new QueryWrapper<>(taskCheckImage));
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出任务巡查图片列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('cxxm:image:export')")
|
||||
@Log(title = "任务巡查图片", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, TaskCheckImage taskCheckImage)
|
||||
{
|
||||
List<TaskCheckImage> list = taskCheckImageService.list(new QueryWrapper<>(taskCheckImage));
|
||||
ExcelUtil<TaskCheckImage> util = new ExcelUtil<TaskCheckImage>(TaskCheckImage.class);
|
||||
util.exportExcel(response, list, "任务巡查图片数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取任务巡查图片详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('cxxm:image:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return AjaxResult.success(taskCheckImageService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增任务巡查图片
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('cxxm:image:add')")
|
||||
@Log(title = "任务巡查图片", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody TaskCheckImage taskCheckImage)
|
||||
{
|
||||
return toAjax(taskCheckImageService.save(taskCheckImage));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改任务巡查图片
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('cxxm:image:edit')")
|
||||
@Log(title = "任务巡查图片", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody TaskCheckImage taskCheckImage)
|
||||
{
|
||||
return toAjax(taskCheckImageService.updateById(taskCheckImage));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除任务巡查图片
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('cxxm:image:remove')")
|
||||
@Log(title = "任务巡查图片", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable List<Long> ids)
|
||||
{
|
||||
return toAjax(taskCheckImageService.removeByIds(ids));
|
||||
}
|
||||
}
|
||||
|
||||
-108
@@ -1,108 +0,0 @@
|
||||
package com.ruoyi.web.controller.cxxm;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.PageDomain;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.cxxm.domain.TaskCheckVideo;
|
||||
import com.ruoyi.cxxm.service.ITaskCheckVideoService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 任务巡查视频Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-03-28
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/cxxm/video")
|
||||
public class TaskCheckVideoController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ITaskCheckVideoService taskCheckVideoService;
|
||||
|
||||
/**
|
||||
* 查询任务巡查视频列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('cxxm:video:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(TaskCheckVideo taskCheckVideo, PageDomain pageDomain)
|
||||
{
|
||||
startPage();
|
||||
List<TaskCheckVideo> list = taskCheckVideoService.list(new QueryWrapper<>(taskCheckVideo));
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出任务巡查视频列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('cxxm:video:export')")
|
||||
@Log(title = "任务巡查视频", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, TaskCheckVideo taskCheckVideo)
|
||||
{
|
||||
List<TaskCheckVideo> list = taskCheckVideoService.list(new QueryWrapper<>(taskCheckVideo));
|
||||
ExcelUtil<TaskCheckVideo> util = new ExcelUtil<TaskCheckVideo>(TaskCheckVideo.class);
|
||||
util.exportExcel(response, list, "任务巡查视频数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取任务巡查视频详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('cxxm:video:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return AjaxResult.success(taskCheckVideoService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增任务巡查视频
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('cxxm:video:add')")
|
||||
@Log(title = "任务巡查视频", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody TaskCheckVideo taskCheckVideo)
|
||||
{
|
||||
return toAjax(taskCheckVideoService.save(taskCheckVideo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改任务巡查视频
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('cxxm:video:edit')")
|
||||
@Log(title = "任务巡查视频", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody TaskCheckVideo taskCheckVideo)
|
||||
{
|
||||
return toAjax(taskCheckVideoService.updateById(taskCheckVideo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除任务巡查视频
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('cxxm:video:remove')")
|
||||
@Log(title = "任务巡查视频", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable List<Long> ids)
|
||||
{
|
||||
return toAjax(taskCheckVideoService.removeByIds(ids));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,26 @@
|
||||
package com.ruoyi.web.controller.cxxm;
|
||||
|
||||
import java.util.List;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.*;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.bean.BeanUtils;
|
||||
import com.ruoyi.cxxm.domain.Tbxx;
|
||||
import com.ruoyi.cxxm.domain.enums.XFQK;
|
||||
import com.ruoyi.cxxm.domain.query.TaskQuery;
|
||||
import com.ruoyi.cxxm.domain.vo.TaskDetailVo;
|
||||
import com.ruoyi.cxxm.mapper.DeptMapper;
|
||||
import com.ruoyi.cxxm.service.ITbxxService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -23,6 +40,7 @@ import com.ruoyi.cxxm.domain.Task;
|
||||
import com.ruoyi.cxxm.service.ITaskService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* 任务Controller
|
||||
@@ -32,20 +50,35 @@ import com.ruoyi.common.core.page.TableDataInfo;
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/cxxm/task")
|
||||
public class TaskController extends BaseController
|
||||
{
|
||||
public class TaskController extends BaseController {
|
||||
@Autowired
|
||||
private ITaskService taskService;
|
||||
@Autowired
|
||||
private ITbxxService tbxxService;
|
||||
@Autowired
|
||||
private DeptMapper deptMapper;
|
||||
|
||||
/**
|
||||
* 查询任务列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('cxxm:task:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(Task task, PageDomain pageDomain)
|
||||
{
|
||||
/**
|
||||
* 查询任务列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('cxxm:task:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(TaskQuery task, PageDomain pageDomain) {
|
||||
startPage();
|
||||
List<Task> list = taskService.list(new QueryWrapper<>(task));
|
||||
LambdaQueryWrapper<Task> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.like(Objects.nonNull(task.getTbbh()), Task::getTbbh, task.getTbbh());
|
||||
queryWrapper.eq(Objects.nonNull(task.getXfqk()), Task::getXfqk, task.getXfqk());
|
||||
queryWrapper.eq(Objects.nonNull(task.getRwlx()), Task::getRwlx, task.getRwlx());
|
||||
queryWrapper.in(Objects.nonNull(task.getDeptId()), Task::getDeptId, deptMapper.getAllAncestorsByDeptId(task.getDeptId()));
|
||||
List<String> drsjQuery = task.getDrsjQuery();
|
||||
if (drsjQuery != null && drsjQuery.size() == 2) {
|
||||
queryWrapper.apply(StringUtils.format("DATE_FORMAT(drsj, '%Y-%m') between '{}' and '{}'",
|
||||
drsjQuery.get(0), drsjQuery.get(1)));
|
||||
}
|
||||
queryWrapper.orderByAsc(Task::getXfqk);
|
||||
queryWrapper.orderByDesc(Task::getXfsj);
|
||||
queryWrapper.orderByDesc(Task::getDrsj);
|
||||
List<Task> list = taskService.list(queryWrapper);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@@ -55,8 +88,7 @@ public class TaskController extends BaseController
|
||||
@PreAuthorize("@ss.hasPermi('cxxm:task:export')")
|
||||
@Log(title = "任务", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, Task task)
|
||||
{
|
||||
public void export(HttpServletResponse response, Task task) {
|
||||
List<Task> list = taskService.list(new QueryWrapper<>(task));
|
||||
ExcelUtil<Task> util = new ExcelUtil<Task>(Task.class);
|
||||
util.exportExcel(response, list, "任务数据");
|
||||
@@ -67,9 +99,13 @@ public class TaskController extends BaseController
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('cxxm:task:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return AjaxResult.success(taskService.getById(id));
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||
Task task = taskService.getById(id);
|
||||
Tbxx tbxx = tbxxService.selectTbxxByTbbh(task.getTbbh());
|
||||
TaskDetailVo taskDetailVo = new TaskDetailVo();
|
||||
BeanUtils.copyProperties(task, taskDetailVo);
|
||||
taskDetailVo.setTbxx(tbxx);
|
||||
return AjaxResult.success(taskDetailVo);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -78,8 +114,7 @@ public class TaskController extends BaseController
|
||||
@PreAuthorize("@ss.hasPermi('cxxm:task:add')")
|
||||
@Log(title = "任务", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody Task task)
|
||||
{
|
||||
public AjaxResult add(@RequestBody Task task) {
|
||||
return toAjax(taskService.save(task));
|
||||
}
|
||||
|
||||
@@ -89,8 +124,7 @@ public class TaskController extends BaseController
|
||||
@PreAuthorize("@ss.hasPermi('cxxm:task:edit')")
|
||||
@Log(title = "任务", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody Task task)
|
||||
{
|
||||
public AjaxResult edit(@RequestBody Task task) {
|
||||
return toAjax(taskService.updateById(task));
|
||||
}
|
||||
|
||||
@@ -100,9 +134,151 @@ public class TaskController extends BaseController
|
||||
@PreAuthorize("@ss.hasPermi('cxxm:task:remove')")
|
||||
@Log(title = "任务", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable List<Long> ids)
|
||||
{
|
||||
return toAjax(taskService.removeByIds(ids));
|
||||
public AjaxResult remove(@PathVariable List<Long> ids) {
|
||||
return toAjax(taskService.removeTaskAndTbxxByTaskIds(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入任务
|
||||
*
|
||||
* @param file
|
||||
* @param rwlx
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@Log(title = "导入任务", businessType = BusinessType.IMPORT)
|
||||
@PreAuthorize("@ss.hasPermi('cxxm:task:import')")
|
||||
@PostMapping("/importData")
|
||||
public AjaxResult importData(MultipartFile file, String rwlx) throws Exception {
|
||||
try (InputStream inputStream = file.getInputStream()) {
|
||||
// 读取数据
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
|
||||
StringBuilder content = new StringBuilder();
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
content.append(line);
|
||||
}
|
||||
// 解析数据
|
||||
Map map = JSONObject.parseObject(content.toString(), Map.class);
|
||||
Object features = map.get("features");
|
||||
List importData = JSONObject.parseObject(features.toString(), List.class);
|
||||
List<String> failTbbhList = new ArrayList<>();
|
||||
for (Object data : importData) {
|
||||
Map item = JSONObject.parseObject(data.toString(), Map.class);
|
||||
Tbxx tbxx = new Tbxx();
|
||||
// 图斑空间数据
|
||||
Object geometry = item.get("geometry");
|
||||
tbxx.setGis(geometry.toString());
|
||||
// 图斑信息
|
||||
Object properties = item.get("properties");
|
||||
Map tbxxMap = JSONObject.parseObject(properties.toString(), Map.class);
|
||||
tbxx.setTbbh(tbxxMap.get("KCTBBH") != null ? tbxxMap.get("KCTBBH").toString() : "");
|
||||
tbxx.setKsmc(tbxxMap.get("KMMC") != null ? tbxxMap.get("KMMC").toString() : "");
|
||||
tbxx.setXkzbh(tbxxMap.get("KMXKZ") != null ? tbxxMap.get("KMXKZ").toString() : "");
|
||||
tbxx.setKqjb(tbxxMap.get("KQJB") != null ? tbxxMap.get("KQJB").toString() : "");
|
||||
tbxx.setSheng(tbxxMap.get("SHENG") != null ? tbxxMap.get("SHENG").toString() : "");
|
||||
tbxx.setShi(tbxxMap.get("SHI") != null ? tbxxMap.get("SHI").toString() : "");
|
||||
tbxx.setXian(tbxxMap.get("XIAN") != null ? tbxxMap.get("XIAN").toString() : "");
|
||||
tbxx.setXdm(tbxxMap.get("XDM") != null ? tbxxMap.get("XDM").toString() : "");
|
||||
tbxx.setXxdz(tbxxMap.get("KMDZ") != null ? tbxxMap.get("KMDZ").toString() : "");
|
||||
tbxx.setJjlx(tbxxMap.get("KMJJLX") != null ? tbxxMap.get("KMJJLX").toString() : "");
|
||||
tbxx.setKzlx(tbxxMap.get("KMLX") != null ? tbxxMap.get("KMLX").toString() : "");
|
||||
tbxx.setKcqtkz(tbxxMap.get("KMQTKZ") != null ? tbxxMap.get("KMQTKZ").toString() : "");
|
||||
tbxx.setKcfs(tbxxMap.get("KMKCFS") != null ? tbxxMap.get("KMKCFS").toString() : "");
|
||||
tbxx.setKczt(tbxxMap.get("KMKCZT") != null ? tbxxMap.get("KMKCZT").toString() : "");
|
||||
tbxx.setZdmj(tbxxMap.get("KMZDMJ") != null ? tbxxMap.get("KMZDMJ").toString() : "");
|
||||
tbxx.setWfmj(tbxxMap.get("KMWFMJ") != null ? tbxxMap.get("KMWFMJ").toString() : "");
|
||||
tbxx.setX(tbxxMap.get("KMX") != null ? tbxxMap.get("KMX").toString() : "");
|
||||
tbxx.setY(tbxxMap.get("KMY") != null ? tbxxMap.get("KMY").toString() : "");
|
||||
tbxx.setCzwt(tbxxMap.get("KMCZWT") != null ? tbxxMap.get("KMCZWT").toString() : "");
|
||||
tbxx.setSqtbbh(tbxxMap.get("SQTBBH") != null ? tbxxMap.get("SQTBBH").toString() : "");
|
||||
tbxx.setBxftbbh(tbxxMap.get("BFTBBH") != null ? tbxxMap.get("BFTBBH").toString() : "");
|
||||
tbxx.setBqsjsj(tbxxMap.get("BQSJSJ") != null ? tbxxMap.get("BQSJSJ").toString() : "");
|
||||
tbxx.setSqsjsj(tbxxMap.get("SQSJSJ") != null ? tbxxMap.get("SQSJSJ").toString() : "");
|
||||
tbxx.setLsks(tbxxMap.get("LKBH") != null ? tbxxMap.get("LKBH").toString() : "");
|
||||
tbxx.setZdkqmc(tbxxMap.get("ZDKQMC") != null ? tbxxMap.get("ZDKQMC").toString() : "");
|
||||
tbxx.setZrbhqmc(tbxxMap.get("BHQMC") != null ? tbxxMap.get("BHQMC").toString() : "");
|
||||
tbxx.setGyhpmc(tbxxMap.get("GYHPMC") != null ? tbxxMap.get("GYHPMC").toString() : "");
|
||||
tbxx.setGyhp03(tbxxMap.get("GYHP03") != null ? tbxxMap.get("GYHP03").toString() : "");
|
||||
tbxx.setGyhp10(tbxxMap.get("GYHP10") != null ? tbxxMap.get("GYHP10").toString() : "");
|
||||
tbxx.setCjgzmc(tbxxMap.get("CJGZMC") != null ? tbxxMap.get("CJGZMC").toString() : "");
|
||||
tbxx.setCjgz03(tbxxMap.get("CJGZ03") != null ? tbxxMap.get("CJGZ03").toString() : "");
|
||||
tbxx.setCjgzl10(tbxxMap.get("CJGZ10") != null ? tbxxMap.get("CJGZ10").toString() : "");
|
||||
tbxx.setFjmsmc(tbxxMap.get("FJMSMC") != null ? tbxxMap.get("FJMSMC").toString() : "");
|
||||
tbxx.setGjgymc(tbxxMap.get("GJGYMC") != null ? tbxxMap.get("GJGYMC").toString() : "");
|
||||
tbxx.setYsydmc(tbxxMap.get("YSYDMC") != null ? tbxxMap.get("YSYDMC").toString() : "");
|
||||
tbxx.setBz(tbxxMap.get("KFBZ") != null ? tbxxMap.get("KFBZ").toString() : "");
|
||||
tbxx.setXsly(tbxxMap.get("XSLY") != null ? tbxxMap.get("XSLY").toString() : "");
|
||||
// 导入图斑信息
|
||||
// 判断图斑数据是否已经存在
|
||||
LambdaQueryWrapper<Tbxx> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(Tbxx::getTbbh, tbxx.getTbbh());
|
||||
if (tbxxService.count(queryWrapper) == 0) {
|
||||
taskService.importTaskByTbxx(tbxx, rwlx);
|
||||
} else {
|
||||
failTbbhList.add(tbxx.getTbbh());
|
||||
}
|
||||
}
|
||||
// 统计导入结果
|
||||
int total = importData.size();
|
||||
int fail = failTbbhList.size();
|
||||
int success = total - fail;
|
||||
Map<String, Object> res = new HashMap<String, Object>();
|
||||
res.put("total", total);
|
||||
res.put("successCount", success);
|
||||
res.put("failCount", fail);
|
||||
res.put("failTbbhList", failTbbhList);
|
||||
return success(res);
|
||||
} catch (IOException e) {
|
||||
// 处理异常
|
||||
throw new IOException("文件上传失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 下发任务
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("下发任务")
|
||||
@PreAuthorize("@ss.hasPermi('cxxm:task:distribute')")
|
||||
@Log(title = "任务", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/distribute/{ids}")
|
||||
public AjaxResult distribute(@PathVariable Long[] ids) {
|
||||
List<Task> taskList = new ArrayList<>();
|
||||
for (Long id : ids) {
|
||||
Task task = new Task();
|
||||
task.setId(id);
|
||||
task.setXfqk(XFQK.YXF.getValue());
|
||||
task.setXfsj(DateUtils.getNowDate());
|
||||
taskList.add(task);
|
||||
}
|
||||
return toAjax(taskService.updateBatchById(taskList));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询任务巡查情况列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('cxxm:task:list')")
|
||||
@GetMapping("/distributed/list")
|
||||
public TableDataInfo distributedList(TaskQuery task, PageDomain pageDomain) {
|
||||
startPage();
|
||||
LambdaQueryWrapper<Task> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.like(Objects.nonNull(task.getTbbh()), Task::getTbbh, task.getTbbh());
|
||||
queryWrapper.eq(Task::getXfqk, XFQK.YXF.getValue());
|
||||
queryWrapper.eq(Objects.nonNull(task.getRwlx()), Task::getRwlx, task.getRwlx());
|
||||
queryWrapper.in(Objects.nonNull(task.getDeptId()), Task::getDeptId, deptMapper.getAllAncestorsByDeptId(task.getDeptId()));
|
||||
List<String> drsjQuery = task.getDrsjQuery();
|
||||
if (drsjQuery != null && drsjQuery.size() == 2) {
|
||||
queryWrapper.apply(StringUtils.format("DATE_FORMAT(drsj, '%Y-%m') between '{}' and '{}'",
|
||||
drsjQuery.get(0), drsjQuery.get(1)));
|
||||
}
|
||||
queryWrapper.orderByAsc(Task::getXfqk);
|
||||
queryWrapper.orderByDesc(Task::getXfsj);
|
||||
queryWrapper.orderByDesc(Task::getDrsj);
|
||||
List<Task> list = taskService.list(queryWrapper);
|
||||
return getDataTable(list);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,108 +0,0 @@
|
||||
package com.ruoyi.web.controller.cxxm;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.PageDomain;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.cxxm.domain.Tbxx;
|
||||
import com.ruoyi.cxxm.service.ITbxxService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 图斑信息Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-03-28
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/cxxm/tbxx")
|
||||
public class TbxxController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ITbxxService tbxxService;
|
||||
|
||||
/**
|
||||
* 查询图斑信息列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('cxxm:tbxx:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(Tbxx tbxx, PageDomain pageDomain)
|
||||
{
|
||||
startPage();
|
||||
List<Tbxx> list = tbxxService.list(new QueryWrapper<>(tbxx));
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出图斑信息列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('cxxm:tbxx:export')")
|
||||
@Log(title = "图斑信息", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, Tbxx tbxx)
|
||||
{
|
||||
List<Tbxx> list = tbxxService.list(new QueryWrapper<>(tbxx));
|
||||
ExcelUtil<Tbxx> util = new ExcelUtil<Tbxx>(Tbxx.class);
|
||||
util.exportExcel(response, list, "图斑信息数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取图斑信息详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('cxxm:tbxx:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return AjaxResult.success(tbxxService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增图斑信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('cxxm:tbxx:add')")
|
||||
@Log(title = "图斑信息", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody Tbxx tbxx)
|
||||
{
|
||||
return toAjax(tbxxService.save(tbxx));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改图斑信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('cxxm:tbxx:edit')")
|
||||
@Log(title = "图斑信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody Tbxx tbxx)
|
||||
{
|
||||
return toAjax(tbxxService.updateById(tbxx));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除图斑信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('cxxm:tbxx:remove')")
|
||||
@Log(title = "图斑信息", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable List<Long> ids)
|
||||
{
|
||||
return toAjax(tbxxService.removeByIds(ids));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user