Commit 87eccd76 authored by 王晓旭's avatar 王晓旭

修改评价

parents a4532be7 faec8751
<template>
<div>
<a-drawer
title="报表管理"
:visible="Visible"
@close="onClose"
:maskClosable="false"
:destroyOnClose="true"
width="850"
>
<div class="search-box flex aic jcb mb20">
<div>
<a-space>
<a-button type="primary" @click="handleAdd"> 新增 </a-button>
<a-button type="danger" @click="handleDelAll"> 批量删除 </a-button>
</a-space>
</div>
<a-input-search
style="width: 300px"
placeholder="请输入报表名称搜索"
enter-button="搜索"
v-model="censusName"
allowClear
@search="onSearch"
/>
</div>
<!-- 表格 -->
<div class="table-content">
<a-table
:row-selection="{
selectedRowKeys: selectedRowKeys,
onChange: onSelectChange,
}"
:loading="loading"
bordered
:scroll="{ y: 460 }"
:columns="columns"
:pagination="{
showTotal: (total) => `共 ${total} 条`,
current: current,
total: total,
pageSize: size,
showSizeChanger: true,
showQuickJumper: true,
pageSizeOptions: pageSizeOptions,
onChange: handleChange,
onShowSizeChange: showSizeChange,
}"
:data-source="tableData"
:rowKey="(record) => record.id"
>
<!-- 序号 -->
<span slot="num" slot-scope="text, record, index">{{
(current - 1) * size + index + 1
}}</span>
<!-- 统计类型 -->
<template slot="censusType" slot-scope="text">
{{ filterDict(text.censusType) }}
</template>
<!-- 是否开放 -->
<template slot="status" slot-scope="text">
<a-tag color="blue" v-if="text.status === 1"></a-tag>
<a-tag color="red" v-else></a-tag>
</template>
<!-- 操作 -->
<template slot="action" slot-scope="text">
<a-space>
<a href="javascript:;" class="edit" @click="handleEdit(text)"
>编辑</a
>
<a href="javascript:;" class="delete" @click="handleDel(text.id)"
>删除</a
>
</a-space>
</template>
</a-table>
</div>
<!-- 新增报表 -->
<AddStatement
:addStatementVisile.sync="addStatementVisile"
:title="title"
:dict="dict"
ref="AddStatement"
@addSuccess="getStatementList"
></AddStatement>
</a-drawer>
</div>
</template>
<script>
import { getStatementList, delStatement } from "@/services/basicsetFun";
import AddStatement from "../modal/AddStatement.vue";
const columns = [
{
title: "序号",
dataIndex: "num",
width: "65px",
scopedSlots: {
customRender: "num",
},
},
{
title: "报表名称",
dataIndex: "censusName",
},
{
title: "统计类型",
scopedSlots: { customRender: "censusType" },
},
{
title: "访问路由",
dataIndex: "censusUrl",
},
{
title: "是否开放",
scopedSlots: { customRender: "status" },
},
{
title: "操作",
width: "100px",
scopedSlots: { customRender: "action" },
},
];
export default {
props: {
StatementVisible: {
type: Boolean,
require: true,
default: false,
},
},
components: {
AddStatement,
},
data() {
return {
columns,
modelInfo: {}, // 模块信息
loading: false,
total: 0,
size: 10,
current: 1,
pageSizeOptions: ["10", "30", "50", "100"],
selectedRowKeys: [],
tableData: [],
addStatementVisile: false,
title: "新增",
censusName: "",
dict: {}, // 字典
};
},
computed: {
Visible: {
get() {
return this.StatementVisible;
},
set(val) {
this.$emit("update:StatementVisible", val);
},
},
},
methods: {
// 获取模块信息
getModelInfo(modelInfo) {
this.modelInfo = modelInfo;
this.getStatementList();
},
// 获取报表列表
async getStatementList() {
this.loading = true;
let res = await getStatementList({
page: this.current,
size: this.size,
modelId: this.modelInfo.id,
censusName: `%${this.censusName}%`,
});
let { code, dict, data } = res.data;
this.dict = dict;
this.loading = false;
if (code == 1) {
if (!data.length && this.current > 1) {
this.current -= 1;
this.getStatementList();
}
this.tableData = data.data;
}
},
handleAdd() {
this.title = "新增报表";
this.addStatementVisile = true;
this.$refs.AddStatement.onAdd(this.modelInfo);
},
handleDelAll() {
if (!this.selectedRowKeys.length) {
this.$message.warning("请先勾选数据");
return;
}
let ids = this.selectedRowKeys.join(",");
this.handleDel(ids);
},
// 关闭抽屉
onClose() {
this.censusName = "";
this.selectedRowKeys = [];
this.Visible = false;
},
// 搜索
onSearch() {
this.current = 1;
this.getStatementList();
},
// 编辑
handleEdit(row) {
this.title = "编辑报表";
this.addStatementVisile = true;
this.$refs.AddStatement.onEdit(row, this.modelInfo);
},
// 翻页
handleChange(cur) {
this.current = cur;
this.getStatementList();
},
// 改变每页显示数量
showSizeChange(current, size) {
this.current = current;
this.size = size;
this.getStatementList();
},
// 删除
handleDel(id) {
let _this = this;
this.$confirm({
title: "系统提示",
content: "删除不可恢复,确定要删除吗?",
okText: "确定",
okType: "danger",
cancelText: "取消",
centered: true,
icon: "exclamation-circle",
maskClosable: true,
async onOk() {
let res = await delStatement({ id });
let { code, msg } = res.data;
if (code === 1) {
_this.$message.success(msg);
_this.getStatementList();
}
},
});
},
// 选中
onSelectChange(keys) {
this.selectedRowKeys = keys;
},
// 过滤列表数据
filterDict(dict) {
let str = "";
Object.keys(this.dict.censusType).forEach((keys) => {
if (dict == keys) {
str = this.dict.censusType[keys];
}
});
return str;
},
},
};
</script>
<style lang="less" scoped>
</style>
\ No newline at end of file
...@@ -77,12 +77,20 @@ ...@@ -77,12 +77,20 @@
</template> </template>
<!-- 操作 --> <!-- 操作 -->
<template slot="action" slot-scope="text"> <template slot="action" slot-scope="text">
<a href="javascript:;" class="edit" @click="handleEdit(text)" <a-space>
>编辑</a <a
> href="javascript:;"
<a href="javascript:;" class="delete" @click="handleDel(text.id)" class="primary"
>删除</a @click="statementManage(text)"
> >配置报表</a
>
<a href="javascript:;" class="edit" @click="handleEdit(text)"
>编辑</a
>
<a href="javascript:;" class="delete" @click="handleDel(text.id)"
>删除</a
>
</a-space>
</template> </template>
</a-table> </a-table>
</div> </div>
...@@ -212,12 +220,18 @@ ...@@ -212,12 +220,18 @@
:previewVisible.sync="previewVisible" :previewVisible.sync="previewVisible"
></PrevieModal> ></PrevieModal>
</a-modal> </a-modal>
<!-- 表别管理 -->
<StatementManage
ref="StatementManage"
:StatementVisible.sync="StatementVisible"
></StatementManage>
</div> </div>
</template> </template>
<script> <script>
import { modelList, addMode, delMode } from "@/services/basicsetFun"; import { modelList, addMode, delMode } from "@/services/basicsetFun";
import PrevieModal from "@/components/PrevieModal.vue"; import PrevieModal from "@/components/PrevieModal.vue";
import StatementManage from "./components/StatementManage.vue";
const columns = [ const columns = [
{ {
title: "序号", title: "序号",
...@@ -262,13 +276,14 @@ const columns = [ ...@@ -262,13 +276,14 @@ const columns = [
}, },
{ {
title: "操作", title: "操作",
width: "120px", width: "180px",
scopedSlots: { customRender: "action" }, scopedSlots: { customRender: "action" },
}, },
]; ];
export default { export default {
components: { components: {
PrevieModal, PrevieModal,
StatementManage,
}, },
data() { data() {
return { return {
...@@ -311,6 +326,8 @@ export default { ...@@ -311,6 +326,8 @@ export default {
{ required: true, message: "模块图标不能为空", trigger: "change" }, { required: true, message: "模块图标不能为空", trigger: "change" },
], ],
}, },
StatementVisible: false,
modelInfo: {},
}; };
}, },
created() { created() {
...@@ -485,6 +502,14 @@ export default { ...@@ -485,6 +502,14 @@ export default {
// return false; // return false;
// } // }
// }, // },
statementManage(row) {
let obj = {
id: row.id,
modelName: row.modelName,
};
this.StatementVisible = true;
this.$refs.StatementManage.getModelInfo(obj);
},
}, },
}; };
</script> </script>
...@@ -508,7 +533,6 @@ export default { ...@@ -508,7 +533,6 @@ export default {
// } // }
.edit { .edit {
color: #03d76f; color: #03d76f;
margin-right: 15px;
} }
.delete { .delete {
color: #f94545; color: #f94545;
......
<template>
<div>
<a-modal
v-model="Visible"
:maskClosable="false"
:title="title"
@cancel="handleClose"
:zIndex="1001"
destroyOnClose
>
<template slot="footer">
<a-button @click="handleReset">重置</a-button>
<a-button type="primary" @click="handleOk">确定</a-button>
</template>
<a-form-model
ref="ruleForm"
:model="formData"
:rules="rules"
:label-col="{ span: 4 }"
:wrapper-col="{ span: 20 }"
>
<a-form-model-item label="所属模块">
<a-input disabled :value="modelInfo.modelName" />
</a-form-model-item>
<a-form-model-item label="报表名称" prop="censusName">
<a-input v-model="formData.censusName" placeholder="请输入报表名称" />
</a-form-model-item>
<a-form-model-item label="报表路由" prop="censusUrl">
<a-input
v-model="formData.censusUrl"
placeholder="请输入报表访问路由"
/>
</a-form-model-item>
<a-form-model-item label="统计类型" prop="censusType">
<a-select v-model="formData.censusType" placeholder="请选择统计类型">
<a-select-option
v-for="(v, key) in dict.censusType"
:key="key"
:value="Number(key)"
>
{{ v }}
</a-select-option>
</a-select>
</a-form-model-item>
<a-form-model-item label="是否开放" prop="status">
<YSwitch v-model="formData.status"></YSwitch>
</a-form-model-item>
</a-form-model>
</a-modal>
</div>
</template>
<script>
import { addStatement } from "@/services/basicsetFun";
import YSwitch from "@/components/yswitch/YSwitch.vue";
export default {
props: {
title: {
require: true,
type: String,
default: "",
},
addStatementVisile: {
type: Boolean,
require: true,
default: false,
},
dict: {
type: Object,
require: true,
default: () => {
return {};
},
},
},
components: {
YSwitch,
},
data() {
return {
modelInfo: {},
formData: {
modelId: "", // 模块id
censusName: "", // 报表名称
censusUrl: "", // 报表访问路由
censusType: undefined, // 统计类型
status: 1, // 状态(0:为开通,1:开通)
},
rules: {
censusName: [
{ required: true, message: "请输入报表名称", trigger: "blur" },
],
censusUrl: [
{ required: true, message: "请输入报表访问路由", trigger: "blur" },
],
censusType: [
{ required: true, message: "请选择统计类型", trigger: "change" },
],
},
};
},
computed: {
Visible: {
get() {
return this.addStatementVisile;
},
set(val) {
this.$emit("update:addStatementVisile", val);
},
},
},
methods: {
// 新增
onAdd(modelInfo) {
Object.assign(this.formData, this.$options.data().formData);
this.formData.id && this.$delete(this.formData, "id");
this.modelInfo = modelInfo;
this.formData.modelId = modelInfo.id;
},
// 编辑
onEdit(data, modelInfo) {
this.modelInfo = modelInfo;
this.formData = { ...data };
},
// 关闭弹窗
handleClose() {
this.$refs.ruleForm.resetFields();
this.Visible = false;
},
// 保存
handleOk() {
this.$refs.ruleForm.validate(async (valid) => {
if (valid) {
let res = await addStatement(this.formData);
let { code, msg } = res.data;
if (code === 1) {
this.$message.success(msg);
this.$emit("addSuccess");
this.handleClose();
}
}
});
},
// 重置
handleReset() {
this.$refs.ruleForm.resetFields();
},
},
};
</script>
<style lang="less" scoped>
</style>
\ No newline at end of file
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
cancel-text="取消" cancel-text="取消"
width="820px" width="820px"
:maskClosable="false" :maskClosable="false"
destroyOnClose
> >
<a-form-model <a-form-model
:model="form" :model="form"
...@@ -53,31 +54,14 @@ ...@@ -53,31 +54,14 @@
{{ v.name }}</a-select-option {{ v.name }}</a-select-option
> >
</a-select> </a-select>
<!-- <a-select
v-model="form.deptId"
@change="handleDeptSelect"
placeholder="请选择部门"
>
<a-select-option
v-for="v in diptData"
:key="v.id"
:value="v.id"
>{{ v.name }}</a-select-option
>
</a-select> -->
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
<a-col :span="12"> <a-col :span="12">
<a-form-model-item label="星级" prop="starlevel"> <a-form-model-item label="经办人Id" prop="operatorId">
<a-select v-model="form.starlevel" placeholder="请选择星级"> <a-input v-model="form.operatorId" placeholder="请输入经办人Id" />
<a-select-option :value="5">5星</a-select-option>
<a-select-option :value="4">4星</a-select-option>
<a-select-option :value="3">3星</a-select-option>
<a-select-option :value="2">2星</a-select-option>
<a-select-option :value="1">1星</a-select-option>
</a-select>
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
<!-- <a-col :span="12"> <!-- <a-col :span="12">
<a-form-model-item label="所属窗口" prop="windowId"> <a-form-model-item label="所属窗口" prop="windowId">
<a-select <a-select
...@@ -96,18 +80,33 @@ ...@@ -96,18 +80,33 @@
</a-col> --> </a-col> -->
</a-row> </a-row>
<a-row> <a-row>
<a-col :span="12">
<a-form-model-item label="星级" prop="starlevel">
<a-select
allowClear
v-model="form.starlevel"
placeholder="请选择星级"
>
<a-select-option :value="5">5星</a-select-option>
<a-select-option :value="4">4星</a-select-option>
<a-select-option :value="3">3星</a-select-option>
<a-select-option :value="2">2星</a-select-option>
<a-select-option :value="1">1星</a-select-option>
</a-select>
</a-form-model-item>
</a-col>
<a-col :span="12"> <a-col :span="12">
<a-form-model-item label="职务" prop="userpost"> <a-form-model-item label="职务" prop="userpost">
<a-input v-model="form.userpost" placeholder="请输入职务" /> <a-input v-model="form.userpost" placeholder="请输入职务" />
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
</a-row>
<a-row>
<a-col :span="12"> <a-col :span="12">
<a-form-model-item label="职称" prop="posttitle"> <a-form-model-item label="职称" prop="posttitle">
<a-input v-model="form.posttitle" placeholder="请输入职称" /> <a-input v-model="form.posttitle" placeholder="请输入职称" />
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
</a-row>
<a-row>
<a-col :span="12"> <a-col :span="12">
<a-form-model-item label="政治面貌" prop="politicalstatus"> <a-form-model-item label="政治面貌" prop="politicalstatus">
<a-select <a-select
...@@ -140,9 +139,14 @@ ...@@ -140,9 +139,14 @@
</a-select> </a-select>
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
<a-col :span="12">
<a-form-model-item label="电话" prop="phone">
<a-input v-model="form.phone" placeholder="请输入电话" />
</a-form-model-item>
</a-col>
</a-row> </a-row>
<a-row v-if="form.dangyuan === 99"> <a-row v-if="form.dangyuan === 99">
<a-col :span="12"> </a-col> <!-- <a-col :span="12"> </a-col> -->
<a-col :span="12"> <a-col :span="12">
<a-form-model-item label="其他称号" prop="dangyuanext"> <a-form-model-item label="其他称号" prop="dangyuanext">
<a-input v-model="form.dangyuanext" placeholder="请输入称号" /> <a-input v-model="form.dangyuanext" placeholder="请输入称号" />
...@@ -150,18 +154,11 @@ ...@@ -150,18 +154,11 @@
</a-col> </a-col>
</a-row> </a-row>
<a-row> <a-row>
<a-col :span="12">
<a-form-model-item label="电话" prop="phone">
<a-input v-model="form.phone" placeholder="请输入电话" />
</a-form-model-item>
</a-col>
<a-col :span="12"> <a-col :span="12">
<a-form-model-item label="手机" prop="mobile"> <a-form-model-item label="手机" prop="mobile">
<a-input v-model="form.mobile" placeholder="请输入手机" /> <a-input v-model="form.mobile" placeholder="请输入手机" />
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
</a-row>
<a-row>
<a-col :span="12"> <a-col :span="12">
<a-form-model-item label="身份证" prop="idCard"> <a-form-model-item label="身份证" prop="idCard">
<a-input v-model="form.idCard" placeholder="请输入身份证号码" /> <a-input v-model="form.idCard" placeholder="请输入身份证号码" />
...@@ -428,6 +425,7 @@ export default { ...@@ -428,6 +425,7 @@ export default {
duty: "", // 岗位职责 duty: "", // 岗位职责
promise: "", // 服务承诺 promise: "", // 服务承诺
business: "", // 办理事项 business: "", // 办理事项
operatorId: "", // 经办人id
// modelIds: [], // 模块 // modelIds: [], // 模块
}, },
rules: { rules: {
...@@ -529,7 +527,7 @@ export default { ...@@ -529,7 +527,7 @@ export default {
}, },
// 关闭对话框 // 关闭对话框
handleClose() { handleClose() {
this.$refs.formData.resetFields(); // this.$refs.formData.resetFields();
this.loading = false; this.loading = false;
this.Visible = false; this.Visible = false;
}, },
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
cancel-text="重置" cancel-text="重置"
width="820px" width="820px"
:maskClosable="false" :maskClosable="false"
destroyOnClose
> >
<a-form-model <a-form-model
:model="form" :model="form"
...@@ -53,37 +54,14 @@ ...@@ -53,37 +54,14 @@
{{ v.name }}</a-select-option {{ v.name }}</a-select-option
> >
</a-select> </a-select>
<!-- <a-select
v-model="form.deptId"
@change="handleDeptSelect"
allowClear
placeholder="请选择部门"
>
<a-select-option
v-for="v in diptData"
:key="v.id"
:value="v.id"
>{{ v.name }}</a-select-option
>
</a-select> -->
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
<a-col :span="12"> <a-col :span="12">
<a-form-model-item label="星级" prop="starlevel"> <a-form-model-item label="经办人Id" prop="operatorId">
<a-select <a-input v-model="form.operatorId" placeholder="请输入经办人Id" />
allowClear
v-model="form.starlevel"
placeholder="请选择星级"
>
<a-select-option :value="5">5星</a-select-option>
<a-select-option :value="4">4星</a-select-option>
<a-select-option :value="3">3星</a-select-option>
<a-select-option :value="2">2星</a-select-option>
<a-select-option :value="1">1星</a-select-option>
</a-select>
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
<!-- <a-col :span="12"> <!-- <a-col :span="12">
<a-form-model-item label="所属窗口" prop="windowId"> <a-form-model-item label="所属窗口" prop="windowId">
<a-select <a-select
...@@ -102,18 +80,33 @@ ...@@ -102,18 +80,33 @@
</a-col> --> </a-col> -->
</a-row> </a-row>
<a-row> <a-row>
<a-col :span="12">
<a-form-model-item label="星级" prop="starlevel">
<a-select
allowClear
v-model="form.starlevel"
placeholder="请选择星级"
>
<a-select-option :value="5">5星</a-select-option>
<a-select-option :value="4">4星</a-select-option>
<a-select-option :value="3">3星</a-select-option>
<a-select-option :value="2">2星</a-select-option>
<a-select-option :value="1">1星</a-select-option>
</a-select>
</a-form-model-item>
</a-col>
<a-col :span="12"> <a-col :span="12">
<a-form-model-item label="职务" prop="userpost"> <a-form-model-item label="职务" prop="userpost">
<a-input v-model="form.userpost" placeholder="请输入职务" /> <a-input v-model="form.userpost" placeholder="请输入职务" />
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
</a-row>
<a-row>
<a-col :span="12"> <a-col :span="12">
<a-form-model-item label="职称" prop="posttitle"> <a-form-model-item label="职称" prop="posttitle">
<a-input v-model="form.posttitle" placeholder="请输入职称" /> <a-input v-model="form.posttitle" placeholder="请输入职称" />
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
</a-row>
<a-row>
<a-col :span="12"> <a-col :span="12">
<a-form-model-item label="政治面貌" prop="politicalstatus"> <a-form-model-item label="政治面貌" prop="politicalstatus">
<a-select <a-select
...@@ -146,9 +139,14 @@ ...@@ -146,9 +139,14 @@
</a-select> </a-select>
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
<a-col :span="12">
<a-form-model-item label="电话" prop="phone">
<a-input v-model="form.phone" placeholder="请输入电话" />
</a-form-model-item>
</a-col>
</a-row> </a-row>
<a-row v-if="form.dangyuan === 99"> <a-row v-if="form.dangyuan === 99">
<a-col :span="12"> </a-col> <!-- <a-col :span="12"> </a-col> -->
<a-col :span="12"> <a-col :span="12">
<a-form-model-item label="其他称号" prop="dangyuanext"> <a-form-model-item label="其他称号" prop="dangyuanext">
<a-input v-model="form.dangyuanext" placeholder="请输入称号" /> <a-input v-model="form.dangyuanext" placeholder="请输入称号" />
...@@ -156,18 +154,11 @@ ...@@ -156,18 +154,11 @@
</a-col> </a-col>
</a-row> </a-row>
<a-row> <a-row>
<a-col :span="12">
<a-form-model-item label="电话" prop="phone">
<a-input v-model="form.phone" placeholder="请输入电话" />
</a-form-model-item>
</a-col>
<a-col :span="12"> <a-col :span="12">
<a-form-model-item label="手机" prop="mobile"> <a-form-model-item label="手机" prop="mobile">
<a-input v-model="form.mobile" placeholder="请输入手机" /> <a-input v-model="form.mobile" placeholder="请输入手机" />
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
</a-row>
<a-row>
<a-col :span="12"> <a-col :span="12">
<a-form-model-item label="身份证" prop="idCard"> <a-form-model-item label="身份证" prop="idCard">
<a-input v-model="form.idCard" placeholder="请输入身份证号码" /> <a-input v-model="form.idCard" placeholder="请输入身份证号码" />
...@@ -470,6 +461,7 @@ export default { ...@@ -470,6 +461,7 @@ export default {
duty: "", // 岗位职责 duty: "", // 岗位职责
promise: "", // 服务承诺 promise: "", // 服务承诺
business: "", // 办理事项 business: "", // 办理事项
operatorId: "", // 经办人id
// modelIds: [], // 模块 // modelIds: [], // 模块
}, },
rules: { rules: {
...@@ -582,7 +574,7 @@ export default { ...@@ -582,7 +574,7 @@ export default {
}, },
// 关闭对话框 // 关闭对话框
handleClose() { handleClose() {
this.$refs.formData.resetFields(); // this.$refs.formData.resetFields();
this.loading = false; this.loading = false;
this.Visible = false; this.Visible = false;
}, },
......
...@@ -199,7 +199,7 @@ ...@@ -199,7 +199,7 @@
onChange: handlePagination, onChange: handlePagination,
onShowSizeChange: showSizeChange, onShowSizeChange: showSizeChange,
}" }"
:scroll="{ y: 450 }" :scroll="{ y: 530 }"
:loading="loading" :loading="loading"
:columns="columns" :columns="columns"
:data-source="WorkmanData" :data-source="WorkmanData"
......
...@@ -17,6 +17,9 @@ module.exports = { ...@@ -17,6 +17,9 @@ module.exports = {
info: `${BASE_URL}/base/model/info`, info: `${BASE_URL}/base/model/info`,
save: `${BASE_URL}/base/model/save`, save: `${BASE_URL}/base/model/save`,
delete: `${BASE_URL}/base/model/delete`, delete: `${BASE_URL}/base/model/delete`,
saveStatement: `${BASE_URL}/base/model/census/save`,
statementList: `${BASE_URL}/base/model/census/list`,
delStatement: `${BASE_URL}/base/model/census/delete`,
}, },
// 区域 // 区域
area: { area: {
......
...@@ -59,3 +59,15 @@ export async function addMode(data) { ...@@ -59,3 +59,15 @@ export async function addMode(data) {
export async function delMode(data) { export async function delMode(data) {
return request(model.delete, METHOD.GET, data); return request(model.delete, METHOD.GET, data);
} }
// 保存模块报表
export async function addStatement(data) {
return request(model.saveStatement, METHOD.POST, data);
}
// 模块报表列表
export async function getStatementList(data) {
return request(model.statementList, METHOD.POST, data);
}
// 删除报表
export async function delStatement(data) {
return request(model.delStatement, METHOD.GET, data);
}
...@@ -6,3 +6,6 @@ ALTER TABLE mortals_sys_window ADD COLUMN `duty` tinyint (1) default 0 COMMEN ...@@ -6,3 +6,6 @@ ALTER TABLE mortals_sys_window ADD COLUMN `duty` tinyint (1) default 0 COMMEN
ALTER TABLE mortals_sys_window ADD COLUMN `dutyContent` varchar (256) default "" COMMENT '显示内容' AFTER duty; ALTER TABLE mortals_sys_window ADD COLUMN `dutyContent` varchar (256) default "" COMMENT '显示内容' AFTER duty;
ALTER TABLE mortals_sys_window ADD COLUMN `dutyEnglish` varchar (256) default "" COMMENT '显示英文' AFTER dutyContent; ALTER TABLE mortals_sys_window ADD COLUMN `dutyEnglish` varchar (256) default "" COMMENT '显示英文' AFTER dutyContent;
ALTER TABLE mortals_sys_dept ADD COLUMN `total` int(9) DEFAULT '0' COMMENT '关联事项数量' AFTER updateTime;
INSERT INTO `mortals_xhx_task` VALUES (null, '统计站点部门事项数', 'StatSiteDeptMatterTask', 0, 'StatSiteDeptMatterTask', NULL, NULL, 1, 0, '23:21', NULL, '172.17.0.1', '2023-03-05 23:21:01', 0, NULL, NULL, NULL);
...@@ -212,6 +212,7 @@ CREATE TABLE mortals_sys_dept ...@@ -212,6 +212,7 @@ CREATE TABLE mortals_sys_dept
`createTime` datetime COMMENT '创建时间', `createTime` datetime COMMENT '创建时间',
`createUserId` bigint(20) COMMENT '创建用户', `createUserId` bigint(20) COMMENT '创建用户',
`updateTime` datetime COMMENT '修改时间', `updateTime` datetime COMMENT '修改时间',
`total` int(9) DEFAULT '0' COMMENT '关联事项数量',
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='部门'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='部门';
...@@ -289,39 +290,39 @@ CREATE TABLE mortals_sys_window_matter ...@@ -289,39 +290,39 @@ CREATE TABLE mortals_sys_window_matter
-- ---------------------------- -- ----------------------------
DROP TABLE IF EXISTS `mortals_sys_workman`; DROP TABLE IF EXISTS `mortals_sys_workman`;
CREATE TABLE mortals_sys_workman( CREATE TABLE mortals_sys_workman(
`id` bigint(20) AUTO_INCREMENT COMMENT '序号,主键,自增长', `id` bigint(20) AUTO_INCREMENT COMMENT '序号,主键,自增长',
`loginName` varchar(64) COMMENT '登录用户名', `loginName` varchar(64) COMMENT '登录用户名',
`loginPwd` varchar(255) COMMENT '密码', `loginPwd` varchar(255) COMMENT '密码',
`deptId` bigint(20) COMMENT '部门id号', `deptId` bigint(20) COMMENT '部门id号',
`deptName` varchar(64) COMMENT '部门名称', `deptName` varchar(64) COMMENT '部门名称',
`windowId` bigint(20) COMMENT '窗口id号', `windowId` bigint(20) COMMENT '窗口id号',
`windowName` varchar(64) COMMENT '窗口名称', `windowName` varchar(64) COMMENT '窗口名称',
`siteId` bigint(20) COMMENT '站点ID', `siteId` bigint(20) COMMENT '站点ID',
`siteName` varchar(255) COMMENT '站点名称', `siteName` varchar(255) COMMENT '站点名称',
`name` varchar(64) COMMENT '姓名', `name` varchar(64) COMMENT '姓名',
`number` varchar(64) COMMENT '工号', `number` varchar(64) COMMENT '工号',
`userpost` varchar(64) COMMENT '职务', `userpost` varchar(64) COMMENT '职务',
`posttitle` varchar(64) COMMENT '职称', `posttitle` varchar(64) COMMENT '职称',
`politicalstatus` tinyint(2) DEFAULT '0' COMMENT '政治面貌 (0.中共党员,1.中共预备党员,2.共青团员,3.普通居民,4.其它)', `politicalstatus` tinyint(2) DEFAULT '0' COMMENT '政治面貌 (0.中共党员,1.中共预备党员,2.共青团员,3.普通居民,4.其它)',
`dangyuan` tinyint(2) DEFAULT '0' COMMENT '党员 (0.非党员,1.党员,2.党员示范岗,3.党员先锋岗)', `dangyuan` tinyint(2) DEFAULT '0' COMMENT '党员 (0.非党员,1.党员,2.党员示范岗,3.党员先锋岗)',
`dangyuanext` varchar(64) COMMENT '党员扩展', `dangyuanext` varchar(64) COMMENT '党员扩展',
`idCard` varchar(32) COMMENT '身份证', `idCard` varchar(32) COMMENT '身份证',
`phone` varchar(64) COMMENT '电话', `phone` varchar(64) COMMENT '电话',
`mobile` varchar(64) COMMENT '手机', `mobile` varchar(64) COMMENT '手机',
`starlevel` tinyint(2) DEFAULT '0' COMMENT '星级', `starlevel` tinyint(2) DEFAULT '0' COMMENT '星级',
`summary` varchar(255) COMMENT '个人简介', `summary` varchar(255) COMMENT '个人简介',
`photoPath` varchar(255) COMMENT '照片', `photoPath` varchar(255) COMMENT '照片',
`duty` mediumtext COMMENT '岗位职责', `duty` mediumtext COMMENT '岗位职责',
`promise` mediumtext COMMENT '服务承诺', `promise` mediumtext COMMENT '服务承诺',
`business` mediumtext COMMENT '办理事项', `business` mediumtext COMMENT '办理事项',
`online` tinyint(2) DEFAULT '1' COMMENT '是否在线(0.离线,1.在线,2.暂离,3.点击暂离,4.回归,5.登陆)', `online` tinyint(2) DEFAULT '1' COMMENT '是否在线(0.离线,1.在线,2.暂离,3.点击暂离,4.回归,5.登陆)',
`modelIds` varchar(256) COMMENT '配置站点模块,逗号分隔', `modelIds` varchar(256) COMMENT '配置站点模块,逗号分隔',
`createTime` datetime COMMENT '创建时间', `createTime` datetime COMMENT '创建时间',
`createUserId` bigint(20) COMMENT '创建用户', `createUserId` bigint(20) COMMENT '创建用户',
`updateTime` datetime COMMENT '修改时间', `updateTime` datetime COMMENT '修改时间',
`lastLoginTime` datetime COMMENT '最后一次登录时间', `lastLoginTime` datetime COMMENT '最后一次登录时间',
`lastLoginAddress` varchar(21) COMMENT '最后一次登录地址', `lastLoginAddress` varchar(21) COMMENT '最后一次登录地址',
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='工作人员'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='工作人员';
......
This diff is collapsed.
...@@ -214,11 +214,11 @@ ...@@ -214,11 +214,11 @@
</dependency> </dependency>
<!-- 虹软人脸解析 --> <!-- 虹软人脸解析 -->
<!-- <dependency> <dependency>
<groupId>com.arcsoft.face</groupId> <groupId>com.arcsoft.face</groupId>
<artifactId>arcsoft-sdk-face</artifactId> <artifactId>arcsoft-sdk-face</artifactId>
<version>3.0.0.0</version> <version>3.0.0.0</version>
</dependency>--> </dependency>
<dependency> <dependency>
<groupId>net.coobird</groupId> <groupId>net.coobird</groupId>
<artifactId>thumbnailator</artifactId> <artifactId>thumbnailator</artifactId>
......
...@@ -41,8 +41,9 @@ public class OperlogAspect extends FileLogServiceImpl implements ILogService { ...@@ -41,8 +41,9 @@ public class OperlogAspect extends FileLogServiceImpl implements ILogService {
public void doHandlerLog(String platformMark, Long userId, String userName, String loginName, String requestUrl, public void doHandlerLog(String platformMark, Long userId, String userName, String loginName, String requestUrl,
String content, String ip, Date logDate) { String content, String ip, Date logDate) {
super.doHandlerLog(platformMark, userId, userName, loginName, requestUrl, content, ip, logDate); super.doHandlerLog(platformMark, userId, userName, loginName, requestUrl, content, ip, logDate);
//操作日志 只记录用户侧
if(userId==null) return;
operLogService.insertOperLog(ip, requestUrl, userId, userName, loginName, content); operLogService.insertOperLog(ip, requestUrl, userId, userName, loginName, content);
OperateLogPdu operateLogPdu = new OperateLogPdu(); OperateLogPdu operateLogPdu = new OperateLogPdu();
operateLogPdu.initAttrValue(); operateLogPdu.initAttrValue();
operateLogPdu.setIp(ip); operateLogPdu.setIp(ip);
......
package com.mortals.xhx.busiz.req;
import lombok.Data;
/**
* 微中台请求接口
* @author:
* @date: 2023/3/2 18:08
*/
@Data
public class MidReq{
private String method;
private String body;
private String path;
}
package com.mortals.xhx.busiz.rsp;
import lombok.Data;
/**
* @author karlhoo
*/
@Data
public class MidResp {
private String appId;
private String appKey;
private String timeStamp;
private String nonce;
private String secretKey;
private String sign;
}
package com.mortals.xhx.busiz.rsp;
import lombok.Data;
/**
* @author karlhoo
*/
@Data
public class SignResp {
private String appId;
private String appKey;
private String timeStamp;
private String nonce;
private String secretKey;
private String sign;
}
package com.mortals.xhx.busiz.web;
import cn.hutool.core.codec.Base64;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.RandomUtil;
import cn.hutool.core.util.URLUtil;
import cn.hutool.crypto.digest.DigestAlgorithm;
import cn.hutool.crypto.digest.Digester;
import cn.hutool.http.HttpUtil;
import cn.hutool.http.Method;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.common.Rest;
import com.mortals.xhx.busiz.req.MidReq;
import com.mortals.xhx.busiz.rsp.SignResp;
import com.mortals.xhx.common.utils.EncryptionUtils;
import com.mortals.xhx.module.dept.model.DeptEntity;
import com.mortals.xhx.module.dept.model.DeptQuery;
import com.mortals.xhx.module.dept.service.DeptService;
import com.mortals.xhx.module.matter.model.MatterEntity;
import com.mortals.xhx.module.matter.model.MatterQuery;
import com.mortals.xhx.module.matter.service.MatterService;
import com.mortals.xhx.module.site.model.SiteMatterEntity;
import com.mortals.xhx.module.site.model.SiteMatterQuery;
import com.mortals.xhx.module.site.service.SiteMatterService;
import com.mortals.xhx.module.window.model.WindowEntity;
import com.mortals.xhx.module.window.model.WindowMatterEntity;
import com.mortals.xhx.module.window.model.WindowMatterQuery;
import com.mortals.xhx.module.window.model.WindowQuery;
import com.mortals.xhx.module.window.service.WindowMatterService;
import com.mortals.xhx.module.window.service.WindowService;
import lombok.extern.slf4j.Slf4j;
import org.apache.http.HttpResponse;
import org.apache.http.client.CookieStore;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.BasicCookieStore;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.util.EntityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpMethod;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.*;
import java.util.stream.Collectors;
/**
* 微中台签名接口
*
* @author:
* @date: 2023/3/2 18:07
*/
@RestController
@RequestMapping("mid")
@Slf4j
public class MidSignApiController {
@Value("${mid.midUrl:http://172.15.28.117:9000}")
private String midUrl;
@Value("${mid.appId:01C67D56D0630517}")
private String appId;
@Value("${mid.appKey:a0b946c858aa8d06}")
private String appKey;
@Value("${mid.secretKey:ad80c59e575a78ab}")
private String secretKey;
@PostMapping(value = "sign")
@UnAuth
public Rest<SignResp> midSign(@RequestBody MidReq midReq) {
SignResp signResp = new SignResp();
try {
Map<String, String> headerMap = new HashMap<>();
if("post".equalsIgnoreCase(midReq.getMethod())){
headerMap.put("appId", appId);
headerMap.put("appKey", appKey);
JSONObject object1 = JSONObject.parseObject(midReq.getBody());
headerMap.put("body", object1.toJSONString());
String timeStamp = System.currentTimeMillis() + "";
headerMap.put("timeStamp", timeStamp);
String nonce = RandomUtil.randomNumbers(6);
headerMap.put("nonce", nonce);
headerMap.put("secretKey", secretKey);
signResp.setAppId(appId);
signResp.setAppKey(appKey);
signResp.setTimeStamp(timeStamp);
signResp.setNonce(nonce);
signResp.setSecretKey(secretKey);
}else if("get".equalsIgnoreCase(midReq.getMethod())){
HashMap<String, String> paramsMap = JSON.parseObject(midReq.getBody(), HashMap.class);
if (!paramsMap.isEmpty()) {
for (Map.Entry<String, String> entry : paramsMap.entrySet()) {
headerMap.put(entry.getKey(), entry.getValue());
}
}
}
StringBuilder signSb = new StringBuilder();
signSb.append("appId").append("=").append(headerMap.get("appId")).append("&");
signSb.append("appKey").append("=").append(headerMap.get("appKey")).append("&");
signSb.append("body").append("=").append(headerMap.get("body")).append("&");
signSb.append("nonce").append("=").append(headerMap.get("nonce")).append("&");
signSb.append("secretKey").append("=").append(headerMap.get("secretKey")).append("&");
signSb.append("timeStamp").append("=").append(headerMap.get("timeStamp")).append("&");
/* for (Map.Entry<String, String> params : headerMap.entrySet()) {
signSb.append(params.getKey()).append("=").append(params.getValue() + "").append("&");
}*/
String signStr = signSb.substring(0, signSb.length() - 1);
log.info("签名源字符串: " + signStr);
String sign = EncryptionUtils.SHA256(signStr);
log.info("签名计算结果: " + sign);
signResp.setSign(sign);
return Rest.ok(signResp);
} catch (Exception e) {
log.error("签名异常",e);
return Rest.fail("签名异常!");
}
}
/**
* 透传请求
* @param midReq
* @return
*/
@PostMapping(value = "trans")
@UnAuth
public Rest<String> trans(@RequestBody MidReq midReq) {
try {
Map<String, String> headerMap = new HashMap<>();
StringBuilder signSb = new StringBuilder();
headerMap.put("appId", appId);
headerMap.put("appKey", appKey);
String timeStamp = System.currentTimeMillis() + "";
headerMap.put("timeStamp", timeStamp);
String nonce = RandomUtil.randomNumbers(6);
headerMap.put("nonce", nonce);
headerMap.put("secretKey", secretKey);
if("post".equalsIgnoreCase(midReq.getMethod())){
JSONObject object1 = JSONObject.parseObject(midReq.getBody());
headerMap.put("body", object1.toJSONString());
}else if("get".equalsIgnoreCase(midReq.getMethod())){
/* HashMap<String, String> paramsMap = JSON.parseObject(midReq.getBody(), HashMap.class);
if (!paramsMap.isEmpty()) {
for (Map.Entry<String, String> entry : paramsMap.entrySet()) {
headerMap.put(entry.getKey(), entry.getValue());
}
}*/
}
signSb.append("appId").append("=").append(headerMap.get("appId")).append("&");
signSb.append("appKey").append("=").append(headerMap.get("appKey")).append("&");
signSb.append("body").append("=").append(headerMap.get("body")).append("&");
signSb.append("nonce").append("=").append(headerMap.get("nonce")).append("&");
signSb.append("secretKey").append("=").append(headerMap.get("secretKey")).append("&");
signSb.append("timeStamp").append("=").append(headerMap.get("timeStamp")).append("&");
String signStr = signSb.substring(0, signSb.length() - 1);
log.info("签名源字符串: " + signStr);
String sign = EncryptionUtils.SHA256(signStr);
log.info("签名计算结果: " + sign);
headerMap.put("sign", sign);
//请求转发
String fullUrl = URLUtil.completeUrl(midUrl, midReq.getPath());
String body = HttpUtil.createRequest(Method.POST, fullUrl).headerMap(headerMap, true).body(headerMap.get("body")).execute().body();
return Rest.ok(body);
} catch (Exception e) {
log.error("透传请求异常",e);
return Rest.fail("透传请求异常!");
}
}
}
package com.mortals.xhx.common.utils;
import lombok.extern.slf4j.Slf4j;
import java.security.MessageDigest;
@Slf4j
public class EncryptionUtils {
private enum DigestType{
MD5("MD5"),
SHA("SHA"),
SHA256("SHA-256");
private String name;
private DigestType(String name){
this.name = name;
}
public String getName() {
return name;
}
}
private final static String digest(String sourceStr,DigestType type) {
char hexDigits[]={'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
try {
byte[] btInput = sourceStr.getBytes();
// 获得摘要算法的 MessageDigest 对象
MessageDigest mdInst = MessageDigest.getInstance(type.name);
// 使用指定的字节更新摘要
mdInst.update(btInput);
// 获得密文
byte[] md = mdInst.digest();
// 把密文转换成十六进制的字符串形式
int length = md.length;
char str[] = new char[length * 2];
int k = 0;
for (int i = 0; i < length; i++) {
byte byte0 = md[i];
str[k++] = hexDigits[byte0 >>> 4 & 0xf];
str[k++] = hexDigits[byte0 & 0xf];
}
return new String(str);
} catch (Exception e) {
log.error("签名失败", e);
return "";
}
}
public final static String MD5(String s) {
return digest(s, DigestType.MD5);
}
public final static String SHA(String s) {
return digest(s, DigestType.SHA);
}
public final static String SHA256(String s){
return digest(s, DigestType.SHA256);
}
}
//package com.mortals.xhx.common.utils; package com.mortals.xhx.common.utils;
//
//import com.arcsoft.face.*; import com.arcsoft.face.*;
//import com.arcsoft.face.enums.DetectMode; import com.arcsoft.face.enums.DetectMode;
//import com.arcsoft.face.enums.DetectOrient; import com.arcsoft.face.enums.DetectOrient;
//import com.arcsoft.face.enums.ErrorInfo; import com.arcsoft.face.enums.ErrorInfo;
//import com.arcsoft.face.toolkit.ImageInfo; import com.arcsoft.face.toolkit.ImageInfo;
//import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
//import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
//import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
//
//import java.util.ArrayList; import java.util.ArrayList;
//import java.util.List; import java.util.List;
//
//import static com.arcsoft.face.toolkit.ImageFactory.getRGBData; import static com.arcsoft.face.toolkit.ImageFactory.getRGBData;
//
//@Slf4j @Slf4j
//@Component @Component
//public class FaceUtil { public class FaceUtil {
//
// public FaceEngine initFace(String appId, String sdkKey) { public FaceEngine initFace(String appId, String sdkKey) {
// FaceEngine faceEngine = new FaceEngine(getClass().getResource(getOsName()).getPath()); FaceEngine faceEngine = new FaceEngine(getClass().getResource(getOsName()).getPath());
// //激活引擎 //激活引擎
// int errorCode = faceEngine.activeOnline(appId, sdkKey); int errorCode = faceEngine.activeOnline(appId, sdkKey);
// isTrue(!(errorCode != ErrorInfo.MOK.getValue() && errorCode != ErrorInfo.MERR_ASF_ALREADY_ACTIVATED.getValue()), "引擎激活失败"); isTrue(!(errorCode != ErrorInfo.MOK.getValue() && errorCode != ErrorInfo.MERR_ASF_ALREADY_ACTIVATED.getValue()), "引擎激活失败");
// ActiveFileInfo activeFileInfo = new ActiveFileInfo(); ActiveFileInfo activeFileInfo = new ActiveFileInfo();
// errorCode = faceEngine.getActiveFileInfo(activeFileInfo); errorCode = faceEngine.getActiveFileInfo(activeFileInfo);
// isTrue(!(errorCode != ErrorInfo.MOK.getValue() && errorCode != ErrorInfo.MERR_ASF_ALREADY_ACTIVATED.getValue()), "获取激活文件信息失败"); isTrue(!(errorCode != ErrorInfo.MOK.getValue() && errorCode != ErrorInfo.MERR_ASF_ALREADY_ACTIVATED.getValue()), "获取激活文件信息失败");
// //引擎配置 //引擎配置
// EngineConfiguration engineConfiguration = new EngineConfiguration(); EngineConfiguration engineConfiguration = new EngineConfiguration();
// engineConfiguration.setDetectMode(DetectMode.ASF_DETECT_MODE_IMAGE); engineConfiguration.setDetectMode(DetectMode.ASF_DETECT_MODE_IMAGE);
// engineConfiguration.setDetectFaceOrientPriority(DetectOrient.ASF_OP_ALL_OUT); engineConfiguration.setDetectFaceOrientPriority(DetectOrient.ASF_OP_ALL_OUT);
// engineConfiguration.setDetectFaceMaxNum(10); engineConfiguration.setDetectFaceMaxNum(10);
// engineConfiguration.setDetectFaceScaleVal(16); engineConfiguration.setDetectFaceScaleVal(16);
// //功能配置 //功能配置
// FunctionConfiguration functionConfiguration = new FunctionConfiguration(); FunctionConfiguration functionConfiguration = new FunctionConfiguration();
// functionConfiguration.setSupportAge(true); functionConfiguration.setSupportAge(true);
// functionConfiguration.setSupportFace3dAngle(true); functionConfiguration.setSupportFace3dAngle(true);
// functionConfiguration.setSupportFaceDetect(true); functionConfiguration.setSupportFaceDetect(true);
// functionConfiguration.setSupportFaceRecognition(true); functionConfiguration.setSupportFaceRecognition(true);
// functionConfiguration.setSupportGender(true); functionConfiguration.setSupportGender(true);
// functionConfiguration.setSupportLiveness(true); functionConfiguration.setSupportLiveness(true);
// functionConfiguration.setSupportIRLiveness(true); functionConfiguration.setSupportIRLiveness(true);
// engineConfiguration.setFunctionConfiguration(functionConfiguration); engineConfiguration.setFunctionConfiguration(functionConfiguration);
// //初始化引擎 //初始化引擎
// errorCode = faceEngine.init(engineConfiguration); errorCode = faceEngine.init(engineConfiguration);
// isTrue(errorCode == ErrorInfo.MOK.getValue(), "初始化引擎失败"); isTrue(errorCode == ErrorInfo.MOK.getValue(), "初始化引擎失败");
// return faceEngine; return faceEngine;
// } }
//
//
// /** /**
// * 人脸检测、特征提取 * 人脸检测、特征提取
// * *
// * @param faceEngine * @param faceEngine
// * @param bytes * @param bytes
// * @return * @return
// */ */
// public byte[] featureData(FaceEngine faceEngine, byte[] bytes) { public byte[] featureData(FaceEngine faceEngine, byte[] bytes) {
// //人脸检测 //人脸检测
// ImageInfo imageInfo = getRGBData(bytes); ImageInfo imageInfo = getRGBData(bytes);
// List<FaceInfo> faceInfoList = new ArrayList<FaceInfo>(); List<FaceInfo> faceInfoList = new ArrayList<FaceInfo>();
// faceEngine.detectFaces(imageInfo.getImageData(), imageInfo.getWidth(), imageInfo.getHeight(), imageInfo.getImageFormat(), faceInfoList); faceEngine.detectFaces(imageInfo.getImageData(), imageInfo.getWidth(), imageInfo.getHeight(), imageInfo.getImageFormat(), faceInfoList);
// //特征提取 //特征提取
// FaceFeature faceFeature = new FaceFeature(); FaceFeature faceFeature = new FaceFeature();
// faceEngine.extractFaceFeature(imageInfo.getImageData(), imageInfo.getWidth(), imageInfo.getHeight(), imageInfo.getImageFormat(), faceInfoList.get(0), faceFeature); faceEngine.extractFaceFeature(imageInfo.getImageData(), imageInfo.getWidth(), imageInfo.getHeight(), imageInfo.getImageFormat(), faceInfoList.get(0), faceFeature);
// return faceFeature.getFeatureData(); return faceFeature.getFeatureData();
// } }
//
//
// /** /**
// * 特征比对 * 特征比对
// * *
// * @param targeFace * @param targeFace
// * @param sourceFace * @param sourceFace
// * @return * @return
// */ */
// public boolean featureComparison(FaceEngine faceEngine, byte[] targeFace, byte[] sourceFace) { public boolean featureComparison(FaceEngine faceEngine, byte[] targeFace, byte[] sourceFace) {
// //特征比对 //特征比对
// FaceFeature targetFaceFeature = new FaceFeature(); FaceFeature targetFaceFeature = new FaceFeature();
// targetFaceFeature.setFeatureData(targeFace); targetFaceFeature.setFeatureData(targeFace);
// FaceFeature sourceFaceFeature = new FaceFeature(); FaceFeature sourceFaceFeature = new FaceFeature();
// sourceFaceFeature.setFeatureData(sourceFace); sourceFaceFeature.setFeatureData(sourceFace);
// FaceSimilar faceSimilar = new FaceSimilar(); FaceSimilar faceSimilar = new FaceSimilar();
// faceEngine.compareFaceFeature(targetFaceFeature, sourceFaceFeature, faceSimilar); faceEngine.compareFaceFeature(targetFaceFeature, sourceFaceFeature, faceSimilar);
// float score = faceSimilar.getScore(); float score = faceSimilar.getScore();
// if (score > 0.8) { if (score > 0.8) {
// return true; return true;
// } }
// return false; return false;
// } }
//
// public void unInit(FaceEngine faceEngine) { public void unInit(FaceEngine faceEngine) {
// faceEngine.unInit(); faceEngine.unInit();
// } }
//
// public String getOsName() { public String getOsName() {
// String os = System.getProperty("os.name"); String os = System.getProperty("os.name");
// String osName = os.toLowerCase().startsWith("win") ? "/face_lib/win64" : "/face_lib/linux"; String osName = os.toLowerCase().startsWith("win") ? "/face_lib/win64" : "/face_lib/linux";
// return osName; return osName;
// } }
//
//
// private void isTrue(boolean b, String errorMsg) { private void isTrue(boolean b, String errorMsg) {
// if (!b) { if (!b) {
// throw new AppException(errorMsg); throw new AppException(errorMsg);
// } }
// } }
//
//} }
...@@ -51,10 +51,40 @@ public class MatterHtmlParseUtil { ...@@ -51,10 +51,40 @@ public class MatterHtmlParseUtil {
return Rest.ok(resultMap); return Rest.ok(resultMap);
} }
public static Rest<Map<String, Integer>> statSiteMatterDeptCount(Map<String, String> params, String url) {
String matterTotalExp = "//input[@id=\"result_countDept\"]";
String matterPageExp = "//input[@id=\"pageNumDept\"]";
Map<String, Integer> resultMap = new HashMap<>();
try {
Document dom = Jsoup.connect(url).data(params).get();
Elements elements = dom.selectXpath(matterTotalExp);
if (elements.size() > 0) {
Integer total = elements.get(0) == null ? 0 : DataUtil.converStr2Int(elements.get(0).attr("value"), 0);
resultMap.put("total", total);
}
elements = dom.selectXpath(matterPageExp);
if (elements.size() > 0) {
Integer pageNum = elements.get(0) == null ? 0 : DataUtil.converStr2Int(elements.get(0).attr("value"), 0);
resultMap.put("pageNum", pageNum);
}
} catch (Exception e) {
log.error("获取事项数量异常!params:" + JSON.toJSONString(params), e);
return Rest.fail(e.getMessage());
}
return Rest.ok(resultMap);
}
public static Rest<List<MatterEntity>> getMatterList(Map<String, String> params, String url) { public static Rest<List<MatterEntity>> getMatterList(Map<String, String> params, String url) {
String matterListExp = "//div[@class=\"sx_list\"]//span[1]"; String matterListExp = "//div[@class=\"sx_list\"]//span[1]";
String matterListLiExp = "//div[@class=\"sx_list\"]//li/a[1]"; String matterListLiExp = "//div[@class=\"sx_list\"]//li/a[1]";
List<MatterEntity> matterEntityList = new ArrayList<>(); List<MatterEntity> matterEntityList = new ArrayList<>();
String evaluationUrl = "";
String netApplyUrl = "";
String href = "";
try { try {
Document dom = Jsoup.connect(url).data(params).get(); Document dom = Jsoup.connect(url).data(params).get();
//System.out.println(dom.html()); //System.out.println(dom.html());
...@@ -66,7 +96,7 @@ public class MatterHtmlParseUtil { ...@@ -66,7 +96,7 @@ public class MatterHtmlParseUtil {
continue; continue;
} }
String title = element.attr("title"); String title = element.attr("title");
String href = element.firstElementChild().attr("href"); href = element.firstElementChild().attr("href");
//element.child() //element.child()
if (href.equalsIgnoreCase("javascript:void(0)")) { if (href.equalsIgnoreCase("javascript:void(0)")) {
...@@ -74,18 +104,22 @@ public class MatterHtmlParseUtil { ...@@ -74,18 +104,22 @@ public class MatterHtmlParseUtil {
} }
//抓取申请与评价页面地址 //抓取申请与评价页面地址
Element nextElementSibling = element.nextElementSibling(); Element nextElementSibling = element.nextElementSibling();
Elements elementsA = nextElementSibling.children();
String evaluationUrl = ""; //Elements elementsA = nextElementSibling.selectXpath("//a");
String netApplyUrl = "";
Elements elementsA = nextElementSibling.selectXpath("//a");
if (elementsA != null) { if (elementsA != null) {
for (Element tempElement : elementsA) { for (Element tempElement : elementsA) {
if (tempElement.text().trim().equals("好差评")) { if ("办事指南".equals(tempElement.text().trim())) {
String onclick = tempElement.attr("onclick");
List<String> list = ReUtil.findAllGroup0("'(.*?)'", onclick);
if (list.size() > 1) {
href = StrUtil.subBetween(list.get(0), "'", "'");
}
}
if ("好差评".equals(tempElement.text().trim())) {
String onclick = tempElement.attr("onclick"); String onclick = tempElement.attr("onclick");
evaluationUrl = StrUtil.subBetween(onclick, "evaluation('", "')"); evaluationUrl = StrUtil.subBetween(onclick, "evaluation('", "')");
} }
if (tempElement.text().trim().equals("申请")) { if ("申请".equals(tempElement.text().trim())) {
String onclick = tempElement.attr("onclick"); String onclick = tempElement.attr("onclick");
List<String> list = ReUtil.findAllGroup0("'(.*?)'", onclick); List<String> list = ReUtil.findAllGroup0("'(.*?)'", onclick);
if (list.size() > 4) { if (list.size() > 4) {
...@@ -94,6 +128,11 @@ public class MatterHtmlParseUtil { ...@@ -94,6 +128,11 @@ public class MatterHtmlParseUtil {
} }
} }
} }
if (ObjectUtils.isEmpty(href)) {
log.info("error href ,title:" + title);
}
buildMatter(matterEntityList, title, href, evaluationUrl, netApplyUrl); buildMatter(matterEntityList, title, href, evaluationUrl, netApplyUrl);
} }
...@@ -104,14 +143,23 @@ public class MatterHtmlParseUtil { ...@@ -104,14 +143,23 @@ public class MatterHtmlParseUtil {
continue; continue;
} }
String title = element.attr("title"); String title = element.attr("title");
String href = element.attr("href"); href = element.attr("href");
//抓取申请与评价页面地址 //抓取申请与评价页面地址
String evaluationUrl = "";
String netApplyUrl = "";
Element nextElementSibling = element.nextElementSibling(); Element nextElementSibling = element.nextElementSibling();
if (nextElementSibling != null) { if (nextElementSibling != null) {
Elements elementsA = nextElementSibling.selectXpath("//a");
Elements elementsA = nextElementSibling.children();
//Elements elementsA = nextElementSibling.selectXpath("//a");
for (Element tempElement : elementsA) { for (Element tempElement : elementsA) {
if ("办事指南".equals(tempElement.text().trim())) {
String onclick = tempElement.attr("onclick");
if(ObjectUtils.isEmpty(onclick)) continue;
List<String> list = ReUtil.findAllGroup0("'(.*?)'", onclick);
if (list.size() > 1) {
href = StrUtil.subBetween(list.get(0), "'", "'");
}
}
if ("好差评".equals(tempElement.text().trim())) { if ("好差评".equals(tempElement.text().trim())) {
String onclick = tempElement.attr("onclick"); String onclick = tempElement.attr("onclick");
evaluationUrl = StrUtil.subBetween(onclick, "evaluation('", "')"); evaluationUrl = StrUtil.subBetween(onclick, "evaluation('", "')");
...@@ -123,6 +171,11 @@ public class MatterHtmlParseUtil { ...@@ -123,6 +171,11 @@ public class MatterHtmlParseUtil {
netApplyUrl = StrUtil.subBetween(list.get(3), "'", "'"); netApplyUrl = StrUtil.subBetween(list.get(3), "'", "'");
} }
} }
if (ObjectUtils.isEmpty(href)) {
log.info("error href ,title:" + title);
}
} }
} }
buildMatter(matterEntityList, title, href, evaluationUrl, netApplyUrl); buildMatter(matterEntityList, title, href, evaluationUrl, netApplyUrl);
...@@ -243,17 +296,19 @@ public class MatterHtmlParseUtil { ...@@ -243,17 +296,19 @@ public class MatterHtmlParseUtil {
// System.out.println(JSON.toJSONString(allList)); // System.out.println(JSON.toJSONString(allList));
String url = "http://www.sczwfw.gov.cn/jiq/interface/item/tags"; /* String url = "http://www.sczwfw.gov.cn/jiq/interface/item/tags";
HashMap<String, String> params = new HashMap<>(); HashMap<String, String> params = new HashMap<>();
params.put("areaCode", "510110006007"); params.put("areaCode", "511500000000");
params.put("dxType", "56"); params.put("dxType", "3");
params.put("deptCode", ""); params.put("deptCode", "");
params.put("searchtext", ""); params.put("searchtext", "");
params.put("type", "2");//类型 2.部门 1.主题 3.热度
params.put("taskType", ""); params.put("taskType", "");
params.put("pageno", "1"); // params.put("pageno", "1");
Rest<Map<String, Integer>> rest = MatterHtmlParseUtil.statSiteMatterCount(params, url); Rest<Map<String, Integer>> rest = MatterHtmlParseUtil.statSiteMatterDeptCount(params, url);
System.out.println(JSON.toJSONString(rest)); System.out.println(JSON.toJSONString(rest));*/
/*
List<MatterEntity> allList = new ArrayList<>(); List<MatterEntity> allList = new ArrayList<>();
String url1 = "http://www.sczwfw.gov.cn/jiq/interface/item/tags"; String url1 = "http://www.sczwfw.gov.cn/jiq/interface/item/tags";
...@@ -282,6 +337,7 @@ public class MatterHtmlParseUtil { ...@@ -282,6 +337,7 @@ public class MatterHtmlParseUtil {
Rest<Map<String, String>> rest1 = MatterHtmlParseUtil.syncDeptBySiteId(params, url); Rest<Map<String, String>> rest1 = MatterHtmlParseUtil.syncDeptBySiteId(params, url);
System.out.println(JSON.toJSONString(rest1)); System.out.println(JSON.toJSONString(rest1));
*/
} }
......
...@@ -69,15 +69,15 @@ public class SyncGovMatterDetailThread implements Runnable { ...@@ -69,15 +69,15 @@ public class SyncGovMatterDetailThread implements Runnable {
@Override @Override
public void run() { public void run() {
log.info("同步站点事项开始....."); log.info("同步站点事项开始.....");
Rest<String> deptRest = deptService.syncDeptBySiteId(siteEntity, context); // Rest<String> deptRest = deptService.syncDeptBySiteId(siteEntity, context);
log.info("同步站点部门:" + JSON.toJSONString(deptRest)); // log.info("同步站点部门:" + JSON.toJSONString(deptRest));
Rest<String> rest = siteService.syncMatterBySiteId(siteEntity, context); Rest<String> rest = siteService.syncMatterBySiteId(siteEntity, context);
AreaEntity areaEntity = areaService.getCache(siteEntity.getAreaCode()); AreaEntity areaEntity = areaService.getCache(siteEntity.getAreaCode());
log.info("同步事项列表:" + JSON.toJSONString(rest)); log.info("同步事项列表:" + JSON.toJSONString(rest));
if (rest.getCode() == YesNoEnum.YES.getValue()) { if (rest.getCode() == YesNoEnum.YES.getValue()) {
List<MatterEntity> matterEntityList = matterService.find(new MatterQuery().areaCode(siteEntity.getAreaCode()).source(SourceEnum.政务网.getValue())); List<MatterEntity> matterEntityList = matterService.find(new MatterQuery().areaCode(siteEntity.getAreaCode()).source(SourceEnum.政务网.getValue()));
List<MatterEntity> unSyncDetailMatterList = matterEntityList.stream() List<MatterEntity> unSyncDetailMatterList = matterEntityList.stream()
//.filter(f -> f.getHaveGetMatterInfo().equalsIgnoreCase("false")) .filter(f -> f.getHaveGetMatterInfo().equalsIgnoreCase("false"))
.collect(Collectors.toList()); .collect(Collectors.toList());
//查询站点事项相关 //查询站点事项相关
......
package com.mortals.xhx.daemon.task;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.service.ITask;
import com.mortals.framework.service.ITaskExcuteService;
import com.mortals.xhx.module.dept.model.DeptEntity;
import com.mortals.xhx.module.dept.model.DeptQuery;
import com.mortals.xhx.module.dept.service.DeptService;
import com.mortals.xhx.module.matter.model.MatterEntity;
import com.mortals.xhx.module.matter.model.MatterQuery;
import com.mortals.xhx.module.matter.service.MatterService;
import com.mortals.xhx.module.matters.service.MattersService;
import com.mortals.xhx.module.site.model.SiteMatterQuery;
import com.mortals.xhx.module.site.service.SiteMatterService;
import com.mortals.xhx.module.site.service.SiteService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
* 统计站点部门事项
*/
@Slf4j
@Service("StatSiteDeptMatterTask")
public class StatSiteDeptMatterTaskImpl implements ITaskExcuteService {
@Autowired
private DeptService deptService;
@Autowired
private MatterService matterService;
@Override
public void excuteTask(ITask task) throws AppException {
log.info("开始同步事项列表!");
List<DeptEntity> deptEntities = deptService.find(new DeptQuery());
for (DeptEntity deptEntity : deptEntities) {
int total = matterService.count(new MatterQuery().deptCode(deptEntity.getDeptNumber()), null);
if (total > 0) {
DeptEntity deptQuery = new DeptEntity();
deptQuery.setTotal(total);
deptQuery.setUpdateTime(new Date());
DeptEntity condition = new DeptEntity();
condition.setId(deptEntity.getId());
deptService.getDao().update(deptQuery, condition);
// deptService.update(deptEntity, null);
}
}
}
@Override
public void stopTask(ITask task) throws AppException {
}
}
...@@ -15,6 +15,7 @@ import com.mortals.xhx.common.pdu.user.UserPdu; ...@@ -15,6 +15,7 @@ import com.mortals.xhx.common.pdu.user.UserPdu;
import com.mortals.xhx.common.utils.BeanUtil; import com.mortals.xhx.common.utils.BeanUtil;
import com.mortals.xhx.common.utils.SyncTreeSiteThread; import com.mortals.xhx.common.utils.SyncTreeSiteThread;
import com.mortals.xhx.feign.user.IUserFeign; import com.mortals.xhx.feign.user.IUserFeign;
import com.mortals.xhx.module.dept.service.DeptService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -27,7 +28,7 @@ import java.util.List; ...@@ -27,7 +28,7 @@ import java.util.List;
* 同步用户 * 同步用户
*/ */
@Slf4j @Slf4j
@Service("SyncUserTask") //@Service("SyncUserTask")
public class SyncUserTaskImpl implements ITaskExcuteService { public class SyncUserTaskImpl implements ITaskExcuteService {
@Autowired @Autowired
...@@ -47,8 +48,6 @@ public class SyncUserTaskImpl implements ITaskExcuteService { ...@@ -47,8 +48,6 @@ public class SyncUserTaskImpl implements ITaskExcuteService {
userService.updateUserList(list.getData().getData()); userService.updateUserList(list.getData().getData());
//resourceService.updateUserList(); //resourceService.updateUserList();
/* UserPdu userPdu = new UserPdu(); /* UserPdu userPdu = new UserPdu();
......
//package com.mortals.xhx.face.factory; package com.mortals.xhx.face.factory;
//
//import com.arcsoft.face.ActiveFileInfo; import com.arcsoft.face.ActiveFileInfo;
//import com.arcsoft.face.EngineConfiguration; import com.arcsoft.face.EngineConfiguration;
//import com.arcsoft.face.FaceEngine; import com.arcsoft.face.FaceEngine;
//import com.arcsoft.face.FunctionConfiguration; import com.arcsoft.face.FunctionConfiguration;
//import com.arcsoft.face.enums.DetectMode; import com.arcsoft.face.enums.DetectMode;
//import com.arcsoft.face.enums.DetectOrient; import com.arcsoft.face.enums.DetectOrient;
//import com.arcsoft.face.enums.ErrorInfo; import com.arcsoft.face.enums.ErrorInfo;
//import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
//import org.apache.commons.pool2.BasePooledObjectFactory; import org.apache.commons.pool2.BasePooledObjectFactory;
//import org.apache.commons.pool2.PooledObject; import org.apache.commons.pool2.PooledObject;
//import org.apache.commons.pool2.impl.DefaultPooledObject; import org.apache.commons.pool2.impl.DefaultPooledObject;
//
//@Slf4j @Slf4j
//public class FaceEnginePoolFactory extends BasePooledObjectFactory<FaceEngine> { public class FaceEnginePoolFactory extends BasePooledObjectFactory<FaceEngine> {
//
// private String appId; private String appId;
// private String sdkKey; private String sdkKey;
// private String sdkLibPath; private String sdkLibPath;
//
// public FaceEnginePoolFactory(String appId, String sdkKey, String sdkLibPath) { public FaceEnginePoolFactory(String appId, String sdkKey, String sdkLibPath) {
// this.appId = appId; this.appId = appId;
// this.sdkKey = sdkKey; this.sdkKey = sdkKey;
// this.sdkLibPath = sdkLibPath; this.sdkLibPath = sdkLibPath;
// //this.sdkLibPath = "D:\\face\\win64"; //this.sdkLibPath = "D:\\face\\win64";
// } }
//
// /** /**
// * 在对象池中创建对象 * 在对象池中创建对象
// * @return * @return
// * @throws Exception * @throws Exception
// */ */
// @Override @Override
// public FaceEngine create() throws Exception { public FaceEngine create() throws Exception {
// FaceEngine faceEngine = new FaceEngine(sdkLibPath); FaceEngine faceEngine = new FaceEngine(sdkLibPath);
// //激活引擎 //激活引擎
// int errorCode = faceEngine.activeOnline(appId, sdkKey); int errorCode = faceEngine.activeOnline(appId, sdkKey);
// if (errorCode != ErrorInfo.MOK.getValue() && errorCode != ErrorInfo.MERR_ASF_ALREADY_ACTIVATED.getValue()) { if (errorCode != ErrorInfo.MOK.getValue() && errorCode != ErrorInfo.MERR_ASF_ALREADY_ACTIVATED.getValue()) {
// log.warn("引擎激活失败"); log.warn("引擎激活失败");
// } }
// ActiveFileInfo activeFileInfo=new ActiveFileInfo(); ActiveFileInfo activeFileInfo=new ActiveFileInfo();
// errorCode = faceEngine.getActiveFileInfo(activeFileInfo); errorCode = faceEngine.getActiveFileInfo(activeFileInfo);
// if (errorCode != ErrorInfo.MOK.getValue() && errorCode != ErrorInfo.MERR_ASF_ALREADY_ACTIVATED.getValue()) { if (errorCode != ErrorInfo.MOK.getValue() && errorCode != ErrorInfo.MERR_ASF_ALREADY_ACTIVATED.getValue()) {
// log.warn("获取激活文件信息失败"); log.warn("获取激活文件信息失败");
// } }
// //引擎配置 //引擎配置
// EngineConfiguration engineConfiguration = new EngineConfiguration(); EngineConfiguration engineConfiguration = new EngineConfiguration();
// engineConfiguration.setDetectMode(DetectMode.ASF_DETECT_MODE_IMAGE); engineConfiguration.setDetectMode(DetectMode.ASF_DETECT_MODE_IMAGE);
// engineConfiguration.setDetectFaceOrientPriority(DetectOrient.ASF_OP_ALL_OUT); engineConfiguration.setDetectFaceOrientPriority(DetectOrient.ASF_OP_ALL_OUT);
// engineConfiguration.setDetectFaceMaxNum(10); engineConfiguration.setDetectFaceMaxNum(10);
// engineConfiguration.setDetectFaceScaleVal(16); engineConfiguration.setDetectFaceScaleVal(16);
// //功能配置 //功能配置
// FunctionConfiguration functionConfiguration = new FunctionConfiguration(); FunctionConfiguration functionConfiguration = new FunctionConfiguration();
// functionConfiguration.setSupportAge(true); functionConfiguration.setSupportAge(true);
// functionConfiguration.setSupportFace3dAngle(true); functionConfiguration.setSupportFace3dAngle(true);
// functionConfiguration.setSupportFaceDetect(true); functionConfiguration.setSupportFaceDetect(true);
// functionConfiguration.setSupportFaceRecognition(true); functionConfiguration.setSupportFaceRecognition(true);
// functionConfiguration.setSupportGender(true); functionConfiguration.setSupportGender(true);
// functionConfiguration.setSupportLiveness(true); functionConfiguration.setSupportLiveness(true);
// functionConfiguration.setSupportIRLiveness(true); functionConfiguration.setSupportIRLiveness(true);
// engineConfiguration.setFunctionConfiguration(functionConfiguration); engineConfiguration.setFunctionConfiguration(functionConfiguration);
// //初始化引擎 //初始化引擎
// errorCode = faceEngine.init(engineConfiguration); errorCode = faceEngine.init(engineConfiguration);
//
// if (errorCode != ErrorInfo.MOK.getValue()) { if (errorCode != ErrorInfo.MOK.getValue()) {
// log.error("初始化引擎失败"); log.error("初始化引擎失败");
// } }
// return faceEngine; return faceEngine;
// } }
//
// /** /**
// * 包装对象 * 包装对象
// * @param faceEngine * @param faceEngine
// * @return * @return
// */ */
// @Override @Override
// public PooledObject<FaceEngine> wrap(FaceEngine faceEngine) { public PooledObject<FaceEngine> wrap(FaceEngine faceEngine) {
// return new DefaultPooledObject<>(faceEngine); return new DefaultPooledObject<>(faceEngine);
// } }
// /** /**
// * 销毁对象 * 销毁对象
// * @param faceEngine 对象池 * @param faceEngine 对象池
// * @throws Exception 异常 * @throws Exception 异常
// */ */
// @Override @Override
// public void destroyObject(PooledObject<FaceEngine> faceEngine) throws Exception { public void destroyObject(PooledObject<FaceEngine> faceEngine) throws Exception {
// super.destroyObject(faceEngine); super.destroyObject(faceEngine);
// } }
//
// /** /**
// * 校验对象是否可用 * 校验对象是否可用
// * @param faceEngine 对象池 * @param faceEngine 对象池
// * @return 对象是否可用结果,boolean * @return 对象是否可用结果,boolean
// */ */
// @Override @Override
// public boolean validateObject(PooledObject<FaceEngine> faceEngine) { public boolean validateObject(PooledObject<FaceEngine> faceEngine) {
// return super.validateObject(faceEngine); return super.validateObject(faceEngine);
// } }
//
// /** /**
// * 激活钝化的对象系列操作 * 激活钝化的对象系列操作
// * @param faceEngine 对象池 * @param faceEngine 对象池
// * @throws Exception 异常信息 * @throws Exception 异常信息
// */ */
// @Override @Override
// public void activateObject(PooledObject<FaceEngine> faceEngine) throws Exception { public void activateObject(PooledObject<FaceEngine> faceEngine) throws Exception {
// super.activateObject(faceEngine); super.activateObject(faceEngine);
// } }
//
// /** /**
// * 钝化未使用的对象 * 钝化未使用的对象
// * @param faceEngine 对象池 * @param faceEngine 对象池
// * @throws Exception 异常信息 * @throws Exception 异常信息
// */ */
// @Override @Override
// public void passivateObject(PooledObject<FaceEngine> faceEngine) throws Exception { public void passivateObject(PooledObject<FaceEngine> faceEngine) throws Exception {
// super.passivateObject(faceEngine); super.passivateObject(faceEngine);
// } }
//
//} }
...@@ -17,14 +17,17 @@ import com.mortals.framework.model.PageInfo; ...@@ -17,14 +17,17 @@ import com.mortals.framework.model.PageInfo;
import com.mortals.xhx.base.system.upload.service.UploadService; import com.mortals.xhx.base.system.upload.service.UploadService;
import com.mortals.xhx.common.code.YesNoEnum; import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.common.key.Constant; import com.mortals.xhx.common.key.Constant;
import com.mortals.xhx.common.pdu.app.AppPdu;
import com.mortals.xhx.common.utils.BeanUtil; import com.mortals.xhx.common.utils.BeanUtil;
import com.mortals.xhx.common.utils.ZipUtils; import com.mortals.xhx.common.utils.ZipUtils;
import com.mortals.xhx.feign.app.device.IAppFeign;
import com.mortals.xhx.module.app.model.*; import com.mortals.xhx.module.app.model.*;
import com.mortals.xhx.module.app.service.*; import com.mortals.xhx.module.app.service.*;
import com.mortals.xhx.module.site.model.SiteEntity; import com.mortals.xhx.module.site.model.SiteEntity;
import com.mortals.xhx.module.site.service.SiteService; import com.mortals.xhx.module.site.service.SiteService;
import com.mortals.xhx.utils.EncodeUtil; import com.mortals.xhx.utils.EncodeUtil;
import com.mortals.xhx.version.model.VersionEntity; import com.mortals.xhx.version.model.VersionEntity;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -49,6 +52,7 @@ import static com.mortals.xhx.common.key.Constant.CUSTAPP_ROOT_PATH; ...@@ -49,6 +52,7 @@ import static com.mortals.xhx.common.key.Constant.CUSTAPP_ROOT_PATH;
* @date 2022-11-28 * @date 2022-11-28
*/ */
@Service("appService") @Service("appService")
@Slf4j
public class AppServiceImpl extends AbstractCRUDServiceImpl<AppDao, AppEntity, Long> implements AppService { public class AppServiceImpl extends AbstractCRUDServiceImpl<AppDao, AppEntity, Long> implements AppService {
@Autowired @Autowired
...@@ -63,11 +67,14 @@ public class AppServiceImpl extends AbstractCRUDServiceImpl<AppDao, AppEntity, L ...@@ -63,11 +67,14 @@ public class AppServiceImpl extends AbstractCRUDServiceImpl<AppDao, AppEntity, L
private AppInfoTempleteFieldService appInfoTempleteFieldService; private AppInfoTempleteFieldService appInfoTempleteFieldService;
@Autowired @Autowired
private AppVersionService appVersionService; private AppVersionService appVersionService;
@Autowired
private IAppFeign appFeign;
@Override @Override
protected void findAfter(AppEntity params, PageInfo pageInfo, Context context, List<AppEntity> list) throws AppException { protected void findAfter(AppEntity params, PageInfo pageInfo, Context context, List<AppEntity> list) throws AppException {
//排序 //排序
if (!ObjectUtils.isEmpty(params.getIdList())) { if (!ObjectUtils.isEmpty(params.getIdList())) {
log.info("请求的排序id列表:{}", JSON.toJSONString(params.getIdList()));
try { try {
//去除idlist中不存在的 //去除idlist中不存在的
Set<Long> idSet = list.stream().map(item -> item.getId()).collect(Collectors.toSet()); Set<Long> idSet = list.stream().map(item -> item.getId()).collect(Collectors.toSet());
...@@ -317,6 +324,12 @@ public class AppServiceImpl extends AbstractCRUDServiceImpl<AppDao, AppEntity, L ...@@ -317,6 +324,12 @@ public class AppServiceImpl extends AbstractCRUDServiceImpl<AppDao, AppEntity, L
entity.setFilePath(null); entity.setFilePath(null);
entity.setFileName(null); entity.setFileName(null);
//判断如果应用下架,通知自助服务终端
if(entity.getShelves()==YesNoEnum.NO.getValue()){
AppPdu appPdu = new AppPdu();
appPdu.setAppId(entity.getId());
appFeign.forbidden(appPdu);
}
int iRet = this.dao.update(entity); int iRet = this.dao.update(entity);
if (iRet == 0) { if (iRet == 0) {
throw new AppException(-1002, "更新失败!"); throw new AppException(-1002, "更新失败!");
......
...@@ -36,7 +36,7 @@ public class AreaServiceImpl extends AbstractCRUDCacheServiceImpl<AreaDao, AreaE ...@@ -36,7 +36,7 @@ public class AreaServiceImpl extends AbstractCRUDCacheServiceImpl<AreaDao, AreaE
private BaseAreaService baseAreaService; private BaseAreaService baseAreaService;
/* @Override @Override
public void putCache(String key, AreaEntity data) { public void putCache(String key, AreaEntity data) {
super.putCache(key, data); super.putCache(key, data);
//加载孩子关系 //加载孩子关系
...@@ -47,7 +47,7 @@ public class AreaServiceImpl extends AbstractCRUDCacheServiceImpl<AreaDao, AreaE ...@@ -47,7 +47,7 @@ public class AreaServiceImpl extends AbstractCRUDCacheServiceImpl<AreaDao, AreaE
cacheService.lpush(childKey, item); cacheService.lpush(childKey, item);
}); });
} }
}*/ }
@Override @Override
protected String getExtKey(AreaEntity data) { protected String getExtKey(AreaEntity data) {
......
...@@ -10,7 +10,7 @@ import com.mortals.xhx.module.dept.model.vo.DeptVo; ...@@ -10,7 +10,7 @@ import com.mortals.xhx.module.dept.model.vo.DeptVo;
* 部门实体对象 * 部门实体对象
* *
* @author zxfei * @author zxfei
* @date 2022-11-23 * @date 2023-03-06
*/ */
public class DeptEntity extends DeptVo { public class DeptEntity extends DeptVo {
...@@ -84,6 +84,10 @@ public class DeptEntity extends DeptVo { ...@@ -84,6 +84,10 @@ public class DeptEntity extends DeptVo {
* 部门来源 * 部门来源
*/ */
private Integer source; private Integer source;
/**
* 关联事项数量
*/
private Integer total;
...@@ -326,6 +330,20 @@ public class DeptEntity extends DeptVo { ...@@ -326,6 +330,20 @@ public class DeptEntity extends DeptVo {
public void setSource(Integer source){ public void setSource(Integer source){
this.source = source; this.source = source;
} }
/**
* 获取 关联事项数量
* @return Integer
*/
public Integer getTotal(){
return total;
}
/**
* 设置 关联事项数量
* @param total
*/
public void setTotal(Integer total){
this.total = total;
}
...@@ -365,6 +383,7 @@ public class DeptEntity extends DeptVo { ...@@ -365,6 +383,7 @@ public class DeptEntity extends DeptVo {
sb.append(",isEnglish:").append(getIsEnglish()); sb.append(",isEnglish:").append(getIsEnglish());
sb.append(",sort:").append(getSort()); sb.append(",sort:").append(getSort());
sb.append(",source:").append(getSource()); sb.append(",source:").append(getSource());
sb.append(",total:").append(getTotal());
return sb.toString(); return sb.toString();
} }
...@@ -403,5 +422,7 @@ public class DeptEntity extends DeptVo { ...@@ -403,5 +422,7 @@ public class DeptEntity extends DeptVo {
this.sort = 0; this.sort = 0;
this.source = 0; this.source = 0;
this.total = 0;
} }
} }
\ No newline at end of file
...@@ -43,5 +43,12 @@ public class DeptVo extends BaseEntityLong { ...@@ -43,5 +43,12 @@ public class DeptVo extends BaseEntityLong {
/** 部门ID列表 */ /** 部门ID列表 */
private List <Long> idList; private List <Long> idList;
/**
* 是否过滤不存在事项的部门(0.不过滤,1.过滤,默认不过滤)
*/
private Integer filter;
/** 开始 关联事项数量 */
private Integer totalStart;
} }
\ No newline at end of file
...@@ -5,6 +5,7 @@ import com.mortals.framework.model.Context; ...@@ -5,6 +5,7 @@ import com.mortals.framework.model.Context;
import com.mortals.framework.service.ICRUDCacheService; import com.mortals.framework.service.ICRUDCacheService;
import com.mortals.framework.service.ICRUDService; import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.business.model.BusinessEntity; import com.mortals.xhx.module.business.model.BusinessEntity;
import com.mortals.xhx.module.dept.dao.DeptDao;
import com.mortals.xhx.module.dept.model.DeptEntity; import com.mortals.xhx.module.dept.model.DeptEntity;
import com.mortals.xhx.module.dept.model.DeptQuery; import com.mortals.xhx.module.dept.model.DeptQuery;
import com.mortals.xhx.module.dept.model.vo.DeptVo; import com.mortals.xhx.module.dept.model.vo.DeptVo;
...@@ -23,6 +24,7 @@ import java.util.Map; ...@@ -23,6 +24,7 @@ import java.util.Map;
*/ */
public interface DeptService extends ICRUDCacheService<DeptEntity, Long> { public interface DeptService extends ICRUDCacheService<DeptEntity, Long> {
DeptDao getDao();
/** /**
* 同步政务网部门数据 * 同步政务网部门数据
......
...@@ -4,6 +4,7 @@ import com.mortals.framework.ap.GlobalSysInfo; ...@@ -4,6 +4,7 @@ import com.mortals.framework.ap.GlobalSysInfo;
import com.mortals.framework.common.Rest; import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context; import com.mortals.framework.model.Context;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.service.impl.AbstractCRUDCacheServiceImpl; import com.mortals.framework.service.impl.AbstractCRUDCacheServiceImpl;
import com.mortals.xhx.common.code.SourceEnum; import com.mortals.xhx.common.code.SourceEnum;
import com.mortals.xhx.common.code.YesNoEnum; import com.mortals.xhx.common.code.YesNoEnum;
...@@ -69,6 +70,7 @@ public class DeptServiceImpl extends AbstractCRUDCacheServiceImpl<DeptDao, DeptE ...@@ -69,6 +70,7 @@ public class DeptServiceImpl extends AbstractCRUDCacheServiceImpl<DeptDao, DeptE
return data.getDeptNumber(); return data.getDeptNumber();
} }
/** /**
* @param entity * @param entity
* @param context * @param context
......
...@@ -9,6 +9,7 @@ import com.mortals.framework.model.OrderCol; ...@@ -9,6 +9,7 @@ import com.mortals.framework.model.OrderCol;
import com.mortals.framework.util.DataUtil; import com.mortals.framework.util.DataUtil;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController; import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService; import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.module.business.model.BusinessEntity; import com.mortals.xhx.module.business.model.BusinessEntity;
import com.mortals.xhx.module.dept.model.DeptEntity; import com.mortals.xhx.module.dept.model.DeptEntity;
import com.mortals.xhx.module.dept.model.DeptQuery; import com.mortals.xhx.module.dept.model.DeptQuery;
...@@ -59,6 +60,11 @@ public class DeptController extends BaseCRUDJsonBodyMappingController<DeptServic ...@@ -59,6 +60,11 @@ public class DeptController extends BaseCRUDJsonBodyMappingController<DeptServic
add(new OrderCol("a.createTime", OrderCol.ASCENDING)); add(new OrderCol("a.createTime", OrderCol.ASCENDING));
} }
}); });
if(!ObjectUtils.isEmpty(query.getFilter())&& YesNoEnum.YES.getValue()==query.getFilter()){
//过滤部门事项数据为0的部门
query.setTotalStart(0);
}
super.doListBefore(query, model, context); super.doListBefore(query, model, context);
} }
...@@ -150,6 +156,19 @@ public class DeptController extends BaseCRUDJsonBodyMappingController<DeptServic ...@@ -150,6 +156,19 @@ public class DeptController extends BaseCRUDJsonBodyMappingController<DeptServic
} }
/**
* @param entity
* @param model
* @param context
* @throws AppException
*/
@Override
protected void saveBefore(DeptEntity entity, Map<String, Object> model, Context context) throws AppException {
DeptEntity deptEntity = this.service.selectOne(new DeptQuery().deptNumber(entity.getDeptNumber()));
if(!ObjectUtils.isEmpty(deptEntity)){
throw new AppException("部门编码已存在!");
}
entity.setSource(1);
super.saveBefore(entity, model, context);
}
} }
\ No newline at end of file
package com.mortals.xhx.module.matter.model; package com.mortals.xhx.module.matter.model;
import java.util.*;
import java.util.List; import java.util.List;
import java.util.Date;
import java.util.List;
import java.util.ArrayList;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.mortals.framework.annotation.Excel; import com.mortals.framework.annotation.Excel;
...@@ -1694,7 +1692,7 @@ public class MatterEntity extends MatterVo { ...@@ -1694,7 +1692,7 @@ public class MatterEntity extends MatterVo {
@Override @Override
public int hashCode() { public int hashCode() {
return this.getId().hashCode(); return Objects.hash(this.areaCode, this.matterNo);
} }
@Override @Override
...@@ -1702,7 +1700,7 @@ public class MatterEntity extends MatterVo { ...@@ -1702,7 +1700,7 @@ public class MatterEntity extends MatterVo {
if (obj == null) return false; if (obj == null) return false;
if (obj instanceof MatterEntity) { if (obj instanceof MatterEntity) {
MatterEntity tmp = (MatterEntity) obj; MatterEntity tmp = (MatterEntity) obj;
if (this.getId() == tmp.getId()) { if ((this.getAreaCode()+this.matterNo).equals(tmp.getAreaCode()+tmp.matterNo)) {
return true; return true;
} }
} }
......
...@@ -284,6 +284,7 @@ public class MatterServiceImpl extends AbstractCRUDServiceImpl<MatterDao, Matter ...@@ -284,6 +284,7 @@ public class MatterServiceImpl extends AbstractCRUDServiceImpl<MatterDao, Matter
@Override @Override
public Result<MatterEntity> findSubList(MatterEntity matterQuery, PageInfo pageInfo, Context context) throws AppException { public Result<MatterEntity> findSubList(MatterEntity matterQuery, PageInfo pageInfo, Context context) throws AppException {
SiteEntity siteCache = siteService.getCache(matterQuery.getSiteId().toString()); SiteEntity siteCache = siteService.getCache(matterQuery.getSiteId().toString());
if(ObjectUtils.isEmpty(siteCache)) throw new AppException("查询站点id不能为空!");
if (ObjectUtils.isEmpty(matterQuery.getAreaCode())) { if (ObjectUtils.isEmpty(matterQuery.getAreaCode())) {
matterQuery.setAreaCode(siteCache == null ? null : siteCache.getAreaCode()); matterQuery.setAreaCode(siteCache == null ? null : siteCache.getAreaCode());
} }
......
...@@ -85,7 +85,6 @@ public class SiteBusinessServiceImpl extends AbstractCRUDCacheServiceImpl<SiteBu ...@@ -85,7 +85,6 @@ public class SiteBusinessServiceImpl extends AbstractCRUDCacheServiceImpl<SiteBu
@Override @Override
protected void findAfter(SiteBusinessEntity params, PageInfo pageInfo, Context context, List<SiteBusinessEntity> list) throws AppException { protected void findAfter(SiteBusinessEntity params, PageInfo pageInfo, Context context, List<SiteBusinessEntity> list) throws AppException {
if (!ObjectUtils.isEmpty(params.getIdNotList())) { if (!ObjectUtils.isEmpty(params.getIdNotList())) {
//排除掉已经存在的ids //排除掉已经存在的ids
log.info("idNotList:{}", JSON.toJSONString(params.getIdNotList())); log.info("idNotList:{}", JSON.toJSONString(params.getIdNotList()));
...@@ -103,15 +102,15 @@ public class SiteBusinessServiceImpl extends AbstractCRUDCacheServiceImpl<SiteBu ...@@ -103,15 +102,15 @@ public class SiteBusinessServiceImpl extends AbstractCRUDCacheServiceImpl<SiteBu
//子节点已经全部选中,删除父节点 //子节点已经全部选中,删除父节点
iterator.remove(); iterator.remove();
pageInfo.setTotalResult(pageInfo.getTotalResult() - 1); pageInfo.setTotalResult(pageInfo.getTotalResult() - 1);
} else { } else {
childs.stream().forEach(item1 -> { childs.stream().forEach(item1 -> {
buildChildBusiness(item1); buildChildBusiness(item1);
}); });
item.setChildren(childs); item.setChildren(childs);
buildChildBusiness(item);
} }
} }
buildChildBusiness(item);
} }
} else { } else {
list.stream().peek(item -> { list.stream().peek(item -> {
...@@ -187,10 +186,6 @@ public class SiteBusinessServiceImpl extends AbstractCRUDCacheServiceImpl<SiteBu ...@@ -187,10 +186,6 @@ public class SiteBusinessServiceImpl extends AbstractCRUDCacheServiceImpl<SiteBu
//删除 //删除
businessService.remove(mainIds,context); businessService.remove(mainIds,context);
} }
} }
......
...@@ -27,6 +27,7 @@ import com.mortals.xhx.module.area.model.AreaEntity; ...@@ -27,6 +27,7 @@ import com.mortals.xhx.module.area.model.AreaEntity;
import com.mortals.xhx.module.area.model.AreaQuery; import com.mortals.xhx.module.area.model.AreaQuery;
import com.mortals.xhx.module.area.service.AreaService; import com.mortals.xhx.module.area.service.AreaService;
import com.mortals.xhx.module.dept.model.DeptEntity; import com.mortals.xhx.module.dept.model.DeptEntity;
import com.mortals.xhx.module.dept.model.DeptQuery;
import com.mortals.xhx.module.dept.service.DeptService; import com.mortals.xhx.module.dept.service.DeptService;
import com.mortals.xhx.module.matter.model.MatterEntity; import com.mortals.xhx.module.matter.model.MatterEntity;
import com.mortals.xhx.module.matter.model.MatterQuery; import com.mortals.xhx.module.matter.model.MatterQuery;
...@@ -368,14 +369,14 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE ...@@ -368,14 +369,14 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE
private List<SiteTreeSelect> getSiteTreeSelects(String userId) { private List<SiteTreeSelect> getSiteTreeSelects(String userId) {
String siteTreeSelectStr = cacheService.hget(USER_SITE_TREE, userId, String.class); String siteTreeSelectStr = cacheService.hget(USER_SITE_TREE, userId, String.class);
log.info("userId:{},siteTreeSelectStr:{}",userId,siteTreeSelectStr); log.info("userId:{},siteTreeSelectStr:{}", userId, siteTreeSelectStr);
//反序列化树对象 //反序列化树对象
if(ObjectUtils.isEmpty(siteTreeSelectStr)){ if (ObjectUtils.isEmpty(siteTreeSelectStr)) {
return new ArrayList<>(); return new ArrayList<>();
} }
JSONArray jsonArray = JSON.parseArray(siteTreeSelectStr); JSONArray jsonArray = JSON.parseArray(siteTreeSelectStr);
if(ObjectUtils.isEmpty(jsonArray)){ if (ObjectUtils.isEmpty(jsonArray)) {
return new ArrayList<>(); return new ArrayList<>();
} }
List<SiteTreeSelect> collect = jsonArray.stream().map(item -> { List<SiteTreeSelect> collect = jsonArray.stream().map(item -> {
...@@ -554,32 +555,100 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE ...@@ -554,32 +555,100 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE
return Rest.ok(allList); return Rest.ok(allList);
} }
private List<MatterEntity> getMatters(HashMap<String, String> params, Context context) {
String url = GlobalSysInfo.getParamValue(Constant.GOV_MATTER_PAGELIST_URL, "http://www.sczwfw.gov.cn/jiq/interface/item/tags");
Rest<Map<String, Integer>> restStat = MatterHtmlParseUtil.statSiteMatterCount(params, url);
if (restStat.getCode() == YesNoEnum.YES.getValue()) {
Integer pageNum = restStat.getData().getOrDefault("pageNum", 0);
Integer total = restStat.getData().getOrDefault("total", 0);
//获取事项全列表
Rest<List<MatterEntity>> matterAllRest = this.getMatterAllListByGOV(params, pageNum, context);
if (matterAllRest.getCode() == YesNoEnum.YES.getValue()) {
return matterAllRest.getData();
}
}
return new ArrayList<MatterEntity>();
}
@Override @Override
public Rest<String> syncMatterBySiteId(SiteEntity siteEntity, Context context) { public Rest<String> syncMatterBySiteId(SiteEntity siteEntity, Context context) {
//根据站点中区域编码 查询当前是否已经存在事项 //根据站点中区域编码 查询当前是否已经存在事项
//根据站点区域编码查询政务网事项列表 //根据站点区域编码查询政务网事项列表
AreaEntity areaEntity = areaService.getCache(siteEntity.getAreaCode()); AreaEntity areaEntity = areaService.getCache(siteEntity.getAreaCode());
String dxType = AreaLevelDxTypeEnum.getByValue(areaEntity == null ? 2 : areaEntity.getAreaLevel()).getDesc(); //String dxType = AreaLevelDxTypeEnum.getByValue(areaEntity == null ? 2 : areaEntity.getAreaLevel()).getDesc();
String url = GlobalSysInfo.getParamValue(Constant.GOV_MATTER_PAGELIST_URL, "http://www.sczwfw.gov.cn/jiq/interface/item/tags"); // String dxType="2";
HashMap<String, String> params = new HashMap<>(); //String dxType = "3";
List<MatterEntity> govMatterList = new ArrayList<>();
List<DeptEntity> deptEntities = deptService.find(new DeptQuery().siteId(siteEntity.getId()).source(0));
for (DeptEntity deptEntity : deptEntities) {
HashMap<String, String> params = new HashMap<>();
params.put("areaCode", areaEntity.getAreaCode());
params.put("dxType", "6");
params.put("deptCode", deptEntity.getDeptNumber());
params.put("searchtext", "");
params.put("taskType", "");
List<MatterEntity> deptMatterList = this.getMatters(params, context);
if (!ObjectUtils.isEmpty(deptMatterList)) {
govMatterList.addAll(deptMatterList);
}
}
/* HashMap<String, String> params = new HashMap<>();
params.put("dxType", dxType); params.put("dxType", dxType);
params.put("areaCode", siteEntity.getAreaCode()); params.put("areaCode", siteEntity.getAreaCode());
params.put("deptCode", ""); params.put("deptCode", "");
params.put("searchtext", ""); params.put("searchtext", "");
params.put("taskType", ""); params.put("taskType", "");
params.put("pageno", "1"); params.put("pageno", "1");
params.put("type", "2");
Rest<Map<String, Integer>> restStat = MatterHtmlParseUtil.statSiteMatterCount(params, url); List<MatterEntity> govMatterList = this.getMatters(params, context);
dxType = "3";
params = new HashMap<>();
params.put("dxType", dxType);
params.put("areaCode", siteEntity.getAreaCode());
params.put("deptCode", "");
params.put("searchtext", "");
params.put("taskType", "");
params.put("pageno", "1");
params.put("type", "2");
List<MatterEntity> mattersTwo = this.getMatters(params, context);
govMatterList.addAll(mattersTwo);*/
List<MatterEntity> localMatterList = matterService.find(new MatterQuery().areaCode(siteEntity.getAreaCode()));
List<MatterEntity> subList = this.subList(govMatterList, localMatterList);
log.info("抓取事项总数:{}需要添加事项数量:{}", govMatterList.size(), subList.size());
subList = subList.stream().distinct().collect(Collectors.toList());
log.info("需要添加事项过滤后数量:{}" , subList.size());
//差集进行插入并更新详细数据
if (!ObjectUtils.isEmpty(subList)) {
for (MatterEntity matterEntity : subList) {
DeptEntity deptCache = deptService.getExtCache(matterEntity.getDeptCode());
matterEntity.setDeptName(deptCache == null ? "" : deptCache.getName());
matterService.save(matterEntity, context);
}
/* List<List<MatterEntity>> partition = ListUtil.partition(subList, 100);
for (List<MatterEntity> matterEntityList : partition) {
log.info("insert subList size:" + matterEntityList.size());
int count = matterService.save(matterEntityList, context);
log.info("insert subList size success:" + count);
}*/
}
/* Rest<Map<String, Integer>> restStat = MatterHtmlParseUtil.statSiteMatterDeptCount(params, url);
if (restStat.getCode() == YesNoEnum.YES.getValue()) { if (restStat.getCode() == YesNoEnum.YES.getValue()) {
Integer pageNum = restStat.getData().getOrDefault("pageNum", 0); Integer pageNum = restStat.getData().getOrDefault("pageNum", 0);
Integer total = restStat.getData().getOrDefault("total", 0); Integer total = restStat.getData().getOrDefault("total", 0);
//获取事项全列表 //获取事项全列表
Rest<List<MatterEntity>> matterAllRest = this.getMatterAllListByGOV(params, pageNum, context); Rest<List<MatterEntity>> matterAllRest = this.getMatterAllListByGOV(params, pageNum, context);
if (total != matterAllRest.getData().size()) {
log.warn(String.format("抓取事项数量不一致,抓取计划:%d条 ,实际抓取:%d条", total, matterAllRest.getData().size()));
}
if (matterAllRest.getCode() == YesNoEnum.YES.getValue()) { if (matterAllRest.getCode() == YesNoEnum.YES.getValue()) {
List<MatterEntity> govMatterList = matterAllRest.getData(); List<MatterEntity> govMatterList = matterAllRest.getData();
List<MatterEntity> localMatterList = matterService.find(new MatterQuery().areaCode(siteEntity.getAreaCode())); List<MatterEntity> localMatterList = matterService.find(new MatterQuery().areaCode(siteEntity.getAreaCode()));
...@@ -602,7 +671,7 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE ...@@ -602,7 +671,7 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE
} }
} }
} }
*/
return Rest.ok("同步事项条数成功!"); return Rest.ok("同步事项条数成功!");
} }
......
...@@ -41,9 +41,6 @@ import java.util.regex.Pattern; ...@@ -41,9 +41,6 @@ import java.util.regex.Pattern;
@Service("siteThemeService") @Service("siteThemeService")
public class SiteThemeServiceImpl extends AbstractCRUDServiceImpl<SiteThemeDao, SiteThemeEntity, Long> implements SiteThemeService { public class SiteThemeServiceImpl extends AbstractCRUDServiceImpl<SiteThemeDao, SiteThemeEntity, Long> implements SiteThemeService {
@Autowired
private SiteService siteService;
@Override @Override
public Rest<String> syncThemeBySiteId(SiteEntity siteEntity, Context context) { public Rest<String> syncThemeBySiteId(SiteEntity siteEntity, Context context) {
...@@ -151,16 +148,21 @@ public class SiteThemeServiceImpl extends AbstractCRUDServiceImpl<SiteThemeDao, ...@@ -151,16 +148,21 @@ public class SiteThemeServiceImpl extends AbstractCRUDServiceImpl<SiteThemeDao,
public static void main(String[] args) { public static void main(String[] args) {
String str = "changeTheme('005', '1')"; String str = "ywblurl('http://www.sczwfw.gov.cn/jiq/front/transition/ywTransToDetail?areaCode=511500000000&amp;itemCode=511A0141700000-511500000000-000-125112007566044888-1-00&amp;taskType=1&amp;deptCode=511501-17','在公路增设或改造平面交叉道口审批')";
/*
String reg = "'.*?'"; String reg = "'.*?'";
Pattern compile = Pattern.compile(reg); Pattern compile = Pattern.compile(reg);
*/
List<String> allGroups = ReUtil.findAllGroup0(compile, str); List<String> allGroups = ReUtil.findAllGroup0("'(.*?)'", str);
allGroups.forEach(item -> { allGroups.forEach(item -> {
System.out.println(item); // System.out.println(item);
}); });
System.out.println(allGroups.get(0));
} }
} }
\ No newline at end of file
...@@ -184,7 +184,7 @@ public class WindowServiceImpl extends AbstractCRUDCacheServiceImpl<WindowDao, W ...@@ -184,7 +184,7 @@ public class WindowServiceImpl extends AbstractCRUDCacheServiceImpl<WindowDao, W
} }
private void pushChangeMsg(Long windowId) { private void pushChangeMsg(Long windowId) {
log.info("pushChangeMsg:{}", JSON.toJSONString(windowId)); // log.info("pushChangeMsg:{}", JSON.toJSONString(windowId));
String phpUrl = GlobalSysInfo.getParamValue(PARAM_SERVER_PHP_HTTP_URL, "http://172.15.28.116:8090"); String phpUrl = GlobalSysInfo.getParamValue(PARAM_SERVER_PHP_HTTP_URL, "http://172.15.28.116:8090");
phpUrl += "/api/window/winNameChange"; phpUrl += "/api/window/winNameChange";
HashMap<String, Object> paramsMap = new HashMap<>(); HashMap<String, Object> paramsMap = new HashMap<>();
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
LEFT JOIN ( SELECT matterCode FROM mortals_sys_site_matter LEFT JOIN ( SELECT matterCode FROM mortals_sys_site_matter
<trim suffixOverrides="where" suffix=""> <trim suffixOverrides="where" suffix="">
<if test="condition.siteId!=null and condition.siteId!=''"> <if test="condition.siteId!=null and condition.siteId!=''">
where siteId = #{condition.siteId,jdbcType=VARCHAR} where siteId = #{condition.siteId}
</if> </if>
</trim> </trim>
)AS b ON a.matterNo = b.matterCode )AS b ON a.matterNo = b.matterCode
......
...@@ -19,7 +19,7 @@ Content-Type: application/json ...@@ -19,7 +19,7 @@ Content-Type: application/json
{ {
"siteId":1, "siteId":1,
"idList": [1,2,3,4], "idList": [2,10,5,14,13,3,7,9,1],
"type": 1, "type": 1,
"shelves": 1, "shelves": 1,
"page":1, "page":1,
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment