Merge remote-tracking branch 'origin/main'

This commit is contained in:
wangyilin 2024-11-25 09:35:06 +08:00
commit b5634e58fd
246 changed files with 3267 additions and 3040 deletions

View File

@ -166,7 +166,7 @@ const assessmentCriteriaRulesByCkProjectId = async function (ckProjectId) {
// title: '...', // title: '...',
// mask: true, // mask: true,
// }) // })
const res = await api.get<StarRating[]>(`/assessmentCriteria/assessmentCriteriaRulesByCkProjectId`, { ckProjectId }) const res = await api.get<StarRating[]>(`/m2/sa/assessmentCriteriaRulesByCkProjectId`, { ckProjectId })
res.data?.forEach((item) => { res.data?.forEach((item) => {
item.currentScore = 0 item.currentScore = 0
@ -203,7 +203,7 @@ const assessmentCriteriaRulesByCkProjectId = async function (ckProjectId) {
const selectorCheckedType = ref<string>('') const selectorCheckedType = ref<string>('')
const selectorType = ref<CkProjectListByType[]>() const selectorType = ref<CkProjectListByType[]>()
const ckProjectListByType = async function (type) { const ckProjectListByType = async function (type) {
const res = await api.get<CkProjectListByType[]>(`/assessmentCriteria/ckProjectListByType`, { type }) const res = await api.get<CkProjectListByType[]>(`/m2/sa/ckProjectListByType`, { type })
console.log(res.data) console.log(res.data)
if (res.data?.length === 0) { if (res.data?.length === 0) {
@ -326,7 +326,7 @@ const onSubmit = async function () {
} }
Object.assign(assessmentRecordParams, _form) Object.assign(assessmentRecordParams, _form)
assessmentRecordParams.assessmentRecordDetails = [...assessmentRecordDetails.value] assessmentRecordParams.assessmentRecordDetails = [...assessmentRecordDetails.value]
const result = await api.post('/assessmentCriteria/submitAssessmentRecord', assessmentRecordParams) const result = await api.post('/m2/sa/submitAssessmentRecord', assessmentRecordParams)
clearData() // clearData() //
if (result.code === 200) { if (result.code === 200) {

File diff suppressed because it is too large Load Diff

View File

@ -28,8 +28,9 @@
"@amap/amap-jsapi-types": "^0.0.15", "@amap/amap-jsapi-types": "^0.0.15",
"@types/lodash-es": "^4.17.12", "@types/lodash-es": "^4.17.12",
"@types/node": "^22.5.1", "@types/node": "^22.5.1",
"@types/react": "^18.3.12",
"@vitejs/plugin-vue": "^5.1.2", "@vitejs/plugin-vue": "^5.1.2",
"@vitejs/plugin-vue-jsx": "^4.0.1", "@vitejs/plugin-vue-jsx": "^4.1.0",
"autoprefixer": "^10.4.20", "autoprefixer": "^10.4.20",
"postcss": "^8.4.41", "postcss": "^8.4.41",
"tailwindcss": "^3.4.10", "tailwindcss": "^3.4.10",

View File

@ -81,6 +81,10 @@ export const staticRouter: RouteRecordRaw[] =
keepalive: true keepalive: true
}, },
component: () => import('@/views/query/publicUnit.vue') component: () => import('@/views/query/publicUnit.vue')
// component: () => import('@/views/query/index.tsx')
// component: () => import('@/views/query/EnterprisesUnit')
}, },
{ {
path: 'assessment-record', // 这里使用相对路径而不是 '/register' path: 'assessment-record', // 这里使用相对路径而不是 '/register'

View File

@ -1,103 +1,110 @@
import api from "@/axios"; import api from '@/axios'
import {AssessmentRecordPagerVo, DeductedDetailRes} from "@/types/views/assessmentRecord.ts"; import { AssessmentRecordPagerVo, DeductedDetailRes } from '@/types/views/assessmentRecord.ts'
import {ColumnsType} from "ant-design-vue/es/table"; import { ColumnsType } from 'ant-design-vue/es/table'
import {Modal, Table} from "ant-design-vue"; import { Modal, Table } from 'ant-design-vue'
export const deductedDetail = async (assessmentRecord: AssessmentRecordPagerVo) => { export const deductedDetail = async (assessmentRecord: AssessmentRecordPagerVo) => {
const {data} = await api.get<DeductedDetailRes[]>('/assessmentRecord/deductedDetail', {assessmentRecordId: assessmentRecord.snowFlakeId}) const { data } = await api.get<DeductedDetailRes[]>('/m1/ar/deductedDetail', { assessmentRecordId: assessmentRecord.snowFlakeId })
const groupRowSpan: Record<string, { firstIndex: number, count: number }> = {} const groupRowSpan: Record<string, { firstIndex: number; count: number }> = {}
const itemRowSpan: Record<string, { firstIndex: number, count: number }> = {} const itemRowSpan: Record<string, { firstIndex: number; count: number }> = {}
data.forEach((item, index) => { data.forEach((item, index) => {
//如果第一次没有值 //如果第一次没有值
if (item.ckGroupId) { if (item.ckGroupId) {
if (!groupRowSpan[item.ckGroupId]) { if (!groupRowSpan[item.ckGroupId]) {
groupRowSpan[item.ckGroupId] = {count: 1, firstIndex: index} groupRowSpan[item.ckGroupId] = { count: 1, firstIndex: index }
} else { } else {
groupRowSpan[item.ckGroupId].count++; groupRowSpan[item.ckGroupId].count++
data[index].groupRowSpan = 0 data[index].groupRowSpan = 0
} }
}
if (item.ckItemId) {
if (!itemRowSpan[item.ckItemId]) {
itemRowSpan[item.ckItemId] = { count: 1, firstIndex: index }
} else {
itemRowSpan[item.ckItemId].count++
data[index].itemRowSpan = 0
}
}
})
Object.values(groupRowSpan).forEach(({ count, firstIndex }) => {
data[firstIndex].groupRowSpan = count
})
Object.values(itemRowSpan).forEach(({ count, firstIndex }) => {
data[firstIndex].itemRowSpan = count
})
const ckProjectDetailTableColumns: ColumnsType<DeductedDetailRes> = [
{
dataIndex: 'groupName',
title: '考核分组',
customCell: (_record) => {
return {
rowspan: _record.groupRowSpan,
} }
},
if (item.ckItemId) { customRender: ({ record: _record }) => {
if (!itemRowSpan[item.ckItemId]) { return (
itemRowSpan[item.ckItemId] = {count: 1, firstIndex: index} <div>
} else { <p>
itemRowSpan[item.ckItemId].count++; {_record.groupName}({_record.groupTotalScore})
data[index].itemRowSpan = 0 </p>
} <p>{_record.groupRemark}</p>
</div>
)
},
},
{
dataIndex: 'itemName',
title: '考核项',
customCell: (_record) => {
return {
rowspan: _record.itemRowSpan,
} }
}) },
customRender: ({ record: _record }) => {
Object.values(groupRowSpan).forEach(({count, firstIndex}) => { if (!_record.ckItemId) {
data[firstIndex].groupRowSpan = count; return '/'
})
Object.values(itemRowSpan).forEach(({count, firstIndex}) => {
data[firstIndex].itemRowSpan = count;
})
const ckProjectDetailTableColumns: ColumnsType<DeductedDetailRes> = [
{
dataIndex: 'groupName',
title: '考核分组',
customCell: (_record) => {
return {
rowspan: _record.groupRowSpan
}
},
customRender: ({record: _record}) => {
return <div>
<p>{_record.groupName}({_record.groupTotalScore})</p>
<p>{_record.groupRemark}</p>
</div>
}
}, {
dataIndex: 'itemName',
title: '考核项',
customCell: (_record) => {
return {
rowspan: _record.itemRowSpan
}
},
customRender: ({record: _record}) => {
if (!_record.ckItemId) {
return '/'
}
return <div>
<p>{_record.itemName}({_record.itemType?.label})
</p>
</div>
}
}, {
dataIndex: 'standardName',
title: '标准',
customRender: ({record: _record}) => {
if (!_record.ckStandardId) {
return '/'
}
return <div>
<p style={{color: _record.isSelected ? 'red' : ''}}>{_record.standardName}{_record.deductionPoints}</p>
</div>
}
} }
] return (
<div>
Modal.info({ <p>
title: `${assessmentRecord.enterprisesUnitName}/${assessmentRecord.ckProjectName}】扣分详情`, {_record.itemName}({_record.itemType?.label})
icon: ' ', </p>
width: '80%', </div>
centered: true, )
content: () => <div style={{height: '80vh', overflow: 'auto'}}> },
<Table },
size="small" {
bordered dataIndex: 'standardName',
pagination={false} title: '标准',
class="margin-top-xs" customRender: ({ record: _record }) => {
columns={ckProjectDetailTableColumns} if (!_record.ckStandardId) {
data-source={data} return '/'
></Table> }
</div> return (
}) <div>
<p style={{ color: _record.isSelected ? 'red' : '' }}>
{_record.standardName}{_record.deductionPoints}
</p>
</div>
)
},
},
]
Modal.info({
title: `${assessmentRecord.enterprisesUnitName}/${assessmentRecord.ckProjectName}】扣分详情`,
icon: ' ',
width: '80%',
centered: true,
content: () => (
<div style={{ height: '80vh', overflow: 'auto' }}>
<Table size='small' bordered pagination={false} class='margin-top-xs' columns={ckProjectDetailTableColumns} data-source={data}></Table>
</div>
),
})
} }

View File

@ -1,92 +1,102 @@
<template> <template>
<div> <div>
<TableProMax ref="tableRef" :request-api="reqApi" :columns="columns"> <TableProMax ref="tableRef" :request-api="reqApi" :columns="columns"> </TableProMax>
</TableProMax> </div>
</div>
</template> </template>
<script setup lang="tsx"> <script setup lang="tsx">
import TableProMax from "@/components/table/TableProMax.vue"; import TableProMax from '@/components/table/TableProMax.vue'
import api from "@/axios"; import api from '@/axios'
import {TableProMaxProps} from "@/types/components/table"; import { TableProMaxProps } from '@/types/components/table'
import { import { AssessmentRecordPagerQueryParams, AssessmentRecordPagerVo } from '@/types/views/assessmentRecord.ts'
AssessmentRecordPagerQueryParams, import { ComponentExposed } from 'vue-component-type-helpers'
AssessmentRecordPagerVo, import { ref } from 'vue'
} from "@/types/views/assessmentRecord.ts"; import { Modal } from 'ant-design-vue'
import {ComponentExposed} from "vue-component-type-helpers"; import { deductedDetail } from '@/views/query/assessmentIndex.tsx'
import { ref} from "vue";
import {Modal} from "ant-design-vue";
import {deductedDetail} from "@/views/query/assessmentIndex.tsx";
const tableRef = ref<ComponentExposed<typeof TableProMax>>(null!) const tableRef = ref<ComponentExposed<typeof TableProMax>>(null!)
type TableProps = TableProMaxProps<AssessmentRecordPagerVo,AssessmentRecordPagerQueryParams> type TableProps = TableProMaxProps<AssessmentRecordPagerVo, AssessmentRecordPagerQueryParams>
const reqApi: TableProps['requestApi'] = (params) => api.post('/assessmentRecord/pager', params) // const reqApi: TableProps['requestApi'] = (params) => api.post('/m1/ar/pager', params) //
const columns: TableProps['columns'] = [ const columns: TableProps['columns'] = [
{ {
dataIndex: 'enterprisesUnitName', dataIndex: 'enterprisesUnitName',
title: '单位名称' title: '单位名称',
}, { },
{
dataIndex: 'type', dataIndex: 'type',
title: '类型', title: '类型',
customRender: ({text}) => text?.label customRender: ({ text }) => text?.label,
}, { },
{
dataIndex: 'ckProjectName', dataIndex: 'ckProjectName',
title: '考核项目' title: '考核项目',
}, { },
{
dataIndex: 'totalScore', dataIndex: 'totalScore',
title: '总分' title: '总分',
}, { },
{
dataIndex: 'deductionPointsTotal', dataIndex: 'deductionPointsTotal',
title: '扣分', title: '扣分',
customRender:({record})=>{ customRender: ({ record }) => {
if (!record.deductionPointsTotal) { if (!record.deductionPointsTotal) {
return <a-tag color="green">0</a-tag> return <a-tag color='green'>0</a-tag>
} }
return <a-tag class="pointer" color="red" onClick={()=>deductedDetail(record)}>{record.deductionPointsTotal}</a-tag> return (
} <a-tag class='pointer' color='red' onClick={() => deductedDetail(record)}>
}, { {record.deductionPointsTotal}
</a-tag>
)
},
},
{
dataIndex: 'result', dataIndex: 'result',
title: '得分', title: '得分',
customRender: ({record}) => record.totalScore - record.deductionPointsTotal customRender: ({ record }) => record.totalScore - record.deductionPointsTotal,
}, { },
{
dataIndex: 'policeUnitName', dataIndex: 'policeUnitName',
title: '考核单位' title: '考核单位',
}, { },
{
dataIndex: 'createUserName', dataIndex: 'createUserName',
title: '考核人' title: '考核人',
}, { },
{
dataIndex: 'createTime', dataIndex: 'createTime',
title: '考核时间' title: '考核时间',
}, { },
{
dataIndex: 'remark', dataIndex: 'remark',
title: '考核备注' title: '考核备注',
}, { },
{
dataIndex: 'signature', dataIndex: 'signature',
title: '签字', title: '签字',
customRender:({record})=>{ customRender: ({ record }) => {
return <a-button onClick={()=>{ return (
Modal.info({ <a-button
title: `${record.enterprisesUnitName}${record.ckProjectName} 签字结果`, onClick={() => {
content: () => <> Modal.info({
<div>审核人签字: <a-image src={record.assessmentUserSignature}/> title: `${record.enterprisesUnitName}${record.ckProjectName} 签字结果`,
</div> content: () => (
<div>被审核单位人员签字: <a-image src={record.byAssessmentEnterprisesUnitUserSignature}/></div> <>
</> <div>
}) 审核人签字: <a-image src={record.assessmentUserSignature} />
}}>查看</a-button> </div>
<div>
被审核单位人员签字: <a-image src={record.byAssessmentEnterprisesUnitUserSignature} />
</div>
</>
),
})
}}
>
查看
</a-button>
)
}, },
} },
] ]
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss"></style>
</style>

View File

@ -1,331 +0,0 @@
import { TableProMaxProps, TableProMaxSlots } from '@/types/components/table'
import { EnterprisesUnitPagerQueryParams, EnterprisesUnitPagerVo, EnterprisesUnitSaveOrUpdateParams, PoliceUnitPagerVo } from '@/types/views/unitManage/police/policeUnit.ts'
import { ref } from 'vue'
import { FormExpose } from 'ant-design-vue/es/form/Form'
import { ComponentExposed } from 'vue-component-type-helpers'
import MapContainer from '@/components/aMap/MapContainer.vue'
import { FormProMaxItemOptions } from '@/types/components/form'
import { dictSelectNodes } from '@/config/dict.ts'
import { AutoComplete, Button, Input, message, Modal, Space } from 'ant-design-vue'
import api from '@/axios'
import TableProMax from '@/components/table/TableProMax.vue'
import { deleteDataModal } from '@/components/tsx/ModalPro.tsx'
import { PageParams } from '@/types/hooks/useTableProMax.ts'
import FormProMax from '@/components/form/FormProMax.vue'
import { debounce } from 'lodash-es'
type _TableProps = TableProMaxProps<EnterprisesUnitPagerVo, EnterprisesUnitPagerQueryParams>
type _FormType = EnterprisesUnitSaveOrUpdateParams & {
contactPersonInfoName?: string
contactPersonInfoTelephone?: string
}
const saveOrUpdateEnterprisesUnit = (params: _FormType, callback: Function) => {
const _formRef = ref<FormExpose>(null)
const _mapRef = ref<ComponentExposed<typeof MapContainer>>(null)
const _formParams = ref<_FormType>({ ...params })
let city = ''
const initMarker = (map: AMap.Map) => {
//添加maker点 设置point
const maker = new AMap.Marker({
position: _formParams.value.point,
draggable: true,
})
maker.on('dragend', ({ lnglat }) => {
_formParams.value.point = lnglat
})
map.clearMap()
map.add(maker)
map.setFitView()
}
const autoAddress = ref<SelectNodeVo<string>[]>([])
const _formOptions = ref<FormProMaxItemOptions<_FormType>>({
name: {
type: 'custom',
label: '单位名称',
required: true,
customRender: () => {
return (
// AutoComplete 自动完成 组件
<AutoComplete
v-model:value={_formParams.value.name}
options={autoAddress.value}
onSelect={(_, options: SelectNodeVo<string>) => {
_formParams.value.point = options.extData?.location
_formParams.value.address = options.extData?.address
initMarker(_mapRef.value?.mapInstance)
}}
onSearch={debounce((val: string) => {
console.log('onSearch___________________', val)
//@ts-ignore
const auto = new AMap.AutoComplete({
city: city,
// input: 'tipinput',
citylimit: true,
})
auto.search(val, (status, result) => {
console.log('🚀 ~ auto.search ~ status, result:', status, result)
if (status === 'complete') {
// 生成组件需要数据
autoAddress.value = result.tips?.map((e) => {
return {
value: e.name,
label: e.name,
extData: {
district: e.district,
address: e.address,
location: e.location,
},
} as SelectNodeVo<string>
})
} else {
autoAddress.value = []
}
})
}, 300)}
v-slots={{
option: (item: SelectNodeVo<string>) => {
return (
<div>
<p>{item.label}</p>
<p style={{ color: '#9a9c9d' }}>
{item.extData?.district} {item.extData?.address}
</p>
</div>
)
},
}}
>
<Input placeholder='请输入单位名称' />
</AutoComplete>
)
},
},
type: {
type: 'select',
label: '单位类型',
required: true,
options: dictSelectNodes('EnterprisesUnitType'),
},
administrativeDivisionCodes: {
type: 'administrativeDivisionTree',
label: '行政区划',
required: true,
componentsProps: {
displayRender: ({ labels }): string => {
city = labels[1]
return labels.join(' / ')
},
},
},
address: {
type: 'inputTextArea',
label: '详细地址',
},
map: {
type: 'custom',
label: '经纬度',
customRender: () => (
<MapContainer
ref={_mapRef}
plugins={['AMap.AutoComplete', 'AMap.PlaceSearch']}
style={{ width: '100%', height: '300px', position: 'relative' }}
initCallback={(map) => {
const contextMenu = new AMap.ContextMenu()
contextMenu.addItem(
'标记',
() => {
const { lng, lat } = contextMenu.getPosition()
_formParams.value.point = [lng, lat]
initMarker(map)
},
0
)
map.on('rightclick', ({ lnglat }) => {
contextMenu.open(map, lnglat)
})
if (_formParams.value.point) {
initMarker(map)
}
}}
></MapContainer>
),
},
contactPersonInfoName: {
type: 'input',
label: '联系人名称',
},
contactPersonInfoTelephone: {
type: 'input',
label: '联系人电话',
},
remark: {
type: 'inputTextArea',
label: '备注',
},
})
Modal.confirm({
title: params.snowFlakeId ? `${params.name}】 信息编辑` : '新增企事业单位',
width: 600,
icon: ' ',
centered: true,
content: () => <FormProMax ref={_formRef} v-model:value={_formParams.value} formItemOptions={_formOptions.value} />,
onOk: async () => {
await _formRef.value?.validate()
const resp = await api.post('/enterprisesUnit/saveOrUpdate', {
..._formParams.value,
contactPersonInfo: {
name: _formParams.value.contactPersonInfoName,
telephone: _formParams.value.contactPersonInfoTelephone,
},
})
message.success(resp.message)
callback && callback()
},
})
}
export const showEnterprisesUnit = (policeUnitPagerVo: PoliceUnitPagerVo) => {
const _tableRef = ref<ComponentExposed<typeof TableProMax>>(null)
const _columns: _TableProps['columns'] = [
{
dataIndex: 'name',
title: '名称',
},
{
dataIndex: 'type',
title: '类型',
customRender: ({ text }) => text?.label,
},
{
dataIndex: 'contactPersonInfo',
title: '联系人',
ellipsis: true,
customRender: ({ text }) => text?.name + '/' + text.telephone,
},
{
dataIndex: 'province',
title: '行政区划',
ellipsis: true,
customRender: ({ record }) => [record.provinceName, record.cityName, record.districtsName, record.streetName].filter(Boolean).join('/'),
},
{
dataIndex: 'address',
title: '详细地址',
ellipsis: true,
},
{
dataIndex: 'remark',
title: '备注',
},
{
dataIndex: 'createTime',
title: '创建时间',
},
{
dataIndex: 'opt',
title: '操作',
customRender: ({ record }) => (
<Space>
<Button
class='btn-warn'
onClick={() =>
saveOrUpdateEnterprisesUnit(
{
snowFlakeId: record.snowFlakeId,
policeUnitId: record.policeUnitId,
name: record.name,
type: record.type.value,
administrativeDivisionCodes: [record.province, record.city, record.districts, record.street].filter(Boolean),
address: record.address,
point: record.point,
contactPersonInfoName: record.contactPersonInfo?.name,
contactPersonInfoTelephone: record.contactPersonInfo?.telephone,
remark: record.remark,
},
_tableRef.value?.requestGetTableData
)
}
>
</Button>
<Button
class='btn-danger'
onClick={() =>
deleteDataModal(record.name, async () => {
const resp = await api.delete('/enterprisesUnit/deleteById', {
enterprisesUnitId: record.snowFlakeId,
})
message.success(resp.message)
await _tableRef.value?.requestGetTableData()
})
}
>
</Button>
</Space>
),
},
]
const _reqApi: _TableProps['requestApi'] = (params) => {
;(params as PageParams<EnterprisesUnitPagerQueryParams>).params.policeUnitId = policeUnitPagerVo.snowFlakeId
return api.post('/enterprisesUnit/pager', params)
}
Modal.info({
title: `${policeUnitPagerVo.name}】 管辖企事业单位`,
width: '80%',
centered: true,
maskClosable: true,
content: () => (
<TableProMax
ref={_tableRef}
size='small'
columns={_columns}
requestApi={_reqApi}
searchFormOptions={{
name: {
type: 'input',
label: '单位名称',
},
address: {
type: 'input',
label: '地址',
},
remark: {
type: 'input',
label: '备注',
},
}}
v-slots={
{
tableHeader: (_) => {
return (
<Space>
<Button
class='btn-success'
onClick={() =>
saveOrUpdateEnterprisesUnit(
{
name: undefined,
type: 'party_government',
policeUnitId: policeUnitPagerVo.snowFlakeId,
administrativeDivisionCodes: [policeUnitPagerVo.province, policeUnitPagerVo.city, policeUnitPagerVo.districts, policeUnitPagerVo.street].filter(Boolean),
},
_tableRef.value?.requestGetTableData
)
}
>
</Button>
<Button disabled></Button>
</Space>
)
},
} as TableProMaxSlots<PoliceUnitPagerVo>
}
/>
),
})
}

View File

@ -1,46 +1,46 @@
<template> <template>
<div> <div>
<!-- 企事业单位 -->
<TableProMax ref="tableRef" :request-api="reqApi" :columns="columns" :searchFormOptions="searchFormOptions" :scroll="{ x }"> <TableProMax ref="tableRef" :request-api="reqApi" :columns="columns" :searchFormOptions="searchFormOptions" :scroll="{ x }">
<!-- <template #tableHeader> <template #tableHeader>
<a-space> <a-space>
<a-button type="primary" @click="addUserManagement">新增用户</a-button> <a-button type="primary" @click="saveOrUpdateEnterprisesUnit">新增企事业单位</a-button>
</a-space> </a-space>
</template> --> </template>
</TableProMax> </TableProMax>
<a-modal v-model:open="visible" :title="title" @ok="submit" @cancel="closeModal">
<!-- <FormProMax ref="formRef" v-model:value="formParams" :form-item-options="formItemOptions" /> -->
</a-modal>
</div> </div>
</template> </template>
<script setup lang="tsx"> <script setup lang="tsx">
// import { storeTreeData, loadTreeFromCache } from '@/utils/DB.ts' import { deleteDataModal } from '@/components/tsx/ModalPro.tsx'
import { EnterprisesUnitSaveOrUpdateParams } from '@/types/views/unitManage/police/policeUnit.ts'
import MapContainer from '@/components/aMap/MapContainer.vue'
import { AutoComplete, Button, Input, message, Modal, Space } from 'ant-design-vue'
import { debounce } from 'lodash-es'
import FormProMax from '@/components/form/FormProMax.vue'
import api from '@/axios' import api from '@/axios'
import { ref, reactive } from 'vue' import { ref, reactive } from 'vue'
import TableProMax from '@/components/table/TableProMax.vue' import TableProMax from '@/components/table/TableProMax.vue'
import { TableProMaxProps } from '@/types/components/table/index.ts' import { TableProMaxProps } from '@/types/components/table/index.ts'
import { ComponentExposed } from 'vue-component-type-helpers' import { ComponentExposed } from 'vue-component-type-helpers'
import { dictSelectNodes } from '@/config/dict.ts' import { dictSelectNodes } from '@/config/dict.ts'
import { publicUnitPagerQueryParams, FromItem } from '@/types/views/publicUnit.ts' import { publicUnitPagerQueryParams } from '@/types/views/publicUnit.ts'
// import FormProMax from '@/components/form/FormProMax.vue'
import { FormProMaxItemOptions } from '@/types/components/form//index.ts' import { FormProMaxItemOptions } from '@/types/components/form//index.ts'
import { FormExpose } from 'ant-design-vue/es/form/Form' import { FormExpose } from 'ant-design-vue/es/form/Form'
import { showEnterprisesUnit } from './index' type _FormType = EnterprisesUnitSaveOrUpdateParams & {
const formRef = ref<FormExpose>(null) contactPersonInfoName?: string
contactPersonInfoTelephone?: string
}
type TableProps = TableProMaxProps<publicUnitPagerQueryParams> type TableProps = TableProMaxProps<publicUnitPagerQueryParams>
const tableRef = ref<ComponentExposed<typeof TableProMax>>(null!)
const reqApi: TableProps['requestApi'] = (params) => api.post('/enterprisesUnit/pager', params) //
// const reqApi: TableProps['requestApi'] = (params) => api.post('/enterprisesUnit/pager', params) //
const reqApi: TableProps['requestApi'] = (params) => api.post('/eu/pager', params) //
const tableRef = ref<ComponentExposed<typeof TableProMax>>(null)
const columns: TableProps['columns'] = [ const columns: TableProps['columns'] = [
{ {
dataIndex: 'name', dataIndex: 'name',
title: '单位名称', title: '单位名称',
}, },
// {
// dataIndex: 'code',
// title: '',
// },
{ {
dataIndex: 'provinceName', dataIndex: 'provinceName',
title: '行政区划', title: '行政区划',
@ -49,19 +49,6 @@ const columns: TableProps['columns'] = [
}, },
}, },
// {
// dataIndex: 'isEnable',
// title: '',
// customRender: ({ text }) => <a-tag color={text?.extData?.color}>{text?.label}</a-tag>,
// width: 150,
// },
// {
// dataIndex: 'checkStatus',
// title: '',
// customRender: ({ record }) => {
// return record.checkStatus?.extData?.color === 'success' ? <a-tag color='green'>{record?.checkStatus?.label}</a-tag> : <a-tag color='#f50'>{record?.checkStatus?.label}</a-tag>
// },
// },
{ {
dataIndex: 'address', dataIndex: 'address',
title: '详细地址', title: '详细地址',
@ -92,45 +79,225 @@ const columns: TableProps['columns'] = [
{ {
dataIndex: 'opt', dataIndex: 'opt',
title: '操作', title: '操作',
customRender({ record }) { customRender: ({ record }) => (
return ( <Space>
<a-space> <Button
<a-button class='btn-success' onClick={() => showEnterprisesUnit(record)}> class='btn-warn'
企事业单位 onClick={() =>
</a-button> saveOrUpdateEnterprisesUnit(
</a-space> {
) snowFlakeId: record.snowFlakeId,
}, policeUnitId: record.policeUnitId,
name: record.name,
type: record.type.value,
administrativeDivisionCodes: [record.province, record.city, record.districts, record.street].filter(Boolean),
address: record.address,
point: record.point,
contactPersonInfoName: record.contactPersonInfo?.name,
contactPersonInfoTelephone: record.contactPersonInfo?.telephone,
remark: record.remark,
},
tableRef.value?.requestGetTableData
)
}
>
编辑
</Button>
<Button
class='btn-danger'
onClick={() =>
deleteDataModal(record.name, async () => {
// const resp = await api.delete('/enterprisesUnit/deleteById', {
const resp = await api.delete('/eu/del_id', {
enterprisesUnitId: 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 x: number = columns.reduce((a, b) => a + (b.width as number), 0)
const visible = ref(false)
const title = ref('新增用户') const saveOrUpdateEnterprisesUnit = (params: _FormType, callback: Function) => {
const addUserManagement = () => { const _formRef = ref<FormExpose>(null)
visible.value = true const _mapRef = ref<ComponentExposed<typeof MapContainer>>(null)
title.value = '' const _formParams = ref<_FormType>({ ...params })
let city = ''
const initMarker = (map: AMap.Map) => {
//maker point
const maker = new AMap.Marker({
position: _formParams.value.point,
draggable: true,
})
maker.on('dragend', ({ lnglat }) => {
_formParams.value.point = lnglat
})
map.clearMap()
map.add(maker)
map.setFitView()
}
const autoAddress = ref<SelectNodeVo<string>[]>([])
const _formOptions = ref<FormProMaxItemOptions<_FormType>>({
name: {
type: 'custom',
label: '单位名称',
required: true,
customRender: () => {
return (
// AutoComplete
<AutoComplete
v-model:value={_formParams.value.name}
options={autoAddress.value}
onSelect={(_, options: SelectNodeVo<string>) => {
_formParams.value.point = options.extData?.location
_formParams.value.address = options.extData?.address
initMarker(_mapRef.value?.mapInstance)
}}
onSearch={debounce((val: string) => {
console.log('onSearch___________________', val)
//@ts-ignore
const auto = new AMap.AutoComplete({
city: city,
// input: 'tipinput',
citylimit: true,
})
auto.search(val, (status, result) => {
console.log('🚀 ~ auto.search ~ status, result:', status, result)
if (status === 'complete') {
//
autoAddress.value = result.tips?.map((e) => {
return {
value: e.name,
label: e.name,
extData: {
district: e.district,
address: e.address,
location: e.location,
},
} as SelectNodeVo<string>
})
} else {
autoAddress.value = []
}
})
}, 300)}
v-slots={{
option: (item: SelectNodeVo<string>) => {
return (
<div>
<p>{item.label}</p>
<p style={{ color: '#9a9c9d' }}>
{item.extData?.district} {item.extData?.address}
</p>
</div>
)
},
}}
>
<Input placeholder='请输入单位名称' />
</AutoComplete>
)
},
},
type: {
type: 'select',
label: '单位类型',
required: true,
// @ts-ignore
options: dictSelectNodes('EnterprisesUnitType'),
},
administrativeDivisionCodes: {
type: 'administrativeDivisionTree',
label: '行政区划',
required: true,
componentsProps: {
// @ts-ignore
displayRender: ({ labels }): string => {
city = labels[1]
return labels.join(' / ')
},
},
},
address: {
type: 'inputTextArea',
label: '详细地址',
},
map: {
type: 'custom',
label: '经纬度',
customRender: () => (
<MapContainer
ref={_mapRef}
plugins={['AMap.AutoComplete', 'AMap.PlaceSearch']}
style={{ width: '100%', height: '300px', position: 'relative' }}
initCallback={(map) => {
const contextMenu = new AMap.ContextMenu()
contextMenu.addItem(
'标记',
() => {
const { lng, lat } = contextMenu.getPosition()
_formParams.value.point = [lng, lat]
initMarker(map)
},
0
)
map.on('rightclick', ({ lnglat }) => {
contextMenu.open(map, lnglat)
})
if (_formParams.value.point) {
initMarker(map)
}
}}
></MapContainer>
),
},
contactPersonInfoName: {
type: 'input',
label: '联系人名称',
},
contactPersonInfoTelephone: {
type: 'input',
label: '联系人电话',
},
remark: {
type: 'inputTextArea',
label: '备注',
},
})
Modal.confirm({
title: params.snowFlakeId ? `${params.name}】 信息编辑` : '新增企事业单位',
width: 600,
icon: ' ',
centered: true,
content: () => <FormProMax ref={_formRef} v-model:value={_formParams.value} formItemOptions={_formOptions.value} />,
onOk: async () => {
await _formRef.value?.validate()
// const resp = await api.post('/enterprisesUnit/saveOrUpdate', {
const resp = await api.post('/eu/add_upd', {
..._formParams.value,
contactPersonInfo: {
name: _formParams.value.contactPersonInfoName,
telephone: _formParams.value.contactPersonInfoTelephone,
},
})
message.success(resp.message)
await tableRef.value?.requestGetTableData()
// reqApi(params)
callback && callback()
},
})
} }
// const getTree = async () => {
// //
// const cachedData = await loadTreeFromCache()
// if (cachedData) {
// console.log('')
// // 使
// return cachedData
// } else {
// console.log('')
// // API
// const res = await api.get<any>('/common/administrativeDivisionTree')
// await storeTreeData(res.data)
// return res.data
// }
// }
// const loadOptions = async () => {
// const treeData = await getTree()
// searchFormOptions.treeSelect.options = treeData
// }
// loadOptions()
const searchFormOptions = reactive<TableProps['searchFormOptions']>({ const searchFormOptions = reactive<TableProps['searchFormOptions']>({
name: { name: {
type: 'input', type: 'input',
@ -145,65 +312,5 @@ const searchFormOptions = reactive<TableProps['searchFormOptions']>({
type: 'input', type: 'input',
label: '手机号', label: '手机号',
}, },
// isEnable: {
// type: 'select',
// label: '',
// options: [
// {
// value: null,
// label: '',
// },
// ...dictSelectNodes('IsEnable'),
// ],
// },
})
const formParams = ref<{
snowFlakeId?: string
name: string
sex: number
telephone: string
isEnable: any
remark?: string
}>({
name: '',
sex: 0,
telephone: '',
isEnable: 0,
})
const submit = async () => {
// await formRef.value.validate()
}
const closeModal = () => {
visible.value = false
}
const formItemOptions = ref<FormProMaxItemOptions<FromItem>>({
name: {
type: 'input',
label: '姓名',
required: true,
},
sex: {
type: 'radioGroup',
label: '性别',
options: dictSelectNodes('Sex'),
required: true,
},
telephone: {
type: 'input',
label: '手机号',
required: true,
},
isEnable: {
type: 'radioGroup',
label: '启用状态',
options: dictSelectNodes('IsEnable'),
required: true,
},
remark: {
type: 'inputTextArea',
label: '备注',
},
}) })
</script> </script>

View File

@ -2,13 +2,7 @@
<!-- 后台用户 --> <!-- 后台用户 -->
<!-- template 内部必须有一个根节点 div否则<Transition>将会失效所以这个<a-modal></a-modal> div --> <!-- template 内部必须有一个根节点 div否则<Transition>将会失效所以这个<a-modal></a-modal> div -->
<div> <div>
<TableProMax <TableProMax ref="tableRef" :request-api="reqApi" :columns="columns" :searchFormOptions="searchFormOptions" :scroll="{ x }">
ref="tableRef"
:request-api="reqApi"
:columns="columns"
:searchFormOptions="searchFormOptions"
:scroll="{x}"
>
<template #tableHeader> <template #tableHeader>
<a-space> <a-space>
<a-button type="primary" @click="addUserManagement">新增用户</a-button> <a-button type="primary" @click="addUserManagement">新增用户</a-button>
@ -17,36 +11,37 @@
</TableProMax> </TableProMax>
<!-- template 内部必须有一个根节点 div否则<Transition>将会失效所以这个<a-modal></a-modal> div --> <!-- template 内部必须有一个根节点 div否则<Transition>将会失效所以这个<a-modal></a-modal> div -->
<a-modal v-model:open="visible" :title="title" @ok="submit" @cancel="closeModal"> <a-modal v-model:open="visible" :title="title" @ok="submit" @cancel="closeModal">
<FormProMax ref="formRef" v-model:value="formParams" :form-item-options="formItemOptions"/> <FormProMax ref="formRef" v-model:value="formParams" :form-item-options="formItemOptions" />
</a-modal> </a-modal>
</div> </div>
</template> </template>
<script setup lang="tsx"> <script setup lang="tsx">
import TableProMax from "@/components/table/TableProMax.vue"; import TableProMax from '@/components/table/TableProMax.vue'
import {TableProMaxProps} from "@/types/components/table"; import { TableProMaxProps } from '@/types/components/table'
import {message} from 'ant-design-vue' import { message } from 'ant-design-vue'
import {dictSelectNodes} from '@/config/dict.ts' import { dictSelectNodes } from '@/config/dict.ts'
// const enumsSex = ref<any[]>(dictSelectNodes('Sex')) // const enumsSex = ref<any[]>(dictSelectNodes('Sex'))
// const enumsIsEnable = ref<any[]>(dictSelectNodes('IsEnable')) // const enumsIsEnable = ref<any[]>(dictSelectNodes('IsEnable'))
import api from '@/axios/index.ts' import api from '@/axios/index.ts'
import {ref, reactive, onMounted} from 'vue' import { ref, reactive, onMounted } from 'vue'
import FormProMax from "@/components/form/FormProMax.vue"; import FormProMax from '@/components/form/FormProMax.vue'
import {FormProMaxItemOptions} from "@/types/components/form"; import { FormProMaxItemOptions } from '@/types/components/form'
import {FormExpose} from "ant-design-vue/es/form/Form"; import { FormExpose } from 'ant-design-vue/es/form/Form'
import {publicUnitPagerQueryParams, FromItem} from "@/types/views/publicUnit.ts"; import { publicUnitPagerQueryParams, FromItem } from '@/types/views/publicUnit.ts'
const tableRef = ref<ComponentExposed<typeof TableProMax>>(null!) const tableRef = ref<ComponentExposed<typeof TableProMax>>(null!)
const formRef = ref<FormExpose>(null) const formRef = ref<FormExpose>(null)
type TableProps = TableProMaxProps<publicUnitPagerQueryParams> type TableProps = TableProMaxProps<publicUnitPagerQueryParams>
const reqApi: TableProps['requestApi'] = (params) => api.post('/management/police/user/pager', params) // // const reqApi: TableProps['requestApi'] = (params) => api.post('/management/police/user/pager', params) //
const formParams = ref<{ const reqApi: TableProps['requestApi'] = (params) => api.post('/m2/user/pager', params) //
snowFlakeId?: string,
name: string,
sex: number,
telephone: string,
isEnable: any,
const formParams = ref<{
snowFlakeId?: string
name: string
sex: number
telephone: string
isEnable: any
}>({ }>({
name: '', name: '',
sex: 0, sex: 0,
@ -58,9 +53,7 @@ const formItemOptions = ref<FormProMaxItemOptions<FromItem>>({
type: 'input', type: 'input',
label: '姓名', label: '姓名',
required: true, required: true,
rules: [ rules: [{ required: true, message: '请输入姓名' }],
{required: true, message: '请输入姓名'}
],
}, },
sex: { sex: {
type: 'radioGroup', type: 'radioGroup',
@ -73,16 +66,16 @@ const formItemOptions = ref<FormProMaxItemOptions<FromItem>>({
label: '手机号', label: '手机号',
required: true, required: true,
rules: [ rules: [
{required: true, message: '请输入手机号'}, { required: true, message: '请输入手机号' },
{ {
validator: (rule, value) => { validator: (rule, value) => {
const phoneRegex = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/ const phoneRegex = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/
if (!value) { if (!value) {
return Promise.reject('手机号不能为空'); return Promise.reject('手机号不能为空')
} else if (!phoneRegex.test(value)) { } else if (!phoneRegex.test(value)) {
return Promise.reject('手机号格式不正确'); return Promise.reject('手机号格式不正确')
} else { } else {
return Promise.resolve(); return Promise.resolve()
} }
}, },
trigger: 'blur', trigger: 'blur',
@ -101,25 +94,25 @@ const columns: TableProps['columns'] = [
dataIndex: 'account', dataIndex: 'account',
title: '账号', title: '账号',
width: 100, width: 100,
ellipsis: true ellipsis: true,
}, },
{ {
dataIndex: 'name', dataIndex: 'name',
title: '名称', title: '名称',
width: 200, width: 200,
ellipsis: true ellipsis: true,
}, },
{ {
dataIndex: 'sex', dataIndex: 'sex',
title: '性别', title: '性别',
customRender: ({text}) => <a-tag>{text?.label}</a-tag>, customRender: ({ text }) => <a-tag>{text?.label}</a-tag>,
width: 150 width: 150,
}, },
{ {
dataIndex: 'telephone', dataIndex: 'telephone',
title: '手机号码', title: '手机号码',
width: 150, width: 150,
ellipsis: true ellipsis: true,
}, },
{ {
dataIndex: 'createTime', dataIndex: 'createTime',
@ -131,66 +124,72 @@ const columns: TableProps['columns'] = [
{ {
dataIndex: 'isEnable', dataIndex: 'isEnable',
title: '是否启用', title: '是否启用',
customRender: ({text}) => <a-tag color={text?.extData?.color}>{text?.label}</a-tag>, customRender: ({ text }) => <a-tag color={text?.extData?.color}>{text?.label}</a-tag>,
width: 150 width: 150,
}, },
{ {
dataIndex: 'opt', dataIndex: 'opt',
title: '操作', title: '操作',
fixed: "right", fixed: 'right',
customRender({record}) { customRender({ record }) {
return ( return record.isAdmin.value === 1 ? (
record.isAdmin.value === 1 ? <a-space>
<a-space> <a-popconfirm
<a-popconfirm style='width:100%'
style="width:100%" title='确认删除账号吗?'
title="确认删除账号吗?" onConfirm={async () => {
onConfirm={async () => { {
const resp = await api.delete('/management/police/user/deleteById', { /* const resp = await api.delete('/management/police/user/deleteById', { */
managementPoliceUnitUserId: record.snowFlakeId, }
}) const resp = await api.delete('/m2/user/del_id', {
message.success(resp.message) managementPoliceUnitUserId: record.snowFlakeId,
await tableRef.value?.requestGetTableData() })
}}> message.success(resp.message)
<a-button type="primary" danger>删除</a-button> await tableRef.value?.requestGetTableData()
</a-popconfirm> }}
<a-button type="primary" onClick={async () => { >
visible.value = true <a-button type='primary' danger>
title.value = "编辑用户" 删除
formParams.value.snowFlakeId = record.snowFlakeId </a-button>
formParams.value.name = record.name, </a-popconfirm>
formParams.value.sex = record.sex.value, <a-button
formParams.value.telephone = record.telephone, type='primary'
formParams.value.isEnable = record.isEnable?.value onClick={async () => {
visible.value = true
}}> title.value = '编辑用户'
编辑 formParams.value.snowFlakeId = record.snowFlakeId
</a-button> ;(formParams.value.name = record.name), (formParams.value.sex = record.sex.value), (formParams.value.telephone = record.telephone), (formParams.value.isEnable = record.isEnable?.value)
</a-space> }}
: >
<div>超级管理员不能编辑</div> 编辑
</a-button>
</a-space>
) : (
<div>超级管理员不能编辑</div>
) )
} },
}, },
] ]
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 searchFormOptions: TableProps["searchFormOptions"] = { const searchFormOptions: TableProps['searchFormOptions'] = {
name: { name: {
type: 'input', type: 'input',
label: '名称' label: '名称',
}, sex: { },
sex: {
type: 'select', type: 'select',
label: '性别', label: '性别',
options: [ options: [
{ {
value: null, value: null,
label: '全部' label: '全部',
}, ...dictSelectNodes('Sex') },
] ...dictSelectNodes('Sex'),
],
}, },
telephone: { telephone: {
type: 'input', type: 'input',
label: '手机号' label: '手机号',
}, },
isEnable: { isEnable: {
type: 'select', type: 'select',
@ -198,10 +197,11 @@ const searchFormOptions: TableProps["searchFormOptions"] = {
options: [ options: [
{ {
value: null, value: null,
label: '全部' label: '全部',
}, ...dictSelectNodes('IsEnable') },
] ...dictSelectNodes('IsEnable'),
} ],
},
} }
const visible = ref(false) const visible = ref(false)
const title = ref('新增用户') const title = ref('新增用户')
@ -222,13 +222,13 @@ const submit = async () => {
sex: formParams.value.sex, sex: formParams.value.sex,
telephone: formParams.value.telephone, telephone: formParams.value.telephone,
isEnable: formParams.value.isEnable, isEnable: formParams.value.isEnable,
} }
const resp = await api.post('/management/police/user/saveOrUpdate', managementSecurityUnitUserSaveOrUpdateParams) // const resp = await api.post('/management/police/user/saveOrUpdate', managementSecurityUnitUserSaveOrUpdateParams)
const resp = await api.post('/m2/user/add_upd', managementSecurityUnitUserSaveOrUpdateParams)
message.success(resp.message) message.success(resp.message)
tableRef.value?.requestGetTableData() tableRef.value?.requestGetTableData()
closeModal() closeModal()
} }
const closeModal = () => { const closeModal = () => {
@ -236,7 +236,7 @@ const closeModal = () => {
name: '', name: '',
sex: 0, sex: 0,
telephone: '', telephone: '',
isEnable: 0 isEnable: 0,
} }
visible.value = false visible.value = false
title.value = '新增用户' title.value = '新增用户'

View File

@ -1,7 +1,6 @@
package com.changhu.common.annotation; package com.changhu.common.annotation;
import com.changhu.common.db.enums.UserType; import com.changhu.common.db.enums.UserType;
import org.springframework.web.bind.annotation.RestController;
import java.lang.annotation.*; import java.lang.annotation.*;
@ -13,7 +12,6 @@ import java.lang.annotation.*;
@Target({ElementType.TYPE, ElementType.METHOD}) @Target({ElementType.TYPE, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@Documented @Documented
@RestController
public @interface CheckUserType { public @interface CheckUserType {
/** /**

View File

@ -4,7 +4,7 @@ import java.lang.annotation.*;
/** /**
* author: luozhun * author: luozhun
* desc: 是拓展属性 * desc: 标注是拓展属性
* createTime: 2023/11/1 17:25 * createTime: 2023/11/1 17:25
*/ */
@Documented @Documented

View File

@ -0,0 +1,14 @@
package com.changhu.common.annotation;
import java.lang.annotation.*;
/**
* @author 20252
* @createTime 2024/11/21 下午3:34
* @desc IsWhiteList...
*/
@Documented
@Retention(value = RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD, ElementType.TYPE})
public @interface IsWhiteList {
}

View File

@ -1,7 +1,5 @@
package com.changhu.common.annotation; package com.changhu.common.annotation;
import org.springframework.web.bind.annotation.RestController;
import java.lang.annotation.*; import java.lang.annotation.*;
/** /**
@ -12,7 +10,6 @@ import java.lang.annotation.*;
@Target({ElementType.TYPE, ElementType.METHOD}) @Target({ElementType.TYPE, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@Documented @Documented
@RestController
public @interface JsonBody { public @interface JsonBody {
boolean value() default true; boolean value() default true;
} }

View File

@ -2,38 +2,121 @@ package com.changhu.config;
import cn.dev33.satoken.interceptor.SaInterceptor; import cn.dev33.satoken.interceptor.SaInterceptor;
import cn.dev33.satoken.stp.StpUtil; import cn.dev33.satoken.stp.StpUtil;
import com.changhu.support.filter.BodyWrapperFilter; import cn.hutool.core.collection.CollUtil;
import com.changhu.support.interceptor.JsonBodyInterceptor; import cn.hutool.core.util.ClassUtil;
import com.changhu.support.interceptor.SignInterceptor; import com.changhu.common.annotation.IsWhiteList;
import com.changhu.support.interceptor.UserTypeInterceptor; import com.changhu.common.annotation.JsonBody;
import com.changhu.filter.BodyWrapperFilter;
import com.changhu.interceptor.JsonBodyInterceptor;
import com.changhu.interceptor.OpenApiAuthInterceptor;
import com.changhu.interceptor.UserTypeInterceptor;
import lombok.extern.slf4j.Slf4j;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.springframework.boot.web.servlet.FilterRegistrationBean; import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.AnnotatedElementUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.config.annotation.CorsRegistry; import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import java.util.ArrayList; import java.lang.annotation.Annotation;
import java.util.List; import java.lang.reflect.Method;
import java.util.*;
import java.util.stream.Collectors;
/** /**
* author: luozhun * author: luozhun
* desc: WebConfig * desc: WebConfig
* createTime: 2023/8/18 10:56 * createTime: 2023/8/18 10:56
*/ */
@Slf4j
@Configuration @Configuration
public class WebConfig implements WebMvcConfigurer { public class WebConfig implements WebMvcConfigurer {
private final List<String> whiteList = new ArrayList<>(); private final List<String> whiteList = new ArrayList<>();
/**
* 扫描所有Controller
*/
private static Set<Class<?>> scanRestController() {
//需要过滤出JsonBody
Set<Class<?>> classes = ClassUtil.scanPackage("com.changhu", clazz -> !JsonBody.class.equals(clazz));
return classes.stream().filter(aClass -> {
//判断类上是否有Controller注解
if (aClass.isAnnotationPresent(Controller.class) || aClass.isAnnotationPresent(RestController.class)) {
return true;
}
Annotation[] annotations = aClass.getAnnotations();
for (Annotation annotation : annotations) {
if (annotation.annotationType().isAnnotationPresent(Controller.class) || annotation.annotationType().isAnnotationPresent(RestController.class)) {
return true;
}
}
return false;
}).collect(Collectors.toSet());
}
public WebConfig() { public WebConfig() {
whiteList.add("/common/**"); Set<String> w = new HashSet<>();
whiteList.add("/open/**"); for (Class<?> clazz : scanRestController()) {
whiteList.add("/test/**"); //类上的注解
whiteList.add("/login"); RequestMapping classRequestMapping = AnnotatedElementUtils.findMergedAnnotation(clazz, RequestMapping.class);
whiteList.add("/logout"); IsWhiteList clazzIsWhiteList = clazz.getAnnotation(IsWhiteList.class);
if (classRequestMapping != null && clazzIsWhiteList != null) {
//直接放行当前控制器的所有方法
w.addAll(Arrays.stream(classRequestMapping.value()).map(path -> {
if (!path.startsWith("/")) {
path = "/" + path;
}
if (!path.endsWith("/")) {
path = path + "/";
}
return path + "**";
}).toList());
continue;
}
//看方法上是否有白名单注解
Method[] methods = clazz.getDeclaredMethods();
for (Method method : methods) {
IsWhiteList methodIsWhiteList = method.getAnnotation(IsWhiteList.class);
RequestMapping methodRequestMapping = AnnotatedElementUtils.findMergedAnnotation(method, RequestMapping.class);
if (methodRequestMapping != null && methodIsWhiteList != null) {
List<List<String>> list1 = Arrays.stream(methodRequestMapping.value()).map(path -> {
if (!path.startsWith("/")) {
path = "/" + path;
}
if (path.endsWith("/")) {
path = path.substring(0, path.length() - 1);
}
List<String> list = new ArrayList<>();
if (classRequestMapping != null && CollUtil.isNotEmpty(Arrays.asList(classRequestMapping.value()))) {
for (String p : classRequestMapping.value()) {
if (!p.startsWith("/")) {
p = "/" + p;
}
if (p.endsWith("/")) {
p = p.substring(0, p.length() - 1);
}
list.add(p + path);
}
} else {
list.add(path);
}
return list;
}).toList();
w.addAll(list1.stream().flatMap(List::stream).toList());
}
}
}
log.info("加载路由白名单:{}", w);
whiteList.addAll(w);
//网站图标
whiteList.add("/favicon.ico"); whiteList.add("/favicon.ico");
//druid console //druid console
whiteList.add("/druid/**"); whiteList.add("/druid/**");
@ -43,12 +126,6 @@ public class WebConfig implements WebMvcConfigurer {
whiteList.add("/swagger-resources"); whiteList.add("/swagger-resources");
whiteList.add("/**webjars/**"); whiteList.add("/**webjars/**");
whiteList.add("/v3/**"); whiteList.add("/v3/**");
//获取企业注册审核状态
whiteList.add("/management/getCheckStatus");
//微信小程序注册
whiteList.add("/miniProgramUser/register");
//二维码表单录入保安人员
whiteList.add("/miniProgramUser/qrCodeFormInputSecurityUser");
} }
@Override @Override
@ -57,12 +134,12 @@ public class WebConfig implements WebMvcConfigurer {
registry.addInterceptor(new SaInterceptor(handle -> StpUtil.checkLogin())) registry.addInterceptor(new SaInterceptor(handle -> StpUtil.checkLogin()))
.addPathPatterns("/**") .addPathPatterns("/**")
.excludePathPatterns(whiteList); .excludePathPatterns(whiteList);
// 注册jsonBody 拦截器 用于标识是否需要JsonResult返回 // 注册jsonBody拦截器 用于标识是否需要JsonResult返回
registry.addInterceptor(new JsonBodyInterceptor()); registry.addInterceptor(new JsonBodyInterceptor());
// 注册clientType 拦截器 用于校验当前用户是否匹配操作客户端 // 注册用户类型拦截器 用于校验当前用户是否匹配操作客户端
registry.addInterceptor(new UserTypeInterceptor()); registry.addInterceptor(new UserTypeInterceptor());
// 注册开放接口 拦截器 用于校验第三方是否携带指定apiKey // 注册开放接口认证拦截器 用于校验第三方是否授权
registry.addInterceptor(new SignInterceptor()) registry.addInterceptor(new OpenApiAuthInterceptor())
.addPathPatterns("/open/**"); .addPathPatterns("/open/**");
} }

View File

@ -1,5 +1,6 @@
package com.changhu.controller; package com.changhu.controller;
import com.changhu.common.annotation.IsWhiteList;
import com.changhu.common.annotation.JsonBody; import com.changhu.common.annotation.JsonBody;
import com.changhu.common.cache.GlobalCacheManager; import com.changhu.common.cache.GlobalCacheManager;
import com.changhu.common.pojo.model.JsonResult; import com.changhu.common.pojo.model.JsonResult;
@ -31,6 +32,8 @@ import java.util.Map;
@Tag(name = "公共接口") @Tag(name = "公共接口")
@RequestMapping("/common") @RequestMapping("/common")
@JsonBody @JsonBody
@IsWhiteList
@RestController
public class CommonController { public class CommonController {
@Autowired @Autowired

View File

@ -1,4 +1,4 @@
package com.changhu.module.management.controller; package com.changhu.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.CheckUserType;
@ -6,10 +6,10 @@ import com.changhu.common.annotation.JsonBody;
import com.changhu.common.db.enums.UserType; import com.changhu.common.db.enums.UserType;
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.module.management.pojo.params.EnterprisesUnitSaveOrUpdateParams; import com.changhu.pojo.params.EnterprisesUnitSaveOrUpdateParams;
import com.changhu.module.management.pojo.queryParams.EnterprisesUnitPagerQueryParams; import com.changhu.pojo.queryParams.EnterprisesUnitPagerQueryParams;
import com.changhu.module.management.pojo.vo.EnterprisesUnitPagerVo; import com.changhu.pojo.vo.EnterprisesUnitPagerVo;
import com.changhu.module.management.service.EnterprisesUnitService; import com.changhu.service.EnterprisesUnitService;
import com.changhu.support.mybatisplus.pojo.params.PageParams; import com.changhu.support.mybatisplus.pojo.params.PageParams;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
@ -27,7 +27,8 @@ import java.util.List;
*/ */
@Tag(name = "企事业单位") @Tag(name = "企事业单位")
@JsonBody @JsonBody
@RequestMapping("/enterprisesUnit") @RequestMapping("/eu")
@RestController
public class EnterprisesUnitController { public class EnterprisesUnitController {
@Autowired @Autowired
@ -41,14 +42,14 @@ public class EnterprisesUnitController {
} }
@Operation(summary = "新增或保存") @Operation(summary = "新增或保存")
@PostMapping("/saveOrUpdate") @PostMapping("/add_upd")
@CheckUserType(userTypes = {UserType.MANAGEMENT_POLICE, UserType.MANAGEMENT_SUPER}) @CheckUserType(userTypes = {UserType.MANAGEMENT_POLICE, UserType.MANAGEMENT_SUPER})
public void saveOrUpdate(@RequestBody @Valid EnterprisesUnitSaveOrUpdateParams params) { public void saveOrUpdate(@RequestBody @Valid EnterprisesUnitSaveOrUpdateParams params) {
enterprisesUnitService.saveOrUpdate(params); enterprisesUnitService.saveOrUpdate(params);
} }
@Operation(summary = "根据id删除") @Operation(summary = "根据id删除")
@DeleteMapping("/deleteById") @DeleteMapping("/del_id")
@CheckUserType(userTypes = {UserType.MANAGEMENT_POLICE, UserType.MANAGEMENT_SUPER}) @CheckUserType(userTypes = {UserType.MANAGEMENT_POLICE, UserType.MANAGEMENT_SUPER})
public void deleteById(@RequestParam @Schema(description = "企事业单位id") Long enterprisesUnitId) { public void deleteById(@RequestParam @Schema(description = "企事业单位id") Long enterprisesUnitId) {
boolean b = enterprisesUnitService.removeById(enterprisesUnitId); boolean b = enterprisesUnitService.removeById(enterprisesUnitId);
@ -58,7 +59,7 @@ public class EnterprisesUnitController {
} }
@Operation(summary = "根据行政区划编码查询下面的企事业单位") @Operation(summary = "根据行政区划编码查询下面的企事业单位")
@PostMapping("/queryListByAdministrativeDivisionCodes") @PostMapping("/list_ad_codes")
public List<SelectNodeVo<Long>> queryListByAdministrativeDivisionCodes(@RequestBody @Schema(description = "行政区划编码") List<String> administrativeDivisionCodes) { public List<SelectNodeVo<Long>> queryListByAdministrativeDivisionCodes(@RequestBody @Schema(description = "行政区划编码") List<String> administrativeDivisionCodes) {
return enterprisesUnitService.queryListByAdministrativeDivisionCodes(administrativeDivisionCodes); return enterprisesUnitService.queryListByAdministrativeDivisionCodes(administrativeDivisionCodes);
} }

View File

@ -1,5 +1,6 @@
package com.changhu.controller; package com.changhu.controller;
import com.changhu.common.annotation.IsWhiteList;
import com.changhu.common.annotation.JsonBody; import com.changhu.common.annotation.JsonBody;
import com.changhu.common.pojo.vo.TokenInfo; import com.changhu.common.pojo.vo.TokenInfo;
import com.changhu.pojo.params.LoginParams; import com.changhu.pojo.params.LoginParams;
@ -10,6 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
/** /**
* @author 20252 * @author 20252
@ -18,6 +20,7 @@ import org.springframework.web.bind.annotation.RequestBody;
*/ */
@Tag(name = "登录相关") @Tag(name = "登录相关")
@JsonBody @JsonBody
@RestController
public class LoginController { public class LoginController {
@Autowired @Autowired
@ -25,12 +28,14 @@ public class LoginController {
@Operation(summary = "登录") @Operation(summary = "登录")
@PostMapping("/login") @PostMapping("/login")
@IsWhiteList
public TokenInfo login(@RequestBody LoginParams loginParams) { public TokenInfo login(@RequestBody LoginParams loginParams) {
return loginService.login(loginParams); return loginService.login(loginParams);
} }
@Operation(summary = "登出") @Operation(summary = "登出")
@GetMapping("/logout") @GetMapping("/logout")
@IsWhiteList
public void logout() { public void logout() {
loginService.logout(); loginService.logout();
} }

View File

@ -1,16 +1,16 @@
package com.changhu.module.management.controller; package com.changhu.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.CheckUserType;
import com.changhu.common.annotation.IsWhiteList;
import com.changhu.common.annotation.JsonBody; import com.changhu.common.annotation.JsonBody;
import com.changhu.common.db.enums.UserType; import com.changhu.common.db.enums.UserType;
import com.changhu.module.management.pojo.params.IndexCheckPassParams; import com.changhu.pojo.params.CheckStatusParams;
import com.changhu.module.management.pojo.params.IndexCheckStatusParams; import com.changhu.pojo.params.UnitDisableOrEnableParams;
import com.changhu.module.management.pojo.params.IndexDisableOrEnableParams; import com.changhu.pojo.vo.UnitCheckStatusVo;
import com.changhu.module.management.pojo.queryParams.UnitMiniProgramUserPagerQueryParams; import com.changhu.pojo.vo.UnitMiniProgramUserPagerQueryParams;
import com.changhu.module.management.pojo.vo.UnitCheckStatusVo; import com.changhu.pojo.vo.UnitMiniProgramUserPagerVo;
import com.changhu.module.management.pojo.vo.UnitMiniProgramUserPagerVo; import com.changhu.service.ManagementService;
import com.changhu.module.management.service.ManagementService;
import com.changhu.support.mybatisplus.pojo.params.PageParams; import com.changhu.support.mybatisplus.pojo.params.PageParams;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
@ -19,40 +19,28 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/** /**
* @author 20252 * @author 20252
* @createTime 2024/9/2 上午9:48 * @createTime 2024/11/22 上午9:03
* @desc IndexController... * @desc ManagementController...
*/ */
@Tag(name = "后台-通用接口") @Tag(name = "后台-通用接口")
@JsonBody @JsonBody
@RequestMapping("/management") @RequestMapping("/management")
@RestController
public class ManagementController { public class ManagementController {
@Autowired @Autowired
private ManagementService managementService; private ManagementService managementService;
@Operation(summary = "审核通过")
@PostMapping("/checkPass")
@CheckUserType(userTypes = UserType.MANAGEMENT_SUPER)
public void checkPass(@RequestBody @Valid IndexCheckPassParams params) {
managementService.checkPass(params);
}
@Operation(summary = "获取审核状态") @Operation(summary = "获取审核状态")
@PostMapping("/getCheckStatus") @PostMapping("/getCheckStatus")
public UnitCheckStatusVo getCheckStatus(@RequestBody @Valid IndexCheckStatusParams params) { @IsWhiteList
public UnitCheckStatusVo getCheckStatus(@RequestBody @Valid CheckStatusParams params) {
return managementService.getCheckStatus(params); return managementService.getCheckStatus(params);
} }
@Operation(summary = "启用或禁用状态")
@PostMapping("/disableOrEnable")
@CheckUserType(userTypes = UserType.MANAGEMENT_SUPER)
public void disableOrEnable(@RequestBody @Valid IndexDisableOrEnableParams params) {
managementService.disableOrEnable(params);
}
@Operation(summary = "查询单位下的小程序用户") @Operation(summary = "查询单位下的小程序用户")
@PostMapping("/miniProgramUserPager") @PostMapping("/miniProgramUserPager")
@CheckUserType(userTypes = {UserType.MANAGEMENT_POLICE, UserType.MANAGEMENT_SECURITY}) @CheckUserType(userTypes = {UserType.MANAGEMENT_POLICE, UserType.MANAGEMENT_SECURITY})
@ -63,14 +51,14 @@ public class ManagementController {
@Operation(summary = "审核通过小程序用户") @Operation(summary = "审核通过小程序用户")
@PostMapping("/passMiniProgramUser") @PostMapping("/passMiniProgramUser")
@CheckUserType(userTypes = {UserType.MANAGEMENT_POLICE, UserType.MANAGEMENT_SECURITY}) @CheckUserType(userTypes = {UserType.MANAGEMENT_POLICE, UserType.MANAGEMENT_SECURITY})
public void passMiniProgramUser(@RequestBody @Valid IndexDisableOrEnableParams params) { public void passMiniProgramUser(@RequestBody @Valid UnitDisableOrEnableParams params) {
managementService.passMiniProgramUser(params); managementService.passMiniProgramUser(params);
} }
@Operation(summary = "禁用或启用小程序用户") @Operation(summary = "禁用或启用小程序用户")
@PostMapping("/disableOrEnableMiniProgramUser") @PostMapping("/disableOrEnableMiniProgramUser")
@CheckUserType(userTypes = {UserType.MANAGEMENT_POLICE, UserType.MANAGEMENT_SECURITY}) @CheckUserType(userTypes = {UserType.MANAGEMENT_POLICE, UserType.MANAGEMENT_SECURITY})
public void disableOrEnableMiniProgramUser(@RequestBody @Valid IndexDisableOrEnableParams params) { public void disableOrEnableMiniProgramUser(@RequestBody @Valid UnitDisableOrEnableParams params) {
managementService.disableOrEnableMiniProgramUser(params); managementService.disableOrEnableMiniProgramUser(params);
} }
} }

View File

@ -1,5 +1,6 @@
package com.changhu.controller; package com.changhu.controller;
import com.changhu.common.annotation.IsWhiteList;
import com.changhu.common.annotation.JsonBody; import com.changhu.common.annotation.JsonBody;
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;
@ -15,6 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List; import java.util.List;
@ -26,6 +28,8 @@ import java.util.List;
@Tag(name = "开放接口") @Tag(name = "开放接口")
@JsonBody @JsonBody
@RequestMapping("/open") @RequestMapping("/open")
@IsWhiteList
@RestController
public class OpenController { public class OpenController {
@Autowired @Autowired

View File

@ -0,0 +1,36 @@
package com.changhu.controller;
import com.changhu.common.annotation.JsonBody;
import com.changhu.service.WxService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.Resource;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
/**
* @author 20252
* @createTime 2024/11/22 上午11:42
* @desc WeChatController...
*/
@Tag(name = "微信相关")
@Controller
@RequestMapping("/wx")
public class WeChatController {
@Autowired
private WxService wxService;
@JsonBody(value = false)
@Operation(summary = "获取小程序页面二维码")
@GetMapping(value = "/qrCode")
public ResponseEntity<Resource> qrCode(@Schema(description = "要生成的路径") @RequestParam String path,
@Schema(description = "生成二维码的宽度") @RequestParam(defaultValue = "430") Integer width) {
return wxService.qrCode(path, width);
}
}

View File

@ -1,4 +1,4 @@
package com.changhu.support.filter; package com.changhu.filter;
import jakarta.servlet.*; import jakarta.servlet.*;
import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;

View File

@ -1,4 +1,4 @@
package com.changhu.support.filter; package com.changhu.filter;
import jakarta.servlet.ReadListener; import jakarta.servlet.ReadListener;
import jakarta.servlet.ServletInputStream; import jakarta.servlet.ServletInputStream;

View File

@ -1,4 +1,4 @@
package com.changhu.support.handler; package com.changhu.handler;
import cn.dev33.satoken.exception.NotLoginException; import cn.dev33.satoken.exception.NotLoginException;
import cn.hutool.core.exceptions.ExceptionUtil; import cn.hutool.core.exceptions.ExceptionUtil;

View File

@ -1,7 +1,7 @@
package com.changhu.support.handler; package com.changhu.handler;
import com.changhu.common.pojo.model.JsonResult; import com.changhu.common.pojo.model.JsonResult;
import com.changhu.support.interceptor.JsonBodyInterceptor; import com.changhu.interceptor.JsonBodyInterceptor;
import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;

View File

@ -1,4 +1,4 @@
package com.changhu.support.interceptor; package com.changhu.interceptor;
import cn.hutool.core.collection.ConcurrentHashSet; import cn.hutool.core.collection.ConcurrentHashSet;
import com.changhu.common.annotation.JsonBody; import com.changhu.common.annotation.JsonBody;

View File

@ -1,4 +1,4 @@
package com.changhu.support.interceptor; package com.changhu.interceptor;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.core.util.URLUtil; import cn.hutool.core.util.URLUtil;
@ -9,8 +9,8 @@ import com.baomidou.mybatisplus.extension.toolkit.Db;
import com.changhu.common.db.enums.IsEnable; import com.changhu.common.db.enums.IsEnable;
import com.changhu.common.exception.MessageException; import com.changhu.common.exception.MessageException;
import com.changhu.common.utils.IpUtil; import com.changhu.common.utils.IpUtil;
import com.changhu.filter.CustomHttpServletRequestWrapper;
import com.changhu.pojo.entity.AccessKeys; import com.changhu.pojo.entity.AccessKeys;
import com.changhu.support.filter.CustomHttpServletRequestWrapper;
import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -26,10 +26,10 @@ import java.util.stream.Collectors;
/** /**
* @author 20252 * @author 20252
* @createTime 2024/11/19 下午1:58 * @createTime 2024/11/19 下午1:58
* @desc SignInterceptor... * @desc 开放接口认证拦截器
*/ */
@Slf4j @Slf4j
public class SignInterceptor implements HandlerInterceptor { public class OpenApiAuthInterceptor implements HandlerInterceptor {
private static final String ACCESS_KEY = "Access-Key";//调用者身份唯一标识 private static final String ACCESS_KEY = "Access-Key";//调用者身份唯一标识
private static final String TIMESTAMP = "Time-Stamp";//时间戳 private static final String TIMESTAMP = "Time-Stamp";//时间戳

View File

@ -1,4 +1,4 @@
package com.changhu.support.interceptor; package com.changhu.interceptor;
import cn.hutool.core.util.ArrayUtil; import cn.hutool.core.util.ArrayUtil;
import com.changhu.common.annotation.CheckUserType; import com.changhu.common.annotation.CheckUserType;
@ -14,7 +14,7 @@ import org.springframework.web.servlet.HandlerInterceptor;
/** /**
* @author 20252 * @author 20252
* @createTime 2024/9/4 下午4:00 * @createTime 2024/9/4 下午4:00
* @desc UserTypeInterceptor... * @desc 用户类型校验拦截器
*/ */
public class UserTypeInterceptor implements HandlerInterceptor { public class UserTypeInterceptor implements HandlerInterceptor {

View File

@ -1,7 +1,7 @@
package com.changhu.module.assessmentCriteria.mapper; package com.changhu.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.changhu.module.assessmentCriteria.pojo.entity.CkAssessmentRecordDetails; import com.changhu.pojo.entity.CkAssessmentRecordDetails;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
/** /**

View File

@ -0,0 +1,15 @@
package com.changhu.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.changhu.pojo.entity.CkAssessmentRecord;
import org.apache.ibatis.annotations.Mapper;
/**
* ck_assessment_record (考核记录) 固化类
* author: luozhun
* desc 由groovy脚本自动生成
*/
@Mapper
public interface CkAssessmentRecordMapper extends BaseMapper<CkAssessmentRecord> {
}

View File

@ -1,7 +1,7 @@
package com.changhu.module.assessmentCriteria.mapper; package com.changhu.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.changhu.module.assessmentCriteria.pojo.entity.CkGroup; import com.changhu.pojo.entity.CkGroup;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
/** /**

View File

@ -1,7 +1,7 @@
package com.changhu.module.assessmentCriteria.mapper; package com.changhu.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.changhu.module.assessmentCriteria.pojo.entity.CkItem; import com.changhu.pojo.entity.CkItem;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
/** /**

View File

@ -0,0 +1,15 @@
package com.changhu.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.changhu.pojo.entity.CkProject;
import org.apache.ibatis.annotations.Mapper;
/**
* ck_project (考核项目) 固化类
* author: luozhun
* desc 由groovy脚本自动生成
*/
@Mapper
public interface CkProjectMapper extends BaseMapper<CkProject> {
}

View File

@ -1,7 +1,7 @@
package com.changhu.module.assessmentCriteria.mapper; package com.changhu.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.changhu.module.assessmentCriteria.pojo.entity.CkStandard; import com.changhu.pojo.entity.CkStandard;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
/** /**

View File

@ -1,10 +1,10 @@
package com.changhu.module.management.mapper; package com.changhu.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.changhu.module.management.pojo.entity.EnterprisesUnit; import com.changhu.pojo.entity.EnterprisesUnit;
import com.changhu.module.management.pojo.queryParams.EnterprisesUnitPagerQueryParams; import com.changhu.pojo.queryParams.EnterprisesUnitPagerQueryParams;
import com.changhu.module.management.pojo.vo.EnterprisesUnitPagerVo; import com.changhu.pojo.vo.EnterprisesUnitPagerVo;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;

View File

@ -0,0 +1,28 @@
package com.changhu.mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.changhu.common.db.enums.MiniProgramUserIdentity;
import com.changhu.pojo.vo.UnitMiniProgramUserPagerQueryParams;
import com.changhu.pojo.vo.UnitMiniProgramUserPagerVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* @author 20252
* @createTime 2024/11/22 上午9:05
* @desc ManagementMapper...
*/
@Mapper
public interface ManagementMapper {
/**
* 分页查询
*
* @param page 分页参数
* @param params 查询参数
* @param identity 用户身份
* @return 结果
*/
Page<UnitMiniProgramUserPagerVo> miniProgramUserPager(@Param("page") Page<UnitMiniProgramUserPagerVo> page,
@Param("params") UnitMiniProgramUserPagerQueryParams params,
@Param("identity") MiniProgramUserIdentity identity);
}

View File

@ -0,0 +1,15 @@
package com.changhu.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.changhu.pojo.entity.ManagementPoliceUnitUser;
import org.apache.ibatis.annotations.Mapper;
/**
* management_police_user (后台-公安单位用户表) 固化类
* author: luozhun
* desc 由groovy脚本自动生成
*/
@Mapper
public interface ManagementPoliceUnitUserMapper extends BaseMapper<ManagementPoliceUnitUser> {
}

View File

@ -0,0 +1,15 @@
package com.changhu.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.changhu.pojo.entity.ManagementSecurityUnitUser;
import org.apache.ibatis.annotations.Mapper;
/**
* management_security_unit_user (后台-保安单位用户表) 固化类
* author: luozhun
* desc 由groovy脚本自动生成
*/
@Mapper
public interface ManagementSecurityUnitUserMapper extends BaseMapper<ManagementSecurityUnitUser> {
}

View File

@ -1,7 +1,7 @@
package com.changhu.module.management.mapper; package com.changhu.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.changhu.module.management.pojo.entity.ManagementSuperUser; import com.changhu.pojo.entity.ManagementSuperUser;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
/** /**

View File

@ -0,0 +1,14 @@
package com.changhu.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.changhu.pojo.entity.MiniProgramUser;
import org.apache.ibatis.annotations.Mapper;
/**
* mini_program_user (小程序用户) 固化类
* author: luozhun
* desc 由groovy脚本自动生成
*/
@Mapper
public interface MiniProgramUserMapper extends BaseMapper<MiniProgramUser> {
}

View File

@ -3,6 +3,7 @@ package com.changhu.mapper;
import com.changhu.common.pojo.vo.SelectNodeVo; import com.changhu.common.pojo.vo.SelectNodeVo;
import com.changhu.pojo.dto.SecurityUnitUseStatisticsDTO; import com.changhu.pojo.dto.SecurityUnitUseStatisticsDTO;
import com.changhu.pojo.dto.SecurityUserRosterDTO; import com.changhu.pojo.dto.SecurityUserRosterDTO;
import com.changhu.pojo.dto.ServiceProjectDTO;
import com.changhu.pojo.params.EnterprisesUnitOrServiceProjectType; import com.changhu.pojo.params.EnterprisesUnitOrServiceProjectType;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -27,6 +28,14 @@ public interface OpenApiMapper {
List<SelectNodeVo<Long>> getEnterprisesUnit(@Param("code") String code, List<SelectNodeVo<Long>> getEnterprisesUnit(@Param("code") String code,
@Param("level") Integer level); @Param("level") Integer level);
/**
* 获取企事业单位下的服务项目
*
* @param enterprisesUnitId 企事业单位id
* @return 服务项目列表
*/
List<ServiceProjectDTO> getServiceProjectByEnterprisesUnitId(@Param("enterprisesUnitId") Long enterprisesUnitId);
/** /**
* 保安单位使用情况统计 * 保安单位使用情况统计
* *

View File

@ -0,0 +1,15 @@
package com.changhu.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.changhu.pojo.entity.PoliceUnit;
import org.apache.ibatis.annotations.Mapper;
/**
* police_unit (公安单位) 固化类
* author: luozhun
* desc 由groovy脚本自动生成
*/
@Mapper
public interface PoliceUnitMapper extends BaseMapper<PoliceUnit> {
}

View File

@ -0,0 +1,15 @@
package com.changhu.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.changhu.pojo.entity.SecurityUnit;
import org.apache.ibatis.annotations.Mapper;
/**
* security_unit (保安单位) 固化类
* author: luozhun
* desc 由groovy脚本自动生成
*/
@Mapper
public interface SecurityUnitMapper extends BaseMapper<SecurityUnit> {
}

View File

@ -1,10 +1,10 @@
package com.changhu.module.miniProgram.mapper; package com.changhu.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.changhu.module.miniProgram.pojo.entity.SecurityUser;
import com.changhu.module.miniProgram.pojo.queryParams.ServiceProjectSecurityUserPagerQueryParams; import com.changhu.module.miniProgram.pojo.queryParams.ServiceProjectSecurityUserPagerQueryParams;
import com.changhu.module.miniProgram.pojo.vo.ServiceProjectSecurityUserPagerVo; import com.changhu.module.miniProgram.pojo.vo.ServiceProjectSecurityUserPagerVo;
import com.changhu.pojo.entity.SecurityUser;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;

View File

@ -0,0 +1,27 @@
package com.changhu.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.changhu.module.miniProgram.pojo.vo.IndexServiceProjectListVo;
import com.changhu.pojo.entity.ServiceProject;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* service_project (服务项目) 固化类
* author: luozhun
* desc 由groovy脚本自动生成
*/
@Mapper
public interface ServiceProjectMapper extends BaseMapper<ServiceProject> {
/**
* 获取服务项目
*
* @return 服务项目列表
*/
List<IndexServiceProjectListVo> getServiceProjectList(@Param("policeUnitId") Long policeUnitId,
@Param("projectManagerMiniProgramUserId") Long projectManagerMiniProgramUserId);
}

View File

@ -1,39 +0,0 @@
package com.changhu.module.assessmentCriteria.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.changhu.module.assessmentCriteria.pojo.entity.CkProject;
import com.changhu.module.assessmentCriteria.pojo.queryParams.CkProjectPagerQueryParams;
import com.changhu.module.assessmentCriteria.pojo.vo.CkProjectDetailTableVo;
import com.changhu.module.assessmentCriteria.pojo.vo.CkProjectPagerVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* ck_project (考核项目) 固化类
* author: luozhun
* desc 由groovy脚本自动生成
*/
@Mapper
public interface CkProjectMapper extends BaseMapper<CkProject> {
/**
* 分页查询
*
* @param page 分页参数
* @param params 查询参数
* @return 分页数据
*/
Page<CkProjectPagerVo> pager(@Param("page") Page<CkProjectPagerVo> page,
@Param("params") CkProjectPagerQueryParams params);
/**
* 考核项目详情
*
* @param ckProjectId 考核项目id
* @return 详情
*/
List<CkProjectDetailTableVo> ckProjectDetail(@Param("ckProjectId") Long ckProjectId);
}

View File

@ -1,35 +0,0 @@
package com.changhu.module.assessmentCriteria.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.changhu.module.assessmentCriteria.pojo.entity.CkAssessmentRecord;
import com.changhu.module.assessmentCriteria.pojo.queryParams.AssessmentRecordPagerQueryParams;
import com.changhu.module.assessmentCriteria.pojo.vo.AssessmentRecordDetailVo;
import com.changhu.module.assessmentCriteria.pojo.vo.AssessmentRecordPagerVo;
import com.changhu.support.mybatisplus.pojo.params.PageParams;
import java.util.List;
/**
* ck_assessment_record (考核记录) 服务类
* author: luozhun
* desc 由groovy脚本自动生成
*/
public interface CkAssessmentRecordService extends IService<CkAssessmentRecord> {
/**
* 分页查询
*
* @param queryParams 查询参数
* @return 结果
*/
Page<AssessmentRecordPagerVo> pager(PageParams<AssessmentRecordPagerQueryParams, AssessmentRecordPagerVo> queryParams);
/**
* 扣分详情
*
* @param assessmentRecordId 考核记录id
* @return 结果
*/
List<AssessmentRecordDetailVo> deductedDetail(Long assessmentRecordId);
}

View File

@ -1,51 +0,0 @@
package com.changhu.module.management.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.management.pojo.params.ManagementPoliceUserSaveOrUpdateParams;
import com.changhu.module.management.pojo.queryParams.ManagementPoliceUnitUserPagerQueryParams;
import com.changhu.module.management.pojo.vo.ManagementPoliceUnitUserPagerVo;
import com.changhu.module.management.service.PoliceService;
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.*;
/**
* @author 20252
* @createTime 2024/9/11 上午9:39
* @desc PoliceController...
*/
@Tag(name = "后台-公安")
@JsonBody
@RequestMapping("/management/police")
@CheckUserType(userTypes = UserType.MANAGEMENT_POLICE)
public class PoliceController {
@Autowired
private PoliceService policeService;
@Operation(summary = "新增或保存后台用户")
@PostMapping("/user/saveOrUpdate")
public void userSaveOrUpdate(@RequestBody @Valid ManagementPoliceUserSaveOrUpdateParams params) {
policeService.userSaveOrUpdate(params);
}
@Operation(summary = "分页查询后台用户")
@PostMapping("/user/pager")
public Page<ManagementPoliceUnitUserPagerVo> userPager(@RequestBody PageParams<ManagementPoliceUnitUserPagerQueryParams, ManagementPoliceUnitUserPagerVo> queryParams) {
return policeService.userPager(queryParams);
}
@Operation(summary = "根据id删除后台用户")
@DeleteMapping("/user/deleteById")
public void userDeleteById(@RequestParam @Schema(description = "后台公安用户id") Long managementPoliceUnitUserId) {
policeService.userDeleteById(managementPoliceUnitUserId);
}
}

View File

@ -1,59 +0,0 @@
package com.changhu.module.management.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.common.pojo.vo.SelectNodeVo;
import com.changhu.module.management.pojo.params.ManagementSecurityUnitUserSaveOrUpdateParams;
import com.changhu.module.management.pojo.queryParams.ManagementSecurityUnitUserPagerQueryParams;
import com.changhu.module.management.pojo.vo.ManagementSecurityUnitUserPagerVo;
import com.changhu.module.management.service.SecurityService;
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/9/11 上午9:39
* @desc SecurityController...
*/
@Tag(name = "后台-保安")
@JsonBody
@RequestMapping("/management/security")
@CheckUserType(userTypes = UserType.MANAGEMENT_SECURITY)
public class SecurityController {
@Autowired
private SecurityService securityService;
@Operation(summary = "新增或修改后台用户")
@PostMapping("/user/saveOrUpdate")
public void userSaveOrUpdate(@RequestBody @Valid ManagementSecurityUnitUserSaveOrUpdateParams saveOrUpdateParams) {
securityService.userSaveOrUpdate(saveOrUpdateParams);
}
@Operation(summary = "分页查询后台用户")
@PostMapping("/user/pager")
public Page<ManagementSecurityUnitUserPagerVo> userPager(@RequestBody PageParams<ManagementSecurityUnitUserPagerQueryParams, ManagementSecurityUnitUserPagerVo> queryParams) {
return securityService.userPager(queryParams);
}
@Operation(summary = "根据id删除后台用户")
@DeleteMapping("/user/deleteById")
public void userDeleteById(@RequestParam @Schema(description = "后台保安用户id") Long managementSecurityUnitUserId) {
securityService.userDeleteById(managementSecurityUnitUserId);
}
@Operation(summary = "查询单位下的项目经理")
@GetMapping("/listProjectManager")
public List<SelectNodeVo<Long>> listProjectManager() {
return securityService.listProjectManager();
}
}

View File

@ -1,54 +0,0 @@
package com.changhu.module.management.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.management.pojo.params.ManagementSuperUserSaveOrUpdateParams;
import com.changhu.module.management.pojo.queryParams.PoliceUnitPagerQueryParams;
import com.changhu.module.management.pojo.queryParams.SecurityUnitPagerQueryParams;
import com.changhu.module.management.pojo.vo.PoliceUnitPagerVo;
import com.changhu.module.management.pojo.vo.SecurityUnitPagerVo;
import com.changhu.module.management.service.SuperService;
import com.changhu.support.mybatisplus.pojo.params.PageParams;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
/**
* @author 20252
* @createTime 2024/9/11 上午9:38
* @desc ManagementSuperController...
*/
@Tag(name = "超级后台")
@JsonBody
@RequestMapping("/management/super")
@CheckUserType(userTypes = UserType.MANAGEMENT_SUPER)
public class SuperController {
@Autowired
private SuperService superService;
@Operation(summary = "新增或保存后台用户")
@PostMapping("/saveOrUpdateUser")
public void saveOrUpdateUser(@RequestBody @Valid ManagementSuperUserSaveOrUpdateParams params) {
superService.saveOrUpdateUser(params);
}
@Operation(summary = "公安单位分页查询")
@PostMapping("/policeUnit/pager")
public Page<PoliceUnitPagerVo> policeUnitPager(@RequestBody PageParams<PoliceUnitPagerQueryParams, PoliceUnitPagerVo> queryParams) {
return superService.policeUnitPager(queryParams);
}
@Operation(summary = "保安单位分页查询")
@PostMapping("/securityUnit/pager")
public Page<SecurityUnitPagerVo> securityUnitPager(@RequestBody PageParams<SecurityUnitPagerQueryParams, SecurityUnitPagerVo> queryParams) {
return superService.securityUnitPager(queryParams);
}
}

View File

@ -1,28 +0,0 @@
package com.changhu.module.management.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.changhu.module.management.pojo.entity.ManagementPoliceUnitUser;
import com.changhu.module.management.pojo.queryParams.ManagementPoliceUnitUserPagerQueryParams;
import com.changhu.module.management.pojo.vo.ManagementPoliceUnitUserPagerVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* management_police_user (后台-公安单位用户表) 固化类
* author: luozhun
* desc 由groovy脚本自动生成
*/
@Mapper
public interface ManagementPoliceUnitUserMapper extends BaseMapper<ManagementPoliceUnitUser> {
/**
* 分页查询
*
* @param page 分页参数
* @param params 查询参数
* @return 结果
*/
Page<ManagementPoliceUnitUserPagerVo> pager(@Param("page") Page<ManagementPoliceUnitUserPagerVo> page,
@Param("params") ManagementPoliceUnitUserPagerQueryParams params);
}

View File

@ -1,28 +0,0 @@
package com.changhu.module.management.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.changhu.module.management.pojo.entity.ManagementSecurityUnitUser;
import com.changhu.module.management.pojo.queryParams.ManagementSecurityUnitUserPagerQueryParams;
import com.changhu.module.management.pojo.vo.ManagementSecurityUnitUserPagerVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* management_security_unit_user (后台-保安单位用户表) 固化类
* author: luozhun
* desc 由groovy脚本自动生成
*/
@Mapper
public interface ManagementSecurityUnitUserMapper extends BaseMapper<ManagementSecurityUnitUser> {
/**
* 分页查询
*
* @param page 分页参数
* @param params 查询参数
* @return 结果
*/
Page<ManagementSecurityUnitUserPagerVo> pager(@Param("page") Page<ManagementSecurityUnitUserPagerVo> page,
@Param("params") ManagementSecurityUnitUserPagerQueryParams params);
}

View File

@ -1,28 +0,0 @@
package com.changhu.module.management.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.changhu.module.management.pojo.entity.PoliceUnit;
import com.changhu.module.management.pojo.queryParams.PoliceUnitPagerQueryParams;
import com.changhu.module.management.pojo.vo.PoliceUnitPagerVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* police_unit (公安单位) 固化类
* author: luozhun
* desc 由groovy脚本自动生成
*/
@Mapper
public interface PoliceUnitMapper extends BaseMapper<PoliceUnit> {
/**
* 分页查询
*
* @param page 分页参数
* @param params 查询参数
* @return 结果
*/
Page<PoliceUnitPagerVo> pager(@Param("page") Page<PoliceUnitPagerVo> page,
@Param("params") PoliceUnitPagerQueryParams params);
}

View File

@ -1,28 +0,0 @@
package com.changhu.module.management.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.changhu.module.management.pojo.entity.SecurityUnit;
import com.changhu.module.management.pojo.queryParams.SecurityUnitPagerQueryParams;
import com.changhu.module.management.pojo.vo.SecurityUnitPagerVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* security_unit (保安单位) 固化类
* author: luozhun
* desc 由groovy脚本自动生成
*/
@Mapper
public interface SecurityUnitMapper extends BaseMapper<SecurityUnit> {
/**
* 分页查询
*
* @param page 分页对象
* @param params 查询参数
* @return 结果
*/
Page<SecurityUnitPagerVo> pager(@Param("page") Page<SecurityUnitPagerVo> page,
@Param("params") SecurityUnitPagerQueryParams params);
}

View File

@ -1,48 +0,0 @@
package com.changhu.module.management.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.changhu.module.management.pojo.entity.ServiceProject;
import com.changhu.module.management.pojo.queryParams.ServiceProjectPagerQueryParams;
import com.changhu.module.management.pojo.vo.ServiceProjectPagerVo;
import com.changhu.module.miniProgram.pojo.vo.IndexServiceProjectListVo;
import com.changhu.pojo.dto.ServiceProjectDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* service_project (服务项目) 固化类
* author: luozhun
* desc 由groovy脚本自动生成
*/
@Mapper
public interface ServiceProjectMapper extends BaseMapper<ServiceProject> {
/**
* 分页查询
*
* @param page 分页对象
* @param params 查询参数
* @return 结果
*/
Page<ServiceProjectPagerVo> pager(@Param("page") Page<ServiceProjectPagerVo> page,
@Param("params") ServiceProjectPagerQueryParams params);
/**
* 获取服务项目
*
* @return 服务项目列表
*/
List<IndexServiceProjectListVo> getServiceProjectList(@Param("policeUnitId") Long policeUnitId,
@Param("projectManagerMiniProgramUserId") Long projectManagerMiniProgramUserId);
/**
* 获取企事业单位下的服务项目
*
* @param enterprisesUnitId 企事业单位id
* @return 服务项目列表
*/
List<ServiceProjectDTO> getServiceProjectByEnterprisesUnitId(@Param("enterprisesUnitId") Long enterprisesUnitId);
}

View File

@ -1,63 +0,0 @@
package com.changhu.module.management.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.changhu.module.management.pojo.params.IndexCheckPassParams;
import com.changhu.module.management.pojo.params.IndexCheckStatusParams;
import com.changhu.module.management.pojo.params.IndexDisableOrEnableParams;
import com.changhu.module.management.pojo.queryParams.UnitMiniProgramUserPagerQueryParams;
import com.changhu.module.management.pojo.vo.UnitCheckStatusVo;
import com.changhu.module.management.pojo.vo.UnitMiniProgramUserPagerVo;
import com.changhu.support.mybatisplus.pojo.params.PageParams;
/**
* @author 20252
* @createTime 2024/9/2 上午9:49
* @desc IndexService...
*/
public interface ManagementService {
/**
* 审核通过
*
* @param params 审核参数
*/
void checkPass(IndexCheckPassParams params);
/**
* 获取审核状态
*
* @param params 参数
* @return 结果
*/
UnitCheckStatusVo getCheckStatus(IndexCheckStatusParams params);
/**
* 启用或者禁用单位
*
* @param params 参数
*/
void disableOrEnable(IndexDisableOrEnableParams params);
/**
* 查询单位下的小程序用户
*
* @param queryParams 查询参数
* @return 结果
*/
Page<UnitMiniProgramUserPagerVo> miniProgramUserPager(PageParams<UnitMiniProgramUserPagerQueryParams, UnitMiniProgramUserPagerVo> queryParams);
/**
* 审核通过小程序用户
*
* @param params 参数
*/
void passMiniProgramUser(IndexDisableOrEnableParams params);
/**
* 禁用或启用小程序用户
*
* @param params 参数
*/
void disableOrEnableMiniProgramUser(IndexDisableOrEnableParams params);
}

View File

@ -1,37 +0,0 @@
package com.changhu.module.management.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.changhu.module.management.pojo.params.ManagementPoliceUserSaveOrUpdateParams;
import com.changhu.module.management.pojo.queryParams.ManagementPoliceUnitUserPagerQueryParams;
import com.changhu.module.management.pojo.vo.ManagementPoliceUnitUserPagerVo;
import com.changhu.support.mybatisplus.pojo.params.PageParams;
/**
* @author 20252
* @createTime 2024/9/11 上午9:59
* @desc MPoliceService...
*/
public interface PoliceService {
/**
* 新增或保存后台用户
*
* @param params 参数
*/
void userSaveOrUpdate(ManagementPoliceUserSaveOrUpdateParams params);
/**
* 后台用户分页查询
*
* @param queryParams 查询参数
* @return 结果
*/
Page<ManagementPoliceUnitUserPagerVo> userPager(PageParams<ManagementPoliceUnitUserPagerQueryParams, ManagementPoliceUnitUserPagerVo> queryParams);
/**
* 根据id删除后台用户
*
* @param managementPoliceUnitUserId 后台用户id
*/
void userDeleteById(Long managementPoliceUnitUserId);
}

View File

@ -1,46 +0,0 @@
package com.changhu.module.management.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.changhu.common.pojo.vo.SelectNodeVo;
import com.changhu.module.management.pojo.params.ManagementSecurityUnitUserSaveOrUpdateParams;
import com.changhu.module.management.pojo.queryParams.ManagementSecurityUnitUserPagerQueryParams;
import com.changhu.module.management.pojo.vo.ManagementSecurityUnitUserPagerVo;
import com.changhu.support.mybatisplus.pojo.params.PageParams;
import java.util.List;
/**
* @author 20252
* @createTime 2024/9/11 上午10:17
* @desc SecurityService...
*/
public interface SecurityService {
/**
* 新增或修改后台用户
*
* @param saveOrUpdateParams 参数
*/
void userSaveOrUpdate(ManagementSecurityUnitUserSaveOrUpdateParams saveOrUpdateParams);
/**
* 分页查询后台用户
*
* @param queryParams 分页查询后台用户
* @return 结果
*/
Page<ManagementSecurityUnitUserPagerVo> userPager(PageParams<ManagementSecurityUnitUserPagerQueryParams, ManagementSecurityUnitUserPagerVo> queryParams);
/**
* 根据id删除后台用户
*
* @param managementSecurityUnitUserId 用户id
*/
void userDeleteById(Long managementSecurityUnitUserId);
/**
* 查询单位下的项目经理
*
* @return 项目经理
*/
List<SelectNodeVo<Long>> listProjectManager();
}

View File

@ -1,43 +0,0 @@
package com.changhu.module.management.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.changhu.module.management.pojo.entity.ServiceProject;
import com.changhu.module.management.pojo.params.ServiceProjectSaveOrUpdateParams;
import com.changhu.module.management.pojo.queryParams.ServiceProjectPagerQueryParams;
import com.changhu.module.management.pojo.vo.ServiceProjectPagerVo;
import com.changhu.pojo.dto.ServiceProjectDTO;
import com.changhu.support.mybatisplus.pojo.params.PageParams;
import java.util.List;
/**
* service_project (服务项目) 服务类
* author: luozhun
* desc 由groovy脚本自动生成
*/
public interface ServiceProjectService extends IService<ServiceProject> {
/**
* 分页查询
*
* @param queryParams 查询参数
* @return 结果
*/
Page<ServiceProjectPagerVo> pager(PageParams<ServiceProjectPagerQueryParams, ServiceProjectPagerVo> queryParams);
/**
* 新增或者修改
*
* @param params 参数
*/
void saveOrUpdate(ServiceProjectSaveOrUpdateParams params);
/**
* 获取企事业单位下的服务项目
*
* @param enterprisesUnitId 企事业单位id
* @return 服务项目列表
*/
List<ServiceProjectDTO> getServiceProjectByEnterprisesUnitId(Long enterprisesUnitId);
}

View File

@ -1,40 +0,0 @@
package com.changhu.module.management.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.changhu.module.management.pojo.params.ManagementSuperUserSaveOrUpdateParams;
import com.changhu.module.management.pojo.queryParams.PoliceUnitPagerQueryParams;
import com.changhu.module.management.pojo.queryParams.SecurityUnitPagerQueryParams;
import com.changhu.module.management.pojo.vo.PoliceUnitPagerVo;
import com.changhu.module.management.pojo.vo.SecurityUnitPagerVo;
import com.changhu.support.mybatisplus.pojo.params.PageParams;
import org.apache.ibatis.annotations.Param;
/**
* @author 20252
* @createTime 2024/9/11 上午9:52
* @desc SuperService...
*/
public interface SuperService {
/**
* 新增或保存后台用户
*
* @param params 参数
*/
void saveOrUpdateUser(ManagementSuperUserSaveOrUpdateParams params);
/**
* 公安单位分页查询
*
* @param queryParams 查询参数
* @return 结果
*/
Page<PoliceUnitPagerVo> policeUnitPager(@Param("queryParams") PageParams<PoliceUnitPagerQueryParams, PoliceUnitPagerVo> queryParams);
/**
* 保安单位分页查询
*
* @param queryParams 查询参数
* @return 结果
*/
Page<SecurityUnitPagerVo> securityUnitPager(PageParams<SecurityUnitPagerQueryParams, SecurityUnitPagerVo> queryParams);
}

View File

@ -1,47 +0,0 @@
package com.changhu.module.management.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.changhu.common.exception.MessageException;
import com.changhu.common.utils.UserUtil;
import com.changhu.module.management.mapper.ServiceProjectMapper;
import com.changhu.module.management.pojo.entity.ServiceProject;
import com.changhu.module.management.pojo.params.ServiceProjectSaveOrUpdateParams;
import com.changhu.module.management.pojo.queryParams.ServiceProjectPagerQueryParams;
import com.changhu.module.management.pojo.vo.ServiceProjectPagerVo;
import com.changhu.module.management.service.ServiceProjectService;
import com.changhu.pojo.dto.ServiceProjectDTO;
import com.changhu.support.mybatisplus.pojo.params.PageParams;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* service_project (服务项目) 服务实现类
* author: luozhun
* desc 由groovy脚本自动生成
*/
@Service
public class ServiceProjectServiceImpl extends ServiceImpl<ServiceProjectMapper, ServiceProject> implements ServiceProjectService {
@Override
public Page<ServiceProjectPagerVo> pager(PageParams<ServiceProjectPagerQueryParams, ServiceProjectPagerVo> queryParams) {
return baseMapper.pager(queryParams.getPage(), queryParams.getParams());
}
@Override
public void saveOrUpdate(ServiceProjectSaveOrUpdateParams params) {
ServiceProject serviceProject = BeanUtil.copyProperties(params, ServiceProject.class);
serviceProject.setSecurityUnitId(UserUtil.getUnitId());
boolean b = this.saveOrUpdate(serviceProject);
if (!b) {
throw new MessageException();
}
}
@Override
public List<ServiceProjectDTO> getServiceProjectByEnterprisesUnitId(Long enterprisesUnitId) {
return baseMapper.getServiceProjectByEnterprisesUnitId(enterprisesUnitId);
}
}

View File

@ -1,49 +0,0 @@
package com.changhu.module.miniProgram.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.changhu.common.annotation.JsonBody;
import com.changhu.module.miniProgram.pojo.params.MiniProgramUserRegisterParams;
import com.changhu.module.miniProgram.pojo.params.SaveOrUpdateSecurityUserParams;
import com.changhu.module.miniProgram.pojo.queryParams.ServiceProjectSecurityUserPagerQueryParams;
import com.changhu.module.miniProgram.pojo.vo.ServiceProjectSecurityUserPagerVo;
import com.changhu.module.miniProgram.service.MiniProgramUserService;
import com.changhu.support.mybatisplus.pojo.params.PageParams;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
/**
* @author 20252
* @createTime 2024/9/6 上午10:42
* @desc MiniProgramUserController...
*/
@Tag(name = "小程序用户接口")
@JsonBody
@RequestMapping("/miniProgramUser")
public class MiniProgramUserController {
@Autowired
private MiniProgramUserService miniProgramUserService;
@Operation(summary = "注册")
@PostMapping("/register")
public void register(@RequestBody @Valid MiniProgramUserRegisterParams params) {
miniProgramUserService.register(params);
}
@Operation(summary = "二维码表单录入保安人员")
@PostMapping("/qrCodeFormInputSecurityUser")
public void qrCodeFormInputSecurityUser(@RequestBody @Valid SaveOrUpdateSecurityUserParams params) {
miniProgramUserService.qrCodeFormInputSecurityUser(params);
}
@Operation(summary = "服务项目保安人员分页")
@PostMapping("/securityUserPager")
public Page<ServiceProjectSecurityUserPagerVo> securityUserPager(@RequestBody PageParams<ServiceProjectSecurityUserPagerQueryParams, ServiceProjectSecurityUserPagerVo> queryParams) {
return miniProgramUserService.securityUserPager(queryParams);
}
}

View File

@ -6,12 +6,13 @@ import com.changhu.common.db.enums.UserType;
import com.changhu.common.pojo.vo.SelectNodeVo; import com.changhu.common.pojo.vo.SelectNodeVo;
import com.changhu.module.miniProgram.pojo.vo.IndexDataStatisticsVo; import com.changhu.module.miniProgram.pojo.vo.IndexDataStatisticsVo;
import com.changhu.module.miniProgram.pojo.vo.IndexServiceProjectListVo; import com.changhu.module.miniProgram.pojo.vo.IndexServiceProjectListVo;
import com.changhu.module.miniProgram.service.MPoliceService; import com.changhu.module.miniProgram.service.PoliceIndexService;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List; import java.util.List;
@ -20,13 +21,14 @@ import java.util.List;
* @createTime 2024/9/11 上午10:44 * @createTime 2024/9/11 上午10:44
* @desc PoliceIndexController... * @desc PoliceIndexController...
*/ */
@Tag(name = "公安人员首页") @Tag(name = "微信小程序-首页-公安")
@JsonBody @JsonBody
@RequestMapping("/policeIndex") @RequestMapping("/policeIndex")
@RestController
public class PoliceIndexController { public class PoliceIndexController {
@Autowired @Autowired
private MPoliceService policeIndexService; private PoliceIndexService policeIndexService;
@Operation(summary = "首页数据统计") @Operation(summary = "首页数据统计")
@GetMapping("/dataStatistics") @GetMapping("/dataStatistics")

View File

@ -3,17 +3,14 @@ package com.changhu.module.miniProgram.controller;
import com.changhu.common.annotation.CheckUserType; 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.common.db.enums.UserType;
import com.changhu.module.miniProgram.pojo.params.SaveOrUpdateSecurityUserParams;
import com.changhu.module.miniProgram.pojo.vo.IndexServiceProjectListVo; import com.changhu.module.miniProgram.pojo.vo.IndexServiceProjectListVo;
import com.changhu.module.miniProgram.service.ProjectManageIndexService; import com.changhu.module.miniProgram.service.ProjectManageIndexService;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.Resource; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.RestController;
import java.util.List; import java.util.List;
@ -22,38 +19,20 @@ import java.util.List;
* @createTime 2024/9/10 下午3:48 * @createTime 2024/9/10 下午3:48
* @desc 项目经理首页控制器 * @desc 项目经理首页控制器
*/ */
@Tag(name = "项目经理首页") @Tag(name = "微信小程序-首页-项目经理")
@JsonBody @JsonBody
@RequestMapping("/projectManageIndex") @RequestMapping("/mp/pmi")
@RestController
public class ProjectManageIndexController { public class ProjectManageIndexController {
@Autowired @Autowired
private ProjectManageIndexService projectManageIndexService; private ProjectManageIndexService projectManageIndexService;
@Operation(summary = "获取我的服务项目") @Operation(summary = "获取我的服务项目")
@GetMapping("/getMyServiceProject") @GetMapping("/get_my_sp")
@CheckUserType(userTypes = UserType.MINI_PROGRAM_PROJECT_MANAGE) @CheckUserType(userTypes = UserType.MINI_PROGRAM_PROJECT_MANAGE)
public List<IndexServiceProjectListVo> getMyServiceProjectList() { public List<IndexServiceProjectListVo> getMyServiceProjectList() {
return projectManageIndexService.getMyServiceProjectList(); return projectManageIndexService.getMyServiceProjectList();
} }
@Operation(summary = "根据id删除保安人员")
@DeleteMapping("/deleteSecurityUserByServiceProjectId")
public void deleteSecurityUserById(@RequestParam @Schema(description = "保安人员id") Long securityUserId) {
projectManageIndexService.deleteSecurityUserByServiceProjectId(securityUserId);
}
@Operation(summary = "保存或更新保安人员")
@PostMapping("/saveOrUpdateSecurityUser")
public void saveOrUpdateSecurityUser(@RequestBody @Valid SaveOrUpdateSecurityUserParams params) {
projectManageIndexService.saveOrUpdateSecurityUser(params);
}
@JsonBody(value = false)
@Operation(summary = "获取表单分享二维码")
@GetMapping(value = "/shareForm_QR_Code")
public ResponseEntity<Resource> shareForm_QR_Code(@Schema(description = "要生成的路径") @RequestParam String path,
@Schema(description = "生成二维码的宽度") @RequestParam(defaultValue = "430") Integer width) {
return projectManageIndexService.shareForm_QR_Code(path, width);
}
} }

View File

@ -0,0 +1,51 @@
package com.changhu.module.miniProgram.controller;
import com.changhu.common.annotation.CheckUserType;
import com.changhu.common.annotation.JsonBody;
import com.changhu.common.db.enums.EnterprisesUnitType;
import com.changhu.common.db.enums.UserType;
import com.changhu.common.pojo.vo.SelectNodeVo;
import com.changhu.module.miniProgram.pojo.params.AssessmentRecordParams;
import com.changhu.module.miniProgram.pojo.vo.AssessmentCriteriaRuleVo;
import com.changhu.module.miniProgram.service.SupervisionAssessmentService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @author 20252
* @createTime 2024/11/22 下午2:47
* @desc SupervisionAssessmentController...
*/
@Tag(name = "微信小程序-监督考核")
@JsonBody
@RequestMapping("/mp/sa")
@CheckUserType(userTypes = UserType.MINI_PROGRAM_POLICE)
@RestController
public class SupervisionAssessmentController {
@Autowired
private SupervisionAssessmentService supervisionAssessmentService;
@Operation(summary = "根据类型获取考核项目列表")
@GetMapping("/ckProjectListByType")
public List<SelectNodeVo<Long>> ckProjectListByType(@RequestParam EnterprisesUnitType type) {
return supervisionAssessmentService.assessmentCriteriaListByType(type);
}
@Operation(summary = "根据考核项目获取考核规则")
@GetMapping("/assessmentCriteriaRulesByCkProjectId")
public List<AssessmentCriteriaRuleVo> assessmentCriteriaRulesByCkProjectId(@RequestParam Long ckProjectId) {
return supervisionAssessmentService.assessmentCriteriaRulesByCkProjectId(ckProjectId);
}
@Operation(summary = "提交考核记录")
@PostMapping("/submitAssessmentRecord")
public void submitAssessmentRecord(@Validated @RequestBody AssessmentRecordParams params) {
supervisionAssessmentService.submitAssessmentRecord(params);
}
}

View File

@ -0,0 +1,64 @@
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.UserRegisterParams;
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.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.*;
/**
* @author 20252
* @createTime 2024/9/6 上午10:42
* @desc UserController...
*/
@Tag(name = "微信小程序-用户相关")
@JsonBody
@RequestMapping("/mp/user")
@RestController("miniProgramUserController")
public class UserController {
@Autowired
private UserService userService;
@Operation(summary = "注册小程序用户")
@PostMapping("/register")
@IsWhiteList
public void register(@RequestBody @Valid UserRegisterParams params) {
userService.register(params);
}
@Operation(summary = "保存或更新保安人员")
@PostMapping("/add_security_user_upd")
public void saveOrUpdateSecurityUser(@RequestBody @Valid SaveOrUpdateSecurityUserParams 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) {
userService.qrCodeFormInputSecurityUser(params);
}
@Operation(summary = "服务项目保安人员分页")
@PostMapping("/securityUserPager")
public Page<ServiceProjectSecurityUserPagerVo> securityUserPager(@RequestBody PageParams<ServiceProjectSecurityUserPagerQueryParams, ServiceProjectSecurityUserPagerVo> queryParams) {
return userService.securityUserPager(queryParams);
}
}

View File

@ -1,31 +0,0 @@
package com.changhu.module.miniProgram.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.changhu.common.db.enums.MiniProgramUserIdentity;
import com.changhu.module.management.pojo.queryParams.UnitMiniProgramUserPagerQueryParams;
import com.changhu.module.management.pojo.vo.UnitMiniProgramUserPagerVo;
import com.changhu.module.miniProgram.pojo.entity.MiniProgramUser;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* mini_program_user (小程序用户) 固化类
* author: luozhun
* desc 由groovy脚本自动生成
*/
@Mapper
public interface MiniProgramUserMapper extends BaseMapper<MiniProgramUser> {
/**
* 分页查询
*
* @param page 分页参数
* @param params 查询参数
* @param identity 用户身份
* @return 结果
*/
Page<UnitMiniProgramUserPagerVo> pager(@Param("page") Page<UnitMiniProgramUserPagerVo> page,
@Param("params") UnitMiniProgramUserPagerQueryParams params,
@Param("identity") MiniProgramUserIdentity identity);
}

View File

@ -1,4 +1,4 @@
package com.changhu.module.assessmentCriteria.pojo.params; package com.changhu.module.miniProgram.pojo.params;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.Valid; import jakarta.validation.Valid;

View File

@ -10,10 +10,10 @@ import lombok.Data;
/** /**
* @author 20252 * @author 20252
* @createTime 2024/9/6 上午10:47 * @createTime 2024/9/6 上午10:47
* @desc MiniProgramUserRegisterParams... * @desc UserRegisterParams...
*/ */
@Data @Data
public class MiniProgramUserRegisterParams { public class UserRegisterParams {
@Schema(description = "微信code") @Schema(description = "微信code")
@NotBlank(message = "code不能为空") @NotBlank(message = "code不能为空")
private String code; private String code;

View File

@ -1,4 +1,4 @@
package com.changhu.module.assessmentCriteria.pojo.vo; package com.changhu.module.miniProgram.pojo.vo;
import com.changhu.common.db.enums.SelectType; import com.changhu.common.db.enums.SelectType;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;

View File

@ -3,7 +3,7 @@ package com.changhu.module.miniProgram.pojo.vo;
import cn.hutool.core.lang.Dict; import cn.hutool.core.lang.Dict;
import com.changhu.common.db.enums.EnterprisesUnitType; import com.changhu.common.db.enums.EnterprisesUnitType;
import com.changhu.common.db.enums.ServiceProjectType; import com.changhu.common.db.enums.ServiceProjectType;
import com.changhu.module.management.pojo.model.ContactPersonInfo; import com.changhu.pojo.model.ContactPersonInfo;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;

View File

@ -11,7 +11,7 @@ import java.util.List;
* @createTime 2024/9/11 上午10:52 * @createTime 2024/9/11 上午10:52
* @desc MPoliceService... * @desc MPoliceService...
*/ */
public interface MPoliceService { public interface PoliceIndexService {
/** /**
* 首页数据统计 * 首页数据统计

View File

@ -1,9 +1,6 @@
package com.changhu.module.miniProgram.service; package com.changhu.module.miniProgram.service;
import com.changhu.module.miniProgram.pojo.params.SaveOrUpdateSecurityUserParams;
import com.changhu.module.miniProgram.pojo.vo.IndexServiceProjectListVo; import com.changhu.module.miniProgram.pojo.vo.IndexServiceProjectListVo;
import org.springframework.core.io.Resource;
import org.springframework.http.ResponseEntity;
import java.util.List; import java.util.List;
@ -20,22 +17,4 @@ public interface ProjectManageIndexService {
*/ */
List<IndexServiceProjectListVo> getMyServiceProjectList(); List<IndexServiceProjectListVo> getMyServiceProjectList();
/**
* 根据id删除保安人员
*
* @param securityUserId 保安人员id
*/
void deleteSecurityUserByServiceProjectId(Long securityUserId);
/**
* 保存或更新保安人员
*
* @param params 保安人员参数
*/
void saveOrUpdateSecurityUser(SaveOrUpdateSecurityUserParams params);
/**
* 分享表单录入的二维码
*/
ResponseEntity<Resource> shareForm_QR_Code(String path, Integer width);
} }

View File

@ -0,0 +1,38 @@
package com.changhu.module.miniProgram.service;
import com.changhu.common.db.enums.EnterprisesUnitType;
import com.changhu.common.pojo.vo.SelectNodeVo;
import com.changhu.module.miniProgram.pojo.params.AssessmentRecordParams;
import com.changhu.module.miniProgram.pojo.vo.AssessmentCriteriaRuleVo;
import java.util.List;
/**
* @author 20252
* @createTime 2024/11/22 下午2:48
* @desc SupervisionAssessmentService...
*/
public interface SupervisionAssessmentService {
/**
* 根据类型获取考核标准列表
*
* @param type 类型
* @return 结果
*/
List<SelectNodeVo<Long>> assessmentCriteriaListByType(EnterprisesUnitType type);
/**
* 根据考核项目获取考核规则
*
* @param ckProjectId 考核项目id
* @return 结果
*/
List<AssessmentCriteriaRuleVo> assessmentCriteriaRulesByCkProjectId(Long ckProjectId);
/**
* 提交考核记录
*
* @param params 参数
*/
void submitAssessmentRecord(AssessmentRecordParams params);
}

View File

@ -1,27 +1,38 @@
package com.changhu.module.miniProgram.service; package com.changhu.module.miniProgram.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.changhu.module.miniProgram.pojo.entity.MiniProgramUser;
import com.changhu.module.miniProgram.pojo.params.MiniProgramUserRegisterParams;
import com.changhu.module.miniProgram.pojo.params.SaveOrUpdateSecurityUserParams; import com.changhu.module.miniProgram.pojo.params.SaveOrUpdateSecurityUserParams;
import com.changhu.module.miniProgram.pojo.params.UserRegisterParams;
import com.changhu.module.miniProgram.pojo.queryParams.ServiceProjectSecurityUserPagerQueryParams; import com.changhu.module.miniProgram.pojo.queryParams.ServiceProjectSecurityUserPagerQueryParams;
import com.changhu.module.miniProgram.pojo.vo.ServiceProjectSecurityUserPagerVo; import com.changhu.module.miniProgram.pojo.vo.ServiceProjectSecurityUserPagerVo;
import com.changhu.support.mybatisplus.pojo.params.PageParams; import com.changhu.support.mybatisplus.pojo.params.PageParams;
/** /**
* mini_program_user (小程序用户) 服务类 * @author 20252
* author: luozhun * @createTime 2024/11/22 下午4:14
* desc 由groovy脚本自动生成 * @desc UserService...
*/ */
public interface MiniProgramUserService extends IService<MiniProgramUser> { public interface UserService {
/** /**
* 注册 * 注册
* *
* @param params 参数 * @param params 参数
*/ */
void register(MiniProgramUserRegisterParams params); void register(UserRegisterParams params);
/**
* 保存或更新保安人员
*
* @param params 保安人员参数
*/
void saveOrUpdateSecurityUser(SaveOrUpdateSecurityUserParams params);
/**
* 根据id删除保安人员
*
* @param securityUserId 保安人员id
*/
void deleteSecurityUserByServiceProjectId(Long securityUserId);
/** /**
* 服务项目内的保安人员分页 * 服务项目内的保安人员分页

View File

@ -1,73 +0,0 @@
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.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.changhu.common.exception.MessageException;
import com.changhu.common.utils.SnowFlakeIdUtil;
import com.changhu.module.miniProgram.mapper.MiniProgramUserMapper;
import com.changhu.module.miniProgram.mapper.SecurityUserMapper;
import com.changhu.module.miniProgram.pojo.entity.MiniProgramUser;
import com.changhu.module.miniProgram.pojo.params.MiniProgramUserRegisterParams;
import com.changhu.module.miniProgram.pojo.params.SaveOrUpdateSecurityUserParams;
import com.changhu.module.miniProgram.pojo.queryParams.ServiceProjectSecurityUserPagerQueryParams;
import com.changhu.module.miniProgram.pojo.vo.ServiceProjectSecurityUserPagerVo;
import com.changhu.module.miniProgram.service.MiniProgramUserService;
import com.changhu.module.miniProgram.service.ProjectManageIndexService;
import com.changhu.support.mybatisplus.pojo.params.PageParams;
import me.chanjar.weixin.common.error.WxErrorException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* mini_program_user (小程序用户) 服务实现类
* author: luozhun
* desc 由groovy脚本自动生成
*/
@Service
public class MiniProgramUserServiceImpl extends ServiceImpl<MiniProgramUserMapper, MiniProgramUser> implements MiniProgramUserService {
@Autowired
private WxMaService wxMaService;
@Autowired
private SecurityUserMapper securityUserMapper;
@Autowired
private ProjectManageIndexService projectManageIndexService;
@Override
public void register(MiniProgramUserRegisterParams params) {
MiniProgramUser miniProgramUser = BeanUtil.copyProperties(params, MiniProgramUser.class);
try {
WxMaJscode2SessionResult sessionInfo = wxMaService.getUserService().getSessionInfo(params.getCode());
miniProgramUser.setOpenId(sessionInfo.getOpenid());
miniProgramUser.setSessionKey(sessionInfo.getSessionKey());
} catch (WxErrorException e) {
throw new MessageException(e.getMessage());
}
boolean exists = baseMapper.exists(Wrappers.<MiniProgramUser>lambdaQuery().eq(MiniProgramUser::getOpenId, miniProgramUser.getOpenId()));
if (exists) {
throw new MessageException("该用户已存在,请勿重复注册!");
}
long userId = SnowFlakeIdUtil.snowflakeId();
miniProgramUser.setSnowFlakeId(userId);
boolean save = this.save(miniProgramUser);
if (!save) {
throw new MessageException();
}
}
@Override
public Page<ServiceProjectSecurityUserPagerVo> securityUserPager(PageParams<ServiceProjectSecurityUserPagerQueryParams, ServiceProjectSecurityUserPagerVo> queryParams) {
return securityUserMapper.securityUserPager(queryParams.getPage(), queryParams.getParams());
}
@Override
public void qrCodeFormInputSecurityUser(SaveOrUpdateSecurityUserParams params) {
projectManageIndexService.saveOrUpdateSecurityUser(params);
}
}

View File

@ -5,13 +5,13 @@ import cn.hutool.core.lang.func.LambdaUtil;
import com.baomidou.mybatisplus.extension.toolkit.Db; import com.baomidou.mybatisplus.extension.toolkit.Db;
import com.changhu.common.pojo.vo.SelectNodeVo; import com.changhu.common.pojo.vo.SelectNodeVo;
import com.changhu.common.utils.UserUtil; import com.changhu.common.utils.UserUtil;
import com.changhu.module.management.mapper.ServiceProjectMapper; import com.changhu.mapper.ServiceProjectMapper;
import com.changhu.module.management.pojo.entity.EnterprisesUnit;
import com.changhu.module.management.pojo.entity.ServiceProject;
import com.changhu.module.miniProgram.pojo.entity.SecurityUser;
import com.changhu.module.miniProgram.pojo.vo.IndexDataStatisticsVo; import com.changhu.module.miniProgram.pojo.vo.IndexDataStatisticsVo;
import com.changhu.module.miniProgram.pojo.vo.IndexServiceProjectListVo; import com.changhu.module.miniProgram.pojo.vo.IndexServiceProjectListVo;
import com.changhu.module.miniProgram.service.MPoliceService; import com.changhu.module.miniProgram.service.PoliceIndexService;
import com.changhu.pojo.entity.EnterprisesUnit;
import com.changhu.pojo.entity.SecurityUser;
import com.changhu.pojo.entity.ServiceProject;
import com.changhu.support.mybatisplus.pojo.entity.BaseEntity; import com.changhu.support.mybatisplus.pojo.entity.BaseEntity;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -24,7 +24,7 @@ import java.util.List;
* @desc MPoliceServiceImpl... * @desc MPoliceServiceImpl...
*/ */
@Service @Service
public class MPoliceServiceImpl implements MPoliceService { public class PoliceIndexServiceImpl implements PoliceIndexService {
@Autowired @Autowired
private ServiceProjectMapper serviceProjectMapper; private ServiceProjectMapper serviceProjectMapper;

View File

@ -1,27 +1,13 @@
package com.changhu.module.miniProgram.service.impl; package com.changhu.module.miniProgram.service.impl;
import cn.binarywang.wx.miniapp.api.WxMaQrcodeService;
import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.extension.toolkit.Db;
import com.changhu.common.exception.MessageException;
import com.changhu.common.utils.UserUtil; import com.changhu.common.utils.UserUtil;
import com.changhu.module.management.mapper.ServiceProjectMapper; import com.changhu.mapper.ServiceProjectMapper;
import com.changhu.module.miniProgram.pojo.entity.SecurityUser;
import com.changhu.module.miniProgram.pojo.params.SaveOrUpdateSecurityUserParams;
import com.changhu.module.miniProgram.pojo.vo.IndexServiceProjectListVo; import com.changhu.module.miniProgram.pojo.vo.IndexServiceProjectListVo;
import com.changhu.module.miniProgram.service.ProjectManageIndexService; import com.changhu.module.miniProgram.service.ProjectManageIndexService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.common.error.WxErrorException;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.FileSystemResource;
import org.springframework.core.io.Resource;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.io.File;
import java.util.List; import java.util.List;
/** /**
@ -36,66 +22,9 @@ public class ProjectManageIndexServiceImpl implements ProjectManageIndexService
@Autowired @Autowired
private ServiceProjectMapper serviceProjectMapper; private ServiceProjectMapper serviceProjectMapper;
@Autowired
private WxMaService wxMaService;
@Override @Override
public List<IndexServiceProjectListVo> getMyServiceProjectList() { public List<IndexServiceProjectListVo> getMyServiceProjectList() {
return serviceProjectMapper.getServiceProjectList(null, UserUtil.getUserId()); return serviceProjectMapper.getServiceProjectList(null, UserUtil.getUserId());
} }
@Override
public void deleteSecurityUserByServiceProjectId(Long securityUserId) {
boolean b = Db.removeById(securityUserId, SecurityUser.class);
if (!b) {
throw new MessageException();
}
}
@Override
public void saveOrUpdateSecurityUser(SaveOrUpdateSecurityUserParams params) {
SecurityUser securityUser = BeanUtil.copyProperties(params, SecurityUser.class);
//新增的情况
Long snowFlakeId = securityUser.getSnowFlakeId();
if (snowFlakeId == null) {
//判断是否已经存在
boolean exists = Db.lambdaQuery(SecurityUser.class)
.eq(SecurityUser::getServiceProjectId, securityUser.getServiceProjectId())
.eq(SecurityUser::getIdCard, securityUser.getIdCard())
.exists();
if (exists) {
throw new MessageException("服务项目下已经存在该人员");
}
} else {
//如果修改了身份证 需要查重
SecurityUser byId = Db.getById(snowFlakeId, SecurityUser.class);
if (!securityUser.getIdCard().equals(byId.getIdCard())) {
boolean exists = Db.lambdaQuery(SecurityUser.class)
.eq(SecurityUser::getServiceProjectId, securityUser.getServiceProjectId())
.eq(SecurityUser::getIdCard, securityUser.getIdCard())
.exists();
if (exists) {
throw new MessageException("服务项目下已经存在该人员");
}
}
}
boolean b = Db.saveOrUpdate(securityUser);
if (!b) {
throw new MessageException();
}
}
@Override
public ResponseEntity<Resource> shareForm_QR_Code(String path, Integer width) {
WxMaQrcodeService qrcodeService = wxMaService.getQrcodeService();
try {
File qrcodeFile = qrcodeService.createQrcode(path, width);
return ResponseEntity.ok()
.header(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=" + qrcodeFile.getName())
.contentType(MediaType.APPLICATION_OCTET_STREAM)
.body(new FileSystemResource(qrcodeFile));
} catch (WxErrorException e) {
throw new MessageException("生成表单二维码失败:{}", e.getMessage());
}
}
} }

View File

@ -1,26 +1,18 @@
package com.changhu.module.assessmentCriteria.service.impl; package com.changhu.module.miniProgram.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.lang.Dict; import cn.hutool.core.lang.Dict;
import cn.hutool.core.lang.func.LambdaUtil; import cn.hutool.core.lang.func.LambdaUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.toolkit.Db; import com.baomidou.mybatisplus.extension.toolkit.Db;
import com.changhu.common.db.enums.EnterprisesUnitType; import com.changhu.common.db.enums.EnterprisesUnitType;
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.common.utils.SnowFlakeIdUtil; import com.changhu.common.utils.SnowFlakeIdUtil;
import com.changhu.module.assessmentCriteria.mapper.CkProjectMapper; import com.changhu.module.miniProgram.pojo.params.AssessmentRecordParams;
import com.changhu.module.assessmentCriteria.pojo.entity.*; import com.changhu.module.miniProgram.pojo.vo.AssessmentCriteriaRuleVo;
import com.changhu.module.assessmentCriteria.pojo.params.*; import com.changhu.module.miniProgram.service.SupervisionAssessmentService;
import com.changhu.module.assessmentCriteria.pojo.queryParams.CkProjectPagerQueryParams; import com.changhu.pojo.entity.*;
import com.changhu.module.assessmentCriteria.pojo.vo.AssessmentCriteriaRuleVo;
import com.changhu.module.assessmentCriteria.pojo.vo.CkProjectDetailTableVo;
import com.changhu.module.assessmentCriteria.pojo.vo.CkProjectPagerVo;
import com.changhu.module.assessmentCriteria.service.AssessmentCriteriaService;
import com.changhu.support.mybatisplus.pojo.entity.BaseEntity; import com.changhu.support.mybatisplus.pojo.entity.BaseEntity;
import com.changhu.support.mybatisplus.pojo.params.PageParams;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -30,14 +22,11 @@ import java.util.stream.Collectors;
/** /**
* @author 20252 * @author 20252
* @createTime 2024/11/6 上午10:08 * @createTime 2024/11/22 下午2:48
* @desc AssessmentCriteriaServiceImpl... * @desc SupervisionAssessmentServiceImpl...
*/ */
@Service @Service
public class AssessmentCriteriaServiceImpl implements AssessmentCriteriaService { public class SupervisionAssessmentServiceImpl implements SupervisionAssessmentService {
@Autowired
private CkProjectMapper ckProjectMapper;
@Override @Override
public List<SelectNodeVo<Long>> assessmentCriteriaListByType(EnterprisesUnitType type) { public List<SelectNodeVo<Long>> assessmentCriteriaListByType(EnterprisesUnitType type) {
@ -119,61 +108,6 @@ public class AssessmentCriteriaServiceImpl implements AssessmentCriteriaService
return groupList; return groupList;
} }
@Override
public Page<CkProjectPagerVo> ckProjectPagerVoPager(PageParams<CkProjectPagerQueryParams, CkProjectPagerVo> queryParams) {
return ckProjectMapper.pager(queryParams.getPage(), queryParams.getParams());
}
@Transactional(rollbackFor = Exception.class)
@Override
public void saveOrUpdateCkProject(CkProjectSaveOrUpdateParams params) {
boolean b = Db.saveOrUpdate(BeanUtil.copyProperties(params, CkProject.class));
if (!b) {
throw new MessageException();
}
}
@Transactional(rollbackFor = Exception.class)
@Override
public void deleteCkProjectById(Long ckProjectId) {
boolean b = Db.removeById(ckProjectId, CkProject.class);
if (!b) {
throw new MessageException();
}
}
@Override
public List<CkProjectDetailTableVo> ckProjectDetail(Long ckProjectId) {
return ckProjectMapper.ckProjectDetail(ckProjectId);
}
@Transactional(rollbackFor = Exception.class)
@Override
public void saveOrUpdateCkGroup(CkGroupSaveOrUpdateParams params) {
boolean b = Db.saveOrUpdate(BeanUtil.copyProperties(params, CkGroup.class));
if (!b) {
throw new MessageException();
}
}
@Transactional(rollbackFor = Exception.class)
@Override
public void saveOrUpdateCkItem(CkItemSaveOrUpdateParams params) {
boolean b = Db.saveOrUpdate(BeanUtil.copyProperties(params, CkItem.class));
if (!b) {
throw new MessageException();
}
}
@Transactional(rollbackFor = Exception.class)
@Override
public void saveOrUpdateCkStandard(CkStandardSaveOrUpdateParams params) {
boolean b = Db.saveOrUpdate(BeanUtil.copyProperties(params, CkStandard.class));
if (!b) {
throw new MessageException();
}
}
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Override @Override
public void submitAssessmentRecord(AssessmentRecordParams params) { public void submitAssessmentRecord(AssessmentRecordParams params) {

View File

@ -0,0 +1,112 @@
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.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.toolkit.Db;
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.UserRegisterParams;
import com.changhu.module.miniProgram.pojo.queryParams.ServiceProjectSecurityUserPagerQueryParams;
import com.changhu.module.miniProgram.pojo.vo.ServiceProjectSecurityUserPagerVo;
import com.changhu.module.miniProgram.service.ProjectManageIndexService;
import com.changhu.module.miniProgram.service.UserService;
import com.changhu.pojo.entity.MiniProgramUser;
import com.changhu.pojo.entity.SecurityUser;
import com.changhu.support.mybatisplus.pojo.params.PageParams;
import me.chanjar.weixin.common.error.WxErrorException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @author 20252
* @createTime 2024/11/22 下午4:14
* @desc UserServiceImpl...
*/
@Service("miniProgramUserService")
public class UserServiceImpl implements UserService {
@Autowired
private WxMaService wxMaService;
@Autowired
private SecurityUserMapper securityUserMapper;
@Autowired
private ProjectManageIndexService projectManageIndexService;
@Override
public void register(UserRegisterParams params) {
MiniProgramUser miniProgramUser = BeanUtil.copyProperties(params, MiniProgramUser.class);
try {
WxMaJscode2SessionResult sessionInfo = wxMaService.getUserService().getSessionInfo(params.getCode());
miniProgramUser.setOpenId(sessionInfo.getOpenid());
miniProgramUser.setSessionKey(sessionInfo.getSessionKey());
} catch (WxErrorException e) {
throw new MessageException(e.getMessage());
}
boolean exists = Db.lambdaQuery(MiniProgramUser.class).eq(MiniProgramUser::getOpenId, miniProgramUser.getOpenId()).exists();
if (exists) {
throw new MessageException("该用户已存在,请勿重复注册!");
}
long userId = SnowFlakeIdUtil.snowflakeId();
miniProgramUser.setSnowFlakeId(userId);
boolean save = Db.save(miniProgramUser);
if (!save) {
throw new MessageException();
}
}
@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) {
SecurityUser securityUser = BeanUtil.copyProperties(params, SecurityUser.class);
//新增的情况
Long snowFlakeId = securityUser.getSnowFlakeId();
if (snowFlakeId == null) {
//判断是否已经存在
boolean exists = Db.lambdaQuery(SecurityUser.class)
.eq(SecurityUser::getServiceProjectId, securityUser.getServiceProjectId())
.eq(SecurityUser::getIdCard, securityUser.getIdCard())
.exists();
if (exists) {
throw new MessageException("服务项目下已经存在该人员");
}
} else {
//如果修改了身份证 需要查重
SecurityUser byId = Db.getById(snowFlakeId, SecurityUser.class);
if (!securityUser.getIdCard().equals(byId.getIdCard())) {
boolean exists = Db.lambdaQuery(SecurityUser.class)
.eq(SecurityUser::getServiceProjectId, securityUser.getServiceProjectId())
.eq(SecurityUser::getIdCard, securityUser.getIdCard())
.exists();
if (exists) {
throw new MessageException("服务项目下已经存在该人员");
}
}
}
boolean b = Db.saveOrUpdate(securityUser);
if (!b) {
throw new MessageException();
}
}
@Override
public void deleteSecurityUserByServiceProjectId(Long securityUserId) {
boolean b = Db.removeById(securityUserId, SecurityUser.class);
if (!b) {
throw new MessageException();
}
}
}

View File

@ -0,0 +1,51 @@
package com.changhu.module.policeManagement.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.policeManagement.pojo.params.UserSaveOrUpdateParams;
import com.changhu.module.policeManagement.pojo.queryParams.UserPagerQueryParams;
import com.changhu.module.policeManagement.pojo.vo.UserPagerVo;
import com.changhu.module.policeManagement.service.UserService;
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.*;
/**
* @author 20252
* @createTime 2024/11/22 上午9:26
* @desc UserController...
*/
@Tag(name = "公安后台-用户管理")
@JsonBody
@RequestMapping("/m2/user")
@RestController("policeUserManagement")
@CheckUserType(userTypes = UserType.MANAGEMENT_POLICE)
public class UserController {
@Autowired
private UserService userService;
@Operation(summary = "新增或保存后台用户")
@PostMapping("/add_upd")
public void userSaveOrUpdate(@RequestBody @Valid UserSaveOrUpdateParams params) {
userService.saveOrUpdate(params);
}
@Operation(summary = "分页查询后台用户")
@PostMapping("/pager")
public Page<UserPagerVo> userPager(@RequestBody PageParams<UserPagerQueryParams, UserPagerVo> queryParams) {
return userService.pager(queryParams);
}
@Operation(summary = "根据id删除后台用户")
@DeleteMapping("/del_id")
public void userDeleteById(@RequestParam @Schema(description = "后台公安用户id") Long managementPoliceUnitUserId) {
userService.deleteById(managementPoliceUnitUserId);
}
}

View File

@ -0,0 +1,27 @@
package com.changhu.module.policeManagement.mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.changhu.module.policeManagement.pojo.queryParams.UserPagerQueryParams;
import com.changhu.module.policeManagement.pojo.vo.UserPagerVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
/**
* @author 20252
* @createTime 2024/11/22 上午9:34
* @desc UserMapper...
*/
@Mapper
@Repository("policeManagementUserMapper")
public interface UserMapper {
/**
* 分页查询用户
*
* @param page 分页参数
* @param params 查询参数
* @return 用户
*/
Page<UserPagerVo> pager(@Param("page") Page<UserPagerVo> page,
@Param("params") UserPagerQueryParams params);
}

View File

@ -1,4 +1,4 @@
package com.changhu.module.management.pojo.params; package com.changhu.module.policeManagement.pojo.params;
import com.changhu.common.db.enums.IsEnable; import com.changhu.common.db.enums.IsEnable;
import com.changhu.common.db.enums.Sex; import com.changhu.common.db.enums.Sex;
@ -11,10 +11,10 @@ import lombok.Data;
/** /**
* @author 20252 * @author 20252
* @createTime 2024/9/4 下午3:04 * @createTime 2024/9/4 下午3:04
* @desc ManagementPoliceUserSaveOrUpdateParams... * @desc UserSaveOrUpdateParams...
*/ */
@Data @Data
public class ManagementPoliceUserSaveOrUpdateParams { public class UserSaveOrUpdateParams {
@Schema(description = "id") @Schema(description = "id")
private Long snowFlakeId; private Long snowFlakeId;

View File

@ -1,4 +1,4 @@
package com.changhu.module.management.pojo.queryParams; package com.changhu.module.policeManagement.pojo.queryParams;
import com.changhu.common.db.enums.IsEnable; import com.changhu.common.db.enums.IsEnable;
import com.changhu.common.db.enums.Sex; import com.changhu.common.db.enums.Sex;
@ -8,10 +8,10 @@ import lombok.Data;
/** /**
* @author 20252 * @author 20252
* @createTime 2024/9/4 下午3:22 * @createTime 2024/9/4 下午3:22
* @desc ManagementPoliceUnitUserPagerQueryParams... * @desc UserPagerQueryParams...
*/ */
@Data @Data
public class ManagementPoliceUnitUserPagerQueryParams { public class UserPagerQueryParams {
@Schema(description = "名字") @Schema(description = "名字")
private String name; private String name;
@Schema(description = "手机号") @Schema(description = "手机号")

View File

@ -1,4 +1,4 @@
package com.changhu.module.management.pojo.vo; package com.changhu.module.policeManagement.pojo.vo;
import com.changhu.common.db.enums.IsEnable; import com.changhu.common.db.enums.IsEnable;
import com.changhu.common.db.enums.IsOrNot; import com.changhu.common.db.enums.IsOrNot;
@ -11,10 +11,10 @@ import java.time.LocalDateTime;
/** /**
* @author 20252 * @author 20252
* @createTime 2024/9/3 上午10:59 * @createTime 2024/9/3 上午10:59
* @desc ManagementSecurityUnitUserPagerVo... * @desc UserPagerVo...
*/ */
@Data @Data
public class ManagementPoliceUnitUserPagerVo { public class UserPagerVo {
@Schema(description = "id") @Schema(description = "id")
private Long snowFlakeId; private Long snowFlakeId;

View File

@ -0,0 +1,36 @@
package com.changhu.module.policeManagement.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.changhu.module.policeManagement.pojo.params.UserSaveOrUpdateParams;
import com.changhu.module.policeManagement.pojo.queryParams.UserPagerQueryParams;
import com.changhu.module.policeManagement.pojo.vo.UserPagerVo;
import com.changhu.support.mybatisplus.pojo.params.PageParams;
/**
* @author 20252
* @createTime 2024/11/22 上午9:30
* @desc UserService...
*/
public interface UserService {
/**
* 新增或保存用户
*
* @param params 参数
*/
void saveOrUpdate(UserSaveOrUpdateParams params);
/**
* 分页查询用户
*
* @param queryParams 查询参数
* @return 结果
*/
Page<UserPagerVo> pager(PageParams<UserPagerQueryParams, UserPagerVo> queryParams);
/**
* 根据id删除用户
*
* @param managementPoliceUnitUserId 公安单位用户id
*/
void deleteById(Long managementPoliceUnitUserId);
}

View File

@ -1,4 +1,4 @@
package com.changhu.module.management.service.impl; package com.changhu.module.policeManagement.service.impl;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.RandomUtil; import cn.hutool.core.util.RandomUtil;
@ -8,13 +8,12 @@ import com.baomidou.mybatisplus.extension.toolkit.Db;
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.common.utils.UserUtil;
import com.changhu.module.management.mapper.EnterprisesUnitMapper; import com.changhu.module.policeManagement.mapper.UserMapper;
import com.changhu.module.management.mapper.ManagementPoliceUnitUserMapper; import com.changhu.module.policeManagement.pojo.params.UserSaveOrUpdateParams;
import com.changhu.module.management.pojo.entity.ManagementPoliceUnitUser; import com.changhu.module.policeManagement.pojo.queryParams.UserPagerQueryParams;
import com.changhu.module.management.pojo.params.ManagementPoliceUserSaveOrUpdateParams; import com.changhu.module.policeManagement.pojo.vo.UserPagerVo;
import com.changhu.module.management.pojo.queryParams.ManagementPoliceUnitUserPagerQueryParams; import com.changhu.module.policeManagement.service.UserService;
import com.changhu.module.management.pojo.vo.ManagementPoliceUnitUserPagerVo; import com.changhu.pojo.entity.ManagementPoliceUnitUser;
import com.changhu.module.management.service.PoliceService;
import com.changhu.support.mybatisplus.pojo.entity.BaseEntity; import com.changhu.support.mybatisplus.pojo.entity.BaseEntity;
import com.changhu.support.mybatisplus.pojo.params.PageParams; import com.changhu.support.mybatisplus.pojo.params.PageParams;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -25,21 +24,18 @@ import java.util.List;
/** /**
* @author 20252 * @author 20252
* @createTime 2024/9/11 上午9:59 * @createTime 2024/11/22 上午9:30
* @desc MPoliceServiceImpl... * @desc UserServiceImpl...
*/ */
@Service @Service("policeManagementUserService")
public class PoliceServiceImpl implements PoliceService { public class UserServiceImpl implements UserService {
@Autowired @Autowired
private ManagementPoliceUnitUserMapper managementPoliceUnitUserMapper; private UserMapper userMapper;
@Autowired
private EnterprisesUnitMapper enterprisesUnitMapper;
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Override @Override
public void userSaveOrUpdate(ManagementPoliceUserSaveOrUpdateParams params) { public void saveOrUpdate(UserSaveOrUpdateParams params) {
//查看手机号是否存在 //查看手机号是否存在
boolean exists = Db.lambdaQuery(ManagementPoliceUnitUser.class) boolean exists = Db.lambdaQuery(ManagementPoliceUnitUser.class)
.ne(params.getSnowFlakeId() != null, BaseEntity::getSnowFlakeId, params.getSnowFlakeId()) .ne(params.getSnowFlakeId() != null, BaseEntity::getSnowFlakeId, params.getSnowFlakeId())
@ -70,12 +66,12 @@ public class PoliceServiceImpl implements PoliceService {
} }
@Override @Override
public Page<ManagementPoliceUnitUserPagerVo> userPager(PageParams<ManagementPoliceUnitUserPagerQueryParams, ManagementPoliceUnitUserPagerVo> queryParams) { public Page<UserPagerVo> pager(PageParams<UserPagerQueryParams, UserPagerVo> queryParams) {
return managementPoliceUnitUserMapper.pager(queryParams.getPage(), queryParams.getParams()); return userMapper.pager(queryParams.getPage(), queryParams.getParams());
} }
@Override @Override
public void userDeleteById(Long managementPoliceUnitUserId) { public void deleteById(Long managementPoliceUnitUserId) {
Long unitId = UserUtil.getUnitId(); Long unitId = UserUtil.getUnitId();
Long l = Db.lambdaQuery(ManagementPoliceUnitUser.class) Long l = Db.lambdaQuery(ManagementPoliceUnitUser.class)
.eq(BaseEntity::getSnowFlakeId, managementPoliceUnitUserId) .eq(BaseEntity::getSnowFlakeId, managementPoliceUnitUserId)
@ -90,5 +86,4 @@ public class PoliceServiceImpl implements PoliceService {
throw new MessageException(); throw new MessageException();
} }
} }
} }

View File

@ -0,0 +1,55 @@
package com.changhu.module.securityManagement.controller;
import cn.hutool.core.lang.Dict;
import cn.hutool.core.lang.func.LambdaUtil;
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.IsEnable;
import com.changhu.common.db.enums.MiniProgramUserIdentity;
import com.changhu.common.db.enums.UserType;
import com.changhu.common.pojo.vo.SelectNodeVo;
import com.changhu.common.utils.UserUtil;
import com.changhu.pojo.entity.MiniProgramUser;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @author 20252
* @createTime 2024/11/22 上午10:16
* @desc SecurityController...
*/
@Tag(name = "保安后台-通用接口")
@JsonBody
@RequestMapping("/m3")
@CheckUserType(userTypes = UserType.MANAGEMENT_SECURITY)
@RestController
public class SecurityController {
@Operation(summary = "查询单位下的项目经理")
@GetMapping("/list_p_m")
public List<SelectNodeVo<Long>> listProjectManager() {
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, MiniProgramUserIdentity.PROJECT_MANAGER)
.eq(MiniProgramUser::getUnitId, UserUtil.getUnitId())
.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

@ -1,14 +1,16 @@
package com.changhu.module.management.controller; package com.changhu.module.securityManagement.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 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.CheckUserType;
import com.changhu.common.annotation.JsonBody; import com.changhu.common.annotation.JsonBody;
import com.changhu.common.db.enums.UserType; import com.changhu.common.db.enums.UserType;
import com.changhu.common.exception.MessageException; import com.changhu.common.exception.MessageException;
import com.changhu.module.management.pojo.params.ServiceProjectSaveOrUpdateParams; import com.changhu.module.securityManagement.pojo.params.ServiceProjectSaveOrUpdateParams;
import com.changhu.module.management.pojo.queryParams.ServiceProjectPagerQueryParams; import com.changhu.module.securityManagement.pojo.queryParams.ServiceProjectPagerQueryParams;
import com.changhu.module.management.pojo.vo.ServiceProjectPagerVo; import com.changhu.module.securityManagement.pojo.vo.ServiceProjectPagerVo;
import com.changhu.module.management.service.ServiceProjectService; import com.changhu.module.securityManagement.service.Service_ProjectService;
import com.changhu.pojo.entity.ServiceProject;
import com.changhu.support.mybatisplus.pojo.params.PageParams; import com.changhu.support.mybatisplus.pojo.params.PageParams;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
@ -17,34 +19,35 @@ import org.springframework.web.bind.annotation.*;
/** /**
* @author 20252 * @author 20252
* @createTime 2024/9/5 上午11:09 * @createTime 2024/11/22 上午10:19
* @desc ServiceProjectController... * @desc ServiceProjectController...
*/ */
@Tag(name = "服务项目") @Tag(name = "保安后台-服务项目管理")
@JsonBody @JsonBody
@RequestMapping("/serviceProject") @RequestMapping("/m3/sp")
@RestController("securityServiceProjectManagement")
@CheckUserType(userTypes = UserType.MANAGEMENT_SECURITY) @CheckUserType(userTypes = UserType.MANAGEMENT_SECURITY)
public class ServiceProjectController { public class ServiceProjectController {
@Autowired @Autowired
private ServiceProjectService serviceProjectService; private Service_ProjectService service_projectService;
@Operation(summary = "分页查询") @Operation(summary = "分页查询")
@PostMapping("/pager") @PostMapping("/pager")
public Page<ServiceProjectPagerVo> pager(@RequestBody PageParams<ServiceProjectPagerQueryParams, ServiceProjectPagerVo> queryParams) { public Page<ServiceProjectPagerVo> pager(@RequestBody PageParams<ServiceProjectPagerQueryParams, ServiceProjectPagerVo> queryParams) {
return serviceProjectService.pager(queryParams); return service_projectService.pager(queryParams);
} }
@Operation(summary = "新增或者保存") @Operation(summary = "新增或者保存")
@PostMapping("/saveOrUpdate") @PostMapping("/add_upd")
public void saveOrUpdate(@RequestBody ServiceProjectSaveOrUpdateParams params) { public void saveOrUpdate(@RequestBody ServiceProjectSaveOrUpdateParams params) {
serviceProjectService.saveOrUpdate(params); service_projectService.saveOrUpdate(params);
} }
@Operation(summary = "根据id删除") @Operation(summary = "根据id删除")
@DeleteMapping("/deleteById") @DeleteMapping("/del_id")
public void deleteById(@RequestParam Long serviceProjectId) { public void deleteById(@RequestParam Long serviceProjectId) {
boolean b = serviceProjectService.removeById(serviceProjectId); boolean b = Db.removeById(serviceProjectId, ServiceProject.class);
if (!b) { if (!b) {
throw new MessageException(); throw new MessageException();
} }

View File

@ -0,0 +1,52 @@
package com.changhu.module.securityManagement.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.securityManagement.pojo.params.UserSaveOrUpdateParams;
import com.changhu.module.securityManagement.pojo.queryParams.UserPagerQueryParams;
import com.changhu.module.securityManagement.pojo.vo.UserPagerVo;
import com.changhu.module.securityManagement.service.UserService;
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.*;
/**
* @author 20252
* @createTime 2024/11/22 上午9:46
* @desc UserController...
*/
@Tag(name = "保安后台-用户管理")
@JsonBody
@RequestMapping("/m3/user")
@RestController("securityUserManagement")
@CheckUserType(userTypes = UserType.MANAGEMENT_SECURITY)
public class UserController {
@Autowired
private UserService userService;
@Operation(summary = "新增或修改后台用户")
@PostMapping("/add_upd")
public void userSaveOrUpdate(@RequestBody @Valid UserSaveOrUpdateParams saveOrUpdateParams) {
userService.saveOrUpdate(saveOrUpdateParams);
}
@Operation(summary = "分页查询后台用户")
@PostMapping("/pager")
public Page<UserPagerVo> userPager(@RequestBody PageParams<UserPagerQueryParams, UserPagerVo> queryParams) {
return userService.pager(queryParams);
}
@Operation(summary = "根据id删除后台用户")
@DeleteMapping("/del_id")
public void userDeleteById(@RequestParam @Schema(description = "后台保安用户id") Long managementSecurityUnitUserId) {
userService.deleteById(managementSecurityUnitUserId);
}
}

View File

@ -0,0 +1,23 @@
package com.changhu.module.securityManagement.mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.changhu.module.securityManagement.pojo.queryParams.ServiceProjectPagerQueryParams;
import com.changhu.module.securityManagement.pojo.vo.ServiceProjectPagerVo;
import org.apache.ibatis.annotations.Mapper;
/**
* @author 20252
* @createTime 2024/11/22 上午10:25
* @desc Service_ProjectMapper...
*/
@Mapper
public interface Service_ProjectMapper {
/**
* 分页查询
*
* @param page 分页参数
* @param params 查询参数
* @return 结果
*/
Page<ServiceProjectPagerVo> pager(Page<ServiceProjectPagerVo> page, ServiceProjectPagerQueryParams params);
}

View File

@ -0,0 +1,27 @@
package com.changhu.module.securityManagement.mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.changhu.module.securityManagement.pojo.queryParams.UserPagerQueryParams;
import com.changhu.module.securityManagement.pojo.vo.UserPagerVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
/**
* @author 20252
* @createTime 2024/11/22 上午9:53
* @desc UserMapper...
*/
@Mapper
@Repository("securityManagementUserMapper")
public interface UserMapper {
/**
* 分页查询
*
* @param page 分页参数
* @param params 查询参数
* @return 结果
*/
Page<UserPagerVo> pager(@Param("page") Page<UserPagerVo> page,
@Param("params") UserPagerQueryParams params);
}

View File

@ -1,4 +1,4 @@
package com.changhu.module.management.pojo.params; package com.changhu.module.securityManagement.pojo.params;
import com.changhu.common.db.enums.IsOrNot; import com.changhu.common.db.enums.IsOrNot;
import com.changhu.common.db.enums.ServiceProjectTwoType; import com.changhu.common.db.enums.ServiceProjectTwoType;

View File

@ -1,4 +1,4 @@
package com.changhu.module.management.pojo.params; package com.changhu.module.securityManagement.pojo.params;
import com.changhu.common.db.enums.IsEnable; import com.changhu.common.db.enums.IsEnable;
import com.changhu.common.db.enums.Sex; import com.changhu.common.db.enums.Sex;
@ -11,10 +11,10 @@ import lombok.Data;
/** /**
* @author 20252 * @author 20252
* @createTime 2024/9/3 上午10:26 * @createTime 2024/9/3 上午10:26
* @desc ManagementSecurityUnitUserSaveOrUpdateParams... * @desc UserSaveOrUpdateParams...
*/ */
@Data @Data
public class ManagementSecurityUnitUserSaveOrUpdateParams { public class UserSaveOrUpdateParams {
@Schema(description = "id") @Schema(description = "id")
private Long snowFlakeId; private Long snowFlakeId;

View File

@ -1,4 +1,4 @@
package com.changhu.module.management.pojo.queryParams; package com.changhu.module.securityManagement.pojo.queryParams;
import com.changhu.common.db.enums.ServiceProjectType; import com.changhu.common.db.enums.ServiceProjectType;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;

View File

@ -1,4 +1,4 @@
package com.changhu.module.management.pojo.queryParams; package com.changhu.module.securityManagement.pojo.queryParams;
import com.changhu.common.db.enums.Sex; import com.changhu.common.db.enums.Sex;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
@ -7,10 +7,10 @@ import lombok.Data;
/** /**
* @author 20252 * @author 20252
* @createTime 2024/9/3 上午11:02 * @createTime 2024/9/3 上午11:02
* @desc ManagementSecurityUnitUserPagerQueryParams... * @desc UserPagerQueryParams...
*/ */
@Data @Data
public class ManagementSecurityUnitUserPagerQueryParams { public class UserPagerQueryParams {
@Schema(description = "名字") @Schema(description = "名字")
private String name; private String name;
@Schema(description = "手机号") @Schema(description = "手机号")

View File

@ -1,4 +1,4 @@
package com.changhu.module.management.pojo.vo; package com.changhu.module.securityManagement.pojo.vo;
import com.changhu.common.db.enums.IsOrNot; import com.changhu.common.db.enums.IsOrNot;
import com.changhu.common.db.enums.ServiceProjectTwoType; import com.changhu.common.db.enums.ServiceProjectTwoType;

View File

@ -1,4 +1,4 @@
package com.changhu.module.management.pojo.vo; package com.changhu.module.securityManagement.pojo.vo;
import com.changhu.common.db.enums.IsEnable; import com.changhu.common.db.enums.IsEnable;
import com.changhu.common.db.enums.IsOrNot; import com.changhu.common.db.enums.IsOrNot;
@ -11,10 +11,10 @@ import java.time.LocalDateTime;
/** /**
* @author 20252 * @author 20252
* @createTime 2024/9/3 上午10:59 * @createTime 2024/9/3 上午10:59
* @desc ManagementSecurityUnitUserPagerVo... * @desc UserPagerVo...
*/ */
@Data @Data
public class ManagementSecurityUnitUserPagerVo { public class UserPagerVo {
@Schema(description = "id") @Schema(description = "id")
private Long snowFlakeId; private Long snowFlakeId;

View File

@ -0,0 +1,29 @@
package com.changhu.module.securityManagement.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.changhu.module.securityManagement.pojo.params.ServiceProjectSaveOrUpdateParams;
import com.changhu.module.securityManagement.pojo.queryParams.ServiceProjectPagerQueryParams;
import com.changhu.module.securityManagement.pojo.vo.ServiceProjectPagerVo;
import com.changhu.support.mybatisplus.pojo.params.PageParams;
/**
* @author 20252
* @createTime 2024/11/22 上午10:21
* @desc Service_ProjectService...
*/
public interface Service_ProjectService {
/**
* 分页查询
*
* @param queryParams 查询参数
* @return 结果
*/
Page<ServiceProjectPagerVo> pager(PageParams<ServiceProjectPagerQueryParams, ServiceProjectPagerVo> queryParams);
/**
* 新增或者保存
*
* @param params 参数
*/
void saveOrUpdate(ServiceProjectSaveOrUpdateParams params);
}

View File

@ -0,0 +1,36 @@
package com.changhu.module.securityManagement.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.changhu.module.securityManagement.pojo.params.UserSaveOrUpdateParams;
import com.changhu.module.securityManagement.pojo.queryParams.UserPagerQueryParams;
import com.changhu.module.securityManagement.pojo.vo.UserPagerVo;
import com.changhu.support.mybatisplus.pojo.params.PageParams;
/**
* @author 20252
* @createTime 2024/11/22 上午9:49
* @desc UserService...
*/
public interface UserService {
/**
* 新增或修改
*
* @param saveOrUpdateParams 参数
*/
void saveOrUpdate(UserSaveOrUpdateParams saveOrUpdateParams);
/**
* 分页查询
*
* @param queryParams 查询参数
* @return 结果
*/
Page<UserPagerVo> pager(PageParams<UserPagerQueryParams, UserPagerVo> queryParams);
/**
* 根据id删除
*
* @param managementSecurityUnitUserId 用户id
*/
void deleteById(Long managementSecurityUnitUserId);
}

View File

@ -0,0 +1,43 @@
package com.changhu.module.securityManagement.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.toolkit.Db;
import com.changhu.common.exception.MessageException;
import com.changhu.common.utils.UserUtil;
import com.changhu.module.securityManagement.mapper.Service_ProjectMapper;
import com.changhu.module.securityManagement.pojo.params.ServiceProjectSaveOrUpdateParams;
import com.changhu.module.securityManagement.pojo.queryParams.ServiceProjectPagerQueryParams;
import com.changhu.module.securityManagement.pojo.vo.ServiceProjectPagerVo;
import com.changhu.module.securityManagement.service.Service_ProjectService;
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;
/**
* @author 20252
* @createTime 2024/11/22 上午10:22
* @desc Service_ProjectServiceImpl...
*/
@Service
public class Service_ProjectServiceImpl implements Service_ProjectService {
@Autowired
private Service_ProjectMapper service_projectMapper;
@Override
public Page<ServiceProjectPagerVo> pager(PageParams<ServiceProjectPagerQueryParams, ServiceProjectPagerVo> queryParams) {
return service_projectMapper.pager(queryParams.getPage(), queryParams.getParams());
}
@Override
public void saveOrUpdate(ServiceProjectSaveOrUpdateParams params) {
ServiceProject serviceProject = BeanUtil.copyProperties(params, ServiceProject.class);
serviceProject.setSecurityUnitId(UserUtil.getUnitId());
boolean b = Db.saveOrUpdate(serviceProject);
if (!b) {
throw new MessageException();
}
}
}

Some files were not shown because too many files have changed in this diff Show More