From b3b1ee41f5e3562a6d78c7b344ae08d55ac94096 Mon Sep 17 00:00:00 2001 From: luozhun <2025254074@qq.com> Date: Fri, 15 Nov 2024 14:42:01 +0800 Subject: [PATCH] =?UTF-8?q?feat(assessmentCriteria):=20=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E4=BC=81=E4=BA=8B=E4=B8=9A=E5=8D=95=E4=BD=8D=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=B9=B6=E4=BC=98=E5=8C=96=E8=80=83=E6=A0=B8?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增 OpenApiMapper 接口和对应的 XML 文件,实现根据代码和等级获取企事业单位列表 - 修改 AssessmentRecordController,增加用户类型检查注解- 更新 CkAssessmentRecordMapper 接口和 XML 文件,支持按公安单位 ID 查询考核记录- 修改 AssessmentRecordPagerQueryParams 类,增加新的查询参数 - 更新 CkAssessmentRecordServiceImpl 中的 pager 方法,支持不同用户类型的查询逻辑 - 修改 EnterprisesUnitDetailDTO 类,增加企事业单位类型字段- 新增 OpenGetEnterprisesUnit 类,用于定义企事业单位列表接口的查询参数 - 更新 OpenApiService 接口和 OpenApiServiceImpl 类,实现新的企事业单位列表接口 - 修改前端页面,支持新的查询参数和展示逻辑 --- .../changhu/controller/OpenController.java | 5 +-- .../com/changhu/mapper/OpenApiMapper.java | 26 +++++++++++++++ .../AssessmentRecordController.java | 4 +++ .../mapper/CkAssessmentRecordMapper.java | 6 ++-- .../AssessmentRecordPagerQueryParams.java | 6 ++++ .../impl/CkAssessmentRecordServiceImpl.java | 7 +++- .../pojo/dto/EnterprisesUnitDetailDTO.java | 3 ++ .../queryParams/OpenGetEnterprisesUnit.java | 24 ++++++++++++++ .../com/changhu/service/OpenApiService.java | 6 ++-- .../service/impl/OpenApiServiceImpl.java | 19 +++++------ .../mapper/CkAssessmentRecordMapper.xml | 16 ++++++++- .../main/resources/mapper/OpenApiMapper.xml | 31 +++++++++++++++++ .../police/assessmentCriteria/index.ts | 8 ++--- .../police/assessmentRecord/index.vue | 33 ++++++++++++++++--- 14 files changed, 164 insertions(+), 30 deletions(-) create mode 100644 policeSecurityServer/src/main/java/com/changhu/mapper/OpenApiMapper.java create mode 100644 policeSecurityServer/src/main/java/com/changhu/pojo/queryParams/OpenGetEnterprisesUnit.java create mode 100644 policeSecurityServer/src/main/resources/mapper/OpenApiMapper.xml diff --git a/policeSecurityServer/src/main/java/com/changhu/controller/OpenController.java b/policeSecurityServer/src/main/java/com/changhu/controller/OpenController.java index f8a5b92..531f532 100644 --- a/policeSecurityServer/src/main/java/com/changhu/controller/OpenController.java +++ b/policeSecurityServer/src/main/java/com/changhu/controller/OpenController.java @@ -33,8 +33,9 @@ public class OpenController { @Operation(summary = "获取企事业单位列表") @CheckOpenApi(value = OpenApiType.Information_on_enterprises_and_institutions) @GetMapping("/getEnterprisesUnit") - public List> getEnterprisesUnit(@Schema(description = "公安单位机构代码") @RequestParam String policeCode) { - return openApiService.getEnterprisesUnit(policeCode); + public List> getEnterprisesUnit(@Schema(description = "代码") @RequestParam String code, + @Schema(description = "等级") @RequestParam Integer level) { + return openApiService.getEnterprisesUnit(code, level); } @Operation(summary = "企事业单位详情") diff --git a/policeSecurityServer/src/main/java/com/changhu/mapper/OpenApiMapper.java b/policeSecurityServer/src/main/java/com/changhu/mapper/OpenApiMapper.java new file mode 100644 index 0000000..4ca5ecc --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/mapper/OpenApiMapper.java @@ -0,0 +1,26 @@ +package com.changhu.mapper; + +import com.changhu.common.pojo.vo.SelectNodeVo; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * @author 20252 + * @createTime 2024/11/15 下午2:27 + * @desc OpenApiMapper... + */ +@Mapper +public interface OpenApiMapper { + + /** + * 根据单位获取企事业单位 + * + * @param code 代码 + * @param level 等级 + * @return 企事业单位 + */ + List> getEnterprisesUnit(@Param("code") String code, + @Param("level") Integer level); +} diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/controller/AssessmentRecordController.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/controller/AssessmentRecordController.java index 7cfb7fc..c8111d8 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/controller/AssessmentRecordController.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/controller/AssessmentRecordController.java @@ -1,7 +1,9 @@ package com.changhu.module.assessmentCriteria.controller; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.changhu.common.annotation.CheckUserType; import com.changhu.common.annotation.JsonBody; +import com.changhu.common.db.enums.UserType; import com.changhu.module.assessmentCriteria.pojo.queryParams.AssessmentRecordPagerQueryParams; import com.changhu.module.assessmentCriteria.pojo.vo.AssessmentRecordDetailVo; import com.changhu.module.assessmentCriteria.pojo.vo.AssessmentRecordPagerVo; @@ -29,12 +31,14 @@ public class AssessmentRecordController { @Operation(summary = "考核记录分页") @PostMapping("/pager") + @CheckUserType(userTypes = {UserType.MANAGEMENT_POLICE, UserType.MANAGEMENT_SUPER}) public Page pager(@RequestBody PageParams queryParams) { return assessmentRecordService.pager(queryParams); } @Operation(summary = "扣分详情") @GetMapping("/deductedDetail") + @CheckUserType(userTypes = {UserType.MANAGEMENT_POLICE, UserType.MANAGEMENT_SUPER}) public List deductedDetail(@RequestParam Long assessmentRecordId) { return assessmentRecordService.deductedDetail(assessmentRecordId); } 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 index 13bc5c3..3d77347 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/mapper/CkAssessmentRecordMapper.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/mapper/CkAssessmentRecordMapper.java @@ -19,10 +19,12 @@ public interface CkAssessmentRecordMapper extends BaseMapper /** * 分页查询 * - * @param page 分页对象 - * @param params 查询参数 + * @param page 分页对象 + * @param policeUnitId 公安单位id + * @param params 查询参数 * @return 结果 */ Page pager(@Param("page") Page page, + @Param("policeUnitId") Long policeUnitId, @Param("params") AssessmentRecordPagerQueryParams params); } diff --git a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/queryParams/AssessmentRecordPagerQueryParams.java b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/queryParams/AssessmentRecordPagerQueryParams.java index ff6d855..ef5a4ed 100644 --- a/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/queryParams/AssessmentRecordPagerQueryParams.java +++ b/policeSecurityServer/src/main/java/com/changhu/module/assessmentCriteria/pojo/queryParams/AssessmentRecordPagerQueryParams.java @@ -13,4 +13,10 @@ import lombok.Data; public class AssessmentRecordPagerQueryParams { @Schema(description = "企事业单位类型") private EnterprisesUnitType type; + @Schema(description = "公安单位名称") + private String policeUnitName; + @Schema(description = "企事业单位名称") + private String enterprisesUnitName; + @Schema(description = "考核人") + private String assessmentUserName; } 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 index de08d5b..1e4fd22 100644 --- 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 @@ -4,8 +4,10 @@ import cn.hutool.core.bean.BeanUtil; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.toolkit.Db; +import com.changhu.common.db.enums.UserType; import com.changhu.common.enums.ResultCode; import com.changhu.common.exception.MessageException; +import com.changhu.common.utils.UserUtil; import com.changhu.module.assessmentCriteria.mapper.CkAssessmentRecordMapper; import com.changhu.module.assessmentCriteria.mapper.CkProjectMapper; import com.changhu.module.assessmentCriteria.pojo.entity.CkAssessmentRecord; @@ -35,7 +37,10 @@ public class CkAssessmentRecordServiceImpl extends ServiceImpl pager(PageParams queryParams) { - return baseMapper.pager(queryParams.getPage(), queryParams.getParams()); + if (UserType.MANAGEMENT_POLICE.equals(UserUtil.getUserType())) { + return baseMapper.pager(queryParams.getPage(), UserUtil.getUnitId(), queryParams.getParams()); + } + return baseMapper.pager(queryParams.getPage(), null, queryParams.getParams()); } @Override diff --git a/policeSecurityServer/src/main/java/com/changhu/pojo/dto/EnterprisesUnitDetailDTO.java b/policeSecurityServer/src/main/java/com/changhu/pojo/dto/EnterprisesUnitDetailDTO.java index 65161b0..12fb4f7 100644 --- a/policeSecurityServer/src/main/java/com/changhu/pojo/dto/EnterprisesUnitDetailDTO.java +++ b/policeSecurityServer/src/main/java/com/changhu/pojo/dto/EnterprisesUnitDetailDTO.java @@ -1,5 +1,6 @@ package com.changhu.pojo.dto; +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.AllArgsConstructor; @@ -24,6 +25,8 @@ public class EnterprisesUnitDetailDTO { private Long snowFlakeId; @Schema(description = "名字") private String name; + @Schema(description = "类型") + private EnterprisesUnitType type; @Schema(description = "地址") private String address; @Schema(description = "联系人") diff --git a/policeSecurityServer/src/main/java/com/changhu/pojo/queryParams/OpenGetEnterprisesUnit.java b/policeSecurityServer/src/main/java/com/changhu/pojo/queryParams/OpenGetEnterprisesUnit.java new file mode 100644 index 0000000..1aecba2 --- /dev/null +++ b/policeSecurityServer/src/main/java/com/changhu/pojo/queryParams/OpenGetEnterprisesUnit.java @@ -0,0 +1,24 @@ +package com.changhu.pojo.queryParams; + +import lombok.Data; +import lombok.Getter; + +/** + * @author 20252 + * @createTime 2024/11/15 下午2:16 + * @desc OpenGetEnterprisesUnit... + */ +@Data +public class OpenGetEnterprisesUnit { + + private SearchType searchType; + + private String code; + private Integer level; + + @Getter + public enum SearchType { + ADMINISTRATIVE_DIVISION, + POLICE_UNIT + } +} diff --git a/policeSecurityServer/src/main/java/com/changhu/service/OpenApiService.java b/policeSecurityServer/src/main/java/com/changhu/service/OpenApiService.java index c471c95..2cf64f5 100644 --- a/policeSecurityServer/src/main/java/com/changhu/service/OpenApiService.java +++ b/policeSecurityServer/src/main/java/com/changhu/service/OpenApiService.java @@ -3,6 +3,7 @@ package com.changhu.service; import com.changhu.common.pojo.vo.SelectNodeVo; import com.changhu.pojo.dto.DataViewDTO; import com.changhu.pojo.dto.EnterprisesUnitDetailDTO; +import com.changhu.pojo.queryParams.OpenGetEnterprisesUnit; import java.util.List; @@ -15,10 +16,11 @@ public interface OpenApiService { /** * 获取企事业单位列表 * - * @param policeCode 公安机构代码 + * @param code 代码 + * @param level 等级 * @return 企事业单位列表 */ - List> getEnterprisesUnit(String policeCode); + List> getEnterprisesUnit(String code, Integer level); /** * 企事业单位详情 diff --git a/policeSecurityServer/src/main/java/com/changhu/service/impl/OpenApiServiceImpl.java b/policeSecurityServer/src/main/java/com/changhu/service/impl/OpenApiServiceImpl.java index 12843aa..0df0c7e 100644 --- a/policeSecurityServer/src/main/java/com/changhu/service/impl/OpenApiServiceImpl.java +++ b/policeSecurityServer/src/main/java/com/changhu/service/impl/OpenApiServiceImpl.java @@ -3,6 +3,7 @@ package com.changhu.service.impl; import com.baomidou.mybatisplus.extension.toolkit.Db; import com.changhu.common.exception.MessageException; import com.changhu.common.pojo.vo.SelectNodeVo; +import com.changhu.mapper.OpenApiMapper; import com.changhu.module.management.pojo.entity.EnterprisesUnit; import com.changhu.module.management.pojo.entity.PoliceUnit; import com.changhu.module.management.pojo.entity.SecurityUnit; @@ -10,6 +11,7 @@ import com.changhu.module.management.service.ServiceProjectService; import com.changhu.module.miniProgram.pojo.entity.SecurityUser; import com.changhu.pojo.dto.DataViewDTO; import com.changhu.pojo.dto.EnterprisesUnitDetailDTO; +import com.changhu.pojo.queryParams.OpenGetEnterprisesUnit; import com.changhu.service.OpenApiService; import com.changhu.support.mybatisplus.pojo.entity.BaseEntity; import lombok.SneakyThrows; @@ -30,18 +32,12 @@ public class OpenApiServiceImpl implements OpenApiService { @Autowired private ServiceProjectService serviceProjectService; + @Autowired + private OpenApiMapper openApiMapper; + @Override - public List> getEnterprisesUnit(String policeCode) { - PoliceUnit policeUnit = Db.lambdaQuery(PoliceUnit.class).eq(PoliceUnit::getCode, policeCode).oneOpt().orElseThrow(() -> new MessageException("当前系统没有该派出所")); - return Db.lambdaQuery(EnterprisesUnit.class) - .eq(EnterprisesUnit::getPoliceUnitId, policeUnit.getSnowFlakeId()) - .list() - .stream() - .map(item -> SelectNodeVo.builder() - .value(item.getSnowFlakeId()) - .label(item.getName()) - .build()) - .toList(); + public List> getEnterprisesUnit(String code, Integer level) { + return openApiMapper.getEnterprisesUnit(code, level); } @Override @@ -52,6 +48,7 @@ public class OpenApiServiceImpl implements OpenApiService { .map(item -> EnterprisesUnitDetailDTO.builder() .snowFlakeId(item.getSnowFlakeId()) .name(item.getName()) + .type(item.getType()) .address(item.getAddress()) .contactPersonInfo(item.getContactPersonInfo()) .remark(item.getRemark()) diff --git a/policeSecurityServer/src/main/resources/mapper/CkAssessmentRecordMapper.xml b/policeSecurityServer/src/main/resources/mapper/CkAssessmentRecordMapper.xml index b2716f3..bd2c55f 100644 --- a/policeSecurityServer/src/main/resources/mapper/CkAssessmentRecordMapper.xml +++ b/policeSecurityServer/src/main/resources/mapper/CkAssessmentRecordMapper.xml @@ -19,7 +19,21 @@ left join ck_assessment_record_details card on car.snow_flake_id = card.ck_assessment_record_id and card.delete_flag = 0 left join ck_standard cs on card.ck_standard_id = cs.snow_flake_id where car.delete_flag = 0 - + + and eu.police_unit_id = #{policeUnitId} + + + and cp.type = #{params.type.value} + + + and pu.name like concat('%',#{params.policeUnitName},'%') + + + and eu.name like concat('%',#{params.enterprisesUnitName},'%') + + + and mpu.name like concat('%',#{params.assessmentUserName},'%') + group by car.snow_flake_id order by car.create_time desc diff --git a/policeSecurityServer/src/main/resources/mapper/OpenApiMapper.xml b/policeSecurityServer/src/main/resources/mapper/OpenApiMapper.xml new file mode 100644 index 0000000..81e52b6 --- /dev/null +++ b/policeSecurityServer/src/main/resources/mapper/OpenApiMapper.xml @@ -0,0 +1,31 @@ + + + + + \ No newline at end of file diff --git a/superManagement/src/views/unitManage/police/assessmentCriteria/index.ts b/superManagement/src/views/unitManage/police/assessmentCriteria/index.ts index b3137ff..e5813a9 100644 --- a/superManagement/src/views/unitManage/police/assessmentCriteria/index.ts +++ b/superManagement/src/views/unitManage/police/assessmentCriteria/index.ts @@ -87,13 +87,9 @@ export const ckProjectDetail = async (ckProjectId: string): Promise { - data[firstIndex].groupRowSpan = count; - }) + Object.values(groupRowSpan).forEach(({count, firstIndex}) => data[firstIndex].groupRowSpan = count) - Object.values(itemRowSpan).forEach(({count, firstIndex}) => { - data[firstIndex].itemRowSpan = count; - }) + Object.values(itemRowSpan).forEach(({count, firstIndex}) => data[firstIndex].itemRowSpan = count) return data } diff --git a/superManagement/src/views/unitManage/police/assessmentRecord/index.vue b/superManagement/src/views/unitManage/police/assessmentRecord/index.vue index 2800200..1a561fa 100644 --- a/superManagement/src/views/unitManage/police/assessmentRecord/index.vue +++ b/superManagement/src/views/unitManage/police/assessmentRecord/index.vue @@ -3,8 +3,8 @@ ref="tableRef" :request-api="reqApi" :columns="columns" + :searchFormOptions="searchFormOptions" > - @@ -20,16 +20,16 @@ import { AssessmentRecordPagerVo } from "@/types/views/unitManage/police/assessmentRecord.ts"; import {deductedDetail} from "@/views/unitManage/police/assessmentRecord/index.tsx"; +import {dictSelectNodes} from "@/config/dict.ts"; + type TableProps = TableProMaxProps const tableRef = ref>(null) -const reqApi: TableProps["requestApi"] = (params) => { - return api.post('/assessmentRecord/pager', params) -} +const reqApi: TableProps["requestApi"] = (params) => api.post('/assessmentRecord/pager', params) const columns: TableProps['columns'] = [ { dataIndex: 'enterprisesUnitName', - title: '单位名称' + title: '事业单位' }, { dataIndex: 'type', title: '类型', @@ -84,6 +84,29 @@ const columns: TableProps['columns'] = [ }, } ] +const searchFormOptions = ref({ + type: { + type: 'select', + label: '单位类型', + options: [{ + value: null, + label: '全部' + }, ...dictSelectNodes('EnterprisesUnitType')] + }, + policeUnitName: { + type: 'input', + label: '公安单位', + }, + enterprisesUnitName: { + type: 'input', + label: '事业单位' + }, + assessmentUserName: { + type: 'input', + label: '考核人' + } +}) +