增加执法信息、执法文书管理、现场检查、通知公告等controller类
This commit is contained in:
parent
d0d0a5712f
commit
1ef15e0829
|
|
@ -0,0 +1,127 @@
|
||||||
|
package com.aisino.iles.lawenforcement.controller;
|
||||||
|
|
||||||
|
import com.aisino.iles.common.model.Fail;
|
||||||
|
import com.aisino.iles.common.model.Ok;
|
||||||
|
import com.aisino.iles.common.model.PageResult;
|
||||||
|
import com.aisino.iles.common.model.Result;
|
||||||
|
import com.aisino.iles.common.util.Constants;
|
||||||
|
import com.aisino.iles.lawenforcement.model.Case;
|
||||||
|
import com.aisino.iles.lawenforcement.model.Document;
|
||||||
|
import com.aisino.iles.lawenforcement.model.dto.FormDataDto;
|
||||||
|
import com.aisino.iles.lawenforcement.model.query.DocumentQuery;
|
||||||
|
import com.aisino.iles.lawenforcement.service.DocumentService;
|
||||||
|
import org.springframework.data.domain.Page;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
/**
|
||||||
|
* 综合执法/执法文书管理
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping(Constants.API_PREFIX + "/lawenforcement/documents")
|
||||||
|
public class DocumentController {
|
||||||
|
|
||||||
|
private final DocumentService documentService;
|
||||||
|
public DocumentController(DocumentService documentService) {
|
||||||
|
this.documentService = documentService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询文书信息
|
||||||
|
*
|
||||||
|
* @param query 文书数据项查询条件
|
||||||
|
* @return 文书信息
|
||||||
|
*/
|
||||||
|
@GetMapping
|
||||||
|
public PageResult<Document> getDocumentPage(DocumentQuery query) {
|
||||||
|
Page<Document> page = documentService.findDocumentsPage(query);
|
||||||
|
return PageResult.of(page);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询文书信息(不分页)
|
||||||
|
*
|
||||||
|
* @param query 文书数据项查询条件
|
||||||
|
* @return 查询结果
|
||||||
|
*/
|
||||||
|
@GetMapping("/list")
|
||||||
|
public Result<List<Document>> geDocumentList(DocumentQuery query) {
|
||||||
|
return Ok.of(documentService.listDocuments(query));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询文书信息(单条)
|
||||||
|
*
|
||||||
|
* @param query 文书数据项查询条件
|
||||||
|
* @return 文书实体
|
||||||
|
*/
|
||||||
|
@GetMapping("/getOneByCaseIdAndDocumentName")
|
||||||
|
public Result<Document> findByCaseIdAndDocumentName(DocumentQuery query) {
|
||||||
|
return documentService.findByCaseIdAndDocumentName(query.getCaseId(),query.getDocumentName())
|
||||||
|
.map(o -> ((Result<Document>) Ok.of(o)))
|
||||||
|
.orElse(Fail.of("缺少"+query.getDocumentName()));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存
|
||||||
|
*
|
||||||
|
* @param document 保存文书信息
|
||||||
|
* @return 保存结果
|
||||||
|
*/
|
||||||
|
@PostMapping
|
||||||
|
public Result<Document> createOfficer(@RequestBody Document document) {
|
||||||
|
return Ok.of(documentService.saveDocument(document));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新文书信息
|
||||||
|
*
|
||||||
|
* @param documentId 文书ID
|
||||||
|
* @param document 文书信息
|
||||||
|
* @return 更新结果
|
||||||
|
*/
|
||||||
|
@PutMapping("/{documentId}")
|
||||||
|
public Result<Document> updateDocument(@PathVariable String documentId, @RequestBody Document document) {
|
||||||
|
document.setDocumentId(documentId);
|
||||||
|
return Ok.of(documentService.saveDocument(document));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据ID删除文书信息
|
||||||
|
*
|
||||||
|
* @param documentId 文书信息ID
|
||||||
|
* @return 删除结果
|
||||||
|
*/
|
||||||
|
@DeleteMapping("/{documentId}")
|
||||||
|
public Result<Void> deleteDocumentById(@PathVariable String documentId) {
|
||||||
|
documentService.deleteDocumentById(documentId);
|
||||||
|
return Ok.of();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除文书信息
|
||||||
|
*
|
||||||
|
* @param documentIds 文书信息ID列表
|
||||||
|
* @return 删除结果
|
||||||
|
*/
|
||||||
|
@DeleteMapping
|
||||||
|
public Result<Void> deleteDocumentsByIds(@RequestBody List<String> documentIds) {
|
||||||
|
documentService.deleteDocumentsByIds(documentIds);
|
||||||
|
return Ok.of();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上传执法文书
|
||||||
|
*
|
||||||
|
* @param formData 文书附件
|
||||||
|
* @return 文书信息
|
||||||
|
*/
|
||||||
|
@PostMapping("/upload-file")
|
||||||
|
public Result<Document> addDocumentFile(FormDataDto formData) {
|
||||||
|
return Ok.of(documentService.addDocumentFile(formData));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,299 @@
|
||||||
|
package com.aisino.iles.lawenforcement.controller;
|
||||||
|
|
||||||
|
import com.aisino.iles.common.model.*;
|
||||||
|
import com.aisino.iles.common.util.Constants;
|
||||||
|
import com.aisino.iles.common.util.ExportExcelUtil;
|
||||||
|
import com.aisino.iles.core.annotation.CurrentUser;
|
||||||
|
import com.aisino.iles.lawenforcement.model.EnforceCheck;
|
||||||
|
import com.aisino.iles.lawenforcement.model.SpotCheck;
|
||||||
|
import com.aisino.iles.lawenforcement.model.dto.EnforceCheckDto;
|
||||||
|
import com.aisino.iles.lawenforcement.model.dto.EnforceCheckResDto;
|
||||||
|
import com.aisino.iles.lawenforcement.model.dto.EnterpriseDto;
|
||||||
|
import com.aisino.iles.lawenforcement.model.dto.FormDataDto;
|
||||||
|
import com.aisino.iles.lawenforcement.model.query.EnforceCheckQuery;
|
||||||
|
import com.aisino.iles.lawenforcement.model.query.EnterpriseQuery;
|
||||||
|
import com.aisino.iles.lawenforcement.service.EnforceCheckService;
|
||||||
|
import com.smartlx.sso.client.model.RemoteUserInfo;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
import org.springframework.data.domain.Page;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 综合执法/执法信息现场检查
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping(Constants.API_PREFIX + "/lawenforcement/enforceChecks")
|
||||||
|
public class EnforceCheckController {
|
||||||
|
|
||||||
|
private final EnforceCheckService enforceCheckService;
|
||||||
|
|
||||||
|
public EnforceCheckController(EnforceCheckService enforceCheckService) {
|
||||||
|
this.enforceCheckService = enforceCheckService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建执法检查记录
|
||||||
|
*
|
||||||
|
* @param enforceCheck 执法检查记录
|
||||||
|
* @return 创建结果
|
||||||
|
*/
|
||||||
|
@PostMapping
|
||||||
|
public Result<EnforceCheck> createEnforceCheck(@RequestBody EnforceCheck enforceCheck, @CurrentUser RemoteUserInfo user) {
|
||||||
|
List<Object> publishData = enforceCheckService.saveEnforceCheck(enforceCheck, user, "add");
|
||||||
|
if (!publishData.isEmpty()) {
|
||||||
|
return Ok.of((EnforceCheck) publishData.get(0));
|
||||||
|
}
|
||||||
|
return Ok.of();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据ID查询执法检查记录
|
||||||
|
*
|
||||||
|
* @param enforceCheckId 执法检查记录ID
|
||||||
|
* @return 执法检查记录
|
||||||
|
*/
|
||||||
|
@GetMapping("/{enforceCheckId}")
|
||||||
|
public Result<EnforceCheck> getEnforceCheckById(@PathVariable String enforceCheckId) {
|
||||||
|
return enforceCheckService.findEnforceCheckById(enforceCheckId)
|
||||||
|
.map(s -> (Result<EnforceCheck>) Ok.of(s))
|
||||||
|
.orElse(Fail.of("执法检查记录不存在"));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询执法检查记录
|
||||||
|
*
|
||||||
|
* @param query 查询条件
|
||||||
|
* @return 分页执法检查记录
|
||||||
|
*/
|
||||||
|
@GetMapping
|
||||||
|
public PageResult<EnforceCheck> getEnforceCheckPage(EnforceCheckQuery query, @CurrentUser RemoteUserInfo user) {
|
||||||
|
Page<EnforceCheck> page = enforceCheckService.findEnforceCheckPage(query, user);
|
||||||
|
return PageResult.of(page);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* app端更新执法检查记录
|
||||||
|
*
|
||||||
|
* @param enforceCheck 执法检查记录
|
||||||
|
* @return 更新结果
|
||||||
|
*/
|
||||||
|
@PostMapping("/app")
|
||||||
|
public Result<EnforceCheck> appupdateEnforceCheck( @RequestBody EnforceCheck enforceCheck, @CurrentUser RemoteUserInfo user) {
|
||||||
|
if (!enforceCheckService.existsEnforceCheckById(enforceCheck.getEnforceCheckId())) {
|
||||||
|
return Fail.of("执法检查记录不存在");
|
||||||
|
}
|
||||||
|
List<Object> publishData = enforceCheckService.saveEnforceCheck(enforceCheck, user, "update");
|
||||||
|
if (!publishData.isEmpty()) {
|
||||||
|
return Ok.of((EnforceCheck) publishData.get(0));
|
||||||
|
}
|
||||||
|
return Ok.of();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新执法检查记录
|
||||||
|
*
|
||||||
|
* @param enforceCheckId 执法检查记录ID
|
||||||
|
* @param enforceCheck 执法检查记录
|
||||||
|
* @return 更新结果
|
||||||
|
*/
|
||||||
|
@PutMapping("/{enforceCheckId}")
|
||||||
|
public Result<EnforceCheck> updateEnforceCheck(@PathVariable String enforceCheckId, @RequestBody EnforceCheck enforceCheck, @CurrentUser RemoteUserInfo user) {
|
||||||
|
if (!enforceCheckService.existsEnforceCheckById(enforceCheckId)) {
|
||||||
|
return Fail.of("执法检查记录不存在");
|
||||||
|
}
|
||||||
|
enforceCheck.setEnforceCheckId(enforceCheckId);
|
||||||
|
List<Object> publishData = enforceCheckService.saveEnforceCheck(enforceCheck, user, "update");
|
||||||
|
if (!publishData.isEmpty()) {
|
||||||
|
return Ok.of((EnforceCheck) publishData.get(0));
|
||||||
|
}
|
||||||
|
return Ok.of();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据ID删除执法检查记录
|
||||||
|
*
|
||||||
|
* @param enforceCheckId 执法检查记录ID
|
||||||
|
* @return 删除结果
|
||||||
|
*/
|
||||||
|
@DeleteMapping("/{enforceCheckId}")
|
||||||
|
public Result<Void> deleteEnforceCheckById(@PathVariable String enforceCheckId) {
|
||||||
|
if (!enforceCheckService.existsEnforceCheckById(enforceCheckId)) {
|
||||||
|
return Fail.of("执法检查记录不存在");
|
||||||
|
}
|
||||||
|
enforceCheckService.deleteEnforceCheckById(enforceCheckId);
|
||||||
|
return Ok.of();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加现场图片或文件
|
||||||
|
*
|
||||||
|
* @param formData 图片信息
|
||||||
|
* @return 添加结果
|
||||||
|
*/
|
||||||
|
@PostMapping("/scenePic-file")
|
||||||
|
public Result<EnforceCheck> addScenePicOrFile(FormDataDto formData) {
|
||||||
|
return Ok.of(enforceCheckService.addScenePicOrFile(formData));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据执法信息ID查询执法检查记录
|
||||||
|
*
|
||||||
|
* @param enforcementId 执法信息ID
|
||||||
|
* @return 执法检查记录
|
||||||
|
*/
|
||||||
|
@GetMapping("/enforcement/{enforcementId}")
|
||||||
|
public Result<EnforceCheck> getEnforceCheckByEnforcementId(@PathVariable String enforcementId) {
|
||||||
|
return enforceCheckService.getEnforceCheckByEnforcementId(enforcementId)
|
||||||
|
.map(s -> (Result<EnforceCheck>) Ok.of(s))
|
||||||
|
.orElse(Fail.of("执法检查记录不存在"));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除现场图片或文件
|
||||||
|
*
|
||||||
|
* @param dto 删除对象
|
||||||
|
* @return 删除结果
|
||||||
|
*/
|
||||||
|
@DeleteMapping("/scenePic-file")
|
||||||
|
public Result<Void> deleteByIdScenePicFile(@RequestBody EnforceCheckResDto dto) {
|
||||||
|
enforceCheckService.deleteByIdScenePicFile(dto);
|
||||||
|
return Ok.of();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加抽样数据
|
||||||
|
*
|
||||||
|
* @param spotCheck 抽样数据
|
||||||
|
* @return 添加结果
|
||||||
|
*/
|
||||||
|
@PostMapping("/spotCheck")
|
||||||
|
public Result<SpotCheck> addSpotCheck(@RequestBody SpotCheck spotCheck) {
|
||||||
|
return Ok.of(enforceCheckService.addSpotCheck(spotCheck));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据执法信息ID查询抽样数据
|
||||||
|
*
|
||||||
|
* @param enforcementId 执法信息ID
|
||||||
|
* @return 抽样数据
|
||||||
|
*/
|
||||||
|
@GetMapping("/spotCheck/{enforcementId}")
|
||||||
|
public Result<SpotCheck> getSpotCheck(@PathVariable String enforcementId) {
|
||||||
|
return enforceCheckService.getSpotCheck(enforcementId)
|
||||||
|
.map(s -> (Result<SpotCheck>) Ok.of(s))
|
||||||
|
.orElse(Ok.of());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改抽样数据
|
||||||
|
*
|
||||||
|
* @param enforcementId 执法信息ID
|
||||||
|
*/
|
||||||
|
@PutMapping("/spotCheck/{enforcementId}")
|
||||||
|
public Result<Void> modifySpotCheck(@PathVariable String enforcementId, @RequestBody SpotCheck spotCheck) {
|
||||||
|
enforceCheckService.modifySpotCheck(enforcementId, spotCheck);
|
||||||
|
return Ok.of();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询历史执法检查记录
|
||||||
|
*
|
||||||
|
* @param query 查询条件
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@GetMapping("/history")
|
||||||
|
public PageResult<EnforceCheckDto> getEnforceCheckDtoPage(EnforceCheckQuery query, @CurrentUser RemoteUserInfo user) {
|
||||||
|
Page<EnforceCheckDto> page = enforceCheckService.findEnforceCheckDtoPage(query, user);
|
||||||
|
return PageResult.of(page);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执法检查上报
|
||||||
|
*
|
||||||
|
* @param enforceCheckId 检查id
|
||||||
|
* @param enforceCheck 执法检查实体
|
||||||
|
* @return 执法检查实体
|
||||||
|
*/
|
||||||
|
@PutMapping("/updateSupplement/{enforceCheckId}")
|
||||||
|
public Result<EnforceCheck> updateSupplement(@PathVariable String enforceCheckId, @RequestBody EnforceCheck enforceCheck, @CurrentUser RemoteUserInfo user) {
|
||||||
|
enforceCheck.setEnforceCheckId(enforceCheckId);
|
||||||
|
return Ok.of(enforceCheckService.saveSupplement(enforceCheck, user));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执法检查审核
|
||||||
|
* 俄
|
||||||
|
*
|
||||||
|
* @param enforceCheckId 检查id
|
||||||
|
* @param enforceCheck 执法检查实体
|
||||||
|
* @return 执法检查实体
|
||||||
|
*/
|
||||||
|
@PutMapping("/updateSupplementVerify/{enforceCheckId}")
|
||||||
|
public Result<EnforceCheck> updateSupplementVerify(@PathVariable String enforceCheckId, @RequestBody EnforceCheck enforceCheck, @CurrentUser RemoteUserInfo user) {
|
||||||
|
enforceCheck.setEnforceCheckId(enforceCheckId);
|
||||||
|
return Ok.of(enforceCheckService.updateSupplementVerify(enforceCheck, user));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改检查项id
|
||||||
|
*
|
||||||
|
* @param enforceCheck 执法检查实体
|
||||||
|
* @param user 用户信息
|
||||||
|
* @return 执法检查实体
|
||||||
|
*/
|
||||||
|
@PutMapping("/checkItem")
|
||||||
|
public Result<EnforceCheck> updateCheckItem(@RequestBody EnforceCheck enforceCheck, @CurrentUser RemoteUserInfo user) {
|
||||||
|
return enforceCheckService.updateCheckItem(enforceCheck, user)
|
||||||
|
.map(s -> (Result<EnforceCheck>) Ok.of(s))
|
||||||
|
.orElse(Fail.of("执法检查记录不存在"));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执法检查 现场处理措施
|
||||||
|
*
|
||||||
|
* @param enforceCheckId 检查id
|
||||||
|
* @param enforceCheck 执法检查实体
|
||||||
|
* @return 执法检查实体
|
||||||
|
*/
|
||||||
|
@PutMapping("/updateXcclcs/{enforceCheckId}")
|
||||||
|
public Result<EnforceCheck> updateXcclcs(@PathVariable String enforceCheckId, @RequestBody EnforceCheck enforceCheck, @CurrentUser RemoteUserInfo user) {
|
||||||
|
enforceCheck.setEnforceCheckId(enforceCheckId);
|
||||||
|
return Ok.of(enforceCheckService.updateXcclcs(enforceCheck, user));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出Excel
|
||||||
|
*
|
||||||
|
* @param excelParam 查询参数
|
||||||
|
* @param response 响应
|
||||||
|
*/
|
||||||
|
@PostMapping(value = "/export")
|
||||||
|
public void enterpriseExport(@RequestBody(required = false) ExportExcelParam<EnforceCheckQuery> excelParam, HttpServletResponse response, @CurrentUser RemoteUserInfo user) {
|
||||||
|
EnforceCheckQuery query = excelParam.getObj();
|
||||||
|
query.setTag("dc");
|
||||||
|
List<EnforceCheck> list = enforceCheckService.list(query, user);
|
||||||
|
if (list.isEmpty()) throw new RuntimeException("无查询结果不能导出");
|
||||||
|
List<String> labels = new ArrayList<>();
|
||||||
|
labels.add("企业名称");
|
||||||
|
labels.add("社会统一信用代码");
|
||||||
|
labels.add("执法机构");
|
||||||
|
labels.add("当前节点");
|
||||||
|
labels.add("检查日期");
|
||||||
|
labels.add("检查结果");
|
||||||
|
List<String> props = new ArrayList<>();
|
||||||
|
props.add("enforcementInfo.enterprise.unitName");
|
||||||
|
props.add("enforcementInfo.enterprise.unifiedSocialCode");
|
||||||
|
props.add("enforcementInfo.agency.agencyName");
|
||||||
|
props.add("enforcementInfo.currentNode");
|
||||||
|
props.add("checkDate");
|
||||||
|
props.add("checkResultMsg");
|
||||||
|
excelParam.setLabels(labels);
|
||||||
|
excelParam.setProps(props);
|
||||||
|
ExportExcelUtil.exportExcel(response, excelParam, list);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,206 @@
|
||||||
|
package com.aisino.iles.lawenforcement.controller;
|
||||||
|
|
||||||
|
import com.aisino.iles.common.model.Fail;
|
||||||
|
import com.aisino.iles.common.model.Ok;
|
||||||
|
import com.aisino.iles.common.model.PageResult;
|
||||||
|
import com.aisino.iles.common.model.Result;
|
||||||
|
import com.aisino.iles.common.util.Constants;
|
||||||
|
import com.aisino.iles.core.annotation.CurrentUser;
|
||||||
|
import com.aisino.iles.lawenforcement.model.EnforcementInfo;
|
||||||
|
import com.aisino.iles.lawenforcement.model.dto.CaseInfoDto;
|
||||||
|
import com.aisino.iles.lawenforcement.model.dto.EnforcementInfoDto;
|
||||||
|
import com.aisino.iles.lawenforcement.model.query.EnforcementInfoQuery;
|
||||||
|
import com.aisino.iles.lawenforcement.service.EnforcementInfoService;
|
||||||
|
import com.smartlx.sso.client.model.RemoteUserInfo;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 综合执法/执法信息
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping(Constants.API_PREFIX + "/lawenforcement/enforcements")
|
||||||
|
public class EnforcementInfoController {
|
||||||
|
|
||||||
|
private final EnforcementInfoService enforcementInfoService;
|
||||||
|
|
||||||
|
public EnforcementInfoController(EnforcementInfoService enforcementInfoService) {
|
||||||
|
this.enforcementInfoService = enforcementInfoService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建执法信息
|
||||||
|
*
|
||||||
|
* @param enforcementInfoDto 执法信息
|
||||||
|
* @return 创建结果
|
||||||
|
*/
|
||||||
|
@PostMapping
|
||||||
|
public Result createEnforcementInfo(EnforcementInfoDto enforcementInfoDto, @CurrentUser RemoteUserInfo user) {
|
||||||
|
enforcementInfoService.saveEnforcementInfo(enforcementInfoDto, user);
|
||||||
|
return Ok.of();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询执法信息
|
||||||
|
*
|
||||||
|
* @param query 查询条件
|
||||||
|
* @return 执法信息
|
||||||
|
*/
|
||||||
|
@GetMapping
|
||||||
|
public PageResult<EnforcementInfo> getEnforcementInfosPage(EnforcementInfoQuery query) {
|
||||||
|
return PageResult.of(enforcementInfoService.findEnforcementInfosPage(query));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id查询执法信息
|
||||||
|
*
|
||||||
|
* @param enforcementId 执法信息id
|
||||||
|
* @return 执法信息
|
||||||
|
*/
|
||||||
|
@GetMapping("/{enforcementId}")
|
||||||
|
public Result<EnforcementInfo> getEnforcementInfoById(@PathVariable String enforcementId) {
|
||||||
|
return enforcementInfoService.findEnforcementInfoById(enforcementId).map(e -> (Result<EnforcementInfo>) Ok.of(e)).orElse(Fail.of("执法信息不存在"));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id更新执法信息
|
||||||
|
*
|
||||||
|
* @param enforcementId 执法信息id
|
||||||
|
* @param enforcementInfo 执法信息
|
||||||
|
* @return 更新结果
|
||||||
|
*/
|
||||||
|
@PutMapping("/{enforcementId}")
|
||||||
|
public Result updateEnforcementInfo(@PathVariable String enforcementId, @RequestBody EnforcementInfoDto enforcementInfo) {
|
||||||
|
if (!enforcementInfoService.existsEnforcementInfoById(enforcementId)) {
|
||||||
|
return Fail.of("执法信息不存在");
|
||||||
|
}
|
||||||
|
enforcementInfo.setEnforcementId(enforcementId);
|
||||||
|
enforcementInfoService.updateEnforcementInfo(enforcementInfo);
|
||||||
|
return Ok.of();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id删除执法信息
|
||||||
|
*
|
||||||
|
* @param enforcementId 执法信息id
|
||||||
|
* @return 删除结果
|
||||||
|
*/
|
||||||
|
@DeleteMapping("/{enforcementId}")
|
||||||
|
public Result deleteEnforcementInfoById(@PathVariable String enforcementId) {
|
||||||
|
if (!enforcementInfoService.existsEnforcementInfoById(enforcementId)) {
|
||||||
|
return Fail.of("执法信息不存在");
|
||||||
|
}
|
||||||
|
enforcementInfoService.deleteEnforcementInfoById(enforcementId);
|
||||||
|
return Ok.of();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除执法信息
|
||||||
|
*
|
||||||
|
* @param enforcementIds 执法信息id列表
|
||||||
|
* @return 删除结果
|
||||||
|
*/
|
||||||
|
@DeleteMapping
|
||||||
|
public Result deleteEnforcementInfosByIds(@RequestBody List<String> enforcementIds) {
|
||||||
|
enforcementInfoService.deleteEnforcementInfosByIds(enforcementIds);
|
||||||
|
return Ok.of();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执法信息方案审批
|
||||||
|
*
|
||||||
|
* @param enforcementInfoDto 方案审批信息
|
||||||
|
* @return 创建结果
|
||||||
|
*/
|
||||||
|
@PostMapping("/plan_approval")
|
||||||
|
public Result createPlanApproval(@RequestBody EnforcementInfoDto enforcementInfoDto) {
|
||||||
|
enforcementInfoService.savePlanApproval(enforcementInfoDto);
|
||||||
|
return Ok.of();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执法信息总结
|
||||||
|
*
|
||||||
|
* @param enforcementInfoDto 总结信息
|
||||||
|
* @return 创建结果
|
||||||
|
*/
|
||||||
|
@PostMapping("/summarize")
|
||||||
|
public Result createSummarize(@RequestBody EnforcementInfoDto enforcementInfoDto) {
|
||||||
|
enforcementInfoService.saveSummarize(enforcementInfoDto);
|
||||||
|
return Ok.of();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执法信息创建案件
|
||||||
|
*
|
||||||
|
* @param caseInfoDto 案件信息
|
||||||
|
* @return 创建结果
|
||||||
|
*/
|
||||||
|
@PostMapping("/case")
|
||||||
|
public Result createCaseInfo(@RequestBody CaseInfoDto caseInfoDto) {
|
||||||
|
enforcementInfoService.saveCaseInfo(caseInfoDto);
|
||||||
|
return Ok.of();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执法信息推送案件
|
||||||
|
*
|
||||||
|
* @param caseInfoDto 案件信息
|
||||||
|
* @return 创建结果
|
||||||
|
*/
|
||||||
|
@PostMapping("/case/push")
|
||||||
|
public Result pushCaseInfo(@RequestBody CaseInfoDto caseInfoDto) {
|
||||||
|
enforcementInfoService.pushCaseInfo(caseInfoDto);
|
||||||
|
return Ok.of();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执法信息集体讨论
|
||||||
|
*
|
||||||
|
* @param enforcementInfoDto 集体讨论信息
|
||||||
|
* @return 创建结果
|
||||||
|
*/
|
||||||
|
@PostMapping("/brainstorm")
|
||||||
|
public Result createBrainstorm(@RequestBody EnforcementInfoDto enforcementInfoDto) {
|
||||||
|
enforcementInfoService.saveBrainstorm(enforcementInfoDto);
|
||||||
|
return Ok.of();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执法信息案件审核
|
||||||
|
*
|
||||||
|
* @param enforcementInfoDto 案件审核信息
|
||||||
|
* @return 创建结果
|
||||||
|
*/
|
||||||
|
@PostMapping("/caseexamine")
|
||||||
|
public Result createCaseExamine(@RequestBody EnforcementInfoDto enforcementInfoDto) {
|
||||||
|
enforcementInfoService.saveCaseExamine(enforcementInfoDto);
|
||||||
|
return Ok.of();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执法信息案件审批
|
||||||
|
*
|
||||||
|
* @param enforcementInfoDto 案件审批信息
|
||||||
|
* @return 创建结果
|
||||||
|
*/
|
||||||
|
@PostMapping("/caseapprove")
|
||||||
|
public Result createCaseApprove(@RequestBody EnforcementInfoDto enforcementInfoDto) {
|
||||||
|
enforcementInfoService.saveCaseApprove(enforcementInfoDto);
|
||||||
|
return Ok.of();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执法信息立案
|
||||||
|
*
|
||||||
|
* @param enforcementInfoDto 执法信息立案信息
|
||||||
|
* @return 创建结果
|
||||||
|
*/
|
||||||
|
@PostMapping("/fillingFlag")
|
||||||
|
public Result updateFillingFlag(@RequestBody EnforcementInfoDto enforcementInfoDto) {
|
||||||
|
enforcementInfoService.updateFillingFlag(enforcementInfoDto);
|
||||||
|
return Ok.of();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,104 @@
|
||||||
|
package com.aisino.iles.lawenforcement.controller;
|
||||||
|
|
||||||
|
import com.aisino.iles.common.model.Fail;
|
||||||
|
import com.aisino.iles.common.model.Ok;
|
||||||
|
import com.aisino.iles.common.model.PageResult;
|
||||||
|
import com.aisino.iles.common.model.Result;
|
||||||
|
import com.aisino.iles.common.util.Constants;
|
||||||
|
import com.aisino.iles.core.annotation.CurrentUser;
|
||||||
|
import com.aisino.iles.lawenforcement.model.Case;
|
||||||
|
import com.aisino.iles.lawenforcement.model.EnforcementInfoHistory;
|
||||||
|
import com.aisino.iles.lawenforcement.model.dto.FormDataDto;
|
||||||
|
import com.aisino.iles.lawenforcement.model.query.CaseQuery;
|
||||||
|
import com.aisino.iles.lawenforcement.service.EnforcementInfoHistoryService;
|
||||||
|
import com.smartlx.sso.client.model.RemoteUserInfo;
|
||||||
|
import org.springframework.data.domain.Page;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 综合执法/历史执法信息填报
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping(Constants.API_PREFIX + "/lawenforcement/enforcementInfoHistory")
|
||||||
|
public class EnforcementInfoHistoryController {
|
||||||
|
private final EnforcementInfoHistoryService historyService;
|
||||||
|
public EnforcementInfoHistoryController(EnforcementInfoHistoryService historyService) {
|
||||||
|
this.historyService = historyService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询历史执法信息
|
||||||
|
*
|
||||||
|
* @param query 历史执法信息数据项查询条件
|
||||||
|
* @return 分页历史执法信息
|
||||||
|
*/
|
||||||
|
@GetMapping
|
||||||
|
public PageResult<EnforcementInfoHistory> getEnforcementInfoHistoryPage(CaseQuery query,@CurrentUser RemoteUserInfo user) {
|
||||||
|
Page<EnforcementInfoHistory> page = historyService.findCasesPage(query,user);
|
||||||
|
return PageResult.of(page);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存填报的历史执法信息
|
||||||
|
*
|
||||||
|
* @param info 历史执法信息实体
|
||||||
|
* @return 历史执法信息实体
|
||||||
|
*/
|
||||||
|
@PostMapping
|
||||||
|
public Result<EnforcementInfoHistory> saveCase( @RequestBody EnforcementInfoHistory info,@CurrentUser RemoteUserInfo user) {
|
||||||
|
info.setCreatedTime(LocalDateTime.now());
|
||||||
|
info.setTbr(user.getXm());
|
||||||
|
|
||||||
|
return Ok.of(historyService.saveEnforcementInfoHistory(info,user));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据历史执法信息id修改
|
||||||
|
*
|
||||||
|
* @param historyId 历史执法信息id
|
||||||
|
* @param info 历史执法信息实体
|
||||||
|
* @return 历史执法信息实体
|
||||||
|
*/
|
||||||
|
@PutMapping("/{historyId}")
|
||||||
|
public Result<EnforcementInfoHistory> updateCase(@PathVariable String historyId, @RequestBody EnforcementInfoHistory info,@CurrentUser RemoteUserInfo user) {
|
||||||
|
info.setHistoryId(historyId);
|
||||||
|
return Ok.of(historyService.saveEnforcementInfoHistory(info,user));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 立案上报审核
|
||||||
|
* @param historyId 历史执法信息id
|
||||||
|
* @param caseInfo 历史执法信息实体
|
||||||
|
* @return 历史执法信息实体
|
||||||
|
*/
|
||||||
|
@PutMapping("/updateSupplementVerify/{historyId}")
|
||||||
|
public Result<EnforcementInfoHistory> updateSupplementVerify(@PathVariable String historyId, @RequestBody EnforcementInfoHistory caseInfo, @CurrentUser RemoteUserInfo user) {
|
||||||
|
caseInfo.setHistoryId(historyId);
|
||||||
|
return Ok.of(historyService.updateSupplementVerify(caseInfo,user));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执法立案统计(不分页)
|
||||||
|
*
|
||||||
|
* @param query
|
||||||
|
* @return 查询执法立案统计结果
|
||||||
|
*/
|
||||||
|
@GetMapping("/listZflatj")
|
||||||
|
public Result<List<EnforcementInfoHistory>> listZflatj(CaseQuery query, @CurrentUser RemoteUserInfo user) {
|
||||||
|
return Ok.of(historyService.listLsZflatj(query,user));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,97 @@
|
||||||
|
package com.aisino.iles.lawenforcement.controller;
|
||||||
|
|
||||||
|
import com.aisino.iles.common.util.Constants;
|
||||||
|
import com.aisino.iles.lawenforcement.model.query.HikVisionQuery;
|
||||||
|
import com.aisino.iles.lawenforcement.service.HikVisionService;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 综合执法/海康威视
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping(Constants.API_PREFIX + "/hikvision")
|
||||||
|
public class HikVisionController {
|
||||||
|
|
||||||
|
private static final String REGIONS_ROOT = "/getRegions/root";
|
||||||
|
private static final String SUB_REGIONS = "/getRegions/subRegions";
|
||||||
|
private static final String REGIONS_CAMERAS = "/getRegions/cameras";
|
||||||
|
private static final String REGIONS_CAMERAS_DETAIL = "/getRegions/cameras/detail";
|
||||||
|
private static final String CAMERAS_PREVIEW = "/cameras/preview";
|
||||||
|
private static final String CAMERAS_PLAYBACK = "/cameras/playback";
|
||||||
|
|
||||||
|
private final HikVisionService hikVisionService;
|
||||||
|
|
||||||
|
public HikVisionController(HikVisionService hikVisionService) {
|
||||||
|
this.hikVisionService = hikVisionService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取根区域信息
|
||||||
|
*
|
||||||
|
* @param treeCode 树编码
|
||||||
|
* @return 区域信息
|
||||||
|
*/
|
||||||
|
@GetMapping(REGIONS_ROOT)
|
||||||
|
public String getRegionsRoot(String treeCode) {
|
||||||
|
return hikVisionService.getRegionsRoot(treeCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据区域编号获取下一级区域列表
|
||||||
|
*
|
||||||
|
* @param parentIndexCode 父节点indexCode
|
||||||
|
* @param treeCode 父节点树编码
|
||||||
|
* @return 区域信息
|
||||||
|
*/
|
||||||
|
@GetMapping(SUB_REGIONS)
|
||||||
|
public String getSubRegions(String parentIndexCode, String treeCode) {
|
||||||
|
return hikVisionService.getSubRegions(parentIndexCode, treeCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据区域编号获取下级监控点列表
|
||||||
|
*
|
||||||
|
* @param hikVisionQuery
|
||||||
|
* @return 摄像头信息
|
||||||
|
*/
|
||||||
|
@GetMapping(REGIONS_CAMERAS)
|
||||||
|
public String getRegionsCameras(HikVisionQuery hikVisionQuery) {
|
||||||
|
return hikVisionService.getRegionsCameras(hikVisionQuery);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据编号获取监控点详细信息
|
||||||
|
*
|
||||||
|
* @param cameraIndexCode 摄像头indexCode
|
||||||
|
* @return 摄像头信息
|
||||||
|
*/
|
||||||
|
@GetMapping(REGIONS_CAMERAS_DETAIL)
|
||||||
|
public String getRegionsCamerasDetail(String cameraIndexCode) {
|
||||||
|
return hikVisionService.getRegionsCamerasDetail(cameraIndexCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取监控点预览取流
|
||||||
|
*
|
||||||
|
* @param hikVisionQuery 摄像头indexCode
|
||||||
|
* @return 监控点预览流
|
||||||
|
*/
|
||||||
|
@GetMapping(CAMERAS_PREVIEW)
|
||||||
|
public String getCamerasPreview(HikVisionQuery hikVisionQuery) {
|
||||||
|
return hikVisionService.getCamerasPreview(hikVisionQuery);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取监控点回放取流
|
||||||
|
*
|
||||||
|
* @param hikVisionQuery 摄像头indexCode
|
||||||
|
* @return 监控点回放流
|
||||||
|
*/
|
||||||
|
@GetMapping(CAMERAS_PLAYBACK)
|
||||||
|
public String getCamerasPlayback(HikVisionQuery hikVisionQuery) {
|
||||||
|
return hikVisionService.getCamerasPlayback(hikVisionQuery);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,92 @@
|
||||||
|
package com.aisino.iles.lawenforcement.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import com.aisino.iles.common.model.Ok;
|
||||||
|
import com.aisino.iles.common.model.Result;
|
||||||
|
import com.aisino.iles.common.util.Constants;
|
||||||
|
import com.aisino.iles.core.annotation.CurrentUser;
|
||||||
|
import com.aisino.iles.lawenforcement.model.dto.DocumentDto;
|
||||||
|
import com.aisino.iles.lawenforcement.model.query.EnforceCheckQuery;
|
||||||
|
import com.aisino.iles.lawenforcement.service.HomePageService;
|
||||||
|
import com.smartlx.sso.client.model.RemoteUserInfo;
|
||||||
|
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 java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 综合执法/首页统计数
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping(Constants.API_PREFIX + "/lawenforcement/HomePage")
|
||||||
|
public class HomePageController {
|
||||||
|
private final HomePageService homePageService;
|
||||||
|
|
||||||
|
public HomePageController(HomePageService homePageService) {
|
||||||
|
this.homePageService = homePageService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 首页统计条计数
|
||||||
|
*
|
||||||
|
* @return 首页统计条计数
|
||||||
|
*/
|
||||||
|
@GetMapping("/getstatCount")
|
||||||
|
public Result<Map> getstatCount(@CurrentUser RemoteUserInfo user) {
|
||||||
|
return Ok.of(homePageService.getstatCount(user));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 首页统计代办数量
|
||||||
|
*
|
||||||
|
* @return 首页统计代办数量
|
||||||
|
*/
|
||||||
|
@GetMapping("/countCurrentNodeCode")
|
||||||
|
public Result<List<Map<String, Object>>> countCurrentNodeCode(@CurrentUser RemoteUserInfo user) {
|
||||||
|
return Ok.of(homePageService.countCurrentNodeCode(user));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 首页查询待立案数量
|
||||||
|
*
|
||||||
|
* @return 首页查询待立案数量
|
||||||
|
*/
|
||||||
|
@GetMapping("/getdlaCount")
|
||||||
|
public Result<Map> getdlaCount(@CurrentUser RemoteUserInfo user) {
|
||||||
|
return Ok.of(homePageService.getdla(user));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执法趋势统计
|
||||||
|
*
|
||||||
|
* @return 统计结果
|
||||||
|
*/
|
||||||
|
@GetMapping("/zfqstj")
|
||||||
|
public Result<Map<String, Object>> zfqstj(EnforceCheckQuery query) {
|
||||||
|
return Ok.of(homePageService.zfqstj(query));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 行政执法案件进度一览表
|
||||||
|
*
|
||||||
|
* @return 列表结果
|
||||||
|
*/
|
||||||
|
@GetMapping("/ajjdlb")
|
||||||
|
public Result<List<DocumentDto>> ajjdlb(EnforceCheckQuery query) {
|
||||||
|
return Ok.of(homePageService.ajjdlb(query));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 案件统计
|
||||||
|
*
|
||||||
|
* @return 列表结果
|
||||||
|
*/
|
||||||
|
@GetMapping("/ajtj")
|
||||||
|
public Result<Map<String, Long>> ajtj(EnforceCheckQuery query, @CurrentUser RemoteUserInfo user) {
|
||||||
|
return Ok.of(homePageService.ajtj(query, user));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,138 @@
|
||||||
|
package com.aisino.iles.lawenforcement.controller;
|
||||||
|
|
||||||
|
import com.aisino.iles.common.model.Ok;
|
||||||
|
import com.aisino.iles.common.model.PageResult;
|
||||||
|
import com.aisino.iles.common.model.Result;
|
||||||
|
import com.aisino.iles.core.annotation.CurrentUser;
|
||||||
|
import com.aisino.iles.lawenforcement.model.Message.MessageStatus;
|
||||||
|
import com.aisino.iles.lawenforcement.model.dto.message.MessageDto.DeleteMessagesRequest;
|
||||||
|
import com.aisino.iles.lawenforcement.model.dto.message.MessageDto.MessageCountResponse;
|
||||||
|
import com.aisino.iles.lawenforcement.model.dto.message.MessageDto.MessageResponse;
|
||||||
|
import com.aisino.iles.lawenforcement.model.dto.message.MessageDto.SendMessageRequest;
|
||||||
|
import com.aisino.iles.lawenforcement.model.dto.message.MessageDto.UpdateStatusRequest;
|
||||||
|
import com.aisino.iles.lawenforcement.service.MessageService;
|
||||||
|
import com.smartlx.sso.client.model.RemoteUserInfo;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.data.domain.Page;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 综合执法/消息管理
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/lawenforcement/messages")
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Slf4j
|
||||||
|
public class MessageController {
|
||||||
|
|
||||||
|
private final MessageService messageService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送消息
|
||||||
|
*
|
||||||
|
* @param request 发送消息请求
|
||||||
|
* @param user 当前用户
|
||||||
|
* @return 消息ID
|
||||||
|
*/
|
||||||
|
@PostMapping
|
||||||
|
public Result<Map<String, String>> sendMessage(@Valid @RequestBody SendMessageRequest request, @CurrentUser RemoteUserInfo user) {
|
||||||
|
String messageId = messageService.sendMessage(request, user);
|
||||||
|
|
||||||
|
Map<String, String> response = new HashMap<>();
|
||||||
|
response.put("id", messageId);
|
||||||
|
response.put("status", "success");
|
||||||
|
|
||||||
|
return Ok.of(response);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除消息(逻辑删除)
|
||||||
|
*
|
||||||
|
* @param request 包含消息ID列表的请求
|
||||||
|
* @param user 当前用户
|
||||||
|
* @return 操作结果
|
||||||
|
*/
|
||||||
|
@DeleteMapping
|
||||||
|
public Result<Void> deleteMessages(@RequestBody DeleteMessagesRequest request, @CurrentUser RemoteUserInfo user) {
|
||||||
|
messageService.deleteMessagesForCurrentUser(request.getMessageIds(), user);
|
||||||
|
return Ok.of();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取当前用户的消息列表
|
||||||
|
*
|
||||||
|
* @param status 消息状态过滤(可选)
|
||||||
|
* @param pageable 分页参数
|
||||||
|
* @param user 当前用户
|
||||||
|
* @return 消息列表(分页)
|
||||||
|
*/
|
||||||
|
@GetMapping
|
||||||
|
public PageResult<MessageResponse> getUserMessages(
|
||||||
|
@RequestParam(required = false) MessageStatus status,
|
||||||
|
Pageable pageable, @CurrentUser RemoteUserInfo user) {
|
||||||
|
|
||||||
|
Page<MessageResponse> messages = messageService.getUserMessages(status, pageable, user);
|
||||||
|
return PageResult.of(messages);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取消息详情
|
||||||
|
*
|
||||||
|
* @param id 消息ID
|
||||||
|
* @param user 当前用户
|
||||||
|
* @return 消息详情
|
||||||
|
*/
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public Result<MessageResponse> getMessageById(@PathVariable String id, @CurrentUser RemoteUserInfo user) {
|
||||||
|
MessageResponse message = messageService.getMessageById(id, user);
|
||||||
|
return Ok.of(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新消息状态
|
||||||
|
*
|
||||||
|
* @param id 消息ID
|
||||||
|
* @param request 更新状态请求
|
||||||
|
* @param user 当前用户
|
||||||
|
* @return 操作结果
|
||||||
|
*/
|
||||||
|
@PutMapping("/{id}/status")
|
||||||
|
public Result<Map<String, String>> updateMessageStatus(
|
||||||
|
@PathVariable String id,
|
||||||
|
@Valid @RequestBody UpdateStatusRequest request, @CurrentUser RemoteUserInfo user) {
|
||||||
|
messageService.updateMessageStatus(id, request.getStatus(), user);
|
||||||
|
|
||||||
|
return Ok.of();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除消息(逻辑删除)
|
||||||
|
*
|
||||||
|
* @param id 消息ID
|
||||||
|
* @return 操作结果
|
||||||
|
*/
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
public Result<Object> deleteMessage(@PathVariable String id, @CurrentUser RemoteUserInfo user) {
|
||||||
|
messageService.deleteMessage(id, user);
|
||||||
|
return Ok.of();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取当前用户未读消息数量
|
||||||
|
*
|
||||||
|
* @return 未读消息数量
|
||||||
|
*/
|
||||||
|
@GetMapping("/unread/count")
|
||||||
|
public Result<MessageCountResponse> getUnreadMessageCount(@CurrentUser RemoteUserInfo user) {
|
||||||
|
MessageCountResponse response = messageService.getUnreadMessageCount(user);
|
||||||
|
return Ok.of(response);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,91 @@
|
||||||
|
package com.aisino.iles.lawenforcement.controller;
|
||||||
|
|
||||||
|
import com.aisino.iles.common.model.Fail;
|
||||||
|
import com.aisino.iles.common.model.Ok;
|
||||||
|
import com.aisino.iles.common.model.PageResult;
|
||||||
|
import com.aisino.iles.common.model.Result;
|
||||||
|
import com.aisino.iles.common.util.Constants;
|
||||||
|
import com.aisino.iles.core.annotation.CurrentUser;
|
||||||
|
import com.aisino.iles.lawenforcement.model.Notice;
|
||||||
|
import com.aisino.iles.lawenforcement.model.Zfzbgl;
|
||||||
|
import com.aisino.iles.lawenforcement.model.dto.ZfzbglStatisticsDto;
|
||||||
|
import com.aisino.iles.lawenforcement.model.query.NotificationQuery;
|
||||||
|
import com.aisino.iles.lawenforcement.model.query.ZfzbglQuery;
|
||||||
|
import com.aisino.iles.lawenforcement.service.NoticeService;
|
||||||
|
import com.aisino.iles.lawenforcement.service.ZfzbglService;
|
||||||
|
import com.smartlx.sso.client.model.RemoteUserInfo;
|
||||||
|
import org.springframework.data.domain.Page;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 综合执法/通知公告
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping(Constants.API_PREFIX + "/lawenforcement/notice")
|
||||||
|
public class NoticeController {
|
||||||
|
|
||||||
|
private final NoticeService noticeService;
|
||||||
|
|
||||||
|
public NoticeController(NoticeService noticeService) {
|
||||||
|
this.noticeService = noticeService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增
|
||||||
|
*/
|
||||||
|
@PostMapping
|
||||||
|
public Result<Notice> createZfzbgl(@RequestBody Notice notice, @CurrentUser RemoteUserInfo userInfo) {
|
||||||
|
return Ok.of(noticeService.addNotice(notice, userInfo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据ID查询
|
||||||
|
*/
|
||||||
|
@GetMapping("/{noticeId}")
|
||||||
|
public Result<Notice> getZfzbglById(@PathVariable String noticeId, @CurrentUser RemoteUserInfo userInfo) {
|
||||||
|
Result<Notice> noticeResult = noticeService.findOneNotice(noticeId, userInfo).map(e -> ((Result<Notice>) Ok.of(e))).orElse(Fail.of("通知公告不存在"));
|
||||||
|
return noticeResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询
|
||||||
|
*/
|
||||||
|
@GetMapping
|
||||||
|
public PageResult<Notice> getZfzbglPage(NotificationQuery query, @CurrentUser RemoteUserInfo user) {
|
||||||
|
Page<Notice> page = noticeService.pageNotice(query, user);
|
||||||
|
return PageResult.of(page);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新
|
||||||
|
*/
|
||||||
|
@PutMapping("/{noticeId}")
|
||||||
|
public Result<Notice> updateZfzbgl(@PathVariable String noticeId, @RequestBody Notice notice, @CurrentUser RemoteUserInfo user) {
|
||||||
|
noticeService.modifyNotice(noticeId, notice, user);
|
||||||
|
return Ok.of();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据ID删除
|
||||||
|
*/
|
||||||
|
@DeleteMapping("/{noticeId}")
|
||||||
|
public Result<Void> deleteZfzbglById(@PathVariable String noticeId, @CurrentUser RemoteUserInfo user) {
|
||||||
|
noticeService.removeNotice(noticeId, user);
|
||||||
|
return Ok.of();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通知通告列表
|
||||||
|
*
|
||||||
|
* @param query 查询参数
|
||||||
|
* @param user 当前用户
|
||||||
|
* @return 通知通告列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/list")
|
||||||
|
public Result<List<Notice>> list(NotificationQuery query, @CurrentUser RemoteUserInfo user) {
|
||||||
|
return Ok.of(noticeService.list(query, user));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue