Merge remote-tracking branch 'origin/main'

# Conflicts:
#	collect_information/.env.development
This commit is contained in:
wangyilin 2024-12-02 10:18:26 +08:00
commit f80ef7bc85
31 changed files with 1122 additions and 251 deletions

View File

@ -21,4 +21,8 @@ VITE_APP_RSA_PUBLIC_KEY=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDJps/EXxxSpEM1Ix4R
# 高德 lz
VITE_APP_GAODE_KEY=f379a3f860a68d7438526275d6a94b05
VITE_APP_GAODE_VERSION=2.0
VITE_APP_SECURITY_JS_CODE=432125a0f8d8cad2dac38b77d6f6728f
VITE_APP_SECURITY_JS_CODE=432125a0f8d8cad2dac38b77d6f6728f
# minio
VITE_APP_MINIO_URL=http://118.253.177.137:9000
VITE_APP_MINIO_BUCKET=police-security-dev

View File

@ -12,4 +12,8 @@ VITE_APP_RSA_PUBLIC_KEY=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCpu1C3JHZ+Ng/eVVCZ
# 高德
VITE_APP_GAODE_KEY=f379a3f860a68d7438526275d6a94b05
VITE_APP_GAODE_VERSION=2.0
VITE_APP_SECURITY_JS_CODE=432125a0f8d8cad2dac38b77d6f6728f
VITE_APP_SECURITY_JS_CODE=432125a0f8d8cad2dac38b77d6f6728f
# minio
VITE_APP_MINIO_URL=https://www.hnjinglian.cn:9002
VITE_APP_MINIO_BUCKET=police-security

View File

