From 807dc1fff85979874fbfc185918025e6b922ee3c Mon Sep 17 00:00:00 2001 From: baizonghao <1719256278@qq.com> Date: 星期六, 18 三月 2023 17:58:31 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- ycl-common/src/main/java/com/ycl/utils/StringUtils.java | 13 ycl-platform/src/main/java/com/ycl/mapper/unlawful/UnlawfulMapper.java | 38 - ycl-platform/src/main/resources/application-dev.yml | 2 ycl-common/src/main/java/com/ycl/service/user/impl/UmsRoleServiceImpl.java | 1 ycl-platform/src/main/java/com/ycl/controller/intelligentPatrol/StatisticsController.java | 124 ++---- ycl-platform/src/main/java/com/ycl/service/unlawful/impl/UnlawfulServiceImpl.java | 193 ++--------- ycl-platform/src/main/java/com/ycl/service/dict/impl/DataDictionaryServiceImpl.java | 11 ycl-platform/src/main/java/com/ycl/dto/statistics/UnlawfulDto.java | 15 ycl-platform/src/main/java/com/ycl/service/caseHandler/impl/ViolationsServiceImpl.java | 15 ycl-platform/src/main/java/com/ycl/mapper/dict/DataDictionaryMapper.java | 6 ycl-platform/src/main/resources/mapper/dict/DataDictionaryMapper.xml | 64 ++- ycl-platform/src/main/java/com/ycl/service/caseHandler/IBaseCaseService.java | 2 ycl-platform/src/test/java/com/ycl/sccgplatform/Test1.java | 4 ycl-platform/src/main/resources/mapper/caseHandler/BaseCaseMapper.xml | 23 + ycl-platform/src/main/resources/mapper/unlawful/UnlawfulMapper.xml | 362 ++++---------------- ycl-platform/src/main/java/com/ycl/controller/caseHandler/BaseCaseController.java | 52 +- ycl-platform/src/main/java/com/ycl/service/unlawful/UnlawfulService.java | 24 - ycl-platform/src/main/java/com/ycl/vo/dict/DataDictionaryVo.java | 16 ycl-platform/src/main/java/com/ycl/controller/dict/DatabaseDictionaryController.java | 17 ycl-platform/src/main/java/com/ycl/service/dict/IDataDictionaryService.java | 5 ycl-platform/src/main/java/com/ycl/entity/caseHandler/Violations.java | 2 ycl-platform/src/main/java/com/ycl/service/caseHandler/impl/BaseCaseServiceImpl.java | 4 ycl-platform/src/main/java/com/ycl/mapper/caseHandler/BaseCaseMapper.java | 2 23 files changed, 357 insertions(+), 638 deletions(-) diff --git a/ycl-common/src/main/java/com/ycl/service/user/impl/UmsRoleServiceImpl.java b/ycl-common/src/main/java/com/ycl/service/user/impl/UmsRoleServiceImpl.java index 3d35c0e..fef2b37 100644 --- a/ycl-common/src/main/java/com/ycl/service/user/impl/UmsRoleServiceImpl.java +++ b/ycl-common/src/main/java/com/ycl/service/user/impl/UmsRoleServiceImpl.java @@ -13,7 +13,6 @@ import com.ycl.mapper.user.UmsResourceMapper; import com.ycl.mapper.user.UmsRoleMapper; import com.ycl.service.user.*; -import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; diff --git a/ycl-common/src/main/java/com/ycl/utils/StringUtils.java b/ycl-common/src/main/java/com/ycl/utils/StringUtils.java index 4fa7c6c..62ddc24 100644 --- a/ycl-common/src/main/java/com/ycl/utils/StringUtils.java +++ b/ycl-common/src/main/java/com/ycl/utils/StringUtils.java @@ -1,5 +1,8 @@ package com.ycl.utils; +import java.math.BigDecimal; +import java.text.DecimalFormat; + public class StringUtils { /** @@ -48,13 +51,14 @@ * hello_world=>helloWorld * HELLO_WORLD=>helloWorld * Hello_World=>helloWorld + * * @param content * @return */ public static String underlineToLowerCamelCase(String content) { return new StringBuilder(16) - .append(content.substring(0,1).toLowerCase()) - .append(content.substring(1).replaceAll("_([a-zA-Z])","$1".toUpperCase())) + .append(content.substring(0, 1).toLowerCase()) + .append(content.substring(1).replaceAll("_([a-zA-Z])", "$1".toUpperCase())) .toString(); } @@ -64,6 +68,7 @@ * hello_world=>HelloWorld * HELLO_WORLD=>HelloWorld * Hello_World=>HelloWorld + * * @param content * @return */ @@ -74,5 +79,7 @@ .toString(); } - + public static String doubleTwo(Double value) { + return String.format("%.2f", value); + } } \ No newline at end of file diff --git a/ycl-platform/src/main/java/com/ycl/controller/caseHandler/BaseCaseController.java b/ycl-platform/src/main/java/com/ycl/controller/caseHandler/BaseCaseController.java index 569df4d..58a96b7 100644 --- a/ycl-platform/src/main/java/com/ycl/controller/caseHandler/BaseCaseController.java +++ b/ycl-platform/src/main/java/com/ycl/controller/caseHandler/BaseCaseController.java @@ -113,7 +113,6 @@ } return CommonResult.failed("request parameter is null"); }*/ - @ApiOperation(value = "鏌ヨ杩濊杩濆缓") @GetMapping("/query") @ApiImplicitParams({ @@ -131,8 +130,8 @@ }) public CommonResult searchViolation(@RequestParam Integer size, @RequestParam Integer current, - @RequestParam Integer state, - @RequestParam(required = false) Integer type, + @RequestParam(required = false) Integer state, + @RequestParam Integer type, @RequestParam(required = false) Integer resource, @RequestParam(required = false) String code, @RequestParam(required = false) String categoryBig, @@ -140,21 +139,18 @@ @RequestParam(required = false) Integer street, @RequestParam(required = false) String site, @RequestParam(required = false) String startTime, - @RequestParam(required = false) String endTime ){ - if (state != null) { - Page<Object> queryList; - Integer violation = 1; - Integer illegalBuilding = 2; - if (type == violation) { - queryList = baseCaseService.listViolationsPage(new Page<>().setCurrent(current).setSize(size), state, resource, code, categoryBig, categorySmall, street, site, startTime, endTime); - } else if (type == illegalBuilding) { - queryList = baseCaseService.listIllegalBuilding(new Page<>().setCurrent(current).setSize(size), state, resource); - } else { - return CommonResult.failed("bad request url"); - } - return CommonResult.success(queryList); + @RequestParam(required = false) String endTime, + @RequestParam(required = false) Integer violationsTypeId) { + + Page<Object> queryList; + if (type == 1) { + queryList = baseCaseService.listViolationsPage(new Page<>().setCurrent(current).setSize(size), state, resource, code, categoryBig, categorySmall, street, site, startTime, endTime, violationsTypeId); + } else if (type == 2) { + queryList = baseCaseService.listIllegalBuilding(new Page<>().setCurrent(current).setSize(size), state, resource); + } else { + return CommonResult.failed("bad request url"); } - return CommonResult.failed("request parameter is null"); + return CommonResult.success(queryList); } /** @@ -316,18 +312,18 @@ @ApiOperation(value = "璋冨害绠$悊-鎵归噺鍒犻櫎") @DeleteMapping("/batch_case_delete") - public CommonResult batchCaseDelete(@RequestParam List<Long> ids){ + public CommonResult batchCaseDelete(@RequestParam List<Long> ids) { ids.forEach( - item->{ - BaseCase baseCase = baseCaseService.getOne(new LambdaQueryWrapper<BaseCase>().eq(BaseCase::getId, item)); - if (baseCase.getCategory()==1){ - violationsService.removeById(item); - baseCaseService.removeById(item); - }else { - illegalBuildingService.removeById(item); - baseCaseService.removeById(item); + item -> { + BaseCase baseCase = baseCaseService.getOne(new LambdaQueryWrapper<BaseCase>().eq(BaseCase::getId, item)); + if (baseCase.getCategory() == 1) { + violationsService.removeById(item); + baseCaseService.removeById(item); + } else { + illegalBuildingService.removeById(item); + baseCaseService.removeById(item); + } } - } ); return CommonResult.success("success"); } @@ -344,7 +340,7 @@ Integer state = iDisposeRecordService .list(new LambdaQueryWrapper<DisposeRecord>() .eq(DisposeRecord::getBaseCaseId, caseId). - orderByDesc(DisposeRecord::getCreateTime)).get(firstNum).getState(); + orderByDesc(DisposeRecord::getCreateTime)).get(firstNum).getState(); return CommonResult.success(baseCaseService .update(new LambdaUpdateWrapper<BaseCase>() .eq(BaseCase::getId, caseId) diff --git a/ycl-platform/src/main/java/com/ycl/controller/dict/DatabaseDictionaryController.java b/ycl-platform/src/main/java/com/ycl/controller/dict/DatabaseDictionaryController.java index ec98475..14f77d1 100644 --- a/ycl-platform/src/main/java/com/ycl/controller/dict/DatabaseDictionaryController.java +++ b/ycl-platform/src/main/java/com/ycl/controller/dict/DatabaseDictionaryController.java @@ -7,6 +7,7 @@ import com.ycl.entity.dict.DataDictionary; import com.ycl.enums.common.DictTypeEnum; import com.ycl.service.dict.IDataDictionaryService; +import com.ycl.vo.dict.DataDictionaryVo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; @@ -41,7 +42,7 @@ @GetMapping("/queryByCode") @ApiOperation(("鏍规嵁code鑾峰彇瀛楁淇℃伅")) private CommonResult<List<DataDictionary>> queryByCode(@RequestParam(value = "code") String code) { - List<DataDictionary> dataDictionary = iDatabaseDictionaryService.queryByCode(code); + List<DataDictionary> dataDictionary = iDatabaseDictionaryService.queryByCode(code, null); return CommonResult.success(dataDictionary); } @@ -132,6 +133,20 @@ )); } + @GetMapping("/query_tree_type") + @ApiOperation("閫氳繃绫诲瀷缂栫爜鏌ヨ鏍戝舰绫诲瀷-鍙湁涓ょ骇") + @ApiImplicitParams({ + @ApiImplicitParam(name = "typeCode", value = "01杩濊 02 浜嬩欢绛夌骇 03璇佷欢绫诲瀷 04鏂囧寲 05鍚嶆棌 06杩濆缓 07鐢ㄦ埛绫诲瀷 08 閮ㄩ棬绫诲瀷 09 瑙掕壊绫诲瀷 10 涔℃潙琛楅亾 11 绀惧尯"), + @ApiImplicitParam(name = "level", value = "1 椤剁骇 2 涓�绾у瓙绾� 3 浜岀骇瀛愮骇 4涓夌骇瀛愮骇") + } + ) + private CommonResult queryTreeType(@RequestParam String typeCode, @RequestParam Integer level) { + + List<DataDictionaryVo> list = iDatabaseDictionaryService.queryTreeType(typeCode, level); + return CommonResult.success(list); + } + + @GetMapping("/addition") @ApiOperation("閫氱敤娣诲姞") private CommonResult queryType(@RequestBody DataDictionary dataDictionary) { diff --git a/ycl-platform/src/main/java/com/ycl/controller/intelligentPatrol/StatisticsController.java b/ycl-platform/src/main/java/com/ycl/controller/intelligentPatrol/StatisticsController.java index 506d508..5fcdd02 100644 --- a/ycl-platform/src/main/java/com/ycl/controller/intelligentPatrol/StatisticsController.java +++ b/ycl-platform/src/main/java/com/ycl/controller/intelligentPatrol/StatisticsController.java @@ -8,12 +8,14 @@ import com.ycl.dto.statistics.UnlawfulDto; import com.ycl.service.unlawful.UnlawfulService; import com.ycl.utils.EasyExcelUtils; +import com.ycl.vo.cockpit.CockpitVO; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.format.annotation.DateTimeFormat; import org.springframework.web.bind.annotation.*; +import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; @@ -57,23 +59,11 @@ @LogSave(operationType = "鎸夎繚瑙勭被鍨嬬粺璁�", contain = "鏌ヨ") public CommonResult<IPage<UnlawfulDto>> searchByType(@RequestParam(required = true) Integer currentPage, @RequestParam(required = true) Integer pageSize, - @RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime beginTime, - @RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime endTime) { - DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); - String startTime = null; - String endTime1 = null; - if (beginTime != null){ - startTime = beginTime.format(fmt); - } - if (endTime != null){ - endTime1 = endTime.format(fmt); - } + @RequestParam(required = false) String beginTime, + @RequestParam(required = false) String endTime) { - IPage<UnlawfulDto> page = new Page<>(); - List<UnlawfulDto> unlawfulByType = unlawfulService.getUnlawfulByType((currentPage - 1) * pageSize, pageSize, startTime, endTime1); + IPage<UnlawfulDto> page = unlawfulService.getUnlawfulByType(currentPage, pageSize, beginTime, endTime); - page.setTotal(unlawfulService.getTotalByType(startTime, endTime1)); - page.setRecords(unlawfulByType); return CommonResult.success(page); } @@ -82,22 +72,11 @@ @LogSave(operationType = "鎸夌偣浣嶇粺璁�", contain = "鏌ヨ") public CommonResult<IPage<UnlawfulDto>> searchByPoint(@RequestParam(required = true) Integer currentPage, @RequestParam(required = true) Integer pageSize, - @RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime beginTime, - @RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime endTime) { - DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); - String startTime = null; - String endTime1 = null; - if (beginTime != null){ - startTime = beginTime.format(fmt); - } - if (endTime != null){ - endTime1 = endTime.format(fmt); - } - IPage<UnlawfulDto> page = new Page<>(); - List<UnlawfulDto> unlawfulByType = unlawfulService.getUnlawfulBySite((currentPage - 1) * pageSize, pageSize, startTime, endTime1); + @RequestParam(required = false) String beginTime, + @RequestParam(required = false) String endTime) { - page.setTotal(unlawfulService.getTotalBySite(startTime, endTime1)); - page.setRecords(unlawfulByType); + IPage<UnlawfulDto> page = unlawfulService.getUnlawfulByPoint(currentPage, pageSize, beginTime, endTime); + return CommonResult.success(page); } @@ -106,21 +85,11 @@ @LogSave(operationType = "鎸夋椂闂寸粺璁�", contain = "鏌ヨ") public CommonResult<IPage<UnlawfulDto>> searchByTime(@RequestParam(required = true) Integer currentPage, @RequestParam(required = true) Integer pageSize, - @RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime beginTime, - @RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime endTime) { - DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); - String startTime = null; - String endTime1 = null; - if (beginTime != null){ - startTime = beginTime.format(fmt); - } - if (endTime != null){ - endTime1 = endTime.format(fmt); - } - IPage<UnlawfulDto> page = new Page<>(); - List<UnlawfulDto> unlawfulByType = unlawfulService.getUnlawfulByTime((currentPage - 1) * pageSize, pageSize, startTime, endTime1); - page.setTotal(unlawfulService.getTotalByTime(startTime, endTime1)); - page.setRecords(unlawfulByType); + @RequestParam(required = false) String beginTime, + @RequestParam(required = false) String endTime) { + + IPage<UnlawfulDto> page = unlawfulService.getUnlawfulByTime(currentPage, pageSize, beginTime, endTime); + return CommonResult.success(page); } @@ -129,22 +98,10 @@ @LogSave(operationType = "鎸夊尯鍩熺粺璁�", contain = "鏌ヨ") public CommonResult<IPage<UnlawfulDto>> searchByArea(@RequestParam(required = true) Integer currentPage, @RequestParam(required = true) Integer pageSize, - @RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime beginTime, - @RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime endTime) { - DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); - String startTime = null; - String endTime1 = null; - if (beginTime != null){ - startTime = beginTime.format(fmt); - } - if (endTime != null){ - endTime1 = endTime.format(fmt); - } - IPage<UnlawfulDto> page = new Page<>(); - List<UnlawfulDto> unlawfulByType = unlawfulService.getUnlawfulByStreet((currentPage - 1) * pageSize, pageSize, startTime, endTime1); + @RequestParam(required = false) String beginTime, + @RequestParam(required = false) String endTime) { + IPage<UnlawfulDto> page = unlawfulService.getUnlawfulByStreet(currentPage, pageSize, beginTime, endTime); - page.setTotal(unlawfulService.getTotalByStreet(startTime, endTime1)); - page.setRecords(unlawfulByType); return CommonResult.success(page); } @@ -175,44 +132,51 @@ return CommonResult.success(page); }*/ - @PostMapping("/export/unlawful") - @ApiOperation("鎸夊悇绉嶇粺璁℃柟寮�-瀵煎嚭") - public void export(HttpServletResponse response) { - List<UnlawfulDto> unlawfulByTypeExport = unlawfulService.getUnlawfulByTypeExport(); - String sheetName = "鎸夌粺璁℃柟寮�"; - EasyExcelUtils.export(response, sheetName, UnlawfulDto.class, unlawfulByTypeExport); - } +// @PostMapping("/export/unlawful") +// @ApiOperation("鎸夊悇绉嶇粺璁℃柟寮�-瀵煎嚭") +// public void export(HttpServletResponse response) { +// List<UnlawfulDto> unlawfulByTypeExport = unlawfulService.getUnlawfulByTypeExport(); +// String sheetName = "鎸夌粺璁℃柟寮�"; +// EasyExcelUtils.export(response, sheetName, UnlawfulDto.class, unlawfulByTypeExport); +// } @PostMapping("/export/unlawful/type") @ApiOperation("鎸夌被鍨嬬粺璁℃柟寮�-瀵煎嚭") - public void exportType(HttpServletResponse response) { - List<UnlawfulDto> unlawfulByTypeExport = unlawfulService.getUnlawfulByTypeExport(); - String sheetName = "鎸夌被鍨嬬粺璁℃柟寮�"; - EasyExcelUtils.export(response, sheetName, UnlawfulDto.class, unlawfulByTypeExport); + public void exportType(HttpServletResponse response, + @RequestBody CockpitVO vo) { + IPage<UnlawfulDto> page = unlawfulService.getUnlawfulByType(1, 500, vo.getBeginTime(), vo.getEndTime()); + String sheetName = "鎸夌粺璁℃柟寮�"; + EasyExcelUtils.export(response, sheetName, UnlawfulDto.class, page.getRecords()); } @PostMapping("/export/unlawful/street") @ApiOperation("鎸夊尯鍩熺粺璁℃柟寮�-瀵煎嚭") - public void exportStreet(HttpServletResponse response) { - List<UnlawfulDto> unlawfulByStreetExport = unlawfulService.getUnlawfulByStreetExport(); + public void exportStreet(HttpServletResponse response, + @RequestBody CockpitVO vo) { + IPage<UnlawfulDto> page = unlawfulService.getUnlawfulByStreet(1, 500, vo.getBeginTime(), vo.getEndTime()); + String sheetName = "鎸夊尯鍩熺粺璁℃柟寮�"; - EasyExcelUtils.export(response, sheetName, UnlawfulDto.class, unlawfulByStreetExport); + EasyExcelUtils.export(response, sheetName, UnlawfulDto.class, page.getRecords()); } @PostMapping("/export/unlawful/site") @ApiOperation("鎸夋姤璀︾偣浣嶇粺璁℃柟寮�-瀵煎嚭") - public void exportSite(HttpServletResponse response) { - List<UnlawfulDto> unlawfulBySiteExport = unlawfulService.getUnlawfulBySiteExport(); + public void exportSite(HttpServletResponse response, + @RequestBody CockpitVO vo) { + IPage<UnlawfulDto> page = unlawfulService.getUnlawfulByPoint(1, 500, vo.getBeginTime(), vo.getEndTime()); + String sheetName = "鎸夋姤璀︾偣浣嶇粺璁℃柟寮�"; - EasyExcelUtils.export(response, sheetName, UnlawfulDto.class, unlawfulBySiteExport); + EasyExcelUtils.export(response, sheetName, UnlawfulDto.class, page.getRecords()); } @PostMapping("/export/unlawful/time") @ApiOperation("鎸夋姤璀︾偣浣嶇粺璁℃柟寮�-瀵煎嚭") - public void exportTime(HttpServletResponse response) { - List<UnlawfulDto> unlawfulBySiteExport = unlawfulService.getUnlawfulByTimeExport(); + public void exportTime(HttpServletResponse response, + @RequestBody CockpitVO vo) { + IPage<UnlawfulDto> page = unlawfulService.getUnlawfulByTime(1, 500, vo.getBeginTime(), vo.getEndTime()); + String sheetName = "鎸夋姤璀︾偣浣嶇粺璁℃柟寮�"; - EasyExcelUtils.export(response, sheetName, UnlawfulDto.class, unlawfulBySiteExport); + EasyExcelUtils.export(response, sheetName, UnlawfulDto.class, page.getRecords()); } /*@PostMapping("/export/shop") diff --git a/ycl-platform/src/main/java/com/ycl/dto/statistics/UnlawfulDto.java b/ycl-platform/src/main/java/com/ycl/dto/statistics/UnlawfulDto.java index 02c4ec5..7fd6241 100644 --- a/ycl-platform/src/main/java/com/ycl/dto/statistics/UnlawfulDto.java +++ b/ycl-platform/src/main/java/com/ycl/dto/statistics/UnlawfulDto.java @@ -1,5 +1,6 @@ package com.ycl.dto.statistics; +import com.alibaba.excel.annotation.ExcelIgnore; import com.alibaba.excel.annotation.ExcelProperty; import lombok.AllArgsConstructor; import lombok.Builder; @@ -19,7 +20,11 @@ @NoArgsConstructor @Builder public class UnlawfulDto { - + /** + * 绫诲瀷鍚嶇О + */ + @ExcelIgnore + private Long id; /** * 绫诲瀷鍚嶇О */ @@ -36,7 +41,7 @@ * 鍗犳瘮 */ @ExcelProperty(value = "鍗犳瘮", index = 2) - private Double ratio; + private String ratio; /** * 绔嬫 @@ -72,17 +77,17 @@ * 瀹℃牳鐜� */ @ExcelProperty(value = "瀹℃牳鐜�", index = 8) - private Double checkedRatio; + private String checkedRatio; /** * 绔嬫鐜� */ @ExcelProperty(value = "绔嬫鐜�", index = 9) - private Double registerRatio; + private String registerRatio; /** * 鍑嗙‘鐜� */ @ExcelProperty(value = "鍑嗙‘鐜�", index = 10) - private Double accuracyRatio; + private String accuracyRatio; } diff --git a/ycl-platform/src/main/java/com/ycl/entity/caseHandler/Violations.java b/ycl-platform/src/main/java/com/ycl/entity/caseHandler/Violations.java index a328a7f..f7e9cc0 100644 --- a/ycl-platform/src/main/java/com/ycl/entity/caseHandler/Violations.java +++ b/ycl-platform/src/main/java/com/ycl/entity/caseHandler/Violations.java @@ -52,7 +52,7 @@ */ @TableField("grade_id") @ApiModelProperty(value = "浜嬩欢绛夌骇") - private Integer gradeId; + private Long gradeId; /** * 妗堢敱 diff --git a/ycl-platform/src/main/java/com/ycl/mapper/caseHandler/BaseCaseMapper.java b/ycl-platform/src/main/java/com/ycl/mapper/caseHandler/BaseCaseMapper.java index e309319..ba7288e 100644 --- a/ycl-platform/src/main/java/com/ycl/mapper/caseHandler/BaseCaseMapper.java +++ b/ycl-platform/src/main/java/com/ycl/mapper/caseHandler/BaseCaseMapper.java @@ -25,7 +25,7 @@ * @since 2022-09-24 */ public interface BaseCaseMapper extends BaseMapper<BaseCase> { - Page<CasePoolViolationVO> listViolationsPage(Page page, Integer state, Integer type, Integer resource, String code, String categoryBig, String categorySmall, Integer street, String site, String startTime, String endTime); + Page<CasePoolViolationVO> listViolationsPage(Page page, Integer state, Integer type, Integer resource, String code, String categoryBig, String categorySmall, Integer street, String site, String startTime, String endTime, Integer violationsTypeId); Page<CasePoolIllegalBuildingVO> listIllegalBuildingsPage(Page page, Integer state, Integer type, Integer resource); diff --git a/ycl-platform/src/main/java/com/ycl/mapper/dict/DataDictionaryMapper.java b/ycl-platform/src/main/java/com/ycl/mapper/dict/DataDictionaryMapper.java index 55b9609..8b166b0 100644 --- a/ycl-platform/src/main/java/com/ycl/mapper/dict/DataDictionaryMapper.java +++ b/ycl-platform/src/main/java/com/ycl/mapper/dict/DataDictionaryMapper.java @@ -4,6 +4,10 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ycl.entity.dict.DataDictionary; import com.ycl.vo.ViolationSettingVO; +import com.ycl.vo.dict.DataDictionaryVo; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * <p> @@ -18,4 +22,6 @@ Page<DataDictionary> listDataDictionaryPage(Page<DataDictionary> dataDictionaryPage, String keyWord); Page<ViolationSettingVO> listViolationPage(Page<ViolationSettingVO> dataDictionaryPage, String keyWord); + + List<DataDictionaryVo> queryTreeType(@Param("typeCode") String typeCode, @Param("level") Integer level); } diff --git a/ycl-platform/src/main/java/com/ycl/mapper/unlawful/UnlawfulMapper.java b/ycl-platform/src/main/java/com/ycl/mapper/unlawful/UnlawfulMapper.java index a59f123..f9182d9 100644 --- a/ycl-platform/src/main/java/com/ycl/mapper/unlawful/UnlawfulMapper.java +++ b/ycl-platform/src/main/java/com/ycl/mapper/unlawful/UnlawfulMapper.java @@ -1,8 +1,11 @@ package com.ycl.mapper.unlawful; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ycl.dto.statistics.CategoryDto; import com.ycl.dto.statistics.StatusDto; import com.ycl.dto.statistics.TimeDto; +import com.ycl.dto.statistics.UnlawfulDto; import java.util.List; @@ -10,44 +13,27 @@ /** * 鑾峰彇鎬昏繚瑙勬暟閲� */ - Integer getTotal(); + Integer getTotal(String startTime, String endTime, Boolean type, Boolean street, Boolean video); /** - * 鎸夌収杩濊绫诲瀷缁熻 + * 鎸夌収杩濊绫诲瀷缁熻 */ - List<CategoryDto> getDataByType(Integer currentPage, Integer pageSize, String startTime, String endTime); - StatusDto getStatusDataByType(String startTime, String endTime, Integer dictionaryId); - List<CategoryDto> getDataByTypeExp(); + IPage<UnlawfulDto> getDataByType(Page<UnlawfulDto> page, String startTime, String endTime); + /** - * 鎸夌収鍖哄煙缁熻 + * 鎸夌収鍖哄煙缁熻 */ - List<CategoryDto> getDataByStreet(Integer currentPage, Integer pageSize, String startTime, String endTime); - StatusDto getStatusDataByStreet(String startTime, String endTime, Integer streetId); - List<CategoryDto> getDataByStreetExp(); + IPage<UnlawfulDto> getDataByStreet(Page<UnlawfulDto> page, String startTime, String endTime); + /** * 鎸夌偣浣嶇粺璁� */ - List<String> getDataBySite(Integer currentPage, Integer pageSize, String startTime, String endTime); - StatusDto getStatusDataBySite(String startTime, String endTime, String site); - List<String> getDataBySiteExp(); + IPage<UnlawfulDto> getDataByPoint(Page<UnlawfulDto> page, String startTime, String endTime); /** * 鎸夋姤璀︽椂闂� */ - List<TimeDto> getDataByTime(Integer currentPage, Integer pageSize, String startTime, String endTime); - StatusDto getStatusDataByTime(String startTime, String endTime, Integer id); - List<TimeDto> getDataByTimeExp(); - - /** - * 鑾峰彇鍒嗛〉鎬绘暟 - */ - Integer getTotalByType(String startTime, String endTime); - Integer getTotalByStreet(String startTime, String endTime); - Integer getTotalBySite(String startTime, String endTime); - Integer getTotalByTime(String startTime, String endTime); - - - + IPage<UnlawfulDto> getDataByTime(Page<UnlawfulDto> page, String startTime, String endTime); } diff --git a/ycl-platform/src/main/java/com/ycl/service/caseHandler/IBaseCaseService.java b/ycl-platform/src/main/java/com/ycl/service/caseHandler/IBaseCaseService.java index e885dbf..c2fca5e 100644 --- a/ycl-platform/src/main/java/com/ycl/service/caseHandler/IBaseCaseService.java +++ b/ycl-platform/src/main/java/com/ycl/service/caseHandler/IBaseCaseService.java @@ -37,7 +37,7 @@ */ String uploadEvent(Long caseId); - Page listViolationsPage(Page page, Integer state, Integer resource, String code, String categoryBig, String categorySmall, Integer street, String site, String startTime, String endTime); + Page listViolationsPage(Page page, Integer state, Integer resource, String code, String categoryBig, String categorySmall, Integer street, String site, String startTime, String endTime,Integer violationsTypeId); Page listIllegalBuilding(Page page, Integer state, Integer resource); diff --git a/ycl-platform/src/main/java/com/ycl/service/caseHandler/impl/BaseCaseServiceImpl.java b/ycl-platform/src/main/java/com/ycl/service/caseHandler/impl/BaseCaseServiceImpl.java index d317117..7fcdf5c 100644 --- a/ycl-platform/src/main/java/com/ycl/service/caseHandler/impl/BaseCaseServiceImpl.java +++ b/ycl-platform/src/main/java/com/ycl/service/caseHandler/impl/BaseCaseServiceImpl.java @@ -170,11 +170,11 @@ } @Override - public Page listViolationsPage(Page page, Integer state, Integer resource, String code, String categoryBig, String categorySmall, Integer street, String site, String startTime, String endTime) { + public Page listViolationsPage(Page page, Integer state, Integer resource, String code, String categoryBig, String categorySmall, Integer street, String site, String startTime, String endTime,Integer violationsTypeId) { Integer type = 01; Integer hours = 60; Integer day = 24; - Page<CasePoolViolationVO> violationsPage = baseCaseMapper.listViolationsPage(page, state, type, resource, code, categoryBig, categorySmall, street, site, startTime, endTime); + Page<CasePoolViolationVO> violationsPage = baseCaseMapper.listViolationsPage(page, state, type, resource, code, categoryBig, categorySmall, street, site, startTime, endTime,violationsTypeId); violationsPage.getRecords().stream().forEach(item -> { if (item.getCloseTime() == null) { Duration duration = Duration.between(item.getAlarmTime(), LocalDateTime.now()); diff --git a/ycl-platform/src/main/java/com/ycl/service/caseHandler/impl/ViolationsServiceImpl.java b/ycl-platform/src/main/java/com/ycl/service/caseHandler/impl/ViolationsServiceImpl.java index 57ab292..d216aa5 100644 --- a/ycl-platform/src/main/java/com/ycl/service/caseHandler/impl/ViolationsServiceImpl.java +++ b/ycl-platform/src/main/java/com/ycl/service/caseHandler/impl/ViolationsServiceImpl.java @@ -6,12 +6,15 @@ import com.ycl.entity.caseHandler.EventSource; import com.ycl.entity.caseHandler.QuestionCategory; import com.ycl.entity.caseHandler.Violations; +import com.ycl.entity.dict.DataDictionary; import com.ycl.entity.video.VideoAlarmReport; import com.ycl.entity.video.VideoPoint; +import com.ycl.enums.common.DictTypeEnum; import com.ycl.mapper.caseHandler.BaseCaseMapper; import com.ycl.mapper.caseHandler.ViolationsMapper; import com.ycl.service.caseHandler.IBaseCaseService; import com.ycl.service.caseHandler.IViolationsService; +import com.ycl.service.dict.IDataDictionaryService; import com.ycl.service.video.impl.IVideoPointService; import com.ycl.vo.cockpit.enforcementEvents.VideoAndAreaVO; import org.springframework.beans.factory.annotation.Autowired; @@ -34,6 +37,7 @@ private IVideoPointService videoPointService; private IBaseCaseService baseCaseService; + private IDataDictionaryService dataDictionaryService; @Resource BaseCaseMapper baseCaseMapper; @@ -46,6 +50,11 @@ @Autowired public void setBaseCaseService(IBaseCaseService baseCaseService) { this.baseCaseService = baseCaseService; + } + + @Autowired + public void setDataDictionaryService(IDataDictionaryService dataDictionaryService) { + this.dataDictionaryService = dataDictionaryService; } @Override @@ -73,6 +82,12 @@ violations.setVideoAlarmReportId(videoAlarmReport.getId()); violations.setVideoPointId(videoPoint.getId()); violations.setDescription(videoAlarmReport.getAlgoName()); + + List<DataDictionary> list = dataDictionaryService.queryByCode(DictTypeEnum.EVENT_GRADE_TYPE.getCode(), videoAlarmReport.getAlarmName().trim()); + if (list.size() > 0) { + violations.setGradeId(list.get(0).getId()); + } + baseMapper.insert(violations); } } diff --git a/ycl-platform/src/main/java/com/ycl/service/dict/IDataDictionaryService.java b/ycl-platform/src/main/java/com/ycl/service/dict/IDataDictionaryService.java index 2eac3e0..4108f01 100644 --- a/ycl-platform/src/main/java/com/ycl/service/dict/IDataDictionaryService.java +++ b/ycl-platform/src/main/java/com/ycl/service/dict/IDataDictionaryService.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService; import com.ycl.entity.dict.DataDictionary; import com.ycl.vo.ViolationSettingVO; +import com.ycl.vo.dict.DataDictionaryVo; import java.util.List; @@ -27,9 +28,11 @@ * @param code * @return */ - List<DataDictionary> queryByCode(String code); + List<DataDictionary> queryByCode(String code,String keyword); Page listIllegalBuildingSettings(Page<DataDictionary> dataDictionaryPage, String keyWork); Page listViolations(Page<ViolationSettingVO> dataDictionaryPage, String keyWord); + + List<DataDictionaryVo> queryTreeType(String typeCode, Integer level); } diff --git a/ycl-platform/src/main/java/com/ycl/service/dict/impl/DataDictionaryServiceImpl.java b/ycl-platform/src/main/java/com/ycl/service/dict/impl/DataDictionaryServiceImpl.java index 7672d25..67ca01b 100644 --- a/ycl-platform/src/main/java/com/ycl/service/dict/impl/DataDictionaryServiceImpl.java +++ b/ycl-platform/src/main/java/com/ycl/service/dict/impl/DataDictionaryServiceImpl.java @@ -12,6 +12,7 @@ import com.ycl.utils.common.LiveTimeMillisecond; import com.ycl.utils.redis.RedisKey; import com.ycl.vo.ViolationSettingVO; +import com.ycl.vo.dict.DataDictionaryVo; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; @@ -49,8 +50,11 @@ } @Override - public List<DataDictionary> queryByCode(String code) { + public List<DataDictionary> queryByCode(String code, String keyword) { LambdaQueryWrapper<DataDictionary> queryWrapper = new LambdaQueryWrapper<DataDictionary>().eq(DataDictionary::getTypeCode, code); + if (!com.aliyuncs.utils.StringUtils.isEmpty(keyword)) { + queryWrapper.eq(DataDictionary::getName, keyword); + } List<DataDictionary> dataDictionary = dataDictionaryMapper.selectList(queryWrapper); return dataDictionary; } @@ -67,4 +71,9 @@ Page<ViolationSettingVO> dataDictionaryPageList = dataDictionaryMapper.listViolationPage(dataDictionaryPage, keyWord); return dataDictionaryPageList; } + + @Override + public List<DataDictionaryVo> queryTreeType(String typeCode, Integer level) { + return baseMapper.queryTreeType(typeCode, level); + } } diff --git a/ycl-platform/src/main/java/com/ycl/service/unlawful/UnlawfulService.java b/ycl-platform/src/main/java/com/ycl/service/unlawful/UnlawfulService.java index dc91c3e..e1d902c 100644 --- a/ycl-platform/src/main/java/com/ycl/service/unlawful/UnlawfulService.java +++ b/ycl-platform/src/main/java/com/ycl/service/unlawful/UnlawfulService.java @@ -1,5 +1,6 @@ package com.ycl.service.unlawful; +import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ycl.dto.statistics.UnlawfulDto; @@ -8,32 +9,19 @@ public interface UnlawfulService { /** - * 鎸夌被鍨� + * 鎸夌被鍨� */ - public List<UnlawfulDto> getUnlawfulByType(Integer currentPage, Integer pageSize, String startTime, String endTime); - public List<UnlawfulDto> getUnlawfulByTypeExport(); - public Integer getTotalByType(String startTime, String endTime); + IPage<UnlawfulDto> getUnlawfulByType(Integer currentPage, Integer pageSize, String startTime, String endTime); /** * 鎸夊尯鍩� */ - public List<UnlawfulDto> getUnlawfulByStreet(Integer currentPage, Integer pageSize, String startTime, String endTime); - public List<UnlawfulDto> getUnlawfulByStreetExport(); - public Integer getTotalByStreet(String startTime, String endTime); - - /** - * 鎸夋姤璀︾偣浣� - */ - public List<UnlawfulDto> getUnlawfulBySite(Integer currentPage, Integer pageSize, String startTime, String endTime); - - public List<UnlawfulDto> getUnlawfulBySiteExport(); - public Integer getTotalBySite(String startTime, String endTime); + IPage<UnlawfulDto> getUnlawfulByStreet(Integer currentPage, Integer pageSize, String startTime, String endTime); /** * 鎸夋姤璀︽椂闂� */ - public List<UnlawfulDto> getUnlawfulByTime(Integer currentPage, Integer pageSize, String startTime, String endTime); + IPage<UnlawfulDto> getUnlawfulByTime(Integer currentPage, Integer pageSize, String startTime, String endTime); - public List<UnlawfulDto> getUnlawfulByTimeExport(); - public Integer getTotalByTime(String startTime, String endTime); + IPage<UnlawfulDto> getUnlawfulByPoint(Integer currentPage, Integer pageSize, String startTime, String endTime); } diff --git a/ycl-platform/src/main/java/com/ycl/service/unlawful/impl/UnlawfulServiceImpl.java b/ycl-platform/src/main/java/com/ycl/service/unlawful/impl/UnlawfulServiceImpl.java index 43af345..fa20858 100644 --- a/ycl-platform/src/main/java/com/ycl/service/unlawful/impl/UnlawfulServiceImpl.java +++ b/ycl-platform/src/main/java/com/ycl/service/unlawful/impl/UnlawfulServiceImpl.java @@ -1,11 +1,14 @@ package com.ycl.service.unlawful.impl; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ycl.dto.statistics.CategoryDto; import com.ycl.dto.statistics.StatusDto; import com.ycl.dto.statistics.TimeDto; import com.ycl.dto.statistics.UnlawfulDto; import com.ycl.mapper.unlawful.UnlawfulMapper; import com.ycl.service.unlawful.UnlawfulService; +import com.ycl.utils.StringUtils; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -26,177 +29,57 @@ * 鎸夌被鍨� */ @Override - public List<UnlawfulDto> getUnlawfulByType(Integer currentPage, Integer pageSize, String startTime, String endTime) { - List<UnlawfulDto> res = new ArrayList<>(); - Double total = unlawfuldao.getTotal().doubleValue(); - List<CategoryDto> data = unlawfuldao.getDataByType(currentPage, pageSize, startTime, endTime); - data.forEach(categoryDto -> { - StatusDto statusData = unlawfuldao.getStatusDataByType(startTime, endTime, categoryDto.getId()); - format(res, total, categoryDto, statusData); - }); - return res; - } - @Override - public List<UnlawfulDto> getUnlawfulByTypeExport() { - List<UnlawfulDto> res = new ArrayList<>(); - Double total = unlawfuldao.getTotal().doubleValue(); - List<CategoryDto> data = unlawfuldao.getDataByTypeExp(); - data.forEach(categoryDto -> { - StatusDto statusData = unlawfuldao.getStatusDataByType(null, null, categoryDto.getId()); - format(res, total, categoryDto, statusData); - }); - return res; + public IPage<UnlawfulDto> getUnlawfulByType(Integer currentPage, Integer pageSize, String startTime, String endTime) { + Page<UnlawfulDto> page = new Page<>(currentPage, pageSize); + + Double total = unlawfuldao.getTotal(startTime, endTime, true, false, false).doubleValue(); + IPage<UnlawfulDto> page1 = unlawfuldao.getDataByType(page, startTime, endTime); + return getUnlawfulDtoIPage(total, page1); } - @Override - public Integer getTotalByType(String startTime, String endTime) { - return unlawfuldao.getTotalByType(startTime, endTime); + private IPage<UnlawfulDto> getUnlawfulDtoIPage(Double total, IPage<UnlawfulDto> page1) { + page1.getRecords().forEach(dto -> { + dto.setRatio(StringUtils.doubleTwo((double) dto.getCount() / total)); + dto.setRegisterRatio(StringUtils.doubleTwo((double) dto.getRegister() / (double) dto.getCount())); + dto.setCheckedRatio(StringUtils.doubleTwo((double) dto.getChecked() / (double) dto.getCount())); + dto.setAccuracyRatio(StringUtils.doubleTwo(1.0 - (double) dto.getRelearn() / (double) dto.getCount())); + + }); + return page1; } /** * 鎸夊尯鍩� */ @Override - public List<UnlawfulDto> getUnlawfulByStreet(Integer currentPage, Integer pageSize, String startTime, String endTime) { - List<UnlawfulDto> res = new ArrayList<>(); - Double total = unlawfuldao.getTotal().doubleValue(); - List<CategoryDto> data = unlawfuldao.getDataByStreet(currentPage, pageSize, startTime, endTime); - data.forEach(categoryDto -> { - StatusDto statusData = unlawfuldao.getStatusDataByStreet(startTime, endTime, categoryDto.getId()); - format(res, total, categoryDto, statusData); - }); - return res; - } - @Override - public List<UnlawfulDto> getUnlawfulByStreetExport() { - List<UnlawfulDto> res = new ArrayList<>(); - Double total = unlawfuldao.getTotal().doubleValue(); - List<CategoryDto> data = unlawfuldao.getDataByStreetExp(); - data.forEach(categoryDto -> { - StatusDto statusData = unlawfuldao.getStatusDataByStreet(null, null, categoryDto.getId()); - format(res, total, categoryDto, statusData); - }); - return res; - } + public IPage<UnlawfulDto> getUnlawfulByStreet(Integer currentPage, Integer pageSize, String startTime, String endTime) { + Page<UnlawfulDto> page = new Page<>(currentPage, pageSize); - @Override - public Integer getTotalByStreet(String startTime, String endTime) { - return unlawfuldao.getTotalByStreet(startTime, endTime); + Double total = unlawfuldao.getTotal(startTime, endTime, false, true, false).doubleValue(); + IPage<UnlawfulDto> page1 = unlawfuldao.getDataByStreet(page, startTime, endTime); + return getUnlawfulDtoIPage(total, page1); } - - /** - * 鎸夋姤璀︾偣浣� - */ - @Override - public List<UnlawfulDto> getUnlawfulBySite(Integer currentPage, Integer pageSize, String startTime, String endTime) { - List<UnlawfulDto> res = new ArrayList<>(); - Double total = unlawfuldao.getTotal().doubleValue(); - List<String> data = unlawfuldao.getDataBySite(currentPage, pageSize, startTime, endTime); - data.forEach(site -> { - StatusDto statusData = unlawfuldao.getStatusDataBySite(startTime, endTime, site); - format1(res, total, site, statusData); - }); - return res; - } - @Override - public List<UnlawfulDto> getUnlawfulBySiteExport() { - List<UnlawfulDto> res = new ArrayList<>(); - Double total = unlawfuldao.getTotal().doubleValue(); - List<String> data = unlawfuldao.getDataBySiteExp(); - data.forEach(site -> { - StatusDto statusData = unlawfuldao.getStatusDataBySite(null, null, site); - format1(res, total, site, statusData); - }); - return res; - } - - @Override - public Integer getTotalBySite(String startTime, String endTime) { - return unlawfuldao.getTotalBySite(startTime, endTime); - } - - @Override - public List<UnlawfulDto> getUnlawfulByTime(Integer currentPage, Integer pageSize, String startTime, String endTime) { - List<UnlawfulDto> res = new ArrayList<>(); - Double total = unlawfuldao.getTotal().doubleValue(); - List<TimeDto> data = unlawfuldao.getDataByTime(currentPage, pageSize, startTime, endTime); - data.forEach(timeDto -> { - StatusDto statusData = unlawfuldao.getStatusDataByTime(startTime, endTime, timeDto.getId()); - format2(res, total, timeDto, statusData); - }); - return res; - } - @Override - public List<UnlawfulDto> getUnlawfulByTimeExport() { - List<UnlawfulDto> res = new ArrayList<>(); - Double total = unlawfuldao.getTotal().doubleValue(); - List<TimeDto> data = unlawfuldao.getDataByTimeExp(); - data.forEach(timeDto -> { - StatusDto statusData = unlawfuldao.getStatusDataByTime(null, null, timeDto.getId()); - format2(res, total, timeDto, statusData); - }); - return res; + public IPage<UnlawfulDto> getUnlawfulByTime(Integer currentPage, Integer pageSize, String startTime, String endTime) { + Page<UnlawfulDto> page = new Page<>(currentPage, pageSize); + + Double total = unlawfuldao.getTotal(startTime, endTime, false, false, false).doubleValue(); + IPage<UnlawfulDto> page1 = unlawfuldao.getDataByTime(page, startTime, endTime); + return getUnlawfulDtoIPage(total, page1); } + @Override - public Integer getTotalByTime(String startTime, String endTime) { - return unlawfuldao.getTotalBySite(startTime, endTime); + public IPage<UnlawfulDto> getUnlawfulByPoint(Integer currentPage, Integer pageSize, String startTime, String endTime) { + + Page<UnlawfulDto> page = new Page<>(currentPage, pageSize); + + Double total = unlawfuldao.getTotal(startTime, endTime, false, false, true).doubleValue(); + IPage<UnlawfulDto> page1 = unlawfuldao.getDataByPoint(page, startTime, endTime); + return getUnlawfulDtoIPage(total, page1); + } - private Double changeFormat(Double previous){ - NumberFormat numberInstance = NumberFormat.getNumberInstance(); - numberInstance.setMaximumFractionDigits(3); - numberInstance.setRoundingMode(RoundingMode.HALF_UP); - String format = numberInstance.format(previous); - return Double.parseDouble(format); - } - - private void format(List<UnlawfulDto> res, Double total, CategoryDto categoryDto, StatusDto statusData) { - UnlawfulDto build = UnlawfulDto.builder().name(categoryDto.getName()) //绫诲瀷鍚嶇О - .count(statusData.getTotal()) //浜嬩欢鎬绘暟 - .ratio(changeFormat(statusData.getTotal().doubleValue() / total)) //鍗犳瘮 - .register(statusData.getRegister()) //绔嬫 - .notRegister(statusData.getNotRegister()) //鏆備笉绔嬫 - .closing(statusData.getClosing()) //缁撴 - .relearn(statusData.getRelearn()) //鍦ㄥ涔� - .checked(statusData.getChecked()) //宸插鏍� - .checkedRatio(changeFormat(statusData.getChecked().doubleValue() / statusData.getTotal().doubleValue())) //瀹℃牳鐜� - .registerRatio(changeFormat(statusData.getRegister().doubleValue() / statusData.getTotal().doubleValue())) //绔嬫鐜� - .build(); - res.add(build); - } - - private void format2(List<UnlawfulDto> res, Double total, TimeDto timeDto, StatusDto statusData) { - DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); - UnlawfulDto build = UnlawfulDto.builder().name(timeDto.getTime().format(fmt)) //绫诲瀷鍚嶇О - .count(statusData.getTotal()) //浜嬩欢鎬绘暟 - .ratio(changeFormat(statusData.getTotal().doubleValue() / total)) //鍗犳瘮 - .register(statusData.getRegister()) //绔嬫 - .notRegister(statusData.getNotRegister()) //鏆備笉绔嬫 - .closing(statusData.getClosing()) //缁撴 - .relearn(statusData.getRelearn()) //鍦ㄥ涔� - .checked(statusData.getChecked()) //宸插鏍� - .checkedRatio(changeFormat(statusData.getChecked().doubleValue() / statusData.getTotal().doubleValue())) //瀹℃牳鐜� - .registerRatio(changeFormat(statusData.getRegister().doubleValue() / statusData.getTotal().doubleValue())) //绔嬫鐜� - .build(); - res.add(build); - } - - private void format1(List<UnlawfulDto> res, Double total, String site, StatusDto statusData) { - UnlawfulDto build = UnlawfulDto.builder().name(site) //绫诲瀷鍚嶇О - .count(statusData.getTotal()) //浜嬩欢鎬绘暟 - .ratio(changeFormat(statusData.getTotal().doubleValue() / total)) //鍗犳瘮 - .register(statusData.getRegister()) //绔嬫 - .notRegister(statusData.getNotRegister()) //鏆備笉绔嬫 - .closing(statusData.getClosing()) //缁撴 - .relearn(statusData.getRelearn()) //鍦ㄥ涔� - .checked(statusData.getChecked()) //宸插鏍� - .checkedRatio(changeFormat(statusData.getChecked().doubleValue() / statusData.getTotal().doubleValue())) //瀹℃牳鐜� - .registerRatio(changeFormat(statusData.getRegister().doubleValue() / statusData.getTotal().doubleValue())) //绔嬫鐜� - .build(); - res.add(build); - } } diff --git a/ycl-platform/src/main/java/com/ycl/vo/dict/DataDictionaryVo.java b/ycl-platform/src/main/java/com/ycl/vo/dict/DataDictionaryVo.java new file mode 100644 index 0000000..5e341f5 --- /dev/null +++ b/ycl-platform/src/main/java/com/ycl/vo/dict/DataDictionaryVo.java @@ -0,0 +1,16 @@ +package com.ycl.vo.dict; + +import com.ycl.entity.dict.DataDictionary; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +@Data +@ApiModel(value = "瀛楀吀VO") +public class DataDictionaryVo extends DataDictionary { + + @ApiModelProperty(value = "瀛愰泦鍚�") + private List<DataDictionary> children; +} diff --git a/ycl-platform/src/main/resources/application-dev.yml b/ycl-platform/src/main/resources/application-dev.yml index 5b41647..f1691ac 100644 --- a/ycl-platform/src/main/resources/application-dev.yml +++ b/ycl-platform/src/main/resources/application-dev.yml @@ -35,7 +35,7 @@ timeout: 0 datasource: - url: jdbc:mysql://42.193.1.25:3306/sccg?useUnicode=true&characterEncoding=utf8&autoReconnect=true&useSSL=false + url: jdbc:mysql://42.193.1.25:3306/sccg0318?useUnicode=true&characterEncoding=utf8&autoReconnect=true&useSSL=false username: root password: 321$YcYl@1970! type: com.alibaba.druid.pool.DruidDataSource diff --git a/ycl-platform/src/main/resources/mapper/caseHandler/BaseCaseMapper.xml b/ycl-platform/src/main/resources/mapper/caseHandler/BaseCaseMapper.xml index a259595..fc399d2 100644 --- a/ycl-platform/src/main/resources/mapper/caseHandler/BaseCaseMapper.xml +++ b/ycl-platform/src/main/resources/mapper/caseHandler/BaseCaseMapper.xml @@ -85,13 +85,16 @@ and t4.name like concat('%', #{categorySmall},'%') </if> <if test="street != null"> - and ubc.community_id = #{street} + and ubc.street_id = #{street} </if> <if test="site"> and ubc.site like concat('%', #{site},'%') </if> <if test="startTime !='' and endTime !='' and startTime!=null and endTime !=null"> and ubc.create_time between #{startTime} and #{endTime} + </if> + <if test="violationsTypeId !=null"> + and uv.grade_id = #{violationsTypeId} </if> </where> @@ -279,7 +282,7 @@ <select id="selectRegisterCount" resultType="java.lang.Long"> select count(1) from ums_base_case - where state in (2, 6,7,8,9) + where state in (2, 6, 7, 8, 9) and to_days(create_time) = TO_DAYS(now()); </select> @@ -334,7 +337,7 @@ WHEN t1.state = 7 THEN '澶勭疆' WHEN t1.state = 8 THEN '鏍告煡' WHEN t1.state = 9 THEN '缁撴' - END) `status` , + END) `status` , dd.`name` as grade FROM ums_base_case t1 @@ -413,14 +416,22 @@ </select> <select id="selectOnTimeCaseCount" resultType="java.lang.Long"> - SELECT COUNT(1) FROM ums_dispose_record WHERE end_time < limit_time + SELECT COUNT(1) + FROM ums_dispose_record + WHERE end_time < limit_time </select> <select id="selectOnTimeCaseLastMonthCount" resultType="java.lang.Long"> - SELECT COUNT(1) FROM ums_dispose_record WHERE end_time < limit_time AND PERIOD_DIFF( date_format( now( ), '%Y%m' ), date_format( create_time, '%Y%m' ) ) =1 + SELECT COUNT(1) + FROM ums_dispose_record + WHERE end_time < limit_time + AND PERIOD_DIFF(date_format(now(), '%Y%m'), date_format(create_time, '%Y%m')) = 1 </select> <select id="selectOnTimeCaseRecentlyMonthCount" resultType="java.lang.Long"> - SELECT COUNT(1) FROM ums_dispose_record WHERE end_time < limit_time AND PERIOD_DIFF( date_format( now( ), '%Y%m' ), date_format( create_time, '%Y%m' ) ) =0 + SELECT COUNT(1) + FROM ums_dispose_record + WHERE end_time < limit_time + AND PERIOD_DIFF(date_format(now(), '%Y%m'), date_format(create_time, '%Y%m')) = 0 </select> </mapper> \ No newline at end of file diff --git a/ycl-platform/src/main/resources/mapper/dict/DataDictionaryMapper.xml b/ycl-platform/src/main/resources/mapper/dict/DataDictionaryMapper.xml index 7ff04d6..f288084 100644 --- a/ycl-platform/src/main/resources/mapper/dict/DataDictionaryMapper.xml +++ b/ycl-platform/src/main/resources/mapper/dict/DataDictionaryMapper.xml @@ -4,29 +4,39 @@ <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 --> <resultMap id="BaseResultMap" type="com.ycl.entity.dict.DataDictionary"> - <id column="id" property="id" /> - <result column="name" property="name" /> - <result column="code" property="code" /> - <result column="type_name" property="typeName" /> - <result column="type_code" property="typeCode" /> - <result column="parent_id" property="parentId" /> - <result column="level" property="level" /> - <result column="remark" property="remark" /> + <id column="id" property="id"/> + <result column="name" property="name"/> + <result column="code" property="code"/> + <result column="type_name" property="typeName"/> + <result column="type_code" property="typeCode"/> + <result column="parent_id" property="parentId"/> + <result column="level" property="level"/> + <result column="remark" property="remark"/> </resultMap> <!-- 閫氱敤鏌ヨ缁撴灉鍒� --> <sql id="Base_Column_List"> - id, name, code, type_name,type_code,parent_id,level,remark + id + , name, code, type_name,type_code,parent_id,level,remark </sql> <resultMap id="settingsResultMap" type="com.ycl.vo.IllegalBuildingSettingVO"> - <id column="number" property="number" /> - <result column="type" property="type" /> - <result column="typeFirst" property="typeFirst" /> - <result column="typeSecond" property="typeSecond" /> - <result column="typeThird" property="typeThird" /> + <id column="number" property="number"/> + <result column="type" property="type"/> + <result column="typeFirst" property="typeFirst"/> + <result column="typeSecond" property="typeSecond"/> + <result column="typeThird" property="typeThird"/> </resultMap> + <resultMap id="VoMap" type="com.ycl.vo.dict.DataDictionaryVo" extends="BaseResultMap"> + <collection property="children" javaType="ArrayList" ofType="com.ycl.entity.dict.DataDictionary"> + <result column="c_id" property="id"/> + <result column="c_name" property="name"/> + <result column="c_code" property="code"/> + <result column="c_level" property="level"/> + <result column="c_remark" property="remark"/> + </collection> + </resultMap> <select id="listDataDictionaryPage" resultType="com.ycl.vo.IllegalBuildingSettingVO"> SELECT @@ -40,8 +50,9 @@ d1.`level` = '2' AND d1.type_code = '06' <if test="keyWord !=null and keyWord !=''"> - AND (d1.`name` LIKE '%${keyWord}%' - or d2.`name` LIKE '%${keyWord}%') + AND (d1.`name` LIKE '%${keyWord}%' + or d2.`name` LIKE '%${keyWord}%') + or d2.`name` LIKE '%${keyWord}%') </if> </where> @@ -56,16 +67,16 @@ d4.`name` AS typeThird FROM `ums_data_dictionary` AS d1 LEFT JOIN ums_data_dictionary AS d2 ON d1.parent_id = d2.id - LEFT JOIN ums_data_dictionary AS d3 ON d2.parent_id = d3.id - LEFT JOIN ums_data_dictionary AS d4 ON d3.parent_id = d4.id + LEFT JOIN ums_data_dictionary AS d3 ON d2.parent_id = d3.id + LEFT JOIN ums_data_dictionary AS d4 ON d3.parent_id = d4.id <where> d1.`level` = '4' AND d1.type_code = '01' <if test="keyWord !=null and keyWord !=''"> - AND (d1.`name` LIKE '%${keyWord}%' - or d2.`name` LIKE '%${keyWord}%' - or d3.`name` LIKE '%${keyWord}%' - or d4.`name` LIKE '%${keyWord}%' + AND (d1.`name` LIKE '%${keyWord}%' + or d2.`name` LIKE '%${keyWord}%' + or d3.`name` LIKE '%${keyWord}%' + or d4.`name` LIKE '%${keyWord}%' ) </if> @@ -74,4 +85,13 @@ ORDER BY d1.parent_id,d2.parent_id,d3.parent_id,d4.parent_id </select> + <select id="queryTreeType" resultMap="VoMap"> + SELECT p.*, c.id c_id, c.`name` c_name, c.`code` c_code, c.`level` c_level, c.remark c_remark + FROM ums_data_dictionary p + LEFT JOIN ums_data_dictionary c on p.id = c.parent_id + WHERE p.`type_code` = #{typeCode} + and p.`level` = #{level} + ORDER BY p.id, c.id + </select> + </mapper> diff --git a/ycl-platform/src/main/resources/mapper/unlawful/UnlawfulMapper.xml b/ycl-platform/src/main/resources/mapper/unlawful/UnlawfulMapper.xml index a5e5ea6..c7a5b02 100644 --- a/ycl-platform/src/main/resources/mapper/unlawful/UnlawfulMapper.xml +++ b/ycl-platform/src/main/resources/mapper/unlawful/UnlawfulMapper.xml @@ -1,275 +1,42 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.ycl.mapper.unlawful.UnlawfulMapper"> -<!-- 鑾峰彇鎬绘暟--> + <!-- 鑾峰彇鎬绘暟--> <select id="getTotal" resultType="java.lang.Integer"> - SELECT - count(*) - FROM - `ums_base_case` AS ubc - JOIN ums_violations AS uv ON ubc.id = uv.id - LEFT JOIN ums_data_dictionary AS t3 ON uv.category_id = t3.id - LEFT JOIN ums_data_dictionary AS t4 ON uv.type_id = t4.id - LEFT JOIN ums_sccg_region t5 ON ubc.street_id = t5.id - WHERE - ubc.category = 1 - AND t4.`name` IS NOT NULL - </select> + SELECT count(*) + FROM `ums_base_case` AS ubc + JOIN ums_violations AS uv ON ubc.id = uv.id + <if test="type==true"> + INNER JOIN ums_data_dictionary AS t4 ON uv.grade_id = t4.id + </if> + <if test="street==true"> + INNER JOIN ums_sccg_region r on ubc.street_id = r.id + </if> + <if test="video==true"> + INNER JOIN ums_video_point v on uv.video_point_id = v.id + </if> + WHERE ubc.category = 1 -<!-- 鎸夌収杩濊绫诲瀷缁熻--> - <select id="getDataByType" resultType="com.ycl.dto.statistics.CategoryDto"> - SELECT - t4.id id, - t4.NAME name - FROM - `ums_base_case` AS ubc - JOIN ums_violations AS uv ON ubc.id = uv.id - LEFT JOIN ums_data_dictionary AS t3 ON uv.category_id = t3.id - LEFT JOIN ums_data_dictionary AS t4 ON uv.type_id = t4.id - LEFT JOIN ums_sccg_region t5 ON ubc.street_id = t5.id - WHERE - ubc.category =1 - and t4.`name` is NOT NULL - <if test="startTime !='' and endTime !='' and startTime!=null and endTime !=null"> - and ubc.create_time between #{startTime} and #{endTime} - </if> - group by - t4.id - limit #{currentPage}, #{pageSize} - </select> - <select id="getStatusDataByType" resultType="com.ycl.dto.statistics.StatusDto"> - SELECT - count(1) total, - sum(case when ubc.state=5 then 1 else 0 end) register, - sum(case when ubc.state=4 then 1 else 0 end ) notRegister, - sum(case when ubc.state=9 then 1 else 0 end ) closing, - sum(case when ubc.state=3 then 1 else 0 end ) relearn, - sum(case when ubc.state=8 then 1 else 0 end ) checked - FROM - `ums_base_case` AS ubc - JOIN ums_violations AS uv ON ubc.id = uv.id - LEFT JOIN ums_data_dictionary AS t3 ON uv.category_id = t3.id - LEFT JOIN ums_data_dictionary AS t4 ON uv.type_id = t4.id - LEFT JOIN ums_sccg_region t5 ON ubc.street_id = t5.id - WHERE - ubc.category =1 - and t4.`id` = #{dictionaryId} - and t4.`name` IS NOT NULL <if test="startTime !='' and endTime !='' and startTime!=null and endTime !=null"> and ubc.create_time between #{startTime} and #{endTime} </if> </select> - <select id="getDataByTypeExp" resultType="com.ycl.dto.statistics.CategoryDto"> + <!-- 鎸夌収杩濊绫诲瀷缁熻--> + <select id="getDataByType" resultType="com.ycl.dto.statistics.UnlawfulDto"> SELECT - t4.id id, - t4.NAME name - FROM - `ums_base_case` AS ubc - JOIN ums_violations AS uv ON ubc.id = uv.id - LEFT JOIN ums_data_dictionary AS t3 ON uv.category_id = t3.id - LEFT JOIN ums_data_dictionary AS t4 ON uv.type_id = t4.id - LEFT JOIN ums_sccg_region t5 ON ubc.street_id = t5.id - WHERE - ubc.category =1 - and t4.`name` is NOT NULL - group by - t4.id - </select> - - - - -<!-- 鎸夌収鍖哄煙缁熻--> - <select id="getDataByStreet" resultType="com.ycl.dto.statistics.CategoryDto"> - SELECT - ubc.community_id id, - t5.region_name name - FROM - `ums_base_case` AS ubc - JOIN ums_violations AS uv ON ubc.id = uv.id - LEFT JOIN ums_data_dictionary AS t3 ON uv.category_id = t3.id - LEFT JOIN ums_data_dictionary AS t4 ON uv.type_id = t4.id - LEFT JOIN ums_sccg_region t5 ON ubc.street_id = t5.id - WHERE - ubc.category = 1 - AND t4.`name` IS NOT NULL - <if test="startTime !='' and endTime !='' and startTime!=null and endTime !=null"> - and ubc.create_time between #{startTime} and #{endTime} - </if> - GROUP BY - ubc.community_id - limit #{currentPage}, #{pageSize} - </select> - <select id="getStatusDataByStreet" resultType="com.ycl.dto.statistics.StatusDto"> - SELECT - count( 1 ) total, - sum( CASE WHEN ubc.state = 5 THEN 1 ELSE 0 END ) register, - sum( CASE WHEN ubc.state = 4 THEN 1 ELSE 0 END ) notRegister, - sum( CASE WHEN ubc.state = 9 THEN 1 ELSE 0 END ) closing, - sum( CASE WHEN ubc.state = 3 THEN 1 ELSE 0 END ) relearn, - sum( CASE WHEN ubc.state = 8 THEN 1 ELSE 0 END ) checked - FROM - `ums_base_case` AS ubc - JOIN ums_violations AS uv ON ubc.id = uv.id - LEFT JOIN ums_data_dictionary AS t3 ON uv.category_id = t3.id - LEFT JOIN ums_data_dictionary AS t4 ON uv.type_id = t4.id - LEFT JOIN ums_sccg_region t5 ON ubc.street_id = t5.id - WHERE - ubc.category = 1 - AND ubc.`community_id` = #{streetId} - AND t4.`name` IS NOT NULL - <if test="startTime !='' and endTime !='' and startTime!=null and endTime !=null"> - and ubc.create_time between #{startTime} and #{endTime} - </if> - </select> - <select id="getDataByStreetExp" resultType="com.ycl.dto.statistics.CategoryDto"> - SELECT - ubc.community_id id, - t5.region_name NAME - FROM - `ums_base_case` AS ubc - JOIN ums_violations AS uv ON ubc.id = uv.id - LEFT JOIN ums_data_dictionary AS t3 ON uv.category_id = t3.id - LEFT JOIN ums_data_dictionary AS t4 ON uv.type_id = t4.id - LEFT JOIN ums_sccg_region t5 ON ubc.street_id = t5.id - WHERE - ubc.category =1 - and t4.`name` is NOT NULL - group by - ubc.community_id - </select> - - - - -<!-- 鎸夌偣浣嶇粺璁�--> - <select id="getDataBySite" resultType="java.lang.String"> - SELECT - ubc.site - FROM - `ums_base_case` AS ubc - JOIN ums_violations AS uv ON ubc.id = uv.id - LEFT JOIN ums_data_dictionary AS t3 ON uv.category_id = t3.id - LEFT JOIN ums_data_dictionary AS t4 ON uv.type_id = t4.id - LEFT JOIN ums_sccg_region t5 ON ubc.street_id = t5.id - WHERE - ubc.category = 1 - AND t4.`name` IS NOT NULL - <if test="startTime !='' and endTime !='' and startTime!=null and endTime !=null"> - and ubc.create_time between #{startTime} and #{endTime} - </if> - GROUP BY - ubc.site - limit #{currentPage}, #{pageSize} - </select> - <select id="getStatusDataBySite" resultType="com.ycl.dto.statistics.StatusDto"> - SELECT - count( 1 ) total, - sum( CASE WHEN ubc.state = 5 THEN 1 ELSE 0 END ) register, - sum( CASE WHEN ubc.state = 4 THEN 1 ELSE 0 END ) notRegister, - sum( CASE WHEN ubc.state = 9 THEN 1 ELSE 0 END ) closing, - sum( CASE WHEN ubc.state = 3 THEN 1 ELSE 0 END ) relearn, - sum( CASE WHEN ubc.state = 8 THEN 1 ELSE 0 END ) checked - FROM - `ums_base_case` AS ubc - JOIN ums_violations AS uv ON ubc.id = uv.id - LEFT JOIN ums_data_dictionary AS t3 ON uv.category_id = t3.id - LEFT JOIN ums_data_dictionary AS t4 ON uv.type_id = t4.id - LEFT JOIN ums_sccg_region t5 ON ubc.street_id = t5.id - WHERE - ubc.category = 1 - AND t4.`name` IS NOT NULL - AND ubc.site = #{site} - </select> - <select id="getDataBySiteExp" resultType="java.lang.String"> - SELECT - ubc.site - FROM - `ums_base_case` AS ubc - JOIN ums_violations AS uv ON ubc.id = uv.id - LEFT JOIN ums_data_dictionary AS t3 ON uv.category_id = t3.id - LEFT JOIN ums_data_dictionary AS t4 ON uv.type_id = t4.id - LEFT JOIN ums_sccg_region t5 ON ubc.street_id = t5.id - WHERE - ubc.category = 1 - AND t4.`name` IS NOT NULL - GROUP BY - ubc.site - </select> - - - - -<!-- 鎸夌収鎶ヨ鏃堕棿--> - <select id="getDataByTime" resultType="com.ycl.dto.statistics.TimeDto"> - SELECT - ubc.id id, - ubc.alarm_time time - FROM - `ums_base_case` AS ubc - JOIN ums_violations AS uv ON ubc.id = uv.id - LEFT JOIN ums_data_dictionary AS t3 ON uv.category_id = t3.id - LEFT JOIN ums_data_dictionary AS t4 ON uv.type_id = t4.id - LEFT JOIN ums_sccg_region t5 ON ubc.street_id = t5.id - WHERE - ubc.category = 1 - AND t4.`name` IS NOT NULL - <if test="startTime !='' and endTime !='' and startTime!=null and endTime !=null"> - and ubc.alarm_time between #{startTime} and #{endTime} - </if> - GROUP BY - ubc.alarm_time - limit #{currentPage}, #{pageSize} - </select> - <select id="getStatusDataByTime" resultType="com.ycl.dto.statistics.StatusDto"> - SELECT - count( 1 ) total, - sum( CASE WHEN ubc.state = 5 THEN 1 ELSE 0 END ) register, - sum( CASE WHEN ubc.state = 4 THEN 1 ELSE 0 END ) notRegister, - sum( CASE WHEN ubc.state = 9 THEN 1 ELSE 0 END ) closing, - sum( CASE WHEN ubc.state = 3 THEN 1 ELSE 0 END ) relearn, - sum( CASE WHEN ubc.state = 8 THEN 1 ELSE 0 END ) checked - FROM - `ums_base_case` AS ubc - JOIN ums_violations AS uv ON ubc.id = uv.id - LEFT JOIN ums_data_dictionary AS t3 ON uv.category_id = t3.id - LEFT JOIN ums_data_dictionary AS t4 ON uv.type_id = t4.id - LEFT JOIN ums_sccg_region t5 ON ubc.street_id = t5.id - WHERE - ubc.category = 1 - AND t4.`name` IS NOT NULL - AND ubc.id = #{id} - </select> - <select id="getDataByTimeExp" resultType="com.ycl.dto.statistics.TimeDto"> - SELECT - ubc.id id, - ubc.alarm_time time, - FROM - `ums_base_case` AS ubc - JOIN ums_violations AS uv ON ubc.id = uv.id - LEFT JOIN ums_data_dictionary AS t3 ON uv.category_id = t3.id - LEFT JOIN ums_data_dictionary AS t4 ON uv.type_id = t4.id - LEFT JOIN ums_sccg_region t5 ON ubc.street_id = t5.id - WHERE - ubc.category =1 - and t4.`name` is NOT NULL - group by - ubc.alarm_time - </select> - - - - -<!-- 鍒嗛〉鏁伴噺--> - <select id="getTotalByType" resultType="java.lang.Integer"> - SELECT - count(*) num + t4.id id, + t4.NAME name, + COUNT(DISTINCT ubc.id) count, + sum(case when ubc.state >4 then 1 ELSE 0 END ) register, + sum(case when ubc.state =4 then 1 ELSE 0 END ) notRegister, + sum(case when ubc.state =9 then 1 ELSE 0 END ) closing, + sum(case when ubc.state =3 then 1 ELSE 0 END ) relearn, + sum(case when ubc.state =8 then 1 ELSE 0 END ) checked FROM `ums_base_case` AS ubc JOIN ums_violations AS uv ON ubc.id = uv.id - LEFT JOIN ums_data_dictionary AS t3 ON uv.category_id = t3.id - LEFT JOIN ums_data_dictionary AS t4 ON uv.type_id = t4.id + LEFT JOIN ums_data_dictionary AS t4 ON uv.grade_id = t4.id LEFT JOIN ums_sccg_region t5 ON ubc.street_id = t5.id WHERE ubc.category =1 @@ -277,26 +44,21 @@ <if test="startTime !='' and endTime !='' and startTime!=null and endTime !=null"> and ubc.create_time between #{startTime} and #{endTime} </if> + group by t4.id + ORDER BY t4.id </select> - <select id="getTotalByStreet" resultType="java.lang.Integer"> + + <!-- 鎸夌収鍖哄煙缁熻--> + <select id="getDataByStreet" resultType="com.ycl.dto.statistics.UnlawfulDto"> SELECT - count(*) num - FROM - `ums_base_case` AS ubc - JOIN ums_violations AS uv ON ubc.id = uv.id - LEFT JOIN ums_data_dictionary AS t3 ON uv.category_id = t3.id - LEFT JOIN ums_data_dictionary AS t4 ON uv.type_id = t4.id - LEFT JOIN ums_sccg_region t5 ON ubc.street_id = t5.id - WHERE - ubc.category =1 - and t4.`name` is NOT NULL - <if test="startTime !='' and endTime !='' and startTime!=null and endTime !=null"> - and ubc.create_time between #{startTime} and #{endTime} - </if> - </select> - <select id="getTotalBySite" resultType="java.lang.Integer"> - SELECT - count(*) num + ubc.street_id id, + t5.region_name name, + COUNT( DISTINCT ubc.id ) count, + sum( CASE WHEN ubc.state > 4 THEN 1 ELSE 0 END ) register, + sum( CASE WHEN ubc.state = 4 THEN 1 ELSE 0 END ) notRegister, + sum( CASE WHEN ubc.state = 9 THEN 1 ELSE 0 END ) closing, + sum( CASE WHEN ubc.state = 3 THEN 1 ELSE 0 END ) relearn, + sum( CASE WHEN ubc.state = 8 THEN 1 ELSE 0 END ) checked FROM `ums_base_case` AS ubc JOIN ums_violations AS uv ON ubc.id = uv.id @@ -305,25 +67,59 @@ LEFT JOIN ums_sccg_region t5 ON ubc.street_id = t5.id WHERE ubc.category = 1 - AND t4.`name` IS NOT NULL + AND t5.region_name IS NOT NULL <if test="startTime !='' and endTime !='' and startTime!=null and endTime !=null"> and ubc.create_time between #{startTime} and #{endTime} </if> + GROUP BY ubc.street_id + ORDER BY ubc.street_id </select> - <select id="getTotalByTime" resultType="java.lang.Integer"> + + <!-- 鎸夌収鎶ヨ鏃堕棿--> + <select id="getDataByTime" resultType="com.ycl.dto.statistics.UnlawfulDto"> SELECT - count(*) num + DATE_FORMAT(ubc.alarm_time,'%Y-%m-%d') NAME, + COUNT( DISTINCT ubc.id ) count, + sum( CASE WHEN ubc.state > 4 THEN 1 ELSE 0 END ) register, + sum( CASE WHEN ubc.state = 4 THEN 1 ELSE 0 END ) notRegister, + sum( CASE WHEN ubc.state = 9 THEN 1 ELSE 0 END ) closing, + sum( CASE WHEN ubc.state = 3 THEN 1 ELSE 0 END ) relearn, + sum( CASE WHEN ubc.state = 8 THEN 1 ELSE 0 END ) checked FROM `ums_base_case` AS ubc JOIN ums_violations AS uv ON ubc.id = uv.id - LEFT JOIN ums_data_dictionary AS t3 ON uv.category_id = t3.id - LEFT JOIN ums_data_dictionary AS t4 ON uv.type_id = t4.id - LEFT JOIN ums_sccg_region t5 ON ubc.street_id = t5.id WHERE ubc.category = 1 - AND t4.`name` IS NOT NULL <if test="startTime !='' and endTime !='' and startTime!=null and endTime !=null"> and ubc.alarm_time between #{startTime} and #{endTime} </if> + GROUP BY + DATE_FORMAT(ubc.alarm_time,'%Y-%m-%d') + ORDER BY + DATE_FORMAT(ubc.alarm_time,'%Y-%m-%d') + </select> + + <select id="getDataByPoint" resultType="com.ycl.dto.statistics.UnlawfulDto"> + SELECT + vp.id id, + vp.NAME name, + COUNT(DISTINCT ubc.id) count, + sum(case when ubc.state >4 then 1 ELSE 0 END ) register, + sum(case when ubc.state =4 then 1 ELSE 0 END ) notRegister, + sum(case when ubc.state =9 then 1 ELSE 0 END ) closing, + sum(case when ubc.state =3 then 1 ELSE 0 END ) relearn, + sum(case when ubc.state =8 then 1 ELSE 0 END ) checked + FROM + `ums_base_case` AS ubc + JOIN ums_violations AS uv ON ubc.id = uv.id + LEFT JOIN ums_video_point vp ON uv.video_point_id = vp.id + WHERE + ubc.category =1 + and vp.`name` is NOT NULL + <if test="startTime !='' and endTime !='' and startTime!=null and endTime !=null"> + and ubc.alarm_time between #{startTime} and #{endTime} + </if> + group by vp.id + ORDER BY vp.id </select> </mapper> \ No newline at end of file diff --git a/ycl-platform/src/test/java/com/ycl/sccgplatform/Test1.java b/ycl-platform/src/test/java/com/ycl/sccgplatform/Test1.java index 81f84ac..760b2e1 100644 --- a/ycl-platform/src/test/java/com/ycl/sccgplatform/Test1.java +++ b/ycl-platform/src/test/java/com/ycl/sccgplatform/Test1.java @@ -26,8 +26,8 @@ @Test void test(){ - List<CategoryDto> data = unlawfuldao.getDataByType(0, 5,"2022-12-14 17:19:01", "2022-12-14 17:19:03"); - System.out.println(data); +// List<CategoryDto> data = unlawfuldao.getDataByType(0, 5,"2022-12-14 17:19:01", "2022-12-14 17:19:03"); +// System.out.println(data); } // @Test -- Gitblit v1.8.0