feat(assessmentCriteria): 增加企事业单位列表接口并优化考核记录功能

- 新增 OpenApiMapper 接口和对应的 XML 文件,实现根据代码和等级获取企事业单位列表
- 修改 AssessmentRecordController,增加用户类型检查注解- 更新 CkAssessmentRecordMapper 接口和 XML 文件,支持按公安单位 ID 查询考核记录- 修改 AssessmentRecordPagerQueryParams 类,增加新的查询参数
- 更新 CkAssessmentRecordServiceImpl 中的 pager 方法,支持不同用户类型的查询逻辑
- 修改 EnterprisesUnitDetailDTO 类,增加企事业单位类型字段- 新增 OpenGetEnterprisesUnit 类,用于定义企事业单位列表接口的查询参数
- 更新 OpenApiService 接口和 OpenApiServiceImpl 类,实现新的企事业单位列表接口
- 修改前端页面,支持新的查询参数和展示逻辑
This commit is contained in:
luozhun 2024-11-15 14:42:01 +08:00
parent 18ba81d119
commit b3b1ee41f5
14 changed files with 164 additions and 30 deletions

View File

@ -33,8 +33,9 @@ public class OpenController {
@Operation(summary = "获取企事业单位列表") @Operation(summary = "获取企事业单位列表")
@CheckOpenApi(value = OpenApiType.Information_on_enterprises_and_institutions) @CheckOpenApi(value = OpenApiType.Information_on_enterprises_and_institutions)
@GetMapping("/getEnterprisesUnit") @GetMapping("/getEnterprisesUnit")
public List<SelectNodeVo<Long>> getEnterprisesUnit(@Schema(description = "公安单位机构代码") @RequestParam String policeCode) { public List<SelectNodeVo<Long>> getEnterprisesUnit(@Schema(description = "代码") @RequestParam String code,
return openApiService.getEnterprisesUnit(policeCode); @Schema(description = "等级") @RequestParam Integer level) {
return openApiService.getEnterprisesUnit(code, level);
} }
@Operation(summary = "企事业单位详情") @Operation(summary = "企事业单位详情")

View File

@ -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<SelectNodeVo<Long>> getEnterprisesUnit(@Param("code") String code,
@Param("level") Integer level);
}

View File

@ -1,7 +1,9 @@
package com.changhu.module.assessmentCriteria.controller; package com.changhu.module.assessmentCriteria.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.changhu.common.annotation.CheckUserType;
import com.changhu.common.annotation.JsonBody; 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.queryParams.AssessmentRecordPagerQueryParams;
import com.changhu.module.assessmentCriteria.pojo.vo.AssessmentRecordDetailVo; import com.changhu.module.assessmentCriteria.pojo.vo.AssessmentRecordDetailVo;
import com.changhu.module.assessmentCriteria.pojo.vo.AssessmentRecordPagerVo; import com.changhu.module.assessmentCriteria.pojo.vo.AssessmentRecordPagerVo;
@ -29,12 +31,14 @@ public class AssessmentRecordController {
@Operation(summary = "考核记录分页") @Operation(summary = "考核记录分页")
@PostMapping("/pager") @PostMapping("/pager")
@CheckUserType(userTypes = {UserType.MANAGEMENT_POLICE, UserType.MANAGEMENT_SUPER})
public Page<AssessmentRecordPagerVo> pager(@RequestBody PageParams<AssessmentRecordPagerQueryParams, AssessmentRecordPagerVo> queryParams) { public Page<AssessmentRecordPagerVo> pager(@RequestBody PageParams<AssessmentRecordPagerQueryParams, AssessmentRecordPagerVo> queryParams) {
return assessmentRecordService.pager(queryParams); return assessmentRecordService.pager(queryParams);
} }
@Operation(summary = "扣分详情") @Operation(summary = "扣分详情")
@GetMapping("/deductedDetail") @GetMapping("/deductedDetail")
@CheckUserType(userTypes = {UserType.MANAGEMENT_POLICE, UserType.MANAGEMENT_SUPER})
public List<AssessmentRecordDetailVo> deductedDetail(@RequestParam Long assessmentRecordId) { public List<AssessmentRecordDetailVo> deductedDetail(@RequestParam Long assessmentRecordId) {
return assessmentRecordService.deductedDetail(assessmentRecordId); return assessmentRecordService.deductedDetail(assessmentRecordId);
} }

View File

@ -20,9 +20,11 @@ public interface CkAssessmentRecordMapper extends BaseMapper<CkAssessmentRecord>
* 分页查询 * 分页查询
* *
* @param page 分页对象 * @param page 分页对象
* @param policeUnitId 公安单位id
* @param params 查询参数 * @param params 查询参数
* @return 结果 * @return 结果
*/ */
Page<AssessmentRecordPagerVo> pager(@Param("page") Page<AssessmentRecordPagerVo> page, Page<AssessmentRecordPagerVo> pager(@Param("page") Page<AssessmentRecordPagerVo> page,
@Param("policeUnitId") Long policeUnitId,
@Param("params") AssessmentRecordPagerQueryParams params); @Param("params") AssessmentRecordPagerQueryParams params);
} }

