From a7a050fb33089b74fed2ad488e846309d41c1128 Mon Sep 17 00:00:00 2001 From: luozhun <2025254074@qq.com> Date: Thu, 7 Nov 2024 17:14:01 +0800 Subject: [PATCH 1/6] =?UTF-8?q?feat(module/assessmentCriteria):=20?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=80=83=E6=A0=B8=E6=A0=87=E5=87=86=E6=A8=A1?= =?UTF-8?q?=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加了考核标准相关的实体类、枚举类、参数类、VO类等- 实现了考核标准的CRUD接口和相关服务 - 新增了考核标准的分页查询和详情查询功能 - 优化了用户类型检查的注解 --- .../common/annotation/CheckUserType.java | 2 +- .../common/db/enums/EnterprisesUnitType.java | 25 ++ .../changhu/common/db/enums/SelectType.java | 25 ++ .../handler/ManagementSecurityUnitLogin.java | 2 +- .../AssessmentCriteriaController.java | 134 +++++++++ .../CkAssessmentRecordDetailsMapper.java | 15 + .../mapper/CkAssessmentRecordMapper.java | 15 + .../mapper/CkGroupMapper.java | 15 + .../mapper/CkItemMapper.java | 15 + .../mapper/CkProjectMapper.java | 39 +++ .../mapper/CkStandardMapper.java | 15 + .../pojo/entity/CkAssessmentRecord.java | 57 ++++ .../entity/CkAssessmentRecordDetails.java | 57 ++++ .../pojo/entity/CkGroup.java | 52 ++++ .../pojo/entity/CkItem.java | 53 ++++ .../pojo/entity/CkProject.java | 53 ++++ .../pojo/entity/CkStandard.java | 47 +++ .../pojo/params/AssessmentRecordParams.java | 54 ++++ .../params/CkGroupSaveOrUpdateParams.java | 33 ++ .../pojo/params/CkItemSaveOrUpdateParams.java | 33 ++ .../params/CkProjectSaveOrUpdateParams.java | 35 +++ .../params/CkStandardSaveOrUpdateParams.java | 31 ++ .../CkProjectPagerQueryParams.java | 15 + .../pojo/vo/AssessmentCriteriaRuleVo.java | 57 ++++ .../pojo/vo/CkProjectDetailTableVo.java | 39 +++ .../pojo/vo/CkProjectPagerVo.java | 31 ++ .../service/AssessmentCriteriaService.java | 95 ++++++ .../CkAssessmentRecordDetailsService.java | 13 + .../service/CkAssessmentRecordService.java | 13 + .../service/CkGroupService.java | 13 + .../service/CkItemService.java | 13 + .../service/CkProjectService.java | 13 + .../service/CkStandardService.java | 13 + .../impl/AssessmentCriteriaServiceImpl.java | 215 +++++++++++++ .../CkAssessmentRecordDetailsServiceImpl.java | 17 ++ .../impl/CkAssessmentRecordServiceImpl.java | 17 ++ .../service/impl/CkGroupServiceImpl.java | 17 ++ .../service/impl/CkItemServiceImpl.java | 17 ++ .../service/impl/CkProjectServiceImpl.java | 17 ++ .../service/impl/CkStandardServiceImpl.java | 17 ++ .../pojo/entity/EnterprisesUnit.java | 7 + .../EnterprisesUnitSaveOrUpdateParams.java | 5 + .../pojo/vo/EnterprisesUnitPagerVo.java | 4 + .../controller/PoliceIndexController.java | 16 + .../pojo/vo/IndexDataStatisticsVo.java | 21 ++ .../pojo/vo/IndexServiceProjectListVo.java | 8 + .../miniProgram/service/MPoliceService.java | 18 ++ .../service/impl/MPoliceServiceImpl.java | 62 ++++ .../src/main/resources/conf/log4j2.xml | 3 + .../main/resources/mapper/CkProjectMapper.xml | 37 +++ .../resources/mapper/ServiceProjectMapper.xml | 2 + superManagement/.env.development | 4 + superManagement/.env.production | 4 + superManagement/package.json | 2 + .../src/components/aMap/MapContainer.vue | 57 ++++ .../src/components/layout/MenuItem.vue | 1 - .../tree/AdministrativeDivisionTree.vue | 14 +- superManagement/src/config/dict.ts | 2 + superManagement/src/config/index.ts | 31 +- superManagement/src/main.ts | 2 + superManagement/src/router/staticRouters.ts | 46 ++- .../src/types/components/tree/index.ts | 7 + superManagement/src/types/config/index.ts | 1 + .../unitManage/police/assessmentCriteria.ts | 90 ++++++ .../unitManage/{ => police}/policeUnit.ts | 3 + superManagement/src/utils/aMapUtil.ts | 18 ++ .../src/views/data/dataOverview.vue | 13 + superManagement/src/views/test.vue | 44 ++- .../police/assessmentCriteria/index.ts | 188 ++++++++++++ .../police/assessmentCriteria/index.vue | 284 ++++++++++++++++++ .../unitManage/police/unitManage/index.tsx | 226 ++++++++++++++ .../unitManage/police/unitManage/index.vue | 136 +++++++++ .../unitManage/index.vue.bak} | 0 superManagement/src/views/unitManage/test.vue | 11 - superManagement/src/vite-env.d.ts | 4 + 75 files changed, 2756 insertions(+), 54 deletions(-) create mode 100644 policeSecurityServer/src/main/java/com/changhu/common/db/enums/EnterprisesUnitType.java create mode 100644 policeSecurityServer/src/main/java/com/changhu/common/db/enums/SelectType.java create mode 100644 policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/controller/AssessmentCriteriaController.java create mode 100644 policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/mapper/CkAssessmentRecordDetailsMapper.java create mode 100644 policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/mapper/CkAssessmentRecordMapper.java create mode 100644 policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/mapper/CkGroupMapper.java create mode 100644 policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/mapper/CkItemMapper.java create mode 100644 policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/mapper/CkProjectMapper.java create mode 100644 policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/mapper/CkStandardMapper.java create mode 100644 policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/entity/CkAssessmentRecord.java create mode 100644 policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/entity/CkAssessmentRecordDetails.java create mode 100644 policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/entity/CkGroup.java create mode 100644 policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/entity/CkItem.java create mode 100644 policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/entity/CkProject.java create mode 100644 policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/entity/CkStandard.java create mode 100644 policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/params/AssessmentRecordParams.java create mode 100644 policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/params/CkGroupSaveOrUpdateParams.java create mode 100644 policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/params/CkItemSaveOrUpdateParams.java create mode 100644 policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/params/CkProjectSaveOrUpdateParams.java create mode 100644 policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/params/CkStandardSaveOrUpdateParams.java create mode 100644 policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/queryParams/CkProjectPagerQueryParams.java create mode 100644 policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/vo/AssessmentCriteriaRuleVo.java create mode 100644 policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/vo/CkProjectDetailTableVo.java create mode 100644 policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/vo/CkProjectPagerVo.java create mode 100644 policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/AssessmentCriteriaService.java create mode 100644 policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/CkAssessmentRecordDetailsService.java create mode 100644 policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/CkAssessmentRecordService.java create mode 100644 policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/CkGroupService.java create mode 100644 policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/CkItemService.java create mode 100644 policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/CkProjectService.java create mode 100644 policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/CkStandardService.java create mode 100644 policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/impl/AssessmentCriteriaServiceImpl.java create mode 100644 policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/impl/CkAssessmentRecordDetailsServiceImpl.java create mode 100644 policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/impl/CkAssessmentRecordServiceImpl.java create mode 100644 policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/impl/CkGroupServiceImpl.java create mode 100644 policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/impl/CkItemServiceImpl.java create mode 100644 policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/impl/CkProjectServiceImpl.java create mode 100644 policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/impl/CkStandardServiceImpl.java create mode 100644 policeSecurityServer/src/main/java/com/changhu/module/miniProgram/pojo/vo/IndexDataStatisticsVo.java create mode 100644 policeSecurityServer/src/main/resources/mapper/CkProjectMapper.xml create mode 100644 superManagement/src/components/aMap/MapContainer.vue create mode 100644 superManagement/src/types/components/tree/index.ts create mode 100644 superManagement/src/types/views/unitManage/police/assessmentCriteria.ts rename superManagement/src/types/views/unitManage/{ => police}/policeUnit.ts (97%) create mode 100644 superManagement/src/utils/aMapUtil.ts create mode 100644 superManagement/src/views/data/dataOverview.vue create mode 100644 superManagement/src/views/unitManage/police/assessmentCriteria/index.ts create mode 100644 superManagement/src/views/unitManage/police/assessmentCriteria/index.vue create mode 100644 superManagement/src/views/unitManage/police/unitManage/index.tsx create mode 100644 superManagement/src/views/unitManage/police/unitManage/index.vue rename superManagement/src/views/unitManage/{policeUnit/index.vue => police/unitManage/index.vue.bak} (100%) delete mode 100644 superManagement/src/views/unitManage/test.vue diff --git a/policeSecurityServer/src/main/java/com/changhu/common/annotation/CheckUserType.java b/policeSecurityServer/src/main/java/com/changhu/common/annotation/CheckUserType.java index 4621a12..ccac842 100644 --- a/policeSecurityServer/src/main/java/com/changhu/common/annotation/CheckUserType.java +++ b/policeSecurityServer/src/main/java/com/changhu/common/annotation/CheckUserType.java @@ -23,5 +23,5 @@ public @interface CheckUserType { /** * 需要的客户端类型 */ - UserType[] userTypes(); + UserType[] userTypes() default {}; } diff --git a/policeSecurityServer/src/main/java/com/changhu/common/db/enums/EnterprisesUnitType.java b/policeSecurityServer/src/main/java/com/changhu/common/db/enums/EnterprisesUnitType.java new file mode 100644 index 0000000..a45370a --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/common/db/enums/EnterprisesUnitType.java @@ -0,0 +1,25 @@ +package com.changhu.common.db.enums; + +import com.baomidou.mybatisplus.annotation.IEnum; +import com.changhu.common.db.BaseEnum; +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @author 20252 + * @createTime 2024/11/5 下午4:22 + * @desc EnterprisesUnitType... + */ +@Getter +@AllArgsConstructor +public enum EnterprisesUnitType implements BaseEnum, IEnum { + + school("school", "学校"), + hospital("hospital", "医院"), + community("community", "社区/小区"), + bank("bank", "银行"), + ; + + private final String value; + private final String label; +} diff --git a/policeSecurityServer/src/main/java/com/changhu/common/db/enums/SelectType.java b/policeSecurityServer/src/main/java/com/changhu/common/db/enums/SelectType.java new file mode 100644 index 0000000..abdc606 --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/common/db/enums/SelectType.java @@ -0,0 +1,25 @@ +package com.changhu.common.db.enums; + +import com.baomidou.mybatisplus.annotation.IEnum; +import com.changhu.common.db.BaseEnum; +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * author: luozhun + * desc: 单选或多选 + * createTime: 2023/8/16 17:39 + */ +@Getter +@AllArgsConstructor +public enum SelectType implements BaseEnum, IEnum { + + RADIO("radio", "单选"), + MULTIPLE("multiple", "多选"), + ; + + private final String value; + private final String label; + +} + diff --git a/policeSecurityServer/src/main/java/com/changhu/enums/handler/ManagementSecurityUnitLogin.java b/policeSecurityServer/src/main/java/com/changhu/enums/handler/ManagementSecurityUnitLogin.java index 37790bb..7205ccb 100644 --- a/policeSecurityServer/src/main/java/com/changhu/enums/handler/ManagementSecurityUnitLogin.java +++ b/policeSecurityServer/src/main/java/com/changhu/enums/handler/ManagementSecurityUnitLogin.java @@ -42,7 +42,7 @@ public class ManagementSecurityUnitLogin extends AbstractLoginHandler { .or() .eq(ManagementSecurityUnitUser::getTelephone, accountOrTelephone) .oneOpt() - .orElseThrow(() -> new MessageException(ResultCode.ERROR)); + .orElseThrow(() -> new MessageException(ResultCode.USER_NOT_FOUND)); //判断用户是否禁用 if (managementSecurityUnitUser.getIsEnable().equals(IsEnable.FALSE)) { diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/controller/AssessmentCriteriaController.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/controller/AssessmentCriteriaController.java new file mode 100644 index 0000000..8024a93 --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/controller/AssessmentCriteriaController.java @@ -0,0 +1,134 @@ +package com.changhu.module.assessmentCriteria.controller; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.toolkit.Db; +import com.changhu.common.annotation.CheckUserType; +import com.changhu.common.annotation.JsonBody; +import com.changhu.common.annotation.UserType; +import com.changhu.common.db.enums.EnterprisesUnitType; +import com.changhu.common.exception.MessageException; +import com.changhu.common.pojo.vo.SelectNodeVo; +import com.changhu.module.assessmentCriteria.pojo.entity.CkGroup; +import com.changhu.module.assessmentCriteria.pojo.entity.CkItem; +import com.changhu.module.assessmentCriteria.pojo.entity.CkStandard; +import com.changhu.module.assessmentCriteria.pojo.params.*; +import com.changhu.module.assessmentCriteria.pojo.queryParams.CkProjectPagerQueryParams; +import com.changhu.module.assessmentCriteria.pojo.vo.AssessmentCriteriaRuleVo; +import com.changhu.module.assessmentCriteria.pojo.vo.CkProjectDetailTableVo; +import com.changhu.module.assessmentCriteria.pojo.vo.CkProjectPagerVo; +import com.changhu.module.assessmentCriteria.service.AssessmentCriteriaService; +import com.changhu.support.mybatisplus.pojo.params.PageParams; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * @author 20252 + * @createTime 2024/11/6 上午10:02 + * @desc AssessmentCriteriaController... + */ +@Tag(name = "考核标准") +@JsonBody +@RequestMapping("/assessmentCriteria") +@CheckUserType(userTypes = UserType.MANAGEMENT_SUPER) +public class AssessmentCriteriaController { + + @Autowired + private AssessmentCriteriaService assessmentCriteriaService; + + @Operation(summary = "根据类型获取考核项目列表") + @GetMapping("/ckProjectListByType") + @CheckUserType(value = false) + public List> ckProjectListByType(@RequestParam EnterprisesUnitType type) { + return assessmentCriteriaService.assessmentCriteriaListByType(type); + } + + @Operation(summary = "根据考核项目获取考核规则") + @GetMapping("/assessmentCriteriaRulesByCkProjectId") + @CheckUserType(value = false) + public List assessmentCriteriaRulesByCkProjectId(@RequestParam Long ckProjectId) { + return assessmentCriteriaService.assessmentCriteriaRulesByCkProjectId(ckProjectId); + } + + @Operation(summary = "提交考核记录") + @PostMapping("/submitAssessmentRecord") + @CheckUserType(value = false) + public void submitAssessmentRecord(@Validated @RequestBody AssessmentRecordParams params) { + assessmentCriteriaService.submitAssessmentRecord(params); + } + + @Operation(summary = "考核项目分页查询") + @PostMapping("/ckProjectPagerVoPager") + public Page ckProjectPagerVoPager(@RequestBody PageParams queryParams) { + return assessmentCriteriaService.ckProjectPagerVoPager(queryParams); + } + + @Operation(summary = "新增或修改考核项目") + @PostMapping("/saveOrUpdateCkProject") + public void saveOrUpdateCkProject(@Valid @RequestBody CkProjectSaveOrUpdateParams params) { + assessmentCriteriaService.saveOrUpdateCkProject(params); + } + + @Operation(summary = "删除考核项目") + @DeleteMapping("/deleteCkProjectById") + public void deleteCkProjectById(@RequestParam Long ckProjectId) { + assessmentCriteriaService.deleteCkProjectById(ckProjectId); + } + + @Operation(summary = "考核项目详情") + @GetMapping("/ckProjectDetail") + public List ckProjectDetail(@RequestParam Long ckProjectId) { + return assessmentCriteriaService.ckProjectDetail(ckProjectId); + } + + @Operation(summary = "新增或修改考核分组") + @PostMapping("/saveOrUpdateCkGroup") + public void saveOrUpdateCkGroup(@Valid @RequestBody CkGroupSaveOrUpdateParams params) { + assessmentCriteriaService.saveOrUpdateCkGroup(params); + } + + @Operation(summary = "新增或修改考核项") + @PostMapping("/saveOrUpdateCkItem") + public void saveOrUpdateCkItem(@Valid @RequestBody CkItemSaveOrUpdateParams params) { + assessmentCriteriaService.saveOrUpdateCkItem(params); + } + + @Operation(summary = "新增或修改考核标准") + @PostMapping("/saveOrUpdateCkStandard") + public void saveOrUpdateCkStandard(@Valid @RequestBody CkStandardSaveOrUpdateParams params) { + assessmentCriteriaService.saveOrUpdateCkStandard(params); + } + + @Operation(summary = "删除考核分组") + @DeleteMapping("/deleteCkGroupById") + public void deleteCkGroupById(@RequestParam Long ckGroupId) { + boolean b = Db.removeById(ckGroupId, CkGroup.class); + if (!b) { + throw new MessageException(); + } + } + + @Operation(summary = "删除考核项") + @DeleteMapping("/deleteCkItemById") + public void deleteCkItemById(@RequestParam Long ckItemId) { + boolean b = Db.removeById(ckItemId, CkItem.class); + if (!b) { + throw new MessageException(); + } + } + + @Operation(summary = "删除考核标准") + @DeleteMapping("/deleteCkStandardById") + public void deleteCkStandardById(@RequestParam Long ckStandardId) { + boolean b = Db.removeById(ckStandardId, CkStandard.class); + if (!b) { + throw new MessageException(); + } + } + +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/mapper/CkAssessmentRecordDetailsMapper.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/mapper/CkAssessmentRecordDetailsMapper.java new file mode 100644 index 0000000..a3d91bc --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/mapper/CkAssessmentRecordDetailsMapper.java @@ -0,0 +1,15 @@ +package com.changhu.module.assessmentCriteria.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.changhu.module.assessmentCriteria.pojo.entity.CkAssessmentRecordDetails; +import org.apache.ibatis.annotations.Mapper; + +/** + * ck_assessment_record_details (考核记录明细) 固化类 + * author: luozhun + * desc 由groovy脚本自动生成 + */ +@Mapper +public interface CkAssessmentRecordDetailsMapper extends BaseMapper { + +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/mapper/CkAssessmentRecordMapper.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/mapper/CkAssessmentRecordMapper.java new file mode 100644 index 0000000..36dea56 --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/mapper/CkAssessmentRecordMapper.java @@ -0,0 +1,15 @@ +package com.changhu.module.assessmentCriteria.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.changhu.module.assessmentCriteria.pojo.entity.CkAssessmentRecord; +import org.apache.ibatis.annotations.Mapper; + +/** + * ck_assessment_record (考核记录) 固化类 + * author: luozhun + * desc 由groovy脚本自动生成 + */ +@Mapper +public interface CkAssessmentRecordMapper extends BaseMapper { + +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/mapper/CkGroupMapper.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/mapper/CkGroupMapper.java new file mode 100644 index 0000000..eb83633 --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/mapper/CkGroupMapper.java @@ -0,0 +1,15 @@ +package com.changhu.module.assessmentCriteria.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.changhu.module.assessmentCriteria.pojo.entity.CkGroup; +import org.apache.ibatis.annotations.Mapper; + +/** + * ck_group (考核组) 固化类 + * author: luozhun + * desc 由groovy脚本自动生成 + */ +@Mapper +public interface CkGroupMapper extends BaseMapper { + +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/mapper/CkItemMapper.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/mapper/CkItemMapper.java new file mode 100644 index 0000000..027c61d --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/mapper/CkItemMapper.java @@ -0,0 +1,15 @@ +package com.changhu.module.assessmentCriteria.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.changhu.module.assessmentCriteria.pojo.entity.CkItem; +import org.apache.ibatis.annotations.Mapper; + +/** + * ck_item (分组内的考核项) 固化类 + * author: luozhun + * desc 由groovy脚本自动生成 + */ +@Mapper +public interface CkItemMapper extends BaseMapper{ + +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/mapper/CkProjectMapper.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/mapper/CkProjectMapper.java new file mode 100644 index 0000000..0827f55 --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/mapper/CkProjectMapper.java @@ -0,0 +1,39 @@ +package com.changhu.module.assessmentCriteria.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.changhu.module.assessmentCriteria.pojo.entity.CkProject; +import com.changhu.module.assessmentCriteria.pojo.queryParams.CkProjectPagerQueryParams; +import com.changhu.module.assessmentCriteria.pojo.vo.CkProjectDetailTableVo; +import com.changhu.module.assessmentCriteria.pojo.vo.CkProjectPagerVo; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * ck_project (考核项目) 固化类 + * author: luozhun + * desc 由groovy脚本自动生成 + */ +@Mapper +public interface CkProjectMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页参数 + * @param params 查询参数 + * @return 分页数据 + */ + Page pager(@Param("page") Page page, + @Param("params") CkProjectPagerQueryParams params); + + /** + * 考核项目详情 + * + * @param ckProjectId 考核项目id + * @return 详情 + */ + List ckProjectDetail(@Param("ckProjectId") Long ckProjectId); +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/mapper/CkStandardMapper.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/mapper/CkStandardMapper.java new file mode 100644 index 0000000..fa97775 --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/mapper/CkStandardMapper.java @@ -0,0 +1,15 @@ +package com.changhu.module.assessmentCriteria.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.changhu.module.assessmentCriteria.pojo.entity.CkStandard; +import org.apache.ibatis.annotations.Mapper; + +/** + * ck_standard (扣分标准) 固化类 + * author: luozhun + * desc 由groovy脚本自动生成 + */ +@Mapper +public interface CkStandardMapper extends BaseMapper{ + +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/entity/CkAssessmentRecord.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/entity/CkAssessmentRecord.java new file mode 100644 index 0000000..bc8ee3d --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/entity/CkAssessmentRecord.java @@ -0,0 +1,57 @@ +package com.changhu.module.assessmentCriteria.pojo.entity; + +import java.io.Serial; +import java.io.Serializable; + +import com.changhu.support.mybatisplus.pojo.entity.BaseEntity; +import lombok.Data; +import lombok.AllArgsConstructor; +import lombok.NoArgsConstructor; +import lombok.experimental.SuperBuilder; +import lombok.EqualsAndHashCode; +import com.baomidou.mybatisplus.annotation.TableName; + + +/** + * 考核记录 实体类 + * author: luozhun + * desc 由groovy脚本自动生成 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@SuperBuilder +@EqualsAndHashCode(callSuper = true) +@TableName(autoResultMap = true) +public class CkAssessmentRecord extends BaseEntity implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 企事业单位id + */ + private Long enterprisesUnitId; + + /** + * 考核项目id + */ + private Long ckProjectId; + + /** + * 考核人员签字 + */ + private String assessmentUserSignature; + + /** + * 被考核单位人员签字 + */ + private String byAssessmentEnterprisesUnitUserSignature; + + /** + * 考核备注 + */ + private String remark; + + +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/entity/CkAssessmentRecordDetails.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/entity/CkAssessmentRecordDetails.java new file mode 100644 index 0000000..7b99f6c --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/entity/CkAssessmentRecordDetails.java @@ -0,0 +1,57 @@ +package com.changhu.module.assessmentCriteria.pojo.entity; + +import java.io.Serial; +import java.io.Serializable; + +import com.changhu.support.mybatisplus.pojo.entity.BaseEntity; +import lombok.Data; +import lombok.AllArgsConstructor; +import lombok.NoArgsConstructor; +import lombok.experimental.SuperBuilder; +import lombok.EqualsAndHashCode; +import com.baomidou.mybatisplus.annotation.TableName; + + +/** + * 考核记录明细 实体类 + * author: luozhun + * desc 由groovy脚本自动生成 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@SuperBuilder +@EqualsAndHashCode(callSuper = true) +@TableName(autoResultMap = true) +public class CkAssessmentRecordDetails extends BaseEntity implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 考核记录id + */ + private Long ckAssessmentRecordId; + + /** + * 考核项目id + */ + private Long ckProjectId; + + /** + * 考核分组id + */ + private Long ckGroupId; + + /** + * 考核项id + */ + private Long ckItemId; + + /** + * 考核标准id + */ + private Long ckStandardId; + + +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/entity/CkGroup.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/entity/CkGroup.java new file mode 100644 index 0000000..4b2e86d --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/entity/CkGroup.java @@ -0,0 +1,52 @@ +package com.changhu.module.assessmentCriteria.pojo.entity; + +import java.io.Serial; +import java.io.Serializable; + +import com.changhu.support.mybatisplus.pojo.entity.BaseEntity; +import lombok.Data; +import lombok.AllArgsConstructor; +import lombok.NoArgsConstructor; +import lombok.experimental.SuperBuilder; +import lombok.EqualsAndHashCode; +import com.baomidou.mybatisplus.annotation.TableName; + + +/** + * 考核组 实体类 + * author: luozhun + * desc 由groovy脚本自动生成 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@SuperBuilder +@EqualsAndHashCode(callSuper = true) +@TableName(autoResultMap = true) +public class CkGroup extends BaseEntity implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 考核项目id + */ + private Long ckProjectId; + + /** + * 考核组名称 + */ + private String name; + + /** + * 总分 + */ + private Integer totalScore; + + /** + * 备注信息 + */ + private String remark; + + +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/entity/CkItem.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/entity/CkItem.java new file mode 100644 index 0000000..f969bd6 --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/entity/CkItem.java @@ -0,0 +1,53 @@ +package com.changhu.module.assessmentCriteria.pojo.entity; + +import java.io.Serial; +import java.io.Serializable; + +import com.changhu.common.db.enums.SelectType; +import com.changhu.support.mybatisplus.pojo.entity.BaseEntity; +import lombok.Data; +import lombok.AllArgsConstructor; +import lombok.NoArgsConstructor; +import lombok.experimental.SuperBuilder; +import lombok.EqualsAndHashCode; +import com.baomidou.mybatisplus.annotation.TableName; + + +/** + * 分组内的考核项 实体类 + * author: luozhun + * desc 由groovy脚本自动生成 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@SuperBuilder +@EqualsAndHashCode(callSuper = true) +@TableName(autoResultMap = true) +public class CkItem extends BaseEntity implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 考核组id + */ + private Long ckGroupId; + + /** + * 考核项名称 + */ + private String name; + + /** + * 单选或多选 + */ + private SelectType type; + + /** + * 备注信息 + */ + private String remark; + + +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/entity/CkProject.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/entity/CkProject.java new file mode 100644 index 0000000..f9f1bb3 --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/entity/CkProject.java @@ -0,0 +1,53 @@ +package com.changhu.module.assessmentCriteria.pojo.entity; + +import java.io.Serial; +import java.io.Serializable; + +import com.changhu.common.db.enums.EnterprisesUnitType; +import com.changhu.support.mybatisplus.pojo.entity.BaseEntity; +import lombok.Data; +import lombok.AllArgsConstructor; +import lombok.NoArgsConstructor; +import lombok.experimental.SuperBuilder; +import lombok.EqualsAndHashCode; +import com.baomidou.mybatisplus.annotation.TableName; + + +/** + * 考核项目 实体类 + * author: luozhun + * desc 由groovy脚本自动生成 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@SuperBuilder +@EqualsAndHashCode(callSuper = true) +@TableName(autoResultMap = true) +public class CkProject extends BaseEntity implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 考核项目名字 + */ + private String name; + + /** + * 类型(对应企事业单位类型) + */ + private EnterprisesUnitType type; + + /** + * 总分 + */ + private Integer totalScore; + + /** + * 备注信息 + */ + private String remark; + + +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/entity/CkStandard.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/entity/CkStandard.java new file mode 100644 index 0000000..1a561a2 --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/entity/CkStandard.java @@ -0,0 +1,47 @@ +package com.changhu.module.assessmentCriteria.pojo.entity; + +import java.io.Serial; +import java.io.Serializable; + +import com.changhu.common.db.enums.SelectType; +import com.changhu.support.mybatisplus.pojo.entity.BaseEntity; +import lombok.Data; +import lombok.AllArgsConstructor; +import lombok.NoArgsConstructor; +import lombok.experimental.SuperBuilder; +import lombok.EqualsAndHashCode; +import com.baomidou.mybatisplus.annotation.TableName; + + +/** + * 扣分标准 实体类 + * author: luozhun + * desc 由groovy脚本自动生成 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@SuperBuilder +@EqualsAndHashCode(callSuper = true) +@TableName(autoResultMap = true) +public class CkStandard extends BaseEntity implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 考核项id + */ + private Long ckItemId; + + /** + * 条件 + */ + private String name; + + /** + * 扣多少分 + */ + private Double deductionPoints; + +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/params/AssessmentRecordParams.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/params/AssessmentRecordParams.java new file mode 100644 index 0000000..af66d88 --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/params/AssessmentRecordParams.java @@ -0,0 +1,54 @@ +package com.changhu.module.assessmentCriteria.pojo.params; + +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.util.List; + +/** + * @author 20252 + * @createTime 2024/11/7 上午11:15 + * @desc AssessmentRecordParams... + */ +@Data +public class AssessmentRecordParams { + @Schema(description = "企事业单位id") + @NotNull(message = "被考核单位不能为空") + private Long enterprisesUnitId; + + @Schema(description = "考核项目") + @NotNull(message = "考核项目不能为空") + private Long ckProjectId; + + @Schema(description = "考核人员签字") + @NotEmpty(message = "考核人员需签字") + private String assessmentUserSignature; + @Schema(description = "被考核单位人员签字") + @NotEmpty(message = "被考核单位需人员签字") + private String byAssessmentEnterprisesUnitUserSignature; + + @Schema(description = "考核备注") + private String remark; + + @Valid + @Schema(description = "考核记录详情") + private List assessmentRecordDetails; + + @Data + public static class RecordDetailParams { + @NotNull(message = "考核分组不能为空") + @Schema(description = "考核分组id") + private Long ckGroupId; + + @NotNull(message = "考核项不能为空") + @Schema(description = "考核项id") + private Long ckItemId; + + @NotNull(message = "考核标准不能为空") + @Schema(description = "考核标准id") + private Long ckStandardId; + } +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/params/CkGroupSaveOrUpdateParams.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/params/CkGroupSaveOrUpdateParams.java new file mode 100644 index 0000000..d0e464c --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/params/CkGroupSaveOrUpdateParams.java @@ -0,0 +1,33 @@ +package com.changhu.module.assessmentCriteria.pojo.params; + +import com.changhu.common.db.enums.EnterprisesUnitType; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +/** + * @author 20252 + * @createTime 2024/11/6 上午10:31 + * @desc CkProjectSaveOrUpdateParams... + */ +@Data +public class CkGroupSaveOrUpdateParams { + @Schema(description = "考核分组id") + private Long snowFlakeId; + + @Schema(description = "考核项目id") + @NotNull(message = "所属考核项目不能为空") + private Long ckProjectId; + + @NotBlank(message = "考核组名不能为空") + @Schema(description = "考核组名称") + private String name; + + @NotNull(message = "考核组分数不能为空") + @Schema(description = "考核组总分") + private Integer totalScore; + + @Schema(description = "备注") + private String remark; +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/params/CkItemSaveOrUpdateParams.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/params/CkItemSaveOrUpdateParams.java new file mode 100644 index 0000000..9f9868e --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/params/CkItemSaveOrUpdateParams.java @@ -0,0 +1,33 @@ +package com.changhu.module.assessmentCriteria.pojo.params; + +import com.changhu.common.db.enums.SelectType; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +/** + * @author 20252 + * @createTime 2024/11/6 上午11:51 + * @desc CkItemSaveOrUpdateParams... + */ +@Data +public class CkItemSaveOrUpdateParams { + @Schema(description = "id") + private Long snowFlakeId; + + @NotNull(message = "考核组不能为空") + @Schema(description = "考核组id") + private Long ckGroupId; + + @NotBlank(message = "考核项名称不能为空") + @Schema(description = "考核项名称") + private String name; + + @NotNull(message = "组件类型不能为空") + @Schema(description = "组件类型") + private SelectType type; + + @Schema(description = "备注") + private String remark; +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/params/CkProjectSaveOrUpdateParams.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/params/CkProjectSaveOrUpdateParams.java new file mode 100644 index 0000000..fb01afa --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/params/CkProjectSaveOrUpdateParams.java @@ -0,0 +1,35 @@ +package com.changhu.module.assessmentCriteria.pojo.params; + +import com.changhu.common.db.enums.EnterprisesUnitType; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + * @author 20252 + * @createTime 2024/11/6 上午10:31 + * @desc CkProjectSaveOrUpdateParams... + */ +@Data +public class CkProjectSaveOrUpdateParams { + @Schema(description = "考核项目id") + private Long snowFlakeId; + + @NotBlank(message = "考核项目名不能为空") + @Schema(description = "考核项目名称") + private String name; + + @NotNull(message = "单位类型不能为空") + @Schema(description = "对应企事业单位类型") + private EnterprisesUnitType type; + + @NotNull(message = "考核分数不能为空") + @Schema(description = "考核总分") + private Integer totalScore; + + @Schema(description = "备注") + private String remark; +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/params/CkStandardSaveOrUpdateParams.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/params/CkStandardSaveOrUpdateParams.java new file mode 100644 index 0000000..9923114 --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/params/CkStandardSaveOrUpdateParams.java @@ -0,0 +1,31 @@ +package com.changhu.module.assessmentCriteria.pojo.params; + +import com.changhu.common.db.enums.SelectType; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +/** + * @author 20252 + * @createTime 2024/11/6 下午2:50 + * @desc CkStandardSaveOrUpdateParams... + */ +@Data +public class CkStandardSaveOrUpdateParams { + @Schema(description = "考核标准id") + private Long snowFlakeId; + + @NotNull + @Schema(description = "考核项id") + private Long ckItemId; + + @NotBlank(message = "标准名不能为空") + @Schema(description = "标准名") + private String name; + + @NotNull(message = "扣分值不能为空") + @Schema(description = "扣分值") + private Double deductionPoints; + +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/queryParams/CkProjectPagerQueryParams.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/queryParams/CkProjectPagerQueryParams.java new file mode 100644 index 0000000..30b42d7 --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/queryParams/CkProjectPagerQueryParams.java @@ -0,0 +1,15 @@ +package com.changhu.module.assessmentCriteria.pojo.queryParams; + +import com.changhu.common.db.enums.EnterprisesUnitType; +import lombok.Data; + +/** + * @author 20252 + * @createTime 2024/11/6 上午10:09 + * @desc CkProjectPagerQueryParams... + */ +@Data +public class CkProjectPagerQueryParams { + private String name; + private EnterprisesUnitType type; +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/vo/AssessmentCriteriaRuleVo.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/vo/AssessmentCriteriaRuleVo.java new file mode 100644 index 0000000..8295151 --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/vo/AssessmentCriteriaRuleVo.java @@ -0,0 +1,57 @@ +package com.changhu.module.assessmentCriteria.pojo.vo; + +import com.changhu.common.db.enums.SelectType; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.util.List; + +/** + * @author 20252 + * @createTime 2024/11/7 上午10:00 + * @desc 考核标准规则 + */ +@Data +public class AssessmentCriteriaRuleVo { + @Schema(description = "考核组id") + private Long snowFlakeId; + @Schema(description = "考核组名称") + private String name; + @Schema(description = "考核组总成绩") + private Integer totalScore; + @Schema(description = "考核组备注") + private String remark; + + @Schema(description = "考核项") + private List itemList; + + @Data + public static class Item { + @Schema(description = "考核项id") + private Long snowFlakeId; + @Schema(description = "考核分组id") + private Long ckGroupId; + @Schema(description = "考核项名称") + private String name; + @Schema(description = "考核项组件类型") + private SelectType type; + @Schema(description = "考核项备注") + private String remark; + + @Schema(description = "考核标准") + private List standardList; + } + + @Data + public static class Standard { + @Schema(description = "考核标准id") + private Long snowFlakeId; + @Schema(description = "考核项id") + private Long ckItemId; + @Schema(description = "考核标准名字") + private String name; + @Schema(description = "扣分值") + private Double deductionPoints; + } + +} \ No newline at end of file diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/vo/CkProjectDetailTableVo.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/vo/CkProjectDetailTableVo.java new file mode 100644 index 0000000..c83b28f --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/vo/CkProjectDetailTableVo.java @@ -0,0 +1,39 @@ +package com.changhu.module.assessmentCriteria.pojo.vo; + +import com.changhu.common.db.enums.SelectType; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +/** + * @author 20252 + * @createTime 2024/11/6 上午11:03 + * @desc CkProjectDetailTableVo... + */ +@Data +public class CkProjectDetailTableVo { + + @Schema(description = "考核分组id") + private Long ckGroupId; + @Schema(description = "考核分组名字") + private String groupName; + @Schema(description = "考核分组总分") + private Integer groupTotalScore; + @Schema(description = "考核分组备注") + private String groupRemark; + + @Schema(description = "考核项id") + private Long ckItemId; + @Schema(description = "考核项名字") + private String itemName; + @Schema(description = "组件类型") + private SelectType type; + @Schema(description = "考核项备注") + private String itemRemark; + + @Schema(description = "考核标准id") + private Long ckStandardId; + @Schema(description = "考核标准") + private String standardName; + @Schema(description = "扣分数") + private Double deductionPoints; +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/vo/CkProjectPagerVo.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/vo/CkProjectPagerVo.java new file mode 100644 index 0000000..43589d1 --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/vo/CkProjectPagerVo.java @@ -0,0 +1,31 @@ +package com.changhu.module.assessmentCriteria.pojo.vo; + +import com.changhu.common.db.enums.EnterprisesUnitType; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + * @author 20252 + * @createTime 2024/11/6 上午10:05 + * @desc CkProjectPagerVo... + */ +@Data +public class CkProjectPagerVo { + + @Schema(description = "考核项目id") + private Long snowFlakeId; + @Schema(description = "考核项目名称") + private String name; + @Schema(description = "对应企事业单位类型") + private EnterprisesUnitType type; + @Schema(description = "考核总分") + private Integer totalScore; + @Schema(description = "备注") + private String remark; + @Schema(description = "创建时间") + private LocalDateTime createTime; + @Schema(description = "创建人名字") + private String createUserName; +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/AssessmentCriteriaService.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/AssessmentCriteriaService.java new file mode 100644 index 0000000..d752efa --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/AssessmentCriteriaService.java @@ -0,0 +1,95 @@ +package com.changhu.module.assessmentCriteria.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.changhu.common.db.enums.EnterprisesUnitType; +import com.changhu.common.pojo.vo.SelectNodeVo; +import com.changhu.module.assessmentCriteria.pojo.params.*; +import com.changhu.module.assessmentCriteria.pojo.queryParams.CkProjectPagerQueryParams; +import com.changhu.module.assessmentCriteria.pojo.vo.AssessmentCriteriaRuleVo; +import com.changhu.module.assessmentCriteria.pojo.vo.CkProjectDetailTableVo; +import com.changhu.module.assessmentCriteria.pojo.vo.CkProjectPagerVo; +import com.changhu.support.mybatisplus.pojo.params.PageParams; + +import java.util.List; + +/** + * @author 20252 + * @createTime 2024/11/6 上午10:07 + * @desc AssessmentCriteriaService... + */ +public interface AssessmentCriteriaService { + + /** + * 根据类型获取考核标准列表 + * + * @param type 类型 + * @return 结果 + */ + List> assessmentCriteriaListByType(EnterprisesUnitType type); + + /** + * 根据考核项目获取考核规则 + * + * @param ckProjectId 考核项目id + * @return 结果 + */ + List assessmentCriteriaRulesByCkProjectId(Long ckProjectId); + + /** + * 考核项目分页查询 + * + * @param queryParams 查询参数 + * @return 查询结果 + */ + Page ckProjectPagerVoPager(PageParams queryParams); + + /** + * 新增或修改考核项目 + * + * @param params 参数 + */ + void saveOrUpdateCkProject(CkProjectSaveOrUpdateParams params); + + /** + * 删除考核项目 + * + * @param ckProjectId 考核项目id + */ + void deleteCkProjectById(Long ckProjectId); + + /** + * 考核项目详情 + * + * @param ckProjectId 考核项目id + * @return 结果 + */ + List ckProjectDetail(Long ckProjectId); + + /** + * 新增或修改考核分组 + * + * @param params 参数 + */ + void saveOrUpdateCkGroup(CkGroupSaveOrUpdateParams params); + + /** + * 新增或修改考核项 + * + * @param params 参数 + */ + void saveOrUpdateCkItem(CkItemSaveOrUpdateParams params); + + /** + * 新增或修改考核标准 + * + * @param params 参数 + */ + void saveOrUpdateCkStandard(CkStandardSaveOrUpdateParams params); + + /** + * 提交考核记录 + * + * @param params 参数 + */ + void submitAssessmentRecord(AssessmentRecordParams params); +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/CkAssessmentRecordDetailsService.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/CkAssessmentRecordDetailsService.java new file mode 100644 index 0000000..03e198c --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/CkAssessmentRecordDetailsService.java @@ -0,0 +1,13 @@ +package com.changhu.module.assessmentCriteria.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.changhu.module.assessmentCriteria.pojo.entity.CkAssessmentRecordDetails; + +/** + * ck_assessment_record_details (考核记录明细) 服务类 + * author: luozhun + * desc 由groovy脚本自动生成 + */ +public interface CkAssessmentRecordDetailsService extends IService { + +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/CkAssessmentRecordService.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/CkAssessmentRecordService.java new file mode 100644 index 0000000..276cf04 --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/CkAssessmentRecordService.java @@ -0,0 +1,13 @@ +package com.changhu.module.assessmentCriteria.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.changhu.module.assessmentCriteria.pojo.entity.CkAssessmentRecord; + +/** + * ck_assessment_record (考核记录) 服务类 + * author: luozhun + * desc 由groovy脚本自动生成 + */ +public interface CkAssessmentRecordService extends IService { + +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/CkGroupService.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/CkGroupService.java new file mode 100644 index 0000000..db87089 --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/CkGroupService.java @@ -0,0 +1,13 @@ +package com.changhu.module.assessmentCriteria.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.changhu.module.assessmentCriteria.pojo.entity.CkGroup; + +/** + * ck_group (考核组) 服务类 + * author: luozhun + * desc 由groovy脚本自动生成 + */ +public interface CkGroupService extends IService{ + +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/CkItemService.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/CkItemService.java new file mode 100644 index 0000000..4cc3fba --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/CkItemService.java @@ -0,0 +1,13 @@ +package com.changhu.module.assessmentCriteria.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.changhu.module.assessmentCriteria.pojo.entity.CkItem; + +/** + * ck_item (分组内的考核项) 服务类 + * author: luozhun + * desc 由groovy脚本自动生成 + */ +public interface CkItemService extends IService { + +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/CkProjectService.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/CkProjectService.java new file mode 100644 index 0000000..0357d50 --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/CkProjectService.java @@ -0,0 +1,13 @@ +package com.changhu.module.assessmentCriteria.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.changhu.module.assessmentCriteria.pojo.entity.CkProject; + +/** + * ck_project (考核项目) 服务类 + * author: luozhun + * desc 由groovy脚本自动生成 + */ +public interface CkProjectService extends IService{ + +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/CkStandardService.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/CkStandardService.java new file mode 100644 index 0000000..12559a6 --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/CkStandardService.java @@ -0,0 +1,13 @@ +package com.changhu.module.assessmentCriteria.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.changhu.module.assessmentCriteria.pojo.entity.CkStandard; + +/** + * ck_standard (扣分标准) 服务类 + * author: luozhun + * desc 由groovy脚本自动生成 + */ +public interface CkStandardService extends IService { + +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/impl/AssessmentCriteriaServiceImpl.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/impl/AssessmentCriteriaServiceImpl.java new file mode 100644 index 0000000..7656390 --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/impl/AssessmentCriteriaServiceImpl.java @@ -0,0 +1,215 @@ +package com.changhu.module.assessmentCriteria.service.impl; + +import com.changhu.common.db.enums.SelectType; + +import com.changhu.common.utils.SnowFlakeIdUtil; +import com.changhu.module.assessmentCriteria.pojo.entity.*; +import com.changhu.module.assessmentCriteria.pojo.params.*; +import com.google.common.collect.Lists; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.lang.Dict; +import cn.hutool.core.lang.func.LambdaUtil; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.toolkit.Db; +import com.changhu.common.db.enums.EnterprisesUnitType; +import com.changhu.common.exception.MessageException; +import com.changhu.common.pojo.vo.SelectNodeVo; +import com.changhu.module.assessmentCriteria.mapper.CkProjectMapper; +import com.changhu.module.assessmentCriteria.pojo.queryParams.CkProjectPagerQueryParams; +import com.changhu.module.assessmentCriteria.pojo.vo.AssessmentCriteriaRuleVo; +import com.changhu.module.assessmentCriteria.pojo.vo.CkProjectDetailTableVo; +import com.changhu.module.assessmentCriteria.pojo.vo.CkProjectPagerVo; +import com.changhu.module.assessmentCriteria.service.AssessmentCriteriaService; +import com.changhu.support.mybatisplus.pojo.entity.BaseEntity; +import com.changhu.support.mybatisplus.pojo.params.PageParams; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * @author 20252 + * @createTime 2024/11/6 上午10:08 + * @desc AssessmentCriteriaServiceImpl... + */ +@Service +public class AssessmentCriteriaServiceImpl implements AssessmentCriteriaService { + + @Autowired + private CkProjectMapper ckProjectMapper; + + @Override + public List> assessmentCriteriaListByType(EnterprisesUnitType type) { + return Db.lambdaQuery(CkProject.class).eq(CkProject::getType, type).list() + .stream() + .map(e -> SelectNodeVo.builder() + .value(e.getSnowFlakeId()) + .label(e.getName()) + .extData(Dict.create() + .set(LambdaUtil.getFieldName(CkProject::getRemark), e.getRemark()) + .set(LambdaUtil.getFieldName(CkProject::getTotalScore), e.getTotalScore()) + .set(LambdaUtil.getFieldName(CkProject::getType), e.getType()) + .set(LambdaUtil.getFieldName(CkProject::getCreateTime), e.getCreateTime()) + ) + .build()) + .toList(); + } + + @Override + public List assessmentCriteriaRulesByCkProjectId(Long ckProjectId) { + //根据考核项目拿到考核分组 + List groupList = Db.lambdaQuery(CkGroup.class) + .eq(CkGroup::getCkProjectId, ckProjectId) + .orderByAsc(BaseEntity::getCreateTime) + .list() + .stream() + .map(e -> { + AssessmentCriteriaRuleVo assessmentCriteriaRuleVo = new AssessmentCriteriaRuleVo(); + assessmentCriteriaRuleVo.setSnowFlakeId(e.getSnowFlakeId()); + assessmentCriteriaRuleVo.setName(e.getName()); + assessmentCriteriaRuleVo.setTotalScore(e.getTotalScore()); + assessmentCriteriaRuleVo.setRemark(e.getRemark()); + return assessmentCriteriaRuleVo; + }).toList(); + if (groupList.isEmpty()) { + throw new MessageException("该考核项目内暂未制定规则"); + } + //根据考核分组拿到考核项 + List itemList = Db.lambdaQuery(CkItem.class) + .in(CkItem::getCkGroupId, groupList.stream().map(AssessmentCriteriaRuleVo::getSnowFlakeId).toList()) + .orderByAsc(BaseEntity::getCreateTime) + .list() + .stream() + .map(e -> { + AssessmentCriteriaRuleVo.Item item = new AssessmentCriteriaRuleVo.Item(); + item.setSnowFlakeId(e.getSnowFlakeId()); + item.setCkGroupId(e.getCkGroupId()); + item.setName(e.getName()); + item.setType(e.getType()); + item.setRemark(e.getRemark()); + return item; + }).toList(); + if (itemList.isEmpty()) { + throw new MessageException("该考核项目内未制定考核项"); + } + //根据考核项拿到考核标准 + List standardList = Db.lambdaQuery(CkStandard.class) + .in(CkStandard::getCkItemId, itemList.stream().map(AssessmentCriteriaRuleVo.Item::getSnowFlakeId).toList()) + .orderByAsc(BaseEntity::getCreateTime) + .list().stream() + .map(e -> { + AssessmentCriteriaRuleVo.Standard standard = new AssessmentCriteriaRuleVo.Standard(); + standard.setSnowFlakeId(e.getSnowFlakeId()); + standard.setCkItemId(e.getCkItemId()); + standard.setName(e.getName()); + standard.setDeductionPoints(e.getDeductionPoints()); + return standard; + }).toList(); + if (standardList.isEmpty()) { + throw new MessageException("该考核项目内未制定考核标准"); + } + //先将考核标准塞到考核项内 + Map> standardMap = standardList.stream().collect(Collectors.groupingBy(AssessmentCriteriaRuleVo.Standard::getCkItemId)); + itemList.forEach(e -> e.setStandardList(standardMap.get(e.getSnowFlakeId()))); + //将考核项塞到考核分组内 + Map> itemMap = itemList.stream().collect(Collectors.groupingBy(AssessmentCriteriaRuleVo.Item::getCkGroupId)); + groupList.forEach(e -> e.setItemList(itemMap.get(e.getSnowFlakeId()))); + + return groupList; + } + + @Override + public Page ckProjectPagerVoPager(PageParams queryParams) { + return ckProjectMapper.pager(queryParams.getPage(), queryParams.getParams()); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void saveOrUpdateCkProject(CkProjectSaveOrUpdateParams params) { + boolean b = Db.saveOrUpdate(BeanUtil.copyProperties(params, CkProject.class)); + if (!b) { + throw new MessageException(); + } + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void deleteCkProjectById(Long ckProjectId) { + boolean b = Db.removeById(ckProjectId, CkProject.class); + if (!b) { + throw new MessageException(); + } + } + + @Override + public List ckProjectDetail(Long ckProjectId) { + return ckProjectMapper.ckProjectDetail(ckProjectId); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void saveOrUpdateCkGroup(CkGroupSaveOrUpdateParams params) { + boolean b = Db.saveOrUpdate(BeanUtil.copyProperties(params, CkGroup.class)); + if (!b) { + throw new MessageException(); + } + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void saveOrUpdateCkItem(CkItemSaveOrUpdateParams params) { + boolean b = Db.saveOrUpdate(BeanUtil.copyProperties(params, CkItem.class)); + if (!b) { + throw new MessageException(); + } + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void saveOrUpdateCkStandard(CkStandardSaveOrUpdateParams params) { + boolean b = Db.saveOrUpdate(BeanUtil.copyProperties(params, CkStandard.class)); + if (!b) { + throw new MessageException(); + } + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void submitAssessmentRecord(AssessmentRecordParams params) { + CkAssessmentRecord ckAssessmentRecord = CkAssessmentRecord.builder() + .snowFlakeId(SnowFlakeIdUtil.snowflakeId()) + .enterprisesUnitId(params.getEnterprisesUnitId()) + .ckProjectId(params.getCkProjectId()) + .assessmentUserSignature(params.getAssessmentUserSignature()) + .byAssessmentEnterprisesUnitUserSignature(params.getByAssessmentEnterprisesUnitUserSignature()) + .remark(params.getRemark()) + .build(); + //保存考核记录 + boolean save = Db.save(ckAssessmentRecord); + if (!save) { + throw new MessageException(); + } + List assessmentRecordDetails = params.getAssessmentRecordDetails(); + if (CollUtil.isEmpty(assessmentRecordDetails)) { + return; + } + //保存考核明细 + boolean b = Db.saveBatch(assessmentRecordDetails.stream() + .map(e -> CkAssessmentRecordDetails.builder() + .ckAssessmentRecordId(ckAssessmentRecord.getSnowFlakeId()) + .ckProjectId(ckAssessmentRecord.getCkProjectId()) + .ckGroupId(e.getCkGroupId()) + .ckItemId(e.getCkItemId()) + .ckStandardId(e.getCkStandardId()) + .build()) + .toList()); + if (!b) { + throw new MessageException(); + } + } +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/impl/CkAssessmentRecordDetailsServiceImpl.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/impl/CkAssessmentRecordDetailsServiceImpl.java new file mode 100644 index 0000000..5b8e36a --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/impl/CkAssessmentRecordDetailsServiceImpl.java @@ -0,0 +1,17 @@ +package com.changhu.module.assessmentCriteria.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.changhu.module.assessmentCriteria.mapper.CkAssessmentRecordDetailsMapper; +import com.changhu.module.assessmentCriteria.pojo.entity.CkAssessmentRecordDetails; +import com.changhu.module.assessmentCriteria.service.CkAssessmentRecordDetailsService; +import org.springframework.stereotype.Service; + +/** + * ck_assessment_record_details (考核记录明细) 服务实现类 + * author: luozhun + * desc 由groovy脚本自动生成 + */ +@Service +public class CkAssessmentRecordDetailsServiceImpl extends ServiceImpl implements CkAssessmentRecordDetailsService { + +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/impl/CkAssessmentRecordServiceImpl.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/impl/CkAssessmentRecordServiceImpl.java new file mode 100644 index 0000000..489e736 --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/impl/CkAssessmentRecordServiceImpl.java @@ -0,0 +1,17 @@ +package com.changhu.module.assessmentCriteria.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.changhu.module.assessmentCriteria.mapper.CkAssessmentRecordMapper; +import com.changhu.module.assessmentCriteria.pojo.entity.CkAssessmentRecord; +import com.changhu.module.assessmentCriteria.service.CkAssessmentRecordService; +import org.springframework.stereotype.Service; + +/** + * ck_assessment_record (考核记录) 服务实现类 + * author: luozhun + * desc 由groovy脚本自动生成 + */ +@Service +public class CkAssessmentRecordServiceImpl extends ServiceImpl implements CkAssessmentRecordService { + +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/impl/CkGroupServiceImpl.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/impl/CkGroupServiceImpl.java new file mode 100644 index 0000000..fb5e43b --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/impl/CkGroupServiceImpl.java @@ -0,0 +1,17 @@ +package com.changhu.module.assessmentCriteria.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.changhu.module.assessmentCriteria.mapper.CkGroupMapper; +import com.changhu.module.assessmentCriteria.pojo.entity.CkGroup; +import com.changhu.module.assessmentCriteria.service.CkGroupService; +import org.springframework.stereotype.Service; + +/** + * ck_group (考核组) 服务实现类 + * author: luozhun + * desc 由groovy脚本自动生成 + */ +@Service +public class CkGroupServiceImpl extends ServiceImpl implements CkGroupService { + +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/impl/CkItemServiceImpl.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/impl/CkItemServiceImpl.java new file mode 100644 index 0000000..f89df12 --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/impl/CkItemServiceImpl.java @@ -0,0 +1,17 @@ +package com.changhu.module.assessmentCriteria.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.changhu.module.assessmentCriteria.mapper.CkItemMapper; +import com.changhu.module.assessmentCriteria.pojo.entity.CkItem; +import com.changhu.module.assessmentCriteria.service.CkItemService; +import org.springframework.stereotype.Service; + +/** + * ck_item (分组内的考核项) 服务实现类 + * author: luozhun + * desc 由groovy脚本自动生成 + */ +@Service +public class CkItemServiceImpl extends ServiceImpl implements CkItemService { + +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/impl/CkProjectServiceImpl.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/impl/CkProjectServiceImpl.java new file mode 100644 index 0000000..660fc01 --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/impl/CkProjectServiceImpl.java @@ -0,0 +1,17 @@ +package com.changhu.module.assessmentCriteria.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.changhu.module.assessmentCriteria.mapper.CkProjectMapper; +import com.changhu.module.assessmentCriteria.pojo.entity.CkProject; +import com.changhu.module.assessmentCriteria.service.CkProjectService; +import org.springframework.stereotype.Service; + +/** + * ck_project (考核项目) 服务实现类 + * author: luozhun + * desc 由groovy脚本自动生成 + */ +@Service +public class CkProjectServiceImpl extends ServiceImpl implements CkProjectService { + +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/impl/CkStandardServiceImpl.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/impl/CkStandardServiceImpl.java new file mode 100644 index 0000000..16d8dc1 --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/service/impl/CkStandardServiceImpl.java @@ -0,0 +1,17 @@ +package com.changhu.module.assessmentCriteria.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.changhu.module.assessmentCriteria.mapper.CkStandardMapper; +import com.changhu.module.assessmentCriteria.pojo.entity.CkStandard; +import com.changhu.module.assessmentCriteria.service.CkStandardService; +import org.springframework.stereotype.Service; + +/** + * ck_standard (扣分标准) 服务实现类 + * author: luozhun + * desc 由groovy脚本自动生成 + */ +@Service +public class CkStandardServiceImpl extends ServiceImpl implements CkStandardService { + +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/entity/EnterprisesUnit.java b/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/entity/EnterprisesUnit.java index 8569927..b5f5b6a 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/entity/EnterprisesUnit.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/entity/EnterprisesUnit.java @@ -3,6 +3,7 @@ package com.changhu.module.management.pojo.entity; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.extension.handlers.Fastjson2TypeHandler; +import com.changhu.common.db.enums.EnterprisesUnitType; import com.changhu.module.management.pojo.model.ContactPersonInfo; import com.changhu.support.mybatisplus.pojo.entity.BaseEntity; import lombok.AllArgsConstructor; @@ -41,6 +42,12 @@ public class EnterprisesUnit extends BaseEntity implements Serializable { */ private String name; + + /** + * 企事业单位类型 + */ + private EnterprisesUnitType type; + /** * 省 */ diff --git a/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/params/EnterprisesUnitSaveOrUpdateParams.java b/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/params/EnterprisesUnitSaveOrUpdateParams.java index 94a6ed6..7751ec3 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/params/EnterprisesUnitSaveOrUpdateParams.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/params/EnterprisesUnitSaveOrUpdateParams.java @@ -1,5 +1,6 @@ package com.changhu.module.management.pojo.params; +import com.changhu.common.db.enums.EnterprisesUnitType; import com.changhu.module.management.pojo.model.ContactPersonInfo; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; @@ -28,6 +29,10 @@ public class EnterprisesUnitSaveOrUpdateParams { @NotBlank(message = "名称不能为空") private String name; + @Schema(description = "类型") + @NotNull(message = "类型不能为空") + private EnterprisesUnitType type; + @Schema(description = "行政区划编码") @NotEmpty(message = "行政区划不能为空") private List administrativeDivisionCodes; diff --git a/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/vo/EnterprisesUnitPagerVo.java b/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/vo/EnterprisesUnitPagerVo.java index 29a3406..6fac384 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/vo/EnterprisesUnitPagerVo.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/vo/EnterprisesUnitPagerVo.java @@ -1,5 +1,6 @@ package com.changhu.module.management.pojo.vo; +import com.changhu.common.db.enums.EnterprisesUnitType; import com.changhu.module.management.pojo.model.ContactPersonInfo; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; @@ -16,6 +17,9 @@ public class EnterprisesUnitPagerVo { @Schema(description = "名字") private String name; + @Schema(description = "类型") + private EnterprisesUnitType type; + @Schema(description = "公安单位id") private Long policeUnitId; diff --git a/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/controller/PoliceIndexController.java b/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/controller/PoliceIndexController.java index 7c2c0bc..bc8af47 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/controller/PoliceIndexController.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/controller/PoliceIndexController.java @@ -3,6 +3,8 @@ package com.changhu.module.miniProgram.controller; import com.changhu.common.annotation.CheckUserType; import com.changhu.common.annotation.JsonBody; import com.changhu.common.annotation.UserType; +import com.changhu.common.pojo.vo.SelectNodeVo; +import com.changhu.module.miniProgram.pojo.vo.IndexDataStatisticsVo; import com.changhu.module.miniProgram.pojo.vo.IndexServiceProjectListVo; import com.changhu.module.miniProgram.service.MPoliceService; import io.swagger.v3.oas.annotations.Operation; @@ -26,10 +28,24 @@ public class PoliceIndexController { @Autowired private MPoliceService policeIndexService; + @Operation(summary = "首页数据统计") + @GetMapping("/dataStatistics") + @CheckUserType(userTypes = UserType.MINI_PROGRAM_POLICE) + public IndexDataStatisticsVo dataStatistics() { + return policeIndexService.dataStatistics(); + } + @Operation(summary = "获取单位内的服务项目") @GetMapping("/getUnitServiceProjectList") @CheckUserType(userTypes = UserType.MINI_PROGRAM_POLICE) public List getUnitServiceProjectList() { return policeIndexService.getUnitServiceProjectList(); } + + @Operation(summary = "获取单位内的企事业单位列表") + @GetMapping("/getUnitEnterprisesUnitList") + @CheckUserType(userTypes = UserType.MINI_PROGRAM_POLICE) + public List> getUnitEnterprisesUnitList() { + return policeIndexService.getUnitEnterprisesUnitList(); + } } diff --git a/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/pojo/vo/IndexDataStatisticsVo.java b/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/pojo/vo/IndexDataStatisticsVo.java new file mode 100644 index 0000000..5de0f7a --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/pojo/vo/IndexDataStatisticsVo.java @@ -0,0 +1,21 @@ +package com.changhu.module.miniProgram.pojo.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +/** + * @author 20252 + * @createTime 2024/11/7 下午2:23 + * @desc IndexDataStatisticsVo... + */ +@Data +public class IndexDataStatisticsVo { + @Schema(description = "企事业单位数量") + private Integer enterprisesUnitCount = 0; + @Schema(description = "服务项目数量") + private Integer serviceProjectCount = 0; + @Schema(description = "保安人员数量") + private Integer securityUserCount = 0; + @Schema(description = "无证保安人员数量") + private Integer noCardSecurityUserCount = 0; +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/pojo/vo/IndexServiceProjectListVo.java b/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/pojo/vo/IndexServiceProjectListVo.java index ec5e49d..c265925 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/pojo/vo/IndexServiceProjectListVo.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/pojo/vo/IndexServiceProjectListVo.java @@ -1,6 +1,7 @@ package com.changhu.module.miniProgram.pojo.vo; import cn.hutool.core.lang.Dict; +import com.changhu.common.db.enums.EnterprisesUnitType; import com.changhu.common.db.enums.IsOrNot; import com.changhu.common.db.enums.ServiceProjectType; import com.changhu.module.management.pojo.model.ContactPersonInfo; @@ -21,6 +22,8 @@ public class IndexServiceProjectListVo { private Long snowFlakeId; @Schema(description = "企事业单位名称") private String name; + @Schema(description = "单位类型") + private EnterprisesUnitType type; @Schema(description = "省编码") private String province; @@ -53,10 +56,15 @@ public class IndexServiceProjectListVo { static class ServiceProjectVo { @Schema(description = "服务项目id") private Long snowFlakeId; + @Schema(description = "保安单位id") private Long securityUnitId; + @Schema(description = "保安单位名字") + private String securityUnitName; + @Schema(description = "项目经理信息") private Dict projectManagerMiniProgramUserInfo; + @Schema(description = "服务项目名称") private String name; @Schema(description = "服务项目类型") diff --git a/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/service/MPoliceService.java b/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/service/MPoliceService.java index 60954f9..43ed4ac 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/service/MPoliceService.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/service/MPoliceService.java @@ -1,5 +1,7 @@ package com.changhu.module.miniProgram.service; +import com.changhu.common.pojo.vo.SelectNodeVo; +import com.changhu.module.miniProgram.pojo.vo.IndexDataStatisticsVo; import com.changhu.module.miniProgram.pojo.vo.IndexServiceProjectListVo; import java.util.List; @@ -10,10 +12,26 @@ import java.util.List; * @desc MPoliceService... */ public interface MPoliceService { + + /** + * 首页数据统计 + * + * @return 首页数据统计 + */ + IndexDataStatisticsVo dataStatistics(); + /** * 获取单位内的服务项目 * * @return 服务项目 */ List getUnitServiceProjectList(); + + /** + * 获取单位内的企事业单位列表 + * + * @return 企事业单位列表 + */ + List> getUnitEnterprisesUnitList(); + } diff --git a/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/service/impl/MPoliceServiceImpl.java b/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/service/impl/MPoliceServiceImpl.java index d8ec8b6..1877493 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/service/impl/MPoliceServiceImpl.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/miniProgram/service/impl/MPoliceServiceImpl.java @@ -1,9 +1,18 @@ package com.changhu.module.miniProgram.service.impl; +import cn.hutool.core.lang.Dict; +import cn.hutool.core.lang.func.LambdaUtil; +import com.baomidou.mybatisplus.extension.toolkit.Db; +import com.changhu.common.pojo.vo.SelectNodeVo; import com.changhu.common.utils.UserUtil; import com.changhu.module.management.mapper.ServiceProjectMapper; +import com.changhu.module.management.pojo.entity.EnterprisesUnit; +import com.changhu.module.management.pojo.entity.ServiceProject; +import com.changhu.module.miniProgram.pojo.entity.SecurityUser; +import com.changhu.module.miniProgram.pojo.vo.IndexDataStatisticsVo; import com.changhu.module.miniProgram.pojo.vo.IndexServiceProjectListVo; import com.changhu.module.miniProgram.service.MPoliceService; +import com.changhu.support.mybatisplus.pojo.entity.BaseEntity; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -20,8 +29,61 @@ public class MPoliceServiceImpl implements MPoliceService { @Autowired private ServiceProjectMapper serviceProjectMapper; + @Override + public IndexDataStatisticsVo dataStatistics() { + Long unitId = UserUtil.getUnitId(); + IndexDataStatisticsVo indexDataStatisticsVo = new IndexDataStatisticsVo(); + List enterprisesUnitIds = Db.lambdaQuery(EnterprisesUnit.class) + .eq(EnterprisesUnit::getPoliceUnitId, unitId) + .list() + .stream().map(BaseEntity::getSnowFlakeId) + .toList(); + if (enterprisesUnitIds.isEmpty()) { + return indexDataStatisticsVo; + } + indexDataStatisticsVo.setEnterprisesUnitCount(enterprisesUnitIds.size()); + + List serviceProjectIds = Db.lambdaQuery(ServiceProject.class) + .in(ServiceProject::getEnterprisesUnitId, enterprisesUnitIds) + .list() + .stream() + .map(BaseEntity::getSnowFlakeId) + .toList(); + if (serviceProjectIds.isEmpty()) { + return indexDataStatisticsVo; + } + indexDataStatisticsVo.setServiceProjectCount(serviceProjectIds.size()); + + Long securityUserCount = Db.lambdaQuery(SecurityUser.class) + .in(SecurityUser::getServiceProjectId, serviceProjectIds) + .count(); + indexDataStatisticsVo.setSecurityUserCount(securityUserCount.intValue()); + + Long noCardSecurityUserCount = Db.lambdaQuery(SecurityUser.class) + .in(SecurityUser::getServiceProjectId, serviceProjectIds) + .isNull(SecurityUser::getSecurityNumber) + .count(); + indexDataStatisticsVo.setNoCardSecurityUserCount(noCardSecurityUserCount.intValue()); + + return indexDataStatisticsVo; + } + @Override public List getUnitServiceProjectList() { return serviceProjectMapper.getServiceProjectList(UserUtil.getUnitId(), null); } + + @Override + public List> getUnitEnterprisesUnitList() { + return Db.lambdaQuery(EnterprisesUnit.class) + .eq(EnterprisesUnit::getPoliceUnitId, UserUtil.getUnitId()) + .list() + .stream() + .map(item -> SelectNodeVo.builder() + .value(item.getSnowFlakeId()) + .label(item.getName()) + .extData(Dict.of(LambdaUtil.getFieldName(EnterprisesUnit::getType), item.getType())) + .build()) + .toList(); + } } diff --git a/policeSecurityServer/src/main/resources/conf/log4j2.xml b/policeSecurityServer/src/main/resources/conf/log4j2.xml index e08488c..4b6a1a2 100644 --- a/policeSecurityServer/src/main/resources/conf/log4j2.xml +++ b/policeSecurityServer/src/main/resources/conf/log4j2.xml @@ -131,6 +131,9 @@ + + + diff --git a/policeSecurityServer/src/main/resources/mapper/CkProjectMapper.xml b/policeSecurityServer/src/main/resources/mapper/CkProjectMapper.xml new file mode 100644 index 0000000..582f133 --- /dev/null +++ b/policeSecurityServer/src/main/resources/mapper/CkProjectMapper.xml @@ -0,0 +1,37 @@ + + + + + + \ No newline at end of file diff --git a/policeSecurityServer/src/main/resources/mapper/ServiceProjectMapper.xml b/policeSecurityServer/src/main/resources/mapper/ServiceProjectMapper.xml index dbe90f9..3a5505a 100644 --- a/policeSecurityServer/src/main/resources/mapper/ServiceProjectMapper.xml +++ b/policeSecurityServer/src/main/resources/mapper/ServiceProjectMapper.xml @@ -49,6 +49,7 @@ JSON_ARRAYAGG(JSON_OBJECT( 'snowFlakeId', sp.snow_flake_id, 'securityUnitId',sp.security_unit_id, + 'securityUnitName',su.name, 'name', sp.name, 'type', sp.type, 'isRecruitSecurity', sp.is_recruit_security, @@ -65,6 +66,7 @@ 'remark', sp.remark)) as 'service_project_list' from enterprises_unit eu join service_project sp on eu.snow_flake_id = sp.enterprises_unit_id and sp.delete_flag = 0 + left join security_unit su on sp.security_unit_id = su.snow_flake_id and su.delete_flag = 0 left join mini_program_user mpu on sp.project_manager_mini_program_user_id = mpu.snow_flake_id and mpu.delete_flag = 0 left join administrative_division ad1 on eu.province = ad1.code and ad1.delete_flag = 0 left join administrative_division ad2 on eu.city = ad2.code and ad2.delete_flag = 0 diff --git a/superManagement/.env.development b/superManagement/.env.development index 4d6d879..e416923 100644 --- a/superManagement/.env.development +++ b/superManagement/.env.development @@ -14,3 +14,7 @@ VITE_APP_RSA_PUBLIC_KEY=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDJps/EXxxSpEM1Ix4R # minio VITE_APP_MINIO_URL=http://118.253.177.137:9000 VITE_APP_MINIO_BUCKET=police-security-dev + +# 高德 +VITE_APP_GAODE_KEY=f379a3f860a68d7438526275d6a94b05 +VITE_APP_GAODE_VERSION=2.0 diff --git a/superManagement/.env.production b/superManagement/.env.production index 71171e8..70b36e1 100644 --- a/superManagement/.env.production +++ b/superManagement/.env.production @@ -14,3 +14,7 @@ VITE_APP_RSA_PUBLIC_KEY=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCpu1C3JHZ+Ng/eVVCZ # minio VITE_APP_MINIO_URL=https://www.hnjinglian.cn:9002 VITE_APP_MINIO_BUCKET=police-security + +# 高德 +VITE_APP_GAODE_KEY=f379a3f860a68d7438526275d6a94b05 +VITE_APP_GAODE_VERSION=2.0 diff --git a/superManagement/package.json b/superManagement/package.json index 6a8d6e4..882b02e 100644 --- a/superManagement/package.json +++ b/superManagement/package.json @@ -10,6 +10,7 @@ "preview": "vite preview" }, "dependencies": { + "@amap/amap-jsapi-loader": "^1.0.1", "@vueuse/core": "^11.0.3", "ant-design-vue": "^4.2.3", "axios": "^1.7.5", @@ -24,6 +25,7 @@ "vue-uuid": "^3.0.0" }, "devDependencies": { + "@amap/amap-jsapi-types": "^0.0.15", "@types/lodash-es": "^4.17.8", "@types/node": "^22.5.1", "@vitejs/plugin-vue": "^5.1.2", diff --git a/superManagement/src/components/aMap/MapContainer.vue b/superManagement/src/components/aMap/MapContainer.vue new file mode 100644 index 0000000..d637e87 --- /dev/null +++ b/superManagement/src/components/aMap/MapContainer.vue @@ -0,0 +1,57 @@ + + + + + diff --git a/superManagement/src/components/layout/MenuItem.vue b/superManagement/src/components/layout/MenuItem.vue index feb26ca..6323222 100644 --- a/superManagement/src/components/layout/MenuItem.vue +++ b/superManagement/src/components/layout/MenuItem.vue @@ -19,7 +19,6 @@ > {{ item.title }} diff --git a/superManagement/src/components/tree/AdministrativeDivisionTree.vue b/superManagement/src/components/tree/AdministrativeDivisionTree.vue index c6a45f4..3822dfd 100644 --- a/superManagement/src/components/tree/AdministrativeDivisionTree.vue +++ b/superManagement/src/components/tree/AdministrativeDivisionTree.vue @@ -1,11 +1,9 @@ @@ -14,18 +12,14 @@ import api from "@/axios"; import {onMounted, ref} from "vue"; import {CascaderProps} from "ant-design-vue"; import {isEmpty} from "lodash-es"; +import {AdministrativeDivisionTreeProps} from "@/types/components/tree"; -withDefaults(defineProps<{ - placeholder?: string, - changeOnSelect?: boolean - allowClear?: boolean -}>(), { +const props = withDefaults(defineProps(), { placeholder: '请选择行政区划', changeOnSelect: true, - allowClear: true + allowClear: true, }) - const modelValue = defineModel('value', { default: [] }) diff --git a/superManagement/src/config/dict.ts b/superManagement/src/config/dict.ts index 7175c25..ed69da7 100644 --- a/superManagement/src/config/dict.ts +++ b/superManagement/src/config/dict.ts @@ -8,6 +8,8 @@ type DictType = | 'Sex' | 'ServiceProjectType' | 'MiniProgramUserIdentity' + | 'EnterprisesUnitType' + | 'SelectType' export const initDict = () => { api.get[]>>('/common/enums').then(resp => { diff --git a/superManagement/src/config/index.ts b/superManagement/src/config/index.ts index 3494115..93fcb7f 100644 --- a/superManagement/src/config/index.ts +++ b/superManagement/src/config/index.ts @@ -21,13 +21,23 @@ export const SYSTEM_MENUS: SystemMenu[] = [ type: 'dir', children: [ { - title: '公安单位', - name: 'policeUnit', - path: '/policeUnit', - type: 'menu', - // icon: 'icon-policeman-full', - // size: '16', - component: () => import('@/views/unitManage/policeUnit/index.vue') + title: '公安', + name: 'police', + path: '/police', + type: 'dir', + children: [{ + title: '单位管理', + name: 'policeUnitManage', + path: '/police/unitManage', + type: 'menu', + component: () => import('@/views/unitManage/police/unitManage/index.vue') + }, { + title: '考核标准', + name: 'policeAssessmentCriteria', + path: '/police/assessmentCriteria', + type: 'menu', + component: () => import('@/views/unitManage/police/assessmentCriteria/index.vue') + }] }, { title: '保安单位', name: 'securityUnit', @@ -36,5 +46,12 @@ export const SYSTEM_MENUS: SystemMenu[] = [ component: () => import('@/views/unitManage/securityUnit/index.vue') } ] + }, { + title: '数据总览', + name: 'dataOverview', + path: '/dataOverview', + type: 'menu', + isFull: true, + component: () => import('@/views/data/dataOverview.vue') } ] diff --git a/superManagement/src/main.ts b/superManagement/src/main.ts index fc498ba..27927ba 100644 --- a/superManagement/src/main.ts +++ b/superManagement/src/main.ts @@ -13,6 +13,8 @@ import router from "@/router"; // pinia stores import pinia from "@/stores"; import {initDict} from "@/config/dict.ts"; +//高德类型声明文件 +import "@amap/amap-jsapi-types"; initDict(); diff --git a/superManagement/src/router/staticRouters.ts b/superManagement/src/router/staticRouters.ts index 70c4ab1..a4e2afe 100644 --- a/superManagement/src/router/staticRouters.ts +++ b/superManagement/src/router/staticRouters.ts @@ -2,33 +2,47 @@ import {RouteRecordRaw} from "vue-router"; import {SYSTEM_MENUS} from "@/config"; import {SystemMenu} from "@/types/config"; +const routerClassify: Record<'layout' | 'full', RouteRecordRaw[]> = { + layout: [], + full: [] +} + /** * 提取菜单路由 */ -const extractMenuToRouter = (): RouteRecordRaw[] => { - const result: RouteRecordRaw[] = [] +const extractMenuToRouter = () => { const traverse = (data: SystemMenu[]) => { data.forEach(item => { if (item.type === 'dir' && item.children && item.children.length > 0) { traverse(item.children) } else { - result.push({ - path: item.path, - name: item.name, - meta: { - title: item.title - }, - component: item.component - } as RouteRecordRaw) + if (!item.isFull) { + routerClassify.layout.push({ + path: item.path, + name: item.name, + meta: { + title: item.title + }, + component: item.component + } as RouteRecordRaw) + } else { + routerClassify.full.push({ + path: item.path, + name: item.name, + meta: { + title: item.title + }, + component: item.component + } as RouteRecordRaw) + } } }) } - traverse(SYSTEM_MENUS) - - return result; } +extractMenuToRouter() + export const staticRouter: RouteRecordRaw[] = [ { path: '/login', @@ -45,8 +59,10 @@ export const staticRouter: RouteRecordRaw[] = [ name: 'layout', redirect: '/index', component: () => import("@/components/layout/Layout.vue"), - children: extractMenuToRouter() - }, { + children: routerClassify.layout + }, + ...routerClassify.full, + { path: '/test', name: 'test', component: () => import("@/views/test.vue"), diff --git a/superManagement/src/types/components/tree/index.ts b/superManagement/src/types/components/tree/index.ts new file mode 100644 index 0000000..8b14928 --- /dev/null +++ b/superManagement/src/types/components/tree/index.ts @@ -0,0 +1,7 @@ +export interface AdministrativeDivisionTreeProps { + placeholder?: string, + changeOnSelect?: boolean + allowClear?: boolean + onChange?: (value: (string | number[]), selectedOptions: TreeNodeVo[]) => void + displayRender?: (opt: { labels: string[], selectedOptions: TreeNodeVo[] }) => string +} diff --git a/superManagement/src/types/config/index.ts b/superManagement/src/types/config/index.ts index f81e2db..f9c23a8 100644 --- a/superManagement/src/types/config/index.ts +++ b/superManagement/src/types/config/index.ts @@ -4,6 +4,7 @@ export interface SystemMenu { type: 'dir' | 'menu'; title: string; path: string; + isFull?: boolean; name: string; icon?: string; diff --git a/superManagement/src/types/views/unitManage/police/assessmentCriteria.ts b/superManagement/src/types/views/unitManage/police/assessmentCriteria.ts new file mode 100644 index 0000000..206ea15 --- /dev/null +++ b/superManagement/src/types/views/unitManage/police/assessmentCriteria.ts @@ -0,0 +1,90 @@ +import {BaseTableRowRecord} from "@/types/components/table"; + +export interface CkProjectPagerVo extends BaseTableRowRecord { + name: string; + type: BaseEnum + totalScore: number + remark: string; +} + +export interface CkProjectPagerQueryParams { + name: string; + type: string +} + +export interface SaveOrUpdateCkProjectParams { + /*考核项目id */ + snowFlakeId?: string; + /*考核项目名称 */ + name: string; + /*对应企事业单位类型,可用值:school,hospital,community,bank */ + type: string; + /*考核总分 */ + totalScore: number; + /*备注 */ + remark?: string; +} + +export interface SaveOrUpdateCkGroupParams { + /*考核分组id */ + snowFlakeId?: string; + /*考核项目id */ + ckProjectId?: string; + /*考核组名称 */ + name: string; + /*考核组总分 */ + totalScore: number; + /*备注 */ + remark?: string; +} + +export interface SaveOrUpdateCkItemParams { + /*id */ + snowFlakeId?: string; + /*考核组id */ + ckGroupId: string; + /*考核项名称 */ + name: string; + /*组件类型,可用值:RADIO,MULTIPLE */ + type: string; + /*备注 */ + remark?: string; +} + +export interface SaveOrUpdateCkStandardParams { + /*考核标准id */ + snowFlakeId?: string; + /*考核项id */ + ckItemId: string; + /*标准名 */ + name: string; + /*扣分值 */ + deductionPoints: number; +} + +export interface CkProjectDetailRes { + /*考核分组id */ + ckGroupId: string; + groupRowSpan: number; + /*考核分组名字 */ + groupName: string; + /*考核分组总分 */ + groupTotalScore: number; + /*考核分组备注 */ + groupRemark: string; + /*考核项id */ + ckItemId: string; + itemRowSpan: number; + /*考核项名字 */ + itemName: string; + /*考核项备注 */ + itemRemark: string; + /*考核标准id */ + ckStandardId: string; + /*考核标准条件 */ + standardName: string; + /*扣分数 */ + deductionPoints: number; + /*选择类型,可用值:RADIO,MULTIPLE */ + type: BaseEnum; +} diff --git a/superManagement/src/types/views/unitManage/policeUnit.ts b/superManagement/src/types/views/unitManage/police/policeUnit.ts similarity index 97% rename from superManagement/src/types/views/unitManage/policeUnit.ts rename to superManagement/src/types/views/unitManage/police/policeUnit.ts index ce0e7ec..c3bdb3b 100644 --- a/superManagement/src/types/views/unitManage/policeUnit.ts +++ b/superManagement/src/types/views/unitManage/police/policeUnit.ts @@ -55,6 +55,7 @@ export interface EnterprisesUnitPagerQueryParams { export interface EnterprisesUnitPagerVo extends BaseTableRowRecord { /** 名字 **/ name?: string; + type: BaseEnum /** 公安单位id **/ policeUnitId: string; /** 省编码 **/ @@ -91,6 +92,8 @@ export interface EnterprisesUnitSaveOrUpdateParams { policeUnitId: string; /** 名称 **/ name: string; + /** 类型 **/ + type: string; /** 行政区划编码 **/ administrativeDivisionCodes: string[]; /** 详细地址 **/ diff --git a/superManagement/src/utils/aMapUtil.ts b/superManagement/src/utils/aMapUtil.ts new file mode 100644 index 0000000..574e061 --- /dev/null +++ b/superManagement/src/utils/aMapUtil.ts @@ -0,0 +1,18 @@ +import AMapLoader from "@amap/amap-jsapi-loader"; + +type Amap = typeof AMap; +export const initMap = (plugins?: string[]): Promise => new Promise((resolve, reject) => { + //@ts-ignore + window._AMapSecurityConfig = { + securityJsCode: '432125a0f8d8cad2dac38b77d6f6728f' + } + AMapLoader.load({ + key: __APP_ENV.VITE_APP_GAODE_KEY, + version: __APP_ENV.VITE_APP_GAODE_VERSION, + plugins + }).then((AMap: Amap) => { + resolve(AMap) + }).catch(err => { + reject(err) + }) +}) diff --git a/superManagement/src/views/data/dataOverview.vue b/superManagement/src/views/data/dataOverview.vue new file mode 100644 index 0000000..2383d4d --- /dev/null +++ b/superManagement/src/views/data/dataOverview.vue @@ -0,0 +1,13 @@ + + + + + diff --git a/superManagement/src/views/test.vue b/superManagement/src/views/test.vue index 0ada657..3b996ad 100644 --- a/superManagement/src/views/test.vue +++ b/superManagement/src/views/test.vue @@ -1,13 +1,41 @@ + - - diff --git a/superManagement/src/views/unitManage/police/assessmentCriteria/index.ts b/superManagement/src/views/unitManage/police/assessmentCriteria/index.ts new file mode 100644 index 0000000..beb5e85 --- /dev/null +++ b/superManagement/src/views/unitManage/police/assessmentCriteria/index.ts @@ -0,0 +1,188 @@ +import { + CkProjectDetailRes, + SaveOrUpdateCkGroupParams, + SaveOrUpdateCkItemParams, SaveOrUpdateCkProjectParams, SaveOrUpdateCkStandardParams +} from "@/types/views/unitManage/police/assessmentCriteria.ts"; +import {deleteDataModal, submitSimpleFormModal} from "@/components/tsx/ModalPro.tsx"; +import api from "@/axios"; +import {message} from "ant-design-vue"; +import {dictSelectNodes} from "@/config/dict.ts"; + +export const saveOrUpdateCkProject = (params: SaveOrUpdateCkProjectParams = { + name: '', + totalScore: 100, + remark: '', + type: 'school' +}, callback: Function) => { + submitSimpleFormModal({ + title: params.snowFlakeId ? `编辑【${params.name}】` : '添加考核项目', + formParams: params, + formOptions: { + name: { + type: 'input', + label: '考核项目名称', + required: true + }, + type: { + type: 'select', + label: '考核类型', + required: true, + options: dictSelectNodes('EnterprisesUnitType') + }, + totalScore: { + type: 'inputNumber', + label: '总分', + required: true, + componentsProps: { + precision: 0 + } + }, + remark: { + type: 'inputTextArea', + label: '备注' + } + }, + submit: async (params) => { + const resp = await api.post('/assessmentCriteria/saveOrUpdateCkProject', params) + message.success(resp.message) + callback && callback() + } + }) +} + +export const deleteCkProjectById = (name: string, ckProjectId: string, callback: Function) => { + deleteDataModal(name, async () => { + const resp = await api.delete('/assessmentCriteria/deleteCkProjectById', { + ckProjectId + }) + message.success(resp.message) + callback && callback(); + }) +} + +export const ckProjectDetail = async (ckProjectId: string): Promise => { + const {data} = await api.get('/assessmentCriteria/ckProjectDetail', {ckProjectId}) + + const groupRowSpan: Record = {} + const itemRowSpan: Record = {} + + data.forEach((item, index) => { + //如果第一次没有值 + if (item.ckGroupId) { + if (!groupRowSpan[item.ckGroupId]) { + groupRowSpan[item.ckGroupId] = {count: 1, firstIndex: index} + } else { + groupRowSpan[item.ckGroupId].count++; + data[index].groupRowSpan = 0 + } + } + + if (item.ckItemId) { + if (!itemRowSpan[item.ckItemId]) { + itemRowSpan[item.ckItemId] = {count: 1, firstIndex: index} + } else { + itemRowSpan[item.ckItemId].count++; + data[index].itemRowSpan = 0 + } + } + }) + + Object.values(groupRowSpan).forEach(({count, firstIndex}) => { + data[firstIndex].groupRowSpan = count; + }) + + Object.values(itemRowSpan).forEach(({count, firstIndex}) => { + data[firstIndex].itemRowSpan = count; + }) + + return data +} + +export const saveOrUpdateCkGroup = (params: SaveOrUpdateCkGroupParams, callback: Function) => { + submitSimpleFormModal({ + title: params.snowFlakeId ? `编辑【${params.name}】` : '添加考核分组', + formParams: params, + formOptions: { + name: { + type: 'input', + label: '分组名字', + required: true + }, + totalScore: { + type: 'inputNumber', + label: '分组总分', + required: true, + componentsProps: { + precision: 0 + } + }, + remark: { + type: 'inputTextArea', + label: '备注' + } + }, + submit: async (params) => { + const resp = await api.post('/assessmentCriteria/saveOrUpdateCkGroup', params) + message.success(resp.message) + callback && callback() + } + }) +} + +export const saveOrUpdateCkItem = (params: SaveOrUpdateCkItemParams, callback: Function) => { + submitSimpleFormModal({ + title: params.snowFlakeId ? `编辑【${params.name}】` : '添加考核项', + formParams: params, + formOptions: { + name: { + type: 'input', + label: '考核项', + required: true + }, + type: { + type: 'radioGroup', + label: '控件类型', + required: true, + options: dictSelectNodes('SelectType') + }, + remark: { + type: 'inputTextArea', + label: '备注' + } + }, + submit: async (params) => { + const resp = await api.post('/assessmentCriteria/saveOrUpdateCkItem', params) + message.success(resp.message) + callback && callback() + } + }) +} + +export const saveOrUpdateCkStandard = (params: SaveOrUpdateCkStandardParams, callback: Function) => { + submitSimpleFormModal({ + title: params.snowFlakeId ? `编辑【${params.name}】` : '添加考核标准', + formParams: params, + formOptions: { + name: { + type: 'input', + label: '标准', + required: true + }, + deductionPoints: { + type: 'inputNumber', + label: '扣分值', + required: true, + componentsProps: { + precision: 1 + } + } + }, + submit: async (params) => { + const resp = await api.post('/assessmentCriteria/saveOrUpdateCkStandard', params) + message.success(resp.message) + callback && callback() + } + }) +} + + diff --git a/superManagement/src/views/unitManage/police/assessmentCriteria/index.vue b/superManagement/src/views/unitManage/police/assessmentCriteria/index.vue new file mode 100644 index 0000000..12f2aef --- /dev/null +++ b/superManagement/src/views/unitManage/police/assessmentCriteria/index.vue @@ -0,0 +1,284 @@ + + + + + diff --git a/superManagement/src/views/unitManage/police/unitManage/index.tsx b/superManagement/src/views/unitManage/police/unitManage/index.tsx new file mode 100644 index 0000000..1b615cc --- /dev/null +++ b/superManagement/src/views/unitManage/police/unitManage/index.tsx @@ -0,0 +1,226 @@ +import {TableProMaxProps, TableProMaxSlots} from "@/types/components/table"; +import { + EnterprisesUnitPagerQueryParams, + EnterprisesUnitPagerVo, EnterprisesUnitSaveOrUpdateParams, + PoliceUnitPagerVo +} from "@/types/views/unitManage/police/policeUnit.ts"; +import {ref} from "vue"; +import {FormExpose} from "ant-design-vue/es/form/Form"; +import {ComponentExposed} from "vue-component-type-helpers"; +import MapContainer from "@/components/aMap/MapContainer.vue"; +import {FormProMaxItemOptions} from "@/types/components/form"; +import {dictSelectNodes} from "@/config/dict.ts"; +import {Button, message, Modal, Space} from "ant-design-vue"; +import api from "@/axios"; +import TableProMax from "@/components/table/TableProMax.vue"; +import {deleteDataModal} from "@/components/tsx/ModalPro.tsx"; +import {PageParams} from "@/types/hooks/useTableProMax.ts"; +import FormProMax from "@/components/form/FormProMax.vue"; + +type _TableProps = TableProMaxProps; +type _FormType = EnterprisesUnitSaveOrUpdateParams & { + contactPersonInfoName?: string; + contactPersonInfoTelephone?: string +} +const saveOrUpdateEnterprisesUnit = (params: _FormType, callback: Function) => { + const _formRef = ref(null) + const _mapRef = ref>(null) + const _formParams = ref<_FormType>({...params}) + + let city = ''; + + const _formOptions = ref>({ + name: { + type: 'input', + label: '单位名称', + required: true, + }, + type: { + type: 'select', + label: '单位类型', + required: true, + options: dictSelectNodes('EnterprisesUnitType') + }, + administrativeDivisionCodes: { + type: 'administrativeDivisionTree', + label: '行政区划', + required: true, + componentsProps: { + displayRender: ({labels}): string => { + city = labels[0] + return labels.join(' / '); + } + } + }, + address: { + type: 'inputTextArea', + label: '详细地址', + }, + map: { + type: 'custom', + label: '经纬度', + customRender: () => { + AMap.plugin(['AMap.AutoComplete'], () => { + //@ts-ignore + const auto = new AMap.AutoComplete({ + city, + input: "tipinput" + }); + //注册监听,当选中某条记录时会触发 + auto.on("select", (e) => { + //有些点位可能没有经纬度信息 + if (!e.poi.location) { + message.error('所选点位没有经纬度信息 建议选则附近的手动移动!'); + return + } + //添加maker点 设置point + const maker = new AMap.Marker({ + position: e.poi.location, + draggable: true + }) + console.log(e); + maker.on("dragend", (e) => { + console.log(e); + + }) + _mapRef.value.mapInstance.add(maker) + _mapRef.value.mapInstance.setFitView() + }); + }) + }} + > +
+ +
+
+ }, + contactPersonInfoName: { + type: 'input', + label: '联系人名称' + }, + contactPersonInfoTelephone: { + type: 'input', + label: '联系人电话' + }, + remark: { + type: 'inputTextArea', + label: '备注' + } + }) + Modal.confirm({ + title: params.snowFlakeId ? `【${params.name}】 信息编辑` : '新增企事业单位', + width: 600, + icon: ' ', + centered: true, + content: () => , + onOk: async () => { + await _formRef.value?.validate() + const resp = await api.post('/enterprisesUnit/saveOrUpdate', { + ..._formParams.value, + contactPersonInfo: { + name: _formParams.value.contactPersonInfoName, + telephone: _formParams.value.contactPersonInfoTelephone + } + }) + message.success(resp.message) + callback && callback() + } + }) +} + +export const showEnterprisesUnit = (policeUnitPagerVo: PoliceUnitPagerVo) => { + const _tableRef = ref>(null) + const _columns: _TableProps['columns'] = [ + { + dataIndex: 'name', + title: '名称' + }, { + dataIndex: 'type', + title: '类型', + customRender: ({text}) => text?.label + }, { + dataIndex: 'contactPersonInfo', + title: '联系人', + customRender: ({text}) => text?.name + "/" + text.telephone + }, { + dataIndex: 'province', + title: '行政区划', + customRender: ({record}) => [record.provinceName, record.cityName, record.districtsName, record.streetName].filter(Boolean).join("/") + }, { + dataIndex: 'address', + title: '详细地址' + }, { + dataIndex: 'remark', + title: '备注' + }, { + dataIndex: 'createTime', + title: '创建时间' + }, { + dataIndex: 'opt', + title: '操作', + customRender: ({record}) => + + + + } + ] + const _reqApi: _TableProps["requestApi"] = (params) => { + (params as PageParams).params.policeUnitId = policeUnitPagerVo.snowFlakeId + return api.post('/enterprisesUnit/pager', params) + } + Modal.info({ + title: `【${policeUnitPagerVo.name}】 管辖企事业单位`, + width: '80%', + content: () => { + return + + + + } + } as TableProMaxSlots} + /> + }) +} diff --git a/superManagement/src/views/unitManage/police/unitManage/index.vue b/superManagement/src/views/unitManage/police/unitManage/index.vue new file mode 100644 index 0000000..68b9f03 --- /dev/null +++ b/superManagement/src/views/unitManage/police/unitManage/index.vue @@ -0,0 +1,136 @@ + + + + + diff --git a/superManagement/src/views/unitManage/policeUnit/index.vue b/superManagement/src/views/unitManage/police/unitManage/index.vue.bak similarity index 100% rename from superManagement/src/views/unitManage/policeUnit/index.vue rename to superManagement/src/views/unitManage/police/unitManage/index.vue.bak diff --git a/superManagement/src/views/unitManage/test.vue b/superManagement/src/views/unitManage/test.vue deleted file mode 100644 index 5871ec4..0000000 --- a/superManagement/src/views/unitManage/test.vue +++ /dev/null @@ -1,11 +0,0 @@ - - - - - diff --git a/superManagement/src/vite-env.d.ts b/superManagement/src/vite-env.d.ts index c49a709..a1729cb 100644 --- a/superManagement/src/vite-env.d.ts +++ b/superManagement/src/vite-env.d.ts @@ -19,6 +19,10 @@ interface ImportMetaEnv { // RSA公钥 readonly VITE_APP_RSA_PUBLIC_KEY: string; + + // 高德 + VITE_APP_GAODE_KEY: string + VITE_APP_GAODE_VERSION: string } declare module '*.vue' { From b79bacc424d89d0da3e9a9b77080251cb7def304 Mon Sep 17 00:00:00 2001 From: luozhun <2025254074@qq.com> Date: Thu, 7 Nov 2024 17:16:35 +0800 Subject: [PATCH 2/6] 1 --- superManagement/src/views/test.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/superManagement/src/views/test.vue b/superManagement/src/views/test.vue index 3b996ad..dc652ac 100644 --- a/superManagement/src/views/test.vue +++ b/superManagement/src/views/test.vue @@ -17,7 +17,7 @@ From 201f2112e89d46818e4881cba32a5d4fc496247b Mon Sep 17 00:00:00 2001 From: luozhun <2025254074@qq.com> Date: Fri, 8 Nov 2024 11:47:04 +0800 Subject: [PATCH 4/6] =?UTF-8?q?feat(geometry):=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=87=A0=E4=BD=95=E5=B7=A5=E5=85=B7=E7=B1=BB=E5=92=8C=E5=9D=90?= =?UTF-8?q?=E6=A0=87=E8=BD=AC=E6=8D=A2=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增 GeometryUtil 工具类,提供几何对象创建和操作方法 - 添加 GpsConvertUtil 类,实现坐标系转换功能 - 在 EnterprisesUnit 模型中增加坐标字段- 更新相关参数和 VO 类,支持坐标信息 - 新增 PointTypeHandler 以支持 MyBatis-Plus 对 Point 类型的处理 - 在 FastJson2Config 中注册地理坐标相关的序列化和反序列化器 - 添加 GeometryInnerInterceptor 以支持 MyBatis-Plus 几何操作 --- policeSecurityServer/pom.xml | 12 + .../changhu/common/utils/GeometryUtil.java | 428 ++++++++++++++++++ .../changhu/common/utils/GpsConvertUtil.java | 135 ++++++ .../pojo/entity/EnterprisesUnit.java | 6 + .../EnterprisesUnitSaveOrUpdateParams.java | 4 + .../pojo/vo/EnterprisesUnitPagerVo.java | 4 + .../support/fastjson2/FastJson2Config.java | 19 +- .../deserialze/LatitudeDeserializer.java | 31 ++ .../deserialze/LongitudeDeserializer.java | 31 ++ .../deserialze/PointDeserializer.java | 35 ++ .../serializer/LatitudeSerializer.java | 30 ++ .../serializer/LongitudeSerializer.java | 30 ++ .../fastjson2/serializer/PointSerializer.java | 45 ++ .../config/CustomMybatisPlusConfig.java | 3 + .../geo/AbstractGeometryTypeHandler.java | 13 + .../handler/global/geo/PointTypeHandler.java | 55 +++ .../interceptor/GeometryInnerInterceptor.java | 133 ++++++ superManagement/.env.development | 1 + superManagement/.env.production | 1 + .../src/components/aMap/MapContainer.vue | 4 +- .../views/unitManage/police/policeUnit.ts | 2 + superManagement/src/utils/aMapUtil.ts | 2 +- .../unitManage/police/unitManage/index.tsx | 36 +- .../unitManage/police/unitManage/index.vue | 23 + superManagement/src/vite-env.d.ts | 1 + 25 files changed, 1067 insertions(+), 17 deletions(-) create mode 100644 policeSecurityServer/src/main/java/com/changhu/common/utils/GeometryUtil.java create mode 100644 policeSecurityServer/src/main/java/com/changhu/common/utils/GpsConvertUtil.java create mode 100644 policeSecurityServer/src/main/java/com/changhu/support/fastjson2/deserialze/LatitudeDeserializer.java create mode 100644 policeSecurityServer/src/main/java/com/changhu/support/fastjson2/deserialze/LongitudeDeserializer.java create mode 100644 policeSecurityServer/src/main/java/com/changhu/support/fastjson2/deserialze/PointDeserializer.java create mode 100644 policeSecurityServer/src/main/java/com/changhu/support/fastjson2/serializer/LatitudeSerializer.java create mode 100644 policeSecurityServer/src/main/java/com/changhu/support/fastjson2/serializer/LongitudeSerializer.java create mode 100644 policeSecurityServer/src/main/java/com/changhu/support/fastjson2/serializer/PointSerializer.java create mode 100644 policeSecurityServer/src/main/java/com/changhu/support/mybatisplus/handler/global/geo/AbstractGeometryTypeHandler.java create mode 100644 policeSecurityServer/src/main/java/com/changhu/support/mybatisplus/handler/global/geo/PointTypeHandler.java create mode 100644 policeSecurityServer/src/main/java/com/changhu/support/mybatisplus/interceptor/GeometryInnerInterceptor.java diff --git a/policeSecurityServer/pom.xml b/policeSecurityServer/pom.xml index 61d3d4b..140472e 100644 --- a/policeSecurityServer/pom.xml +++ b/policeSecurityServer/pom.xml @@ -23,6 +23,7 @@ 3.3.4 8.0.32 3.5.7 + 25.2 1.2.20 8.4.3 4.8.1 @@ -190,6 +191,17 @@ mybatis-plus-spring-boot3-starter ${mybatis.plus.version} + + + org.geotools + gt-main + ${geotools.version} + + + org.geotools + gt-geojson + ${geotools.version} + io.minio diff --git a/policeSecurityServer/src/main/java/com/changhu/common/utils/GeometryUtil.java b/policeSecurityServer/src/main/java/com/changhu/common/utils/GeometryUtil.java new file mode 100644 index 0000000..fc330d7 --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/common/utils/GeometryUtil.java @@ -0,0 +1,428 @@ +package com.changhu.common.utils; + +import cn.hutool.core.convert.Convert; +import cn.hutool.core.util.StrUtil; +import com.changhu.common.exception.MessageException; +import lombok.extern.slf4j.Slf4j; +import org.geotools.geojson.geom.GeometryJSON; +import org.geotools.geometry.jts.JTS; +import org.geotools.referencing.CRS; +import org.geotools.referencing.GeodeticCalculator; +import org.locationtech.jts.geom.*; +import org.locationtech.jts.io.ParseException; +import org.locationtech.jts.io.WKBReader; +import org.locationtech.jts.io.WKTReader; +import org.opengis.referencing.FactoryException; +import org.opengis.referencing.crs.CoordinateReferenceSystem; +import org.opengis.referencing.operation.MathTransform; +import org.opengis.referencing.operation.TransformException; + +import java.awt.geom.Point2D; +import java.io.IOException; +import java.io.StringReader; +import java.math.BigDecimal; +import java.nio.ByteBuffer; +import java.nio.ByteOrder; +import java.util.List; +import java.util.Objects; + +/** + * author: luozhun + * desc: GeometryUtil + * createTime: 2023/8/25 18:03 + */ +@Slf4j +public class GeometryUtil { + + /** + * - WGS 84(srid=4326):用于全球地理坐标系统的标准参考坐标系。 + * - 美国地理参考系统(srid=4269):用于美国本土的地图和地理数据。 + * - 欧洲地理参考系统(srid=4258):用于欧洲地图和地理数据。 + * - 中国国家大地坐标系(srid=4490):用于中国的地图和地理数据。 + */ + public static final int SRID = 4326; + public static final String ST_GeomFromText = StrUtil.format("ST_GeomFromText({},{},{})", "?", SRID, "'axis-order=long-lat'"); + private static final GeometryFactory GEOMETRY_FACTORY = new GeometryFactory(new PrecisionModel(), SRID); + private static final GeometryFactory LOCATION_TECH_GEOMETRY_FACTORY = new GeometryFactory(new PrecisionModel(), SRID); + + /** + * 空对象,因为简历空间索引不能为空 Mysql 不支持创建 Empty 的数据 这里自定义一个类型 标识为null + */ + public static Point emptyPoint() { + return createPoint("POINT(0 0)"); + } + + public static Polygon emptyPolygon() { + return createPolygon("POLYGON((0 0, 0 0, 0 0, 0 0))"); + } + + public static LineString emptyLineString() { + return createLineString("LINESTRING(0 0, 0 0)"); + } + + public static MultiPoint emptyMultiPoint() { + return createMultiPoint("MULTIPOINT((0 0))"); + } + + public static MultiPolygon emptyMultiPolygon() { + return createMultiPolygon("MULTIPOLYGON(((0 0, 0 0, 0 0, 0 0)))"); + } + + public static MultiLineString emptyMultiLineString() { + return createMultiLineString("MULTILINESTRING(((0 0, 0 0)))"); + } + + + public static boolean equals(Geometry geometry1, Geometry geometry2) { + return StrUtil.equals(geometry1.toText(), geometry2.toText()); + } + + //** 点 **\\ + + /** + * 创建点对象 + */ + public static Point createPoint(List param) { + if (param == null) { + return null; + } + BigDecimal longitude = param.get(0); + BigDecimal latitude = param.get(1); + if (longitude == null || latitude == null) { + return null; + } + Coordinate coordinate = new Coordinate(longitude.doubleValue(), latitude.doubleValue()); + return GEOMETRY_FACTORY.createPoint(coordinate); + } + + public static Point createPoint(double longitude, double latitude) { + Coordinate coordinate = new Coordinate(longitude, latitude); + return GEOMETRY_FACTORY.createPoint(coordinate); + } + + /** + * 从WKT创建点对象 + * + * @param wkt 注WKT类似: POINT(109.013388 32.715519) + */ + public static Point createPoint(String wkt) { + return createGeometryFromWkt(wkt, Point.class); + } + + /** + * 从WKT创建点对象 + * + * @param bytes 数据库二进制数据 + */ + public static Point createPoint(byte[] bytes) { + return createGeometryFromBytes(bytes, Point.class); + } + + + //** 多边形 **\\ + + /** + * 创建多边形对象 + *

+ * 注:后面可能考虑兼容折线类型,如果是折线类型那么需要规范首尾结点要相同才能构成 polygon 否则构成 polyline + * 目前暂时没有做这方面的规划,用代码兼容了首尾不相等的情况构成polygon + */ + public static Polygon createPolygon(List> params) { + if (params == null || params.size() < 4) { + throw new MessageException("构成多边形至少需要三个有效坐标,并且保证尾部坐标和首部坐标相同"); + } + // 检测首尾是否相等,不相等则补充尾坐标 + List startPoint = params.get(0); + List entPoint = params.get(params.size() - 1); + if (!Objects.equals(startPoint.get(0), entPoint.get(0)) + || !Objects.equals(startPoint.get(1), entPoint.get(1))) { + params.add(params.get(0)); + } + Coordinate[] coordinates = convertBigDecimalList2CoordinateArray(params); + return GEOMETRY_FACTORY.createPolygon(coordinates); + } + + public static Polygon createPolygonWithDouble(List> params) { + if (params == null || params.size() < 4) { + throw new MessageException("构成多边形至少需要三个有效坐标,并且保证尾部坐标和首部坐标相同"); + } + // 检测首尾是否相等,不相等则补充尾坐标 + List startPoint = params.get(0); + List entPoint = params.get(params.size() - 1); + if (!Objects.equals(startPoint.get(0), entPoint.get(0)) + || !Objects.equals(startPoint.get(1), entPoint.get(1))) { + params.add(params.get(0)); + } + Coordinate[] coordinates = convertDoubleList2CoordinateArray(params); + return GEOMETRY_FACTORY.createPolygon(coordinates); + } + + /** + * 从WKT创建多边形对象 + * + * @param wkt 注WKT类似:POLYGON((20 10, 30 0, 40 10, 30 20, 20 10)) + */ + public static Polygon createPolygon(String wkt) { + return createGeometryFromWkt(wkt, Polygon.class); + } + + /** + * 创建多边形对象 + * + * @param bytes 数据库二进制数据 + */ + public static Polygon createPolygon(byte[] bytes) { + return createGeometryFromBytes(bytes, Polygon.class); + } + + //** 折线 **\\ + + /** + * 创建折线对象 + */ + public static LineString createLineString(List> params) { + if (params == null || params.size() < 2) { + throw new MessageException("构成折线至少需要两个有效坐标"); + } + Coordinate[] coordinates = convertBigDecimalList2CoordinateArray(params); + return GEOMETRY_FACTORY.createLineString(coordinates); + } + + /** + * 从 wkt 创建折线对象 + */ + public static LineString createLineString(String wkt) { + return createGeometryFromWkt(wkt, LineString.class); + } + + /** + * 从 bytes 创建折线对象 + */ + public static LineString createLineString(byte[] bytes) { + return createGeometryFromBytes(bytes, LineString.class); + } + + + //** 多点 **\\ + + /** + * 创建多点对象 + */ + public static MultiPoint createMultiPoint(List> multiParam) { + int size = multiParam.size(); + Point[] points = new Point[size]; + for (int i = 0; i < size; i++) { + points[i] = createPoint(multiParam.get(i)); + } + return GEOMETRY_FACTORY.createMultiPoint(points); + } + + + /** + * 从 wkt 创建多点对象 + */ + public static MultiPoint createMultiPoint(String wkt) { + return createGeometryFromWkt(wkt, MultiPoint.class); + } + + + /** + * 从 bytes 创建多点对象 + */ + public static MultiPoint createMultiPoint(byte[] bytes) { + return createGeometryFromBytes(bytes, MultiPoint.class); + } + + + //** 多折线 **\\ + + /** + * 创建多折线对象 + */ + public static MultiLineString createMultiLineString(List>> multiParams) { + int size = multiParams.size(); + LineString[] lineStrings = new LineString[size]; + for (int i = 0; i < size; i++) { + lineStrings[i] = createLineString(multiParams.get(i)); + } + return GEOMETRY_FACTORY.createMultiLineString(lineStrings); + } + + /** + * 从 wkt 创建多折线对象 + */ + public static MultiLineString createMultiLineString(String wkt) { + return createGeometryFromWkt(wkt, MultiLineString.class); + } + + /** + * 从 wkt 创建多折线对象 + */ + public static MultiLineString createMultiLineString(byte[] bytes) { + return createGeometryFromBytes(bytes, MultiLineString.class); + } + + //** 多多边形 **\\ + + /** + * 创建多多边形 + */ + public static MultiPolygon createMultiPolygon(List>> multiParams) { + int size = multiParams.size(); + Polygon[] polygons = new Polygon[size]; + for (int i = 0; i < size; i++) { + polygons[i] = createPolygon(multiParams.get(i)); + } + return GEOMETRY_FACTORY.createMultiPolygon(polygons); + } + + /** + * 从 wkt 创建多多边形 + */ + public static MultiPolygon createMultiPolygon(String wkt) { + return createGeometryFromWkt(wkt, MultiPolygon.class); + } + + /** + * 从 bytes 创建多多边形 + */ + public static MultiPolygon createMultiPolygon(byte[] bytes) { + return createGeometryFromBytes(bytes, MultiPolygon.class); + } + + //** 通用工具 **\\ + + + /** + * bytes 创建空间对象 + * + * @param bytes 数据库的二进制数据 + */ + public static T createGeometryFromBytes(byte[] bytes, Class clazz) { + if (bytes == null) { + return null; + } + try { + WKBReader wkbReader = new WKBReader(GEOMETRY_FACTORY); + byte[] geomBytes = ByteBuffer.allocate(bytes.length - 4).order(ByteOrder.LITTLE_ENDIAN) + .put(bytes, 4, bytes.length - 4).array(); + Geometry geometry = wkbReader.read(geomBytes); + return Convert.convert(clazz, geometry); + } catch (Exception e) { + throw new MessageException("从 Bytes 创建空间对象 {} 时出现错误:{}", clazz.getSimpleName(), e.getMessage()); + } + } + + /** + * 从 wkt 创建空间对象 + * + * @param wkt 类似:POLYGON((20 10, 30 0, 40 10, 30 20, 20 10)) , POINT(109.013388 32.715519) 等 + * @param clazz 继承 + */ + public static T createGeometryFromWkt(String wkt, Class clazz) { + if (wkt == null || StrUtil.isBlank(wkt)) { + return null; + } + try { + WKTReader reader = new WKTReader(GEOMETRY_FACTORY); + Geometry geometry = reader.read(wkt); + return Convert.convert(clazz, geometry); + } catch (ParseException e) { + throw new MessageException("从WKT创建空间对象 {} 时出现错误。wkt:{}", clazz.getSimpleName(), wkt); + } + } + + /** + * 从 GeoJson 创建空间对象 + */ + public static T createGeometryFromGeoJson(String geoJson, Class clazz) { + try { + GeometryJSON geometryJson = new GeometryJSON(20); + Geometry read = geometryJson.read(new StringReader(geoJson)); + return createGeometryFromWkt(read.toString(), clazz); + } catch (IOException e) { + log.error("从 GeoJson 创建空间对象出错:{}", e.getMessage()); + } + return null; + } + + /** + * 将 List 转化为 Coordinate[] + */ + private static Coordinate[] convertBigDecimalList2CoordinateArray(List> params) { + int size = params.size(); + Coordinate[] coordinates = new Coordinate[size]; + for (int i = 0; i < params.size(); i++) { + List param = params.get(i); + Coordinate coordinate = new Coordinate(param.get(0).doubleValue(), param.get(1).doubleValue()); + coordinates[i] = coordinate; + } + return coordinates; + } + + private static Coordinate[] convertDoubleList2CoordinateArray(List> params) { + int size = params.size(); + Coordinate[] coordinates = new Coordinate[size]; + for (int i = 0; i < params.size(); i++) { + List param = params.get(i); + Coordinate coordinate = new Coordinate(param.get(0), param.get(1)); + coordinates[i] = coordinate; + } + return coordinates; + } + + /** + * 计算面积 平方米 + * 28155 .195928.042862 + */ + public static BigDecimal getApproximateArea(Geometry geometry) { + try { + String wkt = geometry.toText(); + WKTReader wktReader = new WKTReader(LOCATION_TECH_GEOMETRY_FACTORY); + Geometry geom = wktReader.read(wkt); + // WGS84(一般项目中常用的是CSR:84和EPSG:4326) + CoordinateReferenceSystem sourceCRS = CRS.decode("EPSG:4326"); + // Pseudo-Mercator(墨卡托投影) + CoordinateReferenceSystem targetCRS = CRS.decode("EPSG:4490"); + MathTransform transform = CRS.findMathTransform(sourceCRS, targetCRS, true); + Geometry geometryMercator = JTS.transform(geom, transform); + // 面积、周长 + return BigDecimal.valueOf(geometryMercator.getArea()); + } catch (FactoryException | TransformException | ParseException e) { + log.error("计算面积出错:{}", e.getMessage()); + } + return null; + } + + /** + * 当前数据库的数据来源都是高德数据源 坐标系为GCJ02 如果来源是其他的地图的需要根据规则转换成GCJ02 + * 同理如果需要转换到其他的数据源的坐标系也需要进行转换 + */ + public static T convertWgs84ToGcj02(T geometry) { + log.info("原始数据:{}", geometry.toText()); + Coordinate[] coordinates = geometry.getCoordinates(); + for (Coordinate coordinate : coordinates) { + double lon = coordinate.x; + double lat = coordinate.y; + double[] doubles = GpsConvertUtil.wgs84ToGcj02(lon, lat); + coordinate.x = doubles[0]; + coordinate.y = doubles[1]; + } + log.info("转后数据:{}", geometry.toText()); + return geometry; + } + + public static double distance(Point p0, Point p1) { + GeodeticCalculator calculator = new GeodeticCalculator(); + calculator.setStartingGeographicPoint(p0.getX(), p0.getY()); + calculator.setDestinationGeographicPoint(p1.getX(), p1.getY()); + return calculator.getOrthodromicDistance(); + } + + public static Point2D calculateEndingGlobalCoordinates(double longitude, double latitude, double azi, double dis) { + GeodeticCalculator calculator = new GeodeticCalculator(); + calculator.setStartingGeographicPoint(longitude, latitude); + calculator.setDirection(azi, dis); + return calculator.getDestinationGeographicPoint(); + } +} \ No newline at end of file diff --git a/policeSecurityServer/src/main/java/com/changhu/common/utils/GpsConvertUtil.java b/policeSecurityServer/src/main/java/com/changhu/common/utils/GpsConvertUtil.java new file mode 100644 index 0000000..e524a80 --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/common/utils/GpsConvertUtil.java @@ -0,0 +1,135 @@ +package com.changhu.common.utils; + +/** + * author: luozhun + * desc: 坐标系转换 + * createTime: 2023/8/25 18:18 + */ +public class GpsConvertUtil { + public static final double pi = 3.1415926535897932384626; + public static final double xpi = 3.14159265358979324 * 3000.0 / 180.0; + public static final double a = 6378245.0; + public static final double ee = 0.00669342162296594323; + + public static double transformLat(double x, double y) { + double ret = -100.0 + 2.0 * x + 3.0 * y + 0.2 * y * y + 0.1 * x * y + + 0.2 * Math.sqrt(Math.abs(x)); + ret += (20.0 * Math.sin(6.0 * x * pi) + 20.0 * Math.sin(2.0 * x * pi)) * 2.0 / 3.0; + ret += (20.0 * Math.sin(y * pi) + 40.0 * Math.sin(y / 3.0 * pi)) * 2.0 / 3.0; + ret += (160.0 * Math.sin(y / 12.0 * pi) + 320 * Math.sin(y * pi / 30.0)) * 2.0 / 3.0; + return ret; + } + + public static double transformLon(double x, double y) { + double ret = 300.0 + x + 2.0 * y + 0.1 * x * x + 0.1 * x * y + 0.1 + * Math.sqrt(Math.abs(x)); + ret += (20.0 * Math.sin(6.0 * x * pi) + 20.0 * Math.sin(2.0 * x * pi)) * 2.0 / 3.0; + ret += (20.0 * Math.sin(x * pi) + 40.0 * Math.sin(x / 3.0 * pi)) * 2.0 / 3.0; + ret += (150.0 * Math.sin(x / 12.0 * pi) + 300.0 * Math.sin(x / 30.0 + * pi)) * 2.0 / 3.0; + return ret; + } + + public static double[] transform(double lon, double lat) { + if (outOfChina(lon, lat)) { + return new double[]{lon, lat}; + } + double dLat = transformLat(lon - 105.0, lat - 35.0); + double dLon = transformLon(lon - 105.0, lat - 35.0); + double radLat = lat / 180.0 * pi; + double magic = Math.sin(radLat); + magic = 1 - ee * magic * magic; + double sqrtMagic = Math.sqrt(magic); + dLat = (dLat * 180.0) / ((a * (1 - ee)) / (magic * sqrtMagic) * pi); + dLon = (dLon * 180.0) / (a / sqrtMagic * Math.cos(radLat) * pi); + double mgLat = lat + dLat; + double mgLon = lon + dLon; + return new double[]{mgLon, mgLat}; + } + + public static boolean outOfChina(double lon, double lat) { + if (lon < 72.004 || lon > 137.8347) + return true; + return lat < 0.8293 || lat > 55.8271; + } + + /** + * 84 to 火星坐标系 (GCJ-02) World Geodetic System ==> Mars Geodetic System + */ + public static double[] wgs84ToGcj02(double lon, double lat) { + if (outOfChina(lon, lat)) { + return new double[]{lon, lat}; + } + double dLat = transformLat(lon - 105.0, lat - 35.0); + double dLon = transformLon(lon - 105.0, lat - 35.0); + double radLat = lat / 180.0 * pi; + double magic = Math.sin(radLat); + magic = 1 - ee * magic * magic; + double sqrtMagic = Math.sqrt(magic); + dLat = (dLat * 180.0) / ((a * (1 - ee)) / (magic * sqrtMagic) * pi); + dLon = (dLon * 180.0) / (a / sqrtMagic * Math.cos(radLat) * pi); + double mgLat = lat + dLat; + double mgLon = lon + dLon; + return new double[]{mgLon, mgLat}; + } + + /** + * * 火星坐标系 (GCJ-02) to 84 * * @param lon * @param lat * @return + */ + public static double[] gcj02ToWgs84(double lon, double lat) { + double[] gps = transform(lon, lat); + double longitude = lon * 2 - gps[0]; + double latitude = lat * 2 - gps[1]; + return new double[]{longitude, latitude}; + } + + /** + * 火星坐标系 (GCJ-02) 与百度坐标系 (BD-09) 的转换算法 将 GCJ-02 坐标转换成 BD-09 坐标 + */ + public static double[] gcj02ToBd09(double lon, double lat) { + double z = Math.sqrt(lon * lon + lat * lat) + 0.00002 * Math.sin(lat * xpi); + double theta = Math.atan2(lat, lon) + 0.000003 * Math.cos(lon * xpi); + double tempLon = z * Math.cos(theta) + 0.0065; + double tempLat = z * Math.sin(theta) + 0.006; + return new double[]{tempLon, tempLat}; + } + + /** + * * 火星坐标系 (GCJ-02) 与百度坐标系 (BD-09) 的转换算法 * * 将 BD-09 坐标转换成GCJ-02 坐标 * * @param + * bdlat * @param bdlon * @return + */ + public static double[] bd09ToGcj02(double lon, double lat) { + double x = lon - 0.0065, y = lat - 0.006; + double z = Math.sqrt(x * x + y * y) - 0.00002 * Math.sin(y * xpi); + double theta = Math.atan2(y, x) - 0.000003 * Math.cos(x * xpi); + double tempLon = z * Math.cos(theta); + double tempLat = z * Math.sin(theta); + return new double[]{tempLon, tempLat}; + } + + /** + * 将wgs84转为bd09 + */ + public static double[] wgs84ToBd09(double lon, double lat) { + double[] gcj02 = wgs84ToGcj02(lon, lat); + return gcj02ToBd09(gcj02[0], gcj02[1]); + } + + public static double[] bd09ToWgs84(double lon, double lat) { + double[] gcj02 = bd09ToGcj02(lon, lat); + double[] wgs84 = gcj02ToWgs84(gcj02[0], gcj02[1]); + // 保留小数点后六位 + wgs84[1] = retain6(wgs84[1]); + wgs84[0] = retain6(wgs84[0]); + return wgs84; + } + + /** + * 保留小数点后六位 + */ + private static double retain6(double num) { + String result = String.format("%.6f", num); + return Double.parseDouble(result); + } + +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/entity/EnterprisesUnit.java b/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/entity/EnterprisesUnit.java index b5f5b6a..9b3fc65 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/entity/EnterprisesUnit.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/entity/EnterprisesUnit.java @@ -11,6 +11,7 @@ import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; import lombok.experimental.SuperBuilder; +import org.locationtech.jts.geom.Point; import java.io.Serial; import java.io.Serializable; @@ -73,6 +74,11 @@ public class EnterprisesUnit extends BaseEntity implements Serializable { */ private String address; + /** + * 坐标 + */ + private Point point; + /** * 联系人 */ diff --git a/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/params/EnterprisesUnitSaveOrUpdateParams.java b/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/params/EnterprisesUnitSaveOrUpdateParams.java index 7751ec3..4b7114f 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/params/EnterprisesUnitSaveOrUpdateParams.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/params/EnterprisesUnitSaveOrUpdateParams.java @@ -7,6 +7,7 @@ import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotNull; import lombok.Data; +import org.locationtech.jts.geom.Point; import java.util.List; @@ -40,6 +41,9 @@ public class EnterprisesUnitSaveOrUpdateParams { @Schema(description = "详细地址") private String address; + @Schema(description = "坐标") + private Point point; + @Schema(description = "联系人") private ContactPersonInfo contactPersonInfo; diff --git a/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/vo/EnterprisesUnitPagerVo.java b/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/vo/EnterprisesUnitPagerVo.java index 6fac384..594c1ef 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/vo/EnterprisesUnitPagerVo.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/management/pojo/vo/EnterprisesUnitPagerVo.java @@ -4,6 +4,7 @@ import com.changhu.common.db.enums.EnterprisesUnitType; import com.changhu.module.management.pojo.model.ContactPersonInfo; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; +import org.locationtech.jts.geom.Point; /** * @author 20252 @@ -46,6 +47,9 @@ public class EnterprisesUnitPagerVo { @Schema(description = "地址") private String address; + @Schema(description = "坐标") + private Point point; + @Schema(description = "联系方式") private ContactPersonInfo contactPersonInfo; diff --git a/policeSecurityServer/src/main/java/com/changhu/support/fastjson2/FastJson2Config.java b/policeSecurityServer/src/main/java/com/changhu/support/fastjson2/FastJson2Config.java index 13fc834..10cf050 100644 --- a/policeSecurityServer/src/main/java/com/changhu/support/fastjson2/FastJson2Config.java +++ b/policeSecurityServer/src/main/java/com/changhu/support/fastjson2/FastJson2Config.java @@ -8,9 +8,18 @@ import com.alibaba.fastjson2.support.spring6.http.converter.FastJsonHttpMessageC import com.changhu.common.db.BaseEnum; import com.changhu.common.properties.Fastjson2Properties; import com.changhu.support.fastjson2.deserialze.DbEnumDeserializer; +import com.changhu.support.fastjson2.deserialze.LatitudeDeserializer; +import com.changhu.support.fastjson2.deserialze.LongitudeDeserializer; +import com.changhu.support.fastjson2.deserialze.PointDeserializer; import com.changhu.support.fastjson2.filter.DesensitizedFilter; import com.changhu.support.fastjson2.serializer.DbEnumSerializer; +import com.changhu.support.fastjson2.serializer.LatitudeSerializer; +import com.changhu.support.fastjson2.serializer.LongitudeSerializer; +import com.changhu.support.fastjson2.serializer.PointSerializer; import lombok.extern.slf4j.Slf4j; +import org.geotools.measure.Latitude; +import org.geotools.measure.Longitude; +import org.locationtech.jts.geom.Point; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.http.HttpMessageConverters; import org.springframework.context.annotation.Bean; @@ -47,9 +56,17 @@ public class FastJson2Config { JSON.register(clazz, DbEnumDeserializer.instance); }); - JSON.config(JSONWriter.Feature.WriteLongAsString); + JSON.register(Latitude.class, LatitudeSerializer.instance); + JSON.register(Longitude.class, LongitudeSerializer.instance); + JSON.register(Point.class, PointSerializer.instance); //反序列化配置 + JSON.register(Latitude.class, LatitudeDeserializer.instance); + JSON.register(Longitude.class, LongitudeDeserializer.instance); + JSON.register(Point.class, PointDeserializer.instance); + + JSON.config(JSONWriter.Feature.WriteLongAsString); + } @Bean diff --git a/policeSecurityServer/src/main/java/com/changhu/support/fastjson2/deserialze/LatitudeDeserializer.java b/policeSecurityServer/src/main/java/com/changhu/support/fastjson2/deserialze/LatitudeDeserializer.java new file mode 100644 index 0000000..98c55b4 --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/support/fastjson2/deserialze/LatitudeDeserializer.java @@ -0,0 +1,31 @@ +package com.changhu.support.fastjson2.deserialze; + +import com.alibaba.fastjson2.JSONReader; +import com.alibaba.fastjson2.reader.ObjectReader; +import org.geotools.measure.Latitude; + +import java.lang.reflect.Type; +import java.math.BigDecimal; + +/** + * author: luozhun + * desc: LatitudeDeserializer + * createTime: 2023/8/26 16:10 + */ +public class LatitudeDeserializer implements ObjectReader { + + public static final LatitudeDeserializer instance = new LatitudeDeserializer(); + + private LatitudeDeserializer() { + } + + @Override + public Latitude readObject(JSONReader jsonReader, Type fieldType, Object fieldName, long features) { + //读取为BigDecimal来确保精度和避免浮点数的舍入误差 + BigDecimal value = jsonReader.readBigDecimal(); + if (value == null) { + return null; + } + return new Latitude(value.doubleValue()); + } +} diff --git a/policeSecurityServer/src/main/java/com/changhu/support/fastjson2/deserialze/LongitudeDeserializer.java b/policeSecurityServer/src/main/java/com/changhu/support/fastjson2/deserialze/LongitudeDeserializer.java new file mode 100644 index 0000000..b8ba7fe --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/support/fastjson2/deserialze/LongitudeDeserializer.java @@ -0,0 +1,31 @@ +package com.changhu.support.fastjson2.deserialze; + +import com.alibaba.fastjson2.JSONReader; +import com.alibaba.fastjson2.reader.ObjectReader; +import org.geotools.measure.Longitude; + +import java.lang.reflect.Type; +import java.math.BigDecimal; + +/** + * author: luozhun + * desc: LongitudeDeserializer + * createTime: 2023/8/26 16:15 + */ +public class LongitudeDeserializer implements ObjectReader { + + public static final LongitudeDeserializer instance = new LongitudeDeserializer(); + + private LongitudeDeserializer() { + } + + @Override + public Longitude readObject(JSONReader jsonReader, Type fieldType, Object fieldName, long features) { + //读取为BigDecimal来确保精度和避免浮点数的舍入误差 + BigDecimal value = jsonReader.readBigDecimal(); + if (value == null) { + return null; + } + return new Longitude(value.doubleValue()); + } +} \ No newline at end of file diff --git a/policeSecurityServer/src/main/java/com/changhu/support/fastjson2/deserialze/PointDeserializer.java b/policeSecurityServer/src/main/java/com/changhu/support/fastjson2/deserialze/PointDeserializer.java new file mode 100644 index 0000000..c1c4f13 --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/support/fastjson2/deserialze/PointDeserializer.java @@ -0,0 +1,35 @@ +package com.changhu.support.fastjson2.deserialze; + +import cn.hutool.core.collection.CollUtil; +import com.alibaba.fastjson2.JSONReader; +import com.alibaba.fastjson2.reader.ObjectReader; +import com.changhu.common.utils.GeometryUtil; +import org.locationtech.jts.geom.Point; + +import java.lang.reflect.Type; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; + +/** + * author: luozhun + * desc: PointDeserializer + * createTime: 2023/8/26 16:28 + */ +public class PointDeserializer implements ObjectReader { + + public static final PointDeserializer instance = new PointDeserializer(); + + private PointDeserializer() { + } + + @Override + public Point readObject(JSONReader jsonReader, Type fieldType, Object fieldName, long features) { + List list = new ArrayList<>(); + jsonReader.readArray(list, BigDecimal.class); + if (CollUtil.isEmpty(list)) { + return null; + } + return GeometryUtil.createPoint(list); + } +} \ No newline at end of file diff --git a/policeSecurityServer/src/main/java/com/changhu/support/fastjson2/serializer/LatitudeSerializer.java b/policeSecurityServer/src/main/java/com/changhu/support/fastjson2/serializer/LatitudeSerializer.java new file mode 100644 index 0000000..55deee1 --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/support/fastjson2/serializer/LatitudeSerializer.java @@ -0,0 +1,30 @@ +package com.changhu.support.fastjson2.serializer; + +import com.alibaba.fastjson2.JSONWriter; +import com.alibaba.fastjson2.writer.ObjectWriter; +import org.geotools.measure.Latitude; + +import java.lang.reflect.Type; + +/** + * author: luozhun + * desc: LatitudeSerializer + * createTime: 2023/8/26 15:44 + */ +public class LatitudeSerializer implements ObjectWriter { + + public static final LatitudeSerializer instance = new LatitudeSerializer(); + + private LatitudeSerializer() { + } + + @Override + public void write(JSONWriter jsonWriter, Object object, Object fieldName, Type fieldType, long features) { + if (object == null) { + jsonWriter.writeNull(); + return; + } + jsonWriter.writeDouble(((Latitude) object).degrees()); + } +} + diff --git a/policeSecurityServer/src/main/java/com/changhu/support/fastjson2/serializer/LongitudeSerializer.java b/policeSecurityServer/src/main/java/com/changhu/support/fastjson2/serializer/LongitudeSerializer.java new file mode 100644 index 0000000..42b27df --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/support/fastjson2/serializer/LongitudeSerializer.java @@ -0,0 +1,30 @@ +package com.changhu.support.fastjson2.serializer; + +import com.alibaba.fastjson2.JSONWriter; +import com.alibaba.fastjson2.writer.ObjectWriter; +import org.geotools.measure.Longitude; + +import java.lang.reflect.Type; + +/** + * author: luozhun + * desc: LongitudeSerializer + * createTime: 2023/8/26 15:46 + */ +public class LongitudeSerializer implements ObjectWriter { + + public static final LongitudeSerializer instance = new LongitudeSerializer(); + + private LongitudeSerializer() { + } + + @Override + public void write(JSONWriter jsonWriter, Object object, Object fieldName, Type fieldType, long features) { + if (object == null) { + jsonWriter.writeNull(); + return; + } + jsonWriter.writeDouble(((Longitude) object).degrees()); + } +} + diff --git a/policeSecurityServer/src/main/java/com/changhu/support/fastjson2/serializer/PointSerializer.java b/policeSecurityServer/src/main/java/com/changhu/support/fastjson2/serializer/PointSerializer.java new file mode 100644 index 0000000..3815c21 --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/support/fastjson2/serializer/PointSerializer.java @@ -0,0 +1,45 @@ +package com.changhu.support.fastjson2.serializer; + +import com.alibaba.fastjson2.JSONWriter; +import com.alibaba.fastjson2.writer.ObjectWriter; +import com.changhu.common.utils.GeometryUtil; +import org.geotools.measure.Latitude; +import org.geotools.measure.Longitude; +import org.locationtech.jts.geom.Coordinate; +import org.locationtech.jts.geom.Point; + +import java.lang.reflect.Type; +import java.util.Arrays; + +/** + * author: luozhun + * desc: PointSerializer + * createTime: 2023/8/26 15:59 + */ +public class PointSerializer implements ObjectWriter { + + public static final PointSerializer instance = new PointSerializer(); + + private PointSerializer() { + } + + @Override + public void write(JSONWriter jsonWriter, Object object, Object fieldName, Type fieldType, long features) { + if (object == null) { + jsonWriter.writeNull(); + return; + } + Point point = (Point) object; + if (GeometryUtil.equals(GeometryUtil.emptyPoint(), point)) { + jsonWriter.writeNull(); + return; + } + jsonWriter.writeAny( + Arrays.asList( + new Longitude(point.getCoordinate().getOrdinate(Coordinate.X)).degrees(), + new Latitude(point.getCoordinate().getOrdinate(Coordinate.Y)).degrees() + ) + ); + } +} + diff --git a/policeSecurityServer/src/main/java/com/changhu/support/mybatisplus/config/CustomMybatisPlusConfig.java b/policeSecurityServer/src/main/java/com/changhu/support/mybatisplus/config/CustomMybatisPlusConfig.java index cd63570..6421501 100644 --- a/policeSecurityServer/src/main/java/com/changhu/support/mybatisplus/config/CustomMybatisPlusConfig.java +++ b/policeSecurityServer/src/main/java/com/changhu/support/mybatisplus/config/CustomMybatisPlusConfig.java @@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.extension.plugins.inner.DataPermissionIntercepto import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor; import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; import com.changhu.support.mybatisplus.interceptor.CustomDataPermissionHandler; +import com.changhu.support.mybatisplus.interceptor.GeometryInnerInterceptor; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -30,6 +31,8 @@ public class CustomMybatisPlusConfig { interceptor.addInnerInterceptor(paginationInterceptor(DbType.MYSQL)); // sql性能规范 // interceptor.addInnerInterceptor(new IllegalSQLInnerInterceptor()); + // 地理位置支持 配合 + interceptor.addInnerInterceptor(new GeometryInnerInterceptor()); interceptor.addInnerInterceptor(new BlockAttackInnerInterceptor()); //乐观锁插件 interceptor.addInnerInterceptor(new OptimisticLockerInnerInterceptor()); diff --git a/policeSecurityServer/src/main/java/com/changhu/support/mybatisplus/handler/global/geo/AbstractGeometryTypeHandler.java b/policeSecurityServer/src/main/java/com/changhu/support/mybatisplus/handler/global/geo/AbstractGeometryTypeHandler.java new file mode 100644 index 0000000..cf908b8 --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/support/mybatisplus/handler/global/geo/AbstractGeometryTypeHandler.java @@ -0,0 +1,13 @@ +package com.changhu.support.mybatisplus.handler.global.geo; + +import org.apache.ibatis.type.BaseTypeHandler; +import org.locationtech.jts.geom.Geometry; + +/** + * author: luozhun + * desc: GeometryTypeHandler + * createTime: 2023/8/25 17:59 + */ +public abstract class AbstractGeometryTypeHandler extends BaseTypeHandler { +} + diff --git a/policeSecurityServer/src/main/java/com/changhu/support/mybatisplus/handler/global/geo/PointTypeHandler.java b/policeSecurityServer/src/main/java/com/changhu/support/mybatisplus/handler/global/geo/PointTypeHandler.java new file mode 100644 index 0000000..3c0208d --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/support/mybatisplus/handler/global/geo/PointTypeHandler.java @@ -0,0 +1,55 @@ +package com.changhu.support.mybatisplus.handler.global.geo; + +import cn.hutool.core.util.ClassUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.json.JSONUtil; +import com.changhu.common.utils.GeometryUtil; +import org.apache.ibatis.type.JdbcType; +import org.apache.ibatis.type.MappedJdbcTypes; +import org.apache.ibatis.type.MappedTypes; +import org.locationtech.jts.geom.Point; + +import java.sql.CallableStatement; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; + +/** + * author: luozhun + * desc: PointTypeHandler + * createTime: 2023/8/26 13:17 + */ +@MappedJdbcTypes(JdbcType.VARCHAR) +@MappedTypes(Point.class) +public class PointTypeHandler extends AbstractGeometryTypeHandler { + + @Override + public void setNonNullParameter(PreparedStatement preparedStatement, int i, Point point, JdbcType jdbcType) throws SQLException { + preparedStatement.setString(i, point.toText()); + } + + @Override + public Point getNullableResult(ResultSet resultSet, String s) throws SQLException { + return createPoint(resultSet.getString(s), resultSet.getBytes(s)); + } + + @Override + public Point getNullableResult(ResultSet resultSet, int i) throws SQLException { + return createPoint(resultSet.getString(i), resultSet.getBytes(i)); + } + + @Override + public Point getNullableResult(CallableStatement callableStatement, int i) throws SQLException { + return createPoint(callableStatement.getString(i), callableStatement.getBytes(i)); + } + + public Point createPoint(String pointStr, byte[] pointBytes) { + if (JSONUtil.isTypeJSON(pointStr)) { + return GeometryUtil.createGeometryFromGeoJson(pointStr, Point.class); + } + if (StrUtil.startWithIgnoreCase(pointStr, ClassUtil.getClassName(Point.class, true))) { + return GeometryUtil.createGeometryFromWkt(pointStr, Point.class); + } + return GeometryUtil.createPoint(pointBytes); + } +} diff --git a/policeSecurityServer/src/main/java/com/changhu/support/mybatisplus/interceptor/GeometryInnerInterceptor.java b/policeSecurityServer/src/main/java/com/changhu/support/mybatisplus/interceptor/GeometryInnerInterceptor.java new file mode 100644 index 0000000..7d6dccc --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/support/mybatisplus/interceptor/GeometryInnerInterceptor.java @@ -0,0 +1,133 @@ +package com.changhu.support.mybatisplus.interceptor; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.ReUtil; +import cn.hutool.core.util.ReflectUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.toolkit.Constants; +import com.baomidou.mybatisplus.core.toolkit.PluginUtils; +import com.baomidou.mybatisplus.extension.parser.JsqlParserSupport; +import com.baomidou.mybatisplus.extension.plugins.inner.InnerInterceptor; +import lombok.extern.slf4j.Slf4j; +import org.apache.ibatis.executor.statement.StatementHandler; +import org.apache.ibatis.mapping.BoundSql; +import org.apache.ibatis.mapping.MappedStatement; +import org.apache.ibatis.mapping.SqlCommandType; +import org.locationtech.jts.geom.*; + +import java.lang.reflect.Field; +import java.sql.Connection; +import java.util.Arrays; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.stream.Collectors; + +import static com.changhu.common.utils.GeometryUtil.ST_GeomFromText; + + +/** + * @author 20252 + * @createTime 2024/6/6 下午4:32 + * @desc 注意!!!此拦截器只针对mp提供的基本构造方法管用 可以进行参数对象拦截 如果是xml,请自行添加ST_GeomFromText函数 + */ +@Slf4j +public class GeometryInnerInterceptor extends JsqlParserSupport implements InnerInterceptor { + + + public static final List> GEOMETRY_CLASS_LIST = CollUtil.newArrayList( + Point.class, + MultiPoint.class, + Polygon.class, + MultiPolygon.class, + LineString.class, + MultiLineString.class + ); + + public GeometryInnerInterceptor() { + } + + @Override + public void beforePrepare(StatementHandler sh, Connection connection, Integer transactionTimeout) { + PluginUtils.MPStatementHandler mpSh = PluginUtils.mpStatementHandler(sh); + MappedStatement ms = mpSh.mappedStatement(); + //sql类型:INSERT UPDATE DELETE + SqlCommandType sct = ms.getSqlCommandType(); + //mp参数 + Object parameter = mpSh.parameterHandler().getParameterObject(); + //参数对象 + Object object = null; + //获取参数的属性 + switch (sct) { + case UPDATE: + try { + object = BeanUtil.beanToMap(parameter).get(Constants.ENTITY); + } catch (Exception ignored) { + } + break; + case INSERT: + object = parameter; + break; + } + //如果没有参数 就不进行sql修改 + if (object == null) { + return; + } + //获取 parameter 对象 中有关 geometry 的属性名对应 + List geoFields = this.getGeoFields(object); + //如果没有geometry字段 就不进行sql修改 + if (geoFields.isEmpty()) { + return; + } + //获取原始sql + BoundSql boundSql = ms.getBoundSql(parameter); + //UPDATE geo_test SET update_by=?,update_time=?,delete_flag=1 WHERE id=? AND delete_flag=0 + String originalSql = StrUtil.removeAllLineBreaks(boundSql.getSql()); + switch (sct) { + case UPDATE: + for (String geometryField : geoFields) { + String regex = geometryField + "\\s*=\\s*\\?"; + originalSql = ReUtil.replaceAll(originalSql, regex, StrUtil.format("{}={}", geometryField, ST_GeomFromText)); + } + break; + case INSERT: + for (String geometryField : geoFields) { + originalSql = this.replaceFindGeo(originalSql, geometryField); + } + break; + } + PluginUtils.MPBoundSql mpBs = mpSh.mPBoundSql(); + //修改sql + mpBs.sql(originalSql); + } + + private String replaceFindGeo(String originalSql, String geometryField) { + List split = StrUtil.split(originalSql, geometryField); + //找出geo字段在sql中的位置 + int geometryFieldIndex = StrUtil.count(split.get(0), ","); + StringBuilder stringBuffer = new StringBuilder(); + Matcher matcher = Pattern.compile("\\?").matcher(originalSql); + int count = 0; + while (matcher.find()) { + if (count == geometryFieldIndex) { + matcher.appendReplacement(stringBuffer, ST_GeomFromText); + break; + } + count++; + } + matcher.appendTail(stringBuffer); + return stringBuffer.toString(); + } + + /** + * 获取对象中的geo字段 + */ + private List getGeoFields(Object object) { + return Arrays.stream(ReflectUtil.getFields(object.getClass())) + .filter(field -> GEOMETRY_CLASS_LIST.contains(field.getType())) + .map(Field::getName) + .collect(Collectors.toList()); + } + +} diff --git a/superManagement/.env.development b/superManagement/.env.development index e416923..024b5f7 100644 --- a/superManagement/.env.development +++ b/superManagement/.env.development @@ -18,3 +18,4 @@ VITE_APP_MINIO_BUCKET=police-security-dev # 高德 VITE_APP_GAODE_KEY=f379a3f860a68d7438526275d6a94b05 VITE_APP_GAODE_VERSION=2.0 +VITE_APP_SECURITY_JS_CODE=432125a0f8d8cad2dac38b77d6f6728f diff --git a/superManagement/.env.production b/superManagement/.env.production index 70b36e1..3104a00 100644 --- a/superManagement/.env.production +++ b/superManagement/.env.production @@ -18,3 +18,4 @@ VITE_APP_MINIO_BUCKET=police-security # 高德 VITE_APP_GAODE_KEY=f379a3f860a68d7438526275d6a94b05 VITE_APP_GAODE_VERSION=2.0 +VITE_APP_SECURITY_JS_CODE=432125a0f8d8cad2dac38b77d6f6728f diff --git a/superManagement/src/components/aMap/MapContainer.vue b/superManagement/src/components/aMap/MapContainer.vue index d637e87..fdd897c 100644 --- a/superManagement/src/components/aMap/MapContainer.vue +++ b/superManagement/src/components/aMap/MapContainer.vue @@ -10,7 +10,7 @@ import {initMap} from "@/utils/aMapUtil"; const props = withDefaults(defineProps<{ plugins?: string[], - initCallback?: () => void, + initCallback?: (map: AMap.Map) => void, mapOptions?: AMap.MapOptions }>(), { plugins: () => { @@ -36,8 +36,8 @@ defineExpose({ onMounted(() => { initMap(props.plugins).then(AMap => { - props.initCallback && props.initCallback() map.value = new AMap.Map(mapId, props.mapOptions) + props.initCallback && props.initCallback(map.value) }) }) diff --git a/superManagement/src/types/views/unitManage/police/policeUnit.ts b/superManagement/src/types/views/unitManage/police/policeUnit.ts index c3bdb3b..7c38d1b 100644 --- a/superManagement/src/types/views/unitManage/police/policeUnit.ts +++ b/superManagement/src/types/views/unitManage/police/policeUnit.ts @@ -76,6 +76,7 @@ export interface EnterprisesUnitPagerVo extends BaseTableRowRecord { streetName?: string; /** 地址 **/ address?: string; + point: [number, number] /** 联系方式 **/ contactPersonInfo?: { name: string; @@ -98,6 +99,7 @@ export interface EnterprisesUnitSaveOrUpdateParams { administrativeDivisionCodes: string[]; /** 详细地址 **/ address?: string; + point?: [number, number] /** 联系人 **/ contactPersonInfo?: { name: string; diff --git a/superManagement/src/utils/aMapUtil.ts b/superManagement/src/utils/aMapUtil.ts index 574e061..5d90620 100644 --- a/superManagement/src/utils/aMapUtil.ts +++ b/superManagement/src/utils/aMapUtil.ts @@ -4,7 +4,7 @@ type Amap = typeof AMap; export const initMap = (plugins?: string[]): Promise => new Promise((resolve, reject) => { //@ts-ignore window._AMapSecurityConfig = { - securityJsCode: '432125a0f8d8cad2dac38b77d6f6728f' + securityJsCode: __APP_ENV.VITE_APP_SECURITY_JS_CODE } AMapLoader.load({ key: __APP_ENV.VITE_APP_GAODE_KEY, diff --git a/superManagement/src/views/unitManage/police/unitManage/index.tsx b/superManagement/src/views/unitManage/police/unitManage/index.tsx index 1b615cc..e4ef716 100644 --- a/superManagement/src/views/unitManage/police/unitManage/index.tsx +++ b/superManagement/src/views/unitManage/police/unitManage/index.tsx @@ -29,6 +29,21 @@ const saveOrUpdateEnterprisesUnit = (params: _FormType, callback: Function) => { let city = ''; + const initMarker = (map: AMap.Map) => { + //添加maker点 设置point + const maker = new AMap.Marker({ + position: _formParams.value.point, + draggable: true + }) + maker.on("dragend", ({lnglat}) => { + _formParams.value.point = lnglat + }) + map.clearMap() + map.add(maker) + map.setFitView() + console.log(123); + } + const _formOptions = ref>({ name: { type: 'input', @@ -62,7 +77,7 @@ const saveOrUpdateEnterprisesUnit = (params: _FormType, callback: Function) => { customRender: () => { + initCallback={(map) => { AMap.plugin(['AMap.AutoComplete'], () => { //@ts-ignore const auto = new AMap.AutoComplete({ @@ -76,25 +91,19 @@ const saveOrUpdateEnterprisesUnit = (params: _FormType, callback: Function) => { message.error('所选点位没有经纬度信息 建议选则附近的手动移动!'); return } - //添加maker点 设置point - const maker = new AMap.Marker({ - position: e.poi.location, - draggable: true - }) - console.log(e); - maker.on("dragend", (e) => { - console.log(e); - - }) - _mapRef.value.mapInstance.add(maker) - _mapRef.value.mapInstance.setFitView() + _formParams.value.point = e.poi.location + initMarker(map) }); }) + if (_formParams.value.point) { + initMarker(map) + } }} >

@@ -176,6 +185,7 @@ export const showEnterprisesUnit = (policeUnitPagerVo: PoliceUnitPagerVo) => { type: record.type.value, administrativeDivisionCodes: [record.province, record.city, record.districts, record.street].filter(Boolean), address: record.address, + point: record.point, contactPersonInfoName: record.contactPersonInfo?.name, contactPersonInfoTelephone: record.contactPersonInfo?.telephone, remark: record.remark diff --git a/superManagement/src/views/unitManage/police/unitManage/index.vue b/superManagement/src/views/unitManage/police/unitManage/index.vue index 68b9f03..3c3975d 100644 --- a/superManagement/src/views/unitManage/police/unitManage/index.vue +++ b/superManagement/src/views/unitManage/police/unitManage/index.vue @@ -129,6 +129,29 @@ const searchFormOptions = ref({ } }) +const a = { + groupId1: { + itemId1: { + standardId: 123123, + deductionPoints: 2 + }, + itemId2: { + standardId: 345345, + deductionPoints: 4 + } + }, + groupId2: { + itemId1: { + standardId: 456456, + deductionPoints: 2 + }, + itemId2: { + standardId: 567567, + deductionPoints: 4 + } + } +} +