feat(assessmentCriteria): 增加企事业单位列表接口并优化考核记录功能
- 新增 OpenApiMapper 接口和对应的 XML 文件,实现根据代码和等级获取企事业单位列表 - 修改 AssessmentRecordController,增加用户类型检查注解- 更新 CkAssessmentRecordMapper 接口和 XML 文件,支持按公安单位 ID 查询考核记录- 修改 AssessmentRecordPagerQueryParams 类,增加新的查询参数 - 更新 CkAssessmentRecordServiceImpl 中的 pager 方法,支持不同用户类型的查询逻辑 - 修改 EnterprisesUnitDetailDTO 类,增加企事业单位类型字段- 新增 OpenGetEnterprisesUnit 类,用于定义企事业单位列表接口的查询参数 - 更新 OpenApiService 接口和 OpenApiServiceImpl 类,实现新的企事业单位列表接口 - 修改前端页面,支持新的查询参数和展示逻辑
This commit is contained in:
parent
18ba81d119
commit
b3b1ee41f5
|
@ -33,8 +33,9 @@ public class OpenController {
|
|||
@Operation(summary = "获取企事业单位列表")
|
||||
@CheckOpenApi(value = OpenApiType.Information_on_enterprises_and_institutions)
|
||||
@GetMapping("/getEnterprisesUnit")
|
||||
public List<SelectNodeVo<Long>> getEnterprisesUnit(@Schema(description = "公安单位机构代码") @RequestParam String policeCode) {
|
||||
return openApiService.getEnterprisesUnit(policeCode);
|
||||
public List<SelectNodeVo<Long>> getEnterprisesUnit(@Schema(description = "代码") @RequestParam String code,
|
||||
@Schema(description = "等级") @RequestParam Integer level) {
|
||||
return openApiService.getEnterprisesUnit(code, level);
|
||||
}
|
||||
|
||||
@Operation(summary = "企事业单位详情")
|
||||
|
|
|
@ -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);
|
||||
}
|
|
@ -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<AssessmentRecordPagerVo> pager(@RequestBody PageParams<AssessmentRecordPagerQueryParams, AssessmentRecordPagerVo> queryParams) {
|
||||
return assessmentRecordService.pager(queryParams);
|
||||
}
|
||||
|
||||
@Operation(summary = "扣分详情")
|
||||
@GetMapping("/deductedDetail")
|
||||
@CheckUserType(userTypes = {UserType.MANAGEMENT_POLICE, UserType.MANAGEMENT_SUPER})
|
||||
public List<AssessmentRecordDetailVo> deductedDetail(@RequestParam Long assessmentRecordId) {
|
||||
return assessmentRecordService.deductedDetail(assessmentRecordId);
|
||||
}
|
||||
|
|
|
@ -19,10 +19,12 @@ public interface CkAssessmentRecordMapper extends BaseMapper<CkAssessmentRecord>
|
|||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param params 查询参数
|
||||
* @param page 分页对象
|
||||
* @param policeUnitId 公安单位id
|
||||
* @param params 查询参数
|
||||
* @return 结果
|
||||
*/
|
||||
Page<AssessmentRecordPagerVo> pager(@Param("page") Page<AssessmentRecordPagerVo> page,
|
||||
@Param("policeUnitId") Long policeUnitId,
|
||||
@Param("params") AssessmentRecordPagerQueryParams params);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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<CkAssessmentRecor
|
|||
|
||||
@Override
|
||||
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
|
||||
|
|
|
@ -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 = "联系人")
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
|
@ -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<SelectNodeVo<Long>> getEnterprisesUnit(String policeCode);
|
||||
List<SelectNodeVo<Long>> getEnterprisesUnit(String code, Integer level);
|
||||
|
||||
/**
|
||||
* 企事业单位详情
|
||||
|
|
|
@ -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<SelectNodeVo<Long>> 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.<Long>builder()
|
||||
.value(item.getSnowFlakeId())
|
||||
.label(item.getName())
|
||||
.build())
|
||||
.toList();
|
||||
public List<SelectNodeVo<Long>> 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())
|
||||
|
|
|
@ -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
|
||||
|
||||
<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
|
||||
order by car.create_time desc
|
||||
</select>
|
||||
|
|
|
@ -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>
|
|
@ -87,13 +87,9 @@ export const ckProjectDetail = async (ckProjectId: string): Promise<CkProjectDet
|
|||
}
|
||||
})
|
||||
|
||||
Object.values(groupRowSpan).forEach(({count, firstIndex}) => {
|
||||
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
|
||||
}
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
ref="tableRef"
|
||||
:request-api="reqApi"
|
||||
:columns="columns"
|
||||
:searchFormOptions="searchFormOptions"
|
||||
>
|
||||
|
||||
</table-pro-max>
|
||||
</template>
|
||||
|
||||
|
@ -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<AssessmentRecordPagerVo, AssessmentRecordPagerQueryParams>
|
||||
const tableRef = ref<ComponentExposed<typeof TableProMax>>(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<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>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
|
Loading…
Reference in New Issue