@ -34,6 +34,7 @@ declare module 'vue' {
APagination: typeof import('ant-design-vue/es')['Pagination']
APopconfirm: typeof import('ant-design-vue/es')['Popconfirm']
APopover: typeof import('ant-design-vue/es')['Popover']
AProgress: typeof import('ant-design-vue/es')['Progress']
ARadioGroup: typeof import('ant-design-vue/es')['RadioGroup']
ARangePicker: typeof import('ant-design-vue/es')['RangePicker']
ARow: typeof import('ant-design-vue/es')['Row']

View File

@ -1,15 +1,18 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
<link rel="icon" type="image/svg+xml" href="/vite.svg"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<script type="module" src="/src/assets/iconfont/iconfont.js"></script>
<title>Vite + Vue + TS</title>
<title>公安后台</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
</html>

View File

@ -1,8 +1,9 @@
<template>
<div class="simpleUploadDiv">
<a-progress v-if="uploading" type="circle" :percent="percent" />
<a-image height="80%" v-else :src="minioBaseUrl + modelValue" alt="avatar" />
<a-button class="btn-success" @click="selectFile">{{ btnLabel }}</a-button>
<!-- height="80%" width="80%" -->
<a-image v-else :src="minioBaseUrl + modelValue" alt="avatar" />
<a-button style="margin-top: 4px" class="btn-success" @click="selectFile">{{ btnLabel }}</a-button>
<input id="myFileInput" type="file" style="display: none" />
</div>
</template>

View File

@ -14,6 +14,8 @@ export interface PoliceUnitPagerQueryParams {
}
export interface PoliceUnitPagerVo extends BaseTableRowRecord {
sex: { label: string }
/** 名称 **/
name?: string;
/** 代码 **/
@ -53,6 +55,7 @@ export interface EnterprisesUnitPagerQueryParams {
}
export interface EnterprisesUnitPagerVo extends BaseTableRowRecord {
sex: { label: string }
/** 名字 **/
name?: string;
type: BaseEnum<string>
@ -86,9 +89,12 @@ export interface EnterprisesUnitPagerVo extends BaseTableRowRecord {
remark?: string;
}
export interface EnterprisesUnitSaveOrUpdateParams {
/** id **/
snowFlakeId?: string;
/** 公安单位id **/
policeUnitId: string;
/** 名称 **/
@ -108,3 +114,47 @@ export interface EnterprisesUnitSaveOrUpdateParams {
/** 备注 **/
remark?: string;
}
export interface securityUnitIdListParams {
snowFlakeId?: string;
serviceProjectId?: string;
securityUnitId?: string;
name?: string;
remark?: string;
photo?: string;
telephone?: string;
workPost?: string;
sex?: string;
nativePlace?: string;
idCard?: string;
dateOfBirth?: string;
securityNumber?: string;
noSecurityNumberDesc?: string;
homeAddress?: string;
}
export interface securityUnitIdListPagerVo {
snowFlakeId?: string;
serviceProjectId?: string;
securityUnitId?: string;
name?: string;
remark?: string;
photo?: string;
telephone?: {
desensitizedValue?: string;
originalValue?: string;
};
workPost?: string;
sex?: {
label?: string;
value: number | string
};
nativePlace?: string;
idCard?: {
desensitizedValue?: string;
originalValue?: string;
};
dateOfBirth?: string;
securityNumber?: string;
noSecurityNumberDesc?: string;
homeAddress?: string;
}

View File

@ -1,148 +0,0 @@
<template>
<div>
<TableProMax ref="tableRef" :request-api="reqApi" :columns="columns">
</TableProMax>
<div>
<a-modal v-model:open="open" title="扣分项" @ok="open = false" width="80%">
<a-table :columns="TableColumns" :data-source="dataSource" :pagination="false" bordered>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'itemName'">
<ul>
<li v-for="(item, index) in record.itemName" :key="index">
{{ item.itemName }}
</li>
</ul>
</template>
<template v-if="column.key === 'deductionStandards'">
<ul>
<li v-for="(item, index) in record.itemName" :key="index">
<ul>
<li v-for="(standard, standardIndex) in item.standards" :key="standardIndex">
{{ standard.standardName }}
</li>
</ul>
</li>
</ul>
</template>
</template>
</a-table>
</a-modal>>
</div>
</div>
</template>
<script setup lang="tsx">
import TableProMax from "@/components/table/TableProMax.vue";
import api from "@/axios";
import {TableProMaxProps} from "@/types/components/table";
import {
AssessmentRecordPagerQueryParams,
AssessmentRecordPagerVo,
} from "@/types/views/assessmentRecord.ts";
import {ComponentExposed} from "vue-component-type-helpers";
import {computed, ref} from "vue";
import {Modal} from "ant-design-vue";
const tableRef = ref<ComponentExposed<typeof TableProMax>>(null!)
type TableProps = TableProMaxProps<AssessmentRecordPagerVo,AssessmentRecordPagerQueryParams>
const open = ref<boolean>(false);
const reqApi: TableProps['requestApi'] = (params) => api.post('/assessmentRecord/pager', params) //
const columns: TableProps['columns'] = [
{
dataIndex: 'enterprisesUnitName',
title: '单位名称'
}, {
dataIndex: 'type',
title: '类型',
customRender: ({text}) => text?.label
}, {
dataIndex: 'ckProjectName',
title: '考核项目'
}, {
dataIndex: 'totalScore',
title: '总分'
}, {
dataIndex: 'deductionPointsTotal',
title: '扣分',
customRender:({record})=>{
if (!record.deductionPointsTotal) {
return <a-tag color="green">0</a-tag>
}
return <a-tag class="pointer" color="red" onClick={()=>deductionPointsTotalTable(record)}>{record.deductionPointsTotal}</a-tag>
}
}, {
dataIndex: 'result',
title: '得分',
customRender: ({record}) => record.totalScore - record.deductionPointsTotal
}, {
dataIndex: 'policeUnitName',
title: '考核单位'
}, {
dataIndex: 'createUserName',
title: '考核人'
}, {
dataIndex: 'createTime',
title: '考核时间'
}, {
dataIndex: 'remark',
title: '考核备注'
}, {
dataIndex: 'signature',
title: '签字',
customRender:({record})=>{
return <a-button onClick={()=>{
Modal.info({
title: `${record.enterprisesUnitName}${record.ckProjectName} 签字结果`,
content: () => <>
<div>审核人签字: <a-image src={record.assessmentUserSignature}/>
</div>
<div>被审核单位人员签字: <a-image src={record.byAssessmentEnterprisesUnitUserSignature}/></div>
</>
})
}}>查看</a-button>
},
}
]
const groupRow = ref({})
const TableColumns = [
{ title: '考核分组', dataIndex: 'groupName', key: 'groupName' },
{ title: '考核项', dataIndex: 'itemName', key: 'itemName', slots: { customRender: 'bodyCell' } },
{ title: '扣分标准', dataIndex: 'deductionStandards', key: 'deductionStandards', slots: { customRender: 'bodyCell' } }
];
const dataSource = computed(() => {
return Object.keys(groupRow.value).map(groupName => ({
key: groupName,
groupName: groupName,
itemName: Object.values(groupRow.value[groupName])
}));
});
const deductionPointsTotalTable =async(record:AssessmentRecordPagerVo)=>{
const resp = await api.get('/assessmentRecord/deductedDetail',{assessmentRecordId:record.snowFlakeId})
resp.data.forEach((item,index)=>{
if (!groupRow.value[item.groupName]) {
groupRow.value[item.groupName] = {};
}
if (!groupRow.value[item.groupName][item.ckItemId]) {
groupRow.value[item.groupName][item.ckItemId] = {
itemName: item.itemName,
standards: []
};
}
groupRow.value[item.groupName][item.ckItemId].standards.push(item);
})
open.value = true
}
</script>
<style scoped lang="scss">
</style>

View File

@ -0,0 +1,346 @@
import { TableProMaxProps, TableProMaxSlots } from '@/types/components/table'
import { EnterprisesUnitPagerQueryParams, securityUnitIdListPagerVo, securityUnitIdListParams, PoliceUnitPagerVo } from '@/types/views/unitManage/police/policeUnit.ts'
import { reactive, ref, h } from 'vue'
import { FormExpose } from 'ant-design-vue/es/form/Form'
import { ComponentExposed } from 'vue-component-type-helpers'
import { FormProMaxItemOptions } from '@/types/components/form'
import { dictSelectNodes } from '@/config/dict.ts'
import { Button, message, Modal, Space, Tag, Input } 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'
import { debounce } from 'lodash-es'
import { SearchOutlined } from '@ant-design/icons-vue'
import axios from 'axios'
import SingleImageFileUpload from '@/components/upload/SingleImageFileUpload.vue'
type _TableProps = TableProMaxProps<securityUnitIdListPagerVo, EnterprisesUnitPagerQueryParams>
const _formParams = reactive<securityUnitIdListParams>({
snowFlakeId: '', //
serviceProjectId: '', // 服务项目id
securityUnitId: '', // 保安单位id
name: '', //
photo: '',
telephone: '',
workPost: '',
sex: '',
nativePlace: '',
idCard: '',
dateOfBirth: '',
securityNumber: '',
noSecurityNumberDesc: '',
homeAddress: '',
remark: '',
})
const searchSecurityUnitId = debounce(async () => {
if (process.env.NODE_ENV === 'development') {
console.log('process.env.NODE_ENV === development')
const res = await axios.get(`https://www.hnjinglian.cn:5678/common/querySecurityNumberByIdCard?idCard=${_formParams.idCard}`)
if (res.data?.data?.hasOwnProperty('bayzh')) {
_formParams.securityNumber = res.data.data.bayzh
message.success(res.data.message)
} else {
message.error('未查询到保安证件号')
}
} else {
const res = await api.get<any>('/common/querySecurityNumberByIdCard', { idCard: _formParams.idCard })
if (res.data?.data?.hasOwnProperty('bayzh')) {
_formParams.securityNumber = res.data.data.bayzh
message.success(res.data.message)
} else {
message.error('未查询到保安证件号')
}
}
}, 300)
const saveOrUpdateEnterprisesUnit = (callback: Function, params, type: string) => {
// console.log('🚀 ~ saveOrUpdateEnterprisesUnit ~ params:', params)
if (type === 'add') {
_formParams.serviceProjectId = params.snowFlakeId
_formParams.securityUnitId = params.securityUnitId
} else {
_formParams.snowFlakeId = params.snowFlakeId
_formParams.serviceProjectId = params.serviceProjectId
_formParams.securityUnitId = params.securityUnitId
_formParams.name = params.name
_formParams.photo = params?.photo
_formParams.telephone = params.telephone.originalValue
_formParams.workPost = params.workPost
_formParams.sex = params.sex.value
_formParams.nativePlace = params.nativePlace
_formParams.idCard = params.idCard.originalValue
_formParams.dateOfBirth = params.dateOfBirth
_formParams.securityNumber = params.securityNumber
_formParams.noSecurityNumberDesc = params?.noSecurityNumberDesc
_formParams.homeAddress = params.homeAddress
_formParams.remark = params.remark
}
const _formRef = ref<FormExpose>(null)
const uploadFileRef = ref(null)
const _formOptions = ref<FormProMaxItemOptions<securityUnitIdListParams>>({
photo: {
type: 'custom',
label: '头像',
customRender: () => <SingleImageFileUpload height={200} v-model:value={_formParams.photo} ref={uploadFileRef} />,
},
name: {
type: 'input',
label: '姓名',
required: true,
},
idCard: {
type: 'custom',
label: '身份证',
required: true,
customRender: () => (
<Space>
<Input allow-clear v-model:value={_formParams.idCard} placeholder={'请输入身份证号'} />
<Button type={'primary'} icon={h(SearchOutlined)} onClick={() => searchSecurityUnitId()}>
</Button>
</Space>
),
},
telephone: {
type: 'input',
label: '手机号',
required: true,
},
sex: {
type: 'radioGroup',
label: '性别',
required: true,
options: [...dictSelectNodes('Sex')],
},
securityNumber: {
type: 'input',
label: '保安证号',
required: true,
},
dateOfBirth: {
type: 'datePicker',
label: '出生日期',
componentsProps: {
valueFormat: 'YYYY-MM-DD HH:mm:ss',
},
required: true,
},
workPost: {
type: 'input',
label: '工作岗位',
},
nativePlace: {
type: 'input',
label: '籍贯',
},
homeAddress: {
type: 'input',
label: '家庭住址',
},
noSecurityNumberDesc: {
type: 'input',
label: '无证说明',
},
remark: {
type: 'inputTextArea',
label: '备注',
},
})
Modal.confirm({
title: params.name ? `${params.name}】 编辑保安信息` : '新增保安人员',
width: 600,
icon: ' ',
centered: true,
content: () => <FormProMax ref={_formRef} v-model:value={_formParams} formItemOptions={_formOptions.value} />,
onOk: async () => {
await _formRef.value?.validate()
const resp = await api.post('/m2/eu/add_upd_sec_user', {
..._formParams,
})
message.success(resp.message)
callback && callback()
},
onCancel: async () => {
_formParams.snowFlakeId = ''
_formParams.serviceProjectId = ''
_formParams.securityUnitId = ''
_formParams.name = ''
_formParams.photo = ''
_formParams.telephone = ''
_formParams.workPost = ''
_formParams.sex = ''
_formParams.nativePlace = ''
_formParams.idCard = ''
_formParams.dateOfBirth = ''
_formParams.securityNumber = ''
_formParams.noSecurityNumberDesc = ''
_formParams.homeAddress = ''
_formParams.remark = ''
},
})
}
export const showEnterprisesUnit = (record_) => {
// console.log('🚀 ~ showEnterprisesUnit ~ record_:', record_)
const _tableRef = ref<ComponentExposed<typeof TableProMax>>(null)
const _columns: _TableProps['columns'] = [
{
dataIndex: 'name',
title: '姓名',
width: 100,
ellipsis: true,
},
{
dataIndex: 'idCard',
title: '身份证',
customRender: ({ text }) => {
return text.desensitizedValue
},
width: 160,
ellipsis: true,
},
{
dataIndex: 'sex',
title: '性别',
width: 60,
customRender: ({ record }) => {
return <Tag color={'success'}>{record.sex.label}</Tag>
},
},
{
dataIndex: 'dateOfBirth',
title: '出生日期',
width: 100,
ellipsis: true,
},
{
dataIndex: 'telephone',
title: '手机号',
width: 120,
ellipsis: true,
customRender: ({ text }) => text?.originalValue,
},
{
dataIndex: 'securityNumber',
title: '保安证号',
width: 120,
ellipsis: true,
},
{
dataIndex: 'nativePlace',
title: '籍贯',
width: 120,
ellipsis: true,
},
{
dataIndex: 'workPost',
title: '工作岗位',
width: 120,
ellipsis: true,
},
{
dataIndex: 'homeAddress',
title: '家庭住址',
width: 120,
ellipsis: true,
},
{
dataIndex: 'remark',
title: '备注',
width: 120,
},
{
dataIndex: 'createTime',
title: '创建时间',
width: 120,
ellipsis: true,
},
{
dataIndex: 'opt',
title: '操作',
width: 200,
fixed: 'right',
customRender: ({ record }) => (
<Space>
<Button class='btn-warn' onClick={() => saveOrUpdateEnterprisesUnit(_tableRef.value?.requestGetTableData, record, 'edit')}>
</Button>
<Button
class='btn-danger'
onClick={() =>
deleteDataModal(record.name, async () => {
const resp = await api.delete('/m2/eu/del_security_user_id', {
securityUserId: record?.snowFlakeId,
})
message.success(resp.message)
await _tableRef.value?.requestGetTableData()
})
}
>
</Button>
</Space>
),
},
]
const x: number = _columns.reduce((a, b) => a + (b.width as number), 0)
const _reqApi: _TableProps['requestApi'] = (params) => {
// console.log(record_);
;(params as PageParams<EnterprisesUnitPagerQueryParams>).params.serviceProjectId = record_.snowFlakeId
return api.post('/m2/eu/sec_user_pager', params)
}
Modal.info({
title: `${record_.name}】 管理保安人员`,
width: '80%',
centered: true,
maskClosable: true,
content: () => (
<TableProMax
scroll={{ x: x }}
ref={_tableRef}
size='small'
columns={_columns}
requestApi={_reqApi}
// searchFormOptions={{
// name: {
// type: 'input',
// label: '姓名',
// },
// securityNumber: {
// type: 'input',
// label: '保安证号',
// },
// telephone: {
// type: 'input',
// label: '手机号',
// },
// }}
v-slots={
{
tableHeader: (_) => {
return (
<Space>
<Button class='btn-success' onClick={() => saveOrUpdateEnterprisesUnit(_tableRef.value?.requestGetTableData, record_, 'add')}>
</Button>
</Space>
)
},
} as TableProMaxSlots<PoliceUnitPagerVo>
}
/>
),
})
}

View File

@ -1,8 +1,7 @@
<template>
<div>
<!-- expand-column-widt 展开按钮宽度-->
<!-- :expandRowByClick="true" 点击行展开 -->
<TableProMax
style="width: 100%"
:expandedRowRender="expandedRowRender"
:expand-column-width="50"
:defaultExpandAllRows="false"
@ -10,16 +9,13 @@
:request-api="reqApi"
:columns="columns"
:searchFormOptions="searchFormOptions"
:scroll="{ x }"
:scroll="{ x: x }"
>
<template #tableHeader>
<a-space>
<a-button type="primary" @click="saveOrUpdateEnterprisesUnit">新增企事业单位</a-button>
</a-space>
</template>
<!-- <template #expandedRowRender="{ record }">
<p>{{ record }}</p>
</template> -->
</TableProMax>
<a-modal v-model:open="visible" :title="serviceTitle" @ok="submit" @cancel="closeModal">
<FormProMax ref="formRef" v-model:value="formParams" :form-item-options="formItemOptions" />
@ -44,6 +40,7 @@ import { publicUnitPagerQueryParams } from '@/types/views/publicUnit.ts'
import { FormProMaxItemOptions } from '@/types/components/form//index.ts'
import { FormExpose } from 'ant-design-vue/es/form/Form'
import { serviceProjectSaveOrUpdateParams_ } from '@/types/views/serviceManagement'
import { showEnterprisesUnit } from './index.tsx'
type _FormType = EnterprisesUnitSaveOrUpdateParams & {
contactPersonInfoName?: string
contactPersonInfoTelephone?: string
@ -56,6 +53,7 @@ const columns: TableProps['columns'] = [
{
dataIndex: 'name',
title: '单位名称',
width: 200,
},
{
@ -64,11 +62,14 @@ const columns: TableProps['columns'] = [
customRender: ({ record }) => {
return `${record?.provinceName}/${record?.cityName}/${record?.districtsName}/${record?.streetName}`
},
width: 300,
},
{
dataIndex: 'address',
title: '详细地址',
width: 200,
ellipsis: true,
},
{
@ -77,6 +78,7 @@ const columns: TableProps['columns'] = [
customRender: ({ record }) => {
return record?.contactPersonInfo?.name
},
width: 200,
},
{
dataIndex: 'contactPersonInfo',
@ -84,16 +86,21 @@ const columns: TableProps['columns'] = [
customRender: ({ record }) => {
return record?.contactPersonInfo?.telephone
},
width: 150,
},
{
dataIndex: 'createTime',
title: '创建时间',
width: 120,
ellipsis: true,
},
{
dataIndex: 'remark',
title: '备注',
width: 120,
ellipsis: true,
},
{
width: 200,
dataIndex: 'opt',
title: '操作',
customRender: ({ record }) => (
@ -139,7 +146,11 @@ const columns: TableProps['columns'] = [
),
},
]
const x: number = columns.reduce((a, b) => a + (b.width as number), 0)
// const x: number = columns.reduce((a, b) => a + (b.width as number), 0)
const x: number = columns.reduce((a, b) => {
console.log('x_____________________', a, b, b.width)
return a + (b.width as number)
}, 0)
const saveOrUpdateEnterprisesUnit = (params: _FormType, callback: Function) => {
const _formRef = ref<FormExpose>(null)
@ -179,8 +190,6 @@ const saveOrUpdateEnterprisesUnit = (params: _FormType, callback: Function) => {
initMarker(_mapRef.value?.mapInstance)
}}
onSearch={debounce((val: string) => {
console.log('onSearch___________________', val)
//@ts-ignore
const auto = new AMap.AutoComplete({
city: city,
@ -188,7 +197,6 @@ const saveOrUpdateEnterprisesUnit = (params: _FormType, callback: Function) => {
citylimit: true,
})
auto.search(val, (status, result) => {
console.log('🚀 ~ auto.search ~ status, result:', status, result)
if (status === 'complete') {
//
autoAddress.value = result.tips?.map((e) => {
@ -296,7 +304,7 @@ const saveOrUpdateEnterprisesUnit = (params: _FormType, callback: Function) => {
icon: ' ',
centered: true,
content: () => <FormProMax ref={_formRef} v-model:value={_formParams.value} formItemOptions={_formOptions.value} />,
onOk: async () => {
onOk: debounce(async () => {
await _formRef.value?.validate()
const resp = await api.post('/eu/add_upd', {
@ -310,7 +318,7 @@ const saveOrUpdateEnterprisesUnit = (params: _FormType, callback: Function) => {
await tableRef.value?.requestGetTableData()
callback && callback()
},
}, 300),
})
}
@ -478,24 +486,33 @@ const formItemOptions = ref<FormProMaxItemOptions<serviceProjectSaveOrUpdatePara
},
})
const _tableRef = ref<ComponentExposed<typeof TableProMax>>(null)
const expandedRowRender: TableProMaxProps['expandedRowRender'] = ({ record }) => {
console.log('🚀 ~ record:', record)
const _tableRef = ref(null)
const deleteAccount = async (snowFlakeId) => {
const resp = await api.delete('/m2/eu/deleteSpById', {
serviceProjectId: snowFlakeId,
})
message.success(resp.message)
await _tableRef.value?.requestGetTableData()
}
const expandedRowRender: TableProMaxProps['expandedRowRender'] = ({ record }) => {
const _columns: _TableProps['columns'] = [
{
dataIndex: 'name',
title: '服务项目名称',
width: 120,
},
{
dataIndex: 'type',
title: '服务类型',
customRender: ({ text }) => <a-tag>{text?.label}</a-tag>,
width: 120,
},
{
dataIndex: 'twoType',
title: '二级类型',
customRender: ({ text }) => <a-tag>{text?.label}</a-tag>,
width: 120,
},
{
dataIndex: 'outsourceName',
@ -505,45 +522,69 @@ const expandedRowRender: TableProMaxProps['expandedRowRender'] = ({ record }) =>
return record.outsourceName
}
},
width: 120,
ellipsis: true,
},
{
dataIndex: 'isFiling',
title: '是否备案',
customRender: ({ text }) => <a-tag>{text?.label}</a-tag>,
customRender: ({ text }) => {
if (text?.label === '是') {
return <a-tag color={'success'}>{text?.label}</a-tag>
} else {
return <a-tag color={'error'}>{text?.label}</a-tag>
}
},
width: 120,
},
{
dataIndex: 'idNumber',
title: '保安服务许可证',
width: 200,
ellipsis: true,
},
{
dataIndex: 'serviceArea',
title: '服务区域面积',
width: 60,
ellipsis: true,
},
{
dataIndex: 'buildingTotal',
title: '楼栋数量',
width: 60,
ellipsis: true,
},
{
dataIndex: 'houseTotal',
title: '户数',
width: 60,
ellipsis: true,
},
{
dataIndex: 'staffTotal',
title: '工作人员数量',
width: 60,
ellipsis: true,
},
{
dataIndex: 'securityUserTotal',
title: '保安人员数量',
width: 60,
ellipsis: true,
},
{
dataIndex: 'remark',
title: '备注',
width: 120,
},
{
dataIndex: 'createUserInfo',
title: '创建人',
width: 200,
ellipsis: true,
customRender: ({ record }) => {
return (
<div>
@ -557,28 +598,27 @@ const expandedRowRender: TableProMaxProps['expandedRowRender'] = ({ record }) =>
{
dataIndex: 'createTime',
title: '创建时间',
width: 120,
ellipsis: true,
},
{
dataIndex: 'opt',
title: '操作',
fixed: 'right',
width: 300,
customRender({ record }) {
return (
<a-space>
<a-button class='btn-success' onClick={() => showEnterprisesUnit(record)}>
保安人员
</a-button>
<a-button
type='primary'
class='btn-warn'
onClick={async () => {
console.log('🚀 ~ customRender ~ record:编辑回显参数', record)
visible.value = true
serviceTitle.value = '编辑服务项目'
idNumberDisabled.value = record.twoType.value !== 'outsource'
{
/* */
}
formParams.value.securityUnitId = record.securityUnitId //id
formParams.value.enterprisesUnitId = record.enterprisesUnitId //id
formParams.value.snowFlakeId = record.snowFlakeId //id
formParams.value.projectManagerMiniProgramUserId = record.projectManagerMiniProgramUserId //id
@ -594,24 +634,11 @@ const expandedRowRender: TableProMaxProps['expandedRowRender'] = ({ record }) =>
formParams.value.houseTotal = record.houseTotal //
formParams.value.staffTotal = record.staffTotal //
formParams.value.securityUserTotal = record.securityUserTotal //
{
/* formParams.value.administrativeDivisionCodes = record.enterprisesUnitAdministrativeDivisionCodes */
}
}}
>
编辑
</a-button>
<a-popconfirm
title='确认删除账号吗?'
onConfirm={async () => {
const resp = await api.delete('/m2/eu/deleteSpById', {
serviceProjectId: record.snowFlakeId,
})
message.success(resp.message)
await _tableRef.value?.requestGetTableData()
}}
>
<a-popconfirm title='确认删除账号吗?' onConfirm={() => deleteAccount(record.snowFlakeId)}>
<a-button danger>删除</a-button>
</a-popconfirm>
</a-space>
@ -619,23 +646,24 @@ const expandedRowRender: TableProMaxProps['expandedRowRender'] = ({ record }) =>
},
},
]
const _reqApi: _TableProps['requestApi'] = async (params) => {
console.log('🚀 ~ params:', params)
const x2: number = _columns.reduce((a, b) => a + (b.width as number), 0)
const _reqApi: _TableProps['requestApi'] = async () => {
// @ts-ignore
return await api.get('/m2/eu/listSp', { enterprisesUnitId: record?.snowFlakeId })
}
return (
<TableProMax
scroll={{ x: x2 }}
ref={_tableRef}
size='small'
columns={_columns}
requestApi={_reqApi}
isPagination={false}
v-slots={{
tableHeader: (_) => {
tableHeader: () => {
return (
<Space>
<Button class='btn-success' onClick={() => addService(record)}>
<Button type={'primary'} onClick={() => addService(record)}>
新增服务项目
</Button>
</Space>
@ -669,12 +697,8 @@ const closeModal = async () => {
}
const submit = async () => {
console.log('formParams.value____________________', formParams.value)
await formRef.value.validate()
const serviceProjectSaveOrUpdateParams = { ...formParams.value }
const resp = await api.post('/m2/eu/add_upd_sp', serviceProjectSaveOrUpdateParams)
message.success(resp.message)
await _tableRef.value.requestGetTableData()
@ -686,7 +710,6 @@ onMounted(async () => {
securityUnitIdList.value = res.data
})
const addService = function (record) {
console.log('🚀 ~ addService ~ record:', record)
formParams.value.enterprisesUnitId = record.snowFlakeId //Id
visible.value = true
}

View File

@ -29,7 +29,7 @@ import FormProMax from '@/components/form/FormProMax.vue'
import { FormProMaxItemOptions } from '@/types/components/form'
import { FormExpose } from 'ant-design-vue/es/form/Form'
import { publicUnitPagerQueryParams, FromItem } from '@/types/views/publicUnit.ts'
import { ComponentExposed } from 'vue-component-type-helpers'
const tableRef = ref<ComponentExposed<typeof TableProMax>>(null!)
const formRef = ref<FormExpose>(null)
type TableProps = TableProMaxProps<publicUnitPagerQueryParams>

View File

@ -17,4 +17,8 @@ public class CreateOrUpdateUser {
private String name;
@Schema(description = "用户类型")
private UserType type;
@Schema(description = "单位id")
private Long unitId;
@Schema(description = "单位名字")
private String unitName;
}

View File

@ -1,5 +1,6 @@
package com.changhu.controller;
import com.alibaba.fastjson2.JSONObject;
import com.changhu.common.annotation.IsWhiteList;
import com.changhu.common.annotation.JsonBody;
import com.changhu.common.cache.GlobalCacheManager;
@ -94,4 +95,10 @@ public class CommonController {
return enumsResult;
}
@Operation(summary = "根据身份证查询保安证")
@GetMapping("/querySecurityNumberByIdCard")
public JSONObject querySecurityNumberByIdCard(@RequestParam @Schema(description = "身份证") String idCard) {
return commonService.querySecurityNumberByIdCard(idCard);
}
}

View File

@ -4,7 +4,9 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.changhu.common.annotation.CheckUserType;
import com.changhu.common.annotation.IsWhiteList;
import com.changhu.common.annotation.JsonBody;
import com.changhu.common.db.enums.MiniProgramUserIdentity;
import com.changhu.common.db.enums.UserType;
import com.changhu.common.pojo.vo.SelectNodeVo;
import com.changhu.pojo.params.CheckStatusParams;
import com.changhu.pojo.params.UnitDisableOrEnableParams;
import com.changhu.pojo.vo.UnitCheckStatusVo;
@ -13,13 +15,13 @@ import com.changhu.pojo.vo.UnitMiniProgramUserPagerVo;
import com.changhu.service.ManagementService;
import com.changhu.support.mybatisplus.pojo.params.PageParams;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @author 20252
@ -61,4 +63,17 @@ public class ManagementController {
public void disableOrEnableMiniProgramUser(@RequestBody @Valid UnitDisableOrEnableParams params) {
managementService.disableOrEnableMiniProgramUser(params);
}
@Operation(summary = "所有的保安单位列表")
@GetMapping("/listSecurityUnit")
public List<SelectNodeVo<Long>> listSecurityUnit() {
return managementService.listSecurityUnit();
}
@Operation(summary = "保安单位下的项目经理")
@GetMapping("/listMinUserByUnitId")
public List<SelectNodeVo<Long>> listMinUserByUnitId(@RequestParam @Schema(description = "保安单位id") Long securityUnitId,
@RequestParam @Schema(description = "身份类型") MiniProgramUserIdentity identity) {
return managementService.listMinUserByUnitId(securityUnitId, identity);
}
}

View File

@ -3,7 +3,7 @@ package com.changhu.module.miniProgram.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.changhu.common.annotation.IsWhiteList;
import com.changhu.common.annotation.JsonBody;
import com.changhu.module.miniProgram.pojo.params.SaveOrUpdateSecurityUserParams;
import com.changhu.module.miniProgram.pojo.params.SecurityUserSaveOrUpdateParams;
import com.changhu.module.miniProgram.pojo.params.UserRegisterParams;
import com.changhu.module.miniProgram.pojo.queryParams.ServiceProjectSecurityUserPagerQueryParams;
import com.changhu.module.miniProgram.pojo.vo.ServiceProjectSecurityUserPagerVo;
@ -39,20 +39,14 @@ public class UserController {
@Operation(summary = "保存或更新保安人员")
@PostMapping("/add_security_user_upd")
public void saveOrUpdateSecurityUser(@RequestBody @Valid SaveOrUpdateSecurityUserParams params) {
public void saveOrUpdateSecurityUser(@RequestBody @Valid SecurityUserSaveOrUpdateParams params) {
userService.saveOrUpdateSecurityUser(params);
}
@Operation(summary = "根据id删除保安人员")
@DeleteMapping("/del_security_user_id")
public void deleteSecurityUserById(@RequestParam @Schema(description = "保安人员id") Long securityUserId) {
userService.deleteSecurityUserByServiceProjectId(securityUserId);
}
@Operation(summary = "二维码表单录入保安人员")
@PostMapping("/qrCodeFormInputSecurityUser")
@IsWhiteList
public void qrCodeFormInputSecurityUser(@RequestBody @Valid SaveOrUpdateSecurityUserParams params) {
public void qrCodeFormInputSecurityUser(@RequestBody @Valid SecurityUserSaveOrUpdateParams params) {
userService.qrCodeFormInputSecurityUser(params);
}
@ -61,4 +55,10 @@ public class UserController {
public Page<ServiceProjectSecurityUserPagerVo> securityUserPager(@RequestBody PageParams<ServiceProjectSecurityUserPagerQueryParams, ServiceProjectSecurityUserPagerVo> queryParams) {
return userService.securityUserPager(queryParams);
}
@Operation(summary = "根据id删除保安人员")
@DeleteMapping("/del_security_user_id")
public void deleteSecurityUserById(@RequestParam @Schema(description = "保安人员id") Long securityUserId) {
userService.deleteSecurityUserById(securityUserId);
}
}

View File

@ -15,7 +15,7 @@ import lombok.Data;
* @desc SaveOrUpdateSecurityUserParams...
*/
@Data
public class SaveOrUpdateSecurityUserParams {
public class SecurityUserSaveOrUpdateParams {
@Schema(description = "id")
private Long snowFlakeId;
@ -27,6 +27,9 @@ public class SaveOrUpdateSecurityUserParams {
@Schema(description = "保安单位id")
private Long securityUnitId;
@Schema(description = "照片")
private String photo;
@NotBlank(message = "名字不能为空")
@Schema(description = "名称")
private String name;
@ -57,6 +60,9 @@ public class SaveOrUpdateSecurityUserParams {
@Schema(description = "保安证号")
private String securityNumber;
@Schema(description = "无证说明")
private String noSecurityNumberDesc;
@Schema(description = "家庭住址")
private String homeAddress;

View File

@ -1,7 +1,7 @@
package com.changhu.module.miniProgram.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.changhu.module.miniProgram.pojo.params.SaveOrUpdateSecurityUserParams;
import com.changhu.module.miniProgram.pojo.params.SecurityUserSaveOrUpdateParams;
import com.changhu.module.miniProgram.pojo.params.UserRegisterParams;
import com.changhu.module.miniProgram.pojo.queryParams.ServiceProjectSecurityUserPagerQueryParams;
import com.changhu.module.miniProgram.pojo.vo.ServiceProjectSecurityUserPagerVo;
@ -25,14 +25,14 @@ public interface UserService {
*
* @param params 保安人员参数
*/
void saveOrUpdateSecurityUser(SaveOrUpdateSecurityUserParams params);
void saveOrUpdateSecurityUser(SecurityUserSaveOrUpdateParams params);
/**
* 根据id删除保安人员
* 二维码表单录入保安人员
*
* @param securityUserId 保安人员id
* @param params 参数
*/
void deleteSecurityUserByServiceProjectId(Long securityUserId);
void qrCodeFormInputSecurityUser(SecurityUserSaveOrUpdateParams params);
/**
* 服务项目内的保安人员分页
@ -43,9 +43,9 @@ public interface UserService {
Page<ServiceProjectSecurityUserPagerVo> securityUserPager(PageParams<ServiceProjectSecurityUserPagerQueryParams, ServiceProjectSecurityUserPagerVo> queryParams);
/**
* 二维码表单录入保安人员
* 根据id删除保安人员
*
* @param params 参数
* @param securityUserId 保安人员id
*/
void qrCodeFormInputSecurityUser(SaveOrUpdateSecurityUserParams params);
void deleteSecurityUserById(Long securityUserId);
}

View File

@ -3,12 +3,14 @@ package com.changhu.module.miniProgram.service.impl;
import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.toolkit.Assert;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.toolkit.Db;
import com.changhu.common.enums.ResultCode;
import com.changhu.common.exception.MessageException;
import com.changhu.common.utils.SnowFlakeIdUtil;
import com.changhu.mapper.SecurityUserMapper;
import com.changhu.module.miniProgram.pojo.params.SaveOrUpdateSecurityUserParams;
import com.changhu.module.miniProgram.pojo.params.SecurityUserSaveOrUpdateParams;
import com.changhu.module.miniProgram.pojo.params.UserRegisterParams;
import com.changhu.module.miniProgram.pojo.queryParams.ServiceProjectSecurityUserPagerQueryParams;
import com.changhu.module.miniProgram.pojo.vo.ServiceProjectSecurityUserPagerVo;
@ -56,17 +58,7 @@ public class UserServiceImpl implements UserService {
}
@Override
public Page<ServiceProjectSecurityUserPagerVo> securityUserPager(PageParams<ServiceProjectSecurityUserPagerQueryParams, ServiceProjectSecurityUserPagerVo> queryParams) {
return securityUserMapper.securityUserPager(queryParams.getPage(), queryParams.getParams());
}
@Override
public void qrCodeFormInputSecurityUser(SaveOrUpdateSecurityUserParams params) {
this.saveOrUpdateSecurityUser(params);
}
@Override
public void saveOrUpdateSecurityUser(SaveOrUpdateSecurityUserParams params) {
public void saveOrUpdateSecurityUser(SecurityUserSaveOrUpdateParams params) {
SecurityUser securityUser = BeanUtil.copyProperties(params, SecurityUser.class);
//新增的情况
Long snowFlakeId = securityUser.getSnowFlakeId();
@ -92,17 +84,21 @@ public class UserServiceImpl implements UserService {
}
}
}
boolean b = Db.saveOrUpdate(securityUser);
if (!b) {
throw new MessageException();
}
Assert.isTrue(Db.saveOrUpdate(securityUser), ResultCode.ERROR.getMessage());
}
@Override
public void deleteSecurityUserByServiceProjectId(Long securityUserId) {
boolean b = Db.removeById(securityUserId, SecurityUser.class);
if (!b) {
throw new MessageException();
}
public void qrCodeFormInputSecurityUser(SecurityUserSaveOrUpdateParams params) {
this.saveOrUpdateSecurityUser(params);
}
@Override
public Page<ServiceProjectSecurityUserPagerVo> securityUserPager(PageParams<ServiceProjectSecurityUserPagerQueryParams, ServiceProjectSecurityUserPagerVo> queryParams) {
return securityUserMapper.securityUserPager(queryParams.getPage(), queryParams.getParams());
}
@Override
public void deleteSecurityUserById(Long securityUserId) {
Assert.isTrue(Db.removeById(securityUserId, SecurityUser.class), ResultCode.ERROR.getMessage());
}
}

View File

@ -0,0 +1,79 @@
package com.changhu.module.policeManagement.controller;
import com.baomidou.mybatisplus.core.toolkit.Assert;
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.db.enums.UserType;
import com.changhu.common.enums.ResultCode;
import com.changhu.module.miniProgram.pojo.params.SecurityUserSaveOrUpdateParams;
import com.changhu.module.miniProgram.pojo.queryParams.ServiceProjectSecurityUserPagerQueryParams;
import com.changhu.module.miniProgram.pojo.vo.ServiceProjectSecurityUserPagerVo;
import com.changhu.module.policeManagement.pojo.params.ServiceProjectSaveOrUpdateParams;
import com.changhu.module.policeManagement.pojo.vo.ServiceProjectListVo;
import com.changhu.module.policeManagement.service.PoliceEnterprisesUnitService;
import com.changhu.pojo.entity.ServiceProject;
import com.changhu.support.mybatisplus.pojo.params.PageParams;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @author 20252
* @createTime 2024/11/27 下午2:37
* @desc EnterprisesUnitController...
*/
@Tag(name = "公安后台-企事业单位")
@JsonBody
@RequestMapping("/m2/eu")
@RestController("policeManagementEnterprisesUnit")
@CheckUserType(userTypes = UserType.MANAGEMENT_POLICE)
public class EnterprisesUnitController {
@Autowired
private PoliceEnterprisesUnitService policeEnterprisesUnitService;
@Operation(summary = "事业单位下服务项目列表")
@GetMapping("/listSp")
public List<ServiceProjectListVo> listSp(@RequestParam @Schema(description = "事业单位id") Long enterprisesUnitId) {
return policeEnterprisesUnitService.listSp(enterprisesUnitId);
}
@Operation(summary = "新增或保存服务项目")
@PostMapping("/add_upd_sp")
public void saveOrUpdateSp(@RequestBody @Valid ServiceProjectSaveOrUpdateParams params) {
policeEnterprisesUnitService.saveOrUpdateSp(params);
}
@Operation(summary = "根据id删除服务项目")
@DeleteMapping("/deleteSpById")
public void deleteSpById(@RequestParam Long serviceProjectId) {
Assert.isTrue(Db.removeById(serviceProjectId, ServiceProject.class), ResultCode.ERROR.getMessage());
}
@Operation(summary = "新增或修改保安人员")
@PostMapping("/add_upd_sec_user")
public void saveOrUpdateSecurityUser(@RequestBody @Valid SecurityUserSaveOrUpdateParams params) {
policeEnterprisesUnitService.saveOrUpdateSecurityUser(params);
}
@Operation(summary = "服务项目保安人员分页")
@PostMapping("/sec_user_pager")
public Page<ServiceProjectSecurityUserPagerVo> securityUserPager(@RequestBody PageParams<ServiceProjectSecurityUserPagerQueryParams, ServiceProjectSecurityUserPagerVo> queryParams) {
return policeEnterprisesUnitService.securityUserPager(queryParams);
}
@Operation(summary = "根据id删除保安人员")
@DeleteMapping("/del_security_user_id")
public void deleteSecurityUserById(@RequestParam @Schema(description = "保安人员id") Long securityUserId) {
policeEnterprisesUnitService.deleteSecurityUserById(securityUserId);
}
}

View File

@ -0,0 +1,22 @@
package com.changhu.module.policeManagement.mapper;
import com.changhu.module.policeManagement.pojo.vo.ServiceProjectListVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @author 20252
* @createTime 2024/11/27 下午2:39
* @desc PoliceEnterprisesUnitMapper...
*/
@Mapper
public interface PoliceEnterprisesUnitMapper {
/**
* 事业单位下的服务项目
*/
List<ServiceProjectListVo> listSp(@Param("unitId") Long unitId,
@Param("enterprisesUnitId") Long enterprisesUnitId);
}

View File

@ -0,0 +1,68 @@
package com.changhu.module.policeManagement.pojo.params;
import com.changhu.common.db.enums.IsOrNot;
import com.changhu.common.db.enums.ServiceProjectTwoType;
import com.changhu.common.db.enums.ServiceProjectType;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
/**
* @author 20252
* @createTime 2024/11/27 下午3:24
* @desc ServiceProjectSaveOrUpdateParams...
*/
@Data
public class ServiceProjectSaveOrUpdateParams {
@Schema(description = "id")
private Long snowFlakeId;
@Schema(description = "企事业单位id")
@NotNull(message = "企事业单位不能为空")
private Long enterprisesUnitId;
@Schema(description = "保安单位id")
@NotNull(message = "保安单位不能为空")
private Long securityUnitId;
@Schema(description = "项目经理小程序用户id")
private Long projectManagerMiniProgramUserId;
@Schema(description = "名称")
@NotNull(message = "名称不能为空")
private String name;
@Schema(description = "服务类型")
@NotNull(message = "服务类型不能为空")
private ServiceProjectType type;
@Schema(description = "二级类型")
private ServiceProjectTwoType twoType;
@Schema(description = "外包公司名称")
private String outsourceName;
@Schema(description = "是否备案")
private IsOrNot isFiling;
@Schema(description = "证件号(保安服务许可证/备案证)")
private String idNumber;
@Schema(description = "服务区域面积")
private Double serviceArea;
@Schema(description = "楼栋数量")
private Integer buildingTotal;
@Schema(description = "户数")
private Integer houseTotal;
@Schema(description = "工作人员数量")
private Integer staffTotal;
@Schema(description = "保安人员数量")
private Integer securityUserTotal;
@Schema(description = "备注")
private String remark;
}

View File

@ -0,0 +1,63 @@
package com.changhu.module.policeManagement.pojo.vo;
import com.changhu.common.db.enums.IsOrNot;
import com.changhu.common.db.enums.ServiceProjectTwoType;
import com.changhu.common.db.enums.ServiceProjectType;
import com.changhu.common.pojo.vo.CreateOrUpdateUser;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
/**
* @author 20252
* @createTime 2024/11/27 下午2:42
* @desc ServiceProjectListVo...
*/
@Data
public class ServiceProjectListVo {
@Schema(description = "id")
private Long snowFlakeId;
@Schema(description = "企事业单位id")
private Long enterprisesUnitId;
@Schema(description = "保安单位id")
private Long securityUnitId;
@Schema(description = "项目经理小程序用户id")
private Long projectManagerMiniProgramUserId;
@Schema(description = "项目经理小程序用户名称")
private String projectManagerMiniProgramUserName;
@Schema(description = "服务项目名称")
private String name;
@Schema(description = "服务类型")
private ServiceProjectType type;
@Schema(description = "二级类型")
private ServiceProjectTwoType twoType;
@Schema(description = "外包公司名称")
private String outsourceName;
@Schema(description = "是否备案")
private IsOrNot isFiling;
@Schema(description = "证件号(服务类型为保安必填 服务类型为物业则需自招保安为必填)")
private String idNumber;
@Schema(description = "服务区域面积")
private Double serviceArea;
@Schema(description = "楼栋数量")
private Integer buildingTotal;
@Schema(description = "户数")
private Integer houseTotal;
@Schema(description = "工作人员数量")
private Integer staffTotal;
@Schema(description = "保安人员数量")
private Integer securityUserTotal;
@Schema(description = "备注")
private String remark;
@Schema(description = "创建人")
private CreateOrUpdateUser createUserInfo;
@Schema(description = "创建时间")
private LocalDateTime createTime;
}

View File

@ -0,0 +1,46 @@
package com.changhu.module.policeManagement.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.changhu.module.miniProgram.pojo.params.SecurityUserSaveOrUpdateParams;
import com.changhu.module.miniProgram.pojo.queryParams.ServiceProjectSecurityUserPagerQueryParams;
import com.changhu.module.miniProgram.pojo.vo.ServiceProjectSecurityUserPagerVo;
import com.changhu.module.policeManagement.pojo.params.ServiceProjectSaveOrUpdateParams;
import com.changhu.module.policeManagement.pojo.vo.ServiceProjectListVo;
import com.changhu.support.mybatisplus.pojo.params.PageParams;
import java.util.List;
/**
* @author 20252
* @createTime 2024/11/27 下午2:38
* @desc PoliceEnterprisesUnitService...
*/
public interface PoliceEnterprisesUnitService {
/**
* 事业单位下服务项目列表
*
* @param enterprisesUnitId 事业单位id
* @return 服务项目列表
*/
List<ServiceProjectListVo> listSp(Long enterprisesUnitId);
/**
* 新增或者保存服务项目
*/
void saveOrUpdateSp(ServiceProjectSaveOrUpdateParams params);
/**
* 保险人员新增或者保存
*/
void saveOrUpdateSecurityUser(SecurityUserSaveOrUpdateParams params);
/**
* 服务项目下的保安人员分页
*/
Page<ServiceProjectSecurityUserPagerVo> securityUserPager(PageParams<ServiceProjectSecurityUserPagerQueryParams, ServiceProjectSecurityUserPagerVo> queryParams);
/**
* 根据保安人员id删除人员
*/
void deleteSecurityUserById(Long securityUserId);
}

View File

@ -0,0 +1,63 @@
package com.changhu.module.policeManagement.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.toolkit.Assert;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.toolkit.Db;
import com.changhu.common.enums.ResultCode;
import com.changhu.common.utils.UserUtil;
import com.changhu.module.miniProgram.pojo.params.SecurityUserSaveOrUpdateParams;
import com.changhu.module.miniProgram.pojo.queryParams.ServiceProjectSecurityUserPagerQueryParams;
import com.changhu.module.miniProgram.pojo.vo.ServiceProjectSecurityUserPagerVo;
import com.changhu.module.miniProgram.service.UserService;
import com.changhu.module.policeManagement.mapper.PoliceEnterprisesUnitMapper;
import com.changhu.module.policeManagement.pojo.params.ServiceProjectSaveOrUpdateParams;
import com.changhu.module.policeManagement.pojo.vo.ServiceProjectListVo;
import com.changhu.module.policeManagement.service.PoliceEnterprisesUnitService;
import com.changhu.pojo.entity.ServiceProject;
import com.changhu.support.mybatisplus.pojo.params.PageParams;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author 20252
* @createTime 2024/11/27 下午2:38
* @desc PoliceEnterprisesUnitServiceImpl...
*/
@Service
public class PoliceEnterprisesUnitServiceImpl implements PoliceEnterprisesUnitService {
@Autowired
private PoliceEnterprisesUnitMapper policeEnterprisesUnitMapper;
@Autowired
private UserService userService;
@Override
public List<ServiceProjectListVo> listSp(Long enterprisesUnitId) {
return policeEnterprisesUnitMapper.listSp(UserUtil.getUnitId(), enterprisesUnitId);
}
@Override
public void saveOrUpdateSp(ServiceProjectSaveOrUpdateParams params) {
ServiceProject serviceProject = BeanUtil.copyProperties(params, ServiceProject.class);
Assert.isTrue(Db.saveOrUpdate(serviceProject), ResultCode.ERROR.getMessage());
}
@Override
public void saveOrUpdateSecurityUser(SecurityUserSaveOrUpdateParams params) {
userService.saveOrUpdateSecurityUser(params);
}
@Override
public Page<ServiceProjectSecurityUserPagerVo> securityUserPager(PageParams<ServiceProjectSecurityUserPagerQueryParams, ServiceProjectSecurityUserPagerVo> queryParams) {
return userService.securityUserPager(queryParams);
}
@Override
public void deleteSecurityUserById(Long securityUserId) {
userService.deleteSecurityUserById(securityUserId);
}
}

View File

@ -39,6 +39,11 @@ public class SecurityUser extends BaseEntity implements Serializable {
*/
private Long serviceProjectId;
/**
* 本人照片
*/
private String photo;
/**
* 名称
*/
@ -79,6 +84,11 @@ public class SecurityUser extends BaseEntity implements Serializable {
*/
private String securityNumber;
/**
* 无证说明
*/
private String noSecurityNumberDesc;
/**
* 家庭住址
*/

View File

@ -1,5 +1,6 @@
package com.changhu.service;
import com.alibaba.fastjson2.JSONObject;
import com.changhu.common.pojo.model.JsonResult;
import com.changhu.common.pojo.vo.SelectNodeVo;
import com.changhu.pojo.params.PoliceUnitRegisterParams;
@ -36,4 +37,9 @@ public interface CommonService {
* @return 结果
*/
List<SelectNodeVo<Long>> queryUnitListByIdentity(QueryUnitListByIdentityQueryParams queryParams);
/**
* 根据身份证查询保安证
*/
JSONObject querySecurityNumberByIdCard(String idCard);
}

View File

@ -1,6 +1,8 @@
package com.changhu.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.changhu.common.db.enums.MiniProgramUserIdentity;
import com.changhu.common.pojo.vo.SelectNodeVo;
import com.changhu.pojo.params.CheckStatusParams;
import com.changhu.pojo.params.UnitDisableOrEnableParams;
import com.changhu.pojo.vo.UnitCheckStatusVo;
@ -8,6 +10,8 @@ import com.changhu.pojo.vo.UnitMiniProgramUserPagerQueryParams;
import com.changhu.pojo.vo.UnitMiniProgramUserPagerVo;
import com.changhu.support.mybatisplus.pojo.params.PageParams;
import java.util.List;
/**
* @author 20252
* @createTime 2024/9/2 上午9:49
@ -45,4 +49,13 @@ public interface ManagementService {
*/
void disableOrEnableMiniProgramUser(UnitDisableOrEnableParams params);
/**
* 所有保安单位列表
*/
List<SelectNodeVo<Long>> listSecurityUnit();
/**
* 保安单位下的项目经理
*/
List<SelectNodeVo<Long>> listMinUserByUnitId(Long securityUnitId, MiniProgramUserIdentity identity);
}

View File

@ -1,6 +1,7 @@
package com.changhu.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.changhu.common.db.enums.CheckStatus;
import com.changhu.common.db.enums.IsEnable;
@ -16,6 +17,7 @@ import com.changhu.pojo.params.PoliceUnitRegisterParams;
import com.changhu.pojo.params.SecurityUnitRegisterParams;
import com.changhu.pojo.queryParams.QueryUnitListByIdentityQueryParams;
import com.changhu.service.CommonService;
import com.changhu.task.SecurityAssociationDockingServiceTask;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -36,6 +38,9 @@ public class CommonServiceImpl implements CommonService {
@Autowired
private PoliceUnitMapper policeUnitMapper;
@Autowired
private SecurityAssociationDockingServiceTask securityAssociationDockingServiceTask;
@Override
public JsonResult<Void> securityUnitRegister(SecurityUnitRegisterParams params) {
@ -131,4 +136,9 @@ public class CommonServiceImpl implements CommonService {
.toList();
};
}
@Override
public JSONObject querySecurityNumberByIdCard(String idCard) {
return securityAssociationDockingServiceTask.querySecurityNumberByIdCard(idCard);
}
}

View File

@ -1,11 +1,18 @@
package com.changhu.service.impl;
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.IsEnable;
import com.changhu.common.db.enums.MiniProgramUserIdentity;
import com.changhu.common.db.enums.UserType;
import com.changhu.common.exception.MessageException;
import com.changhu.common.pojo.vo.SelectNodeVo;
import com.changhu.common.utils.UserUtil;
import com.changhu.mapper.ManagementMapper;
import com.changhu.pojo.entity.MiniProgramUser;
import com.changhu.pojo.entity.SecurityUnit;
import com.changhu.pojo.params.CheckStatusParams;
import com.changhu.pojo.params.UnitDisableOrEnableParams;
import com.changhu.pojo.vo.UnitCheckStatusVo;
@ -16,6 +23,8 @@ import com.changhu.support.mybatisplus.pojo.params.PageParams;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author 20252
* @createTime 2024/9/2 上午9:49
@ -58,4 +67,43 @@ public class ManagementServiceImpl implements ManagementService {
.getHandler()
.disableOrEnableMiniProgramUser(params.getDataId());
}
@Override
public List<SelectNodeVo<Long>> listSecurityUnit() {
String addressName = LambdaUtil.getFieldName(SecurityUnit::getAddress);
String legalPersonInfoName = LambdaUtil.getFieldName(SecurityUnit::getLegalPersonInfo);
return Db.lambdaQuery(SecurityUnit.class)
.eq(SecurityUnit::getIsEnable, IsEnable.TRUE)
.list()
.stream()
.map(unit -> SelectNodeVo.<Long>builder()
.value(unit.getSnowFlakeId())
.label(unit.getName())
.extData(Dict.of(
addressName, unit.getAddress(),
legalPersonInfoName, unit.getLegalPersonInfo()))
.build())
.toList();
}
@Override
public List<SelectNodeVo<Long>> listMinUserByUnitId(Long securityUnitId, MiniProgramUserIdentity identity) {
String tel = LambdaUtil.getFieldName(MiniProgramUser::getTelephone);
String sex = LambdaUtil.getFieldName(MiniProgramUser::getSex);
return Db.lambdaQuery(MiniProgramUser.class)
.eq(MiniProgramUser::getIsEnable, IsEnable.TRUE)
.eq(MiniProgramUser::getIdentity, identity)
.eq(MiniProgramUser::getUnitId, securityUnitId)
.list()
.stream()
.map(item -> SelectNodeVo.<Long>builder()
.value(item.getSnowFlakeId())
.label(item.getName())
.extData(Dict.of(
tel, item.getTelephone(),
sex, item.getSex()
))
.build())
.toList();
}
}

View File

@ -0,0 +1,34 @@
package com.changhu.support.mybatisplus.handler.global.json;
import com.alibaba.fastjson2.JSON;
import com.baomidou.mybatisplus.extension.handlers.AbstractJsonTypeHandler;
import com.changhu.common.pojo.vo.CreateOrUpdateUser;
import org.apache.ibatis.type.JdbcType;
import org.apache.ibatis.type.MappedJdbcTypes;
import org.apache.ibatis.type.MappedTypes;
/**
* @author 20252
* @createTime 2024/11/27 下午3:09
* @desc CreateOrUpdateUserTypeHandler...
*/
@MappedJdbcTypes(JdbcType.VARCHAR)
@MappedTypes({CreateOrUpdateUser.class})
public class CreateOrUpdateUserTypeHandler extends AbstractJsonTypeHandler<CreateOrUpdateUser> {
public CreateOrUpdateUserTypeHandler(Class<?> type) {
super(type);
}
@Override
public CreateOrUpdateUser parse(String json) {
if (!JSON.isValid(json)) {
return null;
}
return JSON.parseObject(json, CreateOrUpdateUser.class);
}
@Override
public String toJson(CreateOrUpdateUser obj) {
return JSON.toJSONString(obj);
}
}

View File

@ -0,0 +1,80 @@
package com.changhu.task;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import jakarta.annotation.PostConstruct;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
/**
* @author 20252
* @createTime 2024/11/27 下午4:59
* @desc SecurityAssociationDockingServiceTask...
*/
@Slf4j
@Component
public class SecurityAssociationDockingServiceTask {
private static final String BASE_HOST = "http://tkgl.3589hn.cn";
private static String TOKEN;
/**
* 每小时续一次token
*/
@PostConstruct
@Scheduled(cron = "0 0 * * * *")
public void getToken() {
JSONObject params = new JSONObject();
params.put("appid", "anfang");
params.put("appkey", "fcfefda716dc4760af44973bcf157a01");
//创建请求
HttpRequest request = HttpUtil.createPost(BASE_HOST + "/api/security/get_token");
//设置参数
request.body(params.toJSONString());
try (HttpResponse response = request.execute()) {
int status = response.getStatus();
if (!(status == 200)) {
log.error("保安协会 获取token接口出错 status={} msg={}", status, response.body());
return;
}
String body = response.body();
log.info("getToken 接收到值:{}", body);
if (!JSON.isValid(body)) {
log.warn("返回数据不是json格式");
return;
}
JSONObject jsonObject = JSON.parseObject(body);
JSONObject data = jsonObject.getJSONObject("data");
TOKEN = data.getString("token");
log.info("续期后的 token:{}", TOKEN);
}
}
public JSONObject querySecurityNumberByIdCard(String idCard) {
HttpRequest request = HttpUtil.createPost(BASE_HOST + "/api/security/query?token=" + TOKEN);
//请求体参数
request.body(JSONObject.of("idcard", idCard).toJSONString());
try (HttpResponse response = request.execute()) {
int status = response.getStatus();
if (!(status == 200)) {
log.error("保安协会 身份证查保安证接口出错 status={} msg={}", status, response.body());
return null;
}
String body = response.body();
log.info("querySecurityNumberByIdCard 接收到返回值:{}", body);
if (!JSON.isValid(body)) {
log.warn("返回数据不是json格式");
return null;
}
JSONObject jsonObject = JSON.parseObject(body);
return jsonObject.getJSONObject("data");
}
}
}

View File

@ -0,0 +1,17 @@
<?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.module.policeManagement.mapper.PoliceEnterprisesUnitMapper">
<select id="listSp" resultType="com.changhu.module.policeManagement.pojo.vo.ServiceProjectListVo">
select sp.*,
JSON_OBJECT('snowFlakeId', psu.snow_flake_id, 'name', psu.name, 'type', psu.type, 'unitId', psu.unitId,
'unitName', psu.unitName) as 'createUserInfo'
from enterprises_unit eu
join service_project sp on eu.snow_flake_id = sp.enterprises_unit_id and sp.delete_flag = 0
left join mini_program_user mpu on sp.project_manager_mini_program_user_id = mpu.snow_flake_id
left join police_security_users psu on sp.create_by = psu.snow_flake_id
where eu.delete_flag = 0
and eu.snow_flake_id = #{enterprisesUnitId}
and eu.police_unit_id = #{unitId}
order by sp.create_time desc
</select>
</mapper>