wl
2022-10-13 0041b415eaf904ec70aeb7c4e44ea4f292e6dd20
ycl-platform/src/main/java/com/ycl/controller/caseHandler/BaseCaseController.java
@@ -5,11 +5,15 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ycl.annotation.LogSave;
import com.ycl.api.CommonResult;
import com.ycl.common.constant.BaseCaseStatus;
import com.ycl.common.util.UtilNumber;
import com.ycl.controller.BaseController;
import com.ycl.dto.casePool.IllegalBuildingParam;
import com.ycl.dto.casePool.ViolationParam;
import com.ycl.entity.caseHandler.BaseCase;
import com.ycl.entity.caseHandler.BaseCaseDetail;
import com.ycl.entity.caseHandler.DisposeRecord;
import com.ycl.service.caseHandler.IBaseCaseService;
import com.ycl.service.caseHandler.IDisposeRecordService;
@@ -24,9 +28,7 @@
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
import java.util.List;
import java.util.UUID;
/**
@@ -53,6 +55,9 @@
    @Autowired
    IDisposeRecordService iDisposeRecordService;
    @Autowired
    UtilNumber utilNumber;
    @Autowired
    public void setBaseCaseService(IBaseCaseService baseCaseService) {
@@ -78,7 +83,7 @@
    @ApiOperation(value = "查询违规违建")
    @GetMapping("/query")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "state", value = "处理状态(0误报 1上报 2立案 3派遣 4处置 5核查 6结案7处理中)", dataType = "Integer"),
            @ApiImplicitParam(name = "state", value = "处理状态(0-待处理1-误报2-上报3-再学习/再训练4暂不处理5立案6调度7处置8核查9结案)", dataType = "Integer"),
            @ApiImplicitParam(name = "type", value = "1 违规,2 违建", dataType = "Integer"),
            @ApiImplicitParam(name = "resource", value = "1 视频,2 手动", dataType = "Integer")
    })
@@ -116,6 +121,7 @@
    @ApiImplicitParams({
            @ApiImplicitParam(name = "type", value = "1 违规,2 违建", dataType = "Integer")
    })
    @LogSave(operationType = "事项处置管理",contain = "删除案件")
    public CommonResult removeCase(@RequestParam Integer id, @RequestParam Integer type) {
        Integer violationType = 1;
        Integer illegalBuildingType = 2;
@@ -135,22 +141,22 @@
     * @Description delete illegal buildings or violations
     * @Param [ids, type]
     **/
    @ApiOperation(value = "删除违规/违建案件")
    @ApiOperation(value = "批处理-删除违规/违建案件")
    @DeleteMapping("/batch_deletion")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "type", value = "1 违规,2 违建", dataType = "Integer")
    })
    public CommonResult removeCases(@RequestParam String[] ids, @RequestParam Integer type) {
    @LogSave(operationType = "事项处置管理",contain = "批量删除案件")
    public CommonResult removeCases(@RequestParam List<Long> ids, @RequestParam Integer type) {
        Integer violationType = 1;
        Integer illegalBuildingType = 2;
        List<String> idList = Arrays.asList(ids);
        if (!idList.isEmpty()) {
        if (!ids.isEmpty()) {
            CommonResult.success(baseCaseService.removeBatchByIds(ids));
            if (type == violationType) {
                return CommonResult.success(violationsService.removeBatchByIds(idList));
                return CommonResult.success(violationsService.removeBatchByIds(ids));
            } else if (type == illegalBuildingType) {
                return CommonResult.success(illegalBuildingService.removeBatchByIds(idList));
                return CommonResult.success(illegalBuildingService.removeBatchByIds(ids));
            }
            return CommonResult.success(baseCaseService.removeBatchByIds(idList));
        }
        return CommonResult.failed("request parameter is null");
    }
@@ -162,16 +168,16 @@
     **/
    @ApiOperation(value = "添加违规案件")
    @PostMapping("/addition_violation")
    @LogSave(operationType = "事项处置管理",contain = "新增违建案件")
    public CommonResult addViolationCase(@RequestBody @Validated ViolationParam violationParam) {
        Integer violation = 1;
        Integer resource = 2;
        Integer state = 7;
        BaseCase baseCase = new BaseCase();
        BeanUtils.copyProperties(violationParam, baseCase);
        baseCase.setEventSource(resource);
        baseCase.setCategory(violation);
        baseCase.setCode(UUID.randomUUID().toString());
        baseCase.setState(state);
        baseCase.setCode(utilNumber.createCaseCode());
        baseCase.setState(BaseCaseStatus.PENDING);
        baseCaseService.save(baseCase);
        return CommonResult.success(baseCaseService.saveViolationCase(violationParam, baseCase.getId()));
    }
@@ -183,16 +189,16 @@
     **/
    @ApiOperation(value = "添加违建案件")
    @PostMapping("/addition_illegal_building")
    @LogSave(operationType = "事项处置管理",contain = "新增违规案件")
    public CommonResult addIllegalBuildingCase(@RequestBody @Validated IllegalBuildingParam illegalBuildingParam) {
        Integer illegalBuilding = 2;
        Integer resource = 2;
        Integer state = 7;
        BaseCase baseCase = new BaseCase();
        BeanUtils.copyProperties(illegalBuildingParam, baseCase);
        baseCase.setCategory(illegalBuilding);
        baseCase.setEventSource(resource);
        baseCase.setCode(UUID.randomUUID().toString());
        baseCase.setState(state);
        baseCase.setCode(utilNumber.createCaseCode());
        baseCase.setState(BaseCaseStatus.PENDING);
        baseCaseService.save(baseCase);
        return CommonResult.success(baseCaseService.saveIllegalBuildingCase(illegalBuildingParam, baseCase.getId()));
    }
@@ -202,7 +208,7 @@
    @ApiImplicitParams({
            @ApiImplicitParam(name = "code", value = "事件编号")
    })
    public CommonResult baseCaseDetail(@PathVariable(value = "code") String code) {
    public CommonResult<BaseCaseDetail> baseCaseDetail(@PathVariable(value = "code") String code) {
        return CommonResult.success(baseCaseService.baseCaseDetail(code));
    }
@@ -223,7 +229,7 @@
    @ApiOperation(value = "案件状态修改")
    @PutMapping("/case_status_update")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "处理状态(0误报 1上报 2立案 3派遣 4处置 5核查 6结案7处理中8暂不处理)",name = "state")
            @ApiImplicitParam(value = "处理状态(0-待处理1-误报2-上报3-再学习/再训练4暂不处理5立案6调度7处置8核查9结案)", name = "state")
    })
    public CommonResult updateCaseStatus(@RequestParam Integer caseId, @RequestParam Integer state) {
        return CommonResult.success(baseCaseService
@@ -240,7 +246,7 @@
    @ApiOperation(value = "暂不处置重新处置")
    @PutMapping("/reset")
    public CommonResult resetCase(@RequestParam Integer caseId) {
        Integer firstNum = 0;
        Integer firstNum = 1;
        Integer state = iDisposeRecordService
                .list(new LambdaQueryWrapper<DisposeRecord>()
                        .eq(DisposeRecord::getBaseCaseId, caseId).
@@ -253,8 +259,11 @@
    @ApiOperation(value = "结案")
    @PutMapping("/end_case")
    public  CommonResult endCase(@RequestParam Integer caseId,@RequestParam String result){
        baseCaseService.endCase(caseId,result);
    @LogSave(operationType = "事项处置管理",contain = "案件结案")
    public CommonResult endCase(@RequestParam Long caseId, @RequestParam String result) {
        baseCaseService.endCase(caseId, result);
        return CommonResult.success("end case success~!");
    }
}
}