View File

@ -13,4 +13,10 @@ import lombok.Data;
public class AssessmentRecordPagerQueryParams { public class AssessmentRecordPagerQueryParams {
@Schema(description = "企事业单位类型") @Schema(description = "企事业单位类型")
private EnterprisesUnitType type; private EnterprisesUnitType type;
@Schema(description = "公安单位名称")
private String policeUnitName;
@Schema(description = "企事业单位名称")
private String enterprisesUnitName;
@Schema(description = "考核人")
private String assessmentUserName;
} }

View File

@ -4,8 +4,10 @@ import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.extension.toolkit.Db; import com.baomidou.mybatisplus.extension.toolkit.Db;
import com.changhu.common.db.enums.UserType;
import com.changhu.common.enums.ResultCode; import com.changhu.common.enums.ResultCode;
import com.changhu.common.exception.MessageException; 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.CkAssessmentRecordMapper;
import com.changhu.module.assessmentCriteria.mapper.CkProjectMapper; import com.changhu.module.assessmentCriteria.mapper.CkProjectMapper;
import com.changhu.module.assessmentCriteria.pojo.entity.CkAssessmentRecord; import com.changhu.module.assessmentCriteria.pojo.entity.CkAssessmentRecord;
@ -35,7 +37,10 @@ public class CkAssessmentRecordServiceImpl extends ServiceImpl<CkAssessmentRecor
@Override @Override
public Page<AssessmentRecordPagerVo> pager(PageParams<AssessmentRecordPagerQueryParams, AssessmentRecordPagerVo> queryParams) { public Page<AssessmentRecordPagerVo> pager(PageParams<AssessmentRecordPagerQueryParams, AssessmentRecordPagerVo> 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 @Override

View File

@ -1,5 +1,6 @@
package com.changhu.pojo.dto; package com.changhu.pojo.dto;
import com.changhu.common.db.enums.EnterprisesUnitType;
import com.changhu.module.management.pojo.model.ContactPersonInfo; import com.changhu.module.management.pojo.model.ContactPersonInfo;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
@ -24,6 +25,8 @@ public class EnterprisesUnitDetailDTO {
private Long snowFlakeId; private Long snowFlakeId;
@Schema(description = "名字") @Schema(description = "名字")
private String name; private String name;
@Schema(description = "类型")
private EnterprisesUnitType type;
@Schema(description = "地址") @Schema(description = "地址")
private String address; private String address;
@Schema(description = "联系人") @Schema(description = "联系人")

View File

@ -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
}
}

View File

@ -3,6 +3,7 @@ package com.changhu.service;
import com.changhu.common.pojo.vo.SelectNodeVo; import com.changhu.common.pojo.vo.SelectNodeVo;
import com.changhu.pojo.dto.DataViewDTO; import com.changhu.pojo.dto.DataViewDTO;
import com.changhu.pojo.dto.EnterprisesUnitDetailDTO; import com.changhu.pojo.dto.EnterprisesUnitDetailDTO;
import com.changhu.pojo.queryParams.OpenGetEnterprisesUnit;
import java.util.List; import java.util.List;
@ -15,10 +16,11 @@ public interface OpenApiService {
/** /**
* 获取企事业单位列表 * 获取企事业单位列表
* *
* @param policeCode 公安机构代码 * @param code 代码
* @param level 等级
* @return 企事业单位列表 * @return 企事业单位列表
*/ */
List<SelectNodeVo<Long>> getEnterprisesUnit(String policeCode); List<SelectNodeVo<Long>> getEnterprisesUnit(String code, Integer level);
/** /**
* 企事业单位详情 * 企事业单位详情

View File

@ -3,6 +3,7 @@ package com.changhu.service.impl;
import com.baomidou.mybatisplus.extension.toolkit.Db; import com.baomidou.mybatisplus.extension.toolkit.Db;
import com.changhu.common.exception.MessageException; import com.changhu.common.exception.MessageException;
import com.changhu.common.pojo.vo.SelectNodeVo; 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.EnterprisesUnit;
import com.changhu.module.management.pojo.entity.PoliceUnit; import com.changhu.module.management.pojo.entity.PoliceUnit;
import com.changhu.module.management.pojo.entity.SecurityUnit; 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.module.miniProgram.pojo.entity.SecurityUser;
import com.changhu.pojo.dto.DataViewDTO; import com.changhu.pojo.dto.DataViewDTO;
import com.changhu.pojo.dto.EnterprisesUnitDetailDTO; import com.changhu.pojo.dto.EnterprisesUnitDetailDTO;
import com.changhu.pojo.queryParams.OpenGetEnterprisesUnit;
import com.changhu.service.OpenApiService; import com.changhu.service.OpenApiService;
import com.changhu.support.mybatisplus.pojo.entity.BaseEntity; import com.changhu.support.mybatisplus.pojo.entity.BaseEntity;
import lombok.SneakyThrows; import lombok.SneakyThrows;
@ -30,18 +32,12 @@ public class OpenApiServiceImpl implements OpenApiService {
@Autowired @Autowired
private ServiceProjectService serviceProjectService; private ServiceProjectService serviceProjectService;
@Autowired
private OpenApiMapper openApiMapper;
@Override @Override
public List<SelectNodeVo<Long>> getEnterprisesUnit(String policeCode) { public List<SelectNodeVo<Long>> getEnterprisesUnit(String code, Integer level) {
PoliceUnit policeUnit = Db.lambdaQuery(PoliceUnit.class).eq(PoliceUnit::getCode, policeCode).oneOpt().orElseThrow(() -> new MessageException("当前系统没有该派出所")); return openApiMapper.getEnterprisesUnit(code, level);
return Db.lambdaQuery(EnterprisesUnit.class)
.eq(EnterprisesUnit::getPoliceUnitId, policeUnit.getSnowFlakeId())
.list()
.stream()
.map(item -> SelectNodeVo.<Long>builder()
.value(item.getSnowFlakeId())
.label(item.getName())
.build())
.toList();
} }
@Override @Override
@ -52,6 +48,7 @@ public class OpenApiServiceImpl implements OpenApiService {
.map(item -> EnterprisesUnitDetailDTO.builder() .map(item -> EnterprisesUnitDetailDTO.builder()
.snowFlakeId(item.getSnowFlakeId()) .snowFlakeId(item.getSnowFlakeId())
.name(item.getName()) .name(item.getName())
.type(item.getType())
.address(item.getAddress()) .address(item.getAddress())
.contactPersonInfo(item.getContactPersonInfo()) .contactPersonInfo(item.getContactPersonInfo())
.remark(item.getRemark()) .remark(item.getRemark())

View File

@ -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_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 left join ck_standard cs on card.ck_standard_id = cs.snow_flake_id
where car.delete_flag = 0 where car.delete_flag = 0
<if test="policeUnitId!=null">
and eu.police_unit_id = #{policeUnitId}
</if>
<if test="params.type!=null">
and cp.type = #{params.type.value}
</if>
<if test="params.policeUnitName!=null and params.policeUnitName!=''">
and pu.name like concat('%',#{params.policeUnitName},'%')
</if>
<if test="params.enterprisesUnitName!=null and params.enterprisesUnitName!=''">
and eu.name like concat('%',#{params.enterprisesUnitName},'%')
</if>
<if test="params.assessmentUserName!=null and params.assessmentUserName!=''">
and mpu.name like concat('%',#{params.assessmentUserName},'%')
</if>
group by car.snow_flake_id group by car.snow_flake_id
order by car.create_time desc order by car.create_time desc
</select> </select>

View File

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.changhu.mapper.OpenApiMapper">
<select id="getEnterprisesUnit" resultType="com.changhu.common.pojo.vo.SelectNodeVo">
select
eu.snow_flake_id as 'value',
eu.name as 'label'
from enterprises_unit eu
left join police_unit pu on eu.police_unit_id = pu.snow_flake_id
where eu.delete_flag = 0
<choose>
<when test="level==1">
and eu.province = #{code}
</when>
<when test="level==2">
and eu.city = #{code}
</when>
<when test="level==3">
and eu.districts = #{code}
</when>
<when test="level==4">
and eu.street = #{code}
</when>
<when test="level==5">
and pu.code = #{code}
</when>
<otherwise>and eu.snow_flake_id = -1</otherwise>
</choose>
order by eu.create_time desc
</select>
</mapper>

View File

@ -87,13 +87,9 @@ export const ckProjectDetail = async (ckProjectId: string): Promise<CkProjectDet
} }
}) })
Object.values(groupRowSpan).forEach(({count, firstIndex}) => { Object.values(groupRowSpan).forEach(({count, firstIndex}) => data[firstIndex].groupRowSpan = count)
data[firstIndex].groupRowSpan = count;
})
Object.values(itemRowSpan).forEach(({count, firstIndex}) => { Object.values(itemRowSpan).forEach(({count, firstIndex}) => data[firstIndex].itemRowSpan = count)
data[firstIndex].itemRowSpan = count;
})
return data return data
} }

View File

@ -3,8 +3,8 @@
ref="tableRef" ref="tableRef"
:request-api="reqApi" :request-api="reqApi"
:columns="columns" :columns="columns"
:searchFormOptions="searchFormOptions"
> >
</table-pro-max> </table-pro-max>
</template> </template>
@ -20,16 +20,16 @@ import {
AssessmentRecordPagerVo AssessmentRecordPagerVo
} from "@/types/views/unitManage/police/assessmentRecord.ts"; } from "@/types/views/unitManage/police/assessmentRecord.ts";
import {deductedDetail} from "@/views/unitManage/police/assessmentRecord/index.tsx"; import {deductedDetail} from "@/views/unitManage/police/assessmentRecord/index.tsx";
import {dictSelectNodes} from "@/config/dict.ts";
type TableProps = TableProMaxProps<AssessmentRecordPagerVo, AssessmentRecordPagerQueryParams> type TableProps = TableProMaxProps<AssessmentRecordPagerVo, AssessmentRecordPagerQueryParams>
const tableRef = ref<ComponentExposed<typeof TableProMax>>(null) const tableRef = ref<ComponentExposed<typeof TableProMax>>(null)
const reqApi: TableProps["requestApi"] = (params) => { const reqApi: TableProps["requestApi"] = (params) => api.post('/assessmentRecord/pager', params)
return api.post('/assessmentRecord/pager', params)
}
const columns: TableProps['columns'] = [ const columns: TableProps['columns'] = [
{ {
dataIndex: 'enterprisesUnitName', dataIndex: 'enterprisesUnitName',
title: '单位名称' title: '事业单位'
}, { }, {
dataIndex: 'type', dataIndex: 'type',
title: '类型', title: '类型',
@ -84,6 +84,29 @@ const columns: TableProps['columns'] = [
}, },
} }
] ]
const searchFormOptions = ref<TableProps['searchFormOptions']>({
type: {
type: 'select',
label: '单位类型',
options: [{
value: null,
label: '全部'
}, ...dictSelectNodes('EnterprisesUnitType')]
},
policeUnitName: {
type: 'input',
label: '公安单位',
},
enterprisesUnitName: {
type: 'input',
label: '事业单位'
},
assessmentUserName: {
type: 'input',
label: '考核人'
}
})
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">