集团对接接口开发
parent
f1d9e84018
commit
0057586ea5
|
|
@ -38,3 +38,4 @@ build/
|
|||
### Mac OS ###
|
||||
.DS_Store
|
||||
/.idea/
|
||||
/start/src/main/resources/templates/
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@
|
|||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<mainClass>com.zcloud.risk.Application</mainClass>
|
||||
<mainClass>com.zcloud.safety.Application</mainClass>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
spring:
|
||||
config:
|
||||
import:
|
||||
- classpath:nacos.yml
|
||||
- classpath:sdk.yml
|
||||
# - classpath:nacos.yml
|
||||
# - classpath:sdk.yml
|
||||
- classpath:nacos-prod.yml
|
||||
- classpath:sdk-prod.yml
|
||||
- classpath:swagger.yml
|
||||
|
|
|
|||
|
|
@ -0,0 +1,42 @@
|
|||
nacos:
|
||||
url: prod-nacos:8848
|
||||
namespace: jjb-dragon
|
||||
application:
|
||||
name: zcloud-gbs-safety-supervision
|
||||
version:
|
||||
gateway: safetySupervision
|
||||
cn-name: 集团工作数港推送模块
|
||||
spring:
|
||||
application:
|
||||
name: ${application.name}${application.version}
|
||||
profiles:
|
||||
# 环境配置
|
||||
active: test
|
||||
cloud:
|
||||
nacos:
|
||||
config:
|
||||
username: nacos
|
||||
password: u9Hc7tLFBY
|
||||
namespace: ${nacos.namespace}
|
||||
server-addr: ${nacos.url}
|
||||
file-extension: yml
|
||||
shared-configs:
|
||||
- config-common.yml
|
||||
- config-port.yml
|
||||
- config-mq.yml
|
||||
- config-log.yml
|
||||
- config-sdk-server.yml
|
||||
- config-actuator.yml
|
||||
- config-job.yml
|
||||
- config-mysql.yml
|
||||
- config-redis.yml
|
||||
- config-cache.yml
|
||||
- config-spring.yml
|
||||
- config-mybatis.yml
|
||||
- config-sdk.yml
|
||||
- config-flyway.yml
|
||||
discovery:
|
||||
server-addr: ${spring.cloud.nacos.config.server-addr}
|
||||
namespace: ${spring.cloud.nacos.config.namespace}
|
||||
username: nacos
|
||||
password: u9Hc7tLFBY
|
||||
|
|
@ -2,10 +2,10 @@ nacos:
|
|||
url: 192.168.20.100:30290
|
||||
namespace: jjb-dragon
|
||||
application:
|
||||
name: jjb-saas-zcloud-safety_supervision
|
||||
name: zcloud-gbs-safety-supervision
|
||||
version:
|
||||
gateway: safetySupervision
|
||||
cn-name: 集团安全监管平台
|
||||
cn-name: 集团工作数港推送模块
|
||||
spring:
|
||||
application:
|
||||
name: ${application.name}${application.version}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,72 @@
|
|||
sdk:
|
||||
server:
|
||||
app-key: 804ebaa29dc84fb39de9c0cef7edfd45
|
||||
client:
|
||||
gateway:
|
||||
url: ${common.gateway.network.http.external}
|
||||
route:
|
||||
- client:
|
||||
system-code: ${application.name}
|
||||
name: ${application.cn-name}-后端
|
||||
group-code: public_api
|
||||
service:
|
||||
system-code: ${application.name}
|
||||
name: ${application.cn-name}-后端
|
||||
group-code: public_api
|
||||
strip-prefix: 0
|
||||
uri: http://${application.name}
|
||||
path: /${application.gateway}/**
|
||||
- client:
|
||||
system-code: ${application.name}-container
|
||||
name: ${application.cn-name}-前端
|
||||
group-code: public_api
|
||||
service:
|
||||
system-code: ${application.name}-container
|
||||
name: ${application.cn-name}-前端
|
||||
group-code: public_api
|
||||
strip-prefix: 0
|
||||
uri: http://jjb-saas-base
|
||||
path: /${application.gateway}/container/**
|
||||
order: -2
|
||||
openapi:
|
||||
appId: 1871106785124999168
|
||||
appKey: 7314ecfc11ff4d5fad1ac19284ed2ac3
|
||||
appSecret: 7565ab15-a2ae-4830-9b4d-fb382cd5fb30
|
||||
appPublicKey: 3059301306072a8648ce3d020106082a811ccf5501822d03420004f339671110a06681fcfd968ad9247bd3cd0d2ec6b2159d1d4b775e7ed5566b3297d82cf14b626ef11fdd6bc7ecb6bcfb3ea94ccd1f381f4116f43367be4b360f
|
||||
appPrivateKey: 308193020100301306072a8648ce3d020106082a811ccf5501822d0479307702010104206b6abc8e717b7d042f1e8531190a7c18113e4a701417f2770d2150d33ba97779a00a06082a811ccf5501822da14403420004f339671110a06681fcfd968ad9247bd3cd0d2ec6b2159d1d4b775e7ed5566b3297d82cf14b626ef11fdd6bc7ecb6bcfb3ea94ccd1f381f4116f43367be4b360f
|
||||
encryptType: SM2
|
||||
platform:
|
||||
- name: default
|
||||
openPublicKey: 3059301306072a8648ce3d020106082a811ccf5501822d034200045b5d8fcad91e113910406db4caf0f5c6688048e0f46742d55f872a25855316803ddb177cc9bb5906ff0b2ad4d6b1f1378a49109104613e79b5b5512e3710e88f
|
||||
url: ${common.gateway.network.http.intranet}
|
||||
protocol: HTTP
|
||||
defaultPlatform: true
|
||||
##ciphertext plaintext
|
||||
type: plaintext
|
||||
apiPlatform:
|
||||
- name: default
|
||||
#多个可以逗号隔开
|
||||
apiCode: test:01
|
||||
#多个可以逗号隔开,可以为空
|
||||
tenantIds: 1838408702262321152
|
||||
|
||||
sm2:
|
||||
#数港使用
|
||||
public-key: MFkwEwYHKoZIzj0CAQYIKoEcz1UBgi0DQgAEm4xoDwZ6heM0jzHGNHrAQXCaOs0bwx5N/NzOA/oGyrvmTPhkBcm+dIAhCDxEIGERjRMKfKR/IygkgW8K4SDRrA==
|
||||
private-key: MIGTAgEAMBMGByqGSM49AgEGCCqBHM9VAYItBHkwdwIBAQQgHnH3HOprVgU8ipdM6Mxp5Oyx87BlHva96f2CVCkVOBygCgYIKoEcz1UBgi2hRANCAASbjGgPBnqF4zSPMcY0esBBcJo6zRvDHk383M4D+gbKu+ZM+GQFyb50gCEIPEQgYRGNEwp8pH8jKCSBbwrhINGs
|
||||
|
||||
sg:
|
||||
enabled: false
|
||||
url: http://10.168.11.13:8080/
|
||||
# url: http://safety.ngrok.shebaocard.com/
|
||||
token_url: /admin/login
|
||||
reference_url: /safety/experience/receive
|
||||
supervise_url: /safety/superviseInfo/feedback
|
||||
duty_url: /safety/statistics/receiveDutyStatistics
|
||||
calendar_url: /safety/safetyCalendar/receive
|
||||
accident_url: /safety/accidentReport/receive
|
||||
levelxgf_url: safety/firstRelevantParty/receive
|
||||
supervise_offline_url: safety/superviseInfo/offline/feedback
|
||||
message:
|
||||
code:
|
||||
forward: MS000145
|
||||
|
|
@ -14,7 +14,7 @@ sdk:
|
|||
name: ${application.cn-name}-后端
|
||||
group-code: public_api
|
||||
strip-prefix: 0
|
||||
uri: lb://${application.name}
|
||||
uri: http://${application.name}
|
||||
path: /${application.gateway}/**
|
||||
- client:
|
||||
system-code: ${application.name}-container
|
||||
|
|
@ -25,7 +25,7 @@ sdk:
|
|||
name: ${application.cn-name}-前端
|
||||
group-code: public_api
|
||||
strip-prefix: 0
|
||||
uri: lb://jjb-saas-base
|
||||
uri: http://jjb-saas-base
|
||||
path: /${application.gateway}/container/**
|
||||
order: -2
|
||||
openapi:
|
||||
|
|
@ -49,3 +49,26 @@ openapi:
|
|||
apiCode: test:01
|
||||
#多个可以逗号隔开,可以为空
|
||||
tenantIds: 1838408702262321152
|
||||
|
||||
sm2:
|
||||
#数港使用
|
||||
public-key: MFkwEwYHKoZIzj0CAQYIKoEcz1UBgi0DQgAEm4xoDwZ6heM0jzHGNHrAQXCaOs0bwx5N/NzOA/oGyrvmTPhkBcm+dIAhCDxEIGERjRMKfKR/IygkgW8K4SDRrA==
|
||||
private-key: MIGTAgEAMBMGByqGSM49AgEGCCqBHM9VAYItBHkwdwIBAQQgHnH3HOprVgU8ipdM6Mxp5Oyx87BlHva96f2CVCkVOBygCgYIKoEcz1UBgi2hRANCAASbjGgPBnqF4zSPMcY0esBBcJo6zRvDHk383M4D+gbKu+ZM+GQFyb50gCEIPEQgYRGNEwp8pH8jKCSBbwrhINGs
|
||||
|
||||
sg:
|
||||
enabled: false
|
||||
url: http://10.168.11.13:8080/
|
||||
# url: http://safety.ngrok.shebaocard.com/
|
||||
token_url: /admin/login
|
||||
reference_url: /safety/experience/receive
|
||||
supervise_url: /safety/superviseInfo/feedback
|
||||
duty_url: /safety/statistics/receiveDutyStatistics
|
||||
calendar_url: /safety/safetyCalendar/receive
|
||||
accident_url: /safety/accidentReport/receive
|
||||
levelxgf_url: safety/firstRelevantParty/receive
|
||||
supervise_offline_url: safety/superviseInfo/offline/feedback
|
||||
spring:
|
||||
servlet:
|
||||
multipart:
|
||||
# 关键配置:允许解析多个同名文件
|
||||
resolve-lazily: true
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
<!doctype html><html lang="zh"><head data-built-info="@cqsjjb/scripts@2.0.0-alpha-1 Env/production (2025/10/17 11:07:53) App/risk"><meta charset="UTF-8"/><meta name="renderer" content="webkit"/><meta http-equiv="X-UA-Compatible" content="IE=edge,Chrome=1"/><meta name="viewport" content="width=device-width,minimum-scale=1,maximum-scale=1,user-scalable=no,viewport-fit=cover"><title>--</title><script>(function () {
|
||||
const APP_ENV = {
|
||||
antd: {
|
||||
'ant-prefix': 'micro-temp',
|
||||
fontFamily: 'PingFangSC-Regular',
|
||||
colorPrimary: '#1677ff',
|
||||
borderRadius: parseInt('2')
|
||||
},
|
||||
appKey: '',
|
||||
basename: 'risk',
|
||||
API_HOST: ''
|
||||
};
|
||||
APP_ENV.API_HOST = sessionStorage.API_HOST || APP_ENV.API_HOST || window.location.origin;
|
||||
window.process = {
|
||||
env: { app: APP_ENV },
|
||||
NODE_ENV: 'production'
|
||||
};
|
||||
window.__JJB_ENVIRONMENT__ = {
|
||||
API_HOST: APP_ENV.API_HOST,
|
||||
redirect: '',
|
||||
FRAMEWORK: APP_ENV.antd
|
||||
};
|
||||
})();</script><script defer="defer" src="/risk/static/js/295.21df88c875577274cecb.js"></script><script defer="defer" src="/risk/static/js/main.4c0885586ad9a06ab444.js"></script><link href="/risk/static/css/main.40fc518bb0818fe8b8ea.css" rel="stylesheet"></head><body style="overflow: hidden"><noscript>此网页需要开启JavaScript功能。</noscript><div id="root" style="width: 100%; height: 100%; position: relative"></div><script type="text/javascript">/* @cqsjjb/script 输出当前应用基本信息、构建时间 */console.log("%c@cqsjjb/scripts@2.0.0-alpha-1 Env/production (2025/10/17 11:07:53) App/risk Version/master Java/<branch-name>", "color: #1890ff; border-radius: 2px; padding: 0 4px; border: 1px solid #1890ff; background: #f9fcff")</script></body></html>
|
||||
|
|
@ -1 +0,0 @@
|
|||
body,html{height:100%;width:100%}input::-ms-clear,input::-ms-reveal{display:none}*,:after,:before{box-sizing:border-box}html{font-family:sans-serif;line-height:1.15;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;-ms-overflow-style:scrollbar;-webkit-tap-highlight-color:rgba(0,0,0,0)}@-ms-viewport{width:device-width}body{margin:0}[tabindex="-1"]:focus{outline:none}hr{box-sizing:content-box;height:0;overflow:visible}h1,h2,h3,h4,h5,h6{font-weight:500;margin-bottom:.5em;margin-top:0}p{margin-bottom:1em;margin-top:0}abbr[data-original-title],abbr[title]{border-bottom:0;cursor:help;-webkit-text-decoration:underline dotted;text-decoration:underline dotted}address{font-style:normal;line-height:inherit;margin-bottom:1em}input[type=number],input[type=password],input[type=text],textarea{-webkit-appearance:none}dl,ol,ul{margin-bottom:1em;margin-top:0}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:500}dd{margin-bottom:.5em;margin-left:0}blockquote{margin:0 0 1em}dfn{font-style:italic}b,strong{font-weight:bolder}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}code,kbd,pre,samp{font-family:SFMono-Regular,Consolas,Liberation Mono,Menlo,Courier,monospace;font-size:1em}pre{margin-bottom:1em;margin-top:0;overflow:auto}figure{margin:0 0 1em}img{border-style:none;vertical-align:middle}[role=button],a,area,button,input:not([type=range]),label,select,summary,textarea{touch-action:manipulation}table{border-collapse:collapse}caption{caption-side:bottom;padding-bottom:.3em;padding-top:.75em;text-align:left}button,input,optgroup,select,textarea{color:inherit;font-family:inherit;font-size:inherit;line-height:inherit;margin:0}button,input{overflow:visible}button,select{text-transform:none}[type=reset],[type=submit],button,html [type=button]{-webkit-appearance:button}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{border-style:none;padding:0}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=date],input[type=datetime-local],input[type=month],input[type=time]{-webkit-appearance:listbox}textarea{overflow:auto;resize:vertical}fieldset{border:0;margin:0;min-width:0;padding:0}legend{color:inherit;display:block;font-size:1.5em;line-height:inherit;margin-bottom:.5em;max-width:100%;padding:0;white-space:normal;width:100%}progress{vertical-align:baseline}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:none;outline-offset:-2px}[type=search]::-webkit-search-cancel-button,[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}output{display:inline-block}summary{display:list-item}template{display:none}[hidden]{display:none!important}mark{background-color:#feffe6;padding:.2em}
|
||||
|
|
@ -1 +0,0 @@
|
|||
module.exports={compact:!1,plugins:[["@babel/plugin-proposal-decorators",{legacy:!0}]],presets:[["@babel/preset-env",{targets:{browsers:["ie >= 10"]}}],["@babel/preset-react",{runtime:"automatic"}]]};
|
||||
|
|
@ -1 +0,0 @@
|
|||
module.exports={javaGit:"<git-url>",javaGitName:"<git-name>",environment:{development:{javaGitBranch:"<branch-name>",API_HOST:"http://192.168.20.100:30140/demo2"},production:{javaGitBranch:"<branch-name>",API_HOST:""}},appIdentifier:"risk",contextInject:{appKey:""},windowInject:{title:"微应用模板",links:[],element:{root:{id:"root"}},scripts:[]},server:{port:"8080",host:"127.0.0.1",open:!0},framework:{antd:{"ant-prefix":"micro-temp",fontFamily:"PingFangSC-Regular",colorPrimary:"#1677ff",borderRadius:2}},webpackConfig:{htmlWebpackPluginOption:{inject:!0}}};
|
||||
File diff suppressed because one or more lines are too long
|
|
@ -1,135 +0,0 @@
|
|||
/*!
|
||||
Copyright (c) 2018 Jed Watson.
|
||||
Licensed under the MIT License (MIT), see
|
||||
http://jedwatson.github.io/classnames
|
||||
*/
|
||||
|
||||
/*!
|
||||
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
|
||||
*
|
||||
* Copyright (c) 2014-2017, Jon Schlinkert.
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
|
||||
/*!
|
||||
* isobject <https://github.com/jonschlinkert/isobject>
|
||||
*
|
||||
* Copyright (c) 2014-2017, Jon Schlinkert.
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
|
||||
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
|
||||
|
||||
/**
|
||||
* @license React
|
||||
* react-dom.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @license React
|
||||
* react-is.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @license React
|
||||
* react-jsx-runtime.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @license React
|
||||
* react.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @license React
|
||||
* scheduler.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
/** @license React v16.13.1
|
||||
* react-is.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
/** @license React v17.0.2
|
||||
* react-is.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
/** @preserve
|
||||
* Counter block mode compatible with Dr Brian Gladman fileenc.c
|
||||
* derived from CryptoJS.mode.CTR
|
||||
* Jan Hruby jhruby.web@gmail.com
|
||||
*/
|
||||
|
||||
/** @preserve
|
||||
(c) 2012 by Cédric Mesnil. All rights reserved.
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/** */
|
||||
|
||||
/** */
|
||||
|
||||
/** */
|
||||
|
||||
/** */
|
||||
|
||||
/** */
|
||||
|
||||
/** */
|
||||
|
||||
/** */
|
||||
|
||||
/** */
|
||||
|
||||
/** */
|
||||
|
||||
/** */
|
||||
|
||||
/** */
|
||||
|
||||
/** */
|
||||
|
||||
/** */
|
||||
|
||||
/** */
|
||||
|
||||
/** */
|
||||
|
||||
/** */
|
||||
File diff suppressed because one or more lines are too long
|
|
@ -1 +0,0 @@
|
|||
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
{
|
||||
"name": "micro-app",
|
||||
"version": "2.0.0",
|
||||
"description": "建教帮微应用模板",
|
||||
"author": "JJB",
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"serve": "node node_modules/@cqsjjb/scripts/webpack.dev.server.js",
|
||||
"build": "node node_modules/@cqsjjb/scripts/webpack.build.js",
|
||||
"push": "jjb-cmd push java production",
|
||||
"clean-cache": "rimraf node_modules/.cache/webpack",
|
||||
"serve:development": "cross-env NODE_ENV=development npm run serve",
|
||||
"serve:production": "cross-env NODE_ENV=production npm run serve",
|
||||
"build:development": "cross-env NODE_ENV=development npm run build",
|
||||
"build:production": "cross-env NODE_ENV=production npm run build",
|
||||
"code-optimization": "node node_modules/@cqsjjb/scripts/code-optimization.js",
|
||||
"lint": "eslint --ext .js,.jsx,.tsx --fix src"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ant-design/icons": "latest",
|
||||
"@cqsjjb/jjb-common-decorator": "latest",
|
||||
"@cqsjjb/jjb-common-lib": "latest",
|
||||
"@cqsjjb/jjb-dva-runtime": "latest",
|
||||
"@cqsjjb/jjb-react-admin-component": "latest",
|
||||
"ahooks": "^3.9.5",
|
||||
"antd": "latest",
|
||||
"dayjs": "^1.11.7",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@antfu/eslint-config": "^5.4.1",
|
||||
"@babel/plugin-proposal-decorators": "^7.19.3",
|
||||
"@cqsjjb/scripts": "latest",
|
||||
"@eslint-react/eslint-plugin": "^2.2.2",
|
||||
"cross-env": "^7.0.3",
|
||||
"eslint": "^9.37.0",
|
||||
"eslint-plugin-format": "^1.0.2",
|
||||
"eslint-plugin-react-hooks": "^7.0.0",
|
||||
"eslint-plugin-react-refresh": "^0.4.23",
|
||||
"typescript": "^5.9.3"
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1,92 @@
|
|||
package com.zcloud.safety.receive;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.zcloud.safety.api.SgCalendarServiceI;
|
||||
import com.zcloud.safety.domain.utils.EncryptAndDecryptUtil;
|
||||
import com.zcloud.safety.domain.utils.Result;
|
||||
import com.zcloud.safety.dto.receive.SgCalendarAuditDTO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiResponse;
|
||||
import io.swagger.annotations.ApiResponses;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
/**
|
||||
* 数港安全月历接收控制器。
|
||||
*/
|
||||
@RestController
|
||||
@ApiIgnore
|
||||
@Api(tags = "接收数港安全月历")
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/${application.gateway}/sg/calendar")
|
||||
public class BusCalendarController {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(BusCalendarController.class);
|
||||
private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
|
||||
private final SgCalendarServiceI sgCalendarService;
|
||||
|
||||
/**
|
||||
* 接收数港回传的审核结果,并更新本地审核状态。
|
||||
*/
|
||||
@PostMapping("/release")
|
||||
@ApiOperation(value = "接收数港安全月历审核结果", notes = "用于接收数港统计审核后的状态回传")
|
||||
@ApiResponses({
|
||||
@ApiResponse(code = 0, message = "成功"),
|
||||
@ApiResponse(code = 500, message = "服务器内部错误"),
|
||||
})
|
||||
public Result release(@RequestParam(value = "key") String key,
|
||||
@RequestParam(value = "value") String value) throws Exception {
|
||||
try {
|
||||
log.info("开始接收数港安全月历审核结果,key={},value={}", key,value);
|
||||
if (!StringUtils.hasText(key) || !StringUtils.hasText(value)) {
|
||||
log.warn("接收数港安全月历审核结果失败,请求参数缺失,key是否为空:{},value是否为空:{}", !StringUtils.hasText(key), !StringUtils.hasText(value));
|
||||
return new Result(400, "请求参数不能为空", null);
|
||||
}
|
||||
|
||||
String decryptValue = EncryptAndDecryptUtil.decryptSm4(EncryptAndDecryptUtil.decryptSm2(key), value);
|
||||
SgCalendarAuditDTO auditDTO = JSON.parseObject(decryptValue, SgCalendarAuditDTO.class);
|
||||
String validateMessage = validateAudit(auditDTO);
|
||||
if (validateMessage != null) {
|
||||
log.warn("接收数港安全月历审核结果失败,报文校验未通过,原因:{},解密报文:{}", validateMessage, decryptValue);
|
||||
return new Result(400, validateMessage, null);
|
||||
}
|
||||
|
||||
log.info("开始接收数港安全月历审核结果,本地主键:{},审核状态:{}", auditDTO.getNoticeId(), auditDTO.getAuditType());
|
||||
sgCalendarService.receiveAudit(auditDTO);
|
||||
log.info("接收数港安全月历审核结果成功,本地主键:{},审核状态:{}", auditDTO.getNoticeId(), auditDTO.getAuditType());
|
||||
return Result.ok("成功");
|
||||
} catch (Exception e) {
|
||||
log.error("接收数港安全月历审核结果失败,key长度:{}", key == null ? 0 : key.length(), e);
|
||||
return new Result(500, "数据传输失败", null);
|
||||
}
|
||||
}
|
||||
|
||||
private String validateAudit(SgCalendarAuditDTO auditDTO) {
|
||||
if (auditDTO == null) {
|
||||
return "安全月历审核报文不能为空";
|
||||
}
|
||||
if (auditDTO.getNoticeId() == null) {
|
||||
return "通知id不能为空";
|
||||
}
|
||||
if (!StringUtils.hasText(auditDTO.getAuditType())) {
|
||||
return "审核状态不能为空";
|
||||
}
|
||||
if (!"1".equals(auditDTO.getAuditType()) && !"2".equals(auditDTO.getAuditType())) {
|
||||
return "审核状态不正确";
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,109 @@
|
|||
package com.zcloud.safety.receive;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.zcloud.safety.api.SgInformServiceI;
|
||||
import com.zcloud.safety.domain.utils.EncryptAndDecryptUtil;
|
||||
import com.zcloud.safety.domain.utils.Result;
|
||||
import com.zcloud.safety.dto.receive.SgInformAddDTO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiResponse;
|
||||
import io.swagger.annotations.ApiResponses;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
/**
|
||||
* 数港通知接收控制器。
|
||||
*/
|
||||
@RestController
|
||||
@ApiIgnore
|
||||
@Api(tags = "接收数港通知")
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/${application.gateway}/sg/inform")
|
||||
public class BusInformController {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(BusInformController.class);
|
||||
private static final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
private final SgInformServiceI sgInformService;
|
||||
|
||||
/**
|
||||
* 接收数港推送的通知数据和附件。
|
||||
*/
|
||||
@PostMapping("/release")
|
||||
@ApiOperation(value = "接受数港通知", notes = "用于接收数港推送的通知数据")
|
||||
@ApiResponses({
|
||||
@ApiResponse(code = 0, message = "成功"),
|
||||
@ApiResponse(code = 500, message = "服务器内部错误"),
|
||||
})
|
||||
public Result release(@RequestParam(value = "file", required = false) MultipartFile[] files,
|
||||
@RequestParam(value = "key") String key,
|
||||
@RequestParam(value = "value") String value) throws Exception {
|
||||
try {
|
||||
int fileCount = files == null ? 0 : files.length;
|
||||
if (files != null) {
|
||||
for (MultipartFile file : files) {
|
||||
if (file != null) {
|
||||
log.info("接收数港通知数据,文件名:{}", file.getOriginalFilename());
|
||||
}
|
||||
}
|
||||
}
|
||||
log.info("开始接收数港通知数据,key={},value={},文件数量={}", key, value, fileCount);
|
||||
if (!StringUtils.hasText(key) || !StringUtils.hasText(value)) {
|
||||
log.warn("接收数港通知失败,请求参数缺失,key是否为空:{},value是否为空:{}", !StringUtils.hasText(key), !StringUtils.hasText(value));
|
||||
return new Result(400, "请求参数不能为空", null);
|
||||
}
|
||||
|
||||
String decryptValue = EncryptAndDecryptUtil.decryptSm4(EncryptAndDecryptUtil.decryptSm2(key), value);
|
||||
SgInformAddDTO inform = JSON.parseObject(decryptValue, SgInformAddDTO.class);
|
||||
String validateMessage = validateInform(inform);
|
||||
if (validateMessage != null) {
|
||||
log.warn("接收数港通知失败,报文校验未通过,原因:{},解密报文:{}", validateMessage, decryptValue);
|
||||
return new Result(400, validateMessage, null);
|
||||
}
|
||||
|
||||
log.info("开始接收数港通知数据,通知标题:{},附件数量:{}", inform.getInformTitle(), fileCount);
|
||||
sgInformService.addReceive(inform, key, files);
|
||||
log.info("接收数港通知数据成功,通知标题:{},附件数量:{}", inform.getInformTitle(), fileCount);
|
||||
return Result.ok("成功");
|
||||
} catch (Exception e) {
|
||||
log.error("接收数港通知数据失败,key长度:{},附件数量:{}", key == null ? 0 : key.length(), files == null ? 0 : files.length, e);
|
||||
return new Result(500, "数据传输失败", null);
|
||||
}
|
||||
}
|
||||
|
||||
private String validateInform(SgInformAddDTO inform) {
|
||||
if (inform == null) {
|
||||
return "通知报文不能为空";
|
||||
}
|
||||
if (!StringUtils.hasText(inform.getInformTitle())) {
|
||||
return "通知标题不能为空";
|
||||
}
|
||||
if (!StringUtils.hasText(inform.getInformContent())) {
|
||||
return "通知内容不能为空";
|
||||
}
|
||||
if (!StringUtils.hasText(inform.getCreateBy())) {
|
||||
return "创建人不能为空";
|
||||
}
|
||||
if (!StringUtils.hasText(inform.getCreateTime())) {
|
||||
return "创建时间不能为空";
|
||||
}
|
||||
try {
|
||||
LocalDateTime.parse(inform.getCreateTime().trim(), DATE_TIME_FORMATTER);
|
||||
} catch (Exception e) {
|
||||
return "创建时间格式不正确";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,94 @@
|
|||
package com.zcloud.safety.receive;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.zcloud.safety.api.SgNoticeServiceI;
|
||||
import com.zcloud.safety.domain.utils.EncryptAndDecryptUtil;
|
||||
import com.zcloud.safety.domain.utils.Result;
|
||||
import com.zcloud.safety.dto.receive.SgNoticeAddDTO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiResponse;
|
||||
import io.swagger.annotations.ApiResponses;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
/**
|
||||
* 数港公告接收控制器。
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "接收数港公告")
|
||||
@ApiIgnore
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/${application.gateway}/sg/notice")
|
||||
public class BusNoticeController {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(BusNoticeController.class);
|
||||
|
||||
private final SgNoticeServiceI sgNoticeService;
|
||||
|
||||
/**
|
||||
* 接收数港推送的公告数据和附件。
|
||||
*/
|
||||
@PostMapping("/release")
|
||||
@ApiOperation(value = "接受数港公告", notes = "用于接收数港推送的公告数据")
|
||||
@ApiResponses({
|
||||
@ApiResponse(code = 200, message = "成功"),
|
||||
@ApiResponse(code = 500, message = "服务器内部错误"),
|
||||
})
|
||||
public Result release(@RequestParam(value = "file", required = false) MultipartFile[] files,
|
||||
@RequestParam(value = "key") String key,
|
||||
@RequestParam(value = "value") String value) {
|
||||
try {
|
||||
int fileCount = files == null ? 0 : files.length;
|
||||
if (files != null) {
|
||||
for (MultipartFile file : files) {
|
||||
if (file != null) {
|
||||
log.info("接收数港公告数据,文件名:{}", file.getOriginalFilename());
|
||||
}
|
||||
}
|
||||
}
|
||||
log.info("开始接收数港公告数据,key={},value={},文件数量={}", key, value, fileCount);
|
||||
if (!StringUtils.hasText(key) || !StringUtils.hasText(value)) {
|
||||
log.warn("接收数港公告失败,请求参数缺失,key是否为空:{},value是否为空:{}", !StringUtils.hasText(key), !StringUtils.hasText(value));
|
||||
return new Result(400, "请求参数不能为空", null);
|
||||
}
|
||||
|
||||
String decryptValue = EncryptAndDecryptUtil.decryptSm4(EncryptAndDecryptUtil.decryptSm2(key), value);
|
||||
SgNoticeAddDTO notice = JSON.parseObject(decryptValue, SgNoticeAddDTO.class);
|
||||
String validateMessage = validateNotice(notice);
|
||||
if (validateMessage != null) {
|
||||
log.warn("接收数港公告失败,报文校验未通过,原因:{},解密报文:{}", validateMessage, decryptValue);
|
||||
return new Result(400, validateMessage, null);
|
||||
}
|
||||
|
||||
log.info("开始接收数港公告数据,公告业务主键:{},附件数量:{}", notice.getNoticeId(), fileCount);
|
||||
sgNoticeService.addReceive(notice, key, files);
|
||||
log.info("接收数港公告数据成功,公告业务主键:{},附件数量:{}", notice.getNoticeId(), fileCount);
|
||||
return Result.ok("成功");
|
||||
} catch (Exception e) {
|
||||
log.error("接收数港公告数据失败,key长度:{},附件数量:{}", key == null ? 0 : key.length(), files == null ? 0 : files.length, e);
|
||||
return new Result(500, "数据传输失败", null);
|
||||
}
|
||||
}
|
||||
|
||||
private String validateNotice(SgNoticeAddDTO notice) {
|
||||
if (notice == null) {
|
||||
return "公告报文不能为空";
|
||||
}
|
||||
if (!StringUtils.hasText(notice.getNoticeTitle())) {
|
||||
return "公告标题不能为空";
|
||||
}
|
||||
if (!StringUtils.hasText(notice.getNoticeContent())) {
|
||||
return "公告内容不能为空";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,102 @@
|
|||
package com.zcloud.safety.receive;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.zcloud.safety.api.SgReferenceServiceI;
|
||||
import com.zcloud.safety.domain.utils.EncryptAndDecryptUtil;
|
||||
import com.zcloud.safety.domain.utils.Result;
|
||||
import com.zcloud.safety.dto.receive.SgReferenceReceiveDTO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiResponse;
|
||||
import io.swagger.annotations.ApiResponses;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
/**
|
||||
* 数港互学互鉴接收控制器。
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "接收数港互学互鉴")
|
||||
@ApiIgnore
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/${application.gateway}/sg/reference")
|
||||
public class BusReferenceController {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(BusReferenceController.class);
|
||||
private static final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
private final SgReferenceServiceI sgReferenceService;
|
||||
|
||||
/**
|
||||
* 接收数港推送的互学互鉴数据,附件按既有加密协议支持多文件。
|
||||
*/
|
||||
@PostMapping("/release")
|
||||
@ApiOperation(value = "接收数港互学互鉴", notes = "用于接收数港推送的互学互鉴数据")
|
||||
@ApiResponses({
|
||||
@ApiResponse(code = 0, message = "成功"),
|
||||
@ApiResponse(code = 500, message = "服务器内部错误"),
|
||||
})
|
||||
public Result release(@RequestParam(value = "file", required = false) MultipartFile[] files,
|
||||
@RequestParam(value = "key") String key,
|
||||
@RequestParam(value = "value") String value) {
|
||||
try {
|
||||
int fileCount = files == null ? 0 : files.length;
|
||||
if (files != null) {
|
||||
for (MultipartFile file : files) {
|
||||
if (file != null) {
|
||||
log.info("接收数港互学互鉴数据,文件名:{}", file.getOriginalFilename());
|
||||
}
|
||||
}
|
||||
}
|
||||
log.info("开始接收数港互学互鉴数据,key={},value={},文件数量={}", key, value, fileCount);
|
||||
if (!StringUtils.hasText(key) || !StringUtils.hasText(value)) {
|
||||
log.warn("接收数港互学互鉴失败,请求参数缺失,key是否为空:{},value是否为空:{}", !StringUtils.hasText(key), !StringUtils.hasText(value));
|
||||
return new Result(400, "请求参数不能为空", null);
|
||||
}
|
||||
|
||||
String decryptValue = EncryptAndDecryptUtil.decryptSm4(EncryptAndDecryptUtil.decryptSm2(key), value);
|
||||
SgReferenceReceiveDTO reference = JSON.parseObject(decryptValue, SgReferenceReceiveDTO.class);
|
||||
String validateMessage = validateReference(reference);
|
||||
if (validateMessage != null) {
|
||||
log.warn("接收数港互学互鉴失败,报文校验未通过,原因:{},解密报文:{}", validateMessage, decryptValue);
|
||||
return new Result(400, validateMessage, null);
|
||||
}
|
||||
|
||||
log.info("开始接收数港互学互鉴,事故经验id:{},附件数量:{}", reference.getAccidentId(), fileCount);
|
||||
sgReferenceService.addReceive(reference, key, files);
|
||||
log.info("接收数港互学互鉴成功,事故经验id:{},附件数量:{}", reference.getAccidentId(), fileCount);
|
||||
return Result.ok("成功");
|
||||
} catch (Exception e) {
|
||||
log.error("接收数港互学互鉴失败,key长度:{},附件数量:{}", key == null ? 0 : key.length(), files == null ? 0 : files.length, e);
|
||||
return new Result(500, "数据传输失败", null);
|
||||
}
|
||||
}
|
||||
|
||||
private String validateReference(SgReferenceReceiveDTO reference) {
|
||||
if (reference == null) {
|
||||
return "互学互鉴报文不能为空";
|
||||
}
|
||||
if (!StringUtils.hasText(reference.getTitle())) {
|
||||
return "标题不能为空";
|
||||
}
|
||||
if (StringUtils.hasText(reference.getCreateTime())) {
|
||||
try {
|
||||
LocalDateTime.parse(reference.getCreateTime().trim(), DATE_TIME_FORMATTER);
|
||||
} catch (Exception e) {
|
||||
return "创建时间格式不正确";
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,96 @@
|
|||
package com.zcloud.safety.receive;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.zcloud.safety.api.SgSuperviseServiceI;
|
||||
import com.zcloud.safety.domain.utils.EncryptAndDecryptUtil;
|
||||
import com.zcloud.safety.domain.utils.Result;
|
||||
import com.zcloud.safety.dto.receive.SgSuperviseAddDTO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiResponse;
|
||||
import io.swagger.annotations.ApiResponses;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
/**
|
||||
* 数港督办接收控制器。
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "接收数港督办")
|
||||
@ApiIgnore
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/${application.gateway}/sg/supervise")
|
||||
public class BusSuperviseController {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(BusSuperviseController.class);
|
||||
|
||||
private final SgSuperviseServiceI sgSuperviseService;
|
||||
|
||||
/**
|
||||
* 接收数港推送的督办数据和附件。
|
||||
*/
|
||||
@PostMapping("/release")
|
||||
@ApiOperation(value = "接受数港督办", notes = "用于接收数港推送的督办数据")
|
||||
@ApiResponses({
|
||||
@ApiResponse(code = 0, message = "成功"),
|
||||
@ApiResponse(code = 500, message = "服务器内部错误"),
|
||||
})
|
||||
public Result release(@RequestParam(value = "file", required = false) MultipartFile[] files,
|
||||
@RequestParam(value = "key") String key,
|
||||
@RequestParam(value = "value") String value) throws Exception {
|
||||
try {
|
||||
int fileCount = files == null ? 0 : files.length;
|
||||
log.info("开始接收数港督办数据,key={},value={},文件数量={}", key, value, fileCount);
|
||||
if (!StringUtils.hasText(key) || !StringUtils.hasText(value)) {
|
||||
log.warn("接收数港督办失败,请求参数缺失,key是否为空:{},value是否为空:{}", !StringUtils.hasText(key), !StringUtils.hasText(value));
|
||||
return new Result(400, "请求参数不能为空", null);
|
||||
}
|
||||
String decryptValue = EncryptAndDecryptUtil.decryptSm4(EncryptAndDecryptUtil.decryptSm2(key), value);
|
||||
SgSuperviseAddDTO supervise = JSON.parseObject(decryptValue, SgSuperviseAddDTO.class);
|
||||
String validateMessage = validateSupervise(supervise);
|
||||
if (validateMessage != null) {
|
||||
log.warn("接收数港督办失败,报文校验未通过,原因:{},解密报文:{}", validateMessage, decryptValue);
|
||||
return new Result(400, validateMessage, null);
|
||||
}
|
||||
|
||||
log.info("开始接收数港督办数据,督办id:{},附件数量:{}", supervise.getSuperviseId(), fileCount);
|
||||
sgSuperviseService.addReceive(supervise, key, files);
|
||||
log.info("接收数港督办数据成功,督办id:{},附件数量:{}", supervise.getSuperviseId(), fileCount);
|
||||
return Result.ok("成功");
|
||||
} catch (Exception e) {
|
||||
log.error("接收数港督办数据失败,key长度:{},附件数量:{}", key == null ? 0 : key.length(), files == null ? 0 : files.length, e);
|
||||
return new Result(500, "数据传输失败", null);
|
||||
}
|
||||
}
|
||||
|
||||
private String validateSupervise(SgSuperviseAddDTO supervise) {
|
||||
if (supervise == null) {
|
||||
return "督办报文不能为空";
|
||||
}
|
||||
if (supervise.getSuperviseId() == null) {
|
||||
return "督办id不能为空";
|
||||
}
|
||||
if (!StringUtils.hasText(supervise.getSuperviseTitle())) {
|
||||
return "督办标题不能为空";
|
||||
}
|
||||
if (!StringUtils.hasText(supervise.getSuperviseContent())) {
|
||||
return "督办内容不能为空";
|
||||
}
|
||||
if (!StringUtils.hasText(supervise.getSuperviseStartTime())) {
|
||||
return "督办开始时间不能为空";
|
||||
}
|
||||
if (!StringUtils.hasText(supervise.getSuperviseFinishTime())) {
|
||||
return "督办结束时间不能为空";
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -5,13 +5,13 @@ import com.alibaba.cola.dto.MultiResponse;
|
|||
import com.alibaba.cola.dto.PageResponse;
|
||||
import com.alibaba.cola.dto.Response;
|
||||
import com.alibaba.cola.dto.SingleResponse;
|
||||
import com.zcloud.safety.api.RiskPointServiceI;
|
||||
import com.zcloud.safety.dto.RiskPointAddCmd;
|
||||
import com.zcloud.safety.dto.RiskPointPageQry;
|
||||
import com.zcloud.safety.dto.RiskPointUpdateCmd;
|
||||
import com.zcloud.safety.dto.clientobject.RiskPointCo;
|
||||
import com.jjb.saas.framework.auth.model.SSOUser;
|
||||
import com.jjb.saas.framework.auth.utils.AuthContext;
|
||||
import com.zcloud.safety.api.ImgFilesServiceI;
|
||||
import com.zcloud.safety.dto.ImgFilesAddCmd;
|
||||
import com.zcloud.safety.dto.ImgFilesPageQry;
|
||||
import com.zcloud.safety.dto.ImgFilesUpdateCmd;
|
||||
import com.zcloud.safety.dto.clientobject.ImgFilesCO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
|
@ -21,58 +21,62 @@ import org.springframework.web.bind.annotation.*;
|
|||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* @author lin
|
||||
* web-adapter
|
||||
*
|
||||
* @Author zhaokai
|
||||
* @Date 2026-06-01 14:27:17
|
||||
*/
|
||||
@Api(tags = "风险点管理")
|
||||
@RequestMapping("/risk/riskPoint")
|
||||
@Api(tags = "图片信息表")
|
||||
@RequestMapping("/${application.gateway}/imgFiles")
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
public class RiskPointController {
|
||||
private final RiskPointServiceI riskPointService;
|
||||
public class ImgFilesController {
|
||||
private final ImgFilesServiceI imgFilesService;
|
||||
|
||||
@ApiOperation("新增")
|
||||
@PostMapping("/save")
|
||||
public SingleResponse<RiskPointCo> add(@Validated @RequestBody RiskPointAddCmd cmd) {
|
||||
public SingleResponse<ImgFilesCO> add(@Validated @RequestBody ImgFilesAddCmd cmd) {
|
||||
SSOUser ssoUser = AuthContext.getCurrentUser();
|
||||
return riskPointService.add(cmd);
|
||||
return imgFilesService.add(cmd);
|
||||
}
|
||||
|
||||
@ApiOperation("分页")
|
||||
@PostMapping("/list")
|
||||
public PageResponse<RiskPointCo> page(@RequestBody RiskPointPageQry qry) {
|
||||
return riskPointService.listPage(qry);
|
||||
public PageResponse<ImgFilesCO> page(@RequestBody ImgFilesPageQry qry) {
|
||||
return imgFilesService.listPage(qry);
|
||||
}
|
||||
|
||||
@ApiOperation("所有数据")
|
||||
@GetMapping("/listAll")
|
||||
public MultiResponse<RiskPointCo> listAll() {
|
||||
return MultiResponse.of(new ArrayList<RiskPointCo>());
|
||||
public MultiResponse<ImgFilesCO> listAll() {
|
||||
return MultiResponse.of(new ArrayList<ImgFilesCO>());
|
||||
}
|
||||
|
||||
@ApiOperation("详情")
|
||||
@GetMapping("/{id}")
|
||||
public SingleResponse<RiskPointCo> getInfoById(@PathVariable("id") Long id) {
|
||||
return SingleResponse.of(new RiskPointCo());
|
||||
public SingleResponse<ImgFilesCO> getInfoById(@PathVariable("id") Long id) {
|
||||
return SingleResponse.of(new ImgFilesCO());
|
||||
}
|
||||
|
||||
@ApiOperation("删除")
|
||||
@DeleteMapping("/{id}")
|
||||
public Response remove(@PathVariable("id") Long id) {
|
||||
riskPointService.remove(id);
|
||||
imgFilesService.remove(id);
|
||||
return SingleResponse.buildSuccess();
|
||||
}
|
||||
|
||||
@ApiOperation("删除多个")
|
||||
@DeleteMapping("/ids")
|
||||
public Response removeBatch(@RequestParam Long[] ids) {
|
||||
riskPointService.removeBatch(ids);
|
||||
imgFilesService.removeBatch(ids);
|
||||
return SingleResponse.buildSuccess();
|
||||
}
|
||||
|
||||
@ApiOperation("修改")
|
||||
@PutMapping("/edit")
|
||||
public SingleResponse edit(@Validated @RequestBody RiskPointUpdateCmd riskPointUpdateCmd) {
|
||||
riskPointService.edit(riskPointUpdateCmd);
|
||||
public SingleResponse edit(@Validated @RequestBody ImgFilesUpdateCmd imgFilesUpdateCmd) {
|
||||
imgFilesService.edit(imgFilesUpdateCmd);
|
||||
return SingleResponse.buildSuccess();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
package com.zcloud.safety.web;
|
||||
|
||||
import com.alibaba.cola.dto.PageResponse;
|
||||
import com.alibaba.cola.dto.Response;
|
||||
import com.alibaba.cola.dto.SingleResponse;
|
||||
import com.zcloud.safety.api.SgAccidentServiceI;
|
||||
import com.zcloud.safety.dto.SgAccidentAddCmd;
|
||||
import com.zcloud.safety.dto.SgAccidentPageQry;
|
||||
import com.zcloud.safety.dto.SgAccidentUpdateCmd;
|
||||
import com.zcloud.safety.dto.clientobject.SgAccidentCO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 事故上报控制器。
|
||||
*/
|
||||
@Api(tags = "事故上报")
|
||||
@RequestMapping("/${application.gateway}/sgAccident")
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
public class SgAccidentController {
|
||||
|
||||
private final SgAccidentServiceI sgAccidentService;
|
||||
|
||||
@ApiOperation("新增")
|
||||
@PostMapping("/save")
|
||||
public SingleResponse<SgAccidentCO> add(@Validated SgAccidentAddCmd cmd) {
|
||||
return sgAccidentService.add(cmd);
|
||||
}
|
||||
|
||||
@ApiOperation("分页")
|
||||
@PostMapping("/list")
|
||||
public PageResponse<SgAccidentCO> page(@RequestBody SgAccidentPageQry qry) {
|
||||
return sgAccidentService.listPage(qry);
|
||||
}
|
||||
|
||||
@ApiOperation("详情")
|
||||
@GetMapping("/{id}")
|
||||
public SingleResponse<SgAccidentCO> getInfoById(@PathVariable("id") Long id) {
|
||||
return sgAccidentService.getInfoById(id);
|
||||
}
|
||||
|
||||
@ApiOperation("删除")
|
||||
@PostMapping("/{id}")
|
||||
public Response remove(@PathVariable("id") Long id) {
|
||||
sgAccidentService.remove(id);
|
||||
return SingleResponse.buildSuccess();
|
||||
}
|
||||
|
||||
@ApiOperation("修改")
|
||||
@PostMapping("/edit")
|
||||
public SingleResponse<SgAccidentCO> edit(@Validated SgAccidentUpdateCmd cmd) {
|
||||
sgAccidentService.edit(cmd);
|
||||
return SingleResponse.buildSuccess();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
package com.zcloud.safety.web;
|
||||
|
||||
import com.alibaba.cola.dto.PageResponse;
|
||||
import com.alibaba.cola.dto.Response;
|
||||
import com.alibaba.cola.dto.SingleResponse;
|
||||
import com.zcloud.safety.api.SgCalendarServiceI;
|
||||
import com.zcloud.safety.dto.SgCalendarAddCmd;
|
||||
import com.zcloud.safety.dto.SgCalendarPageQry;
|
||||
import com.zcloud.safety.dto.SgCalendarUpdateCmd;
|
||||
import com.zcloud.safety.dto.clientobject.SgCalendarCO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 安全月历控制器。
|
||||
*/
|
||||
@Api(tags = "安全月历")
|
||||
@RequestMapping("/${application.gateway}/sgCalendar")
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
public class SgCalendarController {
|
||||
|
||||
private final SgCalendarServiceI sgCalendarService;
|
||||
|
||||
@ApiOperation("新增")
|
||||
@PostMapping("/save")
|
||||
public SingleResponse<SgCalendarCO> add(@Validated SgCalendarAddCmd cmd) {
|
||||
return sgCalendarService.add(cmd);
|
||||
}
|
||||
|
||||
@ApiOperation("分页")
|
||||
@PostMapping("/list")
|
||||
public PageResponse<SgCalendarCO> page(@RequestBody SgCalendarPageQry qry) {
|
||||
return sgCalendarService.listPage(qry);
|
||||
}
|
||||
|
||||
@ApiOperation("详情")
|
||||
@GetMapping("/{id}")
|
||||
public SingleResponse<SgCalendarCO> getInfoById(@PathVariable("id") Long id) {
|
||||
return sgCalendarService.getInfoById(id);
|
||||
}
|
||||
|
||||
@ApiOperation("删除")
|
||||
@PostMapping("/{id}")
|
||||
public Response remove(@PathVariable("id") Long id) {
|
||||
sgCalendarService.remove(id);
|
||||
return SingleResponse.buildSuccess();
|
||||
}
|
||||
/*
|
||||
@ApiOperation("删除多个")
|
||||
@DeleteMapping("/ids")
|
||||
public Response removeBatch(@RequestParam Long[] ids) {
|
||||
sgCalendarService.removeBatch(ids);
|
||||
return SingleResponse.buildSuccess();
|
||||
}*/
|
||||
|
||||
@ApiOperation("修改")
|
||||
@PostMapping("/edit")
|
||||
public SingleResponse<SgCalendarCO> edit(@Validated SgCalendarUpdateCmd cmd) {
|
||||
sgCalendarService.edit(cmd);
|
||||
return SingleResponse.buildSuccess();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
package com.zcloud.safety.web;
|
||||
|
||||
import com.alibaba.cola.dto.PageResponse;
|
||||
import com.alibaba.cola.dto.Response;
|
||||
import com.alibaba.cola.dto.SingleResponse;
|
||||
import com.zcloud.safety.api.SgDutyServiceI;
|
||||
import com.zcloud.safety.dto.SgDutyAddCmd;
|
||||
import com.zcloud.safety.dto.SgDutyPageQry;
|
||||
import com.zcloud.safety.dto.SgDutyUpdateCmd;
|
||||
import com.zcloud.safety.dto.clientobject.SgDutyCO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 值班统计控制器。
|
||||
*/
|
||||
@Api(tags = "值班统计")
|
||||
@RequestMapping("/${application.gateway}/sgDuty")
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
public class SgDutyController {
|
||||
|
||||
private final SgDutyServiceI sgDutyService;
|
||||
|
||||
@ApiOperation("新增")
|
||||
@PostMapping("/save")
|
||||
public SingleResponse<SgDutyCO> add(@Validated @RequestBody SgDutyAddCmd cmd) {
|
||||
return sgDutyService.add(cmd);
|
||||
}
|
||||
|
||||
@ApiOperation("分页")
|
||||
@PostMapping("/list")
|
||||
public PageResponse<SgDutyCO> page(@RequestBody SgDutyPageQry qry) {
|
||||
return sgDutyService.listPage(qry);
|
||||
}
|
||||
|
||||
@ApiOperation("详情")
|
||||
@GetMapping("/{id}")
|
||||
public SingleResponse<SgDutyCO> getInfoById(@PathVariable("id") Long id) {
|
||||
return sgDutyService.getInfoById(id);
|
||||
}
|
||||
|
||||
@ApiOperation("删除")
|
||||
@PostMapping("/{id}")
|
||||
public Response remove(@PathVariable("id") Long id) {
|
||||
sgDutyService.remove(id);
|
||||
return SingleResponse.buildSuccess();
|
||||
}
|
||||
/*
|
||||
@ApiOperation("删除多个")
|
||||
@DeleteMapping("/ids")
|
||||
public Response removeBatch(@RequestParam Long[] ids) {
|
||||
sgDutyService.removeBatch(ids);
|
||||
return SingleResponse.buildSuccess();
|
||||
}*/
|
||||
|
||||
@ApiOperation("修改")
|
||||
@PostMapping("/edit")
|
||||
public SingleResponse<SgDutyCO> edit(@Validated @RequestBody SgDutyUpdateCmd cmd) {
|
||||
sgDutyService.edit(cmd);
|
||||
return SingleResponse.buildSuccess();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
package com.zcloud.safety.web;
|
||||
|
||||
import com.alibaba.cola.dto.PageResponse;
|
||||
import com.alibaba.cola.dto.Response;
|
||||
import com.alibaba.cola.dto.SingleResponse;
|
||||
import com.jjb.saas.framework.auth.model.SSOUser;
|
||||
import com.jjb.saas.framework.auth.utils.AuthContext;
|
||||
import com.zcloud.safety.api.SgInformServiceI;
|
||||
import com.zcloud.safety.dto.SgInformAddCmd;
|
||||
import com.zcloud.safety.dto.SgInformPageQry;
|
||||
import com.zcloud.safety.dto.SgInformUpdateCmd;
|
||||
import com.zcloud.safety.dto.clientobject.SgInformCO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 通知表控制器。
|
||||
*/
|
||||
@Api(tags = "通知表")
|
||||
@RequestMapping("/${application.gateway}/sgInform")
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
public class SgInformController {
|
||||
|
||||
private final SgInformServiceI sgInformService;
|
||||
|
||||
/* @ApiOperation("新增")
|
||||
@PostMapping("/save")
|
||||
public SingleResponse<SgInformCO> add(@Validated @RequestBody SgInformAddCmd cmd) {
|
||||
SSOUser ssoUser = AuthContext.getCurrentUser();
|
||||
return sgInformService.add(cmd);
|
||||
}*/
|
||||
|
||||
@ApiOperation("分页")
|
||||
@PostMapping("/list")
|
||||
public PageResponse<SgInformCO> page(@RequestBody SgInformPageQry qry) {
|
||||
return sgInformService.listPage(qry);
|
||||
}
|
||||
|
||||
@ApiOperation("详情")
|
||||
@GetMapping("/{id}")
|
||||
public SingleResponse<SgInformCO> getInfoById(@PathVariable("id") Long id) {
|
||||
return sgInformService.getInfoById(id);
|
||||
}
|
||||
/*
|
||||
@ApiOperation("删除")
|
||||
@DeleteMapping("/{id}")
|
||||
public Response remove(@PathVariable("id") Long id) {
|
||||
sgInformService.remove(id);
|
||||
return SingleResponse.buildSuccess();
|
||||
}
|
||||
|
||||
@ApiOperation("删除多个")
|
||||
@DeleteMapping("/ids")
|
||||
public Response removeBatch(@RequestParam Long[] ids) {
|
||||
sgInformService.removeBatch(ids);
|
||||
return SingleResponse.buildSuccess();
|
||||
}
|
||||
|
||||
@ApiOperation("修改")
|
||||
@PutMapping("/edit")
|
||||
public SingleResponse edit(@Validated @RequestBody SgInformUpdateCmd sgInformUpdateCmd) {
|
||||
sgInformService.edit(sgInformUpdateCmd);
|
||||
return SingleResponse.buildSuccess();
|
||||
}*/
|
||||
}
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
package com.zcloud.safety.web;
|
||||
|
||||
import com.alibaba.cola.dto.MultiResponse;
|
||||
import com.alibaba.cola.dto.PageResponse;
|
||||
import com.alibaba.cola.dto.Response;
|
||||
import com.alibaba.cola.dto.SingleResponse;
|
||||
import com.jjb.saas.framework.auth.model.SSOUser;
|
||||
import com.jjb.saas.framework.auth.utils.AuthContext;
|
||||
import com.zcloud.safety.api.SgNoticeServiceI;
|
||||
import com.zcloud.safety.dto.SgNoticeAddCmd;
|
||||
import com.zcloud.safety.dto.SgNoticePageQry;
|
||||
import com.zcloud.safety.dto.clientobject.SgNoticeCO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
/**
|
||||
* 公告表控制器。
|
||||
*/
|
||||
@Api(tags = "公告表")
|
||||
@RequestMapping("/${application.gateway}/sgNotice")
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
public class SgNoticeController {
|
||||
|
||||
private final SgNoticeServiceI sgNoticeService;
|
||||
|
||||
/* @ApiOperation("新增")
|
||||
@PostMapping("/save")
|
||||
public SingleResponse<SgNoticeCO> add(@Validated @RequestBody SgNoticeAddCmd cmd) {
|
||||
SSOUser ssoUser = AuthContext.getCurrentUser();
|
||||
return sgNoticeService.add(cmd);
|
||||
}*/
|
||||
|
||||
@ApiOperation("分页")
|
||||
@PostMapping("/list")
|
||||
public PageResponse<SgNoticeCO> page(@RequestBody SgNoticePageQry qry) {
|
||||
return sgNoticeService.listPage(qry);
|
||||
}
|
||||
|
||||
@ApiOperation("详情")
|
||||
@GetMapping("/{id}")
|
||||
public SingleResponse<SgNoticeCO> getInfoById(@PathVariable("id") Long id) {
|
||||
return sgNoticeService.getInfoById(id);
|
||||
}
|
||||
/*
|
||||
@ApiOperation("删除")
|
||||
@DeleteMapping("/{id}")
|
||||
public Response remove(@PathVariable("id") Long id) {
|
||||
sgNoticeService.remove(id);
|
||||
return SingleResponse.buildSuccess();
|
||||
}
|
||||
|
||||
@ApiOperation("删除多个")
|
||||
@DeleteMapping("/ids")
|
||||
public Response removeBatch(@RequestParam Long[] ids) {
|
||||
sgNoticeService.removeBatch(ids);
|
||||
return SingleResponse.buildSuccess();
|
||||
}
|
||||
|
||||
@ApiOperation("修改")
|
||||
@PutMapping("/edit")
|
||||
public SingleResponse edit(@Validated @RequestBody SgNoticeUpdateCmd sgNoticeUpdateCmd) {
|
||||
sgNoticeService.edit(sgNoticeUpdateCmd);
|
||||
return SingleResponse.buildSuccess();
|
||||
}*/
|
||||
}
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
package com.zcloud.safety.web;
|
||||
|
||||
import com.alibaba.cola.dto.PageResponse;
|
||||
import com.alibaba.cola.dto.Response;
|
||||
import com.alibaba.cola.dto.SingleResponse;
|
||||
import com.zcloud.safety.api.SgReferenceServiceI;
|
||||
import com.zcloud.safety.dto.SgReferenceAddCmd;
|
||||
import com.zcloud.safety.dto.SgReferencePageQry;
|
||||
import com.zcloud.safety.dto.SgReferenceUpdateCmd;
|
||||
import com.zcloud.safety.dto.clientobject.SgReferenceCO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 互学互鉴控制器。
|
||||
*
|
||||
* @Author zhaokai
|
||||
* @Date 2026-06-02 08:43:52
|
||||
*/
|
||||
@Api(tags = "互学互鉴")
|
||||
@RequestMapping("/${application.gateway}/sgReference")
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
public class SgReferenceController {
|
||||
|
||||
private final SgReferenceServiceI sgReferenceService;
|
||||
|
||||
@ApiOperation("新增")
|
||||
@PostMapping("/save")
|
||||
public SingleResponse<SgReferenceCO> add(@Validated SgReferenceAddCmd cmd) {
|
||||
return sgReferenceService.add(cmd);
|
||||
}
|
||||
|
||||
@ApiOperation("分页")
|
||||
@PostMapping("/list")
|
||||
public PageResponse<SgReferenceCO> page(@RequestBody SgReferencePageQry qry) {
|
||||
return sgReferenceService.listPage(qry);
|
||||
}
|
||||
|
||||
@ApiOperation("详情")
|
||||
@GetMapping("/{id}")
|
||||
public SingleResponse<SgReferenceCO> getInfoById(@PathVariable("id") Long id) {
|
||||
return sgReferenceService.getInfoById(id);
|
||||
}
|
||||
|
||||
@ApiOperation("删除")
|
||||
@PostMapping("/{id}")
|
||||
public Response remove(@PathVariable("id") Long id) {
|
||||
sgReferenceService.remove(id);
|
||||
return SingleResponse.buildSuccess();
|
||||
}
|
||||
|
||||
@ApiOperation("修改")
|
||||
@PostMapping("/edit")
|
||||
public SingleResponse<SgReferenceCO> edit(@Validated SgReferenceUpdateCmd cmd) {
|
||||
sgReferenceService.edit(cmd);
|
||||
return SingleResponse.buildSuccess();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
package com.zcloud.safety.web;
|
||||
|
||||
import com.alibaba.cola.dto.PageResponse;
|
||||
import com.alibaba.cola.dto.SingleResponse;
|
||||
import com.zcloud.safety.api.SgSuperviseServiceI;
|
||||
import com.zcloud.safety.dto.SgSuperviseAddCmd;
|
||||
import com.zcloud.safety.dto.SgSupervisePageQry;
|
||||
import com.zcloud.safety.dto.SgSuperviseUpdateCmd;
|
||||
import com.zcloud.safety.dto.clientobject.SgSuperviseCO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 督办表控制器。
|
||||
*/
|
||||
@Api(tags = "督办表")
|
||||
@RequestMapping("/${application.gateway}/sgSupervise")
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
public class SgSuperviseController {
|
||||
|
||||
private final SgSuperviseServiceI sgSuperviseService;
|
||||
/*
|
||||
@ApiOperation("新增")
|
||||
@PostMapping("/save")
|
||||
public SingleResponse<SgSuperviseCO> add(@Validated SgSuperviseAddCmd cmd) {
|
||||
return sgSuperviseService.add(cmd);
|
||||
}*/
|
||||
|
||||
@ApiOperation("分页")
|
||||
@PostMapping("/list")
|
||||
public PageResponse<SgSuperviseCO> page(@RequestBody SgSupervisePageQry qry) {
|
||||
return sgSuperviseService.listPage(qry);
|
||||
}
|
||||
|
||||
@ApiOperation("详情")
|
||||
@GetMapping("/{id}")
|
||||
public SingleResponse<SgSuperviseCO> getInfoById(@PathVariable("id") Long id) {
|
||||
return sgSuperviseService.getInfoById(id);
|
||||
}
|
||||
|
||||
@ApiOperation("反馈")
|
||||
@PutMapping("/edit")
|
||||
public SingleResponse edit(@Validated SgSuperviseUpdateCmd sgSuperviseUpdateCmd) {
|
||||
sgSuperviseService.edit(sgSuperviseUpdateCmd);
|
||||
return SingleResponse.buildSuccess();
|
||||
}
|
||||
@ApiOperation("转发")
|
||||
@PutMapping("/forward")
|
||||
public SingleResponse forward(@Validated @RequestBody SgSuperviseUpdateCmd sgSuperviseUpdateCmd) {
|
||||
sgSuperviseService.forward(sgSuperviseUpdateCmd);
|
||||
return SingleResponse.buildSuccess();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
package com.zcloud.safety.web;
|
||||
|
||||
import com.alibaba.cola.dto.PageResponse;
|
||||
import com.alibaba.cola.dto.Response;
|
||||
import com.alibaba.cola.dto.SingleResponse;
|
||||
import com.zcloud.safety.api.SgXgfFilingServiceI;
|
||||
import com.zcloud.safety.dto.SgXgfFilingAddCmd;
|
||||
import com.zcloud.safety.dto.SgXgfFilingPageQry;
|
||||
import com.zcloud.safety.dto.SgXgfFilingUpdateCmd;
|
||||
import com.zcloud.safety.dto.clientobject.SgXgfFilingCO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 一级相关方备案控制器。
|
||||
*/
|
||||
@Api(tags = "一级相关方备案")
|
||||
@RequestMapping("/${application.gateway}/sgXgfFiling")
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
public class SgXgfFilingController {
|
||||
|
||||
private final SgXgfFilingServiceI sgXgfFilingService;
|
||||
|
||||
@ApiOperation("新增")
|
||||
@PostMapping("/save")
|
||||
public SingleResponse<SgXgfFilingCO> add(@Validated SgXgfFilingAddCmd cmd) {
|
||||
return sgXgfFilingService.add(cmd);
|
||||
}
|
||||
|
||||
@ApiOperation("分页")
|
||||
@PostMapping("/list")
|
||||
public PageResponse<SgXgfFilingCO> page(@RequestBody SgXgfFilingPageQry qry) {
|
||||
return sgXgfFilingService.listPage(qry);
|
||||
}
|
||||
|
||||
@ApiOperation("详情")
|
||||
@GetMapping("/{id}")
|
||||
public SingleResponse<SgXgfFilingCO> getInfoById(@PathVariable("id") Long id) {
|
||||
return sgXgfFilingService.getInfoById(id);
|
||||
}
|
||||
|
||||
@ApiOperation("删除")
|
||||
@PostMapping("/{id}")
|
||||
public Response remove(@PathVariable("id") Long id) {
|
||||
sgXgfFilingService.remove(id);
|
||||
return SingleResponse.buildSuccess();
|
||||
}
|
||||
|
||||
@ApiOperation("修改")
|
||||
@PostMapping("/edit")
|
||||
public SingleResponse<SgXgfFilingCO> edit(@Validated SgXgfFilingUpdateCmd cmd) {
|
||||
sgXgfFilingService.edit(cmd);
|
||||
return SingleResponse.buildSuccess();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,31 +1,33 @@
|
|||
package com.zcloud.safety.command;
|
||||
|
||||
import com.alibaba.cola.exception.BizException;
|
||||
import com.zcloud.safety.domain.gateway.RiskPointGateway;
|
||||
import com.zcloud.safety.domain.model.RiskPointE;
|
||||
import com.zcloud.safety.dto.RiskPointAddCmd;
|
||||
import com.zcloud.safety.domain.gateway.ImgFilesGateway;
|
||||
import com.zcloud.safety.domain.model.ImgFilesE;
|
||||
import com.zcloud.safety.dto.ImgFilesAddCmd;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
|
||||
/**
|
||||
* 风险点新增执行器
|
||||
* web-app
|
||||
*
|
||||
* @author lin
|
||||
* @Author zhaokai
|
||||
* @Date 2026-06-01 14:27:17
|
||||
*/
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class RiskPointAddExe {
|
||||
private final RiskPointGateway riskPointGateway;
|
||||
public class ImgFilesAddExe {
|
||||
private final ImgFilesGateway imgFilesGateway;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean execute(RiskPointAddCmd cmd) {
|
||||
RiskPointE examTypeE = new RiskPointE();
|
||||
BeanUtils.copyProperties(cmd, examTypeE);
|
||||
public boolean execute(ImgFilesAddCmd cmd) {
|
||||
ImgFilesE imgFilesE = new ImgFilesE();
|
||||
BeanUtils.copyProperties(cmd, imgFilesE);
|
||||
boolean res = false;
|
||||
try {
|
||||
res = riskPointGateway.add(examTypeE);
|
||||
res = imgFilesGateway.add(imgFilesE);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
|
@ -35,3 +37,4 @@ public class RiskPointAddExe {
|
|||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,33 +1,39 @@
|
|||
package com.zcloud.safety.command;
|
||||
|
||||
import com.alibaba.cola.exception.BizException;
|
||||
import com.zcloud.safety.domain.gateway.RiskPointGateway;
|
||||
import com.zcloud.safety.domain.gateway.ImgFilesGateway;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
|
||||
/**
|
||||
* 风险点新增执行器
|
||||
* @author lin
|
||||
* web-app
|
||||
*
|
||||
* @Author zhaokai
|
||||
* @Date 2026-06-01 14:27:18
|
||||
*/
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class RiskPointRemoveExe {
|
||||
private final RiskPointGateway riskPointGateway;
|
||||
public class ImgFilesRemoveExe {
|
||||
private final ImgFilesGateway imgFilesGateway;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean execute(Long id) {
|
||||
boolean res = riskPointGateway.deletedRiskPointById(id);
|
||||
if(!res){
|
||||
boolean res = imgFilesGateway.deletedImgFilesById(id);
|
||||
if (!res) {
|
||||
throw new BizException("删除失败");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean execute(Long[] ids) {
|
||||
boolean res = riskPointGateway.deletedRiskPointByIds(ids);
|
||||
if(!res){
|
||||
boolean res = imgFilesGateway.deletedImgFilesByIds(ids);
|
||||
if (!res) {
|
||||
throw new BizException("删除失败");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
package com.zcloud.safety.command;
|
||||
|
||||
import com.alibaba.cola.exception.BizException;
|
||||
import com.zcloud.safety.domain.gateway.ImgFilesGateway;
|
||||
import com.zcloud.safety.domain.model.ImgFilesE;
|
||||
import com.zcloud.safety.dto.ImgFilesUpdateCmd;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
|
||||
/**
|
||||
* web-app
|
||||
*
|
||||
* @Author zhaokai
|
||||
* @Date 2026-06-01 14:27:18
|
||||
*/
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class ImgFilesUpdateExe {
|
||||
private final ImgFilesGateway imgFilesGateway;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void execute(ImgFilesUpdateCmd imgFilesUpdateCmd) {
|
||||
ImgFilesE imgFilesE = new ImgFilesE();
|
||||
BeanUtils.copyProperties(imgFilesUpdateCmd, imgFilesE);
|
||||
boolean res = imgFilesGateway.update(imgFilesE);
|
||||
if (!res) {
|
||||
throw new BizException("修改失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
package com.zcloud.safety.command;
|
||||
|
||||
import com.alibaba.cola.exception.BizException;
|
||||
import com.zcloud.safety.domain.gateway.RiskPointGateway;
|
||||
import com.zcloud.safety.domain.model.RiskPointE;
|
||||
import com.zcloud.safety.dto.RiskPointUpdateCmd;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* 风险点修改执行器
|
||||
*
|
||||
* @author lin
|
||||
*/
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class RiskPointUpdateExe {
|
||||
private final RiskPointGateway riskPointGateway;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void execute(RiskPointUpdateCmd riskPointUpdateCmd) {
|
||||
RiskPointE riskPointE = new RiskPointE();
|
||||
BeanUtils.copyProperties(riskPointUpdateCmd, riskPointE);
|
||||
boolean res = riskPointGateway.update(riskPointE);
|
||||
if (!res) {
|
||||
throw new BizException("修改失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,106 @@
|
|||
package com.zcloud.safety.command;
|
||||
|
||||
import com.alibaba.cola.exception.BizException;
|
||||
import com.zcloud.gbscommon.utils.Tools;
|
||||
import com.zcloud.gbscommon.zcloudimgfiles.facade.ZcloudImgFilesFacade;
|
||||
import com.zcloud.safety.domain.enums.PushOperationTypeEnum;
|
||||
import com.zcloud.safety.domain.gateway.SgAccidentGateway;
|
||||
import com.zcloud.safety.domain.model.SgAccidentE;
|
||||
import com.zcloud.safety.dto.SgAccidentAddCmd;
|
||||
import com.zcloud.safety.persistence.dataobject.ImgFilesDO;
|
||||
import com.zcloud.safety.persistence.dataobject.SgAccidentDO;
|
||||
import com.zcloud.safety.persistence.repository.ImgFilesRepository;
|
||||
import com.zcloud.safety.persistence.repository.SgAccidentRepository;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 事故上报新增执行器。
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class SgAccidentAddExe {
|
||||
|
||||
private static final int ACCIDENT_FILE_TYPE = 5;
|
||||
|
||||
private final SgAccidentGateway sgAccidentGateway;
|
||||
private final SgAccidentRepository sgAccidentRepository;
|
||||
private final ImgFilesRepository imgFilesRepository;
|
||||
private final SgAccidentPushSupport sgAccidentPushSupport;
|
||||
|
||||
@DubboReference
|
||||
private ZcloudImgFilesFacade zcloudImgFilesFacade;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean execute(SgAccidentAddCmd cmd) {
|
||||
SgAccidentE sgAccidentE = new SgAccidentE();
|
||||
BeanUtils.copyProperties(cmd, sgAccidentE);
|
||||
|
||||
try {
|
||||
boolean res = sgAccidentGateway.add(sgAccidentE);
|
||||
if (!res) {
|
||||
throw new BizException("保存失败");
|
||||
}
|
||||
if (sgAccidentE.getId() == null) {
|
||||
throw new BizException("新增事故上报后未获取到主键");
|
||||
}
|
||||
|
||||
saveAccidentFiles(sgAccidentE.getAccidentId(), cmd.getFiles());
|
||||
|
||||
SgAccidentDO latestAccident = sgAccidentRepository.getById(sgAccidentE.getId());
|
||||
if (latestAccident == null) {
|
||||
throw new BizException("新增事故上报后未查询到数据");
|
||||
}
|
||||
|
||||
sgAccidentPushSupport.pushAccident(latestAccident, PushOperationTypeEnum.ADD, cmd.getFiles());
|
||||
log.info("事故上报新增完成,本地主键:{},附件数量:{}", sgAccidentE.getId(), cmd.getFiles() == null ? 0 : cmd.getFiles().length);
|
||||
return true;
|
||||
} catch (BizException e) {
|
||||
log.error("新增事故上报失败,原因:{}", e.getMessage(), e);
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
log.error("新增事故上报失败", e);
|
||||
throw new BizException("保存失败");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 保存事故上报附件,附件外键统一绑定本地主键。
|
||||
*/
|
||||
private void saveAccidentFiles(String accidentId, MultipartFile[] files) throws Exception {
|
||||
if (files == null || files.length == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<ImgFilesDO> imgFilesDOList = new ArrayList<>();
|
||||
for (MultipartFile file : files) {
|
||||
if (file == null || file.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
String fileName = Tools.get32UUID() + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
|
||||
String filePath = zcloudImgFilesFacade.saveFileNoCorpinfoId(file.getBytes(), fileName, "accident");
|
||||
ImgFilesDO imgFilesDO = new ImgFilesDO();
|
||||
imgFilesDO.setImgFilesId(Tools.get32UUID());
|
||||
imgFilesDO.setFilePath(filePath);
|
||||
imgFilesDO.setForeignKey(accidentId);
|
||||
imgFilesDO.setFileName(file.getOriginalFilename());
|
||||
imgFilesDO.setType(ACCIDENT_FILE_TYPE);
|
||||
imgFilesDOList.add(imgFilesDO);
|
||||
}
|
||||
|
||||
if (!imgFilesDOList.isEmpty()) {
|
||||
imgFilesRepository.saveBatch(imgFilesDOList);
|
||||
log.info("事故上报附件保存完成,本地主键:{},附件数量:{}", accidentId, imgFilesDOList.size());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,110 @@
|
|||
package com.zcloud.safety.command;
|
||||
|
||||
import com.alibaba.cola.exception.BizException;
|
||||
import com.zcloud.safety.domain.config.SgProperties;
|
||||
import com.zcloud.safety.domain.enums.PushOperationTypeEnum;
|
||||
import com.zcloud.safety.domain.enums.PushSourceEnum;
|
||||
import com.zcloud.safety.domain.utils.TokenUtils;
|
||||
import com.zcloud.safety.persistence.dataobject.SgAccidentDO;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 事故上报数港推送支持。
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class SgAccidentPushSupport {
|
||||
|
||||
private static final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
private static final PushSourceEnum DEFAULT_SOURCE = PushSourceEnum.QINGANG_GUFEN;
|
||||
|
||||
private final SgProperties sgProperties;
|
||||
|
||||
/**
|
||||
* 事故上报即使文档未显式声明附件,也按照真实协议透传多附件到数港。
|
||||
*/
|
||||
public void pushAccident(SgAccidentDO sgAccidentDO, PushOperationTypeEnum operationType, MultipartFile... files) {
|
||||
if (sgAccidentDO == null || sgAccidentDO.getId() == null) {
|
||||
throw new BizException("事故上报数据不存在,无法推送数港");
|
||||
}
|
||||
if (operationType == null) {
|
||||
throw new BizException("事故上报推送操作类型不能为空");
|
||||
}
|
||||
|
||||
try {
|
||||
String token = resolveToken();
|
||||
Map<String, Object> requestData = buildRequestData(sgAccidentDO, operationType);
|
||||
log.info("开始推送事故上报到数港,操作类型:{}-{},来源:{}-{},本地主键:{},请求数据:{}",
|
||||
operationType.getCode(), operationType.getValue(), DEFAULT_SOURCE.getCode(), DEFAULT_SOURCE.getValue(), sgAccidentDO.getId(), requestData);
|
||||
if (sgProperties.getEnabled() == null || !sgProperties.getEnabled()) {
|
||||
log.info("模拟真实推送事故上报到数港,操作类型:{}-{},来源:{}-{},本地主键:{},url:{},附件数量:{}",
|
||||
operationType.getCode(), operationType.getValue(), DEFAULT_SOURCE.getCode(), DEFAULT_SOURCE.getValue(), sgAccidentDO.getId(), sgProperties.getAccidentUrl(), files == null ? 0 : files.length);
|
||||
} else {
|
||||
TokenUtils.sendDataToThirdParty(sgProperties.getAccidentUrl(), requestData, token, files);
|
||||
}
|
||||
log.info("推送事故上报到数港成功,操作类型:{}-{},本地主键:{}",
|
||||
operationType.getCode(), operationType.getValue(), sgAccidentDO.getId());
|
||||
} catch (BizException e) {
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
log.error("推送事故上报到数港失败,操作类型:{}-{},本地主键:{}",
|
||||
operationType.getCode(), operationType.getValue(), sgAccidentDO.getId(), e);
|
||||
throw new BizException("推送数港失败");
|
||||
}
|
||||
}
|
||||
|
||||
private String resolveToken() throws Exception {
|
||||
String token;
|
||||
if (sgProperties.getEnabled() == null || !sgProperties.getEnabled()) {
|
||||
token = "tokenAAAA";
|
||||
} else {
|
||||
token = TokenUtils.getTokenFromThirdParty(sgProperties.getTokenUrl());
|
||||
}
|
||||
if (token == null || token.isEmpty()) {
|
||||
throw new BizException("获取数港token失败");
|
||||
}
|
||||
return token;
|
||||
}
|
||||
|
||||
private Map<String, Object> buildRequestData(SgAccidentDO sgAccidentDO, PushOperationTypeEnum operationType) {
|
||||
Map<String, Object> requestData = new HashMap<>();
|
||||
requestData.put("operationType", operationType.getCode());
|
||||
requestData.put("accidentId", String.valueOf(sgAccidentDO.getId()));
|
||||
requestData.put("accidentContent", defaultString(sgAccidentDO.getAccidentContent()));
|
||||
requestData.put("accidentTime", defaultString(sgAccidentDO.getAccidentTime()));
|
||||
requestData.put("companyId", defaultString(sgAccidentDO.getCompanyId()));
|
||||
requestData.put("companyName", defaultString(sgAccidentDO.getCompanyName()));
|
||||
requestData.put("source", DEFAULT_SOURCE.getCode());
|
||||
requestData.put("createBy", resolveCreateBy(sgAccidentDO));
|
||||
requestData.put("createTime", formatDateTime(sgAccidentDO.getCreateTime()));
|
||||
return requestData;
|
||||
}
|
||||
|
||||
private String resolveCreateBy(SgAccidentDO sgAccidentDO) {
|
||||
if (sgAccidentDO.getCreateName() != null && !sgAccidentDO.getCreateName().isEmpty()) {
|
||||
return sgAccidentDO.getCreateName();
|
||||
}
|
||||
if (sgAccidentDO.getUpdateName() != null && !sgAccidentDO.getUpdateName().isEmpty()) {
|
||||
return sgAccidentDO.getUpdateName();
|
||||
}
|
||||
return "系统";
|
||||
}
|
||||
|
||||
private String formatDateTime(LocalDateTime dateTime) {
|
||||
LocalDateTime target = dateTime == null ? LocalDateTime.now() : dateTime;
|
||||
return target.format(DATE_TIME_FORMATTER);
|
||||
}
|
||||
|
||||
private String defaultString(String value) {
|
||||
return value == null ? "" : value;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
package com.zcloud.safety.command;
|
||||
|
||||
import com.alibaba.cola.exception.BizException;
|
||||
import com.zcloud.safety.domain.enums.PushOperationTypeEnum;
|
||||
import com.zcloud.safety.domain.gateway.SgAccidentGateway;
|
||||
import com.zcloud.safety.persistence.dataobject.SgAccidentDO;
|
||||
import com.zcloud.safety.persistence.repository.ImgFilesRepository;
|
||||
import com.zcloud.safety.persistence.repository.SgAccidentRepository;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* 事故上报删除执行器。
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class SgAccidentRemoveExe {
|
||||
|
||||
private final SgAccidentGateway sgAccidentGateway;
|
||||
private final SgAccidentRepository sgAccidentRepository;
|
||||
private final ImgFilesRepository imgFilesRepository;
|
||||
private final SgAccidentPushSupport sgAccidentPushSupport;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean execute(Long id) {
|
||||
SgAccidentDO sgAccidentDO = sgAccidentRepository.getById(id);
|
||||
if (sgAccidentDO == null) {
|
||||
throw new BizException("该数据不存在");
|
||||
}
|
||||
|
||||
boolean res = sgAccidentGateway.deletedSgAccidentById(id);
|
||||
if (!res) {
|
||||
throw new BizException("删除失败");
|
||||
}
|
||||
|
||||
imgFilesRepository.deletedImgFilesByForeignId(String.valueOf(id));
|
||||
sgAccidentPushSupport.pushAccident(sgAccidentDO, PushOperationTypeEnum.DELETE);
|
||||
log.info("事故上报删除完成,本地主键:{}", id);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean execute(Long[] ids) {
|
||||
boolean res = sgAccidentGateway.deletedSgAccidentByIds(ids);
|
||||
if (!res) {
|
||||
throw new BizException("删除失败");
|
||||
}
|
||||
log.info("事故上报批量删除完成,数量:{}", ids == null ? 0 : ids.length);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,110 @@
|
|||
package com.zcloud.safety.command;
|
||||
|
||||
import com.alibaba.cola.exception.BizException;
|
||||
import com.zcloud.gbscommon.utils.Tools;
|
||||
import com.zcloud.gbscommon.zcloudimgfiles.facade.ZcloudImgFilesFacade;
|
||||
import com.zcloud.safety.domain.enums.PushOperationTypeEnum;
|
||||
import com.zcloud.safety.domain.gateway.SgAccidentGateway;
|
||||
import com.zcloud.safety.domain.model.SgAccidentE;
|
||||
import com.zcloud.safety.dto.SgAccidentUpdateCmd;
|
||||
import com.zcloud.safety.persistence.dataobject.ImgFilesDO;
|
||||
import com.zcloud.safety.persistence.dataobject.SgAccidentDO;
|
||||
import com.zcloud.safety.persistence.repository.ImgFilesRepository;
|
||||
import com.zcloud.safety.persistence.repository.SgAccidentRepository;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 事故上报修改执行器。
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class SgAccidentUpdateExe {
|
||||
|
||||
private static final int ACCIDENT_FILE_TYPE = 5;
|
||||
|
||||
private final SgAccidentGateway sgAccidentGateway;
|
||||
private final SgAccidentRepository sgAccidentRepository;
|
||||
private final ImgFilesRepository imgFilesRepository;
|
||||
private final SgAccidentPushSupport sgAccidentPushSupport;
|
||||
|
||||
@DubboReference
|
||||
private ZcloudImgFilesFacade zcloudImgFilesFacade;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void execute(SgAccidentUpdateCmd cmd) {
|
||||
SgAccidentDO oldAccident = sgAccidentRepository.getById(cmd.getId());
|
||||
if (oldAccident == null) {
|
||||
throw new BizException("该数据不存在");
|
||||
}
|
||||
|
||||
try {
|
||||
SgAccidentE sgAccidentE = new SgAccidentE();
|
||||
BeanUtils.copyProperties(cmd, sgAccidentE);
|
||||
|
||||
boolean res = sgAccidentGateway.update(sgAccidentE);
|
||||
if (!res) {
|
||||
throw new BizException("修改失败");
|
||||
}
|
||||
|
||||
replaceAccidentFiles(cmd.getAccidentId(), cmd.getFiles());
|
||||
SgAccidentDO latestAccident = sgAccidentRepository.getById(cmd.getId());
|
||||
if (latestAccident == null) {
|
||||
throw new BizException("修改后未查询到事故上报数据");
|
||||
}
|
||||
|
||||
sgAccidentPushSupport.pushAccident(latestAccident, PushOperationTypeEnum.UPDATE, cmd.getFiles());
|
||||
log.info("事故上报修改完成,本地主键:{},附件数量:{}", cmd.getId(), cmd.getFiles() == null ? 0 : cmd.getFiles().length);
|
||||
} catch (BizException e) {
|
||||
log.error("修改事故上报失败,主键:{},原因:{}", cmd.getId(), e.getMessage(), e);
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
log.error("修改事故上报失败,主键:{}", cmd.getId(), e);
|
||||
throw new BizException("修改失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 新附件重传时先删除旧附件,再保存新附件。
|
||||
*/
|
||||
private void replaceAccidentFiles(String accidentId, MultipartFile[] files) throws Exception {
|
||||
if (files == null || files.length == 0) {
|
||||
return;
|
||||
}
|
||||
imgFilesRepository.deletedImgFilesByForeignId(accidentId);
|
||||
saveAccidentFiles(accidentId, files);
|
||||
}
|
||||
|
||||
private void saveAccidentFiles(String accidentId, MultipartFile[] files) throws Exception {
|
||||
List<ImgFilesDO> imgFilesDOList = new ArrayList<>();
|
||||
for (MultipartFile file : files) {
|
||||
if (file == null || file.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
String fileName = Tools.get32UUID() + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
|
||||
String filePath = zcloudImgFilesFacade.saveFileNoCorpinfoId(file.getBytes(), fileName, "accident");
|
||||
ImgFilesDO imgFilesDO = new ImgFilesDO();
|
||||
imgFilesDO.setImgFilesId(Tools.get32UUID());
|
||||
imgFilesDO.setFilePath(filePath);
|
||||
imgFilesDO.setForeignKey(accidentId);
|
||||
imgFilesDO.setFileName(file.getOriginalFilename());
|
||||
imgFilesDO.setType(ACCIDENT_FILE_TYPE);
|
||||
imgFilesDOList.add(imgFilesDO);
|
||||
}
|
||||
|
||||
if (!imgFilesDOList.isEmpty()) {
|
||||
imgFilesRepository.saveBatch(imgFilesDOList);
|
||||
log.info("事故上报附件保存完成,本地主键:{},附件数量:{}", accidentId, imgFilesDOList.size());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,107 @@
|
|||
package com.zcloud.safety.command;
|
||||
|
||||
import com.alibaba.cola.exception.BizException;
|
||||
import com.zcloud.gbscommon.utils.Tools;
|
||||
import com.zcloud.gbscommon.zcloudimgfiles.facade.ZcloudImgFilesFacade;
|
||||
import com.zcloud.safety.domain.enums.PushOperationTypeEnum;
|
||||
import com.zcloud.safety.domain.gateway.SgCalendarGateway;
|
||||
import com.zcloud.safety.domain.model.SgCalendarE;
|
||||
import com.zcloud.safety.dto.SgCalendarAddCmd;
|
||||
import com.zcloud.safety.persistence.dataobject.ImgFilesDO;
|
||||
import com.zcloud.safety.persistence.dataobject.SgCalendarDO;
|
||||
import com.zcloud.safety.persistence.repository.ImgFilesRepository;
|
||||
import com.zcloud.safety.persistence.repository.SgCalendarRepository;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 安全月历新增执行器。
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class SgCalendarAddExe {
|
||||
|
||||
private static final String PENDING_AUDIT_TYPE = "0";
|
||||
private static final int CALENDAR_FILE_TYPE = 4;
|
||||
|
||||
private final SgCalendarGateway sgCalendarGateway;
|
||||
private final SgCalendarRepository sgCalendarRepository;
|
||||
private final ImgFilesRepository imgFilesRepository;
|
||||
private final SgCalendarPushSupport sgCalendarPushSupport;
|
||||
|
||||
@DubboReference
|
||||
private ZcloudImgFilesFacade zcloudImgFilesFacade;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean execute(SgCalendarAddCmd cmd) {
|
||||
SgCalendarE sgCalendarE = new SgCalendarE();
|
||||
BeanUtils.copyProperties(cmd, sgCalendarE);
|
||||
initAuditStatus(sgCalendarE);
|
||||
|
||||
try {
|
||||
boolean res = sgCalendarGateway.add(sgCalendarE);
|
||||
if (!res) {
|
||||
throw new BizException("保存失败");
|
||||
}
|
||||
if (sgCalendarE.getId() == null) {
|
||||
throw new BizException("新增安全月历后未获取到主键");
|
||||
}
|
||||
|
||||
saveCalendarFiles(sgCalendarE.getCalendarId(), cmd.getFiles());
|
||||
SgCalendarDO latestCalendar = sgCalendarRepository.getById(sgCalendarE.getId());
|
||||
if (latestCalendar == null) {
|
||||
throw new BizException("新增安全月历后未查询到数据");
|
||||
}
|
||||
|
||||
sgCalendarPushSupport.pushCalendar(latestCalendar, PushOperationTypeEnum.ADD, cmd.getFiles());
|
||||
return true;
|
||||
} catch (BizException e) {
|
||||
log.error("新增安全月历失败,原因:{}", e.getMessage(), e);
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
log.error("新增安全月历失败", e);
|
||||
throw new BizException("保存失败");
|
||||
}
|
||||
}
|
||||
|
||||
private void initAuditStatus(SgCalendarE sgCalendarE) {
|
||||
sgCalendarE.setAuditType(PENDING_AUDIT_TYPE);
|
||||
sgCalendarE.setAuditContent("");
|
||||
}
|
||||
|
||||
private void saveCalendarFiles(String calendarId, MultipartFile[] files) throws Exception {
|
||||
if (files == null || files.length == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<ImgFilesDO> imgFilesDOList = new ArrayList<>();
|
||||
for (MultipartFile file : files) {
|
||||
if (file == null || file.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
String fileName = Tools.get32UUID() + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
|
||||
String filePath = zcloudImgFilesFacade.saveFileNoCorpinfoId(file.getBytes(), fileName, "calendar");
|
||||
ImgFilesDO imgFilesDO = new ImgFilesDO();
|
||||
imgFilesDO.setImgFilesId(Tools.get32UUID());
|
||||
imgFilesDO.setFilePath(filePath);
|
||||
imgFilesDO.setForeignKey(calendarId);
|
||||
imgFilesDO.setFileName(file.getOriginalFilename());
|
||||
imgFilesDO.setType(CALENDAR_FILE_TYPE);
|
||||
imgFilesDOList.add(imgFilesDO);
|
||||
}
|
||||
|
||||
if (!imgFilesDOList.isEmpty()) {
|
||||
imgFilesRepository.saveBatch(imgFilesDOList);
|
||||
log.info("安全月历附件保存完成,本地主键:{},附件数量:{}", calendarId, imgFilesDOList.size());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,103 @@
|
|||
package com.zcloud.safety.command;
|
||||
|
||||
import com.alibaba.cola.exception.BizException;
|
||||
import com.zcloud.safety.domain.config.SgProperties;
|
||||
import com.zcloud.safety.domain.enums.PushOperationTypeEnum;
|
||||
import com.zcloud.safety.domain.enums.PushSourceEnum;
|
||||
import com.zcloud.safety.domain.utils.TokenUtils;
|
||||
import com.zcloud.safety.persistence.dataobject.SgCalendarDO;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 安全月历数港推送支持。
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class SgCalendarPushSupport {
|
||||
|
||||
private static final PushSourceEnum DEFAULT_SOURCE = PushSourceEnum.QINGANG_GUFEN;
|
||||
|
||||
private final SgProperties sgProperties;
|
||||
|
||||
/**
|
||||
* 安全月历推送统一走枚举,便于后续扩展来源映射和操作类型字典。
|
||||
*/
|
||||
public void pushCalendar(SgCalendarDO sgCalendarDO, PushOperationTypeEnum operationType, MultipartFile... files) {
|
||||
if (sgCalendarDO == null || sgCalendarDO.getId() == null) {
|
||||
throw new BizException("安全月历数据不存在,无法推送数港");
|
||||
}
|
||||
if (operationType == null) {
|
||||
throw new BizException("安全月历推送操作类型不能为空");
|
||||
}
|
||||
|
||||
try {
|
||||
String token = resolveToken();
|
||||
Map<String, Object> requestData = buildRequestData(sgCalendarDO, operationType);
|
||||
log.info("开始推送安全月历到数港,操作类型:{}-{},来源:{}-{},本地主键:{},请求数据:{}",
|
||||
operationType.getCode(), operationType.getValue(), DEFAULT_SOURCE.getCode(), DEFAULT_SOURCE.getValue(), sgCalendarDO.getId(), requestData);
|
||||
if (sgProperties.getEnabled() == null || !sgProperties.getEnabled()) {
|
||||
log.info("模拟真实推送安全月历到数港,操作类型:{}-{},来源:{}-{},本地主键:{},url:{},请求数据:{}",
|
||||
operationType.getCode(), operationType.getValue(), DEFAULT_SOURCE.getCode(), DEFAULT_SOURCE.getValue(), sgCalendarDO.getId(), sgProperties.getCalendarUrl(), requestData);
|
||||
} else {
|
||||
TokenUtils.sendDataToThirdParty(sgProperties.getCalendarUrl(), requestData, token, files);
|
||||
}
|
||||
log.info("推送安全月历到数港成功,操作类型:{}-{},本地主键:{}",
|
||||
operationType.getCode(), operationType.getValue(), sgCalendarDO.getId());
|
||||
} catch (BizException e) {
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
log.error("推送安全月历到数港失败,操作类型:{}-{},本地主键:{}",
|
||||
operationType.getCode(), operationType.getValue(), sgCalendarDO.getId(), e);
|
||||
throw new BizException("推送数港失败");
|
||||
}
|
||||
}
|
||||
|
||||
private String resolveToken() throws Exception {
|
||||
String token;
|
||||
if (sgProperties.getEnabled() == null || !sgProperties.getEnabled()) {
|
||||
token = "tokenAAAA";
|
||||
} else {
|
||||
token = TokenUtils.getTokenFromThirdParty(sgProperties.getTokenUrl());
|
||||
}
|
||||
if (token == null || token.isEmpty()) {
|
||||
throw new BizException("获取数港token失败");
|
||||
}
|
||||
return token;
|
||||
}
|
||||
|
||||
private Map<String, Object> buildRequestData(SgCalendarDO sgCalendarDO, PushOperationTypeEnum operationType) {
|
||||
Map<String, Object> requestData = new HashMap<>();
|
||||
requestData.put("operationType", operationType.getCode());
|
||||
requestData.put("noticeId", sgCalendarDO.getId());
|
||||
requestData.put("noticeTitle", defaultString(sgCalendarDO.getNoticeTitle()));
|
||||
requestData.put("noticeType", defaultString(sgCalendarDO.getNoticeType()));
|
||||
requestData.put("noticeContent", defaultString(sgCalendarDO.getNoticeContent()));
|
||||
requestData.put("noticeDate", defaultString(sgCalendarDO.getNoticeDate()));
|
||||
requestData.put("companyId", defaultString(sgCalendarDO.getCompanyId()));
|
||||
requestData.put("companyName", defaultString(sgCalendarDO.getCompanyName()));
|
||||
requestData.put("source", DEFAULT_SOURCE.getCode());
|
||||
requestData.put("createBy", resolveCreateBy(sgCalendarDO));
|
||||
return requestData;
|
||||
}
|
||||
|
||||
private String resolveCreateBy(SgCalendarDO sgCalendarDO) {
|
||||
if (sgCalendarDO.getCreateName() != null && !sgCalendarDO.getCreateName().isEmpty()) {
|
||||
return sgCalendarDO.getCreateName();
|
||||
}
|
||||
if (sgCalendarDO.getUpdateName() != null && !sgCalendarDO.getUpdateName().isEmpty()) {
|
||||
return sgCalendarDO.getUpdateName();
|
||||
}
|
||||
return "系统";
|
||||
}
|
||||
|
||||
private String defaultString(String value) {
|
||||
return value == null ? "" : value;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
package com.zcloud.safety.command;
|
||||
|
||||
import com.alibaba.cola.exception.BizException;
|
||||
import com.zcloud.safety.domain.enums.PushOperationTypeEnum;
|
||||
import com.zcloud.safety.domain.gateway.SgCalendarGateway;
|
||||
import com.zcloud.safety.persistence.dataobject.SgCalendarDO;
|
||||
import com.zcloud.safety.persistence.repository.ImgFilesRepository;
|
||||
import com.zcloud.safety.persistence.repository.SgCalendarRepository;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* 安全月历删除执行器。
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class SgCalendarRemoveExe {
|
||||
|
||||
private final SgCalendarGateway sgCalendarGateway;
|
||||
private final SgCalendarRepository sgCalendarRepository;
|
||||
private final ImgFilesRepository imgFilesRepository;
|
||||
private final SgCalendarPushSupport sgCalendarPushSupport;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean execute(Long id) {
|
||||
SgCalendarDO sgCalendarDO = sgCalendarRepository.getById(id);
|
||||
if (sgCalendarDO == null) {
|
||||
throw new BizException("该数据不存在");
|
||||
}
|
||||
|
||||
boolean res = sgCalendarGateway.deletedSgCalendarById(id);
|
||||
if (!res) {
|
||||
throw new BizException("删除失败");
|
||||
}
|
||||
|
||||
imgFilesRepository.deletedImgFilesByForeignId(String.valueOf(id));
|
||||
sgCalendarPushSupport.pushCalendar(sgCalendarDO, PushOperationTypeEnum.DELETE);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean execute(Long[] ids) {
|
||||
boolean res = sgCalendarGateway.deletedSgCalendarByIds(ids);
|
||||
if (!res) {
|
||||
throw new BizException("删除失败");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,137 @@
|
|||
package com.zcloud.safety.command;
|
||||
|
||||
import com.alibaba.cola.exception.BizException;
|
||||
import com.zcloud.gbscommon.utils.Tools;
|
||||
import com.zcloud.gbscommon.zcloudimgfiles.facade.ZcloudImgFilesFacade;
|
||||
import com.zcloud.safety.domain.enums.PushOperationTypeEnum;
|
||||
import com.zcloud.safety.domain.gateway.SgCalendarGateway;
|
||||
import com.zcloud.safety.domain.model.SgCalendarE;
|
||||
import com.zcloud.safety.dto.SgCalendarUpdateCmd;
|
||||
import com.zcloud.safety.dto.receive.SgCalendarAuditDTO;
|
||||
import com.zcloud.safety.persistence.dataobject.ImgFilesDO;
|
||||
import com.zcloud.safety.persistence.dataobject.SgCalendarDO;
|
||||
import com.zcloud.safety.persistence.repository.ImgFilesRepository;
|
||||
import com.zcloud.safety.persistence.repository.SgCalendarRepository;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 安全月历修改执行器。
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class SgCalendarUpdateExe {
|
||||
|
||||
private static final int CALENDAR_FILE_TYPE = 4;
|
||||
|
||||
private final SgCalendarGateway sgCalendarGateway;
|
||||
private final SgCalendarRepository sgCalendarRepository;
|
||||
private final ImgFilesRepository imgFilesRepository;
|
||||
private final SgCalendarPushSupport sgCalendarPushSupport;
|
||||
|
||||
@DubboReference
|
||||
private ZcloudImgFilesFacade zcloudImgFilesFacade;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void execute(SgCalendarUpdateCmd cmd) {
|
||||
SgCalendarDO oldCalendar = sgCalendarRepository.getById(cmd.getId());
|
||||
if (oldCalendar == null) {
|
||||
throw new BizException("该数据不存在");
|
||||
}
|
||||
|
||||
try {
|
||||
SgCalendarE sgCalendarE = new SgCalendarE();
|
||||
BeanUtils.copyProperties(cmd, sgCalendarE);
|
||||
if ((sgCalendarE.getCalendarId() == null || sgCalendarE.getCalendarId().isEmpty())
|
||||
&& oldCalendar.getCalendarId() != null && !oldCalendar.getCalendarId().isEmpty()) {
|
||||
sgCalendarE.setCalendarId(oldCalendar.getCalendarId());
|
||||
}
|
||||
|
||||
boolean res = sgCalendarGateway.update(sgCalendarE);
|
||||
if (!res) {
|
||||
throw new BizException("修改失败");
|
||||
}
|
||||
|
||||
replaceCalendarFiles(cmd.getCalendarId(), cmd.getFiles());
|
||||
SgCalendarDO latestCalendar = sgCalendarRepository.getById(cmd.getId());
|
||||
if (latestCalendar == null) {
|
||||
throw new BizException("修改后未查询到安全月历数据");
|
||||
}
|
||||
|
||||
sgCalendarPushSupport.pushCalendar(latestCalendar, PushOperationTypeEnum.UPDATE, cmd.getFiles());
|
||||
} catch (BizException e) {
|
||||
log.error("修改安全月历失败,主键:{},原因:{}", cmd.getId(), e.getMessage(), e);
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
log.error("修改安全月历失败,主键:{}", cmd.getId(), e);
|
||||
throw new BizException("修改失败");
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void receiveAudit(SgCalendarAuditDTO auditDTO) {
|
||||
SgCalendarDO oldCalendar = sgCalendarRepository.getById(auditDTO.getNoticeId());
|
||||
if (oldCalendar == null) {
|
||||
throw new BizException("该数据不存在");
|
||||
}
|
||||
|
||||
try {
|
||||
SgCalendarE sgCalendarE = new SgCalendarE();
|
||||
sgCalendarE.setId(auditDTO.getNoticeId());
|
||||
sgCalendarE.setNoticeDate(auditDTO.getNoticeDate());
|
||||
sgCalendarE.setAuditType(auditDTO.getAuditType());
|
||||
sgCalendarE.setAuditContent(auditDTO.getAuditContent());
|
||||
boolean res = sgCalendarGateway.update(sgCalendarE);
|
||||
if (!res) {
|
||||
throw new BizException("审核状态更新失败");
|
||||
}
|
||||
log.info("接收数港安全月历审核结果完成,本地主键:{},审核状态:{}", auditDTO.getNoticeId(), auditDTO.getAuditType());
|
||||
} catch (BizException e) {
|
||||
log.error("接收数港安全月历审核结果失败,主键:{},原因:{}", auditDTO.getNoticeId(), e.getMessage(), e);
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
log.error("接收数港安全月历审核结果失败,主键:{}", auditDTO.getNoticeId(), e);
|
||||
throw new BizException("审核状态更新失败");
|
||||
}
|
||||
}
|
||||
|
||||
private void replaceCalendarFiles(String calendarId, MultipartFile[] files) throws Exception {
|
||||
if (files == null || files.length == 0) {
|
||||
return;
|
||||
}
|
||||
imgFilesRepository.deletedImgFilesByForeignId(calendarId);
|
||||
saveCalendarFiles(calendarId, files);
|
||||
}
|
||||
|
||||
private void saveCalendarFiles(String calendarId, MultipartFile[] files) throws Exception {
|
||||
List<ImgFilesDO> imgFilesDOList = new ArrayList<>();
|
||||
for (MultipartFile file : files) {
|
||||
if (file == null || file.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
String fileName = Tools.get32UUID() + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
|
||||
String filePath = zcloudImgFilesFacade.saveFileNoCorpinfoId(file.getBytes(), fileName, "calendar");
|
||||
ImgFilesDO imgFilesDO = new ImgFilesDO();
|
||||
imgFilesDO.setImgFilesId(Tools.get32UUID());
|
||||
imgFilesDO.setFilePath(filePath);
|
||||
imgFilesDO.setForeignKey(calendarId);
|
||||
imgFilesDO.setFileName(file.getOriginalFilename());
|
||||
imgFilesDO.setType(CALENDAR_FILE_TYPE);
|
||||
imgFilesDOList.add(imgFilesDO);
|
||||
}
|
||||
|
||||
if (!imgFilesDOList.isEmpty()) {
|
||||
imgFilesRepository.saveBatch(imgFilesDOList);
|
||||
log.info("安全月历附件保存完成,本地主键:{},附件数量:{}", calendarId, imgFilesDOList.size());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
package com.zcloud.safety.command;
|
||||
|
||||
import com.alibaba.cola.exception.BizException;
|
||||
import com.zcloud.safety.domain.enums.PushOperationTypeEnum;
|
||||
import com.zcloud.safety.domain.gateway.SgDutyGateway;
|
||||
import com.zcloud.safety.domain.model.SgDutyE;
|
||||
import com.zcloud.safety.dto.SgDutyAddCmd;
|
||||
import com.zcloud.safety.persistence.dataobject.SgDutyDO;
|
||||
import com.zcloud.safety.persistence.repository.SgDutyRepository;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* 值班统计新增执行器。
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class SgDutyAddExe {
|
||||
|
||||
private final SgDutyGateway sgDutyGateway;
|
||||
private final SgDutyRepository sgDutyRepository;
|
||||
private final SgDutyPushSupport sgDutyPushSupport;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean execute(SgDutyAddCmd cmd) {
|
||||
SgDutyE sgDutyE = new SgDutyE();
|
||||
BeanUtils.copyProperties(cmd, sgDutyE);
|
||||
|
||||
try {
|
||||
boolean res = sgDutyGateway.add(sgDutyE);
|
||||
if (!res) {
|
||||
throw new BizException("保存失败");
|
||||
}
|
||||
if (sgDutyE.getId() == null) {
|
||||
throw new BizException("新增值班统计后未获取到主键");
|
||||
}
|
||||
|
||||
SgDutyDO sgDutyDO = sgDutyRepository.getById(sgDutyE.getId());
|
||||
if (sgDutyDO == null) {
|
||||
throw new BizException("新增值班统计后未查询到数据");
|
||||
}
|
||||
|
||||
sgDutyPushSupport.pushDuty(sgDutyDO, PushOperationTypeEnum.ADD);
|
||||
return true;
|
||||
} catch (BizException e) {
|
||||
log.error("新增值班统计失败,原因:{}", e.getMessage(), e);
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
log.error("新增值班统计失败", e);
|
||||
throw new BizException("保存失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,110 @@
|
|||
package com.zcloud.safety.command;
|
||||
|
||||
import com.alibaba.cola.exception.BizException;
|
||||
import com.zcloud.safety.domain.config.SgProperties;
|
||||
import com.zcloud.safety.domain.enums.PushOperationTypeEnum;
|
||||
import com.zcloud.safety.domain.enums.PushSourceEnum;
|
||||
import com.zcloud.safety.domain.utils.TokenUtils;
|
||||
import com.zcloud.safety.persistence.dataobject.SgDutyDO;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 值班统计数港推送支持。
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class SgDutyPushSupport {
|
||||
|
||||
private static final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
private static final PushSourceEnum DEFAULT_SOURCE = PushSourceEnum.QINGANG_GUFEN;
|
||||
|
||||
private final SgProperties sgProperties;
|
||||
|
||||
/**
|
||||
* 值班统计推送到数港时,统一使用枚举承接操作类型和来源,避免链路里继续散落裸值。
|
||||
*/
|
||||
public void pushDuty(SgDutyDO sgDutyDO, PushOperationTypeEnum operationType) {
|
||||
if (sgDutyDO == null || sgDutyDO.getId() == null) {
|
||||
throw new BizException("值班统计数据不存在,无法推送数港");
|
||||
}
|
||||
if (operationType == null) {
|
||||
throw new BizException("值班统计推送操作类型不能为空");
|
||||
}
|
||||
|
||||
try {
|
||||
String token = resolveToken();
|
||||
Map<String, Object> requestData = buildRequestData(sgDutyDO, operationType);
|
||||
log.info("开始推送值班统计到数港,操作类型:{}-{},来源:{}-{},本地主键:{},请求数据:{}",
|
||||
operationType.getCode(), operationType.getValue(), DEFAULT_SOURCE.getCode(), DEFAULT_SOURCE.getValue(), sgDutyDO.getId(), requestData);
|
||||
if (sgProperties.getEnabled() == null || !sgProperties.getEnabled()) {
|
||||
log.info("模拟真实推送值班统计到数港,操作类型:{}-{},来源:{}-{},本地主键:{},url:{},请求数据:{}",
|
||||
operationType.getCode(), operationType.getValue(), DEFAULT_SOURCE.getCode(), DEFAULT_SOURCE.getValue(), sgDutyDO.getId(), sgProperties.getDutyUrl(), requestData);
|
||||
} else {
|
||||
TokenUtils.sendDataToThirdParty(sgProperties.getDutyUrl(), requestData, token);
|
||||
}
|
||||
log.info("推送值班统计到数港成功,操作类型:{}-{},本地主键:{}",
|
||||
operationType.getCode(), operationType.getValue(), sgDutyDO.getId());
|
||||
} catch (BizException e) {
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
log.error("推送值班统计到数港失败,操作类型:{}-{},本地主键:{}",
|
||||
operationType.getCode(), operationType.getValue(), sgDutyDO.getId(), e);
|
||||
throw new BizException("推送数港失败");
|
||||
}
|
||||
}
|
||||
|
||||
private String resolveToken() throws Exception {
|
||||
String token;
|
||||
if (sgProperties.getEnabled() == null || !sgProperties.getEnabled()) {
|
||||
token = "tokenAAAA";
|
||||
} else {
|
||||
token = TokenUtils.getTokenFromThirdParty(sgProperties.getTokenUrl());
|
||||
}
|
||||
if (token == null || token.isEmpty()) {
|
||||
throw new BizException("获取数港token失败");
|
||||
}
|
||||
return token;
|
||||
}
|
||||
|
||||
private Map<String, Object> buildRequestData(SgDutyDO sgDutyDO, PushOperationTypeEnum operationType) {
|
||||
Map<String, Object> requestData = new HashMap<>();
|
||||
requestData.put("operationType", operationType.getCode());
|
||||
requestData.put("dutyId", String.valueOf(sgDutyDO.getId()));
|
||||
requestData.put("dutyName", sgDutyDO.getDutyName());
|
||||
requestData.put("dutyPhone", sgDutyDO.getDutyPhone());
|
||||
requestData.put("dutyTime", sgDutyDO.getDutyTime());
|
||||
requestData.put("source", DEFAULT_SOURCE.getCode());
|
||||
requestData.put("companyId", defaultString(sgDutyDO.getCompanyId()));
|
||||
requestData.put("companyName", defaultString(sgDutyDO.getCompanyName()));
|
||||
requestData.put("createTime", formatDateTime(sgDutyDO.getCreateTime()));
|
||||
requestData.put("createBy", defaultString(resolveCreateBy(sgDutyDO)));
|
||||
return requestData;
|
||||
}
|
||||
|
||||
private String resolveCreateBy(SgDutyDO sgDutyDO) {
|
||||
if (sgDutyDO.getCreateName() != null && !sgDutyDO.getCreateName().isEmpty()) {
|
||||
return sgDutyDO.getCreateName();
|
||||
}
|
||||
if (sgDutyDO.getUpdateName() != null && !sgDutyDO.getUpdateName().isEmpty()) {
|
||||
return sgDutyDO.getUpdateName();
|
||||
}
|
||||
return "系统";
|
||||
}
|
||||
|
||||
private String formatDateTime(LocalDateTime dateTime) {
|
||||
LocalDateTime target = dateTime == null ? LocalDateTime.now() : dateTime;
|
||||
return target.format(DATE_TIME_FORMATTER);
|
||||
}
|
||||
|
||||
private String defaultString(String value) {
|
||||
return value == null ? "" : value;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
package com.zcloud.safety.command;
|
||||
|
||||
import com.alibaba.cola.exception.BizException;
|
||||
import com.zcloud.safety.domain.enums.PushOperationTypeEnum;
|
||||
import com.zcloud.safety.domain.gateway.SgDutyGateway;
|
||||
import com.zcloud.safety.persistence.dataobject.SgDutyDO;
|
||||
import com.zcloud.safety.persistence.repository.SgDutyRepository;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* 值班统计删除执行器。
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class SgDutyRemoveExe {
|
||||
|
||||
private final SgDutyGateway sgDutyGateway;
|
||||
private final SgDutyRepository sgDutyRepository;
|
||||
private final SgDutyPushSupport sgDutyPushSupport;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean execute(Long id) {
|
||||
SgDutyDO sgDutyDO = sgDutyRepository.getById(id);
|
||||
if (sgDutyDO == null) {
|
||||
throw new BizException("该数据不存在");
|
||||
}
|
||||
|
||||
boolean res = sgDutyGateway.deletedSgDutyById(id);
|
||||
if (!res) {
|
||||
throw new BizException("删除失败");
|
||||
}
|
||||
sgDutyPushSupport.pushDuty(sgDutyDO, PushOperationTypeEnum.DELETE);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean execute(Long[] ids) {
|
||||
boolean res = sgDutyGateway.deletedSgDutyByIds(ids);
|
||||
if (!res) {
|
||||
throw new BizException("删除失败");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
package com.zcloud.safety.command;
|
||||
|
||||
import com.alibaba.cola.exception.BizException;
|
||||
import com.zcloud.safety.domain.enums.PushOperationTypeEnum;
|
||||
import com.zcloud.safety.domain.gateway.SgDutyGateway;
|
||||
import com.zcloud.safety.domain.model.SgDutyE;
|
||||
import com.zcloud.safety.dto.SgDutyUpdateCmd;
|
||||
import com.zcloud.safety.persistence.dataobject.SgDutyDO;
|
||||
import com.zcloud.safety.persistence.repository.SgDutyRepository;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* 值班统计修改执行器。
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class SgDutyUpdateExe {
|
||||
|
||||
private final SgDutyGateway sgDutyGateway;
|
||||
private final SgDutyRepository sgDutyRepository;
|
||||
private final SgDutyPushSupport sgDutyPushSupport;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void execute(SgDutyUpdateCmd cmd) {
|
||||
SgDutyDO oldDuty = sgDutyRepository.getById(cmd.getId());
|
||||
if (oldDuty == null) {
|
||||
throw new BizException("该数据不存在");
|
||||
}
|
||||
|
||||
try {
|
||||
SgDutyE sgDutyE = new SgDutyE();
|
||||
BeanUtils.copyProperties(cmd, sgDutyE);
|
||||
boolean res = sgDutyGateway.update(sgDutyE);
|
||||
if (!res) {
|
||||
throw new BizException("修改失败");
|
||||
}
|
||||
|
||||
SgDutyDO latestDuty = sgDutyRepository.getById(cmd.getId());
|
||||
if (latestDuty == null) {
|
||||
throw new BizException("修改后未查询到值班统计数据");
|
||||
}
|
||||
|
||||
sgDutyPushSupport.pushDuty(latestDuty, PushOperationTypeEnum.UPDATE);
|
||||
} catch (BizException e) {
|
||||
log.error("修改值班统计失败,主键:{},原因:{}", cmd.getId(), e.getMessage(), e);
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
log.error("修改值班统计失败,主键:{}", cmd.getId(), e);
|
||||
throw new BizException("修改失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,117 @@
|
|||
package com.zcloud.safety.command;
|
||||
|
||||
import cn.hutool.crypto.SmUtil;
|
||||
import cn.hutool.crypto.symmetric.SM4;
|
||||
import com.alibaba.cola.exception.BizException;
|
||||
import com.zcloud.gbscommon.utils.Tools;
|
||||
import com.zcloud.gbscommon.zcloudimgfiles.facade.ZcloudImgFilesFacade;
|
||||
import com.zcloud.safety.domain.gateway.SgInformGateway;
|
||||
import com.zcloud.safety.domain.model.SgInformE;
|
||||
import com.zcloud.safety.domain.utils.EncryptAndDecryptUtil;
|
||||
import com.zcloud.safety.dto.SgInformAddCmd;
|
||||
import com.zcloud.safety.dto.receive.SgInformAddDTO;
|
||||
import com.zcloud.safety.persistence.dataobject.ImgFilesDO;
|
||||
import com.zcloud.safety.persistence.repository.ImgFilesRepository;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 通知新增执行器。
|
||||
*/
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class SgInformAddExe {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(SgInformAddExe.class);
|
||||
private static final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
private final SgInformGateway sgInformGateway;
|
||||
private final ImgFilesRepository imgFilesRepository;
|
||||
|
||||
@DubboReference
|
||||
private ZcloudImgFilesFacade zcloudImgFilesFacade;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean execute(SgInformAddCmd cmd) {
|
||||
SgInformE sgInformE = new SgInformE();
|
||||
BeanUtils.copyProperties(cmd, sgInformE);
|
||||
boolean res = false;
|
||||
try {
|
||||
res = sgInformGateway.add(sgInformE);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
if (!res) {
|
||||
throw new BizException("保存失败");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void addReceive(SgInformAddDTO inform, String key, MultipartFile[] files) {
|
||||
SgInformE sgInformE = new SgInformE();
|
||||
BeanUtils.copyProperties(inform, sgInformE);
|
||||
|
||||
// 通知接收接口未传业务主键,按当前约定每次生成新的 informId 并绑定图片外键。
|
||||
sgInformE.setInformId(Tools.get32UUID());
|
||||
handleCreateFields(sgInformE, inform);
|
||||
|
||||
try {
|
||||
log.info("开始处理数港通知入库,通知业务主键:{},附件数量:{}", sgInformE.getInformId(), files == null ? 0 : files.length);
|
||||
boolean addResult = sgInformGateway.add(sgInformE);
|
||||
if (!addResult) {
|
||||
throw new BizException("通知保存失败");
|
||||
}
|
||||
log.info("数港通知主表新增完成,通知业务主键:{}", sgInformE.getInformId());
|
||||
|
||||
if (files != null && files.length > 0) {
|
||||
saveInformFiles(sgInformE.getInformId(), key, files);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("处理数港通知入库失败,通知业务主键:{},附件数量:{}", sgInformE.getInformId(), files == null ? 0 : files.length, e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private void handleCreateFields(SgInformE sgInformE, SgInformAddDTO inform) {
|
||||
if (StringUtils.isNotBlank(inform.getCreateBy())) {
|
||||
sgInformE.setCreateName(inform.getCreateBy().trim());
|
||||
}
|
||||
if (StringUtils.isNotBlank(inform.getCreateTime())) {
|
||||
sgInformE.setCreateTime(LocalDateTime.parse(inform.getCreateTime().trim(), DATE_TIME_FORMATTER));
|
||||
}
|
||||
}
|
||||
|
||||
private void saveInformFiles(String informId, String key, MultipartFile[] files) throws Exception {
|
||||
List<ImgFilesDO> imgFilesDOList = new ArrayList<>();
|
||||
byte[] decryptKey = EncryptAndDecryptUtil.decryptSm2(key);
|
||||
for (MultipartFile multipartFile : files) {
|
||||
SM4 sm4 = SmUtil.sm4(decryptKey);
|
||||
byte[] decrypt = sm4.decrypt(multipartFile.getInputStream());
|
||||
String fileName = Tools.get32UUID() + multipartFile.getOriginalFilename().substring(multipartFile.getOriginalFilename().lastIndexOf("."));
|
||||
String filePath = zcloudImgFilesFacade.saveFileNoCorpinfoId(decrypt, fileName, "inform");
|
||||
|
||||
ImgFilesDO imgFilesDO = new ImgFilesDO();
|
||||
imgFilesDO.setImgFilesId(Tools.get32UUID());
|
||||
imgFilesDO.setFilePath(filePath);
|
||||
imgFilesDO.setForeignKey(informId);
|
||||
imgFilesDO.setFileName(multipartFile.getOriginalFilename());
|
||||
imgFilesDO.setType(3);
|
||||
imgFilesDOList.add(imgFilesDO);
|
||||
}
|
||||
imgFilesRepository.saveBatch(imgFilesDOList);
|
||||
log.info("数港通知附件保存完成,通知业务主键:{},附件数量:{}", informId, imgFilesDOList.size());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
package com.zcloud.safety.command;
|
||||
|
||||
import com.alibaba.cola.exception.BizException;
|
||||
import com.zcloud.safety.domain.gateway.SgInformGateway;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
|
||||
/**
|
||||
* web-app
|
||||
*
|
||||
* @Author zhaokai
|
||||
* @Date 2026-06-01 16:22:01
|
||||
*/
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class SgInformRemoveExe {
|
||||
private final SgInformGateway sgInformGateway;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean execute(Long id) {
|
||||
boolean res = sgInformGateway.deletedSgInformById(id);
|
||||
if (!res) {
|
||||
throw new BizException("删除失败");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean execute(Long[] ids) {
|
||||
boolean res = sgInformGateway.deletedSgInformByIds(ids);
|
||||
if (!res) {
|
||||
throw new BizException("删除失败");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
package com.zcloud.safety.command;
|
||||
|
||||
import com.alibaba.cola.exception.BizException;
|
||||
import com.zcloud.safety.domain.gateway.SgInformGateway;
|
||||
import com.zcloud.safety.domain.model.SgInformE;
|
||||
import com.zcloud.safety.dto.SgInformUpdateCmd;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
|
||||
/**
|
||||
* web-app
|
||||
*
|
||||
* @Author zhaokai
|
||||
* @Date 2026-06-01 16:22:02
|
||||
*/
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class SgInformUpdateExe {
|
||||
private final SgInformGateway sgInformGateway;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void execute(SgInformUpdateCmd sgInformUpdateCmd) {
|
||||
SgInformE sgInformE = new SgInformE();
|
||||
BeanUtils.copyProperties(sgInformUpdateCmd, sgInformE);
|
||||
boolean res = sgInformGateway.update(sgInformE);
|
||||
if (!res) {
|
||||
throw new BizException("修改失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,153 @@
|
|||
package com.zcloud.safety.command;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.crypto.SmUtil;
|
||||
import cn.hutool.crypto.symmetric.SM4;
|
||||
import com.alibaba.cola.exception.BizException;
|
||||
import com.zcloud.gbscommon.utils.Tools;
|
||||
import com.zcloud.gbscommon.zcloudimgfiles.facade.ZcloudImgFilesFacade;
|
||||
import com.zcloud.safety.domain.gateway.SgNoticeGateway;
|
||||
import com.zcloud.safety.domain.model.SgNoticeE;
|
||||
import com.zcloud.safety.domain.utils.EncryptAndDecryptUtil;
|
||||
import com.zcloud.safety.dto.SgNoticeAddCmd;
|
||||
import com.zcloud.safety.dto.receive.SgNoticeAddDTO;
|
||||
import com.zcloud.safety.persistence.dataobject.ImgFilesDO;
|
||||
import com.zcloud.safety.persistence.dataobject.SgNoticeDO;
|
||||
import com.zcloud.safety.persistence.repository.ImgFilesRepository;
|
||||
import com.zcloud.safety.persistence.repository.SgNoticeRepository;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 公告新增执行器。
|
||||
*/
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class SgNoticeAddExe {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(SgNoticeAddExe.class);
|
||||
|
||||
private final SgNoticeGateway sgNoticeGateway;
|
||||
private final SgNoticeRepository sgNoticeRepository;
|
||||
private final ImgFilesRepository imgFilesRepository;
|
||||
|
||||
@DubboReference
|
||||
private ZcloudImgFilesFacade zcloudImgFilesFacade;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean execute(SgNoticeAddCmd cmd) {
|
||||
SgNoticeE sgNoticeE = new SgNoticeE();
|
||||
BeanUtils.copyProperties(cmd, sgNoticeE);
|
||||
boolean res = false;
|
||||
try {
|
||||
res = sgNoticeGateway.add(sgNoticeE);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
if (!res) {
|
||||
throw new BizException("保存失败");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void addReceive(SgNoticeAddDTO notice, String key, MultipartFile[] files) {
|
||||
SgNoticeE sgNoticeE = new SgNoticeE();
|
||||
BeanUtils.copyProperties(notice, sgNoticeE);
|
||||
handleCreateFields(sgNoticeE, notice);
|
||||
|
||||
try {
|
||||
log.info("开始处理数港公告入库,公告业务主键:{},附件数量:{}", notice.getNoticeId(), files == null ? 0 : files.length);
|
||||
String noticeId = notice.getNoticeId();
|
||||
|
||||
SgNoticeDO byNoticeId = null;
|
||||
if (StringUtils.isNotBlank(noticeId)) {
|
||||
byNoticeId = sgNoticeRepository.getByNoticeId(noticeId);
|
||||
if (byNoticeId != null) {
|
||||
deleteOldImages(byNoticeId.getNoticeId(), files);
|
||||
log.info("检测到已存在公告数据,执行更新,公告业务主键:{}", noticeId);
|
||||
} else {
|
||||
sgNoticeE.setNoticeId(Tools.get32UUID());
|
||||
log.info("检测到首次接收公告数据,执行新增,公告业务主键:{}", noticeId);
|
||||
}
|
||||
} else {
|
||||
sgNoticeE.setNoticeId(Tools.get32UUID());
|
||||
log.info("公告业务主键为空,执行新增操作");
|
||||
}
|
||||
|
||||
if (files != null && files.length > 0) {
|
||||
List<ImgFilesDO> imgFilesDOList = new ArrayList<>();
|
||||
for (MultipartFile multipartFile : files) {
|
||||
SM4 sm4 = SmUtil.sm4(EncryptAndDecryptUtil.decryptSm2(key));
|
||||
byte[] decrypt = sm4.decrypt(multipartFile.getInputStream());
|
||||
// 生成文件名
|
||||
String fileName = Tools.get32UUID() + multipartFile.getOriginalFilename().substring(multipartFile.getOriginalFilename().lastIndexOf("."));
|
||||
String filePath = zcloudImgFilesFacade.saveFileNoCorpinfoId(decrypt, fileName, "notice");
|
||||
|
||||
ImgFilesDO imgFilesDO = new ImgFilesDO();
|
||||
imgFilesDO.setImgFilesId(Tools.get32UUID());
|
||||
imgFilesDO.setFilePath(filePath);
|
||||
imgFilesDO.setForeignKey(sgNoticeE.getNoticeId());
|
||||
imgFilesDO.setFileName(multipartFile.getOriginalFilename());
|
||||
imgFilesDO.setType(2);
|
||||
imgFilesDOList.add(imgFilesDO);
|
||||
}
|
||||
imgFilesRepository.saveBatch(imgFilesDOList);
|
||||
log.info("数港公告附件保存完成,公告业务主键:{},图片数量:{}", notice.getNoticeId(), imgFilesDOList.size());
|
||||
}
|
||||
|
||||
if (byNoticeId != null) {
|
||||
sgNoticeE.setId(byNoticeId.getId());
|
||||
sgNoticeGateway.update(sgNoticeE);
|
||||
log.info("数港公告更新完成,公告业务主键:{}", notice.getNoticeId());
|
||||
} else {
|
||||
sgNoticeGateway.add(sgNoticeE);
|
||||
log.info("数港公告新增完成,公告业务主键:{}", notice.getNoticeId());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("处理数港公告入库失败,公告业务主键:{},附件数量:{}", notice == null ? null : notice.getNoticeId(), files == null ? 0 : files.length, e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 处理创建人和创建时间字段的转换
|
||||
*/
|
||||
private void handleCreateFields(SgNoticeE sgNoticeE, SgNoticeAddDTO notice) {
|
||||
if (StringUtils.isNotBlank(notice.getCreateBy())) {
|
||||
sgNoticeE.setCreateName(notice.getCreateBy());
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(notice.getCreateTime())) {
|
||||
try {
|
||||
LocalDateTime createTime = LocalDateTime.parse(notice.getCreateTime().trim(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||
sgNoticeE.setCreateTime(createTime);
|
||||
} catch (Exception e) {
|
||||
log.warn("解析创建时间失败,使用当前时间,原始值:{},错误:{}", notice.getCreateTime(), e.getMessage());
|
||||
sgNoticeE.setCreateTime(LocalDateTime.now());
|
||||
}
|
||||
} else {
|
||||
sgNoticeE.setCreateTime(LocalDateTime.now());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 公告带新附件重传时,先逻辑删除旧图片,避免明细重复。
|
||||
*/
|
||||
private void deleteOldImages(String noticeId, MultipartFile[] files) {
|
||||
if (files != null && files.length > 0) {
|
||||
imgFilesRepository.deletedImgFilesByForeignId(noticeId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
package com.zcloud.safety.command;
|
||||
|
||||
import com.alibaba.cola.exception.BizException;
|
||||
import com.zcloud.safety.domain.gateway.SgNoticeGateway;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
|
||||
/**
|
||||
* web-app
|
||||
*
|
||||
* @Author zhaokai
|
||||
* @Date 2026-06-01 16:20:44
|
||||
*/
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class SgNoticeRemoveExe {
|
||||
private final SgNoticeGateway sgNoticeGateway;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean execute(Long id) {
|
||||
boolean res = sgNoticeGateway.deletedSgNoticeById(id);
|
||||
if (!res) {
|
||||
throw new BizException("删除失败");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean execute(Long[] ids) {
|
||||
boolean res = sgNoticeGateway.deletedSgNoticeByIds(ids);
|
||||
if (!res) {
|
||||
throw new BizException("删除失败");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
package com.zcloud.safety.command;
|
||||
|
||||
import com.alibaba.cola.exception.BizException;
|
||||
import com.zcloud.safety.domain.gateway.SgNoticeGateway;
|
||||
import com.zcloud.safety.domain.model.SgNoticeE;
|
||||
import com.zcloud.safety.dto.SgNoticeUpdateCmd;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
|
||||
/**
|
||||
* web-app
|
||||
*
|
||||
* @Author zhaokai
|
||||
* @Date 2026-06-01 16:20:45
|
||||
*/
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class SgNoticeUpdateExe {
|
||||
private final SgNoticeGateway sgNoticeGateway;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void execute(SgNoticeUpdateCmd sgNoticeUpdateCmd) {
|
||||
SgNoticeE sgNoticeE = new SgNoticeE();
|
||||
BeanUtils.copyProperties(sgNoticeUpdateCmd, sgNoticeE);
|
||||
boolean res = sgNoticeGateway.update(sgNoticeE);
|
||||
if (!res) {
|
||||
throw new BizException("修改失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,226 @@
|
|||
package com.zcloud.safety.command;
|
||||
|
||||
import cn.hutool.crypto.SmUtil;
|
||||
import cn.hutool.crypto.symmetric.SM4;
|
||||
import com.alibaba.cola.exception.BizException;
|
||||
import com.zcloud.gbscommon.utils.Tools;
|
||||
import com.zcloud.gbscommon.zcloudimgfiles.facade.ZcloudImgFilesFacade;
|
||||
import com.zcloud.safety.domain.enums.PushOperationTypeEnum;
|
||||
import com.zcloud.safety.domain.gateway.SgReferenceGateway;
|
||||
import com.zcloud.safety.domain.model.SgReferenceE;
|
||||
import com.zcloud.safety.domain.utils.EncryptAndDecryptUtil;
|
||||
import com.zcloud.safety.dto.SgReferenceAddCmd;
|
||||
import com.zcloud.safety.dto.receive.SgReferenceReceiveDTO;
|
||||
import com.zcloud.safety.persistence.dataobject.ImgFilesDO;
|
||||
import com.zcloud.safety.persistence.dataobject.SgReferenceDO;
|
||||
import com.zcloud.safety.persistence.repository.ImgFilesRepository;
|
||||
import com.zcloud.safety.persistence.repository.SgReferenceRepository;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 互学互鉴新增执行器。
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class SgReferenceAddExe {
|
||||
|
||||
private static final int REFERENCE_FILE_TYPE = 6;
|
||||
private static final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
private final SgReferenceGateway sgReferenceGateway;
|
||||
private final SgReferenceRepository sgReferenceRepository;
|
||||
private final ImgFilesRepository imgFilesRepository;
|
||||
private final SgReferencePushSupport sgReferencePushSupport;
|
||||
|
||||
@DubboReference
|
||||
private ZcloudImgFilesFacade zcloudImgFilesFacade;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean execute(SgReferenceAddCmd cmd) {
|
||||
SgReferenceE sgReferenceE = new SgReferenceE();
|
||||
BeanUtils.copyProperties(cmd, sgReferenceE);
|
||||
|
||||
try {
|
||||
boolean res = sgReferenceGateway.add(sgReferenceE);
|
||||
if (!res) {
|
||||
throw new BizException("保存失败");
|
||||
}
|
||||
if (sgReferenceE.getId() == null) {
|
||||
throw new BizException("新增互学互鉴后未获取到主键");
|
||||
}
|
||||
|
||||
syncReferenceBusinessFields(sgReferenceE.getId(), cmd.getFiles(), false, null);
|
||||
SgReferenceDO latestReference = sgReferenceRepository.getById(sgReferenceE.getId());
|
||||
if (latestReference == null) {
|
||||
throw new BizException("新增互学互鉴后未查询到数据");
|
||||
}
|
||||
|
||||
sgReferencePushSupport.pushReference(latestReference, PushOperationTypeEnum.ADD);
|
||||
log.info("互学互鉴新增完成,本地主键:{},附件数量:{}", sgReferenceE.getId(), cmd.getFiles() == null ? 0 : cmd.getFiles().length);
|
||||
return true;
|
||||
} catch (BizException e) {
|
||||
log.error("新增互学互鉴失败,原因:{}", e.getMessage(), e);
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
log.error("新增互学互鉴失败", e);
|
||||
throw new BizException("保存失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 接收数港推送的互学互鉴数据,业务表只保存主数据,附件统一落到附件表。
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void addReceive(SgReferenceReceiveDTO reference, String key, MultipartFile[] files) {
|
||||
try {
|
||||
SgReferenceDO oldReference = resolveReceiveTarget(reference);
|
||||
if (oldReference != null) {
|
||||
updateReceiveReference(oldReference, reference, key, files);
|
||||
return;
|
||||
}
|
||||
addReceiveReference(reference, key, files);
|
||||
} catch (BizException e) {
|
||||
log.error("接收数港互学互鉴失败,事故经验id:{},原因:{}", reference == null ? null : reference.getAccidentId(), e.getMessage(), e);
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
log.error("接收数港互学互鉴失败,事故经验id:{}", reference == null ? null : reference.getAccidentId(), e);
|
||||
throw new BizException("保存失败");
|
||||
}
|
||||
}
|
||||
|
||||
private SgReferenceDO resolveReceiveTarget(SgReferenceReceiveDTO reference) {
|
||||
if (reference == null || reference.getAccidentId() == null) {
|
||||
return null;
|
||||
}
|
||||
return sgReferenceRepository.getById(reference.getAccidentId());
|
||||
}
|
||||
|
||||
private void addReceiveReference(SgReferenceReceiveDTO reference, String key, MultipartFile[] files) throws Exception {
|
||||
SgReferenceE sgReferenceE = new SgReferenceE();
|
||||
sgReferenceE.setTitle(reference.getTitle().trim());
|
||||
if (reference.getAccidentId() != null) {
|
||||
sgReferenceE.setReferenceId(String.valueOf(reference.getAccidentId()));
|
||||
}
|
||||
fillCreateFields(sgReferenceE, reference);
|
||||
|
||||
boolean res = sgReferenceGateway.add(sgReferenceE);
|
||||
if (!res || sgReferenceE.getId() == null) {
|
||||
throw new BizException("接收互学互鉴数据保存失败");
|
||||
}
|
||||
|
||||
syncReferenceBusinessFields(sgReferenceE.getId(), files, true, key);
|
||||
log.info("接收数港互学互鉴新增完成,本地主键:{},事故经验id:{},附件数量:{}", sgReferenceE.getId(), reference.getAccidentId(), files == null ? 0 : files.length);
|
||||
}
|
||||
|
||||
private void updateReceiveReference(SgReferenceDO oldReference, SgReferenceReceiveDTO reference, String key, MultipartFile[] files) throws Exception {
|
||||
SgReferenceE sgReferenceE = new SgReferenceE();
|
||||
sgReferenceE.setId(oldReference.getId());
|
||||
sgReferenceE.setTitle(reference.getTitle().trim());
|
||||
fillCreateFields(sgReferenceE, reference);
|
||||
|
||||
boolean res = sgReferenceGateway.update(sgReferenceE);
|
||||
if (!res) {
|
||||
throw new BizException("接收互学互鉴数据更新失败");
|
||||
}
|
||||
|
||||
if (files != null && files.length > 0) {
|
||||
imgFilesRepository.deletedImgFilesByForeignId(oldReference.getReferenceId());
|
||||
}
|
||||
syncReferenceBusinessFields(oldReference.getId(), files, true, key);
|
||||
log.info("接收数港互学互鉴更新完成,本地主键:{},事故经验id:{},附件数量:{}", oldReference.getId(), reference.getAccidentId(), files == null ? 0 : files.length);
|
||||
}
|
||||
|
||||
/**
|
||||
* 互学互鉴业务表只同步业务主键,附件信息全部以 img_files 为准。
|
||||
*/
|
||||
private void syncReferenceBusinessFields(Long id, MultipartFile[] files, boolean encrypted, String key) throws Exception {
|
||||
SgReferenceDO currentReference = sgReferenceRepository.getById(id);
|
||||
if (currentReference == null) {
|
||||
throw new BizException("互学互鉴数据不存在");
|
||||
}
|
||||
if (encrypted) {
|
||||
saveReceiveFiles(currentReference.getReferenceId(), key, files);
|
||||
} else {
|
||||
saveLocalFiles(currentReference.getReferenceId(), files);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void fillCreateFields(SgReferenceE sgReferenceE, SgReferenceReceiveDTO reference) {
|
||||
if (StringUtils.isNotBlank(reference.getCreateBy())) {
|
||||
sgReferenceE.setCreateName(reference.getCreateBy().trim());
|
||||
}
|
||||
if (StringUtils.isNotBlank(reference.getCreateTime())) {
|
||||
sgReferenceE.setCreateTime(LocalDateTime.parse(reference.getCreateTime().trim(), DATE_TIME_FORMATTER));
|
||||
}
|
||||
}
|
||||
|
||||
private void saveLocalFiles(String referenceId, MultipartFile[] files) throws Exception {
|
||||
if (files == null || files.length == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<ImgFilesDO> imgFilesDOList = new ArrayList<>();
|
||||
for (MultipartFile file : files) {
|
||||
if (file == null || file.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
String fileName = Tools.get32UUID() + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
|
||||
|
||||
String filePath = zcloudImgFilesFacade.saveFileNoCorpinfoId(file.getBytes(), fileName, "reference");
|
||||
imgFilesDOList.add(buildImgFile(referenceId, file.getOriginalFilename(), filePath));
|
||||
}
|
||||
saveImgFiles(referenceId, imgFilesDOList);
|
||||
}
|
||||
|
||||
private void saveReceiveFiles(String referenceId, String key, MultipartFile[] files) throws Exception {
|
||||
if (files == null || files.length == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
byte[] decryptKey = EncryptAndDecryptUtil.decryptSm2(key);
|
||||
List<ImgFilesDO> imgFilesDOList = new ArrayList<>();
|
||||
for (MultipartFile file : files) {
|
||||
if (file == null || file.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
SM4 sm4 = SmUtil.sm4(decryptKey);
|
||||
byte[] decrypt = sm4.decrypt(file.getInputStream());
|
||||
String fileName = Tools.get32UUID() + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
|
||||
String filePath = zcloudImgFilesFacade.saveFileNoCorpinfoId(decrypt, fileName, "reference");
|
||||
imgFilesDOList.add(buildImgFile(referenceId, file.getOriginalFilename(), filePath));
|
||||
}
|
||||
saveImgFiles(referenceId, imgFilesDOList);
|
||||
}
|
||||
|
||||
private ImgFilesDO buildImgFile(String referenceId, String fileName, String filePath) {
|
||||
ImgFilesDO imgFilesDO = new ImgFilesDO();
|
||||
imgFilesDO.setImgFilesId(Tools.get32UUID());
|
||||
imgFilesDO.setFilePath(filePath);
|
||||
imgFilesDO.setForeignKey(referenceId);
|
||||
imgFilesDO.setFileName(fileName);
|
||||
imgFilesDO.setType(REFERENCE_FILE_TYPE);
|
||||
return imgFilesDO;
|
||||
}
|
||||
|
||||
private void saveImgFiles(String referenceId, List<ImgFilesDO> imgFilesDOList) {
|
||||
if (imgFilesDOList == null || imgFilesDOList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
imgFilesRepository.saveBatch(imgFilesDOList);
|
||||
log.info("互学互鉴附件保存完成,本地主键:{},附件数量:{}", referenceId, imgFilesDOList.size());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,227 @@
|
|||
package com.zcloud.safety.command;
|
||||
|
||||
import com.alibaba.cola.exception.BizException;
|
||||
import com.zcloud.safety.domain.config.SgProperties;
|
||||
import com.zcloud.safety.domain.enums.PushOperationTypeEnum;
|
||||
import com.zcloud.safety.domain.enums.PushSourceEnum;
|
||||
import com.zcloud.safety.domain.utils.TokenUtils;
|
||||
import com.zcloud.safety.persistence.dataobject.ImgFilesDO;
|
||||
import com.zcloud.safety.persistence.dataobject.SgReferenceDO;
|
||||
import com.zcloud.safety.persistence.repository.ImgFilesRepository;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.StreamUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 互学互鉴数港推送支持。
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class SgReferencePushSupport {
|
||||
|
||||
private static final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
private static final PushSourceEnum DEFAULT_SOURCE = PushSourceEnum.QINGANG_GUFEN;
|
||||
|
||||
private final SgProperties sgProperties;
|
||||
private final ImgFilesRepository imgFilesRepository;
|
||||
|
||||
/**
|
||||
* 互学互鉴推送统一从附件表读取文件信息,避免业务表继续维护冗余附件字段。
|
||||
*/
|
||||
public void pushReference(SgReferenceDO sgReferenceDO, PushOperationTypeEnum operationType) {
|
||||
if (sgReferenceDO == null || sgReferenceDO.getId() == null) {
|
||||
throw new BizException("互学互鉴数据不存在,无法推送数港");
|
||||
}
|
||||
if (operationType == null) {
|
||||
throw new BizException("互学互鉴推送操作类型不能为空");
|
||||
}
|
||||
|
||||
try {
|
||||
String token = resolveToken();
|
||||
List<ImgFilesDO> imgFilesDOList = imgFilesRepository.listByForeignKey(String.valueOf(sgReferenceDO.getId()));
|
||||
Map<String, Object> requestData = buildRequestData(sgReferenceDO, operationType, imgFilesDOList);
|
||||
MultipartFile[] pushFiles = buildPushFiles(imgFilesDOList);
|
||||
log.info("开始推送互学互鉴到数港,操作类型:{}-{},来源:{}-{},本地主键:{},附件数量:{},请求数据:{}",
|
||||
operationType.getCode(), operationType.getValue(), DEFAULT_SOURCE.getCode(), DEFAULT_SOURCE.getValue(),
|
||||
sgReferenceDO.getId(), pushFiles.length, requestData);
|
||||
if (sgProperties.getEnabled() == null || !sgProperties.getEnabled()) {
|
||||
log.info("模拟真实推送互学互鉴到数港,操作类型:{}-{},本地主键:{},url:{},附件数量:{}",
|
||||
operationType.getCode(), operationType.getValue(), sgReferenceDO.getId(), sgProperties.getReferenceUrl(), pushFiles.length);
|
||||
} else {
|
||||
TokenUtils.sendDataToThirdParty(sgProperties.getReferenceUrl(), requestData, token, pushFiles);
|
||||
}
|
||||
// TokenUtils.sendDataToThirdPartyTwo(sgProperties.getReferenceUrl(), requestData, token, pushFiles);
|
||||
log.info("推送互学互鉴到数港成功,操作类型:{}-{},本地主键:{}",
|
||||
operationType.getCode(), operationType.getValue(), sgReferenceDO.getId());
|
||||
} catch (BizException e) {
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
log.error("推送互学互鉴到数港失败,操作类型:{}-{},本地主键:{}",
|
||||
operationType.getCode(), operationType.getValue(), sgReferenceDO.getId(), e);
|
||||
throw new BizException("推送数港失败");
|
||||
}
|
||||
}
|
||||
|
||||
private String resolveToken() throws Exception {
|
||||
String token;
|
||||
if (sgProperties.getEnabled() == null || !sgProperties.getEnabled()) {
|
||||
token = "tokenAAAA";
|
||||
} else {
|
||||
token = TokenUtils.getTokenFromThirdParty(sgProperties.getTokenUrl());
|
||||
}
|
||||
if (!StringUtils.hasText(token)) {
|
||||
throw new BizException("获取数港token失败");
|
||||
}
|
||||
return token;
|
||||
}
|
||||
|
||||
private Map<String, Object> buildRequestData(SgReferenceDO sgReferenceDO, PushOperationTypeEnum operationType, List<ImgFilesDO> imgFilesDOList) {
|
||||
Map<String, Object> requestData = new HashMap<>();
|
||||
requestData.put("operationType", operationType.getCode());
|
||||
requestData.put("accidentId", sgReferenceDO.getId());
|
||||
requestData.put("title", defaultString(sgReferenceDO.getTitle()));
|
||||
requestData.put("source", DEFAULT_SOURCE.getCode());
|
||||
requestData.put("fileName", resolveFileNames(imgFilesDOList));
|
||||
requestData.put("createBy", resolveCreateBy(sgReferenceDO));
|
||||
requestData.put("createTime", formatDateTime(sgReferenceDO.getCreateTime()));
|
||||
return requestData;
|
||||
}
|
||||
|
||||
private MultipartFile[] buildPushFiles(List<ImgFilesDO> imgFilesDOList) throws IOException {
|
||||
if (imgFilesDOList == null || imgFilesDOList.isEmpty()) {
|
||||
return new MultipartFile[0];
|
||||
}
|
||||
|
||||
List<MultipartFile> multipartFileList = new ArrayList<>();
|
||||
for (ImgFilesDO imgFilesDO : imgFilesDOList) {
|
||||
if (imgFilesDO == null || !StringUtils.hasText(imgFilesDO.getFilePath()) || !StringUtils.hasText(imgFilesDO.getFileName())) {
|
||||
continue;
|
||||
}
|
||||
byte[] fileBytes = readFileBytes(imgFilesDO.getFilePath());
|
||||
multipartFileList.add(new StoredMultipartFile(imgFilesDO.getFileName(), fileBytes));
|
||||
}
|
||||
return multipartFileList.toArray(new MultipartFile[0]);
|
||||
}
|
||||
|
||||
private byte[] readFileBytes(String filePath) throws IOException {
|
||||
try {
|
||||
Path localPath = Paths.get(filePath);
|
||||
if (Files.exists(localPath)) {
|
||||
return Files.readAllBytes(localPath);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.debug("互学互鉴附件路径不是本地文件,尝试按远程地址读取,路径:{}", filePath);
|
||||
}
|
||||
|
||||
try (InputStream inputStream = new URL(filePath).openStream()) {
|
||||
return StreamUtils.copyToByteArray(inputStream);
|
||||
} catch (Exception e) {
|
||||
throw new BizException("读取互学互鉴附件失败,路径:" + filePath);
|
||||
}
|
||||
}
|
||||
|
||||
private String resolveFileNames(List<ImgFilesDO> imgFilesDOList) {
|
||||
if (imgFilesDOList == null || imgFilesDOList.isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
|
||||
return imgFilesDOList.stream()
|
||||
.map(ImgFilesDO::getFileName)
|
||||
.filter(StringUtils::hasText)
|
||||
.collect(Collectors.joining(","));
|
||||
}
|
||||
|
||||
private String resolveCreateBy(SgReferenceDO sgReferenceDO) {
|
||||
if (StringUtils.hasText(sgReferenceDO.getCreateName())) {
|
||||
return sgReferenceDO.getCreateName();
|
||||
}
|
||||
if (StringUtils.hasText(sgReferenceDO.getUpdateName())) {
|
||||
return sgReferenceDO.getUpdateName();
|
||||
}
|
||||
return "系统";
|
||||
}
|
||||
|
||||
private String formatDateTime(LocalDateTime dateTime) {
|
||||
LocalDateTime target = dateTime == null ? LocalDateTime.now() : dateTime;
|
||||
return target.format(DATE_TIME_FORMATTER);
|
||||
}
|
||||
|
||||
private String defaultString(String value) {
|
||||
return value == null ? "" : value;
|
||||
}
|
||||
|
||||
/**
|
||||
* 仅在互学互鉴推送链路中使用的内存文件对象,用于把附件表中的文件重新组装成上传参数。
|
||||
*/
|
||||
private static class StoredMultipartFile implements MultipartFile {
|
||||
|
||||
private final String originalFilename;
|
||||
private final byte[] bytes;
|
||||
|
||||
private StoredMultipartFile(String originalFilename, byte[] bytes) {
|
||||
this.originalFilename = originalFilename;
|
||||
this.bytes = bytes == null ? new byte[0] : bytes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "file";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOriginalFilename() {
|
||||
return originalFilename;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getContentType() {
|
||||
return URLConnection.guessContentTypeFromName(originalFilename);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return bytes.length == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getSize() {
|
||||
return bytes.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] getBytes() {
|
||||
return bytes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputStream getInputStream() {
|
||||
return new ByteArrayInputStream(bytes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transferTo(File dest) throws IOException {
|
||||
Files.write(dest.toPath(), bytes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
package com.zcloud.safety.command;
|
||||
|
||||
import com.alibaba.cola.exception.BizException;
|
||||
import com.zcloud.safety.domain.enums.PushOperationTypeEnum;
|
||||
import com.zcloud.safety.domain.gateway.SgReferenceGateway;
|
||||
import com.zcloud.safety.persistence.dataobject.SgReferenceDO;
|
||||
import com.zcloud.safety.persistence.repository.ImgFilesRepository;
|
||||
import com.zcloud.safety.persistence.repository.SgReferenceRepository;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* 互学互鉴删除执行器。
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class SgReferenceRemoveExe {
|
||||
|
||||
private final SgReferenceGateway sgReferenceGateway;
|
||||
private final SgReferenceRepository sgReferenceRepository;
|
||||
private final ImgFilesRepository imgFilesRepository;
|
||||
private final SgReferencePushSupport sgReferencePushSupport;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean execute(Long id) {
|
||||
SgReferenceDO sgReferenceDO = sgReferenceRepository.getById(id);
|
||||
if (sgReferenceDO == null) {
|
||||
throw new BizException("该数据不存在");
|
||||
}
|
||||
|
||||
boolean res = sgReferenceGateway.deletedSgReferenceById(id);
|
||||
if (!res) {
|
||||
throw new BizException("删除失败");
|
||||
}
|
||||
|
||||
// 删除推送也要带上当前附件,因此先推送,再删除附件表数据。
|
||||
sgReferencePushSupport.pushReference(sgReferenceDO, PushOperationTypeEnum.DELETE);
|
||||
imgFilesRepository.deletedImgFilesByForeignId(String.valueOf(id));
|
||||
log.info("互学互鉴删除完成,本地主键:{}", id);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean execute(Long[] ids) {
|
||||
boolean res = sgReferenceGateway.deletedSgReferenceByIds(ids);
|
||||
if (!res) {
|
||||
throw new BizException("删除失败");
|
||||
}
|
||||
log.info("互学互鉴批量删除完成,数量:{}", ids == null ? 0 : ids.length);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,107 @@
|
|||
package com.zcloud.safety.command;
|
||||
|
||||
import com.alibaba.cola.exception.BizException;
|
||||
import com.zcloud.gbscommon.utils.Tools;
|
||||
import com.zcloud.gbscommon.zcloudimgfiles.facade.ZcloudImgFilesFacade;
|
||||
import com.zcloud.safety.domain.enums.PushOperationTypeEnum;
|
||||
import com.zcloud.safety.domain.gateway.SgReferenceGateway;
|
||||
import com.zcloud.safety.domain.model.SgReferenceE;
|
||||
import com.zcloud.safety.dto.SgReferenceUpdateCmd;
|
||||
import com.zcloud.safety.persistence.dataobject.ImgFilesDO;
|
||||
import com.zcloud.safety.persistence.dataobject.SgReferenceDO;
|
||||
import com.zcloud.safety.persistence.repository.ImgFilesRepository;
|
||||
import com.zcloud.safety.persistence.repository.SgReferenceRepository;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 互学互鉴修改执行器。
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class SgReferenceUpdateExe {
|
||||
|
||||
private static final int REFERENCE_FILE_TYPE = 6;
|
||||
|
||||
private final SgReferenceGateway sgReferenceGateway;
|
||||
private final SgReferenceRepository sgReferenceRepository;
|
||||
private final ImgFilesRepository imgFilesRepository;
|
||||
private final SgReferencePushSupport sgReferencePushSupport;
|
||||
|
||||
@DubboReference
|
||||
private ZcloudImgFilesFacade zcloudImgFilesFacade;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void execute(SgReferenceUpdateCmd cmd) {
|
||||
SgReferenceDO oldReference = sgReferenceRepository.getById(cmd.getId());
|
||||
if (oldReference == null) {
|
||||
throw new BizException("该数据不存在");
|
||||
}
|
||||
|
||||
try {
|
||||
SgReferenceE sgReferenceE = new SgReferenceE();
|
||||
BeanUtils.copyProperties(cmd, sgReferenceE);
|
||||
boolean res = sgReferenceGateway.update(sgReferenceE);
|
||||
if (!res) {
|
||||
throw new BizException("修改失败");
|
||||
}
|
||||
|
||||
replaceReferenceFiles(cmd.getReferenceId(), cmd.getFiles());
|
||||
SgReferenceDO latestReference = sgReferenceRepository.getById(cmd.getId());
|
||||
if (latestReference == null) {
|
||||
throw new BizException("修改后未查询到互学互鉴数据");
|
||||
}
|
||||
|
||||
sgReferencePushSupport.pushReference(latestReference, PushOperationTypeEnum.UPDATE);
|
||||
log.info("互学互鉴修改完成,本地主键:{},附件数量:{}", cmd.getId(), cmd.getFiles() == null ? 0 : cmd.getFiles().length);
|
||||
} catch (BizException e) {
|
||||
log.error("修改互学互鉴失败,主键:{},原因:{}", cmd.getId(), e.getMessage(), e);
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
log.error("修改互学互鉴失败,主键:{}", cmd.getId(), e);
|
||||
throw new BizException("修改失败");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新附件上传时只维护附件表,不再回写业务表冗余字段。
|
||||
*/
|
||||
private void replaceReferenceFiles(String referenceId, MultipartFile[] files) throws Exception {
|
||||
if (files == null || files.length == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
imgFilesRepository.deletedImgFilesByForeignId(referenceId);
|
||||
List<ImgFilesDO> imgFilesDOList = new ArrayList<>();
|
||||
for (MultipartFile file : files) {
|
||||
if (file == null || file.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
String fileName = Tools.get32UUID() + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
|
||||
String filePath = zcloudImgFilesFacade.saveFileNoCorpinfoId(file.getBytes(), fileName, "reference");
|
||||
ImgFilesDO imgFilesDO = new ImgFilesDO();
|
||||
imgFilesDO.setImgFilesId(Tools.get32UUID());
|
||||
imgFilesDO.setFilePath(filePath);
|
||||
imgFilesDO.setForeignKey(referenceId);
|
||||
imgFilesDO.setFileName(file.getOriginalFilename());
|
||||
imgFilesDO.setType(REFERENCE_FILE_TYPE);
|
||||
imgFilesDOList.add(imgFilesDO);
|
||||
}
|
||||
|
||||
if (!imgFilesDOList.isEmpty()) {
|
||||
imgFilesRepository.saveBatch(imgFilesDOList);
|
||||
log.info("互学互鉴附件保存完成,本地主键:{},附件数量:{}", referenceId, imgFilesDOList.size());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,112 @@
|
|||
package com.zcloud.safety.command;
|
||||
|
||||
import cn.hutool.crypto.SmUtil;
|
||||
import cn.hutool.crypto.symmetric.SM4;
|
||||
import com.alibaba.cola.exception.BizException;
|
||||
import com.zcloud.gbscommon.utils.Tools;
|
||||
import com.zcloud.gbscommon.zcloudimgfiles.facade.ZcloudImgFilesFacade;
|
||||
import com.zcloud.safety.domain.gateway.SgSuperviseGateway;
|
||||
import com.zcloud.safety.domain.model.SgSuperviseE;
|
||||
import com.zcloud.safety.domain.utils.EncryptAndDecryptUtil;
|
||||
import com.zcloud.safety.dto.SgSuperviseAddCmd;
|
||||
import com.zcloud.safety.dto.receive.SgSuperviseAddDTO;
|
||||
import com.zcloud.safety.persistence.dataobject.ImgFilesDO;
|
||||
import com.zcloud.safety.persistence.dataobject.SgSuperviseDO;
|
||||
import com.zcloud.safety.persistence.repository.ImgFilesRepository;
|
||||
import com.zcloud.safety.persistence.repository.SgSuperviseRepository;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 督办新增执行器。
|
||||
*/
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class SgSuperviseAddExe {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(SgSuperviseAddExe.class);
|
||||
|
||||
private final SgSuperviseGateway sgSuperviseGateway;
|
||||
private final SgSuperviseRepository sgSuperviseRepository;
|
||||
private final ImgFilesRepository imgFilesRepository;
|
||||
|
||||
@DubboReference
|
||||
private ZcloudImgFilesFacade zcloudImgFilesFacade;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean execute(SgSuperviseAddCmd cmd) {
|
||||
SgSuperviseE sgSuperviseE = new SgSuperviseE();
|
||||
BeanUtils.copyProperties(cmd, sgSuperviseE);
|
||||
boolean res;
|
||||
try {
|
||||
res = sgSuperviseGateway.add(sgSuperviseE);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
if (!res) {
|
||||
throw new BizException("保存失败");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void addReceive(SgSuperviseAddDTO supervise, String key, MultipartFile[] files) {
|
||||
SgSuperviseE sgSuperviseE = new SgSuperviseE();
|
||||
BeanUtils.copyProperties(supervise, sgSuperviseE);
|
||||
// 数港督办id按现有约定直接映射到本地主键id。
|
||||
sgSuperviseE.setId(supervise.getSuperviseId());
|
||||
|
||||
try {
|
||||
log.info("开始处理数港督办入库,督办id:{},附件数量:{}", supervise.getSuperviseId(), files == null ? 0 : files.length);
|
||||
SgSuperviseDO byId = sgSuperviseRepository.getById(supervise.getSuperviseId());
|
||||
if (byId != null) {
|
||||
log.info("检测到已存在督办数据,执行更新并清理历史图片,督办id:{},业务主键:{}", supervise.getSuperviseId(), byId.getSuperviseId());
|
||||
imgFilesRepository.deletedImgFilesByForeignId(byId.getSuperviseId());
|
||||
sgSuperviseE.setSuperviseId(byId.getSuperviseId());
|
||||
} else {
|
||||
sgSuperviseE.setSuperviseId(Tools.get32UUID());
|
||||
log.info("检测到首次接收督办数据,生成新的业务主键,督办id:{},业务主键:{}", supervise.getSuperviseId(), sgSuperviseE.getSuperviseId());
|
||||
}
|
||||
|
||||
if (files != null && files.length > 0) {
|
||||
List<ImgFilesDO> imgFilesDOList = new ArrayList<>();
|
||||
for (MultipartFile multipartFile : files) {
|
||||
SM4 sm4 = SmUtil.sm4(EncryptAndDecryptUtil.decryptSm2(key));
|
||||
byte[] decrypt = sm4.decrypt(multipartFile.getInputStream());
|
||||
String fileName = Tools.get32UUID() + multipartFile.getOriginalFilename().substring(multipartFile.getOriginalFilename().lastIndexOf("."));
|
||||
|
||||
String filePath = zcloudImgFilesFacade.saveFileNoCorpinfoId(decrypt, fileName, "supervise");
|
||||
|
||||
ImgFilesDO imgFilesDO = new ImgFilesDO();
|
||||
imgFilesDO.setImgFilesId(Tools.get32UUID());
|
||||
imgFilesDO.setFilePath(filePath);
|
||||
imgFilesDO.setForeignKey(sgSuperviseE.getSuperviseId());
|
||||
imgFilesDO.setFileName(multipartFile.getOriginalFilename());
|
||||
imgFilesDO.setType(1);
|
||||
imgFilesDOList.add(imgFilesDO);
|
||||
}
|
||||
imgFilesRepository.saveBatch(imgFilesDOList);
|
||||
log.info("数港督办附件保存完成,督办id:{},图片数量:{}", supervise.getSuperviseId(), imgFilesDOList.size());
|
||||
}
|
||||
|
||||
if (byId != null) {
|
||||
sgSuperviseGateway.update(sgSuperviseE);
|
||||
log.info("数港督办更新完成,督办id:{},业务主键:{}", supervise.getSuperviseId(), sgSuperviseE.getSuperviseId());
|
||||
} else {
|
||||
sgSuperviseGateway.add(sgSuperviseE);
|
||||
log.info("数港督办新增完成,督办id:{},业务主键:{}", supervise.getSuperviseId(), sgSuperviseE.getSuperviseId());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("处理数港督办入库失败,督办id:{},附件数量:{}", supervise == null ? null : supervise.getSuperviseId(), files == null ? 0 : files.length, e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
package com.zcloud.safety.command;
|
||||
|
||||
import com.alibaba.cola.exception.BizException;
|
||||
import com.zcloud.safety.domain.gateway.SgSuperviseGateway;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
|
||||
/**
|
||||
* web-app
|
||||
*
|
||||
* @Author zhaokai
|
||||
* @Date 2026-06-01 11:22:45
|
||||
*/
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class SgSuperviseRemoveExe {
|
||||
private final SgSuperviseGateway sgSuperviseGateway;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean execute(Long id) {
|
||||
boolean res = sgSuperviseGateway.deletedSgSuperviseById(id);
|
||||
if (!res) {
|
||||
throw new BizException("删除失败");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean execute(Long[] ids) {
|
||||
boolean res = sgSuperviseGateway.deletedSgSuperviseByIds(ids);
|
||||
if (!res) {
|
||||
throw new BizException("删除失败");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,156 @@
|
|||
package com.zcloud.safety.command;
|
||||
|
||||
import cn.hutool.core.io.IoUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.cola.dto.SingleResponse;
|
||||
import com.alibaba.cola.exception.BizException;
|
||||
import com.jjb.saas.message.client.message.facede.MessageFacade;
|
||||
import com.jjb.saas.message.client.message.request.MessageSendCmd;
|
||||
import com.jjb.saas.message.client.message.request.MessageTargetCmd;
|
||||
import com.zcloud.gbscommon.utils.Tools;
|
||||
import com.zcloud.gbscommon.utils.UuidUtil;
|
||||
import com.zcloud.gbscommon.zcloudimgfiles.facade.ZcloudImgFilesFacade;
|
||||
import com.zcloud.safety.domain.config.MessageConfig;
|
||||
import com.zcloud.safety.domain.config.SgProperties;
|
||||
import com.zcloud.safety.domain.gateway.SgSuperviseGateway;
|
||||
import com.zcloud.safety.domain.model.SgSuperviseE;
|
||||
import com.zcloud.safety.domain.utils.TokenUtils;
|
||||
import com.zcloud.safety.dto.SgSuperviseUpdateCmd;
|
||||
import com.zcloud.safety.persistence.dataobject.ImgFilesDO;
|
||||
import com.zcloud.safety.persistence.dataobject.SgSuperviseDO;
|
||||
import com.zcloud.safety.persistence.repository.ImgFilesRepository;
|
||||
import com.zcloud.safety.persistence.repository.SgSuperviseRepository;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 督办反馈修改执行器。
|
||||
*/
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
@Slf4j
|
||||
public class SgSuperviseUpdateExe {
|
||||
|
||||
private final SgSuperviseGateway sgSuperviseGateway;
|
||||
private final SgSuperviseRepository sgSuperviseRepository;
|
||||
private final ImgFilesRepository imgFilesRepository;
|
||||
private final SgProperties sgProperties;
|
||||
private MessageConfig messageConfig;
|
||||
@DubboReference
|
||||
private ZcloudImgFilesFacade zcloudImgFilesFacade;
|
||||
@DubboReference
|
||||
private MessageFacade messageFacade;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void execute(SgSuperviseUpdateCmd sgSuperviseUpdateCmd) {
|
||||
SgSuperviseDO byId = sgSuperviseRepository.getById(sgSuperviseUpdateCmd.getId());
|
||||
if (byId == null) {
|
||||
throw new BizException("该数据不存在");
|
||||
}
|
||||
if (sgSuperviseUpdateCmd.getFiles() == null || sgSuperviseUpdateCmd.getFiles().length == 0) {
|
||||
throw new BizException("图片不能为空");
|
||||
}
|
||||
|
||||
try {
|
||||
List<ImgFilesDO> imgFilesDOList = new ArrayList<>();
|
||||
for (MultipartFile multipartFile : sgSuperviseUpdateCmd.getFiles()) {
|
||||
InputStream inputStream = multipartFile.getInputStream();
|
||||
byte[] fileBytes = IoUtil.readBytes(inputStream);
|
||||
String fileName = Tools.get32UUID() + multipartFile.getOriginalFilename().substring(multipartFile.getOriginalFilename().lastIndexOf("."));
|
||||
String filePath = zcloudImgFilesFacade.saveFileNoCorpinfoId(fileBytes, fileName, "supervise");
|
||||
|
||||
ImgFilesDO imgFilesDO = new ImgFilesDO();
|
||||
imgFilesDO.setImgFilesId(Tools.get32UUID());
|
||||
imgFilesDO.setFilePath(filePath);
|
||||
imgFilesDO.setForeignKey(byId.getSuperviseId());
|
||||
imgFilesDO.setFileName(multipartFile.getOriginalFilename());
|
||||
imgFilesDO.setType(1);
|
||||
imgFilesDOList.add(imgFilesDO);
|
||||
}
|
||||
imgFilesRepository.saveBatch(imgFilesDOList);
|
||||
log.info("督办附件保存完成,督办业务主键:{},图片数量:{}", byId.getSuperviseId(), imgFilesDOList.size());
|
||||
|
||||
String token;
|
||||
if (sgProperties.getEnabled() == null || !sgProperties.getEnabled()) {
|
||||
token = "tokenAAAA";
|
||||
} else {
|
||||
token = TokenUtils.getTokenFromThirdParty(sgProperties.getTokenUrl());
|
||||
}
|
||||
if (token == null) {
|
||||
throw new BizException("获取token失败");
|
||||
}
|
||||
|
||||
Map<String, Object> requestData = new HashMap<>();
|
||||
requestData.put("superviseId", byId.getId());
|
||||
requestData.put("source", "1");
|
||||
// TokenUtils.sendDataToThirdParty(sgProperties.getSuperviseUrl(), requestData, token, sgSuperviseUpdateCmd.getFiles());
|
||||
if (sgProperties.getEnabled() == null || !sgProperties.getEnabled()) {
|
||||
log.info("模拟真正推送督办到数港,本地主键:{},url:{},请求数据:{},", sgSuperviseUpdateCmd.getId(), sgProperties.getSuperviseUrl(), requestData);
|
||||
} else {
|
||||
TokenUtils.sendDataToThirdParty(sgProperties.getSuperviseUrl(), requestData, token, sgSuperviseUpdateCmd.getFiles());
|
||||
}
|
||||
SgSuperviseE sgSuperviseE = new SgSuperviseE();
|
||||
BeanUtils.copyProperties(sgSuperviseUpdateCmd, sgSuperviseE);
|
||||
sgSuperviseE.setFeedbackTime(LocalDateTime.now());
|
||||
sgSuperviseE.setStatus(2);
|
||||
boolean res = sgSuperviseGateway.update(sgSuperviseE);
|
||||
if (!res) {
|
||||
throw new BizException("修改失败");
|
||||
}
|
||||
} catch (BizException e) {
|
||||
log.error("督办反馈处理失败,主键:{},原因:{}", sgSuperviseUpdateCmd.getId(), e.getMessage(), e);
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
log.error("督办反馈处理失败,主键:{}", sgSuperviseUpdateCmd.getId(), e);
|
||||
throw new BizException("修改失败");
|
||||
}
|
||||
}
|
||||
|
||||
public void forward(SgSuperviseUpdateCmd sgSuperviseUpdateCmd) {
|
||||
SgSuperviseDO byId = sgSuperviseRepository.getById(sgSuperviseUpdateCmd.getId());
|
||||
if (byId == null) {
|
||||
throw new BizException("该数据不存在");
|
||||
}
|
||||
try {
|
||||
SgSuperviseE sgSuperviseE = new SgSuperviseE();
|
||||
BeanUtils.copyProperties(sgSuperviseUpdateCmd, sgSuperviseE);
|
||||
sgSuperviseE.setSuperviseTime(LocalDateTime.now());
|
||||
boolean res = sgSuperviseGateway.update(sgSuperviseE);
|
||||
if (!res) {
|
||||
throw new BizException("修改失败");
|
||||
}
|
||||
MessageSendCmd messageSendCmd = new MessageSendCmd();
|
||||
messageSendCmd.setBusinessId(UuidUtil.get32UUID());
|
||||
MessageTargetCmd messageTargetCmd = new MessageTargetCmd();
|
||||
messageTargetCmd.setUserId(sgSuperviseUpdateCmd.getFeedbackUserId());
|
||||
messageSendCmd.setTargetCmd(messageTargetCmd);
|
||||
messageSendCmd.setSourceCode(messageConfig.getForward());
|
||||
messageSendCmd.setNeedTokenEnum(false);
|
||||
Map<String, Object> sendParams = new HashMap<String, Object>();
|
||||
|
||||
messageSendCmd.setParams(sendParams);
|
||||
log.info("发送消息参数:messageSendCmd: {}", JSONUtil.toJsonStr(messageSendCmd));
|
||||
SingleResponse<Boolean> d = messageFacade.send(messageSendCmd);
|
||||
log.info("发送消息结果:d: {}", JSONUtil.toJsonStr(d));
|
||||
|
||||
} catch (BizException e) {
|
||||
log.error("督办转发处理失败,主键:{},原因:{}", sgSuperviseUpdateCmd.getId(), e.getMessage(), e);
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
log.error("督办转发处理失败,主键:{}", sgSuperviseUpdateCmd.getId(), e);
|
||||
throw new BizException("修改失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
package com.zcloud.safety.command;
|
||||
|
||||
import com.alibaba.cola.exception.BizException;
|
||||
import com.zcloud.safety.domain.enums.PushOperationTypeEnum;
|
||||
import com.zcloud.safety.domain.gateway.SgXgfFilingGateway;
|
||||
import com.zcloud.safety.domain.model.SgXgfFilingE;
|
||||
import com.zcloud.safety.dto.SgXgfFilingAddCmd;
|
||||
import com.zcloud.safety.persistence.dataobject.SgXgfFilingDO;
|
||||
import com.zcloud.safety.persistence.repository.SgXgfFilingRepository;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* 一级相关方备案新增执行器。
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class SgXgfFilingAddExe {
|
||||
|
||||
private final SgXgfFilingGateway sgXgfFilingGateway;
|
||||
private final SgXgfFilingRepository sgXgfFilingRepository;
|
||||
private final SgXgfFilingPushSupport sgXgfFilingPushSupport;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean execute(SgXgfFilingAddCmd cmd) {
|
||||
SgXgfFilingE sgXgfFilingE = new SgXgfFilingE();
|
||||
BeanUtils.copyProperties(cmd, sgXgfFilingE);
|
||||
try {
|
||||
boolean res = sgXgfFilingGateway.add(sgXgfFilingE);
|
||||
if (!res) {
|
||||
throw new BizException("保存失败");
|
||||
}
|
||||
if (sgXgfFilingE.getId() == null) {
|
||||
throw new BizException("新增一级相关方备案后未获取到主键");
|
||||
}
|
||||
|
||||
SgXgfFilingDO latestFiling = sgXgfFilingRepository.getById(sgXgfFilingE.getId());
|
||||
if (latestFiling == null) {
|
||||
throw new BizException("新增一级相关方备案后未查询到数据");
|
||||
}
|
||||
|
||||
sgXgfFilingPushSupport.pushFiling(latestFiling, PushOperationTypeEnum.ADD, cmd.getFiles());
|
||||
return true;
|
||||
} catch (BizException e) {
|
||||
log.error("新增一级相关方备案失败,原因:{}", e.getMessage(), e);
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
log.error("新增一级相关方备案失败", e);
|
||||
throw new BizException("保存失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,105 @@
|
|||
package com.zcloud.safety.command;
|
||||
|
||||
import com.alibaba.cola.exception.BizException;
|
||||
import com.zcloud.safety.domain.config.SgProperties;
|
||||
import com.zcloud.safety.domain.enums.PushOperationTypeEnum;
|
||||
import com.zcloud.safety.domain.enums.PushSourceEnum;
|
||||
import com.zcloud.safety.domain.utils.TokenUtils;
|
||||
import com.zcloud.safety.persistence.dataobject.SgXgfFilingDO;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 一级相关方备案数港推送支持。
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class SgXgfFilingPushSupport {
|
||||
|
||||
private static final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
private static final PushSourceEnum DEFAULT_SOURCE = PushSourceEnum.QINGANG_GUFEN;
|
||||
|
||||
private final SgProperties sgProperties;
|
||||
|
||||
/**
|
||||
* 一级相关方备案推送使用 companyId 作为匹配键,来源和操作类型统一收口到枚举。
|
||||
*/
|
||||
public void pushFiling(SgXgfFilingDO sgXgfFilingDO, PushOperationTypeEnum operationType, MultipartFile... files) {
|
||||
if (sgXgfFilingDO == null || sgXgfFilingDO.getCompanyId() == null) {
|
||||
throw new BizException("一级相关方备案数据不存在,无法推送数港");
|
||||
}
|
||||
if (operationType == null) {
|
||||
throw new BizException("一级相关方备案推送操作类型不能为空");
|
||||
}
|
||||
|
||||
try {
|
||||
String token = resolveToken();
|
||||
Map<String, Object> requestData = buildRequestData(sgXgfFilingDO, operationType);
|
||||
log.info("开始推送一级相关方备案到数港,操作类型:{}-{},来源:{}-{},企业id:{},请求数据:{}",
|
||||
operationType.getCode(), operationType.getValue(), DEFAULT_SOURCE.getCode(), DEFAULT_SOURCE.getValue(), sgXgfFilingDO.getCompanyId(), requestData);
|
||||
if (sgProperties.getEnabled() == null || !sgProperties.getEnabled()) {
|
||||
log.info("模拟真实推送一级相关方备案到数港,操作类型:{}-{},来源:{}-{},企业id:{},url:{},请求数据:{}",
|
||||
operationType.getCode(), operationType.getValue(), DEFAULT_SOURCE.getCode(), DEFAULT_SOURCE.getValue(), sgXgfFilingDO.getCompanyId(), sgProperties.getLevelxgfUrl(), requestData);
|
||||
} else {
|
||||
TokenUtils.sendDataToThirdParty(sgProperties.getLevelxgfUrl(), requestData, token, files);
|
||||
}
|
||||
log.info("推送一级相关方备案到数港成功,操作类型:{}-{},企业id:{}",
|
||||
operationType.getCode(), operationType.getValue(), sgXgfFilingDO.getCompanyId());
|
||||
} catch (BizException e) {
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
log.error("推送一级相关方备案到数港失败,操作类型:{}-{},企业id:{}",
|
||||
operationType.getCode(), operationType.getValue(), sgXgfFilingDO.getCompanyId(), e);
|
||||
throw new BizException("推送数港失败");
|
||||
}
|
||||
}
|
||||
|
||||
private String resolveToken() throws Exception {
|
||||
String token;
|
||||
if (sgProperties.getEnabled() == null || !sgProperties.getEnabled()) {
|
||||
token = "tokenAAAA";
|
||||
} else {
|
||||
token = TokenUtils.getTokenFromThirdParty(sgProperties.getTokenUrl());
|
||||
}
|
||||
if (token == null || token.isEmpty()) {
|
||||
throw new BizException("获取数港token失败");
|
||||
}
|
||||
return token;
|
||||
}
|
||||
|
||||
private Map<String, Object> buildRequestData(SgXgfFilingDO sgXgfFilingDO, PushOperationTypeEnum operationType) {
|
||||
Map<String, Object> requestData = new HashMap<>();
|
||||
requestData.put("operationType", operationType.getCode());
|
||||
requestData.put("companyId", sgXgfFilingDO.getCompanyId());
|
||||
requestData.put("companyName", defaultString(sgXgfFilingDO.getCompanyName()));
|
||||
requestData.put("location", defaultString(sgXgfFilingDO.getLocation()));
|
||||
requestData.put("supervisionCompId", sgXgfFilingDO.getSupervisionCompId());
|
||||
requestData.put("supervisionCompName", defaultString(sgXgfFilingDO.getSupervisionCompName()));
|
||||
requestData.put("supervisionDeptId", sgXgfFilingDO.getSupervisionDeptId());
|
||||
requestData.put("supervisionDeptName", defaultString(sgXgfFilingDO.getSupervisionDeptName()));
|
||||
requestData.put("legalPerson", defaultString(sgXgfFilingDO.getLegalPerson()));
|
||||
requestData.put("contactNumber", defaultString(sgXgfFilingDO.getContactNumber()));
|
||||
requestData.put("auditUser", defaultString(sgXgfFilingDO.getAuditUser()));
|
||||
requestData.put("auditTime", formatDateTime(sgXgfFilingDO.getAuditTime()));
|
||||
requestData.put("qualifications", defaultString(sgXgfFilingDO.getQualifications()));
|
||||
requestData.put("source", DEFAULT_SOURCE.getCode());
|
||||
return requestData;
|
||||
}
|
||||
|
||||
private String formatDateTime(LocalDateTime dateTime) {
|
||||
LocalDateTime target = dateTime == null ? LocalDateTime.now() : dateTime;
|
||||
return target.format(DATE_TIME_FORMATTER);
|
||||
}
|
||||
|
||||
private String defaultString(String value) {
|
||||
return value == null ? "" : value;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
package com.zcloud.safety.command;
|
||||
|
||||
import com.alibaba.cola.exception.BizException;
|
||||
import com.zcloud.safety.domain.enums.PushOperationTypeEnum;
|
||||
import com.zcloud.safety.domain.gateway.SgXgfFilingGateway;
|
||||
import com.zcloud.safety.persistence.dataobject.SgXgfFilingDO;
|
||||
import com.zcloud.safety.persistence.repository.SgXgfFilingRepository;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* 一级相关方备案删除执行器。
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class SgXgfFilingRemoveExe {
|
||||
|
||||
private final SgXgfFilingGateway sgXgfFilingGateway;
|
||||
private final SgXgfFilingRepository sgXgfFilingRepository;
|
||||
private final SgXgfFilingPushSupport sgXgfFilingPushSupport;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean execute(Long id) {
|
||||
SgXgfFilingDO sgXgfFilingDO = sgXgfFilingRepository.getById(id);
|
||||
if (sgXgfFilingDO == null) {
|
||||
throw new BizException("该数据不存在");
|
||||
}
|
||||
|
||||
boolean res = sgXgfFilingGateway.deletedSgXgfFilingById(id);
|
||||
if (!res) {
|
||||
throw new BizException("删除失败");
|
||||
}
|
||||
sgXgfFilingPushSupport.pushFiling(sgXgfFilingDO, PushOperationTypeEnum.DELETE);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean execute(Long[] ids) {
|
||||
boolean res = sgXgfFilingGateway.deletedSgXgfFilingByIds(ids);
|
||||
if (!res) {
|
||||
throw new BizException("删除失败");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
package com.zcloud.safety.command;
|
||||
|
||||
import com.alibaba.cola.exception.BizException;
|
||||
import com.zcloud.safety.domain.enums.PushOperationTypeEnum;
|
||||
import com.zcloud.safety.domain.gateway.SgXgfFilingGateway;
|
||||
import com.zcloud.safety.domain.model.SgXgfFilingE;
|
||||
import com.zcloud.safety.dto.SgXgfFilingUpdateCmd;
|
||||
import com.zcloud.safety.persistence.dataobject.SgXgfFilingDO;
|
||||
import com.zcloud.safety.persistence.repository.SgXgfFilingRepository;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* 一级相关方备案修改执行器。
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class SgXgfFilingUpdateExe {
|
||||
|
||||
private final SgXgfFilingGateway sgXgfFilingGateway;
|
||||
private final SgXgfFilingRepository sgXgfFilingRepository;
|
||||
private final SgXgfFilingPushSupport sgXgfFilingPushSupport;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void execute(SgXgfFilingUpdateCmd cmd) {
|
||||
SgXgfFilingDO oldFiling = sgXgfFilingRepository.getById(cmd.getId());
|
||||
if (oldFiling == null) {
|
||||
throw new BizException("该数据不存在");
|
||||
}
|
||||
|
||||
try {
|
||||
SgXgfFilingE sgXgfFilingE = new SgXgfFilingE();
|
||||
BeanUtils.copyProperties(cmd, sgXgfFilingE);
|
||||
|
||||
boolean res = sgXgfFilingGateway.update(sgXgfFilingE);
|
||||
if (!res) {
|
||||
throw new BizException("修改失败");
|
||||
}
|
||||
|
||||
SgXgfFilingDO latestFiling = sgXgfFilingRepository.getById(cmd.getId());
|
||||
if (latestFiling == null) {
|
||||
throw new BizException("修改后未查询到一级相关方备案数据");
|
||||
}
|
||||
|
||||
sgXgfFilingPushSupport.pushFiling(latestFiling, PushOperationTypeEnum.UPDATE, cmd.getFiles());
|
||||
} catch (BizException e) {
|
||||
log.error("修改一级相关方备案失败,主键:{},原因:{}", cmd.getId(), e.getMessage(), e);
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
log.error("修改一级相关方备案失败,主键:{}", cmd.getId(), e);
|
||||
throw new BizException("修改失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
package com.zcloud.safety.command.convertor;
|
||||
|
||||
import com.zcloud.safety.dto.clientobject.ImgFilesCO;
|
||||
import com.zcloud.safety.persistence.dataobject.ImgFilesDO;
|
||||
import org.mapstruct.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* web-app
|
||||
*
|
||||
* @Author zhaokai
|
||||
* @Date 2026-06-01 14:27:17
|
||||
*/
|
||||
@Mapper(componentModel = "spring")
|
||||
public interface ImgFilesCoConvertor {
|
||||
ImgFilesCO converDOToCO(ImgFilesDO imgFilesDO);
|
||||
|
||||
/**
|
||||
* @param imgFilesDOs
|
||||
* @return
|
||||
*/
|
||||
List<ImgFilesCO> converDOsToCOs(List<ImgFilesDO> imgFilesDOs);
|
||||
}
|
||||
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
package com.zcloud.safety.command.convertor;
|
||||
|
||||
import com.zcloud.safety.dto.clientobject.RiskPointCo;
|
||||
import com.zcloud.safety.persistence.dataobject.RiskPointDO;
|
||||
import org.mapstruct.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper(componentModel = "spring")
|
||||
public interface RiskPointCoConvertor {
|
||||
/**
|
||||
* @param riskPointE
|
||||
* @return
|
||||
*/
|
||||
List<RiskPointCo> converDOsToCOs(List<RiskPointDO> riskPointE);
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.zcloud.safety.command.convertor;
|
||||
|
||||
import com.zcloud.safety.dto.clientobject.SgAccidentCO;
|
||||
import com.zcloud.safety.persistence.dataobject.SgAccidentDO;
|
||||
import org.mapstruct.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 事故上报对象转换器。
|
||||
*/
|
||||
@Mapper(componentModel = "spring")
|
||||
public interface SgAccidentCoConvertor {
|
||||
|
||||
SgAccidentCO converDOToCO(SgAccidentDO sgAccidentDO);
|
||||
|
||||
List<SgAccidentCO> converDOsToCOs(List<SgAccidentDO> sgAccidentDOs);
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.zcloud.safety.command.convertor;
|
||||
|
||||
import com.zcloud.safety.dto.clientobject.SgCalendarCO;
|
||||
import com.zcloud.safety.persistence.dataobject.SgCalendarDO;
|
||||
import org.mapstruct.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 安全月历对象转换器。
|
||||
*/
|
||||
@Mapper(componentModel = "spring")
|
||||
public interface SgCalendarCoConvertor {
|
||||
|
||||
SgCalendarCO converDOToCO(SgCalendarDO sgCalendarDO);
|
||||
|
||||
List<SgCalendarCO> converDOsToCOs(List<SgCalendarDO> sgCalendarDOs);
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package com.zcloud.safety.command.convertor;
|
||||
|
||||
import com.zcloud.safety.dto.clientobject.SgDutyCO;
|
||||
import com.zcloud.safety.persistence.dataobject.SgDutyDO;
|
||||
import org.mapstruct.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 值班统计对象转换器。
|
||||
*/
|
||||
@Mapper(componentModel = "spring")
|
||||
public interface SgDutyCoConvertor {
|
||||
SgDutyCO converDOToCO(SgDutyDO sgDutyDO);
|
||||
|
||||
List<SgDutyCO> converDOsToCOs(List<SgDutyDO> sgDutyDOs);
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package com.zcloud.safety.command.convertor;
|
||||
|
||||
import com.zcloud.safety.dto.clientobject.SgInformCO;
|
||||
import com.zcloud.safety.persistence.dataobject.SgInformDO;
|
||||
import org.mapstruct.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 通知对象转换器。
|
||||
*/
|
||||
@Mapper(componentModel = "spring")
|
||||
public interface SgInformCoConvertor {
|
||||
SgInformCO converDOToCO(SgInformDO sgInformDO);
|
||||
|
||||
List<SgInformCO> converDOsToCOs(List<SgInformDO> sgInformDOs);
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
package com.zcloud.safety.command.convertor;
|
||||
|
||||
import com.zcloud.safety.dto.clientobject.SgNoticeCO;
|
||||
import com.zcloud.safety.persistence.dataobject.SgNoticeDO;
|
||||
import org.mapstruct.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* web-app
|
||||
*
|
||||
* @Author zhaokai
|
||||
* @Date 2026-06-01 16:20:44
|
||||
*/
|
||||
@Mapper(componentModel = "spring")
|
||||
public interface SgNoticeCoConvertor {
|
||||
SgNoticeCO converDOToCO(SgNoticeDO sgNoticeDO);
|
||||
|
||||
/**
|
||||
* @param sgNoticeDOs
|
||||
* @return
|
||||
*/
|
||||
List<SgNoticeCO> converDOsToCOs(List<SgNoticeDO> sgNoticeDOs);
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
package com.zcloud.safety.command.convertor;
|
||||
|
||||
import com.zcloud.safety.dto.clientobject.SgReferenceCO;
|
||||
import com.zcloud.safety.persistence.dataobject.SgReferenceDO;
|
||||
import org.mapstruct.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 互学互鉴对象转换器。
|
||||
*
|
||||
* @Author zhaokai
|
||||
* @Date 2026-06-02 08:43:52
|
||||
*/
|
||||
@Mapper(componentModel = "spring")
|
||||
public interface SgReferenceCoConvertor {
|
||||
|
||||
SgReferenceCO converDOToCO(SgReferenceDO sgReferenceDO);
|
||||
|
||||
List<SgReferenceCO> converDOsToCOs(List<SgReferenceDO> sgReferenceDOs);
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
package com.zcloud.safety.command.convertor;
|
||||
|
||||
import com.zcloud.safety.dto.clientobject.SgSuperviseCO;
|
||||
import com.zcloud.safety.persistence.dataobject.SgSuperviseDO;
|
||||
import org.mapstruct.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* web-app
|
||||
*
|
||||
* @Author zhaokai
|
||||
* @Date 2026-06-01 11:22:44
|
||||
*/
|
||||
@Mapper(componentModel = "spring")
|
||||
public interface SgSuperviseCoConvertor {
|
||||
SgSuperviseCO converDOToCO(SgSuperviseDO sgSuperviseDO);
|
||||
|
||||
/**
|
||||
* @param sgSuperviseDOs
|
||||
* @return
|
||||
*/
|
||||
List<SgSuperviseCO> converDOsToCOs(List<SgSuperviseDO> sgSuperviseDOs);
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.zcloud.safety.command.convertor;
|
||||
|
||||
import com.zcloud.safety.dto.clientobject.SgXgfFilingCO;
|
||||
import com.zcloud.safety.persistence.dataobject.SgXgfFilingDO;
|
||||
import org.mapstruct.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 一级相关方备案对象转换器。
|
||||
*/
|
||||
@Mapper(componentModel = "spring")
|
||||
public interface SgXgfFilingCoConvertor {
|
||||
|
||||
SgXgfFilingCO converDOToCO(SgXgfFilingDO sgXgfFilingDO);
|
||||
|
||||
List<SgXgfFilingCO> converDOsToCOs(List<SgXgfFilingDO> sgXgfFilingDOs);
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
package com.zcloud.safety.command.query;
|
||||
|
||||
import com.alibaba.cola.dto.PageResponse;
|
||||
import com.zcloud.gbscommon.utils.PageQueryHelper;
|
||||
import com.zcloud.safety.command.convertor.ImgFilesCoConvertor;
|
||||
import com.zcloud.safety.dto.ImgFilesPageQry;
|
||||
import com.zcloud.safety.dto.clientobject.ImgFilesCO;
|
||||
import com.zcloud.safety.persistence.dataobject.ImgFilesDO;
|
||||
import com.zcloud.safety.persistence.repository.ImgFilesRepository;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* web-app
|
||||
*
|
||||
* @Author zhaokai
|
||||
* @Date 2026-06-01 14:27:18
|
||||
*/
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class ImgFilesQueryExe {
|
||||
private final ImgFilesRepository imgFilesRepository;
|
||||
private final ImgFilesCoConvertor imgFilesCoConvertor;
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*
|
||||
* @param imgFilesPageQry
|
||||
* @return
|
||||
*/
|
||||
public PageResponse<ImgFilesCO> execute(ImgFilesPageQry imgFilesPageQry) {
|
||||
Map<String, Object> params = PageQueryHelper.toHashMap(imgFilesPageQry);
|
||||
PageResponse<ImgFilesDO> pageResponse = imgFilesRepository.listPage(params);
|
||||
List<ImgFilesCO> examCenterCOS = imgFilesCoConvertor.converDOsToCOs(pageResponse.getData());
|
||||
return PageResponse.of(examCenterCOS, pageResponse.getTotalCount(), pageResponse.getPageSize(), pageResponse.getPageIndex());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
package com.zcloud.safety.command.query;
|
||||
|
||||
import com.alibaba.cola.dto.PageResponse;
|
||||
import com.zcloud.safety.command.convertor.RiskPointCoConvertor;
|
||||
import com.zcloud.safety.dto.RiskPointPageQry;
|
||||
import com.zcloud.safety.dto.clientobject.RiskPointCo;
|
||||
import com.zcloud.safety.persistence.dataobject.RiskPointDO;
|
||||
import com.zcloud.safety.persistence.repository.RiskPointRepository;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 风险点新增执行器
|
||||
*
|
||||
* @author lin
|
||||
*/
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class RiskPointQueryExe {
|
||||
private final RiskPointRepository riskPointRepository;
|
||||
private final RiskPointCoConvertor riskPointCoConvertor;
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*
|
||||
* @param riskPointPageQry
|
||||
* @return
|
||||
*/
|
||||
public PageResponse<RiskPointCo> execute(RiskPointPageQry riskPointPageQry) {
|
||||
PageResponse<RiskPointDO> pageResponse = riskPointRepository.listRiskPointPage(riskPointPageQry.toHashMap());
|
||||
List<RiskPointCo> examCenterCOS = riskPointCoConvertor.converDOsToCOs(pageResponse.getData());
|
||||
return PageResponse.of(examCenterCOS, pageResponse.getTotalCount(), pageResponse.getPageSize(), pageResponse.getPageIndex());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
package com.zcloud.safety.command.query;
|
||||
|
||||
import com.alibaba.cola.dto.PageResponse;
|
||||
import com.zcloud.gbscommon.utils.PageQueryHelper;
|
||||
import com.zcloud.safety.command.convertor.ImgFilesCoConvertor;
|
||||
import com.zcloud.safety.command.convertor.SgAccidentCoConvertor;
|
||||
import com.zcloud.safety.dto.SgAccidentPageQry;
|
||||
import com.zcloud.safety.dto.clientobject.ImgFilesCO;
|
||||
import com.zcloud.safety.dto.clientobject.SgAccidentCO;
|
||||
import com.zcloud.safety.persistence.dataobject.ImgFilesDO;
|
||||
import com.zcloud.safety.persistence.dataobject.SgAccidentDO;
|
||||
import com.zcloud.safety.persistence.repository.ImgFilesRepository;
|
||||
import com.zcloud.safety.persistence.repository.SgAccidentRepository;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 事故上报查询执行器。
|
||||
*/
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class SgAccidentQueryExe {
|
||||
|
||||
private final SgAccidentRepository sgAccidentRepository;
|
||||
private final ImgFilesRepository imgFilesRepository;
|
||||
private final SgAccidentCoConvertor sgAccidentCoConvertor;
|
||||
private final ImgFilesCoConvertor imgFilesCoConvertor;
|
||||
|
||||
/**
|
||||
* 分页查询事故上报列表。
|
||||
*/
|
||||
public PageResponse<SgAccidentCO> execute(SgAccidentPageQry qry) {
|
||||
Map<String, Object> params = PageQueryHelper.toHashMap(qry);
|
||||
PageResponse<SgAccidentDO> pageResponse = sgAccidentRepository.listPage(params);
|
||||
List<SgAccidentCO> sgAccidentCOList = sgAccidentCoConvertor.converDOsToCOs(pageResponse.getData());
|
||||
return PageResponse.of(sgAccidentCOList, pageResponse.getTotalCount(), pageResponse.getPageSize(), pageResponse.getPageIndex());
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询事故上报详情,并回带附件列表。
|
||||
*/
|
||||
public SgAccidentCO getInfoById(Long id) {
|
||||
SgAccidentDO sgAccidentDO = sgAccidentRepository.getInfoById(id);
|
||||
if (sgAccidentDO == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
SgAccidentCO sgAccidentCO = sgAccidentCoConvertor.converDOToCO(sgAccidentDO);
|
||||
List<ImgFilesDO> imgFilesDOList = imgFilesRepository.listByForeignKey(sgAccidentDO.getAccidentId());
|
||||
if (imgFilesDOList == null || imgFilesDOList.isEmpty()) {
|
||||
sgAccidentCO.setImgFilesList(Collections.emptyList());
|
||||
return sgAccidentCO;
|
||||
}
|
||||
|
||||
List<ImgFilesCO> imgFilesCOList = imgFilesCoConvertor.converDOsToCOs(imgFilesDOList);
|
||||
sgAccidentCO.setImgFilesList(imgFilesCOList);
|
||||
return sgAccidentCO;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
package com.zcloud.safety.command.query;
|
||||
|
||||
import com.alibaba.cola.dto.PageResponse;
|
||||
import com.zcloud.gbscommon.utils.PageQueryHelper;
|
||||
import com.zcloud.safety.command.convertor.ImgFilesCoConvertor;
|
||||
import com.zcloud.safety.command.convertor.SgCalendarCoConvertor;
|
||||
import com.zcloud.safety.dto.SgCalendarPageQry;
|
||||
import com.zcloud.safety.dto.clientobject.ImgFilesCO;
|
||||
import com.zcloud.safety.dto.clientobject.SgCalendarCO;
|
||||
import com.zcloud.safety.persistence.dataobject.ImgFilesDO;
|
||||
import com.zcloud.safety.persistence.dataobject.SgCalendarDO;
|
||||
import com.zcloud.safety.persistence.repository.ImgFilesRepository;
|
||||
import com.zcloud.safety.persistence.repository.SgCalendarRepository;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 安全月历查询执行器。
|
||||
*/
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class SgCalendarQueryExe {
|
||||
|
||||
private final SgCalendarRepository sgCalendarRepository;
|
||||
private final ImgFilesRepository imgFilesRepository;
|
||||
private final SgCalendarCoConvertor sgCalendarCoConvertor;
|
||||
private final ImgFilesCoConvertor imgFilesCoConvertor;
|
||||
|
||||
/**
|
||||
* 分页查询。
|
||||
*/
|
||||
public PageResponse<SgCalendarCO> execute(SgCalendarPageQry sgCalendarPageQry) {
|
||||
Map<String, Object> params = PageQueryHelper.toHashMap(sgCalendarPageQry);
|
||||
PageResponse<SgCalendarDO> pageResponse = sgCalendarRepository.listPage(params);
|
||||
List<SgCalendarCO> sgCalendarCOList = sgCalendarCoConvertor.converDOsToCOs(pageResponse.getData());
|
||||
return PageResponse.of(sgCalendarCOList, pageResponse.getTotalCount(), pageResponse.getPageSize(), pageResponse.getPageIndex());
|
||||
}
|
||||
|
||||
/**
|
||||
* 按主键查询详情,并回填附件列表。
|
||||
*/
|
||||
public SgCalendarCO getInfoById(Long id) {
|
||||
SgCalendarDO sgCalendarDO = sgCalendarRepository.getInfoById(id);
|
||||
if (sgCalendarDO == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
SgCalendarCO sgCalendarCO = sgCalendarCoConvertor.converDOToCO(sgCalendarDO);
|
||||
List<ImgFilesDO> imgFilesDOList = imgFilesRepository.listByForeignKey(String.valueOf(sgCalendarDO.getId()));
|
||||
if (imgFilesDOList == null || imgFilesDOList.isEmpty()) {
|
||||
sgCalendarCO.setImgFilesList(Collections.emptyList());
|
||||
return sgCalendarCO;
|
||||
}
|
||||
|
||||
List<ImgFilesCO> imgFilesCOList = imgFilesCoConvertor.converDOsToCOs(imgFilesDOList);
|
||||
sgCalendarCO.setImgFilesList(imgFilesCOList);
|
||||
return sgCalendarCO;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
package com.zcloud.safety.command.query;
|
||||
|
||||
import com.alibaba.cola.dto.PageResponse;
|
||||
import com.zcloud.gbscommon.utils.PageQueryHelper;
|
||||
import com.zcloud.safety.command.convertor.SgDutyCoConvertor;
|
||||
import com.zcloud.safety.dto.SgDutyPageQry;
|
||||
import com.zcloud.safety.dto.clientobject.SgDutyCO;
|
||||
import com.zcloud.safety.persistence.dataobject.SgDutyDO;
|
||||
import com.zcloud.safety.persistence.repository.SgDutyRepository;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 值班统计查询执行器。
|
||||
*/
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class SgDutyQueryExe {
|
||||
|
||||
private final SgDutyRepository sgDutyRepository;
|
||||
private final SgDutyCoConvertor sgDutyCoConvertor;
|
||||
|
||||
/**
|
||||
* 分页查询。
|
||||
*/
|
||||
public PageResponse<SgDutyCO> execute(SgDutyPageQry sgDutyPageQry) {
|
||||
Map<String, Object> params = PageQueryHelper.toHashMap(sgDutyPageQry);
|
||||
PageResponse<SgDutyDO> pageResponse = sgDutyRepository.listPage(params);
|
||||
List<SgDutyCO> sgDutyCOList = sgDutyCoConvertor.converDOsToCOs(pageResponse.getData());
|
||||
return PageResponse.of(sgDutyCOList, pageResponse.getTotalCount(), pageResponse.getPageSize(), pageResponse.getPageIndex());
|
||||
}
|
||||
|
||||
/**
|
||||
* 按主键查询详情。
|
||||
*/
|
||||
public SgDutyCO getInfoById(Long id) {
|
||||
SgDutyDO sgDutyDO = sgDutyRepository.getInfoById(id);
|
||||
if (sgDutyDO == null) {
|
||||
return null;
|
||||
}
|
||||
return sgDutyCoConvertor.converDOToCO(sgDutyDO);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
package com.zcloud.safety.command.query;
|
||||
|
||||
import com.alibaba.cola.dto.PageResponse;
|
||||
import com.zcloud.gbscommon.utils.PageQueryHelper;
|
||||
import com.zcloud.safety.command.convertor.ImgFilesCoConvertor;
|
||||
import com.zcloud.safety.command.convertor.SgInformCoConvertor;
|
||||
import com.zcloud.safety.dto.SgInformPageQry;
|
||||
import com.zcloud.safety.dto.clientobject.ImgFilesCO;
|
||||
import com.zcloud.safety.dto.clientobject.SgInformCO;
|
||||
import com.zcloud.safety.persistence.dataobject.ImgFilesDO;
|
||||
import com.zcloud.safety.persistence.dataobject.SgInformDO;
|
||||
import com.zcloud.safety.persistence.repository.ImgFilesRepository;
|
||||
import com.zcloud.safety.persistence.repository.SgInformRepository;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 通知查询执行器。
|
||||
*/
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class SgInformQueryExe {
|
||||
|
||||
private final SgInformRepository sgInformRepository;
|
||||
private final ImgFilesRepository imgFilesRepository;
|
||||
private final SgInformCoConvertor sgInformCoConvertor;
|
||||
private final ImgFilesCoConvertor imgFilesCoConvertor;
|
||||
|
||||
/**
|
||||
* 分页查询。
|
||||
*/
|
||||
public PageResponse<SgInformCO> execute(SgInformPageQry sgInformPageQry) {
|
||||
Map<String, Object> params = PageQueryHelper.toHashMap(sgInformPageQry);
|
||||
PageResponse<SgInformDO> pageResponse = sgInformRepository.listPage(params);
|
||||
List<SgInformCO> sgInformCOList = sgInformCoConvertor.converDOsToCOs(pageResponse.getData());
|
||||
return PageResponse.of(sgInformCOList, pageResponse.getTotalCount(), pageResponse.getPageSize(), pageResponse.getPageIndex());
|
||||
}
|
||||
|
||||
/**
|
||||
* 按主键查询详情,并回填通知业务主键关联的图片列表。
|
||||
*/
|
||||
public SgInformCO getInfoById(Long id) {
|
||||
SgInformDO sgInformDO = sgInformRepository.getInfoById(id);
|
||||
if (sgInformDO == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
SgInformCO sgInformCO = sgInformCoConvertor.converDOToCO(sgInformDO);
|
||||
if (sgInformDO.getInformId() == null || sgInformDO.getInformId().isEmpty()) {
|
||||
sgInformCO.setImgFilesList(Collections.emptyList());
|
||||
return sgInformCO;
|
||||
}
|
||||
|
||||
List<ImgFilesDO> imgFilesDOList = imgFilesRepository.listByForeignKey(sgInformDO.getInformId());
|
||||
List<ImgFilesCO> imgFilesCOList = imgFilesCoConvertor.converDOsToCOs(imgFilesDOList);
|
||||
sgInformCO.setImgFilesList(imgFilesCOList);
|
||||
return sgInformCO;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
package com.zcloud.safety.command.query;
|
||||
|
||||
import com.alibaba.cola.dto.PageResponse;
|
||||
import com.zcloud.gbscommon.utils.PageQueryHelper;
|
||||
import com.zcloud.safety.command.convertor.ImgFilesCoConvertor;
|
||||
import com.zcloud.safety.command.convertor.SgNoticeCoConvertor;
|
||||
import com.zcloud.safety.dto.SgNoticePageQry;
|
||||
import com.zcloud.safety.dto.clientobject.ImgFilesCO;
|
||||
import com.zcloud.safety.dto.clientobject.SgNoticeCO;
|
||||
import com.zcloud.safety.persistence.dataobject.ImgFilesDO;
|
||||
import com.zcloud.safety.persistence.dataobject.SgNoticeDO;
|
||||
import com.zcloud.safety.persistence.repository.ImgFilesRepository;
|
||||
import com.zcloud.safety.persistence.repository.SgNoticeRepository;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 公告查询执行器。
|
||||
*/
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class SgNoticeQueryExe {
|
||||
|
||||
private final SgNoticeRepository sgNoticeRepository;
|
||||
private final ImgFilesRepository imgFilesRepository;
|
||||
private final SgNoticeCoConvertor sgNoticeCoConvertor;
|
||||
private final ImgFilesCoConvertor imgFilesCoConvertor;
|
||||
|
||||
/**
|
||||
* 分页查询。
|
||||
*/
|
||||
public PageResponse<SgNoticeCO> execute(SgNoticePageQry sgNoticePageQry) {
|
||||
Map<String, Object> params = PageQueryHelper.toHashMap(sgNoticePageQry);
|
||||
PageResponse<SgNoticeDO> pageResponse = sgNoticeRepository.listPage(params);
|
||||
List<SgNoticeCO> sgNoticeCOList = sgNoticeCoConvertor.converDOsToCOs(pageResponse.getData());
|
||||
return PageResponse.of(sgNoticeCOList, pageResponse.getTotalCount(), pageResponse.getPageSize(), pageResponse.getPageIndex());
|
||||
}
|
||||
|
||||
/**
|
||||
* 按主键查询详情,并回填公告业务主键关联的图片列表。
|
||||
*/
|
||||
public SgNoticeCO getInfoById(Long id) {
|
||||
SgNoticeDO sgNoticeDO = sgNoticeRepository.getInfoById(id);
|
||||
if (sgNoticeDO == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
SgNoticeCO sgNoticeCO = sgNoticeCoConvertor.converDOToCO(sgNoticeDO);
|
||||
if (sgNoticeDO.getNoticeId() == null || sgNoticeDO.getNoticeId().isEmpty()) {
|
||||
sgNoticeCO.setImgFilesList(Collections.emptyList());
|
||||
return sgNoticeCO;
|
||||
}
|
||||
|
||||
List<ImgFilesDO> imgFilesDOList = imgFilesRepository.listByForeignKey(sgNoticeDO.getNoticeId());
|
||||
List<ImgFilesCO> imgFilesCOList = imgFilesCoConvertor.converDOsToCOs(imgFilesDOList);
|
||||
sgNoticeCO.setImgFilesList(imgFilesCOList);
|
||||
return sgNoticeCO;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,76 @@
|
|||
package com.zcloud.safety.command.query;
|
||||
|
||||
import com.alibaba.cola.dto.PageResponse;
|
||||
import com.zcloud.gbscommon.utils.PageQueryHelper;
|
||||
import com.zcloud.safety.command.convertor.ImgFilesCoConvertor;
|
||||
import com.zcloud.safety.command.convertor.SgReferenceCoConvertor;
|
||||
import com.zcloud.safety.dto.SgReferencePageQry;
|
||||
import com.zcloud.safety.dto.clientobject.ImgFilesCO;
|
||||
import com.zcloud.safety.dto.clientobject.SgReferenceCO;
|
||||
import com.zcloud.safety.persistence.dataobject.ImgFilesDO;
|
||||
import com.zcloud.safety.persistence.dataobject.SgReferenceDO;
|
||||
import com.zcloud.safety.persistence.repository.ImgFilesRepository;
|
||||
import com.zcloud.safety.persistence.repository.SgReferenceRepository;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 互学互鉴查询执行器。
|
||||
*/
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class SgReferenceQueryExe {
|
||||
|
||||
private final SgReferenceRepository sgReferenceRepository;
|
||||
private final ImgFilesRepository imgFilesRepository;
|
||||
private final SgReferenceCoConvertor sgReferenceCoConvertor;
|
||||
private final ImgFilesCoConvertor imgFilesCoConvertor;
|
||||
|
||||
/**
|
||||
* 分页查询互学互鉴列表,并统一从附件表补全附件信息。
|
||||
*/
|
||||
public PageResponse<SgReferenceCO> execute(SgReferencePageQry qry) {
|
||||
Map<String, Object> params = PageQueryHelper.toHashMap(qry);
|
||||
PageResponse<SgReferenceDO> pageResponse = sgReferenceRepository.listPage(params);
|
||||
List<SgReferenceCO> sgReferenceCOList = sgReferenceCoConvertor.converDOsToCOs(pageResponse.getData());
|
||||
fillImgFilesList(sgReferenceCOList);
|
||||
return PageResponse.of(sgReferenceCOList, pageResponse.getTotalCount(), pageResponse.getPageSize(), pageResponse.getPageIndex());
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询互学互鉴详情,并回带附件列表。
|
||||
*/
|
||||
public SgReferenceCO getInfoById(Long id) {
|
||||
SgReferenceDO sgReferenceDO = sgReferenceRepository.getInfoById(id);
|
||||
if (sgReferenceDO == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
SgReferenceCO sgReferenceCO = sgReferenceCoConvertor.converDOToCO(sgReferenceDO);
|
||||
fillImgFilesList(Collections.singletonList(sgReferenceCO));
|
||||
return sgReferenceCO;
|
||||
}
|
||||
|
||||
private void fillImgFilesList(List<SgReferenceCO> sgReferenceCOList) {
|
||||
if (sgReferenceCOList == null || sgReferenceCOList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (SgReferenceCO sgReferenceCO : sgReferenceCOList) {
|
||||
if (sgReferenceCO == null || sgReferenceCO.getId() == null) {
|
||||
continue;
|
||||
}
|
||||
List<ImgFilesDO> imgFilesDOList = imgFilesRepository.listByForeignKey(sgReferenceCO.getReferenceId());
|
||||
if (imgFilesDOList == null || imgFilesDOList.isEmpty()) {
|
||||
sgReferenceCO.setImgFilesList(Collections.emptyList());
|
||||
continue;
|
||||
}
|
||||
List<ImgFilesCO> imgFilesCOList = imgFilesCoConvertor.converDOsToCOs(imgFilesDOList);
|
||||
sgReferenceCO.setImgFilesList(imgFilesCOList == null ? Collections.emptyList() : imgFilesCOList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
package com.zcloud.safety.command.query;
|
||||
|
||||
import com.alibaba.cola.dto.PageResponse;
|
||||
import com.zcloud.gbscommon.utils.PageQueryHelper;
|
||||
import com.zcloud.safety.command.convertor.ImgFilesCoConvertor;
|
||||
import com.zcloud.safety.command.convertor.SgSuperviseCoConvertor;
|
||||
import com.zcloud.safety.dto.SgSupervisePageQry;
|
||||
import com.zcloud.safety.dto.clientobject.ImgFilesCO;
|
||||
import com.zcloud.safety.dto.clientobject.SgSuperviseCO;
|
||||
import com.zcloud.safety.persistence.dataobject.ImgFilesDO;
|
||||
import com.zcloud.safety.persistence.dataobject.SgSuperviseDO;
|
||||
import com.zcloud.safety.persistence.repository.ImgFilesRepository;
|
||||
import com.zcloud.safety.persistence.repository.SgSuperviseRepository;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 督办查询执行器。
|
||||
*/
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class SgSuperviseQueryExe {
|
||||
|
||||
private final SgSuperviseRepository sgSuperviseRepository;
|
||||
private final ImgFilesRepository imgFilesRepository;
|
||||
private final SgSuperviseCoConvertor sgSuperviseCoConvertor;
|
||||
private final ImgFilesCoConvertor imgFilesCoConvertor;
|
||||
|
||||
/**
|
||||
* 分页查询。
|
||||
*/
|
||||
public PageResponse<SgSuperviseCO> execute(SgSupervisePageQry sgSupervisePageQry) {
|
||||
Map<String, Object> params = PageQueryHelper.toHashMap(sgSupervisePageQry);
|
||||
PageResponse<SgSuperviseDO> pageResponse = sgSuperviseRepository.listPage(params);
|
||||
List<SgSuperviseCO> sgSuperviseCOList = sgSuperviseCoConvertor.converDOsToCOs(pageResponse.getData());
|
||||
return PageResponse.of(sgSuperviseCOList, pageResponse.getTotalCount(), pageResponse.getPageSize(), pageResponse.getPageIndex());
|
||||
}
|
||||
|
||||
/**
|
||||
* 按主键查询详情,并回填业务主键关联的图片列表。
|
||||
*/
|
||||
public SgSuperviseCO getInfoById(Long id) {
|
||||
SgSuperviseDO sgSuperviseDO = sgSuperviseRepository.getInfoById(id);
|
||||
if (sgSuperviseDO == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
SgSuperviseCO sgSuperviseCO = sgSuperviseCoConvertor.converDOToCO(sgSuperviseDO);
|
||||
if (sgSuperviseDO.getSuperviseId() == null || sgSuperviseDO.getSuperviseId().isEmpty()) {
|
||||
sgSuperviseCO.setImgFilesList(Collections.emptyList());
|
||||
return sgSuperviseCO;
|
||||
}
|
||||
|
||||
List<ImgFilesDO> imgFilesDOList = imgFilesRepository.listByForeignKey(sgSuperviseDO.getSuperviseId());
|
||||
List<ImgFilesCO> imgFilesCOList = imgFilesCoConvertor.converDOsToCOs(imgFilesDOList);
|
||||
sgSuperviseCO.setImgFilesList(imgFilesCOList);
|
||||
return sgSuperviseCO;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
package com.zcloud.safety.command.query;
|
||||
|
||||
import com.alibaba.cola.dto.PageResponse;
|
||||
import com.zcloud.gbscommon.utils.PageQueryHelper;
|
||||
import com.zcloud.safety.command.convertor.SgXgfFilingCoConvertor;
|
||||
import com.zcloud.safety.dto.SgXgfFilingPageQry;
|
||||
import com.zcloud.safety.dto.clientobject.SgXgfFilingCO;
|
||||
import com.zcloud.safety.persistence.dataobject.SgXgfFilingDO;
|
||||
import com.zcloud.safety.persistence.repository.SgXgfFilingRepository;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 一级相关方备案查询执行器。
|
||||
*/
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class SgXgfFilingQueryExe {
|
||||
|
||||
private final SgXgfFilingRepository sgXgfFilingRepository;
|
||||
private final SgXgfFilingCoConvertor sgXgfFilingCoConvertor;
|
||||
|
||||
/**
|
||||
* 分页查询。
|
||||
*/
|
||||
public PageResponse<SgXgfFilingCO> execute(SgXgfFilingPageQry sgXgfFilingPageQry) {
|
||||
Map<String, Object> params = PageQueryHelper.toHashMap(sgXgfFilingPageQry);
|
||||
PageResponse<SgXgfFilingDO> pageResponse = sgXgfFilingRepository.listPage(params);
|
||||
List<SgXgfFilingCO> sgXgfFilingCOList = sgXgfFilingCoConvertor.converDOsToCOs(pageResponse.getData());
|
||||
return PageResponse.of(sgXgfFilingCOList, pageResponse.getTotalCount(), pageResponse.getPageSize(), pageResponse.getPageIndex());
|
||||
}
|
||||
|
||||
/**
|
||||
* 按主键查询详情。
|
||||
*/
|
||||
public SgXgfFilingCO getInfoById(Long id) {
|
||||
SgXgfFilingDO sgXgfFilingDO = sgXgfFilingRepository.getInfoById(id);
|
||||
if (sgXgfFilingDO == null) {
|
||||
return null;
|
||||
}
|
||||
return sgXgfFilingCoConvertor.converDOToCO(sgXgfFilingDO);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
package com.zcloud.safety.service;
|
||||
|
||||
import com.alibaba.cola.dto.PageResponse;
|
||||
import com.alibaba.cola.dto.SingleResponse;
|
||||
import com.zcloud.safety.api.ImgFilesServiceI;
|
||||
import com.zcloud.safety.command.ImgFilesAddExe;
|
||||
import com.zcloud.safety.command.ImgFilesRemoveExe;
|
||||
import com.zcloud.safety.command.ImgFilesUpdateExe;
|
||||
import com.zcloud.safety.command.query.ImgFilesQueryExe;
|
||||
import com.zcloud.safety.dto.ImgFilesAddCmd;
|
||||
import com.zcloud.safety.dto.ImgFilesPageQry;
|
||||
import com.zcloud.safety.dto.ImgFilesUpdateCmd;
|
||||
import com.zcloud.safety.dto.clientobject.ImgFilesCO;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* web-app
|
||||
*
|
||||
* @Author zhaokai
|
||||
* @Date 2026-06-01 14:27:18
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class ImgFilesServiceImpl implements ImgFilesServiceI {
|
||||
private final ImgFilesAddExe imgFilesAddExe;
|
||||
private final ImgFilesUpdateExe imgFilesUpdateExe;
|
||||
private final ImgFilesRemoveExe imgFilesRemoveExe;
|
||||
private final ImgFilesQueryExe imgFilesQueryExe;
|
||||
|
||||
@Override
|
||||
public PageResponse<ImgFilesCO> listPage(ImgFilesPageQry qry) {
|
||||
|
||||
return imgFilesQueryExe.execute(qry);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SingleResponse add(ImgFilesAddCmd cmd) {
|
||||
|
||||
imgFilesAddExe.execute(cmd);
|
||||
return SingleResponse.buildSuccess();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void edit(ImgFilesUpdateCmd imgFilesUpdateCmd) {
|
||||
imgFilesUpdateExe.execute(imgFilesUpdateCmd);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove(Long id) {
|
||||
imgFilesRemoveExe.execute(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeBatch(Long[] ids) {
|
||||
imgFilesRemoveExe.execute(ids);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,56 +0,0 @@
|
|||
package com.zcloud.safety.service;
|
||||
|
||||
import com.alibaba.cola.dto.PageResponse;
|
||||
import com.alibaba.cola.dto.SingleResponse;
|
||||
import com.zcloud.safety.api.RiskPointServiceI;
|
||||
import com.zcloud.safety.command.RiskPointAddExe;
|
||||
import com.zcloud.safety.command.RiskPointRemoveExe;
|
||||
import com.zcloud.safety.command.RiskPointUpdateExe;
|
||||
import com.zcloud.safety.command.query.RiskPointQueryExe;
|
||||
import com.zcloud.safety.dto.RiskPointAddCmd;
|
||||
import com.zcloud.safety.dto.RiskPointPageQry;
|
||||
import com.zcloud.safety.dto.RiskPointUpdateCmd;
|
||||
import com.zcloud.safety.dto.clientobject.RiskPointCo;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author lin
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class RiskPointServiceImpl implements RiskPointServiceI {
|
||||
private final RiskPointAddExe riskPointAddExe;
|
||||
private final RiskPointUpdateExe riskPointUpdateExe;
|
||||
private final RiskPointRemoveExe riskPointRemoveExe;
|
||||
private final RiskPointQueryExe riskPointQueryExe;
|
||||
|
||||
@Override
|
||||
public PageResponse<RiskPointCo> listPage(RiskPointPageQry qry){
|
||||
|
||||
return riskPointQueryExe.execute(qry);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SingleResponse add(RiskPointAddCmd cmd) {
|
||||
|
||||
riskPointAddExe.execute(cmd);
|
||||
return SingleResponse.buildSuccess();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void edit(RiskPointUpdateCmd riskPointUpdateCmd) {
|
||||
riskPointUpdateExe.execute(riskPointUpdateCmd);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove(Long id) {
|
||||
riskPointRemoveExe.execute(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeBatch(Long[] ids) {
|
||||
riskPointRemoveExe.execute(ids);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
package com.zcloud.safety.service;
|
||||
|
||||
import com.alibaba.cola.dto.PageResponse;
|
||||
import com.alibaba.cola.dto.SingleResponse;
|
||||
import com.zcloud.safety.api.SgAccidentServiceI;
|
||||
import com.zcloud.safety.command.SgAccidentAddExe;
|
||||
import com.zcloud.safety.command.SgAccidentRemoveExe;
|
||||
import com.zcloud.safety.command.SgAccidentUpdateExe;
|
||||
import com.zcloud.safety.command.query.SgAccidentQueryExe;
|
||||
import com.zcloud.safety.dto.SgAccidentAddCmd;
|
||||
import com.zcloud.safety.dto.SgAccidentPageQry;
|
||||
import com.zcloud.safety.dto.SgAccidentUpdateCmd;
|
||||
import com.zcloud.safety.dto.clientobject.SgAccidentCO;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 事故上报服务实现。
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class SgAccidentServiceImpl implements SgAccidentServiceI {
|
||||
|
||||
private final SgAccidentAddExe sgAccidentAddExe;
|
||||
private final SgAccidentUpdateExe sgAccidentUpdateExe;
|
||||
private final SgAccidentRemoveExe sgAccidentRemoveExe;
|
||||
private final SgAccidentQueryExe sgAccidentQueryExe;
|
||||
|
||||
@Override
|
||||
public PageResponse<SgAccidentCO> listPage(SgAccidentPageQry qry) {
|
||||
return sgAccidentQueryExe.execute(qry);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SingleResponse<SgAccidentCO> getInfoById(Long id) {
|
||||
return SingleResponse.of(sgAccidentQueryExe.getInfoById(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public SingleResponse<SgAccidentCO> add(SgAccidentAddCmd cmd) {
|
||||
sgAccidentAddExe.execute(cmd);
|
||||
return SingleResponse.buildSuccess();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void edit(SgAccidentUpdateCmd cmd) {
|
||||
sgAccidentUpdateExe.execute(cmd);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove(Long id) {
|
||||
sgAccidentRemoveExe.execute(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeBatch(Long[] ids) {
|
||||
sgAccidentRemoveExe.execute(ids);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
package com.zcloud.safety.service;
|
||||
|
||||
import com.alibaba.cola.dto.PageResponse;
|
||||
import com.alibaba.cola.dto.SingleResponse;
|
||||
import com.zcloud.safety.api.SgCalendarServiceI;
|
||||
import com.zcloud.safety.command.SgCalendarAddExe;
|
||||
import com.zcloud.safety.command.SgCalendarRemoveExe;
|
||||
import com.zcloud.safety.command.SgCalendarUpdateExe;
|
||||
import com.zcloud.safety.command.query.SgCalendarQueryExe;
|
||||
import com.zcloud.safety.dto.SgCalendarAddCmd;
|
||||
import com.zcloud.safety.dto.SgCalendarPageQry;
|
||||
import com.zcloud.safety.dto.SgCalendarUpdateCmd;
|
||||
import com.zcloud.safety.dto.clientobject.SgCalendarCO;
|
||||
import com.zcloud.safety.dto.receive.SgCalendarAuditDTO;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 安全月历服务实现。
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class SgCalendarServiceImpl implements SgCalendarServiceI {
|
||||
|
||||
private final SgCalendarAddExe sgCalendarAddExe;
|
||||
private final SgCalendarUpdateExe sgCalendarUpdateExe;
|
||||
private final SgCalendarRemoveExe sgCalendarRemoveExe;
|
||||
private final SgCalendarQueryExe sgCalendarQueryExe;
|
||||
|
||||
@Override
|
||||
public PageResponse<SgCalendarCO> listPage(SgCalendarPageQry qry) {
|
||||
return sgCalendarQueryExe.execute(qry);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SingleResponse<SgCalendarCO> getInfoById(Long id) {
|
||||
return SingleResponse.of(sgCalendarQueryExe.getInfoById(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public SingleResponse<SgCalendarCO> add(SgCalendarAddCmd cmd) {
|
||||
sgCalendarAddExe.execute(cmd);
|
||||
return SingleResponse.buildSuccess();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void edit(SgCalendarUpdateCmd cmd) {
|
||||
sgCalendarUpdateExe.execute(cmd);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove(Long id) {
|
||||
sgCalendarRemoveExe.execute(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeBatch(Long[] ids) {
|
||||
sgCalendarRemoveExe.execute(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveAudit(SgCalendarAuditDTO auditDTO) {
|
||||
sgCalendarUpdateExe.receiveAudit(auditDTO);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
package com.zcloud.safety.service;
|
||||
|
||||
import com.alibaba.cola.dto.PageResponse;
|
||||
import com.alibaba.cola.dto.SingleResponse;
|
||||
import com.zcloud.safety.api.SgDutyServiceI;
|
||||
import com.zcloud.safety.command.SgDutyAddExe;
|
||||
import com.zcloud.safety.command.SgDutyRemoveExe;
|
||||
import com.zcloud.safety.command.SgDutyUpdateExe;
|
||||
import com.zcloud.safety.command.query.SgDutyQueryExe;
|
||||
import com.zcloud.safety.dto.SgDutyAddCmd;
|
||||
import com.zcloud.safety.dto.SgDutyPageQry;
|
||||
import com.zcloud.safety.dto.SgDutyUpdateCmd;
|
||||
import com.zcloud.safety.dto.clientobject.SgDutyCO;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 值班统计服务实现。
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class SgDutyServiceImpl implements SgDutyServiceI {
|
||||
|
||||
private final SgDutyAddExe sgDutyAddExe;
|
||||
private final SgDutyUpdateExe sgDutyUpdateExe;
|
||||
private final SgDutyRemoveExe sgDutyRemoveExe;
|
||||
private final SgDutyQueryExe sgDutyQueryExe;
|
||||
|
||||
@Override
|
||||
public PageResponse<SgDutyCO> listPage(SgDutyPageQry qry) {
|
||||
return sgDutyQueryExe.execute(qry);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SingleResponse<SgDutyCO> getInfoById(Long id) {
|
||||
return SingleResponse.of(sgDutyQueryExe.getInfoById(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public SingleResponse<SgDutyCO> add(SgDutyAddCmd cmd) {
|
||||
sgDutyAddExe.execute(cmd);
|
||||
return SingleResponse.buildSuccess();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void edit(SgDutyUpdateCmd cmd) {
|
||||
sgDutyUpdateExe.execute(cmd);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove(Long id) {
|
||||
sgDutyRemoveExe.execute(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeBatch(Long[] ids) {
|
||||
sgDutyRemoveExe.execute(ids);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
package com.zcloud.safety.service;
|
||||
|
||||
import com.alibaba.cola.dto.PageResponse;
|
||||
import com.alibaba.cola.dto.SingleResponse;
|
||||
import com.zcloud.safety.api.SgInformServiceI;
|
||||
import com.zcloud.safety.command.SgInformAddExe;
|
||||
import com.zcloud.safety.command.SgInformRemoveExe;
|
||||
import com.zcloud.safety.command.SgInformUpdateExe;
|
||||
import com.zcloud.safety.command.query.SgInformQueryExe;
|
||||
import com.zcloud.safety.dto.SgInformAddCmd;
|
||||
import com.zcloud.safety.dto.SgInformPageQry;
|
||||
import com.zcloud.safety.dto.SgInformUpdateCmd;
|
||||
import com.zcloud.safety.dto.clientobject.SgInformCO;
|
||||
import com.zcloud.safety.dto.receive.SgInformAddDTO;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* 通知服务实现。
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class SgInformServiceImpl implements SgInformServiceI {
|
||||
|
||||
private final SgInformAddExe sgInformAddExe;
|
||||
private final SgInformUpdateExe sgInformUpdateExe;
|
||||
private final SgInformRemoveExe sgInformRemoveExe;
|
||||
private final SgInformQueryExe sgInformQueryExe;
|
||||
|
||||
@Override
|
||||
public PageResponse<SgInformCO> listPage(SgInformPageQry qry) {
|
||||
return sgInformQueryExe.execute(qry);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SingleResponse<SgInformCO> getInfoById(Long id) {
|
||||
return SingleResponse.of(sgInformQueryExe.getInfoById(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public SingleResponse<SgInformCO> add(SgInformAddCmd cmd) {
|
||||
sgInformAddExe.execute(cmd);
|
||||
return SingleResponse.buildSuccess();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void edit(SgInformUpdateCmd cmd) {
|
||||
sgInformUpdateExe.execute(cmd);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove(Long id) {
|
||||
sgInformRemoveExe.execute(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeBatch(Long[] ids) {
|
||||
sgInformRemoveExe.execute(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addReceive(SgInformAddDTO inform, String key, MultipartFile[] files) {
|
||||
sgInformAddExe.addReceive(inform, key, files);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,71 @@
|
|||
package com.zcloud.safety.service;
|
||||
|
||||
import com.alibaba.cola.dto.PageResponse;
|
||||
import com.alibaba.cola.dto.SingleResponse;
|
||||
import com.zcloud.safety.api.SgNoticeServiceI;
|
||||
import com.zcloud.safety.command.SgNoticeAddExe;
|
||||
import com.zcloud.safety.command.SgNoticeRemoveExe;
|
||||
import com.zcloud.safety.command.SgNoticeUpdateExe;
|
||||
import com.zcloud.safety.command.query.SgNoticeQueryExe;
|
||||
import com.zcloud.safety.dto.SgNoticeAddCmd;
|
||||
import com.zcloud.safety.dto.SgNoticePageQry;
|
||||
import com.zcloud.safety.dto.SgNoticeUpdateCmd;
|
||||
import com.zcloud.safety.dto.clientobject.SgNoticeCO;
|
||||
import com.zcloud.safety.dto.receive.SgNoticeAddDTO;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* web-app
|
||||
*
|
||||
* @Author zhaokai
|
||||
* @Date 2026-06-01 16:20:44
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class SgNoticeServiceImpl implements SgNoticeServiceI {
|
||||
private final SgNoticeAddExe sgNoticeAddExe;
|
||||
private final SgNoticeUpdateExe sgNoticeUpdateExe;
|
||||
private final SgNoticeRemoveExe sgNoticeRemoveExe;
|
||||
private final SgNoticeQueryExe sgNoticeQueryExe;
|
||||
|
||||
@Override
|
||||
public PageResponse<SgNoticeCO> listPage(SgNoticePageQry qry) {
|
||||
|
||||
return sgNoticeQueryExe.execute(qry);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SingleResponse<SgNoticeCO> getInfoById(Long id) {
|
||||
return SingleResponse.of(sgNoticeQueryExe.getInfoById(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public SingleResponse add(SgNoticeAddCmd cmd) {
|
||||
|
||||
sgNoticeAddExe.execute(cmd);
|
||||
return SingleResponse.buildSuccess();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void edit(SgNoticeUpdateCmd sgNoticeUpdateCmd) {
|
||||
sgNoticeUpdateExe.execute(sgNoticeUpdateCmd);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove(Long id) {
|
||||
sgNoticeRemoveExe.execute(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeBatch(Long[] ids) {
|
||||
sgNoticeRemoveExe.execute(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addReceive(SgNoticeAddDTO notice, String key, MultipartFile[] files) {
|
||||
sgNoticeAddExe.addReceive(notice, key, files);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
package com.zcloud.safety.service;
|
||||
|
||||
import com.alibaba.cola.dto.PageResponse;
|
||||
import com.alibaba.cola.dto.SingleResponse;
|
||||
import com.zcloud.safety.api.SgReferenceServiceI;
|
||||
import com.zcloud.safety.command.SgReferenceAddExe;
|
||||
import com.zcloud.safety.command.SgReferenceRemoveExe;
|
||||
import com.zcloud.safety.command.SgReferenceUpdateExe;
|
||||
import com.zcloud.safety.command.query.SgReferenceQueryExe;
|
||||
import com.zcloud.safety.dto.SgReferenceAddCmd;
|
||||
import com.zcloud.safety.dto.SgReferencePageQry;
|
||||
import com.zcloud.safety.dto.SgReferenceUpdateCmd;
|
||||
import com.zcloud.safety.dto.clientobject.SgReferenceCO;
|
||||
import com.zcloud.safety.dto.receive.SgReferenceReceiveDTO;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* 互学互鉴服务实现。
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class SgReferenceServiceImpl implements SgReferenceServiceI {
|
||||
|
||||
private final SgReferenceAddExe sgReferenceAddExe;
|
||||
private final SgReferenceUpdateExe sgReferenceUpdateExe;
|
||||
private final SgReferenceRemoveExe sgReferenceRemoveExe;
|
||||
private final SgReferenceQueryExe sgReferenceQueryExe;
|
||||
|
||||
@Override
|
||||
public PageResponse<SgReferenceCO> listPage(SgReferencePageQry qry) {
|
||||
return sgReferenceQueryExe.execute(qry);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SingleResponse<SgReferenceCO> getInfoById(Long id) {
|
||||
return SingleResponse.of(sgReferenceQueryExe.getInfoById(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public SingleResponse<SgReferenceCO> add(SgReferenceAddCmd cmd) {
|
||||
sgReferenceAddExe.execute(cmd);
|
||||
return SingleResponse.buildSuccess();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void edit(SgReferenceUpdateCmd cmd) {
|
||||
sgReferenceUpdateExe.execute(cmd);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove(Long id) {
|
||||
sgReferenceRemoveExe.execute(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeBatch(Long[] ids) {
|
||||
sgReferenceRemoveExe.execute(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addReceive(SgReferenceReceiveDTO reference, String key, MultipartFile[] files) {
|
||||
sgReferenceAddExe.addReceive(reference, key, files);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,76 @@
|
|||
package com.zcloud.safety.service;
|
||||
|
||||
import com.alibaba.cola.dto.PageResponse;
|
||||
import com.alibaba.cola.dto.SingleResponse;
|
||||
import com.zcloud.safety.api.SgSuperviseServiceI;
|
||||
import com.zcloud.safety.command.SgSuperviseAddExe;
|
||||
import com.zcloud.safety.command.SgSuperviseRemoveExe;
|
||||
import com.zcloud.safety.command.SgSuperviseUpdateExe;
|
||||
import com.zcloud.safety.command.query.SgSuperviseQueryExe;
|
||||
import com.zcloud.safety.dto.SgSuperviseAddCmd;
|
||||
import com.zcloud.safety.dto.SgSupervisePageQry;
|
||||
import com.zcloud.safety.dto.SgSuperviseUpdateCmd;
|
||||
import com.zcloud.safety.dto.clientobject.SgSuperviseCO;
|
||||
import com.zcloud.safety.dto.receive.SgSuperviseAddDTO;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* web-app
|
||||
*
|
||||
* @Author zhaokai
|
||||
* @Date 2026-06-01 11:22:45
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class SgSuperviseServiceImpl implements SgSuperviseServiceI {
|
||||
private final SgSuperviseAddExe sgSuperviseAddExe;
|
||||
private final SgSuperviseUpdateExe sgSuperviseUpdateExe;
|
||||
private final SgSuperviseRemoveExe sgSuperviseRemoveExe;
|
||||
private final SgSuperviseQueryExe sgSuperviseQueryExe;
|
||||
|
||||
@Override
|
||||
public PageResponse<SgSuperviseCO> listPage(SgSupervisePageQry qry) {
|
||||
|
||||
return sgSuperviseQueryExe.execute(qry);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SingleResponse<SgSuperviseCO> getInfoById(Long id) {
|
||||
return SingleResponse.of(sgSuperviseQueryExe.getInfoById(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public SingleResponse add(SgSuperviseAddCmd cmd) {
|
||||
|
||||
sgSuperviseAddExe.execute(cmd);
|
||||
return SingleResponse.buildSuccess();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void edit(SgSuperviseUpdateCmd sgSuperviseUpdateCmd) {
|
||||
sgSuperviseUpdateExe.execute(sgSuperviseUpdateCmd);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove(Long id) {
|
||||
sgSuperviseRemoveExe.execute(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeBatch(Long[] ids) {
|
||||
sgSuperviseRemoveExe.execute(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addReceive(SgSuperviseAddDTO supervise, String key, MultipartFile[] files) {
|
||||
sgSuperviseAddExe.addReceive(supervise,key,files);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void forward(SgSuperviseUpdateCmd sgSuperviseUpdateCmd) {
|
||||
sgSuperviseUpdateExe.forward(sgSuperviseUpdateCmd);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
package com.zcloud.safety.service;
|
||||
|
||||
import com.alibaba.cola.dto.PageResponse;
|
||||
import com.alibaba.cola.dto.SingleResponse;
|
||||
import com.zcloud.safety.api.SgXgfFilingServiceI;
|
||||
import com.zcloud.safety.command.SgXgfFilingAddExe;
|
||||
import com.zcloud.safety.command.SgXgfFilingRemoveExe;
|
||||
import com.zcloud.safety.command.SgXgfFilingUpdateExe;
|
||||
import com.zcloud.safety.command.query.SgXgfFilingQueryExe;
|
||||
import com.zcloud.safety.dto.SgXgfFilingAddCmd;
|
||||
import com.zcloud.safety.dto.SgXgfFilingPageQry;
|
||||
import com.zcloud.safety.dto.SgXgfFilingUpdateCmd;
|
||||
import com.zcloud.safety.dto.clientobject.SgXgfFilingCO;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 一级相关方备案服务实现。
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class SgXgfFilingServiceImpl implements SgXgfFilingServiceI {
|
||||
|
||||
private final SgXgfFilingAddExe sgXgfFilingAddExe;
|
||||
private final SgXgfFilingUpdateExe sgXgfFilingUpdateExe;
|
||||
private final SgXgfFilingRemoveExe sgXgfFilingRemoveExe;
|
||||
private final SgXgfFilingQueryExe sgXgfFilingQueryExe;
|
||||
|
||||
@Override
|
||||
public PageResponse<SgXgfFilingCO> listPage(SgXgfFilingPageQry qry) {
|
||||
return sgXgfFilingQueryExe.execute(qry);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SingleResponse<SgXgfFilingCO> getInfoById(Long id) {
|
||||
return SingleResponse.of(sgXgfFilingQueryExe.getInfoById(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public SingleResponse<SgXgfFilingCO> add(SgXgfFilingAddCmd cmd) {
|
||||
sgXgfFilingAddExe.execute(cmd);
|
||||
return SingleResponse.buildSuccess();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void edit(SgXgfFilingUpdateCmd cmd) {
|
||||
sgXgfFilingUpdateExe.execute(cmd);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove(Long id) {
|
||||
sgXgfFilingRemoveExe.execute(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeBatch(Long[] ids) {
|
||||
sgXgfFilingRemoveExe.execute(ids);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
package com.zcloud.safety.api;
|
||||
|
||||
import com.alibaba.cola.dto.PageResponse;
|
||||
import com.alibaba.cola.dto.SingleResponse;
|
||||
import com.zcloud.safety.dto.ImgFilesAddCmd;
|
||||
import com.zcloud.safety.dto.ImgFilesPageQry;
|
||||
import com.zcloud.safety.dto.ImgFilesUpdateCmd;
|
||||
import com.zcloud.safety.dto.clientobject.ImgFilesCO;
|
||||
|
||||
/**
|
||||
* web-client
|
||||
*
|
||||
* @Author zhaokai
|
||||
* @Date 2026-06-01 14:27:18
|
||||
*/
|
||||
public interface ImgFilesServiceI {
|
||||
PageResponse<ImgFilesCO> listPage(ImgFilesPageQry qry);
|
||||
|
||||
SingleResponse<ImgFilesCO> add(ImgFilesAddCmd cmd);
|
||||
|
||||
void edit(ImgFilesUpdateCmd cmd);
|
||||
|
||||
void remove(Long id);
|
||||
|
||||
void removeBatch(Long[] ids);
|
||||
}
|
||||
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
package com.zcloud.safety.api;
|
||||
|
||||
import com.alibaba.cola.dto.PageResponse;
|
||||
import com.alibaba.cola.dto.SingleResponse;
|
||||
import com.zcloud.safety.dto.RiskPointAddCmd;
|
||||
import com.zcloud.safety.dto.RiskPointPageQry;
|
||||
import com.zcloud.safety.dto.RiskPointUpdateCmd;
|
||||
import com.zcloud.safety.dto.clientobject.RiskPointCo;
|
||||
|
||||
public interface RiskPointServiceI {
|
||||
PageResponse<RiskPointCo> listPage(RiskPointPageQry qry);
|
||||
SingleResponse<RiskPointCo> add(RiskPointAddCmd cmd);
|
||||
|
||||
void edit(RiskPointUpdateCmd riskPointUpdateCmd);
|
||||
|
||||
void remove(Long id);
|
||||
|
||||
void removeBatch(Long[] ids);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
package com.zcloud.safety.api;
|
||||
|
||||
import com.alibaba.cola.dto.PageResponse;
|
||||
import com.alibaba.cola.dto.SingleResponse;
|
||||
import com.zcloud.safety.dto.SgAccidentAddCmd;
|
||||
import com.zcloud.safety.dto.SgAccidentPageQry;
|
||||
import com.zcloud.safety.dto.SgAccidentUpdateCmd;
|
||||
import com.zcloud.safety.dto.clientobject.SgAccidentCO;
|
||||
|
||||
/**
|
||||
* 事故上报服务接口。
|
||||
*/
|
||||
public interface SgAccidentServiceI {
|
||||
|
||||
PageResponse<SgAccidentCO> listPage(SgAccidentPageQry qry);
|
||||
|
||||
SingleResponse<SgAccidentCO> getInfoById(Long id);
|
||||
|
||||
SingleResponse<SgAccidentCO> add(SgAccidentAddCmd cmd);
|
||||
|
||||
void edit(SgAccidentUpdateCmd cmd);
|
||||
|
||||
void remove(Long id);
|
||||
|
||||
void removeBatch(Long[] ids);
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
package com.zcloud.safety.api;
|
||||
|
||||
import com.alibaba.cola.dto.PageResponse;
|
||||
import com.alibaba.cola.dto.SingleResponse;
|
||||
import com.zcloud.safety.dto.SgCalendarAddCmd;
|
||||
import com.zcloud.safety.dto.SgCalendarPageQry;
|
||||
import com.zcloud.safety.dto.SgCalendarUpdateCmd;
|
||||
import com.zcloud.safety.dto.clientobject.SgCalendarCO;
|
||||
import com.zcloud.safety.dto.receive.SgCalendarAuditDTO;
|
||||
|
||||
/**
|
||||
* 安全月历服务接口。
|
||||
*/
|
||||
public interface SgCalendarServiceI {
|
||||
PageResponse<SgCalendarCO> listPage(SgCalendarPageQry qry);
|
||||
|
||||
SingleResponse<SgCalendarCO> getInfoById(Long id);
|
||||
|
||||
SingleResponse<SgCalendarCO> add(SgCalendarAddCmd cmd);
|
||||
|
||||
void edit(SgCalendarUpdateCmd cmd);
|
||||
|
||||
void remove(Long id);
|
||||
|
||||
void removeBatch(Long[] ids);
|
||||
|
||||
void receiveAudit(SgCalendarAuditDTO auditDTO);
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package com.zcloud.safety.api;
|
||||
|
||||
import com.alibaba.cola.dto.PageResponse;
|
||||
import com.alibaba.cola.dto.SingleResponse;
|
||||
import com.zcloud.safety.dto.SgDutyAddCmd;
|
||||
import com.zcloud.safety.dto.SgDutyPageQry;
|
||||
import com.zcloud.safety.dto.SgDutyUpdateCmd;
|
||||
import com.zcloud.safety.dto.clientobject.SgDutyCO;
|
||||
|
||||
/**
|
||||
* 值班统计服务接口。
|
||||
*/
|
||||
public interface SgDutyServiceI {
|
||||
PageResponse<SgDutyCO> listPage(SgDutyPageQry qry);
|
||||
|
||||
SingleResponse<SgDutyCO> getInfoById(Long id);
|
||||
|
||||
SingleResponse<SgDutyCO> add(SgDutyAddCmd cmd);
|
||||
|
||||
void edit(SgDutyUpdateCmd cmd);
|
||||
|
||||
void remove(Long id);
|
||||
|
||||
void removeBatch(Long[] ids);
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
package com.zcloud.safety.api;
|
||||
|
||||
import com.alibaba.cola.dto.PageResponse;
|
||||
import com.alibaba.cola.dto.SingleResponse;
|
||||
import com.zcloud.safety.dto.SgInformAddCmd;
|
||||
import com.zcloud.safety.dto.SgInformPageQry;
|
||||
import com.zcloud.safety.dto.SgInformUpdateCmd;
|
||||
import com.zcloud.safety.dto.clientobject.SgInformCO;
|
||||
import com.zcloud.safety.dto.receive.SgInformAddDTO;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* 通知服务接口。
|
||||
*/
|
||||
public interface SgInformServiceI {
|
||||
PageResponse<SgInformCO> listPage(SgInformPageQry qry);
|
||||
|
||||
SingleResponse<SgInformCO> getInfoById(Long id);
|
||||
|
||||
SingleResponse<SgInformCO> add(SgInformAddCmd cmd);
|
||||
|
||||
void edit(SgInformUpdateCmd cmd);
|
||||
|
||||
void remove(Long id);
|
||||
|
||||
void removeBatch(Long[] ids);
|
||||
|
||||
void addReceive(SgInformAddDTO inform, String key, MultipartFile[] files);
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue