commit 3cdddc453387fb316ac487de5744fd64e7359bf8 Author: diven Date: Tue Jun 30 21:49:19 2026 +0800 init diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..170c598 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,8 @@ +# 营销模块目录 +marketing-module-*/ +marketing-framework/ +marketing-client-sdk/ +marketing-dependencies/ +# 前端依赖 +marketing-ui/admin-ui/node_modules/ +**/node_modules/ \ No newline at end of file diff --git a/.flattened-pom.xml b/.flattened-pom.xml new file mode 100644 index 0000000..5ccd726 --- /dev/null +++ b/.flattened-pom.xml @@ -0,0 +1,40 @@ + + + 4.0.0 + com.platform + marketing-admin-all + 0.0.1-jdk8-SNAPSHOT + pom + marketing-admin-all + marketing-admin基础脚手架 + https://github.com/makemyownlife/marketing-admin + + + huaweicloud + huawei + https://mirrors.huaweicloud.com/repository/maven/ + + + aliyunmaven + aliyun + https://maven.aliyun.com/repository/public + + + + false + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + + + false + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + + diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..eab6124 --- /dev/null +++ b/.gitignore @@ -0,0 +1,304 @@ +# Created by .ignore support plugin (hsz.mobi) +.idea +# bin +pkg +*.iml +target +.vscode/* +.DS_Store + +.svn/ +target/ +test-output/ +*.class +.classpath +.project +.settings/ +tmp +temp +*.log +antx.properties +otter.properties +jtester.properties +.idea/ +*.iml +.DS_Store +*.tar.gz +*.rpm +*.dat +conf/ +.vscode + +target/ +marketing-ui/admin-ui/dist-prod/favicon.ico +marketing-ui/admin-ui/dist-prod/home.png +marketing-ui/admin-ui/dist-prod/index.html +marketing-ui/admin-ui/dist-prod/logo.gif +marketing-ui/admin-ui/dist-prod/assets/403---x72x_k.js +marketing-ui/admin-ui/dist-prod/assets/403-RqeqO19C.svg +marketing-ui/admin-ui/dist-prod/assets/404-B3JyPfEa.svg +marketing-ui/admin-ui/dist-prod/assets/404-TFng1Qog.js +marketing-ui/admin-ui/dist-prod/assets/500-BGu8fdSB.svg +marketing-ui/admin-ui/dist-prod/assets/500-DHh5Q027.js +marketing-ui/admin-ui/dist-prod/assets/ApiAccessLogDetail-CAT7ipXo.js +marketing-ui/admin-ui/dist-prod/assets/ApiAccessLogDetail.vue_vue_type_script_setup_true_lang-DRe7aG98.js +marketing-ui/admin-ui/dist-prod/assets/ApiErrorLogDetail-BG7lkl1-.js +marketing-ui/admin-ui/dist-prod/assets/ApiErrorLogDetail.vue_vue_type_script_setup_true_lang-B2lrJ1Mf.js +marketing-ui/admin-ui/dist-prod/assets/AreaForm-C2IAMT7d.js +marketing-ui/admin-ui/dist-prod/assets/AreaForm.vue_vue_type_script_setup_true_lang-Ug8Jk3ra.js +marketing-ui/admin-ui/dist-prod/assets/avatar-5EZc-Rgm.js +marketing-ui/admin-ui/dist-prod/assets/avatar-Ca9gIz_i.css +marketing-ui/admin-ui/dist-prod/assets/avatar-Dcbh69co.gif +marketing-ui/admin-ui/dist-prod/assets/BasicInfo-BS4wKhiV.js +marketing-ui/admin-ui/dist-prod/assets/BasicInfo-BwbMfmj0.css +marketing-ui/admin-ui/dist-prod/assets/BasicInfo-BwbMfmj0.css.gz +marketing-ui/admin-ui/dist-prod/assets/BasicInfo.vue_vue_type_script_setup_true_lang-Dz3kyAPJ.js +marketing-ui/admin-ui/dist-prod/assets/BasicInfo.vue_vue_type_script_setup_true_lang-Dz3kyAPJ.js.gz +marketing-ui/admin-ui/dist-prod/assets/BasicInfoForm-Bgrql1U2.js +marketing-ui/admin-ui/dist-prod/assets/BasicInfoForm.vue_vue_type_script_setup_true_lang-Bfm0Ur-D.js +marketing-ui/admin-ui/dist-prod/assets/ChannelAccountForm-DfmrksCV.js +marketing-ui/admin-ui/dist-prod/assets/ChannelAccountForm.vue_vue_type_script_setup_true_lang-D-3WI5tz.js +marketing-ui/admin-ui/dist-prod/assets/color-xEzN0Pg5.js +marketing-ui/admin-ui/dist-prod/assets/ColumInfoForm-JtfCXPEo.js +marketing-ui/admin-ui/dist-prod/assets/ColumInfoForm.vue_vue_type_script_setup_true_lang-4Crsas99.js +marketing-ui/admin-ui/dist-prod/assets/ConfigForm-C8FfNkXj.js +marketing-ui/admin-ui/dist-prod/assets/ConfigForm.vue_vue_type_script_setup_true_lang-DH4PLCMr.js +marketing-ui/admin-ui/dist-prod/assets/constants-D0aoFN3l.js +marketing-ui/admin-ui/dist-prod/assets/ContentWrap.vue_vue_type_script_setup_true_lang-DnXdNlYy.js +marketing-ui/admin-ui/dist-prod/assets/DataSourceConfigForm-D3JMl6Br.js +marketing-ui/admin-ui/dist-prod/assets/DataSourceConfigForm.vue_vue_type_script_setup_true_lang-Be-KP8WD.js +marketing-ui/admin-ui/dist-prod/assets/Demo01ContactForm-Dtx3ls76.js +marketing-ui/admin-ui/dist-prod/assets/Demo01ContactForm.vue_vue_type_script_setup_true_lang-DEGK_ELx.js +marketing-ui/admin-ui/dist-prod/assets/Demo02CategoryForm-BQIY2jfy.js +marketing-ui/admin-ui/dist-prod/assets/Demo02CategoryForm.vue_vue_type_script_setup_true_lang-CHyxtO5c.js +marketing-ui/admin-ui/dist-prod/assets/Demo03CourseForm-CWrhNLo9.js +marketing-ui/admin-ui/dist-prod/assets/Demo03CourseForm-D5jay_pz.js +marketing-ui/admin-ui/dist-prod/assets/Demo03CourseForm-DVQTOoi2.js +marketing-ui/admin-ui/dist-prod/assets/Demo03CourseForm.vue_vue_type_script_setup_true_lang-Cp1KjWMi.js +marketing-ui/admin-ui/dist-prod/assets/Demo03CourseForm.vue_vue_type_script_setup_true_lang-CZOYW_Iv.js +marketing-ui/admin-ui/dist-prod/assets/Demo03CourseForm.vue_vue_type_script_setup_true_lang-DeICqiOB.js +marketing-ui/admin-ui/dist-prod/assets/Demo03CourseList-B8Mknwmz.js +marketing-ui/admin-ui/dist-prod/assets/Demo03CourseList-C8fONkDN.js +marketing-ui/admin-ui/dist-prod/assets/Demo03CourseList.vue_vue_type_script_setup_true_lang-D_0z4z15.js +marketing-ui/admin-ui/dist-prod/assets/Demo03CourseList.vue_vue_type_script_setup_true_lang-DfO2DiX2.js +marketing-ui/admin-ui/dist-prod/assets/Demo03GradeForm-BlHpRrRC.js +marketing-ui/admin-ui/dist-prod/assets/Demo03GradeForm-CAdT3vrv.js +marketing-ui/admin-ui/dist-prod/assets/Demo03GradeForm-Om44l9YU.js +marketing-ui/admin-ui/dist-prod/assets/Demo03GradeForm.vue_vue_type_script_setup_true_lang-Bl1acwtg.js +marketing-ui/admin-ui/dist-prod/assets/Demo03GradeForm.vue_vue_type_script_setup_true_lang-BygOcUvf.js +marketing-ui/admin-ui/dist-prod/assets/Demo03GradeForm.vue_vue_type_script_setup_true_lang-thuOcCHX.js +marketing-ui/admin-ui/dist-prod/assets/Demo03GradeList-BCHOWl40.js +marketing-ui/admin-ui/dist-prod/assets/Demo03GradeList-DuGtbLQ6.js +marketing-ui/admin-ui/dist-prod/assets/Demo03GradeList.vue_vue_type_script_setup_true_lang-BY2JEaqy.js +marketing-ui/admin-ui/dist-prod/assets/Demo03GradeList.vue_vue_type_script_setup_true_lang-nUFrI-rU.js +marketing-ui/admin-ui/dist-prod/assets/Demo03StudentForm-4xkVEPe3.js +marketing-ui/admin-ui/dist-prod/assets/Demo03StudentForm-Cg9TdrhZ.js +marketing-ui/admin-ui/dist-prod/assets/Demo03StudentForm-Drb-41jz.js +marketing-ui/admin-ui/dist-prod/assets/Demo03StudentForm.vue_vue_type_script_setup_true_lang-D3dl_ynA.js +marketing-ui/admin-ui/dist-prod/assets/Demo03StudentForm.vue_vue_type_script_setup_true_lang-pesN_ZQ0.js +marketing-ui/admin-ui/dist-prod/assets/Demo03StudentForm.vue_vue_type_script_setup_true_lang-PugoSPnh.js +marketing-ui/admin-ui/dist-prod/assets/DeptForm-C2T255is.js +marketing-ui/admin-ui/dist-prod/assets/DeptForm.vue_vue_type_script_setup_true_lang-B0N6L4Ga.js +marketing-ui/admin-ui/dist-prod/assets/DeptTree-T7XtdGkx.js +marketing-ui/admin-ui/dist-prod/assets/DeptTree.vue_vue_type_script_setup_true_lang-4sL964g8.js +marketing-ui/admin-ui/dist-prod/assets/Dialog-BdewL7YE.css +marketing-ui/admin-ui/dist-prod/assets/Dialog.vue_vue_type_style_index_0_lang-DvBbpV3D.js +marketing-ui/admin-ui/dist-prod/assets/dict.type-C0qRJc_H.js +marketing-ui/admin-ui/dist-prod/assets/DictDataForm-B4V6YkHi.js +marketing-ui/admin-ui/dist-prod/assets/DictDataForm.vue_vue_type_script_setup_true_lang-BmhRM8Sx.js +marketing-ui/admin-ui/dist-prod/assets/DictTag.vue_vue_type_script_lang-CPtIjj0S.js +marketing-ui/admin-ui/dist-prod/assets/DictTypeForm-CdX27RA_.js +marketing-ui/admin-ui/dist-prod/assets/DictTypeForm.vue_vue_type_script_setup_true_lang-BLltR3Rv.js +marketing-ui/admin-ui/dist-prod/assets/download-oWiM5xVU.js +marketing-ui/admin-ui/dist-prod/assets/Echart.vue_vue_type_script_setup_true_lang-BcsVFKzI.js +marketing-ui/admin-ui/dist-prod/assets/Echart.vue_vue_type_script_setup_true_lang-BcsVFKzI.js.gz +marketing-ui/admin-ui/dist-prod/assets/echarts-B3Xnk3T1.js +marketing-ui/admin-ui/dist-prod/assets/echarts-B3Xnk3T1.js.gz +marketing-ui/admin-ui/dist-prod/assets/echarts-data-D_oXWXkg.js +marketing-ui/admin-ui/dist-prod/assets/echarts-data-ODRhKdw_.css +marketing-ui/admin-ui/dist-prod/assets/EditTable-dVZgKaiI.js +marketing-ui/admin-ui/dist-prod/assets/el-descriptions-item-CdyfzhGA.js +marketing-ui/admin-ui/dist-prod/assets/el-descriptions-item-D_IHWRLM.css +marketing-ui/admin-ui/dist-prod/assets/el-table-v2-Bd4f-86g.js +marketing-ui/admin-ui/dist-prod/assets/el-table-v2-Bd4f-86g.js.gz +marketing-ui/admin-ui/dist-prod/assets/el-table-v2-UcpT72VY.css +marketing-ui/admin-ui/dist-prod/assets/el-tree-select-BC9u6a6J.css +marketing-ui/admin-ui/dist-prod/assets/el-tree-select-CcwX-1RK.js +marketing-ui/admin-ui/dist-prod/assets/el-virtual-list-a11W3tEv.js +marketing-ui/admin-ui/dist-prod/assets/el-virtual-list-gqT3UWYL.css +marketing-ui/admin-ui/dist-prod/assets/en-QtiwgkPu.js +marketing-ui/admin-ui/dist-prod/assets/en-QtiwgkPu.js.gz +marketing-ui/admin-ui/dist-prod/assets/Error.vue_vue_type_script_setup_true_lang-D0IaN0n3.js +marketing-ui/admin-ui/dist-prod/assets/FileConfigForm-DJUQGYt5.js +marketing-ui/admin-ui/dist-prod/assets/FileConfigForm.vue_vue_type_script_setup_true_lang-TsCgwK-I.js +marketing-ui/admin-ui/dist-prod/assets/FileForm-BtrdpNoR.js +marketing-ui/admin-ui/dist-prod/assets/FileForm.vue_vue_type_script_setup_true_lang-mUeQvY6A.js +marketing-ui/admin-ui/dist-prod/assets/fontello-BTAxVWQW.woff +marketing-ui/admin-ui/dist-prod/assets/ForgetPasswordForm-aob2xmWK.js +marketing-ui/admin-ui/dist-prod/assets/ForgetPasswordForm-CBdI5LV8.css +marketing-ui/admin-ui/dist-prod/assets/formatTime-DV6z3HJ9.js +marketing-ui/admin-ui/dist-prod/assets/formRules-6BHLt0eT.js +marketing-ui/admin-ui/dist-prod/assets/GenerateInfoForm-Cm3zoIJc.js +marketing-ui/admin-ui/dist-prod/assets/GenerateInfoForm.vue_vue_type_script_setup_true_lang-fuLOFsp0.js +marketing-ui/admin-ui/dist-prod/assets/IFrame.vue_vue_type_script_setup_true_lang-CtOnZAt0.js +marketing-ui/admin-ui/dist-prod/assets/ImportTable-CZA2ZW-V.js +marketing-ui/admin-ui/dist-prod/assets/ImportTable.vue_vue_type_script_setup_true_lang-CMHaYpHQ.js +marketing-ui/admin-ui/dist-prod/assets/index-_V6zJOg3.js +marketing-ui/admin-ui/dist-prod/assets/index-2D27ydj1.css +marketing-ui/admin-ui/dist-prod/assets/Index-4jkUOdzG.css +marketing-ui/admin-ui/dist-prod/assets/index-b1eB6pGg.js +marketing-ui/admin-ui/dist-prod/assets/index-B5nujwuD.js +marketing-ui/admin-ui/dist-prod/assets/index-B9wl4o4u.js +marketing-ui/admin-ui/dist-prod/assets/index-Ba38QfZu.js +marketing-ui/admin-ui/dist-prod/assets/index-BAJLB_-R.js +marketing-ui/admin-ui/dist-prod/assets/index-Bb3kBxCv.js +marketing-ui/admin-ui/dist-prod/assets/index-BGeiC94L.js +marketing-ui/admin-ui/dist-prod/assets/index-Bl_EnnHt.js +marketing-ui/admin-ui/dist-prod/assets/index-BOTr1eeH.js +marketing-ui/admin-ui/dist-prod/assets/index-BrUZgf8Q.css +marketing-ui/admin-ui/dist-prod/assets/index-BRxBcAHj.js +marketing-ui/admin-ui/dist-prod/assets/index-BSp__PPC.js +marketing-ui/admin-ui/dist-prod/assets/index-C0LA7-Yf.js +marketing-ui/admin-ui/dist-prod/assets/Index-C3L8yP93.js +marketing-ui/admin-ui/dist-prod/assets/index-C03T_KSS.js +marketing-ui/admin-ui/dist-prod/assets/index-C4BENW8H.js +marketing-ui/admin-ui/dist-prod/assets/index-C4yChNuY.js +marketing-ui/admin-ui/dist-prod/assets/index-C8yW75XH.js +marketing-ui/admin-ui/dist-prod/assets/index-CB0lTtlY.js +marketing-ui/admin-ui/dist-prod/assets/Index-CbZesan5.js +marketing-ui/admin-ui/dist-prod/assets/index-ChsGs3cI.js +marketing-ui/admin-ui/dist-prod/assets/index-CHvI6XKA.js +marketing-ui/admin-ui/dist-prod/assets/index-CIuBqTRP.js +marketing-ui/admin-ui/dist-prod/assets/index-CjOFW6_i.js +marketing-ui/admin-ui/dist-prod/assets/index-COMmfAhY.js +marketing-ui/admin-ui/dist-prod/assets/index-Cpuairgj.js +marketing-ui/admin-ui/dist-prod/assets/index-Cpuairgj.js.gz +marketing-ui/admin-ui/dist-prod/assets/index-CrfTg3rd.js +marketing-ui/admin-ui/dist-prod/assets/index-CRU_VxN8.js +marketing-ui/admin-ui/dist-prod/assets/index-CTY-1tgs.js +marketing-ui/admin-ui/dist-prod/assets/index-CVFYqYIZ.js +marketing-ui/admin-ui/dist-prod/assets/index-CxH2vw_3.js +marketing-ui/admin-ui/dist-prod/assets/index-CYLhsPln.js +marketing-ui/admin-ui/dist-prod/assets/index-CYLhsPln.js.gz +marketing-ui/admin-ui/dist-prod/assets/index-D-nrPQ6r.js +marketing-ui/admin-ui/dist-prod/assets/index-D03I7QA5.js +marketing-ui/admin-ui/dist-prod/assets/index-D5gOqURp.js +marketing-ui/admin-ui/dist-prod/assets/index-D8lsdqED.js +marketing-ui/admin-ui/dist-prod/assets/index-Df26oTqT.js +marketing-ui/admin-ui/dist-prod/assets/index-DFCTHbPg.js +marketing-ui/admin-ui/dist-prod/assets/index-DG6XYd9E.js +marketing-ui/admin-ui/dist-prod/assets/index-DiAZs2K6.js +marketing-ui/admin-ui/dist-prod/assets/index-Dqp_pGU3.css +marketing-ui/admin-ui/dist-prod/assets/index-Dqp_pGU3.css.gz +marketing-ui/admin-ui/dist-prod/assets/index-DUKJZojM.js +marketing-ui/admin-ui/dist-prod/assets/index-DUKJZojM.js.gz +marketing-ui/admin-ui/dist-prod/assets/index-DVSGTC-P.js +marketing-ui/admin-ui/dist-prod/assets/index-DzSQo7NT.js +marketing-ui/admin-ui/dist-prod/assets/index-iEdnegTT.js +marketing-ui/admin-ui/dist-prod/assets/index-IvNnt4fu.js +marketing-ui/admin-ui/dist-prod/assets/index-KhhTxVBR.js +marketing-ui/admin-ui/dist-prod/assets/index-N6cZ28Pp.js +marketing-ui/admin-ui/dist-prod/assets/index-oLYpNB-Q.js +marketing-ui/admin-ui/dist-prod/assets/index-PGQ0TbxF.js +marketing-ui/admin-ui/dist-prod/assets/index-raJoS0ux.js +marketing-ui/admin-ui/dist-prod/assets/index-Xmn4R73-.js +marketing-ui/admin-ui/dist-prod/assets/index.vue_vue_type_script_setup_true_lang-X_OdiC1e.js +marketing-ui/admin-ui/dist-prod/assets/Index2-3gfXcXef.js +marketing-ui/admin-ui/dist-prod/assets/Index2-DeC7rtYf.css +marketing-ui/admin-ui/dist-prod/assets/InputPassword-BggAj9L0.js +marketing-ui/admin-ui/dist-prod/assets/InputPassword-BggAj9L0.js.gz +marketing-ui/admin-ui/dist-prod/assets/InputPassword-CRqODEyh.css +marketing-ui/admin-ui/dist-prod/assets/java-CGk0_04g.css +marketing-ui/admin-ui/dist-prod/assets/java-CJPVIdx6.js +marketing-ui/admin-ui/dist-prod/assets/java-CJPVIdx6.js.gz +marketing-ui/admin-ui/dist-prod/assets/JobDetail-CS5C_fMx.js +marketing-ui/admin-ui/dist-prod/assets/JobDetail-uzx6ttP-.css +marketing-ui/admin-ui/dist-prod/assets/JobDetail.vue_vue_type_script_setup_true_lang-B0U48_wX.js +marketing-ui/admin-ui/dist-prod/assets/JobForm-COxR787v.js +marketing-ui/admin-ui/dist-prod/assets/JobForm-DylK8ism.css +marketing-ui/admin-ui/dist-prod/assets/JobForm.vue_vue_type_script_setup_true_lang-Bfp5x_DV.js +marketing-ui/admin-ui/dist-prod/assets/JobForm.vue_vue_type_script_setup_true_lang-Bfp5x_DV.js.gz +marketing-ui/admin-ui/dist-prod/assets/JobLogDetail-CA9ZpktQ.js +marketing-ui/admin-ui/dist-prod/assets/JobLogDetail.vue_vue_type_script_setup_true_lang-BSLezxhx.js +marketing-ui/admin-ui/dist-prod/assets/Layout-CCSDB6Ru.js +marketing-ui/admin-ui/dist-prod/assets/Layout-CCSDB6Ru.js.gz +marketing-ui/admin-ui/dist-prod/assets/Layout-Cq32ah7f.css +marketing-ui/admin-ui/dist-prod/assets/Layout-Cq32ah7f.css.gz +marketing-ui/admin-ui/dist-prod/assets/LocaleDropdown-CWX4f097.css +marketing-ui/admin-ui/dist-prod/assets/LocaleDropdown.vue_vue_type_script_setup_true_lang-CVflBqTQ.js +marketing-ui/admin-ui/dist-prod/assets/Login-7fQCP0wX.css +marketing-ui/admin-ui/dist-prod/assets/login-box-bg-CgotIC_L.js +marketing-ui/admin-ui/dist-prod/assets/login-box-bg-CL6i7T2F.svg +marketing-ui/admin-ui/dist-prod/assets/Login-brbWnuhl.js +marketing-ui/admin-ui/dist-prod/assets/LoginForm-CtKx8Pcd.js +marketing-ui/admin-ui/dist-prod/assets/LoginForm-TBteuj-9.css +marketing-ui/admin-ui/dist-prod/assets/LoginFormTitle-DX-bWpHn.js +marketing-ui/admin-ui/dist-prod/assets/LoginFormTitle.vue_vue_type_script_setup_true_lang-CDZVRR3_.js +marketing-ui/admin-ui/dist-prod/assets/LoginLogDetail-Das6Ml15.js +marketing-ui/admin-ui/dist-prod/assets/LoginLogDetail.vue_vue_type_script_setup_true_lang-BDFGUZIu.js +marketing-ui/admin-ui/dist-prod/assets/logo-D8fXwB4F.png +marketing-ui/admin-ui/dist-prod/assets/logo-DTOYuZRW.js +marketing-ui/admin-ui/dist-prod/assets/MenuForm-gfdt_aAm.js +marketing-ui/admin-ui/dist-prod/assets/MenuForm.vue_vue_type_script_setup_true_lang-BptOOqry.js +marketing-ui/admin-ui/dist-prod/assets/MenuForm.vue_vue_type_script_setup_true_lang-BptOOqry.js.gz +marketing-ui/admin-ui/dist-prod/assets/MobileForm-B-MCaqQz.js +marketing-ui/admin-ui/dist-prod/assets/MobileForm-V-i_1bow.css +marketing-ui/admin-ui/dist-prod/assets/NoticeForm-DEbMVWaa.js +marketing-ui/admin-ui/dist-prod/assets/NoticeForm.vue_vue_type_script_setup_true_lang-DzFaDTTC.js +marketing-ui/admin-ui/dist-prod/assets/OperateLogDetail-BlRTWTXj.js +marketing-ui/admin-ui/dist-prod/assets/OperateLogDetail.vue_vue_type_script_setup_true_lang-PrMQIlQi.js +marketing-ui/admin-ui/dist-prod/assets/permission-BlaWMjPj.js +marketing-ui/admin-ui/dist-prod/assets/PostForm-Cj1dTKmx.js +marketing-ui/admin-ui/dist-prod/assets/PostForm.vue_vue_type_script_setup_true_lang-CeqSF7hD.js +marketing-ui/admin-ui/dist-prod/assets/PreviewCode-Dwx5-jFd.js +marketing-ui/admin-ui/dist-prod/assets/PreviewCode-xvKbIAPl.css +marketing-ui/admin-ui/dist-prod/assets/PreviewCode.vue_vue_type_style_index_0_lang-DovLP5zf.js +marketing-ui/admin-ui/dist-prod/assets/PreviewCode.vue_vue_type_style_index_0_lang-DovLP5zf.js.gz +marketing-ui/admin-ui/dist-prod/assets/profile-BjePXVCo.js +marketing-ui/admin-ui/dist-prod/assets/ProfileUser-Ba_t_siW.js +marketing-ui/admin-ui/dist-prod/assets/ProfileUser-D993dKCS.css +marketing-ui/admin-ui/dist-prod/assets/QrCodeForm-CDj06kWG.css +marketing-ui/admin-ui/dist-prod/assets/QrCodeForm-hfCjyDin.js +marketing-ui/admin-ui/dist-prod/assets/QrCodeForm.vue_vue_type_script_setup_true_lang-s18LUGA1.js +marketing-ui/admin-ui/dist-prod/assets/QrCodeForm.vue_vue_type_script_setup_true_lang-s18LUGA1.js.gz +marketing-ui/admin-ui/dist-prod/assets/Redirect-C4EIex3a.js +marketing-ui/admin-ui/dist-prod/assets/RegisterForm-D-gnI4Ka.css +marketing-ui/admin-ui/dist-prod/assets/RegisterForm-DjdIS0aw.js +marketing-ui/admin-ui/dist-prod/assets/ResetPwd-DNDkM6-q.js +marketing-ui/admin-ui/dist-prod/assets/ResetPwd.vue_vue_type_script_setup_true_lang-Cvg0L-Ee.js +marketing-ui/admin-ui/dist-prod/assets/RoleAssignMenuForm-D9NxKBl2.js +marketing-ui/admin-ui/dist-prod/assets/RoleAssignMenuForm.vue_vue_type_script_setup_true_lang-DxO9MYpz.js +marketing-ui/admin-ui/dist-prod/assets/RoleDataPermissionForm-cAMH0-3Y.js +marketing-ui/admin-ui/dist-prod/assets/RoleDataPermissionForm.vue_vue_type_script_setup_true_lang-3jyeMQFq.js +marketing-ui/admin-ui/dist-prod/assets/RoleForm-G2Rm_hhh.js +marketing-ui/admin-ui/dist-prod/assets/RoleForm.vue_vue_type_script_setup_true_lang-C5mP5XPA.js +marketing-ui/admin-ui/dist-prod/assets/SmsChannelInfoForm-CoS3bVBZ.css +marketing-ui/admin-ui/dist-prod/assets/SmsChannelInfoForm-Un21-ad5.js +marketing-ui/admin-ui/dist-prod/assets/SocialLogin-6dLikcbD.js +marketing-ui/admin-ui/dist-prod/assets/SocialLogin-CJ7S1maZ.css +marketing-ui/admin-ui/dist-prod/assets/SSOLogin-DdHKSaVH.js +marketing-ui/admin-ui/dist-prod/assets/SSOLogin.vue_vue_type_script_setup_true_lang-GiaibmFM.js +marketing-ui/admin-ui/dist-prod/assets/tagsView-Bckid-dM.js +marketing-ui/admin-ui/dist-prod/assets/tree-DAv-QQbh.js +marketing-ui/admin-ui/dist-prod/assets/useIcon-CsZ8KiuC.js +marketing-ui/admin-ui/dist-prod/assets/UserAssignRoleForm-CGwwcqKX.js +marketing-ui/admin-ui/dist-prod/assets/UserAssignRoleForm.vue_vue_type_script_setup_true_lang-WhjG6V3W.js +marketing-ui/admin-ui/dist-prod/assets/UserAvatar-CLPjOoSV.js +marketing-ui/admin-ui/dist-prod/assets/UserAvatar-CLPjOoSV.js.gz +marketing-ui/admin-ui/dist-prod/assets/UserAvatar-DZGzQns6.css +marketing-ui/admin-ui/dist-prod/assets/UserForm-6b8EkzNj.js +marketing-ui/admin-ui/dist-prod/assets/UserForm.vue_vue_type_script_setup_true_lang-BUXYeilv.js +marketing-ui/admin-ui/dist-prod/assets/UserImportForm-YCI3iyeS.js +marketing-ui/admin-ui/dist-prod/assets/UserImportForm.vue_vue_type_script_setup_true_lang-DJuTEnKX.js +marketing-ui/admin-ui/dist-prod/assets/UserSocial-CAOV7Vhf.js +marketing-ui/admin-ui/dist-prod/assets/UserSocial-DB_gu1EO.css +marketing-ui/admin-ui/dist-prod/assets/useWatermark-BmKapRf9.js +marketing-ui/admin-ui/dist-prod/assets/Verify-BvbYQthm.css +marketing-ui/admin-ui/dist-prod/assets/Verify-BvbYQthm.css.gz +marketing-ui/admin-ui/dist-prod/assets/Verify-NjODIIBB.js +marketing-ui/admin-ui/dist-prod/assets/Verify-NjODIIBB.js.gz +marketing-ui/admin-ui/dist-prod/assets/XButton-CrMSGTmM.js +marketing-ui/admin-ui/dist-prod/assets/XButton-ohXGS2Na.css +marketing-ui/admin-ui/dist-prod/assets/zh-CN-BGT-CEDR.js +marketing-ui/admin-ui/dist-prod/assets/zh-CN-BGT-CEDR.js.gz +/marketing-ui/admin-ui/dist-prod/ diff --git a/README.md b/README.md new file mode 100644 index 0000000..85b2c8f --- /dev/null +++ b/README.md @@ -0,0 +1,4 @@ +短信平台 Pro 版本: +http://14.103.184.174:81/login?redirect=/index +用户名:admin +密码:gaohui0601 \ No newline at end of file diff --git a/doc/sql/README.md b/doc/sql/README.md new file mode 100644 index 0000000..e69de29 diff --git a/doc/sql/mysql/marketing_admin.sql b/doc/sql/mysql/marketing_admin.sql new file mode 100644 index 0000000..cf87195 --- /dev/null +++ b/doc/sql/mysql/marketing_admin.sql @@ -0,0 +1,1639 @@ +/* + Navicat Premium Data Transfer + + Source Server : localhost + Source Server Type : MySQL + Source Server Version : 80039 + Source Host : localhost:3306 + Source Schema : magic_admin + + Target Server Type : MySQL + Target Server Version : 80039 + File Encoding : 65001 + + Date: 01/07/2025 21:42:36 +*/ + +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + +-- ---------------------------- +-- Table structure for infra_codegen_column +-- ---------------------------- +DROP TABLE IF EXISTS `infra_codegen_column`; +CREATE TABLE `infra_codegen_column` ( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号', + `table_id` bigint NOT NULL COMMENT '表编号', + `column_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '字段名', + `data_type` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '字段类型', + `column_comment` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '字段描述', + `nullable` bit(1) NOT NULL COMMENT '是否允许为空', + `primary_key` bit(1) NOT NULL COMMENT '是否主键', + `ordinal_position` int NOT NULL COMMENT '排序', + `java_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Java 属性类型', + `java_field` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Java 属性名', + `dict_type` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '字典类型', + `example` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '数据示例', + `create_operation` bit(1) NOT NULL COMMENT '是否为 Create 创建操作的字段', + `update_operation` bit(1) NOT NULL COMMENT '是否为 Update 更新操作的字段', + `list_operation` bit(1) NOT NULL COMMENT '是否为 List 查询操作的字段', + `list_operation_condition` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '=' COMMENT 'List 查询操作的条件类型', + `list_operation_result` bit(1) NOT NULL COMMENT '是否为 List 查询操作的返回字段', + `html_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '显示类型', + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建者', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '更新者', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=2564 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='代码生成表字段定义'; + +-- ---------------------------- +-- Records of infra_codegen_column +-- ---------------------------- +BEGIN; +INSERT INTO `infra_codegen_column` (`id`, `table_id`, `column_name`, `data_type`, `column_comment`, `nullable`, `primary_key`, `ordinal_position`, `java_type`, `java_field`, `dict_type`, `example`, `create_operation`, `update_operation`, `list_operation`, `list_operation_condition`, `list_operation_result`, `html_type`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2538, 191, 'id', 'BIGINT', '编号', b'0', b'1', 1, 'Long', 'id', '', '13987', b'0', b'1', b'0', '=', b'1', 'input', '1', '2025-04-09 17:40:21', '1', '2025-06-30 22:53:54', b'1'); +INSERT INTO `infra_codegen_column` (`id`, `table_id`, `column_name`, `data_type`, `column_comment`, `nullable`, `primary_key`, `ordinal_position`, `java_type`, `java_field`, `dict_type`, `example`, `create_operation`, `update_operation`, `list_operation`, `list_operation_condition`, `list_operation_result`, `html_type`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2539, 191, 'name', 'VARCHAR', '名字', b'0', b'0', 2, 'String', 'name', '', '芋艿', b'1', b'1', b'1', 'LIKE', b'1', 'input', '1', '2025-04-09 17:40:21', '1', '2025-06-30 22:53:54', b'1'); +INSERT INTO `infra_codegen_column` (`id`, `table_id`, `column_name`, `data_type`, `column_comment`, `nullable`, `primary_key`, `ordinal_position`, `java_type`, `java_field`, `dict_type`, `example`, `create_operation`, `update_operation`, `list_operation`, `list_operation_condition`, `list_operation_result`, `html_type`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2540, 191, 'sex', 'TINYINT', '性别', b'0', b'0', 3, 'Integer', 'sex', '', NULL, b'1', b'1', b'1', '=', b'1', 'radio', '1', '2025-04-09 17:40:21', '1', '2025-06-30 22:53:54', b'1'); +INSERT INTO `infra_codegen_column` (`id`, `table_id`, `column_name`, `data_type`, `column_comment`, `nullable`, `primary_key`, `ordinal_position`, `java_type`, `java_field`, `dict_type`, `example`, `create_operation`, `update_operation`, `list_operation`, `list_operation_condition`, `list_operation_result`, `html_type`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2541, 191, 'birthday', 'TIMESTAMP', '出生日期', b'0', b'0', 4, 'LocalDateTime', 'birthday', '', NULL, b'1', b'1', b'1', '=', b'1', 'datetime', '1', '2025-04-09 17:40:21', '1', '2025-06-30 22:53:54', b'1'); +INSERT INTO `infra_codegen_column` (`id`, `table_id`, `column_name`, `data_type`, `column_comment`, `nullable`, `primary_key`, `ordinal_position`, `java_type`, `java_field`, `dict_type`, `example`, `create_operation`, `update_operation`, `list_operation`, `list_operation_condition`, `list_operation_result`, `html_type`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2542, 191, 'description', 'VARCHAR', '简介', b'0', b'0', 5, 'String', 'description', '', '你说的对', b'1', b'1', b'1', '=', b'1', 'editor', '1', '2025-04-09 17:40:21', '1', '2025-06-30 22:53:54', b'1'); +INSERT INTO `infra_codegen_column` (`id`, `table_id`, `column_name`, `data_type`, `column_comment`, `nullable`, `primary_key`, `ordinal_position`, `java_type`, `java_field`, `dict_type`, `example`, `create_operation`, `update_operation`, `list_operation`, `list_operation_condition`, `list_operation_result`, `html_type`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2543, 191, 'creator', 'VARCHAR', '创建者', b'1', b'0', 6, 'String', 'creator', '', NULL, b'0', b'0', b'0', '=', b'0', 'input', '1', '2025-04-09 17:40:21', '1', '2025-06-30 22:53:54', b'1'); +INSERT INTO `infra_codegen_column` (`id`, `table_id`, `column_name`, `data_type`, `column_comment`, `nullable`, `primary_key`, `ordinal_position`, `java_type`, `java_field`, `dict_type`, `example`, `create_operation`, `update_operation`, `list_operation`, `list_operation_condition`, `list_operation_result`, `html_type`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2544, 191, 'create_time', 'TIMESTAMP', '创建时间', b'0', b'0', 7, 'LocalDateTime', 'createTime', '', NULL, b'0', b'0', b'1', 'BETWEEN', b'1', 'datetime', '1', '2025-04-09 17:40:21', '1', '2025-06-30 22:53:54', b'1'); +INSERT INTO `infra_codegen_column` (`id`, `table_id`, `column_name`, `data_type`, `column_comment`, `nullable`, `primary_key`, `ordinal_position`, `java_type`, `java_field`, `dict_type`, `example`, `create_operation`, `update_operation`, `list_operation`, `list_operation_condition`, `list_operation_result`, `html_type`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2545, 191, 'updater', 'VARCHAR', '更新者', b'1', b'0', 8, 'String', 'updater', '', NULL, b'0', b'0', b'0', '=', b'0', 'input', '1', '2025-04-09 17:40:21', '1', '2025-06-30 22:53:54', b'1'); +INSERT INTO `infra_codegen_column` (`id`, `table_id`, `column_name`, `data_type`, `column_comment`, `nullable`, `primary_key`, `ordinal_position`, `java_type`, `java_field`, `dict_type`, `example`, `create_operation`, `update_operation`, `list_operation`, `list_operation_condition`, `list_operation_result`, `html_type`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2546, 191, 'update_time', 'TIMESTAMP', '更新时间', b'0', b'0', 9, 'LocalDateTime', 'updateTime', '', NULL, b'0', b'0', b'0', 'BETWEEN', b'0', 'datetime', '1', '2025-04-09 17:40:21', '1', '2025-06-30 22:53:54', b'1'); +INSERT INTO `infra_codegen_column` (`id`, `table_id`, `column_name`, `data_type`, `column_comment`, `nullable`, `primary_key`, `ordinal_position`, `java_type`, `java_field`, `dict_type`, `example`, `create_operation`, `update_operation`, `list_operation`, `list_operation_condition`, `list_operation_result`, `html_type`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2547, 191, 'deleted', 'BIT', '是否删除', b'0', b'0', 10, 'Boolean', 'deleted', '', NULL, b'0', b'0', b'0', '=', b'0', 'radio', '1', '2025-04-09 17:40:21', '1', '2025-06-30 22:53:54', b'1'); +INSERT INTO `infra_codegen_column` (`id`, `table_id`, `column_name`, `data_type`, `column_comment`, `nullable`, `primary_key`, `ordinal_position`, `java_type`, `java_field`, `dict_type`, `example`, `create_operation`, `update_operation`, `list_operation`, `list_operation_condition`, `list_operation_result`, `html_type`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2548, 191, 'tenant_id', 'BIGINT', '租户编号', b'0', b'0', 11, 'Long', 'tenantId', '', '12608', b'0', b'0', b'0', '=', b'0', 'input', '1', '2025-04-09 17:40:21', '1', '2025-06-30 22:53:54', b'1'); +INSERT INTO `infra_codegen_column` (`id`, `table_id`, `column_name`, `data_type`, `column_comment`, `nullable`, `primary_key`, `ordinal_position`, `java_type`, `java_field`, `dict_type`, `example`, `create_operation`, `update_operation`, `list_operation`, `list_operation_condition`, `list_operation_result`, `html_type`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2549, 192, 'id', 'INTEGER', '编号', b'0', b'1', 1, 'Integer', 'id', '', '14447', b'0', b'1', b'0', '=', b'1', 'input', '1', '2025-06-30 22:54:01', '1', '2025-06-30 22:54:01', b'0'); +INSERT INTO `infra_codegen_column` (`id`, `table_id`, `column_name`, `data_type`, `column_comment`, `nullable`, `primary_key`, `ordinal_position`, `java_type`, `java_field`, `dict_type`, `example`, `create_operation`, `update_operation`, `list_operation`, `list_operation_condition`, `list_operation_result`, `html_type`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2550, 192, 'name', 'VARCHAR', '模型名称', b'1', b'0', 2, 'String', 'name', '', '张三', b'1', b'1', b'1', 'LIKE', b'1', 'input', '1', '2025-06-30 22:54:01', '1', '2025-06-30 22:54:01', b'0'); +INSERT INTO `infra_codegen_column` (`id`, `table_id`, `column_name`, `data_type`, `column_comment`, `nullable`, `primary_key`, `ordinal_position`, `java_type`, `java_field`, `dict_type`, `example`, `create_operation`, `update_operation`, `list_operation`, `list_operation_condition`, `list_operation_result`, `html_type`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2551, 192, 'model', 'VARCHAR', '模型标志', b'1', b'0', 3, 'String', 'model', '', NULL, b'1', b'1', b'1', '=', b'1', 'input', '1', '2025-06-30 22:54:01', '1', '2025-06-30 22:54:01', b'0'); +INSERT INTO `infra_codegen_column` (`id`, `table_id`, `column_name`, `data_type`, `column_comment`, `nullable`, `primary_key`, `ordinal_position`, `java_type`, `java_field`, `dict_type`, `example`, `create_operation`, `update_operation`, `list_operation`, `list_operation_condition`, `list_operation_result`, `html_type`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2552, 192, 'platform', 'VARCHAR', '平台', b'1', b'0', 4, 'String', 'platform', '', NULL, b'1', b'1', b'1', '=', b'1', 'input', '1', '2025-06-30 22:54:01', '1', '2025-06-30 22:54:01', b'0'); +INSERT INTO `infra_codegen_column` (`id`, `table_id`, `column_name`, `data_type`, `column_comment`, `nullable`, `primary_key`, `ordinal_position`, `java_type`, `java_field`, `dict_type`, `example`, `create_operation`, `update_operation`, `list_operation`, `list_operation_condition`, `list_operation_result`, `html_type`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2553, 192, 'type', 'INTEGER', '类型', b'1', b'0', 5, 'Integer', 'type', '', '1', b'1', b'1', b'1', '=', b'1', 'select', '1', '2025-06-30 22:54:01', '1', '2025-06-30 22:54:01', b'0'); +INSERT INTO `infra_codegen_column` (`id`, `table_id`, `column_name`, `data_type`, `column_comment`, `nullable`, `primary_key`, `ordinal_position`, `java_type`, `java_field`, `dict_type`, `example`, `create_operation`, `update_operation`, `list_operation`, `list_operation_condition`, `list_operation_result`, `html_type`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2554, 192, 'sort', 'INTEGER', '排序值', b'1', b'0', 6, 'Integer', 'sort', '', NULL, b'1', b'1', b'1', '=', b'1', 'input', '1', '2025-06-30 22:54:01', '1', '2025-06-30 22:54:01', b'0'); +INSERT INTO `infra_codegen_column` (`id`, `table_id`, `column_name`, `data_type`, `column_comment`, `nullable`, `primary_key`, `ordinal_position`, `java_type`, `java_field`, `dict_type`, `example`, `create_operation`, `update_operation`, `list_operation`, `list_operation_condition`, `list_operation_result`, `html_type`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2555, 192, 'status', 'INTEGER', '状态', b'1', b'0', 7, 'Integer', 'status', '', '1', b'1', b'1', b'1', '=', b'1', 'radio', '1', '2025-06-30 22:54:01', '1', '2025-06-30 22:54:01', b'0'); +INSERT INTO `infra_codegen_column` (`id`, `table_id`, `column_name`, `data_type`, `column_comment`, `nullable`, `primary_key`, `ordinal_position`, `java_type`, `java_field`, `dict_type`, `example`, `create_operation`, `update_operation`, `list_operation`, `list_operation_condition`, `list_operation_result`, `html_type`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2556, 192, 'temperature', 'DOUBLE', '温度参数', b'1', b'0', 8, 'Double', 'temperature', '', NULL, b'1', b'1', b'1', '=', b'1', 'input', '1', '2025-06-30 22:54:01', '1', '2025-06-30 22:54:01', b'0'); +INSERT INTO `infra_codegen_column` (`id`, `table_id`, `column_name`, `data_type`, `column_comment`, `nullable`, `primary_key`, `ordinal_position`, `java_type`, `java_field`, `dict_type`, `example`, `create_operation`, `update_operation`, `list_operation`, `list_operation_condition`, `list_operation_result`, `html_type`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2557, 192, 'max_tokens', 'INTEGER', '单条回复的最大 Token 数量', b'1', b'0', 9, 'Integer', 'maxTokens', '', NULL, b'1', b'1', b'1', '=', b'1', 'input', '1', '2025-06-30 22:54:01', '1', '2025-06-30 22:54:01', b'0'); +INSERT INTO `infra_codegen_column` (`id`, `table_id`, `column_name`, `data_type`, `column_comment`, `nullable`, `primary_key`, `ordinal_position`, `java_type`, `java_field`, `dict_type`, `example`, `create_operation`, `update_operation`, `list_operation`, `list_operation_condition`, `list_operation_result`, `html_type`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2558, 192, 'max_contexts', 'INTEGER', '上下文的最大 Message 数量', b'1', b'0', 10, 'Integer', 'maxContexts', '', NULL, b'1', b'1', b'1', '=', b'1', 'input', '1', '2025-06-30 22:54:01', '1', '2025-06-30 22:54:01', b'0'); +INSERT INTO `infra_codegen_column` (`id`, `table_id`, `column_name`, `data_type`, `column_comment`, `nullable`, `primary_key`, `ordinal_position`, `java_type`, `java_field`, `dict_type`, `example`, `create_operation`, `update_operation`, `list_operation`, `list_operation_condition`, `list_operation_result`, `html_type`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2559, 192, 'create_time', 'TIMESTAMP', '创建时间', b'1', b'0', 11, 'LocalDateTime', 'createTime', '', NULL, b'0', b'0', b'1', 'BETWEEN', b'1', 'datetime', '1', '2025-06-30 22:54:01', '1', '2025-06-30 22:54:01', b'0'); +INSERT INTO `infra_codegen_column` (`id`, `table_id`, `column_name`, `data_type`, `column_comment`, `nullable`, `primary_key`, `ordinal_position`, `java_type`, `java_field`, `dict_type`, `example`, `create_operation`, `update_operation`, `list_operation`, `list_operation_condition`, `list_operation_result`, `html_type`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2560, 192, 'update_time', 'TIMESTAMP', '更新时间', b'1', b'0', 12, 'LocalDateTime', 'updateTime', '', NULL, b'0', b'0', b'0', 'BETWEEN', b'0', 'datetime', '1', '2025-06-30 22:54:01', '1', '2025-06-30 22:54:01', b'0'); +INSERT INTO `infra_codegen_column` (`id`, `table_id`, `column_name`, `data_type`, `column_comment`, `nullable`, `primary_key`, `ordinal_position`, `java_type`, `java_field`, `dict_type`, `example`, `create_operation`, `update_operation`, `list_operation`, `list_operation_condition`, `list_operation_result`, `html_type`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2561, 192, 'creator', 'VARCHAR', '创建者', b'1', b'0', 13, 'String', 'creator', '', NULL, b'0', b'0', b'0', '=', b'0', 'input', '1', '2025-06-30 22:54:01', '1', '2025-06-30 22:54:01', b'0'); +INSERT INTO `infra_codegen_column` (`id`, `table_id`, `column_name`, `data_type`, `column_comment`, `nullable`, `primary_key`, `ordinal_position`, `java_type`, `java_field`, `dict_type`, `example`, `create_operation`, `update_operation`, `list_operation`, `list_operation_condition`, `list_operation_result`, `html_type`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2562, 192, 'updater', 'VARCHAR', '更新者', b'1', b'0', 14, 'String', 'updater', '', NULL, b'0', b'0', b'0', '=', b'0', 'input', '1', '2025-06-30 22:54:02', '1', '2025-06-30 22:54:02', b'0'); +INSERT INTO `infra_codegen_column` (`id`, `table_id`, `column_name`, `data_type`, `column_comment`, `nullable`, `primary_key`, `ordinal_position`, `java_type`, `java_field`, `dict_type`, `example`, `create_operation`, `update_operation`, `list_operation`, `list_operation_condition`, `list_operation_result`, `html_type`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2563, 192, 'deleted', 'BIT', '是否删除', b'1', b'0', 15, 'Boolean', 'deleted', '', NULL, b'0', b'0', b'0', '=', b'0', 'radio', '1', '2025-06-30 22:54:02', '1', '2025-06-30 22:54:02', b'0'); +COMMIT; + +-- ---------------------------- +-- Table structure for infra_codegen_table +-- ---------------------------- +DROP TABLE IF EXISTS `infra_codegen_table`; +CREATE TABLE `infra_codegen_table` ( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号', + `data_source_config_id` bigint NOT NULL COMMENT '数据源配置的编号', + `scene` tinyint NOT NULL DEFAULT '1' COMMENT '生成场景', + `table_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '表名称', + `table_comment` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '表描述', + `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '备注', + `module_name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '模块名', + `business_name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '业务名', + `class_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '类名称', + `class_comment` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '类描述', + `author` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '作者', + `template_type` tinyint NOT NULL DEFAULT '1' COMMENT '模板类型', + `front_type` tinyint NOT NULL COMMENT '前端类型', + `parent_menu_id` bigint DEFAULT NULL COMMENT '父菜单编号', + `master_table_id` bigint DEFAULT NULL COMMENT '主表的编号', + `sub_join_column_id` bigint DEFAULT NULL COMMENT '子表关联主表的字段编号', + `sub_join_many` bit(1) DEFAULT NULL COMMENT '主表与子表是否一对多', + `tree_parent_column_id` bigint DEFAULT NULL COMMENT '树表的父字段编号', + `tree_name_column_id` bigint DEFAULT NULL COMMENT '树表的名字字段编号', + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建者', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '更新者', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=193 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='代码生成表定义'; + +-- ---------------------------- +-- Records of infra_codegen_table +-- ---------------------------- +BEGIN; +INSERT INTO `infra_codegen_table` (`id`, `data_source_config_id`, `scene`, `table_name`, `table_comment`, `remark`, `module_name`, `business_name`, `class_name`, `class_comment`, `author`, `template_type`, `front_type`, `parent_menu_id`, `master_table_id`, `sub_join_column_id`, `sub_join_many`, `tree_parent_column_id`, `tree_name_column_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (191, 0, 1, 'yudao_demo03_student', '学生表', NULL, 'yudao', 'demo03student', 'Demo03Student', '学生', '勇哥Java实战', 1, 20, NULL, NULL, NULL, NULL, NULL, NULL, '1', '2025-04-09 17:40:21', '1', '2025-06-30 22:53:54', b'1'); +INSERT INTO `infra_codegen_table` (`id`, `data_source_config_id`, `scene`, `table_name`, `table_comment`, `remark`, `module_name`, `business_name`, `class_name`, `class_comment`, `author`, `template_type`, `front_type`, `parent_menu_id`, `master_table_id`, `sub_join_column_id`, `sub_join_many`, `tree_parent_column_id`, `tree_name_column_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (192, 0, 1, 'ai_model', 'AI模型表', NULL, 'ai', 'model', 'Model', 'AI模型', 'admin', 1, 20, NULL, NULL, NULL, NULL, NULL, NULL, '1', '2025-06-30 22:54:01', '1', '2025-06-30 22:54:01', b'0'); +COMMIT; + +-- ---------------------------- +-- Table structure for infra_config +-- ---------------------------- +DROP TABLE IF EXISTS `infra_config`; +CREATE TABLE `infra_config` ( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '参数主键', + `category` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '参数分组', + `type` tinyint NOT NULL COMMENT '参数类型', + `name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '参数名称', + `config_key` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '参数键名', + `value` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '参数键值', + `visible` bit(1) NOT NULL COMMENT '是否可见', + `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '备注', + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建者', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '更新者', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='参数配置表'; + +-- ---------------------------- +-- Records of infra_config +-- ---------------------------- +BEGIN; +INSERT INTO `infra_config` (`id`, `category`, `type`, `name`, `config_key`, `value`, `visible`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2, 'biz', 1, '用户管理-账号初始密码', 'system.user.init-password', '123456', b'0', '初始化密码 123456', 'admin', '2021-01-05 17:03:48', '1', '2024-07-20 17:22:47', b'0'); +INSERT INTO `infra_config` (`id`, `category`, `type`, `name`, `config_key`, `value`, `visible`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (10, 'url', 2, 'Swagger 接口文档的地址', 'url.swagger', '', b'1', '', '1', '2023-04-07 13:41:16', '1', '2023-04-07 14:59:00', b'0'); +INSERT INTO `infra_config` (`id`, `category`, `type`, `name`, `config_key`, `value`, `visible`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (12, 'test2', 2, 'test3', 'test4', 'test5', b'1', 'test6', '1', '2023-12-03 09:55:16', '1', '2023-12-03 09:55:27', b'0'); +COMMIT; + +-- ---------------------------- +-- Table structure for infra_data_source_config +-- ---------------------------- +DROP TABLE IF EXISTS `infra_data_source_config`; +CREATE TABLE `infra_data_source_config` ( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键编号', + `name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '参数名称', + `url` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '数据源连接', + `username` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '用户名', + `password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '密码', + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建者', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '更新者', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='数据源配置表'; + +-- ---------------------------- +-- Records of infra_data_source_config +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for infra_file +-- ---------------------------- +DROP TABLE IF EXISTS `infra_file`; +CREATE TABLE `infra_file` ( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '文件编号', + `config_id` bigint DEFAULT NULL COMMENT '配置编号', + `name` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '文件名', + `path` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '文件路径', + `url` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '文件 URL', + `type` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '文件类型', + `size` int NOT NULL COMMENT '文件大小', + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建者', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '更新者', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=1657 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='文件表'; + +-- ---------------------------- +-- Records of infra_file +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for infra_file_config +-- ---------------------------- +DROP TABLE IF EXISTS `infra_file_config`; +CREATE TABLE `infra_file_config` ( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号', + `name` varchar(63) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '配置名', + `storage` tinyint NOT NULL COMMENT '存储器', + `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '备注', + `master` bit(1) NOT NULL COMMENT '是否为主配置', + `config` varchar(4096) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '存储配置', + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建者', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '更新者', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=29 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='文件配置表'; + +-- ---------------------------- +-- Records of infra_file_config +-- ---------------------------- +BEGIN; +INSERT INTO `infra_file_config` (`id`, `name`, `storage`, `remark`, `master`, `config`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (4, '数据库(示例)', 1, '我是数据库', b'0', '{\"@class\":\"cn.iocoder.yudao.module.infra.framework.file.core.client.db.DBFileClientConfig\",\"domain\":\"http://127.0.0.1:48080\"}', '1', '2022-03-15 23:56:24', '1', '2024-11-09 18:09:28', b'0'); +INSERT INTO `infra_file_config` (`id`, `name`, `storage`, `remark`, `master`, `config`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (22, '七牛存储器(示例)', 20, '请换成你自己的密钥!!!', b'1', '{\"@class\":\"cn.iocoder.yudao.module.infra.framework.file.core.client.s3.S3FileClientConfig\",\"endpoint\":\"s3.cn-south-1.qiniucs.com\",\"domain\":\"http://test.yudao.iocoder.cn\",\"bucket\":\"ruoyi-vue-pro\",\"accessKey\":\"3TvrJ70gl2Gt6IBe7_IZT1F6i_k0iMuRtyEv4EyS\",\"accessSecret\":\"wd0tbVBYlp0S-ihA8Qg2hPLncoP83wyrIq24OZuY\"}', '1', '2024-01-13 22:11:12', '1', '2024-11-09 18:09:28', b'0'); +INSERT INTO `infra_file_config` (`id`, `name`, `storage`, `remark`, `master`, `config`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (24, '腾讯云存储(示例)', 20, '请换成你的密钥!!!', b'0', '{\"@class\":\"cn.iocoder.yudao.module.infra.framework.file.core.client.s3.S3FileClientConfig\",\"endpoint\":\"https://cos.ap-shanghai.myqcloud.com\",\"domain\":\"http://tengxun-oss.iocoder.cn\",\"bucket\":\"aoteman-1255880240\",\"accessKey\":\"AKIDAF6WSh1uiIjwqtrOsGSN3WryqTM6cTMt\",\"accessSecret\":\"X\"}', '1', '2024-11-09 16:03:22', '1', '2024-11-09 18:15:39', b'0'); +INSERT INTO `infra_file_config` (`id`, `name`, `storage`, `remark`, `master`, `config`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (25, '阿里云存储(示例)', 20, '', b'0', '{\"@class\":\"cn.iocoder.yudao.module.infra.framework.file.core.client.s3.S3FileClientConfig\",\"endpoint\":\"oss-cn-beijing.aliyuncs.com\",\"domain\":\"http://ali-oss.iocoder.cn\",\"bucket\":\"yunai-aoteman\",\"accessKey\":\"LTAI5tEQLgnDyjh3WpNcdMKA\",\"accessSecret\":\"X\"}', '1', '2024-11-09 16:47:08', '1', '2024-11-09 18:15:43', b'0'); +INSERT INTO `infra_file_config` (`id`, `name`, `storage`, `remark`, `master`, `config`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (26, '火山云存储(示例)', 20, '', b'0', '{\"@class\":\"cn.iocoder.yudao.module.infra.framework.file.core.client.s3.S3FileClientConfig\",\"endpoint\":\"tos-s3-cn-beijing.volces.com\",\"domain\":null,\"bucket\":\"yunai\",\"accessKey\":\"AKLTZjc3Zjc4MzZmMjU3NDk0ZTgxYmIyMmFkNTIwMDI1ZGE\",\"accessSecret\":\"X==\"}', '1', '2024-11-09 16:56:42', '1', '2024-11-09 18:15:46', b'0'); +INSERT INTO `infra_file_config` (`id`, `name`, `storage`, `remark`, `master`, `config`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (27, '华为云存储(示例)', 20, '', b'0', '{\"@class\":\"cn.iocoder.yudao.module.infra.framework.file.core.client.s3.S3FileClientConfig\",\"endpoint\":\"obs.cn-east-3.myhuaweicloud.com\",\"domain\":\"\",\"bucket\":\"yudao\",\"accessKey\":\"PVDONDEIOTW88LF8DC4U\",\"accessSecret\":\"X\"}', '1', '2024-11-09 17:18:41', '1', '2024-11-09 18:15:49', b'0'); +INSERT INTO `infra_file_config` (`id`, `name`, `storage`, `remark`, `master`, `config`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (28, 'MinIO 存储(示例)', 20, '', b'0', '{\"@class\":\"cn.iocoder.yudao.module.infra.framework.file.core.client.s3.S3FileClientConfig\",\"endpoint\":\"http://127.0.0.1:9000\",\"domain\":\"http://127.0.0.1:9000/yudao\",\"bucket\":\"yudao\",\"accessKey\":\"admin\",\"accessSecret\":\"password\"}', '1', '2024-11-09 17:43:10', '1', '2024-11-09 18:15:52', b'0'); +COMMIT; + +-- ---------------------------- +-- Table structure for infra_file_content +-- ---------------------------- +DROP TABLE IF EXISTS `infra_file_content`; +CREATE TABLE `infra_file_content` ( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号', + `config_id` bigint NOT NULL COMMENT '配置编号', + `path` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '文件路径', + `content` mediumblob NOT NULL COMMENT '文件内容', + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建者', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '更新者', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=283 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='文件表'; + +-- ---------------------------- +-- Records of infra_file_content +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for infra_job +-- ---------------------------- +DROP TABLE IF EXISTS `infra_job`; +CREATE TABLE `infra_job` ( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '任务编号', + `name` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '任务名称', + `status` tinyint NOT NULL COMMENT '任务状态', + `handler_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '处理器的名字', + `handler_param` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '处理器的参数', + `cron_expression` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'CRON 表达式', + `retry_count` int NOT NULL DEFAULT '0' COMMENT '重试次数', + `retry_interval` int NOT NULL DEFAULT '0' COMMENT '重试间隔', + `monitor_timeout` int NOT NULL DEFAULT '0' COMMENT '监控超时时间', + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建者', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '更新者', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=34 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='定时任务表'; + +-- ---------------------------- +-- Records of infra_job +-- ---------------------------- +BEGIN; +INSERT INTO `infra_job` (`id`, `name`, `status`, `handler_name`, `handler_param`, `cron_expression`, `retry_count`, `retry_interval`, `monitor_timeout`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (33, 'demoJob', 2, 'demoJob', '', '0 * * * * ?', 1, 1, 0, '1', '2024-10-27 19:38:46', '1', '2024-10-27 19:40:23', b'0'); +COMMIT; + +-- ---------------------------- +-- Table structure for infra_job_log +-- ---------------------------- +DROP TABLE IF EXISTS `infra_job_log`; +CREATE TABLE `infra_job_log` ( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '日志编号', + `job_id` bigint NOT NULL COMMENT '任务编号', + `handler_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '处理器的名字', + `handler_param` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '处理器的参数', + `execute_index` tinyint NOT NULL DEFAULT '1' COMMENT '第几次执行', + `begin_time` datetime NOT NULL COMMENT '开始执行时间', + `end_time` datetime DEFAULT NULL COMMENT '结束执行时间', + `duration` int DEFAULT NULL COMMENT '执行时长', + `status` tinyint NOT NULL COMMENT '任务状态', + `result` varchar(4000) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '结果数据', + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建者', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '更新者', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=638 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='定时任务日志表'; + +-- ---------------------------- +-- Records of infra_job_log +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for system_dept +-- ---------------------------- +DROP TABLE IF EXISTS `system_dept`; +CREATE TABLE `system_dept` ( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '部门id', + `name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '部门名称', + `parent_id` bigint NOT NULL DEFAULT '0' COMMENT '父部门id', + `sort` int NOT NULL DEFAULT '0' COMMENT '显示顺序', + `leader_user_id` bigint DEFAULT NULL COMMENT '负责人', + `phone` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '联系电话', + `email` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '邮箱', + `status` tinyint NOT NULL COMMENT '部门状态(0正常 1停用)', + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建者', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '更新者', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=115 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='部门表'; + +-- ---------------------------- +-- Records of system_dept +-- ---------------------------- +BEGIN; +INSERT INTO `system_dept` (`id`, `name`, `parent_id`, `sort`, `leader_user_id`, `phone`, `email`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (100, '勇哥Java实战', 0, 0, 1, '15888888888', 'ry@qq.com', 0, 'admin', '2021-01-05 17:03:47', '1', '2023-11-14 23:30:36', b'0'); +INSERT INTO `system_dept` (`id`, `name`, `parent_id`, `sort`, `leader_user_id`, `phone`, `email`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (101, '深圳总公司', 100, 1, 104, '15888888888', 'ry@qq.com', 0, 'admin', '2021-01-05 17:03:47', '1', '2023-12-02 09:53:35', b'0'); +INSERT INTO `system_dept` (`id`, `name`, `parent_id`, `sort`, `leader_user_id`, `phone`, `email`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (102, '长沙分公司', 100, 2, NULL, '15888888888', 'ry@qq.com', 0, 'admin', '2021-01-05 17:03:47', '', '2021-12-15 05:01:40', b'0'); +INSERT INTO `system_dept` (`id`, `name`, `parent_id`, `sort`, `leader_user_id`, `phone`, `email`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (103, '研发部门', 101, 1, 1, '15888888888', 'ry@qq.com', 0, 'admin', '2021-01-05 17:03:47', '1', '2024-10-02 10:22:03', b'0'); +INSERT INTO `system_dept` (`id`, `name`, `parent_id`, `sort`, `leader_user_id`, `phone`, `email`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (104, '市场部门', 101, 2, NULL, '15888888888', 'ry@qq.com', 0, 'admin', '2021-01-05 17:03:47', '', '2021-12-15 05:01:38', b'0'); +INSERT INTO `system_dept` (`id`, `name`, `parent_id`, `sort`, `leader_user_id`, `phone`, `email`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (105, '测试部门', 101, 3, NULL, '15888888888', 'ry@qq.com', 0, 'admin', '2021-01-05 17:03:47', '1', '2022-05-16 20:25:15', b'0'); +INSERT INTO `system_dept` (`id`, `name`, `parent_id`, `sort`, `leader_user_id`, `phone`, `email`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (106, '财务部门', 101, 4, 103, '15888888888', 'ry@qq.com', 0, 'admin', '2021-01-05 17:03:47', '103', '2022-01-15 21:32:22', b'0'); +INSERT INTO `system_dept` (`id`, `name`, `parent_id`, `sort`, `leader_user_id`, `phone`, `email`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (107, '运维部门', 101, 5, 1, '15888888888', 'ry@qq.com', 0, 'admin', '2021-01-05 17:03:47', '1', '2023-12-02 09:28:22', b'0'); +INSERT INTO `system_dept` (`id`, `name`, `parent_id`, `sort`, `leader_user_id`, `phone`, `email`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (108, '市场部门', 102, 1, NULL, '15888888888', 'ry@qq.com', 0, 'admin', '2021-01-05 17:03:47', '1', '2022-02-16 08:35:45', b'0'); +INSERT INTO `system_dept` (`id`, `name`, `parent_id`, `sort`, `leader_user_id`, `phone`, `email`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (109, '财务部门', 102, 2, NULL, '15888888888', 'ry@qq.com', 0, 'admin', '2021-01-05 17:03:47', '', '2021-12-15 05:01:29', b'0'); +COMMIT; + +-- ---------------------------- +-- Table structure for system_dict_data +-- ---------------------------- +DROP TABLE IF EXISTS `system_dict_data`; +CREATE TABLE `system_dict_data` ( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '字典编码', + `sort` int NOT NULL DEFAULT '0' COMMENT '字典排序', + `label` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '字典标签', + `value` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '字典键值', + `dict_type` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '字典类型', + `status` tinyint NOT NULL DEFAULT '0' COMMENT '状态(0正常 1停用)', + `color_type` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '颜色类型', + `css_class` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT 'css 样式', + `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '备注', + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建者', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '更新者', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=3000 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='字典数据表'; + +-- ---------------------------- +-- Records of system_dict_data +-- ---------------------------- +BEGIN; +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1, 1, '男', '1', 'system_user_sex', 0, 'default', 'A', '性别男', 'admin', '2021-01-05 17:03:48', '1', '2022-03-29 00:14:39', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2, 2, '女', '2', 'system_user_sex', 0, 'success', '', '性别女', 'admin', '2021-01-05 17:03:48', '1', '2023-11-15 23:30:37', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (8, 1, '正常', '1', 'infra_job_status', 0, 'success', '', '正常状态', 'admin', '2021-01-05 17:03:48', '1', '2022-02-16 19:33:38', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (9, 2, '暂停', '2', 'infra_job_status', 0, 'danger', '', '停用状态', 'admin', '2021-01-05 17:03:48', '1', '2022-02-16 19:33:45', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (12, 1, '系统内置', '1', 'infra_config_type', 0, 'danger', '', '参数类型 - 系统内置', 'admin', '2021-01-05 17:03:48', '1', '2022-02-16 19:06:02', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (13, 2, '自定义', '2', 'infra_config_type', 0, 'primary', '', '参数类型 - 自定义', 'admin', '2021-01-05 17:03:48', '1', '2022-02-16 19:06:07', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (14, 1, '通知', '1', 'system_notice_type', 0, 'success', '', '通知', 'admin', '2021-01-05 17:03:48', '1', '2022-02-16 13:05:57', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (15, 2, '公告', '2', 'system_notice_type', 0, 'info', '', '公告', 'admin', '2021-01-05 17:03:48', '1', '2022-02-16 13:06:01', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (16, 0, '其它', '0', 'infra_operate_type', 0, 'default', '', '其它操作', 'admin', '2021-01-05 17:03:48', '1', '2024-03-14 12:44:19', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (17, 1, '查询', '1', 'infra_operate_type', 0, 'info', '', '查询操作', 'admin', '2021-01-05 17:03:48', '1', '2024-03-14 12:44:20', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (18, 2, '新增', '2', 'infra_operate_type', 0, 'primary', '', '新增操作', 'admin', '2021-01-05 17:03:48', '1', '2024-03-14 12:44:21', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (19, 3, '修改', '3', 'infra_operate_type', 0, 'warning', '', '修改操作', 'admin', '2021-01-05 17:03:48', '1', '2024-03-14 12:44:22', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (20, 4, '删除', '4', 'infra_operate_type', 0, 'danger', '', '删除操作', 'admin', '2021-01-05 17:03:48', '1', '2024-03-14 12:44:23', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (22, 5, '导出', '5', 'infra_operate_type', 0, 'default', '', '导出操作', 'admin', '2021-01-05 17:03:48', '1', '2024-03-14 12:44:24', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (23, 6, '导入', '6', 'infra_operate_type', 0, 'default', '', '导入操作', 'admin', '2021-01-05 17:03:48', '1', '2024-03-14 12:44:25', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (27, 1, '开启', '0', 'common_status', 0, 'primary', '', '开启状态', 'admin', '2021-01-05 17:03:48', '1', '2022-02-16 08:00:39', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (28, 2, '关闭', '1', 'common_status', 0, 'info', '', '关闭状态', 'admin', '2021-01-05 17:03:48', '1', '2022-02-16 08:00:44', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (29, 1, '目录', '1', 'system_menu_type', 0, '', '', '目录', 'admin', '2021-01-05 17:03:48', '', '2022-02-01 16:43:45', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (30, 2, '菜单', '2', 'system_menu_type', 0, '', '', '菜单', 'admin', '2021-01-05 17:03:48', '', '2022-02-01 16:43:41', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (31, 3, '按钮', '3', 'system_menu_type', 0, '', '', '按钮', 'admin', '2021-01-05 17:03:48', '', '2022-02-01 16:43:39', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (32, 1, '内置', '1', 'system_role_type', 0, 'danger', '', '内置角色', 'admin', '2021-01-05 17:03:48', '1', '2022-02-16 13:02:08', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (33, 2, '自定义', '2', 'system_role_type', 0, 'primary', '', '自定义角色', 'admin', '2021-01-05 17:03:48', '1', '2022-02-16 13:02:12', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (34, 1, '全部数据权限', '1', 'system_data_scope', 0, '', '', '全部数据权限', 'admin', '2021-01-05 17:03:48', '', '2022-02-01 16:47:17', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (35, 2, '指定部门数据权限', '2', 'system_data_scope', 0, '', '', '指定部门数据权限', 'admin', '2021-01-05 17:03:48', '', '2022-02-01 16:47:18', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (36, 3, '本部门数据权限', '3', 'system_data_scope', 0, '', '', '本部门数据权限', 'admin', '2021-01-05 17:03:48', '', '2022-02-01 16:47:16', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (37, 4, '本部门及以下数据权限', '4', 'system_data_scope', 0, '', '', '本部门及以下数据权限', 'admin', '2021-01-05 17:03:48', '', '2022-02-01 16:47:21', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (38, 5, '仅本人数据权限', '5', 'system_data_scope', 0, '', '', '仅本人数据权限', 'admin', '2021-01-05 17:03:48', '', '2022-02-01 16:47:23', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (39, 0, '成功', '0', 'system_login_result', 0, 'success', '', '登陆结果 - 成功', '', '2021-01-18 06:17:36', '1', '2022-02-16 13:23:49', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (40, 10, '账号或密码不正确', '10', 'system_login_result', 0, 'primary', '', '登陆结果 - 账号或密码不正确', '', '2021-01-18 06:17:54', '1', '2022-02-16 13:24:27', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (41, 20, '用户被禁用', '20', 'system_login_result', 0, 'warning', '', '登陆结果 - 用户被禁用', '', '2021-01-18 06:17:54', '1', '2022-02-16 13:23:57', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (42, 30, '验证码不存在', '30', 'system_login_result', 0, 'info', '', '登陆结果 - 验证码不存在', '', '2021-01-18 06:17:54', '1', '2022-02-16 13:24:07', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (43, 31, '验证码不正确', '31', 'system_login_result', 0, 'info', '', '登陆结果 - 验证码不正确', '', '2021-01-18 06:17:54', '1', '2022-02-16 13:24:11', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (44, 100, '未知异常', '100', 'system_login_result', 0, 'danger', '', '登陆结果 - 未知异常', '', '2021-01-18 06:17:54', '1', '2022-02-16 13:24:23', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (45, 1, '是', 'true', 'infra_boolean_string', 0, 'danger', '', 'Boolean 是否类型 - 是', '', '2021-01-19 03:20:55', '1', '2022-03-15 23:01:45', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (46, 1, '否', 'false', 'infra_boolean_string', 0, 'info', '', 'Boolean 是否类型 - 否', '', '2021-01-19 03:20:55', '1', '2022-03-15 23:09:45', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (50, 1, '单表(增删改查)', '1', 'infra_codegen_template_type', 0, '', '', NULL, '', '2021-02-05 07:09:06', '', '2022-03-10 16:33:15', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (51, 2, '树表(增删改查)', '2', 'infra_codegen_template_type', 0, '', '', NULL, '', '2021-02-05 07:14:46', '', '2022-03-10 16:33:19', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (53, 0, '初始化中', '0', 'infra_job_status', 0, 'primary', '', NULL, '', '2021-02-07 07:46:49', '1', '2022-02-16 19:33:29', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (57, 0, '运行中', '0', 'infra_job_log_status', 0, 'primary', '', 'RUNNING', '', '2021-02-08 10:04:24', '1', '2022-02-16 19:07:48', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (58, 1, '成功', '1', 'infra_job_log_status', 0, 'success', '', NULL, '', '2021-02-08 10:06:57', '1', '2022-02-16 19:07:52', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (59, 2, '失败', '2', 'infra_job_log_status', 0, 'warning', '', '失败', '', '2021-02-08 10:07:38', '1', '2022-02-16 19:07:56', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (60, 1, '会员', '1', 'user_type', 0, 'primary', '', NULL, '', '2021-02-26 00:16:27', '1', '2022-02-16 10:22:19', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (61, 2, '管理员', '2', 'user_type', 0, 'success', '', NULL, '', '2021-02-26 00:16:34', '1', '2022-02-16 10:22:22', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (62, 0, '未处理', '0', 'infra_api_error_log_process_status', 0, 'primary', '', NULL, '', '2021-02-26 07:07:19', '1', '2022-02-16 20:14:17', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (63, 1, '已处理', '1', 'infra_api_error_log_process_status', 0, 'success', '', NULL, '', '2021-02-26 07:07:26', '1', '2022-02-16 20:14:08', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (64, 2, '已忽略', '2', 'infra_api_error_log_process_status', 0, 'danger', '', NULL, '', '2021-02-26 07:07:34', '1', '2022-02-16 20:14:14', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (66, 1, '阿里云', 'ALIYUN', 'system_sms_channel_code', 0, 'primary', '', NULL, '1', '2021-04-05 01:05:26', '1', '2024-07-22 22:23:25', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (67, 1, '验证码', '1', 'system_sms_template_type', 0, 'warning', '', NULL, '1', '2021-04-05 21:50:57', '1', '2022-02-16 12:48:30', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (68, 2, '通知', '2', 'system_sms_template_type', 0, 'primary', '', NULL, '1', '2021-04-05 21:51:08', '1', '2022-02-16 12:48:27', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (69, 0, '营销', '3', 'system_sms_template_type', 0, 'danger', '', NULL, '1', '2021-04-05 21:51:15', '1', '2022-02-16 12:48:22', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (70, 0, '初始化', '0', 'system_sms_send_status', 0, 'primary', '', NULL, '1', '2021-04-11 20:18:33', '1', '2022-02-16 10:26:07', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (71, 1, '发送成功', '10', 'system_sms_send_status', 0, 'success', '', NULL, '1', '2021-04-11 20:18:43', '1', '2022-02-16 10:25:56', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (72, 2, '发送失败', '20', 'system_sms_send_status', 0, 'danger', '', NULL, '1', '2021-04-11 20:18:49', '1', '2022-02-16 10:26:03', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (73, 3, '不发送', '30', 'system_sms_send_status', 0, 'info', '', NULL, '1', '2021-04-11 20:19:44', '1', '2022-02-16 10:26:10', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (74, 0, '等待结果', '0', 'system_sms_receive_status', 0, 'primary', '', NULL, '1', '2021-04-11 20:27:43', '1', '2022-02-16 10:28:24', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (75, 1, '接收成功', '10', 'system_sms_receive_status', 0, 'success', '', NULL, '1', '2021-04-11 20:29:25', '1', '2022-02-16 10:28:28', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (76, 2, '接收失败', '20', 'system_sms_receive_status', 0, 'danger', '', NULL, '1', '2021-04-11 20:29:31', '1', '2022-02-16 10:28:32', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (77, 0, '调试(钉钉)', 'DEBUG_DING_TALK', 'system_sms_channel_code', 0, 'info', '', NULL, '1', '2021-04-13 00:20:37', '1', '2022-02-16 10:10:00', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (80, 100, '账号登录', '100', 'system_login_type', 0, 'primary', '', '账号登录', '1', '2021-10-06 00:52:02', '1', '2022-02-16 13:11:34', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (81, 101, '社交登录', '101', 'system_login_type', 0, 'info', '', '社交登录', '1', '2021-10-06 00:52:17', '1', '2022-02-16 13:11:40', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (83, 200, '主动登出', '200', 'system_login_type', 0, 'primary', '', '主动登出', '1', '2021-10-06 00:52:58', '1', '2022-02-16 13:11:49', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (85, 202, '强制登出', '202', 'system_login_type', 0, 'danger', '', '强制退出', '1', '2021-10-06 00:53:41', '1', '2022-02-16 13:11:57', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (86, 0, '病假', '1', 'bpm_oa_leave_type', 0, 'primary', '', NULL, '1', '2021-09-21 22:35:28', '1', '2022-02-16 10:00:41', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (87, 1, '事假', '2', 'bpm_oa_leave_type', 0, 'info', '', NULL, '1', '2021-09-21 22:36:11', '1', '2022-02-16 10:00:49', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (88, 2, '婚假', '3', 'bpm_oa_leave_type', 0, 'warning', '', NULL, '1', '2021-09-21 22:36:38', '1', '2022-02-16 10:00:53', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (112, 0, '微信 Wap 网站支付', 'wx_wap', 'pay_channel_code', 0, 'success', '', '微信 Wap 网站支付', '1', '2023-07-19 20:08:06', '1', '2023-07-19 20:09:08', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (113, 1, '微信公众号支付', 'wx_pub', 'pay_channel_code', 0, 'success', '', '微信公众号支付', '1', '2021-12-03 10:40:24', '1', '2023-07-19 20:08:47', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (114, 2, '微信小程序支付', 'wx_lite', 'pay_channel_code', 0, 'success', '', '微信小程序支付', '1', '2021-12-03 10:41:06', '1', '2023-07-19 20:08:50', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (115, 3, '微信 App 支付', 'wx_app', 'pay_channel_code', 0, 'success', '', '微信 App 支付', '1', '2021-12-03 10:41:20', '1', '2023-07-19 20:08:56', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (116, 10, '支付宝 PC 网站支付', 'alipay_pc', 'pay_channel_code', 0, 'primary', '', '支付宝 PC 网站支付', '1', '2021-12-03 10:42:09', '1', '2023-07-19 20:09:12', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (117, 11, '支付宝 Wap 网站支付', 'alipay_wap', 'pay_channel_code', 0, 'primary', '', '支付宝 Wap 网站支付', '1', '2021-12-03 10:42:26', '1', '2023-07-19 20:09:16', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (118, 12, '支付宝 App 支付', 'alipay_app', 'pay_channel_code', 0, 'primary', '', '支付宝 App 支付', '1', '2021-12-03 10:42:55', '1', '2023-07-19 20:09:20', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (119, 14, '支付宝扫码支付', 'alipay_qr', 'pay_channel_code', 0, 'primary', '', '支付宝扫码支付', '1', '2021-12-03 10:43:10', '1', '2023-07-19 20:09:28', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (120, 10, '通知成功', '10', 'pay_notify_status', 0, 'success', '', '通知成功', '1', '2021-12-03 11:02:41', '1', '2023-07-19 10:08:19', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (121, 20, '通知失败', '20', 'pay_notify_status', 0, 'danger', '', '通知失败', '1', '2021-12-03 11:02:59', '1', '2023-07-19 10:08:21', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (122, 0, '等待通知', '0', 'pay_notify_status', 0, 'info', '', '未通知', '1', '2021-12-03 11:03:10', '1', '2023-07-19 10:08:24', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (123, 10, '支付成功', '10', 'pay_order_status', 0, 'success', '', '支付成功', '1', '2021-12-03 11:18:29', '1', '2023-07-19 18:04:28', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (124, 30, '支付关闭', '30', 'pay_order_status', 0, 'info', '', '支付关闭', '1', '2021-12-03 11:18:42', '1', '2023-07-19 18:05:07', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (125, 0, '等待支付', '0', 'pay_order_status', 0, 'info', '', '未支付', '1', '2021-12-03 11:18:18', '1', '2023-07-19 18:04:15', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (600, 5, '首页', '1', 'promotion_banner_position', 0, 'warning', '', '', '1', '2023-10-11 07:45:24', '1', '2023-10-11 07:45:38', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (601, 4, '秒杀活动页', '2', 'promotion_banner_position', 0, 'warning', '', '', '1', '2023-10-11 07:45:24', '1', '2023-10-11 07:45:38', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (602, 3, '砍价活动页', '3', 'promotion_banner_position', 0, 'warning', '', '', '1', '2023-10-11 07:45:24', '1', '2023-10-11 07:45:38', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (603, 2, '限时折扣页', '4', 'promotion_banner_position', 0, 'warning', '', '', '1', '2023-10-11 07:45:24', '1', '2023-10-11 07:45:38', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (604, 1, '满减送页', '5', 'promotion_banner_position', 0, 'warning', '', '', '1', '2023-10-11 07:45:24', '1', '2023-10-11 07:45:38', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1118, 0, '等待退款', '0', 'pay_refund_status', 0, 'info', '', '等待退款', '1', '2021-12-10 16:44:59', '1', '2023-07-19 10:14:39', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1119, 20, '退款失败', '20', 'pay_refund_status', 0, 'danger', '', '退款失败', '1', '2021-12-10 16:45:10', '1', '2023-07-19 10:15:10', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1124, 10, '退款成功', '10', 'pay_refund_status', 0, 'success', '', '退款成功', '1', '2021-12-10 16:46:26', '1', '2023-07-19 10:15:00', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1127, 1, '审批中', '1', 'bpm_process_instance_status', 0, 'default', '', '流程实例的状态 - 进行中', '1', '2022-01-07 23:47:22', '1', '2024-03-16 16:11:45', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1128, 2, '审批通过', '2', 'bpm_process_instance_status', 0, 'success', '', '流程实例的状态 - 已完成', '1', '2022-01-07 23:47:49', '1', '2024-03-16 16:11:54', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1129, 1, '审批中', '1', 'bpm_task_status', 0, 'primary', '', '流程实例的结果 - 处理中', '1', '2022-01-07 23:48:32', '1', '2024-03-08 22:41:37', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1130, 2, '审批通过', '2', 'bpm_task_status', 0, 'success', '', '流程实例的结果 - 通过', '1', '2022-01-07 23:48:45', '1', '2024-03-08 22:41:38', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1131, 3, '审批不通过', '3', 'bpm_task_status', 0, 'danger', '', '流程实例的结果 - 不通过', '1', '2022-01-07 23:48:55', '1', '2024-03-08 22:41:38', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1132, 4, '已取消', '4', 'bpm_task_status', 0, 'info', '', '流程实例的结果 - 撤销', '1', '2022-01-07 23:49:06', '1', '2024-03-08 22:41:39', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1133, 10, '流程表单', '10', 'bpm_model_form_type', 0, '', '', '流程的表单类型 - 流程表单', '103', '2022-01-11 23:51:30', '103', '2022-01-11 23:51:30', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1134, 20, '业务表单', '20', 'bpm_model_form_type', 0, '', '', '流程的表单类型 - 业务表单', '103', '2022-01-11 23:51:47', '103', '2022-01-11 23:51:47', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1135, 10, '角色', '10', 'bpm_task_candidate_strategy', 0, 'info', '', '任务分配规则的类型 - 角色', '103', '2022-01-12 23:21:22', '1', '2024-03-06 02:53:16', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1136, 20, '部门的成员', '20', 'bpm_task_candidate_strategy', 0, 'primary', '', '任务分配规则的类型 - 部门的成员', '103', '2022-01-12 23:21:47', '1', '2024-03-06 02:53:17', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1137, 21, '部门的负责人', '21', 'bpm_task_candidate_strategy', 0, 'primary', '', '任务分配规则的类型 - 部门的负责人', '103', '2022-01-12 23:33:36', '1', '2024-03-06 02:53:18', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1138, 30, '用户', '30', 'bpm_task_candidate_strategy', 0, 'info', '', '任务分配规则的类型 - 用户', '103', '2022-01-12 23:34:02', '1', '2024-03-06 02:53:19', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1139, 40, '用户组', '40', 'bpm_task_candidate_strategy', 0, 'warning', '', '任务分配规则的类型 - 用户组', '103', '2022-01-12 23:34:21', '1', '2024-03-06 02:53:20', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1140, 60, '流程表达式', '60', 'bpm_task_candidate_strategy', 0, 'danger', '', '任务分配规则的类型 - 流程表达式', '103', '2022-01-12 23:34:43', '1', '2024-03-06 02:53:20', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1141, 22, '岗位', '22', 'bpm_task_candidate_strategy', 0, 'success', '', '任务分配规则的类型 - 岗位', '103', '2022-01-14 18:41:55', '1', '2024-03-06 02:53:21', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1145, 1, '管理后台', '1', 'infra_codegen_scene', 0, '', '', '代码生成的场景枚举 - 管理后台', '1', '2022-02-02 13:15:06', '1', '2022-03-10 16:32:59', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1146, 2, '用户 APP', '2', 'infra_codegen_scene', 0, '', '', '代码生成的场景枚举 - 用户 APP', '1', '2022-02-02 13:15:19', '1', '2022-03-10 16:33:03', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1150, 1, '数据库', '1', 'infra_file_storage', 0, 'default', '', NULL, '1', '2022-03-15 00:25:28', '1', '2022-03-15 00:25:28', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1151, 10, '本地磁盘', '10', 'infra_file_storage', 0, 'default', '', NULL, '1', '2022-03-15 00:25:41', '1', '2022-03-15 00:25:56', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1152, 11, 'FTP 服务器', '11', 'infra_file_storage', 0, 'default', '', NULL, '1', '2022-03-15 00:26:06', '1', '2022-03-15 00:26:10', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1153, 12, 'SFTP 服务器', '12', 'infra_file_storage', 0, 'default', '', NULL, '1', '2022-03-15 00:26:22', '1', '2022-03-15 00:26:22', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1154, 20, 'S3 对象存储', '20', 'infra_file_storage', 0, 'default', '', NULL, '1', '2022-03-15 00:26:31', '1', '2022-03-15 00:26:45', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1155, 103, '短信登录', '103', 'system_login_type', 0, 'default', '', NULL, '1', '2022-05-09 23:57:58', '1', '2022-05-09 23:58:09', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1156, 1, 'password', 'password', 'system_oauth2_grant_type', 0, 'default', '', '密码模式', '1', '2022-05-12 00:22:05', '1', '2022-05-11 16:26:01', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1157, 2, 'authorization_code', 'authorization_code', 'system_oauth2_grant_type', 0, 'primary', '', '授权码模式', '1', '2022-05-12 00:22:59', '1', '2022-05-11 16:26:02', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1158, 3, 'implicit', 'implicit', 'system_oauth2_grant_type', 0, 'success', '', '简化模式', '1', '2022-05-12 00:23:40', '1', '2022-05-11 16:26:05', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1159, 4, 'client_credentials', 'client_credentials', 'system_oauth2_grant_type', 0, 'default', '', '客户端模式', '1', '2022-05-12 00:23:51', '1', '2022-05-11 16:26:08', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1160, 5, 'refresh_token', 'refresh_token', 'system_oauth2_grant_type', 0, 'info', '', '刷新模式', '1', '2022-05-12 00:24:02', '1', '2022-05-11 16:26:11', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1162, 1, '销售中', '1', 'product_spu_status', 0, 'success', '', '商品 SPU 状态 - 销售中', '1', '2022-10-24 21:19:47', '1', '2022-10-24 21:20:38', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1163, 0, '仓库中', '0', 'product_spu_status', 0, 'info', '', '商品 SPU 状态 - 仓库中', '1', '2022-10-24 21:20:54', '1', '2022-10-24 21:21:22', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1164, 0, '回收站', '-1', 'product_spu_status', 0, 'default', '', '商品 SPU 状态 - 回收站', '1', '2022-10-24 21:21:11', '1', '2022-10-24 21:21:11', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1165, 1, '满减', '1', 'promotion_discount_type', 0, 'success', '', '优惠类型 - 满减', '1', '2022-11-01 12:46:41', '1', '2022-11-01 12:50:11', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1166, 2, '折扣', '2', 'promotion_discount_type', 0, 'primary', '', '优惠类型 - 折扣', '1', '2022-11-01 12:46:51', '1', '2022-11-01 12:50:08', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1167, 1, '固定日期', '1', 'promotion_coupon_template_validity_type', 0, 'default', '', '优惠劵模板的有限期类型 - 固定日期', '1', '2022-11-02 00:07:34', '1', '2022-11-04 00:07:49', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1168, 2, '领取之后', '2', 'promotion_coupon_template_validity_type', 0, 'default', '', '优惠劵模板的有限期类型 - 领取之后', '1', '2022-11-02 00:07:54', '1', '2022-11-04 00:07:52', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1169, 1, '通用劵', '1', 'promotion_product_scope', 0, 'default', '', '营销的商品范围 - 全部商品参与', '1', '2022-11-02 00:28:22', '1', '2023-09-28 00:27:42', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1170, 2, '商品劵', '2', 'promotion_product_scope', 0, 'default', '', '营销的商品范围 - 指定商品参与', '1', '2022-11-02 00:28:34', '1', '2023-09-28 00:27:44', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1171, 1, '未使用', '1', 'promotion_coupon_status', 0, 'primary', '', '优惠劵的状态 - 已领取', '1', '2022-11-04 00:15:08', '1', '2023-10-03 12:54:38', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1172, 2, '已使用', '2', 'promotion_coupon_status', 0, 'success', '', '优惠劵的状态 - 已使用', '1', '2022-11-04 00:15:21', '1', '2022-11-04 19:16:08', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1173, 3, '已过期', '3', 'promotion_coupon_status', 0, 'info', '', '优惠劵的状态 - 已过期', '1', '2022-11-04 00:15:43', '1', '2022-11-04 19:16:12', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1174, 1, '直接领取', '1', 'promotion_coupon_take_type', 0, 'primary', '', '优惠劵的领取方式 - 直接领取', '1', '2022-11-04 19:13:00', '1', '2022-11-04 19:13:25', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1175, 2, '指定发放', '2', 'promotion_coupon_take_type', 0, 'success', '', '优惠劵的领取方式 - 指定发放', '1', '2022-11-04 19:13:13', '1', '2022-11-04 19:14:48', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1176, 10, '未开始', '10', 'promotion_activity_status', 0, 'primary', '', '促销活动的状态枚举 - 未开始', '1', '2022-11-04 22:54:49', '1', '2022-11-04 22:55:53', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1177, 20, '进行中', '20', 'promotion_activity_status', 0, 'success', '', '促销活动的状态枚举 - 进行中', '1', '2022-11-04 22:55:06', '1', '2022-11-04 22:55:20', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1178, 30, '已结束', '30', 'promotion_activity_status', 0, 'info', '', '促销活动的状态枚举 - 已结束', '1', '2022-11-04 22:55:41', '1', '2022-11-04 22:55:41', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1179, 40, '已关闭', '40', 'promotion_activity_status', 0, 'warning', '', '促销活动的状态枚举 - 已关闭', '1', '2022-11-04 22:56:10', '1', '2022-11-04 22:56:18', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1180, 10, '满 N 元', '10', 'promotion_condition_type', 0, 'primary', '', '营销的条件类型 - 满 N 元', '1', '2022-11-04 22:59:45', '1', '2022-11-04 22:59:45', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1181, 20, '满 N 件', '20', 'promotion_condition_type', 0, 'success', '', '营销的条件类型 - 满 N 件', '1', '2022-11-04 23:00:02', '1', '2022-11-04 23:00:02', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1182, 10, '申请售后', '10', 'trade_after_sale_status', 0, 'primary', '', '交易售后状态 - 申请售后', '1', '2022-11-19 20:53:33', '1', '2022-11-19 20:54:42', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1183, 20, '商品待退货', '20', 'trade_after_sale_status', 0, 'primary', '', '交易售后状态 - 商品待退货', '1', '2022-11-19 20:54:36', '1', '2022-11-19 20:58:58', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1184, 30, '商家待收货', '30', 'trade_after_sale_status', 0, 'primary', '', '交易售后状态 - 商家待收货', '1', '2022-11-19 20:56:56', '1', '2022-11-19 20:59:20', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1185, 40, '等待退款', '40', 'trade_after_sale_status', 0, 'primary', '', '交易售后状态 - 等待退款', '1', '2022-11-19 20:59:54', '1', '2022-11-19 21:00:01', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1186, 50, '退款成功', '50', 'trade_after_sale_status', 0, 'default', '', '交易售后状态 - 退款成功', '1', '2022-11-19 21:00:33', '1', '2022-11-19 21:00:33', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1187, 61, '买家取消', '61', 'trade_after_sale_status', 0, 'info', '', '交易售后状态 - 买家取消', '1', '2022-11-19 21:01:29', '1', '2022-11-19 21:01:29', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1188, 62, '商家拒绝', '62', 'trade_after_sale_status', 0, 'info', '', '交易售后状态 - 商家拒绝', '1', '2022-11-19 21:02:17', '1', '2022-11-19 21:02:17', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1189, 63, '商家拒收货', '63', 'trade_after_sale_status', 0, 'info', '', '交易售后状态 - 商家拒收货', '1', '2022-11-19 21:02:37', '1', '2022-11-19 21:03:07', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1190, 10, '售中退款', '10', 'trade_after_sale_type', 0, 'success', '', '交易售后的类型 - 售中退款', '1', '2022-11-19 21:05:05', '1', '2022-11-19 21:38:23', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1191, 20, '售后退款', '20', 'trade_after_sale_type', 0, 'primary', '', '交易售后的类型 - 售后退款', '1', '2022-11-19 21:05:32', '1', '2022-11-19 21:38:32', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1192, 10, '仅退款', '10', 'trade_after_sale_way', 0, 'primary', '', '交易售后的方式 - 仅退款', '1', '2022-11-19 21:39:19', '1', '2022-11-19 21:39:19', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1193, 20, '退货退款', '20', 'trade_after_sale_way', 0, 'success', '', '交易售后的方式 - 退货退款', '1', '2022-11-19 21:39:38', '1', '2022-11-19 21:39:49', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1194, 10, '微信小程序', '10', 'terminal', 0, 'default', '', '终端 - 微信小程序', '1', '2022-12-10 10:51:11', '1', '2022-12-10 10:51:57', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1195, 20, 'H5 网页', '20', 'terminal', 0, 'default', '', '终端 - H5 网页', '1', '2022-12-10 10:51:30', '1', '2022-12-10 10:51:59', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1196, 11, '微信公众号', '11', 'terminal', 0, 'default', '', '终端 - 微信公众号', '1', '2022-12-10 10:54:16', '1', '2022-12-10 10:52:01', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1197, 31, '苹果 App', '31', 'terminal', 0, 'default', '', '终端 - 苹果 App', '1', '2022-12-10 10:54:42', '1', '2022-12-10 10:52:18', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1198, 32, '安卓 App', '32', 'terminal', 0, 'default', '', '终端 - 安卓 App', '1', '2022-12-10 10:55:02', '1', '2022-12-10 10:59:17', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1199, 0, '普通订单', '0', 'trade_order_type', 0, 'default', '', '交易订单的类型 - 普通订单', '1', '2022-12-10 16:34:14', '1', '2022-12-10 16:34:14', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1200, 1, '秒杀订单', '1', 'trade_order_type', 0, 'default', '', '交易订单的类型 - 秒杀订单', '1', '2022-12-10 16:34:26', '1', '2022-12-10 16:34:26', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1201, 2, '砍价订单', '2', 'trade_order_type', 0, 'default', '', '交易订单的类型 - 拼团订单', '1', '2022-12-10 16:34:36', '1', '2024-09-07 14:18:39', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1202, 3, '拼团订单', '3', 'trade_order_type', 0, 'default', '', '交易订单的类型 - 砍价订单', '1', '2022-12-10 16:34:48', '1', '2024-09-07 14:18:32', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1203, 0, '待支付', '0', 'trade_order_status', 0, 'default', '', '交易订单状态 - 待支付', '1', '2022-12-10 16:49:29', '1', '2022-12-10 16:49:29', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1204, 10, '待发货', '10', 'trade_order_status', 0, 'primary', '', '交易订单状态 - 待发货', '1', '2022-12-10 16:49:53', '1', '2022-12-10 16:51:17', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1205, 20, '已发货', '20', 'trade_order_status', 0, 'primary', '', '交易订单状态 - 已发货', '1', '2022-12-10 16:50:13', '1', '2022-12-10 16:51:31', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1206, 30, '已完成', '30', 'trade_order_status', 0, 'success', '', '交易订单状态 - 已完成', '1', '2022-12-10 16:50:30', '1', '2022-12-10 16:51:06', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1207, 40, '已取消', '40', 'trade_order_status', 0, 'danger', '', '交易订单状态 - 已取消', '1', '2022-12-10 16:50:50', '1', '2022-12-10 16:51:00', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1208, 0, '未售后', '0', 'trade_order_item_after_sale_status', 0, 'info', '', '交易订单项的售后状态 - 未售后', '1', '2022-12-10 20:58:42', '1', '2022-12-10 20:59:29', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1209, 10, '售后中', '10', 'trade_order_item_after_sale_status', 0, 'primary', '', '交易订单项的售后状态 - 售后中', '1', '2022-12-10 20:59:21', '1', '2024-07-21 17:01:24', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1210, 20, '已退款', '20', 'trade_order_item_after_sale_status', 0, 'success', '', '交易订单项的售后状态 - 已退款', '1', '2022-12-10 20:59:46', '1', '2024-07-21 17:01:35', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1211, 1, '完全匹配', '1', 'mp_auto_reply_request_match', 0, 'primary', '', '公众号自动回复的请求关键字匹配模式 - 完全匹配', '1', '2023-01-16 23:30:39', '1', '2023-01-16 23:31:00', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1212, 2, '半匹配', '2', 'mp_auto_reply_request_match', 0, 'success', '', '公众号自动回复的请求关键字匹配模式 - 半匹配', '1', '2023-01-16 23:30:55', '1', '2023-01-16 23:31:10', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1213, 1, '文本', 'text', 'mp_message_type', 0, 'default', '', '公众号的消息类型 - 文本', '1', '2023-01-17 22:17:32', '1', '2023-01-17 22:17:39', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1214, 2, '图片', 'image', 'mp_message_type', 0, 'default', '', '公众号的消息类型 - 图片', '1', '2023-01-17 22:17:32', '1', '2023-01-17 14:19:47', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1215, 3, '语音', 'voice', 'mp_message_type', 0, 'default', '', '公众号的消息类型 - 语音', '1', '2023-01-17 22:17:32', '1', '2023-01-17 14:20:08', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1216, 4, '视频', 'video', 'mp_message_type', 0, 'default', '', '公众号的消息类型 - 视频', '1', '2023-01-17 22:17:32', '1', '2023-01-17 14:21:08', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1217, 5, '小视频', 'shortvideo', 'mp_message_type', 0, 'default', '', '公众号的消息类型 - 小视频', '1', '2023-01-17 22:17:32', '1', '2023-01-17 14:19:59', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1218, 6, '图文', 'news', 'mp_message_type', 0, 'default', '', '公众号的消息类型 - 图文', '1', '2023-01-17 22:17:32', '1', '2023-01-17 14:22:54', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1219, 7, '音乐', 'music', 'mp_message_type', 0, 'default', '', '公众号的消息类型 - 音乐', '1', '2023-01-17 22:17:32', '1', '2023-01-17 14:22:54', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1220, 8, '地理位置', 'location', 'mp_message_type', 0, 'default', '', '公众号的消息类型 - 地理位置', '1', '2023-01-17 22:17:32', '1', '2023-01-17 14:23:51', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1221, 9, '链接', 'link', 'mp_message_type', 0, 'default', '', '公众号的消息类型 - 链接', '1', '2023-01-17 22:17:32', '1', '2023-01-17 14:24:49', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1222, 10, '事件', 'event', 'mp_message_type', 0, 'default', '', '公众号的消息类型 - 事件', '1', '2023-01-17 22:17:32', '1', '2023-01-17 14:24:49', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1223, 0, '初始化', '0', 'system_mail_send_status', 0, 'primary', '', '邮件发送状态 - 初始化\n', '1', '2023-01-26 09:53:49', '1', '2023-01-26 16:36:14', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1224, 10, '发送成功', '10', 'system_mail_send_status', 0, 'success', '', '邮件发送状态 - 发送成功', '1', '2023-01-26 09:54:28', '1', '2023-01-26 16:36:22', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1225, 20, '发送失败', '20', 'system_mail_send_status', 0, 'danger', '', '邮件发送状态 - 发送失败', '1', '2023-01-26 09:54:50', '1', '2023-01-26 16:36:26', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1226, 30, '不发送', '30', 'system_mail_send_status', 0, 'info', '', '邮件发送状态 - 不发送', '1', '2023-01-26 09:55:06', '1', '2023-01-26 16:36:36', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1227, 1, '通知公告', '1', 'system_notify_template_type', 0, 'primary', '', '站内信模版的类型 - 通知公告', '1', '2023-01-28 10:35:59', '1', '2023-01-28 10:35:59', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1228, 2, '系统消息', '2', 'system_notify_template_type', 0, 'success', '', '站内信模版的类型 - 系统消息', '1', '2023-01-28 10:36:20', '1', '2023-01-28 10:36:25', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1230, 13, '支付宝条码支付', 'alipay_bar', 'pay_channel_code', 0, 'primary', '', '支付宝条码支付', '1', '2023-02-18 23:32:24', '1', '2023-07-19 20:09:23', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1231, 10, 'Vue2 Element UI 标准模版', '10', 'infra_codegen_front_type', 0, '', '', '', '1', '2023-04-13 00:03:55', '1', '2023-04-13 00:03:55', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1232, 20, 'Vue3 Element Plus 标准模版', '20', 'infra_codegen_front_type', 0, '', '', '', '1', '2023-04-13 00:04:08', '1', '2023-04-13 00:04:08', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1234, 30, 'Vue3 vben 模版', '30', 'infra_codegen_front_type', 0, '', '', '', '1', '2023-04-13 00:04:26', '1', '2023-04-13 00:04:26', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1244, 0, '按件', '1', 'trade_delivery_express_charge_mode', 0, '', '', '', '1', '2023-05-21 22:46:40', '1', '2023-05-21 22:46:40', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1245, 1, '按重量', '2', 'trade_delivery_express_charge_mode', 0, '', '', '', '1', '2023-05-21 22:46:58', '1', '2023-05-21 22:46:58', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1246, 2, '按体积', '3', 'trade_delivery_express_charge_mode', 0, '', '', '', '1', '2023-05-21 22:47:18', '1', '2023-05-21 22:47:18', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1335, 11, '订单积分抵扣', '11', 'member_point_biz_type', 0, '', '', '', '1', '2023-06-10 12:15:27', '1', '2023-10-11 07:41:43', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1336, 1, '签到', '1', 'member_point_biz_type', 0, '', '', '', '1', '2023-06-10 12:15:48', '1', '2023-08-20 11:59:53', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1341, 20, '已退款', '20', 'pay_order_status', 0, 'danger', '', '已退款', '1', '2023-07-19 18:05:37', '1', '2023-07-19 18:05:37', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1342, 21, '请求成功,但是结果失败', '21', 'pay_notify_status', 0, 'warning', '', '请求成功,但是结果失败', '1', '2023-07-19 18:10:47', '1', '2023-07-19 18:11:38', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1343, 22, '请求失败', '22', 'pay_notify_status', 0, 'warning', '', NULL, '1', '2023-07-19 18:11:05', '1', '2023-07-19 18:11:27', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1344, 4, '微信扫码支付', 'wx_native', 'pay_channel_code', 0, 'success', '', '微信扫码支付', '1', '2023-07-19 20:07:47', '1', '2023-07-19 20:09:03', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1345, 5, '微信条码支付', 'wx_bar', 'pay_channel_code', 0, 'success', '', '微信条码支付\n', '1', '2023-07-19 20:08:06', '1', '2023-07-19 20:09:08', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1346, 1, '支付单', '1', 'pay_notify_type', 0, 'primary', '', '支付单', '1', '2023-07-20 12:23:17', '1', '2023-07-20 12:23:17', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1347, 2, '退款单', '2', 'pay_notify_type', 0, 'danger', '', NULL, '1', '2023-07-20 12:23:26', '1', '2023-07-20 12:23:26', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1348, 20, '模拟支付', 'mock', 'pay_channel_code', 0, 'default', '', '模拟支付', '1', '2023-07-29 11:10:51', '1', '2023-07-29 03:14:10', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1349, 12, '订单积分抵扣(整单取消)', '12', 'member_point_biz_type', 0, '', '', '', '1', '2023-08-20 12:00:03', '1', '2023-10-11 07:42:01', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1350, 0, '管理员调整', '0', 'member_experience_biz_type', 0, '', '', NULL, '', '2023-08-22 12:41:01', '', '2023-08-22 12:41:01', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1351, 1, '邀新奖励', '1', 'member_experience_biz_type', 0, '', '', NULL, '', '2023-08-22 12:41:01', '', '2023-08-22 12:41:01', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1352, 11, '下单奖励', '11', 'member_experience_biz_type', 0, 'success', '', NULL, '', '2023-08-22 12:41:01', '1', '2023-10-11 07:45:09', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1353, 12, '下单奖励(整单取消)', '12', 'member_experience_biz_type', 0, 'warning', '', NULL, '', '2023-08-22 12:41:01', '1', '2023-10-11 07:45:01', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1354, 4, '签到奖励', '4', 'member_experience_biz_type', 0, '', '', NULL, '', '2023-08-22 12:41:01', '', '2023-08-22 12:41:01', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1355, 5, '抽奖奖励', '5', 'member_experience_biz_type', 0, '', '', NULL, '', '2023-08-22 12:41:01', '', '2023-08-22 12:41:01', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1356, 1, '快递发货', '1', 'trade_delivery_type', 0, '', '', '', '1', '2023-08-23 00:04:55', '1', '2023-08-23 00:04:55', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1357, 2, '用户自提', '2', 'trade_delivery_type', 0, '', '', '', '1', '2023-08-23 00:05:05', '1', '2023-08-23 00:05:05', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1358, 3, '品类劵', '3', 'promotion_product_scope', 0, 'default', '', '', '1', '2023-09-01 23:43:07', '1', '2023-09-28 00:27:47', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1359, 1, '人人分销', '1', 'brokerage_enabled_condition', 0, '', '', '所有用户都可以分销', '', '2023-09-28 02:46:05', '', '2023-09-28 02:46:05', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1360, 2, '指定分销', '2', 'brokerage_enabled_condition', 0, '', '', '仅可后台手动设置推广员', '', '2023-09-28 02:46:05', '', '2023-09-28 02:46:05', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1361, 1, '首次绑定', '1', 'brokerage_bind_mode', 0, '', '', '只要用户没有推广人,随时都可以绑定推广关系', '', '2023-09-28 02:46:05', '', '2023-09-28 02:46:05', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1362, 2, '注册绑定', '2', 'brokerage_bind_mode', 0, '', '', '仅新用户注册时才能绑定推广关系', '', '2023-09-28 02:46:05', '', '2023-09-28 02:46:05', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1363, 3, '覆盖绑定', '3', 'brokerage_bind_mode', 0, '', '', '如果用户已经有推广人,推广人会被变更', '', '2023-09-28 02:46:05', '', '2023-09-28 02:46:05', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1364, 1, '钱包', '1', 'brokerage_withdraw_type', 0, '', '', NULL, '', '2023-09-28 02:46:05', '', '2023-09-28 02:46:05', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1365, 2, '银行卡', '2', 'brokerage_withdraw_type', 0, '', '', NULL, '', '2023-09-28 02:46:05', '', '2023-09-28 02:46:05', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1366, 3, '微信', '3', 'brokerage_withdraw_type', 0, '', '', '手动打款', '', '2023-09-28 02:46:05', '1', '2024-10-13 11:06:54', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1367, 4, '支付宝', '4', 'brokerage_withdraw_type', 0, '', '', NULL, '', '2023-09-28 02:46:05', '', '2023-09-28 02:46:05', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1368, 1, '订单返佣', '1', 'brokerage_record_biz_type', 0, '', '', NULL, '', '2023-09-28 02:46:05', '', '2023-09-28 02:46:05', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1369, 2, '申请提现', '2', 'brokerage_record_biz_type', 0, '', '', NULL, '', '2023-09-28 02:46:05', '', '2023-09-28 02:46:05', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1370, 3, '申请提现驳回', '3', 'brokerage_record_biz_type', 0, '', '', NULL, '', '2023-09-28 02:46:05', '', '2023-09-28 02:46:05', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1371, 0, '待结算', '0', 'brokerage_record_status', 0, '', '', NULL, '', '2023-09-28 02:46:05', '', '2023-09-28 02:46:05', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1372, 1, '已结算', '1', 'brokerage_record_status', 0, '', '', NULL, '', '2023-09-28 02:46:05', '', '2023-09-28 02:46:05', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1373, 2, '已取消', '2', 'brokerage_record_status', 0, '', '', NULL, '', '2023-09-28 02:46:05', '', '2023-09-28 02:46:05', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1374, 0, '审核中', '0', 'brokerage_withdraw_status', 0, '', '', NULL, '', '2023-09-28 02:46:05', '', '2023-09-28 02:46:05', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1375, 10, '审核通过', '10', 'brokerage_withdraw_status', 0, 'success', '', NULL, '', '2023-09-28 02:46:05', '', '2023-09-28 02:46:05', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1376, 11, '提现成功', '11', 'brokerage_withdraw_status', 0, 'success', '', NULL, '', '2023-09-28 02:46:05', '', '2023-09-28 02:46:05', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1377, 20, '审核不通过', '20', 'brokerage_withdraw_status', 0, 'danger', '', NULL, '', '2023-09-28 02:46:05', '', '2023-09-28 02:46:05', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1378, 21, '提现失败', '21', 'brokerage_withdraw_status', 0, 'danger', '', NULL, '', '2023-09-28 02:46:05', '', '2023-09-28 02:46:05', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1379, 0, '工商银行', '0', 'brokerage_bank_name', 0, '', '', NULL, '', '2023-09-28 02:46:05', '', '2023-09-28 02:46:05', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1380, 1, '建设银行', '1', 'brokerage_bank_name', 0, '', '', NULL, '', '2023-09-28 02:46:05', '', '2023-09-28 02:46:05', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1381, 2, '农业银行', '2', 'brokerage_bank_name', 0, '', '', NULL, '', '2023-09-28 02:46:05', '', '2023-09-28 02:46:05', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1382, 3, '中国银行', '3', 'brokerage_bank_name', 0, '', '', NULL, '', '2023-09-28 02:46:05', '', '2023-09-28 02:46:05', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1383, 4, '交通银行', '4', 'brokerage_bank_name', 0, '', '', NULL, '', '2023-09-28 02:46:05', '', '2023-09-28 02:46:05', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1384, 5, '招商银行', '5', 'brokerage_bank_name', 0, '', '', NULL, '', '2023-09-28 02:46:05', '', '2023-09-28 02:46:05', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1385, 21, '钱包', 'wallet', 'pay_channel_code', 0, 'primary', '', '', '1', '2023-10-01 21:46:19', '1', '2023-10-01 21:48:01', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1386, 1, '砍价中', '1', 'promotion_bargain_record_status', 0, 'default', '', '', '1', '2023-10-05 10:41:26', '1', '2023-10-05 10:41:26', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1387, 2, '砍价成功', '2', 'promotion_bargain_record_status', 0, 'success', '', '', '1', '2023-10-05 10:41:39', '1', '2023-10-05 10:41:39', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1388, 3, '砍价失败', '3', 'promotion_bargain_record_status', 0, 'warning', '', '', '1', '2023-10-05 10:41:57', '1', '2023-10-05 10:41:57', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1389, 0, '拼团中', '0', 'promotion_combination_record_status', 0, '', '', '', '1', '2023-10-08 07:24:44', '1', '2024-10-13 10:08:17', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1390, 1, '拼团成功', '1', 'promotion_combination_record_status', 0, 'success', '', '', '1', '2023-10-08 07:24:56', '1', '2024-10-13 10:08:20', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1391, 2, '拼团失败', '2', 'promotion_combination_record_status', 0, 'warning', '', '', '1', '2023-10-08 07:25:11', '1', '2024-10-13 10:08:24', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1392, 2, '管理员修改', '2', 'member_point_biz_type', 0, 'default', '', '', '1', '2023-10-11 07:41:34', '1', '2023-10-11 07:41:34', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1393, 13, '订单积分抵扣(单个退款)', '13', 'member_point_biz_type', 0, '', '', '', '1', '2023-10-11 07:42:29', '1', '2023-10-11 07:42:29', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1394, 21, '订单积分奖励', '21', 'member_point_biz_type', 0, 'default', '', '', '1', '2023-10-11 07:42:44', '1', '2023-10-11 07:42:44', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1395, 22, '订单积分奖励(整单取消)', '22', 'member_point_biz_type', 0, 'default', '', '', '1', '2023-10-11 07:42:55', '1', '2023-10-11 07:43:01', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1396, 23, '订单积分奖励(单个退款)', '23', 'member_point_biz_type', 0, 'default', '', '', '1', '2023-10-11 07:43:16', '1', '2023-10-11 07:43:16', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1397, 13, '下单奖励(单个退款)', '13', 'member_experience_biz_type', 0, 'warning', '', '', '1', '2023-10-11 07:45:24', '1', '2023-10-11 07:45:38', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1398, 5, '网上转账', '5', 'crm_receivable_return_type', 0, 'default', '', '', '1', '2023-10-18 21:55:24', '1', '2023-10-18 21:55:24', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1399, 6, '支付宝', '6', 'crm_receivable_return_type', 0, 'default', '', '', '1', '2023-10-18 21:55:38', '1', '2023-10-18 21:55:38', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1400, 7, '微信支付', '7', 'crm_receivable_return_type', 0, 'default', '', '', '1', '2023-10-18 21:55:53', '1', '2023-10-18 21:55:53', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1401, 8, '其他', '8', 'crm_receivable_return_type', 0, 'default', '', '', '1', '2023-10-18 21:56:06', '1', '2023-10-18 21:56:06', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1402, 1, 'IT', '1', 'crm_customer_industry', 0, 'default', '', '', '1', '2023-10-28 23:02:15', '1', '2024-02-18 23:30:38', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1403, 2, '金融业', '2', 'crm_customer_industry', 0, 'default', '', '', '1', '2023-10-28 23:02:29', '1', '2024-02-18 23:30:43', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1404, 3, '房地产', '3', 'crm_customer_industry', 0, 'default', '', '', '1', '2023-10-28 23:02:41', '1', '2024-02-18 23:30:48', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1405, 4, '商业服务', '4', 'crm_customer_industry', 0, 'default', '', '', '1', '2023-10-28 23:02:54', '1', '2024-02-18 23:30:54', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1406, 5, '运输/物流', '5', 'crm_customer_industry', 0, 'default', '', '', '1', '2023-10-28 23:03:03', '1', '2024-02-18 23:31:00', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1407, 6, '生产', '6', 'crm_customer_industry', 0, 'default', '', '', '1', '2023-10-28 23:03:13', '1', '2024-02-18 23:31:08', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1408, 7, '政府', '7', 'crm_customer_industry', 0, 'default', '', '', '1', '2023-10-28 23:03:27', '1', '2024-02-18 23:31:13', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1409, 8, '文化传媒', '8', 'crm_customer_industry', 0, 'default', '', '', '1', '2023-10-28 23:03:37', '1', '2024-02-18 23:31:20', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1422, 1, 'A (重点客户)', '1', 'crm_customer_level', 0, 'primary', '', '', '1', '2023-10-28 23:07:13', '1', '2023-10-28 23:07:13', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1423, 2, 'B (普通客户)', '2', 'crm_customer_level', 0, 'info', '', '', '1', '2023-10-28 23:07:35', '1', '2023-10-28 23:07:35', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1424, 3, 'C (非优先客户)', '3', 'crm_customer_level', 0, 'default', '', '', '1', '2023-10-28 23:07:53', '1', '2023-10-28 23:07:53', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1425, 1, '促销', '1', 'crm_customer_source', 0, 'default', '', '', '1', '2023-10-28 23:08:29', '1', '2023-10-28 23:08:29', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1426, 2, '搜索引擎', '2', 'crm_customer_source', 0, 'default', '', '', '1', '2023-10-28 23:08:39', '1', '2023-10-28 23:08:39', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1427, 3, '广告', '3', 'crm_customer_source', 0, 'default', '', '', '1', '2023-10-28 23:08:47', '1', '2023-10-28 23:08:47', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1428, 4, '转介绍', '4', 'crm_customer_source', 0, 'default', '', '', '1', '2023-10-28 23:08:58', '1', '2023-10-28 23:08:58', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1429, 5, '线上注册', '5', 'crm_customer_source', 0, 'default', '', '', '1', '2023-10-28 23:09:12', '1', '2023-10-28 23:09:12', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1430, 6, '线上咨询', '6', 'crm_customer_source', 0, 'default', '', '', '1', '2023-10-28 23:09:22', '1', '2023-10-28 23:09:22', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1431, 7, '预约上门', '7', 'crm_customer_source', 0, 'default', '', '', '1', '2023-10-28 23:09:39', '1', '2023-10-28 23:09:39', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1432, 8, '陌拜', '8', 'crm_customer_source', 0, 'default', '', '', '1', '2023-10-28 23:10:04', '1', '2023-10-28 23:10:04', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1433, 9, '电话咨询', '9', 'crm_customer_source', 0, 'default', '', '', '1', '2023-10-28 23:10:18', '1', '2023-10-28 23:10:18', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1434, 10, '邮件咨询', '10', 'crm_customer_source', 0, 'default', '', '', '1', '2023-10-28 23:10:33', '1', '2023-10-28 23:10:33', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1435, 10, 'Gitee', '10', 'system_social_type', 0, '', '', '', '1', '2023-11-04 13:04:42', '1', '2023-11-04 13:04:42', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1436, 20, '钉钉', '20', 'system_social_type', 0, '', '', '', '1', '2023-11-04 13:04:54', '1', '2023-11-04 13:04:54', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1437, 30, '企业微信', '30', 'system_social_type', 0, '', '', '', '1', '2023-11-04 13:05:09', '1', '2023-11-04 13:05:09', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1438, 31, '微信公众平台', '31', 'system_social_type', 0, '', '', '', '1', '2023-11-04 13:05:18', '1', '2023-11-04 13:05:18', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1439, 32, '微信开放平台', '32', 'system_social_type', 0, '', '', '', '1', '2023-11-04 13:05:30', '1', '2023-11-04 13:05:30', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1440, 34, '微信小程序', '34', 'system_social_type', 0, '', '', '', '1', '2023-11-04 13:05:38', '1', '2023-11-04 13:07:16', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1441, 1, '上架', '1', 'crm_product_status', 0, 'success', '', '', '1', '2023-10-30 21:49:34', '1', '2023-10-30 21:49:34', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1442, 0, '下架', '0', 'crm_product_status', 0, 'success', '', '', '1', '2023-10-30 21:49:13', '1', '2023-10-30 21:49:13', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1443, 15, '子表', '15', 'infra_codegen_template_type', 0, 'default', '', '', '1', '2023-11-13 23:06:16', '1', '2023-11-13 23:06:16', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1444, 10, '主表(标准模式)', '10', 'infra_codegen_template_type', 0, 'default', '', '', '1', '2023-11-14 12:32:49', '1', '2023-11-14 12:32:49', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1445, 11, '主表(ERP 模式)', '11', 'infra_codegen_template_type', 0, 'default', '', '', '1', '2023-11-14 12:33:05', '1', '2023-11-14 12:33:05', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1446, 12, '主表(内嵌模式)', '12', 'infra_codegen_template_type', 0, '', '', '', '1', '2023-11-14 12:33:31', '1', '2023-11-14 12:33:31', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1447, 1, '负责人', '1', 'crm_permission_level', 0, 'default', '', '', '1', '2023-11-30 09:53:12', '1', '2023-11-30 09:53:12', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1448, 2, '只读', '2', 'crm_permission_level', 0, '', '', '', '1', '2023-11-30 09:53:29', '1', '2023-11-30 09:53:29', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1449, 3, '读写', '3', 'crm_permission_level', 0, '', '', '', '1', '2023-11-30 09:53:36', '1', '2023-11-30 09:53:36', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1450, 0, '未提交', '0', 'crm_audit_status', 0, '', '', '', '1', '2023-11-30 18:56:59', '1', '2023-11-30 18:56:59', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1451, 10, '审批中', '10', 'crm_audit_status', 0, '', '', '', '1', '2023-11-30 18:57:10', '1', '2023-11-30 18:57:10', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1452, 20, '审核通过', '20', 'crm_audit_status', 0, '', '', '', '1', '2023-11-30 18:57:24', '1', '2023-11-30 18:57:24', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1453, 30, '审核不通过', '30', 'crm_audit_status', 0, '', '', '', '1', '2023-11-30 18:57:32', '1', '2023-11-30 18:57:32', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1454, 40, '已取消', '40', 'crm_audit_status', 0, '', '', '', '1', '2023-11-30 18:57:42', '1', '2023-11-30 18:57:42', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1456, 1, '支票', '1', 'crm_receivable_return_type', 0, 'default', '', '', '1', '2023-10-18 21:54:29', '1', '2023-10-18 21:54:29', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1457, 2, '现金', '2', 'crm_receivable_return_type', 0, 'default', '', '', '1', '2023-10-18 21:54:41', '1', '2023-10-18 21:54:41', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1458, 3, '邮政汇款', '3', 'crm_receivable_return_type', 0, 'default', '', '', '1', '2023-10-18 21:54:53', '1', '2023-10-18 21:54:53', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1459, 4, '电汇', '4', 'crm_receivable_return_type', 0, 'default', '', '', '1', '2023-10-18 21:55:07', '1', '2023-10-18 21:55:07', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1461, 1, '个', '1', 'crm_product_unit', 0, '', '', '', '1', '2023-12-05 23:02:26', '1', '2023-12-05 23:02:26', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1462, 2, '块', '2', 'crm_product_unit', 0, '', '', '', '1', '2023-12-05 23:02:34', '1', '2023-12-05 23:02:34', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1463, 3, '只', '3', 'crm_product_unit', 0, '', '', '', '1', '2023-12-05 23:02:57', '1', '2023-12-05 23:02:57', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1464, 4, '把', '4', 'crm_product_unit', 0, '', '', '', '1', '2023-12-05 23:03:05', '1', '2023-12-05 23:03:05', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1465, 5, '枚', '5', 'crm_product_unit', 0, '', '', '', '1', '2023-12-05 23:03:14', '1', '2023-12-05 23:03:14', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1466, 6, '瓶', '6', 'crm_product_unit', 0, '', '', '', '1', '2023-12-05 23:03:20', '1', '2023-12-05 23:03:20', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1467, 7, '盒', '7', 'crm_product_unit', 0, '', '', '', '1', '2023-12-05 23:03:30', '1', '2023-12-05 23:03:30', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1468, 8, '台', '8', 'crm_product_unit', 0, '', '', '', '1', '2023-12-05 23:03:41', '1', '2023-12-05 23:03:41', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1469, 9, '吨', '9', 'crm_product_unit', 0, '', '', '', '1', '2023-12-05 23:03:48', '1', '2023-12-05 23:03:48', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1470, 10, '千克', '10', 'crm_product_unit', 0, '', '', '', '1', '2023-12-05 23:04:03', '1', '2023-12-05 23:04:03', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1471, 11, '米', '11', 'crm_product_unit', 0, '', '', '', '1', '2023-12-05 23:04:12', '1', '2023-12-05 23:04:12', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1472, 12, '箱', '12', 'crm_product_unit', 0, '', '', '', '1', '2023-12-05 23:04:25', '1', '2023-12-05 23:04:25', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1473, 13, '套', '13', 'crm_product_unit', 0, '', '', '', '1', '2023-12-05 23:04:34', '1', '2023-12-05 23:04:34', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1474, 1, '打电话', '1', 'crm_follow_up_type', 0, '', '', '', '1', '2024-01-15 20:48:20', '1', '2024-01-15 20:48:20', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1475, 2, '发短信', '2', 'crm_follow_up_type', 0, '', '', '', '1', '2024-01-15 20:48:31', '1', '2024-01-15 20:48:31', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1476, 3, '上门拜访', '3', 'crm_follow_up_type', 0, '', '', '', '1', '2024-01-15 20:49:07', '1', '2024-01-15 20:49:07', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1477, 4, '微信沟通', '4', 'crm_follow_up_type', 0, '', '', '', '1', '2024-01-15 20:49:15', '1', '2024-01-15 20:49:15', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1478, 4, '钱包余额', '4', 'pay_transfer_type', 0, 'info', '', '', '1', '2023-10-28 16:28:37', '1', '2023-10-28 16:28:37', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1479, 3, '银行卡', '3', 'pay_transfer_type', 0, 'default', '', '', '1', '2023-10-28 16:28:21', '1', '2023-10-28 16:28:21', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1480, 2, '微信余额', '2', 'pay_transfer_type', 0, 'info', '', '', '1', '2023-10-28 16:28:07', '1', '2023-10-28 16:28:07', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1481, 1, '支付宝余额', '1', 'pay_transfer_type', 0, 'default', '', '', '1', '2023-10-28 16:27:44', '1', '2023-10-28 16:27:44', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1482, 4, '转账失败', '30', 'pay_transfer_status', 0, 'warning', '', '', '1', '2023-10-28 16:24:16', '1', '2023-10-28 16:24:16', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1483, 3, '转账成功', '20', 'pay_transfer_status', 0, 'success', '', '', '1', '2023-10-28 16:23:50', '1', '2023-10-28 16:23:50', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1484, 2, '转账进行中', '10', 'pay_transfer_status', 0, 'info', '', '', '1', '2023-10-28 16:23:12', '1', '2023-10-28 16:23:12', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1485, 1, '等待转账', '0', 'pay_transfer_status', 0, 'default', '', '', '1', '2023-10-28 16:21:43', '1', '2023-10-28 16:23:22', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1486, 10, '其它入库', '10', 'erp_stock_record_biz_type', 0, '', '', '', '1', '2024-02-05 18:07:25', '1', '2024-02-05 18:07:43', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1487, 11, '其它入库(作废)', '11', 'erp_stock_record_biz_type', 0, 'danger', '', '', '1', '2024-02-05 18:08:07', '1', '2024-02-05 19:20:16', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1488, 20, '其它出库', '20', 'erp_stock_record_biz_type', 0, '', '', '', '1', '2024-02-05 18:08:51', '1', '2024-02-05 18:08:51', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1489, 21, '其它出库(作废)', '21', 'erp_stock_record_biz_type', 0, 'danger', '', '', '1', '2024-02-05 18:09:00', '1', '2024-02-05 19:20:10', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1490, 10, '未审核', '10', 'erp_audit_status', 0, 'default', '', '', '1', '2024-02-06 00:00:21', '1', '2024-02-06 00:00:21', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1491, 20, '已审核', '20', 'erp_audit_status', 0, 'success', '', '', '1', '2024-02-06 00:00:35', '1', '2024-02-06 00:00:35', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1492, 30, '调拨入库', '30', 'erp_stock_record_biz_type', 0, '', '', '', '1', '2024-02-07 20:34:19', '1', '2024-02-07 12:36:31', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1493, 31, '调拨入库(作废)', '31', 'erp_stock_record_biz_type', 0, 'danger', '', '', '1', '2024-02-07 20:34:29', '1', '2024-02-07 20:37:11', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1494, 32, '调拨出库', '32', 'erp_stock_record_biz_type', 0, '', '', '', '1', '2024-02-07 20:34:38', '1', '2024-02-07 12:36:33', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1495, 33, '调拨出库(作废)', '33', 'erp_stock_record_biz_type', 0, 'danger', '', '', '1', '2024-02-07 20:34:49', '1', '2024-02-07 20:37:06', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1496, 40, '盘盈入库', '40', 'erp_stock_record_biz_type', 0, '', '', '', '1', '2024-02-08 08:53:00', '1', '2024-02-08 08:53:09', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1497, 41, '盘盈入库(作废)', '41', 'erp_stock_record_biz_type', 0, 'danger', '', '', '1', '2024-02-08 08:53:39', '1', '2024-02-16 19:40:54', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1498, 42, '盘亏出库', '42', 'erp_stock_record_biz_type', 0, '', '', '', '1', '2024-02-08 08:54:16', '1', '2024-02-08 08:54:16', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1499, 43, '盘亏出库(作废)', '43', 'erp_stock_record_biz_type', 0, 'danger', '', '', '1', '2024-02-08 08:54:31', '1', '2024-02-16 19:40:46', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1500, 50, '销售出库', '50', 'erp_stock_record_biz_type', 0, '', '', '', '1', '2024-02-11 21:47:25', '1', '2024-02-11 21:50:40', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1501, 51, '销售出库(作废)', '51', 'erp_stock_record_biz_type', 0, 'danger', '', '', '1', '2024-02-11 21:47:37', '1', '2024-02-11 21:51:12', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1502, 60, '销售退货入库', '60', 'erp_stock_record_biz_type', 0, '', '', '', '1', '2024-02-12 06:51:05', '1', '2024-02-12 06:51:05', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1503, 61, '销售退货入库(作废)', '61', 'erp_stock_record_biz_type', 0, 'danger', '', '', '1', '2024-02-12 06:51:18', '1', '2024-02-12 06:51:18', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1504, 70, '采购入库', '70', 'erp_stock_record_biz_type', 0, '', '', '', '1', '2024-02-16 13:10:02', '1', '2024-02-16 13:10:02', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1505, 71, '采购入库(作废)', '71', 'erp_stock_record_biz_type', 0, 'danger', '', '', '1', '2024-02-16 13:10:10', '1', '2024-02-16 19:40:40', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1506, 80, '采购退货出库', '80', 'erp_stock_record_biz_type', 0, '', '', '', '1', '2024-02-16 13:10:17', '1', '2024-02-16 13:10:17', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1507, 81, '采购退货出库(作废)', '81', 'erp_stock_record_biz_type', 0, 'danger', '', '', '1', '2024-02-16 13:10:26', '1', '2024-02-16 19:40:33', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1509, 3, '审批不通过', '3', 'bpm_process_instance_status', 0, 'danger', '', '', '1', '2024-03-16 16:12:06', '1', '2024-03-16 16:12:06', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1510, 4, '已取消', '4', 'bpm_process_instance_status', 0, 'warning', '', '', '1', '2024-03-16 16:12:22', '1', '2024-03-16 16:12:22', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1511, 5, '已退回', '5', 'bpm_task_status', 0, 'warning', '', '', '1', '2024-03-16 19:10:46', '1', '2024-03-08 22:41:40', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1512, 6, '委派中', '6', 'bpm_task_status', 0, 'primary', '', '', '1', '2024-03-17 10:06:22', '1', '2024-03-08 22:41:40', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1513, 7, '审批通过中', '7', 'bpm_task_status', 0, 'success', '', '', '1', '2024-03-17 10:06:47', '1', '2024-03-08 22:41:41', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1514, 0, '待审批', '0', 'bpm_task_status', 0, 'info', '', '', '1', '2024-03-17 10:07:11', '1', '2024-03-08 22:41:42', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1515, 35, '发起人自选', '35', 'bpm_task_candidate_strategy', 0, '', '', '', '1', '2024-03-22 19:45:16', '1', '2024-03-22 19:45:16', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1516, 1, '执行监听器', 'execution', 'bpm_process_listener_type', 0, 'primary', '', '', '1', '2024-03-23 12:54:03', '1', '2024-03-23 19:14:19', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1517, 1, '任务监听器', 'task', 'bpm_process_listener_type', 0, 'success', '', '', '1', '2024-03-23 12:54:13', '1', '2024-03-23 19:14:24', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1526, 1, 'Java 类', 'class', 'bpm_process_listener_value_type', 0, 'primary', '', '', '1', '2024-03-23 15:08:45', '1', '2024-03-23 19:14:32', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1527, 2, '表达式', 'expression', 'bpm_process_listener_value_type', 0, 'success', '', '', '1', '2024-03-23 15:09:06', '1', '2024-03-23 19:14:38', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1528, 3, '代理表达式', 'delegateExpression', 'bpm_process_listener_value_type', 0, 'info', '', '', '1', '2024-03-23 15:11:23', '1', '2024-03-23 19:14:41', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1529, 1, '天', '1', 'date_interval', 0, '', '', '', '1', '2024-03-29 22:50:26', '1', '2024-03-29 22:50:26', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1530, 2, '周', '2', 'date_interval', 0, '', '', '', '1', '2024-03-29 22:50:36', '1', '2024-03-29 22:50:36', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1531, 3, '月', '3', 'date_interval', 0, '', '', '', '1', '2024-03-29 22:50:46', '1', '2024-03-29 22:50:54', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1532, 4, '季度', '4', 'date_interval', 0, '', '', '', '1', '2024-03-29 22:51:01', '1', '2024-03-29 22:51:01', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1533, 5, '年', '5', 'date_interval', 0, '', '', '', '1', '2024-03-29 22:51:07', '1', '2024-03-29 22:51:07', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1534, 1, '赢单', '1', 'crm_business_end_status_type', 0, 'success', '', '', '1', '2024-04-13 23:26:57', '1', '2024-04-13 23:26:57', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1535, 2, '输单', '2', 'crm_business_end_status_type', 0, 'primary', '', '', '1', '2024-04-13 23:27:31', '1', '2024-04-13 23:27:31', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1536, 3, '无效', '3', 'crm_business_end_status_type', 0, 'info', '', '', '1', '2024-04-13 23:27:59', '1', '2024-04-13 23:27:59', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1537, 1, 'OpenAI', 'OpenAI', 'ai_platform', 0, '', '', '', '1', '2024-05-09 22:33:47', '1', '2024-05-09 22:58:46', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1538, 2, 'Ollama', 'Ollama', 'ai_platform', 0, '', '', '', '1', '2024-05-17 23:02:55', '1', '2024-05-17 23:02:55', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1539, 3, '文心一言', 'YiYan', 'ai_platform', 0, '', '', '', '1', '2024-05-18 09:24:20', '1', '2024-05-18 09:29:01', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1540, 4, '讯飞星火', 'XingHuo', 'ai_platform', 0, '', '', '', '1', '2024-05-18 10:08:56', '1', '2024-05-18 10:08:56', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1541, 5, '通义千问', 'TongYi', 'ai_platform', 0, '', '', '', '1', '2024-05-18 10:32:29', '1', '2024-07-06 15:42:29', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1542, 6, 'StableDiffusion', 'StableDiffusion', 'ai_platform', 0, '', '', '', '1', '2024-06-01 15:09:31', '1', '2024-06-01 15:10:25', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1543, 10, '进行中', '10', 'ai_image_status', 0, 'primary', '', '', '1', '2024-06-26 20:51:41', '1', '2024-06-26 20:52:48', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1544, 20, '已完成', '20', 'ai_image_status', 0, 'success', '', '', '1', '2024-06-26 20:52:07', '1', '2024-06-26 20:52:41', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1545, 30, '已失败', '30', 'ai_image_status', 0, 'warning', '', '', '1', '2024-06-26 20:52:25', '1', '2024-06-26 20:52:35', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1546, 7, 'Midjourney', 'Midjourney', 'ai_platform', 0, '', '', '', '1', '2024-06-26 22:14:46', '1', '2024-06-26 22:14:46', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1547, 10, '进行中', '10', 'ai_music_status', 0, 'primary', '', '', '1', '2024-06-27 22:45:22', '1', '2024-06-28 00:56:17', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1548, 20, '已完成', '20', 'ai_music_status', 0, 'success', '', '', '1', '2024-06-27 22:45:33', '1', '2024-06-28 00:56:18', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1549, 30, '已失败', '30', 'ai_music_status', 0, 'danger', '', '', '1', '2024-06-27 22:45:44', '1', '2024-06-28 00:56:19', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1550, 1, '歌词模式', '1', 'ai_generate_mode', 0, '', '', '', '1', '2024-06-27 22:46:31', '1', '2024-06-28 01:22:25', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1551, 2, '描述模式', '2', 'ai_generate_mode', 0, '', '', '', '1', '2024-06-27 22:46:37', '1', '2024-06-28 01:22:24', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1552, 8, 'Suno', 'Suno', 'ai_platform', 0, '', '', '', '1', '2024-06-29 09:13:36', '1', '2024-06-29 09:13:41', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1553, 9, 'DeepSeek', 'DeepSeek', 'ai_platform', 0, '', '', '', '1', '2024-07-06 12:04:30', '1', '2024-07-06 12:05:20', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1554, 13, '智谱', 'ZhiPu', 'ai_platform', 0, '', '', '', '1', '2024-07-06 18:00:35', '1', '2025-02-24 20:18:41', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1555, 4, '长', '4', 'ai_write_length', 0, '', '', '', '1', '2024-07-07 15:49:03', '1', '2024-07-07 15:49:03', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1556, 5, '段落', '5', 'ai_write_format', 0, '', '', '', '1', '2024-07-07 15:49:54', '1', '2024-07-07 15:49:54', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1557, 6, '文章', '6', 'ai_write_format', 0, '', '', '', '1', '2024-07-07 15:50:05', '1', '2024-07-07 15:50:05', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1558, 7, '博客文章', '7', 'ai_write_format', 0, '', '', '', '1', '2024-07-07 15:50:23', '1', '2024-07-07 15:50:23', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1559, 8, '想法', '8', 'ai_write_format', 0, '', '', '', '1', '2024-07-07 15:50:31', '1', '2024-07-07 15:50:31', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1560, 9, '大纲', '9', 'ai_write_format', 0, '', '', '', '1', '2024-07-07 15:50:37', '1', '2024-07-07 15:50:37', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1561, 1, '自动', '1', 'ai_write_tone', 0, '', '', '', '1', '2024-07-07 15:51:06', '1', '2024-07-07 15:51:06', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1562, 2, '友善', '2', 'ai_write_tone', 0, '', '', '', '1', '2024-07-07 15:51:19', '1', '2024-07-07 15:51:19', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1563, 3, '随意', '3', 'ai_write_tone', 0, '', '', '', '1', '2024-07-07 15:51:27', '1', '2024-07-07 15:51:27', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1564, 4, '友好', '4', 'ai_write_tone', 0, '', '', '', '1', '2024-07-07 15:51:37', '1', '2024-07-07 15:51:37', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1565, 5, '专业', '5', 'ai_write_tone', 0, '', '', '', '1', '2024-07-07 15:51:49', '1', '2024-07-07 15:52:02', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1566, 6, '诙谐', '6', 'ai_write_tone', 0, '', '', '', '1', '2024-07-07 15:52:15', '1', '2024-07-07 15:52:15', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1567, 7, '有趣', '7', 'ai_write_tone', 0, '', '', '', '1', '2024-07-07 15:52:24', '1', '2024-07-07 15:52:24', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1568, 8, '正式', '8', 'ai_write_tone', 0, '', '', '', '1', '2024-07-07 15:54:33', '1', '2024-07-07 15:54:33', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1569, 5, '段落', '5', 'ai_write_format', 0, '', '', '', '1', '2024-07-07 15:49:54', '1', '2024-07-07 15:49:54', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1570, 1, '自动', '1', 'ai_write_format', 0, '', '', '', '1', '2024-07-07 15:19:34', '1', '2024-07-07 15:19:34', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1571, 2, '电子邮件', '2', 'ai_write_format', 0, '', '', '', '1', '2024-07-07 15:19:50', '1', '2024-07-07 15:49:30', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1572, 3, '消息', '3', 'ai_write_format', 0, '', '', '', '1', '2024-07-07 15:20:01', '1', '2024-07-07 15:49:38', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1573, 4, '评论', '4', 'ai_write_format', 0, '', '', '', '1', '2024-07-07 15:20:13', '1', '2024-07-07 15:49:45', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1574, 1, '自动', '1', 'ai_write_language', 0, '', '', '', '1', '2024-07-07 15:44:18', '1', '2024-07-07 15:44:18', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1575, 2, '中文', '2', 'ai_write_language', 0, '', '', '', '1', '2024-07-07 15:44:28', '1', '2024-07-07 15:44:28', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1576, 3, '英文', '3', 'ai_write_language', 0, '', '', '', '1', '2024-07-07 15:44:37', '1', '2024-07-07 15:44:37', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1577, 4, '韩语', '4', 'ai_write_language', 0, '', '', '', '1', '2024-07-07 15:46:28', '1', '2024-07-07 15:46:28', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1578, 5, '日语', '5', 'ai_write_language', 0, '', '', '', '1', '2024-07-07 15:46:44', '1', '2024-07-07 15:46:44', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1579, 1, '自动', '1', 'ai_write_length', 0, '', '', '', '1', '2024-07-07 15:48:34', '1', '2024-07-07 15:48:34', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1580, 2, '短', '2', 'ai_write_length', 0, '', '', '', '1', '2024-07-07 15:48:44', '1', '2024-07-07 15:48:44', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1581, 3, '中等', '3', 'ai_write_length', 0, '', '', '', '1', '2024-07-07 15:48:52', '1', '2024-07-07 15:48:52', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1582, 4, '长', '4', 'ai_write_length', 0, '', '', '', '1', '2024-07-07 15:49:03', '1', '2024-07-07 15:49:03', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1584, 1, '撰写', '1', 'ai_write_type', 0, '', '', '', '1', '2024-07-10 21:26:00', '1', '2024-07-10 21:26:00', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1585, 2, '回复', '2', 'ai_write_type', 0, '', '', '', '1', '2024-07-10 21:26:06', '1', '2024-07-10 21:26:06', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1586, 2, '腾讯云', 'TENCENT', 'system_sms_channel_code', 0, '', '', '', '1', '2024-07-22 22:23:16', '1', '2024-07-22 22:23:16', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1587, 3, '华为云', 'HUAWEI', 'system_sms_channel_code', 0, '', '', '', '1', '2024-07-22 22:23:46', '1', '2024-07-22 22:23:53', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1588, 1, 'OpenAI 微软', 'AzureOpenAI', 'ai_platform', 0, '', '', '', '1', '2024-08-10 14:07:41', '1', '2024-08-10 14:07:41', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1589, 10, 'BPMN 设计器', '10', 'bpm_model_type', 0, 'primary', '', '', '1', '2024-08-26 15:22:17', '1', '2024-08-26 16:46:02', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1590, 20, 'SIMPLE 设计器', '20', 'bpm_model_type', 0, 'success', '', '', '1', '2024-08-26 15:22:27', '1', '2024-08-26 16:45:58', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1591, 4, '七牛云', 'QINIU', 'system_sms_channel_code', 0, '', '', '', '1', '2024-08-31 08:45:03', '1', '2024-08-31 08:45:24', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1592, 3, '新人券', '3', 'promotion_coupon_take_type', 0, 'info', '', '新人注册后,自动发放', '1', '2024-09-03 11:57:16', '1', '2024-09-03 11:57:28', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1593, 5, '微信零钱', '5', 'brokerage_withdraw_type', 0, '', '', '自动打款', '1', '2024-10-13 11:06:48', '1', '2024-10-13 11:06:59', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1683, 10, '字节豆包', 'DouBao', 'ai_platform', 0, '', '', '', '1', '2025-02-23 19:51:40', '1', '2025-02-23 19:52:02', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1684, 11, '腾讯混元', 'HunYuan', 'ai_platform', 0, '', '', '', '1', '2025-02-23 20:58:04', '1', '2025-02-23 20:58:04', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1685, 12, '硅基流动', 'SiliconFlow', 'ai_platform', 0, '', '', '', '1', '2025-02-24 20:19:09', '1', '2025-02-24 20:19:09', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1686, 1, '聊天', '1', 'ai_model_type', 0, '', '', '', '1', '2025-03-03 12:26:34', '1', '2025-03-03 12:26:34', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1687, 2, '图像', '2', 'ai_model_type', 0, '', '', '', '1', '2025-03-03 12:27:23', '1', '2025-03-03 12:27:23', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1688, 3, '音频', '3', 'ai_model_type', 0, '', '', '', '1', '2025-03-03 12:27:51', '1', '2025-03-03 12:27:51', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1689, 4, '视频', '4', 'ai_model_type', 0, '', '', '', '1', '2025-03-03 12:28:03', '1', '2025-03-03 12:28:03', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1690, 5, '向量', '5', 'ai_model_type', 0, '', '', '', '1', '2025-03-03 12:28:15', '1', '2025-03-03 12:28:15', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1691, 6, '重排', '6', 'ai_model_type', 0, '', '', '', '1', '2025-03-03 12:28:26', '1', '2025-03-03 12:28:26', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1692, 14, 'MiniMax', 'MiniMax', 'ai_platform', 0, '', '', '', '1', '2025-03-11 20:04:51', '1', '2025-03-11 20:04:51', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1693, 15, '月之暗灭', 'Moonshot', 'ai_platform', 0, '', '', '', '1', '2025-03-11 20:05:08', '1', '2025-03-11 20:05:08', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2000, 0, '标准数据格式(JSON)', '0', 'iot_data_format', 0, 'default', '', '', '1', '2024-08-10 11:53:26', '1', '2025-03-17 09:28:16', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2001, 1, '透传/自定义', '1', 'iot_data_format', 0, 'default', '', '', '1', '2024-08-10 11:53:37', '1', '2025-03-17 09:28:19', b'0'); +COMMIT; + +-- ---------------------------- +-- Table structure for system_dict_type +-- ---------------------------- +DROP TABLE IF EXISTS `system_dict_type`; +CREATE TABLE `system_dict_type` ( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '字典主键', + `name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '字典名称', + `type` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '字典类型', + `status` tinyint NOT NULL DEFAULT '0' COMMENT '状态(0正常 1停用)', + `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '备注', + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建者', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '更新者', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', + `deleted_time` datetime DEFAULT NULL COMMENT '删除时间', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=2000 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='字典类型表'; + +-- ---------------------------- +-- Records of system_dict_type +-- ---------------------------- +BEGIN; +INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (1, '用户性别', 'system_user_sex', 0, NULL, 'admin', '2021-01-05 17:03:48', '1', '2022-05-16 20:29:32', b'0', NULL); +INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (6, '参数类型', 'infra_config_type', 0, NULL, 'admin', '2021-01-05 17:03:48', '', '2022-02-01 16:36:54', b'0', NULL); +INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (7, '通知类型', 'system_notice_type', 0, NULL, 'admin', '2021-01-05 17:03:48', '', '2022-02-01 16:35:26', b'0', NULL); +INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (9, '操作类型', 'infra_operate_type', 0, NULL, 'admin', '2021-01-05 17:03:48', '1', '2024-03-14 12:44:01', b'0', NULL); +INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (10, '系统状态', 'common_status', 0, NULL, 'admin', '2021-01-05 17:03:48', '', '2022-02-01 16:21:28', b'0', NULL); +INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (11, 'Boolean 是否类型', 'infra_boolean_string', 0, 'boolean 转是否', '', '2021-01-19 03:20:08', '', '2022-02-01 16:37:10', b'0', NULL); +INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (104, '登陆结果', 'system_login_result', 0, '登陆结果', '', '2021-01-18 06:17:11', '', '2022-02-01 16:36:00', b'0', NULL); +INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (106, '代码生成模板类型', 'infra_codegen_template_type', 0, NULL, '', '2021-02-05 07:08:06', '1', '2022-05-16 20:26:50', b'0', NULL); +INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (107, '定时任务状态', 'infra_job_status', 0, NULL, '', '2021-02-07 07:44:16', '', '2022-02-01 16:51:11', b'0', NULL); +INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (108, '定时任务日志状态', 'infra_job_log_status', 0, NULL, '', '2021-02-08 10:03:51', '', '2022-02-01 16:50:43', b'0', NULL); +INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (109, '用户类型', 'user_type', 0, NULL, '', '2021-02-26 00:15:51', '', '2021-02-26 00:15:51', b'0', NULL); +INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (110, 'API 异常数据的处理状态', 'infra_api_error_log_process_status', 0, NULL, '', '2021-02-26 07:07:01', '', '2022-02-01 16:50:53', b'0', NULL); +INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (116, '登陆日志的类型', 'system_login_type', 0, '登陆日志的类型', '1', '2021-10-06 00:50:46', '1', '2022-02-01 16:35:56', b'0', NULL); +INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (144, '代码生成的场景枚举', 'infra_codegen_scene', 0, '代码生成的场景枚举', '1', '2022-02-02 13:14:45', '1', '2022-03-10 16:33:46', b'0', NULL); +INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (145, '角色类型', 'system_role_type', 0, '角色类型', '1', '2022-02-16 13:01:46', '1', '2022-02-16 13:01:46', b'0', NULL); +INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (146, '文件存储器', 'infra_file_storage', 0, '文件存储器', '1', '2022-03-15 00:24:38', '1', '2022-03-15 00:24:38', b'0', NULL); +INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (147, 'OAuth 2.0 授权类型', 'system_oauth2_grant_type', 0, 'OAuth 2.0 授权类型(模式)', '1', '2022-05-12 00:20:52', '1', '2022-05-11 16:25:49', b'0', NULL); +INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (160, '终端', 'terminal', 0, '终端', '1', '2022-12-10 10:50:50', '1', '2022-12-10 10:53:11', b'0', NULL); +COMMIT; + +-- ---------------------------- +-- Table structure for system_login_log +-- ---------------------------- +DROP TABLE IF EXISTS `system_login_log`; +CREATE TABLE `system_login_log` ( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '访问ID', + `log_type` bigint NOT NULL COMMENT '日志类型', + `trace_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '链路追踪编号', + `user_id` bigint NOT NULL DEFAULT '0' COMMENT '用户编号', + `user_type` tinyint NOT NULL DEFAULT '0' COMMENT '用户类型', + `username` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '用户账号', + `result` tinyint NOT NULL COMMENT '登陆结果', + `user_ip` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '用户 IP', + `user_agent` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '浏览器 UA', + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建者', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '更新者', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', + `tenant_id` bigint NOT NULL DEFAULT '0' COMMENT '租户编号', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=3477 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='系统访问记录'; + +-- ---------------------------- +-- Records of system_login_log +-- ---------------------------- +BEGIN; +INSERT INTO `system_login_log` (`id`, `log_type`, `trace_id`, `user_id`, `user_type`, `username`, `result`, `user_ip`, `user_agent`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (3475, 100, '93afa762-9497-4e53-976d-50a67af59452', 1, 2, 'admin', 0, '0:0:0:0:0:0:0:1', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36', NULL, '2025-06-30 22:38:03', NULL, '2025-06-30 22:38:03', b'0', 0); +INSERT INTO `system_login_log` (`id`, `log_type`, `trace_id`, `user_id`, `user_type`, `username`, `result`, `user_ip`, `user_agent`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (3476, 100, '6270e957-c9e2-4331-b837-a9d2c94b80c5', 1, 2, 'admin', 0, '0:0:0:0:0:0:0:1', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36', NULL, '2025-07-01 21:41:03', NULL, '2025-07-01 21:41:03', b'0', 0); +COMMIT; + +-- ---------------------------- +-- Table structure for system_menu +-- ---------------------------- +DROP TABLE IF EXISTS `system_menu`; +CREATE TABLE `system_menu` ( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '菜单ID', + `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '菜单名称', + `permission` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '权限标识', + `type` tinyint NOT NULL COMMENT '菜单类型', + `sort` int NOT NULL DEFAULT '0' COMMENT '显示顺序', + `parent_id` bigint NOT NULL DEFAULT '0' COMMENT '父菜单ID', + `path` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '路由地址', + `icon` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '#' COMMENT '菜单图标', + `component` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '组件路径', + `component_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '组件名', + `status` tinyint NOT NULL DEFAULT '0' COMMENT '菜单状态', + `visible` bit(1) NOT NULL DEFAULT b'1' COMMENT '是否可见', + `keep_alive` bit(1) NOT NULL DEFAULT b'1' COMMENT '是否缓存', + `always_show` bit(1) NOT NULL DEFAULT b'1' COMMENT '是否总是显示', + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建者', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '更新者', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=5000 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='菜单权限表'; + +-- ---------------------------- +-- Records of system_menu +-- ---------------------------- +BEGIN; +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1, '系统管理', '', 1, 10, 0, '/system', 'ep:tools', NULL, NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2025-03-15 21:30:27', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2, '基础设施', '', 1, 20, 0, '/infra', 'ep:monitor', NULL, NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2024-03-01 08:28:40', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (100, '用户管理', 'system:user:list', 2, 1, 1, 'user', 'ep:avatar', 'system/user/index', 'SystemUser', 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2025-03-15 21:30:41', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (101, '角色管理', '', 2, 2, 1, 'role', 'ep:user', 'system/role/index', 'SystemRole', 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2024-05-01 18:35:29', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (102, '菜单管理', '', 2, 3, 1, 'menu', 'ep:menu', 'system/menu/index', 'SystemMenu', 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2024-02-29 01:03:50', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (103, '部门管理', '', 2, 4, 1, 'dept', 'fa:address-card', 'system/dept/index', 'SystemDept', 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2024-02-29 01:06:28', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (104, '岗位管理', '', 2, 5, 1, 'post', 'fa:address-book-o', 'system/post/index', 'SystemPost', 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2024-02-29 01:06:39', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (105, '字典管理', '', 2, 6, 1, 'dict', 'ep:collection', 'system/dict/index', 'SystemDictType', 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2024-02-29 01:07:12', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (106, '配置管理', '', 2, 8, 2, 'config', 'fa:connectdevelop', 'infra/config/index', 'InfraConfig', 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2024-04-23 00:02:45', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (107, '通知公告', '', 2, 4, 1, 'notice', 'ep:takeaway-box', 'system/notice/index', 'SystemNotice', 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2024-04-22 23:56:17', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (108, '审计日志', '', 1, 9, 1, 'log', 'ep:document-copy', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2024-02-29 01:08:30', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (110, '定时任务', '', 2, 7, 2, 'job', 'fa-solid:tasks', 'infra/job/index', 'InfraJob', 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2024-02-29 08:57:36', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (114, '表单构建', 'infra:build:list', 2, 2, 2, 'build', 'fa:wpforms', 'infra/build/index', 'InfraBuild', 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2024-02-29 08:51:35', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (115, '代码生成', 'infra:codegen:query', 2, 1, 2, 'codegen', 'ep:document-copy', 'infra/codegen/index', 'InfraCodegen', 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2024-02-29 08:51:06', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (116, 'API 接口', 'infra:swagger:list', 2, 3, 2, 'swagger', 'fa:fighter-jet', 'infra/swagger/index', 'InfraSwagger', 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2024-04-23 00:01:24', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (500, '操作日志', '', 2, 1, 108, 'operate-log', 'ep:position', 'system/operatelog/index', 'SystemOperateLog', 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2024-02-29 01:09:59', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (501, '登录日志', '', 2, 2, 108, 'login-log', 'ep:promotion', 'system/loginlog/index', 'SystemLoginLog', 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2024-02-29 01:10:29', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1001, '用户查询', 'system:user:query', 3, 1, 100, '', '#', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1002, '用户新增', 'system:user:create', 3, 2, 100, '', '', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1003, '用户修改', 'system:user:update', 3, 3, 100, '', '', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1004, '用户删除', 'system:user:delete', 3, 4, 100, '', '', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1005, '用户导出', 'system:user:export', 3, 5, 100, '', '#', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1006, '用户导入', 'system:user:import', 3, 6, 100, '', '#', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1007, '重置密码', 'system:user:update-password', 3, 7, 100, '', '', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1008, '角色查询', 'system:role:query', 3, 1, 101, '', '#', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1009, '角色新增', 'system:role:create', 3, 2, 101, '', '', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1010, '角色修改', 'system:role:update', 3, 3, 101, '', '', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1011, '角色删除', 'system:role:delete', 3, 4, 101, '', '', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1012, '角色导出', 'system:role:export', 3, 5, 101, '', '#', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1013, '菜单查询', 'system:menu:query', 3, 1, 102, '', '#', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1014, '菜单新增', 'system:menu:create', 3, 2, 102, '', '#', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1015, '菜单修改', 'system:menu:update', 3, 3, 102, '', '#', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1016, '菜单删除', 'system:menu:delete', 3, 4, 102, '', '#', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1017, '部门查询', 'system:dept:query', 3, 1, 103, '', '#', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1018, '部门新增', 'system:dept:create', 3, 2, 103, '', '', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1019, '部门修改', 'system:dept:update', 3, 3, 103, '', '', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1020, '部门删除', 'system:dept:delete', 3, 4, 103, '', '', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1021, '岗位查询', 'system:post:query', 3, 1, 104, '', '#', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1022, '岗位新增', 'system:post:create', 3, 2, 104, '', '', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1023, '岗位修改', 'system:post:update', 3, 3, 104, '', '', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1024, '岗位删除', 'system:post:delete', 3, 4, 104, '', '', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1025, '岗位导出', 'system:post:export', 3, 5, 104, '', '#', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1026, '字典查询', 'system:dict:query', 3, 1, 105, '#', '#', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1027, '字典新增', 'system:dict:create', 3, 2, 105, '', '', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1028, '字典修改', 'system:dict:update', 3, 3, 105, '', '', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1029, '字典删除', 'system:dict:delete', 3, 4, 105, '', '', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1030, '字典导出', 'system:dict:export', 3, 5, 105, '#', '#', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1031, '配置查询', 'infra:config:query', 3, 1, 106, '', '', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1032, '配置新增', 'infra:config:create', 3, 2, 106, '', '', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1033, '配置修改', 'infra:config:update', 3, 3, 106, '', '', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1034, '配置删除', 'infra:config:delete', 3, 4, 106, '', '', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1035, '配置导出', 'infra:config:export', 3, 5, 106, '', '', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1036, '公告查询', 'system:notice:query', 3, 1, 107, '#', '#', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1037, '公告新增', 'system:notice:create', 3, 2, 107, '', '', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1038, '公告修改', 'system:notice:update', 3, 3, 107, '', '', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1039, '公告删除', 'system:notice:delete', 3, 4, 107, '', '', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1040, '操作查询', 'system:operate-log:query', 3, 1, 500, '', '', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1042, '日志导出', 'system:operate-log:export', 3, 2, 500, '', '', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1043, '登录查询', 'system:login-log:query', 3, 1, 501, '#', '#', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1045, '日志导出', 'system:login-log:export', 3, 3, 501, '#', '#', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1050, '任务新增', 'infra:job:create', 3, 2, 110, '', '', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1051, '任务修改', 'infra:job:update', 3, 3, 110, '', '', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1052, '任务删除', 'infra:job:delete', 3, 4, 110, '', '', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1053, '状态修改', 'infra:job:update', 3, 5, 110, '', '', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1054, '任务导出', 'infra:job:export', 3, 7, 110, '', '', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1056, '生成修改', 'infra:codegen:update', 3, 2, 115, '', '', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1057, '生成删除', 'infra:codegen:delete', 3, 3, 115, '', '', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1058, '导入代码', 'infra:codegen:create', 3, 2, 115, '', '', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1059, '预览代码', 'infra:codegen:preview', 3, 4, 115, '', '', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1060, '生成代码', 'infra:codegen:download', 3, 5, 115, '', '', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1063, '设置角色菜单权限', 'system:permission:assign-role-menu', 3, 6, 101, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2021-01-06 17:53:44', '', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1064, '设置角色数据权限', 'system:permission:assign-role-data-scope', 3, 7, 101, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2021-01-06 17:56:31', '', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1065, '设置用户角色', 'system:permission:assign-user-role', 3, 8, 101, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2021-01-07 10:23:28', '', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1075, '任务触发', 'infra:job:trigger', 3, 8, 110, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2021-02-07 13:03:10', '', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1087, '任务查询', 'infra:job:query', 3, 1, 110, '', '', '', NULL, 0, b'1', b'1', b'1', '1', '2021-03-10 01:26:19', '1', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1090, '文件列表', '', 2, 5, 1243, 'file', 'ep:upload-filled', 'infra/file/index', 'InfraFile', 0, b'1', b'1', b'1', '', '2021-03-12 20:16:20', '1', '2024-02-29 08:53:02', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1091, '文件查询', 'infra:file:query', 3, 1, 1090, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2021-03-12 20:16:20', '', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1092, '文件删除', 'infra:file:delete', 3, 4, 1090, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2021-03-12 20:16:20', '', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1237, '文件配置', '', 2, 0, 1243, 'file-config', 'fa-solid:file-signature', 'infra/fileConfig/index', 'InfraFileConfig', 0, b'1', b'1', b'1', '', '2022-03-15 14:35:28', '1', '2024-02-29 08:52:54', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1238, '文件配置查询', 'infra:file-config:query', 3, 1, 1237, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2022-03-15 14:35:28', '', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1239, '文件配置创建', 'infra:file-config:create', 3, 2, 1237, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2022-03-15 14:35:28', '', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1240, '文件配置更新', 'infra:file-config:update', 3, 3, 1237, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2022-03-15 14:35:28', '', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1241, '文件配置删除', 'infra:file-config:delete', 3, 4, 1237, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2022-03-15 14:35:28', '', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1242, '文件配置导出', 'infra:file-config:export', 3, 5, 1237, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2022-03-15 14:35:28', '', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1243, '文件管理', '', 2, 6, 2, 'file', 'ep:files', NULL, '', 0, b'1', b'1', b'1', '1', '2022-03-16 23:47:40', '1', '2024-04-23 00:02:11', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1255, '数据源配置', '', 2, 1, 2, 'data-source-config', 'ep:data-analysis', 'infra/dataSourceConfig/index', 'InfraDataSourceConfig', 0, b'1', b'1', b'1', '', '2022-04-27 14:37:32', '1', '2024-02-29 08:51:25', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1256, '数据源配置查询', 'infra:data-source-config:query', 3, 1, 1255, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2022-04-27 14:37:32', '', '2022-04-27 14:37:32', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1257, '数据源配置创建', 'infra:data-source-config:create', 3, 2, 1255, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2022-04-27 14:37:32', '', '2022-04-27 14:37:32', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1258, '数据源配置更新', 'infra:data-source-config:update', 3, 3, 1255, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2022-04-27 14:37:32', '', '2022-04-27 14:37:32', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1259, '数据源配置删除', 'infra:data-source-config:delete', 3, 4, 1255, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2022-04-27 14:37:32', '', '2022-04-27 14:37:32', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1260, '数据源配置导出', 'infra:data-source-config:export', 3, 5, 1255, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2022-04-27 14:37:32', '', '2022-04-27 14:37:32', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2083, '地区管理', '', 2, 14, 1, 'area', 'fa:map-marker', 'system/area/index', 'SystemArea', 0, b'1', b'1', b'1', '1', '2022-12-23 17:35:05', '1', '2024-02-29 08:50:28', b'0'); +COMMIT; + +-- ---------------------------- +-- Table structure for system_notice +-- ---------------------------- +DROP TABLE IF EXISTS `system_notice`; +CREATE TABLE `system_notice` ( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '公告ID', + `title` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '公告标题', + `content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '公告内容', + `type` tinyint NOT NULL COMMENT '公告类型(1通知 2公告)', + `status` tinyint NOT NULL DEFAULT '0' COMMENT '公告状态(0正常 1关闭)', + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建者', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '更新者', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='通知公告表'; + +-- ---------------------------- +-- Records of system_notice +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for system_operate_log +-- ---------------------------- +DROP TABLE IF EXISTS `system_operate_log`; +CREATE TABLE `system_operate_log` ( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '日志主键', + `trace_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '链路追踪编号', + `user_id` bigint NOT NULL COMMENT '用户编号', + `user_type` tinyint NOT NULL DEFAULT '0' COMMENT '用户类型', + `type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '操作模块类型', + `sub_type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '操作名', + `biz_id` bigint NOT NULL COMMENT '操作数据模块编号', + `action` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '操作内容', + `success` bit(1) NOT NULL DEFAULT b'1' COMMENT '操作结果', + `extra` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '拓展字段', + `request_method` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '请求方法名', + `request_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '请求地址', + `user_ip` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '用户 IP', + `user_agent` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '浏览器 UA', + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建者', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '更新者', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', + `tenant_id` bigint NOT NULL DEFAULT '0' COMMENT '租户编号', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=9066 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='操作日志记录 V2 版本'; + +-- ---------------------------- +-- Records of system_operate_log +-- ---------------------------- +BEGIN; +INSERT INTO `system_operate_log` (`id`, `trace_id`, `user_id`, `user_type`, `type`, `sub_type`, `biz_id`, `action`, `success`, `extra`, `request_method`, `request_url`, `user_ip`, `user_agent`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (9065, '', 1, 2, 'SYSTEM 用户', '重置用户密码', 1, '将用户【勇哥Java实战】的密码从【$2a$04$Q3WCEQJbSZ0zT/7ryYTb3OgtrhwIZXu4ah5RQ5/YQDQ7DpW7N7oNa】重置为【$2a$04$360poG67pqaEWbvXWhgOe.bdV5R30UW.e7/0p5OzAXh52IvllkkC2】', b'1', '', 'PUT', '/admin-api/system/user/update-password', '0:0:0:0:0:0:0:1', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36', NULL, '2025-04-14 22:02:26', NULL, '2025-04-14 22:02:26', b'0', 0); +COMMIT; + +-- ---------------------------- +-- Table structure for system_post +-- ---------------------------- +DROP TABLE IF EXISTS `system_post`; +CREATE TABLE `system_post` ( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '岗位ID', + `code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '岗位编码', + `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '岗位名称', + `sort` int NOT NULL COMMENT '显示顺序', + `status` tinyint NOT NULL COMMENT '状态(0正常 1停用)', + `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '备注', + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建者', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '更新者', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', + `tenant_id` bigint NOT NULL DEFAULT '0' COMMENT '租户编号', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='岗位信息表'; + +-- ---------------------------- +-- Records of system_post +-- ---------------------------- +BEGIN; +INSERT INTO `system_post` (`id`, `code`, `name`, `sort`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (1, 'ceo', '董事长', 1, 0, '', 'admin', '2021-01-06 17:03:48', '1', '2023-02-11 15:19:04', b'0', 0); +INSERT INTO `system_post` (`id`, `code`, `name`, `sort`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2, 'se', '项目经理', 2, 0, '', 'admin', '2021-01-05 17:03:48', '1', '2023-11-15 09:18:20', b'0', 0); +INSERT INTO `system_post` (`id`, `code`, `name`, `sort`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (4, 'user', '普通员工', 4, 0, '111', 'admin', '2021-01-05 17:03:48', '1', '2023-12-02 10:04:37', b'0', 0); +INSERT INTO `system_post` (`id`, `code`, `name`, `sort`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (5, 'HR', '人力资源', 5, 0, '', '1', '2024-03-24 20:45:40', '1', '2024-03-24 20:45:40', b'0', 0); +COMMIT; + +-- ---------------------------- +-- Table structure for system_role +-- ---------------------------- +DROP TABLE IF EXISTS `system_role`; +CREATE TABLE `system_role` ( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '角色ID', + `name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '角色名称', + `code` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '角色权限字符串', + `sort` int NOT NULL COMMENT '显示顺序', + `data_scope` tinyint NOT NULL DEFAULT '1' COMMENT '数据范围(1:全部数据权限 2:自定数据权限 3:本部门数据权限 4:本部门及以下数据权限)', + `data_scope_dept_ids` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '数据范围(指定部门数组)', + `status` tinyint NOT NULL COMMENT '角色状态(0正常 1停用)', + `type` tinyint NOT NULL COMMENT '角色类型', + `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '备注', + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建者', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '更新者', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', + `tenant_id` bigint NOT NULL DEFAULT '0' COMMENT '租户编号', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=154 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='角色信息表'; + +-- ---------------------------- +-- Records of system_role +-- ---------------------------- +BEGIN; +INSERT INTO `system_role` (`id`, `name`, `code`, `sort`, `data_scope`, `data_scope_dept_ids`, `status`, `type`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (1, '超级管理员', 'super_admin', 1, 1, '', 0, 1, '超级管理员', 'admin', '2021-01-05 17:03:48', '', '2022-02-22 05:08:21', b'0', 0); +INSERT INTO `system_role` (`id`, `name`, `code`, `sort`, `data_scope`, `data_scope_dept_ids`, `status`, `type`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2, '普通角色', 'common', 2, 2, '', 0, 1, '普通角色', 'admin', '2021-01-05 17:03:48', '', '2022-02-22 05:08:20', b'0', 0); +INSERT INTO `system_role` (`id`, `name`, `code`, `sort`, `data_scope`, `data_scope_dept_ids`, `status`, `type`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (3, 'CRM 管理员', 'crm_admin', 2, 1, '', 0, 1, 'CRM 专属角色', '1', '2024-02-24 10:51:13', '1', '2024-02-24 02:51:32', b'0', 0); +INSERT INTO `system_role` (`id`, `name`, `code`, `sort`, `data_scope`, `data_scope_dept_ids`, `status`, `type`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (101, '测试账号', 'test', 0, 1, '[]', 0, 2, '', '', '2021-01-06 13:49:35', '1', '2024-08-11 10:41:10', b'0', 0); +INSERT INTO `system_role` (`id`, `name`, `code`, `sort`, `data_scope`, `data_scope_dept_ids`, `status`, `type`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (153, '某角色', 'tt', 4, 1, '', 0, 2, '', '1', '2024-08-17 14:09:35', '1', '2024-08-17 14:09:35', b'0', 0); +COMMIT; + +-- ---------------------------- +-- Table structure for system_role_menu +-- ---------------------------- +DROP TABLE IF EXISTS `system_role_menu`; +CREATE TABLE `system_role_menu` ( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '自增编号', + `role_id` bigint NOT NULL COMMENT '角色ID', + `menu_id` bigint NOT NULL COMMENT '菜单ID', + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建者', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '更新者', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=5793 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='角色和菜单关联表'; + +-- ---------------------------- +-- Records of system_role_menu +-- ---------------------------- +BEGIN; +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (434, 2, 1, '1', '2022-02-22 13:09:12', '1', '2022-02-22 13:09:12', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (454, 2, 1093, '1', '2022-02-22 13:09:12', '1', '2022-02-22 13:09:12', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (455, 2, 1094, '1', '2022-02-22 13:09:12', '1', '2022-02-22 13:09:12', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (460, 2, 1100, '1', '2022-02-22 13:09:12', '1', '2022-02-22 13:09:12', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (467, 2, 1107, '1', '2022-02-22 13:09:12', '1', '2022-02-22 13:09:12', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (476, 2, 1117, '1', '2022-02-22 13:09:12', '1', '2022-02-22 13:09:12', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (477, 2, 100, '1', '2022-02-22 13:09:12', '1', '2022-02-22 13:09:12', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (478, 2, 101, '1', '2022-02-22 13:09:12', '1', '2022-02-22 13:09:12', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (479, 2, 102, '1', '2022-02-22 13:09:12', '1', '2022-02-22 13:09:12', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (480, 2, 1126, '1', '2022-02-22 13:09:12', '1', '2022-02-22 13:09:12', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (481, 2, 103, '1', '2022-02-22 13:09:12', '1', '2022-02-22 13:09:12', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (483, 2, 104, '1', '2022-02-22 13:09:12', '1', '2022-02-22 13:09:12', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (485, 2, 105, '1', '2022-02-22 13:09:12', '1', '2022-02-22 13:09:12', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (488, 2, 107, '1', '2022-02-22 13:09:12', '1', '2022-02-22 13:09:12', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (490, 2, 108, '1', '2022-02-22 13:09:12', '1', '2022-02-22 13:09:12', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (492, 2, 109, '1', '2022-02-22 13:09:12', '1', '2022-02-22 13:09:12', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (498, 2, 1138, '1', '2022-02-22 13:09:12', '1', '2022-02-22 13:09:12', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (523, 2, 1224, '1', '2022-02-22 13:09:12', '1', '2022-02-22 13:09:12', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (524, 2, 1225, '1', '2022-02-22 13:09:12', '1', '2022-02-22 13:09:12', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (541, 2, 500, '1', '2022-02-22 13:09:12', '1', '2022-02-22 13:09:12', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (543, 2, 501, '1', '2022-02-22 13:09:12', '1', '2022-02-22 13:09:12', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (675, 2, 2, '1', '2022-02-22 13:16:57', '1', '2022-02-22 13:16:57', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (689, 2, 1077, '1', '2022-02-22 13:16:57', '1', '2022-02-22 13:16:57', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (690, 2, 1078, '1', '2022-02-22 13:16:57', '1', '2022-02-22 13:16:57', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (692, 2, 1083, '1', '2022-02-22 13:16:57', '1', '2022-02-22 13:16:57', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (693, 2, 1084, '1', '2022-02-22 13:16:57', '1', '2022-02-22 13:16:57', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (699, 2, 1090, '1', '2022-02-22 13:16:57', '1', '2022-02-22 13:16:57', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (703, 2, 106, '1', '2022-02-22 13:16:57', '1', '2022-02-22 13:16:57', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (704, 2, 110, '1', '2022-02-22 13:16:57', '1', '2022-02-22 13:16:57', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (705, 2, 111, '1', '2022-02-22 13:16:57', '1', '2022-02-22 13:16:57', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (706, 2, 112, '1', '2022-02-22 13:16:57', '1', '2022-02-22 13:16:57', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (707, 2, 113, '1', '2022-02-22 13:16:57', '1', '2022-02-22 13:16:57', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1604, 101, 1216, '1', '2022-03-19 21:45:52', '1', '2022-03-19 21:45:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1605, 101, 1217, '1', '2022-03-19 21:45:52', '1', '2022-03-19 21:45:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1606, 101, 1218, '1', '2022-03-19 21:45:52', '1', '2022-03-19 21:45:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1607, 101, 1219, '1', '2022-03-19 21:45:52', '1', '2022-03-19 21:45:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1608, 101, 1220, '1', '2022-03-19 21:45:52', '1', '2022-03-19 21:45:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1609, 101, 1221, '1', '2022-03-19 21:45:52', '1', '2022-03-19 21:45:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1610, 101, 5, '1', '2022-03-19 21:45:52', '1', '2022-03-19 21:45:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1611, 101, 1222, '1', '2022-03-19 21:45:52', '1', '2022-03-19 21:45:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1612, 101, 1118, '1', '2022-03-19 21:45:52', '1', '2022-03-19 21:45:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1613, 101, 1119, '1', '2022-03-19 21:45:52', '1', '2022-03-19 21:45:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1614, 101, 1120, '1', '2022-03-19 21:45:52', '1', '2022-03-19 21:45:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1615, 101, 1185, '1', '2022-03-19 21:45:52', '1', '2022-03-19 21:45:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1616, 101, 1186, '1', '2022-03-19 21:45:52', '1', '2022-03-19 21:45:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1617, 101, 1187, '1', '2022-03-19 21:45:52', '1', '2022-03-19 21:45:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1618, 101, 1188, '1', '2022-03-19 21:45:52', '1', '2022-03-19 21:45:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1619, 101, 1189, '1', '2022-03-19 21:45:52', '1', '2022-03-19 21:45:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1620, 101, 1190, '1', '2022-03-19 21:45:52', '1', '2022-03-19 21:45:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1621, 101, 1191, '1', '2022-03-19 21:45:52', '1', '2022-03-19 21:45:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1622, 101, 1192, '1', '2022-03-19 21:45:52', '1', '2022-03-19 21:45:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1623, 101, 1193, '1', '2022-03-19 21:45:52', '1', '2022-03-19 21:45:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1624, 101, 1194, '1', '2022-03-19 21:45:52', '1', '2022-03-19 21:45:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1625, 101, 1195, '1', '2022-03-19 21:45:52', '1', '2022-03-19 21:45:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1627, 101, 1197, '1', '2022-03-19 21:45:52', '1', '2022-03-19 21:45:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1628, 101, 1198, '1', '2022-03-19 21:45:52', '1', '2022-03-19 21:45:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1629, 101, 1199, '1', '2022-03-19 21:45:52', '1', '2022-03-19 21:45:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1630, 101, 1200, '1', '2022-03-19 21:45:52', '1', '2022-03-19 21:45:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1631, 101, 1201, '1', '2022-03-19 21:45:52', '1', '2022-03-19 21:45:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1632, 101, 1202, '1', '2022-03-19 21:45:52', '1', '2022-03-19 21:45:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1633, 101, 1207, '1', '2022-03-19 21:45:52', '1', '2022-03-19 21:45:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1634, 101, 1208, '1', '2022-03-19 21:45:52', '1', '2022-03-19 21:45:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1635, 101, 1209, '1', '2022-03-19 21:45:52', '1', '2022-03-19 21:45:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1636, 101, 1210, '1', '2022-03-19 21:45:52', '1', '2022-03-19 21:45:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1637, 101, 1211, '1', '2022-03-19 21:45:52', '1', '2022-03-19 21:45:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1638, 101, 1212, '1', '2022-03-19 21:45:52', '1', '2022-03-19 21:45:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1639, 101, 1213, '1', '2022-03-19 21:45:52', '1', '2022-03-19 21:45:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1640, 101, 1215, '1', '2022-03-19 21:45:52', '1', '2022-03-19 21:45:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1641, 101, 2, '1', '2022-04-01 22:21:24', '1', '2022-04-01 22:21:24', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1642, 101, 1031, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1643, 101, 1032, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1644, 101, 1033, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1645, 101, 1034, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1646, 101, 1035, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1647, 101, 1050, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1648, 101, 1051, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1649, 101, 1052, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1650, 101, 1053, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1651, 101, 1054, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1652, 101, 1056, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1653, 101, 1057, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1654, 101, 1058, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1655, 101, 1059, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1656, 101, 1060, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1657, 101, 1066, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1658, 101, 1067, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1659, 101, 1070, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1664, 101, 1075, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1666, 101, 1077, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1667, 101, 1078, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1668, 101, 1082, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1669, 101, 1083, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1670, 101, 1084, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1671, 101, 1085, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1672, 101, 1086, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1673, 101, 1087, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1674, 101, 1088, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1675, 101, 1089, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1679, 101, 1237, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1680, 101, 1238, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1681, 101, 1239, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1682, 101, 1240, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1683, 101, 1241, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1684, 101, 1242, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1685, 101, 1243, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1687, 101, 106, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1688, 101, 110, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1689, 101, 111, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1690, 101, 112, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1691, 101, 113, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1692, 101, 114, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1693, 101, 115, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1694, 101, 116, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1991, 2, 1024, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1992, 2, 1025, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1993, 2, 1026, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1994, 2, 1027, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1995, 2, 1028, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1996, 2, 1029, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1997, 2, 1030, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1998, 2, 1031, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1999, 2, 1032, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2000, 2, 1033, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2001, 2, 1034, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2002, 2, 1035, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2003, 2, 1036, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2004, 2, 1037, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2005, 2, 1038, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2006, 2, 1039, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2007, 2, 1040, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2008, 2, 1042, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2009, 2, 1043, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2010, 2, 1045, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2011, 2, 1046, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2012, 2, 1048, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2013, 2, 1050, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2014, 2, 1051, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2015, 2, 1052, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2016, 2, 1053, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2017, 2, 1054, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2018, 2, 1056, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2019, 2, 1057, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2020, 2, 1058, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2021, 2, 2083, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2022, 2, 1059, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2023, 2, 1060, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2024, 2, 1063, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2025, 2, 1064, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2026, 2, 1065, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2027, 2, 1066, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2028, 2, 1067, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2029, 2, 1070, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2034, 2, 1075, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2036, 2, 1082, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2037, 2, 1085, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2038, 2, 1086, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2039, 2, 1087, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2040, 2, 1088, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2041, 2, 1089, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2042, 2, 1091, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2043, 2, 1092, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2044, 2, 1095, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2045, 2, 1096, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2046, 2, 1097, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2047, 2, 1098, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2048, 2, 1101, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2049, 2, 1102, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2050, 2, 1103, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2051, 2, 1104, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2052, 2, 1105, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2053, 2, 1106, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2054, 2, 1108, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2055, 2, 1109, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2061, 2, 1127, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2062, 2, 1128, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2063, 2, 1129, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2064, 2, 1130, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2066, 2, 1132, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2067, 2, 1133, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2068, 2, 1134, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2069, 2, 1135, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2070, 2, 1136, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2071, 2, 1137, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2072, 2, 114, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2073, 2, 1139, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2074, 2, 115, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2075, 2, 1140, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2076, 2, 116, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2077, 2, 1141, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2078, 2, 1142, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2079, 2, 1143, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2080, 2, 1150, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2081, 2, 1161, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2082, 2, 1162, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2083, 2, 1163, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2084, 2, 1164, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2085, 2, 1165, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2086, 2, 1166, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2087, 2, 1173, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2088, 2, 1174, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2089, 2, 1175, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2090, 2, 1176, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2091, 2, 1177, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2092, 2, 1178, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2099, 2, 1226, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2100, 2, 1227, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2101, 2, 1228, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2102, 2, 1229, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2103, 2, 1237, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2104, 2, 1238, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2105, 2, 1239, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2106, 2, 1240, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2107, 2, 1241, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2108, 2, 1242, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2109, 2, 1243, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2116, 2, 1254, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2117, 2, 1255, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2118, 2, 1256, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2119, 2, 1257, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2120, 2, 1258, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2121, 2, 1259, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2122, 2, 1260, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2123, 2, 1261, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2124, 2, 1263, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2125, 2, 1264, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2126, 2, 1265, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2127, 2, 1266, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2128, 2, 1267, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2129, 2, 1001, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2130, 2, 1002, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2131, 2, 1003, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2132, 2, 1004, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2133, 2, 1005, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2134, 2, 1006, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2135, 2, 1007, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2136, 2, 1008, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2137, 2, 1009, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2138, 2, 1010, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2139, 2, 1011, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2140, 2, 1012, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2141, 2, 1013, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2143, 2, 1015, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2145, 2, 1017, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2146, 2, 1018, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2147, 2, 1019, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2148, 2, 1020, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2149, 2, 1021, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2150, 2, 1022, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2151, 2, 1023, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2152, 2, 1281, '1', '2023-01-25 08:42:58', '1', '2023-01-25 08:42:58', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2153, 2, 1282, '1', '2023-01-25 08:42:58', '1', '2023-01-25 08:42:58', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2154, 2, 2000, '1', '2023-01-25 08:42:58', '1', '2023-01-25 08:42:58', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2155, 2, 2002, '1', '2023-01-25 08:42:58', '1', '2023-01-25 08:42:58', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2156, 2, 2003, '1', '2023-01-25 08:42:58', '1', '2023-01-25 08:42:58', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2157, 2, 2004, '1', '2023-01-25 08:42:58', '1', '2023-01-25 08:42:58', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2158, 2, 2005, '1', '2023-01-25 08:42:58', '1', '2023-01-25 08:42:58', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2159, 2, 2006, '1', '2023-01-25 08:42:58', '1', '2023-01-25 08:42:58', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2160, 2, 2008, '1', '2023-01-25 08:42:58', '1', '2023-01-25 08:42:58', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2161, 2, 2009, '1', '2023-01-25 08:42:58', '1', '2023-01-25 08:42:58', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2162, 2, 2010, '1', '2023-01-25 08:42:58', '1', '2023-01-25 08:42:58', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2163, 2, 2011, '1', '2023-01-25 08:42:58', '1', '2023-01-25 08:42:58', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2164, 2, 2012, '1', '2023-01-25 08:42:58', '1', '2023-01-25 08:42:58', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2170, 2, 2019, '1', '2023-01-25 08:42:58', '1', '2023-01-25 08:42:58', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2171, 2, 2020, '1', '2023-01-25 08:42:58', '1', '2023-01-25 08:42:58', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2172, 2, 2021, '1', '2023-01-25 08:42:58', '1', '2023-01-25 08:42:58', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2173, 2, 2022, '1', '2023-01-25 08:42:58', '1', '2023-01-25 08:42:58', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2174, 2, 2023, '1', '2023-01-25 08:42:58', '1', '2023-01-25 08:42:58', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2175, 2, 2025, '1', '2023-01-25 08:42:58', '1', '2023-01-25 08:42:58', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2177, 2, 2027, '1', '2023-01-25 08:42:58', '1', '2023-01-25 08:42:58', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2178, 2, 2028, '1', '2023-01-25 08:42:58', '1', '2023-01-25 08:42:58', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2179, 2, 2029, '1', '2023-01-25 08:42:58', '1', '2023-01-25 08:42:58', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2180, 2, 2014, '1', '2023-01-25 08:43:12', '1', '2023-01-25 08:43:12', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2181, 2, 2015, '1', '2023-01-25 08:43:12', '1', '2023-01-25 08:43:12', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2182, 2, 2016, '1', '2023-01-25 08:43:12', '1', '2023-01-25 08:43:12', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2183, 2, 2017, '1', '2023-01-25 08:43:12', '1', '2023-01-25 08:43:12', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2184, 2, 2018, '1', '2023-01-25 08:43:12', '1', '2023-01-25 08:43:12', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2188, 101, 1024, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2189, 101, 1, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2190, 101, 1025, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2191, 101, 1026, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2192, 101, 1027, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2193, 101, 1028, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2194, 101, 1029, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2195, 101, 1030, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2196, 101, 1036, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2197, 101, 1037, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2198, 101, 1038, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2199, 101, 1039, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2200, 101, 1040, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2201, 101, 1042, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2202, 101, 1043, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2203, 101, 1045, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2204, 101, 1046, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2205, 101, 1048, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2206, 101, 2083, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2207, 101, 1063, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2208, 101, 1064, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2209, 101, 1065, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2210, 101, 1093, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2211, 101, 1094, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2212, 101, 1095, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2213, 101, 1096, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2214, 101, 1097, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2215, 101, 1098, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2216, 101, 1100, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2217, 101, 1101, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2218, 101, 1102, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2219, 101, 1103, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2220, 101, 1104, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2221, 101, 1105, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2222, 101, 1106, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2223, 101, 2130, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2224, 101, 1107, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2225, 101, 2131, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2226, 101, 1108, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2227, 101, 2132, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2228, 101, 1109, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2229, 101, 2133, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2230, 101, 2134, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2232, 101, 2135, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2234, 101, 2136, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2236, 101, 2137, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2238, 101, 2138, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2240, 101, 2139, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2242, 101, 2140, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2243, 101, 2141, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2244, 101, 2142, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2245, 101, 2143, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2246, 101, 2144, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2247, 101, 2145, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2248, 101, 2146, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2249, 101, 2147, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2250, 101, 100, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2251, 101, 2148, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2252, 101, 101, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2253, 101, 2149, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2254, 101, 102, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2255, 101, 2150, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2256, 101, 103, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2257, 101, 2151, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2258, 101, 104, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2259, 101, 2152, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2260, 101, 105, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2261, 101, 107, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2262, 101, 108, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2263, 101, 109, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2264, 101, 1138, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2265, 101, 1139, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2266, 101, 1140, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2267, 101, 1141, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2268, 101, 1142, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2269, 101, 1143, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2270, 101, 1224, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2271, 101, 1225, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2272, 101, 1226, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2273, 101, 1227, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2274, 101, 1228, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2275, 101, 1229, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2282, 101, 1261, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2283, 101, 1263, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2284, 101, 1264, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2285, 101, 1265, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2286, 101, 1266, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2287, 101, 1267, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2288, 101, 1001, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2289, 101, 1002, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2290, 101, 1003, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2291, 101, 1004, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2292, 101, 1005, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2293, 101, 1006, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2294, 101, 1007, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2295, 101, 1008, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2296, 101, 1009, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2297, 101, 1010, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2298, 101, 1011, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2299, 101, 1012, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2300, 101, 500, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2301, 101, 1013, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2302, 101, 501, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2303, 101, 1014, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2304, 101, 1015, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2305, 101, 1016, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2306, 101, 1017, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2307, 101, 1018, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2308, 101, 1019, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2309, 101, 1020, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2310, 101, 1021, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2311, 101, 1022, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2312, 101, 1023, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (5777, 101, 2739, '1', '2024-04-30 09:38:37', '1', '2024-04-30 09:38:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (5778, 101, 2740, '1', '2024-04-30 09:38:37', '1', '2024-04-30 09:38:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (5779, 2, 2739, '1', '2024-07-07 20:39:38', '1', '2024-07-07 20:39:38', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (5780, 2, 2740, '1', '2024-07-07 20:39:38', '1', '2024-07-07 20:39:38', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (5781, 2, 2758, '1', '2024-07-07 20:39:38', '1', '2024-07-07 20:39:38', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (5782, 2, 2759, '1', '2024-07-07 20:39:38', '1', '2024-07-07 20:39:38', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (5783, 2, 2362, '1', '2024-07-07 20:39:38', '1', '2024-07-07 20:39:38', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (5784, 2, 2387, '1', '2024-07-07 20:39:38', '1', '2024-07-07 20:39:38', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (5785, 2, 2030, '1', '2024-07-07 20:39:38', '1', '2024-07-07 20:39:38', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (5786, 101, 2758, '1', '2024-07-07 20:39:55', '1', '2024-07-07 20:39:55', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (5787, 101, 2759, '1', '2024-07-07 20:39:55', '1', '2024-07-07 20:39:55', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (5788, 101, 2783, '1', '2024-07-07 20:39:55', '1', '2024-07-07 20:39:55', b'0'); +COMMIT; + +-- ---------------------------- +-- Table structure for system_user_post +-- ---------------------------- +DROP TABLE IF EXISTS `system_user_post`; +CREATE TABLE `system_user_post` ( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id', + `user_id` bigint NOT NULL DEFAULT '0' COMMENT '用户ID', + `post_id` bigint NOT NULL DEFAULT '0' COMMENT '岗位ID', + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建者', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '更新者', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=126 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='用户岗位表'; + +-- ---------------------------- +-- Records of system_user_post +-- ---------------------------- +BEGIN; +INSERT INTO `system_user_post` (`id`, `user_id`, `post_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (112, 1, 1, 'admin', '2022-05-02 07:25:24', 'admin', '2022-05-02 07:25:24', b'0'); +COMMIT; + +-- ---------------------------- +-- Table structure for system_user_role +-- ---------------------------- +DROP TABLE IF EXISTS `system_user_role`; +CREATE TABLE `system_user_role` ( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '自增编号', + `user_id` bigint NOT NULL COMMENT '用户ID', + `role_id` bigint NOT NULL COMMENT '角色ID', + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建者', + `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '更新者', + `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `deleted` bit(1) DEFAULT b'0' COMMENT '是否删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=48 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='用户和角色关联表'; + +-- ---------------------------- +-- Records of system_user_role +-- ---------------------------- +BEGIN; +INSERT INTO `system_user_role` (`id`, `user_id`, `role_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1, 1, 1, '', '2022-01-11 13:19:45', '', '2022-05-12 12:35:17', b'0'); +COMMIT; + +-- ---------------------------- +-- Table structure for system_users +-- ---------------------------- +DROP TABLE IF EXISTS `system_users`; +CREATE TABLE `system_users` ( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '用户ID', + `username` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '用户账号', + `password` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '密码', + `nickname` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '用户昵称', + `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '备注', + `dept_id` bigint DEFAULT NULL COMMENT '部门ID', + `post_ids` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '岗位编号数组', + `email` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '用户邮箱', + `mobile` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '手机号码', + `sex` tinyint DEFAULT '0' COMMENT '用户性别', + `avatar` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '头像地址', + `status` tinyint NOT NULL DEFAULT '0' COMMENT '帐号状态(0正常 1停用)', + `login_ip` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '最后登录IP', + `login_date` datetime DEFAULT NULL COMMENT '最后登录时间', + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建者', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '更新者', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=140 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='用户信息表'; + +-- ---------------------------- +-- Records of system_users +-- ---------------------------- +BEGIN; +INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1, 'admin', '$2a$04$360poG67pqaEWbvXWhgOe.bdV5R30UW.e7/0p5OzAXh52IvllkkC2', '勇哥Java实战', '管理员', 103, '[1,2]', 'zhangyong7120180@163.com', '15011319235', 2, 'https://javayong.cn/logo.png', 0, '0:0:0:0:0:0:0:1', '2025-07-01 21:41:03', 'admin', '2021-01-05 17:03:47', NULL, '2025-07-01 21:41:03', b'0'); +COMMIT; + +SET FOREIGN_KEY_CHECKS = 1; diff --git a/doc/sql/mysql/quartz.sql b/doc/sql/mysql/quartz.sql new file mode 100644 index 0000000..21ae391 --- /dev/null +++ b/doc/sql/mysql/quartz.sql @@ -0,0 +1,284 @@ +/* + Navicat Premium Data Transfer + + Source Server : 127.0.0.1 MySQL + Source Server Type : MySQL + Source Server Version : 80200 (8.2.0) + Source Host : 127.0.0.1:3306 + Source Schema : ruoyi-vue-pro + + Target Server Type : MySQL + Target Server Version : 80200 (8.2.0) + File Encoding : 65001 + + Date: 24/07/2024 08:52:41 +*/ + +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + +-- ---------------------------- +-- Table structure for QRTZ_BLOB_TRIGGERS +-- ---------------------------- +DROP TABLE IF EXISTS `QRTZ_BLOB_TRIGGERS`; +CREATE TABLE `QRTZ_BLOB_TRIGGERS` ( + `SCHED_NAME` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `TRIGGER_NAME` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `TRIGGER_GROUP` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `BLOB_DATA` blob NULL, + PRIMARY KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) USING BTREE, + INDEX `SCHED_NAME`(`SCHED_NAME` ASC, `TRIGGER_NAME` ASC, `TRIGGER_GROUP` ASC) USING BTREE, + CONSTRAINT `qrtz_blob_triggers_ibfk_1` FOREIGN KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) REFERENCES `QRTZ_TRIGGERS` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) ON DELETE RESTRICT ON UPDATE RESTRICT +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; + +-- ---------------------------- +-- Records of QRTZ_BLOB_TRIGGERS +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for QRTZ_CALENDARS +-- ---------------------------- +DROP TABLE IF EXISTS `QRTZ_CALENDARS`; +CREATE TABLE `QRTZ_CALENDARS` ( + `SCHED_NAME` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `CALENDAR_NAME` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `CALENDAR` blob NOT NULL, + PRIMARY KEY (`SCHED_NAME`, `CALENDAR_NAME`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; + +-- ---------------------------- +-- Records of QRTZ_CALENDARS +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for QRTZ_CRON_TRIGGERS +-- ---------------------------- +DROP TABLE IF EXISTS `QRTZ_CRON_TRIGGERS`; +CREATE TABLE `QRTZ_CRON_TRIGGERS` ( + `SCHED_NAME` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `TRIGGER_NAME` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `TRIGGER_GROUP` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `CRON_EXPRESSION` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `TIME_ZONE_ID` varchar(80) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL, + PRIMARY KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) USING BTREE, + CONSTRAINT `qrtz_cron_triggers_ibfk_1` FOREIGN KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) REFERENCES `QRTZ_TRIGGERS` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) ON DELETE RESTRICT ON UPDATE RESTRICT +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; + +-- ---------------------------- +-- Records of QRTZ_CRON_TRIGGERS +-- ---------------------------- +BEGIN; +INSERT INTO `QRTZ_CRON_TRIGGERS` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`, `CRON_EXPRESSION`, `TIME_ZONE_ID`) VALUES ('schedulerName', 'accessLogCleanJob', 'DEFAULT', '0 0 0 * * ?', 'Asia/Shanghai'), ('schedulerName', 'brokerageRecordUnfreezeJob', 'DEFAULT', '0 * * * * ?', 'Asia/Shanghai'), ('schedulerName', 'errorLogCleanJob', 'DEFAULT', '0 0 0 * * ?', 'Asia/Shanghai'), ('schedulerName', 'jobLogCleanJob', 'DEFAULT', '0 0 0 * * ?', 'Asia/Shanghai'), ('schedulerName', 'payNotifyJob', 'DEFAULT', '* * * * * ?', 'Asia/Shanghai'), ('schedulerName', 'payOrderExpireJob', 'DEFAULT', '0 0/1 * * * ?', 'Asia/Shanghai'), ('schedulerName', 'payOrderSyncJob', 'DEFAULT', '0 0/1 * * * ?', 'Asia/Shanghai'), ('schedulerName', 'payRefundSyncJob', 'DEFAULT', '0 0/1 * * * ?', 'Asia/Shanghai'), ('schedulerName', 'tradeOrderAutoCancelJob', 'DEFAULT', '0 * * * * ?', 'Asia/Shanghai'), ('schedulerName', 'tradeOrderAutoCommentJob', 'DEFAULT', '0 * * * * ?', 'Asia/Shanghai'), ('schedulerName', 'tradeOrderAutoReceiveJob', 'DEFAULT', '0 * * * * ?', 'Asia/Shanghai'); +COMMIT; + +-- ---------------------------- +-- Table structure for QRTZ_FIRED_TRIGGERS +-- ---------------------------- +DROP TABLE IF EXISTS `QRTZ_FIRED_TRIGGERS`; +CREATE TABLE `QRTZ_FIRED_TRIGGERS` ( + `SCHED_NAME` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `ENTRY_ID` varchar(95) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `TRIGGER_NAME` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `TRIGGER_GROUP` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `INSTANCE_NAME` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `FIRED_TIME` bigint NOT NULL, + `SCHED_TIME` bigint NOT NULL, + `PRIORITY` int NOT NULL, + `STATE` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `JOB_NAME` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL, + `JOB_GROUP` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL, + `IS_NONCONCURRENT` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL, + `REQUESTS_RECOVERY` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL, + PRIMARY KEY (`SCHED_NAME`, `ENTRY_ID`) USING BTREE, + INDEX `IDX_QRTZ_FT_TRIG_INST_NAME`(`SCHED_NAME` ASC, `INSTANCE_NAME` ASC) USING BTREE, + INDEX `IDX_QRTZ_FT_INST_JOB_REQ_RCVRY`(`SCHED_NAME` ASC, `INSTANCE_NAME` ASC, `REQUESTS_RECOVERY` ASC) USING BTREE, + INDEX `IDX_QRTZ_FT_J_G`(`SCHED_NAME` ASC, `JOB_NAME` ASC, `JOB_GROUP` ASC) USING BTREE, + INDEX `IDX_QRTZ_FT_JG`(`SCHED_NAME` ASC, `JOB_GROUP` ASC) USING BTREE, + INDEX `IDX_QRTZ_FT_T_G`(`SCHED_NAME` ASC, `TRIGGER_NAME` ASC, `TRIGGER_GROUP` ASC) USING BTREE, + INDEX `IDX_QRTZ_FT_TG`(`SCHED_NAME` ASC, `TRIGGER_GROUP` ASC) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; + +-- ---------------------------- +-- Records of QRTZ_FIRED_TRIGGERS +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for QRTZ_JOB_DETAILS +-- ---------------------------- +DROP TABLE IF EXISTS `QRTZ_JOB_DETAILS`; +CREATE TABLE `QRTZ_JOB_DETAILS` ( + `SCHED_NAME` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `JOB_NAME` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `JOB_GROUP` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `DESCRIPTION` varchar(250) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL, + `JOB_CLASS_NAME` varchar(250) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `IS_DURABLE` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `IS_NONCONCURRENT` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `IS_UPDATE_DATA` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `REQUESTS_RECOVERY` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `JOB_DATA` blob NULL, + PRIMARY KEY (`SCHED_NAME`, `JOB_NAME`, `JOB_GROUP`) USING BTREE, + INDEX `IDX_QRTZ_J_REQ_RECOVERY`(`SCHED_NAME` ASC, `REQUESTS_RECOVERY` ASC) USING BTREE, + INDEX `IDX_QRTZ_J_GRP`(`SCHED_NAME` ASC, `JOB_GROUP` ASC) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; + +-- ---------------------------- +-- Records of QRTZ_JOB_DETAILS +-- ---------------------------- +BEGIN; +INSERT INTO `QRTZ_JOB_DETAILS` (`SCHED_NAME`, `JOB_NAME`, `JOB_GROUP`, `DESCRIPTION`, `JOB_CLASS_NAME`, `IS_DURABLE`, `IS_NONCONCURRENT`, `IS_UPDATE_DATA`, `REQUESTS_RECOVERY`, `JOB_DATA`) VALUES ('schedulerName', 'accessLogCleanJob', 'DEFAULT', NULL, 'cn.iocoder.yudao.framework.quartz.core.handler.JobHandlerInvoker', '0', '1', '1', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000027400064A4F425F49447372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000000000197400104A4F425F48414E444C45525F4E414D457400116163636573734C6F67436C65616E4A6F627800), ('schedulerName', 'brokerageRecordUnfreezeJob', 'DEFAULT', NULL, 'cn.iocoder.yudao.framework.quartz.core.handler.JobHandlerInvoker', '0', '1', '1', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000027400064A4F425F49447372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000000000187400104A4F425F48414E444C45525F4E414D4574001A62726F6B65726167655265636F7264556E667265657A654A6F627800), ('schedulerName', 'errorLogCleanJob', 'DEFAULT', NULL, 'cn.iocoder.yudao.framework.quartz.core.handler.JobHandlerInvoker', '0', '1', '1', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000027400064A4F425F49447372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B0200007870000000000000001A7400104A4F425F48414E444C45525F4E414D457400106572726F724C6F67436C65616E4A6F627800), ('schedulerName', 'jobLogCleanJob', 'DEFAULT', NULL, 'cn.iocoder.yudao.framework.quartz.core.handler.JobHandlerInvoker', '0', '1', '1', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000027400064A4F425F49447372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B0200007870000000000000001B7400104A4F425F48414E444C45525F4E414D4574000E6A6F624C6F67436C65616E4A6F627800), ('schedulerName', 'payNotifyJob', 'DEFAULT', NULL, 'cn.iocoder.yudao.framework.quartz.core.handler.JobHandlerInvoker', '0', '1', '1', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000027400064A4F425F49447372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000000000057400104A4F425F48414E444C45525F4E414D4574000C7061794E6F746966794A6F627800), ('schedulerName', 'payOrderExpireJob', 'DEFAULT', NULL, 'cn.iocoder.yudao.framework.quartz.core.handler.JobHandlerInvoker', '0', '1', '1', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000027400064A4F425F49447372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000000000127400104A4F425F48414E444C45525F4E414D457400117061794F726465724578706972654A6F627800), ('schedulerName', 'payOrderSyncJob', 'DEFAULT', NULL, 'cn.iocoder.yudao.framework.quartz.core.handler.JobHandlerInvoker', '0', '1', '1', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000027400064A4F425F49447372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000000000117400104A4F425F48414E444C45525F4E414D4574000F7061794F7264657253796E634A6F627800), ('schedulerName', 'payRefundSyncJob', 'DEFAULT', NULL, 'cn.iocoder.yudao.framework.quartz.core.handler.JobHandlerInvoker', '0', '1', '1', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000027400064A4F425F49447372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000000000137400104A4F425F48414E444C45525F4E414D45740010706179526566756E6453796E634A6F627800), ('schedulerName', 'tradeOrderAutoCancelJob', 'DEFAULT', NULL, 'cn.iocoder.yudao.framework.quartz.core.handler.JobHandlerInvoker', '0', '1', '1', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000027400064A4F425F49447372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000000000157400104A4F425F48414E444C45525F4E414D4574001774726164654F726465724175746F43616E63656C4A6F627800), ('schedulerName', 'tradeOrderAutoCommentJob', 'DEFAULT', NULL, 'cn.iocoder.yudao.framework.quartz.core.handler.JobHandlerInvoker', '0', '1', '1', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000027400064A4F425F49447372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000000000177400104A4F425F48414E444C45525F4E414D4574001874726164654F726465724175746F436F6D6D656E744A6F627800), ('schedulerName', 'tradeOrderAutoReceiveJob', 'DEFAULT', NULL, 'cn.iocoder.yudao.framework.quartz.core.handler.JobHandlerInvoker', '0', '1', '1', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000027400064A4F425F49447372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000000000167400104A4F425F48414E444C45525F4E414D4574001874726164654F726465724175746F526563656976654A6F627800); +COMMIT; + +-- ---------------------------- +-- Table structure for QRTZ_LOCKS +-- ---------------------------- +DROP TABLE IF EXISTS `QRTZ_LOCKS`; +CREATE TABLE `QRTZ_LOCKS` ( + `SCHED_NAME` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `LOCK_NAME` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + PRIMARY KEY (`SCHED_NAME`, `LOCK_NAME`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; + +-- ---------------------------- +-- Records of QRTZ_LOCKS +-- ---------------------------- +BEGIN; +INSERT INTO `QRTZ_LOCKS` (`SCHED_NAME`, `LOCK_NAME`) VALUES ('schedulerName', 'STATE_ACCESS'), ('schedulerName', 'TRIGGER_ACCESS'); +COMMIT; + +-- ---------------------------- +-- Table structure for QRTZ_PAUSED_TRIGGER_GRPS +-- ---------------------------- +DROP TABLE IF EXISTS `QRTZ_PAUSED_TRIGGER_GRPS`; +CREATE TABLE `QRTZ_PAUSED_TRIGGER_GRPS` ( + `SCHED_NAME` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `TRIGGER_GROUP` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + PRIMARY KEY (`SCHED_NAME`, `TRIGGER_GROUP`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; + +-- ---------------------------- +-- Records of QRTZ_PAUSED_TRIGGER_GRPS +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for QRTZ_SCHEDULER_STATE +-- ---------------------------- +DROP TABLE IF EXISTS `QRTZ_SCHEDULER_STATE`; +CREATE TABLE `QRTZ_SCHEDULER_STATE` ( + `SCHED_NAME` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `INSTANCE_NAME` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `LAST_CHECKIN_TIME` bigint NOT NULL, + `CHECKIN_INTERVAL` bigint NOT NULL, + PRIMARY KEY (`SCHED_NAME`, `INSTANCE_NAME`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; + +-- ---------------------------- +-- Records of QRTZ_SCHEDULER_STATE +-- ---------------------------- +BEGIN; +INSERT INTO `QRTZ_SCHEDULER_STATE` (`SCHED_NAME`, `INSTANCE_NAME`, `LAST_CHECKIN_TIME`, `CHECKIN_INTERVAL`) VALUES ('schedulerName', 'MacBook-Pro.local1713489703551', 1713742509534, 15000); +COMMIT; + +-- ---------------------------- +-- Table structure for QRTZ_SIMPLE_TRIGGERS +-- ---------------------------- +DROP TABLE IF EXISTS `QRTZ_SIMPLE_TRIGGERS`; +CREATE TABLE `QRTZ_SIMPLE_TRIGGERS` ( + `SCHED_NAME` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `TRIGGER_NAME` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `TRIGGER_GROUP` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `REPEAT_COUNT` bigint NOT NULL, + `REPEAT_INTERVAL` bigint NOT NULL, + `TIMES_TRIGGERED` bigint NOT NULL, + PRIMARY KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) USING BTREE, + CONSTRAINT `qrtz_simple_triggers_ibfk_1` FOREIGN KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) REFERENCES `QRTZ_TRIGGERS` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) ON DELETE RESTRICT ON UPDATE RESTRICT +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; + +-- ---------------------------- +-- Records of QRTZ_SIMPLE_TRIGGERS +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for QRTZ_SIMPROP_TRIGGERS +-- ---------------------------- +DROP TABLE IF EXISTS `QRTZ_SIMPROP_TRIGGERS`; +CREATE TABLE `QRTZ_SIMPROP_TRIGGERS` ( + `SCHED_NAME` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `TRIGGER_NAME` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `TRIGGER_GROUP` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `STR_PROP_1` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL, + `STR_PROP_2` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL, + `STR_PROP_3` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL, + `INT_PROP_1` int NULL DEFAULT NULL, + `INT_PROP_2` int NULL DEFAULT NULL, + `LONG_PROP_1` bigint NULL DEFAULT NULL, + `LONG_PROP_2` bigint NULL DEFAULT NULL, + `DEC_PROP_1` decimal(13, 4) NULL DEFAULT NULL, + `DEC_PROP_2` decimal(13, 4) NULL DEFAULT NULL, + `BOOL_PROP_1` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL, + `BOOL_PROP_2` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL, + PRIMARY KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) USING BTREE, + CONSTRAINT `qrtz_simprop_triggers_ibfk_1` FOREIGN KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) REFERENCES `QRTZ_TRIGGERS` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) ON DELETE RESTRICT ON UPDATE RESTRICT +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; + +-- ---------------------------- +-- Records of QRTZ_SIMPROP_TRIGGERS +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for QRTZ_TRIGGERS +-- ---------------------------- +DROP TABLE IF EXISTS `QRTZ_TRIGGERS`; +CREATE TABLE `QRTZ_TRIGGERS` ( + `SCHED_NAME` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `TRIGGER_NAME` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `TRIGGER_GROUP` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `JOB_NAME` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `JOB_GROUP` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `DESCRIPTION` varchar(250) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL, + `NEXT_FIRE_TIME` bigint NULL DEFAULT NULL, + `PREV_FIRE_TIME` bigint NULL DEFAULT NULL, + `PRIORITY` int NULL DEFAULT NULL, + `TRIGGER_STATE` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `TRIGGER_TYPE` varchar(8) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `START_TIME` bigint NOT NULL, + `END_TIME` bigint NULL DEFAULT NULL, + `CALENDAR_NAME` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL, + `MISFIRE_INSTR` smallint NULL DEFAULT NULL, + `JOB_DATA` blob NULL, + PRIMARY KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) USING BTREE, + INDEX `IDX_QRTZ_T_J`(`SCHED_NAME` ASC, `JOB_NAME` ASC, `JOB_GROUP` ASC) USING BTREE, + INDEX `IDX_QRTZ_T_JG`(`SCHED_NAME` ASC, `JOB_GROUP` ASC) USING BTREE, + INDEX `IDX_QRTZ_T_C`(`SCHED_NAME` ASC, `CALENDAR_NAME` ASC) USING BTREE, + INDEX `IDX_QRTZ_T_G`(`SCHED_NAME` ASC, `TRIGGER_GROUP` ASC) USING BTREE, + INDEX `IDX_QRTZ_T_STATE`(`SCHED_NAME` ASC, `TRIGGER_STATE` ASC) USING BTREE, + INDEX `IDX_QRTZ_T_N_STATE`(`SCHED_NAME` ASC, `TRIGGER_NAME` ASC, `TRIGGER_GROUP` ASC, `TRIGGER_STATE` ASC) USING BTREE, + INDEX `IDX_QRTZ_T_N_G_STATE`(`SCHED_NAME` ASC, `TRIGGER_GROUP` ASC, `TRIGGER_STATE` ASC) USING BTREE, + INDEX `IDX_QRTZ_T_NEXT_FIRE_TIME`(`SCHED_NAME` ASC, `NEXT_FIRE_TIME` ASC) USING BTREE, + INDEX `IDX_QRTZ_T_NFT_ST`(`SCHED_NAME` ASC, `TRIGGER_STATE` ASC, `NEXT_FIRE_TIME` ASC) USING BTREE, + INDEX `IDX_QRTZ_T_NFT_MISFIRE`(`SCHED_NAME` ASC, `MISFIRE_INSTR` ASC, `NEXT_FIRE_TIME` ASC) USING BTREE, + INDEX `IDX_QRTZ_T_NFT_ST_MISFIRE`(`SCHED_NAME` ASC, `MISFIRE_INSTR` ASC, `NEXT_FIRE_TIME` ASC, `TRIGGER_STATE` ASC) USING BTREE, + INDEX `IDX_QRTZ_T_NFT_ST_MISFIRE_GRP`(`SCHED_NAME` ASC, `MISFIRE_INSTR` ASC, `NEXT_FIRE_TIME` ASC, `TRIGGER_GROUP` ASC, `TRIGGER_STATE` ASC) USING BTREE, + CONSTRAINT `qrtz_triggers_ibfk_1` FOREIGN KEY (`SCHED_NAME`, `JOB_NAME`, `JOB_GROUP`) REFERENCES `QRTZ_JOB_DETAILS` (`SCHED_NAME`, `JOB_NAME`, `JOB_GROUP`) ON DELETE RESTRICT ON UPDATE RESTRICT +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; + +-- ---------------------------- +-- Records of QRTZ_TRIGGERS +-- ---------------------------- +BEGIN; +INSERT INTO `QRTZ_TRIGGERS` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`, `JOB_NAME`, `JOB_GROUP`, `DESCRIPTION`, `NEXT_FIRE_TIME`, `PREV_FIRE_TIME`, `PRIORITY`, `TRIGGER_STATE`, `TRIGGER_TYPE`, `START_TIME`, `END_TIME`, `CALENDAR_NAME`, `MISFIRE_INSTR`, `JOB_DATA`) VALUES ('schedulerName', 'accessLogCleanJob', 'DEFAULT', 'accessLogCleanJob', 'DEFAULT', NULL, 1696348800000, -1, 5, 'PAUSED', 'CRON', 1696301981000, 0, NULL, 0, 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000037400114A4F425F48414E444C45525F504152414D7400007400124A4F425F52455452595F494E54455256414C737200116A6176612E6C616E672E496E746567657212E2A0A4F781873802000149000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B02000078700000000074000F4A4F425F52455452595F434F554E547371007E000A000000037800), ('schedulerName', 'brokerageRecordUnfreezeJob', 'DEFAULT', 'brokerageRecordUnfreezeJob', 'DEFAULT', NULL, 1695909720000, -1, 5, 'PAUSED', 'CRON', 1695909706000, 0, NULL, 0, 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000037400114A4F425F48414E444C45525F504152414D7400007400124A4F425F52455452595F494E54455256414C737200116A6176612E6C616E672E496E746567657212E2A0A4F781873802000149000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B02000078700000000074000F4A4F425F52455452595F434F554E547371007E000A000000037800), ('schedulerName', 'errorLogCleanJob', 'DEFAULT', 'errorLogCleanJob', 'DEFAULT', NULL, 1696348800000, -1, 5, 'PAUSED', 'CRON', 1696302043000, 0, NULL, 0, 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000037400114A4F425F48414E444C45525F504152414D7400007400124A4F425F52455452595F494E54455256414C737200116A6176612E6C616E672E496E746567657212E2A0A4F781873802000149000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B02000078700000000074000F4A4F425F52455452595F434F554E547371007E000A000000037800), ('schedulerName', 'jobLogCleanJob', 'DEFAULT', 'jobLogCleanJob', 'DEFAULT', NULL, 1696348800000, -1, 5, 'PAUSED', 'CRON', 1696302092000, 0, NULL, 0, 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000037400114A4F425F48414E444C45525F504152414D7400007400124A4F425F52455452595F494E54455256414C737200116A6176612E6C616E672E496E746567657212E2A0A4F781873802000149000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B02000078700000000074000F4A4F425F52455452595F434F554E547371007E000A000000037800), ('schedulerName', 'payNotifyJob', 'DEFAULT', 'payNotifyJob', 'DEFAULT', NULL, 1688907102000, 1688907101000, 5, 'PAUSED', 'CRON', 1635294882000, 0, NULL, 0, 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000037400114A4F425F48414E444C45525F504152414D707400124A4F425F52455452595F494E54455256414C737200116A6176612E6C616E672E496E746567657212E2A0A4F781873802000149000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B02000078700000000074000F4A4F425F52455452595F434F554E5471007E000B7800), ('schedulerName', 'payOrderExpireJob', 'DEFAULT', 'payOrderExpireJob', 'DEFAULT', NULL, 1690011600000, -1, 5, 'PAUSED', 'CRON', 1690011553000, 0, NULL, 0, 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000037400114A4F425F48414E444C45525F504152414D707400124A4F425F52455452595F494E54455256414C737200116A6176612E6C616E672E496E746567657212E2A0A4F781873802000149000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B02000078700000000074000F4A4F425F52455452595F434F554E5471007E000B7800), ('schedulerName', 'payOrderSyncJob', 'DEFAULT', 'payOrderSyncJob', 'DEFAULT', NULL, 1690011600000, 1690011540000, 5, 'PAUSED', 'CRON', 1690007785000, 0, NULL, 0, 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000037400114A4F425F48414E444C45525F504152414D707400124A4F425F52455452595F494E54455256414C737200116A6176612E6C616E672E496E746567657212E2A0A4F781873802000149000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B02000078700000000074000F4A4F425F52455452595F434F554E5471007E000B7800), ('schedulerName', 'payRefundSyncJob', 'DEFAULT', 'payRefundSyncJob', 'DEFAULT', NULL, 1690117560000, 1690117500000, 5, 'PAUSED', 'CRON', 1690117424000, 0, NULL, 0, 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000037400114A4F425F48414E444C45525F504152414D707400124A4F425F52455452595F494E54455256414C737200116A6176612E6C616E672E496E746567657212E2A0A4F781873802000149000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B02000078700000000074000F4A4F425F52455452595F434F554E5471007E000B7800), ('schedulerName', 'tradeOrderAutoCancelJob', 'DEFAULT', 'tradeOrderAutoCancelJob', 'DEFAULT', NULL, 1695727440000, 1695727380000, 5, 'PAUSED', 'CRON', 1695656605000, 0, NULL, 0, 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000037400114A4F425F48414E444C45525F504152414D7400007400124A4F425F52455452595F494E54455256414C737200116A6176612E6C616E672E496E746567657212E2A0A4F781873802000149000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B02000078700000000074000F4A4F425F52455452595F434F554E547371007E000A000000037800), ('schedulerName', 'tradeOrderAutoCommentJob', 'DEFAULT', 'tradeOrderAutoCommentJob', 'DEFAULT', NULL, 1695783840000, 1695783780000, 5, 'PAUSED', 'CRON', 1695742709000, 0, NULL, 0, 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000037400114A4F425F48414E444C45525F504152414D7400007400124A4F425F52455452595F494E54455256414C737200116A6176612E6C616E672E496E746567657212E2A0A4F781873802000149000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B02000078700000000074000F4A4F425F52455452595F434F554E547371007E000A000000037800), ('schedulerName', 'tradeOrderAutoReceiveJob', 'DEFAULT', 'tradeOrderAutoReceiveJob', 'DEFAULT', NULL, 1695742740000, 1695742680000, 5, 'PAUSED', 'CRON', 1695727433000, 0, NULL, 0, 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000037400114A4F425F48414E444C45525F504152414D7400007400124A4F425F52455452595F494E54455256414C737200116A6176612E6C616E672E496E746567657212E2A0A4F781873802000149000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B02000078700000000074000F4A4F425F52455452595F434F554E547371007E000A000000037800); +COMMIT; + +SET FOREIGN_KEY_CHECKS = 1; diff --git a/doc/sql/mysql/sms.sql b/doc/sql/mysql/sms.sql new file mode 100644 index 0000000..44821cb --- /dev/null +++ b/doc/sql/mysql/sms.sql @@ -0,0 +1,392 @@ + +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + +-- ---------------------------- +-- Table structure for sms_channel_account +-- ---------------------------- +DROP TABLE IF EXISTS `sms_channel_account`; +CREATE TABLE `sms_channel_account` ( + `id` int NOT NULL AUTO_INCREMENT COMMENT '主键ID', + `channel_id` int NOT NULL COMMENT '逻辑关联渠道ID', + `channel_code` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '渠道标识(逻辑关联channel_info.code)', + `account_name` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '账号名称', + `app_key` varchar(80) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'API密钥', + `app_secret` varchar(80) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'API密钥', + `md5_value` char(32) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '关键字段MD5值(算法:MD5(channel_id|account_name|app_key|app_secret))', + `support_sms_type` json NOT NULL COMMENT '支持的短信类型[0:验证码,1:短信通知,2:推广短信,3:国际/港澳台消息]', + `ext_params` json DEFAULT NULL COMMENT '扩展参数', + `remark` varchar(200) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '备注', + `deleted` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0-正常 1-禁用', + `creator` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建人', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '更新人', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', + PRIMARY KEY (`id`), + UNIQUE KEY `uk_md5_value` (`md5_value`) COMMENT '防重复提交', + KEY `idx_channel_id` (`channel_id`), + KEY `idx_channel_code` (`channel_code`) +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='短信渠道账号表'; + +-- ---------------------------- +-- Records of sms_channel_account +-- ---------------------------- +BEGIN; +INSERT INTO `sms_channel_account` (`id`, `channel_id`, `channel_code`, `account_name`, `app_key`, `app_secret`, `md5_value`, `support_sms_type`, `ext_params`, `remark`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (1, 1, 'aliyun', '阿里云勇哥账号', '22333333aaaadafsadf', '23232aadafsfsdaaaa', '8de8d3023dc91845be26c49f0c926955', '[0, 1, 2, 3]', '{}', '', 0, '1', '2025-07-06 21:52:04', '1', '2025-07-07 11:22:09'); +COMMIT; + +-- ---------------------------- +-- Table structure for sms_channel_info +-- ---------------------------- +DROP TABLE IF EXISTS `sms_channel_info`; +CREATE TABLE `sms_channel_info` ( + `id` int NOT NULL AUTO_INCREMENT COMMENT '渠道ID', + `channel_name` varchar(30) COLLATE utf8mb4_general_ci NOT NULL COMMENT '渠道名称', + `channel_code` varchar(30) COLLATE utf8mb4_general_ci NOT NULL COMMENT '渠道标识(如:aliyun/tencent等)', + `domain_url` varchar(255) COLLATE utf8mb4_general_ci NOT NULL COMMENT '请求地址', + `label` varchar(100) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '渠道标签(逗号分隔)', + `deleted` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0-正常 1-禁用', + `support_apply_template` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否支持申请模板(1-支持 0-不支持)', + `support_apply_sign` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否支持申请签名(1-支持 0-不支持)', + `support_batch_send` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否支持批量发送(1-支持 0-不支持)', + `support_international` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否支持国际短信(1-支持 0-不支持)', + `support_query_template` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否支持查询模板信息(1-支持 0-不支持)', + `support_reply` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否支持上行回复(1-支持 0-不支持)', + `channel_properties` text COLLATE utf8mb4_general_ci COMMENT '渠道扩展属性(JSON格式配置/动态参数)', + `creator` varchar(64) COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '创建人', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '更新人', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='短信渠道配置表(含扩展属性字段)'; + +-- ---------------------------- +-- Records of sms_channel_info +-- ---------------------------- +BEGIN; +INSERT INTO `sms_channel_info` (`id`, `channel_name`, `channel_code`, `domain_url`, `label`, `deleted`, `support_apply_template`, `support_apply_sign`, `support_batch_send`, `support_international`, `support_query_template`, `support_reply`, `channel_properties`, `creator`, `create_time`, `updater`, `update_time`) VALUES (1, '阿里云', 'aliyun', 'https://dysmsapi.aliyuncs.com', '内置', 0, 0, 0, 0, 1, 0, 0, '{}', '1', '2025-07-03 19:37:14', '1', '2025-07-04 22:06:38'); +INSERT INTO `sms_channel_info` (`id`, `channel_name`, `channel_code`, `domain_url`, `label`, `deleted`, `support_apply_template`, `support_apply_sign`, `support_batch_send`, `support_international`, `support_query_template`, `support_reply`, `channel_properties`, `creator`, `create_time`, `updater`, `update_time`) VALUES (2, '腾讯云', 'tencent', 'https://sms.tencentcloudapi.com', '内置', 0, 1, 1, 1, 1, 1, 1, '{\"appId\":\"应用编号\"}', '1', '2025-07-03 21:10:35', '1', '2025-07-03 21:22:25'); +INSERT INTO `sms_channel_info` (`id`, `channel_name`, `channel_code`, `domain_url`, `label`, `deleted`, `support_apply_template`, `support_apply_sign`, `support_batch_send`, `support_international`, `support_query_template`, `support_reply`, `channel_properties`, `creator`, `create_time`, `updater`, `update_time`) VALUES (3, '合一短信', 'unisms', 'https://uni.apistd.com/', '内置', 0, 0, 0, 1, 1, 0, 0, '{\"signType\":\"签名方式:easy/sha256\"}', '1', '2025-07-03 21:13:43', '1', '2025-07-03 21:13:43'); +INSERT INTO `sms_channel_info` (`id`, `channel_name`, `channel_code`, `domain_url`, `label`, `deleted`, `support_apply_template`, `support_apply_sign`, `support_batch_send`, `support_international`, `support_query_template`, `support_reply`, `channel_properties`, `creator`, `create_time`, `updater`, `update_time`) VALUES (4, '亿美短信', 'emay', 'http://www.btom.cn', '内置', 0, 1, 0, 1, 1, 1, 0, NULL, '1', '2025-07-03 21:41:20', '1', '2025-07-03 21:41:20'); +COMMIT; + +SET FOREIGN_KEY_CHECKS = 1; + +-- 渠道管理 -- +INSERT INTO `marketing_admin`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (3000, '短信渠道', '', 1, 30, 0, '/smschannel', 'fa:address-card', NULL, NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2025-07-02 21:03:22', b'0'); +INSERT INTO `marketing_admin`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (5000, '渠道配置', '', 2, 0, 3000, 'sms-channel-info', 'fa:creative-commons', 'smschannel/smschannelinfo/index', 'SmsChannelInfo', 0, b'1', b'1', b'1', '', '2025-07-02 20:54:30', '1', '2025-07-02 21:03:41', b'0'); +INSERT INTO `marketing_admin`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (5001, '渠道配置查询', 't:sms-channel-info:query', 3, 1, 5000, '', '', '', '', 0, b'1', b'1', b'1', '', '2025-07-02 20:54:30', '1', '2025-07-02 20:58:34', b'0'); +INSERT INTO `marketing_admin`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (5002, '创建渠道配置', 't:sms-channel-info:create', 3, 2, 5000, '', '', '', '', 0, b'1', b'1', b'1', '', '2025-07-02 20:54:30', '1', '2025-07-02 20:58:46', b'0'); +INSERT INTO `marketing_admin`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (5003, '更新渠道配置', 't:sms-channel-info:update', 3, 3, 5000, '', '', '', '', 0, b'1', b'1', b'1', '', '2025-07-02 20:54:30', '1', '2025-07-02 20:59:01', b'0'); +INSERT INTO `marketing_admin`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (5004, '删除渠道配置', 't:sms-channel-info:delete', 3, 4, 5000, '', '', '', '', 0, b'1', b'1', b'1', '', '2025-07-02 20:54:30', '1', '2025-07-02 20:59:08', b'0'); +INSERT INTO `marketing_admin`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (5005, '导出渠道配置', 't:sms-channel-info:export', 3, 5, 5000, '', '', '', '', 0, b'1', b'1', b'1', '', '2025-07-02 20:54:30', '1', '2025-07-02 20:59:17', b'0'); +INSERT INTO `marketing_admin`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (5006, '渠道账号', '', 2, 0, 3000, 'channel-account', 'ep:film', 'smschannel/channelaccount/index', 'ChannelAccount', 0, b'1', b'1', b'1', '', '2025-07-05 23:46:12', '1', '2025-07-05 23:47:25', b'0'); +INSERT INTO `marketing_admin`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (5007, '短信渠道账号查询', 'smschannel:channel-account:query', 3, 1, 5006, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-07-05 23:46:12', '', '2025-07-05 23:46:12', b'0'); +INSERT INTO `marketing_admin`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (5008, '短信渠道账号创建', 'smschannel:channel-account:create', 3, 2, 5006, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-07-05 23:46:12', '', '2025-07-05 23:46:12', b'0'); +INSERT INTO `marketing_admin`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (5009, '短信渠道账号更新', 'smschannel:channel-account:update', 3, 3, 5006, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-07-05 23:46:12', '', '2025-07-05 23:46:12', b'0'); +INSERT INTO `marketing_admin`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (5010, '短信渠道账号删除', 'smschannel:channel-account:delete', 3, 4, 5006, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-07-05 23:46:12', '', '2025-07-05 23:46:12', b'0'); + +DROP TABLE IF EXISTS `sms_sign_info`; +CREATE TABLE `sms_sign_info` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID', + `sign_name` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '签名名称', + `tenant_id` bigint(20) NOT NULL DEFAULT '1' COMMENT '租户ID', + `sign_type` tinyint(3) NOT NULL DEFAULT '0' COMMENT '签名类型:0-企业,1-APP,2-商标,3-政府/事业单位/其他企业', + `international` tinyint(3) NOT NULL DEFAULT '0' COMMENT '短信区域:0-国内短信 1-国际/港澳台短信', + `binding_account_ids` json DEFAULT NULL COMMENT '绑定的账号ID集合(JSON数组格式,如 ["1001","1002"])', + `remark` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '备注说明', + `deleted` tinyint(1) NOT NULL DEFAULT '0' COMMENT '状态:0-正常,1-禁用', + `creator` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建人', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '更新人', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + PRIMARY KEY (`id`), + KEY `idx_sign_name` (`sign_name`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='短信签名信息表'; + +-- 国内短信 -- +INSERT INTO `marketing_admin`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6000, '国内短信', '', 1, 30, 0, '/domesticsms', 'fa:archive', NULL, NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2025-07-08 22:18:44', b'0'); +INSERT INTO `marketing_admin`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6002, '签名管理', '', 2, 0, 6000, 'sms-sign-info', 'fa:creative-commons', 'domesticsms/signinfo/index', 'SmsSignInfo', 0, b'1', b'1', b'1', '', '2025-07-08 17:00:51', '1', '2025-07-08 17:05:16', b'0'); +INSERT INTO `marketing_admin`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6003, '短信签名信息查询', 'sms:sign-info:query', 3, 1, 6002, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-07-08 17:00:51', '', '2025-07-08 17:00:51', b'0'); +INSERT INTO `marketing_admin`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6004, '短信签名信息创建', 'sms:sign-info:create', 3, 2, 6002, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-07-08 17:00:51', '', '2025-07-08 17:00:51', b'0'); +INSERT INTO `marketing_admin`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6005, '短信签名信息更新', 'sms:sign-info:update', 3, 3, 6002, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-07-08 17:00:51', '', '2025-07-08 17:00:51', b'0'); +INSERT INTO `marketing_admin`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6006, '短信签名信息删除', 'sms:sign-info:delete', 3, 4, 6002, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-07-08 17:00:51', '', '2025-07-08 17:00:51', b'0'); +INSERT INTO `marketing_admin`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6007, '短信签名信息导出', 'sms:sign-info:export', 3, 5, 6002, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-07-08 17:00:51', '', '2025-07-08 17:00:51', b'0'); +INSERT INTO `marketing_admin`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6008, '模板信息', '', 2, 0, 6000, 'templateinfo', 'ep:eleme-filled', 'domesticsms/templateinfo/index', 'TemplateInfo', 0, b'1', b'1', b'1', '', '2025-07-09 10:50:59', '1', '2025-07-14 11:02:47', b'0'); +INSERT INTO `marketing_admin`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6009, '短信模板信息查询', 'smschannel:template-info:query', 3, 1, 6008, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-07-09 10:50:59', '', '2025-07-09 10:50:59', b'0'); +INSERT INTO `marketing_admin`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6010, '短信模板信息创建', 'smschannel:template-info:create', 3, 2, 6008, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-07-09 10:50:59', '', '2025-07-09 10:50:59', b'0'); +INSERT INTO `marketing_admin`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6011, '短信模板信息更新', 'smschannel:template-info:update', 3, 3, 6008, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-07-09 10:50:59', '', '2025-07-09 10:50:59', b'0'); +INSERT INTO `marketing_admin`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6012, '短信模板信息删除', 'smschannel:template-info:delete', 3, 4, 6008, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-07-09 10:50:59', '', '2025-07-09 10:50:59', b'0'); +INSERT INTO `marketing_admin`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6013, '短信模板信息导出', 'smschannel:template-info:export', 3, 5, 6008, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-07-09 10:50:59', '', '2025-07-09 10:50:59', b'0'); +INSERT INTO `marketing_admin`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6020, '短信记录', '', 2, 0, 6000, 'record', 'ep:message', 'domesticsms/record/index', 'Record', 0, b'1', b'1', b'1', '', '2025-09-13 21:58:45', '1', '2025-09-13 22:01:28', b'0'); +INSERT INTO `marketing_admin`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6021, '短信记录查询', 'sms:record:query', 3, 1, 6020, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-09-13 21:58:45', '', '2025-09-13 21:58:45', b'0'); +INSERT INTO `marketing_admin`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6022, '短信记录创建', 'sms:record:create', 3, 2, 6020, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-09-13 21:58:45', '', '2025-09-13 21:58:45', b'0'); +INSERT INTO `marketing_admin`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6023, '短信记录更新', 'sms:record:update', 3, 3, 6020, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-09-13 21:58:45', '', '2025-09-13 21:58:45', b'0'); +INSERT INTO `marketing_admin`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6024, '短信记录删除', 'sms:record:delete', 3, 4, 6020, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-09-13 21:58:45', '', '2025-09-13 21:58:45', b'0'); +INSERT INTO `marketing_admin`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6025, '短信记录导出', 'sms:record:export', 3, 5, 6020, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-09-13 21:58:45', '', '2025-09-13 21:58:45', b'0'); + +INSERT INTO `marketing_admin`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6040, '发送任务', '', 2, 0, 6000, 'domesticsms/sendtask/index', 'fa:tasks', 'domesticsms/sendtask/index', 'SmsTask', 0, b'1', b'1', b'1', '', '2025-09-19 10:02:14', '1', '2025-09-19 10:06:55', b'0'); +INSERT INTO `marketing_admin`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6041, '短信任务查询', 'record:sms-task:query', 3, 1, 6040, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-09-19 10:02:14', '', '2025-09-19 10:02:14', b'0'); +INSERT INTO `marketing_admin`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6042, '短信任务创建', 'record:sms-task:create', 3, 2, 6040, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-09-19 10:02:14', '', '2025-09-19 10:02:14', b'0'); +INSERT INTO `marketing_admin`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6043, '短信任务更新', 'record:sms-task:update', 3, 3, 6040, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-09-19 10:02:14', '', '2025-09-19 10:02:14', b'0'); +INSERT INTO `marketing_admin`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6044, '短信任务删除', 'record:sms-task:delete', 3, 4, 6040, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-09-19 10:02:14', '', '2025-09-19 10:02:14', b'0'); +INSERT INTO `marketing_admin`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6045, '短信任务导出', 'record:sms-task:export', 3, 5, 6040, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-09-19 10:02:14', '', '2025-09-19 10:02:14', b'0'); + +-- 国际短信 -- +INSERT INTO `marketing_admin`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (7000, '国际短信', '', 1, 31, 0, '/internationalsms', 'fa:globe', NULL, NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2025-07-08 22:18:44', b'0'); +INSERT INTO `marketing_admin`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (7002, '签名管理', '', 2, 0, 7000, 'sms-sign-info', 'fa:creative-commons', 'internationalsms/signinfo/index', 'SmsSignInfo1', 0, b'1', b'1', b'1', '', '2025-07-08 17:00:51', '1', '2025-07-08 17:05:16', b'0'); +INSERT INTO `marketing_admin`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (7003, '短信签名信息查询', 'sms:sign-info:query', 3, 1, 7002, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-07-08 17:00:51', '', '2025-07-08 17:00:51', b'0'); +INSERT INTO `marketing_admin`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (7004, '短信签名信息创建', 'sms:sign-info:create', 3, 2, 7002, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-07-08 17:00:51', '', '2025-07-08 17:00:51', b'0'); +INSERT INTO `marketing_admin`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (7005, '短信签名信息更新', 'sms:sign-info:update', 3, 3, 7002, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-07-08 17:00:51', '', '2025-07-08 17:00:51', b'0'); +INSERT INTO `marketing_admin`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (7006, '短信签名信息删除', 'sms:sign-info:delete', 3, 4, 7002, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-07-08 17:00:51', '', '2025-07-08 17:00:51', b'0'); +INSERT INTO `marketing_admin`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (7007, '短信签名信息导出', 'sms:sign-info:export', 3, 5, 7002, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-07-08 17:00:51', '', '2025-07-08 17:00:51', b'0'); +INSERT INTO `marketing_admin`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (7008, '模板信息', '', 2, 0, 7000, 'templateinfo', 'ep:eleme-filled', 'internationalsms/templateinfo/index', 'TemplateInfo1', 0, b'1', b'1', b'1', '', '2025-07-09 10:50:59', '1', '2025-07-14 11:02:47', b'0'); +INSERT INTO `marketing_admin`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (7009, '短信模板信息查询', 'smschannel:template-info:query', 3, 1, 7008, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-07-09 10:50:59', '', '2025-07-09 10:50:59', b'0'); +INSERT INTO `marketing_admin`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (7010, '短信模板信息创建', 'smschannel:template-info:create', 3, 2, 7008, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-07-09 10:50:59', '', '2025-07-09 10:50:59', b'0'); +INSERT INTO `marketing_admin`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (7011, '短信模板信息更新', 'smschannel:template-info:update', 3, 3, 7008, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-07-09 10:50:59', '', '2025-07-09 10:50:59', b'0'); +INSERT INTO `marketing_admin`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (7012, '短信模板信息删除', 'smschannel:template-info:delete', 3, 4, 7008, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-07-09 10:50:59', '', '2025-07-09 10:50:59', b'0'); +INSERT INTO `marketing_admin`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (7013, '短信模板信息导出', 'smschannel:template-info:export', 3, 5, 7008, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-07-09 10:50:59', '', '2025-07-09 10:50:59', b'0'); +INSERT INTO `marketing_admin`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (7020, '短信记录', '', 2, 0, 7000, 'record', 'ep:message', 'internationalsms/record/index', 'Record1', 0, b'1', b'1', b'1', '', '2025-09-13 21:58:45', '1', '2025-09-13 22:01:28', b'0'); +INSERT INTO `marketing_admin`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (7021, '短信记录查询', 'sms:record:query', 3, 1, 7020, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-09-13 21:58:45', '', '2025-09-13 21:58:45', b'0'); +INSERT INTO `marketing_admin`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (7022, '短信记录创建', 'sms:record:create', 3, 2, 7020, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-09-13 21:58:45', '', '2025-09-13 21:58:45', b'0'); +INSERT INTO `marketing_admin`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (7023, '短信记录更新', 'sms:record:update', 3, 3, 7020, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-09-13 21:58:45', '', '2025-09-13 21:58:45', b'0'); +INSERT INTO `marketing_admin`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (7024, '短信记录删除', 'sms:record:delete', 3, 4, 7020, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-09-13 21:58:45', '', '2025-09-13 21:58:45', b'0'); +INSERT INTO `marketing_admin`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (7025, '短信记录导出', 'sms:record:export', 3, 5, 7020, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-09-13 21:58:45', '', '2025-09-13 21:58:45', b'0'); +INSERT INTO `marketing_admin`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (7040, '发送任务', '', 2, 0, 7000, 'internationalsms/sendtask/index', 'fa:tasks', 'internationalsms/sendtask/index', 'SmsTask1', 0, b'1', b'1', b'1', '', '2025-09-19 10:02:14', '1', '2025-09-19 10:06:55', b'0'); +INSERT INTO `marketing_admin`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (7041, '短信任务查询', 'record:sms-task:query', 3, 1, 7040, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-09-19 10:02:14', '', '2025-09-19 10:02:14', b'0'); +INSERT INTO `marketing_admin`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (7042, '短信任务创建', 'record:sms-task:create', 3, 2, 7040, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-09-19 10:02:14', '', '2025-09-19 10:02:14', b'0'); +INSERT INTO `marketing_admin`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (7043, '短信任务更新', 'record:sms-task:update', 3, 3, 7040, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-09-19 10:02:14', '', '2025-09-19 10:02:14', b'0'); +INSERT INTO `marketing_admin`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (7044, '短信任务删除', 'record:sms-task:delete', 3, 4, 7040, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-09-19 10:02:14', '', '2025-09-19 10:02:14', b'0'); +INSERT INTO `marketing_admin`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (7045, '短信任务导出', 'record:sms-task:export', 3, 5, 7040, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-09-19 10:02:14', '', '2025-09-19 10:02:14', b'0'); + +DROP TABLE IF EXISTS `sms_template_info`; +CREATE TABLE `sms_template_info` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '模板ID', + `template_name` varchar(64) NOT NULL COMMENT '模板名称', + `content` varchar(500) NOT NULL COMMENT '模板内容', + `sign_id` bigint(20) NOT NULL COMMENT '签名ID(关联签名表)', + `sign_name` varchar(32) NOT NULL COMMENT '签名名称(冗余存储)', + `template_type` tinyint(4) NOT NULL DEFAULT '0' COMMENT '模板类型:0-验证码 1-短信通知 2-推广短信', + `international` tinyint(3) NOT NULL DEFAULT '0' COMMENT '短信区域:0-国内短信 1-国际/港澳台短信', + `switch_open` tinyint(1) NOT NULL DEFAULT '1' COMMENT '启用开关:1-开启 0-关闭', + `deleted` tinyint(1) NOT NULL DEFAULT '0' COMMENT '删除状态:0-正常 1-删除', + `creator` varchar(64) DEFAULT '' COMMENT '创建人', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) DEFAULT '' COMMENT '更新人', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `remark` varchar(200) DEFAULT '' COMMENT '备注', + PRIMARY KEY (`id`), + KEY `idx_template_name` (`template_name`), + KEY `idx_sign_name` (`sign_name`), + KEY `idx_sign_id` (`sign_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='短信模板信息表'; + +-- 1. 删除原表(如果存在) +DROP TABLE IF EXISTS `sms_template_binding_info`; + +-- 2. 创建新表(包含 account_id 字段) +CREATE TABLE `sms_template_binding_info` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '绑定ID', + `template_id` bigint(20) NOT NULL COMMENT '模板ID', + `template_code` varchar(64) NOT NULL COMMENT '三方模板编码', + `template_content` varchar(500) NOT NULL COMMENT '三方模板内容', + `channel_id` bigint(20) NOT NULL COMMENT '渠道ID', + `channel_code` varchar(64) NOT NULL COMMENT '渠道标识', + `account_id` bigint(20) DEFAULT NULL COMMENT '渠道账户ID', + `status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '审核状态:0-待提交 1-待审核 2-审核成功 3-审核失败 4-撤销', + `deleted` tinyint(1) NOT NULL DEFAULT '0' COMMENT '删除状态:0-正常 1-删除', + `audit_remark` varchar(200) DEFAULT '' COMMENT '审核备注', + `creator` varchar(64) DEFAULT '' COMMENT '创建人', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) DEFAULT '' COMMENT '更新人', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + PRIMARY KEY (`id`), + UNIQUE KEY `uk_template_channel_account` (`template_id`, `channel_id`), + KEY `idx_template_id` (`template_id`), + KEY `idx_channel_id` (`channel_id`), + KEY `idx_account_id` (`account_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='短信模板渠道绑定表'; + +DROP TABLE IF EXISTS `sms_record`; +CREATE TABLE `sms_record` ( + `id` bigint(20) NOT NULL COMMENT '主键 雪花算法', + `task_id` bigint(20) NOT NULL COMMENT '任务编号', + `mobile` varchar(20) NOT NULL COMMENT '手机号', + `nationcode` varchar(10) NOT NULL DEFAULT '86' COMMENT '国际电话区号如 86', + `app_id` varchar(30) DEFAULT NULL COMMENT '调用服务方', + `record_type` tinyint(4) DEFAULT '0' COMMENT '0-验证码 1-短信通知 2-推广短信', + `template_id` bigint(20) NOT NULL COMMENT '模版编号', + `template_param` varchar(50) NOT NULL COMMENT '模版参数', + `content` varchar(500) NOT NULL COMMENT '短信内容', + `remark` varchar(500) DEFAULT '' COMMENT '备注(比如:发送失败原因)', + `attime` varchar(30) DEFAULT '' COMMENT '指定发送时间', + `send_status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '0:待发送 / 1:已发送 / 2:发送失败', + `international` tinyint(1) NOT NULL DEFAULT '0' COMMENT '短信类型:0-国内 1-国际', + `deleted` tinyint(1) NOT NULL DEFAULT '0' COMMENT '删除状态:0-正常 1-删除', + `creator` varchar(64) DEFAULT '' COMMENT '创建人', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) DEFAULT '' COMMENT '更新人', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + PRIMARY KEY (`id`), + KEY `idx_app_id` (`app_id`) USING BTREE, + KEY `idx_task_id` (`task_id`) USING BTREE COMMENT '任务编号索引', + KEY `idx_attime` (`attime`) USING BTREE COMMENT '延迟短信索引', + KEY `idx_create_time` (`create_time`) USING BTREE COMMENT '创建时间索引', + KEY `idx_mobile` (`mobile`) USING BTREE +) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COMMENT = '短信记录表'; + +-- ---------------------------- +-- Table structure for sms_record_detail +-- ---------------------------- +DROP TABLE IF EXISTS `sms_record_detail`; +CREATE TABLE `sms_record_detail` ( + `id` bigint(20) NOT NULL COMMENT '主键 雪花算法', + `record_id` bigint(20) NOT NULL COMMENT 'sms_record表外键', + `task_id` bigint(20) NOT NULL COMMENT '任务编号', + `app_id` varchar(30) NOT NULL COMMENT '调用服务方', + `mobile` varchar(20) NOT NULL COMMENT '手机号码', + `nationcode` varchar(10) NOT NULL DEFAULT '86' COMMENT '国际电话区号', + `send_status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '0:待发送 / 1:已发送 / 2:发送失败', + `report_status` tinyint(4) DEFAULT '0' COMMENT '短信报告 0:待回执 / 1:发送成功 / 2:发送失败', + `channel_code` varchar(30) NOT NULL COMMENT '渠道编码', + `channel_account_id` int(11) NOT NULL COMMENT '渠道账户ID', + `msgid` varchar(40) NOT NULL COMMENT '三方短信ID', + `error_msg` varchar(300) DEFAULT '' COMMENT '发送失败时,渠道返回的错误信息', + `price` decimal(10,6) DEFAULT NULL COMMENT '消费金额', + `sender_time` datetime DEFAULT NULL COMMENT '实际发送时间', + `deleted` tinyint(1) NOT NULL DEFAULT '0' COMMENT '删除状态:0-正常 1-删除', + `creator` varchar(64) DEFAULT '' COMMENT '创建人', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) DEFAULT '' COMMENT '更新人', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + PRIMARY KEY (`id`), + KEY `idx_record_id` (`record_id`) USING BTREE COMMENT '记录ID索引', + KEY `idx_task_id` (`task_id`) USING BTREE COMMENT '任务编号索引', + KEY `idx_app_id` (`app_id`) USING BTREE COMMENT '应用ID索引', + KEY `idx_msgid` (`msgid`) USING BTREE COMMENT '三方ID索引', + KEY `idx_sender_time` (`sender_time`) USING BTREE COMMENT '发送时间索引', + KEY `idx_create_time` (`create_time`) USING BTREE COMMENT '创建时间索引', + KEY `idx_mobile` (`mobile`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='短信记录详情表'; + +DROP TABLE IF EXISTS `sms_task`; +CREATE TABLE `sms_task` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '任务编号', + `app_id` bigint(20) NOT NULL COMMENT '应用编号', + `task_name` varchar(100) NOT NULL DEFAULT '' COMMENT '任务名称', + `sign_id` bigint(20) NOT NULL COMMENT '签名编号', + `sign_name` varchar(20) NOT NULL COMMENT '签名名称', + `template_id` bigint(20) NOT NULL COMMENT '模版编号', + `template_name` varchar(50) NOT NULL COMMENT '模版名称', + `template_content` text NOT NULL COMMENT '模版内容', + `template_param` varchar(500) NOT NULL COMMENT '模版参数', + `total_count` int(11) NOT NULL DEFAULT '0' COMMENT '手机总数量', + `success_count` int(11) NOT NULL DEFAULT '0' COMMENT '发送成功数量', + `fail_count` int(11) NOT NULL DEFAULT '0' COMMENT '发送失败数量', + `task_status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '任务状态:0-待发送 1-发送中 2-已完成 3-已取消', + `international` tinyint(1) NOT NULL DEFAULT '0' COMMENT '短信类型:0-国内 1-国际', + `load_to_queue` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否加载到队列:0-未加载 1-已加载', + `sender_ip` varchar(40) DEFAULT '' COMMENT '发送IP', + `attime` varchar(30) DEFAULT '' COMMENT '指定发送时间', + `remark` varchar(255) DEFAULT NULL COMMENT '备注信息', + `deleted` tinyint(1) NOT NULL DEFAULT '0' COMMENT '删除状态:0-正常 1-删除', + `creator` varchar(64) DEFAULT '' COMMENT '创建人', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) DEFAULT '' COMMENT '更新人', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `source` tinyint(2) NOT NULL DEFAULT '0' COMMENT '来源:0-网关 1-admin控制台上传', + PRIMARY KEY (`id`), + KEY `idx_app_id` (`app_id`), + KEY `idx_create_time` (`create_time`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='短信任务表'; + +DROP TABLE IF EXISTS `sms_task_content`; +CREATE TABLE `sms_task_content` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '任务编号', + `task_content` MEDIUMTEXT NOT NULL COMMENT '若无模板参数,则手机号码列表,手机号用英文逗号分隔 ,若模板参数,则手机号码列表,手机号用英文逗号分隔,参数用英文冒号分隔,参数格式为:手机号1^参数1^参数2^参数3,手机号2^参数1^参数2^参数3', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='短信任务内容表'; + +-- 租户管理 (租户以及下面的每个应用) -- +INSERT INTO `marketing_admin`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6026, '租户管理', '', 1, 21, 0, '/tenant/index', 'fa-solid:binoculars', '', '', 0, b'1', b'1', b'1', '1', '2025-09-15 19:28:25', '1', '2025-09-15 19:28:25', b'0'); +INSERT INTO `marketing_admin`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6027, '租户列表', '', 2, 0, 6026, 'tenant', 'fa:renren', '/tenant/index', 'SmsTenant', 0, b'1', b'1', b'1', '', '2025-09-15 19:28:43', '1', '2025-09-15 19:32:04', b'0'); +INSERT INTO `marketing_admin`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6028, '租户查询', 'sms:tenant:query', 3, 1, 6027, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-09-15 19:28:43', '', '2025-09-15 19:28:43', b'0'); +INSERT INTO `marketing_admin`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6029, '租户创建', 'sms:tenant:create', 3, 2, 6027, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-09-15 19:28:43', '', '2025-09-15 19:28:43', b'0'); +INSERT INTO `marketing_admin`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6030, '租户更新', 'sms:tenant:update', 3, 3, 6027, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-09-15 19:28:43', '', '2025-09-15 19:28:43', b'0'); +INSERT INTO `marketing_admin`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6031, '租户删除', 'sms:tenant:delete', 3, 4, 6027, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-09-15 19:28:43', '', '2025-09-15 19:28:43', b'0'); +INSERT INTO `marketing_admin`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6032, '租户导出', 'sms:tenant:export', 3, 5, 6027, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-09-15 19:28:43', '', '2025-09-15 19:28:43', b'0'); +INSERT INTO `marketing_admin`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6033, '应用列表', '', 2, 0, 6026, 'sms-appinfo', 'ep:apple', '/tenant/SmsAppinfo/index', 'SmsAppinfo', 0, b'1', b'1', b'1', '', '2025-09-15 19:28:56', '1', '2025-09-15 19:30:29', b'0'); +INSERT INTO `marketing_admin`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6034, '租户应用查询', 'tenant:sms-appinfo:query', 3, 1, 6033, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-09-15 19:28:56', '', '2025-09-15 19:28:56', b'0'); +INSERT INTO `marketing_admin`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6035, '租户应用创建', 'tenant:sms-appinfo:create', 3, 2, 6033, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-09-15 19:28:56', '', '2025-09-15 19:28:56', b'0'); +INSERT INTO `marketing_admin`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6036, '租户应用更新', 'tenant:sms-appinfo:update', 3, 3, 6033, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-09-15 19:28:56', '', '2025-09-15 19:28:56', b'0'); +INSERT INTO `marketing_admin`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6037, '租户应用删除', 'tenant:sms-appinfo:delete', 3, 4, 6033, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-09-15 19:28:56', '', '2025-09-15 19:28:56', b'0'); +INSERT INTO `marketing_admin`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6038, '租户应用导出', 'tenant:sms-appinfo:export', 3, 5, 6033, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-09-15 19:28:56', '', '2025-09-15 19:28:56', b'0'); + + +-- ---------------------------- +-- Table structure for sms_tenant +-- ---------------------------- +DROP TABLE IF EXISTS `sms_tenant`; +CREATE TABLE `sms_tenant` ( + `id` bigint(20) NOT NULL COMMENT '租户编号' AUTO_INCREMENT , + `tenant_user_name` varchar(100) NOT NULL COMMENT '租户用户名', + `password` varchar(100) NOT NULL COMMENT '密码', + `email` varchar(100) DEFAULT NULL COMMENT '邮箱', + `mobile` varchar(20) DEFAULT NULL COMMENT '手机号', + `nationcode` varchar(10) DEFAULT NULL COMMENT '手机国家编码', + `deleted` tinyint(1) NOT NULL DEFAULT '0' COMMENT '删除状态:0-正常 1-删除', + `creator` varchar(64) DEFAULT '' COMMENT '创建人', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) DEFAULT '' COMMENT '更新人', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + PRIMARY KEY (`id`), + UNIQUE KEY `uk_tenant_user_name` (`tenant_user_name`), + KEY `idx_email` (`email`), + KEY `idx_mobile` (`mobile`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='租户表'; + +INSERT INTO `marketing_admin`.`sms_tenant` (`id`, `tenant_user_name`, `password`, `email`, `mobile`, `nationcode`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (1, 'makemyownlife', '594B6D8465CB0EE37C51A113A4FD07E3', 'zhangyong7120180@163.com', '15011319235', NULL, 0, '1', '2025-09-15 16:40:27', '1', '2025-09-15 16:40:27'); + +-- ---------------------------- +-- Table structure for sms_appinfo +-- ---------------------------- +DROP TABLE IF EXISTS `sms_appinfo`; +CREATE TABLE `sms_appinfo` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '应用编号', + `tenant_id` bigint(20) NOT NULL DEFAULT '1' COMMENT '租户ID', + `app_key` varchar(20) NOT NULL COMMENT '应用密钥Key', + `app_name` varchar(40) NOT NULL DEFAULT '' COMMENT '应用名称', + `app_secret` varchar(100) NOT NULL COMMENT '应用密钥Secret', + `status` tinyint(4) DEFAULT '0' COMMENT '状态:0-有效 / 1-无效', + `remark` varchar(255) DEFAULT NULL COMMENT '备注信息', + `deleted` tinyint(1) NOT NULL DEFAULT '0' COMMENT '删除状态:0-正常 1-删除', + `creator` varchar(64) DEFAULT '' COMMENT '创建人', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) DEFAULT '' COMMENT '更新人', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COMMENT='租户应用表'; + +-- ---------------------------- +-- Records of sms_appinfo +-- ---------------------------- +BEGIN; +INSERT INTO `sms_appinfo` (`id`, `tenant_id`, `app_key`, `app_name`, `app_secret`, `status`, `remark`, `deleted`, `creator`, `updater`) +VALUES (1, 1, 'qQjEiFzn80v8VM4h', 'mydemo', '9c465ece754bd26a9be77f3d0e2606bd', 0, '例子', 0, 'system', 'system'); +COMMIT; + +INSERT INTO `marketing_admin`.`QRTZ_JOB_DETAILS` (`SCHED_NAME`, `JOB_NAME`, `JOB_GROUP`, `DESCRIPTION`, `JOB_CLASS_NAME`, `IS_DURABLE`, `IS_NONCONCURRENT`, `IS_UPDATE_DATA`, `REQUESTS_RECOVERY`, `JOB_DATA`) VALUES ('schedulerName', 'smsTemplateJob', 'DEFAULT', NULL, 'com.platform.marketing.framework.quartz.core.handler.JobHandlerInvoker', '0', '1', '1', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000027400064A4F425F49447372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000000000227400104A4F425F48414E444C45525F4E414D4574000E736D7354656D706C6174654A6F627800); + +-- INSERT INTO `marketing_admin`.`QRTZ_TRIGGERS` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`, `JOB_NAME`, `JOB_GROUP`, `DESCRIPTION`, `NEXT_FIRE_TIME`, `PREV_FIRE_TIME`, `PRIORITY`, `TRIGGER_STATE`, `TRIGGER_TYPE`, `START_TIME`, `END_TIME`, `CALENDAR_NAME`, `MISFIRE_INSTR`, `JOB_DATA`) VALUES ('schedulerName', 'smsTemplateJob', 'DEFAULT', 'smsTemplateJob', 'DEFAULT', NULL, 1758081600000, -1, 5, 'WAITING', 'CRON', 1758078283000, 0, NULL, 0, 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000037400114A4F425F48414E444C45525F504152414D7400007400124A4F425F52455452595F494E54455256414C737200116A6176612E6C616E672E496E746567657212E2A0A4F781873802000149000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B02000078700000138874000F4A4F425F52455452595F434F554E547371007E000A000000017800); + +-- INSERT INTO `marketing_admin`.`infra_job` (`id`, `name`, `status`, `handler_name`, `handler_param`, `cron_expression`, `retry_count`, `retry_interval`, `monitor_timeout`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (34, '自动向阿里云/腾讯云申请短信模版', 1, 'smsTemplateJob', '', '0 0 * * * ?', 1, 5000, 0, '1', '2025-09-17 11:04:44', '1', '2025-09-17 11:04:44', b'0'); + +INSERT INTO `marketing_admin`.`infra_job` (`id`, `name`, `status`, `handler_name`, `handler_param`, `cron_expression`, `retry_count`, `retry_interval`, `monitor_timeout`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (35, '每半个小时执行一次将 task的延迟内容加载到 MQ', 1, 'loadDelayShortMessageToMQJob', '', '* 0/30 * * * ?', 0, 0, 0, '1', '2025-10-12 10:47:32', '1', '2025-10-12 10:47:32', b'0'); + +INSERT INTO marketing_admin.QRTZ_JOB_DETAILS +(SCHED_NAME, JOB_NAME, JOB_GROUP, DESCRIPTION, JOB_CLASS_NAME, IS_DURABLE, IS_NONCONCURRENT, IS_UPDATE_DATA, REQUESTS_RECOVERY, JOB_DATA) +VALUES('schedulerName', 'loadDelayShortMessageToMQJob', 'DEFAULT', NULL, 'com.platform.marketing.framework.quartz.core.handler.JobHandlerInvoker', '0', '1', '1', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000027400064A4F425F49447372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000000000237400104A4F425F48414E444C45525F4E414D4574001C6C6F616444656C617953686F72744D657373616765546F4D514A6F627800); + +INSERT INTO `marketing_admin`.`QRTZ_TRIGGERS` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`, `JOB_NAME`, `JOB_GROUP`, `DESCRIPTION`, `NEXT_FIRE_TIME`, `PREV_FIRE_TIME`, `PRIORITY`, `TRIGGER_STATE`, `TRIGGER_TYPE`, `START_TIME`, `END_TIME`, `CALENDAR_NAME`, `MISFIRE_INSTR`, `JOB_DATA`) VALUES ('schedulerName', 'loadDelayShortMessageToMQJob', 'DEFAULT', 'loadDelayShortMessageToMQJob', 'DEFAULT', NULL, 1760238000000, -1, 5, 'WAITING', 'CRON', 1760237251000, 0, NULL, 0, 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000037400114A4F425F48414E444C45525F504152414D7400007400124A4F425F52455452595F494E54455256414C737200116A6176612E6C616E672E496E746567657212E2A0A4F781873802000149000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B02000078700000000074000F4A4F425F52455452595F434F554E5471007E000C7800); + +INSERT INTO `marketing_admin`.`QRTZ_CRON_TRIGGERS` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`, `CRON_EXPRESSION`, `TIME_ZONE_ID`) VALUES ('schedulerName', 'loadDelayShortMessageToMQJob', 'DEFAULT', '* 0/30 * * * ?', 'Asia/Shanghai'); \ No newline at end of file diff --git a/doc/sql/mysql/smspro_admin.sql b/doc/sql/mysql/smspro_admin.sql new file mode 100644 index 0000000..3b08f25 --- /dev/null +++ b/doc/sql/mysql/smspro_admin.sql @@ -0,0 +1,2721 @@ +/* + Navicat Premium Dump SQL + + Source Server : localhost-mac + Source Server Type : MySQL + Source Server Version : 80300 (8.3.0) + Source Host : localhost:3306 + Source Schema : smspro_admin + + Target Server Type : MySQL + Target Server Version : 80300 (8.3.0) + File Encoding : 65001 + + Date: 02/06/2026 19:37:17 +*/ + +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + +-- ---------------------------- +-- Table structure for infra_codegen_column +-- ---------------------------- +DROP TABLE IF EXISTS `infra_codegen_column`; +CREATE TABLE `infra_codegen_column` ( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号', + `table_id` bigint NOT NULL COMMENT '表编号', + `column_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '字段名', + `data_type` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '字段类型', + `column_comment` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '字段描述', + `nullable` bit(1) NOT NULL COMMENT '是否允许为空', + `primary_key` bit(1) NOT NULL COMMENT '是否主键', + `ordinal_position` int NOT NULL COMMENT '排序', + `java_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Java 属性类型', + `java_field` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Java 属性名', + `dict_type` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '字典类型', + `example` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '数据示例', + `create_operation` bit(1) NOT NULL COMMENT '是否为 Create 创建操作的字段', + `update_operation` bit(1) NOT NULL COMMENT '是否为 Update 更新操作的字段', + `list_operation` bit(1) NOT NULL COMMENT '是否为 List 查询操作的字段', + `list_operation_condition` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '=' COMMENT 'List 查询操作的条件类型', + `list_operation_result` bit(1) NOT NULL COMMENT '是否为 List 查询操作的返回字段', + `html_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '显示类型', + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建者', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '更新者', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=2564 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='代码生成表字段定义'; + +-- ---------------------------- +-- Records of infra_codegen_column +-- ---------------------------- +BEGIN; +INSERT INTO `infra_codegen_column` (`id`, `table_id`, `column_name`, `data_type`, `column_comment`, `nullable`, `primary_key`, `ordinal_position`, `java_type`, `java_field`, `dict_type`, `example`, `create_operation`, `update_operation`, `list_operation`, `list_operation_condition`, `list_operation_result`, `html_type`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2538, 191, 'id', 'BIGINT', '编号', b'0', b'1', 1, 'Long', 'id', '', '13987', b'0', b'1', b'0', '=', b'1', 'input', '1', '2025-04-09 17:40:21', '1', '2025-06-30 22:53:54', b'1'); +INSERT INTO `infra_codegen_column` (`id`, `table_id`, `column_name`, `data_type`, `column_comment`, `nullable`, `primary_key`, `ordinal_position`, `java_type`, `java_field`, `dict_type`, `example`, `create_operation`, `update_operation`, `list_operation`, `list_operation_condition`, `list_operation_result`, `html_type`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2539, 191, 'name', 'VARCHAR', '名字', b'0', b'0', 2, 'String', 'name', '', '芋艿', b'1', b'1', b'1', 'LIKE', b'1', 'input', '1', '2025-04-09 17:40:21', '1', '2025-06-30 22:53:54', b'1'); +INSERT INTO `infra_codegen_column` (`id`, `table_id`, `column_name`, `data_type`, `column_comment`, `nullable`, `primary_key`, `ordinal_position`, `java_type`, `java_field`, `dict_type`, `example`, `create_operation`, `update_operation`, `list_operation`, `list_operation_condition`, `list_operation_result`, `html_type`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2540, 191, 'sex', 'TINYINT', '性别', b'0', b'0', 3, 'Integer', 'sex', '', NULL, b'1', b'1', b'1', '=', b'1', 'radio', '1', '2025-04-09 17:40:21', '1', '2025-06-30 22:53:54', b'1'); +INSERT INTO `infra_codegen_column` (`id`, `table_id`, `column_name`, `data_type`, `column_comment`, `nullable`, `primary_key`, `ordinal_position`, `java_type`, `java_field`, `dict_type`, `example`, `create_operation`, `update_operation`, `list_operation`, `list_operation_condition`, `list_operation_result`, `html_type`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2541, 191, 'birthday', 'TIMESTAMP', '出生日期', b'0', b'0', 4, 'LocalDateTime', 'birthday', '', NULL, b'1', b'1', b'1', '=', b'1', 'datetime', '1', '2025-04-09 17:40:21', '1', '2025-06-30 22:53:54', b'1'); +INSERT INTO `infra_codegen_column` (`id`, `table_id`, `column_name`, `data_type`, `column_comment`, `nullable`, `primary_key`, `ordinal_position`, `java_type`, `java_field`, `dict_type`, `example`, `create_operation`, `update_operation`, `list_operation`, `list_operation_condition`, `list_operation_result`, `html_type`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2542, 191, 'description', 'VARCHAR', '简介', b'0', b'0', 5, 'String', 'description', '', '你说的对', b'1', b'1', b'1', '=', b'1', 'editor', '1', '2025-04-09 17:40:21', '1', '2025-06-30 22:53:54', b'1'); +INSERT INTO `infra_codegen_column` (`id`, `table_id`, `column_name`, `data_type`, `column_comment`, `nullable`, `primary_key`, `ordinal_position`, `java_type`, `java_field`, `dict_type`, `example`, `create_operation`, `update_operation`, `list_operation`, `list_operation_condition`, `list_operation_result`, `html_type`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2543, 191, 'creator', 'VARCHAR', '创建者', b'1', b'0', 6, 'String', 'creator', '', NULL, b'0', b'0', b'0', '=', b'0', 'input', '1', '2025-04-09 17:40:21', '1', '2025-06-30 22:53:54', b'1'); +INSERT INTO `infra_codegen_column` (`id`, `table_id`, `column_name`, `data_type`, `column_comment`, `nullable`, `primary_key`, `ordinal_position`, `java_type`, `java_field`, `dict_type`, `example`, `create_operation`, `update_operation`, `list_operation`, `list_operation_condition`, `list_operation_result`, `html_type`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2544, 191, 'create_time', 'TIMESTAMP', '创建时间', b'0', b'0', 7, 'LocalDateTime', 'createTime', '', NULL, b'0', b'0', b'1', 'BETWEEN', b'1', 'datetime', '1', '2025-04-09 17:40:21', '1', '2025-06-30 22:53:54', b'1'); +INSERT INTO `infra_codegen_column` (`id`, `table_id`, `column_name`, `data_type`, `column_comment`, `nullable`, `primary_key`, `ordinal_position`, `java_type`, `java_field`, `dict_type`, `example`, `create_operation`, `update_operation`, `list_operation`, `list_operation_condition`, `list_operation_result`, `html_type`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2545, 191, 'updater', 'VARCHAR', '更新者', b'1', b'0', 8, 'String', 'updater', '', NULL, b'0', b'0', b'0', '=', b'0', 'input', '1', '2025-04-09 17:40:21', '1', '2025-06-30 22:53:54', b'1'); +INSERT INTO `infra_codegen_column` (`id`, `table_id`, `column_name`, `data_type`, `column_comment`, `nullable`, `primary_key`, `ordinal_position`, `java_type`, `java_field`, `dict_type`, `example`, `create_operation`, `update_operation`, `list_operation`, `list_operation_condition`, `list_operation_result`, `html_type`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2546, 191, 'update_time', 'TIMESTAMP', '更新时间', b'0', b'0', 9, 'LocalDateTime', 'updateTime', '', NULL, b'0', b'0', b'0', 'BETWEEN', b'0', 'datetime', '1', '2025-04-09 17:40:21', '1', '2025-06-30 22:53:54', b'1'); +INSERT INTO `infra_codegen_column` (`id`, `table_id`, `column_name`, `data_type`, `column_comment`, `nullable`, `primary_key`, `ordinal_position`, `java_type`, `java_field`, `dict_type`, `example`, `create_operation`, `update_operation`, `list_operation`, `list_operation_condition`, `list_operation_result`, `html_type`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2547, 191, 'deleted', 'BIT', '是否删除', b'0', b'0', 10, 'Boolean', 'deleted', '', NULL, b'0', b'0', b'0', '=', b'0', 'radio', '1', '2025-04-09 17:40:21', '1', '2025-06-30 22:53:54', b'1'); +INSERT INTO `infra_codegen_column` (`id`, `table_id`, `column_name`, `data_type`, `column_comment`, `nullable`, `primary_key`, `ordinal_position`, `java_type`, `java_field`, `dict_type`, `example`, `create_operation`, `update_operation`, `list_operation`, `list_operation_condition`, `list_operation_result`, `html_type`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2548, 191, 'tenant_id', 'BIGINT', '租户编号', b'0', b'0', 11, 'Long', 'tenantId', '', '12608', b'0', b'0', b'0', '=', b'0', 'input', '1', '2025-04-09 17:40:21', '1', '2025-06-30 22:53:54', b'1'); +INSERT INTO `infra_codegen_column` (`id`, `table_id`, `column_name`, `data_type`, `column_comment`, `nullable`, `primary_key`, `ordinal_position`, `java_type`, `java_field`, `dict_type`, `example`, `create_operation`, `update_operation`, `list_operation`, `list_operation_condition`, `list_operation_result`, `html_type`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2549, 192, 'id', 'INTEGER', '编号', b'0', b'1', 1, 'Integer', 'id', '', '14447', b'0', b'1', b'0', '=', b'1', 'input', '1', '2025-06-30 22:54:01', '1', '2025-06-30 22:54:01', b'0'); +INSERT INTO `infra_codegen_column` (`id`, `table_id`, `column_name`, `data_type`, `column_comment`, `nullable`, `primary_key`, `ordinal_position`, `java_type`, `java_field`, `dict_type`, `example`, `create_operation`, `update_operation`, `list_operation`, `list_operation_condition`, `list_operation_result`, `html_type`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2550, 192, 'name', 'VARCHAR', '模型名称', b'1', b'0', 2, 'String', 'name', '', '张三', b'1', b'1', b'1', 'LIKE', b'1', 'input', '1', '2025-06-30 22:54:01', '1', '2025-06-30 22:54:01', b'0'); +INSERT INTO `infra_codegen_column` (`id`, `table_id`, `column_name`, `data_type`, `column_comment`, `nullable`, `primary_key`, `ordinal_position`, `java_type`, `java_field`, `dict_type`, `example`, `create_operation`, `update_operation`, `list_operation`, `list_operation_condition`, `list_operation_result`, `html_type`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2551, 192, 'model', 'VARCHAR', '模型标志', b'1', b'0', 3, 'String', 'model', '', NULL, b'1', b'1', b'1', '=', b'1', 'input', '1', '2025-06-30 22:54:01', '1', '2025-06-30 22:54:01', b'0'); +INSERT INTO `infra_codegen_column` (`id`, `table_id`, `column_name`, `data_type`, `column_comment`, `nullable`, `primary_key`, `ordinal_position`, `java_type`, `java_field`, `dict_type`, `example`, `create_operation`, `update_operation`, `list_operation`, `list_operation_condition`, `list_operation_result`, `html_type`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2552, 192, 'platform', 'VARCHAR', '平台', b'1', b'0', 4, 'String', 'platform', '', NULL, b'1', b'1', b'1', '=', b'1', 'input', '1', '2025-06-30 22:54:01', '1', '2025-06-30 22:54:01', b'0'); +INSERT INTO `infra_codegen_column` (`id`, `table_id`, `column_name`, `data_type`, `column_comment`, `nullable`, `primary_key`, `ordinal_position`, `java_type`, `java_field`, `dict_type`, `example`, `create_operation`, `update_operation`, `list_operation`, `list_operation_condition`, `list_operation_result`, `html_type`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2553, 192, 'type', 'INTEGER', '类型', b'1', b'0', 5, 'Integer', 'type', '', '1', b'1', b'1', b'1', '=', b'1', 'select', '1', '2025-06-30 22:54:01', '1', '2025-06-30 22:54:01', b'0'); +INSERT INTO `infra_codegen_column` (`id`, `table_id`, `column_name`, `data_type`, `column_comment`, `nullable`, `primary_key`, `ordinal_position`, `java_type`, `java_field`, `dict_type`, `example`, `create_operation`, `update_operation`, `list_operation`, `list_operation_condition`, `list_operation_result`, `html_type`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2554, 192, 'sort', 'INTEGER', '排序值', b'1', b'0', 6, 'Integer', 'sort', '', NULL, b'1', b'1', b'1', '=', b'1', 'input', '1', '2025-06-30 22:54:01', '1', '2025-06-30 22:54:01', b'0'); +INSERT INTO `infra_codegen_column` (`id`, `table_id`, `column_name`, `data_type`, `column_comment`, `nullable`, `primary_key`, `ordinal_position`, `java_type`, `java_field`, `dict_type`, `example`, `create_operation`, `update_operation`, `list_operation`, `list_operation_condition`, `list_operation_result`, `html_type`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2555, 192, 'status', 'INTEGER', '状态', b'1', b'0', 7, 'Integer', 'status', '', '1', b'1', b'1', b'1', '=', b'1', 'radio', '1', '2025-06-30 22:54:01', '1', '2025-06-30 22:54:01', b'0'); +INSERT INTO `infra_codegen_column` (`id`, `table_id`, `column_name`, `data_type`, `column_comment`, `nullable`, `primary_key`, `ordinal_position`, `java_type`, `java_field`, `dict_type`, `example`, `create_operation`, `update_operation`, `list_operation`, `list_operation_condition`, `list_operation_result`, `html_type`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2556, 192, 'temperature', 'DOUBLE', '温度参数', b'1', b'0', 8, 'Double', 'temperature', '', NULL, b'1', b'1', b'1', '=', b'1', 'input', '1', '2025-06-30 22:54:01', '1', '2025-06-30 22:54:01', b'0'); +INSERT INTO `infra_codegen_column` (`id`, `table_id`, `column_name`, `data_type`, `column_comment`, `nullable`, `primary_key`, `ordinal_position`, `java_type`, `java_field`, `dict_type`, `example`, `create_operation`, `update_operation`, `list_operation`, `list_operation_condition`, `list_operation_result`, `html_type`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2557, 192, 'max_tokens', 'INTEGER', '单条回复的最大 Token 数量', b'1', b'0', 9, 'Integer', 'maxTokens', '', NULL, b'1', b'1', b'1', '=', b'1', 'input', '1', '2025-06-30 22:54:01', '1', '2025-06-30 22:54:01', b'0'); +INSERT INTO `infra_codegen_column` (`id`, `table_id`, `column_name`, `data_type`, `column_comment`, `nullable`, `primary_key`, `ordinal_position`, `java_type`, `java_field`, `dict_type`, `example`, `create_operation`, `update_operation`, `list_operation`, `list_operation_condition`, `list_operation_result`, `html_type`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2558, 192, 'max_contexts', 'INTEGER', '上下文的最大 Message 数量', b'1', b'0', 10, 'Integer', 'maxContexts', '', NULL, b'1', b'1', b'1', '=', b'1', 'input', '1', '2025-06-30 22:54:01', '1', '2025-06-30 22:54:01', b'0'); +INSERT INTO `infra_codegen_column` (`id`, `table_id`, `column_name`, `data_type`, `column_comment`, `nullable`, `primary_key`, `ordinal_position`, `java_type`, `java_field`, `dict_type`, `example`, `create_operation`, `update_operation`, `list_operation`, `list_operation_condition`, `list_operation_result`, `html_type`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2559, 192, 'create_time', 'TIMESTAMP', '创建时间', b'1', b'0', 11, 'LocalDateTime', 'createTime', '', NULL, b'0', b'0', b'1', 'BETWEEN', b'1', 'datetime', '1', '2025-06-30 22:54:01', '1', '2025-06-30 22:54:01', b'0'); +INSERT INTO `infra_codegen_column` (`id`, `table_id`, `column_name`, `data_type`, `column_comment`, `nullable`, `primary_key`, `ordinal_position`, `java_type`, `java_field`, `dict_type`, `example`, `create_operation`, `update_operation`, `list_operation`, `list_operation_condition`, `list_operation_result`, `html_type`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2560, 192, 'update_time', 'TIMESTAMP', '更新时间', b'1', b'0', 12, 'LocalDateTime', 'updateTime', '', NULL, b'0', b'0', b'0', 'BETWEEN', b'0', 'datetime', '1', '2025-06-30 22:54:01', '1', '2025-06-30 22:54:01', b'0'); +INSERT INTO `infra_codegen_column` (`id`, `table_id`, `column_name`, `data_type`, `column_comment`, `nullable`, `primary_key`, `ordinal_position`, `java_type`, `java_field`, `dict_type`, `example`, `create_operation`, `update_operation`, `list_operation`, `list_operation_condition`, `list_operation_result`, `html_type`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2561, 192, 'creator', 'VARCHAR', '创建者', b'1', b'0', 13, 'String', 'creator', '', NULL, b'0', b'0', b'0', '=', b'0', 'input', '1', '2025-06-30 22:54:01', '1', '2025-06-30 22:54:01', b'0'); +INSERT INTO `infra_codegen_column` (`id`, `table_id`, `column_name`, `data_type`, `column_comment`, `nullable`, `primary_key`, `ordinal_position`, `java_type`, `java_field`, `dict_type`, `example`, `create_operation`, `update_operation`, `list_operation`, `list_operation_condition`, `list_operation_result`, `html_type`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2562, 192, 'updater', 'VARCHAR', '更新者', b'1', b'0', 14, 'String', 'updater', '', NULL, b'0', b'0', b'0', '=', b'0', 'input', '1', '2025-06-30 22:54:02', '1', '2025-06-30 22:54:02', b'0'); +INSERT INTO `infra_codegen_column` (`id`, `table_id`, `column_name`, `data_type`, `column_comment`, `nullable`, `primary_key`, `ordinal_position`, `java_type`, `java_field`, `dict_type`, `example`, `create_operation`, `update_operation`, `list_operation`, `list_operation_condition`, `list_operation_result`, `html_type`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2563, 192, 'deleted', 'BIT', '是否删除', b'1', b'0', 15, 'Boolean', 'deleted', '', NULL, b'0', b'0', b'0', '=', b'0', 'radio', '1', '2025-06-30 22:54:02', '1', '2025-06-30 22:54:02', b'0'); +COMMIT; + +-- ---------------------------- +-- Table structure for infra_codegen_table +-- ---------------------------- +DROP TABLE IF EXISTS `infra_codegen_table`; +CREATE TABLE `infra_codegen_table` ( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号', + `data_source_config_id` bigint NOT NULL COMMENT '数据源配置的编号', + `scene` tinyint NOT NULL DEFAULT '1' COMMENT '生成场景', + `table_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '表名称', + `table_comment` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '表描述', + `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '备注', + `module_name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '模块名', + `business_name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '业务名', + `class_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '类名称', + `class_comment` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '类描述', + `author` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '作者', + `template_type` tinyint NOT NULL DEFAULT '1' COMMENT '模板类型', + `front_type` tinyint NOT NULL COMMENT '前端类型', + `parent_menu_id` bigint DEFAULT NULL COMMENT '父菜单编号', + `master_table_id` bigint DEFAULT NULL COMMENT '主表的编号', + `sub_join_column_id` bigint DEFAULT NULL COMMENT '子表关联主表的字段编号', + `sub_join_many` bit(1) DEFAULT NULL COMMENT '主表与子表是否一对多', + `tree_parent_column_id` bigint DEFAULT NULL COMMENT '树表的父字段编号', + `tree_name_column_id` bigint DEFAULT NULL COMMENT '树表的名字字段编号', + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建者', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '更新者', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=193 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='代码生成表定义'; + +-- ---------------------------- +-- Records of infra_codegen_table +-- ---------------------------- +BEGIN; +INSERT INTO `infra_codegen_table` (`id`, `data_source_config_id`, `scene`, `table_name`, `table_comment`, `remark`, `module_name`, `business_name`, `class_name`, `class_comment`, `author`, `template_type`, `front_type`, `parent_menu_id`, `master_table_id`, `sub_join_column_id`, `sub_join_many`, `tree_parent_column_id`, `tree_name_column_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (191, 0, 1, 'yudao_demo03_student', '学生表', NULL, 'yudao', 'demo03student', 'Demo03Student', '学生', '勇哥Java实战', 1, 20, NULL, NULL, NULL, NULL, NULL, NULL, '1', '2025-04-09 17:40:21', '1', '2025-06-30 22:53:54', b'1'); +INSERT INTO `infra_codegen_table` (`id`, `data_source_config_id`, `scene`, `table_name`, `table_comment`, `remark`, `module_name`, `business_name`, `class_name`, `class_comment`, `author`, `template_type`, `front_type`, `parent_menu_id`, `master_table_id`, `sub_join_column_id`, `sub_join_many`, `tree_parent_column_id`, `tree_name_column_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (192, 0, 1, 'ai_model', 'AI模型表', NULL, 'ai', 'model', 'Model', 'AI模型', 'admin', 1, 20, NULL, NULL, NULL, NULL, NULL, NULL, '1', '2025-06-30 22:54:01', '1', '2025-06-30 22:54:01', b'0'); +COMMIT; + +-- ---------------------------- +-- Table structure for infra_config +-- ---------------------------- +DROP TABLE IF EXISTS `infra_config`; +CREATE TABLE `infra_config` ( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '参数主键', + `category` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '参数分组', + `type` tinyint NOT NULL COMMENT '参数类型', + `name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '参数名称', + `config_key` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '参数键名', + `value` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '参数键值', + `visible` bit(1) NOT NULL COMMENT '是否可见', + `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '备注', + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建者', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '更新者', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='参数配置表'; + +-- ---------------------------- +-- Records of infra_config +-- ---------------------------- +BEGIN; +INSERT INTO `infra_config` (`id`, `category`, `type`, `name`, `config_key`, `value`, `visible`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2, 'biz', 1, '用户管理-账号初始密码', 'system.user.init-password', '123456', b'0', '初始化密码 123456', 'admin', '2021-01-05 17:03:48', '1', '2024-07-20 17:22:47', b'0'); +INSERT INTO `infra_config` (`id`, `category`, `type`, `name`, `config_key`, `value`, `visible`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (10, 'url', 2, 'Swagger 接口文档的地址', 'url.swagger', '', b'1', '', '1', '2023-04-07 13:41:16', '1', '2023-04-07 14:59:00', b'0'); +INSERT INTO `infra_config` (`id`, `category`, `type`, `name`, `config_key`, `value`, `visible`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (12, 'test2', 2, 'test3', 'test4', 'test5', b'1', 'test6', '1', '2023-12-03 09:55:16', '1', '2023-12-03 09:55:27', b'0'); +COMMIT; + +-- ---------------------------- +-- Table structure for infra_data_source_config +-- ---------------------------- +DROP TABLE IF EXISTS `infra_data_source_config`; +CREATE TABLE `infra_data_source_config` ( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键编号', + `name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '参数名称', + `url` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '数据源连接', + `username` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '用户名', + `password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '密码', + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建者', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '更新者', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='数据源配置表'; + +-- ---------------------------- +-- Records of infra_data_source_config +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for infra_file +-- ---------------------------- +DROP TABLE IF EXISTS `infra_file`; +CREATE TABLE `infra_file` ( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '文件编号', + `config_id` bigint DEFAULT NULL COMMENT '配置编号', + `name` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '文件名', + `path` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '文件路径', + `url` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '文件 URL', + `type` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '文件类型', + `size` int NOT NULL COMMENT '文件大小', + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建者', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '更新者', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=1657 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='文件表'; + +-- ---------------------------- +-- Records of infra_file +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for infra_file_config +-- ---------------------------- +DROP TABLE IF EXISTS `infra_file_config`; +CREATE TABLE `infra_file_config` ( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号', + `name` varchar(63) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '配置名', + `storage` tinyint NOT NULL COMMENT '存储器', + `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '备注', + `master` bit(1) NOT NULL COMMENT '是否为主配置', + `config` varchar(4096) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '存储配置', + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建者', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '更新者', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=29 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='文件配置表'; + +-- ---------------------------- +-- Records of infra_file_config +-- ---------------------------- +BEGIN; +INSERT INTO `infra_file_config` (`id`, `name`, `storage`, `remark`, `master`, `config`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (4, '数据库(示例)', 1, '我是数据库', b'0', '{\"@class\":\"cn.iocoder.yudao.module.infra.framework.file.core.client.db.DBFileClientConfig\",\"domain\":\"http://127.0.0.1:48080\"}', '1', '2022-03-15 23:56:24', '1', '2024-11-09 18:09:28', b'0'); +INSERT INTO `infra_file_config` (`id`, `name`, `storage`, `remark`, `master`, `config`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (22, '七牛存储器(示例)', 20, '请换成你自己的密钥!!!', b'1', '{\"@class\":\"cn.iocoder.yudao.module.infra.framework.file.core.client.s3.S3FileClientConfig\",\"endpoint\":\"s3.cn-south-1.qiniucs.com\",\"domain\":\"http://test.yudao.iocoder.cn\",\"bucket\":\"ruoyi-vue-pro\",\"accessKey\":\"3TvrJ70gl2Gt6IBe7_IZT1F6i_k0iMuRtyEv4EyS\",\"accessSecret\":\"wd0tbVBYlp0S-ihA8Qg2hPLncoP83wyrIq24OZuY\"}', '1', '2024-01-13 22:11:12', '1', '2024-11-09 18:09:28', b'0'); +INSERT INTO `infra_file_config` (`id`, `name`, `storage`, `remark`, `master`, `config`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (24, '腾讯云存储(示例)', 20, '请换成你的密钥!!!', b'0', '{\"@class\":\"cn.iocoder.yudao.module.infra.framework.file.core.client.s3.S3FileClientConfig\",\"endpoint\":\"https://cos.ap-shanghai.myqcloud.com\",\"domain\":\"http://tengxun-oss.iocoder.cn\",\"bucket\":\"aoteman-1255880240\",\"accessKey\":\"AKIDAF6WSh1uiIjwqtrOsGSN3WryqTM6cTMt\",\"accessSecret\":\"X\"}', '1', '2024-11-09 16:03:22', '1', '2024-11-09 18:15:39', b'0'); +INSERT INTO `infra_file_config` (`id`, `name`, `storage`, `remark`, `master`, `config`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (25, '阿里云存储(示例)', 20, '', b'0', '{\"@class\":\"cn.iocoder.yudao.module.infra.framework.file.core.client.s3.S3FileClientConfig\",\"endpoint\":\"oss-cn-beijing.aliyuncs.com\",\"domain\":\"http://ali-oss.iocoder.cn\",\"bucket\":\"yunai-aoteman\",\"accessKey\":\"LTAI5tEQLgnDyjh3WpNcdMKA\",\"accessSecret\":\"X\"}', '1', '2024-11-09 16:47:08', '1', '2024-11-09 18:15:43', b'0'); +INSERT INTO `infra_file_config` (`id`, `name`, `storage`, `remark`, `master`, `config`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (26, '火山云存储(示例)', 20, '', b'0', '{\"@class\":\"cn.iocoder.yudao.module.infra.framework.file.core.client.s3.S3FileClientConfig\",\"endpoint\":\"tos-s3-cn-beijing.volces.com\",\"domain\":null,\"bucket\":\"yunai\",\"accessKey\":\"AKLTZjc3Zjc4MzZmMjU3NDk0ZTgxYmIyMmFkNTIwMDI1ZGE\",\"accessSecret\":\"X==\"}', '1', '2024-11-09 16:56:42', '1', '2024-11-09 18:15:46', b'0'); +INSERT INTO `infra_file_config` (`id`, `name`, `storage`, `remark`, `master`, `config`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (27, '华为云存储(示例)', 20, '', b'0', '{\"@class\":\"cn.iocoder.yudao.module.infra.framework.file.core.client.s3.S3FileClientConfig\",\"endpoint\":\"obs.cn-east-3.myhuaweicloud.com\",\"domain\":\"\",\"bucket\":\"yudao\",\"accessKey\":\"PVDONDEIOTW88LF8DC4U\",\"accessSecret\":\"X\"}', '1', '2024-11-09 17:18:41', '1', '2024-11-09 18:15:49', b'0'); +INSERT INTO `infra_file_config` (`id`, `name`, `storage`, `remark`, `master`, `config`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (28, 'MinIO 存储(示例)', 20, '', b'0', '{\"@class\":\"cn.iocoder.yudao.module.infra.framework.file.core.client.s3.S3FileClientConfig\",\"endpoint\":\"http://127.0.0.1:9000\",\"domain\":\"http://127.0.0.1:9000/yudao\",\"bucket\":\"yudao\",\"accessKey\":\"admin\",\"accessSecret\":\"password\"}', '1', '2024-11-09 17:43:10', '1', '2024-11-09 18:15:52', b'0'); +COMMIT; + +-- ---------------------------- +-- Table structure for infra_file_content +-- ---------------------------- +DROP TABLE IF EXISTS `infra_file_content`; +CREATE TABLE `infra_file_content` ( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号', + `config_id` bigint NOT NULL COMMENT '配置编号', + `path` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '文件路径', + `content` mediumblob NOT NULL COMMENT '文件内容', + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建者', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '更新者', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=283 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='文件表'; + +-- ---------------------------- +-- Records of infra_file_content +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for infra_job +-- ---------------------------- +DROP TABLE IF EXISTS `infra_job`; +CREATE TABLE `infra_job` ( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '任务编号', + `name` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '任务名称', + `status` tinyint NOT NULL COMMENT '任务状态', + `handler_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '处理器的名字', + `handler_param` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '处理器的参数', + `cron_expression` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'CRON 表达式', + `retry_count` int NOT NULL DEFAULT '0' COMMENT '重试次数', + `retry_interval` int NOT NULL DEFAULT '0' COMMENT '重试间隔', + `monitor_timeout` int NOT NULL DEFAULT '0' COMMENT '监控超时时间', + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建者', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '更新者', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=34 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='定时任务表'; + +-- ---------------------------- +-- Records of infra_job +-- ---------------------------- +BEGIN; +INSERT INTO `infra_job` (`id`, `name`, `status`, `handler_name`, `handler_param`, `cron_expression`, `retry_count`, `retry_interval`, `monitor_timeout`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (33, 'demoJob', 2, 'demoJob', '', '0 * * * * ?', 1, 1, 0, '1', '2024-10-27 19:38:46', '1', '2024-10-27 19:40:23', b'0'); +COMMIT; + +-- ---------------------------- +-- Table structure for infra_job_log +-- ---------------------------- +DROP TABLE IF EXISTS `infra_job_log`; +CREATE TABLE `infra_job_log` ( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '日志编号', + `job_id` bigint NOT NULL COMMENT '任务编号', + `handler_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '处理器的名字', + `handler_param` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '处理器的参数', + `execute_index` tinyint NOT NULL DEFAULT '1' COMMENT '第几次执行', + `begin_time` datetime NOT NULL COMMENT '开始执行时间', + `end_time` datetime DEFAULT NULL COMMENT '结束执行时间', + `duration` int DEFAULT NULL COMMENT '执行时长', + `status` tinyint NOT NULL COMMENT '任务状态', + `result` varchar(4000) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '结果数据', + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建者', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '更新者', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=638 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='定时任务日志表'; + +-- ---------------------------- +-- Records of infra_job_log +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for QRTZ_BLOB_TRIGGERS +-- ---------------------------- +DROP TABLE IF EXISTS `QRTZ_BLOB_TRIGGERS`; +CREATE TABLE `QRTZ_BLOB_TRIGGERS` ( + `SCHED_NAME` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `TRIGGER_NAME` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `TRIGGER_GROUP` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `BLOB_DATA` blob, + PRIMARY KEY (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`) USING BTREE, + KEY `SCHED_NAME` (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`) USING BTREE, + CONSTRAINT `qrtz_blob_triggers_ibfk_1` FOREIGN KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) REFERENCES `QRTZ_TRIGGERS` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) ON DELETE RESTRICT ON UPDATE RESTRICT +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- ---------------------------- +-- Records of QRTZ_BLOB_TRIGGERS +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for QRTZ_CALENDARS +-- ---------------------------- +DROP TABLE IF EXISTS `QRTZ_CALENDARS`; +CREATE TABLE `QRTZ_CALENDARS` ( + `SCHED_NAME` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `CALENDAR_NAME` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `CALENDAR` blob NOT NULL, + PRIMARY KEY (`SCHED_NAME`,`CALENDAR_NAME`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- ---------------------------- +-- Records of QRTZ_CALENDARS +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for QRTZ_CRON_TRIGGERS +-- ---------------------------- +DROP TABLE IF EXISTS `QRTZ_CRON_TRIGGERS`; +CREATE TABLE `QRTZ_CRON_TRIGGERS` ( + `SCHED_NAME` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `TRIGGER_NAME` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `TRIGGER_GROUP` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `CRON_EXPRESSION` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `TIME_ZONE_ID` varchar(80) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + PRIMARY KEY (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`) USING BTREE, + CONSTRAINT `qrtz_cron_triggers_ibfk_1` FOREIGN KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) REFERENCES `QRTZ_TRIGGERS` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) ON DELETE RESTRICT ON UPDATE RESTRICT +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- ---------------------------- +-- Records of QRTZ_CRON_TRIGGERS +-- ---------------------------- +BEGIN; +INSERT INTO `QRTZ_CRON_TRIGGERS` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`, `CRON_EXPRESSION`, `TIME_ZONE_ID`) VALUES ('schedulerName', 'accessLogCleanJob', 'DEFAULT', '0 0 0 * * ?', 'Asia/Shanghai'); +INSERT INTO `QRTZ_CRON_TRIGGERS` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`, `CRON_EXPRESSION`, `TIME_ZONE_ID`) VALUES ('schedulerName', 'brokerageRecordUnfreezeJob', 'DEFAULT', '0 * * * * ?', 'Asia/Shanghai'); +INSERT INTO `QRTZ_CRON_TRIGGERS` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`, `CRON_EXPRESSION`, `TIME_ZONE_ID`) VALUES ('schedulerName', 'errorLogCleanJob', 'DEFAULT', '0 0 0 * * ?', 'Asia/Shanghai'); +INSERT INTO `QRTZ_CRON_TRIGGERS` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`, `CRON_EXPRESSION`, `TIME_ZONE_ID`) VALUES ('schedulerName', 'jobLogCleanJob', 'DEFAULT', '0 0 0 * * ?', 'Asia/Shanghai'); +INSERT INTO `QRTZ_CRON_TRIGGERS` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`, `CRON_EXPRESSION`, `TIME_ZONE_ID`) VALUES ('schedulerName', 'payNotifyJob', 'DEFAULT', '* * * * * ?', 'Asia/Shanghai'); +INSERT INTO `QRTZ_CRON_TRIGGERS` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`, `CRON_EXPRESSION`, `TIME_ZONE_ID`) VALUES ('schedulerName', 'payOrderExpireJob', 'DEFAULT', '0 0/1 * * * ?', 'Asia/Shanghai'); +INSERT INTO `QRTZ_CRON_TRIGGERS` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`, `CRON_EXPRESSION`, `TIME_ZONE_ID`) VALUES ('schedulerName', 'payOrderSyncJob', 'DEFAULT', '0 0/1 * * * ?', 'Asia/Shanghai'); +INSERT INTO `QRTZ_CRON_TRIGGERS` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`, `CRON_EXPRESSION`, `TIME_ZONE_ID`) VALUES ('schedulerName', 'payRefundSyncJob', 'DEFAULT', '0 0/1 * * * ?', 'Asia/Shanghai'); +INSERT INTO `QRTZ_CRON_TRIGGERS` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`, `CRON_EXPRESSION`, `TIME_ZONE_ID`) VALUES ('schedulerName', 'tradeOrderAutoCancelJob', 'DEFAULT', '0 * * * * ?', 'Asia/Shanghai'); +INSERT INTO `QRTZ_CRON_TRIGGERS` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`, `CRON_EXPRESSION`, `TIME_ZONE_ID`) VALUES ('schedulerName', 'tradeOrderAutoCommentJob', 'DEFAULT', '0 * * * * ?', 'Asia/Shanghai'); +INSERT INTO `QRTZ_CRON_TRIGGERS` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`, `CRON_EXPRESSION`, `TIME_ZONE_ID`) VALUES ('schedulerName', 'tradeOrderAutoReceiveJob', 'DEFAULT', '0 * * * * ?', 'Asia/Shanghai'); +COMMIT; + +-- ---------------------------- +-- Table structure for QRTZ_FIRED_TRIGGERS +-- ---------------------------- +DROP TABLE IF EXISTS `QRTZ_FIRED_TRIGGERS`; +CREATE TABLE `QRTZ_FIRED_TRIGGERS` ( + `SCHED_NAME` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `ENTRY_ID` varchar(95) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `TRIGGER_NAME` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `TRIGGER_GROUP` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `INSTANCE_NAME` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `FIRED_TIME` bigint NOT NULL, + `SCHED_TIME` bigint NOT NULL, + `PRIORITY` int NOT NULL, + `STATE` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `JOB_NAME` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `JOB_GROUP` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `IS_NONCONCURRENT` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `REQUESTS_RECOVERY` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + PRIMARY KEY (`SCHED_NAME`,`ENTRY_ID`) USING BTREE, + KEY `IDX_QRTZ_FT_TRIG_INST_NAME` (`SCHED_NAME`,`INSTANCE_NAME`) USING BTREE, + KEY `IDX_QRTZ_FT_INST_JOB_REQ_RCVRY` (`SCHED_NAME`,`INSTANCE_NAME`,`REQUESTS_RECOVERY`) USING BTREE, + KEY `IDX_QRTZ_FT_J_G` (`SCHED_NAME`,`JOB_NAME`,`JOB_GROUP`) USING BTREE, + KEY `IDX_QRTZ_FT_JG` (`SCHED_NAME`,`JOB_GROUP`) USING BTREE, + KEY `IDX_QRTZ_FT_T_G` (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`) USING BTREE, + KEY `IDX_QRTZ_FT_TG` (`SCHED_NAME`,`TRIGGER_GROUP`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- ---------------------------- +-- Records of QRTZ_FIRED_TRIGGERS +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for QRTZ_JOB_DETAILS +-- ---------------------------- +DROP TABLE IF EXISTS `QRTZ_JOB_DETAILS`; +CREATE TABLE `QRTZ_JOB_DETAILS` ( + `SCHED_NAME` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `JOB_NAME` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `JOB_GROUP` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `DESCRIPTION` varchar(250) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `JOB_CLASS_NAME` varchar(250) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `IS_DURABLE` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `IS_NONCONCURRENT` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `IS_UPDATE_DATA` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `REQUESTS_RECOVERY` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `JOB_DATA` blob, + PRIMARY KEY (`SCHED_NAME`,`JOB_NAME`,`JOB_GROUP`) USING BTREE, + KEY `IDX_QRTZ_J_REQ_RECOVERY` (`SCHED_NAME`,`REQUESTS_RECOVERY`) USING BTREE, + KEY `IDX_QRTZ_J_GRP` (`SCHED_NAME`,`JOB_GROUP`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- ---------------------------- +-- Records of QRTZ_JOB_DETAILS +-- ---------------------------- +BEGIN; +INSERT INTO `QRTZ_JOB_DETAILS` (`SCHED_NAME`, `JOB_NAME`, `JOB_GROUP`, `DESCRIPTION`, `JOB_CLASS_NAME`, `IS_DURABLE`, `IS_NONCONCURRENT`, `IS_UPDATE_DATA`, `REQUESTS_RECOVERY`, `JOB_DATA`) VALUES ('schedulerName', 'accessLogCleanJob', 'DEFAULT', NULL, 'cn.iocoder.yudao.framework.quartz.core.handler.JobHandlerInvoker', '0', '1', '1', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000027400064A4F425F49447372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000000000197400104A4F425F48414E444C45525F4E414D457400116163636573734C6F67436C65616E4A6F627800); +INSERT INTO `QRTZ_JOB_DETAILS` (`SCHED_NAME`, `JOB_NAME`, `JOB_GROUP`, `DESCRIPTION`, `JOB_CLASS_NAME`, `IS_DURABLE`, `IS_NONCONCURRENT`, `IS_UPDATE_DATA`, `REQUESTS_RECOVERY`, `JOB_DATA`) VALUES ('schedulerName', 'brokerageRecordUnfreezeJob', 'DEFAULT', NULL, 'cn.iocoder.yudao.framework.quartz.core.handler.JobHandlerInvoker', '0', '1', '1', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000027400064A4F425F49447372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000000000187400104A4F425F48414E444C45525F4E414D4574001A62726F6B65726167655265636F7264556E667265657A654A6F627800); +INSERT INTO `QRTZ_JOB_DETAILS` (`SCHED_NAME`, `JOB_NAME`, `JOB_GROUP`, `DESCRIPTION`, `JOB_CLASS_NAME`, `IS_DURABLE`, `IS_NONCONCURRENT`, `IS_UPDATE_DATA`, `REQUESTS_RECOVERY`, `JOB_DATA`) VALUES ('schedulerName', 'errorLogCleanJob', 'DEFAULT', NULL, 'cn.iocoder.yudao.framework.quartz.core.handler.JobHandlerInvoker', '0', '1', '1', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000027400064A4F425F49447372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B0200007870000000000000001A7400104A4F425F48414E444C45525F4E414D457400106572726F724C6F67436C65616E4A6F627800); +INSERT INTO `QRTZ_JOB_DETAILS` (`SCHED_NAME`, `JOB_NAME`, `JOB_GROUP`, `DESCRIPTION`, `JOB_CLASS_NAME`, `IS_DURABLE`, `IS_NONCONCURRENT`, `IS_UPDATE_DATA`, `REQUESTS_RECOVERY`, `JOB_DATA`) VALUES ('schedulerName', 'jobLogCleanJob', 'DEFAULT', NULL, 'cn.iocoder.yudao.framework.quartz.core.handler.JobHandlerInvoker', '0', '1', '1', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000027400064A4F425F49447372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B0200007870000000000000001B7400104A4F425F48414E444C45525F4E414D4574000E6A6F624C6F67436C65616E4A6F627800); +INSERT INTO `QRTZ_JOB_DETAILS` (`SCHED_NAME`, `JOB_NAME`, `JOB_GROUP`, `DESCRIPTION`, `JOB_CLASS_NAME`, `IS_DURABLE`, `IS_NONCONCURRENT`, `IS_UPDATE_DATA`, `REQUESTS_RECOVERY`, `JOB_DATA`) VALUES ('schedulerName', 'payNotifyJob', 'DEFAULT', NULL, 'cn.iocoder.yudao.framework.quartz.core.handler.JobHandlerInvoker', '0', '1', '1', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000027400064A4F425F49447372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000000000057400104A4F425F48414E444C45525F4E414D4574000C7061794E6F746966794A6F627800); +INSERT INTO `QRTZ_JOB_DETAILS` (`SCHED_NAME`, `JOB_NAME`, `JOB_GROUP`, `DESCRIPTION`, `JOB_CLASS_NAME`, `IS_DURABLE`, `IS_NONCONCURRENT`, `IS_UPDATE_DATA`, `REQUESTS_RECOVERY`, `JOB_DATA`) VALUES ('schedulerName', 'payOrderExpireJob', 'DEFAULT', NULL, 'cn.iocoder.yudao.framework.quartz.core.handler.JobHandlerInvoker', '0', '1', '1', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000027400064A4F425F49447372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000000000127400104A4F425F48414E444C45525F4E414D457400117061794F726465724578706972654A6F627800); +INSERT INTO `QRTZ_JOB_DETAILS` (`SCHED_NAME`, `JOB_NAME`, `JOB_GROUP`, `DESCRIPTION`, `JOB_CLASS_NAME`, `IS_DURABLE`, `IS_NONCONCURRENT`, `IS_UPDATE_DATA`, `REQUESTS_RECOVERY`, `JOB_DATA`) VALUES ('schedulerName', 'payOrderSyncJob', 'DEFAULT', NULL, 'cn.iocoder.yudao.framework.quartz.core.handler.JobHandlerInvoker', '0', '1', '1', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000027400064A4F425F49447372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000000000117400104A4F425F48414E444C45525F4E414D4574000F7061794F7264657253796E634A6F627800); +INSERT INTO `QRTZ_JOB_DETAILS` (`SCHED_NAME`, `JOB_NAME`, `JOB_GROUP`, `DESCRIPTION`, `JOB_CLASS_NAME`, `IS_DURABLE`, `IS_NONCONCURRENT`, `IS_UPDATE_DATA`, `REQUESTS_RECOVERY`, `JOB_DATA`) VALUES ('schedulerName', 'payRefundSyncJob', 'DEFAULT', NULL, 'cn.iocoder.yudao.framework.quartz.core.handler.JobHandlerInvoker', '0', '1', '1', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000027400064A4F425F49447372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000000000137400104A4F425F48414E444C45525F4E414D45740010706179526566756E6453796E634A6F627800); +INSERT INTO `QRTZ_JOB_DETAILS` (`SCHED_NAME`, `JOB_NAME`, `JOB_GROUP`, `DESCRIPTION`, `JOB_CLASS_NAME`, `IS_DURABLE`, `IS_NONCONCURRENT`, `IS_UPDATE_DATA`, `REQUESTS_RECOVERY`, `JOB_DATA`) VALUES ('schedulerName', 'tradeOrderAutoCancelJob', 'DEFAULT', NULL, 'cn.iocoder.yudao.framework.quartz.core.handler.JobHandlerInvoker', '0', '1', '1', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000027400064A4F425F49447372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000000000157400104A4F425F48414E444C45525F4E414D4574001774726164654F726465724175746F43616E63656C4A6F627800); +INSERT INTO `QRTZ_JOB_DETAILS` (`SCHED_NAME`, `JOB_NAME`, `JOB_GROUP`, `DESCRIPTION`, `JOB_CLASS_NAME`, `IS_DURABLE`, `IS_NONCONCURRENT`, `IS_UPDATE_DATA`, `REQUESTS_RECOVERY`, `JOB_DATA`) VALUES ('schedulerName', 'tradeOrderAutoCommentJob', 'DEFAULT', NULL, 'cn.iocoder.yudao.framework.quartz.core.handler.JobHandlerInvoker', '0', '1', '1', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000027400064A4F425F49447372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000000000177400104A4F425F48414E444C45525F4E414D4574001874726164654F726465724175746F436F6D6D656E744A6F627800); +INSERT INTO `QRTZ_JOB_DETAILS` (`SCHED_NAME`, `JOB_NAME`, `JOB_GROUP`, `DESCRIPTION`, `JOB_CLASS_NAME`, `IS_DURABLE`, `IS_NONCONCURRENT`, `IS_UPDATE_DATA`, `REQUESTS_RECOVERY`, `JOB_DATA`) VALUES ('schedulerName', 'tradeOrderAutoReceiveJob', 'DEFAULT', NULL, 'cn.iocoder.yudao.framework.quartz.core.handler.JobHandlerInvoker', '0', '1', '1', '0', 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000027400064A4F425F49447372000E6A6176612E6C616E672E4C6F6E673B8BE490CC8F23DF0200014A000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000000000167400104A4F425F48414E444C45525F4E414D4574001874726164654F726465724175746F526563656976654A6F627800); +COMMIT; + +-- ---------------------------- +-- Table structure for QRTZ_LOCKS +-- ---------------------------- +DROP TABLE IF EXISTS `QRTZ_LOCKS`; +CREATE TABLE `QRTZ_LOCKS` ( + `SCHED_NAME` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `LOCK_NAME` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + PRIMARY KEY (`SCHED_NAME`,`LOCK_NAME`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- ---------------------------- +-- Records of QRTZ_LOCKS +-- ---------------------------- +BEGIN; +INSERT INTO `QRTZ_LOCKS` (`SCHED_NAME`, `LOCK_NAME`) VALUES ('schedulerName', 'STATE_ACCESS'); +INSERT INTO `QRTZ_LOCKS` (`SCHED_NAME`, `LOCK_NAME`) VALUES ('schedulerName', 'TRIGGER_ACCESS'); +COMMIT; + +-- ---------------------------- +-- Table structure for QRTZ_PAUSED_TRIGGER_GRPS +-- ---------------------------- +DROP TABLE IF EXISTS `QRTZ_PAUSED_TRIGGER_GRPS`; +CREATE TABLE `QRTZ_PAUSED_TRIGGER_GRPS` ( + `SCHED_NAME` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `TRIGGER_GROUP` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + PRIMARY KEY (`SCHED_NAME`,`TRIGGER_GROUP`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- ---------------------------- +-- Records of QRTZ_PAUSED_TRIGGER_GRPS +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for QRTZ_SCHEDULER_STATE +-- ---------------------------- +DROP TABLE IF EXISTS `QRTZ_SCHEDULER_STATE`; +CREATE TABLE `QRTZ_SCHEDULER_STATE` ( + `SCHED_NAME` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `INSTANCE_NAME` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `LAST_CHECKIN_TIME` bigint NOT NULL, + `CHECKIN_INTERVAL` bigint NOT NULL, + PRIMARY KEY (`SCHED_NAME`,`INSTANCE_NAME`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- ---------------------------- +-- Records of QRTZ_SCHEDULER_STATE +-- ---------------------------- +BEGIN; +INSERT INTO `QRTZ_SCHEDULER_STATE` (`SCHED_NAME`, `INSTANCE_NAME`, `LAST_CHECKIN_TIME`, `CHECKIN_INTERVAL`) VALUES ('schedulerName', 'diven-3.local1780399931310', 1780400233170, 15000); +COMMIT; + +-- ---------------------------- +-- Table structure for QRTZ_SIMPLE_TRIGGERS +-- ---------------------------- +DROP TABLE IF EXISTS `QRTZ_SIMPLE_TRIGGERS`; +CREATE TABLE `QRTZ_SIMPLE_TRIGGERS` ( + `SCHED_NAME` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `TRIGGER_NAME` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `TRIGGER_GROUP` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `REPEAT_COUNT` bigint NOT NULL, + `REPEAT_INTERVAL` bigint NOT NULL, + `TIMES_TRIGGERED` bigint NOT NULL, + PRIMARY KEY (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`) USING BTREE, + CONSTRAINT `qrtz_simple_triggers_ibfk_1` FOREIGN KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) REFERENCES `QRTZ_TRIGGERS` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) ON DELETE RESTRICT ON UPDATE RESTRICT +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- ---------------------------- +-- Records of QRTZ_SIMPLE_TRIGGERS +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for QRTZ_SIMPROP_TRIGGERS +-- ---------------------------- +DROP TABLE IF EXISTS `QRTZ_SIMPROP_TRIGGERS`; +CREATE TABLE `QRTZ_SIMPROP_TRIGGERS` ( + `SCHED_NAME` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `TRIGGER_NAME` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `TRIGGER_GROUP` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `STR_PROP_1` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `STR_PROP_2` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `STR_PROP_3` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `INT_PROP_1` int DEFAULT NULL, + `INT_PROP_2` int DEFAULT NULL, + `LONG_PROP_1` bigint DEFAULT NULL, + `LONG_PROP_2` bigint DEFAULT NULL, + `DEC_PROP_1` decimal(13,4) DEFAULT NULL, + `DEC_PROP_2` decimal(13,4) DEFAULT NULL, + `BOOL_PROP_1` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `BOOL_PROP_2` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + PRIMARY KEY (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`) USING BTREE, + CONSTRAINT `qrtz_simprop_triggers_ibfk_1` FOREIGN KEY (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) REFERENCES `QRTZ_TRIGGERS` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`) ON DELETE RESTRICT ON UPDATE RESTRICT +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- ---------------------------- +-- Records of QRTZ_SIMPROP_TRIGGERS +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for QRTZ_TRIGGERS +-- ---------------------------- +DROP TABLE IF EXISTS `QRTZ_TRIGGERS`; +CREATE TABLE `QRTZ_TRIGGERS` ( + `SCHED_NAME` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `TRIGGER_NAME` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `TRIGGER_GROUP` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `JOB_NAME` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `JOB_GROUP` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `DESCRIPTION` varchar(250) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `NEXT_FIRE_TIME` bigint DEFAULT NULL, + `PREV_FIRE_TIME` bigint DEFAULT NULL, + `PRIORITY` int DEFAULT NULL, + `TRIGGER_STATE` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `TRIGGER_TYPE` varchar(8) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `START_TIME` bigint NOT NULL, + `END_TIME` bigint DEFAULT NULL, + `CALENDAR_NAME` varchar(190) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `MISFIRE_INSTR` smallint DEFAULT NULL, + `JOB_DATA` blob, + PRIMARY KEY (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`) USING BTREE, + KEY `IDX_QRTZ_T_J` (`SCHED_NAME`,`JOB_NAME`,`JOB_GROUP`) USING BTREE, + KEY `IDX_QRTZ_T_JG` (`SCHED_NAME`,`JOB_GROUP`) USING BTREE, + KEY `IDX_QRTZ_T_C` (`SCHED_NAME`,`CALENDAR_NAME`) USING BTREE, + KEY `IDX_QRTZ_T_G` (`SCHED_NAME`,`TRIGGER_GROUP`) USING BTREE, + KEY `IDX_QRTZ_T_STATE` (`SCHED_NAME`,`TRIGGER_STATE`) USING BTREE, + KEY `IDX_QRTZ_T_N_STATE` (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`,`TRIGGER_STATE`) USING BTREE, + KEY `IDX_QRTZ_T_N_G_STATE` (`SCHED_NAME`,`TRIGGER_GROUP`,`TRIGGER_STATE`) USING BTREE, + KEY `IDX_QRTZ_T_NEXT_FIRE_TIME` (`SCHED_NAME`,`NEXT_FIRE_TIME`) USING BTREE, + KEY `IDX_QRTZ_T_NFT_ST` (`SCHED_NAME`,`TRIGGER_STATE`,`NEXT_FIRE_TIME`) USING BTREE, + KEY `IDX_QRTZ_T_NFT_MISFIRE` (`SCHED_NAME`,`MISFIRE_INSTR`,`NEXT_FIRE_TIME`) USING BTREE, + KEY `IDX_QRTZ_T_NFT_ST_MISFIRE` (`SCHED_NAME`,`MISFIRE_INSTR`,`NEXT_FIRE_TIME`,`TRIGGER_STATE`) USING BTREE, + KEY `IDX_QRTZ_T_NFT_ST_MISFIRE_GRP` (`SCHED_NAME`,`MISFIRE_INSTR`,`NEXT_FIRE_TIME`,`TRIGGER_GROUP`,`TRIGGER_STATE`) USING BTREE, + CONSTRAINT `qrtz_triggers_ibfk_1` FOREIGN KEY (`SCHED_NAME`, `JOB_NAME`, `JOB_GROUP`) REFERENCES `QRTZ_JOB_DETAILS` (`SCHED_NAME`, `JOB_NAME`, `JOB_GROUP`) ON DELETE RESTRICT ON UPDATE RESTRICT +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- ---------------------------- +-- Records of QRTZ_TRIGGERS +-- ---------------------------- +BEGIN; +INSERT INTO `QRTZ_TRIGGERS` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`, `JOB_NAME`, `JOB_GROUP`, `DESCRIPTION`, `NEXT_FIRE_TIME`, `PREV_FIRE_TIME`, `PRIORITY`, `TRIGGER_STATE`, `TRIGGER_TYPE`, `START_TIME`, `END_TIME`, `CALENDAR_NAME`, `MISFIRE_INSTR`, `JOB_DATA`) VALUES ('schedulerName', 'accessLogCleanJob', 'DEFAULT', 'accessLogCleanJob', 'DEFAULT', NULL, 1696348800000, -1, 5, 'PAUSED', 'CRON', 1696301981000, 0, NULL, 0, 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000037400114A4F425F48414E444C45525F504152414D7400007400124A4F425F52455452595F494E54455256414C737200116A6176612E6C616E672E496E746567657212E2A0A4F781873802000149000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B02000078700000000074000F4A4F425F52455452595F434F554E547371007E000A000000037800); +INSERT INTO `QRTZ_TRIGGERS` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`, `JOB_NAME`, `JOB_GROUP`, `DESCRIPTION`, `NEXT_FIRE_TIME`, `PREV_FIRE_TIME`, `PRIORITY`, `TRIGGER_STATE`, `TRIGGER_TYPE`, `START_TIME`, `END_TIME`, `CALENDAR_NAME`, `MISFIRE_INSTR`, `JOB_DATA`) VALUES ('schedulerName', 'brokerageRecordUnfreezeJob', 'DEFAULT', 'brokerageRecordUnfreezeJob', 'DEFAULT', NULL, 1695909720000, -1, 5, 'PAUSED', 'CRON', 1695909706000, 0, NULL, 0, 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000037400114A4F425F48414E444C45525F504152414D7400007400124A4F425F52455452595F494E54455256414C737200116A6176612E6C616E672E496E746567657212E2A0A4F781873802000149000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B02000078700000000074000F4A4F425F52455452595F434F554E547371007E000A000000037800); +INSERT INTO `QRTZ_TRIGGERS` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`, `JOB_NAME`, `JOB_GROUP`, `DESCRIPTION`, `NEXT_FIRE_TIME`, `PREV_FIRE_TIME`, `PRIORITY`, `TRIGGER_STATE`, `TRIGGER_TYPE`, `START_TIME`, `END_TIME`, `CALENDAR_NAME`, `MISFIRE_INSTR`, `JOB_DATA`) VALUES ('schedulerName', 'errorLogCleanJob', 'DEFAULT', 'errorLogCleanJob', 'DEFAULT', NULL, 1696348800000, -1, 5, 'PAUSED', 'CRON', 1696302043000, 0, NULL, 0, 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000037400114A4F425F48414E444C45525F504152414D7400007400124A4F425F52455452595F494E54455256414C737200116A6176612E6C616E672E496E746567657212E2A0A4F781873802000149000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B02000078700000000074000F4A4F425F52455452595F434F554E547371007E000A000000037800); +INSERT INTO `QRTZ_TRIGGERS` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`, `JOB_NAME`, `JOB_GROUP`, `DESCRIPTION`, `NEXT_FIRE_TIME`, `PREV_FIRE_TIME`, `PRIORITY`, `TRIGGER_STATE`, `TRIGGER_TYPE`, `START_TIME`, `END_TIME`, `CALENDAR_NAME`, `MISFIRE_INSTR`, `JOB_DATA`) VALUES ('schedulerName', 'jobLogCleanJob', 'DEFAULT', 'jobLogCleanJob', 'DEFAULT', NULL, 1696348800000, -1, 5, 'PAUSED', 'CRON', 1696302092000, 0, NULL, 0, 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000037400114A4F425F48414E444C45525F504152414D7400007400124A4F425F52455452595F494E54455256414C737200116A6176612E6C616E672E496E746567657212E2A0A4F781873802000149000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B02000078700000000074000F4A4F425F52455452595F434F554E547371007E000A000000037800); +INSERT INTO `QRTZ_TRIGGERS` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`, `JOB_NAME`, `JOB_GROUP`, `DESCRIPTION`, `NEXT_FIRE_TIME`, `PREV_FIRE_TIME`, `PRIORITY`, `TRIGGER_STATE`, `TRIGGER_TYPE`, `START_TIME`, `END_TIME`, `CALENDAR_NAME`, `MISFIRE_INSTR`, `JOB_DATA`) VALUES ('schedulerName', 'payNotifyJob', 'DEFAULT', 'payNotifyJob', 'DEFAULT', NULL, 1688907102000, 1688907101000, 5, 'PAUSED', 'CRON', 1635294882000, 0, NULL, 0, 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000037400114A4F425F48414E444C45525F504152414D707400124A4F425F52455452595F494E54455256414C737200116A6176612E6C616E672E496E746567657212E2A0A4F781873802000149000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B02000078700000000074000F4A4F425F52455452595F434F554E5471007E000B7800); +INSERT INTO `QRTZ_TRIGGERS` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`, `JOB_NAME`, `JOB_GROUP`, `DESCRIPTION`, `NEXT_FIRE_TIME`, `PREV_FIRE_TIME`, `PRIORITY`, `TRIGGER_STATE`, `TRIGGER_TYPE`, `START_TIME`, `END_TIME`, `CALENDAR_NAME`, `MISFIRE_INSTR`, `JOB_DATA`) VALUES ('schedulerName', 'payOrderExpireJob', 'DEFAULT', 'payOrderExpireJob', 'DEFAULT', NULL, 1690011600000, -1, 5, 'PAUSED', 'CRON', 1690011553000, 0, NULL, 0, 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000037400114A4F425F48414E444C45525F504152414D707400124A4F425F52455452595F494E54455256414C737200116A6176612E6C616E672E496E746567657212E2A0A4F781873802000149000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B02000078700000000074000F4A4F425F52455452595F434F554E5471007E000B7800); +INSERT INTO `QRTZ_TRIGGERS` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`, `JOB_NAME`, `JOB_GROUP`, `DESCRIPTION`, `NEXT_FIRE_TIME`, `PREV_FIRE_TIME`, `PRIORITY`, `TRIGGER_STATE`, `TRIGGER_TYPE`, `START_TIME`, `END_TIME`, `CALENDAR_NAME`, `MISFIRE_INSTR`, `JOB_DATA`) VALUES ('schedulerName', 'payOrderSyncJob', 'DEFAULT', 'payOrderSyncJob', 'DEFAULT', NULL, 1690011600000, 1690011540000, 5, 'PAUSED', 'CRON', 1690007785000, 0, NULL, 0, 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000037400114A4F425F48414E444C45525F504152414D707400124A4F425F52455452595F494E54455256414C737200116A6176612E6C616E672E496E746567657212E2A0A4F781873802000149000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B02000078700000000074000F4A4F425F52455452595F434F554E5471007E000B7800); +INSERT INTO `QRTZ_TRIGGERS` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`, `JOB_NAME`, `JOB_GROUP`, `DESCRIPTION`, `NEXT_FIRE_TIME`, `PREV_FIRE_TIME`, `PRIORITY`, `TRIGGER_STATE`, `TRIGGER_TYPE`, `START_TIME`, `END_TIME`, `CALENDAR_NAME`, `MISFIRE_INSTR`, `JOB_DATA`) VALUES ('schedulerName', 'payRefundSyncJob', 'DEFAULT', 'payRefundSyncJob', 'DEFAULT', NULL, 1690117560000, 1690117500000, 5, 'PAUSED', 'CRON', 1690117424000, 0, NULL, 0, 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000037400114A4F425F48414E444C45525F504152414D707400124A4F425F52455452595F494E54455256414C737200116A6176612E6C616E672E496E746567657212E2A0A4F781873802000149000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B02000078700000000074000F4A4F425F52455452595F434F554E5471007E000B7800); +INSERT INTO `QRTZ_TRIGGERS` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`, `JOB_NAME`, `JOB_GROUP`, `DESCRIPTION`, `NEXT_FIRE_TIME`, `PREV_FIRE_TIME`, `PRIORITY`, `TRIGGER_STATE`, `TRIGGER_TYPE`, `START_TIME`, `END_TIME`, `CALENDAR_NAME`, `MISFIRE_INSTR`, `JOB_DATA`) VALUES ('schedulerName', 'tradeOrderAutoCancelJob', 'DEFAULT', 'tradeOrderAutoCancelJob', 'DEFAULT', NULL, 1695727440000, 1695727380000, 5, 'PAUSED', 'CRON', 1695656605000, 0, NULL, 0, 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000037400114A4F425F48414E444C45525F504152414D7400007400124A4F425F52455452595F494E54455256414C737200116A6176612E6C616E672E496E746567657212E2A0A4F781873802000149000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B02000078700000000074000F4A4F425F52455452595F434F554E547371007E000A000000037800); +INSERT INTO `QRTZ_TRIGGERS` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`, `JOB_NAME`, `JOB_GROUP`, `DESCRIPTION`, `NEXT_FIRE_TIME`, `PREV_FIRE_TIME`, `PRIORITY`, `TRIGGER_STATE`, `TRIGGER_TYPE`, `START_TIME`, `END_TIME`, `CALENDAR_NAME`, `MISFIRE_INSTR`, `JOB_DATA`) VALUES ('schedulerName', 'tradeOrderAutoCommentJob', 'DEFAULT', 'tradeOrderAutoCommentJob', 'DEFAULT', NULL, 1695783840000, 1695783780000, 5, 'PAUSED', 'CRON', 1695742709000, 0, NULL, 0, 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000037400114A4F425F48414E444C45525F504152414D7400007400124A4F425F52455452595F494E54455256414C737200116A6176612E6C616E672E496E746567657212E2A0A4F781873802000149000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B02000078700000000074000F4A4F425F52455452595F434F554E547371007E000A000000037800); +INSERT INTO `QRTZ_TRIGGERS` (`SCHED_NAME`, `TRIGGER_NAME`, `TRIGGER_GROUP`, `JOB_NAME`, `JOB_GROUP`, `DESCRIPTION`, `NEXT_FIRE_TIME`, `PREV_FIRE_TIME`, `PRIORITY`, `TRIGGER_STATE`, `TRIGGER_TYPE`, `START_TIME`, `END_TIME`, `CALENDAR_NAME`, `MISFIRE_INSTR`, `JOB_DATA`) VALUES ('schedulerName', 'tradeOrderAutoReceiveJob', 'DEFAULT', 'tradeOrderAutoReceiveJob', 'DEFAULT', NULL, 1695742740000, 1695742680000, 5, 'PAUSED', 'CRON', 1695727433000, 0, NULL, 0, 0xACED0005737200156F72672E71756172747A2E4A6F62446174614D61709FB083E8BFA9B0CB020000787200266F72672E71756172747A2E7574696C732E537472696E674B65794469727479466C61674D61708208E8C3FBC55D280200015A0013616C6C6F77735472616E7369656E74446174617872001D6F72672E71756172747A2E7574696C732E4469727479466C61674D617013E62EAD28760ACE0200025A000564697274794C00036D617074000F4C6A6176612F7574696C2F4D61703B787001737200116A6176612E7574696C2E486173684D61700507DAC1C31660D103000246000A6C6F6164466163746F724900097468726573686F6C6478703F4000000000000C770800000010000000037400114A4F425F48414E444C45525F504152414D7400007400124A4F425F52455452595F494E54455256414C737200116A6176612E6C616E672E496E746567657212E2A0A4F781873802000149000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B02000078700000000074000F4A4F425F52455452595F434F554E547371007E000A000000037800); +COMMIT; + +-- ---------------------------- +-- Table structure for sms_appinfo +-- ---------------------------- +DROP TABLE IF EXISTS `sms_appinfo`; +CREATE TABLE `sms_appinfo` ( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '应用编号', + `tenant_id` bigint NOT NULL DEFAULT '1' COMMENT '租户ID', + `app_key` varchar(20) NOT NULL COMMENT '应用密钥Key', + `app_name` varchar(40) NOT NULL DEFAULT '' COMMENT '应用名称', + `app_secret` varchar(100) NOT NULL COMMENT '应用密钥Secret', + `status` tinyint DEFAULT '0' COMMENT '状态:0-有效 / 1-无效', + `remark` varchar(255) DEFAULT NULL COMMENT '备注信息', + `deleted` tinyint(1) NOT NULL DEFAULT '0' COMMENT '删除状态:0-正常 1-删除', + `creator` varchar(64) DEFAULT '' COMMENT '创建人', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) DEFAULT '' COMMENT '更新人', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='租户应用表'; + +-- ---------------------------- +-- Records of sms_appinfo +-- ---------------------------- +BEGIN; +INSERT INTO `sms_appinfo` (`id`, `tenant_id`, `app_key`, `app_name`, `app_secret`, `status`, `remark`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (1, 1, 'qQjEiFzn80v8VM4h', 'mydemo', '9c465ece754bd26a9be77f3d0e2606bd', 0, '例子', 0, 'system', '2026-06-01 15:41:08', 'system', '2026-06-01 15:41:08'); +COMMIT; + +-- ---------------------------- +-- Table structure for sms_channel_account +-- ---------------------------- +DROP TABLE IF EXISTS `sms_channel_account`; +CREATE TABLE `sms_channel_account` ( + `id` int NOT NULL AUTO_INCREMENT COMMENT '主键ID', + `channel_id` int NOT NULL COMMENT '逻辑关联渠道ID', + `channel_code` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '渠道标识(逻辑关联channel_info.code)', + `account_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '账号名称', + `app_key` varchar(80) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'API密钥', + `app_secret` varchar(80) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'API密钥', + `md5_value` char(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '关键字段MD5值(算法:MD5(channel_id|account_name|app_key|app_secret))', + `support_sms_type` json NOT NULL COMMENT '支持的短信类型[0:验证码,1:短信通知,2:推广短信,3:国际/港澳台消息]', + `ext_params` json DEFAULT NULL COMMENT '扩展参数', + `remark` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '备注', + `deleted` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0-正常 1-禁用', + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建人', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '更新人', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', + PRIMARY KEY (`id`), + UNIQUE KEY `uk_md5_value` (`md5_value`) COMMENT '防重复提交', + KEY `idx_channel_id` (`channel_id`), + KEY `idx_channel_code` (`channel_code`) +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='短信渠道账号表'; + +-- ---------------------------- +-- Records of sms_channel_account +-- ---------------------------- +BEGIN; +INSERT INTO `sms_channel_account` (`id`, `channel_id`, `channel_code`, `account_name`, `app_key`, `app_secret`, `md5_value`, `support_sms_type`, `ext_params`, `remark`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (1, 1, 'aliyun', '阿里云勇哥账号', '22333333aaaadafsadf', '23232aadafsfsdaaaa', '8de8d3023dc91845be26c49f0c926955', '[0, 1, 2, 3]', '{}', '', 0, '1', '2025-07-06 21:52:04', '1', '2025-07-07 11:22:09'); +INSERT INTO `sms_channel_account` (`id`, `channel_id`, `channel_code`, `account_name`, `app_key`, `app_secret`, `md5_value`, `support_sms_type`, `ext_params`, `remark`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (3, 5, 'chuanglan', '创南账号1', 'IM9341742', '1Y2T8c5gWge34f', 'ed8c5d57104d13230b4e82ce839b5243', '[3, 2]', '{}', NULL, 0, '1', '2026-06-02 14:34:08', '1', '2026-06-02 14:34:08'); +COMMIT; + +-- ---------------------------- +-- Table structure for sms_channel_info +-- ---------------------------- +DROP TABLE IF EXISTS `sms_channel_info`; +CREATE TABLE `sms_channel_info` ( + `id` int NOT NULL AUTO_INCREMENT COMMENT '渠道ID', + `channel_name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '渠道名称', + `channel_code` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '渠道标识(如:aliyun/tencent等)', + `domain_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '请求地址', + `label` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '渠道标签(逗号分隔)', + `deleted` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0-正常 1-禁用', + `support_apply_template` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否支持申请模板(1-支持 0-不支持)', + `support_apply_sign` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否支持申请签名(1-支持 0-不支持)', + `support_batch_send` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否支持批量发送(1-支持 0-不支持)', + `support_international` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否支持国际短信(1-支持 0-不支持)', + `support_query_template` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否支持查询模板信息(1-支持 0-不支持)', + `support_reply` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否支持上行回复(1-支持 0-不支持)', + `channel_properties` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '渠道扩展属性(JSON格式配置/动态参数)', + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '创建人', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '更新人', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='短信渠道配置表(含扩展属性字段)'; + +-- ---------------------------- +-- Records of sms_channel_info +-- ---------------------------- +BEGIN; +INSERT INTO `sms_channel_info` (`id`, `channel_name`, `channel_code`, `domain_url`, `label`, `deleted`, `support_apply_template`, `support_apply_sign`, `support_batch_send`, `support_international`, `support_query_template`, `support_reply`, `channel_properties`, `creator`, `create_time`, `updater`, `update_time`) VALUES (1, '阿里云', 'aliyun', 'https://dysmsapi.aliyuncs.com', '内置', 0, 0, 0, 0, 1, 0, 0, '{}', '1', '2025-07-03 19:37:14', '1', '2025-07-04 22:06:38'); +INSERT INTO `sms_channel_info` (`id`, `channel_name`, `channel_code`, `domain_url`, `label`, `deleted`, `support_apply_template`, `support_apply_sign`, `support_batch_send`, `support_international`, `support_query_template`, `support_reply`, `channel_properties`, `creator`, `create_time`, `updater`, `update_time`) VALUES (2, '腾讯云', 'tencent', 'https://sms.tencentcloudapi.com', '内置', 0, 1, 1, 1, 1, 1, 1, '{\"appId\":\"应用编号\"}', '1', '2025-07-03 21:10:35', '1', '2025-07-03 21:22:25'); +INSERT INTO `sms_channel_info` (`id`, `channel_name`, `channel_code`, `domain_url`, `label`, `deleted`, `support_apply_template`, `support_apply_sign`, `support_batch_send`, `support_international`, `support_query_template`, `support_reply`, `channel_properties`, `creator`, `create_time`, `updater`, `update_time`) VALUES (3, '合一短信', 'unisms', 'https://uni.apistd.com/', '内置', 0, 0, 0, 1, 1, 0, 0, '{\"signType\":\"签名方式:easy/sha256\"}', '1', '2025-07-03 21:13:43', '1', '2025-07-03 21:13:43'); +INSERT INTO `sms_channel_info` (`id`, `channel_name`, `channel_code`, `domain_url`, `label`, `deleted`, `support_apply_template`, `support_apply_sign`, `support_batch_send`, `support_international`, `support_query_template`, `support_reply`, `channel_properties`, `creator`, `create_time`, `updater`, `update_time`) VALUES (4, '亿美短信', 'emay', 'http://www.btom.cn', '内置', 0, 1, 0, 1, 1, 1, 0, NULL, '1', '2025-07-03 21:41:20', '1', '2025-07-03 21:41:20'); +INSERT INTO `sms_channel_info` (`id`, `channel_name`, `channel_code`, `domain_url`, `label`, `deleted`, `support_apply_template`, `support_apply_sign`, `support_batch_send`, `support_international`, `support_query_template`, `support_reply`, `channel_properties`, `creator`, `create_time`, `updater`, `update_time`) VALUES (5, '创南', 'chuanglan', 'https://intapi.tig253.com', '创南', 0, 0, 0, 0, 1, 0, 0, '{}', '1', '2026-06-02 14:31:51', '1', '2026-06-02 14:32:00'); +COMMIT; + +-- ---------------------------- +-- Table structure for sms_record +-- ---------------------------- +DROP TABLE IF EXISTS `sms_record`; +CREATE TABLE `sms_record` ( + `id` bigint NOT NULL COMMENT '主键 雪花算法', + `task_id` bigint NOT NULL COMMENT '任务编号', + `mobile` varchar(20) NOT NULL COMMENT '手机号', + `nationcode` varchar(10) NOT NULL DEFAULT '86' COMMENT '国际电话区号如 86', + `app_id` varchar(30) DEFAULT NULL COMMENT '调用服务方', + `record_type` tinyint DEFAULT '0' COMMENT '0-验证码 1-短信通知 2-推广短信', + `template_id` bigint NOT NULL COMMENT '模版编号', + `template_param` varchar(50) NOT NULL COMMENT '模版参数', + `content` varchar(500) NOT NULL COMMENT '短信内容', + `remark` varchar(500) DEFAULT '' COMMENT '备注(比如:发送失败原因)', + `attime` varchar(30) DEFAULT '' COMMENT '指定发送时间', + `send_status` tinyint NOT NULL DEFAULT '0' COMMENT '0:待发送 / 1:已发送 / 2:发送失败', + `international` tinyint(1) NOT NULL DEFAULT '0' COMMENT '短信类型:0-国内 1-国际', + `deleted` tinyint(1) NOT NULL DEFAULT '0' COMMENT '删除状态:0-正常 1-删除', + `creator` varchar(64) DEFAULT '' COMMENT '创建人', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) DEFAULT '' COMMENT '更新人', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + PRIMARY KEY (`id`), + KEY `idx_app_id` (`app_id`) USING BTREE, + KEY `idx_task_id` (`task_id`) USING BTREE COMMENT '任务编号索引', + KEY `idx_attime` (`attime`) USING BTREE COMMENT '延迟短信索引', + KEY `idx_create_time` (`create_time`) USING BTREE COMMENT '创建时间索引', + KEY `idx_mobile` (`mobile`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='短信记录表'; + +-- ---------------------------- +-- Records of sms_record +-- ---------------------------- +BEGIN; +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (902955590269759490, 902955590269759489, '15102879295', '86', '1', 2, 1, '{}', '【iiiii】ddd', '没有可选择的渠道供选择', '', 2, 0, 0, NULL, '2026-06-01 16:23:09', NULL, '2026-06-01 16:23:09'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903302087276457986, 903302087276457985, '85167000597', '62', '1', 2, 3, '{}', '【测试APP】demo demo', '没有可选择的渠道供选择', '', 2, 1, 0, NULL, '2026-06-02 15:21:58', NULL, '2026-06-02 15:22:03'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903302087276457988, 903302087276457987, '85167000597', '62', '1', 2, 3, '{}', '【测试APP】demo demo', '没有可选择的渠道供选择', '', 2, 1, 0, NULL, '2026-06-02 15:25:16', NULL, '2026-06-02 15:27:22'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903302087276457990, 903302087276457989, '85167000597', '62', '1', 2, 3, '{}', '【测试APP】demo demo', '没有可选择的渠道供选择', '', 2, 1, 0, NULL, '2026-06-02 15:31:02', NULL, '2026-06-02 15:32:52'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903302087276457992, 903302087276457991, '85167000597', '62', '1', 2, 3, '{}', '【测试APP】demo demo', '没有可选择的渠道供选择', '', 2, 1, 0, NULL, '2026-06-02 15:33:50', NULL, '2026-06-02 15:34:38'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903307441699778562, 903307441699778561, '85167000597', '62', '1', 2, 3, '{}', '【APP】demo demo', '没有可选择的渠道供选择', '', 2, 1, 0, NULL, '2026-06-02 15:41:26', NULL, '2026-06-02 15:42:59'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903307441699778564, 903307441699778563, '85167000597', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '提交失败:code=114, message=客户端IP错误', '', 2, 1, 0, NULL, '2026-06-02 15:47:25', NULL, '2026-06-02 15:49:06'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903328516840058882, 903328516840058881, '85167000597', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 17:05:02', NULL, '2026-06-02 17:05:03'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903328516840058885, 903328516840058884, '85167000597', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '1780391340000', 1, 1, 0, NULL, '2026-06-02 17:09:00', NULL, '2026-06-02 17:09:01'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903342870348132354, 903342870348132353, '85167000597', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 18:02:04', NULL, '2026-06-02 18:02:09'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903342870348132357, 903342870348132356, '85167000501', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 18:03:39', NULL, '2026-06-02 18:03:44'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903342870348132358, 903342870348132356, '85167000502', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 18:03:39', NULL, '2026-06-02 18:03:44'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903342870348132359, 903342870348132356, '85167000503', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 18:03:39', NULL, '2026-06-02 18:03:44'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903342870348132360, 903342870348132356, '85167000504', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 18:03:39', NULL, '2026-06-02 18:03:44'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903342870348132361, 903342870348132356, '85167000505', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 18:03:39', NULL, '2026-06-02 18:03:44'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903342870348132367, 903342870348132356, '85167000506', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 18:03:44', NULL, '2026-06-02 18:03:49'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903343291393339396, 903343291393339395, '85167000501', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 18:10:21', NULL, '2026-06-02 18:10:26'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903343291393339397, 903343291393339395, '85167000502', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 18:10:21', NULL, '2026-06-02 18:10:26'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903343291393339398, 903343291393339395, '85167000503', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 18:10:21', NULL, '2026-06-02 18:10:26'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903343291393339399, 903343291393339395, '85167000504', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 18:10:21', NULL, '2026-06-02 18:10:26'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903343291393339400, 903343291393339395, '85167000505', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 18:10:21', NULL, '2026-06-02 18:10:26'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903343291393339406, 903343291393339395, '85167000508', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 18:10:26', NULL, '2026-06-02 18:10:31'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903343291393339407, 903343291393339395, '85167000506', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 18:10:26', NULL, '2026-06-02 18:10:31'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903343291393339408, 903342870348132356, '85167000508', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 18:03:44', NULL, '2026-06-02 18:03:49'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903343291393339409, 903342870348132356, '85167000509', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 18:03:44', NULL, '2026-06-02 18:03:49'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903343291393339410, 903342870348132356, '85167000507', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 18:03:44', NULL, '2026-06-02 18:03:49'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903343291393339411, 903342870348132356, '85167000510', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 18:03:44', NULL, '2026-06-02 18:03:49'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903343291393339417, 903342870348132356, '85167000513', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 18:03:49', NULL, '2026-06-02 18:03:54'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903343291393339418, 903342870348132356, '85167000511', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 18:03:49', NULL, '2026-06-02 18:03:54'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903343291393339419, 903342870348132356, '85167000512', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 18:03:49', NULL, '2026-06-02 18:03:54'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903343291393339420, 903342870348132356, '85167000514', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 18:03:49', NULL, '2026-06-02 18:03:54'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903343291393339423, 903343291393339395, '85167000509', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 18:10:26', NULL, '2026-06-02 18:10:31'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903343291393339424, 903343291393339395, '85167000507', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 18:10:26', NULL, '2026-06-02 18:10:31'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903343291393339425, 903343291393339395, '85167000510', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 18:10:26', NULL, '2026-06-02 18:10:31'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903343291393339431, 903343291393339395, '85167000512', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 18:10:31', NULL, '2026-06-02 18:10:36'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903343291393339432, 903343291393339395, '85167000511', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 18:10:31', NULL, '2026-06-02 18:10:36'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903343291393339433, 903343291393339395, '85167000514', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 18:10:31', NULL, '2026-06-02 18:10:36'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903343291393339434, 903343291393339395, '85167000513', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 18:10:31', NULL, '2026-06-02 18:10:36'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903345671576973314, 903345671576973313, '85167000501', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 18:13:12', NULL, '2026-06-02 18:13:22'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903345671576973316, 903345671576973313, '85167000502', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 18:13:22', NULL, '2026-06-02 18:13:32'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903345671576973318, 903345671576973313, '85167000503', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 18:13:32', NULL, '2026-06-02 18:13:42'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903345671576973320, 903345671576973313, '85167000504', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 18:13:42', NULL, '2026-06-02 18:13:52'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903345671576973322, 903345671576973313, '85167000505', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 18:13:52', NULL, '2026-06-02 18:14:02'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903345671576973324, 903345671576973313, '85167000506', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 18:14:02', NULL, '2026-06-02 18:14:12'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903345671576973326, 903345671576973313, '85167000507', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 18:14:12', NULL, '2026-06-02 18:14:22'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903345966629482497, 903345671576973313, '85167000508', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 18:14:22', NULL, '2026-06-02 18:14:32'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903345966629482499, 903345671576973313, '85167000509', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 18:14:32', NULL, '2026-06-02 18:14:42'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903345966629482501, 903345671576973313, '85167000510', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 18:14:42', NULL, '2026-06-02 18:14:52'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903345966629482502, 903345671576973313, '85167000511', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '', '', 3, 1, 0, '1', '2026-06-02 18:14:46', '1', '2026-06-02 18:14:46'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903345966629482503, 903345671576973313, '85167000512', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '', '', 3, 1, 0, '1', '2026-06-02 18:14:46', '1', '2026-06-02 18:14:46'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903345966629482504, 903345671576973313, '85167000513', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '', '', 3, 1, 0, '1', '2026-06-02 18:14:46', '1', '2026-06-02 18:14:46'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903345966629482505, 903345671576973313, '85167000514', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '', '', 3, 1, 0, '1', '2026-06-02 18:14:46', '1', '2026-06-02 18:14:46'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903345966629482506, 903345671576973313, '85167000515', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '', '', 3, 1, 0, '1', '2026-06-02 18:14:46', '1', '2026-06-02 18:14:46'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903345966629482507, 903345671576973313, '85167000516', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '', '', 3, 1, 0, '1', '2026-06-02 18:14:46', '1', '2026-06-02 18:14:46'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903345966629482508, 903345671576973313, '85167000517', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '', '', 3, 1, 0, '1', '2026-06-02 18:14:46', '1', '2026-06-02 18:14:46'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903345966629482509, 903345671576973313, '85167000518', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '', '', 3, 1, 0, '1', '2026-06-02 18:14:46', '1', '2026-06-02 18:14:46'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903345966629482510, 903345671576973313, '85167000519', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '', '', 3, 1, 0, '1', '2026-06-02 18:14:46', '1', '2026-06-02 18:14:46'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903357337702199298, 903357337702199297, '85167000501', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 18:59:33', NULL, '2026-06-02 18:59:43'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903357337702199300, 903357337702199297, '85167000502', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 18:59:43', NULL, '2026-06-02 18:59:53'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903357337702199302, 903357337702199297, '85167000503', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 18:59:53', NULL, '2026-06-02 19:00:03'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903357337702199304, 903357337702199297, '85167000504', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:00:03', NULL, '2026-06-02 19:00:13'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903357337702199306, 903357337702199297, '85167000505', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:00:37', NULL, '2026-06-02 19:00:47'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903357337702199308, 903357337702199297, '85167000506', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:00:47', NULL, '2026-06-02 19:00:57'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903357337702199310, 903357337702199297, '85167000507', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:00:57', NULL, '2026-06-02 19:01:07'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903357732671418369, 903357337702199297, '85167000508', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:01:07', NULL, '2026-06-02 19:01:17'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903357732671418370, 903357337702199297, '85167000509', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '', '', 3, 1, 0, '1', '2026-06-02 19:01:15', '1', '2026-06-02 19:01:15'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903357732671418371, 903357337702199297, '85167000510', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '', '', 3, 1, 0, '1', '2026-06-02 19:01:15', '1', '2026-06-02 19:01:15'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903357732671418372, 903357337702199297, '85167000511', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '', '', 3, 1, 0, '1', '2026-06-02 19:01:15', '1', '2026-06-02 19:01:15'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903357732671418373, 903357337702199297, '85167000512', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '', '', 3, 1, 0, '1', '2026-06-02 19:01:15', '1', '2026-06-02 19:01:15'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903357732671418374, 903357337702199297, '85167000513', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '', '', 3, 1, 0, '1', '2026-06-02 19:01:15', '1', '2026-06-02 19:01:15'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903357732671418375, 903357337702199297, '85167000514', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '', '', 3, 1, 0, '1', '2026-06-02 19:01:15', '1', '2026-06-02 19:01:15'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903357732671418376, 903357337702199297, '85167000515', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '', '', 3, 1, 0, '1', '2026-06-02 19:01:15', '1', '2026-06-02 19:01:15'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903357732671418377, 903357337702199297, '85167000516', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '', '', 3, 1, 0, '1', '2026-06-02 19:01:15', '1', '2026-06-02 19:01:15'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903357732671418378, 903357337702199297, '85167000517', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '', '', 3, 1, 0, '1', '2026-06-02 19:01:15', '1', '2026-06-02 19:01:15'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903357732671418379, 903357337702199297, '85167000518', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '', '', 3, 1, 0, '1', '2026-06-02 19:01:15', '1', '2026-06-02 19:01:15'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903357732671418380, 903357337702199297, '85167000519', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '', '', 3, 1, 0, '1', '2026-06-02 19:01:15', '1', '2026-06-02 19:01:15'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903357732671418383, 903357732671418382, '85167000501', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:11:21', NULL, '2026-06-02 19:11:32'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903360351976517634, 903357732671418382, '85167000502', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:11:32', NULL, '2026-06-02 19:11:42'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903360351976517636, 903357732671418382, '85167000503', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:11:58', NULL, '2026-06-02 19:12:08'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903360351976517638, 903357732671418382, '85167000504', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:12:08', NULL, '2026-06-02 19:12:18'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903360351976517640, 903357732671418382, '85167000505', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:12:18', NULL, '2026-06-02 19:12:28'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364131379965954, 903364131379965953, '85167000501', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:26:33', NULL, '2026-06-02 19:26:33'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364131379965956, 903364131379965953, '85167000502', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:26:33', NULL, '2026-06-02 19:26:33'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364131379965958, 903364131379965953, '85167000503', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:26:33', NULL, '2026-06-02 19:26:33'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364131379965960, 903364131379965953, '85167000504', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:26:33', NULL, '2026-06-02 19:26:34'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364131379965962, 903364131379965953, '85167000505', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:26:34', NULL, '2026-06-02 19:26:34'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364131379965964, 903364131379965953, '85167000506', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:26:34', NULL, '2026-06-02 19:26:34'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364131379965966, 903364131379965953, '85167000507', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:26:34', NULL, '2026-06-02 19:26:34'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364138602557441, 903364131379965953, '85167000508', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:26:34', NULL, '2026-06-02 19:26:35'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364138602557443, 903364131379965953, '85167000509', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:26:35', NULL, '2026-06-02 19:26:35'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364138602557445, 903364131379965953, '85167000510', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:26:35', NULL, '2026-06-02 19:26:35'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364138602557447, 903364131379965953, '85167000511', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:26:35', NULL, '2026-06-02 19:26:35'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364138602557449, 903364131379965953, '85167000512', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:26:35', NULL, '2026-06-02 19:26:35'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364138602557451, 903364131379965953, '85167000513', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:26:35', NULL, '2026-06-02 19:26:36'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364138602557453, 903364131379965953, '85167000514', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:26:36', NULL, '2026-06-02 19:26:36'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364138602557455, 903364131379965953, '85167000515', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:26:36', NULL, '2026-06-02 19:26:36'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364145783205890, 903364131379965953, '85167000516', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:26:36', NULL, '2026-06-02 19:26:36'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364145783205892, 903364131379965953, '85167000517', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:26:36', NULL, '2026-06-02 19:26:36'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364145783205894, 903364131379965953, '85167000518', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:26:36', NULL, '2026-06-02 19:26:37'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364145783205896, 903364131379965953, '85167000519', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:26:37', NULL, '2026-06-02 19:26:37'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364145783205899, 903364145783205898, '85167000501', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:26:49', NULL, '2026-06-02 19:26:49'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364145783205901, 903364145783205898, '85167000502', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:26:49', NULL, '2026-06-02 19:26:50'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364145783205903, 903364145783205898, '85167000503', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:26:50', NULL, '2026-06-02 19:26:50'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364203123535874, 903364145783205898, '85167000504', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:26:50', NULL, '2026-06-02 19:26:50'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364203123535876, 903364145783205898, '85167000505', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:26:50', NULL, '2026-06-02 19:26:50'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364203123535878, 903364145783205898, '85167000506', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:26:50', NULL, '2026-06-02 19:26:50'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364203123535880, 903364145783205898, '85167000507', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:26:50', NULL, '2026-06-02 19:26:51'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364203123535882, 903364145783205898, '85167000508', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:26:51', NULL, '2026-06-02 19:26:51'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364203123535884, 903364145783205898, '85167000509', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:26:51', NULL, '2026-06-02 19:26:51'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364203123535886, 903364145783205898, '85167000510', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:26:51', NULL, '2026-06-02 19:26:51'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364209423380481, 903364145783205898, '85167000511', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:26:51', NULL, '2026-06-02 19:26:51'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364209423380483, 903364145783205898, '85167000512', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:26:51', NULL, '2026-06-02 19:26:52'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364209423380485, 903364145783205898, '85167000513', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:26:52', NULL, '2026-06-02 19:26:52'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364209423380487, 903364145783205898, '85167000514', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:26:52', NULL, '2026-06-02 19:26:52'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364209423380489, 903364145783205898, '85167000515', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:26:52', NULL, '2026-06-02 19:26:52'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364209423380491, 903364145783205898, '85167000516', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:27:52', NULL, '2026-06-02 19:27:52'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364209423380493, 903364145783205898, '85167000517', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:27:52', NULL, '2026-06-02 19:27:52'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364209423380495, 903364145783205898, '85167000518', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:27:52', NULL, '2026-06-02 19:27:52'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364466219642882, 903364145783205898, '85167000519', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:27:52', NULL, '2026-06-02 19:27:53'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903365815527239682, 903365815527239681, '85167000501', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:33:14', NULL, '2026-06-02 19:33:15'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903365815527239684, 903365815527239681, '85167000502', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:33:15', NULL, '2026-06-02 19:33:15'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903365815527239686, 903365815527239681, '85167000503', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:33:15', NULL, '2026-06-02 19:33:15'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903365815527239688, 903365815527239681, '85167000504', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:33:15', NULL, '2026-06-02 19:33:15'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903365815527239690, 903365815527239681, '85167000505', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:33:15', NULL, '2026-06-02 19:33:15'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903365815527239692, 903365815527239681, '85167000506', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:33:15', NULL, '2026-06-02 19:33:16'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903365815527239694, 903365815527239681, '85167000507', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:33:16', NULL, '2026-06-02 19:33:16'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903365822544310273, 903365815527239681, '85167000508', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:33:16', NULL, '2026-06-02 19:33:16'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903365822544310275, 903365815527239681, '85167000509', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:33:16', NULL, '2026-06-02 19:33:16'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903365822544310277, 903365815527239681, '85167000510', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:33:16', NULL, '2026-06-02 19:33:16'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903365822544310279, 903365815527239681, '85167000511', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:33:16', NULL, '2026-06-02 19:33:17'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903365822544310281, 903365815527239681, '85167000512', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:33:17', NULL, '2026-06-02 19:33:17'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903365822544310283, 903365815527239681, '85167000513', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:33:17', NULL, '2026-06-02 19:33:17'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903365822544310285, 903365815527239681, '85167000514', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:33:17', NULL, '2026-06-02 19:33:17'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903365822544310287, 903365815527239681, '85167000515', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:33:17', NULL, '2026-06-02 19:33:18'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903365829699792898, 903365815527239681, '85167000516', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:33:18', NULL, '2026-06-02 19:33:18'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903365829699792900, 903365815527239681, '85167000517', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:33:18', NULL, '2026-06-02 19:33:18'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903365829699792902, 903365815527239681, '85167000518', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:33:18', NULL, '2026-06-02 19:33:18'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903365829699792904, 903365815527239681, '85167000519', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:33:18', NULL, '2026-06-02 19:33:18'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903365829699792907, 903365829699792906, '85167000501', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:35:25', NULL, '2026-06-02 19:35:25'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903365829699792909, 903365829699792906, '85167000502', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:35:25', NULL, '2026-06-02 19:35:25'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903365829699792911, 903365829699792906, '85167000503', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:35:25', NULL, '2026-06-02 19:35:25'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903366365509545986, 903365829699792906, '85167000504', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:35:25', NULL, '2026-06-02 19:35:25'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903366365509545988, 903365829699792906, '85167000505', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:35:25', NULL, '2026-06-02 19:35:26'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903366365509545990, 903365829699792906, '85167000506', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:35:26', NULL, '2026-06-02 19:35:26'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903366365509545992, 903365829699792906, '85167000507', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:35:26', NULL, '2026-06-02 19:35:26'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903366365509545994, 903365829699792906, '85167000508', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:35:26', NULL, '2026-06-02 19:35:26'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903366365509545996, 903365829699792906, '85167000509', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:35:26', NULL, '2026-06-02 19:35:27'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903366365509545998, 903365829699792906, '85167000510', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:35:27', NULL, '2026-06-02 19:35:27'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903366371834556417, 903365829699792906, '85167000511', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:35:27', NULL, '2026-06-02 19:35:27'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903366371834556419, 903365829699792906, '85167000512', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:35:27', NULL, '2026-06-02 19:35:27'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903366371834556421, 903365829699792906, '85167000513', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:35:45', NULL, '2026-06-02 19:35:45'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903366371834556423, 903365829699792906, '85167000514', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:35:45', NULL, '2026-06-02 19:35:45'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903366371834556425, 903365829699792906, '85167000515', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:35:45', NULL, '2026-06-02 19:35:46'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903366371834556427, 903365829699792906, '85167000516', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:35:46', NULL, '2026-06-02 19:35:46'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903366371834556429, 903365829699792906, '85167000517', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:35:46', NULL, '2026-06-02 19:35:46'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903366371834556431, 903365829699792906, '85167000518', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:35:46', NULL, '2026-06-02 19:35:46'); +INSERT INTO `sms_record` (`id`, `task_id`, `mobile`, `nationcode`, `app_id`, `record_type`, `template_id`, `template_param`, `content`, `remark`, `attime`, `send_status`, `international`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903366453082419202, 903365829699792906, '85167000519', '62', '1', 2, 4, '{}', '【创南签名】demo demo demo', '发送成功', '', 1, 1, 0, NULL, '2026-06-02 19:35:46', NULL, '2026-06-02 19:35:46'); +COMMIT; + +-- ---------------------------- +-- Table structure for sms_record_detail +-- ---------------------------- +DROP TABLE IF EXISTS `sms_record_detail`; +CREATE TABLE `sms_record_detail` ( + `id` bigint NOT NULL COMMENT '主键 雪花算法', + `record_id` bigint NOT NULL COMMENT 'sms_record表外键', + `task_id` bigint NOT NULL COMMENT '任务编号', + `app_id` varchar(30) NOT NULL COMMENT '调用服务方', + `mobile` varchar(20) NOT NULL COMMENT '手机号码', + `nationcode` varchar(10) NOT NULL DEFAULT '86' COMMENT '国际电话区号', + `send_status` tinyint NOT NULL DEFAULT '0' COMMENT '0:待发送 / 1:已发送 / 2:发送失败', + `report_status` tinyint DEFAULT '0' COMMENT '短信报告 0:待回执 / 1:发送成功 / 2:发送失败', + `channel_code` varchar(30) NOT NULL COMMENT '渠道编码', + `channel_account_id` int NOT NULL COMMENT '渠道账户ID', + `msgid` varchar(40) NOT NULL COMMENT '三方短信ID', + `error_msg` varchar(300) DEFAULT '' COMMENT '发送失败时,渠道返回的错误信息', + `price` decimal(10,6) DEFAULT NULL COMMENT '消费金额', + `sender_time` datetime DEFAULT NULL COMMENT '实际发送时间', + `deleted` tinyint(1) NOT NULL DEFAULT '0' COMMENT '删除状态:0-正常 1-删除', + `creator` varchar(64) DEFAULT '' COMMENT '创建人', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) DEFAULT '' COMMENT '更新人', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + PRIMARY KEY (`id`), + KEY `idx_record_id` (`record_id`) USING BTREE COMMENT '记录ID索引', + KEY `idx_task_id` (`task_id`) USING BTREE COMMENT '任务编号索引', + KEY `idx_app_id` (`app_id`) USING BTREE COMMENT '应用ID索引', + KEY `idx_msgid` (`msgid`) USING BTREE COMMENT '三方ID索引', + KEY `idx_sender_time` (`sender_time`) USING BTREE COMMENT '发送时间索引', + KEY `idx_create_time` (`create_time`) USING BTREE COMMENT '创建时间索引', + KEY `idx_mobile` (`mobile`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='短信记录详情表'; + +-- ---------------------------- +-- Records of sms_record_detail +-- ---------------------------- +BEGIN; +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903307441699778565, 903307441699778564, 903307441699778563, '1', '85167000597', '62', 1, 0, 'chuanglan', 3, '', '提交失败:code=114, message=客户端IP错误', NULL, '2026-06-02 15:49:05', 0, NULL, '2026-06-02 15:49:06', NULL, '2026-06-02 15:49:06'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903328516840058883, 903328516840058882, 903328516840058881, '1', '85167000597', '62', 0, 0, 'chuanglan', 3, '756615123395608576', '', NULL, '2026-06-02 17:05:03', 0, NULL, '2026-06-02 17:05:03', NULL, '2026-06-02 17:05:03'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903328516840058886, 903328516840058885, 903328516840058884, '1', '85167000597', '62', 0, 0, 'chuanglan', 3, '756616122994974720', '', NULL, '2026-06-02 17:09:01', 0, NULL, '2026-06-02 17:09:01', NULL, '2026-06-02 17:09:01'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903342870348132355, 903342870348132354, 903342870348132353, '1', '85167000597', '62', 0, 0, 'chuanglan', 3, '1780394528805', '', NULL, '2026-06-02 18:02:09', 0, NULL, '2026-06-02 18:02:09', NULL, '2026-06-02 18:02:09'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903342870348132362, 903342870348132359, 903342870348132356, '1', '85167000503', '62', 0, 0, 'chuanglan', 3, '1780394623959', '', NULL, '2026-06-02 18:03:44', 0, NULL, '2026-06-02 18:03:44', NULL, '2026-06-02 18:03:44'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903342870348132363, 903342870348132357, 903342870348132356, '1', '85167000501', '62', 0, 0, 'chuanglan', 3, '1780394623961', '', NULL, '2026-06-02 18:03:44', 0, NULL, '2026-06-02 18:03:44', NULL, '2026-06-02 18:03:44'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903342870348132364, 903342870348132358, 903342870348132356, '1', '85167000502', '62', 0, 0, 'chuanglan', 3, '1780394623962', '', NULL, '2026-06-02 18:03:44', 0, NULL, '2026-06-02 18:03:44', NULL, '2026-06-02 18:03:44'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903342870348132365, 903342870348132361, 903342870348132356, '1', '85167000505', '62', 0, 0, 'chuanglan', 3, '1780394623966', '', NULL, '2026-06-02 18:03:44', 0, NULL, '2026-06-02 18:03:44', NULL, '2026-06-02 18:03:44'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903342870348132366, 903342870348132360, 903342870348132356, '1', '85167000504', '62', 0, 0, 'chuanglan', 3, '1780394623967', '', NULL, '2026-06-02 18:03:44', 0, NULL, '2026-06-02 18:03:44', NULL, '2026-06-02 18:03:44'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903343291393339393, 903343291393339418, 903342870348132356, '1', '85167000511', '62', 0, 0, 'chuanglan', 3, '1780394634005', '', NULL, '2026-06-02 18:03:54', 0, NULL, '2026-06-02 18:03:54', NULL, '2026-06-02 18:03:54'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903343291393339394, 903343291393339420, 903342870348132356, '1', '85167000514', '62', 0, 0, 'chuanglan', 3, '1780394634007', '', NULL, '2026-06-02 18:03:54', 0, NULL, '2026-06-02 18:03:54', NULL, '2026-06-02 18:03:54'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903343291393339401, 903343291393339400, 903343291393339395, '1', '85167000505', '62', 0, 0, 'chuanglan', 3, '1780395026109', '', NULL, '2026-06-02 18:10:26', 0, NULL, '2026-06-02 18:10:26', NULL, '2026-06-02 18:10:26'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903343291393339402, 903343291393339396, 903343291393339395, '1', '85167000501', '62', 0, 0, 'chuanglan', 3, '1780395026110', '', NULL, '2026-06-02 18:10:26', 0, NULL, '2026-06-02 18:10:26', NULL, '2026-06-02 18:10:26'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903343291393339403, 903343291393339397, 903343291393339395, '1', '85167000502', '62', 0, 0, 'chuanglan', 3, '1780395026111', '', NULL, '2026-06-02 18:10:26', 0, NULL, '2026-06-02 18:10:26', NULL, '2026-06-02 18:10:26'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903343291393339404, 903343291393339399, 903343291393339395, '1', '85167000504', '62', 0, 0, 'chuanglan', 3, '1780395026113', '', NULL, '2026-06-02 18:10:26', 0, NULL, '2026-06-02 18:10:26', NULL, '2026-06-02 18:10:26'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903343291393339405, 903343291393339398, 903343291393339395, '1', '85167000503', '62', 0, 0, 'chuanglan', 3, '1780395026113', '', NULL, '2026-06-02 18:10:26', 0, NULL, '2026-06-02 18:10:26', NULL, '2026-06-02 18:10:26'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903343291393339412, 903342870348132367, 903342870348132356, '1', '85167000506', '62', 0, 0, 'chuanglan', 3, '1780394628980', '', NULL, '2026-06-02 18:03:49', 0, NULL, '2026-06-02 18:03:49', NULL, '2026-06-02 18:03:49'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903343291393339413, 903343291393339411, 903342870348132356, '1', '85167000510', '62', 0, 0, 'chuanglan', 3, '1780394628983', '', NULL, '2026-06-02 18:03:49', 0, NULL, '2026-06-02 18:03:49', NULL, '2026-06-02 18:03:49'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903343291393339414, 903343291393339410, 903342870348132356, '1', '85167000507', '62', 0, 0, 'chuanglan', 3, '1780394628983', '', NULL, '2026-06-02 18:03:49', 0, NULL, '2026-06-02 18:03:49', NULL, '2026-06-02 18:03:49'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903343291393339415, 903343291393339409, 903342870348132356, '1', '85167000509', '62', 0, 0, 'chuanglan', 3, '1780394628984', '', NULL, '2026-06-02 18:03:49', 0, NULL, '2026-06-02 18:03:49', NULL, '2026-06-02 18:03:49'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903343291393339416, 903343291393339408, 903342870348132356, '1', '85167000508', '62', 0, 0, 'chuanglan', 3, '1780394628984', '', NULL, '2026-06-02 18:03:49', 0, NULL, '2026-06-02 18:03:49', NULL, '2026-06-02 18:03:49'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903343291393339421, 903343291393339417, 903342870348132356, '1', '85167000513', '62', 0, 0, 'chuanglan', 3, '1780394634001', '', NULL, '2026-06-02 18:03:54', 0, NULL, '2026-06-02 18:03:54', NULL, '2026-06-02 18:03:54'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903343291393339422, 903343291393339419, 903342870348132356, '1', '85167000512', '62', 0, 0, 'chuanglan', 3, '1780394634005', '', NULL, '2026-06-02 18:03:54', 0, NULL, '2026-06-02 18:03:54', NULL, '2026-06-02 18:03:54'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903343291393339426, 903343291393339425, 903343291393339395, '1', '85167000510', '62', 0, 0, 'chuanglan', 3, '1780395031147', '', NULL, '2026-06-02 18:10:31', 0, NULL, '2026-06-02 18:10:31', NULL, '2026-06-02 18:10:31'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903343291393339427, 903343291393339406, 903343291393339395, '1', '85167000508', '62', 0, 0, 'chuanglan', 3, '1780395031147', '', NULL, '2026-06-02 18:10:31', 0, NULL, '2026-06-02 18:10:31', NULL, '2026-06-02 18:10:31'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903343291393339428, 903343291393339424, 903343291393339395, '1', '85167000507', '62', 0, 0, 'chuanglan', 3, '1780395031147', '', NULL, '2026-06-02 18:10:31', 0, NULL, '2026-06-02 18:10:31', NULL, '2026-06-02 18:10:31'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903343291393339429, 903343291393339423, 903343291393339395, '1', '85167000509', '62', 0, 0, 'chuanglan', 3, '1780395031150', '', NULL, '2026-06-02 18:10:31', 0, NULL, '2026-06-02 18:10:31', NULL, '2026-06-02 18:10:31'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903343291393339430, 903343291393339407, 903343291393339395, '1', '85167000506', '62', 0, 0, 'chuanglan', 3, '1780395031150', '', NULL, '2026-06-02 18:10:31', 0, NULL, '2026-06-02 18:10:31', NULL, '2026-06-02 18:10:31'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903343291393339435, 903343291393339433, 903343291393339395, '1', '85167000514', '62', 0, 0, 'chuanglan', 3, '1780395036162', '', NULL, '2026-06-02 18:10:36', 0, NULL, '2026-06-02 18:10:36', NULL, '2026-06-02 18:10:36'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903343291393339436, 903343291393339432, 903343291393339395, '1', '85167000511', '62', 0, 0, 'chuanglan', 3, '1780395036162', '', NULL, '2026-06-02 18:10:36', 0, NULL, '2026-06-02 18:10:36', NULL, '2026-06-02 18:10:36'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903343291393339437, 903343291393339434, 903343291393339395, '1', '85167000513', '62', 0, 0, 'chuanglan', 3, '1780395036164', '', NULL, '2026-06-02 18:10:36', 0, NULL, '2026-06-02 18:10:36', NULL, '2026-06-02 18:10:36'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903343291393339438, 903343291393339431, 903343291393339395, '1', '85167000512', '62', 0, 0, 'chuanglan', 3, '1780395036166', '', NULL, '2026-06-02 18:10:36', 0, NULL, '2026-06-02 18:10:36', NULL, '2026-06-02 18:10:36'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903345671576973315, 903345671576973314, 903345671576973313, '1', '85167000501', '62', 0, 0, 'chuanglan', 3, '1780395201635', '', NULL, '2026-06-02 18:13:22', 0, NULL, '2026-06-02 18:13:22', NULL, '2026-06-02 18:13:22'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903345671576973317, 903345671576973316, 903345671576973313, '1', '85167000502', '62', 0, 0, 'chuanglan', 3, '1780395211665', '', NULL, '2026-06-02 18:13:32', 0, NULL, '2026-06-02 18:13:32', NULL, '2026-06-02 18:13:32'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903345671576973319, 903345671576973318, 903345671576973313, '1', '85167000503', '62', 0, 0, 'chuanglan', 3, '1780395221680', '', NULL, '2026-06-02 18:13:42', 0, NULL, '2026-06-02 18:13:42', NULL, '2026-06-02 18:13:42'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903345671576973321, 903345671576973320, 903345671576973313, '1', '85167000504', '62', 0, 0, 'chuanglan', 3, '1780395231695', '', NULL, '2026-06-02 18:13:52', 0, NULL, '2026-06-02 18:13:52', NULL, '2026-06-02 18:13:52'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903345671576973323, 903345671576973322, 903345671576973313, '1', '85167000505', '62', 0, 0, 'chuanglan', 3, '1780395241712', '', NULL, '2026-06-02 18:14:02', 0, NULL, '2026-06-02 18:14:02', NULL, '2026-06-02 18:14:02'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903345671576973325, 903345671576973324, 903345671576973313, '1', '85167000506', '62', 0, 0, 'chuanglan', 3, '1780395251751', '', NULL, '2026-06-02 18:14:12', 0, NULL, '2026-06-02 18:14:12', NULL, '2026-06-02 18:14:12'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903345671576973327, 903345671576973326, 903345671576973313, '1', '85167000507', '62', 0, 0, 'chuanglan', 3, '1780395261779', '', NULL, '2026-06-02 18:14:22', 0, NULL, '2026-06-02 18:14:22', NULL, '2026-06-02 18:14:22'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903345966629482498, 903345966629482497, 903345671576973313, '1', '85167000508', '62', 0, 0, 'chuanglan', 3, '1780395271806', '', NULL, '2026-06-02 18:14:32', 0, NULL, '2026-06-02 18:14:32', NULL, '2026-06-02 18:14:32'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903345966629482500, 903345966629482499, 903345671576973313, '1', '85167000509', '62', 0, 0, 'chuanglan', 3, '1780395281819', '', NULL, '2026-06-02 18:14:42', 0, NULL, '2026-06-02 18:14:42', NULL, '2026-06-02 18:14:42'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903345966629482511, 903345966629482501, 903345671576973313, '1', '85167000510', '62', 0, 0, 'chuanglan', 3, '1780395291857', '', NULL, '2026-06-02 18:14:52', 0, NULL, '2026-06-02 18:14:52', NULL, '2026-06-02 18:14:52'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903357337702199299, 903357337702199298, 903357337702199297, '1', '85167000501', '62', 0, 0, 'chuanglan', 3, '1780397983044', '', NULL, '2026-06-02 18:59:43', 0, NULL, '2026-06-02 18:59:43', NULL, '2026-06-02 18:59:43'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903357337702199301, 903357337702199300, 903357337702199297, '1', '85167000502', '62', 0, 0, 'chuanglan', 3, '1780397993071', '', NULL, '2026-06-02 18:59:53', 0, NULL, '2026-06-02 18:59:53', NULL, '2026-06-02 18:59:53'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903357337702199303, 903357337702199302, 903357337702199297, '1', '85167000503', '62', 0, 0, 'chuanglan', 3, '1780398003090', '', NULL, '2026-06-02 19:00:03', 0, NULL, '2026-06-02 19:00:03', NULL, '2026-06-02 19:00:03'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903357337702199305, 903357337702199304, 903357337702199297, '1', '85167000504', '62', 0, 0, 'chuanglan', 3, '1780398013109', '', NULL, '2026-06-02 19:00:13', 0, NULL, '2026-06-02 19:00:13', NULL, '2026-06-02 19:00:13'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903357337702199307, 903357337702199306, 903357337702199297, '1', '85167000505', '62', 0, 0, 'chuanglan', 3, '1780398046990', '', NULL, '2026-06-02 19:00:47', 0, NULL, '2026-06-02 19:00:47', NULL, '2026-06-02 19:00:47'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903357337702199309, 903357337702199308, 903357337702199297, '1', '85167000506', '62', 0, 0, 'chuanglan', 3, '1780398057003', '', NULL, '2026-06-02 19:00:57', 0, NULL, '2026-06-02 19:00:57', NULL, '2026-06-02 19:00:57'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903357337702199311, 903357337702199310, 903357337702199297, '1', '85167000507', '62', 0, 0, 'chuanglan', 3, '1780398067020', '', NULL, '2026-06-02 19:01:07', 0, NULL, '2026-06-02 19:01:07', NULL, '2026-06-02 19:01:07'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903357732671418381, 903357732671418369, 903357337702199297, '1', '85167000508', '62', 0, 0, 'chuanglan', 3, '1780398077052', '', NULL, '2026-06-02 19:01:17', 0, NULL, '2026-06-02 19:01:17', NULL, '2026-06-02 19:01:17'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903360351976517633, 903357732671418383, 903357732671418382, '1', '85167000501', '62', 0, 0, 'chuanglan', 3, '1780398691533', '', NULL, '2026-06-02 19:11:32', 0, NULL, '2026-06-02 19:11:32', NULL, '2026-06-02 19:11:32'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903360351976517635, 903360351976517634, 903357732671418382, '1', '85167000502', '62', 0, 0, 'chuanglan', 3, '1780398701555', '', NULL, '2026-06-02 19:11:42', 0, NULL, '2026-06-02 19:11:42', NULL, '2026-06-02 19:11:42'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903360351976517637, 903360351976517636, 903357732671418382, '1', '85167000503', '62', 0, 0, 'chuanglan', 3, '1780398727525', '', NULL, '2026-06-02 19:12:08', 0, NULL, '2026-06-02 19:12:08', NULL, '2026-06-02 19:12:08'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903360351976517639, 903360351976517638, 903357732671418382, '1', '85167000504', '62', 0, 0, 'chuanglan', 3, '1780398737537', '', NULL, '2026-06-02 19:12:18', 0, NULL, '2026-06-02 19:12:18', NULL, '2026-06-02 19:12:18'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903360351976517641, 903360351976517640, 903357732671418382, '1', '85167000505', '62', 0, 0, 'chuanglan', 3, '1780398747549', '', NULL, '2026-06-02 19:12:28', 0, NULL, '2026-06-02 19:12:28', NULL, '2026-06-02 19:12:28'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364131379965955, 903364131379965954, 903364131379965953, '1', '85167000501', '62', 0, 0, 'chuanglan', 3, '1780399593021', '', NULL, '2026-06-02 19:26:33', 0, NULL, '2026-06-02 19:26:33', NULL, '2026-06-02 19:26:33'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364131379965957, 903364131379965956, 903364131379965953, '1', '85167000502', '62', 0, 0, 'chuanglan', 3, '1780399593247', '', NULL, '2026-06-02 19:26:33', 0, NULL, '2026-06-02 19:26:33', NULL, '2026-06-02 19:26:33'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364131379965959, 903364131379965958, 903364131379965953, '1', '85167000503', '62', 0, 0, 'chuanglan', 3, '1780399593458', '', NULL, '2026-06-02 19:26:33', 0, NULL, '2026-06-02 19:26:33', NULL, '2026-06-02 19:26:33'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364131379965961, 903364131379965960, 903364131379965953, '1', '85167000504', '62', 0, 0, 'chuanglan', 3, '1780399593678', '', NULL, '2026-06-02 19:26:34', 0, NULL, '2026-06-02 19:26:34', NULL, '2026-06-02 19:26:34'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364131379965963, 903364131379965962, 903364131379965953, '1', '85167000505', '62', 0, 0, 'chuanglan', 3, '1780399593892', '', NULL, '2026-06-02 19:26:34', 0, NULL, '2026-06-02 19:26:34', NULL, '2026-06-02 19:26:34'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364131379965965, 903364131379965964, 903364131379965953, '1', '85167000506', '62', 0, 0, 'chuanglan', 3, '1780399594107', '', NULL, '2026-06-02 19:26:34', 0, NULL, '2026-06-02 19:26:34', NULL, '2026-06-02 19:26:34'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364131379965967, 903364131379965966, 903364131379965953, '1', '85167000507', '62', 0, 0, 'chuanglan', 3, '1780399594327', '', NULL, '2026-06-02 19:26:34', 0, NULL, '2026-06-02 19:26:34', NULL, '2026-06-02 19:26:34'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364138602557442, 903364138602557441, 903364131379965953, '1', '85167000508', '62', 0, 0, 'chuanglan', 3, '1780399594543', '', NULL, '2026-06-02 19:26:35', 0, NULL, '2026-06-02 19:26:35', NULL, '2026-06-02 19:26:35'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364138602557444, 903364138602557443, 903364131379965953, '1', '85167000509', '62', 0, 0, 'chuanglan', 3, '1780399594760', '', NULL, '2026-06-02 19:26:35', 0, NULL, '2026-06-02 19:26:35', NULL, '2026-06-02 19:26:35'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364138602557446, 903364138602557445, 903364131379965953, '1', '85167000510', '62', 0, 0, 'chuanglan', 3, '1780399594978', '', NULL, '2026-06-02 19:26:35', 0, NULL, '2026-06-02 19:26:35', NULL, '2026-06-02 19:26:35'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364138602557448, 903364138602557447, 903364131379965953, '1', '85167000511', '62', 0, 0, 'chuanglan', 3, '1780399595192', '', NULL, '2026-06-02 19:26:35', 0, NULL, '2026-06-02 19:26:35', NULL, '2026-06-02 19:26:35'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364138602557450, 903364138602557449, 903364131379965953, '1', '85167000512', '62', 0, 0, 'chuanglan', 3, '1780399595406', '', NULL, '2026-06-02 19:26:35', 0, NULL, '2026-06-02 19:26:35', NULL, '2026-06-02 19:26:35'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364138602557452, 903364138602557451, 903364131379965953, '1', '85167000513', '62', 0, 0, 'chuanglan', 3, '1780399595621', '', NULL, '2026-06-02 19:26:36', 0, NULL, '2026-06-02 19:26:36', NULL, '2026-06-02 19:26:36'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364138602557454, 903364138602557453, 903364131379965953, '1', '85167000514', '62', 0, 0, 'chuanglan', 3, '1780399595836', '', NULL, '2026-06-02 19:26:36', 0, NULL, '2026-06-02 19:26:36', NULL, '2026-06-02 19:26:36'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364145783205889, 903364138602557455, 903364131379965953, '1', '85167000515', '62', 0, 0, 'chuanglan', 3, '1780399596046', '', NULL, '2026-06-02 19:26:36', 0, NULL, '2026-06-02 19:26:36', NULL, '2026-06-02 19:26:36'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364145783205891, 903364145783205890, 903364131379965953, '1', '85167000516', '62', 0, 0, 'chuanglan', 3, '1780399596265', '', NULL, '2026-06-02 19:26:36', 0, NULL, '2026-06-02 19:26:36', NULL, '2026-06-02 19:26:36'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364145783205893, 903364145783205892, 903364131379965953, '1', '85167000517', '62', 0, 0, 'chuanglan', 3, '1780399596480', '', NULL, '2026-06-02 19:26:36', 0, NULL, '2026-06-02 19:26:36', NULL, '2026-06-02 19:26:36'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364145783205895, 903364145783205894, 903364131379965953, '1', '85167000518', '62', 0, 0, 'chuanglan', 3, '1780399596699', '', NULL, '2026-06-02 19:26:37', 0, NULL, '2026-06-02 19:26:37', NULL, '2026-06-02 19:26:37'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364145783205897, 903364145783205896, 903364131379965953, '1', '85167000519', '62', 0, 0, 'chuanglan', 3, '1780399596912', '', NULL, '2026-06-02 19:26:37', 0, NULL, '2026-06-02 19:26:37', NULL, '2026-06-02 19:26:37'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364145783205900, 903364145783205899, 903364145783205898, '1', '85167000501', '62', 0, 0, 'chuanglan', 3, '1780399609272', '', NULL, '2026-06-02 19:26:49', 0, NULL, '2026-06-02 19:26:49', NULL, '2026-06-02 19:26:49'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364145783205902, 903364145783205901, 903364145783205898, '1', '85167000502', '62', 0, 0, 'chuanglan', 3, '1780399609507', '', NULL, '2026-06-02 19:26:50', 0, NULL, '2026-06-02 19:26:50', NULL, '2026-06-02 19:26:50'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364203123535873, 903364145783205903, 903364145783205898, '1', '85167000503', '62', 0, 0, 'chuanglan', 3, '1780399609718', '', NULL, '2026-06-02 19:26:50', 0, NULL, '2026-06-02 19:26:50', NULL, '2026-06-02 19:26:50'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364203123535875, 903364203123535874, 903364145783205898, '1', '85167000504', '62', 0, 0, 'chuanglan', 3, '1780399609935', '', NULL, '2026-06-02 19:26:50', 0, NULL, '2026-06-02 19:26:50', NULL, '2026-06-02 19:26:50'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364203123535877, 903364203123535876, 903364145783205898, '1', '85167000505', '62', 0, 0, 'chuanglan', 3, '1780399610150', '', NULL, '2026-06-02 19:26:50', 0, NULL, '2026-06-02 19:26:50', NULL, '2026-06-02 19:26:50'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364203123535879, 903364203123535878, 903364145783205898, '1', '85167000506', '62', 0, 0, 'chuanglan', 3, '1780399610361', '', NULL, '2026-06-02 19:26:50', 0, NULL, '2026-06-02 19:26:50', NULL, '2026-06-02 19:26:50'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364203123535881, 903364203123535880, 903364145783205898, '1', '85167000507', '62', 0, 0, 'chuanglan', 3, '1780399610573', '', NULL, '2026-06-02 19:26:51', 0, NULL, '2026-06-02 19:26:51', NULL, '2026-06-02 19:26:51'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364203123535883, 903364203123535882, 903364145783205898, '1', '85167000508', '62', 0, 0, 'chuanglan', 3, '1780399610786', '', NULL, '2026-06-02 19:26:51', 0, NULL, '2026-06-02 19:26:51', NULL, '2026-06-02 19:26:51'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364203123535885, 903364203123535884, 903364145783205898, '1', '85167000509', '62', 0, 0, 'chuanglan', 3, '1780399611000', '', NULL, '2026-06-02 19:26:51', 0, NULL, '2026-06-02 19:26:51', NULL, '2026-06-02 19:26:51'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364203123535887, 903364203123535886, 903364145783205898, '1', '85167000510', '62', 0, 0, 'chuanglan', 3, '1780399611214', '', NULL, '2026-06-02 19:26:51', 0, NULL, '2026-06-02 19:26:51', NULL, '2026-06-02 19:26:51'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364209423380482, 903364209423380481, 903364145783205898, '1', '85167000511', '62', 0, 0, 'chuanglan', 3, '1780399611427', '', NULL, '2026-06-02 19:26:51', 0, NULL, '2026-06-02 19:26:51', NULL, '2026-06-02 19:26:51'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364209423380484, 903364209423380483, 903364145783205898, '1', '85167000512', '62', 0, 0, 'chuanglan', 3, '1780399611641', '', NULL, '2026-06-02 19:26:52', 0, NULL, '2026-06-02 19:26:52', NULL, '2026-06-02 19:26:52'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364209423380486, 903364209423380485, 903364145783205898, '1', '85167000513', '62', 0, 0, 'chuanglan', 3, '1780399611857', '', NULL, '2026-06-02 19:26:52', 0, NULL, '2026-06-02 19:26:52', NULL, '2026-06-02 19:26:52'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364209423380488, 903364209423380487, 903364145783205898, '1', '85167000514', '62', 0, 0, 'chuanglan', 3, '1780399612067', '', NULL, '2026-06-02 19:26:52', 0, NULL, '2026-06-02 19:26:52', NULL, '2026-06-02 19:26:52'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364209423380490, 903364209423380489, 903364145783205898, '1', '85167000515', '62', 0, 0, 'chuanglan', 3, '1780399612283', '', NULL, '2026-06-02 19:26:52', 0, NULL, '2026-06-02 19:26:52', NULL, '2026-06-02 19:26:52'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364209423380492, 903364209423380491, 903364145783205898, '1', '85167000516', '62', 0, 0, 'chuanglan', 3, '1780399672019', '', NULL, '2026-06-02 19:27:52', 0, NULL, '2026-06-02 19:27:52', NULL, '2026-06-02 19:27:52'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364209423380494, 903364209423380493, 903364145783205898, '1', '85167000517', '62', 0, 0, 'chuanglan', 3, '1780399672236', '', NULL, '2026-06-02 19:27:52', 0, NULL, '2026-06-02 19:27:52', NULL, '2026-06-02 19:27:52'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364466219642881, 903364209423380495, 903364145783205898, '1', '85167000518', '62', 0, 0, 'chuanglan', 3, '1780399672445', '', NULL, '2026-06-02 19:27:52', 0, NULL, '2026-06-02 19:27:52', NULL, '2026-06-02 19:27:52'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903364466219642883, 903364466219642882, 903364145783205898, '1', '85167000519', '62', 0, 0, 'chuanglan', 3, '1780399672660', '', NULL, '2026-06-02 19:27:53', 0, NULL, '2026-06-02 19:27:53', NULL, '2026-06-02 19:27:53'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903365815527239683, 903365815527239682, 903365815527239681, '1', '85167000501', '62', 0, 0, 'chuanglan', 3, '1780399994498', '', NULL, '2026-06-02 19:33:15', 0, NULL, '2026-06-02 19:33:15', NULL, '2026-06-02 19:33:15'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903365815527239685, 903365815527239684, 903365815527239681, '1', '85167000502', '62', 0, 0, 'chuanglan', 3, '1780399994717', '', NULL, '2026-06-02 19:33:15', 0, NULL, '2026-06-02 19:33:15', NULL, '2026-06-02 19:33:15'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903365815527239687, 903365815527239686, 903365815527239681, '1', '85167000503', '62', 0, 0, 'chuanglan', 3, '1780399994933', '', NULL, '2026-06-02 19:33:15', 0, NULL, '2026-06-02 19:33:15', NULL, '2026-06-02 19:33:15'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903365815527239689, 903365815527239688, 903365815527239681, '1', '85167000504', '62', 0, 0, 'chuanglan', 3, '1780399995162', '', NULL, '2026-06-02 19:33:15', 0, NULL, '2026-06-02 19:33:15', NULL, '2026-06-02 19:33:15'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903365815527239691, 903365815527239690, 903365815527239681, '1', '85167000505', '62', 0, 0, 'chuanglan', 3, '1780399995377', '', NULL, '2026-06-02 19:33:15', 0, NULL, '2026-06-02 19:33:15', NULL, '2026-06-02 19:33:15'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903365815527239693, 903365815527239692, 903365815527239681, '1', '85167000506', '62', 0, 0, 'chuanglan', 3, '1780399995592', '', NULL, '2026-06-02 19:33:16', 0, NULL, '2026-06-02 19:33:16', NULL, '2026-06-02 19:33:16'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903365815527239695, 903365815527239694, 903365815527239681, '1', '85167000507', '62', 0, 0, 'chuanglan', 3, '1780399995807', '', NULL, '2026-06-02 19:33:16', 0, NULL, '2026-06-02 19:33:16', NULL, '2026-06-02 19:33:16'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903365822544310274, 903365822544310273, 903365815527239681, '1', '85167000508', '62', 0, 0, 'chuanglan', 3, '1780399996026', '', NULL, '2026-06-02 19:33:16', 0, NULL, '2026-06-02 19:33:16', NULL, '2026-06-02 19:33:16'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903365822544310276, 903365822544310275, 903365815527239681, '1', '85167000509', '62', 0, 0, 'chuanglan', 3, '1780399996240', '', NULL, '2026-06-02 19:33:16', 0, NULL, '2026-06-02 19:33:16', NULL, '2026-06-02 19:33:16'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903365822544310278, 903365822544310277, 903365815527239681, '1', '85167000510', '62', 0, 0, 'chuanglan', 3, '1780399996455', '', NULL, '2026-06-02 19:33:16', 0, NULL, '2026-06-02 19:33:16', NULL, '2026-06-02 19:33:16'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903365822544310280, 903365822544310279, 903365815527239681, '1', '85167000511', '62', 0, 0, 'chuanglan', 3, '1780399996672', '', NULL, '2026-06-02 19:33:17', 0, NULL, '2026-06-02 19:33:17', NULL, '2026-06-02 19:33:17'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903365822544310282, 903365822544310281, 903365815527239681, '1', '85167000512', '62', 0, 0, 'chuanglan', 3, '1780399996883', '', NULL, '2026-06-02 19:33:17', 0, NULL, '2026-06-02 19:33:17', NULL, '2026-06-02 19:33:17'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903365822544310284, 903365822544310283, 903365815527239681, '1', '85167000513', '62', 0, 0, 'chuanglan', 3, '1780399997095', '', NULL, '2026-06-02 19:33:17', 0, NULL, '2026-06-02 19:33:17', NULL, '2026-06-02 19:33:17'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903365822544310286, 903365822544310285, 903365815527239681, '1', '85167000514', '62', 0, 0, 'chuanglan', 3, '1780399997312', '', NULL, '2026-06-02 19:33:17', 0, NULL, '2026-06-02 19:33:17', NULL, '2026-06-02 19:33:17'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903365829699792897, 903365822544310287, 903365815527239681, '1', '85167000515', '62', 0, 0, 'chuanglan', 3, '1780399997524', '', NULL, '2026-06-02 19:33:18', 0, NULL, '2026-06-02 19:33:18', NULL, '2026-06-02 19:33:18'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903365829699792899, 903365829699792898, 903365815527239681, '1', '85167000516', '62', 0, 0, 'chuanglan', 3, '1780399997742', '', NULL, '2026-06-02 19:33:18', 0, NULL, '2026-06-02 19:33:18', NULL, '2026-06-02 19:33:18'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903365829699792901, 903365829699792900, 903365815527239681, '1', '85167000517', '62', 0, 0, 'chuanglan', 3, '1780399997954', '', NULL, '2026-06-02 19:33:18', 0, NULL, '2026-06-02 19:33:18', NULL, '2026-06-02 19:33:18'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903365829699792903, 903365829699792902, 903365815527239681, '1', '85167000518', '62', 0, 0, 'chuanglan', 3, '1780399998171', '', NULL, '2026-06-02 19:33:18', 0, NULL, '2026-06-02 19:33:18', NULL, '2026-06-02 19:33:18'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903365829699792905, 903365829699792904, 903365815527239681, '1', '85167000519', '62', 0, 0, 'chuanglan', 3, '1780399998384', '', NULL, '2026-06-02 19:33:18', 0, NULL, '2026-06-02 19:33:18', NULL, '2026-06-02 19:33:18'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903365829699792908, 903365829699792907, 903365829699792906, '1', '85167000501', '62', 0, 0, 'chuanglan', 3, '1780400124832', '', NULL, '2026-06-02 19:35:25', 0, NULL, '2026-06-02 19:35:25', NULL, '2026-06-02 19:35:25'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903365829699792910, 903365829699792909, 903365829699792906, '1', '85167000502', '62', 0, 0, 'chuanglan', 3, '1780400125059', '', NULL, '2026-06-02 19:35:25', 0, NULL, '2026-06-02 19:35:25', NULL, '2026-06-02 19:35:25'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903366365509545985, 903365829699792911, 903365829699792906, '1', '85167000503', '62', 0, 0, 'chuanglan', 3, '1780400125272', '', NULL, '2026-06-02 19:35:25', 0, NULL, '2026-06-02 19:35:25', NULL, '2026-06-02 19:35:25'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903366365509545987, 903366365509545986, 903365829699792906, '1', '85167000504', '62', 0, 0, 'chuanglan', 3, '1780400125487', '', NULL, '2026-06-02 19:35:25', 0, NULL, '2026-06-02 19:35:25', NULL, '2026-06-02 19:35:25'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903366365509545989, 903366365509545988, 903365829699792906, '1', '85167000505', '62', 0, 0, 'chuanglan', 3, '1780400125703', '', NULL, '2026-06-02 19:35:26', 0, NULL, '2026-06-02 19:35:26', NULL, '2026-06-02 19:35:26'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903366365509545991, 903366365509545990, 903365829699792906, '1', '85167000506', '62', 0, 0, 'chuanglan', 3, '1780400125918', '', NULL, '2026-06-02 19:35:26', 0, NULL, '2026-06-02 19:35:26', NULL, '2026-06-02 19:35:26'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903366365509545993, 903366365509545992, 903365829699792906, '1', '85167000507', '62', 0, 0, 'chuanglan', 3, '1780400126128', '', NULL, '2026-06-02 19:35:26', 0, NULL, '2026-06-02 19:35:26', NULL, '2026-06-02 19:35:26'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903366365509545995, 903366365509545994, 903365829699792906, '1', '85167000508', '62', 0, 0, 'chuanglan', 3, '1780400126345', '', NULL, '2026-06-02 19:35:26', 0, NULL, '2026-06-02 19:35:26', NULL, '2026-06-02 19:35:26'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903366365509545997, 903366365509545996, 903365829699792906, '1', '85167000509', '62', 0, 0, 'chuanglan', 3, '1780400126556', '', NULL, '2026-06-02 19:35:27', 0, NULL, '2026-06-02 19:35:27', NULL, '2026-06-02 19:35:27'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903366365509545999, 903366365509545998, 903365829699792906, '1', '85167000510', '62', 0, 0, 'chuanglan', 3, '1780400126771', '', NULL, '2026-06-02 19:35:27', 0, NULL, '2026-06-02 19:35:27', NULL, '2026-06-02 19:35:27'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903366371834556418, 903366371834556417, 903365829699792906, '1', '85167000511', '62', 0, 0, 'chuanglan', 3, '1780400126985', '', NULL, '2026-06-02 19:35:27', 0, NULL, '2026-06-02 19:35:27', NULL, '2026-06-02 19:35:27'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903366371834556420, 903366371834556419, 903365829699792906, '1', '85167000512', '62', 0, 0, 'chuanglan', 3, '1780400127199', '', NULL, '2026-06-02 19:35:27', 0, NULL, '2026-06-02 19:35:27', NULL, '2026-06-02 19:35:27'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903366371834556422, 903366371834556421, 903365829699792906, '1', '85167000513', '62', 0, 0, 'chuanglan', 3, '1780400145080', '', NULL, '2026-06-02 19:35:45', 0, NULL, '2026-06-02 19:35:45', NULL, '2026-06-02 19:35:45'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903366371834556424, 903366371834556423, 903365829699792906, '1', '85167000514', '62', 0, 0, 'chuanglan', 3, '1780400145295', '', NULL, '2026-06-02 19:35:45', 0, NULL, '2026-06-02 19:35:45', NULL, '2026-06-02 19:35:45'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903366371834556426, 903366371834556425, 903365829699792906, '1', '85167000515', '62', 0, 0, 'chuanglan', 3, '1780400145508', '', NULL, '2026-06-02 19:35:46', 0, NULL, '2026-06-02 19:35:46', NULL, '2026-06-02 19:35:46'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903366371834556428, 903366371834556427, 903365829699792906, '1', '85167000516', '62', 0, 0, 'chuanglan', 3, '1780400145720', '', NULL, '2026-06-02 19:35:46', 0, NULL, '2026-06-02 19:35:46', NULL, '2026-06-02 19:35:46'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903366371834556430, 903366371834556429, 903365829699792906, '1', '85167000517', '62', 0, 0, 'chuanglan', 3, '1780400145938', '', NULL, '2026-06-02 19:35:46', 0, NULL, '2026-06-02 19:35:46', NULL, '2026-06-02 19:35:46'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903366453082419201, 903366371834556431, 903365829699792906, '1', '85167000518', '62', 0, 0, 'chuanglan', 3, '1780400146151', '', NULL, '2026-06-02 19:35:46', 0, NULL, '2026-06-02 19:35:46', NULL, '2026-06-02 19:35:46'); +INSERT INTO `sms_record_detail` (`id`, `record_id`, `task_id`, `app_id`, `mobile`, `nationcode`, `send_status`, `report_status`, `channel_code`, `channel_account_id`, `msgid`, `error_msg`, `price`, `sender_time`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (903366453082419203, 903366453082419202, 903365829699792906, '1', '85167000519', '62', 0, 0, 'chuanglan', 3, '1780400146363', '', NULL, '2026-06-02 19:35:46', 0, NULL, '2026-06-02 19:35:46', NULL, '2026-06-02 19:35:46'); +COMMIT; + +-- ---------------------------- +-- Table structure for sms_sign_info +-- ---------------------------- +DROP TABLE IF EXISTS `sms_sign_info`; +CREATE TABLE `sms_sign_info` ( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键ID', + `sign_name` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '签名名称', + `tenant_id` bigint NOT NULL DEFAULT '1' COMMENT '租户ID', + `sign_type` tinyint NOT NULL DEFAULT '0' COMMENT '签名类型:0-企业,1-APP,2-商标,3-政府/事业单位/其他企业', + `international` tinyint NOT NULL DEFAULT '0' COMMENT '短信区域:0-国内短信 1-国际/港澳台短信', + `binding_account_ids` json DEFAULT NULL COMMENT '绑定的账号ID集合(JSON数组格式,如 ["1001","1002"])', + `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '备注说明', + `deleted` tinyint(1) NOT NULL DEFAULT '0' COMMENT '状态:0-正常,1-禁用', + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建人', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '更新人', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + PRIMARY KEY (`id`), + KEY `idx_sign_name` (`sign_name`) +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='短信签名信息表'; + +-- ---------------------------- +-- Records of sms_sign_info +-- ---------------------------- +BEGIN; +INSERT INTO `sms_sign_info` (`id`, `sign_name`, `tenant_id`, `sign_type`, `international`, `binding_account_ids`, `remark`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (1, 'iiiii', 1, 0, 0, '[1]', '', 0, '1', '2026-06-01 16:11:04', '1', '2026-06-01 16:11:04'); +INSERT INTO `sms_sign_info` (`id`, `sign_name`, `tenant_id`, `sign_type`, `international`, `binding_account_ids`, `remark`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (2, 'APP', 1, 0, 1, '[1]', '', 0, '1', '2026-06-02 09:55:01', '1', '2026-06-02 15:26:03'); +INSERT INTO `sms_sign_info` (`id`, `sign_name`, `tenant_id`, `sign_type`, `international`, `binding_account_ids`, `remark`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (3, '创南签名', 1, 0, 1, '[3]', '', 0, '1', '2026-06-02 15:44:08', '1', '2026-06-02 15:44:08'); +COMMIT; + +-- ---------------------------- +-- Table structure for sms_task +-- ---------------------------- +DROP TABLE IF EXISTS `sms_task`; +CREATE TABLE `sms_task` ( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '任务编号', + `app_id` bigint NOT NULL COMMENT '应用编号', + `task_name` varchar(100) NOT NULL DEFAULT '' COMMENT '任务名称', + `sign_id` bigint NOT NULL COMMENT '签名编号', + `sign_name` varchar(20) NOT NULL COMMENT '签名名称', + `template_id` bigint NOT NULL COMMENT '模版编号', + `template_name` varchar(50) NOT NULL COMMENT '模版名称', + `template_content` text NOT NULL COMMENT '模版内容', + `template_param` varchar(500) NOT NULL COMMENT '模版参数', + `total_count` int NOT NULL DEFAULT '0' COMMENT '手机总数量', + `success_count` int NOT NULL DEFAULT '0' COMMENT '发送成功数量', + `fail_count` int NOT NULL DEFAULT '0' COMMENT '发送失败数量', + `task_status` tinyint NOT NULL DEFAULT '0' COMMENT '任务状态:0-待发送 1-发送中 2-已完成 3-已取消', + `international` tinyint(1) NOT NULL DEFAULT '0' COMMENT '短信类型:0-国内 1-国际', + `load_to_queue` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否加载到队列:0-未加载 1-已加载', + `sender_ip` varchar(40) DEFAULT '' COMMENT '发送IP', + `attime` varchar(30) DEFAULT '' COMMENT '指定发送时间', + `remark` varchar(255) DEFAULT NULL COMMENT '备注信息', + `deleted` tinyint(1) NOT NULL DEFAULT '0' COMMENT '删除状态:0-正常 1-删除', + `creator` varchar(64) DEFAULT '' COMMENT '创建人', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) DEFAULT '' COMMENT '更新人', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `source` tinyint NOT NULL DEFAULT '0' COMMENT '来源:0-网关 1-admin控制台上传', + PRIMARY KEY (`id`), + KEY `idx_app_id` (`app_id`), + KEY `idx_create_time` (`create_time`) +) ENGINE=InnoDB AUTO_INCREMENT=903365829699792907 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='短信任务表'; + +-- ---------------------------- +-- Records of sms_task +-- ---------------------------- +BEGIN; +INSERT INTO `sms_task` (`id`, `app_id`, `task_name`, `sign_id`, `sign_name`, `template_id`, `template_name`, `template_content`, `template_param`, `total_count`, `success_count`, `fail_count`, `task_status`, `international`, `load_to_queue`, `sender_ip`, `attime`, `remark`, `deleted`, `creator`, `create_time`, `updater`, `update_time`, `source`) VALUES (902955590269759489, 1, 'dd', 1, 'iiiii', 1, 'ddddd', 'ddd', '{}', 1, 0, 1, 2, 0, 0, '0:0:0:0:0:0:0:1', '', NULL, 0, '1', '2026-06-01 16:23:09', NULL, '2026-06-01 16:23:09', 0); +INSERT INTO `sms_task` (`id`, `app_id`, `task_name`, `sign_id`, `sign_name`, `template_id`, `template_name`, `template_content`, `template_param`, `total_count`, `success_count`, `fail_count`, `task_status`, `international`, `load_to_queue`, `sender_ip`, `attime`, `remark`, `deleted`, `creator`, `create_time`, `updater`, `update_time`, `source`) VALUES (902955590269759491, 1, '测试任务', 2, '测试APP', 2, '测试模板', '这是一条测试信息', '{}', 1, 0, 0, 0, 1, 0, '0:0:0:0:0:0:0:1', '1780451764000', NULL, 0, '1', '2026-06-02 09:56:18', '1', '2026-06-02 09:56:18', 0); +INSERT INTO `sms_task` (`id`, `app_id`, `task_name`, `sign_id`, `sign_name`, `template_id`, `template_name`, `template_content`, `template_param`, `total_count`, `success_count`, `fail_count`, `task_status`, `international`, `load_to_queue`, `sender_ip`, `attime`, `remark`, `deleted`, `creator`, `create_time`, `updater`, `update_time`, `source`) VALUES (903291107351949313, 1, '测试任务1111', 2, '测试APP', 3, '创南测试模板', 'demo demo', '{}', 1, 0, 0, 1, 1, 0, '0:0:0:0:0:0:0:1', '', NULL, 0, '1', '2026-06-02 14:36:22', NULL, '2026-06-02 14:36:22', 0); +INSERT INTO `sms_task` (`id`, `app_id`, `task_name`, `sign_id`, `sign_name`, `template_id`, `template_name`, `template_content`, `template_param`, `total_count`, `success_count`, `fail_count`, `task_status`, `international`, `load_to_queue`, `sender_ip`, `attime`, `remark`, `deleted`, `creator`, `create_time`, `updater`, `update_time`, `source`) VALUES (903291701173121025, 1, 'xxxx', 2, '测试APP', 3, '创南测试模板', 'demo demo', '{}', 1, 0, 0, 1, 1, 0, '0:0:0:0:0:0:0:1', '', NULL, 0, '1', '2026-06-02 14:38:44', NULL, '2026-06-02 14:38:44', 0); +INSERT INTO `sms_task` (`id`, `app_id`, `task_name`, `sign_id`, `sign_name`, `template_id`, `template_name`, `template_content`, `template_param`, `total_count`, `success_count`, `fail_count`, `task_status`, `international`, `load_to_queue`, `sender_ip`, `attime`, `remark`, `deleted`, `creator`, `create_time`, `updater`, `update_time`, `source`) VALUES (903292505672437763, 1, 'ddd', 2, '测试APP', 3, '创南测试模板', 'demo demo', '', 1, 0, 0, 1, 1, 0, '', '', NULL, 0, '1', '2026-06-02 14:50:02', NULL, '2026-06-02 14:50:02', 1); +INSERT INTO `sms_task` (`id`, `app_id`, `task_name`, `sign_id`, `sign_name`, `template_id`, `template_name`, `template_content`, `template_param`, `total_count`, `success_count`, `fail_count`, `task_status`, `international`, `load_to_queue`, `sender_ip`, `attime`, `remark`, `deleted`, `creator`, `create_time`, `updater`, `update_time`, `source`) VALUES (903292505672437765, 1, 'gggg', 2, '测试APP', 3, '创南测试模板', 'demo demo', '', 1, 0, 0, 1, 1, 0, '', '', NULL, 0, '1', '2026-06-02 14:52:12', NULL, '2026-06-02 14:52:12', 1); +INSERT INTO `sms_task` (`id`, `app_id`, `task_name`, `sign_id`, `sign_name`, `template_id`, `template_name`, `template_content`, `template_param`, `total_count`, `success_count`, `fail_count`, `task_status`, `international`, `load_to_queue`, `sender_ip`, `attime`, `remark`, `deleted`, `creator`, `create_time`, `updater`, `update_time`, `source`) VALUES (903292505672437767, 1, 'ff', 2, '测试APP', 3, '创南测试模板', 'demo demo', '', 1, 0, 0, 1, 1, 0, '', '', NULL, 0, '1', '2026-06-02 14:54:45', NULL, '2026-06-02 14:54:45', 1); +INSERT INTO `sms_task` (`id`, `app_id`, `task_name`, `sign_id`, `sign_name`, `template_id`, `template_name`, `template_content`, `template_param`, `total_count`, `success_count`, `fail_count`, `task_status`, `international`, `load_to_queue`, `sender_ip`, `attime`, `remark`, `deleted`, `creator`, `create_time`, `updater`, `update_time`, `source`) VALUES (903292505674182657, 1, 'fffff', 2, '测试APP', 3, '创南测试模板', 'demo demo', '{}', 1, 0, 0, 1, 1, 0, '0:0:0:0:0:0:0:1', '', NULL, 0, '1', '2026-06-02 14:41:56', NULL, '2026-06-02 14:41:56', 0); +INSERT INTO `sms_task` (`id`, `app_id`, `task_name`, `sign_id`, `sign_name`, `template_id`, `template_name`, `template_content`, `template_param`, `total_count`, `success_count`, `fail_count`, `task_status`, `international`, `load_to_queue`, `sender_ip`, `attime`, `remark`, `deleted`, `creator`, `create_time`, `updater`, `update_time`, `source`) VALUES (903298177864617985, 1, 'gggg', 2, '测试APP', 3, '创南测试模板', 'demo demo', '', 1, 0, 0, 1, 1, 0, '', '', NULL, 0, '1', '2026-06-02 15:04:28', NULL, '2026-06-02 15:04:28', 1); +INSERT INTO `sms_task` (`id`, `app_id`, `task_name`, `sign_id`, `sign_name`, `template_id`, `template_name`, `template_content`, `template_param`, `total_count`, `success_count`, `fail_count`, `task_status`, `international`, `load_to_queue`, `sender_ip`, `attime`, `remark`, `deleted`, `creator`, `create_time`, `updater`, `update_time`, `source`) VALUES (903299547900465153, 1, 'ff', 2, '测试APP', 3, '创南测试模板', 'demo demo', '', 1, 0, 0, 1, 1, 0, '', '', NULL, 0, '1', '2026-06-02 15:09:55', NULL, '2026-06-02 15:09:55', 1); +INSERT INTO `sms_task` (`id`, `app_id`, `task_name`, `sign_id`, `sign_name`, `template_id`, `template_name`, `template_content`, `template_param`, `total_count`, `success_count`, `fail_count`, `task_status`, `international`, `load_to_queue`, `sender_ip`, `attime`, `remark`, `deleted`, `creator`, `create_time`, `updater`, `update_time`, `source`) VALUES (903299547900465155, 1, 'cccv', 2, '测试APP', 3, '创南测试模板', 'demo demo', '', 1, 0, 0, 1, 1, 0, '', '', NULL, 0, '1', '2026-06-02 15:14:10', NULL, '2026-06-02 15:18:50', 1); +INSERT INTO `sms_task` (`id`, `app_id`, `task_name`, `sign_id`, `sign_name`, `template_id`, `template_name`, `template_content`, `template_param`, `total_count`, `success_count`, `fail_count`, `task_status`, `international`, `load_to_queue`, `sender_ip`, `attime`, `remark`, `deleted`, `creator`, `create_time`, `updater`, `update_time`, `source`) VALUES (903302087276457985, 1, 'vvv', 2, '测试APP', 3, '创南测试模板', 'demo demo', '{}', 1, 0, 1, 2, 1, 0, '0:0:0:0:0:0:0:1', '', NULL, 0, '1', '2026-06-02 15:20:00', NULL, '2026-06-02 15:22:03', 0); +INSERT INTO `sms_task` (`id`, `app_id`, `task_name`, `sign_id`, `sign_name`, `template_id`, `template_name`, `template_content`, `template_param`, `total_count`, `success_count`, `fail_count`, `task_status`, `international`, `load_to_queue`, `sender_ip`, `attime`, `remark`, `deleted`, `creator`, `create_time`, `updater`, `update_time`, `source`) VALUES (903302087276457987, 1, 'dddd', 2, '测试APP', 3, '创南测试模板', 'demo demo', '{}', 1, 0, 1, 2, 1, 0, '0:0:0:0:0:0:0:1', '', NULL, 0, '1', '2026-06-02 15:24:16', NULL, '2026-06-02 15:27:21', 0); +INSERT INTO `sms_task` (`id`, `app_id`, `task_name`, `sign_id`, `sign_name`, `template_id`, `template_name`, `template_content`, `template_param`, `total_count`, `success_count`, `fail_count`, `task_status`, `international`, `load_to_queue`, `sender_ip`, `attime`, `remark`, `deleted`, `creator`, `create_time`, `updater`, `update_time`, `source`) VALUES (903302087276457989, 1, 'ffff', 2, '测试APP', 3, '创南测试模板', 'demo demo', '{}', 1, 0, 1, 2, 1, 0, '0:0:0:0:0:0:0:1', '', NULL, 0, '1', '2026-06-02 15:29:16', NULL, '2026-06-02 15:32:51', 0); +INSERT INTO `sms_task` (`id`, `app_id`, `task_name`, `sign_id`, `sign_name`, `template_id`, `template_name`, `template_content`, `template_param`, `total_count`, `success_count`, `fail_count`, `task_status`, `international`, `load_to_queue`, `sender_ip`, `attime`, `remark`, `deleted`, `creator`, `create_time`, `updater`, `update_time`, `source`) VALUES (903302087276457991, 1, 'kk', 2, '测试APP', 3, '创南测试模板', 'demo demo', '{}', 1, 0, 1, 2, 1, 0, '0:0:0:0:0:0:0:1', '', NULL, 0, '1', '2026-06-02 15:33:44', NULL, '2026-06-02 15:34:38', 0); +INSERT INTO `sms_task` (`id`, `app_id`, `task_name`, `sign_id`, `sign_name`, `template_id`, `template_name`, `template_content`, `template_param`, `total_count`, `success_count`, `fail_count`, `task_status`, `international`, `load_to_queue`, `sender_ip`, `attime`, `remark`, `deleted`, `creator`, `create_time`, `updater`, `update_time`, `source`) VALUES (903307441699778561, 1, 'fff', 2, 'APP', 3, '创南测试模板', 'demo demo', '{}', 1, 0, 1, 2, 1, 0, '0:0:0:0:0:0:0:1', '', NULL, 0, '1', '2026-06-02 15:41:17', NULL, '2026-06-02 15:42:59', 0); +INSERT INTO `sms_task` (`id`, `app_id`, `task_name`, `sign_id`, `sign_name`, `template_id`, `template_name`, `template_content`, `template_param`, `total_count`, `success_count`, `fail_count`, `task_status`, `international`, `load_to_queue`, `sender_ip`, `attime`, `remark`, `deleted`, `creator`, `create_time`, `updater`, `update_time`, `source`) VALUES (903307441699778563, 1, 'df', 3, '创南签名', 4, '创蓝测试001', 'demo demo demo', '{}', 1, 0, 1, 2, 1, 0, '0:0:0:0:0:0:0:1', '', NULL, 0, '1', '2026-06-02 15:47:19', NULL, '2026-06-02 15:49:05', 0); +INSERT INTO `sms_task` (`id`, `app_id`, `task_name`, `sign_id`, `sign_name`, `template_id`, `template_name`, `template_content`, `template_param`, `total_count`, `success_count`, `fail_count`, `task_status`, `international`, `load_to_queue`, `sender_ip`, `attime`, `remark`, `deleted`, `creator`, `create_time`, `updater`, `update_time`, `source`) VALUES (903328516840058881, 1, 'fff', 3, '创南签名', 4, '创蓝测试001', 'demo demo demo', '{}', 1, 1, 0, 2, 1, 0, '0:0:0:0:0:0:0:1', '', NULL, 0, '1', '2026-06-02 17:05:01', NULL, '2026-06-02 17:05:02', 0); +INSERT INTO `sms_task` (`id`, `app_id`, `task_name`, `sign_id`, `sign_name`, `template_id`, `template_name`, `template_content`, `template_param`, `total_count`, `success_count`, `fail_count`, `task_status`, `international`, `load_to_queue`, `sender_ip`, `attime`, `remark`, `deleted`, `creator`, `create_time`, `updater`, `update_time`, `source`) VALUES (903328516840058884, 1, 'fffff', 3, '创南签名', 4, '创蓝测试001', 'demo demo demo', '{}', 1, 1, 0, 2, 1, 0, '0:0:0:0:0:0:0:1', '1780391340000', NULL, 0, '1', '2026-06-02 17:08:30', NULL, '2026-06-02 17:09:00', 0); +INSERT INTO `sms_task` (`id`, `app_id`, `task_name`, `sign_id`, `sign_name`, `template_id`, `template_name`, `template_content`, `template_param`, `total_count`, `success_count`, `fail_count`, `task_status`, `international`, `load_to_queue`, `sender_ip`, `attime`, `remark`, `deleted`, `creator`, `create_time`, `updater`, `update_time`, `source`) VALUES (903342870348132353, 1, 'jjj', 3, '创南签名', 4, '创蓝测试001', 'demo demo demo', '{}', 1, 1, 0, 2, 1, 0, '0:0:0:0:0:0:0:1', '', NULL, 0, '1', '2026-06-02 18:02:04', '1', '2026-06-02 18:02:08', 0); +INSERT INTO `sms_task` (`id`, `app_id`, `task_name`, `sign_id`, `sign_name`, `template_id`, `template_name`, `template_content`, `template_param`, `total_count`, `success_count`, `fail_count`, `task_status`, `international`, `load_to_queue`, `sender_ip`, `attime`, `remark`, `deleted`, `creator`, `create_time`, `updater`, `update_time`, `source`) VALUES (903342870348132356, 1, 'fff', 3, '创南签名', 4, '创蓝测试001', 'demo demo demo', '{}', 14, 14, 0, 2, 1, 0, '0:0:0:0:0:0:0:1', '', NULL, 0, '1', '2026-06-02 18:03:39', '1', '2026-06-02 18:03:54', 0); +INSERT INTO `sms_task` (`id`, `app_id`, `task_name`, `sign_id`, `sign_name`, `template_id`, `template_name`, `template_content`, `template_param`, `total_count`, `success_count`, `fail_count`, `task_status`, `international`, `load_to_queue`, `sender_ip`, `attime`, `remark`, `deleted`, `creator`, `create_time`, `updater`, `update_time`, `source`) VALUES (903343291393339395, 1, 'ggg', 3, '创南签名', 4, '创蓝测试001', 'demo demo demo', '{}', 14, 10, 0, 5, 1, 0, '0:0:0:0:0:0:0:1', '', NULL, 0, '1', '2026-06-02 18:10:21', '1', '2026-06-02 19:16:53', 0); +INSERT INTO `sms_task` (`id`, `app_id`, `task_name`, `sign_id`, `sign_name`, `template_id`, `template_name`, `template_content`, `template_param`, `total_count`, `success_count`, `fail_count`, `task_status`, `international`, `load_to_queue`, `sender_ip`, `attime`, `remark`, `deleted`, `creator`, `create_time`, `updater`, `update_time`, `source`) VALUES (903345671576973313, 1, 'fff', 3, '创南签名', 4, '创蓝测试001', 'demo demo demo', '{}', 19, 1, 9, 5, 1, 0, '0:0:0:0:0:0:0:1', '', NULL, 0, '1', '2026-06-02 18:13:11', '1', '2026-06-02 18:14:46', 0); +INSERT INTO `sms_task` (`id`, `app_id`, `task_name`, `sign_id`, `sign_name`, `template_id`, `template_name`, `template_content`, `template_param`, `total_count`, `success_count`, `fail_count`, `task_status`, `international`, `load_to_queue`, `sender_ip`, `attime`, `remark`, `deleted`, `creator`, `create_time`, `updater`, `update_time`, `source`) VALUES (903357337702199297, 1, 'cccc', 3, '创南签名', 4, '创蓝测试001', 'demo demo demo', '{}', 19, 6, 11, 5, 1, 0, '0:0:0:0:0:0:0:1', '', NULL, 0, '1', '2026-06-02 18:59:33', '1', '2026-06-02 19:01:15', 0); +INSERT INTO `sms_task` (`id`, `app_id`, `task_name`, `sign_id`, `sign_name`, `template_id`, `template_name`, `template_content`, `template_param`, `total_count`, `success_count`, `fail_count`, `task_status`, `international`, `load_to_queue`, `sender_ip`, `attime`, `remark`, `deleted`, `creator`, `create_time`, `updater`, `update_time`, `source`) VALUES (903357732671418382, 1, 'hhh', 3, '创南签名', 4, '创蓝测试001', 'demo demo demo', '{}', 5, 4, 0, 2, 1, 0, '0:0:0:0:0:0:0:1', '', NULL, 0, '1', '2026-06-02 19:11:21', '1', '2026-06-02 19:12:27', 0); +INSERT INTO `sms_task` (`id`, `app_id`, `task_name`, `sign_id`, `sign_name`, `template_id`, `template_name`, `template_content`, `template_param`, `total_count`, `success_count`, `fail_count`, `task_status`, `international`, `load_to_queue`, `sender_ip`, `attime`, `remark`, `deleted`, `creator`, `create_time`, `updater`, `update_time`, `source`) VALUES (903364131379965953, 1, 'ffffs', 3, '创南签名', 4, '创蓝测试001', 'demo demo demo', '{}', 19, 19, 0, 2, 1, 0, '0:0:0:0:0:0:0:1', '', NULL, 0, '1', '2026-06-02 19:26:33', '1', '2026-06-02 19:26:36', 0); +INSERT INTO `sms_task` (`id`, `app_id`, `task_name`, `sign_id`, `sign_name`, `template_id`, `template_name`, `template_content`, `template_param`, `total_count`, `success_count`, `fail_count`, `task_status`, `international`, `load_to_queue`, `sender_ip`, `attime`, `remark`, `deleted`, `creator`, `create_time`, `updater`, `update_time`, `source`) VALUES (903364145783205898, 1, 'ddd', 3, '创南签名', 4, '创蓝测试001', 'demo demo demo', '{}', 19, 18, 0, 2, 1, 0, '0:0:0:0:0:0:0:1', '', NULL, 0, '1', '2026-06-02 19:26:49', '1', '2026-06-02 19:27:52', 0); +INSERT INTO `sms_task` (`id`, `app_id`, `task_name`, `sign_id`, `sign_name`, `template_id`, `template_name`, `template_content`, `template_param`, `total_count`, `success_count`, `fail_count`, `task_status`, `international`, `load_to_queue`, `sender_ip`, `attime`, `remark`, `deleted`, `creator`, `create_time`, `updater`, `update_time`, `source`) VALUES (903365815527239681, 1, 'kkk', 3, '创南签名', 4, '创蓝测试001', 'demo demo demo', '{}', 19, 19, 0, 2, 1, 0, '0:0:0:0:0:0:0:1', '', NULL, 0, '1', '2026-06-02 19:33:14', '1', '2026-06-02 19:33:18', 0); +INSERT INTO `sms_task` (`id`, `app_id`, `task_name`, `sign_id`, `sign_name`, `template_id`, `template_name`, `template_content`, `template_param`, `total_count`, `success_count`, `fail_count`, `task_status`, `international`, `load_to_queue`, `sender_ip`, `attime`, `remark`, `deleted`, `creator`, `create_time`, `updater`, `update_time`, `source`) VALUES (903365829699792906, 1, 'hhh', 3, '创南签名', 4, '创蓝测试001', 'demo demo demo', '{}', 19, 18, 0, 2, 1, 0, '0:0:0:0:0:0:0:1', '', NULL, 0, '1', '2026-06-02 19:35:25', '1', '2026-06-02 19:35:46', 0); +COMMIT; + +-- ---------------------------- +-- Table structure for sms_task_content +-- ---------------------------- +DROP TABLE IF EXISTS `sms_task_content`; +CREATE TABLE `sms_task_content` ( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '任务编号', + `task_content` mediumtext NOT NULL COMMENT '若无模板参数,则手机号码列表,手机号用英文逗号分隔 ,若模板参数,则手机号码列表,手机号用英文逗号分隔,参数用英文冒号分隔,参数格式为:手机号1^参数1^参数2^参数3,手机号2^参数1^参数2^参数3', + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=903365829699792907 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='短信任务内容表'; + +-- ---------------------------- +-- Records of sms_task_content +-- ---------------------------- +BEGIN; +INSERT INTO `sms_task_content` (`id`, `task_content`) VALUES (902955590269759489, '15102879295'); +INSERT INTO `sms_task_content` (`id`, `task_content`) VALUES (902955590269759491, '15102879295'); +INSERT INTO `sms_task_content` (`id`, `task_content`) VALUES (903291107351949313, '006285167000597'); +INSERT INTO `sms_task_content` (`id`, `task_content`) VALUES (903291701173121025, '006285167000597'); +INSERT INTO `sms_task_content` (`id`, `task_content`) VALUES (903292505672437763, '85167000597'); +INSERT INTO `sms_task_content` (`id`, `task_content`) VALUES (903292505672437765, '85167000597'); +INSERT INTO `sms_task_content` (`id`, `task_content`) VALUES (903292505672437767, '85167000597'); +INSERT INTO `sms_task_content` (`id`, `task_content`) VALUES (903292505674182657, '006285167000597'); +INSERT INTO `sms_task_content` (`id`, `task_content`) VALUES (903298177864617985, '85167000597'); +INSERT INTO `sms_task_content` (`id`, `task_content`) VALUES (903299547900465153, '85167000597'); +INSERT INTO `sms_task_content` (`id`, `task_content`) VALUES (903299547900465155, '85167000597'); +INSERT INTO `sms_task_content` (`id`, `task_content`) VALUES (903302087276457985, '6285167000597'); +INSERT INTO `sms_task_content` (`id`, `task_content`) VALUES (903302087276457987, '6285167000597'); +INSERT INTO `sms_task_content` (`id`, `task_content`) VALUES (903302087276457989, '6285167000597'); +INSERT INTO `sms_task_content` (`id`, `task_content`) VALUES (903302087276457991, '6285167000597'); +INSERT INTO `sms_task_content` (`id`, `task_content`) VALUES (903307441699778561, '6285167000597'); +INSERT INTO `sms_task_content` (`id`, `task_content`) VALUES (903307441699778563, '6285167000597'); +INSERT INTO `sms_task_content` (`id`, `task_content`) VALUES (903328516840058881, '6285167000597'); +INSERT INTO `sms_task_content` (`id`, `task_content`) VALUES (903328516840058884, '6285167000597'); +INSERT INTO `sms_task_content` (`id`, `task_content`) VALUES (903342870348132353, '6285167000597'); +INSERT INTO `sms_task_content` (`id`, `task_content`) VALUES (903342870348132356, '6285167000501,6285167000502,6285167000503,6285167000504,6285167000505,6285167000506,6285167000507,6285167000508,6285167000509,6285167000510,6285167000511,6285167000512,6285167000513,6285167000514'); +INSERT INTO `sms_task_content` (`id`, `task_content`) VALUES (903343291393339395, '6285167000501,6285167000502,6285167000503,6285167000504,6285167000505,6285167000506,6285167000507,6285167000508,6285167000509,6285167000510,6285167000511,6285167000512,6285167000513,6285167000514'); +INSERT INTO `sms_task_content` (`id`, `task_content`) VALUES (903345671576973313, '6285167000501,6285167000502,6285167000503,6285167000504,6285167000505,6285167000506,6285167000507,6285167000508,6285167000509,6285167000510,6285167000511,6285167000512,6285167000513,6285167000514,6285167000515,6285167000516,6285167000517,6285167000518,6285167000519'); +INSERT INTO `sms_task_content` (`id`, `task_content`) VALUES (903357337702199297, '6285167000501,6285167000502,6285167000503,6285167000504,6285167000505,6285167000506,6285167000507,6285167000508,6285167000509,6285167000510,6285167000511,6285167000512,6285167000513,6285167000514,6285167000515,6285167000516,6285167000517,6285167000518,6285167000519'); +INSERT INTO `sms_task_content` (`id`, `task_content`) VALUES (903357732671418382, '6285167000501,6285167000502,6285167000503,6285167000504,6285167000505'); +INSERT INTO `sms_task_content` (`id`, `task_content`) VALUES (903364131379965953, '6285167000501,6285167000502,6285167000503,6285167000504,6285167000505,6285167000506,6285167000507,6285167000508,6285167000509,6285167000510,6285167000511,6285167000512,6285167000513,6285167000514,6285167000515,6285167000516,6285167000517,6285167000518,6285167000519'); +INSERT INTO `sms_task_content` (`id`, `task_content`) VALUES (903364145783205898, '6285167000501,6285167000502,6285167000503,6285167000504,6285167000505,6285167000506,6285167000507,6285167000508,6285167000509,6285167000510,6285167000511,6285167000512,6285167000513,6285167000514,6285167000515,6285167000516,6285167000517,6285167000518,6285167000519'); +INSERT INTO `sms_task_content` (`id`, `task_content`) VALUES (903365815527239681, '6285167000501,6285167000502,6285167000503,6285167000504,6285167000505,6285167000506,6285167000507,6285167000508,6285167000509,6285167000510,6285167000511,6285167000512,6285167000513,6285167000514,6285167000515,6285167000516,6285167000517,6285167000518,6285167000519'); +INSERT INTO `sms_task_content` (`id`, `task_content`) VALUES (903365829699792906, '6285167000501,6285167000502,6285167000503,6285167000504,6285167000505,6285167000506,6285167000507,6285167000508,6285167000509,6285167000510,6285167000511,6285167000512,6285167000513,6285167000514,6285167000515,6285167000516,6285167000517,6285167000518,6285167000519'); +COMMIT; + +-- ---------------------------- +-- Table structure for sms_template_binding_info +-- ---------------------------- +DROP TABLE IF EXISTS `sms_template_binding_info`; +CREATE TABLE `sms_template_binding_info` ( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '绑定ID', + `template_id` bigint NOT NULL COMMENT '模板ID', + `template_code` varchar(64) NOT NULL COMMENT '三方模板编码', + `template_content` varchar(500) NOT NULL COMMENT '三方模板内容', + `channel_id` bigint NOT NULL COMMENT '渠道ID', + `channel_code` varchar(64) NOT NULL COMMENT '渠道标识', + `account_id` bigint DEFAULT NULL COMMENT '渠道账户ID', + `status` tinyint NOT NULL DEFAULT '0' COMMENT '审核状态:0-待提交 1-待审核 2-审核成功 3-审核失败 4-撤销', + `deleted` tinyint(1) NOT NULL DEFAULT '0' COMMENT '删除状态:0-正常 1-删除', + `audit_remark` varchar(200) DEFAULT '' COMMENT '审核备注', + `creator` varchar(64) DEFAULT '' COMMENT '创建人', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) DEFAULT '' COMMENT '更新人', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + PRIMARY KEY (`id`), + UNIQUE KEY `uk_template_channel_account` (`template_id`,`channel_id`), + KEY `idx_template_id` (`template_id`), + KEY `idx_channel_id` (`channel_id`), + KEY `idx_account_id` (`account_id`) +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='短信模板渠道绑定表'; + +-- ---------------------------- +-- Records of sms_template_binding_info +-- ---------------------------- +BEGIN; +INSERT INTO `sms_template_binding_info` (`id`, `template_id`, `template_code`, `template_content`, `channel_id`, `channel_code`, `account_id`, `status`, `deleted`, `audit_remark`, `creator`, `create_time`, `updater`, `update_time`) VALUES (1, 1, '', 'ddd', 1, 'aliyun', 1, 0, 0, '', '1', '2026-06-01 16:22:37', '1', '2026-06-01 16:22:37'); +INSERT INTO `sms_template_binding_info` (`id`, `template_id`, `template_code`, `template_content`, `channel_id`, `channel_code`, `account_id`, `status`, `deleted`, `audit_remark`, `creator`, `create_time`, `updater`, `update_time`) VALUES (2, 2, '', '这是一条测试信息', 1, 'aliyun', 1, 0, 0, '', '1', '2026-06-02 09:55:34', '1', '2026-06-02 09:55:34'); +INSERT INTO `sms_template_binding_info` (`id`, `template_id`, `template_code`, `template_content`, `channel_id`, `channel_code`, `account_id`, `status`, `deleted`, `audit_remark`, `creator`, `create_time`, `updater`, `update_time`) VALUES (3, 3, '', 'demo demo', 1, 'aliyun', 1, 0, 0, '', '1', '2026-06-02 14:35:50', '1', '2026-06-02 15:32:47'); +INSERT INTO `sms_template_binding_info` (`id`, `template_id`, `template_code`, `template_content`, `channel_id`, `channel_code`, `account_id`, `status`, `deleted`, `audit_remark`, `creator`, `create_time`, `updater`, `update_time`) VALUES (4, 4, '', 'demo demo demo', 5, 'chuanglan', 3, 2, 0, '', '1', '2026-06-02 15:46:22', '1', '2026-06-02 15:46:35'); +COMMIT; + +-- ---------------------------- +-- Table structure for sms_template_info +-- ---------------------------- +DROP TABLE IF EXISTS `sms_template_info`; +CREATE TABLE `sms_template_info` ( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '模板ID', + `template_name` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '模板名称', + `content` varchar(500) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '模板内容', + `sign_id` bigint NOT NULL COMMENT '签名ID(关联签名表)', + `sign_name` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '签名名称(冗余存储)', + `template_type` tinyint NOT NULL DEFAULT '0' COMMENT '模板类型:0-验证码 1-短信通知 2-推广短信', + `international` tinyint NOT NULL DEFAULT '0' COMMENT '短信区域:0-国内短信 1-国际/港澳台短信', + `switch_open` tinyint(1) NOT NULL DEFAULT '1' COMMENT '启用开关:1-开启 0-关闭', + `deleted` tinyint(1) NOT NULL DEFAULT '0' COMMENT '删除状态:0-正常 1-删除', + `creator` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建人', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '更新人', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `remark` varchar(200) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '备注', + PRIMARY KEY (`id`), + KEY `idx_template_name` (`template_name`), + KEY `idx_sign_name` (`sign_name`), + KEY `idx_sign_id` (`sign_id`) +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='短信模板信息表'; + +-- ---------------------------- +-- Records of sms_template_info +-- ---------------------------- +BEGIN; +INSERT INTO `sms_template_info` (`id`, `template_name`, `content`, `sign_id`, `sign_name`, `template_type`, `international`, `switch_open`, `deleted`, `creator`, `create_time`, `updater`, `update_time`, `remark`) VALUES (1, 'ddddd', 'ddd', 1, 'iiiii', 2, 0, 1, 0, '1', '2026-06-01 16:22:37', '1', '2026-06-01 16:22:37', 'dddd'); +INSERT INTO `sms_template_info` (`id`, `template_name`, `content`, `sign_id`, `sign_name`, `template_type`, `international`, `switch_open`, `deleted`, `creator`, `create_time`, `updater`, `update_time`, `remark`) VALUES (2, '测试模板', '这是一条测试信息', 2, '测试APP', 1, 1, 1, 0, '1', '2026-06-02 09:55:34', '1', '2026-06-02 09:55:34', '这是一条测试信息,这是一条测试信息'); +INSERT INTO `sms_template_info` (`id`, `template_name`, `content`, `sign_id`, `sign_name`, `template_type`, `international`, `switch_open`, `deleted`, `creator`, `create_time`, `updater`, `update_time`, `remark`) VALUES (3, '创南测试模板', 'demo demo', 2, 'APP', 2, 1, 1, 0, '1', '2026-06-02 14:35:50', '1', '2026-06-02 15:23:01', 'demo'); +INSERT INTO `sms_template_info` (`id`, `template_name`, `content`, `sign_id`, `sign_name`, `template_type`, `international`, `switch_open`, `deleted`, `creator`, `create_time`, `updater`, `update_time`, `remark`) VALUES (4, '创蓝测试001', 'demo demo demo', 3, '创南签名', 2, 1, 1, 0, '1', '2026-06-02 15:46:22', '1', '2026-06-02 15:46:22', '创蓝测试001'); +COMMIT; + +-- ---------------------------- +-- Table structure for sms_tenant +-- ---------------------------- +DROP TABLE IF EXISTS `sms_tenant`; +CREATE TABLE `sms_tenant` ( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '租户编号', + `tenant_user_name` varchar(100) NOT NULL COMMENT '租户用户名', + `password` varchar(100) NOT NULL COMMENT '密码', + `email` varchar(100) DEFAULT NULL COMMENT '邮箱', + `mobile` varchar(20) DEFAULT NULL COMMENT '手机号', + `nationcode` varchar(10) DEFAULT NULL COMMENT '手机国家编码', + `deleted` tinyint(1) NOT NULL DEFAULT '0' COMMENT '删除状态:0-正常 1-删除', + `creator` varchar(64) DEFAULT '' COMMENT '创建人', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) DEFAULT '' COMMENT '更新人', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + PRIMARY KEY (`id`), + UNIQUE KEY `uk_tenant_user_name` (`tenant_user_name`), + KEY `idx_email` (`email`), + KEY `idx_mobile` (`mobile`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='租户表'; + +-- ---------------------------- +-- Records of sms_tenant +-- ---------------------------- +BEGIN; +INSERT INTO `sms_tenant` (`id`, `tenant_user_name`, `password`, `email`, `mobile`, `nationcode`, `deleted`, `creator`, `create_time`, `updater`, `update_time`) VALUES (1, 'makemyownlife', '594B6D8465CB0EE37C51A113A4FD07E3', 'zhangyong7120180@163.com', '15011319235', NULL, 0, '1', '2025-09-15 16:40:27', '1', '2025-09-15 16:40:27'); +COMMIT; + +-- ---------------------------- +-- Table structure for system_dept +-- ---------------------------- +DROP TABLE IF EXISTS `system_dept`; +CREATE TABLE `system_dept` ( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '部门id', + `name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '部门名称', + `parent_id` bigint NOT NULL DEFAULT '0' COMMENT '父部门id', + `sort` int NOT NULL DEFAULT '0' COMMENT '显示顺序', + `leader_user_id` bigint DEFAULT NULL COMMENT '负责人', + `phone` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '联系电话', + `email` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '邮箱', + `status` tinyint NOT NULL COMMENT '部门状态(0正常 1停用)', + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建者', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '更新者', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=115 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='部门表'; + +-- ---------------------------- +-- Records of system_dept +-- ---------------------------- +BEGIN; +INSERT INTO `system_dept` (`id`, `name`, `parent_id`, `sort`, `leader_user_id`, `phone`, `email`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (100, '勇哥Java实战', 0, 0, 1, '15888888888', 'ry@qq.com', 0, 'admin', '2021-01-05 17:03:47', '1', '2023-11-14 23:30:36', b'0'); +INSERT INTO `system_dept` (`id`, `name`, `parent_id`, `sort`, `leader_user_id`, `phone`, `email`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (101, '深圳总公司', 100, 1, 104, '15888888888', 'ry@qq.com', 0, 'admin', '2021-01-05 17:03:47', '1', '2023-12-02 09:53:35', b'0'); +INSERT INTO `system_dept` (`id`, `name`, `parent_id`, `sort`, `leader_user_id`, `phone`, `email`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (102, '长沙分公司', 100, 2, NULL, '15888888888', 'ry@qq.com', 0, 'admin', '2021-01-05 17:03:47', '', '2021-12-15 05:01:40', b'0'); +INSERT INTO `system_dept` (`id`, `name`, `parent_id`, `sort`, `leader_user_id`, `phone`, `email`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (103, '研发部门', 101, 1, 1, '15888888888', 'ry@qq.com', 0, 'admin', '2021-01-05 17:03:47', '1', '2024-10-02 10:22:03', b'0'); +INSERT INTO `system_dept` (`id`, `name`, `parent_id`, `sort`, `leader_user_id`, `phone`, `email`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (104, '市场部门', 101, 2, NULL, '15888888888', 'ry@qq.com', 0, 'admin', '2021-01-05 17:03:47', '', '2021-12-15 05:01:38', b'0'); +INSERT INTO `system_dept` (`id`, `name`, `parent_id`, `sort`, `leader_user_id`, `phone`, `email`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (105, '测试部门', 101, 3, NULL, '15888888888', 'ry@qq.com', 0, 'admin', '2021-01-05 17:03:47', '1', '2022-05-16 20:25:15', b'0'); +INSERT INTO `system_dept` (`id`, `name`, `parent_id`, `sort`, `leader_user_id`, `phone`, `email`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (106, '财务部门', 101, 4, 103, '15888888888', 'ry@qq.com', 0, 'admin', '2021-01-05 17:03:47', '103', '2022-01-15 21:32:22', b'0'); +INSERT INTO `system_dept` (`id`, `name`, `parent_id`, `sort`, `leader_user_id`, `phone`, `email`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (107, '运维部门', 101, 5, 1, '15888888888', 'ry@qq.com', 0, 'admin', '2021-01-05 17:03:47', '1', '2023-12-02 09:28:22', b'0'); +INSERT INTO `system_dept` (`id`, `name`, `parent_id`, `sort`, `leader_user_id`, `phone`, `email`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (108, '市场部门', 102, 1, NULL, '15888888888', 'ry@qq.com', 0, 'admin', '2021-01-05 17:03:47', '1', '2022-02-16 08:35:45', b'0'); +INSERT INTO `system_dept` (`id`, `name`, `parent_id`, `sort`, `leader_user_id`, `phone`, `email`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (109, '财务部门', 102, 2, NULL, '15888888888', 'ry@qq.com', 0, 'admin', '2021-01-05 17:03:47', '', '2021-12-15 05:01:29', b'0'); +COMMIT; + +-- ---------------------------- +-- Table structure for system_dict_data +-- ---------------------------- +DROP TABLE IF EXISTS `system_dict_data`; +CREATE TABLE `system_dict_data` ( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '字典编码', + `sort` int NOT NULL DEFAULT '0' COMMENT '字典排序', + `label` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '字典标签', + `value` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '字典键值', + `dict_type` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '字典类型', + `status` tinyint NOT NULL DEFAULT '0' COMMENT '状态(0正常 1停用)', + `color_type` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '颜色类型', + `css_class` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT 'css 样式', + `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '备注', + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建者', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '更新者', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=3000 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='字典数据表'; + +-- ---------------------------- +-- Records of system_dict_data +-- ---------------------------- +BEGIN; +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1, 1, '男', '1', 'system_user_sex', 0, 'default', 'A', '性别男', 'admin', '2021-01-05 17:03:48', '1', '2022-03-29 00:14:39', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2, 2, '女', '2', 'system_user_sex', 0, 'success', '', '性别女', 'admin', '2021-01-05 17:03:48', '1', '2023-11-15 23:30:37', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (8, 1, '正常', '1', 'infra_job_status', 0, 'success', '', '正常状态', 'admin', '2021-01-05 17:03:48', '1', '2022-02-16 19:33:38', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (9, 2, '暂停', '2', 'infra_job_status', 0, 'danger', '', '停用状态', 'admin', '2021-01-05 17:03:48', '1', '2022-02-16 19:33:45', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (12, 1, '系统内置', '1', 'infra_config_type', 0, 'danger', '', '参数类型 - 系统内置', 'admin', '2021-01-05 17:03:48', '1', '2022-02-16 19:06:02', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (13, 2, '自定义', '2', 'infra_config_type', 0, 'primary', '', '参数类型 - 自定义', 'admin', '2021-01-05 17:03:48', '1', '2022-02-16 19:06:07', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (14, 1, '通知', '1', 'system_notice_type', 0, 'success', '', '通知', 'admin', '2021-01-05 17:03:48', '1', '2022-02-16 13:05:57', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (15, 2, '公告', '2', 'system_notice_type', 0, 'info', '', '公告', 'admin', '2021-01-05 17:03:48', '1', '2022-02-16 13:06:01', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (16, 0, '其它', '0', 'infra_operate_type', 0, 'default', '', '其它操作', 'admin', '2021-01-05 17:03:48', '1', '2024-03-14 12:44:19', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (17, 1, '查询', '1', 'infra_operate_type', 0, 'info', '', '查询操作', 'admin', '2021-01-05 17:03:48', '1', '2024-03-14 12:44:20', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (18, 2, '新增', '2', 'infra_operate_type', 0, 'primary', '', '新增操作', 'admin', '2021-01-05 17:03:48', '1', '2024-03-14 12:44:21', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (19, 3, '修改', '3', 'infra_operate_type', 0, 'warning', '', '修改操作', 'admin', '2021-01-05 17:03:48', '1', '2024-03-14 12:44:22', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (20, 4, '删除', '4', 'infra_operate_type', 0, 'danger', '', '删除操作', 'admin', '2021-01-05 17:03:48', '1', '2024-03-14 12:44:23', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (22, 5, '导出', '5', 'infra_operate_type', 0, 'default', '', '导出操作', 'admin', '2021-01-05 17:03:48', '1', '2024-03-14 12:44:24', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (23, 6, '导入', '6', 'infra_operate_type', 0, 'default', '', '导入操作', 'admin', '2021-01-05 17:03:48', '1', '2024-03-14 12:44:25', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (27, 1, '开启', '0', 'common_status', 0, 'primary', '', '开启状态', 'admin', '2021-01-05 17:03:48', '1', '2022-02-16 08:00:39', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (28, 2, '关闭', '1', 'common_status', 0, 'info', '', '关闭状态', 'admin', '2021-01-05 17:03:48', '1', '2022-02-16 08:00:44', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (29, 1, '目录', '1', 'system_menu_type', 0, '', '', '目录', 'admin', '2021-01-05 17:03:48', '', '2022-02-01 16:43:45', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (30, 2, '菜单', '2', 'system_menu_type', 0, '', '', '菜单', 'admin', '2021-01-05 17:03:48', '', '2022-02-01 16:43:41', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (31, 3, '按钮', '3', 'system_menu_type', 0, '', '', '按钮', 'admin', '2021-01-05 17:03:48', '', '2022-02-01 16:43:39', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (32, 1, '内置', '1', 'system_role_type', 0, 'danger', '', '内置角色', 'admin', '2021-01-05 17:03:48', '1', '2022-02-16 13:02:08', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (33, 2, '自定义', '2', 'system_role_type', 0, 'primary', '', '自定义角色', 'admin', '2021-01-05 17:03:48', '1', '2022-02-16 13:02:12', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (34, 1, '全部数据权限', '1', 'system_data_scope', 0, '', '', '全部数据权限', 'admin', '2021-01-05 17:03:48', '', '2022-02-01 16:47:17', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (35, 2, '指定部门数据权限', '2', 'system_data_scope', 0, '', '', '指定部门数据权限', 'admin', '2021-01-05 17:03:48', '', '2022-02-01 16:47:18', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (36, 3, '本部门数据权限', '3', 'system_data_scope', 0, '', '', '本部门数据权限', 'admin', '2021-01-05 17:03:48', '', '2022-02-01 16:47:16', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (37, 4, '本部门及以下数据权限', '4', 'system_data_scope', 0, '', '', '本部门及以下数据权限', 'admin', '2021-01-05 17:03:48', '', '2022-02-01 16:47:21', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (38, 5, '仅本人数据权限', '5', 'system_data_scope', 0, '', '', '仅本人数据权限', 'admin', '2021-01-05 17:03:48', '', '2022-02-01 16:47:23', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (39, 0, '成功', '0', 'system_login_result', 0, 'success', '', '登陆结果 - 成功', '', '2021-01-18 06:17:36', '1', '2022-02-16 13:23:49', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (40, 10, '账号或密码不正确', '10', 'system_login_result', 0, 'primary', '', '登陆结果 - 账号或密码不正确', '', '2021-01-18 06:17:54', '1', '2022-02-16 13:24:27', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (41, 20, '用户被禁用', '20', 'system_login_result', 0, 'warning', '', '登陆结果 - 用户被禁用', '', '2021-01-18 06:17:54', '1', '2022-02-16 13:23:57', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (42, 30, '验证码不存在', '30', 'system_login_result', 0, 'info', '', '登陆结果 - 验证码不存在', '', '2021-01-18 06:17:54', '1', '2022-02-16 13:24:07', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (43, 31, '验证码不正确', '31', 'system_login_result', 0, 'info', '', '登陆结果 - 验证码不正确', '', '2021-01-18 06:17:54', '1', '2022-02-16 13:24:11', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (44, 100, '未知异常', '100', 'system_login_result', 0, 'danger', '', '登陆结果 - 未知异常', '', '2021-01-18 06:17:54', '1', '2022-02-16 13:24:23', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (45, 1, '是', 'true', 'infra_boolean_string', 0, 'danger', '', 'Boolean 是否类型 - 是', '', '2021-01-19 03:20:55', '1', '2022-03-15 23:01:45', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (46, 1, '否', 'false', 'infra_boolean_string', 0, 'info', '', 'Boolean 是否类型 - 否', '', '2021-01-19 03:20:55', '1', '2022-03-15 23:09:45', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (50, 1, '单表(增删改查)', '1', 'infra_codegen_template_type', 0, '', '', NULL, '', '2021-02-05 07:09:06', '', '2022-03-10 16:33:15', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (51, 2, '树表(增删改查)', '2', 'infra_codegen_template_type', 0, '', '', NULL, '', '2021-02-05 07:14:46', '', '2022-03-10 16:33:19', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (53, 0, '初始化中', '0', 'infra_job_status', 0, 'primary', '', NULL, '', '2021-02-07 07:46:49', '1', '2022-02-16 19:33:29', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (57, 0, '运行中', '0', 'infra_job_log_status', 0, 'primary', '', 'RUNNING', '', '2021-02-08 10:04:24', '1', '2022-02-16 19:07:48', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (58, 1, '成功', '1', 'infra_job_log_status', 0, 'success', '', NULL, '', '2021-02-08 10:06:57', '1', '2022-02-16 19:07:52', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (59, 2, '失败', '2', 'infra_job_log_status', 0, 'warning', '', '失败', '', '2021-02-08 10:07:38', '1', '2022-02-16 19:07:56', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (60, 1, '会员', '1', 'user_type', 0, 'primary', '', NULL, '', '2021-02-26 00:16:27', '1', '2022-02-16 10:22:19', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (61, 2, '管理员', '2', 'user_type', 0, 'success', '', NULL, '', '2021-02-26 00:16:34', '1', '2022-02-16 10:22:22', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (62, 0, '未处理', '0', 'infra_api_error_log_process_status', 0, 'primary', '', NULL, '', '2021-02-26 07:07:19', '1', '2022-02-16 20:14:17', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (63, 1, '已处理', '1', 'infra_api_error_log_process_status', 0, 'success', '', NULL, '', '2021-02-26 07:07:26', '1', '2022-02-16 20:14:08', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (64, 2, '已忽略', '2', 'infra_api_error_log_process_status', 0, 'danger', '', NULL, '', '2021-02-26 07:07:34', '1', '2022-02-16 20:14:14', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (66, 1, '阿里云', 'ALIYUN', 'system_sms_channel_code', 0, 'primary', '', NULL, '1', '2021-04-05 01:05:26', '1', '2024-07-22 22:23:25', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (67, 1, '验证码', '1', 'system_sms_template_type', 0, 'warning', '', NULL, '1', '2021-04-05 21:50:57', '1', '2022-02-16 12:48:30', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (68, 2, '通知', '2', 'system_sms_template_type', 0, 'primary', '', NULL, '1', '2021-04-05 21:51:08', '1', '2022-02-16 12:48:27', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (69, 0, '营销', '3', 'system_sms_template_type', 0, 'danger', '', NULL, '1', '2021-04-05 21:51:15', '1', '2022-02-16 12:48:22', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (70, 0, '初始化', '0', 'system_sms_send_status', 0, 'primary', '', NULL, '1', '2021-04-11 20:18:33', '1', '2022-02-16 10:26:07', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (71, 1, '发送成功', '10', 'system_sms_send_status', 0, 'success', '', NULL, '1', '2021-04-11 20:18:43', '1', '2022-02-16 10:25:56', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (72, 2, '发送失败', '20', 'system_sms_send_status', 0, 'danger', '', NULL, '1', '2021-04-11 20:18:49', '1', '2022-02-16 10:26:03', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (73, 3, '不发送', '30', 'system_sms_send_status', 0, 'info', '', NULL, '1', '2021-04-11 20:19:44', '1', '2022-02-16 10:26:10', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (74, 0, '等待结果', '0', 'system_sms_receive_status', 0, 'primary', '', NULL, '1', '2021-04-11 20:27:43', '1', '2022-02-16 10:28:24', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (75, 1, '接收成功', '10', 'system_sms_receive_status', 0, 'success', '', NULL, '1', '2021-04-11 20:29:25', '1', '2022-02-16 10:28:28', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (76, 2, '接收失败', '20', 'system_sms_receive_status', 0, 'danger', '', NULL, '1', '2021-04-11 20:29:31', '1', '2022-02-16 10:28:32', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (77, 0, '调试(钉钉)', 'DEBUG_DING_TALK', 'system_sms_channel_code', 0, 'info', '', NULL, '1', '2021-04-13 00:20:37', '1', '2022-02-16 10:10:00', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (80, 100, '账号登录', '100', 'system_login_type', 0, 'primary', '', '账号登录', '1', '2021-10-06 00:52:02', '1', '2022-02-16 13:11:34', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (81, 101, '社交登录', '101', 'system_login_type', 0, 'info', '', '社交登录', '1', '2021-10-06 00:52:17', '1', '2022-02-16 13:11:40', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (83, 200, '主动登出', '200', 'system_login_type', 0, 'primary', '', '主动登出', '1', '2021-10-06 00:52:58', '1', '2022-02-16 13:11:49', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (85, 202, '强制登出', '202', 'system_login_type', 0, 'danger', '', '强制退出', '1', '2021-10-06 00:53:41', '1', '2022-02-16 13:11:57', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (86, 0, '病假', '1', 'bpm_oa_leave_type', 0, 'primary', '', NULL, '1', '2021-09-21 22:35:28', '1', '2022-02-16 10:00:41', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (87, 1, '事假', '2', 'bpm_oa_leave_type', 0, 'info', '', NULL, '1', '2021-09-21 22:36:11', '1', '2022-02-16 10:00:49', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (88, 2, '婚假', '3', 'bpm_oa_leave_type', 0, 'warning', '', NULL, '1', '2021-09-21 22:36:38', '1', '2022-02-16 10:00:53', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (112, 0, '微信 Wap 网站支付', 'wx_wap', 'pay_channel_code', 0, 'success', '', '微信 Wap 网站支付', '1', '2023-07-19 20:08:06', '1', '2023-07-19 20:09:08', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (113, 1, '微信公众号支付', 'wx_pub', 'pay_channel_code', 0, 'success', '', '微信公众号支付', '1', '2021-12-03 10:40:24', '1', '2023-07-19 20:08:47', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (114, 2, '微信小程序支付', 'wx_lite', 'pay_channel_code', 0, 'success', '', '微信小程序支付', '1', '2021-12-03 10:41:06', '1', '2023-07-19 20:08:50', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (115, 3, '微信 App 支付', 'wx_app', 'pay_channel_code', 0, 'success', '', '微信 App 支付', '1', '2021-12-03 10:41:20', '1', '2023-07-19 20:08:56', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (116, 10, '支付宝 PC 网站支付', 'alipay_pc', 'pay_channel_code', 0, 'primary', '', '支付宝 PC 网站支付', '1', '2021-12-03 10:42:09', '1', '2023-07-19 20:09:12', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (117, 11, '支付宝 Wap 网站支付', 'alipay_wap', 'pay_channel_code', 0, 'primary', '', '支付宝 Wap 网站支付', '1', '2021-12-03 10:42:26', '1', '2023-07-19 20:09:16', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (118, 12, '支付宝 App 支付', 'alipay_app', 'pay_channel_code', 0, 'primary', '', '支付宝 App 支付', '1', '2021-12-03 10:42:55', '1', '2023-07-19 20:09:20', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (119, 14, '支付宝扫码支付', 'alipay_qr', 'pay_channel_code', 0, 'primary', '', '支付宝扫码支付', '1', '2021-12-03 10:43:10', '1', '2023-07-19 20:09:28', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (120, 10, '通知成功', '10', 'pay_notify_status', 0, 'success', '', '通知成功', '1', '2021-12-03 11:02:41', '1', '2023-07-19 10:08:19', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (121, 20, '通知失败', '20', 'pay_notify_status', 0, 'danger', '', '通知失败', '1', '2021-12-03 11:02:59', '1', '2023-07-19 10:08:21', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (122, 0, '等待通知', '0', 'pay_notify_status', 0, 'info', '', '未通知', '1', '2021-12-03 11:03:10', '1', '2023-07-19 10:08:24', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (123, 10, '支付成功', '10', 'pay_order_status', 0, 'success', '', '支付成功', '1', '2021-12-03 11:18:29', '1', '2023-07-19 18:04:28', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (124, 30, '支付关闭', '30', 'pay_order_status', 0, 'info', '', '支付关闭', '1', '2021-12-03 11:18:42', '1', '2023-07-19 18:05:07', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (125, 0, '等待支付', '0', 'pay_order_status', 0, 'info', '', '未支付', '1', '2021-12-03 11:18:18', '1', '2023-07-19 18:04:15', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (600, 5, '首页', '1', 'promotion_banner_position', 0, 'warning', '', '', '1', '2023-10-11 07:45:24', '1', '2023-10-11 07:45:38', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (601, 4, '秒杀活动页', '2', 'promotion_banner_position', 0, 'warning', '', '', '1', '2023-10-11 07:45:24', '1', '2023-10-11 07:45:38', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (602, 3, '砍价活动页', '3', 'promotion_banner_position', 0, 'warning', '', '', '1', '2023-10-11 07:45:24', '1', '2023-10-11 07:45:38', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (603, 2, '限时折扣页', '4', 'promotion_banner_position', 0, 'warning', '', '', '1', '2023-10-11 07:45:24', '1', '2023-10-11 07:45:38', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (604, 1, '满减送页', '5', 'promotion_banner_position', 0, 'warning', '', '', '1', '2023-10-11 07:45:24', '1', '2023-10-11 07:45:38', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1118, 0, '等待退款', '0', 'pay_refund_status', 0, 'info', '', '等待退款', '1', '2021-12-10 16:44:59', '1', '2023-07-19 10:14:39', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1119, 20, '退款失败', '20', 'pay_refund_status', 0, 'danger', '', '退款失败', '1', '2021-12-10 16:45:10', '1', '2023-07-19 10:15:10', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1124, 10, '退款成功', '10', 'pay_refund_status', 0, 'success', '', '退款成功', '1', '2021-12-10 16:46:26', '1', '2023-07-19 10:15:00', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1127, 1, '审批中', '1', 'bpm_process_instance_status', 0, 'default', '', '流程实例的状态 - 进行中', '1', '2022-01-07 23:47:22', '1', '2024-03-16 16:11:45', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1128, 2, '审批通过', '2', 'bpm_process_instance_status', 0, 'success', '', '流程实例的状态 - 已完成', '1', '2022-01-07 23:47:49', '1', '2024-03-16 16:11:54', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1129, 1, '审批中', '1', 'bpm_task_status', 0, 'primary', '', '流程实例的结果 - 处理中', '1', '2022-01-07 23:48:32', '1', '2024-03-08 22:41:37', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1130, 2, '审批通过', '2', 'bpm_task_status', 0, 'success', '', '流程实例的结果 - 通过', '1', '2022-01-07 23:48:45', '1', '2024-03-08 22:41:38', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1131, 3, '审批不通过', '3', 'bpm_task_status', 0, 'danger', '', '流程实例的结果 - 不通过', '1', '2022-01-07 23:48:55', '1', '2024-03-08 22:41:38', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1132, 4, '已取消', '4', 'bpm_task_status', 0, 'info', '', '流程实例的结果 - 撤销', '1', '2022-01-07 23:49:06', '1', '2024-03-08 22:41:39', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1133, 10, '流程表单', '10', 'bpm_model_form_type', 0, '', '', '流程的表单类型 - 流程表单', '103', '2022-01-11 23:51:30', '103', '2022-01-11 23:51:30', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1134, 20, '业务表单', '20', 'bpm_model_form_type', 0, '', '', '流程的表单类型 - 业务表单', '103', '2022-01-11 23:51:47', '103', '2022-01-11 23:51:47', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1135, 10, '角色', '10', 'bpm_task_candidate_strategy', 0, 'info', '', '任务分配规则的类型 - 角色', '103', '2022-01-12 23:21:22', '1', '2024-03-06 02:53:16', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1136, 20, '部门的成员', '20', 'bpm_task_candidate_strategy', 0, 'primary', '', '任务分配规则的类型 - 部门的成员', '103', '2022-01-12 23:21:47', '1', '2024-03-06 02:53:17', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1137, 21, '部门的负责人', '21', 'bpm_task_candidate_strategy', 0, 'primary', '', '任务分配规则的类型 - 部门的负责人', '103', '2022-01-12 23:33:36', '1', '2024-03-06 02:53:18', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1138, 30, '用户', '30', 'bpm_task_candidate_strategy', 0, 'info', '', '任务分配规则的类型 - 用户', '103', '2022-01-12 23:34:02', '1', '2024-03-06 02:53:19', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1139, 40, '用户组', '40', 'bpm_task_candidate_strategy', 0, 'warning', '', '任务分配规则的类型 - 用户组', '103', '2022-01-12 23:34:21', '1', '2024-03-06 02:53:20', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1140, 60, '流程表达式', '60', 'bpm_task_candidate_strategy', 0, 'danger', '', '任务分配规则的类型 - 流程表达式', '103', '2022-01-12 23:34:43', '1', '2024-03-06 02:53:20', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1141, 22, '岗位', '22', 'bpm_task_candidate_strategy', 0, 'success', '', '任务分配规则的类型 - 岗位', '103', '2022-01-14 18:41:55', '1', '2024-03-06 02:53:21', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1145, 1, '管理后台', '1', 'infra_codegen_scene', 0, '', '', '代码生成的场景枚举 - 管理后台', '1', '2022-02-02 13:15:06', '1', '2022-03-10 16:32:59', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1146, 2, '用户 APP', '2', 'infra_codegen_scene', 0, '', '', '代码生成的场景枚举 - 用户 APP', '1', '2022-02-02 13:15:19', '1', '2022-03-10 16:33:03', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1150, 1, '数据库', '1', 'infra_file_storage', 0, 'default', '', NULL, '1', '2022-03-15 00:25:28', '1', '2022-03-15 00:25:28', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1151, 10, '本地磁盘', '10', 'infra_file_storage', 0, 'default', '', NULL, '1', '2022-03-15 00:25:41', '1', '2022-03-15 00:25:56', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1152, 11, 'FTP 服务器', '11', 'infra_file_storage', 0, 'default', '', NULL, '1', '2022-03-15 00:26:06', '1', '2022-03-15 00:26:10', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1153, 12, 'SFTP 服务器', '12', 'infra_file_storage', 0, 'default', '', NULL, '1', '2022-03-15 00:26:22', '1', '2022-03-15 00:26:22', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1154, 20, 'S3 对象存储', '20', 'infra_file_storage', 0, 'default', '', NULL, '1', '2022-03-15 00:26:31', '1', '2022-03-15 00:26:45', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1155, 103, '短信登录', '103', 'system_login_type', 0, 'default', '', NULL, '1', '2022-05-09 23:57:58', '1', '2022-05-09 23:58:09', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1156, 1, 'password', 'password', 'system_oauth2_grant_type', 0, 'default', '', '密码模式', '1', '2022-05-12 00:22:05', '1', '2022-05-11 16:26:01', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1157, 2, 'authorization_code', 'authorization_code', 'system_oauth2_grant_type', 0, 'primary', '', '授权码模式', '1', '2022-05-12 00:22:59', '1', '2022-05-11 16:26:02', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1158, 3, 'implicit', 'implicit', 'system_oauth2_grant_type', 0, 'success', '', '简化模式', '1', '2022-05-12 00:23:40', '1', '2022-05-11 16:26:05', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1159, 4, 'client_credentials', 'client_credentials', 'system_oauth2_grant_type', 0, 'default', '', '客户端模式', '1', '2022-05-12 00:23:51', '1', '2022-05-11 16:26:08', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1160, 5, 'refresh_token', 'refresh_token', 'system_oauth2_grant_type', 0, 'info', '', '刷新模式', '1', '2022-05-12 00:24:02', '1', '2022-05-11 16:26:11', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1162, 1, '销售中', '1', 'product_spu_status', 0, 'success', '', '商品 SPU 状态 - 销售中', '1', '2022-10-24 21:19:47', '1', '2022-10-24 21:20:38', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1163, 0, '仓库中', '0', 'product_spu_status', 0, 'info', '', '商品 SPU 状态 - 仓库中', '1', '2022-10-24 21:20:54', '1', '2022-10-24 21:21:22', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1164, 0, '回收站', '-1', 'product_spu_status', 0, 'default', '', '商品 SPU 状态 - 回收站', '1', '2022-10-24 21:21:11', '1', '2022-10-24 21:21:11', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1165, 1, '满减', '1', 'promotion_discount_type', 0, 'success', '', '优惠类型 - 满减', '1', '2022-11-01 12:46:41', '1', '2022-11-01 12:50:11', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1166, 2, '折扣', '2', 'promotion_discount_type', 0, 'primary', '', '优惠类型 - 折扣', '1', '2022-11-01 12:46:51', '1', '2022-11-01 12:50:08', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1167, 1, '固定日期', '1', 'promotion_coupon_template_validity_type', 0, 'default', '', '优惠劵模板的有限期类型 - 固定日期', '1', '2022-11-02 00:07:34', '1', '2022-11-04 00:07:49', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1168, 2, '领取之后', '2', 'promotion_coupon_template_validity_type', 0, 'default', '', '优惠劵模板的有限期类型 - 领取之后', '1', '2022-11-02 00:07:54', '1', '2022-11-04 00:07:52', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1169, 1, '通用劵', '1', 'promotion_product_scope', 0, 'default', '', '营销的商品范围 - 全部商品参与', '1', '2022-11-02 00:28:22', '1', '2023-09-28 00:27:42', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1170, 2, '商品劵', '2', 'promotion_product_scope', 0, 'default', '', '营销的商品范围 - 指定商品参与', '1', '2022-11-02 00:28:34', '1', '2023-09-28 00:27:44', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1171, 1, '未使用', '1', 'promotion_coupon_status', 0, 'primary', '', '优惠劵的状态 - 已领取', '1', '2022-11-04 00:15:08', '1', '2023-10-03 12:54:38', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1172, 2, '已使用', '2', 'promotion_coupon_status', 0, 'success', '', '优惠劵的状态 - 已使用', '1', '2022-11-04 00:15:21', '1', '2022-11-04 19:16:08', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1173, 3, '已过期', '3', 'promotion_coupon_status', 0, 'info', '', '优惠劵的状态 - 已过期', '1', '2022-11-04 00:15:43', '1', '2022-11-04 19:16:12', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1174, 1, '直接领取', '1', 'promotion_coupon_take_type', 0, 'primary', '', '优惠劵的领取方式 - 直接领取', '1', '2022-11-04 19:13:00', '1', '2022-11-04 19:13:25', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1175, 2, '指定发放', '2', 'promotion_coupon_take_type', 0, 'success', '', '优惠劵的领取方式 - 指定发放', '1', '2022-11-04 19:13:13', '1', '2022-11-04 19:14:48', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1176, 10, '未开始', '10', 'promotion_activity_status', 0, 'primary', '', '促销活动的状态枚举 - 未开始', '1', '2022-11-04 22:54:49', '1', '2022-11-04 22:55:53', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1177, 20, '进行中', '20', 'promotion_activity_status', 0, 'success', '', '促销活动的状态枚举 - 进行中', '1', '2022-11-04 22:55:06', '1', '2022-11-04 22:55:20', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1178, 30, '已结束', '30', 'promotion_activity_status', 0, 'info', '', '促销活动的状态枚举 - 已结束', '1', '2022-11-04 22:55:41', '1', '2022-11-04 22:55:41', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1179, 40, '已关闭', '40', 'promotion_activity_status', 0, 'warning', '', '促销活动的状态枚举 - 已关闭', '1', '2022-11-04 22:56:10', '1', '2022-11-04 22:56:18', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1180, 10, '满 N 元', '10', 'promotion_condition_type', 0, 'primary', '', '营销的条件类型 - 满 N 元', '1', '2022-11-04 22:59:45', '1', '2022-11-04 22:59:45', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1181, 20, '满 N 件', '20', 'promotion_condition_type', 0, 'success', '', '营销的条件类型 - 满 N 件', '1', '2022-11-04 23:00:02', '1', '2022-11-04 23:00:02', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1182, 10, '申请售后', '10', 'trade_after_sale_status', 0, 'primary', '', '交易售后状态 - 申请售后', '1', '2022-11-19 20:53:33', '1', '2022-11-19 20:54:42', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1183, 20, '商品待退货', '20', 'trade_after_sale_status', 0, 'primary', '', '交易售后状态 - 商品待退货', '1', '2022-11-19 20:54:36', '1', '2022-11-19 20:58:58', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1184, 30, '商家待收货', '30', 'trade_after_sale_status', 0, 'primary', '', '交易售后状态 - 商家待收货', '1', '2022-11-19 20:56:56', '1', '2022-11-19 20:59:20', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1185, 40, '等待退款', '40', 'trade_after_sale_status', 0, 'primary', '', '交易售后状态 - 等待退款', '1', '2022-11-19 20:59:54', '1', '2022-11-19 21:00:01', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1186, 50, '退款成功', '50', 'trade_after_sale_status', 0, 'default', '', '交易售后状态 - 退款成功', '1', '2022-11-19 21:00:33', '1', '2022-11-19 21:00:33', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1187, 61, '买家取消', '61', 'trade_after_sale_status', 0, 'info', '', '交易售后状态 - 买家取消', '1', '2022-11-19 21:01:29', '1', '2022-11-19 21:01:29', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1188, 62, '商家拒绝', '62', 'trade_after_sale_status', 0, 'info', '', '交易售后状态 - 商家拒绝', '1', '2022-11-19 21:02:17', '1', '2022-11-19 21:02:17', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1189, 63, '商家拒收货', '63', 'trade_after_sale_status', 0, 'info', '', '交易售后状态 - 商家拒收货', '1', '2022-11-19 21:02:37', '1', '2022-11-19 21:03:07', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1190, 10, '售中退款', '10', 'trade_after_sale_type', 0, 'success', '', '交易售后的类型 - 售中退款', '1', '2022-11-19 21:05:05', '1', '2022-11-19 21:38:23', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1191, 20, '售后退款', '20', 'trade_after_sale_type', 0, 'primary', '', '交易售后的类型 - 售后退款', '1', '2022-11-19 21:05:32', '1', '2022-11-19 21:38:32', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1192, 10, '仅退款', '10', 'trade_after_sale_way', 0, 'primary', '', '交易售后的方式 - 仅退款', '1', '2022-11-19 21:39:19', '1', '2022-11-19 21:39:19', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1193, 20, '退货退款', '20', 'trade_after_sale_way', 0, 'success', '', '交易售后的方式 - 退货退款', '1', '2022-11-19 21:39:38', '1', '2022-11-19 21:39:49', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1194, 10, '微信小程序', '10', 'terminal', 0, 'default', '', '终端 - 微信小程序', '1', '2022-12-10 10:51:11', '1', '2022-12-10 10:51:57', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1195, 20, 'H5 网页', '20', 'terminal', 0, 'default', '', '终端 - H5 网页', '1', '2022-12-10 10:51:30', '1', '2022-12-10 10:51:59', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1196, 11, '微信公众号', '11', 'terminal', 0, 'default', '', '终端 - 微信公众号', '1', '2022-12-10 10:54:16', '1', '2022-12-10 10:52:01', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1197, 31, '苹果 App', '31', 'terminal', 0, 'default', '', '终端 - 苹果 App', '1', '2022-12-10 10:54:42', '1', '2022-12-10 10:52:18', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1198, 32, '安卓 App', '32', 'terminal', 0, 'default', '', '终端 - 安卓 App', '1', '2022-12-10 10:55:02', '1', '2022-12-10 10:59:17', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1199, 0, '普通订单', '0', 'trade_order_type', 0, 'default', '', '交易订单的类型 - 普通订单', '1', '2022-12-10 16:34:14', '1', '2022-12-10 16:34:14', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1200, 1, '秒杀订单', '1', 'trade_order_type', 0, 'default', '', '交易订单的类型 - 秒杀订单', '1', '2022-12-10 16:34:26', '1', '2022-12-10 16:34:26', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1201, 2, '砍价订单', '2', 'trade_order_type', 0, 'default', '', '交易订单的类型 - 拼团订单', '1', '2022-12-10 16:34:36', '1', '2024-09-07 14:18:39', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1202, 3, '拼团订单', '3', 'trade_order_type', 0, 'default', '', '交易订单的类型 - 砍价订单', '1', '2022-12-10 16:34:48', '1', '2024-09-07 14:18:32', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1203, 0, '待支付', '0', 'trade_order_status', 0, 'default', '', '交易订单状态 - 待支付', '1', '2022-12-10 16:49:29', '1', '2022-12-10 16:49:29', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1204, 10, '待发货', '10', 'trade_order_status', 0, 'primary', '', '交易订单状态 - 待发货', '1', '2022-12-10 16:49:53', '1', '2022-12-10 16:51:17', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1205, 20, '已发货', '20', 'trade_order_status', 0, 'primary', '', '交易订单状态 - 已发货', '1', '2022-12-10 16:50:13', '1', '2022-12-10 16:51:31', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1206, 30, '已完成', '30', 'trade_order_status', 0, 'success', '', '交易订单状态 - 已完成', '1', '2022-12-10 16:50:30', '1', '2022-12-10 16:51:06', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1207, 40, '已取消', '40', 'trade_order_status', 0, 'danger', '', '交易订单状态 - 已取消', '1', '2022-12-10 16:50:50', '1', '2022-12-10 16:51:00', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1208, 0, '未售后', '0', 'trade_order_item_after_sale_status', 0, 'info', '', '交易订单项的售后状态 - 未售后', '1', '2022-12-10 20:58:42', '1', '2022-12-10 20:59:29', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1209, 10, '售后中', '10', 'trade_order_item_after_sale_status', 0, 'primary', '', '交易订单项的售后状态 - 售后中', '1', '2022-12-10 20:59:21', '1', '2024-07-21 17:01:24', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1210, 20, '已退款', '20', 'trade_order_item_after_sale_status', 0, 'success', '', '交易订单项的售后状态 - 已退款', '1', '2022-12-10 20:59:46', '1', '2024-07-21 17:01:35', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1211, 1, '完全匹配', '1', 'mp_auto_reply_request_match', 0, 'primary', '', '公众号自动回复的请求关键字匹配模式 - 完全匹配', '1', '2023-01-16 23:30:39', '1', '2023-01-16 23:31:00', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1212, 2, '半匹配', '2', 'mp_auto_reply_request_match', 0, 'success', '', '公众号自动回复的请求关键字匹配模式 - 半匹配', '1', '2023-01-16 23:30:55', '1', '2023-01-16 23:31:10', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1213, 1, '文本', 'text', 'mp_message_type', 0, 'default', '', '公众号的消息类型 - 文本', '1', '2023-01-17 22:17:32', '1', '2023-01-17 22:17:39', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1214, 2, '图片', 'image', 'mp_message_type', 0, 'default', '', '公众号的消息类型 - 图片', '1', '2023-01-17 22:17:32', '1', '2023-01-17 14:19:47', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1215, 3, '语音', 'voice', 'mp_message_type', 0, 'default', '', '公众号的消息类型 - 语音', '1', '2023-01-17 22:17:32', '1', '2023-01-17 14:20:08', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1216, 4, '视频', 'video', 'mp_message_type', 0, 'default', '', '公众号的消息类型 - 视频', '1', '2023-01-17 22:17:32', '1', '2023-01-17 14:21:08', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1217, 5, '小视频', 'shortvideo', 'mp_message_type', 0, 'default', '', '公众号的消息类型 - 小视频', '1', '2023-01-17 22:17:32', '1', '2023-01-17 14:19:59', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1218, 6, '图文', 'news', 'mp_message_type', 0, 'default', '', '公众号的消息类型 - 图文', '1', '2023-01-17 22:17:32', '1', '2023-01-17 14:22:54', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1219, 7, '音乐', 'music', 'mp_message_type', 0, 'default', '', '公众号的消息类型 - 音乐', '1', '2023-01-17 22:17:32', '1', '2023-01-17 14:22:54', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1220, 8, '地理位置', 'location', 'mp_message_type', 0, 'default', '', '公众号的消息类型 - 地理位置', '1', '2023-01-17 22:17:32', '1', '2023-01-17 14:23:51', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1221, 9, '链接', 'link', 'mp_message_type', 0, 'default', '', '公众号的消息类型 - 链接', '1', '2023-01-17 22:17:32', '1', '2023-01-17 14:24:49', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1222, 10, '事件', 'event', 'mp_message_type', 0, 'default', '', '公众号的消息类型 - 事件', '1', '2023-01-17 22:17:32', '1', '2023-01-17 14:24:49', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1223, 0, '初始化', '0', 'system_mail_send_status', 0, 'primary', '', '邮件发送状态 - 初始化\n', '1', '2023-01-26 09:53:49', '1', '2023-01-26 16:36:14', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1224, 10, '发送成功', '10', 'system_mail_send_status', 0, 'success', '', '邮件发送状态 - 发送成功', '1', '2023-01-26 09:54:28', '1', '2023-01-26 16:36:22', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1225, 20, '发送失败', '20', 'system_mail_send_status', 0, 'danger', '', '邮件发送状态 - 发送失败', '1', '2023-01-26 09:54:50', '1', '2023-01-26 16:36:26', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1226, 30, '不发送', '30', 'system_mail_send_status', 0, 'info', '', '邮件发送状态 - 不发送', '1', '2023-01-26 09:55:06', '1', '2023-01-26 16:36:36', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1227, 1, '通知公告', '1', 'system_notify_template_type', 0, 'primary', '', '站内信模版的类型 - 通知公告', '1', '2023-01-28 10:35:59', '1', '2023-01-28 10:35:59', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1228, 2, '系统消息', '2', 'system_notify_template_type', 0, 'success', '', '站内信模版的类型 - 系统消息', '1', '2023-01-28 10:36:20', '1', '2023-01-28 10:36:25', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1230, 13, '支付宝条码支付', 'alipay_bar', 'pay_channel_code', 0, 'primary', '', '支付宝条码支付', '1', '2023-02-18 23:32:24', '1', '2023-07-19 20:09:23', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1231, 10, 'Vue2 Element UI 标准模版', '10', 'infra_codegen_front_type', 0, '', '', '', '1', '2023-04-13 00:03:55', '1', '2023-04-13 00:03:55', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1232, 20, 'Vue3 Element Plus 标准模版', '20', 'infra_codegen_front_type', 0, '', '', '', '1', '2023-04-13 00:04:08', '1', '2023-04-13 00:04:08', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1234, 30, 'Vue3 vben 模版', '30', 'infra_codegen_front_type', 0, '', '', '', '1', '2023-04-13 00:04:26', '1', '2023-04-13 00:04:26', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1244, 0, '按件', '1', 'trade_delivery_express_charge_mode', 0, '', '', '', '1', '2023-05-21 22:46:40', '1', '2023-05-21 22:46:40', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1245, 1, '按重量', '2', 'trade_delivery_express_charge_mode', 0, '', '', '', '1', '2023-05-21 22:46:58', '1', '2023-05-21 22:46:58', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1246, 2, '按体积', '3', 'trade_delivery_express_charge_mode', 0, '', '', '', '1', '2023-05-21 22:47:18', '1', '2023-05-21 22:47:18', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1335, 11, '订单积分抵扣', '11', 'member_point_biz_type', 0, '', '', '', '1', '2023-06-10 12:15:27', '1', '2023-10-11 07:41:43', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1336, 1, '签到', '1', 'member_point_biz_type', 0, '', '', '', '1', '2023-06-10 12:15:48', '1', '2023-08-20 11:59:53', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1341, 20, '已退款', '20', 'pay_order_status', 0, 'danger', '', '已退款', '1', '2023-07-19 18:05:37', '1', '2023-07-19 18:05:37', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1342, 21, '请求成功,但是结果失败', '21', 'pay_notify_status', 0, 'warning', '', '请求成功,但是结果失败', '1', '2023-07-19 18:10:47', '1', '2023-07-19 18:11:38', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1343, 22, '请求失败', '22', 'pay_notify_status', 0, 'warning', '', NULL, '1', '2023-07-19 18:11:05', '1', '2023-07-19 18:11:27', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1344, 4, '微信扫码支付', 'wx_native', 'pay_channel_code', 0, 'success', '', '微信扫码支付', '1', '2023-07-19 20:07:47', '1', '2023-07-19 20:09:03', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1345, 5, '微信条码支付', 'wx_bar', 'pay_channel_code', 0, 'success', '', '微信条码支付\n', '1', '2023-07-19 20:08:06', '1', '2023-07-19 20:09:08', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1346, 1, '支付单', '1', 'pay_notify_type', 0, 'primary', '', '支付单', '1', '2023-07-20 12:23:17', '1', '2023-07-20 12:23:17', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1347, 2, '退款单', '2', 'pay_notify_type', 0, 'danger', '', NULL, '1', '2023-07-20 12:23:26', '1', '2023-07-20 12:23:26', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1348, 20, '模拟支付', 'mock', 'pay_channel_code', 0, 'default', '', '模拟支付', '1', '2023-07-29 11:10:51', '1', '2023-07-29 03:14:10', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1349, 12, '订单积分抵扣(整单取消)', '12', 'member_point_biz_type', 0, '', '', '', '1', '2023-08-20 12:00:03', '1', '2023-10-11 07:42:01', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1350, 0, '管理员调整', '0', 'member_experience_biz_type', 0, '', '', NULL, '', '2023-08-22 12:41:01', '', '2023-08-22 12:41:01', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1351, 1, '邀新奖励', '1', 'member_experience_biz_type', 0, '', '', NULL, '', '2023-08-22 12:41:01', '', '2023-08-22 12:41:01', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1352, 11, '下单奖励', '11', 'member_experience_biz_type', 0, 'success', '', NULL, '', '2023-08-22 12:41:01', '1', '2023-10-11 07:45:09', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1353, 12, '下单奖励(整单取消)', '12', 'member_experience_biz_type', 0, 'warning', '', NULL, '', '2023-08-22 12:41:01', '1', '2023-10-11 07:45:01', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1354, 4, '签到奖励', '4', 'member_experience_biz_type', 0, '', '', NULL, '', '2023-08-22 12:41:01', '', '2023-08-22 12:41:01', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1355, 5, '抽奖奖励', '5', 'member_experience_biz_type', 0, '', '', NULL, '', '2023-08-22 12:41:01', '', '2023-08-22 12:41:01', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1356, 1, '快递发货', '1', 'trade_delivery_type', 0, '', '', '', '1', '2023-08-23 00:04:55', '1', '2023-08-23 00:04:55', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1357, 2, '用户自提', '2', 'trade_delivery_type', 0, '', '', '', '1', '2023-08-23 00:05:05', '1', '2023-08-23 00:05:05', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1358, 3, '品类劵', '3', 'promotion_product_scope', 0, 'default', '', '', '1', '2023-09-01 23:43:07', '1', '2023-09-28 00:27:47', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1359, 1, '人人分销', '1', 'brokerage_enabled_condition', 0, '', '', '所有用户都可以分销', '', '2023-09-28 02:46:05', '', '2023-09-28 02:46:05', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1360, 2, '指定分销', '2', 'brokerage_enabled_condition', 0, '', '', '仅可后台手动设置推广员', '', '2023-09-28 02:46:05', '', '2023-09-28 02:46:05', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1361, 1, '首次绑定', '1', 'brokerage_bind_mode', 0, '', '', '只要用户没有推广人,随时都可以绑定推广关系', '', '2023-09-28 02:46:05', '', '2023-09-28 02:46:05', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1362, 2, '注册绑定', '2', 'brokerage_bind_mode', 0, '', '', '仅新用户注册时才能绑定推广关系', '', '2023-09-28 02:46:05', '', '2023-09-28 02:46:05', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1363, 3, '覆盖绑定', '3', 'brokerage_bind_mode', 0, '', '', '如果用户已经有推广人,推广人会被变更', '', '2023-09-28 02:46:05', '', '2023-09-28 02:46:05', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1364, 1, '钱包', '1', 'brokerage_withdraw_type', 0, '', '', NULL, '', '2023-09-28 02:46:05', '', '2023-09-28 02:46:05', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1365, 2, '银行卡', '2', 'brokerage_withdraw_type', 0, '', '', NULL, '', '2023-09-28 02:46:05', '', '2023-09-28 02:46:05', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1366, 3, '微信', '3', 'brokerage_withdraw_type', 0, '', '', '手动打款', '', '2023-09-28 02:46:05', '1', '2024-10-13 11:06:54', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1367, 4, '支付宝', '4', 'brokerage_withdraw_type', 0, '', '', NULL, '', '2023-09-28 02:46:05', '', '2023-09-28 02:46:05', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1368, 1, '订单返佣', '1', 'brokerage_record_biz_type', 0, '', '', NULL, '', '2023-09-28 02:46:05', '', '2023-09-28 02:46:05', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1369, 2, '申请提现', '2', 'brokerage_record_biz_type', 0, '', '', NULL, '', '2023-09-28 02:46:05', '', '2023-09-28 02:46:05', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1370, 3, '申请提现驳回', '3', 'brokerage_record_biz_type', 0, '', '', NULL, '', '2023-09-28 02:46:05', '', '2023-09-28 02:46:05', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1371, 0, '待结算', '0', 'brokerage_record_status', 0, '', '', NULL, '', '2023-09-28 02:46:05', '', '2023-09-28 02:46:05', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1372, 1, '已结算', '1', 'brokerage_record_status', 0, '', '', NULL, '', '2023-09-28 02:46:05', '', '2023-09-28 02:46:05', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1373, 2, '已取消', '2', 'brokerage_record_status', 0, '', '', NULL, '', '2023-09-28 02:46:05', '', '2023-09-28 02:46:05', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1374, 0, '审核中', '0', 'brokerage_withdraw_status', 0, '', '', NULL, '', '2023-09-28 02:46:05', '', '2023-09-28 02:46:05', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1375, 10, '审核通过', '10', 'brokerage_withdraw_status', 0, 'success', '', NULL, '', '2023-09-28 02:46:05', '', '2023-09-28 02:46:05', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1376, 11, '提现成功', '11', 'brokerage_withdraw_status', 0, 'success', '', NULL, '', '2023-09-28 02:46:05', '', '2023-09-28 02:46:05', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1377, 20, '审核不通过', '20', 'brokerage_withdraw_status', 0, 'danger', '', NULL, '', '2023-09-28 02:46:05', '', '2023-09-28 02:46:05', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1378, 21, '提现失败', '21', 'brokerage_withdraw_status', 0, 'danger', '', NULL, '', '2023-09-28 02:46:05', '', '2023-09-28 02:46:05', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1379, 0, '工商银行', '0', 'brokerage_bank_name', 0, '', '', NULL, '', '2023-09-28 02:46:05', '', '2023-09-28 02:46:05', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1380, 1, '建设银行', '1', 'brokerage_bank_name', 0, '', '', NULL, '', '2023-09-28 02:46:05', '', '2023-09-28 02:46:05', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1381, 2, '农业银行', '2', 'brokerage_bank_name', 0, '', '', NULL, '', '2023-09-28 02:46:05', '', '2023-09-28 02:46:05', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1382, 3, '中国银行', '3', 'brokerage_bank_name', 0, '', '', NULL, '', '2023-09-28 02:46:05', '', '2023-09-28 02:46:05', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1383, 4, '交通银行', '4', 'brokerage_bank_name', 0, '', '', NULL, '', '2023-09-28 02:46:05', '', '2023-09-28 02:46:05', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1384, 5, '招商银行', '5', 'brokerage_bank_name', 0, '', '', NULL, '', '2023-09-28 02:46:05', '', '2023-09-28 02:46:05', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1385, 21, '钱包', 'wallet', 'pay_channel_code', 0, 'primary', '', '', '1', '2023-10-01 21:46:19', '1', '2023-10-01 21:48:01', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1386, 1, '砍价中', '1', 'promotion_bargain_record_status', 0, 'default', '', '', '1', '2023-10-05 10:41:26', '1', '2023-10-05 10:41:26', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1387, 2, '砍价成功', '2', 'promotion_bargain_record_status', 0, 'success', '', '', '1', '2023-10-05 10:41:39', '1', '2023-10-05 10:41:39', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1388, 3, '砍价失败', '3', 'promotion_bargain_record_status', 0, 'warning', '', '', '1', '2023-10-05 10:41:57', '1', '2023-10-05 10:41:57', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1389, 0, '拼团中', '0', 'promotion_combination_record_status', 0, '', '', '', '1', '2023-10-08 07:24:44', '1', '2024-10-13 10:08:17', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1390, 1, '拼团成功', '1', 'promotion_combination_record_status', 0, 'success', '', '', '1', '2023-10-08 07:24:56', '1', '2024-10-13 10:08:20', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1391, 2, '拼团失败', '2', 'promotion_combination_record_status', 0, 'warning', '', '', '1', '2023-10-08 07:25:11', '1', '2024-10-13 10:08:24', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1392, 2, '管理员修改', '2', 'member_point_biz_type', 0, 'default', '', '', '1', '2023-10-11 07:41:34', '1', '2023-10-11 07:41:34', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1393, 13, '订单积分抵扣(单个退款)', '13', 'member_point_biz_type', 0, '', '', '', '1', '2023-10-11 07:42:29', '1', '2023-10-11 07:42:29', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1394, 21, '订单积分奖励', '21', 'member_point_biz_type', 0, 'default', '', '', '1', '2023-10-11 07:42:44', '1', '2023-10-11 07:42:44', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1395, 22, '订单积分奖励(整单取消)', '22', 'member_point_biz_type', 0, 'default', '', '', '1', '2023-10-11 07:42:55', '1', '2023-10-11 07:43:01', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1396, 23, '订单积分奖励(单个退款)', '23', 'member_point_biz_type', 0, 'default', '', '', '1', '2023-10-11 07:43:16', '1', '2023-10-11 07:43:16', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1397, 13, '下单奖励(单个退款)', '13', 'member_experience_biz_type', 0, 'warning', '', '', '1', '2023-10-11 07:45:24', '1', '2023-10-11 07:45:38', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1398, 5, '网上转账', '5', 'crm_receivable_return_type', 0, 'default', '', '', '1', '2023-10-18 21:55:24', '1', '2023-10-18 21:55:24', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1399, 6, '支付宝', '6', 'crm_receivable_return_type', 0, 'default', '', '', '1', '2023-10-18 21:55:38', '1', '2023-10-18 21:55:38', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1400, 7, '微信支付', '7', 'crm_receivable_return_type', 0, 'default', '', '', '1', '2023-10-18 21:55:53', '1', '2023-10-18 21:55:53', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1401, 8, '其他', '8', 'crm_receivable_return_type', 0, 'default', '', '', '1', '2023-10-18 21:56:06', '1', '2023-10-18 21:56:06', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1402, 1, 'IT', '1', 'crm_customer_industry', 0, 'default', '', '', '1', '2023-10-28 23:02:15', '1', '2024-02-18 23:30:38', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1403, 2, '金融业', '2', 'crm_customer_industry', 0, 'default', '', '', '1', '2023-10-28 23:02:29', '1', '2024-02-18 23:30:43', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1404, 3, '房地产', '3', 'crm_customer_industry', 0, 'default', '', '', '1', '2023-10-28 23:02:41', '1', '2024-02-18 23:30:48', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1405, 4, '商业服务', '4', 'crm_customer_industry', 0, 'default', '', '', '1', '2023-10-28 23:02:54', '1', '2024-02-18 23:30:54', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1406, 5, '运输/物流', '5', 'crm_customer_industry', 0, 'default', '', '', '1', '2023-10-28 23:03:03', '1', '2024-02-18 23:31:00', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1407, 6, '生产', '6', 'crm_customer_industry', 0, 'default', '', '', '1', '2023-10-28 23:03:13', '1', '2024-02-18 23:31:08', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1408, 7, '政府', '7', 'crm_customer_industry', 0, 'default', '', '', '1', '2023-10-28 23:03:27', '1', '2024-02-18 23:31:13', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1409, 8, '文化传媒', '8', 'crm_customer_industry', 0, 'default', '', '', '1', '2023-10-28 23:03:37', '1', '2024-02-18 23:31:20', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1422, 1, 'A (重点客户)', '1', 'crm_customer_level', 0, 'primary', '', '', '1', '2023-10-28 23:07:13', '1', '2023-10-28 23:07:13', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1423, 2, 'B (普通客户)', '2', 'crm_customer_level', 0, 'info', '', '', '1', '2023-10-28 23:07:35', '1', '2023-10-28 23:07:35', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1424, 3, 'C (非优先客户)', '3', 'crm_customer_level', 0, 'default', '', '', '1', '2023-10-28 23:07:53', '1', '2023-10-28 23:07:53', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1425, 1, '促销', '1', 'crm_customer_source', 0, 'default', '', '', '1', '2023-10-28 23:08:29', '1', '2023-10-28 23:08:29', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1426, 2, '搜索引擎', '2', 'crm_customer_source', 0, 'default', '', '', '1', '2023-10-28 23:08:39', '1', '2023-10-28 23:08:39', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1427, 3, '广告', '3', 'crm_customer_source', 0, 'default', '', '', '1', '2023-10-28 23:08:47', '1', '2023-10-28 23:08:47', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1428, 4, '转介绍', '4', 'crm_customer_source', 0, 'default', '', '', '1', '2023-10-28 23:08:58', '1', '2023-10-28 23:08:58', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1429, 5, '线上注册', '5', 'crm_customer_source', 0, 'default', '', '', '1', '2023-10-28 23:09:12', '1', '2023-10-28 23:09:12', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1430, 6, '线上咨询', '6', 'crm_customer_source', 0, 'default', '', '', '1', '2023-10-28 23:09:22', '1', '2023-10-28 23:09:22', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1431, 7, '预约上门', '7', 'crm_customer_source', 0, 'default', '', '', '1', '2023-10-28 23:09:39', '1', '2023-10-28 23:09:39', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1432, 8, '陌拜', '8', 'crm_customer_source', 0, 'default', '', '', '1', '2023-10-28 23:10:04', '1', '2023-10-28 23:10:04', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1433, 9, '电话咨询', '9', 'crm_customer_source', 0, 'default', '', '', '1', '2023-10-28 23:10:18', '1', '2023-10-28 23:10:18', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1434, 10, '邮件咨询', '10', 'crm_customer_source', 0, 'default', '', '', '1', '2023-10-28 23:10:33', '1', '2023-10-28 23:10:33', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1435, 10, 'Gitee', '10', 'system_social_type', 0, '', '', '', '1', '2023-11-04 13:04:42', '1', '2023-11-04 13:04:42', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1436, 20, '钉钉', '20', 'system_social_type', 0, '', '', '', '1', '2023-11-04 13:04:54', '1', '2023-11-04 13:04:54', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1437, 30, '企业微信', '30', 'system_social_type', 0, '', '', '', '1', '2023-11-04 13:05:09', '1', '2023-11-04 13:05:09', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1438, 31, '微信公众平台', '31', 'system_social_type', 0, '', '', '', '1', '2023-11-04 13:05:18', '1', '2023-11-04 13:05:18', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1439, 32, '微信开放平台', '32', 'system_social_type', 0, '', '', '', '1', '2023-11-04 13:05:30', '1', '2023-11-04 13:05:30', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1440, 34, '微信小程序', '34', 'system_social_type', 0, '', '', '', '1', '2023-11-04 13:05:38', '1', '2023-11-04 13:07:16', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1441, 1, '上架', '1', 'crm_product_status', 0, 'success', '', '', '1', '2023-10-30 21:49:34', '1', '2023-10-30 21:49:34', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1442, 0, '下架', '0', 'crm_product_status', 0, 'success', '', '', '1', '2023-10-30 21:49:13', '1', '2023-10-30 21:49:13', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1443, 15, '子表', '15', 'infra_codegen_template_type', 0, 'default', '', '', '1', '2023-11-13 23:06:16', '1', '2023-11-13 23:06:16', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1444, 10, '主表(标准模式)', '10', 'infra_codegen_template_type', 0, 'default', '', '', '1', '2023-11-14 12:32:49', '1', '2023-11-14 12:32:49', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1445, 11, '主表(ERP 模式)', '11', 'infra_codegen_template_type', 0, 'default', '', '', '1', '2023-11-14 12:33:05', '1', '2023-11-14 12:33:05', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1446, 12, '主表(内嵌模式)', '12', 'infra_codegen_template_type', 0, '', '', '', '1', '2023-11-14 12:33:31', '1', '2023-11-14 12:33:31', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1447, 1, '负责人', '1', 'crm_permission_level', 0, 'default', '', '', '1', '2023-11-30 09:53:12', '1', '2023-11-30 09:53:12', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1448, 2, '只读', '2', 'crm_permission_level', 0, '', '', '', '1', '2023-11-30 09:53:29', '1', '2023-11-30 09:53:29', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1449, 3, '读写', '3', 'crm_permission_level', 0, '', '', '', '1', '2023-11-30 09:53:36', '1', '2023-11-30 09:53:36', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1450, 0, '未提交', '0', 'crm_audit_status', 0, '', '', '', '1', '2023-11-30 18:56:59', '1', '2023-11-30 18:56:59', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1451, 10, '审批中', '10', 'crm_audit_status', 0, '', '', '', '1', '2023-11-30 18:57:10', '1', '2023-11-30 18:57:10', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1452, 20, '审核通过', '20', 'crm_audit_status', 0, '', '', '', '1', '2023-11-30 18:57:24', '1', '2023-11-30 18:57:24', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1453, 30, '审核不通过', '30', 'crm_audit_status', 0, '', '', '', '1', '2023-11-30 18:57:32', '1', '2023-11-30 18:57:32', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1454, 40, '已取消', '40', 'crm_audit_status', 0, '', '', '', '1', '2023-11-30 18:57:42', '1', '2023-11-30 18:57:42', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1456, 1, '支票', '1', 'crm_receivable_return_type', 0, 'default', '', '', '1', '2023-10-18 21:54:29', '1', '2023-10-18 21:54:29', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1457, 2, '现金', '2', 'crm_receivable_return_type', 0, 'default', '', '', '1', '2023-10-18 21:54:41', '1', '2023-10-18 21:54:41', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1458, 3, '邮政汇款', '3', 'crm_receivable_return_type', 0, 'default', '', '', '1', '2023-10-18 21:54:53', '1', '2023-10-18 21:54:53', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1459, 4, '电汇', '4', 'crm_receivable_return_type', 0, 'default', '', '', '1', '2023-10-18 21:55:07', '1', '2023-10-18 21:55:07', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1461, 1, '个', '1', 'crm_product_unit', 0, '', '', '', '1', '2023-12-05 23:02:26', '1', '2023-12-05 23:02:26', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1462, 2, '块', '2', 'crm_product_unit', 0, '', '', '', '1', '2023-12-05 23:02:34', '1', '2023-12-05 23:02:34', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1463, 3, '只', '3', 'crm_product_unit', 0, '', '', '', '1', '2023-12-05 23:02:57', '1', '2023-12-05 23:02:57', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1464, 4, '把', '4', 'crm_product_unit', 0, '', '', '', '1', '2023-12-05 23:03:05', '1', '2023-12-05 23:03:05', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1465, 5, '枚', '5', 'crm_product_unit', 0, '', '', '', '1', '2023-12-05 23:03:14', '1', '2023-12-05 23:03:14', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1466, 6, '瓶', '6', 'crm_product_unit', 0, '', '', '', '1', '2023-12-05 23:03:20', '1', '2023-12-05 23:03:20', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1467, 7, '盒', '7', 'crm_product_unit', 0, '', '', '', '1', '2023-12-05 23:03:30', '1', '2023-12-05 23:03:30', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1468, 8, '台', '8', 'crm_product_unit', 0, '', '', '', '1', '2023-12-05 23:03:41', '1', '2023-12-05 23:03:41', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1469, 9, '吨', '9', 'crm_product_unit', 0, '', '', '', '1', '2023-12-05 23:03:48', '1', '2023-12-05 23:03:48', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1470, 10, '千克', '10', 'crm_product_unit', 0, '', '', '', '1', '2023-12-05 23:04:03', '1', '2023-12-05 23:04:03', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1471, 11, '米', '11', 'crm_product_unit', 0, '', '', '', '1', '2023-12-05 23:04:12', '1', '2023-12-05 23:04:12', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1472, 12, '箱', '12', 'crm_product_unit', 0, '', '', '', '1', '2023-12-05 23:04:25', '1', '2023-12-05 23:04:25', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1473, 13, '套', '13', 'crm_product_unit', 0, '', '', '', '1', '2023-12-05 23:04:34', '1', '2023-12-05 23:04:34', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1474, 1, '打电话', '1', 'crm_follow_up_type', 0, '', '', '', '1', '2024-01-15 20:48:20', '1', '2024-01-15 20:48:20', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1475, 2, '发短信', '2', 'crm_follow_up_type', 0, '', '', '', '1', '2024-01-15 20:48:31', '1', '2024-01-15 20:48:31', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1476, 3, '上门拜访', '3', 'crm_follow_up_type', 0, '', '', '', '1', '2024-01-15 20:49:07', '1', '2024-01-15 20:49:07', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1477, 4, '微信沟通', '4', 'crm_follow_up_type', 0, '', '', '', '1', '2024-01-15 20:49:15', '1', '2024-01-15 20:49:15', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1478, 4, '钱包余额', '4', 'pay_transfer_type', 0, 'info', '', '', '1', '2023-10-28 16:28:37', '1', '2023-10-28 16:28:37', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1479, 3, '银行卡', '3', 'pay_transfer_type', 0, 'default', '', '', '1', '2023-10-28 16:28:21', '1', '2023-10-28 16:28:21', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1480, 2, '微信余额', '2', 'pay_transfer_type', 0, 'info', '', '', '1', '2023-10-28 16:28:07', '1', '2023-10-28 16:28:07', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1481, 1, '支付宝余额', '1', 'pay_transfer_type', 0, 'default', '', '', '1', '2023-10-28 16:27:44', '1', '2023-10-28 16:27:44', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1482, 4, '转账失败', '30', 'pay_transfer_status', 0, 'warning', '', '', '1', '2023-10-28 16:24:16', '1', '2023-10-28 16:24:16', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1483, 3, '转账成功', '20', 'pay_transfer_status', 0, 'success', '', '', '1', '2023-10-28 16:23:50', '1', '2023-10-28 16:23:50', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1484, 2, '转账进行中', '10', 'pay_transfer_status', 0, 'info', '', '', '1', '2023-10-28 16:23:12', '1', '2023-10-28 16:23:12', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1485, 1, '等待转账', '0', 'pay_transfer_status', 0, 'default', '', '', '1', '2023-10-28 16:21:43', '1', '2023-10-28 16:23:22', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1486, 10, '其它入库', '10', 'erp_stock_record_biz_type', 0, '', '', '', '1', '2024-02-05 18:07:25', '1', '2024-02-05 18:07:43', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1487, 11, '其它入库(作废)', '11', 'erp_stock_record_biz_type', 0, 'danger', '', '', '1', '2024-02-05 18:08:07', '1', '2024-02-05 19:20:16', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1488, 20, '其它出库', '20', 'erp_stock_record_biz_type', 0, '', '', '', '1', '2024-02-05 18:08:51', '1', '2024-02-05 18:08:51', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1489, 21, '其它出库(作废)', '21', 'erp_stock_record_biz_type', 0, 'danger', '', '', '1', '2024-02-05 18:09:00', '1', '2024-02-05 19:20:10', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1490, 10, '未审核', '10', 'erp_audit_status', 0, 'default', '', '', '1', '2024-02-06 00:00:21', '1', '2024-02-06 00:00:21', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1491, 20, '已审核', '20', 'erp_audit_status', 0, 'success', '', '', '1', '2024-02-06 00:00:35', '1', '2024-02-06 00:00:35', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1492, 30, '调拨入库', '30', 'erp_stock_record_biz_type', 0, '', '', '', '1', '2024-02-07 20:34:19', '1', '2024-02-07 12:36:31', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1493, 31, '调拨入库(作废)', '31', 'erp_stock_record_biz_type', 0, 'danger', '', '', '1', '2024-02-07 20:34:29', '1', '2024-02-07 20:37:11', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1494, 32, '调拨出库', '32', 'erp_stock_record_biz_type', 0, '', '', '', '1', '2024-02-07 20:34:38', '1', '2024-02-07 12:36:33', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1495, 33, '调拨出库(作废)', '33', 'erp_stock_record_biz_type', 0, 'danger', '', '', '1', '2024-02-07 20:34:49', '1', '2024-02-07 20:37:06', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1496, 40, '盘盈入库', '40', 'erp_stock_record_biz_type', 0, '', '', '', '1', '2024-02-08 08:53:00', '1', '2024-02-08 08:53:09', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1497, 41, '盘盈入库(作废)', '41', 'erp_stock_record_biz_type', 0, 'danger', '', '', '1', '2024-02-08 08:53:39', '1', '2024-02-16 19:40:54', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1498, 42, '盘亏出库', '42', 'erp_stock_record_biz_type', 0, '', '', '', '1', '2024-02-08 08:54:16', '1', '2024-02-08 08:54:16', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1499, 43, '盘亏出库(作废)', '43', 'erp_stock_record_biz_type', 0, 'danger', '', '', '1', '2024-02-08 08:54:31', '1', '2024-02-16 19:40:46', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1500, 50, '销售出库', '50', 'erp_stock_record_biz_type', 0, '', '', '', '1', '2024-02-11 21:47:25', '1', '2024-02-11 21:50:40', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1501, 51, '销售出库(作废)', '51', 'erp_stock_record_biz_type', 0, 'danger', '', '', '1', '2024-02-11 21:47:37', '1', '2024-02-11 21:51:12', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1502, 60, '销售退货入库', '60', 'erp_stock_record_biz_type', 0, '', '', '', '1', '2024-02-12 06:51:05', '1', '2024-02-12 06:51:05', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1503, 61, '销售退货入库(作废)', '61', 'erp_stock_record_biz_type', 0, 'danger', '', '', '1', '2024-02-12 06:51:18', '1', '2024-02-12 06:51:18', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1504, 70, '采购入库', '70', 'erp_stock_record_biz_type', 0, '', '', '', '1', '2024-02-16 13:10:02', '1', '2024-02-16 13:10:02', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1505, 71, '采购入库(作废)', '71', 'erp_stock_record_biz_type', 0, 'danger', '', '', '1', '2024-02-16 13:10:10', '1', '2024-02-16 19:40:40', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1506, 80, '采购退货出库', '80', 'erp_stock_record_biz_type', 0, '', '', '', '1', '2024-02-16 13:10:17', '1', '2024-02-16 13:10:17', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1507, 81, '采购退货出库(作废)', '81', 'erp_stock_record_biz_type', 0, 'danger', '', '', '1', '2024-02-16 13:10:26', '1', '2024-02-16 19:40:33', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1509, 3, '审批不通过', '3', 'bpm_process_instance_status', 0, 'danger', '', '', '1', '2024-03-16 16:12:06', '1', '2024-03-16 16:12:06', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1510, 4, '已取消', '4', 'bpm_process_instance_status', 0, 'warning', '', '', '1', '2024-03-16 16:12:22', '1', '2024-03-16 16:12:22', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1511, 5, '已退回', '5', 'bpm_task_status', 0, 'warning', '', '', '1', '2024-03-16 19:10:46', '1', '2024-03-08 22:41:40', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1512, 6, '委派中', '6', 'bpm_task_status', 0, 'primary', '', '', '1', '2024-03-17 10:06:22', '1', '2024-03-08 22:41:40', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1513, 7, '审批通过中', '7', 'bpm_task_status', 0, 'success', '', '', '1', '2024-03-17 10:06:47', '1', '2024-03-08 22:41:41', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1514, 0, '待审批', '0', 'bpm_task_status', 0, 'info', '', '', '1', '2024-03-17 10:07:11', '1', '2024-03-08 22:41:42', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1515, 35, '发起人自选', '35', 'bpm_task_candidate_strategy', 0, '', '', '', '1', '2024-03-22 19:45:16', '1', '2024-03-22 19:45:16', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1516, 1, '执行监听器', 'execution', 'bpm_process_listener_type', 0, 'primary', '', '', '1', '2024-03-23 12:54:03', '1', '2024-03-23 19:14:19', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1517, 1, '任务监听器', 'task', 'bpm_process_listener_type', 0, 'success', '', '', '1', '2024-03-23 12:54:13', '1', '2024-03-23 19:14:24', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1526, 1, 'Java 类', 'class', 'bpm_process_listener_value_type', 0, 'primary', '', '', '1', '2024-03-23 15:08:45', '1', '2024-03-23 19:14:32', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1527, 2, '表达式', 'expression', 'bpm_process_listener_value_type', 0, 'success', '', '', '1', '2024-03-23 15:09:06', '1', '2024-03-23 19:14:38', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1528, 3, '代理表达式', 'delegateExpression', 'bpm_process_listener_value_type', 0, 'info', '', '', '1', '2024-03-23 15:11:23', '1', '2024-03-23 19:14:41', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1529, 1, '天', '1', 'date_interval', 0, '', '', '', '1', '2024-03-29 22:50:26', '1', '2024-03-29 22:50:26', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1530, 2, '周', '2', 'date_interval', 0, '', '', '', '1', '2024-03-29 22:50:36', '1', '2024-03-29 22:50:36', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1531, 3, '月', '3', 'date_interval', 0, '', '', '', '1', '2024-03-29 22:50:46', '1', '2024-03-29 22:50:54', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1532, 4, '季度', '4', 'date_interval', 0, '', '', '', '1', '2024-03-29 22:51:01', '1', '2024-03-29 22:51:01', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1533, 5, '年', '5', 'date_interval', 0, '', '', '', '1', '2024-03-29 22:51:07', '1', '2024-03-29 22:51:07', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1534, 1, '赢单', '1', 'crm_business_end_status_type', 0, 'success', '', '', '1', '2024-04-13 23:26:57', '1', '2024-04-13 23:26:57', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1535, 2, '输单', '2', 'crm_business_end_status_type', 0, 'primary', '', '', '1', '2024-04-13 23:27:31', '1', '2024-04-13 23:27:31', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1536, 3, '无效', '3', 'crm_business_end_status_type', 0, 'info', '', '', '1', '2024-04-13 23:27:59', '1', '2024-04-13 23:27:59', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1537, 1, 'OpenAI', 'OpenAI', 'ai_platform', 0, '', '', '', '1', '2024-05-09 22:33:47', '1', '2024-05-09 22:58:46', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1538, 2, 'Ollama', 'Ollama', 'ai_platform', 0, '', '', '', '1', '2024-05-17 23:02:55', '1', '2024-05-17 23:02:55', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1539, 3, '文心一言', 'YiYan', 'ai_platform', 0, '', '', '', '1', '2024-05-18 09:24:20', '1', '2024-05-18 09:29:01', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1540, 4, '讯飞星火', 'XingHuo', 'ai_platform', 0, '', '', '', '1', '2024-05-18 10:08:56', '1', '2024-05-18 10:08:56', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1541, 5, '通义千问', 'TongYi', 'ai_platform', 0, '', '', '', '1', '2024-05-18 10:32:29', '1', '2024-07-06 15:42:29', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1542, 6, 'StableDiffusion', 'StableDiffusion', 'ai_platform', 0, '', '', '', '1', '2024-06-01 15:09:31', '1', '2024-06-01 15:10:25', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1543, 10, '进行中', '10', 'ai_image_status', 0, 'primary', '', '', '1', '2024-06-26 20:51:41', '1', '2024-06-26 20:52:48', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1544, 20, '已完成', '20', 'ai_image_status', 0, 'success', '', '', '1', '2024-06-26 20:52:07', '1', '2024-06-26 20:52:41', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1545, 30, '已失败', '30', 'ai_image_status', 0, 'warning', '', '', '1', '2024-06-26 20:52:25', '1', '2024-06-26 20:52:35', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1546, 7, 'Midjourney', 'Midjourney', 'ai_platform', 0, '', '', '', '1', '2024-06-26 22:14:46', '1', '2024-06-26 22:14:46', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1547, 10, '进行中', '10', 'ai_music_status', 0, 'primary', '', '', '1', '2024-06-27 22:45:22', '1', '2024-06-28 00:56:17', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1548, 20, '已完成', '20', 'ai_music_status', 0, 'success', '', '', '1', '2024-06-27 22:45:33', '1', '2024-06-28 00:56:18', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1549, 30, '已失败', '30', 'ai_music_status', 0, 'danger', '', '', '1', '2024-06-27 22:45:44', '1', '2024-06-28 00:56:19', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1550, 1, '歌词模式', '1', 'ai_generate_mode', 0, '', '', '', '1', '2024-06-27 22:46:31', '1', '2024-06-28 01:22:25', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1551, 2, '描述模式', '2', 'ai_generate_mode', 0, '', '', '', '1', '2024-06-27 22:46:37', '1', '2024-06-28 01:22:24', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1552, 8, 'Suno', 'Suno', 'ai_platform', 0, '', '', '', '1', '2024-06-29 09:13:36', '1', '2024-06-29 09:13:41', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1553, 9, 'DeepSeek', 'DeepSeek', 'ai_platform', 0, '', '', '', '1', '2024-07-06 12:04:30', '1', '2024-07-06 12:05:20', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1554, 13, '智谱', 'ZhiPu', 'ai_platform', 0, '', '', '', '1', '2024-07-06 18:00:35', '1', '2025-02-24 20:18:41', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1555, 4, '长', '4', 'ai_write_length', 0, '', '', '', '1', '2024-07-07 15:49:03', '1', '2024-07-07 15:49:03', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1556, 5, '段落', '5', 'ai_write_format', 0, '', '', '', '1', '2024-07-07 15:49:54', '1', '2024-07-07 15:49:54', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1557, 6, '文章', '6', 'ai_write_format', 0, '', '', '', '1', '2024-07-07 15:50:05', '1', '2024-07-07 15:50:05', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1558, 7, '博客文章', '7', 'ai_write_format', 0, '', '', '', '1', '2024-07-07 15:50:23', '1', '2024-07-07 15:50:23', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1559, 8, '想法', '8', 'ai_write_format', 0, '', '', '', '1', '2024-07-07 15:50:31', '1', '2024-07-07 15:50:31', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1560, 9, '大纲', '9', 'ai_write_format', 0, '', '', '', '1', '2024-07-07 15:50:37', '1', '2024-07-07 15:50:37', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1561, 1, '自动', '1', 'ai_write_tone', 0, '', '', '', '1', '2024-07-07 15:51:06', '1', '2024-07-07 15:51:06', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1562, 2, '友善', '2', 'ai_write_tone', 0, '', '', '', '1', '2024-07-07 15:51:19', '1', '2024-07-07 15:51:19', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1563, 3, '随意', '3', 'ai_write_tone', 0, '', '', '', '1', '2024-07-07 15:51:27', '1', '2024-07-07 15:51:27', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1564, 4, '友好', '4', 'ai_write_tone', 0, '', '', '', '1', '2024-07-07 15:51:37', '1', '2024-07-07 15:51:37', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1565, 5, '专业', '5', 'ai_write_tone', 0, '', '', '', '1', '2024-07-07 15:51:49', '1', '2024-07-07 15:52:02', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1566, 6, '诙谐', '6', 'ai_write_tone', 0, '', '', '', '1', '2024-07-07 15:52:15', '1', '2024-07-07 15:52:15', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1567, 7, '有趣', '7', 'ai_write_tone', 0, '', '', '', '1', '2024-07-07 15:52:24', '1', '2024-07-07 15:52:24', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1568, 8, '正式', '8', 'ai_write_tone', 0, '', '', '', '1', '2024-07-07 15:54:33', '1', '2024-07-07 15:54:33', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1569, 5, '段落', '5', 'ai_write_format', 0, '', '', '', '1', '2024-07-07 15:49:54', '1', '2024-07-07 15:49:54', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1570, 1, '自动', '1', 'ai_write_format', 0, '', '', '', '1', '2024-07-07 15:19:34', '1', '2024-07-07 15:19:34', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1571, 2, '电子邮件', '2', 'ai_write_format', 0, '', '', '', '1', '2024-07-07 15:19:50', '1', '2024-07-07 15:49:30', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1572, 3, '消息', '3', 'ai_write_format', 0, '', '', '', '1', '2024-07-07 15:20:01', '1', '2024-07-07 15:49:38', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1573, 4, '评论', '4', 'ai_write_format', 0, '', '', '', '1', '2024-07-07 15:20:13', '1', '2024-07-07 15:49:45', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1574, 1, '自动', '1', 'ai_write_language', 0, '', '', '', '1', '2024-07-07 15:44:18', '1', '2024-07-07 15:44:18', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1575, 2, '中文', '2', 'ai_write_language', 0, '', '', '', '1', '2024-07-07 15:44:28', '1', '2024-07-07 15:44:28', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1576, 3, '英文', '3', 'ai_write_language', 0, '', '', '', '1', '2024-07-07 15:44:37', '1', '2024-07-07 15:44:37', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1577, 4, '韩语', '4', 'ai_write_language', 0, '', '', '', '1', '2024-07-07 15:46:28', '1', '2024-07-07 15:46:28', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1578, 5, '日语', '5', 'ai_write_language', 0, '', '', '', '1', '2024-07-07 15:46:44', '1', '2024-07-07 15:46:44', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1579, 1, '自动', '1', 'ai_write_length', 0, '', '', '', '1', '2024-07-07 15:48:34', '1', '2024-07-07 15:48:34', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1580, 2, '短', '2', 'ai_write_length', 0, '', '', '', '1', '2024-07-07 15:48:44', '1', '2024-07-07 15:48:44', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1581, 3, '中等', '3', 'ai_write_length', 0, '', '', '', '1', '2024-07-07 15:48:52', '1', '2024-07-07 15:48:52', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1582, 4, '长', '4', 'ai_write_length', 0, '', '', '', '1', '2024-07-07 15:49:03', '1', '2024-07-07 15:49:03', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1584, 1, '撰写', '1', 'ai_write_type', 0, '', '', '', '1', '2024-07-10 21:26:00', '1', '2024-07-10 21:26:00', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1585, 2, '回复', '2', 'ai_write_type', 0, '', '', '', '1', '2024-07-10 21:26:06', '1', '2024-07-10 21:26:06', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1586, 2, '腾讯云', 'TENCENT', 'system_sms_channel_code', 0, '', '', '', '1', '2024-07-22 22:23:16', '1', '2024-07-22 22:23:16', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1587, 3, '华为云', 'HUAWEI', 'system_sms_channel_code', 0, '', '', '', '1', '2024-07-22 22:23:46', '1', '2024-07-22 22:23:53', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1588, 1, 'OpenAI 微软', 'AzureOpenAI', 'ai_platform', 0, '', '', '', '1', '2024-08-10 14:07:41', '1', '2024-08-10 14:07:41', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1589, 10, 'BPMN 设计器', '10', 'bpm_model_type', 0, 'primary', '', '', '1', '2024-08-26 15:22:17', '1', '2024-08-26 16:46:02', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1590, 20, 'SIMPLE 设计器', '20', 'bpm_model_type', 0, 'success', '', '', '1', '2024-08-26 15:22:27', '1', '2024-08-26 16:45:58', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1591, 4, '七牛云', 'QINIU', 'system_sms_channel_code', 0, '', '', '', '1', '2024-08-31 08:45:03', '1', '2024-08-31 08:45:24', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1592, 3, '新人券', '3', 'promotion_coupon_take_type', 0, 'info', '', '新人注册后,自动发放', '1', '2024-09-03 11:57:16', '1', '2024-09-03 11:57:28', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1593, 5, '微信零钱', '5', 'brokerage_withdraw_type', 0, '', '', '自动打款', '1', '2024-10-13 11:06:48', '1', '2024-10-13 11:06:59', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1683, 10, '字节豆包', 'DouBao', 'ai_platform', 0, '', '', '', '1', '2025-02-23 19:51:40', '1', '2025-02-23 19:52:02', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1684, 11, '腾讯混元', 'HunYuan', 'ai_platform', 0, '', '', '', '1', '2025-02-23 20:58:04', '1', '2025-02-23 20:58:04', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1685, 12, '硅基流动', 'SiliconFlow', 'ai_platform', 0, '', '', '', '1', '2025-02-24 20:19:09', '1', '2025-02-24 20:19:09', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1686, 1, '聊天', '1', 'ai_model_type', 0, '', '', '', '1', '2025-03-03 12:26:34', '1', '2025-03-03 12:26:34', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1687, 2, '图像', '2', 'ai_model_type', 0, '', '', '', '1', '2025-03-03 12:27:23', '1', '2025-03-03 12:27:23', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1688, 3, '音频', '3', 'ai_model_type', 0, '', '', '', '1', '2025-03-03 12:27:51', '1', '2025-03-03 12:27:51', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1689, 4, '视频', '4', 'ai_model_type', 0, '', '', '', '1', '2025-03-03 12:28:03', '1', '2025-03-03 12:28:03', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1690, 5, '向量', '5', 'ai_model_type', 0, '', '', '', '1', '2025-03-03 12:28:15', '1', '2025-03-03 12:28:15', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1691, 6, '重排', '6', 'ai_model_type', 0, '', '', '', '1', '2025-03-03 12:28:26', '1', '2025-03-03 12:28:26', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1692, 14, 'MiniMax', 'MiniMax', 'ai_platform', 0, '', '', '', '1', '2025-03-11 20:04:51', '1', '2025-03-11 20:04:51', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1693, 15, '月之暗灭', 'Moonshot', 'ai_platform', 0, '', '', '', '1', '2025-03-11 20:05:08', '1', '2025-03-11 20:05:08', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2000, 0, '标准数据格式(JSON)', '0', 'iot_data_format', 0, 'default', '', '', '1', '2024-08-10 11:53:26', '1', '2025-03-17 09:28:16', b'0'); +INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2001, 1, '透传/自定义', '1', 'iot_data_format', 0, 'default', '', '', '1', '2024-08-10 11:53:37', '1', '2025-03-17 09:28:19', b'0'); +COMMIT; + +-- ---------------------------- +-- Table structure for system_dict_type +-- ---------------------------- +DROP TABLE IF EXISTS `system_dict_type`; +CREATE TABLE `system_dict_type` ( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '字典主键', + `name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '字典名称', + `type` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '字典类型', + `status` tinyint NOT NULL DEFAULT '0' COMMENT '状态(0正常 1停用)', + `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '备注', + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建者', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '更新者', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', + `deleted_time` datetime DEFAULT NULL COMMENT '删除时间', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=2000 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='字典类型表'; + +-- ---------------------------- +-- Records of system_dict_type +-- ---------------------------- +BEGIN; +INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (1, '用户性别', 'system_user_sex', 0, NULL, 'admin', '2021-01-05 17:03:48', '1', '2022-05-16 20:29:32', b'0', NULL); +INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (6, '参数类型', 'infra_config_type', 0, NULL, 'admin', '2021-01-05 17:03:48', '', '2022-02-01 16:36:54', b'0', NULL); +INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (7, '通知类型', 'system_notice_type', 0, NULL, 'admin', '2021-01-05 17:03:48', '', '2022-02-01 16:35:26', b'0', NULL); +INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (9, '操作类型', 'infra_operate_type', 0, NULL, 'admin', '2021-01-05 17:03:48', '1', '2024-03-14 12:44:01', b'0', NULL); +INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (10, '系统状态', 'common_status', 0, NULL, 'admin', '2021-01-05 17:03:48', '', '2022-02-01 16:21:28', b'0', NULL); +INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (11, 'Boolean 是否类型', 'infra_boolean_string', 0, 'boolean 转是否', '', '2021-01-19 03:20:08', '', '2022-02-01 16:37:10', b'0', NULL); +INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (104, '登陆结果', 'system_login_result', 0, '登陆结果', '', '2021-01-18 06:17:11', '', '2022-02-01 16:36:00', b'0', NULL); +INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (106, '代码生成模板类型', 'infra_codegen_template_type', 0, NULL, '', '2021-02-05 07:08:06', '1', '2022-05-16 20:26:50', b'0', NULL); +INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (107, '定时任务状态', 'infra_job_status', 0, NULL, '', '2021-02-07 07:44:16', '', '2022-02-01 16:51:11', b'0', NULL); +INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (108, '定时任务日志状态', 'infra_job_log_status', 0, NULL, '', '2021-02-08 10:03:51', '', '2022-02-01 16:50:43', b'0', NULL); +INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (109, '用户类型', 'user_type', 0, NULL, '', '2021-02-26 00:15:51', '', '2021-02-26 00:15:51', b'0', NULL); +INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (110, 'API 异常数据的处理状态', 'infra_api_error_log_process_status', 0, NULL, '', '2021-02-26 07:07:01', '', '2022-02-01 16:50:53', b'0', NULL); +INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (116, '登陆日志的类型', 'system_login_type', 0, '登陆日志的类型', '1', '2021-10-06 00:50:46', '1', '2022-02-01 16:35:56', b'0', NULL); +INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (144, '代码生成的场景枚举', 'infra_codegen_scene', 0, '代码生成的场景枚举', '1', '2022-02-02 13:14:45', '1', '2022-03-10 16:33:46', b'0', NULL); +INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (145, '角色类型', 'system_role_type', 0, '角色类型', '1', '2022-02-16 13:01:46', '1', '2022-02-16 13:01:46', b'0', NULL); +INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (146, '文件存储器', 'infra_file_storage', 0, '文件存储器', '1', '2022-03-15 00:24:38', '1', '2022-03-15 00:24:38', b'0', NULL); +INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (147, 'OAuth 2.0 授权类型', 'system_oauth2_grant_type', 0, 'OAuth 2.0 授权类型(模式)', '1', '2022-05-12 00:20:52', '1', '2022-05-11 16:25:49', b'0', NULL); +INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (160, '终端', 'terminal', 0, '终端', '1', '2022-12-10 10:50:50', '1', '2022-12-10 10:53:11', b'0', NULL); +COMMIT; + +-- ---------------------------- +-- Table structure for system_login_log +-- ---------------------------- +DROP TABLE IF EXISTS `system_login_log`; +CREATE TABLE `system_login_log` ( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '访问ID', + `log_type` bigint NOT NULL COMMENT '日志类型', + `trace_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '链路追踪编号', + `user_id` bigint NOT NULL DEFAULT '0' COMMENT '用户编号', + `user_type` tinyint NOT NULL DEFAULT '0' COMMENT '用户类型', + `username` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '用户账号', + `result` tinyint NOT NULL COMMENT '登陆结果', + `user_ip` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '用户 IP', + `user_agent` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '浏览器 UA', + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建者', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '更新者', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', + `tenant_id` bigint NOT NULL DEFAULT '0' COMMENT '租户编号', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=3483 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='系统访问记录'; + +-- ---------------------------- +-- Records of system_login_log +-- ---------------------------- +BEGIN; +INSERT INTO `system_login_log` (`id`, `log_type`, `trace_id`, `user_id`, `user_type`, `username`, `result`, `user_ip`, `user_agent`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (3475, 100, '93afa762-9497-4e53-976d-50a67af59452', 1, 2, 'admin', 0, '0:0:0:0:0:0:0:1', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36', NULL, '2025-06-30 22:38:03', NULL, '2025-06-30 22:38:03', b'0', 0); +INSERT INTO `system_login_log` (`id`, `log_type`, `trace_id`, `user_id`, `user_type`, `username`, `result`, `user_ip`, `user_agent`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (3476, 100, '6270e957-c9e2-4331-b837-a9d2c94b80c5', 1, 2, 'admin', 0, '0:0:0:0:0:0:0:1', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36', NULL, '2025-07-01 21:41:03', NULL, '2025-07-01 21:41:03', b'0', 0); +INSERT INTO `system_login_log` (`id`, `log_type`, `trace_id`, `user_id`, `user_type`, `username`, `result`, `user_ip`, `user_agent`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (3477, 100, 'd65b4748-63a1-4326-a8dd-ac6a6b96f6c3', 1, 2, 'admin', 10, '0:0:0:0:0:0:0:1', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36', NULL, '2026-06-01 15:52:18', NULL, '2026-06-01 15:52:18', b'0', 0); +INSERT INTO `system_login_log` (`id`, `log_type`, `trace_id`, `user_id`, `user_type`, `username`, `result`, `user_ip`, `user_agent`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (3478, 100, 'cb23c764-e410-4dfe-aabe-f2ba75d05f06', 1, 2, 'admin', 10, '0:0:0:0:0:0:0:1', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36', NULL, '2026-06-01 15:52:26', NULL, '2026-06-01 15:52:26', b'0', 0); +INSERT INTO `system_login_log` (`id`, `log_type`, `trace_id`, `user_id`, `user_type`, `username`, `result`, `user_ip`, `user_agent`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (3479, 100, '9c2c4cf5-db7b-4aaa-b400-71f9a93c6674', 1, 2, 'admin', 10, '0:0:0:0:0:0:0:1', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36', NULL, '2026-06-01 15:56:18', NULL, '2026-06-01 15:56:18', b'0', 0); +INSERT INTO `system_login_log` (`id`, `log_type`, `trace_id`, `user_id`, `user_type`, `username`, `result`, `user_ip`, `user_agent`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (3480, 100, '1f0bf756-b439-481a-83e6-755d11c9d66f', 1, 2, 'admin', 10, '0:0:0:0:0:0:0:1', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36', NULL, '2026-06-01 15:56:25', NULL, '2026-06-01 15:56:25', b'0', 0); +INSERT INTO `system_login_log` (`id`, `log_type`, `trace_id`, `user_id`, `user_type`, `username`, `result`, `user_ip`, `user_agent`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (3481, 100, '52c06312-3d43-4adf-a455-f57d475bade1', 1, 2, 'admin', 0, '0:0:0:0:0:0:0:1', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36', NULL, '2026-06-01 15:57:18', NULL, '2026-06-01 15:57:18', b'0', 0); +INSERT INTO `system_login_log` (`id`, `log_type`, `trace_id`, `user_id`, `user_type`, `username`, `result`, `user_ip`, `user_agent`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (3482, 100, '2cd686a9-cdb5-4694-abdb-527805566fe6', 1, 2, 'admin', 0, '0:0:0:0:0:0:0:1', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36', NULL, '2026-06-02 10:37:38', NULL, '2026-06-02 10:37:38', b'0', 0); +COMMIT; + +-- ---------------------------- +-- Table structure for system_menu +-- ---------------------------- +DROP TABLE IF EXISTS `system_menu`; +CREATE TABLE `system_menu` ( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '菜单ID', + `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '菜单名称', + `permission` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '权限标识', + `type` tinyint NOT NULL COMMENT '菜单类型', + `sort` int NOT NULL DEFAULT '0' COMMENT '显示顺序', + `parent_id` bigint NOT NULL DEFAULT '0' COMMENT '父菜单ID', + `path` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '路由地址', + `icon` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '#' COMMENT '菜单图标', + `component` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '组件路径', + `component_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '组件名', + `status` tinyint NOT NULL DEFAULT '0' COMMENT '菜单状态', + `visible` bit(1) NOT NULL DEFAULT b'1' COMMENT '是否可见', + `keep_alive` bit(1) NOT NULL DEFAULT b'1' COMMENT '是否缓存', + `always_show` bit(1) NOT NULL DEFAULT b'1' COMMENT '是否总是显示', + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建者', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '更新者', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=7046 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='菜单权限表'; + +-- ---------------------------- +-- Records of system_menu +-- ---------------------------- +BEGIN; +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1, '系统管理', '', 1, 10, 0, '/system', 'ep:tools', NULL, NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2025-03-15 21:30:27', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2, '基础设施', '', 1, 20, 0, '/infra', 'ep:monitor', NULL, NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2024-03-01 08:28:40', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (100, '用户管理', 'system:user:list', 2, 1, 1, 'user', 'ep:avatar', 'system/user/index', 'SystemUser', 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2025-03-15 21:30:41', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (101, '角色管理', '', 2, 2, 1, 'role', 'ep:user', 'system/role/index', 'SystemRole', 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2024-05-01 18:35:29', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (102, '菜单管理', '', 2, 3, 1, 'menu', 'ep:menu', 'system/menu/index', 'SystemMenu', 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2024-02-29 01:03:50', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (103, '部门管理', '', 2, 4, 1, 'dept', 'fa:address-card', 'system/dept/index', 'SystemDept', 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2024-02-29 01:06:28', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (104, '岗位管理', '', 2, 5, 1, 'post', 'fa:address-book-o', 'system/post/index', 'SystemPost', 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2024-02-29 01:06:39', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (105, '字典管理', '', 2, 6, 1, 'dict', 'ep:collection', 'system/dict/index', 'SystemDictType', 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2024-02-29 01:07:12', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (106, '配置管理', '', 2, 8, 2, 'config', 'fa:connectdevelop', 'infra/config/index', 'InfraConfig', 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2024-04-23 00:02:45', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (107, '通知公告', '', 2, 4, 1, 'notice', 'ep:takeaway-box', 'system/notice/index', 'SystemNotice', 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2024-04-22 23:56:17', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (108, '审计日志', '', 1, 9, 1, 'log', 'ep:document-copy', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2024-02-29 01:08:30', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (110, '定时任务', '', 2, 7, 2, 'job', 'fa-solid:tasks', 'infra/job/index', 'InfraJob', 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2024-02-29 08:57:36', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (114, '表单构建', 'infra:build:list', 2, 2, 2, 'build', 'fa:wpforms', 'infra/build/index', 'InfraBuild', 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2024-02-29 08:51:35', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (115, '代码生成', 'infra:codegen:query', 2, 1, 2, 'codegen', 'ep:document-copy', 'infra/codegen/index', 'InfraCodegen', 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2024-02-29 08:51:06', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (116, 'API 接口', 'infra:swagger:list', 2, 3, 2, 'swagger', 'fa:fighter-jet', 'infra/swagger/index', 'InfraSwagger', 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2024-04-23 00:01:24', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (500, '操作日志', '', 2, 1, 108, 'operate-log', 'ep:position', 'system/operatelog/index', 'SystemOperateLog', 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2024-02-29 01:09:59', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (501, '登录日志', '', 2, 2, 108, 'login-log', 'ep:promotion', 'system/loginlog/index', 'SystemLoginLog', 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2024-02-29 01:10:29', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1001, '用户查询', 'system:user:query', 3, 1, 100, '', '#', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1002, '用户新增', 'system:user:create', 3, 2, 100, '', '', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1003, '用户修改', 'system:user:update', 3, 3, 100, '', '', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1004, '用户删除', 'system:user:delete', 3, 4, 100, '', '', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1005, '用户导出', 'system:user:export', 3, 5, 100, '', '#', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1006, '用户导入', 'system:user:import', 3, 6, 100, '', '#', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1007, '重置密码', 'system:user:update-password', 3, 7, 100, '', '', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1008, '角色查询', 'system:role:query', 3, 1, 101, '', '#', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1009, '角色新增', 'system:role:create', 3, 2, 101, '', '', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1010, '角色修改', 'system:role:update', 3, 3, 101, '', '', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1011, '角色删除', 'system:role:delete', 3, 4, 101, '', '', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1012, '角色导出', 'system:role:export', 3, 5, 101, '', '#', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1013, '菜单查询', 'system:menu:query', 3, 1, 102, '', '#', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1014, '菜单新增', 'system:menu:create', 3, 2, 102, '', '#', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1015, '菜单修改', 'system:menu:update', 3, 3, 102, '', '#', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1016, '菜单删除', 'system:menu:delete', 3, 4, 102, '', '#', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1017, '部门查询', 'system:dept:query', 3, 1, 103, '', '#', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1018, '部门新增', 'system:dept:create', 3, 2, 103, '', '', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1019, '部门修改', 'system:dept:update', 3, 3, 103, '', '', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1020, '部门删除', 'system:dept:delete', 3, 4, 103, '', '', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1021, '岗位查询', 'system:post:query', 3, 1, 104, '', '#', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1022, '岗位新增', 'system:post:create', 3, 2, 104, '', '', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1023, '岗位修改', 'system:post:update', 3, 3, 104, '', '', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1024, '岗位删除', 'system:post:delete', 3, 4, 104, '', '', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1025, '岗位导出', 'system:post:export', 3, 5, 104, '', '#', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1026, '字典查询', 'system:dict:query', 3, 1, 105, '#', '#', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1027, '字典新增', 'system:dict:create', 3, 2, 105, '', '', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1028, '字典修改', 'system:dict:update', 3, 3, 105, '', '', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1029, '字典删除', 'system:dict:delete', 3, 4, 105, '', '', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1030, '字典导出', 'system:dict:export', 3, 5, 105, '#', '#', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1031, '配置查询', 'infra:config:query', 3, 1, 106, '', '', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1032, '配置新增', 'infra:config:create', 3, 2, 106, '', '', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1033, '配置修改', 'infra:config:update', 3, 3, 106, '', '', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1034, '配置删除', 'infra:config:delete', 3, 4, 106, '', '', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1035, '配置导出', 'infra:config:export', 3, 5, 106, '', '', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1036, '公告查询', 'system:notice:query', 3, 1, 107, '#', '#', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1037, '公告新增', 'system:notice:create', 3, 2, 107, '', '', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1038, '公告修改', 'system:notice:update', 3, 3, 107, '', '', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1039, '公告删除', 'system:notice:delete', 3, 4, 107, '', '', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1040, '操作查询', 'system:operate-log:query', 3, 1, 500, '', '', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1042, '日志导出', 'system:operate-log:export', 3, 2, 500, '', '', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1043, '登录查询', 'system:login-log:query', 3, 1, 501, '#', '#', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1045, '日志导出', 'system:login-log:export', 3, 3, 501, '#', '#', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1050, '任务新增', 'infra:job:create', 3, 2, 110, '', '', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1051, '任务修改', 'infra:job:update', 3, 3, 110, '', '', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1052, '任务删除', 'infra:job:delete', 3, 4, 110, '', '', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1053, '状态修改', 'infra:job:update', 3, 5, 110, '', '', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1054, '任务导出', 'infra:job:export', 3, 7, 110, '', '', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1056, '生成修改', 'infra:codegen:update', 3, 2, 115, '', '', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1057, '生成删除', 'infra:codegen:delete', 3, 3, 115, '', '', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1058, '导入代码', 'infra:codegen:create', 3, 2, 115, '', '', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1059, '预览代码', 'infra:codegen:preview', 3, 4, 115, '', '', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1060, '生成代码', 'infra:codegen:download', 3, 5, 115, '', '', '', NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1063, '设置角色菜单权限', 'system:permission:assign-role-menu', 3, 6, 101, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2021-01-06 17:53:44', '', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1064, '设置角色数据权限', 'system:permission:assign-role-data-scope', 3, 7, 101, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2021-01-06 17:56:31', '', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1065, '设置用户角色', 'system:permission:assign-user-role', 3, 8, 101, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2021-01-07 10:23:28', '', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1075, '任务触发', 'infra:job:trigger', 3, 8, 110, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2021-02-07 13:03:10', '', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1087, '任务查询', 'infra:job:query', 3, 1, 110, '', '', '', NULL, 0, b'1', b'1', b'1', '1', '2021-03-10 01:26:19', '1', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1090, '文件列表', '', 2, 5, 1243, 'file', 'ep:upload-filled', 'infra/file/index', 'InfraFile', 0, b'1', b'1', b'1', '', '2021-03-12 20:16:20', '1', '2024-02-29 08:53:02', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1091, '文件查询', 'infra:file:query', 3, 1, 1090, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2021-03-12 20:16:20', '', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1092, '文件删除', 'infra:file:delete', 3, 4, 1090, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2021-03-12 20:16:20', '', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1237, '文件配置', '', 2, 0, 1243, 'file-config', 'fa-solid:file-signature', 'infra/fileConfig/index', 'InfraFileConfig', 0, b'1', b'1', b'1', '', '2022-03-15 14:35:28', '1', '2024-02-29 08:52:54', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1238, '文件配置查询', 'infra:file-config:query', 3, 1, 1237, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2022-03-15 14:35:28', '', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1239, '文件配置创建', 'infra:file-config:create', 3, 2, 1237, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2022-03-15 14:35:28', '', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1240, '文件配置更新', 'infra:file-config:update', 3, 3, 1237, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2022-03-15 14:35:28', '', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1241, '文件配置删除', 'infra:file-config:delete', 3, 4, 1237, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2022-03-15 14:35:28', '', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1242, '文件配置导出', 'infra:file-config:export', 3, 5, 1237, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2022-03-15 14:35:28', '', '2022-04-20 17:03:10', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1243, '文件管理', '', 2, 6, 2, 'file', 'ep:files', NULL, '', 0, b'1', b'1', b'1', '1', '2022-03-16 23:47:40', '1', '2024-04-23 00:02:11', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1255, '数据源配置', '', 2, 1, 2, 'data-source-config', 'ep:data-analysis', 'infra/dataSourceConfig/index', 'InfraDataSourceConfig', 0, b'1', b'1', b'1', '', '2022-04-27 14:37:32', '1', '2024-02-29 08:51:25', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1256, '数据源配置查询', 'infra:data-source-config:query', 3, 1, 1255, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2022-04-27 14:37:32', '', '2022-04-27 14:37:32', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1257, '数据源配置创建', 'infra:data-source-config:create', 3, 2, 1255, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2022-04-27 14:37:32', '', '2022-04-27 14:37:32', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1258, '数据源配置更新', 'infra:data-source-config:update', 3, 3, 1255, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2022-04-27 14:37:32', '', '2022-04-27 14:37:32', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1259, '数据源配置删除', 'infra:data-source-config:delete', 3, 4, 1255, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2022-04-27 14:37:32', '', '2022-04-27 14:37:32', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1260, '数据源配置导出', 'infra:data-source-config:export', 3, 5, 1255, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2022-04-27 14:37:32', '', '2022-04-27 14:37:32', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2083, '地区管理', '', 2, 14, 1, 'area', 'fa:map-marker', 'system/area/index', 'SystemArea', 0, b'1', b'1', b'1', '1', '2022-12-23 17:35:05', '1', '2024-02-29 08:50:28', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (3000, '短信渠道', '', 1, 30, 0, '/smschannel', 'fa:address-card', NULL, NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2025-07-02 21:03:22', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (5000, '渠道配置', '', 2, 0, 3000, 'sms-channel-info', 'fa:creative-commons', 'smschannel/smschannelinfo/index', 'SmsChannelInfo', 0, b'1', b'1', b'1', '', '2025-07-02 20:54:30', '1', '2025-07-02 21:03:41', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (5001, '渠道配置查询', 't:sms-channel-info:query', 3, 1, 5000, '', '', '', '', 0, b'1', b'1', b'1', '', '2025-07-02 20:54:30', '1', '2025-07-02 20:58:34', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (5002, '创建渠道配置', 't:sms-channel-info:create', 3, 2, 5000, '', '', '', '', 0, b'1', b'1', b'1', '', '2025-07-02 20:54:30', '1', '2025-07-02 20:58:46', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (5003, '更新渠道配置', 't:sms-channel-info:update', 3, 3, 5000, '', '', '', '', 0, b'1', b'1', b'1', '', '2025-07-02 20:54:30', '1', '2025-07-02 20:59:01', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (5004, '删除渠道配置', 't:sms-channel-info:delete', 3, 4, 5000, '', '', '', '', 0, b'1', b'1', b'1', '', '2025-07-02 20:54:30', '1', '2025-07-02 20:59:08', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (5005, '导出渠道配置', 't:sms-channel-info:export', 3, 5, 5000, '', '', '', '', 0, b'1', b'1', b'1', '', '2025-07-02 20:54:30', '1', '2025-07-02 20:59:17', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (5006, '渠道账号', '', 2, 0, 3000, 'channel-account', 'ep:film', 'smschannel/channelaccount/index', 'ChannelAccount', 0, b'1', b'1', b'1', '', '2025-07-05 23:46:12', '1', '2025-07-05 23:47:25', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (5007, '短信渠道账号查询', 'smschannel:channel-account:query', 3, 1, 5006, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-07-05 23:46:12', '', '2025-07-05 23:46:12', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (5008, '短信渠道账号创建', 'smschannel:channel-account:create', 3, 2, 5006, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-07-05 23:46:12', '', '2025-07-05 23:46:12', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (5009, '短信渠道账号更新', 'smschannel:channel-account:update', 3, 3, 5006, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-07-05 23:46:12', '', '2025-07-05 23:46:12', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (5010, '短信渠道账号删除', 'smschannel:channel-account:delete', 3, 4, 5006, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-07-05 23:46:12', '', '2025-07-05 23:46:12', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6000, '国内短信', '', 1, 30, 0, '/domesticsms', 'fa:archive', NULL, NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2025-07-08 22:18:44', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6002, '签名管理', '', 2, 0, 6000, 'sms-sign-info', 'fa:creative-commons', 'domesticsms/signinfo/index', 'SmsSignInfo', 0, b'1', b'1', b'1', '', '2025-07-08 17:00:51', '1', '2025-07-08 17:05:16', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6003, '短信签名信息查询', 'sms:sign-info:query', 3, 1, 6002, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-07-08 17:00:51', '', '2025-07-08 17:00:51', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6004, '短信签名信息创建', 'sms:sign-info:create', 3, 2, 6002, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-07-08 17:00:51', '', '2025-07-08 17:00:51', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6005, '短信签名信息更新', 'sms:sign-info:update', 3, 3, 6002, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-07-08 17:00:51', '', '2025-07-08 17:00:51', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6006, '短信签名信息删除', 'sms:sign-info:delete', 3, 4, 6002, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-07-08 17:00:51', '', '2025-07-08 17:00:51', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6007, '短信签名信息导出', 'sms:sign-info:export', 3, 5, 6002, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-07-08 17:00:51', '', '2025-07-08 17:00:51', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6008, '模板信息', '', 2, 0, 6000, 'templateinfo', 'ep:eleme-filled', 'domesticsms/templateinfo/index', 'TemplateInfo', 0, b'1', b'1', b'1', '', '2025-07-09 10:50:59', '1', '2025-07-14 11:02:47', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6009, '短信模板信息查询', 'smschannel:template-info:query', 3, 1, 6008, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-07-09 10:50:59', '', '2025-07-09 10:50:59', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6010, '短信模板信息创建', 'smschannel:template-info:create', 3, 2, 6008, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-07-09 10:50:59', '', '2025-07-09 10:50:59', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6011, '短信模板信息更新', 'smschannel:template-info:update', 3, 3, 6008, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-07-09 10:50:59', '', '2025-07-09 10:50:59', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6012, '短信模板信息删除', 'smschannel:template-info:delete', 3, 4, 6008, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-07-09 10:50:59', '', '2025-07-09 10:50:59', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6013, '短信模板信息导出', 'smschannel:template-info:export', 3, 5, 6008, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-07-09 10:50:59', '', '2025-07-09 10:50:59', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6020, '短信记录', '', 2, 0, 6000, 'record', 'ep:message', 'domesticsms/record/index', 'Record', 0, b'1', b'1', b'1', '', '2025-09-13 21:58:45', '1', '2025-09-13 22:01:28', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6021, '短信记录查询', 'sms:record:query', 3, 1, 6020, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-09-13 21:58:45', '', '2025-09-13 21:58:45', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6022, '短信记录创建', 'sms:record:create', 3, 2, 6020, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-09-13 21:58:45', '', '2025-09-13 21:58:45', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6023, '短信记录更新', 'sms:record:update', 3, 3, 6020, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-09-13 21:58:45', '', '2025-09-13 21:58:45', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6024, '短信记录删除', 'sms:record:delete', 3, 4, 6020, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-09-13 21:58:45', '', '2025-09-13 21:58:45', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6025, '短信记录导出', 'sms:record:export', 3, 5, 6020, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-09-13 21:58:45', '', '2025-09-13 21:58:45', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6026, '租户管理', '', 1, 21, 0, '/tenant/index', 'fa-solid:binoculars', '', '', 0, b'1', b'1', b'1', '1', '2025-09-15 19:28:25', '1', '2025-09-15 19:28:25', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6027, '租户列表', '', 2, 0, 6026, 'tenant', 'fa:renren', '/tenant/index', 'SmsTenant', 0, b'1', b'1', b'1', '', '2025-09-15 19:28:43', '1', '2025-09-15 19:32:04', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6028, '租户查询', 'sms:tenant:query', 3, 1, 6027, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-09-15 19:28:43', '', '2025-09-15 19:28:43', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6029, '租户创建', 'sms:tenant:create', 3, 2, 6027, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-09-15 19:28:43', '', '2025-09-15 19:28:43', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6030, '租户更新', 'sms:tenant:update', 3, 3, 6027, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-09-15 19:28:43', '', '2025-09-15 19:28:43', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6031, '租户删除', 'sms:tenant:delete', 3, 4, 6027, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-09-15 19:28:43', '', '2025-09-15 19:28:43', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6032, '租户导出', 'sms:tenant:export', 3, 5, 6027, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-09-15 19:28:43', '', '2025-09-15 19:28:43', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6033, '应用列表', '', 2, 0, 6026, 'sms-appinfo', 'ep:apple', '/tenant/SmsAppinfo/index', 'SmsAppinfo', 0, b'1', b'1', b'1', '', '2025-09-15 19:28:56', '1', '2025-09-15 19:30:29', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6034, '租户应用查询', 'tenant:sms-appinfo:query', 3, 1, 6033, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-09-15 19:28:56', '', '2025-09-15 19:28:56', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6035, '租户应用创建', 'tenant:sms-appinfo:create', 3, 2, 6033, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-09-15 19:28:56', '', '2025-09-15 19:28:56', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6036, '租户应用更新', 'tenant:sms-appinfo:update', 3, 3, 6033, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-09-15 19:28:56', '', '2025-09-15 19:28:56', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6037, '租户应用删除', 'tenant:sms-appinfo:delete', 3, 4, 6033, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-09-15 19:28:56', '', '2025-09-15 19:28:56', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6038, '租户应用导出', 'tenant:sms-appinfo:export', 3, 5, 6033, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-09-15 19:28:56', '', '2025-09-15 19:28:56', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6040, '发送任务', '', 2, 0, 6000, 'domesticsms/sendtask/index', 'fa:tasks', 'domesticsms/sendtask/index', 'SmsTask', 0, b'1', b'1', b'1', '', '2025-09-19 10:02:14', '1', '2025-09-19 10:06:55', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6041, '短信任务查询', 'record:sms-task:query', 3, 1, 6040, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-09-19 10:02:14', '', '2025-09-19 10:02:14', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6042, '短信任务创建', 'record:sms-task:create', 3, 2, 6040, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-09-19 10:02:14', '', '2025-09-19 10:02:14', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6043, '短信任务更新', 'record:sms-task:update', 3, 3, 6040, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-09-19 10:02:14', '', '2025-09-19 10:02:14', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6044, '短信任务删除', 'record:sms-task:delete', 3, 4, 6040, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-09-19 10:02:14', '', '2025-09-19 10:02:14', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (6045, '短信任务导出', 'record:sms-task:export', 3, 5, 6040, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-09-19 10:02:14', '', '2025-09-19 10:02:14', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (7000, '国际短信', '', 1, 31, 0, '/internationalsms', 'fa:globe', NULL, NULL, 0, b'1', b'1', b'1', 'admin', '2021-01-05 17:03:48', '1', '2025-07-08 22:18:44', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (7002, '签名管理', '', 2, 0, 7000, 'sms-sign-info', 'fa:creative-commons', 'internationalsms/signinfo/index', 'SmsSignInfo1', 0, b'1', b'1', b'1', '', '2025-07-08 17:00:51', '1', '2025-07-08 17:05:16', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (7003, '短信签名信息查询', 'sms:sign-info:query', 3, 1, 7002, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-07-08 17:00:51', '', '2025-07-08 17:00:51', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (7004, '短信签名信息创建', 'sms:sign-info:create', 3, 2, 7002, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-07-08 17:00:51', '', '2025-07-08 17:00:51', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (7005, '短信签名信息更新', 'sms:sign-info:update', 3, 3, 7002, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-07-08 17:00:51', '', '2025-07-08 17:00:51', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (7006, '短信签名信息删除', 'sms:sign-info:delete', 3, 4, 7002, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-07-08 17:00:51', '', '2025-07-08 17:00:51', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (7007, '短信签名信息导出', 'sms:sign-info:export', 3, 5, 7002, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-07-08 17:00:51', '', '2025-07-08 17:00:51', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (7008, '模板信息', '', 2, 0, 7000, 'templateinfo', 'ep:eleme-filled', 'internationalsms/templateinfo/index', 'TemplateInfo1', 0, b'1', b'1', b'1', '', '2025-07-09 10:50:59', '1', '2025-07-14 11:02:47', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (7009, '短信模板信息查询', 'smschannel:template-info:query', 3, 1, 7008, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-07-09 10:50:59', '', '2025-07-09 10:50:59', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (7010, '短信模板信息创建', 'smschannel:template-info:create', 3, 2, 7008, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-07-09 10:50:59', '', '2025-07-09 10:50:59', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (7011, '短信模板信息更新', 'smschannel:template-info:update', 3, 3, 7008, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-07-09 10:50:59', '', '2025-07-09 10:50:59', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (7012, '短信模板信息删除', 'smschannel:template-info:delete', 3, 4, 7008, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-07-09 10:50:59', '', '2025-07-09 10:50:59', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (7013, '短信模板信息导出', 'smschannel:template-info:export', 3, 5, 7008, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-07-09 10:50:59', '', '2025-07-09 10:50:59', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (7020, '短信记录', '', 2, 0, 7000, 'record', 'ep:message', 'internationalsms/record/index', 'Record1', 0, b'1', b'1', b'1', '', '2025-09-13 21:58:45', '1', '2025-09-13 22:01:28', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (7021, '短信记录查询', 'sms:record:query', 3, 1, 7020, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-09-13 21:58:45', '', '2025-09-13 21:58:45', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (7022, '短信记录创建', 'sms:record:create', 3, 2, 7020, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-09-13 21:58:45', '', '2025-09-13 21:58:45', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (7023, '短信记录更新', 'sms:record:update', 3, 3, 7020, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-09-13 21:58:45', '', '2025-09-13 21:58:45', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (7024, '短信记录删除', 'sms:record:delete', 3, 4, 7020, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-09-13 21:58:45', '', '2025-09-13 21:58:45', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (7025, '短信记录导出', 'sms:record:export', 3, 5, 7020, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-09-13 21:58:45', '', '2025-09-13 21:58:45', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (7040, '发送任务', '', 2, 0, 7000, 'internationalsms/sendtask/index', 'fa:tasks', 'internationalsms/sendtask/index', 'SmsTask1', 0, b'1', b'1', b'1', '', '2025-09-19 10:02:14', '1', '2025-09-19 10:06:55', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (7041, '短信任务查询', 'record:sms-task:query', 3, 1, 7040, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-09-19 10:02:14', '', '2025-09-19 10:02:14', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (7042, '短信任务创建', 'record:sms-task:create', 3, 2, 7040, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-09-19 10:02:14', '', '2025-09-19 10:02:14', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (7043, '短信任务更新', 'record:sms-task:update', 3, 3, 7040, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-09-19 10:02:14', '', '2025-09-19 10:02:14', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (7044, '短信任务删除', 'record:sms-task:delete', 3, 4, 7040, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-09-19 10:02:14', '', '2025-09-19 10:02:14', b'0'); +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (7045, '短信任务导出', 'record:sms-task:export', 3, 5, 7040, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2025-09-19 10:02:14', '', '2025-09-19 10:02:14', b'0'); +COMMIT; + +-- ---------------------------- +-- Table structure for system_notice +-- ---------------------------- +DROP TABLE IF EXISTS `system_notice`; +CREATE TABLE `system_notice` ( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '公告ID', + `title` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '公告标题', + `content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '公告内容', + `type` tinyint NOT NULL COMMENT '公告类型(1通知 2公告)', + `status` tinyint NOT NULL DEFAULT '0' COMMENT '公告状态(0正常 1关闭)', + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建者', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '更新者', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='通知公告表'; + +-- ---------------------------- +-- Records of system_notice +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for system_operate_log +-- ---------------------------- +DROP TABLE IF EXISTS `system_operate_log`; +CREATE TABLE `system_operate_log` ( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '日志主键', + `trace_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '链路追踪编号', + `user_id` bigint NOT NULL COMMENT '用户编号', + `user_type` tinyint NOT NULL DEFAULT '0' COMMENT '用户类型', + `type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '操作模块类型', + `sub_type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '操作名', + `biz_id` bigint NOT NULL COMMENT '操作数据模块编号', + `action` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '操作内容', + `success` bit(1) NOT NULL DEFAULT b'1' COMMENT '操作结果', + `extra` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '拓展字段', + `request_method` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '请求方法名', + `request_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '请求地址', + `user_ip` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '用户 IP', + `user_agent` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '浏览器 UA', + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建者', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '更新者', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', + `tenant_id` bigint NOT NULL DEFAULT '0' COMMENT '租户编号', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=9066 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='操作日志记录 V2 版本'; + +-- ---------------------------- +-- Records of system_operate_log +-- ---------------------------- +BEGIN; +INSERT INTO `system_operate_log` (`id`, `trace_id`, `user_id`, `user_type`, `type`, `sub_type`, `biz_id`, `action`, `success`, `extra`, `request_method`, `request_url`, `user_ip`, `user_agent`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (9065, '', 1, 2, 'SYSTEM 用户', '重置用户密码', 1, '将用户【勇哥Java实战】的密码从【$2a$04$Q3WCEQJbSZ0zT/7ryYTb3OgtrhwIZXu4ah5RQ5/YQDQ7DpW7N7oNa】重置为【$2a$04$360poG67pqaEWbvXWhgOe.bdV5R30UW.e7/0p5OzAXh52IvllkkC2】', b'1', '', 'PUT', '/admin-api/system/user/update-password', '0:0:0:0:0:0:0:1', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36', NULL, '2025-04-14 22:02:26', NULL, '2025-04-14 22:02:26', b'0', 0); +COMMIT; + +-- ---------------------------- +-- Table structure for system_post +-- ---------------------------- +DROP TABLE IF EXISTS `system_post`; +CREATE TABLE `system_post` ( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '岗位ID', + `code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '岗位编码', + `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '岗位名称', + `sort` int NOT NULL COMMENT '显示顺序', + `status` tinyint NOT NULL COMMENT '状态(0正常 1停用)', + `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '备注', + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建者', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '更新者', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', + `tenant_id` bigint NOT NULL DEFAULT '0' COMMENT '租户编号', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='岗位信息表'; + +-- ---------------------------- +-- Records of system_post +-- ---------------------------- +BEGIN; +INSERT INTO `system_post` (`id`, `code`, `name`, `sort`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (1, 'ceo', '董事长', 1, 0, '', 'admin', '2021-01-06 17:03:48', '1', '2023-02-11 15:19:04', b'0', 0); +INSERT INTO `system_post` (`id`, `code`, `name`, `sort`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2, 'se', '项目经理', 2, 0, '', 'admin', '2021-01-05 17:03:48', '1', '2023-11-15 09:18:20', b'0', 0); +INSERT INTO `system_post` (`id`, `code`, `name`, `sort`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (4, 'user', '普通员工', 4, 0, '111', 'admin', '2021-01-05 17:03:48', '1', '2023-12-02 10:04:37', b'0', 0); +INSERT INTO `system_post` (`id`, `code`, `name`, `sort`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (5, 'HR', '人力资源', 5, 0, '', '1', '2024-03-24 20:45:40', '1', '2024-03-24 20:45:40', b'0', 0); +COMMIT; + +-- ---------------------------- +-- Table structure for system_role +-- ---------------------------- +DROP TABLE IF EXISTS `system_role`; +CREATE TABLE `system_role` ( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '角色ID', + `name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '角色名称', + `code` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '角色权限字符串', + `sort` int NOT NULL COMMENT '显示顺序', + `data_scope` tinyint NOT NULL DEFAULT '1' COMMENT '数据范围(1:全部数据权限 2:自定数据权限 3:本部门数据权限 4:本部门及以下数据权限)', + `data_scope_dept_ids` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '数据范围(指定部门数组)', + `status` tinyint NOT NULL COMMENT '角色状态(0正常 1停用)', + `type` tinyint NOT NULL COMMENT '角色类型', + `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '备注', + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建者', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '更新者', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', + `tenant_id` bigint NOT NULL DEFAULT '0' COMMENT '租户编号', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=154 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='角色信息表'; + +-- ---------------------------- +-- Records of system_role +-- ---------------------------- +BEGIN; +INSERT INTO `system_role` (`id`, `name`, `code`, `sort`, `data_scope`, `data_scope_dept_ids`, `status`, `type`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (1, '超级管理员', 'super_admin', 1, 1, '', 0, 1, '超级管理员', 'admin', '2021-01-05 17:03:48', '', '2022-02-22 05:08:21', b'0', 0); +INSERT INTO `system_role` (`id`, `name`, `code`, `sort`, `data_scope`, `data_scope_dept_ids`, `status`, `type`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (2, '普通角色', 'common', 2, 2, '', 0, 1, '普通角色', 'admin', '2021-01-05 17:03:48', '', '2022-02-22 05:08:20', b'0', 0); +INSERT INTO `system_role` (`id`, `name`, `code`, `sort`, `data_scope`, `data_scope_dept_ids`, `status`, `type`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (3, 'CRM 管理员', 'crm_admin', 2, 1, '', 0, 1, 'CRM 专属角色', '1', '2024-02-24 10:51:13', '1', '2024-02-24 02:51:32', b'0', 0); +INSERT INTO `system_role` (`id`, `name`, `code`, `sort`, `data_scope`, `data_scope_dept_ids`, `status`, `type`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (101, '测试账号', 'test', 0, 1, '[]', 0, 2, '', '', '2021-01-06 13:49:35', '1', '2024-08-11 10:41:10', b'0', 0); +INSERT INTO `system_role` (`id`, `name`, `code`, `sort`, `data_scope`, `data_scope_dept_ids`, `status`, `type`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (153, '某角色', 'tt', 4, 1, '', 0, 2, '', '1', '2024-08-17 14:09:35', '1', '2024-08-17 14:09:35', b'0', 0); +COMMIT; + +-- ---------------------------- +-- Table structure for system_role_menu +-- ---------------------------- +DROP TABLE IF EXISTS `system_role_menu`; +CREATE TABLE `system_role_menu` ( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '自增编号', + `role_id` bigint NOT NULL COMMENT '角色ID', + `menu_id` bigint NOT NULL COMMENT '菜单ID', + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建者', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '更新者', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=5793 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='角色和菜单关联表'; + +-- ---------------------------- +-- Records of system_role_menu +-- ---------------------------- +BEGIN; +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (434, 2, 1, '1', '2022-02-22 13:09:12', '1', '2022-02-22 13:09:12', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (454, 2, 1093, '1', '2022-02-22 13:09:12', '1', '2022-02-22 13:09:12', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (455, 2, 1094, '1', '2022-02-22 13:09:12', '1', '2022-02-22 13:09:12', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (460, 2, 1100, '1', '2022-02-22 13:09:12', '1', '2022-02-22 13:09:12', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (467, 2, 1107, '1', '2022-02-22 13:09:12', '1', '2022-02-22 13:09:12', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (476, 2, 1117, '1', '2022-02-22 13:09:12', '1', '2022-02-22 13:09:12', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (477, 2, 100, '1', '2022-02-22 13:09:12', '1', '2022-02-22 13:09:12', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (478, 2, 101, '1', '2022-02-22 13:09:12', '1', '2022-02-22 13:09:12', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (479, 2, 102, '1', '2022-02-22 13:09:12', '1', '2022-02-22 13:09:12', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (480, 2, 1126, '1', '2022-02-22 13:09:12', '1', '2022-02-22 13:09:12', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (481, 2, 103, '1', '2022-02-22 13:09:12', '1', '2022-02-22 13:09:12', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (483, 2, 104, '1', '2022-02-22 13:09:12', '1', '2022-02-22 13:09:12', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (485, 2, 105, '1', '2022-02-22 13:09:12', '1', '2022-02-22 13:09:12', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (488, 2, 107, '1', '2022-02-22 13:09:12', '1', '2022-02-22 13:09:12', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (490, 2, 108, '1', '2022-02-22 13:09:12', '1', '2022-02-22 13:09:12', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (492, 2, 109, '1', '2022-02-22 13:09:12', '1', '2022-02-22 13:09:12', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (498, 2, 1138, '1', '2022-02-22 13:09:12', '1', '2022-02-22 13:09:12', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (523, 2, 1224, '1', '2022-02-22 13:09:12', '1', '2022-02-22 13:09:12', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (524, 2, 1225, '1', '2022-02-22 13:09:12', '1', '2022-02-22 13:09:12', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (541, 2, 500, '1', '2022-02-22 13:09:12', '1', '2022-02-22 13:09:12', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (543, 2, 501, '1', '2022-02-22 13:09:12', '1', '2022-02-22 13:09:12', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (675, 2, 2, '1', '2022-02-22 13:16:57', '1', '2022-02-22 13:16:57', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (689, 2, 1077, '1', '2022-02-22 13:16:57', '1', '2022-02-22 13:16:57', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (690, 2, 1078, '1', '2022-02-22 13:16:57', '1', '2022-02-22 13:16:57', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (692, 2, 1083, '1', '2022-02-22 13:16:57', '1', '2022-02-22 13:16:57', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (693, 2, 1084, '1', '2022-02-22 13:16:57', '1', '2022-02-22 13:16:57', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (699, 2, 1090, '1', '2022-02-22 13:16:57', '1', '2022-02-22 13:16:57', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (703, 2, 106, '1', '2022-02-22 13:16:57', '1', '2022-02-22 13:16:57', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (704, 2, 110, '1', '2022-02-22 13:16:57', '1', '2022-02-22 13:16:57', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (705, 2, 111, '1', '2022-02-22 13:16:57', '1', '2022-02-22 13:16:57', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (706, 2, 112, '1', '2022-02-22 13:16:57', '1', '2022-02-22 13:16:57', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (707, 2, 113, '1', '2022-02-22 13:16:57', '1', '2022-02-22 13:16:57', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1604, 101, 1216, '1', '2022-03-19 21:45:52', '1', '2022-03-19 21:45:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1605, 101, 1217, '1', '2022-03-19 21:45:52', '1', '2022-03-19 21:45:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1606, 101, 1218, '1', '2022-03-19 21:45:52', '1', '2022-03-19 21:45:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1607, 101, 1219, '1', '2022-03-19 21:45:52', '1', '2022-03-19 21:45:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1608, 101, 1220, '1', '2022-03-19 21:45:52', '1', '2022-03-19 21:45:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1609, 101, 1221, '1', '2022-03-19 21:45:52', '1', '2022-03-19 21:45:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1610, 101, 5, '1', '2022-03-19 21:45:52', '1', '2022-03-19 21:45:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1611, 101, 1222, '1', '2022-03-19 21:45:52', '1', '2022-03-19 21:45:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1612, 101, 1118, '1', '2022-03-19 21:45:52', '1', '2022-03-19 21:45:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1613, 101, 1119, '1', '2022-03-19 21:45:52', '1', '2022-03-19 21:45:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1614, 101, 1120, '1', '2022-03-19 21:45:52', '1', '2022-03-19 21:45:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1615, 101, 1185, '1', '2022-03-19 21:45:52', '1', '2022-03-19 21:45:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1616, 101, 1186, '1', '2022-03-19 21:45:52', '1', '2022-03-19 21:45:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1617, 101, 1187, '1', '2022-03-19 21:45:52', '1', '2022-03-19 21:45:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1618, 101, 1188, '1', '2022-03-19 21:45:52', '1', '2022-03-19 21:45:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1619, 101, 1189, '1', '2022-03-19 21:45:52', '1', '2022-03-19 21:45:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1620, 101, 1190, '1', '2022-03-19 21:45:52', '1', '2022-03-19 21:45:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1621, 101, 1191, '1', '2022-03-19 21:45:52', '1', '2022-03-19 21:45:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1622, 101, 1192, '1', '2022-03-19 21:45:52', '1', '2022-03-19 21:45:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1623, 101, 1193, '1', '2022-03-19 21:45:52', '1', '2022-03-19 21:45:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1624, 101, 1194, '1', '2022-03-19 21:45:52', '1', '2022-03-19 21:45:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1625, 101, 1195, '1', '2022-03-19 21:45:52', '1', '2022-03-19 21:45:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1627, 101, 1197, '1', '2022-03-19 21:45:52', '1', '2022-03-19 21:45:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1628, 101, 1198, '1', '2022-03-19 21:45:52', '1', '2022-03-19 21:45:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1629, 101, 1199, '1', '2022-03-19 21:45:52', '1', '2022-03-19 21:45:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1630, 101, 1200, '1', '2022-03-19 21:45:52', '1', '2022-03-19 21:45:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1631, 101, 1201, '1', '2022-03-19 21:45:52', '1', '2022-03-19 21:45:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1632, 101, 1202, '1', '2022-03-19 21:45:52', '1', '2022-03-19 21:45:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1633, 101, 1207, '1', '2022-03-19 21:45:52', '1', '2022-03-19 21:45:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1634, 101, 1208, '1', '2022-03-19 21:45:52', '1', '2022-03-19 21:45:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1635, 101, 1209, '1', '2022-03-19 21:45:52', '1', '2022-03-19 21:45:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1636, 101, 1210, '1', '2022-03-19 21:45:52', '1', '2022-03-19 21:45:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1637, 101, 1211, '1', '2022-03-19 21:45:52', '1', '2022-03-19 21:45:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1638, 101, 1212, '1', '2022-03-19 21:45:52', '1', '2022-03-19 21:45:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1639, 101, 1213, '1', '2022-03-19 21:45:52', '1', '2022-03-19 21:45:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1640, 101, 1215, '1', '2022-03-19 21:45:52', '1', '2022-03-19 21:45:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1641, 101, 2, '1', '2022-04-01 22:21:24', '1', '2022-04-01 22:21:24', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1642, 101, 1031, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1643, 101, 1032, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1644, 101, 1033, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1645, 101, 1034, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1646, 101, 1035, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1647, 101, 1050, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1648, 101, 1051, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1649, 101, 1052, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1650, 101, 1053, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1651, 101, 1054, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1652, 101, 1056, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1653, 101, 1057, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1654, 101, 1058, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1655, 101, 1059, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1656, 101, 1060, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1657, 101, 1066, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1658, 101, 1067, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1659, 101, 1070, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1664, 101, 1075, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1666, 101, 1077, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1667, 101, 1078, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1668, 101, 1082, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1669, 101, 1083, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1670, 101, 1084, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1671, 101, 1085, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1672, 101, 1086, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1673, 101, 1087, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1674, 101, 1088, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1675, 101, 1089, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1679, 101, 1237, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1680, 101, 1238, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1681, 101, 1239, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1682, 101, 1240, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1683, 101, 1241, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1684, 101, 1242, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1685, 101, 1243, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1687, 101, 106, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1688, 101, 110, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1689, 101, 111, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1690, 101, 112, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1691, 101, 113, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1692, 101, 114, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1693, 101, 115, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1694, 101, 116, '1', '2022-04-01 22:21:37', '1', '2022-04-01 22:21:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1991, 2, 1024, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1992, 2, 1025, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1993, 2, 1026, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1994, 2, 1027, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1995, 2, 1028, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1996, 2, 1029, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1997, 2, 1030, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1998, 2, 1031, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1999, 2, 1032, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2000, 2, 1033, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2001, 2, 1034, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2002, 2, 1035, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2003, 2, 1036, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2004, 2, 1037, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2005, 2, 1038, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2006, 2, 1039, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2007, 2, 1040, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2008, 2, 1042, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2009, 2, 1043, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2010, 2, 1045, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2011, 2, 1046, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2012, 2, 1048, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2013, 2, 1050, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2014, 2, 1051, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2015, 2, 1052, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2016, 2, 1053, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2017, 2, 1054, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2018, 2, 1056, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2019, 2, 1057, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2020, 2, 1058, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2021, 2, 2083, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2022, 2, 1059, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2023, 2, 1060, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2024, 2, 1063, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2025, 2, 1064, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2026, 2, 1065, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2027, 2, 1066, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2028, 2, 1067, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2029, 2, 1070, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2034, 2, 1075, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2036, 2, 1082, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2037, 2, 1085, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2038, 2, 1086, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2039, 2, 1087, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2040, 2, 1088, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2041, 2, 1089, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2042, 2, 1091, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2043, 2, 1092, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2044, 2, 1095, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2045, 2, 1096, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2046, 2, 1097, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2047, 2, 1098, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2048, 2, 1101, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2049, 2, 1102, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2050, 2, 1103, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2051, 2, 1104, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2052, 2, 1105, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2053, 2, 1106, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2054, 2, 1108, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2055, 2, 1109, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2061, 2, 1127, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2062, 2, 1128, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2063, 2, 1129, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2064, 2, 1130, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2066, 2, 1132, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2067, 2, 1133, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2068, 2, 1134, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2069, 2, 1135, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2070, 2, 1136, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2071, 2, 1137, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2072, 2, 114, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2073, 2, 1139, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2074, 2, 115, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2075, 2, 1140, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2076, 2, 116, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2077, 2, 1141, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2078, 2, 1142, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2079, 2, 1143, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2080, 2, 1150, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2081, 2, 1161, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2082, 2, 1162, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2083, 2, 1163, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2084, 2, 1164, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2085, 2, 1165, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2086, 2, 1166, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2087, 2, 1173, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2088, 2, 1174, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2089, 2, 1175, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2090, 2, 1176, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2091, 2, 1177, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2092, 2, 1178, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2099, 2, 1226, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2100, 2, 1227, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2101, 2, 1228, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2102, 2, 1229, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2103, 2, 1237, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2104, 2, 1238, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2105, 2, 1239, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2106, 2, 1240, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2107, 2, 1241, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2108, 2, 1242, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2109, 2, 1243, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2116, 2, 1254, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2117, 2, 1255, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2118, 2, 1256, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2119, 2, 1257, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2120, 2, 1258, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2121, 2, 1259, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2122, 2, 1260, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2123, 2, 1261, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2124, 2, 1263, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2125, 2, 1264, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2126, 2, 1265, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2127, 2, 1266, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2128, 2, 1267, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2129, 2, 1001, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2130, 2, 1002, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2131, 2, 1003, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2132, 2, 1004, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2133, 2, 1005, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2134, 2, 1006, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2135, 2, 1007, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2136, 2, 1008, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2137, 2, 1009, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2138, 2, 1010, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2139, 2, 1011, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2140, 2, 1012, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2141, 2, 1013, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2143, 2, 1015, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2145, 2, 1017, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2146, 2, 1018, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2147, 2, 1019, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2148, 2, 1020, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2149, 2, 1021, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2150, 2, 1022, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2151, 2, 1023, '1', '2023-01-25 08:42:52', '1', '2023-01-25 08:42:52', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2152, 2, 1281, '1', '2023-01-25 08:42:58', '1', '2023-01-25 08:42:58', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2153, 2, 1282, '1', '2023-01-25 08:42:58', '1', '2023-01-25 08:42:58', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2154, 2, 2000, '1', '2023-01-25 08:42:58', '1', '2023-01-25 08:42:58', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2155, 2, 2002, '1', '2023-01-25 08:42:58', '1', '2023-01-25 08:42:58', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2156, 2, 2003, '1', '2023-01-25 08:42:58', '1', '2023-01-25 08:42:58', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2157, 2, 2004, '1', '2023-01-25 08:42:58', '1', '2023-01-25 08:42:58', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2158, 2, 2005, '1', '2023-01-25 08:42:58', '1', '2023-01-25 08:42:58', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2159, 2, 2006, '1', '2023-01-25 08:42:58', '1', '2023-01-25 08:42:58', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2160, 2, 2008, '1', '2023-01-25 08:42:58', '1', '2023-01-25 08:42:58', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2161, 2, 2009, '1', '2023-01-25 08:42:58', '1', '2023-01-25 08:42:58', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2162, 2, 2010, '1', '2023-01-25 08:42:58', '1', '2023-01-25 08:42:58', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2163, 2, 2011, '1', '2023-01-25 08:42:58', '1', '2023-01-25 08:42:58', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2164, 2, 2012, '1', '2023-01-25 08:42:58', '1', '2023-01-25 08:42:58', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2170, 2, 2019, '1', '2023-01-25 08:42:58', '1', '2023-01-25 08:42:58', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2171, 2, 2020, '1', '2023-01-25 08:42:58', '1', '2023-01-25 08:42:58', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2172, 2, 2021, '1', '2023-01-25 08:42:58', '1', '2023-01-25 08:42:58', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2173, 2, 2022, '1', '2023-01-25 08:42:58', '1', '2023-01-25 08:42:58', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2174, 2, 2023, '1', '2023-01-25 08:42:58', '1', '2023-01-25 08:42:58', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2175, 2, 2025, '1', '2023-01-25 08:42:58', '1', '2023-01-25 08:42:58', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2177, 2, 2027, '1', '2023-01-25 08:42:58', '1', '2023-01-25 08:42:58', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2178, 2, 2028, '1', '2023-01-25 08:42:58', '1', '2023-01-25 08:42:58', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2179, 2, 2029, '1', '2023-01-25 08:42:58', '1', '2023-01-25 08:42:58', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2180, 2, 2014, '1', '2023-01-25 08:43:12', '1', '2023-01-25 08:43:12', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2181, 2, 2015, '1', '2023-01-25 08:43:12', '1', '2023-01-25 08:43:12', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2182, 2, 2016, '1', '2023-01-25 08:43:12', '1', '2023-01-25 08:43:12', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2183, 2, 2017, '1', '2023-01-25 08:43:12', '1', '2023-01-25 08:43:12', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2184, 2, 2018, '1', '2023-01-25 08:43:12', '1', '2023-01-25 08:43:12', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2188, 101, 1024, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2189, 101, 1, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2190, 101, 1025, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2191, 101, 1026, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2192, 101, 1027, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2193, 101, 1028, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2194, 101, 1029, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2195, 101, 1030, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2196, 101, 1036, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2197, 101, 1037, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2198, 101, 1038, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2199, 101, 1039, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2200, 101, 1040, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2201, 101, 1042, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2202, 101, 1043, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2203, 101, 1045, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2204, 101, 1046, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2205, 101, 1048, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2206, 101, 2083, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2207, 101, 1063, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2208, 101, 1064, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2209, 101, 1065, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2210, 101, 1093, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2211, 101, 1094, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2212, 101, 1095, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2213, 101, 1096, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2214, 101, 1097, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2215, 101, 1098, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2216, 101, 1100, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2217, 101, 1101, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2218, 101, 1102, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2219, 101, 1103, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2220, 101, 1104, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2221, 101, 1105, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2222, 101, 1106, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2223, 101, 2130, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2224, 101, 1107, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2225, 101, 2131, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2226, 101, 1108, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2227, 101, 2132, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2228, 101, 1109, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2229, 101, 2133, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2230, 101, 2134, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2232, 101, 2135, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2234, 101, 2136, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2236, 101, 2137, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2238, 101, 2138, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2240, 101, 2139, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2242, 101, 2140, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2243, 101, 2141, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2244, 101, 2142, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2245, 101, 2143, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2246, 101, 2144, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2247, 101, 2145, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2248, 101, 2146, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2249, 101, 2147, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2250, 101, 100, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2251, 101, 2148, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2252, 101, 101, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2253, 101, 2149, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2254, 101, 102, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2255, 101, 2150, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2256, 101, 103, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2257, 101, 2151, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2258, 101, 104, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2259, 101, 2152, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2260, 101, 105, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2261, 101, 107, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2262, 101, 108, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2263, 101, 109, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2264, 101, 1138, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2265, 101, 1139, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2266, 101, 1140, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2267, 101, 1141, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2268, 101, 1142, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2269, 101, 1143, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2270, 101, 1224, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2271, 101, 1225, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2272, 101, 1226, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2273, 101, 1227, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2274, 101, 1228, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2275, 101, 1229, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2282, 101, 1261, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2283, 101, 1263, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2284, 101, 1264, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2285, 101, 1265, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2286, 101, 1266, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2287, 101, 1267, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2288, 101, 1001, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2289, 101, 1002, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2290, 101, 1003, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2291, 101, 1004, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2292, 101, 1005, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2293, 101, 1006, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2294, 101, 1007, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2295, 101, 1008, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2296, 101, 1009, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2297, 101, 1010, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2298, 101, 1011, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2299, 101, 1012, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2300, 101, 500, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2301, 101, 1013, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2302, 101, 501, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2303, 101, 1014, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2304, 101, 1015, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2305, 101, 1016, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2306, 101, 1017, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2307, 101, 1018, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2308, 101, 1019, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2309, 101, 1020, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2310, 101, 1021, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2311, 101, 1022, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2312, 101, 1023, '1', '2023-02-09 23:49:46', '1', '2023-02-09 23:49:46', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (5777, 101, 2739, '1', '2024-04-30 09:38:37', '1', '2024-04-30 09:38:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (5778, 101, 2740, '1', '2024-04-30 09:38:37', '1', '2024-04-30 09:38:37', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (5779, 2, 2739, '1', '2024-07-07 20:39:38', '1', '2024-07-07 20:39:38', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (5780, 2, 2740, '1', '2024-07-07 20:39:38', '1', '2024-07-07 20:39:38', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (5781, 2, 2758, '1', '2024-07-07 20:39:38', '1', '2024-07-07 20:39:38', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (5782, 2, 2759, '1', '2024-07-07 20:39:38', '1', '2024-07-07 20:39:38', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (5783, 2, 2362, '1', '2024-07-07 20:39:38', '1', '2024-07-07 20:39:38', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (5784, 2, 2387, '1', '2024-07-07 20:39:38', '1', '2024-07-07 20:39:38', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (5785, 2, 2030, '1', '2024-07-07 20:39:38', '1', '2024-07-07 20:39:38', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (5786, 101, 2758, '1', '2024-07-07 20:39:55', '1', '2024-07-07 20:39:55', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (5787, 101, 2759, '1', '2024-07-07 20:39:55', '1', '2024-07-07 20:39:55', b'0'); +INSERT INTO `system_role_menu` (`id`, `role_id`, `menu_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (5788, 101, 2783, '1', '2024-07-07 20:39:55', '1', '2024-07-07 20:39:55', b'0'); +COMMIT; + +-- ---------------------------- +-- Table structure for system_user_post +-- ---------------------------- +DROP TABLE IF EXISTS `system_user_post`; +CREATE TABLE `system_user_post` ( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id', + `user_id` bigint NOT NULL DEFAULT '0' COMMENT '用户ID', + `post_id` bigint NOT NULL DEFAULT '0' COMMENT '岗位ID', + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建者', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '更新者', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=126 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='用户岗位表'; + +-- ---------------------------- +-- Records of system_user_post +-- ---------------------------- +BEGIN; +INSERT INTO `system_user_post` (`id`, `user_id`, `post_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (112, 1, 1, 'admin', '2022-05-02 07:25:24', 'admin', '2022-05-02 07:25:24', b'0'); +COMMIT; + +-- ---------------------------- +-- Table structure for system_user_role +-- ---------------------------- +DROP TABLE IF EXISTS `system_user_role`; +CREATE TABLE `system_user_role` ( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '自增编号', + `user_id` bigint NOT NULL COMMENT '用户ID', + `role_id` bigint NOT NULL COMMENT '角色ID', + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建者', + `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '更新者', + `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `deleted` bit(1) DEFAULT b'0' COMMENT '是否删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=48 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='用户和角色关联表'; + +-- ---------------------------- +-- Records of system_user_role +-- ---------------------------- +BEGIN; +INSERT INTO `system_user_role` (`id`, `user_id`, `role_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1, 1, 1, '', '2022-01-11 13:19:45', '', '2022-05-12 12:35:17', b'0'); +COMMIT; + +-- ---------------------------- +-- Table structure for system_users +-- ---------------------------- +DROP TABLE IF EXISTS `system_users`; +CREATE TABLE `system_users` ( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '用户ID', + `username` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '用户账号', + `password` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '密码', + `nickname` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '用户昵称', + `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '备注', + `dept_id` bigint DEFAULT NULL COMMENT '部门ID', + `post_ids` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '岗位编号数组', + `email` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '用户邮箱', + `mobile` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '手机号码', + `sex` tinyint DEFAULT '0' COMMENT '用户性别', + `avatar` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '头像地址', + `status` tinyint NOT NULL DEFAULT '0' COMMENT '帐号状态(0正常 1停用)', + `login_ip` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '最后登录IP', + `login_date` datetime DEFAULT NULL COMMENT '最后登录时间', + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建者', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '更新者', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=140 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='用户信息表'; + +-- ---------------------------- +-- Records of system_users +-- ---------------------------- +BEGIN; +INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1, 'admin', '$2a$04$360poG67pqaEWbvXWhgOe.bdV5R30UW.e7/0p5OzAXh52IvllkkC2', '勇哥Java实战', '管理员', 103, '[1,2]', 'zhangyong7120180@163.com', '15011319235', 2, 'https://javayong.cn/logo.png', 0, '0:0:0:0:0:0:0:1', '2026-06-02 10:37:38', 'admin', '2021-01-05 17:03:47', NULL, '2026-06-02 10:37:38', b'0'); +COMMIT; + +SET FOREIGN_KEY_CHECKS = 1; diff --git a/lombok.config b/lombok.config new file mode 100644 index 0000000..a8e8ce6 --- /dev/null +++ b/lombok.config @@ -0,0 +1,4 @@ +config.stopBubbling = true +lombok.tostring.callsuper=CALL +lombok.equalsandhashcode.callsuper=CALL +lombok.accessors.chain=true diff --git a/marketing-admin-server/.flattened-pom.xml b/marketing-admin-server/.flattened-pom.xml new file mode 100644 index 0000000..7f25f55 --- /dev/null +++ b/marketing-admin-server/.flattened-pom.xml @@ -0,0 +1,98 @@ + + + 4.0.0 + com.platform + marketing-admin-server + 0.0.1-jdk8-SNAPSHOT + marketing-admin-server + 后端 Server 的主项目,通过引入需要 marketing-module-xxx 的依赖, + 从而实现提供 RESTful API 给 marketing-ui-admin、marketing-ui-user 等前端项目。 + 本质上来说,它就是个空壳(容器)! + https://github.com/makemyownlife/marketing-admin + + + com.platform + marketing-module-system + 0.0.1-jdk8-SNAPSHOT + compile + + + com.platform + marketing-module-infra + 0.0.1-jdk8-SNAPSHOT + compile + + + org.springframework.boot + spring-boot-configuration-processor + 2.7.18 + compile + true + + + com.platform + marketing-spring-boot-starter-protection + 0.0.1-jdk8-SNAPSHOT + compile + + + com.platform + marketing-module-channel + 0.0.1-jdk8-SNAPSHOT + compile + + + com.platform + marketing-module-tenant + 0.0.1-jdk8-SNAPSHOT + compile + + + com.platform + marketing-module-record + 0.0.1-jdk8-SNAPSHOT + compile + + + com.platform + marketing-module-gateway + 0.0.1-jdk8-SNAPSHOT + compile + + + com.platform + marketing-module-worker + 0.0.1-jdk8-SNAPSHOT + compile + + + + + huaweicloud + huawei + https://mirrors.huaweicloud.com/repository/maven/ + + + aliyunmaven + aliyun + https://maven.aliyun.com/repository/public + + + + false + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + + + false + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + + diff --git a/marketing-admin-server/pom.xml b/marketing-admin-server/pom.xml new file mode 100644 index 0000000..7288edf --- /dev/null +++ b/marketing-admin-server/pom.xml @@ -0,0 +1,142 @@ + + + + + com.platform + marketing-admin-all + ${revision} + + + 4.0.0 + + marketing-admin-server + jar + + ${project.artifactId} + + + 后端 Server 的主项目,通过引入需要 marketing-module-xxx 的依赖, + 从而实现提供 RESTful API 给 marketing-ui-admin、marketing-ui-user 等前端项目。 + 本质上来说,它就是个空壳(容器)! + + + https://github.com/makemyownlife/marketing-admin + + + + + com.platform + marketing-module-system + ${revision} + + + + com.platform + marketing-module-infra + ${revision} + + + + + org.springframework.boot + spring-boot-configuration-processor + true + + + + + com.platform + marketing-spring-boot-starter-protection + + + + + + com.platform + marketing-module-channel + ${revision} + + + + com.platform + marketing-module-tenant + ${revision} + + + + com.platform + marketing-module-record + ${revision} + + + + com.platform + marketing-module-gateway + ${revision} + + + + com.platform + marketing-module-worker + ${revision} + + + + + + + + + docker + + + + true + src/main/resources + + application-** + + + + + + org.apache.maven.plugins + maven-resources-plugin + + + ttf + png + jpg + jpeg + ico + + + + + + + + + + + marketing-admin-server + + + + org.springframework.boot + spring-boot-maven-plugin + ${spring.boot.version} + + + + repackage + + + + + + + + diff --git a/marketing-admin-server/src/main/java/com/platform/marketing/server/ChuanglanInterMessageDemo.java b/marketing-admin-server/src/main/java/com/platform/marketing/server/ChuanglanInterMessageDemo.java new file mode 100644 index 0000000..ce4fd12 --- /dev/null +++ b/marketing-admin-server/src/main/java/com/platform/marketing/server/ChuanglanInterMessageDemo.java @@ -0,0 +1,127 @@ +package com.platform.marketing.server; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson.TypeReference; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.apache.http.HttpEntity; +import org.apache.http.HttpHost; +import org.apache.http.client.config.RequestConfig; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.entity.ContentType; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.util.EntityUtils; +import org.springframework.util.DigestUtils; + +import java.io.IOException; +import java.util.Map; +import java.util.TreeMap; + +/** + * ChuanglanInterMessageDemo + * + * @author EDY + * @createdAt 2023/11/6 14:54 + * @description + */ +@Slf4j +public class ChuanglanInterMessageDemo { + private RequestConfig requestConfig = RequestConfig.custom() + .setConnectTimeout(10000) + .setSocketTimeout(10000).build(); + private CloseableHttpClient httpClient = HttpClients.custom() + .setDefaultRequestConfig(requestConfig) + .setProxy(new HttpHost("127.0.0.1", 1087)) //代理到白名单IP上 + .build(); + + public static void main(String[] args) { + new ChuanglanInterMessageDemo().sendSms(); + } + + public void sendSms() { + String password = "1Y2T8c5gWge34f"; + SmsSendRequest smsRequest = new SmsSendRequest(); + smsRequest.setAccount("IM9341742"); + smsRequest.setMobile("006285167000597"); + smsRequest.setMsg("sms demo test "); + smsRequest.setUid("112233445566778899"); + + String nonce = String.valueOf(System.currentTimeMillis()); + TreeMap paramMap = JSON.parseObject(JSON.toJSONString(smsRequest), new TypeReference>() { + }); + paramMap.put("nonce", nonce); + String sign = generateSign(password, paramMap); + + HttpEntity httpEntity = null; + CloseableHttpResponse httpResponse = null; + try { + StringEntity stringEntity = new StringEntity(JSON.toJSONString(smsRequest), ContentType.APPLICATION_JSON); + HttpPost httpPost = new HttpPost("https://intapi.tig253.com/send/sms"); + httpPost.addHeader("Content-Type", "application/json"); + httpPost.addHeader("nonce", nonce); + httpPost.addHeader("sign", sign); + httpPost.setEntity(stringEntity); + httpResponse = httpClient.execute(httpPost); + httpEntity = httpResponse.getEntity(); + String result = EntityUtils.toString(httpEntity); + System.out.println(result); + JSONObject rtn = JSON.parseObject(result); + String code = rtn.getString("code"); + if("0".equals(code)) { + System.out.println("提交成功"); + String messageId = rtn.getJSONObject("data").getString("messageId"); + System.out.println("messageId=" + messageId); + } else { + System.out.println(String.format("提交失败:code=%s, message=%s", code, rtn.getString("message"))); + } + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + EntityUtils.consume(httpEntity); + } catch (IOException e) { + e.printStackTrace(); + } + if(httpResponse != null) { + try { + httpResponse.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + } + + + private String generateSign(String password, TreeMap paramMap) { + StringBuilder sb = new StringBuilder(); + for (Map.Entry entry : paramMap.entrySet()) { + if (StringUtils.isNotBlank(entry.getValue())) { + sb.append(entry.getKey()); + sb.append(entry.getValue()); + } + } + return DigestUtils.md5DigestAsHex((sb.toString() + password).getBytes()).toLowerCase(); + } + + + static class SmsSendRequest { + private String account; + private String mobile; + private String msg; + private String uid; + + public String getAccount() { return account; } + public void setAccount(String account) { this.account = account; } + public String getMobile() { return mobile; } + public void setMobile(String mobile) { this.mobile = mobile; } + public String getMsg() { return msg; } + public void setMsg(String msg) { this.msg = msg; } + public String getUid() { return uid; } + public void setUid(String uid) { this.uid = uid; } + } +} diff --git a/marketing-admin-server/src/main/java/com/platform/marketing/server/MarketingAdminApplication.java b/marketing-admin-server/src/main/java/com/platform/marketing/server/MarketingAdminApplication.java new file mode 100644 index 0000000..da07f6f --- /dev/null +++ b/marketing-admin-server/src/main/java/com/platform/marketing/server/MarketingAdminApplication.java @@ -0,0 +1,19 @@ +package com.platform.marketing.server; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.scheduling.annotation.EnableScheduling; + +/** + * 项目的启动类 + */ +@SuppressWarnings("SpringComponentScan") // 忽略 IDEA 无法识别 ${marketing.info.base-package} +@EnableScheduling +@SpringBootApplication(scanBasePackages = {"${marketing.info.base-package}.server", "${marketing.info.base-package}.module"}) +public class MarketingAdminApplication { + + public static void main(String[] args) { + SpringApplication.run(MarketingAdminApplication.class, args); + } + +} diff --git a/marketing-admin-server/src/main/java/com/platform/marketing/server/controller/DefaultController.java b/marketing-admin-server/src/main/java/com/platform/marketing/server/controller/DefaultController.java new file mode 100644 index 0000000..034b8b3 --- /dev/null +++ b/marketing-admin-server/src/main/java/com/platform/marketing/server/controller/DefaultController.java @@ -0,0 +1,44 @@ +package com.platform.marketing.server.controller; + +import com.platform.marketing.framework.common.pojo.CommonResult; +import com.platform.marketing.framework.common.util.servlet.ServletUtils; +import com.platform.marketing.framework.idgenerator.core.service.IdGeneratorService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.security.PermitAll; +import javax.servlet.http.HttpServletRequest; + +/** + * 默认 Controller JUST FOR TEST + * + * @author zhangyong + */ +@RestController +@Slf4j +public class DefaultController { + + @Autowired + private IdGeneratorService idGeneratorService; + + /** + * 测试接口:打印 query、header、body + */ + @RequestMapping(value = {"/test"}) + @PermitAll + public CommonResult test(HttpServletRequest request) { + // 打印查询参数 + log.info("Query: {}", ServletUtils.getParamMap(request)); + // 打印请求头 + log.info("Header: {}", ServletUtils.getHeaderMap(request)); + // 打印请求体 + log.info("Body: {}", ServletUtils.getBody(request)); + // 生成 id + Long id = idGeneratorService.createUniqueId("mytable"); + log.info("ID 生成器创建新序号: {}", id); + return CommonResult.success(true); + } + +} diff --git a/marketing-admin-server/src/main/resources/application-docker.yaml b/marketing-admin-server/src/main/resources/application-docker.yaml new file mode 100644 index 0000000..7c0a84f --- /dev/null +++ b/marketing-admin-server/src/main/resources/application-docker.yaml @@ -0,0 +1,26 @@ +spring: + datasource: + dynamic: + primary: master + datasource: + master: + url: jdbc:mysql://${SPRING_DATABASE_HOST:localhost}:${SPRING_DATABASE_PORT:3306}/${SPRING_DATABASE_NAME:biz_data_marketing}?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true&rewriteBatchedStatements=true + username: ${SPRING_DATABASE_USERNAME:root} + password: ${SPRING_DATABASE_PASSWORD:root} + slave: + lazy: true + url: jdbc:mysql://${SPRING_DATABASE_HOST:localhost}:${SPRING_DATABASE_PORT:3306}/${SPRING_DATABASE_NAME:biz_data_marketing}?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true&rewriteBatchedStatements=true + username: ${SPRING_DATABASE_USERNAME:root} + password: ${SPRING_DATABASE_PASSWORD:root} + redis: + host: ${SPRING_REDIS_HOST:localhost} + port: ${SPRING_REDIS_PORT:6379} + database: ${SPRING_REDIS_DATABASE:0} + +logging: + file: + name: ${user.home}/logs/${spring.application.name}.log + level: + com.platform.marketing.module.infra.mapper: INFO + com.platform.marketing.module.smschannel.mapper: INFO + diff --git a/marketing-admin-server/src/main/resources/application-local.yaml b/marketing-admin-server/src/main/resources/application-local.yaml new file mode 100644 index 0000000..37b9034 --- /dev/null +++ b/marketing-admin-server/src/main/resources/application-local.yaml @@ -0,0 +1,25 @@ +spring: + datasource: + dynamic: + primary: master + datasource: + master: + url: jdbc:mysql://127.0.0.1:3306/biz_data_marketing?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true&rewriteBatchedStatements=true + username: root + password: root + slave: + lazy: true + url: jdbc:mysql://127.0.0.1:3306/biz_data_marketing?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&rewriteBatchedStatements=true&nullCatalogMeansCurrent=true + username: root + password: root + redis: + host: 127.0.0.1 + port: 6379 + database: 0 + +logging: + file: + name: ${user.home}/logs/${spring.application.name}.log + level: + com.platform.marketing.module.infra.mapper: DEBUG + com.platform.marketing.module.smschannel.mapper: DEBUG diff --git a/marketing-admin-server/src/main/resources/application-prod.yaml b/marketing-admin-server/src/main/resources/application-prod.yaml new file mode 100644 index 0000000..b0b756a --- /dev/null +++ b/marketing-admin-server/src/main/resources/application-prod.yaml @@ -0,0 +1,26 @@ +spring: + datasource: + dynamic: + primary: master + datasource: + master: + url: jdbc:mysql://127.0.0.1:3306/biz_data_marketing?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true&rewriteBatchedStatements=true + username: root + password: root + slave: + lazy: true + url: jdbc:mysql://127.0.0.1:3306/biz_data_marketing?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&rewriteBatchedStatements=true&nullCatalogMeansCurrent=true + username: root + password: root + redis: + host: 127.0.0.1 + port: 6379 + database: 0 + +logging: + file: + name: ${user.home}/logs/${spring.application.name}.log + level: + com.platform.marketing.module.infra.mapper: INFO + com.platform.marketing.module.smschannel.mapper: INFO + diff --git a/marketing-admin-server/src/main/resources/application.yaml b/marketing-admin-server/src/main/resources/application.yaml new file mode 100644 index 0000000..f1b4d2d --- /dev/null +++ b/marketing-admin-server/src/main/resources/application.yaml @@ -0,0 +1,154 @@ +server: + port: 8089 + servlet: + encoding: + enabled: true + charset: UTF-8 + force: true + +spring: + application: + name: platform-sms-pro + profiles: + active: local + main: + allow-circular-references: true + servlet: + multipart: + max-file-size: 16MB + max-request-size: 32MB + jackson: + serialization: + write-dates-as-timestamps: true + write-date-timestamps-as-nanoseconds: false + write-durations-as-timestamps: true + fail-on-empty-beans: false + cache: + type: REDIS + redis: + time-to-live: 1h + autoconfigure: + exclude: + - com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure + data: + redis: + repositories: + enabled: false + datasource: + druid: + web-stat-filter: + enabled: true + stat-view-servlet: + enabled: true + allow: + url-pattern: /druid/* + login-username: + login-password: + filter: + stat: + enabled: true + log-slow-sql: true + slow-sql-millis: 100 + merge-sql: true + wall: + config: + multi-statement-allow: true + dynamic: + druid: + initial-size: 1 + min-idle: 1 + max-active: 20 + max-wait: 600000 + time-between-eviction-runs-millis: 60000 + min-evictable-idle-time-millis: 300000 + max-evictable-idle-time-millis: 900000 + validation-query: SELECT 1 FROM DUAL + test-while-idle: true + test-on-borrow: false + test-on-return: false + quartz: + auto-startup: true + scheduler-name: schedulerName + job-store-type: jdbc + wait-for-jobs-to-complete-on-shutdown: true + properties: + org: + quartz: + scheduler: + instanceName: schedulerName + instanceId: AUTO + jobStore: + class: org.springframework.scheduling.quartz.LocalDataSourceJobStore + isClustered: true + clusterCheckinInterval: 15000 + misfireThreshold: 60000 + threadPool: + threadCount: 25 + threadPriority: 5 + class: org.quartz.simpl.SimpleThreadPool + jdbc: + initialize-schema: NEVER + +springdoc: + api-docs: + enabled: true + path: /v3/api-docs + swagger-ui: + enabled: true + path: /swagger-ui + default-flat-param-object: true +knife4j: + enable: false + setting: + language: zh_cn + +mybatis-plus: + configuration: + map-underscore-to-camel-case: true + global-config: + db-config: + id-type: NONE + logic-delete-value: 1 + logic-not-delete-value: 0 + banner: false + type-aliases-package: ${marketing.info.base-package}.module.*.mapper.dataobject +mybatis-plus-join: + banner: false + sub-table-logic: true + ms-cache: true + table-alias: t + logic-del-type: on + +marketing: + demo: false + captcha: + enable: false + access-log: + enable: false + info: + version: 1.0.0 + base-package: com.platform.marketing + xss: + enable: false + exclude-urls: + - ${spring.boot.admin.context-path}/** + - ${management.endpoints.web.base-path}/** + security: + mock-enable: true + permit-all_urls: + - /api/mp/open/** + - /gateway/** + swagger: + title: 开发平台 + description: 开发平台 + version: ${marketing.info.version} + url: ${marketing.web.admin-ui.url} + email: keep@163.com + license: MIT + codegen: + base-package: ${marketing.info.base-package} + db-schemas: ${spring.datasource.dynamic.datasource.master.name} + front-type: 20 + vo-type: 10 + delete-batch-enable: true + unit-test-enable: false diff --git a/marketing-admin-server/src/main/resources/demo/示例.xlsx b/marketing-admin-server/src/main/resources/demo/示例.xlsx new file mode 100644 index 0000000..52ffeea Binary files /dev/null and b/marketing-admin-server/src/main/resources/demo/示例.xlsx differ diff --git a/marketing-admin-server/src/main/resources/logback-spring.xml b/marketing-admin-server/src/main/resources/logback-spring.xml new file mode 100644 index 0000000..43ccfec --- /dev/null +++ b/marketing-admin-server/src/main/resources/logback-spring.xml @@ -0,0 +1,42 @@ + + + + + + %d{yyyy-MM-dd HH:mm:ss.SSS} %p %t %logger{36}:%L - %msg%n + + + + + + admin + admin + + + + ../logs/admin.log + + + ../logs/admin/%d{yyyy-MM-dd}/admin-%d{yyyy-MM-dd}-%i.log.gz + + + 512MB + + 60 + + + %d{yyyy-MM-dd HH:mm:ss.SSS} %p %t %logger{36}:%L - %msg%n + + + + + + + + + + + + + diff --git a/marketing-client-sdk/.flattened-pom.xml b/marketing-client-sdk/.flattened-pom.xml new file mode 100644 index 0000000..9f68420 --- /dev/null +++ b/marketing-client-sdk/.flattened-pom.xml @@ -0,0 +1,70 @@ + + + 4.0.0 + com.platform + marketing-client-sdk + 0.0.1-jdk8-SNAPSHOT + marketing-admin基础脚手架 + https://github.com/makemyownlife/marketing-admin/marketing-client-sdk + + + com.alibaba + fastjson + 1.2.83 + compile + + + commons-codec + commons-codec + 1.10 + compile + + + org.slf4j + slf4j-api + 1.7.25 + compile + + + org.apache.commons + commons-lang3 + 3.4 + compile + + + commons-collections + commons-collections + 3.2.2 + compile + + + + + huaweicloud + huawei + https://mirrors.huaweicloud.com/repository/maven/ + + + aliyunmaven + aliyun + https://maven.aliyun.com/repository/public + + + + false + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + + + false + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + + diff --git a/marketing-client-sdk/pom.xml b/marketing-client-sdk/pom.xml new file mode 100644 index 0000000..474f739 --- /dev/null +++ b/marketing-client-sdk/pom.xml @@ -0,0 +1,72 @@ + + + 4.0.0 + + + com.platform + marketing-admin-all + ${revision} + + + marketing-client-sdk + + + 1.8 + 1.8 + UTF-8 + + + + + + + com.alibaba + fastjson + 1.2.83 + + + + + commons-codec + commons-codec + 1.10 + + + + org.slf4j + slf4j-api + 1.7.25 + + + + org.apache.commons + commons-lang3 + 3.4 + + + + commons-collections + commons-collections + 3.2.2 + + + + + ch.qos.logback + logback-classic + 1.2.11 + test + + + + ch.qos.logback + logback-core + 1.2.11 + test + + + + + \ No newline at end of file diff --git a/marketing-client-sdk/src/main/java/com/platform/marketing/client/sdk/SmsConfig.java b/marketing-client-sdk/src/main/java/com/platform/marketing/client/sdk/SmsConfig.java new file mode 100644 index 0000000..00f5b67 --- /dev/null +++ b/marketing-client-sdk/src/main/java/com/platform/marketing/client/sdk/SmsConfig.java @@ -0,0 +1,38 @@ +package com.platform.marketing.client.sdk; + +/** + * 短信平台 sdk 配置 + */ +public class SmsConfig { + + private String smsServerUrl; + + private String appKey; + + private String appSecret; + + public String getAppKey() { + return appKey; + } + + public void setAppKey(String appKey) { + this.appKey = appKey; + } + + public String getAppSecret() { + return appSecret; + } + + public void setAppSecret(String appSecret) { + this.appSecret = appSecret; + } + + public String getSmsServerUrl() { + return smsServerUrl; + } + + public void setSmsServerUrl(String smsServerUrl) { + this.smsServerUrl = smsServerUrl; + } + +} diff --git a/marketing-client-sdk/src/main/java/com/platform/marketing/client/sdk/SmsSenderClient.java b/marketing-client-sdk/src/main/java/com/platform/marketing/client/sdk/SmsSenderClient.java new file mode 100644 index 0000000..acec3e5 --- /dev/null +++ b/marketing-client-sdk/src/main/java/com/platform/marketing/client/sdk/SmsSenderClient.java @@ -0,0 +1,160 @@ +package com.platform.marketing.client.sdk; + +import com.platform.marketing.client.sdk.util.*; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import org.apache.commons.lang3.tuple.Pair; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.HashMap; +import java.util.Map; + +/** + * 短信发送客户端 + * Created by diven on 2020/1/5. + */ +public class SmsSenderClient { + private final static Logger logger = LoggerFactory.getLogger(SmsSenderClient.class); + + private final static String SINGLE_SEND_REQUEST_URL = "/gateway/client/sendByTemplateId"; + + private final static String BTACH_SEND_REQUEST_URL = "/gateway/client/batchSendByTemplateId"; + + private SmsConfig smsConfig; + + private LoadBalancer loadBalancer; + + public SmsSenderClient(SmsConfig smsConfig) { + this.smsConfig = smsConfig; + this.loadBalancer = new LoadBalancer(smsConfig.getSmsServerUrl()); + } + + public SmsSenderResult sendSmsByTemplateId(String mobile, + String templateId, + Map templateParam) { + SmsSenderResult smsSenderResult = sendSmsByTemplateId(mobile, templateId, null, templateParam); + return smsSenderResult; + } + + + /** + * 根据模版单发短信 境内手机号或全为境外手机号 + * + * @param mobile 接收短信的手机号码。手机号码格式: + *

+ * 国内短信:无任何前缀的手机号码,例如 1590000**** 或者 E.164 标准 +8615011319235。 + * 国际/港澳台消息:+ 国际区号+ 号码,例如 +852000012****。 + * @param templateId + * @param attime + * @param templateParam + * @return + */ + public SmsSenderResult sendSmsByTemplateId(String mobile, + String templateId, + String attime, + Map templateParam) { + + /** + * E.164 是国际电信联盟(ITU)定义的国际电话号码标准格式: + * 格式:+[国家代码][地区代码][用户号码] + * 最大长度:15位数字(不包括+号) + * 特点: + * 必须以 + 号开头 + * 国家代码:1-3位数字 + * 号码总长度不超过15位 + * 全球唯一标识一个电话号码 + */ + Pair pair = CountryCallingCodes.detectCountryCode(mobile); + String nationcode = pair.getLeft(); + String pureMobile = pair.getRight(); + String random = SmsSenderUtil.getRandom(); + String appKey = smsConfig.getAppKey(); + String time = String.valueOf(SmsSenderUtil.getCurrentTime()); + // 构造参数 + Map param = new HashMap(4); + param.put("time", time); + param.put("appKey", appKey); + param.put("random", random); + Map queryParam = new HashMap(4); + // 国家编码 中国大陆 86 + queryParam.put("nationcode", nationcode); + queryParam.put("mobile", pureMobile); + queryParam.put("templateId", templateId); + queryParam.put("templateParam", templateParam); + if (!SmsStringUtils.isEmpty(attime)) { + // 指定发送时间 (一般用于延迟短信 ) + queryParam.put("attime", attime); + } + String q = JSON.toJSONString(queryParam); + param.put("q", JSON.toJSONString(queryParam)); + String sign = SmsSenderUtil.calculateSignature(smsConfig.getAppSecret(), random, time, q); + param.put("sign", sign); + // 发送请求 + try { + JSONObject jsonResult = loadBalancer.doSendRequest(SINGLE_SEND_REQUEST_URL, param); + if (jsonResult != null) { + Integer code = jsonResult.getInteger("code"); + if (code == 0) { + return new SmsSenderResult(jsonResult.getString("data")); + } else { + return new SmsSenderResult(code, jsonResult.getString("msg")); + } + } + } catch (Exception e) { + logger.error("smsClient sendSingle error:", e); + } + return new SmsSenderResult(ResponseCode.ERROR.getCode(), "系统异常"); + } + + /** + * 批量发送短信 + * @param phoneNumbers 接收短信的电话号码,以逗号, 分隔 。国内手机号: 15011319235 国际手机号:+852000012**** + * @param templateId 模版编号 + * @param attime 延迟时间 Long 时间戳 + * @param templateParam 模版参数 + * @return + */ + public SmsSenderResult sendBatchSmsByTemplateId(String phoneNumbers, + String templateId, + String attime, + Map templateParam) { + + String random = SmsSenderUtil.getRandom(); + String appKey = smsConfig.getAppKey(); + String time = String.valueOf(SmsSenderUtil.getCurrentTime()); + // 构造参数 + Map param = new HashMap(4); + param.put("time", time); + param.put("appKey", appKey); + param.put("random", random); + Map queryParam = new HashMap(4); + queryParam.put("phoneNumbers", phoneNumbers); + queryParam.put("templateId", templateId); + queryParam.put("templateParam", templateParam); + if (!SmsStringUtils.isEmpty(attime)) { + // 指定发送时间 (一般用于延迟短信 ) + queryParam.put("attime", attime); + } + String q = JSON.toJSONString(queryParam); + param.put("q", JSON.toJSONString(queryParam)); + String sign = SmsSenderUtil.calculateSignature(smsConfig.getAppSecret(), random, time, q); + param.put("sign", sign); + // 发送请求 + try { + JSONObject jsonResult = loadBalancer.doSendRequest(BTACH_SEND_REQUEST_URL, param); + if (jsonResult != null) { + Integer code = jsonResult.getInteger("code"); + if (code == 0) { + return new SmsSenderResult(jsonResult.getString("data")); + } else { + return new SmsSenderResult(code, jsonResult.getString("msg")); + } + } + } catch (Exception e) { + logger.error("smsClient sendSingle error:", e); + } + return new SmsSenderResult(ResponseCode.ERROR.getCode(), "系统异常"); + } + +} diff --git a/marketing-client-sdk/src/main/java/com/platform/marketing/client/sdk/SmsSenderResult.java b/marketing-client-sdk/src/main/java/com/platform/marketing/client/sdk/SmsSenderResult.java new file mode 100644 index 0000000..9fe9af6 --- /dev/null +++ b/marketing-client-sdk/src/main/java/com/platform/marketing/client/sdk/SmsSenderResult.java @@ -0,0 +1,59 @@ +package com.platform.marketing.client.sdk; + +import com.platform.marketing.client.sdk.util.ResponseCode; +import org.apache.commons.lang3.StringUtils; + +public class SmsSenderResult { + private String msg = StringUtils.EMPTY; + + private int code; + + private String smsId; + + public SmsSenderResult(String smsId) { + this.code = ResponseCode.SUCCESS.getCode(); + this.smsId = smsId; + } + + public SmsSenderResult(String smsId, int code, String msg) { + this.code = code; + this.smsId = smsId; + this.msg = msg; + } + + public SmsSenderResult(int code, String msg) { + this.code = code; + this.msg = msg; + } + + public String getSmsId() { + return smsId; + } + + public void setSmsId(String smsId) { + this.smsId = smsId; + } + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public String getMsg() { + return msg; + } + + public void setMsg(String msg) { + this.msg = msg; + } + + @Override + public String toString() { + StringBuffer sb = new StringBuffer(); + return sb.append("smsId:" + smsId).append(" code:" + code + " msg:" + msg).toString(); + } + +} diff --git a/marketing-client-sdk/src/main/java/com/platform/marketing/client/sdk/util/CountryCallingCodes.java b/marketing-client-sdk/src/main/java/com/platform/marketing/client/sdk/util/CountryCallingCodes.java new file mode 100644 index 0000000..9c29178 --- /dev/null +++ b/marketing-client-sdk/src/main/java/com/platform/marketing/client/sdk/util/CountryCallingCodes.java @@ -0,0 +1,360 @@ +package com.platform.marketing.client.sdk.util; + +import org.apache.commons.lang3.tuple.Pair; + +import java.util.HashMap; +import java.util.Map; + +public class CountryCallingCodes { + public static final Map COUNTRY_CODES = new HashMap<>(); + + static { + // 区域1: 北美号码计划 + COUNTRY_CODES.put("1", "北美号码计划区域 (美国、加拿大及加勒比地区)"); + + // 区域2: 非洲 + COUNTRY_CODES.put("20", "埃及"); + COUNTRY_CODES.put("211", "南苏丹"); + COUNTRY_CODES.put("212", "摩洛哥"); + COUNTRY_CODES.put("213", "阿尔及利亚"); + COUNTRY_CODES.put("216", "突尼斯"); + COUNTRY_CODES.put("218", "利比亚"); + COUNTRY_CODES.put("220", "冈比亚"); + COUNTRY_CODES.put("221", "塞内加尔"); + COUNTRY_CODES.put("222", "毛里塔尼亚"); + COUNTRY_CODES.put("223", "马里"); + COUNTRY_CODES.put("224", "几内亚"); + COUNTRY_CODES.put("225", "科特迪瓦"); + COUNTRY_CODES.put("226", "布基纳法索"); + COUNTRY_CODES.put("227", "尼日尔"); + COUNTRY_CODES.put("228", "多哥"); + COUNTRY_CODES.put("229", "贝宁"); + COUNTRY_CODES.put("230", "毛里求斯"); + COUNTRY_CODES.put("231", "利比里亚"); + COUNTRY_CODES.put("232", "塞拉利昂"); + COUNTRY_CODES.put("233", "加纳"); + COUNTRY_CODES.put("234", "尼日利亚"); + COUNTRY_CODES.put("235", "乍得"); + COUNTRY_CODES.put("236", "中非共和国"); + COUNTRY_CODES.put("237", "喀麦隆"); + COUNTRY_CODES.put("238", "佛得角"); + COUNTRY_CODES.put("239", "圣多美和普林西比"); + COUNTRY_CODES.put("240", "赤道几内亚"); + COUNTRY_CODES.put("241", "加蓬"); + COUNTRY_CODES.put("242", "刚果共和国"); + COUNTRY_CODES.put("243", "刚果民主共和国"); + COUNTRY_CODES.put("244", "安哥拉"); + COUNTRY_CODES.put("245", "几内亚比绍"); + COUNTRY_CODES.put("246", "英属印度洋领地"); + COUNTRY_CODES.put("247", "阿森松岛"); + COUNTRY_CODES.put("248", "塞舌尔"); + COUNTRY_CODES.put("249", "苏丹"); + COUNTRY_CODES.put("250", "卢旺达"); + COUNTRY_CODES.put("251", "埃塞俄比亚"); + COUNTRY_CODES.put("252", "索马里"); + COUNTRY_CODES.put("253", "吉布提"); + COUNTRY_CODES.put("254", "肯尼亚"); + COUNTRY_CODES.put("255", "坦桑尼亚"); + COUNTRY_CODES.put("256", "乌干达"); + COUNTRY_CODES.put("257", "布隆迪"); + COUNTRY_CODES.put("258", "莫桑比克"); + COUNTRY_CODES.put("260", "赞比亚"); + COUNTRY_CODES.put("261", "马达加斯加"); + COUNTRY_CODES.put("262", "留尼汪"); + COUNTRY_CODES.put("263", "津巴布韦"); + COUNTRY_CODES.put("264", "纳米比亚"); + COUNTRY_CODES.put("265", "马拉维"); + COUNTRY_CODES.put("266", "莱索托"); + COUNTRY_CODES.put("267", "博茨瓦纳"); + COUNTRY_CODES.put("268", "斯威士兰"); + COUNTRY_CODES.put("269", "科摩罗"); + COUNTRY_CODES.put("27", "南非"); + COUNTRY_CODES.put("290", "圣赫勒拿"); + COUNTRY_CODES.put("291", "厄立特里亚"); + COUNTRY_CODES.put("297", "阿鲁巴"); + COUNTRY_CODES.put("298", "法罗群岛"); + COUNTRY_CODES.put("299", "格陵兰"); + + // 区域3-4: 欧洲 + COUNTRY_CODES.put("30", "希腊"); + COUNTRY_CODES.put("31", "荷兰"); + COUNTRY_CODES.put("32", "比利时"); + COUNTRY_CODES.put("33", "法国"); + COUNTRY_CODES.put("34", "西班牙"); + COUNTRY_CODES.put("350", "直布罗陀"); + COUNTRY_CODES.put("351", "葡萄牙"); + COUNTRY_CODES.put("352", "卢森堡"); + COUNTRY_CODES.put("353", "爱尔兰"); + COUNTRY_CODES.put("354", "冰岛"); + COUNTRY_CODES.put("355", "阿尔巴尼亚"); + COUNTRY_CODES.put("356", "马耳他"); + COUNTRY_CODES.put("357", "塞浦路斯"); + COUNTRY_CODES.put("358", "芬兰"); + COUNTRY_CODES.put("359", "保加利亚"); + COUNTRY_CODES.put("36", "匈牙利"); + COUNTRY_CODES.put("370", "立陶宛"); + COUNTRY_CODES.put("371", "拉脱维亚"); + COUNTRY_CODES.put("372", "爱沙尼亚"); + COUNTRY_CODES.put("373", "摩尔多瓦"); + COUNTRY_CODES.put("374", "亚美尼亚"); + COUNTRY_CODES.put("375", "白俄罗斯"); + COUNTRY_CODES.put("376", "安道尔"); + COUNTRY_CODES.put("377", "摩纳哥"); + COUNTRY_CODES.put("378", "圣马力诺"); + COUNTRY_CODES.put("379", "梵蒂冈"); + COUNTRY_CODES.put("380", "乌克兰"); + COUNTRY_CODES.put("381", "塞尔维亚"); + COUNTRY_CODES.put("382", "黑山"); + COUNTRY_CODES.put("383", "科索沃"); + COUNTRY_CODES.put("385", "克罗地亚"); + COUNTRY_CODES.put("386", "斯洛文尼亚"); + COUNTRY_CODES.put("387", "波黑"); + COUNTRY_CODES.put("389", "北马其顿"); + COUNTRY_CODES.put("39", "意大利"); + COUNTRY_CODES.put("40", "罗马尼亚"); + COUNTRY_CODES.put("41", "瑞士"); + COUNTRY_CODES.put("420", "捷克"); + COUNTRY_CODES.put("421", "斯洛伐克"); + COUNTRY_CODES.put("423", "列支敦士登"); + COUNTRY_CODES.put("43", "奥地利"); + COUNTRY_CODES.put("44", "英国"); + COUNTRY_CODES.put("45", "丹麦"); + COUNTRY_CODES.put("46", "瑞典"); + COUNTRY_CODES.put("47", "挪威"); + COUNTRY_CODES.put("48", "波兰"); + COUNTRY_CODES.put("49", "德国"); + + // 区域5: 美洲(非北美号码计划) + COUNTRY_CODES.put("500", "福克兰群岛"); + COUNTRY_CODES.put("501", "伯利兹"); + COUNTRY_CODES.put("502", "危地马拉"); + COUNTRY_CODES.put("503", "萨尔瓦多"); + COUNTRY_CODES.put("504", "洪都拉斯"); + COUNTRY_CODES.put("505", "尼加拉瓜"); + COUNTRY_CODES.put("506", "哥斯达黎加"); + COUNTRY_CODES.put("507", "巴拿马"); + COUNTRY_CODES.put("508", "圣皮埃尔和密克隆"); + COUNTRY_CODES.put("509", "海地"); + COUNTRY_CODES.put("51", "秘鲁"); + COUNTRY_CODES.put("52", "墨西哥"); + COUNTRY_CODES.put("53", "古巴"); + COUNTRY_CODES.put("54", "阿根廷"); + COUNTRY_CODES.put("55", "巴西"); + COUNTRY_CODES.put("56", "智利"); + COUNTRY_CODES.put("57", "哥伦比亚"); + COUNTRY_CODES.put("58", "委内瑞拉"); + COUNTRY_CODES.put("590", "瓜德罗普"); + COUNTRY_CODES.put("591", "玻利维亚"); + COUNTRY_CODES.put("592", "圭亚那"); + COUNTRY_CODES.put("593", "厄瓜多尔"); + COUNTRY_CODES.put("594", "法属圭亚那"); + COUNTRY_CODES.put("595", "巴拉圭"); + COUNTRY_CODES.put("596", "马提尼克"); + COUNTRY_CODES.put("597", "苏里南"); + COUNTRY_CODES.put("598", "乌拉圭"); + COUNTRY_CODES.put("599", "荷属加勒比"); + + // 区域6: 东南亚及大洋洲 + COUNTRY_CODES.put("60", "马来西亚"); + COUNTRY_CODES.put("61", "澳大利亚"); + COUNTRY_CODES.put("62", "印度尼西亚"); + COUNTRY_CODES.put("63", "菲律宾"); + COUNTRY_CODES.put("64", "新西兰"); + COUNTRY_CODES.put("65", "新加坡"); + COUNTRY_CODES.put("66", "泰国"); + COUNTRY_CODES.put("670", "东帝汶"); + COUNTRY_CODES.put("672", "澳大利亚海外领地"); + COUNTRY_CODES.put("673", "文莱"); + COUNTRY_CODES.put("674", "瑙鲁"); + COUNTRY_CODES.put("675", "巴布亚新几内亚"); + COUNTRY_CODES.put("676", "汤加"); + COUNTRY_CODES.put("677", "所罗门群岛"); + COUNTRY_CODES.put("678", "瓦努阿图"); + COUNTRY_CODES.put("679", "斐济"); + COUNTRY_CODES.put("680", "帕劳"); + COUNTRY_CODES.put("681", "瓦利斯和富图纳"); + COUNTRY_CODES.put("682", "库克群岛"); + COUNTRY_CODES.put("683", "纽埃"); + COUNTRY_CODES.put("685", "萨摩亚"); + COUNTRY_CODES.put("686", "基里巴斯"); + COUNTRY_CODES.put("687", "新喀里多尼亚"); + COUNTRY_CODES.put("688", "图瓦卢"); + COUNTRY_CODES.put("689", "法属波利尼西亚"); + COUNTRY_CODES.put("690", "托克劳"); + COUNTRY_CODES.put("691", "密克罗尼西亚联邦"); + COUNTRY_CODES.put("692", "马绍尔群岛"); + + // 区域7: 部分前苏联地区 + COUNTRY_CODES.put("7", "俄罗斯/哈萨克斯坦"); + + // 区域8: 东亚及特殊服务 + COUNTRY_CODES.put("800", "国际免费电话"); + COUNTRY_CODES.put("808", "国际共享成本服务"); + COUNTRY_CODES.put("81", "日本"); + COUNTRY_CODES.put("82", "韩国"); + COUNTRY_CODES.put("84", "越南"); + COUNTRY_CODES.put("850", "朝鲜"); + COUNTRY_CODES.put("852", "香港"); + COUNTRY_CODES.put("853", "澳门"); + COUNTRY_CODES.put("855", "柬埔寨"); + COUNTRY_CODES.put("856", "老挝"); + COUNTRY_CODES.put("86", "中国大陆"); + COUNTRY_CODES.put("870", "国际网络"); + COUNTRY_CODES.put("878", "环球个人通讯服务"); + COUNTRY_CODES.put("880", "孟加拉国"); + COUNTRY_CODES.put("881", "国际移动卫星"); + COUNTRY_CODES.put("882", "国际网络"); + COUNTRY_CODES.put("883", "国际网络"); + COUNTRY_CODES.put("886", "台湾"); + COUNTRY_CODES.put("888", "电信灾害救济"); + + // 区域9: 中东和南亚 + COUNTRY_CODES.put("90", "土耳其"); + COUNTRY_CODES.put("91", "印度"); + COUNTRY_CODES.put("92", "巴基斯坦"); + COUNTRY_CODES.put("93", "阿富汗"); + COUNTRY_CODES.put("94", "斯里兰卡"); + COUNTRY_CODES.put("95", "缅甸"); + COUNTRY_CODES.put("960", "马尔代夫"); + COUNTRY_CODES.put("961", "黎巴嫩"); + COUNTRY_CODES.put("962", "约旦"); + COUNTRY_CODES.put("963", "叙利亚"); + COUNTRY_CODES.put("964", "伊拉克"); + COUNTRY_CODES.put("965", "科威特"); + COUNTRY_CODES.put("966", "沙特阿拉伯"); + COUNTRY_CODES.put("967", "也门"); + COUNTRY_CODES.put("968", "阿曼"); + COUNTRY_CODES.put("970", "巴勒斯坦"); + COUNTRY_CODES.put("971", "阿联酋"); + COUNTRY_CODES.put("972", "以色列"); + COUNTRY_CODES.put("973", "巴林"); + COUNTRY_CODES.put("974", "卡塔尔"); + COUNTRY_CODES.put("975", "不丹"); + COUNTRY_CODES.put("976", "蒙古"); + COUNTRY_CODES.put("977", "尼泊尔"); + COUNTRY_CODES.put("979", "国际高价服务"); + COUNTRY_CODES.put("98", "伊朗"); + COUNTRY_CODES.put("992", "塔吉克斯坦"); + COUNTRY_CODES.put("993", "土库曼斯坦"); + COUNTRY_CODES.put("994", "阿塞拜疆"); + COUNTRY_CODES.put("995", "格鲁吉亚"); + COUNTRY_CODES.put("996", "吉尔吉斯斯坦"); + COUNTRY_CODES.put("998", "乌兹别克斯坦"); + } + + /** + * 根据国家区号获取国家名称 + */ + public static String getCountryName(String countryCode) { + return COUNTRY_CODES.getOrDefault(countryCode, "未知国家/地区"); + } + + /** + * 根据手机号码识别国家区号 + */ + /** + * 根据手机号码识别国家区号和纯手机号 + * @return Pair 左边是国家码,右边是纯手机号 + */ + public static Pair detectCountryCode(String phoneNumber) { + if (phoneNumber == null || phoneNumber.trim().isEmpty()) { + return Pair.of("", ""); + } + + // 清理号码 + String cleaned = phoneNumber.replaceAll("[^+0-9]", ""); + + // 处理国际格式 + if (cleaned.startsWith("+")) { + String withoutPlus = cleaned.substring(1); + // 尝试1-3位区号匹配 + for (int len = 3; len >= 1; len--) { + if (withoutPlus.length() >= len) { + String potentialCode = withoutPlus.substring(0, len); + if (COUNTRY_CODES.containsKey(potentialCode)) { + String pureMobile = withoutPlus.substring(len); + return Pair.of(potentialCode, pureMobile); + } + } + } + // 如果没有匹配到已知区号,返回整个号码作为纯手机号 + return Pair.of("", withoutPlus); + } + // 处理0086格式 + else if (cleaned.startsWith("0086")) { + String pureMobile = cleaned.substring(4); + return Pair.of("86", pureMobile); + } + // 处理86前缀 + else if (cleaned.startsWith("86") && cleaned.length() > 10) { + String pureMobile = cleaned.substring(2); + return Pair.of("86", pureMobile); + } + // 处理纯11位中国手机号 + else if (cleaned.matches("^1[3-9]\\d{9}$")) { + return Pair.of("86", cleaned); + } + // 处理86前缀 + else if (cleaned.startsWith("62") && cleaned.length() > 10) { + String pureMobile = cleaned.substring(2); + return Pair.of("62", pureMobile); + } + // 其他情况 + else { + return Pair.of("", cleaned); + } + } + + /** + * 获取所有国家区号的区域分类 + */ + public static Map> getCodesByRegion() { + Map> regions = new HashMap<>(); + + Map region1 = new HashMap<>(); // 北美 + Map region2 = new HashMap<>(); // 非洲 + Map region34 = new HashMap<>(); // 欧洲 + Map region5 = new HashMap<>(); // 美洲 + Map region6 = new HashMap<>(); // 东南亚大洋洲 + Map region7 = new HashMap<>(); // 前苏联 + Map region8 = new HashMap<>(); // 东亚 + Map region9 = new HashMap<>(); // 中东南亚 + + // 这里可以根据区号范围进行分类,简化示例 + regions.put("区域1: 北美", region1); + regions.put("区域2: 非洲", region2); + regions.put("区域3-4: 欧洲", region34); + regions.put("区域5: 美洲", region5); + regions.put("区域6: 东南亚及大洋洲", region6); + regions.put("区域7: 前苏联地区", region7); + regions.put("区域8: 东亚及特殊服务", region8); + regions.put("区域9: 中东和南亚", region9); + + return regions; + } + + /** + * 测试方法 + */ + public static void main(String[] args) { + // 测试一些常见号码 + String[] testNumbers = { + "+8615912345678", + "+85212345678", + "+12125551234", + "008615912345678", + "15912345678" + }; + + for (String number : testNumbers) { + + Pair pair = detectCountryCode(number); + String nationCode = pair.getLeft(); + String pureMobile = pair.getRight(); + String country = getCountryName(nationCode); + System.out.println("nationCode:" + nationCode + "国家:" + country + " pureMobile:" + pureMobile); + } + + System.out.println("\n总国家/地区数量: " + COUNTRY_CODES.size()); + } +} diff --git a/marketing-client-sdk/src/main/java/com/platform/marketing/client/sdk/util/LoadBalancer.java b/marketing-client-sdk/src/main/java/com/platform/marketing/client/sdk/util/LoadBalancer.java new file mode 100644 index 0000000..fa84781 --- /dev/null +++ b/marketing-client-sdk/src/main/java/com/platform/marketing/client/sdk/util/LoadBalancer.java @@ -0,0 +1,52 @@ +package com.platform.marketing.client.sdk.util; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.concurrent.atomic.AtomicInteger; + +/** + * 负载均衡工具类 + */ +public class LoadBalancer { + + private final static Logger logger = LoggerFactory.getLogger(LoadBalancer.class); + + private static List CURRENT_SMS_NODES = new ArrayList(); + + private static AtomicInteger INDEX = new AtomicInteger(0); + + public LoadBalancer(String smsServerUrl) { + String[] arr = StringUtils.split(smsServerUrl, ";"); + CURRENT_SMS_NODES.addAll(Arrays.asList(arr)); + } + + public JSONObject doSendRequest(String requestPath, Map params) { + int size = CURRENT_SMS_NODES.size(); + int tryCount = (size >= 2) ? 2 : 1; + JSONObject jsonResult = null; + for (int i = 0; i < tryCount; i++) { + String nodeUrl = CURRENT_SMS_NODES.get(Math.abs(INDEX.intValue() % size)); + try { + String httpResult = SmsHttpClientUtils.doPost(nodeUrl + requestPath, params, 5000, 5000); + jsonResult = JSON.parseObject(httpResult); + int code = jsonResult.getIntValue("code"); + if (code == ResponseCode.SUCCESS.getCode()) { + return jsonResult; + } + } catch (Exception e) { + logger.error("doSendRequest error:", e); + } finally { + INDEX.incrementAndGet(); + } + } + return jsonResult; + } +} diff --git a/marketing-client-sdk/src/main/java/com/platform/marketing/client/sdk/util/ResponseCode.java b/marketing-client-sdk/src/main/java/com/platform/marketing/client/sdk/util/ResponseCode.java new file mode 100644 index 0000000..2610404 --- /dev/null +++ b/marketing-client-sdk/src/main/java/com/platform/marketing/client/sdk/util/ResponseCode.java @@ -0,0 +1,29 @@ +package com.platform.marketing.client.sdk.util; + +/** + * 处理器响应码 + * Created by diven on 2023/8/13. + */ +public enum ResponseCode { + + SUCCESS(0, "成功"), + + ERROR(500, "异常"); + + private final int code; + private final String value; + + ResponseCode(int code, String value) { + this.code = code; + this.value = value; + } + + public int getCode() { + return code; + } + + public String getValue() { + return value; + } + +} diff --git a/marketing-client-sdk/src/main/java/com/platform/marketing/client/sdk/util/SmsHttpClientUtils.java b/marketing-client-sdk/src/main/java/com/platform/marketing/client/sdk/util/SmsHttpClientUtils.java new file mode 100644 index 0000000..f4e6ab4 --- /dev/null +++ b/marketing-client-sdk/src/main/java/com/platform/marketing/client/sdk/util/SmsHttpClientUtils.java @@ -0,0 +1,332 @@ +package com.platform.marketing.client.sdk.util; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.*; +import java.net.HttpURLConnection; +import java.net.URL; +import java.net.URLDecoder; +import java.net.URLEncoder; +import java.util.HashMap; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +public final class SmsHttpClientUtils { + + public static final Logger LOG = LoggerFactory.getLogger(SmsHttpClientUtils.class); + + public static final String DEFAULT_CHARSET = "UTF-8"; + + private static final String METHOD_POST = "POST"; + + private static final String METHOD_GET = "GET"; + + private static final int MAX_SIZE = 1024; + + private SmsHttpClientUtils() { + } + + public static String doPost(String url, Map params, int connectTimeout, int readTimeout) throws Exception { + return doPost(url, params, DEFAULT_CHARSET, connectTimeout, readTimeout); + } + + private static void fillHeaders(HttpURLConnection conn, Map headers) { + if (headers != null) { + for (Entry entry : headers.entrySet()) { + fillHeader(conn, entry.getKey(), entry.getValue()); + } + } + } + + private static void fillHeader(HttpURLConnection conn, String key, String value) { + conn.setRequestProperty(key, value); + } + + private static ByteArrayOutputStream getResultOutputStream(HttpURLConnection conn) throws IOException { + ByteArrayOutputStream outStream = new ByteArrayOutputStream(); + InputStream is = conn.getInputStream(); + try { + if (is != null) { + byte[] buffer = new byte[1024]; + int len = 0; + while ((len = is.read(buffer)) != -1) { + outStream.write(buffer, 0, len); + } + } + } catch (IOException e) { + throw e; + } finally { + if (is != null) { + is.close(); + } + } + return outStream; + } + + public static String doPost(String url, Map params, String charset, int connectTimeout, int readTimeout) throws Exception { + String ctype = "application/x-www-form-urlencoded;charset=" + charset; + String query = buildQuery(params, charset); + byte[] content = {}; + if (query != null) { + try { + content = query.getBytes(charset); + } catch (IOException e) { + throw new Exception(e); + } + } + return doPost(url, ctype, content, connectTimeout, readTimeout); + } + + public static String doPost(String url, String ctype, byte[] content, int connectTimeout, int readTimeout) throws Exception { + HttpURLConnection conn = null; + OutputStream out = null; + String rsp = null; + try { + conn = getConnection(new URL(url), METHOD_POST, ctype); + conn.setConnectTimeout(connectTimeout); + conn.setReadTimeout(readTimeout); + out = conn.getOutputStream(); + out.write(content); + rsp = getResponseAsString(conn); + } catch (IOException e) { + LOG.error("调用 Http地址:" + url + " 访问出现错误 : ", e); + throw new Exception("访问远程服务失败", e); + } finally { + if (out != null) { + try { + out.close(); + } catch (IOException e) { + throw new Exception(e); + } + } + if (conn != null) { + conn.disconnect(); + } + } + return rsp; + } + + public static String doGet(String url, Map params) throws Exception { + return doGet(url, params, DEFAULT_CHARSET); + } + + public static String doGet(String url, Map params, String charset) throws Exception { + HttpURLConnection conn = null; + String rsp = null; + try { + String ctype = "application/x-www-form-urlencoded;charset=" + charset; + String query = buildQuery(params, charset); + try { + conn = getConnection(buildGetUrl(url, query), METHOD_GET, ctype); + } catch (IOException e) { + LOG.error("调用 Http地址:" + url + " 访问出现错误 : ", e); + throw new Exception(e); + } + rsp = getResponseAsString(conn); + + } finally { + if (conn != null) { + conn.disconnect(); + } + } + return rsp; + } + + public static HttpURLConnection getConnection(URL url, String method, String ctype) { + try { + HttpURLConnection conn = (HttpURLConnection) url.openConnection(); + conn.setRequestMethod(method); + conn.setDoInput(true); + conn.setDoOutput(true); + conn.setRequestProperty("Accept", "text/xml,text/javascript,text/html,text/plain,*/*;"); + // conn.setRequestProperty("User-Agent", "remote-java"); + conn.setRequestProperty("Content-Type", ctype); + conn.setRequestProperty("Accept-Language", "zh-CN"); + return conn; + } catch (IOException e) { + LOG.error("execute open connection error", e); + } + return null; + } + + private static URL buildGetUrl(String strUrl, String query) throws IOException { + StringBuffer buffer = new StringBuffer(strUrl); + URL url = new URL(strUrl); + if (SmsStringUtils.isEmpty(query)) { + return url; + } + + if (SmsStringUtils.isEmpty(url.getQuery())) { + if (strUrl.endsWith("?")) { + buffer.append(query); + } else { + buffer.append("?").append(query); + } + } else { + if (strUrl.endsWith("&")) { + buffer.append(query); + } else { + buffer.append("&").append(query); + } + } + + return new URL(buffer.toString()); + } + + public static String buildQuery(Map params, String charset) throws Exception { + if (params == null || params.isEmpty()) { + return null; + } + + StringBuilder query = new StringBuilder(); + Set> entries = params.entrySet(); + boolean hasParam = false; + + for (Entry entry : entries) { + String name = entry.getKey(); + String value = entry.getValue(); + // 忽略参数名或参数值为空的参数 + if (SmsStringUtils.areNotEmpty(name, value)) { + if (hasParam) { + query.append("&"); + } else { + hasParam = true; + } + + try { + query.append(name).append("=").append(URLEncoder.encode(value, charset)); + } catch (IOException e) { + throw new Exception(e); + } + } + } + + return query.toString(); + } + + protected static String getResponseAsString(HttpURLConnection conn) throws Exception { + String charset = getResponseCharset(conn.getContentType()); + InputStream es = conn.getErrorStream(); + String msg; + if (es == null) { + try { + return getStreamAsString(conn.getInputStream(), charset); + } catch (IOException e) { + throw new Exception(e); + } + } else { + msg = getStreamAsString(es, charset); + if (SmsStringUtils.isEmpty(msg)) { + throw new Exception("返回的内容为空" + msg); + } + } + return msg; + } + + private static String getStreamAsString(InputStream stream, String charset) throws Exception { + try { + BufferedReader reader = new BufferedReader(new InputStreamReader(stream, charset)); + StringWriter writer = new StringWriter(); + + char[] chars = new char[MAX_SIZE]; + int count = 0; + while ((count = reader.read(chars)) > 0) { + writer.write(chars, 0, count); + } + return writer.toString(); + } catch (IOException e) { + throw new Exception(e); + } finally { + if (stream != null) { + try { + stream.close(); + } catch (IOException e) { + throw new Exception(e); + } + } + } + } + + private static String getResponseCharset(String ctype) { + String charset = DEFAULT_CHARSET; + if (!SmsStringUtils.isEmpty(ctype)) { + String[] params = ctype.split(";"); + for (String param : params) { + param = param.trim(); + if (param.startsWith("charset")) { + String[] pair = param.split("=", 2); + if (pair.length == 2 && !SmsStringUtils.isEmpty(pair[1])) { + charset = pair[1].trim(); + } + break; + } + } + } + + return charset; + } + + public static String decode(String value) { + return decode(value, DEFAULT_CHARSET); + } + + + public static String encode(String value) { + return encode(value, DEFAULT_CHARSET); + } + + + public static String decode(String value, String charset) { + String result = null; + if (!SmsStringUtils.isEmpty(value)) { + try { + result = URLDecoder.decode(value, charset); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + return result; + } + + public static String encode(String value, String charset) { + String result = null; + if (!SmsStringUtils.isEmpty(value)) { + try { + result = URLEncoder.encode(value, charset); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + return result; + } + + + private static Map getParamsFromUrl(String url) { + Map map = null; + if (url != null && url.indexOf('?') != -1) { + map = splitUrlQuery(url.substring(url.indexOf('?') + 1)); + } + if (map == null) { + map = new HashMap(); + } + return map; + } + + public static Map splitUrlQuery(String query) { + Map result = new HashMap(); + + String[] pairs = query.split("&"); + if (pairs != null && pairs.length > 0) { + for (String pair : pairs) { + String[] param = pair.split("=", 2); + if (param != null && param.length == 2) { + result.put(param[0], param[1]); + } + } + } + return result; + } + +} diff --git a/marketing-client-sdk/src/main/java/com/platform/marketing/client/sdk/util/SmsSenderUtil.java b/marketing-client-sdk/src/main/java/com/platform/marketing/client/sdk/util/SmsSenderUtil.java new file mode 100644 index 0000000..de55ad3 --- /dev/null +++ b/marketing-client-sdk/src/main/java/com/platform/marketing/client/sdk/util/SmsSenderUtil.java @@ -0,0 +1,72 @@ +package com.platform.marketing.client.sdk.util; + +import org.apache.commons.codec.digest.DigestUtils; + +import java.util.ArrayList; +import java.util.UUID; + + +public class SmsSenderUtil { + + public static long getCurrentTime() { + return System.currentTimeMillis(); + } + + public static String getRandom() { + //long random = (new Random(SmsSenderUtil.getCurrentTime())).nextLong() % 900000 + 100000; + //return String.valueOf(random); + return UUID.randomUUID().toString().replaceAll("-", ""); + } + + public static String calculateSignature(String appSecret, String random, String time, + String q) { + StringBuffer buffer = new StringBuffer("appSecret=") + .append(appSecret) + .append("&random=") + .append(random) + .append("&time=") + .append(time) + .append("&q=") + .append(q); + return sha256(buffer.toString()); + } + + public static String calculateSignature(String appSecret, long random, long time, + String[] phoneNumbers) { + StringBuffer buffer = new StringBuffer("appSecret=") + .append(appSecret) + .append("&random=") + .append(random) + .append("&time=") + .append(time) + .append("&q="); + if (phoneNumbers.length > 0) { + buffer.append(phoneNumbers[0]); + for (int i = 1; i < phoneNumbers.length; i++) { + buffer.append(","); + buffer.append(phoneNumbers[i]); + } + } + return sha256(buffer.toString()); + } + + public static String calculateSignature(String appSecret, long random, long time, + ArrayList phoneNumbers) { + return calculateSignature(appSecret, random, time, phoneNumbers.toArray(new String[0])); + } + + public static String calculateSignature(String appSecret, long random, long time) { + StringBuffer buffer = new StringBuffer("appSecret=") + .append(appSecret) + .append("&random=") + .append(random) + .append("&time=") + .append(time); + return sha256(buffer.toString()); + } + + private static String sha256(String rawString) { + return DigestUtils.sha256Hex(rawString); + } + +} diff --git a/marketing-client-sdk/src/main/java/com/platform/marketing/client/sdk/util/SmsStringUtils.java b/marketing-client-sdk/src/main/java/com/platform/marketing/client/sdk/util/SmsStringUtils.java new file mode 100644 index 0000000..db10edd --- /dev/null +++ b/marketing-client-sdk/src/main/java/com/platform/marketing/client/sdk/util/SmsStringUtils.java @@ -0,0 +1,53 @@ +package com.platform.marketing.client.sdk.util; + +public class SmsStringUtils { + + public static boolean isEmpty(String str) { + return str == null || str.length() == 0; + } + + + /** + *

Checks if a String is whitespace, empty ("") or null.

+ *

+ *

+     * StringUtils.isBlank(null)      = true
+     * StringUtils.isBlank("")        = true
+     * StringUtils.isBlank(" ")       = true
+     * StringUtils.isBlank("bob")     = false
+     * StringUtils.isBlank("  bob  ") = false
+     * 
+ * + * @param str the String to check, may be null + * @return true if the String is null, empty or whitespace + * @since 2.0 + */ + public static boolean isBlank(String str) { + if (str == null || str.length() == 0) { + return true; + } + for (int i = 0; i < str.length(); i++) { + if ((!Character.isWhitespace(str.charAt(i)))) { + return false; + } + } + return true; + } + + public static boolean areNotEmpty(String... values) { + boolean result = true; + if (values == null || values.length == 0) { + result = false; + } else { + for (String value : values) { + result &= !isEmpty(value); + } + } + return result; + } + + public static boolean equals(String str1, String str2) { + return str1 == null ? str2 == null : str1.equals(str2); + } + +} diff --git a/marketing-client-sdk/src/test/java/com/platform/marketing/client/sdk/test/BatchSmsSendUnitTest.java b/marketing-client-sdk/src/test/java/com/platform/marketing/client/sdk/test/BatchSmsSendUnitTest.java new file mode 100644 index 0000000..3d546a5 --- /dev/null +++ b/marketing-client-sdk/src/test/java/com/platform/marketing/client/sdk/test/BatchSmsSendUnitTest.java @@ -0,0 +1,34 @@ +package com.platform.marketing.client.sdk.test; + +import com.platform.marketing.client.sdk.SmsConfig; +import com.platform.marketing.client.sdk.SmsSenderClient; +import com.platform.marketing.client.sdk.SmsSenderResult; +import com.alibaba.fastjson.JSON; + +import java.util.HashMap; +import java.util.Map; + +/** + * Created by diven on 2020/9/12. + */ +public class BatchSmsSendUnitTest { + + public static void main(String[] args) throws Exception { + SmsConfig smsConfig = new SmsConfig(); + smsConfig.setAppKey("qQjEiFzn80v8VM4h"); + smsConfig.setSmsServerUrl("http://14.103.184.174:8089"); + smsConfig.setAppSecret("9c465ece754bd26a9be77f3d0e2606bd"); + SmsSenderClient smsSenderClient = new SmsSenderClient(smsConfig); + String phoneNumbers = "15011319235,17607197036,15011319235,15011319235,15011319237,15011319237"; + String templateId = "1"; + // ${code}为您的登录验证码,请于${time}分钟内填写,如非本人操作,请忽略本短信。 + Map param = new HashMap(); + param.put("code", "1234"); + param.put("time", "10"); + // 30 秒之后发送 + String attime = String.valueOf(System.currentTimeMillis() + 30 * 1000L); + SmsSenderResult senderResult = smsSenderClient.sendBatchSmsByTemplateId(phoneNumbers, templateId, attime, param); + System.out.println("senderResult:" + JSON.toJSONString(senderResult)); + } + +} diff --git a/marketing-client-sdk/src/test/java/com/platform/marketing/client/sdk/test/SingleSmsSendUnitTest.java b/marketing-client-sdk/src/test/java/com/platform/marketing/client/sdk/test/SingleSmsSendUnitTest.java new file mode 100644 index 0000000..bd8fdcd --- /dev/null +++ b/marketing-client-sdk/src/test/java/com/platform/marketing/client/sdk/test/SingleSmsSendUnitTest.java @@ -0,0 +1,35 @@ +package com.platform.marketing.client.sdk.test; + +import com.platform.marketing.client.sdk.SmsConfig; +import com.platform.marketing.client.sdk.SmsSenderClient; +import com.platform.marketing.client.sdk.SmsSenderResult; +import com.alibaba.fastjson.JSON; + +import java.util.HashMap; +import java.util.Map; + +/** + * Created by diven on 2020/9/12. + */ +public class SingleSmsSendUnitTest { + + public static void main(String[] args) throws Exception { + SmsConfig smsConfig = new SmsConfig(); + smsConfig.setAppKey("qQjEiFzn80v8VM4h"); + smsConfig.setSmsServerUrl("http://14.103.184.174:8089;http://14.103.184.175:8089"); + smsConfig.setAppSecret("9c465ece754bd26a9be77f3d0e2606bd"); + SmsSenderClient smsSenderClient = new SmsSenderClient(smsConfig); + String mobile = "15011319235"; + String templateId = "1"; + // ${code}为您的登录验证码,请于${time}分钟内填写,如非本人操作,请忽略本短信。 + Map param = new HashMap(); + param.put("code", "1234"); + param.put("time", "10"); + // 30 秒之后发送 + String attime = String.valueOf(System.currentTimeMillis() + 30 * 1000L); + SmsSenderResult senderResult = smsSenderClient.sendSmsByTemplateId(mobile, templateId, attime, param); + System.out.println("senderResult:" + JSON.toJSONString(senderResult)); + + } + +} diff --git a/marketing-client-sdk/src/test/resources/logback.xml b/marketing-client-sdk/src/test/resources/logback.xml new file mode 100644 index 0000000..c008e56 --- /dev/null +++ b/marketing-client-sdk/src/test/resources/logback.xml @@ -0,0 +1,15 @@ + + + + + + %d{yyyy-MM-dd HH:mm:ss.SSS} %p %t %logger{36}:%L - %msg%n + + + + + + + + + diff --git a/marketing-dependencies/.flattened-pom.xml b/marketing-dependencies/.flattened-pom.xml new file mode 100644 index 0000000..adad599 --- /dev/null +++ b/marketing-dependencies/.flattened-pom.xml @@ -0,0 +1,443 @@ + + + 4.0.0 + com.platform + marketing-dependencies + 0.0.1-jdk8-SNAPSHOT + pom + marketing-dependencies + 基础 bom 文件,管理整个项目的依赖版本 + https://github.com/makemyownlife/platform-sms-pro + + 2.9.3 + 7.2.11.RELEASE + 1.6.0 + 5.1.0 + 1.6.3 + 1.2.83 + 5.3.39 + 4.7.2.B + 3.5.17 + 8.6.0 + 1.27.1 + 2.3.2 + 2.7.0 + 4.3.1 + 3.41.0 + 0.9.0 + 2.14.5 + 4.5.13 + 2.7.18 + 1.8.0 + 2.2.7 + 2.17.0 + 1.18.3 + 3.5.9 + 4.5.0 + 1.18.36 + 6.8.0 + 4.11.0 + 1.0.8 + 2.4 + 5.8.14 + 4.0.3 + 1.0.10 + 3.0.6 + 1.2.13 + 1.78 + 1.4.13 + 0.0.1-jdk8-SNAPSHOT + 0.1.55 + 4.1.116.Final + 1.1.8 + 5.8.35 + 33.4.0-jre + 2.5 + 1.12.777 + 3.3.3 + 3.11.1 + 1.7.8 + 5.3.39 + 1.2.24 + 3.0.6 + 8.1.3.140 + + + + + io.netty + netty-bom + ${netty.version} + pom + import + + + org.springframework + spring-framework-bom + ${spring.framework.version} + pom + import + + + org.springframework.security + spring-security-bom + ${spring.security.version} + pom + import + + + org.springframework.boot + spring-boot-dependencies + ${spring.boot.version} + pom + import + + + io.github.mouzt + bizlog-sdk + ${bizlog-sdk.version} + + + org.springframework.boot + spring-boot-starter + + + + + com.platform + marketing-spring-boot-starter-biz-ip + ${revision} + + + org.springframework.boot + spring-boot-configuration-processor + ${spring.boot.version} + + + com.platform + marketing-spring-boot-starter-web + ${revision} + + + com.platform + marketing-spring-boot-starter-security + ${revision} + + + com.github.xiaoymin + knife4j-openapi3-spring-boot-starter + ${knife4j.version} + + + org.springdoc + springdoc-openapi-ui + ${springdoc.version} + + + com.platform + marketing-spring-boot-starter-mybatis + ${revision} + + + com.alibaba + druid-spring-boot-starter + ${druid.version} + + + org.mybatis + mybatis + ${mybatis.version} + + + com.baomidou + mybatis-plus-boot-starter + ${mybatis-plus.version} + + + com.baomidou + mybatis-plus-jsqlparser-4.9 + ${mybatis-plus.version} + + + com.baomidou + mybatis-plus-generator + ${mybatis-plus.version} + + + com.baomidou + dynamic-datasource-spring-boot-starter + ${dynamic-datasource.version} + + + com.github.yulichang + mybatis-plus-join-boot-starter + ${mybatis-plus-join.version} + + + com.fhs-opensource + easy-trans-spring-boot-starter + ${easy-trans.version} + + + org.springframework + spring-context + + + org.springframework.cloud + spring-cloud-commons + + + + + com.fhs-opensource + easy-trans-mybatis-plus-extend + ${easy-trans.version} + + + com.fhs-opensource + easy-trans-anno + ${easy-trans.version} + + + com.platform + marketing-spring-boot-starter-redis + ${revision} + + + org.redisson + redisson-spring-boot-starter + ${redisson.version} + + + org.springframework.boot + spring-boot-starter-actuator + + + org.redisson + redisson-spring-data-34 + + + + + org.redisson + redisson-spring-data-27 + ${redisson.version} + + + org.springframework + spring-webflux + ${spring.boot.webfulx.version} + + + com.platform + marketing-spring-boot-starter-job + ${revision} + + + com.platform + marketing-spring-boot-starter-mq + ${revision} + + + com.platform + marketing-spring-boot-starter-idgenerator + ${revision} + + + org.apache.rocketmq + rocketmq-spring-boot-starter + ${rocketmq-spring.version} + + + com.platform + marketing-spring-boot-starter-protection + ${revision} + + + com.baomidou + lock4j-redisson-spring-boot-starter + ${lock4j.version} + + + org.redisson + redisson-spring-boot-starter + + + + + com.platform + marketing-spring-boot-starter-test + ${revision} + test + + + org.mockito + mockito-inline + ${mockito-inline.version} + + + org.springframework.boot + spring-boot-starter-test + ${spring.boot.version} + + + org.ow2.asm + asm + + + org.mockito + mockito-core + + + + + com.github.fppt + jedis-mock + ${jedis-mock.version} + test + + + uk.co.jemos.podam + podam + ${podam.version} + + + com.platform + marketing-common + ${revision} + + + com.platform + marketing-spring-boot-starter-excel + ${revision} + + + org.projectlombok + lombok + ${lombok.version} + + + org.mapstruct + mapstruct + ${mapstruct.version} + + + org.mapstruct + mapstruct-jdk8 + ${mapstruct.version} + + + org.mapstruct + mapstruct-processor + ${mapstruct.version} + + + cn.hutool + hutool-all + ${hutool.version} + + + org.bouncycastle + bcprov-jdk18on + ${bouncycastle.version} + + + com.alibaba + easyexcel + ${easyexcel.version} + + + commons-io + commons-io + ${commons-io.version} + + + org.apache.commons + commons-compress + ${commons-compress.version} + + + org.apache.tika + tika-core + ${tika-core.version} + + + org.apache.velocity + velocity-engine-core + ${velocity.version} + + + com.alibaba + fastjson + ${fastjson.version} + + + com.google.guava + guava + ${guava.version} + + + com.google.inject + guice + ${guice.version} + + + com.alibaba + transmittable-thread-local + ${transmittable-thread-local.version} + + + commons-net + commons-net + ${commons-net.version} + + + com.jcraft + jsch + ${jsch.version} + + + com.xingyuv + spring-boot-starter-captcha-plus + ${captcha-plus.version} + + + org.lionsoul + ip2region + ${ip2region.version} + + + org.jsoup + jsoup + ${jsoup.version} + + + com.amazonaws + aws-java-sdk-s3 + ${aws-java-sdk-s3.version} + + + com.xingyuv + spring-boot-starter-justauth + ${justauth.version} + + + cn.hutool + hutool-core + + + + + ch.qos.logback + logback-core + ${logback.version} + + + ch.qos.logback + logback-classic + ${logback.version} + + + + diff --git a/marketing-dependencies/pom.xml b/marketing-dependencies/pom.xml new file mode 100644 index 0000000..1bf6a6a --- /dev/null +++ b/marketing-dependencies/pom.xml @@ -0,0 +1,601 @@ + + + 4.0.0 + + com.platform + marketing-dependencies + ${revision} + pom + + ${project.artifactId} + 基础 bom 文件,管理整个项目的依赖版本 + https://github.com/makemyownlife/platform-sms-pro + + + 0.0.1-jdk8-SNAPSHOT + + 1.6.0 + + 5.3.39 + 5.8.14 + 2.7.18 + 5.3.39 + + 1.8.0 + 4.5.0 + 2.5 + + 1.2.24 + 3.5.17 + 3.5.9 + 4.3.1 + 1.4.13 + 3.0.6 + 3.41.0 + 8.1.3.140 + 8.6.0 + 5.1.0 + 3.3.3 + + 2.3.2 + + 2.2.7 + + 7.2.11.RELEASE + 1.1.8 + 4.11.0 + + 6.8.0 + + 1.0.10 + 1.18.3 + 1.18.36 + 1.6.3 + 5.8.35 + 1.78 + 4.0.3 + 2.4 + 1.2.83 + 33.4.0-jre + 2.14.5 + 3.11.1 + 0.1.55 + 2.9.3 + 2.7.0 + + 4.1.116.Final + + 0.9.0 + 4.5.13 + 3.0.6 + + + 2.17.0 + 1.27.1 + 1.12.777 + 1.0.8 + 1.7.8 + 4.7.2.B + + 1.2.13 + + + + + + + + io.netty + netty-bom + ${netty.version} + pom + import + + + + org.springframework + spring-framework-bom + ${spring.framework.version} + pom + import + + + + org.springframework.security + spring-security-bom + ${spring.security.version} + pom + import + + + + org.springframework.boot + spring-boot-dependencies + ${spring.boot.version} + pom + import + + + + + io.github.mouzt + bizlog-sdk + ${bizlog-sdk.version} + + + org.springframework.boot + spring-boot-starter + + + + + + com.platform + marketing-spring-boot-starter-biz-ip + ${revision} + + + + + + org.springframework.boot + spring-boot-configuration-processor + ${spring.boot.version} + + + + + com.platform + marketing-spring-boot-starter-web + ${revision} + + + + com.platform + marketing-spring-boot-starter-security + ${revision} + + + + com.github.xiaoymin + knife4j-openapi3-spring-boot-starter + ${knife4j.version} + + + + org.springdoc + springdoc-openapi-ui + ${springdoc.version} + + + + + com.platform + marketing-spring-boot-starter-mybatis + ${revision} + + + + com.alibaba + druid-spring-boot-starter + ${druid.version} + + + + org.mybatis + mybatis + ${mybatis.version} + + + + com.baomidou + mybatis-plus-boot-starter + ${mybatis-plus.version} + + + + com.baomidou + mybatis-plus-jsqlparser-4.9 + ${mybatis-plus.version} + + + + com.baomidou + mybatis-plus-generator + ${mybatis-plus.version} + + + + com.baomidou + dynamic-datasource-spring-boot-starter + ${dynamic-datasource.version} + + + + com.github.yulichang + mybatis-plus-join-boot-starter + ${mybatis-plus-join.version} + + + + com.fhs-opensource + easy-trans-spring-boot-starter + ${easy-trans.version} + + + org.springframework + spring-context + + + org.springframework.cloud + spring-cloud-commons + + + + + + com.fhs-opensource + easy-trans-mybatis-plus-extend + ${easy-trans.version} + + + + com.fhs-opensource + easy-trans-anno + ${easy-trans.version} + + + + com.platform + marketing-spring-boot-starter-redis + ${revision} + + + + org.redisson + redisson-spring-boot-starter + ${redisson.version} + + + org.springframework.boot + spring-boot-starter-actuator + + + org.redisson + + redisson-spring-data-34 + + + + + + org.redisson + redisson-spring-data-27 + ${redisson.version} + + + + org.springframework + spring-webflux + ${spring.boot.webfulx.version} + + + + + + + com.platform + marketing-spring-boot-starter-job + ${revision} + + + + + com.platform + marketing-spring-boot-starter-mq + ${revision} + + + + + com.platform + marketing-spring-boot-starter-idgenerator + ${revision} + + + + org.apache.rocketmq + rocketmq-spring-boot-starter + ${rocketmq-spring.version} + + + + + com.platform + marketing-spring-boot-starter-protection + ${revision} + + + + com.baomidou + lock4j-redisson-spring-boot-starter + ${lock4j.version} + + + redisson-spring-boot-starter + org.redisson + + + + + + + + + com.platform + marketing-spring-boot-starter-test + ${revision} + test + + + + org.mockito + mockito-inline + ${mockito-inline.version} + + + + org.springframework.boot + spring-boot-starter-test + ${spring.boot.version} + + + asm + org.ow2.asm + + + org.mockito + mockito-core + + + + + + com.github.fppt + jedis-mock + ${jedis-mock.version} + test + + + + uk.co.jemos.podam + podam + ${podam.version} + + + + + com.platform + marketing-common + ${revision} + + + + com.platform + marketing-spring-boot-starter-excel + ${revision} + + + + org.projectlombok + lombok + ${lombok.version} + + + + org.mapstruct + mapstruct + ${mapstruct.version} + + + + org.mapstruct + mapstruct-jdk8 + ${mapstruct.version} + + + + org.mapstruct + mapstruct-processor + ${mapstruct.version} + + + + cn.hutool + hutool-all + ${hutool.version} + + + + org.bouncycastle + bcprov-jdk18on + ${bouncycastle.version} + + + + com.alibaba + easyexcel + ${easyexcel.version} + + + + commons-io + commons-io + ${commons-io.version} + + + + org.apache.commons + commons-compress + ${commons-compress.version} + + + + org.apache.tika + tika-core + ${tika-core.version} + + + + org.apache.velocity + velocity-engine-core + ${velocity.version} + + + + com.alibaba + fastjson + ${fastjson.version} + + + + com.google.guava + guava + ${guava.version} + + + + com.google.inject + guice + ${guice.version} + + + + com.alibaba + transmittable-thread-local + ${transmittable-thread-local.version} + + + + commons-net + commons-net + ${commons-net.version} + + + + com.jcraft + jsch + ${jsch.version} + + + + com.xingyuv + spring-boot-starter-captcha-plus + ${captcha-plus.version} + + + + org.lionsoul + ip2region + ${ip2region.version} + + + + org.jsoup + jsoup + ${jsoup.version} + + + + + com.amazonaws + aws-java-sdk-s3 + ${aws-java-sdk-s3.version} + + + + com.xingyuv + spring-boot-starter-justauth + ${justauth.version} + + + cn.hutool + hutool-core + + + + + + + ch.qos.logback + logback-core + ${logback.version} + + + + ch.qos.logback + logback-classic + ${logback.version} + + + + + + + + + + org.codehaus.mojo + flatten-maven-plugin + ${flatten-maven-plugin.version} + + bom + true + + + + + flatten + + flatten + process-resources + + + + clean + + flatten.clean + clean + + + + + + + diff --git a/marketing-framework/.flattened-pom.xml b/marketing-framework/.flattened-pom.xml new file mode 100644 index 0000000..bbde002 --- /dev/null +++ b/marketing-framework/.flattened-pom.xml @@ -0,0 +1,46 @@ + + + 4.0.0 + com.platform + marketing-framework + 0.0.1-jdk8-SNAPSHOT + pom + 该包是技术组件,每个子包,代表一个组件。每个组件包括两部分: + 1. core 包:是该组件的核心封装 + 2. config 包:是该组件基于 Spring 的配置 + + 技术组件,也分成两类: + 1. 框架组件:和我们熟悉的 MyBatis、Redis 等等的拓展 + 2. 业务组件:和业务相关的组件的封装,例如说数据字典、操作日志等等。 + 如果是业务组件,Maven 名字会包含 biz + https://github.com/makemyownlife/platform-sms-pro + + + huaweicloud + huawei + https://mirrors.huaweicloud.com/repository/maven/ + + + aliyunmaven + aliyun + https://maven.aliyun.com/repository/public + + + + false + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + + + false + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + + diff --git a/marketing-framework/marketing-common/.flattened-pom.xml b/marketing-framework/marketing-common/.flattened-pom.xml new file mode 100644 index 0000000..3b24926 --- /dev/null +++ b/marketing-framework/marketing-common/.flattened-pom.xml @@ -0,0 +1,174 @@ + + + 4.0.0 + com.platform + marketing-common + 0.0.1-jdk8-SNAPSHOT + marketing-common + 定义基础 pojo 类、枚举、工具类等等 + https://github.com/makemyownlife/platform-sms-pro + + + org.springframework + spring-core + 5.3.39 + provided + + + org.springframework + spring-expression + 5.3.39 + provided + + + org.springframework + spring-aop + 5.3.39 + provided + + + org.aspectj + aspectjweaver + 1.9.7 + provided + + + org.springframework.boot + spring-boot-configuration-processor + 2.7.18 + compile + true + + + org.springframework + spring-web + 5.3.39 + provided + + + jakarta.servlet + jakarta.servlet-api + 4.0.4 + provided + + + org.springdoc + springdoc-openapi-ui + 1.8.0 + provided + + + org.projectlombok + lombok + 1.18.36 + compile + + + org.mapstruct + mapstruct + 1.6.3 + compile + + + org.mapstruct + mapstruct-jdk8 + 1.6.3 + compile + + + org.mapstruct + mapstruct-processor + 1.6.3 + compile + + + com.google.guava + guava + 33.4.0-jre + provided + + + com.fasterxml.jackson.core + jackson-databind + 2.13.5 + provided + + + com.fasterxml.jackson.core + jackson-core + 2.13.5 + provided + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + 2.13.5 + provided + + + org.slf4j + slf4j-api + 1.7.36 + provided + + + jakarta.validation + jakarta.validation-api + 2.0.2 + provided + + + cn.hutool + hutool-all + 5.8.35 + compile + + + com.alibaba + transmittable-thread-local + 2.14.5 + compile + + + com.fhs-opensource + easy-trans-anno + 3.0.6 + compile + + + org.hibernate.validator + hibernate-validator + 8.0.1.Final + compile + + + + + huaweicloud + huawei + https://mirrors.huaweicloud.com/repository/maven/ + + + aliyunmaven + aliyun + https://maven.aliyun.com/repository/public + + + + false + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + + + false + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + + diff --git a/marketing-framework/marketing-common/pom.xml b/marketing-framework/marketing-common/pom.xml new file mode 100644 index 0000000..2a313ec --- /dev/null +++ b/marketing-framework/marketing-common/pom.xml @@ -0,0 +1,143 @@ + + + + com.platform + marketing-framework + ${revision} + + 4.0.0 + marketing-common + jar + + ${project.artifactId} + 定义基础 pojo 类、枚举、工具类等等 + https://github.com/makemyownlife/platform-sms-pro + + + + + org.springframework + spring-core + provided + + + org.springframework + spring-expression + provided + + + org.springframework + spring-aop + provided + + + org.aspectj + aspectjweaver + provided + + + + + org.springframework.boot + spring-boot-configuration-processor + true + + + + + org.springframework + spring-web + provided + + + + jakarta.servlet + jakarta.servlet-api + provided + + + + org.springdoc + springdoc-openapi-ui + provided + + + + + org.projectlombok + lombok + + + + org.mapstruct + mapstruct + + + org.mapstruct + mapstruct-jdk8 + + + org.mapstruct + mapstruct-processor + + + + com.google.guava + guava + provided + + + + com.fasterxml.jackson.core + jackson-databind + provided + + + com.fasterxml.jackson.core + jackson-core + provided + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + provided + + + + org.slf4j + slf4j-api + provided + + + + jakarta.validation + jakarta.validation-api + provided + + + + cn.hutool + hutool-all + + + + com.alibaba + transmittable-thread-local + + + + com.fhs-opensource + easy-trans-anno + + + + org.hibernate.validator + hibernate-validator + 8.0.1.Final + + + + + diff --git a/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/core/ArrayValuable.java b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/core/ArrayValuable.java new file mode 100644 index 0000000..58034f0 --- /dev/null +++ b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/core/ArrayValuable.java @@ -0,0 +1,15 @@ +package com.platform.marketing.framework.common.core; + +/** + * 可生成 T 数组的接口 + * + * @author HUIHUI + */ +public interface ArrayValuable { + + /** + * @return 数组 + */ + T[] array(); + +} \ No newline at end of file diff --git a/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/core/KeyValue.java b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/core/KeyValue.java new file mode 100644 index 0000000..dc243fa --- /dev/null +++ b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/core/KeyValue.java @@ -0,0 +1,22 @@ +package com.platform.marketing.framework.common.core; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * Key Value 的键值对 + * + + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class KeyValue implements Serializable { + + private K key; + private V value; + +} diff --git a/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/enums/CommonStatusEnum.java b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/enums/CommonStatusEnum.java new file mode 100644 index 0000000..6fa97c3 --- /dev/null +++ b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/enums/CommonStatusEnum.java @@ -0,0 +1,46 @@ +package com.platform.marketing.framework.common.enums; + +import cn.hutool.core.util.ObjUtil; +import com.platform.marketing.framework.common.core.ArrayValuable; +import lombok.AllArgsConstructor; +import lombok.Getter; + +import java.util.Arrays; + +/** + * 通用状态枚举 + * + + */ +@Getter +@AllArgsConstructor +public enum CommonStatusEnum implements ArrayValuable { + + ENABLE(0, "开启"), + DISABLE(1, "关闭"); + + public static final Integer[] ARRAYS = Arrays.stream(values()).map(CommonStatusEnum::getStatus).toArray(Integer[]::new); + + /** + * 状态值 + */ + private final Integer status; + /** + * 状态名 + */ + private final String name; + + @Override + public Integer[] array() { + return ARRAYS; + } + + public static boolean isEnable(Integer status) { + return ObjUtil.equal(ENABLE.status, status); + } + + public static boolean isDisable(Integer status) { + return ObjUtil.equal(DISABLE.status, status); + } + +} diff --git a/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/enums/DateIntervalEnum.java b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/enums/DateIntervalEnum.java new file mode 100644 index 0000000..226c2a9 --- /dev/null +++ b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/enums/DateIntervalEnum.java @@ -0,0 +1,46 @@ +package com.platform.marketing.framework.common.enums; + +import cn.hutool.core.util.ArrayUtil; +import com.platform.marketing.framework.common.core.ArrayValuable; +import lombok.AllArgsConstructor; +import lombok.Getter; + +import java.util.Arrays; + +/** + * 时间间隔的枚举 + * + * @author dhb52 + */ +@Getter +@AllArgsConstructor +public enum DateIntervalEnum implements ArrayValuable { + + DAY(1, "天"), + WEEK(2, "周"), + MONTH(3, "月"), + QUARTER(4, "季度"), + YEAR(5, "年") + ; + + public static final Integer[] ARRAYS = Arrays.stream(values()).map(DateIntervalEnum::getInterval).toArray(Integer[]::new); + + /** + * 类型 + */ + private final Integer interval; + /** + * 名称 + */ + private final String name; + + @Override + public Integer[] array() { + return ARRAYS; + } + + public static DateIntervalEnum valueOf(Integer interval) { + return ArrayUtil.firstMatch(item -> item.getInterval().equals(interval), DateIntervalEnum.values()); + } + +} \ No newline at end of file diff --git a/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/enums/TerminalEnum.java b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/enums/TerminalEnum.java new file mode 100644 index 0000000..bd1d333 --- /dev/null +++ b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/enums/TerminalEnum.java @@ -0,0 +1,40 @@ +package com.platform.marketing.framework.common.enums; + +import com.platform.marketing.framework.common.core.ArrayValuable; +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +import java.util.Arrays; + +/** + * 终端的枚举 + * + + */ +@RequiredArgsConstructor +@Getter +public enum TerminalEnum implements ArrayValuable { + + UNKNOWN(0, "未知"), // 目的:在无法解析到 terminal 时,使用它 + WECHAT_MINI_PROGRAM(10, "微信小程序"), + WECHAT_WAP(11, "微信公众号"), + H5(20, "H5 网页"), + APP(31, "手机 App"), + ; + + public static final Integer[] ARRAYS = Arrays.stream(values()).map(TerminalEnum::getTerminal).toArray(Integer[]::new); + + /** + * 终端 + */ + private final Integer terminal; + /** + * 终端名 + */ + private final String name; + + @Override + public Integer[] array() { + return ARRAYS; + } +} diff --git a/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/enums/UserTypeEnum.java b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/enums/UserTypeEnum.java new file mode 100644 index 0000000..51698a8 --- /dev/null +++ b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/enums/UserTypeEnum.java @@ -0,0 +1,41 @@ +package com.platform.marketing.framework.common.enums; + +import cn.hutool.core.util.ArrayUtil; +import com.platform.marketing.framework.common.core.ArrayValuable; +import lombok.AllArgsConstructor; +import lombok.Getter; + +import java.util.Arrays; + +/** + * 全局用户类型枚举 + */ +@AllArgsConstructor +@Getter +public enum UserTypeEnum implements ArrayValuable { + + MEMBER(1, "会员"), // 面向 c 端,普通用户 ,暂时占位,后续需要使用。 + + ADMIN(2, "管理员"); // 面向 b 端,管理后台 + + public static final Integer[] ARRAYS = Arrays.stream(values()).map(UserTypeEnum::getValue).toArray(Integer[]::new); + + + /** + * 类型 + */ + private final Integer value; + /** + * 类型名 + */ + private final String name; + + public static UserTypeEnum valueOf(Integer value) { + return ArrayUtil.firstMatch(userType -> userType.getValue().equals(value), UserTypeEnum.values()); + } + + @Override + public Integer[] array() { + return ARRAYS; + } +} diff --git a/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/enums/WebFilterOrderEnum.java b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/enums/WebFilterOrderEnum.java new file mode 100644 index 0000000..86b3c6b --- /dev/null +++ b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/enums/WebFilterOrderEnum.java @@ -0,0 +1,34 @@ +package com.platform.marketing.framework.common.enums; + +/** + * Web 过滤器顺序的枚举类,保证过滤器按照符合我们的预期 + * + * 考虑到每个 starter 都需要用到该工具类,所以放到 common 模块下的 enums 包下 + * + + */ +public interface WebFilterOrderEnum { + + int CORS_FILTER = Integer.MIN_VALUE; + + int TRACE_FILTER = CORS_FILTER + 1; + + int REQUEST_BODY_CACHE_FILTER = Integer.MIN_VALUE + 500; + + // OrderedRequestContextFilter 默认为 -105,用于国际化上下文等等 + + int TENANT_CONTEXT_FILTER = - 104; // 需要保证在 ApiAccessLogFilter 前面 + + int API_ACCESS_LOG_FILTER = -103; // 需要保证在 RequestBodyCacheFilter 后面 + + int XSS_FILTER = -102; // 需要保证在 RequestBodyCacheFilter 后面 + + // Spring Security Filter 默认为 -100,可见 org.springframework.boot.autoconfigure.security.SecurityProperties 配置属性类 + + int TENANT_SECURITY_FILTER = -99; // 需要保证在 Spring Security 过滤器后面 + + int FLOWABLE_FILTER = -98; // 需要保证在 Spring Security 过滤后面 + + int DEMO_FILTER = Integer.MAX_VALUE; + +} diff --git a/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/exception/ErrorCode.java b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/exception/ErrorCode.java new file mode 100644 index 0000000..b35c613 --- /dev/null +++ b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/exception/ErrorCode.java @@ -0,0 +1,32 @@ +package com.platform.marketing.framework.common.exception; + +import com.platform.marketing.framework.common.exception.enums.GlobalErrorCodeConstants; +import com.platform.marketing.framework.common.exception.enums.ServiceErrorCodeRange; +import lombok.Data; + +/** + * 错误码对象 + * + * 全局错误码,占用 [0, 999], 参见 {@link GlobalErrorCodeConstants} + * 业务异常错误码,占用 [1 000 000 000, +∞),参见 {@link ServiceErrorCodeRange} + * + * TODO 错误码设计成对象的原因,为未来的 i18 国际化做准备 + */ +@Data +public class ErrorCode { + + /** + * 错误码 + */ + private final Integer code; + /** + * 错误提示 + */ + private final String msg; + + public ErrorCode(Integer code, String message) { + this.code = code; + this.msg = message; + } + +} diff --git a/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/exception/ServerException.java b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/exception/ServerException.java new file mode 100644 index 0000000..b2be107 --- /dev/null +++ b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/exception/ServerException.java @@ -0,0 +1,60 @@ +package com.platform.marketing.framework.common.exception; + +import com.platform.marketing.framework.common.exception.enums.GlobalErrorCodeConstants; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 服务器异常 Exception + */ +@Data +@EqualsAndHashCode(callSuper = true) +public final class ServerException extends RuntimeException { + + /** + * 全局错误码 + * + * @see GlobalErrorCodeConstants + */ + private Integer code; + /** + * 错误提示 + */ + private String message; + + /** + * 空构造方法,避免反序列化问题 + */ + public ServerException() { + } + + public ServerException(ErrorCode errorCode) { + this.code = errorCode.getCode(); + this.message = errorCode.getMsg(); + } + + public ServerException(Integer code, String message) { + this.code = code; + this.message = message; + } + + public Integer getCode() { + return code; + } + + public ServerException setCode(Integer code) { + this.code = code; + return this; + } + + @Override + public String getMessage() { + return message; + } + + public ServerException setMessage(String message) { + this.message = message; + return this; + } + +} diff --git a/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/exception/ServiceException.java b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/exception/ServiceException.java new file mode 100644 index 0000000..b81b1f7 --- /dev/null +++ b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/exception/ServiceException.java @@ -0,0 +1,60 @@ +package com.platform.marketing.framework.common.exception; + +import com.platform.marketing.framework.common.exception.enums.ServiceErrorCodeRange; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 业务逻辑异常 Exception + */ +@Data +@EqualsAndHashCode(callSuper = true) +public final class ServiceException extends RuntimeException { + + /** + * 业务错误码 + * + * @see ServiceErrorCodeRange + */ + private Integer code; + /** + * 错误提示 + */ + private String message; + + /** + * 空构造方法,避免反序列化问题 + */ + public ServiceException() { + } + + public ServiceException(ErrorCode errorCode) { + this.code = errorCode.getCode(); + this.message = errorCode.getMsg(); + } + + public ServiceException(Integer code, String message) { + this.code = code; + this.message = message; + } + + public Integer getCode() { + return code; + } + + public ServiceException setCode(Integer code) { + this.code = code; + return this; + } + + @Override + public String getMessage() { + return message; + } + + public ServiceException setMessage(String message) { + this.message = message; + return this; + } + +} diff --git a/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/exception/enums/GlobalErrorCodeConstants.java b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/exception/enums/GlobalErrorCodeConstants.java new file mode 100644 index 0000000..b40b785 --- /dev/null +++ b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/exception/enums/GlobalErrorCodeConstants.java @@ -0,0 +1,41 @@ +package com.platform.marketing.framework.common.exception.enums; + +import com.platform.marketing.framework.common.exception.ErrorCode; + +/** + * 全局错误码枚举 + * 0-999 系统异常编码保留 + * + * 一般情况下,使用 HTTP 响应状态码 https://developer.mozilla.org/zh-CN/docs/Web/HTTP/Status + * 虽然说,HTTP 响应状态码作为业务使用表达能力偏弱,但是使用在系统层面还是非常不错的 + * 比较特殊的是,因为之前一直使用 0 作为成功,就不使用 200 啦。 + * + + */ +public interface GlobalErrorCodeConstants { + + ErrorCode SUCCESS = new ErrorCode(0, "成功"); + + // ========== 客户端错误段 ========== + + ErrorCode BAD_REQUEST = new ErrorCode(400, "请求参数不正确"); + ErrorCode UNAUTHORIZED = new ErrorCode(401, "账号未登录"); + ErrorCode FORBIDDEN = new ErrorCode(403, "没有该操作权限"); + ErrorCode NOT_FOUND = new ErrorCode(404, "请求未找到"); + ErrorCode METHOD_NOT_ALLOWED = new ErrorCode(405, "请求方法不正确"); + ErrorCode LOCKED = new ErrorCode(423, "请求失败,请稍后重试"); // 并发请求,不允许 + ErrorCode TOO_MANY_REQUESTS = new ErrorCode(429, "请求过于频繁,请稍后重试"); + + // ========== 服务端错误段 ========== + + ErrorCode INTERNAL_SERVER_ERROR = new ErrorCode(500, "系统异常"); + ErrorCode NOT_IMPLEMENTED = new ErrorCode(501, "功能未实现/未开启"); + ErrorCode ERROR_CONFIGURATION = new ErrorCode(502, "错误的配置项"); + + // ========== 自定义错误段 ========== + ErrorCode REPEATED_REQUESTS = new ErrorCode(900, "重复请求,请稍后重试"); // 重复请求 + ErrorCode DEMO_DENY = new ErrorCode(901, "演示模式,禁止写操作"); + + ErrorCode UNKNOWN = new ErrorCode(999, "未知错误"); + +} diff --git a/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/exception/enums/ServiceErrorCodeRange.java b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/exception/enums/ServiceErrorCodeRange.java new file mode 100644 index 0000000..2848660 --- /dev/null +++ b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/exception/enums/ServiceErrorCodeRange.java @@ -0,0 +1,48 @@ +package com.platform.marketing.framework.common.exception.enums; + +/** + * 业务异常的错误码区间,解决:解决各模块错误码定义,避免重复,在此只声明不做实际使用 + * + * 一共 10 位,分成四段 + * + * 第一段,1 位,类型 + * 1 - 业务级别异常 + * x - 预留 + * 第二段,3 位,系统类型 + * 001 - 用户系统 + * 002 - 商品系统 + * 003 - 订单系统 + * 004 - 支付系统 + * 005 - 优惠劵系统 + * ... - ... + * 第三段,3 位,模块 + * 不限制规则。 + * 一般建议,每个系统里面,可能有多个模块,可以再去做分段。以用户系统为例子: + * 001 - OAuth2 模块 + * 002 - User 模块 + * 003 - MobileCode 模块 + * 第四段,3 位,错误码 + * 不限制规则。 + * 一般建议,每个模块自增。 + * + + */ +public class ServiceErrorCodeRange { + + // 模块 infra 错误码区间 [1-001-000-000 ~ 1-002-000-000) + // 模块 system 错误码区间 [1-002-000-000 ~ 1-003-000-000) + // 模块 report 错误码区间 [1-003-000-000 ~ 1-004-000-000) + // 模块 member 错误码区间 [1-004-000-000 ~ 1-005-000-000) + // 模块 mp 错误码区间 [1-006-000-000 ~ 1-007-000-000) + // 模块 pay 错误码区间 [1-007-000-000 ~ 1-008-000-000) + // 模块 bpm 错误码区间 [1-009-000-000 ~ 1-010-000-000) + + // 模块 product 错误码区间 [1-008-000-000 ~ 1-009-000-000) + // 模块 trade 错误码区间 [1-011-000-000 ~ 1-012-000-000) + // 模块 promotion 错误码区间 [1-013-000-000 ~ 1-014-000-000) + + // 模块 crm 错误码区间 [1-020-000-000 ~ 1-021-000-000) + + // 模块 oneapi 错误码区间 [1-022-000-000 ~ 1-023-000-000) + +} diff --git a/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/exception/util/ServiceExceptionUtil.java b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/exception/util/ServiceExceptionUtil.java new file mode 100644 index 0000000..c3f68c4 --- /dev/null +++ b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/exception/util/ServiceExceptionUtil.java @@ -0,0 +1,77 @@ +package com.platform.marketing.framework.common.exception.util; + +import com.platform.marketing.framework.common.exception.ErrorCode; +import com.platform.marketing.framework.common.exception.ServiceException; +import com.platform.marketing.framework.common.exception.enums.GlobalErrorCodeConstants; +import com.google.common.annotations.VisibleForTesting; +import lombok.extern.slf4j.Slf4j; + +/** + * {@link ServiceException} 工具类 + * + * 目的在于,格式化异常信息提示。 + * 考虑到 String.format 在参数不正确时会报错,因此使用 {} 作为占位符,并使用 {@link #doFormat(int, String, Object...)} 方法来格式化 + * + */ +@Slf4j +public class ServiceExceptionUtil { + + // ========== 和 ServiceException 的集成 ========== + + public static ServiceException exception(ErrorCode errorCode) { + return exception0(errorCode.getCode(), errorCode.getMsg()); + } + + public static ServiceException exception(ErrorCode errorCode, Object... params) { + return exception0(errorCode.getCode(), errorCode.getMsg(), params); + } + + public static ServiceException exception0(Integer code, String messagePattern, Object... params) { + String message = doFormat(code, messagePattern, params); + return new ServiceException(code, message); + } + + public static ServiceException invalidParamException(String messagePattern, Object... params) { + return exception0(GlobalErrorCodeConstants.BAD_REQUEST.getCode(), messagePattern, params); + } + + // ========== 格式化方法 ========== + + /** + * 将错误编号对应的消息使用 params 进行格式化。 + * + * @param code 错误编号 + * @param messagePattern 消息模版 + * @param params 参数 + * @return 格式化后的提示 + */ + @VisibleForTesting + public static String doFormat(int code, String messagePattern, Object... params) { + StringBuilder sbuf = new StringBuilder(messagePattern.length() + 50); + int i = 0; + int j; + int l; + for (l = 0; l < params.length; l++) { + j = messagePattern.indexOf("{}", i); + if (j == -1) { + log.error("[doFormat][参数过多:错误码({})|错误内容({})|参数({})", code, messagePattern, params); + if (i == 0) { + return messagePattern; + } else { + sbuf.append(messagePattern.substring(i)); + return sbuf.toString(); + } + } else { + sbuf.append(messagePattern, i, j); + sbuf.append(params[l]); + i = j + 2; + } + } + if (messagePattern.indexOf("{}", i) != -1) { + log.error("[doFormat][参数过少:错误码({})|错误内容({})|参数({})", code, messagePattern, params); + } + sbuf.append(messagePattern.substring(i)); + return sbuf.toString(); + } + +} diff --git a/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/pojo/CommonResult.java b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/pojo/CommonResult.java new file mode 100644 index 0000000..2c5d26d --- /dev/null +++ b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/pojo/CommonResult.java @@ -0,0 +1,121 @@ +package com.platform.marketing.framework.common.pojo; + +import cn.hutool.core.lang.Assert; +import com.platform.marketing.framework.common.exception.ErrorCode; +import com.platform.marketing.framework.common.exception.ServiceException; +import com.platform.marketing.framework.common.exception.enums.GlobalErrorCodeConstants; +import com.platform.marketing.framework.common.exception.util.ServiceExceptionUtil; +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; + +import java.io.Serializable; +import java.util.Objects; + +/** + * 通用返回 + * + * @param 数据泛型 + */ +@Data +public class CommonResult implements Serializable { + + /** + * 错误码 + * + * @see ErrorCode#getCode() + */ + private Integer code; + /** + * 返回数据 + */ + private T data; + /** + * 错误提示,用户可阅读 + * + * @see ErrorCode#getMsg() () + */ + private String msg; + + /** + * 将传入的 result 对象,转换成另外一个泛型结果的对象 + * + * 因为 A 方法返回的 CommonResult 对象,不满足调用其的 B 方法的返回,所以需要进行转换。 + * + * @param result 传入的 result 对象 + * @param 返回的泛型 + * @return 新的 CommonResult 对象 + */ + public static CommonResult error(CommonResult result) { + return error(result.getCode(), result.getMsg()); + } + + public static CommonResult error(Integer code, String message) { + Assert.notEquals(GlobalErrorCodeConstants.SUCCESS.getCode(), code, "code 必须是错误的!"); + CommonResult result = new CommonResult<>(); + result.code = code; + result.msg = message; + return result; + } + + public static CommonResult error(ErrorCode errorCode, Object... params) { + Assert.notEquals(GlobalErrorCodeConstants.SUCCESS.getCode(), errorCode.getCode(), "code 必须是错误的!"); + CommonResult result = new CommonResult<>(); + result.code = errorCode.getCode(); + result.msg = ServiceExceptionUtil.doFormat(errorCode.getCode(), errorCode.getMsg(), params); + return result; + } + + public static CommonResult error(ErrorCode errorCode) { + return error(errorCode.getCode(), errorCode.getMsg()); + } + + public static CommonResult success(T data) { + CommonResult result = new CommonResult<>(); + result.code = GlobalErrorCodeConstants.SUCCESS.getCode(); + result.data = data; + result.msg = ""; + return result; + } + + public static boolean isSuccess(Integer code) { + return Objects.equals(code, GlobalErrorCodeConstants.SUCCESS.getCode()); + } + + @JsonIgnore // 避免 jackson 序列化 + public boolean isSuccess() { + return isSuccess(code); + } + + @JsonIgnore // 避免 jackson 序列化 + public boolean isError() { + return !isSuccess(); + } + + // ========= 和 Exception 异常体系集成 ========= + + /** + * 判断是否有异常。如果有,则抛出 {@link ServiceException} 异常 + */ + public void checkError() throws ServiceException { + if (isSuccess()) { + return; + } + // 业务异常 + throw new ServiceException(code, msg); + } + + /** + * 判断是否有异常。如果有,则抛出 {@link ServiceException} 异常 + * 如果没有,则返回 {@link #data} 数据 + */ + @JsonIgnore // 避免 jackson 序列化 + public T getCheckedData() { + checkError(); + return data; + } + + public static CommonResult error(ServiceException serviceException) { + return error(serviceException.getCode(), serviceException.getMessage()); + } + +} diff --git a/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/pojo/PageParam.java b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/pojo/PageParam.java new file mode 100644 index 0000000..b70cc84 --- /dev/null +++ b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/pojo/PageParam.java @@ -0,0 +1,36 @@ +package com.platform.marketing.framework.common.pojo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import javax.validation.constraints.Min; +import javax.validation.constraints.Max; +import javax.validation.constraints.NotNull; +import java.io.Serializable; + +@Schema(description="分页参数") +@Data +public class PageParam implements Serializable { + + private static final Integer PAGE_NO = 1; + private static final Integer PAGE_SIZE = 10; + + /** + * 每页条数 - 不分页 + * + * 例如说,导出接口,可以设置 {@link #pageSize} 为 -1 不分页,查询所有数据。 + */ + public static final Integer PAGE_SIZE_NONE = -1; + + @Schema(description = "页码,从 1 开始", requiredMode = Schema.RequiredMode.REQUIRED,example = "1") + @NotNull(message = "页码不能为空") + @Min(value = 1, message = "页码最小值为 1") + private Integer pageNo = PAGE_NO; + + @Schema(description = "每页条数,最大值为 100", requiredMode = Schema.RequiredMode.REQUIRED, example = "10") + @NotNull(message = "每页条数不能为空") + @Min(value = 1, message = "每页条数最小值为 1") + @Max(value = 100, message = "每页条数最大值为 100") + private Integer pageSize = PAGE_SIZE; + +} diff --git a/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/pojo/PageResult.java b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/pojo/PageResult.java new file mode 100644 index 0000000..0848934 --- /dev/null +++ b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/pojo/PageResult.java @@ -0,0 +1,41 @@ +package com.platform.marketing.framework.common.pojo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +@Schema(description = "分页结果") +@Data +public final class PageResult implements Serializable { + + @Schema(description = "数据", requiredMode = Schema.RequiredMode.REQUIRED) + private List list; + + @Schema(description = "总量", requiredMode = Schema.RequiredMode.REQUIRED) + private Long total; + + public PageResult() { + } + + public PageResult(List list, Long total) { + this.list = list; + this.total = total; + } + + public PageResult(Long total) { + this.list = new ArrayList<>(); + this.total = total; + } + + public static PageResult empty() { + return new PageResult<>(0L); + } + + public static PageResult empty(Long total) { + return new PageResult<>(total); + } + +} diff --git a/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/pojo/SortablePageParam.java b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/pojo/SortablePageParam.java new file mode 100644 index 0000000..17124f1 --- /dev/null +++ b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/pojo/SortablePageParam.java @@ -0,0 +1,19 @@ +package com.platform.marketing.framework.common.pojo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +import java.util.List; + +@Schema(description = "可排序的分页参数") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class SortablePageParam extends PageParam { + + @Schema(description = "排序字段") + private List sortingFields; + +} \ No newline at end of file diff --git a/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/pojo/SortingField.java b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/pojo/SortingField.java new file mode 100644 index 0000000..f914ded --- /dev/null +++ b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/pojo/SortingField.java @@ -0,0 +1,37 @@ +package com.platform.marketing.framework.common.pojo; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 排序字段 DTO + * + * 类名加了 ing 的原因是,避免和 ES SortField 重名。 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class SortingField implements Serializable { + + /** + * 顺序 - 升序 + */ + public static final String ORDER_ASC = "asc"; + /** + * 顺序 - 降序 + */ + public static final String ORDER_DESC = "desc"; + + /** + * 字段 + */ + private String field; + /** + * 顺序 + */ + private String order; + +} diff --git a/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/cache/CacheUtils.java b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/cache/CacheUtils.java new file mode 100644 index 0000000..c9d8a14 --- /dev/null +++ b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/cache/CacheUtils.java @@ -0,0 +1,49 @@ +package com.platform.marketing.framework.common.util.cache; + +import com.google.common.cache.CacheBuilder; +import com.google.common.cache.CacheLoader; +import com.google.common.cache.LoadingCache; + +import java.time.Duration; +import java.util.concurrent.Executors; + +/** + * Cache 工具类 + * + + */ +public class CacheUtils { + + /** + * 构建异步刷新的 LoadingCache 对象 + * + * 注意:如果你的缓存和 ThreadLocal 有关系,要么自己处理 ThreadLocal 的传递,要么使用 {@link #buildCache(Duration, CacheLoader)} 方法 + * + * 或者简单理解: + * 1、和“人”相关的,使用 {@link #buildCache(Duration, CacheLoader)} 方法 + * 2、和“全局”、“系统”相关的,使用当前缓存方法 + * + * @param duration 过期时间 + * @param loader CacheLoader 对象 + * @return LoadingCache 对象 + */ + public static LoadingCache buildAsyncReloadingCache(Duration duration, CacheLoader loader) { + return CacheBuilder.newBuilder() + // 只阻塞当前数据加载线程,其他线程返回旧值 + .refreshAfterWrite(duration) + // 通过 asyncReloading 实现全异步加载,包括 refreshAfterWrite 被阻塞的加载线程 + .build(CacheLoader.asyncReloading(loader, Executors.newCachedThreadPool())); // TODO 芋艿:可能要思考下,未来要不要做成可配置 + } + + /** + * 构建同步刷新的 LoadingCache 对象 + * + * @param duration 过期时间 + * @param loader CacheLoader 对象 + * @return LoadingCache 对象 + */ + public static LoadingCache buildCache(Duration duration, CacheLoader loader) { + return CacheBuilder.newBuilder().refreshAfterWrite(duration).build(loader); + } + +} diff --git a/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/collection/ArrayUtils.java b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/collection/ArrayUtils.java new file mode 100644 index 0000000..b994cdb --- /dev/null +++ b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/collection/ArrayUtils.java @@ -0,0 +1,58 @@ +package com.platform.marketing.framework.common.util.collection; + +import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.collection.IterUtil; +import cn.hutool.core.util.ArrayUtil; + +import java.util.Collection; +import java.util.function.Consumer; +import java.util.function.Function; + +import static com.platform.marketing.framework.common.util.collection.CollectionUtils.convertList; + +/** + * Array 工具类 + * + + */ +public class ArrayUtils { + + /** + * 将 object 和 newElements 合并成一个数组 + * + * @param object 对象 + * @param newElements 数组 + * @param 泛型 + * @return 结果数组 + */ + @SafeVarargs + public static Consumer[] append(Consumer object, Consumer... newElements) { + if (object == null) { + return newElements; + } + Consumer[] result = ArrayUtil.newArray(Consumer.class, 1 + newElements.length); + result[0] = object; + System.arraycopy(newElements, 0, result, 1, newElements.length); + return result; + } + + public static V[] toArray(Collection from, Function mapper) { + return toArray(convertList(from, mapper)); + } + + @SuppressWarnings("unchecked") + public static T[] toArray(Collection from) { + if (CollectionUtil.isEmpty(from)) { + return (T[]) (new Object[0]); + } + return ArrayUtil.toArray(from, (Class) IterUtil.getElementType(from.iterator())); + } + + public static T get(T[] array, int index) { + if (null == array || index >= array.length) { + return null; + } + return array[index]; + } + +} diff --git a/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/collection/CollectionUtils.java b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/collection/CollectionUtils.java new file mode 100644 index 0000000..c46c28f --- /dev/null +++ b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/collection/CollectionUtils.java @@ -0,0 +1,338 @@ +package com.platform.marketing.framework.common.util.collection; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.util.ArrayUtil; +import com.platform.marketing.framework.common.pojo.PageResult; +import com.google.common.collect.ImmutableMap; + +import java.util.*; +import java.util.function.*; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import static java.util.Arrays.asList; + +/** + * Collection 工具类 + * + + */ +public class CollectionUtils { + + public static boolean containsAny(Object source, Object... targets) { + return asList(targets).contains(source); + } + + public static boolean isAnyEmpty(Collection... collections) { + return Arrays.stream(collections).anyMatch(CollectionUtil::isEmpty); + } + + public static boolean anyMatch(Collection from, Predicate predicate) { + return from.stream().anyMatch(predicate); + } + + public static List filterList(Collection from, Predicate predicate) { + if (CollUtil.isEmpty(from)) { + return new ArrayList<>(); + } + return from.stream().filter(predicate).collect(Collectors.toList()); + } + + public static List distinct(Collection from, Function keyMapper) { + if (CollUtil.isEmpty(from)) { + return new ArrayList<>(); + } + return distinct(from, keyMapper, (t1, t2) -> t1); + } + + public static List distinct(Collection from, Function keyMapper, BinaryOperator cover) { + if (CollUtil.isEmpty(from)) { + return new ArrayList<>(); + } + return new ArrayList<>(convertMap(from, keyMapper, Function.identity(), cover).values()); + } + + public static List convertList(T[] from, Function func) { + if (ArrayUtil.isEmpty(from)) { + return new ArrayList<>(); + } + return convertList(Arrays.asList(from), func); + } + + public static List convertList(Collection from, Function func) { + if (CollUtil.isEmpty(from)) { + return new ArrayList<>(); + } + return from.stream().map(func).filter(Objects::nonNull).collect(Collectors.toList()); + } + + public static List convertList(Collection from, Function func, Predicate filter) { + if (CollUtil.isEmpty(from)) { + return new ArrayList<>(); + } + return from.stream().filter(filter).map(func).filter(Objects::nonNull).collect(Collectors.toList()); + } + + public static PageResult convertPage(PageResult from, Function func) { + if (ArrayUtil.isEmpty(from)) { + return new PageResult<>(from.getTotal()); + } + return new PageResult<>(convertList(from.getList(), func), from.getTotal()); + } + + public static List convertListByFlatMap(Collection from, + Function> func) { + if (CollUtil.isEmpty(from)) { + return new ArrayList<>(); + } + return from.stream().filter(Objects::nonNull).flatMap(func).filter(Objects::nonNull).collect(Collectors.toList()); + } + + public static List convertListByFlatMap(Collection from, + Function mapper, + Function> func) { + if (CollUtil.isEmpty(from)) { + return new ArrayList<>(); + } + return from.stream().map(mapper).filter(Objects::nonNull).flatMap(func).filter(Objects::nonNull).collect(Collectors.toList()); + } + + public static List mergeValuesFromMap(Map> map) { + return map.values() + .stream() + .flatMap(List::stream) + .collect(Collectors.toList()); + } + + public static Set convertSet(Collection from) { + return convertSet(from, v -> v); + } + + public static Set convertSet(Collection from, Function func) { + if (CollUtil.isEmpty(from)) { + return new HashSet<>(); + } + return from.stream().map(func).filter(Objects::nonNull).collect(Collectors.toSet()); + } + + public static Set convertSet(Collection from, Function func, Predicate filter) { + if (CollUtil.isEmpty(from)) { + return new HashSet<>(); + } + return from.stream().filter(filter).map(func).filter(Objects::nonNull).collect(Collectors.toSet()); + } + + public static Map convertMapByFilter(Collection from, Predicate filter, Function keyFunc) { + if (CollUtil.isEmpty(from)) { + return new HashMap<>(); + } + return from.stream().filter(filter).collect(Collectors.toMap(keyFunc, v -> v)); + } + + public static Set convertSetByFlatMap(Collection from, + Function> func) { + if (CollUtil.isEmpty(from)) { + return new HashSet<>(); + } + return from.stream().filter(Objects::nonNull).flatMap(func).filter(Objects::nonNull).collect(Collectors.toSet()); + } + + public static Set convertSetByFlatMap(Collection from, + Function mapper, + Function> func) { + if (CollUtil.isEmpty(from)) { + return new HashSet<>(); + } + return from.stream().map(mapper).filter(Objects::nonNull).flatMap(func).filter(Objects::nonNull).collect(Collectors.toSet()); + } + + public static Map convertMap(Collection from, Function keyFunc) { + if (CollUtil.isEmpty(from)) { + return new HashMap<>(); + } + return convertMap(from, keyFunc, Function.identity()); + } + + public static Map convertMap(Collection from, Function keyFunc, Supplier> supplier) { + if (CollUtil.isEmpty(from)) { + return supplier.get(); + } + return convertMap(from, keyFunc, Function.identity(), supplier); + } + + public static Map convertMap(Collection from, Function keyFunc, Function valueFunc) { + if (CollUtil.isEmpty(from)) { + return new HashMap<>(); + } + return convertMap(from, keyFunc, valueFunc, (v1, v2) -> v1); + } + + public static Map convertMap(Collection from, Function keyFunc, Function valueFunc, BinaryOperator mergeFunction) { + if (CollUtil.isEmpty(from)) { + return new HashMap<>(); + } + return convertMap(from, keyFunc, valueFunc, mergeFunction, HashMap::new); + } + + public static Map convertMap(Collection from, Function keyFunc, Function valueFunc, Supplier> supplier) { + if (CollUtil.isEmpty(from)) { + return supplier.get(); + } + return convertMap(from, keyFunc, valueFunc, (v1, v2) -> v1, supplier); + } + + public static Map convertMap(Collection from, Function keyFunc, Function valueFunc, BinaryOperator mergeFunction, Supplier> supplier) { + if (CollUtil.isEmpty(from)) { + return new HashMap<>(); + } + return from.stream().collect(Collectors.toMap(keyFunc, valueFunc, mergeFunction, supplier)); + } + + public static Map> convertMultiMap(Collection from, Function keyFunc) { + if (CollUtil.isEmpty(from)) { + return new HashMap<>(); + } + return from.stream().collect(Collectors.groupingBy(keyFunc, Collectors.mapping(t -> t, Collectors.toList()))); + } + + public static Map> convertMultiMap(Collection from, Function keyFunc, Function valueFunc) { + if (CollUtil.isEmpty(from)) { + return new HashMap<>(); + } + return from.stream() + .collect(Collectors.groupingBy(keyFunc, Collectors.mapping(valueFunc, Collectors.toList()))); + } + + // 暂时没想好名字,先以 2 结尾噶 + public static Map> convertMultiMap2(Collection from, Function keyFunc, Function valueFunc) { + if (CollUtil.isEmpty(from)) { + return new HashMap<>(); + } + return from.stream().collect(Collectors.groupingBy(keyFunc, Collectors.mapping(valueFunc, Collectors.toSet()))); + } + + public static Map convertImmutableMap(Collection from, Function keyFunc) { + if (CollUtil.isEmpty(from)) { + return Collections.emptyMap(); + } + ImmutableMap.Builder builder = ImmutableMap.builder(); + from.forEach(item -> builder.put(keyFunc.apply(item), item)); + return builder.build(); + } + + /** + * 对比老、新两个列表,找出新增、修改、删除的数据 + * + * @param oldList 老列表 + * @param newList 新列表 + * @param sameFunc 对比函数,返回 true 表示相同,返回 false 表示不同 + * 注意,same 是通过每个元素的“标识”,判断它们是不是同一个数据 + * @return [新增列表、修改列表、删除列表] + */ + public static List> diffList(Collection oldList, Collection newList, + BiFunction sameFunc) { + List createList = new LinkedList<>(newList); // 默认都认为是新增的,后续会进行移除 + List updateList = new ArrayList<>(); + List deleteList = new ArrayList<>(); + + // 通过以 oldList 为主遍历,找出 updateList 和 deleteList + for (T oldObj : oldList) { + // 1. 寻找是否有匹配的 + T foundObj = null; + for (Iterator iterator = createList.iterator(); iterator.hasNext(); ) { + T newObj = iterator.next(); + // 1.1 不匹配,则直接跳过 + if (!sameFunc.apply(oldObj, newObj)) { + continue; + } + // 1.2 匹配,则移除,并结束寻找 + iterator.remove(); + foundObj = newObj; + break; + } + // 2. 匹配添加到 updateList;不匹配则添加到 deleteList 中 + if (foundObj != null) { + updateList.add(foundObj); + } else { + deleteList.add(oldObj); + } + } + return asList(createList, updateList, deleteList); + } + + public static boolean containsAny(Collection source, Collection candidates) { + return org.springframework.util.CollectionUtils.containsAny(source, candidates); + } + + public static T getFirst(List from) { + return !CollectionUtil.isEmpty(from) ? from.get(0) : null; + } + + public static T findFirst(Collection from, Predicate predicate) { + return findFirst(from, predicate, Function.identity()); + } + + public static U findFirst(Collection from, Predicate predicate, Function func) { + if (CollUtil.isEmpty(from)) { + return null; + } + return from.stream().filter(predicate).findFirst().map(func).orElse(null); + } + + public static > V getMaxValue(Collection from, Function valueFunc) { + if (CollUtil.isEmpty(from)) { + return null; + } + assert !from.isEmpty(); // 断言,避免告警 + T t = from.stream().max(Comparator.comparing(valueFunc)).get(); + return valueFunc.apply(t); + } + + public static > V getMinValue(List from, Function valueFunc) { + if (CollUtil.isEmpty(from)) { + return null; + } + assert from.size() > 0; // 断言,避免告警 + T t = from.stream().min(Comparator.comparing(valueFunc)).get(); + return valueFunc.apply(t); + } + + public static > T getMinObject(List from, Function valueFunc) { + if (CollUtil.isEmpty(from)) { + return null; + } + assert from.size() > 0; // 断言,避免告警 + return from.stream().min(Comparator.comparing(valueFunc)).get(); + } + + public static > V getSumValue(Collection from, Function valueFunc, + BinaryOperator accumulator) { + return getSumValue(from, valueFunc, accumulator, null); + } + + public static > V getSumValue(Collection from, Function valueFunc, + BinaryOperator accumulator, V defaultValue) { + if (CollUtil.isEmpty(from)) { + return defaultValue; + } + assert !from.isEmpty(); // 断言,避免告警 + return from.stream().map(valueFunc).filter(Objects::nonNull).reduce(accumulator).orElse(defaultValue); + } + + public static void addIfNotNull(Collection coll, T item) { + if (item == null) { + return; + } + coll.add(item); + } + + public static Collection singleton(T obj) { + return obj == null ? Collections.emptyList() : Collections.singleton(obj); + } + + public static List newArrayList(List> list) { + return list.stream().filter(Objects::nonNull).flatMap(Collection::stream).collect(Collectors.toList()); + } + +} \ No newline at end of file diff --git a/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/collection/MapUtils.java b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/collection/MapUtils.java new file mode 100644 index 0000000..1b8afd6 --- /dev/null +++ b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/collection/MapUtils.java @@ -0,0 +1,68 @@ +package com.platform.marketing.framework.common.util.collection; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.util.ObjUtil; +import com.platform.marketing.framework.common.core.KeyValue; +import com.google.common.collect.Maps; +import com.google.common.collect.Multimap; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.Map; +import java.util.function.Consumer; + +/** + * Map 工具类 + * + + */ +public class MapUtils { + + /** + * 从哈希表表中,获得 keys 对应的所有 value 数组 + * + * @param multimap 哈希表 + * @param keys keys + * @return value 数组 + */ + public static List getList(Multimap multimap, Collection keys) { + List result = new ArrayList<>(); + keys.forEach(k -> { + Collection values = multimap.get(k); + if (CollectionUtil.isEmpty(values)) { + return; + } + result.addAll(values); + }); + return result; + } + + /** + * 从哈希表查找到 key 对应的 value,然后进一步处理 + * key 为 null 时, 不处理 + * 注意,如果查找到的 value 为 null 时,不进行处理 + * + * @param map 哈希表 + * @param key key + * @param consumer 进一步处理的逻辑 + */ + public static void findAndThen(Map map, K key, Consumer consumer) { + if (ObjUtil.isNull(key) || CollUtil.isEmpty(map)) { + return; + } + V value = map.get(key); + if (value == null) { + return; + } + consumer.accept(value); + } + + public static Map convertMap(List> keyValues) { + Map map = Maps.newLinkedHashMapWithExpectedSize(keyValues.size()); + keyValues.forEach(keyValue -> map.put(keyValue.getKey(), keyValue.getValue())); + return map; + } + +} diff --git a/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/collection/SetUtils.java b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/collection/SetUtils.java new file mode 100644 index 0000000..975a44c --- /dev/null +++ b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/collection/SetUtils.java @@ -0,0 +1,19 @@ +package com.platform.marketing.framework.common.util.collection; + +import cn.hutool.core.collection.CollUtil; + +import java.util.Set; + +/** + * Set 工具类 + * + + */ +public class SetUtils { + + @SafeVarargs + public static Set asSet(T... objs) { + return CollUtil.newHashSet(objs); + } + +} diff --git a/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/date/DateUtils.java b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/date/DateUtils.java new file mode 100644 index 0000000..957d876 --- /dev/null +++ b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/date/DateUtils.java @@ -0,0 +1,149 @@ +package com.platform.marketing.framework.common.util.date; + +import cn.hutool.core.date.LocalDateTimeUtil; + +import java.time.*; +import java.util.Calendar; +import java.util.Date; + +/** + * 时间工具类 + * + + */ +public class DateUtils { + + /** + * 时区 - 默认 + */ + public static final String TIME_ZONE_DEFAULT = "GMT+8"; + + /** + * 秒转换成毫秒 + */ + public static final long SECOND_MILLIS = 1000; + + public static final String FORMAT_YEAR_MONTH_DAY = "yyyy-MM-dd"; + + public static final String FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND = "yyyy-MM-dd HH:mm:ss"; + + /** + * 将 LocalDateTime 转换成 Date + * + * @param date LocalDateTime + * @return LocalDateTime + */ + public static Date of(LocalDateTime date) { + if (date == null) { + return null; + } + // 将此日期时间与时区相结合以创建 ZonedDateTime + ZonedDateTime zonedDateTime = date.atZone(ZoneId.systemDefault()); + // 本地时间线 LocalDateTime 到即时时间线 Instant 时间戳 + Instant instant = zonedDateTime.toInstant(); + // UTC时间(世界协调时间,UTC + 00:00)转北京(北京,UTC + 8:00)时间 + return Date.from(instant); + } + + /** + * 将 Date 转换成 LocalDateTime + * + * @param date Date + * @return LocalDateTime + */ + public static LocalDateTime of(Date date) { + if (date == null) { + return null; + } + // 转为时间戳 + Instant instant = date.toInstant(); + // UTC时间(世界协调时间,UTC + 00:00)转北京(北京,UTC + 8:00)时间 + return LocalDateTime.ofInstant(instant, ZoneId.systemDefault()); + } + + public static Date addTime(Duration duration) { + return new Date(System.currentTimeMillis() + duration.toMillis()); + } + + public static boolean isExpired(LocalDateTime time) { + LocalDateTime now = LocalDateTime.now(); + return now.isAfter(time); + } + + /** + * 创建指定时间 + * + * @param year 年 + * @param mouth 月 + * @param day 日 + * @return 指定时间 + */ + public static Date buildTime(int year, int mouth, int day) { + return buildTime(year, mouth, day, 0, 0, 0); + } + + /** + * 创建指定时间 + * + * @param year 年 + * @param mouth 月 + * @param day 日 + * @param hour 小时 + * @param minute 分钟 + * @param second 秒 + * @return 指定时间 + */ + public static Date buildTime(int year, int mouth, int day, + int hour, int minute, int second) { + Calendar calendar = Calendar.getInstance(); + calendar.set(Calendar.YEAR, year); + calendar.set(Calendar.MONTH, mouth - 1); + calendar.set(Calendar.DAY_OF_MONTH, day); + calendar.set(Calendar.HOUR_OF_DAY, hour); + calendar.set(Calendar.MINUTE, minute); + calendar.set(Calendar.SECOND, second); + calendar.set(Calendar.MILLISECOND, 0); // 一般情况下,都是 0 毫秒 + return calendar.getTime(); + } + + public static Date max(Date a, Date b) { + if (a == null) { + return b; + } + if (b == null) { + return a; + } + return a.compareTo(b) > 0 ? a : b; + } + + public static LocalDateTime max(LocalDateTime a, LocalDateTime b) { + if (a == null) { + return b; + } + if (b == null) { + return a; + } + return a.isAfter(b) ? a : b; + } + + /** + * 是否今天 + * + * @param date 日期 + * @return 是否 + */ + public static boolean isToday(LocalDateTime date) { + return LocalDateTimeUtil.isSameDay(date, LocalDateTime.now()); + } + + /** + * 是否昨天 + * + * @param date 日期 + * @return 是否 + */ + public static boolean isYesterday(LocalDateTime date) { + return LocalDateTimeUtil.isSameDay(date, LocalDateTime.now().minusDays(1)); + } + +} diff --git a/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/date/LocalDateTimeUtils.java b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/date/LocalDateTimeUtils.java new file mode 100644 index 0000000..693435d --- /dev/null +++ b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/date/LocalDateTimeUtils.java @@ -0,0 +1,309 @@ +package com.platform.marketing.framework.common.util.date; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.date.DatePattern; +import cn.hutool.core.date.LocalDateTimeUtil; +import cn.hutool.core.lang.Assert; +import cn.hutool.core.util.StrUtil; +import com.platform.marketing.framework.common.enums.DateIntervalEnum; + +import java.time.*; +import java.time.format.DateTimeParseException; +import java.time.temporal.ChronoUnit; +import java.time.temporal.TemporalAdjusters; +import java.util.ArrayList; +import java.util.List; + +/** + * 时间工具类,用于 {@link java.time.LocalDateTime} + * + + */ +public class LocalDateTimeUtils { + + /** + * 空的 LocalDateTime 对象,主要用于 DB 唯一索引的默认值 + */ + public static LocalDateTime EMPTY = buildTime(1970, 1, 1); + + /** + * 解析时间 + * + * 相比 {@link LocalDateTimeUtil#parse(CharSequence)} 方法来说,会尽量去解析,直到成功 + * + * @param time 时间 + * @return 时间字符串 + */ + public static LocalDateTime parse(String time) { + try { + return LocalDateTimeUtil.parse(time, DatePattern.NORM_DATE_PATTERN); + } catch (DateTimeParseException e) { + return LocalDateTimeUtil.parse(time); + } + } + + public static LocalDateTime addTime(Duration duration) { + return LocalDateTime.now().plus(duration); + } + + public static LocalDateTime minusTime(Duration duration) { + return LocalDateTime.now().minus(duration); + } + + public static boolean beforeNow(LocalDateTime date) { + return date.isBefore(LocalDateTime.now()); + } + + public static boolean afterNow(LocalDateTime date) { + return date.isAfter(LocalDateTime.now()); + } + + /** + * 创建指定时间 + * + * @param year 年 + * @param mouth 月 + * @param day 日 + * @return 指定时间 + */ + public static LocalDateTime buildTime(int year, int mouth, int day) { + return LocalDateTime.of(year, mouth, day, 0, 0, 0); + } + + public static LocalDateTime[] buildBetweenTime(int year1, int mouth1, int day1, + int year2, int mouth2, int day2) { + return new LocalDateTime[]{buildTime(year1, mouth1, day1), buildTime(year2, mouth2, day2)}; + } + + /** + * 判指定断时间,是否在该时间范围内 + * + * @param startTime 开始时间 + * @param endTime 结束时间 + * @param time 指定时间 + * @return 是否 + */ + public static boolean isBetween(LocalDateTime startTime, LocalDateTime endTime, String time) { + if (startTime == null || endTime == null || time == null) { + return false; + } + return LocalDateTimeUtil.isIn(parse(time), startTime, endTime); + } + + /** + * 判断当前时间是否在该时间范围内 + * + * @param startTime 开始时间 + * @param endTime 结束时间 + * @return 是否 + */ + public static boolean isBetween(LocalDateTime startTime, LocalDateTime endTime) { + if (startTime == null || endTime == null) { + return false; + } + return LocalDateTimeUtil.isIn(LocalDateTime.now(), startTime, endTime); + } + + /** + * 判断当前时间是否在该时间范围内 + * + * @param startTime 开始时间 + * @param endTime 结束时间 + * @return 是否 + */ + public static boolean isBetween(String startTime, String endTime) { + if (startTime == null || endTime == null) { + return false; + } + LocalDate nowDate = LocalDate.now(); + return LocalDateTimeUtil.isIn(LocalDateTime.now(), + LocalDateTime.of(nowDate, LocalTime.parse(startTime)), + LocalDateTime.of(nowDate, LocalTime.parse(endTime))); + } + + /** + * 判断时间段是否重叠 + * + * @param startTime1 开始 time1 + * @param endTime1 结束 time1 + * @param startTime2 开始 time2 + * @param endTime2 结束 time2 + * @return 重叠:true 不重叠:false + */ + public static boolean isOverlap(LocalTime startTime1, LocalTime endTime1, LocalTime startTime2, LocalTime endTime2) { + LocalDate nowDate = LocalDate.now(); + return LocalDateTimeUtil.isOverlap(LocalDateTime.of(nowDate, startTime1), LocalDateTime.of(nowDate, endTime1), + LocalDateTime.of(nowDate, startTime2), LocalDateTime.of(nowDate, endTime2)); + } + + /** + * 获取指定日期所在的月份的开始时间 + * 例如:2023-09-30 00:00:00,000 + * + * @param date 日期 + * @return 月份的开始时间 + */ + public static LocalDateTime beginOfMonth(LocalDateTime date) { + return date.with(TemporalAdjusters.firstDayOfMonth()).with(LocalTime.MIN); + } + + /** + * 获取指定日期所在的月份的最后时间 + * 例如:2023-09-30 23:59:59,999 + * + * @param date 日期 + * @return 月份的结束时间 + */ + public static LocalDateTime endOfMonth(LocalDateTime date) { + return date.with(TemporalAdjusters.lastDayOfMonth()).with(LocalTime.MAX); + } + + /** + * 获得指定日期所在季度 + * + * @param date 日期 + * @return 所在季度 + */ + public static int getQuarterOfYear(LocalDateTime date) { + return (date.getMonthValue() - 1) / 3 + 1; + } + + /** + * 获取指定日期到现在过了几天,如果指定日期在当前日期之后,获取结果为负 + * + * @param dateTime 日期 + * @return 相差天数 + */ + public static Long between(LocalDateTime dateTime) { + return LocalDateTimeUtil.between(dateTime, LocalDateTime.now(), ChronoUnit.DAYS); + } + + /** + * 获取今天的开始时间 + * + * @return 今天 + */ + public static LocalDateTime getToday() { + return LocalDateTimeUtil.beginOfDay(LocalDateTime.now()); + } + + /** + * 获取昨天的开始时间 + * + * @return 昨天 + */ + public static LocalDateTime getYesterday() { + return LocalDateTimeUtil.beginOfDay(LocalDateTime.now().minusDays(1)); + } + + /** + * 获取本月的开始时间 + * + * @return 本月 + */ + public static LocalDateTime getMonth() { + return beginOfMonth(LocalDateTime.now()); + } + + /** + * 获取本年的开始时间 + * + * @return 本年 + */ + public static LocalDateTime getYear() { + return LocalDateTime.now().with(TemporalAdjusters.firstDayOfYear()).with(LocalTime.MIN); + } + + public static List getDateRangeList(LocalDateTime startTime, + LocalDateTime endTime, + Integer interval) { + // 1.1 找到枚举 + DateIntervalEnum intervalEnum = DateIntervalEnum.valueOf(interval); + Assert.notNull(intervalEnum, "interval({}} 找不到对应的枚举", interval); + // 1.2 将时间对齐 + startTime = LocalDateTimeUtil.beginOfDay(startTime); + endTime = LocalDateTimeUtil.endOfDay(endTime); + + // 2. 循环,生成时间范围 + List timeRanges = new ArrayList<>(); + switch (intervalEnum) { + case DAY: + while (startTime.isBefore(endTime)) { + timeRanges.add(new LocalDateTime[]{startTime, startTime.plusDays(1).minusNanos(1)}); + startTime = startTime.plusDays(1); + } + break; + case WEEK: + while (startTime.isBefore(endTime)) { + LocalDateTime endOfWeek = startTime.with(DayOfWeek.SUNDAY).plusDays(1).minusNanos(1); + timeRanges.add(new LocalDateTime[]{startTime, endOfWeek}); + startTime = endOfWeek.plusNanos(1); + } + break; + case MONTH: + while (startTime.isBefore(endTime)) { + LocalDateTime endOfMonth = startTime.with(TemporalAdjusters.lastDayOfMonth()).plusDays(1).minusNanos(1); + timeRanges.add(new LocalDateTime[]{startTime, endOfMonth}); + startTime = endOfMonth.plusNanos(1); + } + break; + case QUARTER: + while (startTime.isBefore(endTime)) { + int quarterOfYear = getQuarterOfYear(startTime); + LocalDateTime quarterEnd = quarterOfYear == 4 + ? startTime.with(TemporalAdjusters.lastDayOfYear()).plusDays(1).minusNanos(1) + : startTime.withMonth(quarterOfYear * 3 + 1).withDayOfMonth(1).minusNanos(1); + timeRanges.add(new LocalDateTime[]{startTime, quarterEnd}); + startTime = quarterEnd.plusNanos(1); + } + break; + case YEAR: + while (startTime.isBefore(endTime)) { + LocalDateTime endOfYear = startTime.with(TemporalAdjusters.lastDayOfYear()).plusDays(1).minusNanos(1); + timeRanges.add(new LocalDateTime[]{startTime, endOfYear}); + startTime = endOfYear.plusNanos(1); + } + break; + default: + throw new IllegalArgumentException("Invalid interval: " + interval); + } + // 3. 兜底,最后一个时间,需要保持在 endTime 之前 + LocalDateTime[] lastTimeRange = CollUtil.getLast(timeRanges); + if (lastTimeRange != null) { + lastTimeRange[1] = endTime; + } + return timeRanges; + } + + /** + * 格式化时间范围 + * + * @param startTime 开始时间 + * @param endTime 结束时间 + * @param interval 时间间隔 + * @return 时间范围 + */ + public static String formatDateRange(LocalDateTime startTime, LocalDateTime endTime, Integer interval) { + // 1. 找到枚举 + DateIntervalEnum intervalEnum = DateIntervalEnum.valueOf(interval); + Assert.notNull(intervalEnum, "interval({}} 找不到对应的枚举", interval); + + // 2. 循环,生成时间范围 + switch (intervalEnum) { + case DAY: + return LocalDateTimeUtil.format(startTime, DatePattern.NORM_DATE_PATTERN); + case WEEK: + return LocalDateTimeUtil.format(startTime, DatePattern.NORM_DATE_PATTERN) + + StrUtil.format("(第 {} 周)", LocalDateTimeUtil.weekOfYear(startTime)); + case MONTH: + return LocalDateTimeUtil.format(startTime, DatePattern.NORM_MONTH_PATTERN); + case QUARTER: + return StrUtil.format("{}-Q{}", startTime.getYear(), getQuarterOfYear(startTime)); + case YEAR: + return LocalDateTimeUtil.format(startTime, DatePattern.NORM_YEAR_PATTERN); + default: + throw new IllegalArgumentException("Invalid interval: " + interval); + } + } + +} diff --git a/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/http/HttpUtils.java b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/http/HttpUtils.java new file mode 100644 index 0000000..93ca740 --- /dev/null +++ b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/http/HttpUtils.java @@ -0,0 +1,177 @@ +package com.platform.marketing.framework.common.util.http; + +import cn.hutool.core.codec.Base64; +import cn.hutool.core.map.TableMap; +import cn.hutool.core.net.url.UrlBuilder; +import cn.hutool.core.util.ReflectUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.http.HttpRequest; +import cn.hutool.http.HttpResponse; +import lombok.SneakyThrows; +import org.springframework.util.StringUtils; +import org.springframework.web.util.UriComponents; +import org.springframework.web.util.UriComponentsBuilder; + +import javax.servlet.http.HttpServletRequest; +import java.net.URI; +import java.net.URLEncoder; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.util.Map; + +/** + * HTTP 工具类 + * + + */ +public class HttpUtils { + + /** + * 编码 URL 参数 + * + * @param value 参数 + * @return 编码后的参数 + */ + @SneakyThrows + public static String encodeUtf8(String value) { + return URLEncoder.encode(value, StandardCharsets.UTF_8.name()); + } + + @SuppressWarnings("unchecked") + public static String replaceUrlQuery(String url, String key, String value) { + UrlBuilder builder = UrlBuilder.of(url, Charset.defaultCharset()); + // 先移除 + TableMap query = (TableMap) + ReflectUtil.getFieldValue(builder.getQuery(), "query"); + query.remove(key); + // 后添加 + builder.addQuery(key, value); + return builder.build(); + } + + private String append(String base, Map query, boolean fragment) { + return append(base, query, null, fragment); + } + + /** + * 拼接 URL + * + * copy from Spring Security OAuth2 的 AuthorizationEndpoint 类的 append 方法 + * + * @param base 基础 URL + * @param query 查询参数 + * @param keys query 的 key,对应的原本的 key 的映射。例如说 query 里有个 key 是 xx,实际它的 key 是 extra_xx,则通过 keys 里添加这个映射 + * @param fragment URL 的 fragment,即拼接到 # 中 + * @return 拼接后的 URL + */ + public static String append(String base, Map query, Map keys, boolean fragment) { + UriComponentsBuilder template = UriComponentsBuilder.newInstance(); + UriComponentsBuilder builder = UriComponentsBuilder.fromUriString(base); + URI redirectUri; + try { + // assume it's encoded to start with (if it came in over the wire) + redirectUri = builder.build(true).toUri(); + } catch (Exception e) { + // ... but allow client registrations to contain hard-coded non-encoded values + redirectUri = builder.build().toUri(); + builder = UriComponentsBuilder.fromUri(redirectUri); + } + template.scheme(redirectUri.getScheme()).port(redirectUri.getPort()).host(redirectUri.getHost()) + .userInfo(redirectUri.getUserInfo()).path(redirectUri.getPath()); + + if (fragment) { + StringBuilder values = new StringBuilder(); + if (redirectUri.getFragment() != null) { + String append = redirectUri.getFragment(); + values.append(append); + } + for (String key : query.keySet()) { + if (values.length() > 0) { + values.append("&"); + } + String name = key; + if (keys != null && keys.containsKey(key)) { + name = keys.get(key); + } + values.append(name).append("={").append(key).append("}"); + } + if (values.length() > 0) { + template.fragment(values.toString()); + } + UriComponents encoded = template.build().expand(query).encode(); + builder.fragment(encoded.getFragment()); + } else { + for (String key : query.keySet()) { + String name = key; + if (keys != null && keys.containsKey(key)) { + name = keys.get(key); + } + template.queryParam(name, "{" + key + "}"); + } + template.fragment(redirectUri.getFragment()); + UriComponents encoded = template.build().expand(query).encode(); + builder.query(encoded.getQuery()); + } + return builder.build().toUriString(); + } + + public static String[] obtainBasicAuthorization(HttpServletRequest request) { + String clientId; + String clientSecret; + // 先从 Header 中获取 + String authorization = request.getHeader("Authorization"); + authorization = StrUtil.subAfter(authorization, "Basic ", true); + if (StringUtils.hasText(authorization)) { + authorization = Base64.decodeStr(authorization); + clientId = StrUtil.subBefore(authorization, ":", false); + clientSecret = StrUtil.subAfter(authorization, ":", false); + // 再从 Param 中获取 + } else { + clientId = request.getParameter("client_id"); + clientSecret = request.getParameter("client_secret"); + } + + // 如果两者非空,则返回 + if (StrUtil.isNotEmpty(clientId) && StrUtil.isNotEmpty(clientSecret)) { + return new String[]{clientId, clientSecret}; + } + return null; + } + + /** + * HTTP post 请求,基于 {@link cn.hutool.http.HttpUtil} 实现 + * + * 为什么要封装该方法,因为 HttpUtil 默认封装的方法,没有允许传递 headers 参数 + * + * @param url URL + * @param headers 请求头 + * @param requestBody 请求体 + * @return 请求结果 + */ + public static String post(String url, Map headers, String requestBody) { + try (HttpResponse response = HttpRequest.post(url) + .addHeaders(headers) + .body(requestBody) + .execute()) { + return response.body(); + } + } + + /** + * HTTP get 请求,基于 {@link cn.hutool.http.HttpUtil} 实现 + * + * 为什么要封装该方法,因为 HttpUtil 默认封装的方法,没有允许传递 headers 参数 + * + * @param url URL + * @param headers 请求头 + * @return 请求结果 + */ + public static String get(String url, Map headers) { + try (HttpResponse response = HttpRequest.get(url) + .addHeaders(headers) + .execute()) { + return response.body(); + } + } + +} diff --git a/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/io/FileUtils.java b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/io/FileUtils.java new file mode 100644 index 0000000..045e5fe --- /dev/null +++ b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/io/FileUtils.java @@ -0,0 +1,84 @@ +package com.platform.marketing.framework.common.util.io; + +import cn.hutool.core.io.FileTypeUtil; +import cn.hutool.core.io.FileUtil; +import cn.hutool.core.io.file.FileNameUtil; +import cn.hutool.core.util.IdUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.crypto.digest.DigestUtil; +import lombok.SneakyThrows; + +import java.io.ByteArrayInputStream; +import java.io.File; + +/** + * 文件工具类 + * + + */ +public class FileUtils { + + /** + * 创建临时文件 + * 该文件会在 JVM 退出时,进行删除 + * + * @param data 文件内容 + * @return 文件 + */ + @SneakyThrows + public static File createTempFile(String data) { + File file = createTempFile(); + // 写入内容 + FileUtil.writeUtf8String(data, file); + return file; + } + + /** + * 创建临时文件 + * 该文件会在 JVM 退出时,进行删除 + * + * @param data 文件内容 + * @return 文件 + */ + @SneakyThrows + public static File createTempFile(byte[] data) { + File file = createTempFile(); + // 写入内容 + FileUtil.writeBytes(data, file); + return file; + } + + /** + * 创建临时文件,无内容 + * 该文件会在 JVM 退出时,进行删除 + * + * @return 文件 + */ + @SneakyThrows + public static File createTempFile() { + // 创建文件,通过 UUID 保证唯一 + File file = File.createTempFile(IdUtil.simpleUUID(), null); + // 标记 JVM 退出时,自动删除 + file.deleteOnExit(); + return file; + } + + /** + * 生成文件路径 + * + * @param content 文件内容 + * @param originalName 原始文件名 + * @return path,唯一不可重复 + */ + public static String generatePath(byte[] content, String originalName) { + String sha256Hex = DigestUtil.sha256Hex(content); + // 情况一:如果存在 name,则优先使用 name 的后缀 + if (StrUtil.isNotBlank(originalName)) { + String extName = FileNameUtil.extName(originalName); + return StrUtil.isBlank(extName) ? sha256Hex : sha256Hex + "." + extName; + } + // 情况二:基于 content 计算 + return sha256Hex + '.' + FileTypeUtil.getType(new ByteArrayInputStream(content)); + } + +} diff --git a/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/io/IoUtils.java b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/io/IoUtils.java new file mode 100644 index 0000000..0b33718 --- /dev/null +++ b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/io/IoUtils.java @@ -0,0 +1,28 @@ +package com.platform.marketing.framework.common.util.io; + +import cn.hutool.core.io.IORuntimeException; +import cn.hutool.core.io.IoUtil; +import cn.hutool.core.util.StrUtil; + +import java.io.InputStream; + +/** + * IO 工具类,用于 {@link cn.hutool.core.io.IoUtil} 缺失的方法 + * + + */ +public class IoUtils { + + /** + * 从流中读取 UTF8 编码的内容 + * + * @param in 输入流 + * @param isClose 是否关闭 + * @return 内容 + * @throws IORuntimeException IO 异常 + */ + public static String readUtf8(InputStream in, boolean isClose) throws IORuntimeException { + return StrUtil.utf8Str(IoUtil.read(in, isClose)); + } + +} diff --git a/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/json/JsonUtils.java b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/json/JsonUtils.java new file mode 100644 index 0000000..6269209 --- /dev/null +++ b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/json/JsonUtils.java @@ -0,0 +1,210 @@ +package com.platform.marketing.framework.common.util.json; + +import cn.hutool.core.util.ArrayUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.json.JSONUtil; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +import lombok.SneakyThrows; +import lombok.extern.slf4j.Slf4j; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.List; + +/** + * JSON 工具类 + * + + */ +@Slf4j +public class JsonUtils { + + private static ObjectMapper objectMapper = new ObjectMapper(); + + static { + objectMapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); + objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); // 忽略 null 值 + objectMapper.registerModules(new JavaTimeModule()); // 解决 LocalDateTime 的序列化 + } + + /** + * 初始化 objectMapper 属性 + *

+ * 通过这样的方式,使用 Spring 创建的 ObjectMapper Bean + * + * @param objectMapper ObjectMapper 对象 + */ + public static void init(ObjectMapper objectMapper) { + JsonUtils.objectMapper = objectMapper; + } + + @SneakyThrows + public static String toJsonString(Object object) { + return objectMapper.writeValueAsString(object); + } + + @SneakyThrows + public static byte[] toJsonByte(Object object) { + return objectMapper.writeValueAsBytes(object); + } + + @SneakyThrows + public static String toJsonPrettyString(Object object) { + return objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(object); + } + + public static T parseObject(String text, Class clazz) { + if (StrUtil.isEmpty(text)) { + return null; + } + try { + return objectMapper.readValue(text, clazz); + } catch (IOException e) { + log.error("json parse err,json:{}", text, e); + throw new RuntimeException(e); + } + } + + public static T parseObject(String text, String path, Class clazz) { + if (StrUtil.isEmpty(text)) { + return null; + } + try { + JsonNode treeNode = objectMapper.readTree(text); + JsonNode pathNode = treeNode.path(path); + return objectMapper.readValue(pathNode.toString(), clazz); + } catch (IOException e) { + log.error("json parse err,json:{}", text, e); + throw new RuntimeException(e); + } + } + + public static T parseObject(String text, Type type) { + if (StrUtil.isEmpty(text)) { + return null; + } + try { + return objectMapper.readValue(text, objectMapper.getTypeFactory().constructType(type)); + } catch (IOException e) { + log.error("json parse err,json:{}", text, e); + throw new RuntimeException(e); + } + } + + /** + * 将字符串解析成指定类型的对象 + * 使用 {@link #parseObject(String, Class)} 时,在@JsonTypeInfo(use = JsonTypeInfo.Id.CLASS) 的场景下, + * 如果 text 没有 class 属性,则会报错。此时,使用这个方法,可以解决。 + * + * @param text 字符串 + * @param clazz 类型 + * @return 对象 + */ + public static T parseObject2(String text, Class clazz) { + if (StrUtil.isEmpty(text)) { + return null; + } + return JSONUtil.toBean(text, clazz); + } + + public static T parseObject(byte[] bytes, Class clazz) { + if (ArrayUtil.isEmpty(bytes)) { + return null; + } + try { + return objectMapper.readValue(bytes, clazz); + } catch (IOException e) { + log.error("json parse err,json:{}", bytes, e); + throw new RuntimeException(e); + } + } + + public static T parseObject(String text, TypeReference typeReference) { + try { + return objectMapper.readValue(text, typeReference); + } catch (IOException e) { + log.error("json parse err,json:{}", text, e); + throw new RuntimeException(e); + } + } + + /** + * 解析 JSON 字符串成指定类型的对象,如果解析失败,则返回 null + * + * @param text 字符串 + * @param typeReference 类型引用 + * @return 指定类型的对象 + */ + public static T parseObjectQuietly(String text, TypeReference typeReference) { + try { + return objectMapper.readValue(text, typeReference); + } catch (IOException e) { + return null; + } + } + + public static List parseArray(String text, Class clazz) { + if (StrUtil.isEmpty(text)) { + return new ArrayList<>(); + } + try { + return objectMapper.readValue(text, objectMapper.getTypeFactory().constructCollectionType(List.class, clazz)); + } catch (IOException e) { + log.error("json parse err,json:{}", text, e); + throw new RuntimeException(e); + } + } + + public static List parseArray(String text, String path, Class clazz) { + if (StrUtil.isEmpty(text)) { + return null; + } + try { + JsonNode treeNode = objectMapper.readTree(text); + JsonNode pathNode = treeNode.path(path); + return objectMapper.readValue(pathNode.toString(), objectMapper.getTypeFactory().constructCollectionType(List.class, clazz)); + } catch (IOException e) { + log.error("json parse err,json:{}", text, e); + throw new RuntimeException(e); + } + } + + public static JsonNode parseTree(String text) { + try { + return objectMapper.readTree(text); + } catch (IOException e) { + log.error("json parse err,json:{}", text, e); + throw new RuntimeException(e); + } + } + + public static JsonNode parseTree(byte[] text) { + try { + return objectMapper.readTree(text); + } catch (IOException e) { + log.error("json parse err,json:{}", text, e); + throw new RuntimeException(e); + } + } + + public static boolean isJson(String text) { + return JSONUtil.isTypeJSON(text); + } + + /** + * 判断字符串是否为 JSON 类型的字符串 + * @param str 字符串 + */ + public static boolean isJsonObject(String str) { + return JSONUtil.isTypeJSONObject(str); + } + +} diff --git a/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/json/databind/NumberSerializer.java b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/json/databind/NumberSerializer.java new file mode 100644 index 0000000..85d4605 --- /dev/null +++ b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/json/databind/NumberSerializer.java @@ -0,0 +1,37 @@ +package com.platform.marketing.framework.common.util.json.databind; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JacksonStdImpl; + +import java.io.IOException; + +/** + * Long 序列化规则 + * + * 会将超长 long 值转换为 string,解决前端 JavaScript 最大安全整数是 2^53-1 的问题 + * + * @author 星语 + */ +@JacksonStdImpl +public class NumberSerializer extends com.fasterxml.jackson.databind.ser.std.NumberSerializer { + + private static final long MAX_SAFE_INTEGER = 9007199254740991L; + private static final long MIN_SAFE_INTEGER = -9007199254740991L; + + public static final NumberSerializer INSTANCE = new NumberSerializer(Number.class); + + public NumberSerializer(Class rawType) { + super(rawType); + } + + @Override + public void serialize(Number value, JsonGenerator gen, SerializerProvider serializers) throws IOException { + // 超出范围 序列化位字符串 + if (value.longValue() > MIN_SAFE_INTEGER && value.longValue() < MAX_SAFE_INTEGER) { + super.serialize(value, gen, serializers); + } else { + gen.writeString(value.toString()); + } + } +} diff --git a/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/json/databind/TimestampLocalDateTimeDeserializer.java b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/json/databind/TimestampLocalDateTimeDeserializer.java new file mode 100644 index 0000000..0f9dbe8 --- /dev/null +++ b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/json/databind/TimestampLocalDateTimeDeserializer.java @@ -0,0 +1,27 @@ +package com.platform.marketing.framework.common.util.json.databind; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; + +import java.io.IOException; +import java.time.Instant; +import java.time.LocalDateTime; +import java.time.ZoneId; + +/** + * 基于时间戳的 LocalDateTime 反序列化器 + * + * @author 老五 + */ +public class TimestampLocalDateTimeDeserializer extends JsonDeserializer { + + public static final TimestampLocalDateTimeDeserializer INSTANCE = new TimestampLocalDateTimeDeserializer(); + + @Override + public LocalDateTime deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { + // 将 Long 时间戳,转换为 LocalDateTime 对象 + return LocalDateTime.ofInstant(Instant.ofEpochMilli(p.getValueAsLong()), ZoneId.systemDefault()); + } + +} diff --git a/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/json/databind/TimestampLocalDateTimeSerializer.java b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/json/databind/TimestampLocalDateTimeSerializer.java new file mode 100644 index 0000000..f5fdcf6 --- /dev/null +++ b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/json/databind/TimestampLocalDateTimeSerializer.java @@ -0,0 +1,26 @@ +package com.platform.marketing.framework.common.util.json.databind; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.SerializerProvider; + +import java.io.IOException; +import java.time.LocalDateTime; +import java.time.ZoneId; + +/** + * 基于时间戳的 LocalDateTime 序列化器 + * + * @author 老五 + */ +public class TimestampLocalDateTimeSerializer extends JsonSerializer { + + public static final TimestampLocalDateTimeSerializer INSTANCE = new TimestampLocalDateTimeSerializer(); + + @Override + public void serialize(LocalDateTime value, JsonGenerator gen, SerializerProvider serializers) throws IOException { + // 将 LocalDateTime 对象,转换为 Long 时间戳 + gen.writeNumber(value.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli()); + } + +} diff --git a/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/monitor/TracerUtils.java b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/monitor/TracerUtils.java new file mode 100644 index 0000000..ebd2c61 --- /dev/null +++ b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/monitor/TracerUtils.java @@ -0,0 +1,30 @@ +package com.platform.marketing.framework.common.util.monitor; + +import cn.hutool.core.lang.UUID; + +/** + * 链路追踪工具类 + * + * 考虑到每个 starter 都需要用到该工具类,所以放到 common 模块下的 util 包下 + * + + */ +public class TracerUtils { + + /** + * 私有化构造方法 + */ + private TracerUtils() { + } + + /** + * 获得链路追踪编号。 + * 如果不存在的话为空字符串!!! + * + * @return 链路追踪编号 + */ + public static String getTraceId() { + return UUID.randomUUID().toString(); + } + +} diff --git a/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/number/MoneyUtils.java b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/number/MoneyUtils.java new file mode 100644 index 0000000..1f73805 --- /dev/null +++ b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/number/MoneyUtils.java @@ -0,0 +1,131 @@ +package com.platform.marketing.framework.common.util.number; + +import cn.hutool.core.math.Money; +import cn.hutool.core.util.NumberUtil; + +import java.math.BigDecimal; +import java.math.RoundingMode; + +/** + * 金额工具类 + * + + */ +public class MoneyUtils { + + /** + * 金额的小数位数 + */ + private static final int PRICE_SCALE = 2; + + /** + * 百分比对应的 BigDecimal 对象 + */ + public static final BigDecimal PERCENT_100 = BigDecimal.valueOf(100); + + /** + * 计算百分比金额,四舍五入 + * + * @param price 金额 + * @param rate 百分比,例如说 56.77% 则传入 56.77 + * @return 百分比金额 + */ + public static Integer calculateRatePrice(Integer price, Double rate) { + return calculateRatePrice(price, rate, 0, RoundingMode.HALF_UP).intValue(); + } + + /** + * 计算百分比金额,向下传入 + * + * @param price 金额 + * @param rate 百分比,例如说 56.77% 则传入 56.77 + * @return 百分比金额 + */ + public static Integer calculateRatePriceFloor(Integer price, Double rate) { + return calculateRatePrice(price, rate, 0, RoundingMode.FLOOR).intValue(); + } + + /** + * 计算百分比金额 + * + * @param price 金额(单位分) + * @param count 数量 + * @param percent 折扣(单位分),列如 60.2%,则传入 6020 + * @return 商品总价 + */ + public static Integer calculator(Integer price, Integer count, Integer percent) { + price = price * count; + if (percent == null) { + return price; + } + return MoneyUtils.calculateRatePriceFloor(price, (double) (percent / 100)); + } + + /** + * 计算百分比金额 + * + * @param price 金额 + * @param rate 百分比,例如说 56.77% 则传入 56.77 + * @param scale 保留小数位数 + * @param roundingMode 舍入模式 + */ + public static BigDecimal calculateRatePrice(Number price, Number rate, int scale, RoundingMode roundingMode) { + return NumberUtil.toBigDecimal(price).multiply(NumberUtil.toBigDecimal(rate)) // 乘以 + .divide(BigDecimal.valueOf(100), scale, roundingMode); // 除以 100 + } + + /** + * 分转元 + * + * @param fen 分 + * @return 元 + */ + public static BigDecimal fenToYuan(int fen) { + return new Money(0, fen).getAmount(); + } + + /** + * 分转元(字符串) + * + * 例如说 fen 为 1 时,则结果为 0.01 + * + * @param fen 分 + * @return 元 + */ + public static String fenToYuanStr(int fen) { + return new Money(0, fen).toString(); + } + + /** + * 金额相乘,默认进行四舍五入 + * + * 位数:{@link #PRICE_SCALE} + * + * @param price 金额 + * @param count 数量 + * @return 金额相乘结果 + */ + public static BigDecimal priceMultiply(BigDecimal price, BigDecimal count) { + if (price == null || count == null) { + return null; + } + return price.multiply(count).setScale(PRICE_SCALE, RoundingMode.HALF_UP); + } + + /** + * 金额相乘(百分比),默认进行四舍五入 + * + * 位数:{@link #PRICE_SCALE} + * + * @param price 金额 + * @param percent 百分比 + * @return 金额相乘结果 + */ + public static BigDecimal priceMultiplyPercent(BigDecimal price, BigDecimal percent) { + if (price == null || percent == null) { + return null; + } + return price.multiply(percent).divide(PERCENT_100, PRICE_SCALE, RoundingMode.HALF_UP); + } + +} diff --git a/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/number/NumberUtils.java b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/number/NumberUtils.java new file mode 100644 index 0000000..f6daae4 --- /dev/null +++ b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/number/NumberUtils.java @@ -0,0 +1,78 @@ +package com.platform.marketing.framework.common.util.number; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.NumberUtil; +import cn.hutool.core.util.StrUtil; + +import java.math.BigDecimal; +import java.util.List; + +/** + * 数字的工具类,补全 {@link cn.hutool.core.util.NumberUtil} 的功能 + * + + */ +public class NumberUtils { + + public static Long parseLong(String str) { + return StrUtil.isNotEmpty(str) ? Long.valueOf(str) : null; + } + + public static Integer parseInt(String str) { + return StrUtil.isNotEmpty(str) ? Integer.valueOf(str) : null; + } + + public static boolean isAllNumber(List values) { + if (CollUtil.isEmpty(values)) { + return false; + } + for (String value : values) { + if (!NumberUtil.isNumber(value)) { + return false; + } + } + return true; + } + + /** + * 通过经纬度获取地球上两点之间的距离 + * + * 参考 <DistanceUtil> 实现,目前它已经被 hutool 删除 + * + * @param lat1 经度1 + * @param lng1 纬度1 + * @param lat2 经度2 + * @param lng2 纬度2 + * @return 距离,单位:千米 + */ + public static double getDistance(double lat1, double lng1, double lat2, double lng2) { + double radLat1 = lat1 * Math.PI / 180.0; + double radLat2 = lat2 * Math.PI / 180.0; + double a = radLat1 - radLat2; + double b = lng1 * Math.PI / 180.0 - lng2 * Math.PI / 180.0; + double distance = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) + + Math.cos(radLat1) * Math.cos(radLat2) + * Math.pow(Math.sin(b / 2), 2))); + distance = distance * 6378.137; + distance = Math.round(distance * 10000d) / 10000d; + return distance; + } + + /** + * 提供精确的乘法运算 + * + * 和 hutool {@link NumberUtil#mul(BigDecimal...)} 的差别是,如果存在 null,则返回 null + * + * @param values 多个被乘值 + * @return 积 + */ + public static BigDecimal mul(BigDecimal... values) { + for (BigDecimal value : values) { + if (value == null) { + return null; + } + } + return NumberUtil.mul(values); + } + +} diff --git a/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/object/BeanUtils.java b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/object/BeanUtils.java new file mode 100644 index 0000000..dd04260 --- /dev/null +++ b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/object/BeanUtils.java @@ -0,0 +1,69 @@ +package com.platform.marketing.framework.common.util.object; + +import cn.hutool.core.bean.BeanUtil; +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.common.util.collection.CollectionUtils; + +import java.util.List; +import java.util.function.Consumer; + +/** + * Bean 工具类 + * + * 1. 默认使用 {@link cn.hutool.core.bean.BeanUtil} 作为实现类,虽然不同 bean 工具的性能有差别,但是对绝大多数同学的项目,不用在意这点性能 + * 2. 针对复杂的对象转换,可以搜参考 AuthConvert 实现,通过 mapstruct + default 配合实现 + * + + */ +public class BeanUtils { + + public static T toBean(Object source, Class targetClass) { + return BeanUtil.toBean(source, targetClass); + } + + public static T toBean(Object source, Class targetClass, Consumer peek) { + T target = toBean(source, targetClass); + if (target != null) { + peek.accept(target); + } + return target; + } + + public static List toBean(List source, Class targetType) { + if (source == null) { + return null; + } + return CollectionUtils.convertList(source, s -> toBean(s, targetType)); + } + + public static List toBean(List source, Class targetType, Consumer peek) { + List list = toBean(source, targetType); + if (list != null) { + list.forEach(peek); + } + return list; + } + + public static PageResult toBean(PageResult source, Class targetType) { + return toBean(source, targetType, null); + } + + public static PageResult toBean(PageResult source, Class targetType, Consumer peek) { + if (source == null) { + return null; + } + List list = toBean(source.getList(), targetType); + if (peek != null) { + list.forEach(peek); + } + return new PageResult<>(list, source.getTotal()); + } + + public static void copyProperties(Object source, Object target) { + if (source == null || target == null) { + return; + } + BeanUtil.copyProperties(source, target, false); + } + +} \ No newline at end of file diff --git a/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/object/ObjectUtils.java b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/object/ObjectUtils.java new file mode 100644 index 0000000..c15bba3 --- /dev/null +++ b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/object/ObjectUtils.java @@ -0,0 +1,63 @@ +package com.platform.marketing.framework.common.util.object; + +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.ReflectUtil; + +import java.lang.reflect.Field; +import java.util.Arrays; +import java.util.function.Consumer; + +/** + * Object 工具类 + * + + */ +public class ObjectUtils { + + /** + * 复制对象,并忽略 Id 编号 + * + * @param object 被复制对象 + * @param consumer 消费者,可以二次编辑被复制对象 + * @return 复制后的对象 + */ + public static T cloneIgnoreId(T object, Consumer consumer) { + T result = ObjectUtil.clone(object); + // 忽略 id 编号 + Field field = ReflectUtil.getField(object.getClass(), "id"); + if (field != null) { + ReflectUtil.setFieldValue(result, field, null); + } + // 二次编辑 + if (result != null) { + consumer.accept(result); + } + return result; + } + + public static > T max(T obj1, T obj2) { + if (obj1 == null) { + return obj2; + } + if (obj2 == null) { + return obj1; + } + return obj1.compareTo(obj2) > 0 ? obj1 : obj2; + } + + @SafeVarargs + public static T defaultIfNull(T... array) { + for (T item : array) { + if (item != null) { + return item; + } + } + return null; + } + + @SafeVarargs + public static boolean equalsAny(T obj, T... array) { + return Arrays.asList(array).contains(obj); + } + +} diff --git a/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/object/PageUtils.java b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/object/PageUtils.java new file mode 100644 index 0000000..6bd604f --- /dev/null +++ b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/object/PageUtils.java @@ -0,0 +1,67 @@ +package com.platform.marketing.framework.common.util.object; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.lang.func.Func1; +import cn.hutool.core.lang.func.LambdaUtil; +import cn.hutool.core.util.ArrayUtil; +import com.platform.marketing.framework.common.pojo.PageParam; +import com.platform.marketing.framework.common.pojo.SortablePageParam; +import com.platform.marketing.framework.common.pojo.SortingField; +import org.springframework.util.Assert; + +import static java.util.Collections.singletonList; + +/** + * {@link com.platform.marketing.framework.common.pojo.PageParam} 工具类 + * + + */ +public class PageUtils { + + private static final Object[] ORDER_TYPES = new String[]{SortingField.ORDER_ASC, SortingField.ORDER_DESC}; + + public static int getStart(PageParam pageParam) { + return (pageParam.getPageNo() - 1) * pageParam.getPageSize(); + } + + /** + * 构建排序字段(默认倒序) + * + * @param func 排序字段的 Lambda 表达式 + * @param 排序字段所属的类型 + * @return 排序字段 + */ + public static SortingField buildSortingField(Func1 func) { + return buildSortingField(func, SortingField.ORDER_DESC); + } + + /** + * 构建排序字段 + * + * @param func 排序字段的 Lambda 表达式 + * @param order 排序类型 {@link SortingField#ORDER_ASC} {@link SortingField#ORDER_DESC} + * @param 排序字段所属的类型 + * @return 排序字段 + */ + public static SortingField buildSortingField(Func1 func, String order) { + Assert.isTrue(ArrayUtil.contains(ORDER_TYPES, order), String.format("字段的排序类型只能是 %s/%s", ORDER_TYPES)); + + String fieldName = LambdaUtil.getFieldName(func); + return new SortingField(fieldName, order); + } + + /** + * 构建默认的排序字段 + * 如果排序字段为空,则设置排序字段;否则忽略 + * + * @param sortablePageParam 排序分页查询参数 + * @param func 排序字段的 Lambda 表达式 + * @param 排序字段所属的类型 + */ + public static void buildDefaultSortingField(SortablePageParam sortablePageParam, Func1 func) { + if (sortablePageParam != null && CollUtil.isEmpty(sortablePageParam.getSortingFields())) { + sortablePageParam.setSortingFields(singletonList(buildSortingField(func))); + } + } + +} diff --git a/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/package-info.java b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/package-info.java new file mode 100644 index 0000000..0944b0f --- /dev/null +++ b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/package-info.java @@ -0,0 +1,7 @@ +/** + * 对于工具类的选择,优先查找 Hutool 中有没对应的方法 + * 如果没有,则自己封装对应的工具类,以 Utils 结尾,用于区分 + * + * ps:如果担心 Hutool 存在坑的问题,可以阅读 Hutool 的实现源码,以确保可靠性。并且,可以补充相关的单元测试。 + */ +package com.platform.marketing.framework.common.util; diff --git a/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/servlet/ServletUtils.java b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/servlet/ServletUtils.java new file mode 100644 index 0000000..4ae0ca5 --- /dev/null +++ b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/servlet/ServletUtils.java @@ -0,0 +1,123 @@ +package com.platform.marketing.framework.common.util.servlet; + +import cn.hutool.core.io.IoUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.extra.servlet.ServletUtil; +import com.platform.marketing.framework.common.util.json.JsonUtils; +import org.springframework.http.MediaType; +import org.springframework.web.context.request.RequestAttributes; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.servlet.ServletRequest; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.net.URLEncoder; +import java.util.Map; + +/** + * 客户端工具类 + * + + */ +public class ServletUtils { + + /** + * 返回 JSON 字符串 + * + * @param response 响应 + * @param object 对象,会序列化成 JSON 字符串 + */ + @SuppressWarnings("deprecation") // 必须使用 APPLICATION_JSON_UTF8_VALUE,否则会乱码 + public static void writeJSON(HttpServletResponse response, Object object) { + String content = JsonUtils.toJsonString(object); + ServletUtil.write(response, content, MediaType.APPLICATION_JSON_UTF8_VALUE); + } + + /** + * 返回附件 + * + * @param response 响应 + * @param filename 文件名 + * @param content 附件内容 + */ + public static void writeAttachment(HttpServletResponse response, String filename, byte[] content) throws IOException { + // 设置 header 和 contentType + response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(filename, "UTF-8")); + response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE); + // 输出附件 + IoUtil.write(response.getOutputStream(), false, content); + } + + /** + * @param request 请求 + * @return ua + */ + public static String getUserAgent(HttpServletRequest request) { + String ua = request.getHeader("User-Agent"); + return ua != null ? ua : ""; + } + + /** + * 获得请求 + * + * @return HttpServletRequest + */ + public static HttpServletRequest getRequest() { + RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes(); + if (!(requestAttributes instanceof ServletRequestAttributes)) { + return null; + } + return ((ServletRequestAttributes) requestAttributes).getRequest(); + } + + public static String getUserAgent() { + HttpServletRequest request = getRequest(); + if (request == null) { + return null; + } + return getUserAgent(request); + } + + public static String getClientIP() { + HttpServletRequest request = getRequest(); + if (request == null) { + return null; + } + return ServletUtil.getClientIP(request); + } + + public static boolean isJsonRequest(ServletRequest request) { + return StrUtil.startWithIgnoreCase(request.getContentType(), MediaType.APPLICATION_JSON_VALUE); + } + + public static String getBody(HttpServletRequest request) { + // 只有在 json 请求在读取,因为只有 CacheRequestBodyFilter 才会进行缓存,支持重复读取 + if (isJsonRequest(request)) { + return ServletUtil.getBody(request); + } + return null; + } + + public static byte[] getBodyBytes(HttpServletRequest request) { + // 只有在 json 请求在读取,因为只有 CacheRequestBodyFilter 才会进行缓存,支持重复读取 + if (isJsonRequest(request)) { + return ServletUtil.getBodyBytes(request); + } + return null; + } + + public static String getClientIP(HttpServletRequest request) { + return ServletUtil.getClientIP(request); + } + + public static Map getParamMap(HttpServletRequest request) { + return ServletUtil.getParamMap(request); + } + + public static Map getHeaderMap(HttpServletRequest request) { + return ServletUtil.getHeaderMap(request); + } + +} diff --git a/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/spring/SpringExpressionUtils.java b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/spring/SpringExpressionUtils.java new file mode 100644 index 0000000..d94e690 --- /dev/null +++ b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/spring/SpringExpressionUtils.java @@ -0,0 +1,123 @@ +package com.platform.marketing.framework.common.util.spring; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.map.MapUtil; +import cn.hutool.core.util.ArrayUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.extra.spring.SpringUtil; +import org.aspectj.lang.JoinPoint; +import org.aspectj.lang.reflect.MethodSignature; +import org.springframework.context.expression.BeanFactoryResolver; +import org.springframework.core.DefaultParameterNameDiscoverer; +import org.springframework.core.ParameterNameDiscoverer; +import org.springframework.expression.EvaluationContext; +import org.springframework.expression.Expression; +import org.springframework.expression.ExpressionParser; +import org.springframework.expression.spel.standard.SpelExpressionParser; +import org.springframework.expression.spel.support.StandardEvaluationContext; + +import java.lang.reflect.Method; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +/** + * Spring EL 表达式的工具类 + * + * @author mashu + */ +public class SpringExpressionUtils { + + /** + * Spring EL 表达式解析器 + */ + private static final ExpressionParser EXPRESSION_PARSER = new SpelExpressionParser(); + /** + * 参数名发现器 + */ + private static final ParameterNameDiscoverer PARAMETER_NAME_DISCOVERER = new DefaultParameterNameDiscoverer(); + + private SpringExpressionUtils() { + } + + /** + * 从切面中,单个解析 EL 表达式的结果 + * + * @param joinPoint 切面点 + * @param expressionString EL 表达式数组 + * @return 执行界面 + */ + public static Object parseExpression(JoinPoint joinPoint, String expressionString) { + Map result = parseExpressions(joinPoint, Collections.singletonList(expressionString)); + return result.get(expressionString); + } + + /** + * 从切面中,批量解析 EL 表达式的结果 + * + * @param joinPoint 切面点 + * @param expressionStrings EL 表达式数组 + * @return 结果,key 为表达式,value 为对应值 + */ + public static Map parseExpressions(JoinPoint joinPoint, List expressionStrings) { + // 如果为空,则不进行解析 + if (CollUtil.isEmpty(expressionStrings)) { + return MapUtil.newHashMap(); + } + + // 第一步,构建解析的上下文 EvaluationContext + // 通过 joinPoint 获取被注解方法 + MethodSignature methodSignature = (MethodSignature) joinPoint.getSignature(); + Method method = methodSignature.getMethod(); + // 使用 spring 的 ParameterNameDiscoverer 获取方法形参名数组 + String[] paramNames = PARAMETER_NAME_DISCOVERER.getParameterNames(method); + // Spring 的表达式上下文对象 + EvaluationContext context = new StandardEvaluationContext(); + // 给上下文赋值 + if (ArrayUtil.isNotEmpty(paramNames)) { + Object[] args = joinPoint.getArgs(); + for (int i = 0; i < paramNames.length; i++) { + context.setVariable(paramNames[i], args[i]); + } + } + + // 第二步,逐个参数解析 + Map result = MapUtil.newHashMap(expressionStrings.size(), true); + expressionStrings.forEach(key -> { + Object value = EXPRESSION_PARSER.parseExpression(key).getValue(context); + result.put(key, value); + }); + return result; + } + + /** + * 从 Bean 工厂,解析 EL 表达式的结果 + * + * @param expressionString EL 表达式 + * @return 执行界面 + */ + public static Object parseExpression(String expressionString) { + return parseExpression(expressionString, null); + } + + /** + * 从 Bean 工厂,解析 EL 表达式的结果 + * + * @param expressionString EL 表达式 + * @param variables 变量 + * @return 执行界面 + */ + public static Object parseExpression(String expressionString, Map variables) { + if (StrUtil.isBlank(expressionString)) { + return null; + } + Expression expression = EXPRESSION_PARSER.parseExpression(expressionString); + StandardEvaluationContext context = new StandardEvaluationContext(); + context.setBeanResolver(new BeanFactoryResolver(SpringUtil.getApplicationContext())); + if (MapUtil.isNotEmpty(variables)) { + context.setVariables(variables); + } + return expression.getValue(context); + } + +} diff --git a/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/spring/SpringUtils.java b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/spring/SpringUtils.java new file mode 100644 index 0000000..5795332 --- /dev/null +++ b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/spring/SpringUtils.java @@ -0,0 +1,24 @@ +package com.platform.marketing.framework.common.util.spring; + +import cn.hutool.extra.spring.SpringUtil; + +import java.util.Objects; + +/** + * Spring 工具类 + * + + */ +public class SpringUtils extends SpringUtil { + + /** + * 是否为生产环境 + * + * @return 是否生产环境 + */ + public static boolean isProd() { + String activeProfile = getActiveProfile(); + return Objects.equals("prod", activeProfile); + } + +} diff --git a/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/string/StrUtils.java b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/string/StrUtils.java new file mode 100644 index 0000000..5b29e8c --- /dev/null +++ b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/string/StrUtils.java @@ -0,0 +1,80 @@ +package com.platform.marketing.framework.common.util.string; + +import cn.hutool.core.text.StrPool; +import cn.hutool.core.util.ArrayUtil; +import cn.hutool.core.util.StrUtil; + +import java.util.Arrays; +import java.util.Collection; +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; + +/** + * 字符串工具类 + * + + */ +public class StrUtils { + + public static String maxLength(CharSequence str, int maxLength) { + return StrUtil.maxLength(str, maxLength - 3); // -3 的原因,是该方法会补充 ... 恰好 + } + + /** + * 给定字符串是否以任何一个字符串开始 + * 给定字符串和数组为空都返回 false + * + * @param str 给定字符串 + * @param prefixes 需要检测的开始字符串 + * @since 3.0.6 + */ + public static boolean startWithAny(String str, Collection prefixes) { + if (StrUtil.isEmpty(str) || ArrayUtil.isEmpty(prefixes)) { + return false; + } + + for (CharSequence suffix : prefixes) { + if (StrUtil.startWith(str, suffix, false)) { + return true; + } + } + return false; + } + + public static List splitToLong(String value, CharSequence separator) { + long[] longs = StrUtil.splitToLong(value, separator); + return Arrays.stream(longs).boxed().collect(Collectors.toList()); + } + + public static Set splitToLongSet(String value) { + return splitToLongSet(value, StrPool.COMMA); + } + + public static Set splitToLongSet(String value, CharSequence separator) { + long[] longs = StrUtil.splitToLong(value, separator); + return Arrays.stream(longs).boxed().collect(Collectors.toSet()); + } + + public static List splitToInteger(String value, CharSequence separator) { + int[] integers = StrUtil.splitToInt(value, separator); + return Arrays.stream(integers).boxed().collect(Collectors.toList()); + } + + /** + * 移除字符串中,包含指定字符串的行 + * + * @param content 字符串 + * @param sequence 包含的字符串 + * @return 移除后的字符串 + */ + public static String removeLineContains(String content, String sequence) { + if (StrUtil.isEmpty(content) || StrUtil.isEmpty(sequence)) { + return content; + } + return Arrays.stream(content.split("\n")) + .filter(line -> !line.contains(sequence)) + .collect(Collectors.joining("\n")); + } + +} diff --git a/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/thread/CountDownLatch2.java b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/thread/CountDownLatch2.java new file mode 100644 index 0000000..71e76ab --- /dev/null +++ b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/thread/CountDownLatch2.java @@ -0,0 +1,197 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.platform.marketing.framework.common.util.thread; + +import java.util.concurrent.TimeUnit; +import java.util.concurrent.locks.AbstractQueuedSynchronizer; + +/** + * Add reset feature for @see java.util.concurrent.CountDownLatch + */ +public class CountDownLatch2 { + private final Sync sync; + + /** + * Constructs a {@code CountDownLatch2} initialized with the given count. + * + * @param count the number of times {@link #countDown} must be invoked before threads can pass through {@link + * #await} + * @throws IllegalArgumentException if {@code count} is negative + */ + public CountDownLatch2(int count) { + if (count < 0) + throw new IllegalArgumentException("count < 0"); + this.sync = new Sync(count); + } + + /** + * Causes the current thread to wait until the latch has counted down to + * zero, unless the thread is {@linkplain Thread#interrupt interrupted}. + * + *

If the current count is zero then this method returns immediately. + * + *

If the current count is greater than zero then the current + * thread becomes disabled for thread scheduling purposes and lies + * dormant until one of two things happen: + *

    + *
  • The count reaches zero due to invocations of the + * {@link #countDown} method; or + *
  • Some other thread {@linkplain Thread#interrupt interrupts} + * the current thread. + *
+ * + *

If the current thread: + *

    + *
  • has its interrupted status set on entry to this method; or + *
  • is {@linkplain Thread#interrupt interrupted} while waiting, + *
+ * then {@link InterruptedException} is thrown and the current thread's + * interrupted status is cleared. + * + * @throws InterruptedException if the current thread is interrupted while waiting + */ + public void await() throws InterruptedException { + sync.acquireSharedInterruptibly(1); + } + + /** + * Causes the current thread to wait until the latch has counted down to + * zero, unless the thread is {@linkplain Thread#interrupt interrupted}, + * or the specified waiting time elapses. + * + *

If the current count is zero then this method returns immediately + * with the value {@code true}. + * + *

If the current count is greater than zero then the current + * thread becomes disabled for thread scheduling purposes and lies + * dormant until one of three things happen: + *

    + *
  • The count reaches zero due to invocations of the + * {@link #countDown} method; or + *
  • Some other thread {@linkplain Thread#interrupt interrupts} + * the current thread; or + *
  • The specified waiting time elapses. + *
+ * + *

If the count reaches zero then the method returns with the + * value {@code true}. + * + *

If the current thread: + *

    + *
  • has its interrupted status set on entry to this method; or + *
  • is {@linkplain Thread#interrupt interrupted} while waiting, + *
+ * then {@link InterruptedException} is thrown and the current thread's + * interrupted status is cleared. + * + *

If the specified waiting time elapses then the value {@code false} + * is returned. If the time is less than or equal to zero, the method + * will not wait at all. + * + * @param timeout the maximum time to wait + * @param unit the time unit of the {@code timeout} argument + * @return {@code true} if the count reached zero and {@code false} if the waiting time elapsed before the count + * reached zero + * @throws InterruptedException if the current thread is interrupted while waiting + */ + public boolean await(long timeout, TimeUnit unit) + throws InterruptedException { + return sync.tryAcquireSharedNanos(1, unit.toNanos(timeout)); + } + + /** + * Decrements the count of the latch, releasing all waiting threads if + * the count reaches zero. + * + *

If the current count is greater than zero then it is decremented. + * If the new count is zero then all waiting threads are re-enabled for + * thread scheduling purposes. + * + *

If the current count equals zero then nothing happens. + */ + public void countDown() { + sync.releaseShared(1); + } + + /** + * Returns the current count. + * + *

This method is typically used for debugging and testing purposes. + * + * @return the current count + */ + public long getCount() { + return sync.getCount(); + } + + public void reset() { + sync.reset(); + } + + /** + * Returns a string identifying this latch, as well as its state. + * The state, in brackets, includes the String {@code "Count ="} + * followed by the current count. + * + * @return a string identifying this latch, as well as its state + */ + public String toString() { + return super.toString() + "[Count = " + sync.getCount() + "]"; + } + + /** + * Synchronization control For CountDownLatch2. + * Uses AQS state to represent count. + */ + private static final class Sync extends AbstractQueuedSynchronizer { + private static final long serialVersionUID = 4982264981922014374L; + + private final int startCount; + + Sync(int count) { + this.startCount = count; + setState(count); + } + + int getCount() { + return getState(); + } + + @Override + protected int tryAcquireShared(int acquires) { + return (getState() == 0) ? 1 : -1; + } + + @Override + protected boolean tryReleaseShared(int releases) { + // Decrement count; signal when transition to zero + for (; ; ) { + int c = getState(); + if (c == 0) + return false; + int nextc = c - 1; + if (compareAndSetState(c, nextc)) + return nextc == 0; + } + } + + protected void reset() { + setState(startCount); + } + } +} diff --git a/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/thread/PlatformServiceThread.java b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/thread/PlatformServiceThread.java new file mode 100644 index 0000000..de04223 --- /dev/null +++ b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/thread/PlatformServiceThread.java @@ -0,0 +1,146 @@ +package com.platform.marketing.framework.common.util.thread; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicBoolean; + +public abstract class PlatformServiceThread implements Runnable { + + private static final Logger log = LoggerFactory.getLogger(PlatformServiceThread.class); + private static final long JOIN_TIME = 90 * 1000; + + private Thread thread; + protected final CountDownLatch2 waitPoint = new CountDownLatch2(1); + protected volatile AtomicBoolean hasNotified = new AtomicBoolean(false); + protected volatile boolean stopped = false; + protected boolean isDaemon = false; + + //Make it able to restart the thread + private final AtomicBoolean started = new AtomicBoolean(false); + + public PlatformServiceThread() { + } + + public abstract String getServiceName(); + + public void start() { + log.info("Try to start service thread:{} started:{} lastThread:{}", getServiceName(), started.get(), thread); + if (!started.compareAndSet(false, true)) { + return; + } + stopped = false; + this.thread = new Thread(this, getServiceName()); + this.thread.setDaemon(isDaemon); + this.thread.start(); + } + + public void shutdown() { + this.shutdown(false); + } + + public void shutdown(final boolean interrupt) { + log.info("Try to shutdown service thread:{} started:{} lastThread:{}", getServiceName(), started.get(), thread); + if (!started.compareAndSet(true, false)) { + return; + } + this.stopped = true; + log.info("shutdown thread " + this.getServiceName() + " interrupt " + interrupt); + + if (hasNotified.compareAndSet(false, true)) { + waitPoint.countDown(); // notify + } + + try { + if (interrupt) { + this.thread.interrupt(); + } + + long beginTime = System.currentTimeMillis(); + if (!this.thread.isDaemon()) { + this.thread.join(this.getJointime()); + } + long elapsedTime = System.currentTimeMillis() - beginTime; + log.info("join thread " + this.getServiceName() + " elapsed time(ms) " + elapsedTime + " " + + this.getJointime()); + } catch (InterruptedException e) { + log.error("Interrupted", e); + } + } + + public long getJointime() { + return JOIN_TIME; + } + + @Deprecated + public void stop() { + this.stop(false); + } + + @Deprecated + public void stop(final boolean interrupt) { + if (!started.get()) { + return; + } + this.stopped = true; + log.info("stop thread " + this.getServiceName() + " interrupt " + interrupt); + + if (hasNotified.compareAndSet(false, true)) { + waitPoint.countDown(); // notify + } + + if (interrupt) { + this.thread.interrupt(); + } + } + + public void makeStop() { + if (!started.get()) { + return; + } + this.stopped = true; + log.info("makestop thread " + this.getServiceName()); + } + + public void wakeup() { + if (hasNotified.compareAndSet(false, true)) { + waitPoint.countDown(); // notify + } + } + + protected void waitForRunning(long interval) { + if (hasNotified.compareAndSet(true, false)) { + this.onWaitEnd(); + return; + } + + //entry to wait + waitPoint.reset(); + + try { + waitPoint.await(interval, TimeUnit.MILLISECONDS); + } catch (InterruptedException e) { + log.error("Interrupted", e); + } finally { + hasNotified.set(false); + this.onWaitEnd(); + } + } + + protected void onWaitEnd() { + } + + public boolean isStopped() { + return stopped; + } + + public boolean isDaemon() { + return isDaemon; + } + + public void setDaemon(boolean daemon) { + isDaemon = daemon; + } + +} diff --git a/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/thread/ThreadFactoryImpl.java b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/thread/ThreadFactoryImpl.java new file mode 100644 index 0000000..524d589 --- /dev/null +++ b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/thread/ThreadFactoryImpl.java @@ -0,0 +1,44 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.platform.marketing.framework.common.util.thread; + +import java.util.concurrent.ThreadFactory; +import java.util.concurrent.atomic.AtomicLong; + +public class ThreadFactoryImpl implements ThreadFactory { + private final AtomicLong threadIndex = new AtomicLong(0); + private final String threadNamePrefix; + private final boolean daemon; + + public ThreadFactoryImpl(final String threadNamePrefix) { + this(threadNamePrefix, false); + } + + public ThreadFactoryImpl(final String threadNamePrefix, boolean daemon) { + this.threadNamePrefix = threadNamePrefix; + this.daemon = daemon; + } + + @Override + public Thread newThread(Runnable r) { + Thread thread = new Thread(r, threadNamePrefix + this.threadIndex.incrementAndGet()); + thread.setDaemon(daemon); + return thread; + } + +} diff --git a/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/validation/ValidationUtils.java b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/validation/ValidationUtils.java new file mode 100644 index 0000000..42ee022 --- /dev/null +++ b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/util/validation/ValidationUtils.java @@ -0,0 +1,55 @@ +package com.platform.marketing.framework.common.util.validation; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.lang.Assert; +import org.springframework.util.StringUtils; + +import javax.validation.ConstraintViolation; +import javax.validation.ConstraintViolationException; +import javax.validation.Validation; +import javax.validation.Validator; +import java.util.Set; +import java.util.regex.Pattern; + +/** + * 校验工具类 + * + + */ +public class ValidationUtils { + + private static final Pattern PATTERN_MOBILE = Pattern.compile("^(?:(?:\\+|00)86)?1(?:(?:3[\\d])|(?:4[0,1,4-9])|(?:5[0-3,5-9])|(?:6[2,5-7])|(?:7[0-8])|(?:8[\\d])|(?:9[0-3,5-9]))\\d{8}$"); + + private static final Pattern PATTERN_URL = Pattern.compile("^(https?|ftp|file)://[-a-zA-Z0-9+&@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#/%=~_|]"); + + private static final Pattern PATTERN_XML_NCNAME = Pattern.compile("[a-zA-Z_][\\-_.0-9_a-zA-Z$]*"); + + public static boolean isMobile(String mobile) { + return StringUtils.hasText(mobile) + && PATTERN_MOBILE.matcher(mobile).matches(); + } + + public static boolean isURL(String url) { + return StringUtils.hasText(url) + && PATTERN_URL.matcher(url).matches(); + } + + public static boolean isXmlNCName(String str) { + return StringUtils.hasText(str) + && PATTERN_XML_NCNAME.matcher(str).matches(); + } + + public static void validate(Object object, Class... groups) { + Validator validator = Validation.buildDefaultValidatorFactory().getValidator(); + Assert.notNull(validator); + validate(validator, object, groups); + } + + public static void validate(Validator validator, Object object, Class... groups) { + Set> constraintViolations = validator.validate(object, groups); + if (CollUtil.isNotEmpty(constraintViolations)) { + throw new ConstraintViolationException(constraintViolations); + } + } + +} diff --git a/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/validation/InEnum.java b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/validation/InEnum.java new file mode 100644 index 0000000..d66b719 --- /dev/null +++ b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/validation/InEnum.java @@ -0,0 +1,35 @@ +package com.platform.marketing.framework.common.validation; + +import com.platform.marketing.framework.common.core.ArrayValuable; + +import javax.validation.Constraint; +import javax.validation.Payload; +import java.lang.annotation.*; + +@Target({ + ElementType.METHOD, + ElementType.FIELD, + ElementType.ANNOTATION_TYPE, + ElementType.CONSTRUCTOR, + ElementType.PARAMETER, + ElementType.TYPE_USE +}) +@Retention(RetentionPolicy.RUNTIME) +@Documented +@Constraint( + validatedBy = {InEnumValidator.class, InEnumCollectionValidator.class} +) +public @interface InEnum { + + /** + * @return 实现 ArrayValuable 接口的类 + */ + Class> value(); + + String message() default "必须在指定范围 {value}"; + + Class[] groups() default {}; + + Class[] payload() default {}; + +} diff --git a/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/validation/InEnumCollectionValidator.java b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/validation/InEnumCollectionValidator.java new file mode 100644 index 0000000..9dea8ff --- /dev/null +++ b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/validation/InEnumCollectionValidator.java @@ -0,0 +1,44 @@ +package com.platform.marketing.framework.common.validation; + +import cn.hutool.core.collection.CollUtil; +import com.platform.marketing.framework.common.core.ArrayValuable; + +import javax.validation.ConstraintValidator; +import javax.validation.ConstraintValidatorContext; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.List; + +public class InEnumCollectionValidator implements ConstraintValidator> { + + private List values; + + @Override + public void initialize(InEnum annotation) { + ArrayValuable[] values = annotation.value().getEnumConstants(); + if (values.length == 0) { + this.values = Collections.emptyList(); + } else { + this.values = Arrays.asList(values[0].array()); + } + } + + @Override + public boolean isValid(Collection list, ConstraintValidatorContext context) { + if (list == null) { + return true; + } + // 校验通过 + if (CollUtil.containsAll(values, list)) { + return true; + } + // 校验不通过,自定义提示语句 + context.disableDefaultConstraintViolation(); // 禁用默认的 message 的值 + context.buildConstraintViolationWithTemplate(context.getDefaultConstraintMessageTemplate() + .replaceAll("\\{value}", CollUtil.join(list, ","))).addConstraintViolation(); // 重新添加错误提示语句 + return false; + } + +} + diff --git a/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/validation/InEnumValidator.java b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/validation/InEnumValidator.java new file mode 100644 index 0000000..51dc929 --- /dev/null +++ b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/validation/InEnumValidator.java @@ -0,0 +1,43 @@ +package com.platform.marketing.framework.common.validation; + +import com.platform.marketing.framework.common.core.ArrayValuable; + +import javax.validation.ConstraintValidator; +import javax.validation.ConstraintValidatorContext; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +public class InEnumValidator implements ConstraintValidator { + + private List values; + + @Override + public void initialize(InEnum annotation) { + ArrayValuable[] values = annotation.value().getEnumConstants(); + if (values.length == 0) { + this.values = Collections.emptyList(); + } else { + this.values = Arrays.asList(values[0].array()); + } + } + + @Override + public boolean isValid(Object value, ConstraintValidatorContext context) { + // 为空时,默认不校验,即认为通过 + if (value == null) { + return true; + } + // 校验通过 + if (values.contains(value)) { + return true; + } + // 校验不通过,自定义提示语句 + context.disableDefaultConstraintViolation(); // 禁用默认的 message 的值 + context.buildConstraintViolationWithTemplate(context.getDefaultConstraintMessageTemplate() + .replaceAll("\\{value}", values.toString())).addConstraintViolation(); // 重新添加错误提示语句 + return false; + } + +} + diff --git a/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/validation/Mobile.java b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/validation/Mobile.java new file mode 100644 index 0000000..ce22988 --- /dev/null +++ b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/validation/Mobile.java @@ -0,0 +1,28 @@ +package com.platform.marketing.framework.common.validation; + +import javax.validation.Constraint; +import javax.validation.Payload; +import java.lang.annotation.*; + +@Target({ + ElementType.METHOD, + ElementType.FIELD, + ElementType.ANNOTATION_TYPE, + ElementType.CONSTRUCTOR, + ElementType.PARAMETER, + ElementType.TYPE_USE +}) +@Retention(RetentionPolicy.RUNTIME) +@Documented +@Constraint( + validatedBy = MobileValidator.class +) +public @interface Mobile { + + String message() default "手机号格式不正确"; + + Class[] groups() default {}; + + Class[] payload() default {}; + +} diff --git a/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/validation/MobileValidator.java b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/validation/MobileValidator.java new file mode 100644 index 0000000..93443e2 --- /dev/null +++ b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/validation/MobileValidator.java @@ -0,0 +1,25 @@ +package com.platform.marketing.framework.common.validation; + +import cn.hutool.core.util.StrUtil; +import com.platform.marketing.framework.common.util.validation.ValidationUtils; + +import javax.validation.ConstraintValidator; +import javax.validation.ConstraintValidatorContext; + +public class MobileValidator implements ConstraintValidator { + + @Override + public void initialize(Mobile annotation) { + } + + @Override + public boolean isValid(String value, ConstraintValidatorContext context) { + // 如果手机号为空,默认不校验,即校验通过 + if (StrUtil.isEmpty(value)) { + return true; + } + // 校验手机 + return ValidationUtils.isMobile(value); + } + +} diff --git a/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/validation/Telephone.java b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/validation/Telephone.java new file mode 100644 index 0000000..dc5e1e4 --- /dev/null +++ b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/validation/Telephone.java @@ -0,0 +1,28 @@ +package com.platform.marketing.framework.common.validation; + +import javax.validation.Constraint; +import javax.validation.Payload; +import java.lang.annotation.*; + +@Target({ + ElementType.METHOD, + ElementType.FIELD, + ElementType.ANNOTATION_TYPE, + ElementType.CONSTRUCTOR, + ElementType.PARAMETER, + ElementType.TYPE_USE +}) +@Retention(RetentionPolicy.RUNTIME) +@Documented +@Constraint( + validatedBy = TelephoneValidator.class +) +public @interface Telephone { + + String message() default "电话格式不正确"; + + Class[] groups() default {}; + + Class[] payload() default {}; + +} diff --git a/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/validation/TelephoneValidator.java b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/validation/TelephoneValidator.java new file mode 100644 index 0000000..db27800 --- /dev/null +++ b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/validation/TelephoneValidator.java @@ -0,0 +1,25 @@ +package com.platform.marketing.framework.common.validation; + +import cn.hutool.core.text.CharSequenceUtil; +import cn.hutool.core.util.PhoneUtil; + +import javax.validation.ConstraintValidator; +import javax.validation.ConstraintValidatorContext; + +public class TelephoneValidator implements ConstraintValidator { + + @Override + public void initialize(Telephone annotation) { + } + + @Override + public boolean isValid(String value, ConstraintValidatorContext context) { + // 如果手机号为空,默认不校验,即校验通过 + if (CharSequenceUtil.isEmpty(value)) { + return true; + } + // 校验手机 + return PhoneUtil.isTel(value) || PhoneUtil.isPhone(value); + } + +} diff --git a/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/validation/package-info.java b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/validation/package-info.java new file mode 100644 index 0000000..84a02b1 --- /dev/null +++ b/marketing-framework/marketing-common/src/main/java/com/platform/marketing/framework/common/validation/package-info.java @@ -0,0 +1,4 @@ +/** + * 使用 Hibernate Validator 实现参数校验 + */ +package com.platform.marketing.framework.common.validation; diff --git a/marketing-framework/marketing-spring-boot-starter-biz-ip/.flattened-pom.xml b/marketing-framework/marketing-spring-boot-starter-biz-ip/.flattened-pom.xml new file mode 100644 index 0000000..73f65a1 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-biz-ip/.flattened-pom.xml @@ -0,0 +1,69 @@ + + + 4.0.0 + com.platform + marketing-spring-boot-starter-biz-ip + 0.0.1-jdk8-SNAPSHOT + marketing-spring-boot-starter-biz-ip + IP 拓展,支持如下功能: + 1. IP 功能:查询 IP 对应的城市信息 + 基于 https://gitee.com/lionsoul/ip2region 实现 + 2. 城市功能:查询城市编码对应的城市信息 + 基于 https://github.com/modood/Administrative-divisions-of-China 实现 + https://github.com/makemyownlife/platform-sms-pro + + + com.platform + marketing-common + 0.0.1-jdk8-SNAPSHOT + compile + + + org.lionsoul + ip2region + 2.7.0 + compile + + + org.projectlombok + lombok + 1.18.36 + compile + + + org.slf4j + slf4j-api + 1.7.36 + provided + + + + + huaweicloud + huawei + https://mirrors.huaweicloud.com/repository/maven/ + + + aliyunmaven + aliyun + https://maven.aliyun.com/repository/public + + + + false + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + + + false + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + + diff --git a/marketing-framework/marketing-spring-boot-starter-biz-ip/pom.xml b/marketing-framework/marketing-spring-boot-starter-biz-ip/pom.xml new file mode 100644 index 0000000..a633f13 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-biz-ip/pom.xml @@ -0,0 +1,49 @@ + + + + marketing-framework + com.platform + ${revision} + + 4.0.0 + marketing-spring-boot-starter-biz-ip + jar + + ${project.artifactId} + IP 拓展,支持如下功能: + 1. IP 功能:查询 IP 对应的城市信息 + 基于 https://gitee.com/lionsoul/ip2region 实现 + 2. 城市功能:查询城市编码对应的城市信息 + 基于 https://github.com/modood/Administrative-divisions-of-China 实现 + + https://github.com/makemyownlife/platform-sms-pro + + + + com.platform + marketing-common + + + + + org.lionsoul + ip2region + + + + org.projectlombok + lombok + + + + org.slf4j + slf4j-api + provided + + + + + + diff --git a/marketing-framework/marketing-spring-boot-starter-biz-ip/src/main/java/com/platform/marketing/framework/ip/core/Area.java b/marketing-framework/marketing-spring-boot-starter-biz-ip/src/main/java/com/platform/marketing/framework/ip/core/Area.java new file mode 100644 index 0000000..7e53632 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-biz-ip/src/main/java/com/platform/marketing/framework/ip/core/Area.java @@ -0,0 +1,61 @@ +package com.platform.marketing.framework.ip.core; + +import com.platform.marketing.framework.ip.core.enums.AreaTypeEnum; +import com.fasterxml.jackson.annotation.JsonBackReference; +import com.fasterxml.jackson.annotation.JsonManagedReference; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; + +import java.util.List; + +/** + * 区域节点,包括国家、省份、城市、地区等信息 + * + * 数据可见 resources/area.csv 文件 + * + + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@ToString(exclude = {"parent"}) // 参见 https://gitee.com/marketingcode/marketing-cloud-mini/pulls/2 原因 +public class Area { + + /** + * 编号 - 全球,即根目录 + */ + public static final Integer ID_GLOBAL = 0; + /** + * 编号 - 中国 + */ + public static final Integer ID_CHINA = 1; + + /** + * 编号 + */ + private Integer id; + /** + * 名字 + */ + private String name; + /** + * 类型 + * + * 枚举 {@link AreaTypeEnum} + */ + private Integer type; + + /** + * 父节点 + */ + @JsonManagedReference + private Area parent; + /** + * 子节点 + */ + @JsonBackReference + private List children; + +} diff --git a/marketing-framework/marketing-spring-boot-starter-biz-ip/src/main/java/com/platform/marketing/framework/ip/core/enums/AreaTypeEnum.java b/marketing-framework/marketing-spring-boot-starter-biz-ip/src/main/java/com/platform/marketing/framework/ip/core/enums/AreaTypeEnum.java new file mode 100644 index 0000000..906f0f4 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-biz-ip/src/main/java/com/platform/marketing/framework/ip/core/enums/AreaTypeEnum.java @@ -0,0 +1,39 @@ +package com.platform.marketing.framework.ip.core.enums; + +import com.platform.marketing.framework.common.core.ArrayValuable; +import lombok.AllArgsConstructor; +import lombok.Getter; + +import java.util.Arrays; + +/** + * 区域类型枚举 + * + + */ +@AllArgsConstructor +@Getter +public enum AreaTypeEnum implements ArrayValuable { + + COUNTRY(1, "国家"), + PROVINCE(2, "省份"), + CITY(3, "城市"), + DISTRICT(4, "地区"), // 县、镇、区等 + ; + + public static final Integer[] ARRAYS = Arrays.stream(values()).map(AreaTypeEnum::getType).toArray(Integer[]::new); + + /** + * 类型 + */ + private final Integer type; + /** + * 名字 + */ + private final String name; + + @Override + public Integer[] array() { + return ARRAYS; + } +} diff --git a/marketing-framework/marketing-spring-boot-starter-biz-ip/src/main/java/com/platform/marketing/framework/ip/core/utils/AreaUtils.java b/marketing-framework/marketing-spring-boot-starter-biz-ip/src/main/java/com/platform/marketing/framework/ip/core/utils/AreaUtils.java new file mode 100644 index 0000000..20b2d9c --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-biz-ip/src/main/java/com/platform/marketing/framework/ip/core/utils/AreaUtils.java @@ -0,0 +1,214 @@ +package com.platform.marketing.framework.ip.core.utils; + +import cn.hutool.core.io.resource.ResourceUtil; +import cn.hutool.core.lang.Assert; +import cn.hutool.core.text.csv.CsvRow; +import cn.hutool.core.text.csv.CsvUtil; +import com.platform.marketing.framework.common.util.object.ObjectUtils; +import com.platform.marketing.framework.ip.core.Area; +import com.platform.marketing.framework.ip.core.enums.AreaTypeEnum; +import lombok.NonNull; +import lombok.extern.slf4j.Slf4j; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.function.Function; + +import static com.platform.marketing.framework.common.util.collection.CollectionUtils.convertList; +import static com.platform.marketing.framework.common.util.collection.CollectionUtils.findFirst; + +/** + * 区域工具类 + * + + */ +@Slf4j +public class AreaUtils { + + /** + * 初始化 SEARCHER + */ + @SuppressWarnings("InstantiationOfUtilityClass") + private final static AreaUtils INSTANCE = new AreaUtils(); + + /** + * Area 内存缓存,提升访问速度 + */ + private static Map areas; + + private AreaUtils() { + long now = System.currentTimeMillis(); + areas = new HashMap<>(); + areas.put(Area.ID_GLOBAL, new Area(Area.ID_GLOBAL, "全球", 0, + null, new ArrayList<>())); + // 从 csv 中加载数据 + List rows = CsvUtil.getReader().read(ResourceUtil.getUtf8Reader("area.csv")).getRows(); + rows.remove(0); // 删除 header + for (CsvRow row : rows) { + // 创建 Area 对象 + Area area = new Area(Integer.valueOf(row.get(0)), row.get(1), Integer.valueOf(row.get(2)), + null, new ArrayList<>()); + // 添加到 areas 中 + areas.put(area.getId(), area); + } + + // 构建父子关系:因为 Area 中没有 parentId 字段,所以需要重复读取 + for (CsvRow row : rows) { + Area area = areas.get(Integer.valueOf(row.get(0))); // 自己 + Area parent = areas.get(Integer.valueOf(row.get(3))); // 父 + Assert.isTrue(area != parent, "{}:父子节点相同", area.getName()); + area.setParent(parent); + parent.getChildren().add(area); + } + log.info("启动加载 AreaUtils 成功,耗时 ({}) 毫秒", System.currentTimeMillis() - now); + } + + /** + * 获得指定编号对应的区域 + * + * @param id 区域编号 + * @return 区域 + */ + public static Area getArea(Integer id) { + return areas.get(id); + } + + /** + * 获得指定区域对应的编号 + * + * @param pathStr 区域路径,例如说:河南省/石家庄市/新华区 + * @return 区域 + */ + public static Area parseArea(String pathStr) { + String[] paths = pathStr.split("/"); + Area area = null; + for (String path : paths) { + if (area == null) { + area = findFirst(areas.values(), item -> item.getName().equals(path)); + } else { + area = findFirst(area.getChildren(), item -> item.getName().equals(path)); + } + } + return area; + } + + /** + * 获取所有节点的全路径名称如:河南省/石家庄市/新华区 + * + * @param areas 地区树 + * @return 所有节点的全路径名称 + */ + public static List getAreaNodePathList(List areas) { + List paths = new ArrayList<>(); + areas.forEach(area -> getAreaNodePathList(area, "", paths)); + return paths; + } + + /** + * 构建一棵树的所有节点的全路径名称,并将其存储为 "祖先/父级/子级" 的形式 + * + * @param node 父节点 + * @param path 全路径名称 + * @param paths 全路径名称列表,省份/城市/地区 + */ + private static void getAreaNodePathList(Area node, String path, List paths) { + if (node == null) { + return; + } + // 构建当前节点的路径 + String currentPath = path.isEmpty() ? node.getName() : path + "/" + node.getName(); + paths.add(currentPath); + // 递归遍历子节点 + for (Area child : node.getChildren()) { + getAreaNodePathList(child, currentPath, paths); + } + } + + /** + * 格式化区域 + * + * @param id 区域编号 + * @return 格式化后的区域 + */ + public static String format(Integer id) { + return format(id, " "); + } + + /** + * 格式化区域 + * + * 例如说: + * 1. id = “静安区”时:上海 上海市 静安区 + * 2. id = “上海市”时:上海 上海市 + * 3. id = “上海”时:上海 + * 4. id = “美国”时:美国 + * 当区域在中国时,默认不显示中国 + * + * @param id 区域编号 + * @param separator 分隔符 + * @return 格式化后的区域 + */ + public static String format(Integer id, String separator) { + // 获得区域 + Area area = areas.get(id); + if (area == null) { + return null; + } + + // 格式化 + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < AreaTypeEnum.values().length; i++) { // 避免死循环 + sb.insert(0, area.getName()); + // “递归”父节点 + area = area.getParent(); + if (area == null + || ObjectUtils.equalsAny(area.getId(), Area.ID_GLOBAL, Area.ID_CHINA)) { // 跳过父节点为中国的情况 + break; + } + sb.insert(0, separator); + } + return sb.toString(); + } + + /** + * 获取指定类型的区域列表 + * + * @param type 区域类型 + * @param func 转换函数 + * @param 结果类型 + * @return 区域列表 + */ + public static List getByType(AreaTypeEnum type, Function func) { + return convertList(areas.values(), func, area -> type.getType().equals(area.getType())); + } + + /** + * 根据区域编号、上级区域类型,获取上级区域编号 + * + * @param id 区域编号 + * @param type 区域类型 + * @return 上级区域编号 + */ + public static Integer getParentIdByType(Integer id, @NonNull AreaTypeEnum type) { + for (int i = 0; i < Byte.MAX_VALUE; i++) { + Area area = AreaUtils.getArea(id); + if (area == null) { + return null; + } + // 情况一:匹配到,返回它 + if (type.getType().equals(area.getType())) { + return area.getId(); + } + // 情况二:找到根节点,返回空 + if (area.getParent() == null || area.getParent().getId() == null) { + return null; + } + // 其它:继续向上查找 + id = area.getParent().getId(); + } + return null; + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-biz-ip/src/main/java/com/platform/marketing/framework/ip/core/utils/IPUtils.java b/marketing-framework/marketing-spring-boot-starter-biz-ip/src/main/java/com/platform/marketing/framework/ip/core/utils/IPUtils.java new file mode 100644 index 0000000..35fc748 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-biz-ip/src/main/java/com/platform/marketing/framework/ip/core/utils/IPUtils.java @@ -0,0 +1,87 @@ +package com.platform.marketing.framework.ip.core.utils; + +import cn.hutool.core.io.resource.ResourceUtil; +import com.platform.marketing.framework.ip.core.Area; +import lombok.SneakyThrows; +import lombok.extern.slf4j.Slf4j; +import org.lionsoul.ip2region.xdb.Searcher; + +import java.io.IOException; + +/** + * IP 工具类 + * + * IP 数据源来自 ip2region.xdb 精简版,基于 项目 + * + * @author wanglhup + */ +@Slf4j +public class IPUtils { + + /** + * 初始化 SEARCHER + */ + @SuppressWarnings("InstantiationOfUtilityClass") + private final static IPUtils INSTANCE = new IPUtils(); + + /** + * IP 查询器,启动加载到内存中 + */ + private static Searcher SEARCHER; + + /** + * 私有化构造 + */ + private IPUtils() { + try { + long now = System.currentTimeMillis(); + byte[] bytes = ResourceUtil.readBytes("ip2region.xdb"); + SEARCHER = Searcher.newWithBuffer(bytes); + log.info("启动加载 IPUtils 成功,耗时 ({}) 毫秒", System.currentTimeMillis() - now); + } catch (IOException e) { + log.error("启动加载 IPUtils 失败", e); + } + } + + /** + * 查询 IP 对应的地区编号 + * + * @param ip IP 地址,格式为 127.0.0.1 + * @return 地区id + */ + @SneakyThrows + public static Integer getAreaId(String ip) { + return Integer.parseInt(SEARCHER.search(ip.trim())); + } + + /** + * 查询 IP 对应的地区编号 + * + * @param ip IP 地址的时间戳,格式参考{@link Searcher#checkIP(String)} 的返回 + * @return 地区编号 + */ + @SneakyThrows + public static Integer getAreaId(long ip) { + return Integer.parseInt(SEARCHER.search(ip)); + } + + /** + * 查询 IP 对应的地区 + * + * @param ip IP 地址,格式为 127.0.0.1 + * @return 地区 + */ + public static Area getArea(String ip) { + return AreaUtils.getArea(getAreaId(ip)); + } + + /** + * 查询 IP 对应的地区 + * + * @param ip IP 地址的时间戳,格式参考{@link Searcher#checkIP(String)} 的返回 + * @return 地区 + */ + public static Area getArea(long ip) { + return AreaUtils.getArea(getAreaId(ip)); + } +} diff --git a/marketing-framework/marketing-spring-boot-starter-biz-ip/src/main/resources/area.csv b/marketing-framework/marketing-spring-boot-starter-biz-ip/src/main/resources/area.csv new file mode 100644 index 0000000..0dd830e --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-biz-ip/src/main/resources/area.csv @@ -0,0 +1,3662 @@ +id,name,type,parentId +1,中国,1,0 +2,蒙古,1,0 +3,朝鲜,1,0 +4,韩国,1,0 +5,日本,1,0 +6,菲律宾,1,0 +7,越南,1,0 +8,老挝,1,0 +9,柬埔寨,1,0 +10,缅甸,1,0 +11,泰国,1,0 +12,马来西亚,1,0 +13,文莱,1,0 +14,新加坡,1,0 +15,印度尼西亚,1,0 +16,东帝汶,1,0 +17,尼泊尔,1,0 +18,不丹,1,0 +19,孟加拉国,1,0 +20,印度,1,0 +21,巴基斯坦,1,0 +22,斯里兰卡,1,0 +23,马尔代夫,1,0 +24,哈萨克斯坦,1,0 +25,吉尔吉斯斯坦,1,0 +26,塔吉克斯坦,1,0 +27,乌兹别克斯坦,1,0 +28,土库曼斯坦,1,0 +29,阿富汗,1,0 +30,伊拉克,1,0 +31,伊朗,1,0 +32,叙利亚,1,0 +33,约旦,1,0 +34,黎巴嫩,1,0 +35,以色列,1,0 +36,巴勒斯坦,1,0 +37,沙特阿拉伯,1,0 +38,巴林,1,0 +39,卡塔尔,1,0 +40,科威特,1,0 +41,阿拉伯联合酋长国,1,0 +42,阿曼,1,0 +43,也门,1,0 +44,格鲁吉亚,1,0 +45,亚美尼亚,1,0 +46,阿塞拜疆,1,0 +47,土耳其,1,0 +48,塞浦路斯,1,0 +49,芬兰,1,0 +50,瑞典,1,0 +51,挪威,1,0 +52,冰岛,1,0 +53,丹麦,1,0 +54,爱沙尼亚,1,0 +55,拉脱维亚,1,0 +56,立陶宛,1,0 +57,白俄罗斯,1,0 +58,俄罗斯,1,0 +59,乌克兰,1,0 +60,摩尔多瓦,1,0 +61,波兰,1,0 +62,捷克,1,0 +63,斯洛伐克,1,0 +64,匈牙利,1,0 +65,德国,1,0 +66,奥地利,1,0 +67,瑞士,1,0 +68,列支敦士登,1,0 +69,英国,1,0 +70,爱尔兰,1,0 +71,荷兰,1,0 +72,比利时,1,0 +73,卢森堡,1,0 +74,法国,1,0 +75,摩纳哥,1,0 +76,罗马尼亚,1,0 +77,保加利亚,1,0 +78,塞尔维亚,1,0 +79,马其顿,1,0 +80,阿尔巴尼亚,1,0 +81,希腊,1,0 +82,斯洛文尼亚,1,0 +83,克罗地亚,1,0 +84,波斯尼亚和墨塞哥维那,1,0 +85,意大利,1,0 +86,梵蒂冈,1,0 +87,圣马力诺,1,0 +88,马耳他,1,0 +89,西班牙,1,0 +90,葡萄牙,1,0 +91,安道尔共和国,1,0 +92,埃及,1,0 +93,利比亚,1,0 +94,苏丹,1,0 +95,突尼斯,1,0 +96,阿尔及利亚,1,0 +97,摩洛哥,1,0 +98,亚速尔群岛,1,0 +99,马德拉群岛,1,0 +100,埃塞俄比亚,1,0 +101,厄立特里亚,1,0 +102,索马里,1,0 +103,吉布提,1,0 +104,肯尼亚,1,0 +105,坦桑尼亚,1,0 +106,乌干达,1,0 +107,卢旺达,1,0 +108,布隆迪,1,0 +109,塞舌尔,1,0 +110,圣多美及普林西比,1,0 +111,塞内加尔,1,0 +112,冈比亚,1,0 +113,马里,1,0 +114,布基纳法索,1,0 +115,几内亚,1,0 +116,几内亚比绍,1,0 +117,佛得角,1,0 +118,塞拉利昂,1,0 +119,利比里亚,1,0 +120,科特迪瓦,1,0 +121,加纳,1,0 +122,多哥,1,0 +123,贝宁,1,0 +124,尼日尔,1,0 +125,加那利群岛,1,0 +126,赞比亚,1,0 +127,安哥拉,1,0 +128,津巴布韦,1,0 +129,马拉维,1,0 +130,莫桑比克,1,0 +131,博茨瓦纳,1,0 +132,纳米比亚,1,0 +133,南非,1,0 +134,斯威士兰,1,0 +135,莱索托,1,0 +136,马达加斯加,1,0 +137,科摩罗,1,0 +138,毛里求斯,1,0 +139,留尼旺,1,0 +140,圣赫勒拿,1,0 +141,澳大利亚,1,0 +142,新西兰,1,0 +143,巴布亚新几内亚,1,0 +144,所罗门群岛,1,0 +145,瓦努阿图共和国,1,0 +146,密克罗尼西亚,1,0 +147,马绍尔群岛,1,0 +148,帕劳,1,0 +149,瑙鲁,1,0 +150,基里巴斯,1,0 +151,图瓦卢,1,0 +152,萨摩亚,1,0 +153,斐济,1,0 +154,汤加,1,0 +155,库克群岛,1,0 +156,关岛,1,0 +157,新喀里多尼亚,1,0 +158,法属波利尼西亚,1,0 +159,皮特凯恩岛,1,0 +160,瓦利斯与富图纳,1,0 +161,纽埃,1,0 +162,托克劳,1,0 +163,美属萨摩亚,1,0 +164,北马里亚纳,1,0 +165,加拿大,1,0 +166,美国,1,0 +167,墨西哥,1,0 +168,格陵兰,1,0 +169,危地马拉,1,0 +170,伯利兹,1,0 +171,萨尔瓦多,1,0 +172,洪都拉斯,1,0 +173,尼加拉瓜,1,0 +174,哥斯达黎加,1,0 +175,巴拿马,1,0 +176,巴哈马,1,0 +177,古巴,1,0 +178,牙买加,1,0 +179,海地,1,0 +180,多米尼加共和国,1,0 +181,安提瓜和巴布达,1,0 +182,圣基茨和尼维斯,1,0 +183,多米尼克,1,0 +184,圣卢西亚,1,0 +185,圣文森特和格林纳丁斯,1,0 +186,格林纳达,1,0 +187,巴巴多斯,1,0 +188,特立尼达和多巴哥,1,0 +189,波多黎各,1,0 +190,英属维尔京群岛,1,0 +191,美属维尔京群岛,1,0 +192,安圭拉,1,0 +193,蒙特塞拉特岛,1,0 +194,瓜德罗普,1,0 +195,马提尼克,1,0 +196,荷属安的列斯,1,0 +197,阿鲁巴,1,0 +198,特克斯和凯科斯群岛,1,0 +199,开曼群岛,1,0 +200,百慕大,1,0 +201,哥伦比亚,1,0 +202,委内瑞拉,1,0 +203,圭亚那,1,0 +204,法属圭亚那,1,0 +205,苏里南,1,0 +206,厄瓜多尔,1,0 +207,秘鲁,1,0 +208,玻利维亚,1,0 +209,巴西,1,0 +210,智利,1,0 +211,阿根廷,1,0 +212,乌拉圭,1,0 +213,巴拉圭,1,0 +214,波黑,1,0 +215,直布罗陀,1,0 +216,新喀里多尼亚群岛,1,0 +217,瓦利斯和富图纳群岛,1,0 +218,泽西岛,1,0 +219,黑山,1,0 +220,英属马恩岛,1,0 +221,尼日利亚,1,0 +222,喀麦隆,1,0 +223,加蓬,1,0 +224,乍得,1,0 +225,刚果共和国,1,0 +226,中非共和国,1,0 +227,南苏丹,1,0 +228,赤道几内亚,1,0 +229,毛里塔尼亚,1,0 +230,刚果民主共和国,1,0 +231,留尼汪岛,1,0 +232,格陵兰岛,1,0 +233,法罗群岛,1,0 +234,根西岛,1,0 +235,百慕大群岛,1,0 +236,圣皮埃尔和密克隆群岛,1,0 +237,法属圣马丁,1,0 +238,奥兰群岛,1,0 +239,北马里亚纳群岛,1,0 +240,库拉索,1,0 +241,博内尔岛,1,0 +242,圣马丁岛,1,0 +243,圣巴泰勒米岛,1,0 +244,福克兰群岛,1,0 +245,圣多美和普林西比,1,0 +246,英属印度洋领地,1,0 +247,东萨摩亚,1,0 +248,诺福克岛,1,0 +110000,北京市,2,1 +120000,天津市,2,1 +130000,河北省,2,1 +140000,山西省,2,1 +150000,内蒙古自治区,2,1 +210000,辽宁省,2,1 +220000,吉林省,2,1 +230000,黑龙江省,2,1 +310000,上海市,2,1 +320000,江苏省,2,1 +330000,浙江省,2,1 +340000,安徽省,2,1 +350000,福建省,2,1 +360000,江西省,2,1 +370000,山东省,2,1 +410000,河南省,2,1 +420000,湖北省,2,1 +430000,湖南省,2,1 +440000,广东省,2,1 +450000,广西壮族自治区,2,1 +460000,海南省,2,1 +500000,重庆市,2,1 +510000,四川省,2,1 +520000,贵州省,2,1 +530000,云南省,2,1 +540000,西藏自治区,2,1 +610000,陕西省,2,1 +620000,甘肃省,2,1 +630000,青海省,2,1 +640000,宁夏回族自治区,2,1 +650000,新疆维吾尔自治区,2,1 +110100,北京市,3,110000 +120100,天津市,3,120000 +130100,石家庄市,3,130000 +130200,唐山市,3,130000 +130300,秦皇岛市,3,130000 +130400,邯郸市,3,130000 +130500,邢台市,3,130000 +130600,保定市,3,130000 +130700,张家口市,3,130000 +130800,承德市,3,130000 +130900,沧州市,3,130000 +131000,廊坊市,3,130000 +131100,衡水市,3,130000 +140100,太原市,3,140000 +140200,大同市,3,140000 +140300,阳泉市,3,140000 +140400,长治市,3,140000 +140500,晋城市,3,140000 +140600,朔州市,3,140000 +140700,晋中市,3,140000 +140800,运城市,3,140000 +140900,忻州市,3,140000 +141000,临汾市,3,140000 +141100,吕梁市,3,140000 +150100,呼和浩特市,3,150000 +150200,包头市,3,150000 +150300,乌海市,3,150000 +150400,赤峰市,3,150000 +150500,通辽市,3,150000 +150600,鄂尔多斯市,3,150000 +150700,呼伦贝尔市,3,150000 +150800,巴彦淖尔市,3,150000 +150900,乌兰察布市,3,150000 +152200,兴安盟,3,150000 +152500,锡林郭勒盟,3,150000 +152900,阿拉善盟,3,150000 +210100,沈阳市,3,210000 +210200,大连市,3,210000 +210300,鞍山市,3,210000 +210400,抚顺市,3,210000 +210500,本溪市,3,210000 +210600,丹东市,3,210000 +210700,锦州市,3,210000 +210800,营口市,3,210000 +210900,阜新市,3,210000 +211000,辽阳市,3,210000 +211100,盘锦市,3,210000 +211200,铁岭市,3,210000 +211300,朝阳市,3,210000 +211400,葫芦岛市,3,210000 +220100,长春市,3,220000 +220200,吉林市,3,220000 +220300,四平市,3,220000 +220400,辽源市,3,220000 +220500,通化市,3,220000 +220600,白山市,3,220000 +220700,松原市,3,220000 +220800,白城市,3,220000 +222400,延边朝鲜族自治州,3,220000 +230100,哈尔滨市,3,230000 +230200,齐齐哈尔市,3,230000 +230300,鸡西市,3,230000 +230400,鹤岗市,3,230000 +230500,双鸭山市,3,230000 +230600,大庆市,3,230000 +230700,伊春市,3,230000 +230800,佳木斯市,3,230000 +230900,七台河市,3,230000 +231000,牡丹江市,3,230000 +231100,黑河市,3,230000 +231200,绥化市,3,230000 +232700,大兴安岭地区,3,230000 +310100,上海市,3,310000 +320100,南京市,3,320000 +320200,无锡市,3,320000 +320300,徐州市,3,320000 +320400,常州市,3,320000 +320500,苏州市,3,320000 +320600,南通市,3,320000 +320700,连云港市,3,320000 +320800,淮安市,3,320000 +320900,盐城市,3,320000 +321000,扬州市,3,320000 +321100,镇江市,3,320000 +321200,泰州市,3,320000 +321300,宿迁市,3,320000 +330100,杭州市,3,330000 +330200,宁波市,3,330000 +330300,温州市,3,330000 +330400,嘉兴市,3,330000 +330500,湖州市,3,330000 +330600,绍兴市,3,330000 +330700,金华市,3,330000 +330800,衢州市,3,330000 +330900,舟山市,3,330000 +331000,台州市,3,330000 +331100,丽水市,3,330000 +340100,合肥市,3,340000 +340200,芜湖市,3,340000 +340300,蚌埠市,3,340000 +340400,淮南市,3,340000 +340500,马鞍山市,3,340000 +340600,淮北市,3,340000 +340700,铜陵市,3,340000 +340800,安庆市,3,340000 +341000,黄山市,3,340000 +341100,滁州市,3,340000 +341200,阜阳市,3,340000 +341300,宿州市,3,340000 +341500,六安市,3,340000 +341600,亳州市,3,340000 +341700,池州市,3,340000 +341800,宣城市,3,340000 +350100,福州市,3,350000 +350200,厦门市,3,350000 +350300,莆田市,3,350000 +350400,三明市,3,350000 +350500,泉州市,3,350000 +350600,漳州市,3,350000 +350700,南平市,3,350000 +350800,龙岩市,3,350000 +350900,宁德市,3,350000 +360100,南昌市,3,360000 +360200,景德镇市,3,360000 +360300,萍乡市,3,360000 +360400,九江市,3,360000 +360500,新余市,3,360000 +360600,鹰潭市,3,360000 +360700,赣州市,3,360000 +360800,吉安市,3,360000 +360900,宜春市,3,360000 +361000,抚州市,3,360000 +361100,上饶市,3,360000 +370100,济南市,3,370000 +370200,青岛市,3,370000 +370300,淄博市,3,370000 +370400,枣庄市,3,370000 +370500,东营市,3,370000 +370600,烟台市,3,370000 +370700,潍坊市,3,370000 +370800,济宁市,3,370000 +370900,泰安市,3,370000 +371000,威海市,3,370000 +371100,日照市,3,370000 +371300,临沂市,3,370000 +371400,德州市,3,370000 +371500,聊城市,3,370000 +371600,滨州市,3,370000 +371700,菏泽市,3,370000 +410100,郑州市,3,410000 +410200,开封市,3,410000 +410300,洛阳市,3,410000 +410400,平顶山市,3,410000 +410500,安阳市,3,410000 +410600,鹤壁市,3,410000 +410700,新乡市,3,410000 +410800,焦作市,3,410000 +410900,濮阳市,3,410000 +411000,许昌市,3,410000 +411100,漯河市,3,410000 +411200,三门峡市,3,410000 +411300,南阳市,3,410000 +411400,商丘市,3,410000 +411500,信阳市,3,410000 +411600,周口市,3,410000 +411700,驻马店市,3,410000 +419000,省直辖县级行政区划,3,410000 +420100,武汉市,3,420000 +420200,黄石市,3,420000 +420300,十堰市,3,420000 +420500,宜昌市,3,420000 +420600,襄阳市,3,420000 +420700,鄂州市,3,420000 +420800,荆门市,3,420000 +420900,孝感市,3,420000 +421000,荆州市,3,420000 +421100,黄冈市,3,420000 +421200,咸宁市,3,420000 +421300,随州市,3,420000 +422800,恩施土家族苗族自治州,3,420000 +429000,省直辖县级行政区划,3,420000 +430100,长沙市,3,430000 +430200,株洲市,3,430000 +430300,湘潭市,3,430000 +430400,衡阳市,3,430000 +430500,邵阳市,3,430000 +430600,岳阳市,3,430000 +430700,常德市,3,430000 +430800,张家界市,3,430000 +430900,益阳市,3,430000 +431000,郴州市,3,430000 +431100,永州市,3,430000 +431200,怀化市,3,430000 +431300,娄底市,3,430000 +433100,湘西土家族苗族自治州,3,430000 +440100,广州市,3,440000 +440200,韶关市,3,440000 +440300,深圳市,3,440000 +440400,珠海市,3,440000 +440500,汕头市,3,440000 +440600,佛山市,3,440000 +440700,江门市,3,440000 +440800,湛江市,3,440000 +440900,茂名市,3,440000 +441200,肇庆市,3,440000 +441300,惠州市,3,440000 +441400,梅州市,3,440000 +441500,汕尾市,3,440000 +441600,河源市,3,440000 +441700,阳江市,3,440000 +441800,清远市,3,440000 +441900,东莞市,3,440000 +441901,莞城区,4,441900 +441902,南城区,4,441900 +441904,万江区,4,441900 +441905,石碣镇,4,441900 +441906,石龙镇,4,441900 +441907,茶山镇,4,441900 +441908,石排镇,4,441900 +441909,企石镇,4,441900 +441910,横沥镇,4,441900 +441911,桥头镇,4,441900 +441912,谢岗镇,4,441900 +441913,东坑镇,4,441900 +441914,常平镇,4,441900 +441915,寮步镇,4,441900 +441916,大朗镇,4,441900 +441917,麻涌镇,4,441900 +441918,中堂镇,4,441900 +441919,高埗镇,4,441900 +441920,樟木头镇,4,441900 +441921,大岭山镇,4,441900 +441922,望牛墩镇,4,441900 +441923,黄江镇,4,441900 +441924,洪梅镇,4,441900 +441925,清溪镇,4,441900 +441926,沙田镇,4,441900 +441927,道滘镇,4,441900 +441928,塘厦镇,4,441900 +441929,虎门镇,4,441900 +441930,厚街镇,4,441900 +441931,凤岗镇,4,441900 +441932,长安镇,4,441900 +442000,中山市,3,440000 +442001,石岐街道,4,442000 +442002,东区街道,4,442000 +442003,中山港街道,4,442000 +442004,西区街道,4,442000 +442005,南区街道,4,442000 +442006,五桂山街道,4,442000 +442007,民众街道,4,442000 +442008,南朗街道,4,442000 +442009,黄圃镇,4,442000 +442010,东凤镇,4,442000 +442011,古镇镇,4,442000 +442012,沙溪镇,4,442000 +442013,坦洲镇,4,442000 +442014,港口镇,4,442000 +442015,三角镇,4,442000 +442016,横栏镇,4,442000 +442017,南头镇,4,442000 +442018,阜沙镇,4,442000 +442019,三乡镇,4,442000 +442020,板芙镇,4,442000 +442021,大涌镇,4,442000 +442022,神湾镇,4,442000 +442023,小榄镇,4,442000 +445100,潮州市,3,440000 +445200,揭阳市,3,440000 +445300,云浮市,3,440000 +450100,南宁市,3,450000 +450200,柳州市,3,450000 +450300,桂林市,3,450000 +450400,梧州市,3,450000 +450500,北海市,3,450000 +450600,防城港市,3,450000 +450700,钦州市,3,450000 +450800,贵港市,3,450000 +450900,玉林市,3,450000 +451000,百色市,3,450000 +451100,贺州市,3,450000 +451200,河池市,3,450000 +451300,来宾市,3,450000 +451400,崇左市,3,450000 +460100,海口市,3,460000 +460200,三亚市,3,460000 +460300,三沙市,3,460000 +460400,儋州市,3,460000 +469000,省直辖县级行政区划,3,460000 +500100,重庆市,3,500000 +510100,成都市,3,510000 +510300,自贡市,3,510000 +510400,攀枝花市,3,510000 +510500,泸州市,3,510000 +510600,德阳市,3,510000 +510700,绵阳市,3,510000 +510800,广元市,3,510000 +510900,遂宁市,3,510000 +511000,内江市,3,510000 +511100,乐山市,3,510000 +511300,南充市,3,510000 +511400,眉山市,3,510000 +511500,宜宾市,3,510000 +511600,广安市,3,510000 +511700,达州市,3,510000 +511800,雅安市,3,510000 +511900,巴中市,3,510000 +512000,资阳市,3,510000 +513200,阿坝藏族羌族自治州,3,510000 +513300,甘孜藏族自治州,3,510000 +513400,凉山彝族自治州,3,510000 +520100,贵阳市,3,520000 +520200,六盘水市,3,520000 +520300,遵义市,3,520000 +520400,安顺市,3,520000 +520500,毕节市,3,520000 +520600,铜仁市,3,520000 +522300,黔西南布依族苗族自治州,3,520000 +522600,黔东南苗族侗族自治州,3,520000 +522700,黔南布依族苗族自治州,3,520000 +530100,昆明市,3,530000 +530300,曲靖市,3,530000 +530400,玉溪市,3,530000 +530500,保山市,3,530000 +530600,昭通市,3,530000 +530700,丽江市,3,530000 +530800,普洱市,3,530000 +530900,临沧市,3,530000 +532300,楚雄彝族自治州,3,530000 +532500,红河哈尼族彝族自治州,3,530000 +532600,文山壮族苗族自治州,3,530000 +532800,西双版纳傣族自治州,3,530000 +532900,大理白族自治州,3,530000 +533100,德宏傣族景颇族自治州,3,530000 +533300,怒江傈僳族自治州,3,530000 +533400,迪庆藏族自治州,3,530000 +540100,拉萨市,3,540000 +540200,日喀则市,3,540000 +540300,昌都市,3,540000 +540400,林芝市,3,540000 +540500,山南市,3,540000 +540600,那曲市,3,540000 +542500,阿里地区,3,540000 +610100,西安市,3,610000 +610200,铜川市,3,610000 +610300,宝鸡市,3,610000 +610400,咸阳市,3,610000 +610500,渭南市,3,610000 +610600,延安市,3,610000 +610700,汉中市,3,610000 +610800,榆林市,3,610000 +610900,安康市,3,610000 +611000,商洛市,3,610000 +620100,兰州市,3,620000 +620200,嘉峪关市,3,620000 +620300,金昌市,3,620000 +620400,白银市,3,620000 +620500,天水市,3,620000 +620600,武威市,3,620000 +620700,张掖市,3,620000 +620800,平凉市,3,620000 +620900,酒泉市,3,620000 +621000,庆阳市,3,620000 +621100,定西市,3,620000 +621200,陇南市,3,620000 +622900,临夏回族自治州,3,620000 +623000,甘南藏族自治州,3,620000 +630100,西宁市,3,630000 +630200,海东市,3,630000 +632200,海北藏族自治州,3,630000 +632300,黄南藏族自治州,3,630000 +632500,海南藏族自治州,3,630000 +632600,果洛藏族自治州,3,630000 +632700,玉树藏族自治州,3,630000 +632800,海西蒙古族藏族自治州,3,630000 +640100,银川市,3,640000 +640200,石嘴山市,3,640000 +640300,吴忠市,3,640000 +640400,固原市,3,640000 +640500,中卫市,3,640000 +650100,乌鲁木齐市,3,650000 +650200,克拉玛依市,3,650000 +650400,吐鲁番市,3,650000 +650500,哈密市,3,650000 +652300,昌吉回族自治州,3,650000 +652700,博尔塔拉蒙古自治州,3,650000 +652800,巴音郭楞蒙古自治州,3,650000 +652900,阿克苏地区,3,650000 +653000,克孜勒苏柯尔克孜自治州,3,650000 +653100,喀什地区,3,650000 +653200,和田地区,3,650000 +654000,伊犁哈萨克自治州,3,650000 +654200,塔城地区,3,650000 +654300,阿勒泰地区,3,650000 +659000,自治区直辖县级行政区划,3,650000 +110101,东城区,4,110100 +110102,西城区,4,110100 +110105,朝阳区,4,110100 +110106,丰台区,4,110100 +110107,石景山区,4,110100 +110108,海淀区,4,110100 +110109,门头沟区,4,110100 +110111,房山区,4,110100 +110112,通州区,4,110100 +110113,顺义区,4,110100 +110114,昌平区,4,110100 +110115,大兴区,4,110100 +110116,怀柔区,4,110100 +110117,平谷区,4,110100 +110118,密云区,4,110100 +110119,延庆区,4,110100 +120101,和平区,4,120100 +120102,河东区,4,120100 +120103,河西区,4,120100 +120104,南开区,4,120100 +120105,河北区,4,120100 +120106,红桥区,4,120100 +120110,东丽区,4,120100 +120111,西青区,4,120100 +120112,津南区,4,120100 +120113,北辰区,4,120100 +120114,武清区,4,120100 +120115,宝坻区,4,120100 +120116,滨海新区,4,120100 +120117,宁河区,4,120100 +120118,静海区,4,120100 +120119,蓟州区,4,120100 +130102,长安区,4,130100 +130104,桥西区,4,130100 +130105,新华区,4,130100 +130107,井陉矿区,4,130100 +130108,裕华区,4,130100 +130109,藁城区,4,130100 +130110,鹿泉区,4,130100 +130111,栾城区,4,130100 +130121,井陉县,4,130100 +130123,正定县,4,130100 +130125,行唐县,4,130100 +130126,灵寿县,4,130100 +130127,高邑县,4,130100 +130128,深泽县,4,130100 +130129,赞皇县,4,130100 +130130,无极县,4,130100 +130131,平山县,4,130100 +130132,元氏县,4,130100 +130133,赵县,4,130100 +130171,石家庄高新技术产业开发区,4,130100 +130172,石家庄循环化工园区,4,130100 +130181,辛集市,4,130100 +130183,晋州市,4,130100 +130184,新乐市,4,130100 +130202,路南区,4,130200 +130203,路北区,4,130200 +130204,古冶区,4,130200 +130205,开平区,4,130200 +130207,丰南区,4,130200 +130208,丰润区,4,130200 +130209,曹妃甸区,4,130200 +130224,滦南县,4,130200 +130225,乐亭县,4,130200 +130227,迁西县,4,130200 +130229,玉田县,4,130200 +130271,河北唐山芦台经济开发区,4,130200 +130272,唐山市汉沽管理区,4,130200 +130273,唐山高新技术产业开发区,4,130200 +130274,河北唐山海港经济开发区,4,130200 +130281,遵化市,4,130200 +130283,迁安市,4,130200 +130284,滦州市,4,130200 +130302,海港区,4,130300 +130303,山海关区,4,130300 +130304,北戴河区,4,130300 +130306,抚宁区,4,130300 +130321,青龙满族自治县,4,130300 +130322,昌黎县,4,130300 +130324,卢龙县,4,130300 +130371,秦皇岛市经济技术开发区,4,130300 +130372,北戴河新区,4,130300 +130402,邯山区,4,130400 +130403,丛台区,4,130400 +130404,复兴区,4,130400 +130406,峰峰矿区,4,130400 +130407,肥乡区,4,130400 +130408,永年区,4,130400 +130423,临漳县,4,130400 +130424,成安县,4,130400 +130425,大名县,4,130400 +130426,涉县,4,130400 +130427,磁县,4,130400 +130430,邱县,4,130400 +130431,鸡泽县,4,130400 +130432,广平县,4,130400 +130433,馆陶县,4,130400 +130434,魏县,4,130400 +130435,曲周县,4,130400 +130471,邯郸经济技术开发区,4,130400 +130473,邯郸冀南新区,4,130400 +130481,武安市,4,130400 +130502,襄都区,4,130500 +130503,信都区,4,130500 +130505,任泽区,4,130500 +130506,南和区,4,130500 +130522,临城县,4,130500 +130523,内丘县,4,130500 +130524,柏乡县,4,130500 +130525,隆尧县,4,130500 +130528,宁晋县,4,130500 +130529,巨鹿县,4,130500 +130530,新河县,4,130500 +130531,广宗县,4,130500 +130532,平乡县,4,130500 +130533,威县,4,130500 +130534,清河县,4,130500 +130535,临西县,4,130500 +130571,河北邢台经济开发区,4,130500 +130581,南宫市,4,130500 +130582,沙河市,4,130500 +130602,竞秀区,4,130600 +130606,莲池区,4,130600 +130607,满城区,4,130600 +130608,清苑区,4,130600 +130609,徐水区,4,130600 +130623,涞水县,4,130600 +130624,阜平县,4,130600 +130626,定兴县,4,130600 +130627,唐县,4,130600 +130628,高阳县,4,130600 +130629,容城县,4,130600 +130630,涞源县,4,130600 +130631,望都县,4,130600 +130632,安新县,4,130600 +130633,易县,4,130600 +130634,曲阳县,4,130600 +130635,蠡县,4,130600 +130636,顺平县,4,130600 +130637,博野县,4,130600 +130638,雄县,4,130600 +130671,保定高新技术产业开发区,4,130600 +130672,保定白沟新城,4,130600 +130681,涿州市,4,130600 +130682,定州市,4,130600 +130683,安国市,4,130600 +130684,高碑店市,4,130600 +130702,桥东区,4,130700 +130703,桥西区,4,130700 +130705,宣化区,4,130700 +130706,下花园区,4,130700 +130708,万全区,4,130700 +130709,崇礼区,4,130700 +130722,张北县,4,130700 +130723,康保县,4,130700 +130724,沽源县,4,130700 +130725,尚义县,4,130700 +130726,蔚县,4,130700 +130727,阳原县,4,130700 +130728,怀安县,4,130700 +130730,怀来县,4,130700 +130731,涿鹿县,4,130700 +130732,赤城县,4,130700 +130771,张家口经济开发区,4,130700 +130772,张家口市察北管理区,4,130700 +130773,张家口市塞北管理区,4,130700 +130802,双桥区,4,130800 +130803,双滦区,4,130800 +130804,鹰手营子矿区,4,130800 +130821,承德县,4,130800 +130822,兴隆县,4,130800 +130824,滦平县,4,130800 +130825,隆化县,4,130800 +130826,丰宁满族自治县,4,130800 +130827,宽城满族自治县,4,130800 +130828,围场满族蒙古族自治县,4,130800 +130871,承德高新技术产业开发区,4,130800 +130881,平泉市,4,130800 +130902,新华区,4,130900 +130903,运河区,4,130900 +130921,沧县,4,130900 +130922,青县,4,130900 +130923,东光县,4,130900 +130924,海兴县,4,130900 +130925,盐山县,4,130900 +130926,肃宁县,4,130900 +130927,南皮县,4,130900 +130928,吴桥县,4,130900 +130929,献县,4,130900 +130930,孟村回族自治县,4,130900 +130971,河北沧州经济开发区,4,130900 +130972,沧州高新技术产业开发区,4,130900 +130973,沧州渤海新区,4,130900 +130981,泊头市,4,130900 +130982,任丘市,4,130900 +130983,黄骅市,4,130900 +130984,河间市,4,130900 +131002,安次区,4,131000 +131003,广阳区,4,131000 +131022,固安县,4,131000 +131023,永清县,4,131000 +131024,香河县,4,131000 +131025,大城县,4,131000 +131026,文安县,4,131000 +131028,大厂回族自治县,4,131000 +131071,廊坊经济技术开发区,4,131000 +131081,霸州市,4,131000 +131082,三河市,4,131000 +131102,桃城区,4,131100 +131103,冀州区,4,131100 +131121,枣强县,4,131100 +131122,武邑县,4,131100 +131123,武强县,4,131100 +131124,饶阳县,4,131100 +131125,安平县,4,131100 +131126,故城县,4,131100 +131127,景县,4,131100 +131128,阜城县,4,131100 +131171,河北衡水高新技术产业开发区,4,131100 +131172,衡水滨湖新区,4,131100 +131182,深州市,4,131100 +140105,小店区,4,140100 +140106,迎泽区,4,140100 +140107,杏花岭区,4,140100 +140108,尖草坪区,4,140100 +140109,万柏林区,4,140100 +140110,晋源区,4,140100 +140121,清徐县,4,140100 +140122,阳曲县,4,140100 +140123,娄烦县,4,140100 +140171,山西转型综合改革示范区,4,140100 +140181,古交市,4,140100 +140212,新荣区,4,140200 +140213,平城区,4,140200 +140214,云冈区,4,140200 +140215,云州区,4,140200 +140221,阳高县,4,140200 +140222,天镇县,4,140200 +140223,广灵县,4,140200 +140224,灵丘县,4,140200 +140225,浑源县,4,140200 +140226,左云县,4,140200 +140271,山西大同经济开发区,4,140200 +140302,城区,4,140300 +140303,矿区,4,140300 +140311,郊区,4,140300 +140321,平定县,4,140300 +140322,盂县,4,140300 +140403,潞州区,4,140400 +140404,上党区,4,140400 +140405,屯留区,4,140400 +140406,潞城区,4,140400 +140423,襄垣县,4,140400 +140425,平顺县,4,140400 +140426,黎城县,4,140400 +140427,壶关县,4,140400 +140428,长子县,4,140400 +140429,武乡县,4,140400 +140430,沁县,4,140400 +140431,沁源县,4,140400 +140471,山西长治高新技术产业园区,4,140400 +140502,城区,4,140500 +140521,沁水县,4,140500 +140522,阳城县,4,140500 +140524,陵川县,4,140500 +140525,泽州县,4,140500 +140581,高平市,4,140500 +140602,朔城区,4,140600 +140603,平鲁区,4,140600 +140621,山阴县,4,140600 +140622,应县,4,140600 +140623,右玉县,4,140600 +140671,山西朔州经济开发区,4,140600 +140681,怀仁市,4,140600 +140702,榆次区,4,140700 +140703,太谷区,4,140700 +140721,榆社县,4,140700 +140722,左权县,4,140700 +140723,和顺县,4,140700 +140724,昔阳县,4,140700 +140725,寿阳县,4,140700 +140727,祁县,4,140700 +140728,平遥县,4,140700 +140729,灵石县,4,140700 +140781,介休市,4,140700 +140802,盐湖区,4,140800 +140821,临猗县,4,140800 +140822,万荣县,4,140800 +140823,闻喜县,4,140800 +140824,稷山县,4,140800 +140825,新绛县,4,140800 +140826,绛县,4,140800 +140827,垣曲县,4,140800 +140828,夏县,4,140800 +140829,平陆县,4,140800 +140830,芮城县,4,140800 +140881,永济市,4,140800 +140882,河津市,4,140800 +140902,忻府区,4,140900 +140921,定襄县,4,140900 +140922,五台县,4,140900 +140923,代县,4,140900 +140924,繁峙县,4,140900 +140925,宁武县,4,140900 +140926,静乐县,4,140900 +140927,神池县,4,140900 +140928,五寨县,4,140900 +140929,岢岚县,4,140900 +140930,河曲县,4,140900 +140931,保德县,4,140900 +140932,偏关县,4,140900 +140971,五台山风景名胜区,4,140900 +140981,原平市,4,140900 +141002,尧都区,4,141000 +141021,曲沃县,4,141000 +141022,翼城县,4,141000 +141023,襄汾县,4,141000 +141024,洪洞县,4,141000 +141025,古县,4,141000 +141026,安泽县,4,141000 +141027,浮山县,4,141000 +141028,吉县,4,141000 +141029,乡宁县,4,141000 +141030,大宁县,4,141000 +141031,隰县,4,141000 +141032,永和县,4,141000 +141033,蒲县,4,141000 +141034,汾西县,4,141000 +141081,侯马市,4,141000 +141082,霍州市,4,141000 +141102,离石区,4,141100 +141121,文水县,4,141100 +141122,交城县,4,141100 +141123,兴县,4,141100 +141124,临县,4,141100 +141125,柳林县,4,141100 +141126,石楼县,4,141100 +141127,岚县,4,141100 +141128,方山县,4,141100 +141129,中阳县,4,141100 +141130,交口县,4,141100 +141181,孝义市,4,141100 +141182,汾阳市,4,141100 +150102,新城区,4,150100 +150103,回民区,4,150100 +150104,玉泉区,4,150100 +150105,赛罕区,4,150100 +150121,土默特左旗,4,150100 +150122,托克托县,4,150100 +150123,和林格尔县,4,150100 +150124,清水河县,4,150100 +150125,武川县,4,150100 +150172,呼和浩特经济技术开发区,4,150100 +150202,东河区,4,150200 +150203,昆都仑区,4,150200 +150204,青山区,4,150200 +150205,石拐区,4,150200 +150206,白云鄂博矿区,4,150200 +150207,九原区,4,150200 +150221,土默特右旗,4,150200 +150222,固阳县,4,150200 +150223,达尔罕茂明安联合旗,4,150200 +150271,包头稀土高新技术产业开发区,4,150200 +150302,海勃湾区,4,150300 +150303,海南区,4,150300 +150304,乌达区,4,150300 +150402,红山区,4,150400 +150403,元宝山区,4,150400 +150404,松山区,4,150400 +150421,阿鲁科尔沁旗,4,150400 +150422,巴林左旗,4,150400 +150423,巴林右旗,4,150400 +150424,林西县,4,150400 +150425,克什克腾旗,4,150400 +150426,翁牛特旗,4,150400 +150428,喀喇沁旗,4,150400 +150429,宁城县,4,150400 +150430,敖汉旗,4,150400 +150502,科尔沁区,4,150500 +150521,科尔沁左翼中旗,4,150500 +150522,科尔沁左翼后旗,4,150500 +150523,开鲁县,4,150500 +150524,库伦旗,4,150500 +150525,奈曼旗,4,150500 +150526,扎鲁特旗,4,150500 +150571,通辽经济技术开发区,4,150500 +150581,霍林郭勒市,4,150500 +150602,东胜区,4,150600 +150603,康巴什区,4,150600 +150621,达拉特旗,4,150600 +150622,准格尔旗,4,150600 +150623,鄂托克前旗,4,150600 +150624,鄂托克旗,4,150600 +150625,杭锦旗,4,150600 +150626,乌审旗,4,150600 +150627,伊金霍洛旗,4,150600 +150702,海拉尔区,4,150700 +150703,扎赉诺尔区,4,150700 +150721,阿荣旗,4,150700 +150722,莫力达瓦达斡尔族自治旗,4,150700 +150723,鄂伦春自治旗,4,150700 +150724,鄂温克族自治旗,4,150700 +150725,陈巴尔虎旗,4,150700 +150726,新巴尔虎左旗,4,150700 +150727,新巴尔虎右旗,4,150700 +150781,满洲里市,4,150700 +150782,牙克石市,4,150700 +150783,扎兰屯市,4,150700 +150784,额尔古纳市,4,150700 +150785,根河市,4,150700 +150802,临河区,4,150800 +150821,五原县,4,150800 +150822,磴口县,4,150800 +150823,乌拉特前旗,4,150800 +150824,乌拉特中旗,4,150800 +150825,乌拉特后旗,4,150800 +150826,杭锦后旗,4,150800 +150902,集宁区,4,150900 +150921,卓资县,4,150900 +150922,化德县,4,150900 +150923,商都县,4,150900 +150924,兴和县,4,150900 +150925,凉城县,4,150900 +150926,察哈尔右翼前旗,4,150900 +150927,察哈尔右翼中旗,4,150900 +150928,察哈尔右翼后旗,4,150900 +150929,四子王旗,4,150900 +150981,丰镇市,4,150900 +152201,乌兰浩特市,4,152200 +152202,阿尔山市,4,152200 +152221,科尔沁右翼前旗,4,152200 +152222,科尔沁右翼中旗,4,152200 +152223,扎赉特旗,4,152200 +152224,突泉县,4,152200 +152501,二连浩特市,4,152500 +152502,锡林浩特市,4,152500 +152522,阿巴嘎旗,4,152500 +152523,苏尼特左旗,4,152500 +152524,苏尼特右旗,4,152500 +152525,东乌珠穆沁旗,4,152500 +152526,西乌珠穆沁旗,4,152500 +152527,太仆寺旗,4,152500 +152528,镶黄旗,4,152500 +152529,正镶白旗,4,152500 +152530,正蓝旗,4,152500 +152531,多伦县,4,152500 +152571,乌拉盖管委会,4,152500 +152921,阿拉善左旗,4,152900 +152922,阿拉善右旗,4,152900 +152923,额济纳旗,4,152900 +152971,内蒙古阿拉善高新技术产业开发区,4,152900 +210102,和平区,4,210100 +210103,沈河区,4,210100 +210104,大东区,4,210100 +210105,皇姑区,4,210100 +210106,铁西区,4,210100 +210111,苏家屯区,4,210100 +210112,浑南区,4,210100 +210113,沈北新区,4,210100 +210114,于洪区,4,210100 +210115,辽中区,4,210100 +210123,康平县,4,210100 +210124,法库县,4,210100 +210181,新民市,4,210100 +210202,中山区,4,210200 +210203,西岗区,4,210200 +210204,沙河口区,4,210200 +210211,甘井子区,4,210200 +210212,旅顺口区,4,210200 +210213,金州区,4,210200 +210214,普兰店区,4,210200 +210224,长海县,4,210200 +210281,瓦房店市,4,210200 +210283,庄河市,4,210200 +210302,铁东区,4,210300 +210303,铁西区,4,210300 +210304,立山区,4,210300 +210311,千山区,4,210300 +210321,台安县,4,210300 +210323,岫岩满族自治县,4,210300 +210381,海城市,4,210300 +210402,新抚区,4,210400 +210403,东洲区,4,210400 +210404,望花区,4,210400 +210411,顺城区,4,210400 +210421,抚顺县,4,210400 +210422,新宾满族自治县,4,210400 +210423,清原满族自治县,4,210400 +210502,平山区,4,210500 +210503,溪湖区,4,210500 +210504,明山区,4,210500 +210505,南芬区,4,210500 +210521,本溪满族自治县,4,210500 +210522,桓仁满族自治县,4,210500 +210602,元宝区,4,210600 +210603,振兴区,4,210600 +210604,振安区,4,210600 +210624,宽甸满族自治县,4,210600 +210681,东港市,4,210600 +210682,凤城市,4,210600 +210702,古塔区,4,210700 +210703,凌河区,4,210700 +210711,太和区,4,210700 +210726,黑山县,4,210700 +210727,义县,4,210700 +210781,凌海市,4,210700 +210782,北镇市,4,210700 +210802,站前区,4,210800 +210803,西市区,4,210800 +210804,鲅鱼圈区,4,210800 +210811,老边区,4,210800 +210881,盖州市,4,210800 +210882,大石桥市,4,210800 +210902,海州区,4,210900 +210903,新邱区,4,210900 +210904,太平区,4,210900 +210905,清河门区,4,210900 +210911,细河区,4,210900 +210921,阜新蒙古族自治县,4,210900 +210922,彰武县,4,210900 +211002,白塔区,4,211000 +211003,文圣区,4,211000 +211004,宏伟区,4,211000 +211005,弓长岭区,4,211000 +211011,太子河区,4,211000 +211021,辽阳县,4,211000 +211081,灯塔市,4,211000 +211102,双台子区,4,211100 +211103,兴隆台区,4,211100 +211104,大洼区,4,211100 +211122,盘山县,4,211100 +211202,银州区,4,211200 +211204,清河区,4,211200 +211221,铁岭县,4,211200 +211223,西丰县,4,211200 +211224,昌图县,4,211200 +211281,调兵山市,4,211200 +211282,开原市,4,211200 +211302,双塔区,4,211300 +211303,龙城区,4,211300 +211321,朝阳县,4,211300 +211322,建平县,4,211300 +211324,喀喇沁左翼蒙古族自治县,4,211300 +211381,北票市,4,211300 +211382,凌源市,4,211300 +211402,连山区,4,211400 +211403,龙港区,4,211400 +211404,南票区,4,211400 +211421,绥中县,4,211400 +211422,建昌县,4,211400 +211481,兴城市,4,211400 +220102,南关区,4,220100 +220103,宽城区,4,220100 +220104,朝阳区,4,220100 +220105,二道区,4,220100 +220106,绿园区,4,220100 +220112,双阳区,4,220100 +220113,九台区,4,220100 +220122,农安县,4,220100 +220171,长春经济技术开发区,4,220100 +220172,长春净月高新技术产业开发区,4,220100 +220173,长春高新技术产业开发区,4,220100 +220174,长春汽车经济技术开发区,4,220100 +220182,榆树市,4,220100 +220183,德惠市,4,220100 +220184,公主岭市,4,220100 +220202,昌邑区,4,220200 +220203,龙潭区,4,220200 +220204,船营区,4,220200 +220211,丰满区,4,220200 +220221,永吉县,4,220200 +220271,吉林经济开发区,4,220200 +220272,吉林高新技术产业开发区,4,220200 +220273,吉林中国新加坡食品区,4,220200 +220281,蛟河市,4,220200 +220282,桦甸市,4,220200 +220283,舒兰市,4,220200 +220284,磐石市,4,220200 +220302,铁西区,4,220300 +220303,铁东区,4,220300 +220322,梨树县,4,220300 +220323,伊通满族自治县,4,220300 +220382,双辽市,4,220300 +220402,龙山区,4,220400 +220403,西安区,4,220400 +220421,东丰县,4,220400 +220422,东辽县,4,220400 +220502,东昌区,4,220500 +220503,二道江区,4,220500 +220521,通化县,4,220500 +220523,辉南县,4,220500 +220524,柳河县,4,220500 +220581,梅河口市,4,220500 +220582,集安市,4,220500 +220602,浑江区,4,220600 +220605,江源区,4,220600 +220621,抚松县,4,220600 +220622,靖宇县,4,220600 +220623,长白朝鲜族自治县,4,220600 +220681,临江市,4,220600 +220702,宁江区,4,220700 +220721,前郭尔罗斯蒙古族自治县,4,220700 +220722,长岭县,4,220700 +220723,乾安县,4,220700 +220771,吉林松原经济开发区,4,220700 +220781,扶余市,4,220700 +220802,洮北区,4,220800 +220821,镇赉县,4,220800 +220822,通榆县,4,220800 +220871,吉林白城经济开发区,4,220800 +220881,洮南市,4,220800 +220882,大安市,4,220800 +222401,延吉市,4,222400 +222402,图们市,4,222400 +222403,敦化市,4,222400 +222404,珲春市,4,222400 +222405,龙井市,4,222400 +222406,和龙市,4,222400 +222424,汪清县,4,222400 +222426,安图县,4,222400 +230102,道里区,4,230100 +230103,南岗区,4,230100 +230104,道外区,4,230100 +230108,平房区,4,230100 +230109,松北区,4,230100 +230110,香坊区,4,230100 +230111,呼兰区,4,230100 +230112,阿城区,4,230100 +230113,双城区,4,230100 +230123,依兰县,4,230100 +230124,方正县,4,230100 +230125,宾县,4,230100 +230126,巴彦县,4,230100 +230127,木兰县,4,230100 +230128,通河县,4,230100 +230129,延寿县,4,230100 +230183,尚志市,4,230100 +230184,五常市,4,230100 +230202,龙沙区,4,230200 +230203,建华区,4,230200 +230204,铁锋区,4,230200 +230205,昂昂溪区,4,230200 +230206,富拉尔基区,4,230200 +230207,碾子山区,4,230200 +230208,梅里斯达斡尔族区,4,230200 +230221,龙江县,4,230200 +230223,依安县,4,230200 +230224,泰来县,4,230200 +230225,甘南县,4,230200 +230227,富裕县,4,230200 +230229,克山县,4,230200 +230230,克东县,4,230200 +230231,拜泉县,4,230200 +230281,讷河市,4,230200 +230302,鸡冠区,4,230300 +230303,恒山区,4,230300 +230304,滴道区,4,230300 +230305,梨树区,4,230300 +230306,城子河区,4,230300 +230307,麻山区,4,230300 +230321,鸡东县,4,230300 +230381,虎林市,4,230300 +230382,密山市,4,230300 +230402,向阳区,4,230400 +230403,工农区,4,230400 +230404,南山区,4,230400 +230405,兴安区,4,230400 +230406,东山区,4,230400 +230407,兴山区,4,230400 +230421,萝北县,4,230400 +230422,绥滨县,4,230400 +230502,尖山区,4,230500 +230503,岭东区,4,230500 +230505,四方台区,4,230500 +230506,宝山区,4,230500 +230521,集贤县,4,230500 +230522,友谊县,4,230500 +230523,宝清县,4,230500 +230524,饶河县,4,230500 +230602,萨尔图区,4,230600 +230603,龙凤区,4,230600 +230604,让胡路区,4,230600 +230605,红岗区,4,230600 +230606,大同区,4,230600 +230621,肇州县,4,230600 +230622,肇源县,4,230600 +230623,林甸县,4,230600 +230624,杜尔伯特蒙古族自治县,4,230600 +230671,大庆高新技术产业开发区,4,230600 +230717,伊美区,4,230700 +230718,乌翠区,4,230700 +230719,友好区,4,230700 +230722,嘉荫县,4,230700 +230723,汤旺县,4,230700 +230724,丰林县,4,230700 +230725,大箐山县,4,230700 +230726,南岔县,4,230700 +230751,金林区,4,230700 +230781,铁力市,4,230700 +230803,向阳区,4,230800 +230804,前进区,4,230800 +230805,东风区,4,230800 +230811,郊区,4,230800 +230822,桦南县,4,230800 +230826,桦川县,4,230800 +230828,汤原县,4,230800 +230881,同江市,4,230800 +230882,富锦市,4,230800 +230883,抚远市,4,230800 +230902,新兴区,4,230900 +230903,桃山区,4,230900 +230904,茄子河区,4,230900 +230921,勃利县,4,230900 +231002,东安区,4,231000 +231003,阳明区,4,231000 +231004,爱民区,4,231000 +231005,西安区,4,231000 +231025,林口县,4,231000 +231071,牡丹江经济技术开发区,4,231000 +231081,绥芬河市,4,231000 +231083,海林市,4,231000 +231084,宁安市,4,231000 +231085,穆棱市,4,231000 +231086,东宁市,4,231000 +231102,爱辉区,4,231100 +231123,逊克县,4,231100 +231124,孙吴县,4,231100 +231181,北安市,4,231100 +231182,五大连池市,4,231100 +231183,嫩江市,4,231100 +231202,北林区,4,231200 +231221,望奎县,4,231200 +231222,兰西县,4,231200 +231223,青冈县,4,231200 +231224,庆安县,4,231200 +231225,明水县,4,231200 +231226,绥棱县,4,231200 +231281,安达市,4,231200 +231282,肇东市,4,231200 +231283,海伦市,4,231200 +232701,漠河市,4,232700 +232721,呼玛县,4,232700 +232722,塔河县,4,232700 +232761,加格达奇区,4,232700 +232762,松岭区,4,232700 +232763,新林区,4,232700 +232764,呼中区,4,232700 +310101,黄浦区,4,310100 +310104,徐汇区,4,310100 +310105,长宁区,4,310100 +310106,静安区,4,310100 +310107,普陀区,4,310100 +310109,虹口区,4,310100 +310110,杨浦区,4,310100 +310112,闵行区,4,310100 +310113,宝山区,4,310100 +310114,嘉定区,4,310100 +310115,浦东新区,4,310100 +310116,金山区,4,310100 +310117,松江区,4,310100 +310118,青浦区,4,310100 +310120,奉贤区,4,310100 +310151,崇明区,4,310100 +320102,玄武区,4,320100 +320104,秦淮区,4,320100 +320105,建邺区,4,320100 +320106,鼓楼区,4,320100 +320111,浦口区,4,320100 +320113,栖霞区,4,320100 +320114,雨花台区,4,320100 +320115,江宁区,4,320100 +320116,六合区,4,320100 +320117,溧水区,4,320100 +320118,高淳区,4,320100 +320205,锡山区,4,320200 +320206,惠山区,4,320200 +320211,滨湖区,4,320200 +320213,梁溪区,4,320200 +320214,新吴区,4,320200 +320281,江阴市,4,320200 +320282,宜兴市,4,320200 +320302,鼓楼区,4,320300 +320303,云龙区,4,320300 +320305,贾汪区,4,320300 +320311,泉山区,4,320300 +320312,铜山区,4,320300 +320321,丰县,4,320300 +320322,沛县,4,320300 +320324,睢宁县,4,320300 +320371,徐州经济技术开发区,4,320300 +320381,新沂市,4,320300 +320382,邳州市,4,320300 +320402,天宁区,4,320400 +320404,钟楼区,4,320400 +320411,新北区,4,320400 +320412,武进区,4,320400 +320413,金坛区,4,320400 +320481,溧阳市,4,320400 +320505,虎丘区,4,320500 +320506,吴中区,4,320500 +320507,相城区,4,320500 +320508,姑苏区,4,320500 +320509,吴江区,4,320500 +320571,苏州工业园区,4,320500 +320581,常熟市,4,320500 +320582,张家港市,4,320500 +320583,昆山市,4,320500 +320585,太仓市,4,320500 +320612,通州区,4,320600 +320613,崇川区,4,320600 +320614,海门区,4,320600 +320623,如东县,4,320600 +320671,南通经济技术开发区,4,320600 +320681,启东市,4,320600 +320682,如皋市,4,320600 +320685,海安市,4,320600 +320703,连云区,4,320700 +320706,海州区,4,320700 +320707,赣榆区,4,320700 +320722,东海县,4,320700 +320723,灌云县,4,320700 +320724,灌南县,4,320700 +320771,连云港经济技术开发区,4,320700 +320772,连云港高新技术产业开发区,4,320700 +320803,淮安区,4,320800 +320804,淮阴区,4,320800 +320812,清江浦区,4,320800 +320813,洪泽区,4,320800 +320826,涟水县,4,320800 +320830,盱眙县,4,320800 +320831,金湖县,4,320800 +320871,淮安经济技术开发区,4,320800 +320902,亭湖区,4,320900 +320903,盐都区,4,320900 +320904,大丰区,4,320900 +320921,响水县,4,320900 +320922,滨海县,4,320900 +320923,阜宁县,4,320900 +320924,射阳县,4,320900 +320925,建湖县,4,320900 +320971,盐城经济技术开发区,4,320900 +320981,东台市,4,320900 +321002,广陵区,4,321000 +321003,邗江区,4,321000 +321012,江都区,4,321000 +321023,宝应县,4,321000 +321071,扬州经济技术开发区,4,321000 +321081,仪征市,4,321000 +321084,高邮市,4,321000 +321102,京口区,4,321100 +321111,润州区,4,321100 +321112,丹徒区,4,321100 +321171,镇江新区,4,321100 +321181,丹阳市,4,321100 +321182,扬中市,4,321100 +321183,句容市,4,321100 +321202,海陵区,4,321200 +321203,高港区,4,321200 +321204,姜堰区,4,321200 +321271,泰州医药高新技术产业开发区,4,321200 +321281,兴化市,4,321200 +321282,靖江市,4,321200 +321283,泰兴市,4,321200 +321302,宿城区,4,321300 +321311,宿豫区,4,321300 +321322,沭阳县,4,321300 +321323,泗阳县,4,321300 +321324,泗洪县,4,321300 +321371,宿迁经济技术开发区,4,321300 +330102,上城区,4,330100 +330105,拱墅区,4,330100 +330106,西湖区,4,330100 +330108,滨江区,4,330100 +330109,萧山区,4,330100 +330110,余杭区,4,330100 +330111,富阳区,4,330100 +330112,临安区,4,330100 +330113,临平区,4,330100 +330114,钱塘区,4,330100 +330122,桐庐县,4,330100 +330127,淳安县,4,330100 +330182,建德市,4,330100 +330203,海曙区,4,330200 +330205,江北区,4,330200 +330206,北仑区,4,330200 +330211,镇海区,4,330200 +330212,鄞州区,4,330200 +330213,奉化区,4,330200 +330225,象山县,4,330200 +330226,宁海县,4,330200 +330281,余姚市,4,330200 +330282,慈溪市,4,330200 +330302,鹿城区,4,330300 +330303,龙湾区,4,330300 +330304,瓯海区,4,330300 +330305,洞头区,4,330300 +330324,永嘉县,4,330300 +330326,平阳县,4,330300 +330327,苍南县,4,330300 +330328,文成县,4,330300 +330329,泰顺县,4,330300 +330371,温州经济技术开发区,4,330300 +330381,瑞安市,4,330300 +330382,乐清市,4,330300 +330383,龙港市,4,330300 +330402,南湖区,4,330400 +330411,秀洲区,4,330400 +330421,嘉善县,4,330400 +330424,海盐县,4,330400 +330481,海宁市,4,330400 +330482,平湖市,4,330400 +330483,桐乡市,4,330400 +330502,吴兴区,4,330500 +330503,南浔区,4,330500 +330521,德清县,4,330500 +330522,长兴县,4,330500 +330523,安吉县,4,330500 +330602,越城区,4,330600 +330603,柯桥区,4,330600 +330604,上虞区,4,330600 +330624,新昌县,4,330600 +330681,诸暨市,4,330600 +330683,嵊州市,4,330600 +330702,婺城区,4,330700 +330703,金东区,4,330700 +330723,武义县,4,330700 +330726,浦江县,4,330700 +330727,磐安县,4,330700 +330781,兰溪市,4,330700 +330782,义乌市,4,330700 +330783,东阳市,4,330700 +330784,永康市,4,330700 +330802,柯城区,4,330800 +330803,衢江区,4,330800 +330822,常山县,4,330800 +330824,开化县,4,330800 +330825,龙游县,4,330800 +330881,江山市,4,330800 +330902,定海区,4,330900 +330903,普陀区,4,330900 +330921,岱山县,4,330900 +330922,嵊泗县,4,330900 +331002,椒江区,4,331000 +331003,黄岩区,4,331000 +331004,路桥区,4,331000 +331022,三门县,4,331000 +331023,天台县,4,331000 +331024,仙居县,4,331000 +331081,温岭市,4,331000 +331082,临海市,4,331000 +331083,玉环市,4,331000 +331102,莲都区,4,331100 +331121,青田县,4,331100 +331122,缙云县,4,331100 +331123,遂昌县,4,331100 +331124,松阳县,4,331100 +331125,云和县,4,331100 +331126,庆元县,4,331100 +331127,景宁畲族自治县,4,331100 +331181,龙泉市,4,331100 +340102,瑶海区,4,340100 +340103,庐阳区,4,340100 +340104,蜀山区,4,340100 +340111,包河区,4,340100 +340121,长丰县,4,340100 +340122,肥东县,4,340100 +340123,肥西县,4,340100 +340124,庐江县,4,340100 +340171,合肥高新技术产业开发区,4,340100 +340172,合肥经济技术开发区,4,340100 +340173,合肥新站高新技术产业开发区,4,340100 +340181,巢湖市,4,340100 +340202,镜湖区,4,340200 +340207,鸠江区,4,340200 +340209,弋江区,4,340200 +340210,湾沚区,4,340200 +340212,繁昌区,4,340200 +340223,南陵县,4,340200 +340271,芜湖经济技术开发区,4,340200 +340272,安徽芜湖三山经济开发区,4,340200 +340281,无为市,4,340200 +340302,龙子湖区,4,340300 +340303,蚌山区,4,340300 +340304,禹会区,4,340300 +340311,淮上区,4,340300 +340321,怀远县,4,340300 +340322,五河县,4,340300 +340323,固镇县,4,340300 +340371,蚌埠市高新技术开发区,4,340300 +340372,蚌埠市经济开发区,4,340300 +340402,大通区,4,340400 +340403,田家庵区,4,340400 +340404,谢家集区,4,340400 +340405,八公山区,4,340400 +340406,潘集区,4,340400 +340421,凤台县,4,340400 +340422,寿县,4,340400 +340503,花山区,4,340500 +340504,雨山区,4,340500 +340506,博望区,4,340500 +340521,当涂县,4,340500 +340522,含山县,4,340500 +340523,和县,4,340500 +340602,杜集区,4,340600 +340603,相山区,4,340600 +340604,烈山区,4,340600 +340621,濉溪县,4,340600 +340705,铜官区,4,340700 +340706,义安区,4,340700 +340711,郊区,4,340700 +340722,枞阳县,4,340700 +340802,迎江区,4,340800 +340803,大观区,4,340800 +340811,宜秀区,4,340800 +340822,怀宁县,4,340800 +340825,太湖县,4,340800 +340826,宿松县,4,340800 +340827,望江县,4,340800 +340828,岳西县,4,340800 +340871,安徽安庆经济开发区,4,340800 +340881,桐城市,4,340800 +340882,潜山市,4,340800 +341002,屯溪区,4,341000 +341003,黄山区,4,341000 +341004,徽州区,4,341000 +341021,歙县,4,341000 +341022,休宁县,4,341000 +341023,黟县,4,341000 +341024,祁门县,4,341000 +341102,琅琊区,4,341100 +341103,南谯区,4,341100 +341122,来安县,4,341100 +341124,全椒县,4,341100 +341125,定远县,4,341100 +341126,凤阳县,4,341100 +341171,中新苏滁高新技术产业开发区,4,341100 +341172,滁州经济技术开发区,4,341100 +341181,天长市,4,341100 +341182,明光市,4,341100 +341202,颍州区,4,341200 +341203,颍东区,4,341200 +341204,颍泉区,4,341200 +341221,临泉县,4,341200 +341222,太和县,4,341200 +341225,阜南县,4,341200 +341226,颍上县,4,341200 +341271,阜阳合肥现代产业园区,4,341200 +341272,阜阳经济技术开发区,4,341200 +341282,界首市,4,341200 +341302,埇桥区,4,341300 +341321,砀山县,4,341300 +341322,萧县,4,341300 +341323,灵璧县,4,341300 +341324,泗县,4,341300 +341371,宿州马鞍山现代产业园区,4,341300 +341372,宿州经济技术开发区,4,341300 +341502,金安区,4,341500 +341503,裕安区,4,341500 +341504,叶集区,4,341500 +341522,霍邱县,4,341500 +341523,舒城县,4,341500 +341524,金寨县,4,341500 +341525,霍山县,4,341500 +341602,谯城区,4,341600 +341621,涡阳县,4,341600 +341622,蒙城县,4,341600 +341623,利辛县,4,341600 +341702,贵池区,4,341700 +341721,东至县,4,341700 +341722,石台县,4,341700 +341723,青阳县,4,341700 +341802,宣州区,4,341800 +341821,郎溪县,4,341800 +341823,泾县,4,341800 +341824,绩溪县,4,341800 +341825,旌德县,4,341800 +341871,宣城市经济开发区,4,341800 +341881,宁国市,4,341800 +341882,广德市,4,341800 +350102,鼓楼区,4,350100 +350103,台江区,4,350100 +350104,仓山区,4,350100 +350105,马尾区,4,350100 +350111,晋安区,4,350100 +350112,长乐区,4,350100 +350121,闽侯县,4,350100 +350122,连江县,4,350100 +350123,罗源县,4,350100 +350124,闽清县,4,350100 +350125,永泰县,4,350100 +350128,平潭县,4,350100 +350181,福清市,4,350100 +350203,思明区,4,350200 +350205,海沧区,4,350200 +350206,湖里区,4,350200 +350211,集美区,4,350200 +350212,同安区,4,350200 +350213,翔安区,4,350200 +350302,城厢区,4,350300 +350303,涵江区,4,350300 +350304,荔城区,4,350300 +350305,秀屿区,4,350300 +350322,仙游县,4,350300 +350404,三元区,4,350400 +350405,沙县区,4,350400 +350421,明溪县,4,350400 +350423,清流县,4,350400 +350424,宁化县,4,350400 +350425,大田县,4,350400 +350426,尤溪县,4,350400 +350428,将乐县,4,350400 +350429,泰宁县,4,350400 +350430,建宁县,4,350400 +350481,永安市,4,350400 +350502,鲤城区,4,350500 +350503,丰泽区,4,350500 +350504,洛江区,4,350500 +350505,泉港区,4,350500 +350521,惠安县,4,350500 +350524,安溪县,4,350500 +350525,永春县,4,350500 +350526,德化县,4,350500 +350527,金门县,4,350500 +350581,石狮市,4,350500 +350582,晋江市,4,350500 +350583,南安市,4,350500 +350602,芗城区,4,350600 +350603,龙文区,4,350600 +350604,龙海区,4,350600 +350605,长泰区,4,350600 +350622,云霄县,4,350600 +350623,漳浦县,4,350600 +350624,诏安县,4,350600 +350626,东山县,4,350600 +350627,南靖县,4,350600 +350628,平和县,4,350600 +350629,华安县,4,350600 +350702,延平区,4,350700 +350703,建阳区,4,350700 +350721,顺昌县,4,350700 +350722,浦城县,4,350700 +350723,光泽县,4,350700 +350724,松溪县,4,350700 +350725,政和县,4,350700 +350781,邵武市,4,350700 +350782,武夷山市,4,350700 +350783,建瓯市,4,350700 +350802,新罗区,4,350800 +350803,永定区,4,350800 +350821,长汀县,4,350800 +350823,上杭县,4,350800 +350824,武平县,4,350800 +350825,连城县,4,350800 +350881,漳平市,4,350800 +350902,蕉城区,4,350900 +350921,霞浦县,4,350900 +350922,古田县,4,350900 +350923,屏南县,4,350900 +350924,寿宁县,4,350900 +350925,周宁县,4,350900 +350926,柘荣县,4,350900 +350981,福安市,4,350900 +350982,福鼎市,4,350900 +360102,东湖区,4,360100 +360103,西湖区,4,360100 +360104,青云谱区,4,360100 +360111,青山湖区,4,360100 +360112,新建区,4,360100 +360113,红谷滩区,4,360100 +360121,南昌县,4,360100 +360123,安义县,4,360100 +360124,进贤县,4,360100 +360202,昌江区,4,360200 +360203,珠山区,4,360200 +360222,浮梁县,4,360200 +360281,乐平市,4,360200 +360302,安源区,4,360300 +360313,湘东区,4,360300 +360321,莲花县,4,360300 +360322,上栗县,4,360300 +360323,芦溪县,4,360300 +360402,濂溪区,4,360400 +360403,浔阳区,4,360400 +360404,柴桑区,4,360400 +360423,武宁县,4,360400 +360424,修水县,4,360400 +360425,永修县,4,360400 +360426,德安县,4,360400 +360428,都昌县,4,360400 +360429,湖口县,4,360400 +360430,彭泽县,4,360400 +360481,瑞昌市,4,360400 +360482,共青城市,4,360400 +360483,庐山市,4,360400 +360502,渝水区,4,360500 +360521,分宜县,4,360500 +360602,月湖区,4,360600 +360603,余江区,4,360600 +360681,贵溪市,4,360600 +360702,章贡区,4,360700 +360703,南康区,4,360700 +360704,赣县区,4,360700 +360722,信丰县,4,360700 +360723,大余县,4,360700 +360724,上犹县,4,360700 +360725,崇义县,4,360700 +360726,安远县,4,360700 +360728,定南县,4,360700 +360729,全南县,4,360700 +360730,宁都县,4,360700 +360731,于都县,4,360700 +360732,兴国县,4,360700 +360733,会昌县,4,360700 +360734,寻乌县,4,360700 +360735,石城县,4,360700 +360781,瑞金市,4,360700 +360783,龙南市,4,360700 +360802,吉州区,4,360800 +360803,青原区,4,360800 +360821,吉安县,4,360800 +360822,吉水县,4,360800 +360823,峡江县,4,360800 +360824,新干县,4,360800 +360825,永丰县,4,360800 +360826,泰和县,4,360800 +360827,遂川县,4,360800 +360828,万安县,4,360800 +360829,安福县,4,360800 +360830,永新县,4,360800 +360881,井冈山市,4,360800 +360902,袁州区,4,360900 +360921,奉新县,4,360900 +360922,万载县,4,360900 +360923,上高县,4,360900 +360924,宜丰县,4,360900 +360925,靖安县,4,360900 +360926,铜鼓县,4,360900 +360981,丰城市,4,360900 +360982,樟树市,4,360900 +360983,高安市,4,360900 +361002,临川区,4,361000 +361003,东乡区,4,361000 +361021,南城县,4,361000 +361022,黎川县,4,361000 +361023,南丰县,4,361000 +361024,崇仁县,4,361000 +361025,乐安县,4,361000 +361026,宜黄县,4,361000 +361027,金溪县,4,361000 +361028,资溪县,4,361000 +361030,广昌县,4,361000 +361102,信州区,4,361100 +361103,广丰区,4,361100 +361104,广信区,4,361100 +361123,玉山县,4,361100 +361124,铅山县,4,361100 +361125,横峰县,4,361100 +361126,弋阳县,4,361100 +361127,余干县,4,361100 +361128,鄱阳县,4,361100 +361129,万年县,4,361100 +361130,婺源县,4,361100 +361181,德兴市,4,361100 +370102,历下区,4,370100 +370103,市中区,4,370100 +370104,槐荫区,4,370100 +370105,天桥区,4,370100 +370112,历城区,4,370100 +370113,长清区,4,370100 +370114,章丘区,4,370100 +370115,济阳区,4,370100 +370116,莱芜区,4,370100 +370117,钢城区,4,370100 +370124,平阴县,4,370100 +370126,商河县,4,370100 +370171,济南高新技术产业开发区,4,370100 +370202,市南区,4,370200 +370203,市北区,4,370200 +370211,黄岛区,4,370200 +370212,崂山区,4,370200 +370213,李沧区,4,370200 +370214,城阳区,4,370200 +370215,即墨区,4,370200 +370271,青岛高新技术产业开发区,4,370200 +370281,胶州市,4,370200 +370283,平度市,4,370200 +370285,莱西市,4,370200 +370302,淄川区,4,370300 +370303,张店区,4,370300 +370304,博山区,4,370300 +370305,临淄区,4,370300 +370306,周村区,4,370300 +370321,桓台县,4,370300 +370322,高青县,4,370300 +370323,沂源县,4,370300 +370402,市中区,4,370400 +370403,薛城区,4,370400 +370404,峄城区,4,370400 +370405,台儿庄区,4,370400 +370406,山亭区,4,370400 +370481,滕州市,4,370400 +370502,东营区,4,370500 +370503,河口区,4,370500 +370505,垦利区,4,370500 +370522,利津县,4,370500 +370523,广饶县,4,370500 +370571,东营经济技术开发区,4,370500 +370572,东营港经济开发区,4,370500 +370602,芝罘区,4,370600 +370611,福山区,4,370600 +370612,牟平区,4,370600 +370613,莱山区,4,370600 +370614,蓬莱区,4,370600 +370671,烟台高新技术产业开发区,4,370600 +370672,烟台经济技术开发区,4,370600 +370681,龙口市,4,370600 +370682,莱阳市,4,370600 +370683,莱州市,4,370600 +370685,招远市,4,370600 +370686,栖霞市,4,370600 +370687,海阳市,4,370600 +370702,潍城区,4,370700 +370703,寒亭区,4,370700 +370704,坊子区,4,370700 +370705,奎文区,4,370700 +370724,临朐县,4,370700 +370725,昌乐县,4,370700 +370772,潍坊滨海经济技术开发区,4,370700 +370781,青州市,4,370700 +370782,诸城市,4,370700 +370783,寿光市,4,370700 +370784,安丘市,4,370700 +370785,高密市,4,370700 +370786,昌邑市,4,370700 +370811,任城区,4,370800 +370812,兖州区,4,370800 +370826,微山县,4,370800 +370827,鱼台县,4,370800 +370828,金乡县,4,370800 +370829,嘉祥县,4,370800 +370830,汶上县,4,370800 +370831,泗水县,4,370800 +370832,梁山县,4,370800 +370871,济宁高新技术产业开发区,4,370800 +370881,曲阜市,4,370800 +370883,邹城市,4,370800 +370902,泰山区,4,370900 +370911,岱岳区,4,370900 +370921,宁阳县,4,370900 +370923,东平县,4,370900 +370982,新泰市,4,370900 +370983,肥城市,4,370900 +371002,环翠区,4,371000 +371003,文登区,4,371000 +371071,威海火炬高技术产业开发区,4,371000 +371072,威海经济技术开发区,4,371000 +371073,威海临港经济技术开发区,4,371000 +371082,荣成市,4,371000 +371083,乳山市,4,371000 +371102,东港区,4,371100 +371103,岚山区,4,371100 +371121,五莲县,4,371100 +371122,莒县,4,371100 +371171,日照经济技术开发区,4,371100 +371302,兰山区,4,371300 +371311,罗庄区,4,371300 +371312,河东区,4,371300 +371321,沂南县,4,371300 +371322,郯城县,4,371300 +371323,沂水县,4,371300 +371324,兰陵县,4,371300 +371325,费县,4,371300 +371326,平邑县,4,371300 +371327,莒南县,4,371300 +371328,蒙阴县,4,371300 +371329,临沭县,4,371300 +371371,临沂高新技术产业开发区,4,371300 +371402,德城区,4,371400 +371403,陵城区,4,371400 +371422,宁津县,4,371400 +371423,庆云县,4,371400 +371424,临邑县,4,371400 +371425,齐河县,4,371400 +371426,平原县,4,371400 +371427,夏津县,4,371400 +371428,武城县,4,371400 +371471,德州经济技术开发区,4,371400 +371472,德州运河经济开发区,4,371400 +371481,乐陵市,4,371400 +371482,禹城市,4,371400 +371502,东昌府区,4,371500 +371503,茌平区,4,371500 +371521,阳谷县,4,371500 +371522,莘县,4,371500 +371524,东阿县,4,371500 +371525,冠县,4,371500 +371526,高唐县,4,371500 +371581,临清市,4,371500 +371602,滨城区,4,371600 +371603,沾化区,4,371600 +371621,惠民县,4,371600 +371622,阳信县,4,371600 +371623,无棣县,4,371600 +371625,博兴县,4,371600 +371681,邹平市,4,371600 +371702,牡丹区,4,371700 +371703,定陶区,4,371700 +371721,曹县,4,371700 +371722,单县,4,371700 +371723,成武县,4,371700 +371724,巨野县,4,371700 +371725,郓城县,4,371700 +371726,鄄城县,4,371700 +371728,东明县,4,371700 +371771,菏泽经济技术开发区,4,371700 +371772,菏泽高新技术开发区,4,371700 +410102,中原区,4,410100 +410103,二七区,4,410100 +410104,管城回族区,4,410100 +410105,金水区,4,410100 +410106,上街区,4,410100 +410108,惠济区,4,410100 +410122,中牟县,4,410100 +410171,郑州经济技术开发区,4,410100 +410172,郑州高新技术产业开发区,4,410100 +410173,郑州航空港经济综合实验区,4,410100 +410181,巩义市,4,410100 +410182,荥阳市,4,410100 +410183,新密市,4,410100 +410184,新郑市,4,410100 +410185,登封市,4,410100 +410202,龙亭区,4,410200 +410203,顺河回族区,4,410200 +410204,鼓楼区,4,410200 +410205,禹王台区,4,410200 +410212,祥符区,4,410200 +410221,杞县,4,410200 +410222,通许县,4,410200 +410223,尉氏县,4,410200 +410225,兰考县,4,410200 +410302,老城区,4,410300 +410303,西工区,4,410300 +410304,瀍河回族区,4,410300 +410305,涧西区,4,410300 +410307,偃师区,4,410300 +410308,孟津区,4,410300 +410311,洛龙区,4,410300 +410323,新安县,4,410300 +410324,栾川县,4,410300 +410325,嵩县,4,410300 +410326,汝阳县,4,410300 +410327,宜阳县,4,410300 +410328,洛宁县,4,410300 +410329,伊川县,4,410300 +410371,洛阳高新技术产业开发区,4,410300 +410402,新华区,4,410400 +410403,卫东区,4,410400 +410404,石龙区,4,410400 +410411,湛河区,4,410400 +410421,宝丰县,4,410400 +410422,叶县,4,410400 +410423,鲁山县,4,410400 +410425,郏县,4,410400 +410471,平顶山高新技术产业开发区,4,410400 +410472,平顶山市城乡一体化示范区,4,410400 +410481,舞钢市,4,410400 +410482,汝州市,4,410400 +410502,文峰区,4,410500 +410503,北关区,4,410500 +410505,殷都区,4,410500 +410506,龙安区,4,410500 +410522,安阳县,4,410500 +410523,汤阴县,4,410500 +410526,滑县,4,410500 +410527,内黄县,4,410500 +410571,安阳高新技术产业开发区,4,410500 +410581,林州市,4,410500 +410602,鹤山区,4,410600 +410603,山城区,4,410600 +410611,淇滨区,4,410600 +410621,浚县,4,410600 +410622,淇县,4,410600 +410671,鹤壁经济技术开发区,4,410600 +410702,红旗区,4,410700 +410703,卫滨区,4,410700 +410704,凤泉区,4,410700 +410711,牧野区,4,410700 +410721,新乡县,4,410700 +410724,获嘉县,4,410700 +410725,原阳县,4,410700 +410726,延津县,4,410700 +410727,封丘县,4,410700 +410771,新乡高新技术产业开发区,4,410700 +410772,新乡经济技术开发区,4,410700 +410773,新乡市平原城乡一体化示范区,4,410700 +410781,卫辉市,4,410700 +410782,辉县市,4,410700 +410783,长垣市,4,410700 +410802,解放区,4,410800 +410803,中站区,4,410800 +410804,马村区,4,410800 +410811,山阳区,4,410800 +410821,修武县,4,410800 +410822,博爱县,4,410800 +410823,武陟县,4,410800 +410825,温县,4,410800 +410871,焦作城乡一体化示范区,4,410800 +410882,沁阳市,4,410800 +410883,孟州市,4,410800 +410902,华龙区,4,410900 +410922,清丰县,4,410900 +410923,南乐县,4,410900 +410926,范县,4,410900 +410927,台前县,4,410900 +410928,濮阳县,4,410900 +410971,河南濮阳工业园区,4,410900 +410972,濮阳经济技术开发区,4,410900 +411002,魏都区,4,411000 +411003,建安区,4,411000 +411024,鄢陵县,4,411000 +411025,襄城县,4,411000 +411071,许昌经济技术开发区,4,411000 +411081,禹州市,4,411000 +411082,长葛市,4,411000 +411102,源汇区,4,411100 +411103,郾城区,4,411100 +411104,召陵区,4,411100 +411121,舞阳县,4,411100 +411122,临颍县,4,411100 +411171,漯河经济技术开发区,4,411100 +411202,湖滨区,4,411200 +411203,陕州区,4,411200 +411221,渑池县,4,411200 +411224,卢氏县,4,411200 +411271,河南三门峡经济开发区,4,411200 +411281,义马市,4,411200 +411282,灵宝市,4,411200 +411302,宛城区,4,411300 +411303,卧龙区,4,411300 +411321,南召县,4,411300 +411322,方城县,4,411300 +411323,西峡县,4,411300 +411324,镇平县,4,411300 +411325,内乡县,4,411300 +411326,淅川县,4,411300 +411327,社旗县,4,411300 +411328,唐河县,4,411300 +411329,新野县,4,411300 +411330,桐柏县,4,411300 +411371,南阳高新技术产业开发区,4,411300 +411372,南阳市城乡一体化示范区,4,411300 +411381,邓州市,4,411300 +411402,梁园区,4,411400 +411403,睢阳区,4,411400 +411421,民权县,4,411400 +411422,睢县,4,411400 +411423,宁陵县,4,411400 +411424,柘城县,4,411400 +411425,虞城县,4,411400 +411426,夏邑县,4,411400 +411471,豫东综合物流产业聚集区,4,411400 +411472,河南商丘经济开发区,4,411400 +411481,永城市,4,411400 +411502,浉河区,4,411500 +411503,平桥区,4,411500 +411521,罗山县,4,411500 +411522,光山县,4,411500 +411523,新县,4,411500 +411524,商城县,4,411500 +411525,固始县,4,411500 +411526,潢川县,4,411500 +411527,淮滨县,4,411500 +411528,息县,4,411500 +411571,信阳高新技术产业开发区,4,411500 +411602,川汇区,4,411600 +411603,淮阳区,4,411600 +411621,扶沟县,4,411600 +411622,西华县,4,411600 +411623,商水县,4,411600 +411624,沈丘县,4,411600 +411625,郸城县,4,411600 +411627,太康县,4,411600 +411628,鹿邑县,4,411600 +411671,河南周口经济开发区,4,411600 +411681,项城市,4,411600 +411702,驿城区,4,411700 +411721,西平县,4,411700 +411722,上蔡县,4,411700 +411723,平舆县,4,411700 +411724,正阳县,4,411700 +411725,确山县,4,411700 +411726,泌阳县,4,411700 +411727,汝南县,4,411700 +411728,遂平县,4,411700 +411729,新蔡县,4,411700 +411771,河南驻马店经济开发区,4,411700 +419001,济源市,4,419000 +420102,江岸区,4,420100 +420103,江汉区,4,420100 +420104,硚口区,4,420100 +420105,汉阳区,4,420100 +420106,武昌区,4,420100 +420107,青山区,4,420100 +420111,洪山区,4,420100 +420112,东西湖区,4,420100 +420113,汉南区,4,420100 +420114,蔡甸区,4,420100 +420115,江夏区,4,420100 +420116,黄陂区,4,420100 +420117,新洲区,4,420100 +420202,黄石港区,4,420200 +420203,西塞山区,4,420200 +420204,下陆区,4,420200 +420205,铁山区,4,420200 +420222,阳新县,4,420200 +420281,大冶市,4,420200 +420302,茅箭区,4,420300 +420303,张湾区,4,420300 +420304,郧阳区,4,420300 +420322,郧西县,4,420300 +420323,竹山县,4,420300 +420324,竹溪县,4,420300 +420325,房县,4,420300 +420381,丹江口市,4,420300 +420502,西陵区,4,420500 +420503,伍家岗区,4,420500 +420504,点军区,4,420500 +420505,猇亭区,4,420500 +420506,夷陵区,4,420500 +420525,远安县,4,420500 +420526,兴山县,4,420500 +420527,秭归县,4,420500 +420528,长阳土家族自治县,4,420500 +420529,五峰土家族自治县,4,420500 +420581,宜都市,4,420500 +420582,当阳市,4,420500 +420583,枝江市,4,420500 +420602,襄城区,4,420600 +420606,樊城区,4,420600 +420607,襄州区,4,420600 +420624,南漳县,4,420600 +420625,谷城县,4,420600 +420626,保康县,4,420600 +420682,老河口市,4,420600 +420683,枣阳市,4,420600 +420684,宜城市,4,420600 +420702,梁子湖区,4,420700 +420703,华容区,4,420700 +420704,鄂城区,4,420700 +420802,东宝区,4,420800 +420804,掇刀区,4,420800 +420822,沙洋县,4,420800 +420881,钟祥市,4,420800 +420882,京山市,4,420800 +420902,孝南区,4,420900 +420921,孝昌县,4,420900 +420922,大悟县,4,420900 +420923,云梦县,4,420900 +420981,应城市,4,420900 +420982,安陆市,4,420900 +420984,汉川市,4,420900 +421002,沙市区,4,421000 +421003,荆州区,4,421000 +421022,公安县,4,421000 +421024,江陵县,4,421000 +421071,荆州经济技术开发区,4,421000 +421081,石首市,4,421000 +421083,洪湖市,4,421000 +421087,松滋市,4,421000 +421088,监利市,4,421000 +421102,黄州区,4,421100 +421121,团风县,4,421100 +421122,红安县,4,421100 +421123,罗田县,4,421100 +421124,英山县,4,421100 +421125,浠水县,4,421100 +421126,蕲春县,4,421100 +421127,黄梅县,4,421100 +421171,龙感湖管理区,4,421100 +421181,麻城市,4,421100 +421182,武穴市,4,421100 +421202,咸安区,4,421200 +421221,嘉鱼县,4,421200 +421222,通城县,4,421200 +421223,崇阳县,4,421200 +421224,通山县,4,421200 +421281,赤壁市,4,421200 +421303,曾都区,4,421300 +421321,随县,4,421300 +421381,广水市,4,421300 +422801,恩施市,4,422800 +422802,利川市,4,422800 +422822,建始县,4,422800 +422823,巴东县,4,422800 +422825,宣恩县,4,422800 +422826,咸丰县,4,422800 +422827,来凤县,4,422800 +422828,鹤峰县,4,422800 +429004,仙桃市,4,429000 +429005,潜江市,4,429000 +429006,天门市,4,429000 +429021,神农架林区,4,429000 +430102,芙蓉区,4,430100 +430103,天心区,4,430100 +430104,岳麓区,4,430100 +430105,开福区,4,430100 +430111,雨花区,4,430100 +430112,望城区,4,430100 +430121,长沙县,4,430100 +430181,浏阳市,4,430100 +430182,宁乡市,4,430100 +430202,荷塘区,4,430200 +430203,芦淞区,4,430200 +430204,石峰区,4,430200 +430211,天元区,4,430200 +430212,渌口区,4,430200 +430223,攸县,4,430200 +430224,茶陵县,4,430200 +430225,炎陵县,4,430200 +430271,云龙示范区,4,430200 +430281,醴陵市,4,430200 +430302,雨湖区,4,430300 +430304,岳塘区,4,430300 +430321,湘潭县,4,430300 +430371,湖南湘潭高新技术产业园区,4,430300 +430372,湘潭昭山示范区,4,430300 +430373,湘潭九华示范区,4,430300 +430381,湘乡市,4,430300 +430382,韶山市,4,430300 +430405,珠晖区,4,430400 +430406,雁峰区,4,430400 +430407,石鼓区,4,430400 +430408,蒸湘区,4,430400 +430412,南岳区,4,430400 +430421,衡阳县,4,430400 +430422,衡南县,4,430400 +430423,衡山县,4,430400 +430424,衡东县,4,430400 +430426,祁东县,4,430400 +430471,衡阳综合保税区,4,430400 +430472,湖南衡阳高新技术产业园区,4,430400 +430473,湖南衡阳松木经济开发区,4,430400 +430481,耒阳市,4,430400 +430482,常宁市,4,430400 +430502,双清区,4,430500 +430503,大祥区,4,430500 +430511,北塔区,4,430500 +430522,新邵县,4,430500 +430523,邵阳县,4,430500 +430524,隆回县,4,430500 +430525,洞口县,4,430500 +430527,绥宁县,4,430500 +430528,新宁县,4,430500 +430529,城步苗族自治县,4,430500 +430581,武冈市,4,430500 +430582,邵东市,4,430500 +430602,岳阳楼区,4,430600 +430603,云溪区,4,430600 +430611,君山区,4,430600 +430621,岳阳县,4,430600 +430623,华容县,4,430600 +430624,湘阴县,4,430600 +430626,平江县,4,430600 +430671,岳阳市屈原管理区,4,430600 +430681,汨罗市,4,430600 +430682,临湘市,4,430600 +430702,武陵区,4,430700 +430703,鼎城区,4,430700 +430721,安乡县,4,430700 +430722,汉寿县,4,430700 +430723,澧县,4,430700 +430724,临澧县,4,430700 +430725,桃源县,4,430700 +430726,石门县,4,430700 +430771,常德市西洞庭管理区,4,430700 +430781,津市市,4,430700 +430802,永定区,4,430800 +430811,武陵源区,4,430800 +430821,慈利县,4,430800 +430822,桑植县,4,430800 +430902,资阳区,4,430900 +430903,赫山区,4,430900 +430921,南县,4,430900 +430922,桃江县,4,430900 +430923,安化县,4,430900 +430971,益阳市大通湖管理区,4,430900 +430972,湖南益阳高新技术产业园区,4,430900 +430981,沅江市,4,430900 +431002,北湖区,4,431000 +431003,苏仙区,4,431000 +431021,桂阳县,4,431000 +431022,宜章县,4,431000 +431023,永兴县,4,431000 +431024,嘉禾县,4,431000 +431025,临武县,4,431000 +431026,汝城县,4,431000 +431027,桂东县,4,431000 +431028,安仁县,4,431000 +431081,资兴市,4,431000 +431102,零陵区,4,431100 +431103,冷水滩区,4,431100 +431122,东安县,4,431100 +431123,双牌县,4,431100 +431124,道县,4,431100 +431125,江永县,4,431100 +431126,宁远县,4,431100 +431127,蓝山县,4,431100 +431128,新田县,4,431100 +431129,江华瑶族自治县,4,431100 +431171,永州经济技术开发区,4,431100 +431173,永州市回龙圩管理区,4,431100 +431181,祁阳市,4,431100 +431202,鹤城区,4,431200 +431221,中方县,4,431200 +431222,沅陵县,4,431200 +431223,辰溪县,4,431200 +431224,溆浦县,4,431200 +431225,会同县,4,431200 +431226,麻阳苗族自治县,4,431200 +431227,新晃侗族自治县,4,431200 +431228,芷江侗族自治县,4,431200 +431229,靖州苗族侗族自治县,4,431200 +431230,通道侗族自治县,4,431200 +431271,怀化市洪江管理区,4,431200 +431281,洪江市,4,431200 +431302,娄星区,4,431300 +431321,双峰县,4,431300 +431322,新化县,4,431300 +431381,冷水江市,4,431300 +431382,涟源市,4,431300 +433101,吉首市,4,433100 +433122,泸溪县,4,433100 +433123,凤凰县,4,433100 +433124,花垣县,4,433100 +433125,保靖县,4,433100 +433126,古丈县,4,433100 +433127,永顺县,4,433100 +433130,龙山县,4,433100 +440103,荔湾区,4,440100 +440104,越秀区,4,440100 +440105,海珠区,4,440100 +440106,天河区,4,440100 +440111,白云区,4,440100 +440112,黄埔区,4,440100 +440113,番禺区,4,440100 +440114,花都区,4,440100 +440115,南沙区,4,440100 +440117,从化区,4,440100 +440118,增城区,4,440100 +440203,武江区,4,440200 +440204,浈江区,4,440200 +440205,曲江区,4,440200 +440222,始兴县,4,440200 +440224,仁化县,4,440200 +440229,翁源县,4,440200 +440232,乳源瑶族自治县,4,440200 +440233,新丰县,4,440200 +440281,乐昌市,4,440200 +440282,南雄市,4,440200 +440303,罗湖区,4,440300 +440304,福田区,4,440300 +440305,南山区,4,440300 +440306,宝安区,4,440300 +440307,龙岗区,4,440300 +440308,盐田区,4,440300 +440309,龙华区,4,440300 +440310,坪山区,4,440300 +440311,光明区,4,440300 +440402,香洲区,4,440400 +440403,斗门区,4,440400 +440404,金湾区,4,440400 +440507,龙湖区,4,440500 +440511,金平区,4,440500 +440512,濠江区,4,440500 +440513,潮阳区,4,440500 +440514,潮南区,4,440500 +440515,澄海区,4,440500 +440523,南澳县,4,440500 +440604,禅城区,4,440600 +440605,南海区,4,440600 +440606,顺德区,4,440600 +440607,三水区,4,440600 +440608,高明区,4,440600 +440703,蓬江区,4,440700 +440704,江海区,4,440700 +440705,新会区,4,440700 +440781,台山市,4,440700 +440783,开平市,4,440700 +440784,鹤山市,4,440700 +440785,恩平市,4,440700 +440802,赤坎区,4,440800 +440803,霞山区,4,440800 +440804,坡头区,4,440800 +440811,麻章区,4,440800 +440823,遂溪县,4,440800 +440825,徐闻县,4,440800 +440881,廉江市,4,440800 +440882,雷州市,4,440800 +440883,吴川市,4,440800 +440902,茂南区,4,440900 +440904,电白区,4,440900 +440981,高州市,4,440900 +440982,化州市,4,440900 +440983,信宜市,4,440900 +441202,端州区,4,441200 +441203,鼎湖区,4,441200 +441204,高要区,4,441200 +441223,广宁县,4,441200 +441224,怀集县,4,441200 +441225,封开县,4,441200 +441226,德庆县,4,441200 +441284,四会市,4,441200 +441302,惠城区,4,441300 +441303,惠阳区,4,441300 +441322,博罗县,4,441300 +441323,惠东县,4,441300 +441324,龙门县,4,441300 +441402,梅江区,4,441400 +441403,梅县区,4,441400 +441422,大埔县,4,441400 +441423,丰顺县,4,441400 +441424,五华县,4,441400 +441426,平远县,4,441400 +441427,蕉岭县,4,441400 +441481,兴宁市,4,441400 +441502,城区,4,441500 +441521,海丰县,4,441500 +441523,陆河县,4,441500 +441581,陆丰市,4,441500 +441602,源城区,4,441600 +441621,紫金县,4,441600 +441622,龙川县,4,441600 +441623,连平县,4,441600 +441624,和平县,4,441600 +441625,东源县,4,441600 +441702,江城区,4,441700 +441704,阳东区,4,441700 +441721,阳西县,4,441700 +441781,阳春市,4,441700 +441802,清城区,4,441800 +441803,清新区,4,441800 +441821,佛冈县,4,441800 +441823,阳山县,4,441800 +441825,连山壮族瑶族自治县,4,441800 +441826,连南瑶族自治县,4,441800 +441881,英德市,4,441800 +441882,连州市,4,441800 +445102,湘桥区,4,445100 +445103,潮安区,4,445100 +445122,饶平县,4,445100 +445202,榕城区,4,445200 +445203,揭东区,4,445200 +445222,揭西县,4,445200 +445224,惠来县,4,445200 +445281,普宁市,4,445200 +445302,云城区,4,445300 +445303,云安区,4,445300 +445321,新兴县,4,445300 +445322,郁南县,4,445300 +445381,罗定市,4,445300 +450102,兴宁区,4,450100 +450103,青秀区,4,450100 +450105,江南区,4,450100 +450107,西乡塘区,4,450100 +450108,良庆区,4,450100 +450109,邕宁区,4,450100 +450110,武鸣区,4,450100 +450123,隆安县,4,450100 +450124,马山县,4,450100 +450125,上林县,4,450100 +450126,宾阳县,4,450100 +450181,横州市,4,450100 +450202,城中区,4,450200 +450203,鱼峰区,4,450200 +450204,柳南区,4,450200 +450205,柳北区,4,450200 +450206,柳江区,4,450200 +450222,柳城县,4,450200 +450223,鹿寨县,4,450200 +450224,融安县,4,450200 +450225,融水苗族自治县,4,450200 +450226,三江侗族自治县,4,450200 +450302,秀峰区,4,450300 +450303,叠彩区,4,450300 +450304,象山区,4,450300 +450305,七星区,4,450300 +450311,雁山区,4,450300 +450312,临桂区,4,450300 +450321,阳朔县,4,450300 +450323,灵川县,4,450300 +450324,全州县,4,450300 +450325,兴安县,4,450300 +450326,永福县,4,450300 +450327,灌阳县,4,450300 +450328,龙胜各族自治县,4,450300 +450329,资源县,4,450300 +450330,平乐县,4,450300 +450332,恭城瑶族自治县,4,450300 +450381,荔浦市,4,450300 +450403,万秀区,4,450400 +450405,长洲区,4,450400 +450406,龙圩区,4,450400 +450421,苍梧县,4,450400 +450422,藤县,4,450400 +450423,蒙山县,4,450400 +450481,岑溪市,4,450400 +450502,海城区,4,450500 +450503,银海区,4,450500 +450512,铁山港区,4,450500 +450521,合浦县,4,450500 +450602,港口区,4,450600 +450603,防城区,4,450600 +450621,上思县,4,450600 +450681,东兴市,4,450600 +450702,钦南区,4,450700 +450703,钦北区,4,450700 +450721,灵山县,4,450700 +450722,浦北县,4,450700 +450802,港北区,4,450800 +450803,港南区,4,450800 +450804,覃塘区,4,450800 +450821,平南县,4,450800 +450881,桂平市,4,450800 +450902,玉州区,4,450900 +450903,福绵区,4,450900 +450921,容县,4,450900 +450922,陆川县,4,450900 +450923,博白县,4,450900 +450924,兴业县,4,450900 +450981,北流市,4,450900 +451002,右江区,4,451000 +451003,田阳区,4,451000 +451022,田东县,4,451000 +451024,德保县,4,451000 +451026,那坡县,4,451000 +451027,凌云县,4,451000 +451028,乐业县,4,451000 +451029,田林县,4,451000 +451030,西林县,4,451000 +451031,隆林各族自治县,4,451000 +451081,靖西市,4,451000 +451082,平果市,4,451000 +451102,八步区,4,451100 +451103,平桂区,4,451100 +451121,昭平县,4,451100 +451122,钟山县,4,451100 +451123,富川瑶族自治县,4,451100 +451202,金城江区,4,451200 +451203,宜州区,4,451200 +451221,南丹县,4,451200 +451222,天峨县,4,451200 +451223,凤山县,4,451200 +451224,东兰县,4,451200 +451225,罗城仫佬族自治县,4,451200 +451226,环江毛南族自治县,4,451200 +451227,巴马瑶族自治县,4,451200 +451228,都安瑶族自治县,4,451200 +451229,大化瑶族自治县,4,451200 +451302,兴宾区,4,451300 +451321,忻城县,4,451300 +451322,象州县,4,451300 +451323,武宣县,4,451300 +451324,金秀瑶族自治县,4,451300 +451381,合山市,4,451300 +451402,江州区,4,451400 +451421,扶绥县,4,451400 +451422,宁明县,4,451400 +451423,龙州县,4,451400 +451424,大新县,4,451400 +451425,天等县,4,451400 +451481,凭祥市,4,451400 +460105,秀英区,4,460100 +460106,龙华区,4,460100 +460107,琼山区,4,460100 +460108,美兰区,4,460100 +460202,海棠区,4,460200 +460203,吉阳区,4,460200 +460204,天涯区,4,460200 +460205,崖州区,4,460200 +460321,西沙群岛,4,460300 +460322,南沙群岛,4,460300 +460323,中沙群岛的岛礁及其海域,4,460300 +469001,五指山市,4,469000 +469002,琼海市,4,469000 +469005,文昌市,4,469000 +469006,万宁市,4,469000 +469007,东方市,4,469000 +469021,定安县,4,469000 +469022,屯昌县,4,469000 +469023,澄迈县,4,469000 +469024,临高县,4,469000 +469025,白沙黎族自治县,4,469000 +469026,昌江黎族自治县,4,469000 +469027,乐东黎族自治县,4,469000 +469028,陵水黎族自治县,4,469000 +469029,保亭黎族苗族自治县,4,469000 +469030,琼中黎族苗族自治县,4,469000 +500101,万州区,4,500100 +500102,涪陵区,4,500100 +500103,渝中区,4,500100 +500104,大渡口区,4,500100 +500105,江北区,4,500100 +500106,沙坪坝区,4,500100 +500107,九龙坡区,4,500100 +500108,南岸区,4,500100 +500109,北碚区,4,500100 +500110,綦江区,4,500100 +500111,大足区,4,500100 +500112,渝北区,4,500100 +500113,巴南区,4,500100 +500114,黔江区,4,500100 +500115,长寿区,4,500100 +500116,江津区,4,500100 +500117,合川区,4,500100 +500118,永川区,4,500100 +500119,南川区,4,500100 +500120,璧山区,4,500100 +500151,铜梁区,4,500100 +500152,潼南区,4,500100 +500153,荣昌区,4,500100 +500154,开州区,4,500100 +500155,梁平区,4,500100 +500156,武隆区,4,500100 +500229,城口县,4,500100 +500230,丰都县,4,500100 +500231,垫江县,4,500100 +500233,忠县,4,500100 +500235,云阳县,4,500100 +500236,奉节县,4,500100 +500237,巫山县,4,500100 +500238,巫溪县,4,500100 +500240,石柱土家族自治县,4,500100 +500241,秀山土家族苗族自治县,4,500100 +500242,酉阳土家族苗族自治县,4,500100 +500243,彭水苗族土家族自治县,4,500100 +510104,锦江区,4,510100 +510105,青羊区,4,510100 +510106,金牛区,4,510100 +510107,武侯区,4,510100 +510108,成华区,4,510100 +510112,龙泉驿区,4,510100 +510113,青白江区,4,510100 +510114,新都区,4,510100 +510115,温江区,4,510100 +510116,双流区,4,510100 +510117,郫都区,4,510100 +510118,新津区,4,510100 +510121,金堂县,4,510100 +510129,大邑县,4,510100 +510131,蒲江县,4,510100 +510181,都江堰市,4,510100 +510182,彭州市,4,510100 +510183,邛崃市,4,510100 +510184,崇州市,4,510100 +510185,简阳市,4,510100 +510302,自流井区,4,510300 +510303,贡井区,4,510300 +510304,大安区,4,510300 +510311,沿滩区,4,510300 +510321,荣县,4,510300 +510322,富顺县,4,510300 +510402,东区,4,510400 +510403,西区,4,510400 +510411,仁和区,4,510400 +510421,米易县,4,510400 +510422,盐边县,4,510400 +510502,江阳区,4,510500 +510503,纳溪区,4,510500 +510504,龙马潭区,4,510500 +510521,泸县,4,510500 +510522,合江县,4,510500 +510524,叙永县,4,510500 +510525,古蔺县,4,510500 +510603,旌阳区,4,510600 +510604,罗江区,4,510600 +510623,中江县,4,510600 +510681,广汉市,4,510600 +510682,什邡市,4,510600 +510683,绵竹市,4,510600 +510703,涪城区,4,510700 +510704,游仙区,4,510700 +510705,安州区,4,510700 +510722,三台县,4,510700 +510723,盐亭县,4,510700 +510725,梓潼县,4,510700 +510726,北川羌族自治县,4,510700 +510727,平武县,4,510700 +510781,江油市,4,510700 +510802,利州区,4,510800 +510811,昭化区,4,510800 +510812,朝天区,4,510800 +510821,旺苍县,4,510800 +510822,青川县,4,510800 +510823,剑阁县,4,510800 +510824,苍溪县,4,510800 +510903,船山区,4,510900 +510904,安居区,4,510900 +510921,蓬溪县,4,510900 +510923,大英县,4,510900 +510981,射洪市,4,510900 +511002,市中区,4,511000 +511011,东兴区,4,511000 +511024,威远县,4,511000 +511025,资中县,4,511000 +511071,内江经济开发区,4,511000 +511083,隆昌市,4,511000 +511102,市中区,4,511100 +511111,沙湾区,4,511100 +511112,五通桥区,4,511100 +511113,金口河区,4,511100 +511123,犍为县,4,511100 +511124,井研县,4,511100 +511126,夹江县,4,511100 +511129,沐川县,4,511100 +511132,峨边彝族自治县,4,511100 +511133,马边彝族自治县,4,511100 +511181,峨眉山市,4,511100 +511302,顺庆区,4,511300 +511303,高坪区,4,511300 +511304,嘉陵区,4,511300 +511321,南部县,4,511300 +511322,营山县,4,511300 +511323,蓬安县,4,511300 +511324,仪陇县,4,511300 +511325,西充县,4,511300 +511381,阆中市,4,511300 +511402,东坡区,4,511400 +511403,彭山区,4,511400 +511421,仁寿县,4,511400 +511423,洪雅县,4,511400 +511424,丹棱县,4,511400 +511425,青神县,4,511400 +511502,翠屏区,4,511500 +511503,南溪区,4,511500 +511504,叙州区,4,511500 +511523,江安县,4,511500 +511524,长宁县,4,511500 +511525,高县,4,511500 +511526,珙县,4,511500 +511527,筠连县,4,511500 +511528,兴文县,4,511500 +511529,屏山县,4,511500 +511602,广安区,4,511600 +511603,前锋区,4,511600 +511621,岳池县,4,511600 +511622,武胜县,4,511600 +511623,邻水县,4,511600 +511681,华蓥市,4,511600 +511702,通川区,4,511700 +511703,达川区,4,511700 +511722,宣汉县,4,511700 +511723,开江县,4,511700 +511724,大竹县,4,511700 +511725,渠县,4,511700 +511771,达州经济开发区,4,511700 +511781,万源市,4,511700 +511802,雨城区,4,511800 +511803,名山区,4,511800 +511822,荥经县,4,511800 +511823,汉源县,4,511800 +511824,石棉县,4,511800 +511825,天全县,4,511800 +511826,芦山县,4,511800 +511827,宝兴县,4,511800 +511902,巴州区,4,511900 +511903,恩阳区,4,511900 +511921,通江县,4,511900 +511922,南江县,4,511900 +511923,平昌县,4,511900 +511971,巴中经济开发区,4,511900 +512002,雁江区,4,512000 +512021,安岳县,4,512000 +512022,乐至县,4,512000 +513201,马尔康市,4,513200 +513221,汶川县,4,513200 +513222,理县,4,513200 +513223,茂县,4,513200 +513224,松潘县,4,513200 +513225,九寨沟县,4,513200 +513226,金川县,4,513200 +513227,小金县,4,513200 +513228,黑水县,4,513200 +513230,壤塘县,4,513200 +513231,阿坝县,4,513200 +513232,若尔盖县,4,513200 +513233,红原县,4,513200 +513301,康定市,4,513300 +513322,泸定县,4,513300 +513323,丹巴县,4,513300 +513324,九龙县,4,513300 +513325,雅江县,4,513300 +513326,道孚县,4,513300 +513327,炉霍县,4,513300 +513328,甘孜县,4,513300 +513329,新龙县,4,513300 +513330,德格县,4,513300 +513331,白玉县,4,513300 +513332,石渠县,4,513300 +513333,色达县,4,513300 +513334,理塘县,4,513300 +513335,巴塘县,4,513300 +513336,乡城县,4,513300 +513337,稻城县,4,513300 +513338,得荣县,4,513300 +513401,西昌市,4,513400 +513402,会理市,4,513400 +513422,木里藏族自治县,4,513400 +513423,盐源县,4,513400 +513424,德昌县,4,513400 +513426,会东县,4,513400 +513427,宁南县,4,513400 +513428,普格县,4,513400 +513429,布拖县,4,513400 +513430,金阳县,4,513400 +513431,昭觉县,4,513400 +513432,喜德县,4,513400 +513433,冕宁县,4,513400 +513434,越西县,4,513400 +513435,甘洛县,4,513400 +513436,美姑县,4,513400 +513437,雷波县,4,513400 +520102,南明区,4,520100 +520103,云岩区,4,520100 +520111,花溪区,4,520100 +520112,乌当区,4,520100 +520113,白云区,4,520100 +520115,观山湖区,4,520100 +520121,开阳县,4,520100 +520122,息烽县,4,520100 +520123,修文县,4,520100 +520181,清镇市,4,520100 +520201,钟山区,4,520200 +520203,六枝特区,4,520200 +520204,水城区,4,520200 +520281,盘州市,4,520200 +520302,红花岗区,4,520300 +520303,汇川区,4,520300 +520304,播州区,4,520300 +520322,桐梓县,4,520300 +520323,绥阳县,4,520300 +520324,正安县,4,520300 +520325,道真仡佬族苗族自治县,4,520300 +520326,务川仡佬族苗族自治县,4,520300 +520327,凤冈县,4,520300 +520328,湄潭县,4,520300 +520329,余庆县,4,520300 +520330,习水县,4,520300 +520381,赤水市,4,520300 +520382,仁怀市,4,520300 +520402,西秀区,4,520400 +520403,平坝区,4,520400 +520422,普定县,4,520400 +520423,镇宁布依族苗族自治县,4,520400 +520424,关岭布依族苗族自治县,4,520400 +520425,紫云苗族布依族自治县,4,520400 +520502,七星关区,4,520500 +520521,大方县,4,520500 +520523,金沙县,4,520500 +520524,织金县,4,520500 +520525,纳雍县,4,520500 +520526,威宁彝族回族苗族自治县,4,520500 +520527,赫章县,4,520500 +520581,黔西市,4,520500 +520602,碧江区,4,520600 +520603,万山区,4,520600 +520621,江口县,4,520600 +520622,玉屏侗族自治县,4,520600 +520623,石阡县,4,520600 +520624,思南县,4,520600 +520625,印江土家族苗族自治县,4,520600 +520626,德江县,4,520600 +520627,沿河土家族自治县,4,520600 +520628,松桃苗族自治县,4,520600 +522301,兴义市,4,522300 +522302,兴仁市,4,522300 +522323,普安县,4,522300 +522324,晴隆县,4,522300 +522325,贞丰县,4,522300 +522326,望谟县,4,522300 +522327,册亨县,4,522300 +522328,安龙县,4,522300 +522601,凯里市,4,522600 +522622,黄平县,4,522600 +522623,施秉县,4,522600 +522624,三穗县,4,522600 +522625,镇远县,4,522600 +522626,岑巩县,4,522600 +522627,天柱县,4,522600 +522628,锦屏县,4,522600 +522629,剑河县,4,522600 +522630,台江县,4,522600 +522631,黎平县,4,522600 +522632,榕江县,4,522600 +522633,从江县,4,522600 +522634,雷山县,4,522600 +522635,麻江县,4,522600 +522636,丹寨县,4,522600 +522701,都匀市,4,522700 +522702,福泉市,4,522700 +522722,荔波县,4,522700 +522723,贵定县,4,522700 +522725,瓮安县,4,522700 +522726,独山县,4,522700 +522727,平塘县,4,522700 +522728,罗甸县,4,522700 +522729,长顺县,4,522700 +522730,龙里县,4,522700 +522731,惠水县,4,522700 +522732,三都水族自治县,4,522700 +530102,五华区,4,530100 +530103,盘龙区,4,530100 +530111,官渡区,4,530100 +530112,西山区,4,530100 +530113,东川区,4,530100 +530114,呈贡区,4,530100 +530115,晋宁区,4,530100 +530124,富民县,4,530100 +530125,宜良县,4,530100 +530126,石林彝族自治县,4,530100 +530127,嵩明县,4,530100 +530128,禄劝彝族苗族自治县,4,530100 +530129,寻甸回族彝族自治县,4,530100 +530181,安宁市,4,530100 +530302,麒麟区,4,530300 +530303,沾益区,4,530300 +530304,马龙区,4,530300 +530322,陆良县,4,530300 +530323,师宗县,4,530300 +530324,罗平县,4,530300 +530325,富源县,4,530300 +530326,会泽县,4,530300 +530381,宣威市,4,530300 +530402,红塔区,4,530400 +530403,江川区,4,530400 +530423,通海县,4,530400 +530424,华宁县,4,530400 +530425,易门县,4,530400 +530426,峨山彝族自治县,4,530400 +530427,新平彝族傣族自治县,4,530400 +530428,元江哈尼族彝族傣族自治县,4,530400 +530481,澄江市,4,530400 +530502,隆阳区,4,530500 +530521,施甸县,4,530500 +530523,龙陵县,4,530500 +530524,昌宁县,4,530500 +530581,腾冲市,4,530500 +530602,昭阳区,4,530600 +530621,鲁甸县,4,530600 +530622,巧家县,4,530600 +530623,盐津县,4,530600 +530624,大关县,4,530600 +530625,永善县,4,530600 +530626,绥江县,4,530600 +530627,镇雄县,4,530600 +530628,彝良县,4,530600 +530629,威信县,4,530600 +530681,水富市,4,530600 +530702,古城区,4,530700 +530721,玉龙纳西族自治县,4,530700 +530722,永胜县,4,530700 +530723,华坪县,4,530700 +530724,宁蒗彝族自治县,4,530700 +530802,思茅区,4,530800 +530821,宁洱哈尼族彝族自治县,4,530800 +530822,墨江哈尼族自治县,4,530800 +530823,景东彝族自治县,4,530800 +530824,景谷傣族彝族自治县,4,530800 +530825,镇沅彝族哈尼族拉祜族自治县,4,530800 +530826,江城哈尼族彝族自治县,4,530800 +530827,孟连傣族拉祜族佤族自治县,4,530800 +530828,澜沧拉祜族自治县,4,530800 +530829,西盟佤族自治县,4,530800 +530902,临翔区,4,530900 +530921,凤庆县,4,530900 +530922,云县,4,530900 +530923,永德县,4,530900 +530924,镇康县,4,530900 +530925,双江拉祜族佤族布朗族傣族自治县,4,530900 +530926,耿马傣族佤族自治县,4,530900 +530927,沧源佤族自治县,4,530900 +532301,楚雄市,4,532300 +532302,禄丰市,4,532300 +532322,双柏县,4,532300 +532323,牟定县,4,532300 +532324,南华县,4,532300 +532325,姚安县,4,532300 +532326,大姚县,4,532300 +532327,永仁县,4,532300 +532328,元谋县,4,532300 +532329,武定县,4,532300 +532501,个旧市,4,532500 +532502,开远市,4,532500 +532503,蒙自市,4,532500 +532504,弥勒市,4,532500 +532523,屏边苗族自治县,4,532500 +532524,建水县,4,532500 +532525,石屏县,4,532500 +532527,泸西县,4,532500 +532528,元阳县,4,532500 +532529,红河县,4,532500 +532530,金平苗族瑶族傣族自治县,4,532500 +532531,绿春县,4,532500 +532532,河口瑶族自治县,4,532500 +532601,文山市,4,532600 +532622,砚山县,4,532600 +532623,西畴县,4,532600 +532624,麻栗坡县,4,532600 +532625,马关县,4,532600 +532626,丘北县,4,532600 +532627,广南县,4,532600 +532628,富宁县,4,532600 +532801,景洪市,4,532800 +532822,勐海县,4,532800 +532823,勐腊县,4,532800 +532901,大理市,4,532900 +532922,漾濞彝族自治县,4,532900 +532923,祥云县,4,532900 +532924,宾川县,4,532900 +532925,弥渡县,4,532900 +532926,南涧彝族自治县,4,532900 +532927,巍山彝族回族自治县,4,532900 +532928,永平县,4,532900 +532929,云龙县,4,532900 +532930,洱源县,4,532900 +532931,剑川县,4,532900 +532932,鹤庆县,4,532900 +533102,瑞丽市,4,533100 +533103,芒市,4,533100 +533122,梁河县,4,533100 +533123,盈江县,4,533100 +533124,陇川县,4,533100 +533301,泸水市,4,533300 +533323,福贡县,4,533300 +533324,贡山独龙族怒族自治县,4,533300 +533325,兰坪白族普米族自治县,4,533300 +533401,香格里拉市,4,533400 +533422,德钦县,4,533400 +533423,维西傈僳族自治县,4,533400 +540102,城关区,4,540100 +540103,堆龙德庆区,4,540100 +540104,达孜区,4,540100 +540121,林周县,4,540100 +540122,当雄县,4,540100 +540123,尼木县,4,540100 +540124,曲水县,4,540100 +540127,墨竹工卡县,4,540100 +540171,格尔木藏青工业园区,4,540100 +540172,拉萨经济技术开发区,4,540100 +540173,西藏文化旅游创意园区,4,540100 +540174,达孜工业园区,4,540100 +540202,桑珠孜区,4,540200 +540221,南木林县,4,540200 +540222,江孜县,4,540200 +540223,定日县,4,540200 +540224,萨迦县,4,540200 +540225,拉孜县,4,540200 +540226,昂仁县,4,540200 +540227,谢通门县,4,540200 +540228,白朗县,4,540200 +540229,仁布县,4,540200 +540230,康马县,4,540200 +540231,定结县,4,540200 +540232,仲巴县,4,540200 +540233,亚东县,4,540200 +540234,吉隆县,4,540200 +540235,聂拉木县,4,540200 +540236,萨嘎县,4,540200 +540237,岗巴县,4,540200 +540302,卡若区,4,540300 +540321,江达县,4,540300 +540322,贡觉县,4,540300 +540323,类乌齐县,4,540300 +540324,丁青县,4,540300 +540325,察雅县,4,540300 +540326,八宿县,4,540300 +540327,左贡县,4,540300 +540328,芒康县,4,540300 +540329,洛隆县,4,540300 +540330,边坝县,4,540300 +540402,巴宜区,4,540400 +540421,工布江达县,4,540400 +540422,米林县,4,540400 +540423,墨脱县,4,540400 +540424,波密县,4,540400 +540425,察隅县,4,540400 +540426,朗县,4,540400 +540502,乃东区,4,540500 +540521,扎囊县,4,540500 +540522,贡嘎县,4,540500 +540523,桑日县,4,540500 +540524,琼结县,4,540500 +540525,曲松县,4,540500 +540526,措美县,4,540500 +540527,洛扎县,4,540500 +540528,加查县,4,540500 +540529,隆子县,4,540500 +540530,错那县,4,540500 +540531,浪卡子县,4,540500 +540602,色尼区,4,540600 +540621,嘉黎县,4,540600 +540622,比如县,4,540600 +540623,聂荣县,4,540600 +540624,安多县,4,540600 +540625,申扎县,4,540600 +540626,索县,4,540600 +540627,班戈县,4,540600 +540628,巴青县,4,540600 +540629,尼玛县,4,540600 +540630,双湖县,4,540600 +542521,普兰县,4,542500 +542522,札达县,4,542500 +542523,噶尔县,4,542500 +542524,日土县,4,542500 +542525,革吉县,4,542500 +542526,改则县,4,542500 +542527,措勤县,4,542500 +610102,新城区,4,610100 +610103,碑林区,4,610100 +610104,莲湖区,4,610100 +610111,灞桥区,4,610100 +610112,未央区,4,610100 +610113,雁塔区,4,610100 +610114,阎良区,4,610100 +610115,临潼区,4,610100 +610116,长安区,4,610100 +610117,高陵区,4,610100 +610118,鄠邑区,4,610100 +610122,蓝田县,4,610100 +610124,周至县,4,610100 +610202,王益区,4,610200 +610203,印台区,4,610200 +610204,耀州区,4,610200 +610222,宜君县,4,610200 +610302,渭滨区,4,610300 +610303,金台区,4,610300 +610304,陈仓区,4,610300 +610305,凤翔区,4,610300 +610323,岐山县,4,610300 +610324,扶风县,4,610300 +610326,眉县,4,610300 +610327,陇县,4,610300 +610328,千阳县,4,610300 +610329,麟游县,4,610300 +610330,凤县,4,610300 +610331,太白县,4,610300 +610402,秦都区,4,610400 +610403,杨陵区,4,610400 +610404,渭城区,4,610400 +610422,三原县,4,610400 +610423,泾阳县,4,610400 +610424,乾县,4,610400 +610425,礼泉县,4,610400 +610426,永寿县,4,610400 +610428,长武县,4,610400 +610429,旬邑县,4,610400 +610430,淳化县,4,610400 +610431,武功县,4,610400 +610481,兴平市,4,610400 +610482,彬州市,4,610400 +610502,临渭区,4,610500 +610503,华州区,4,610500 +610522,潼关县,4,610500 +610523,大荔县,4,610500 +610524,合阳县,4,610500 +610525,澄城县,4,610500 +610526,蒲城县,4,610500 +610527,白水县,4,610500 +610528,富平县,4,610500 +610581,韩城市,4,610500 +610582,华阴市,4,610500 +610602,宝塔区,4,610600 +610603,安塞区,4,610600 +610621,延长县,4,610600 +610622,延川县,4,610600 +610625,志丹县,4,610600 +610626,吴起县,4,610600 +610627,甘泉县,4,610600 +610628,富县,4,610600 +610629,洛川县,4,610600 +610630,宜川县,4,610600 +610631,黄龙县,4,610600 +610632,黄陵县,4,610600 +610681,子长市,4,610600 +610702,汉台区,4,610700 +610703,南郑区,4,610700 +610722,城固县,4,610700 +610723,洋县,4,610700 +610724,西乡县,4,610700 +610725,勉县,4,610700 +610726,宁强县,4,610700 +610727,略阳县,4,610700 +610728,镇巴县,4,610700 +610729,留坝县,4,610700 +610730,佛坪县,4,610700 +610802,榆阳区,4,610800 +610803,横山区,4,610800 +610822,府谷县,4,610800 +610824,靖边县,4,610800 +610825,定边县,4,610800 +610826,绥德县,4,610800 +610827,米脂县,4,610800 +610828,佳县,4,610800 +610829,吴堡县,4,610800 +610830,清涧县,4,610800 +610831,子洲县,4,610800 +610881,神木市,4,610800 +610902,汉滨区,4,610900 +610921,汉阴县,4,610900 +610922,石泉县,4,610900 +610923,宁陕县,4,610900 +610924,紫阳县,4,610900 +610925,岚皋县,4,610900 +610926,平利县,4,610900 +610927,镇坪县,4,610900 +610929,白河县,4,610900 +610981,旬阳市,4,610900 +611002,商州区,4,611000 +611021,洛南县,4,611000 +611022,丹凤县,4,611000 +611023,商南县,4,611000 +611024,山阳县,4,611000 +611025,镇安县,4,611000 +611026,柞水县,4,611000 +620102,城关区,4,620100 +620103,七里河区,4,620100 +620104,西固区,4,620100 +620105,安宁区,4,620100 +620111,红古区,4,620100 +620121,永登县,4,620100 +620122,皋兰县,4,620100 +620123,榆中县,4,620100 +620171,兰州新区,4,620100 +620201,嘉峪关市,4,620200 +620302,金川区,4,620300 +620321,永昌县,4,620300 +620402,白银区,4,620400 +620403,平川区,4,620400 +620421,靖远县,4,620400 +620422,会宁县,4,620400 +620423,景泰县,4,620400 +620502,秦州区,4,620500 +620503,麦积区,4,620500 +620521,清水县,4,620500 +620522,秦安县,4,620500 +620523,甘谷县,4,620500 +620524,武山县,4,620500 +620525,张家川回族自治县,4,620500 +620602,凉州区,4,620600 +620621,民勤县,4,620600 +620622,古浪县,4,620600 +620623,天祝藏族自治县,4,620600 +620702,甘州区,4,620700 +620721,肃南裕固族自治县,4,620700 +620722,民乐县,4,620700 +620723,临泽县,4,620700 +620724,高台县,4,620700 +620725,山丹县,4,620700 +620802,崆峒区,4,620800 +620821,泾川县,4,620800 +620822,灵台县,4,620800 +620823,崇信县,4,620800 +620825,庄浪县,4,620800 +620826,静宁县,4,620800 +620881,华亭市,4,620800 +620902,肃州区,4,620900 +620921,金塔县,4,620900 +620922,瓜州县,4,620900 +620923,肃北蒙古族自治县,4,620900 +620924,阿克塞哈萨克族自治县,4,620900 +620981,玉门市,4,620900 +620982,敦煌市,4,620900 +621002,西峰区,4,621000 +621021,庆城县,4,621000 +621022,环县,4,621000 +621023,华池县,4,621000 +621024,合水县,4,621000 +621025,正宁县,4,621000 +621026,宁县,4,621000 +621027,镇原县,4,621000 +621102,安定区,4,621100 +621121,通渭县,4,621100 +621122,陇西县,4,621100 +621123,渭源县,4,621100 +621124,临洮县,4,621100 +621125,漳县,4,621100 +621126,岷县,4,621100 +621202,武都区,4,621200 +621221,成县,4,621200 +621222,文县,4,621200 +621223,宕昌县,4,621200 +621224,康县,4,621200 +621225,西和县,4,621200 +621226,礼县,4,621200 +621227,徽县,4,621200 +621228,两当县,4,621200 +622901,临夏市,4,622900 +622921,临夏县,4,622900 +622922,康乐县,4,622900 +622923,永靖县,4,622900 +622924,广河县,4,622900 +622925,和政县,4,622900 +622926,东乡族自治县,4,622900 +622927,积石山保安族东乡族撒拉族自治县,4,622900 +623001,合作市,4,623000 +623021,临潭县,4,623000 +623022,卓尼县,4,623000 +623023,舟曲县,4,623000 +623024,迭部县,4,623000 +623025,玛曲县,4,623000 +623026,碌曲县,4,623000 +623027,夏河县,4,623000 +630102,城东区,4,630100 +630103,城中区,4,630100 +630104,城西区,4,630100 +630105,城北区,4,630100 +630106,湟中区,4,630100 +630121,大通回族土族自治县,4,630100 +630123,湟源县,4,630100 +630202,乐都区,4,630200 +630203,平安区,4,630200 +630222,民和回族土族自治县,4,630200 +630223,互助土族自治县,4,630200 +630224,化隆回族自治县,4,630200 +630225,循化撒拉族自治县,4,630200 +632221,门源回族自治县,4,632200 +632222,祁连县,4,632200 +632223,海晏县,4,632200 +632224,刚察县,4,632200 +632301,同仁市,4,632300 +632322,尖扎县,4,632300 +632323,泽库县,4,632300 +632324,河南蒙古族自治县,4,632300 +632521,共和县,4,632500 +632522,同德县,4,632500 +632523,贵德县,4,632500 +632524,兴海县,4,632500 +632525,贵南县,4,632500 +632621,玛沁县,4,632600 +632622,班玛县,4,632600 +632623,甘德县,4,632600 +632624,达日县,4,632600 +632625,久治县,4,632600 +632626,玛多县,4,632600 +632701,玉树市,4,632700 +632722,杂多县,4,632700 +632723,称多县,4,632700 +632724,治多县,4,632700 +632725,囊谦县,4,632700 +632726,曲麻莱县,4,632700 +632801,格尔木市,4,632800 +632802,德令哈市,4,632800 +632803,茫崖市,4,632800 +632821,乌兰县,4,632800 +632822,都兰县,4,632800 +632823,天峻县,4,632800 +632857,大柴旦行政委员会,4,632800 +640104,兴庆区,4,640100 +640105,西夏区,4,640100 +640106,金凤区,4,640100 +640121,永宁县,4,640100 +640122,贺兰县,4,640100 +640181,灵武市,4,640100 +640202,大武口区,4,640200 +640205,惠农区,4,640200 +640221,平罗县,4,640200 +640302,利通区,4,640300 +640303,红寺堡区,4,640300 +640323,盐池县,4,640300 +640324,同心县,4,640300 +640381,青铜峡市,4,640300 +640402,原州区,4,640400 +640422,西吉县,4,640400 +640423,隆德县,4,640400 +640424,泾源县,4,640400 +640425,彭阳县,4,640400 +640502,沙坡头区,4,640500 +640521,中宁县,4,640500 +640522,海原县,4,640500 +650102,天山区,4,650100 +650103,沙依巴克区,4,650100 +650104,新市区,4,650100 +650105,水磨沟区,4,650100 +650106,头屯河区,4,650100 +650107,达坂城区,4,650100 +650109,米东区,4,650100 +650121,乌鲁木齐县,4,650100 +650202,独山子区,4,650200 +650203,克拉玛依区,4,650200 +650204,白碱滩区,4,650200 +650205,乌尔禾区,4,650200 +650402,高昌区,4,650400 +650421,鄯善县,4,650400 +650422,托克逊县,4,650400 +650502,伊州区,4,650500 +650521,巴里坤哈萨克自治县,4,650500 +650522,伊吾县,4,650500 +652301,昌吉市,4,652300 +652302,阜康市,4,652300 +652323,呼图壁县,4,652300 +652324,玛纳斯县,4,652300 +652325,奇台县,4,652300 +652327,吉木萨尔县,4,652300 +652328,木垒哈萨克自治县,4,652300 +652701,博乐市,4,652700 +652702,阿拉山口市,4,652700 +652722,精河县,4,652700 +652723,温泉县,4,652700 +652801,库尔勒市,4,652800 +652822,轮台县,4,652800 +652823,尉犁县,4,652800 +652824,若羌县,4,652800 +652825,且末县,4,652800 +652826,焉耆回族自治县,4,652800 +652827,和静县,4,652800 +652828,和硕县,4,652800 +652829,博湖县,4,652800 +652871,库尔勒经济技术开发区,4,652800 +652901,阿克苏市,4,652900 +652902,库车市,4,652900 +652922,温宿县,4,652900 +652924,沙雅县,4,652900 +652925,新和县,4,652900 +652926,拜城县,4,652900 +652927,乌什县,4,652900 +652928,阿瓦提县,4,652900 +652929,柯坪县,4,652900 +653001,阿图什市,4,653000 +653022,阿克陶县,4,653000 +653023,阿合奇县,4,653000 +653024,乌恰县,4,653000 +653101,喀什市,4,653100 +653121,疏附县,4,653100 +653122,疏勒县,4,653100 +653123,英吉沙县,4,653100 +653124,泽普县,4,653100 +653125,莎车县,4,653100 +653126,叶城县,4,653100 +653127,麦盖提县,4,653100 +653128,岳普湖县,4,653100 +653129,伽师县,4,653100 +653130,巴楚县,4,653100 +653131,塔什库尔干塔吉克自治县,4,653100 +653201,和田市,4,653200 +653221,和田县,4,653200 +653222,墨玉县,4,653200 +653223,皮山县,4,653200 +653224,洛浦县,4,653200 +653225,策勒县,4,653200 +653226,于田县,4,653200 +653227,民丰县,4,653200 +654002,伊宁市,4,654000 +654003,奎屯市,4,654000 +654004,霍尔果斯市,4,654000 +654021,伊宁县,4,654000 +654022,察布查尔锡伯自治县,4,654000 +654023,霍城县,4,654000 +654024,巩留县,4,654000 +654025,新源县,4,654000 +654026,昭苏县,4,654000 +654027,特克斯县,4,654000 +654028,尼勒克县,4,654000 +654201,塔城市,4,654200 +654202,乌苏市,4,654200 +654203,沙湾市,4,654200 +654221,额敏县,4,654200 +654224,托里县,4,654200 +654225,裕民县,4,654200 +654226,和布克赛尔蒙古自治县,4,654200 +654301,阿勒泰市,4,654300 +654321,布尔津县,4,654300 +654322,富蕴县,4,654300 +654323,福海县,4,654300 +654324,哈巴河县,4,654300 +654325,青河县,4,654300 +654326,吉木乃县,4,654300 +659001,石河子市,4,659000 +659002,阿拉尔市,4,659000 +659003,图木舒克市,4,659000 +659004,五家渠市,4,659000 +659005,北屯市,4,659000 +659006,铁门关市,4,659000 +659007,双河市,4,659000 +659008,可克达拉市,4,659000 +659009,昆玉市,4,659000 +659010,胡杨河市,4,659000 +659011,新星市,4,659000 \ No newline at end of file diff --git a/marketing-framework/marketing-spring-boot-starter-biz-ip/src/main/resources/ip2region.xdb b/marketing-framework/marketing-spring-boot-starter-biz-ip/src/main/resources/ip2region.xdb new file mode 100644 index 0000000..58596a5 Binary files /dev/null and b/marketing-framework/marketing-spring-boot-starter-biz-ip/src/main/resources/ip2region.xdb differ diff --git a/marketing-framework/marketing-spring-boot-starter-excel/.flattened-pom.xml b/marketing-framework/marketing-spring-boot-starter-excel/.flattened-pom.xml new file mode 100644 index 0000000..7ce15d4 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-excel/.flattened-pom.xml @@ -0,0 +1,90 @@ + + + 4.0.0 + com.platform + marketing-spring-boot-starter-excel + 0.0.1-jdk8-SNAPSHOT + marketing-spring-boot-starter-excel + Excel 拓展 + https://github.com/makemyownlife/platform-sms-pro + + + com.platform + marketing-common + 0.0.1-jdk8-SNAPSHOT + compile + + + org.springframework.boot + spring-boot-starter + 2.7.18 + compile + + + org.springframework + spring-web + 5.3.39 + provided + + + jakarta.servlet + jakarta.servlet-api + 4.0.4 + provided + + + com.alibaba + easyexcel + 4.0.3 + compile + + + com.google.guava + guava + 33.4.0-jre + compile + + + org.apache.commons + commons-compress + 1.27.1 + compile + + + com.platform + marketing-spring-boot-starter-biz-ip + 0.0.1-jdk8-SNAPSHOT + compile + true + + + + + huaweicloud + huawei + https://mirrors.huaweicloud.com/repository/maven/ + + + aliyunmaven + aliyun + https://maven.aliyun.com/repository/public + + + + false + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + + + false + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + + diff --git a/marketing-framework/marketing-spring-boot-starter-excel/pom.xml b/marketing-framework/marketing-spring-boot-starter-excel/pom.xml new file mode 100644 index 0000000..a56831b --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-excel/pom.xml @@ -0,0 +1,67 @@ + + + + com.platform + marketing-framework + ${revision} + + 4.0.0 + marketing-spring-boot-starter-excel + jar + + ${project.artifactId} + Excel 拓展 + https://github.com/makemyownlife/platform-sms-pro + + + + com.platform + marketing-common + + + + + org.springframework.boot + spring-boot-starter + + + + + org.springframework + spring-web + provided + + + + jakarta.servlet + jakarta.servlet-api + provided + + + + + com.alibaba + easyexcel + + + + com.google.guava + guava + + + + org.apache.commons + commons-compress + + + + com.platform + marketing-spring-boot-starter-biz-ip + true + + + + + diff --git a/marketing-framework/marketing-spring-boot-starter-excel/src/main/java/com/platform/marketing/framework/dict/config/MarketingDictAutoConfiguration.java b/marketing-framework/marketing-spring-boot-starter-excel/src/main/java/com/platform/marketing/framework/dict/config/MarketingDictAutoConfiguration.java new file mode 100644 index 0000000..e29d3d9 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-excel/src/main/java/com/platform/marketing/framework/dict/config/MarketingDictAutoConfiguration.java @@ -0,0 +1,18 @@ +package com.platform.marketing.framework.dict.config; + +import com.platform.marketing.framework.dict.core.DictFrameworkUtils; +import com.platform.marketing.framework.dict.core.adapter.DictDataAdapter; +import org.springframework.boot.autoconfigure.AutoConfiguration; +import org.springframework.context.annotation.Bean; + +@AutoConfiguration +public class MarketingDictAutoConfiguration { + + @Bean + @SuppressWarnings("InstantiationOfUtilityClass") + public DictFrameworkUtils dictUtils(DictDataAdapter dictDataAdapter) { + DictFrameworkUtils.init(dictDataAdapter); + return new DictFrameworkUtils(); + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-excel/src/main/java/com/platform/marketing/framework/dict/core/DictFrameworkUtils.java b/marketing-framework/marketing-spring-boot-starter-excel/src/main/java/com/platform/marketing/framework/dict/core/DictFrameworkUtils.java new file mode 100644 index 0000000..eb59240 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-excel/src/main/java/com/platform/marketing/framework/dict/core/DictFrameworkUtils.java @@ -0,0 +1,96 @@ +package com.platform.marketing.framework.dict.core; + +import cn.hutool.core.util.ObjectUtil; +import com.platform.marketing.framework.common.core.KeyValue; +import com.platform.marketing.framework.common.util.cache.CacheUtils; +import com.platform.marketing.framework.dict.core.adapter.DictDataAdapter; +import com.platform.marketing.framework.dict.core.dto.DictDataRespDTO; +import com.google.common.cache.CacheLoader; +import com.google.common.cache.LoadingCache; +import lombok.SneakyThrows; +import lombok.extern.slf4j.Slf4j; + +import java.time.Duration; +import java.util.List; + +/** + * 字典工具类 + * + + */ +@Slf4j +public class DictFrameworkUtils { + + private static DictDataAdapter dictDataApi; + + private static final DictDataRespDTO DICT_DATA_NULL = new DictDataRespDTO(); + + // TODO @puhui999:GET_DICT_DATA_CACHE、GET_DICT_DATA_LIST_CACHE、PARSE_DICT_DATA_CACHE 这 3 个缓存是有点重叠,可以思考下,有没可能减少 1 个。微信讨论好私聊,再具体改哈 + /** + * 针对 {@link #getDictDataLabel(String, String)} 的缓存 + */ + private static final LoadingCache, DictDataRespDTO> GET_DICT_DATA_CACHE = CacheUtils.buildAsyncReloadingCache( + Duration.ofMinutes(1L), // 过期时间 1 分钟 + new CacheLoader, DictDataRespDTO>() { + + @Override + public DictDataRespDTO load(KeyValue key) { + return ObjectUtil.defaultIfNull(dictDataApi.getDictData(key.getKey(), key.getValue()), DICT_DATA_NULL); + } + + }); + + /** + * 针对 {@link #getDictDataLabelList(String)} 的缓存 + */ + private static final LoadingCache> GET_DICT_DATA_LIST_CACHE = CacheUtils.buildAsyncReloadingCache( + Duration.ofMinutes(1L), // 过期时间 1 分钟 + new CacheLoader>() { + + @Override + public List load(String dictType) { + return dictDataApi.getDictDataLabelList(dictType); + } + + }); + + /** + * 针对 {@link #parseDictDataValue(String, String)} 的缓存 + */ + private static final LoadingCache, DictDataRespDTO> PARSE_DICT_DATA_CACHE = CacheUtils.buildAsyncReloadingCache( + Duration.ofMinutes(1L), // 过期时间 1 分钟 + new CacheLoader, DictDataRespDTO>() { + + @Override + public DictDataRespDTO load(KeyValue key) { + return ObjectUtil.defaultIfNull(dictDataApi.parseDictData(key.getKey(), key.getValue()), DICT_DATA_NULL); + } + + }); + + public static void init(DictDataAdapter dictDataAdapter) { + DictFrameworkUtils.dictDataApi = dictDataAdapter; + log.info("[init][初始化 DictFrameworkUtils 成功]"); + } + + @SneakyThrows + public static String getDictDataLabel(String dictType, Integer value) { + return GET_DICT_DATA_CACHE.get(new KeyValue<>(dictType, String.valueOf(value))).getLabel(); + } + + @SneakyThrows + public static String getDictDataLabel(String dictType, String value) { + return GET_DICT_DATA_CACHE.get(new KeyValue<>(dictType, value)).getLabel(); + } + + @SneakyThrows + public static List getDictDataLabelList(String dictType) { + return GET_DICT_DATA_LIST_CACHE.get(dictType); + } + + @SneakyThrows + public static String parseDictDataValue(String dictType, String label) { + return PARSE_DICT_DATA_CACHE.get(new KeyValue<>(dictType, label)).getValue(); + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-excel/src/main/java/com/platform/marketing/framework/dict/core/adapter/DictDataAdapter.java b/marketing-framework/marketing-spring-boot-starter-excel/src/main/java/com/platform/marketing/framework/dict/core/adapter/DictDataAdapter.java new file mode 100644 index 0000000..876dee3 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-excel/src/main/java/com/platform/marketing/framework/dict/core/adapter/DictDataAdapter.java @@ -0,0 +1,81 @@ +package com.platform.marketing.framework.dict.core.adapter; + +import cn.hutool.core.util.ObjUtil; +import cn.hutool.core.util.StrUtil; +import com.platform.marketing.framework.dict.core.dto.DictDataRespDTO; + +import java.util.Collection; +import java.util.List; + +import static com.platform.marketing.framework.common.util.collection.CollectionUtils.convertList; + +/** + * 字典数据 API 接口 + * + + */ +public interface DictDataAdapter { + + /** + * 校验字典数据们是否有效。如下情况,视为无效: + * 1. 字典数据不存在 + * 2. 字典数据被禁用 + * + * @param dictType 字典类型 + * @param values 字典数据值的数组 + */ + void validateDictDataList(String dictType, Collection values); + + /** + * 获得指定的字典数据,从缓存中 + * + * @param type 字典类型 + * @param value 字典数据值 + * @return 字典数据 + */ + DictDataRespDTO getDictData(String type, String value); + + /** + * 获得指定的字典标签,从缓存中 + * + * @param type 字典类型 + * @param value 字典数据值 + * @return 字典标签 + */ + default String getDictDataLabel(String type, Integer value) { + DictDataRespDTO dictData = getDictData(type, String.valueOf(value)); + if (ObjUtil.isNull(dictData)) { + return StrUtil.EMPTY; + } + return dictData.getLabel(); + } + + /** + * 解析获得指定的字典数据,从缓存中 + * + * @param type 字典类型 + * @param label 字典数据标签 + * @return 字典数据 + */ + DictDataRespDTO parseDictData(String type, String label); + + /** + * 获得指定字典类型的字典数据列表 + * + * @param dictType 字典类型 + * @return 字典数据列表 + */ + List getDictDataList(String dictType); + + /** + * 获得字典数据标签列表 + * + * @param dictType 字典类型 + * @return 字典数据标签列表 + */ + default List getDictDataLabelList(String dictType) { + List list = getDictDataList(dictType); + return convertList(list, DictDataRespDTO::getLabel); + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-excel/src/main/java/com/platform/marketing/framework/dict/core/dto/DictDataRespDTO.java b/marketing-framework/marketing-spring-boot-starter-excel/src/main/java/com/platform/marketing/framework/dict/core/dto/DictDataRespDTO.java new file mode 100644 index 0000000..3786239 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-excel/src/main/java/com/platform/marketing/framework/dict/core/dto/DictDataRespDTO.java @@ -0,0 +1,33 @@ +package com.platform.marketing.framework.dict.core.dto; + +import com.platform.marketing.framework.common.enums.CommonStatusEnum; +import lombok.Data; + +/** + * 字典数据 Response DTO + * + + */ +@Data +public class DictDataRespDTO { + + /** + * 字典标签 + */ + private String label; + /** + * 字典值 + */ + private String value; + /** + * 字典类型 + */ + private String dictType; + /** + * 状态 + * + * 枚举 {@link CommonStatusEnum} + */ + private Integer status; + +} diff --git a/marketing-framework/marketing-spring-boot-starter-excel/src/main/java/com/platform/marketing/framework/excel/core/annotations/DictFormat.java b/marketing-framework/marketing-spring-boot-starter-excel/src/main/java/com/platform/marketing/framework/excel/core/annotations/DictFormat.java new file mode 100644 index 0000000..faacc3f --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-excel/src/main/java/com/platform/marketing/framework/excel/core/annotations/DictFormat.java @@ -0,0 +1,22 @@ +package com.platform.marketing.framework.excel.core.annotations; + +import java.lang.annotation.*; + +/** + * 字典格式化 + * + * 实现将字典数据的值,格式化成字典数据的标签 + */ +@Target({ElementType.FIELD}) +@Retention(RetentionPolicy.RUNTIME) +@Inherited +public @interface DictFormat { + + /** + * 例如说,SysDictTypeConstants、InfDictTypeConstants + * + * @return 字典类型 + */ + String value(); + +} diff --git a/marketing-framework/marketing-spring-boot-starter-excel/src/main/java/com/platform/marketing/framework/excel/core/annotations/ExcelColumnSelect.java b/marketing-framework/marketing-spring-boot-starter-excel/src/main/java/com/platform/marketing/framework/excel/core/annotations/ExcelColumnSelect.java new file mode 100644 index 0000000..63d8bae --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-excel/src/main/java/com/platform/marketing/framework/excel/core/annotations/ExcelColumnSelect.java @@ -0,0 +1,27 @@ +package com.platform.marketing.framework.excel.core.annotations; + +import java.lang.annotation.*; + +/** + * 给 Excel 列添加下拉选择数据 + * + * 其中 {@link #dictType()} 和 {@link #functionName()} 二选一 + * + * @author HUIHUI + */ +@Target({ElementType.FIELD}) +@Retention(RetentionPolicy.RUNTIME) +@Inherited +public @interface ExcelColumnSelect { + + /** + * @return 字典类型 + */ + String dictType() default ""; + + /** + * @return 获取下拉数据源的方法名称 + */ + String functionName() default ""; + +} diff --git a/marketing-framework/marketing-spring-boot-starter-excel/src/main/java/com/platform/marketing/framework/excel/core/convert/AreaConvert.java b/marketing-framework/marketing-spring-boot-starter-excel/src/main/java/com/platform/marketing/framework/excel/core/convert/AreaConvert.java new file mode 100644 index 0000000..dabfdb0 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-excel/src/main/java/com/platform/marketing/framework/excel/core/convert/AreaConvert.java @@ -0,0 +1,46 @@ +package com.platform.marketing.framework.excel.core.convert; + +import cn.hutool.core.convert.Convert; +import com.platform.marketing.framework.ip.core.Area; +import com.platform.marketing.framework.ip.core.utils.AreaUtils; +import com.alibaba.excel.converters.Converter; +import com.alibaba.excel.enums.CellDataTypeEnum; +import com.alibaba.excel.metadata.GlobalConfiguration; +import com.alibaba.excel.metadata.data.ReadCellData; +import com.alibaba.excel.metadata.property.ExcelContentProperty; +import lombok.extern.slf4j.Slf4j; + +/** + * Excel 数据地区转换器 + * + * @author HUIHUI + */ +@Slf4j +public class AreaConvert implements Converter { + + @Override + public Class supportJavaTypeKey() { + throw new UnsupportedOperationException("暂不支持,也不需要"); + } + + @Override + public CellDataTypeEnum supportExcelTypeKey() { + throw new UnsupportedOperationException("暂不支持,也不需要"); + } + + @Override + public Object convertToJavaData(ReadCellData readCellData, ExcelContentProperty contentProperty, + GlobalConfiguration globalConfiguration) { + // 解析地区编号 + String label = readCellData.getStringValue(); + Area area = AreaUtils.parseArea(label); + if (area == null) { + log.error("[convertToJavaData][label({}) 解析不掉]", label); + return null; + } + // 将 value 转换成对应的属性 + Class fieldClazz = contentProperty.getField().getType(); + return Convert.convert(fieldClazz, area.getId()); + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-excel/src/main/java/com/platform/marketing/framework/excel/core/convert/DictConvert.java b/marketing-framework/marketing-spring-boot-starter-excel/src/main/java/com/platform/marketing/framework/excel/core/convert/DictConvert.java new file mode 100644 index 0000000..5a718a5 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-excel/src/main/java/com/platform/marketing/framework/excel/core/convert/DictConvert.java @@ -0,0 +1,72 @@ +package com.platform.marketing.framework.excel.core.convert; + +import cn.hutool.core.convert.Convert; +import com.platform.marketing.framework.dict.core.DictFrameworkUtils; +import com.platform.marketing.framework.excel.core.annotations.DictFormat; +import com.alibaba.excel.converters.Converter; +import com.alibaba.excel.enums.CellDataTypeEnum; +import com.alibaba.excel.metadata.GlobalConfiguration; +import com.alibaba.excel.metadata.data.ReadCellData; +import com.alibaba.excel.metadata.data.WriteCellData; +import com.alibaba.excel.metadata.property.ExcelContentProperty; +import lombok.extern.slf4j.Slf4j; + +/** + * Excel 数据字典转换器 + * + + */ +@Slf4j +public class DictConvert implements Converter { + + @Override + public Class supportJavaTypeKey() { + throw new UnsupportedOperationException("暂不支持,也不需要"); + } + + @Override + public CellDataTypeEnum supportExcelTypeKey() { + throw new UnsupportedOperationException("暂不支持,也不需要"); + } + + @Override + public Object convertToJavaData(ReadCellData readCellData, ExcelContentProperty contentProperty, + GlobalConfiguration globalConfiguration) { + // 使用字典解析 + String type = getType(contentProperty); + String label = readCellData.getStringValue(); + String value = DictFrameworkUtils.parseDictDataValue(type, label); + if (value == null) { + log.error("[convertToJavaData][type({}) 解析不掉 label({})]", type, label); + return null; + } + // 将 String 的 value 转换成对应的属性 + Class fieldClazz = contentProperty.getField().getType(); + return Convert.convert(fieldClazz, value); + } + + @Override + public WriteCellData convertToExcelData(Object object, ExcelContentProperty contentProperty, + GlobalConfiguration globalConfiguration) { + // 空时,返回空 + if (object == null) { + return new WriteCellData<>(""); + } + + // 使用字典格式化 + String type = getType(contentProperty); + String value = String.valueOf(object); + String label = DictFrameworkUtils.getDictDataLabel(type, value); + if (label == null) { + log.error("[convertToExcelData][type({}) 转换不了 label({})]", type, value); + return new WriteCellData<>(""); + } + // 生成 Excel 小表格 + return new WriteCellData<>(label); + } + + private static String getType(ExcelContentProperty contentProperty) { + return contentProperty.getField().getAnnotation(DictFormat.class).value(); + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-excel/src/main/java/com/platform/marketing/framework/excel/core/convert/JsonConvert.java b/marketing-framework/marketing-spring-boot-starter-excel/src/main/java/com/platform/marketing/framework/excel/core/convert/JsonConvert.java new file mode 100644 index 0000000..ad06d28 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-excel/src/main/java/com/platform/marketing/framework/excel/core/convert/JsonConvert.java @@ -0,0 +1,34 @@ +package com.platform.marketing.framework.excel.core.convert; + +import com.platform.marketing.framework.common.util.json.JsonUtils; +import com.alibaba.excel.converters.Converter; +import com.alibaba.excel.enums.CellDataTypeEnum; +import com.alibaba.excel.metadata.GlobalConfiguration; +import com.alibaba.excel.metadata.data.WriteCellData; +import com.alibaba.excel.metadata.property.ExcelContentProperty; + +/** + * Excel Json 转换器 + * + + */ +public class JsonConvert implements Converter { + + @Override + public Class supportJavaTypeKey() { + throw new UnsupportedOperationException("暂不支持,也不需要"); + } + + @Override + public CellDataTypeEnum supportExcelTypeKey() { + throw new UnsupportedOperationException("暂不支持,也不需要"); + } + + @Override + public WriteCellData convertToExcelData(Object value, ExcelContentProperty contentProperty, + GlobalConfiguration globalConfiguration) { + // 生成 Excel 小表格 + return new WriteCellData<>(JsonUtils.toJsonString(value)); + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-excel/src/main/java/com/platform/marketing/framework/excel/core/convert/MoneyConvert.java b/marketing-framework/marketing-spring-boot-starter-excel/src/main/java/com/platform/marketing/framework/excel/core/convert/MoneyConvert.java new file mode 100644 index 0000000..59f466f --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-excel/src/main/java/com/platform/marketing/framework/excel/core/convert/MoneyConvert.java @@ -0,0 +1,39 @@ +package com.platform.marketing.framework.excel.core.convert; + +import com.alibaba.excel.converters.Converter; +import com.alibaba.excel.enums.CellDataTypeEnum; +import com.alibaba.excel.metadata.GlobalConfiguration; +import com.alibaba.excel.metadata.data.WriteCellData; +import com.alibaba.excel.metadata.property.ExcelContentProperty; + +import java.math.BigDecimal; +import java.math.RoundingMode; + +/** + * 金额转换器 + * + * 金额单位:分 + * + + */ +public class MoneyConvert implements Converter { + + @Override + public Class supportJavaTypeKey() { + throw new UnsupportedOperationException("暂不支持,也不需要"); + } + + @Override + public CellDataTypeEnum supportExcelTypeKey() { + throw new UnsupportedOperationException("暂不支持,也不需要"); + } + + @Override + public WriteCellData convertToExcelData(Integer value, ExcelContentProperty contentProperty, + GlobalConfiguration globalConfiguration) { + BigDecimal result = BigDecimal.valueOf(value) + .divide(new BigDecimal(100), 2, RoundingMode.HALF_UP); + return new WriteCellData<>(result.toString()); + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-excel/src/main/java/com/platform/marketing/framework/excel/core/function/ExcelColumnSelectFunction.java b/marketing-framework/marketing-spring-boot-starter-excel/src/main/java/com/platform/marketing/framework/excel/core/function/ExcelColumnSelectFunction.java new file mode 100644 index 0000000..798a5f7 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-excel/src/main/java/com/platform/marketing/framework/excel/core/function/ExcelColumnSelectFunction.java @@ -0,0 +1,28 @@ +package com.platform.marketing.framework.excel.core.function; + +import java.util.List; + +/** + * Excel 列下拉数据源获取接口 + * + * 为什么不直接解析字典还搞个接口?考虑到有的下拉数据不是从字典中获取的所有需要做一个兼容 + + * @author HUIHUI + */ +public interface ExcelColumnSelectFunction { + + /** + * 获得方法名称 + * + * @return 方法名称 + */ + String getName(); + + /** + * 获得列下拉数据源 + * + * @return 下拉数据源 + */ + List getOptions(); + +} diff --git a/marketing-framework/marketing-spring-boot-starter-excel/src/main/java/com/platform/marketing/framework/excel/core/handler/SelectSheetWriteHandler.java b/marketing-framework/marketing-spring-boot-starter-excel/src/main/java/com/platform/marketing/framework/excel/core/handler/SelectSheetWriteHandler.java new file mode 100644 index 0000000..dca5201 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-excel/src/main/java/com/platform/marketing/framework/excel/core/handler/SelectSheetWriteHandler.java @@ -0,0 +1,158 @@ +package com.platform.marketing.framework.excel.core.handler; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.lang.Assert; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.extra.spring.SpringUtil; +import cn.hutool.poi.excel.ExcelUtil; +import com.platform.marketing.framework.common.core.KeyValue; +import com.platform.marketing.framework.dict.core.DictFrameworkUtils; +import com.platform.marketing.framework.excel.core.annotations.ExcelColumnSelect; +import com.platform.marketing.framework.excel.core.function.ExcelColumnSelectFunction; +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.write.handler.SheetWriteHandler; +import com.alibaba.excel.write.metadata.holder.WriteSheetHolder; +import com.alibaba.excel.write.metadata.holder.WriteWorkbookHolder; +import lombok.extern.slf4j.Slf4j; +import org.apache.poi.hssf.usermodel.HSSFDataValidation; +import org.apache.poi.ss.usermodel.*; +import org.apache.poi.ss.util.CellRangeAddressList; + +import java.lang.reflect.Field; +import java.util.Comparator; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import static com.platform.marketing.framework.common.util.collection.CollectionUtils.convertList; + +/** + * 基于固定 sheet 实现下拉框 + * + * @author HUIHUI + */ +@Slf4j +public class SelectSheetWriteHandler implements SheetWriteHandler { + + /** + * 数据起始行从 0 开始 + * + * 约定:本项目第一行有标题所以从 1 开始如果您的 Excel 有多行标题请自行更改 + */ + public static final int FIRST_ROW = 1; + /** + * 下拉列需要创建下拉框的行数,默认两千行如需更多请自行调整 + */ + public static final int LAST_ROW = 2000; + + private static final String DICT_SHEET_NAME = "字典sheet"; + + /** + * key: 列 value: 下拉数据源 + */ + private final Map> selectMap = new HashMap<>(); + + public SelectSheetWriteHandler(Class head) { + // 解析下拉数据 + int colIndex = 0; + for (Field field : head.getDeclaredFields()) { + if (field.isAnnotationPresent(ExcelColumnSelect.class)) { + ExcelProperty excelProperty = field.getAnnotation(ExcelProperty.class); + if (excelProperty != null && excelProperty.index() != -1) { + colIndex = excelProperty.index(); + } + getSelectDataList(colIndex, field); + } + colIndex++; + } + } + + /** + * 获得下拉数据,并添加到 {@link #selectMap} 中 + * + * @param colIndex 列索引 + * @param field 字段 + */ + private void getSelectDataList(int colIndex, Field field) { + ExcelColumnSelect columnSelect = field.getAnnotation(ExcelColumnSelect.class); + String dictType = columnSelect.dictType(); + String functionName = columnSelect.functionName(); + Assert.isTrue(ObjectUtil.isNotEmpty(dictType) || ObjectUtil.isNotEmpty(functionName), + "Field({}) 的 @ExcelColumnSelect 注解,dictType 和 functionName 不能同时为空", field.getName()); + + // 情况一:使用 dictType 获得下拉数据 + if (StrUtil.isNotEmpty(dictType)) { // 情况一: 字典数据 (默认) + selectMap.put(colIndex, DictFrameworkUtils.getDictDataLabelList(dictType)); + return; + } + + // 情况二:使用 functionName 获得下拉数据 + Map functionMap = SpringUtil.getApplicationContext().getBeansOfType(ExcelColumnSelectFunction.class); + ExcelColumnSelectFunction function = CollUtil.findOne(functionMap.values(), item -> item.getName().equals(functionName)); + Assert.notNull(function, "未找到对应的 function({})", functionName); + selectMap.put(colIndex, function.getOptions()); + } + + @Override + public void afterSheetCreate(WriteWorkbookHolder writeWorkbookHolder, WriteSheetHolder writeSheetHolder) { + if (CollUtil.isEmpty(selectMap)) { + return; + } + + // 1. 获取相应操作对象 + DataValidationHelper helper = writeSheetHolder.getSheet().getDataValidationHelper(); // 需要设置下拉框的 sheet 页的数据验证助手 + Workbook workbook = writeWorkbookHolder.getWorkbook(); // 获得工作簿 + List>> keyValues = convertList(selectMap.entrySet(), entry -> new KeyValue<>(entry.getKey(), entry.getValue())); + keyValues.sort(Comparator.comparing(item -> item.getValue().size())); // 升序不然创建下拉会报错 + + // 2. 创建数据字典的 sheet 页 + Sheet dictSheet = workbook.createSheet(DICT_SHEET_NAME); + for (KeyValue> keyValue : keyValues) { + int rowLength = keyValue.getValue().size(); + // 2.1 设置字典 sheet 页的值,每一列一个字典项 + for (int i = 0; i < rowLength; i++) { + Row row = dictSheet.getRow(i); + if (row == null) { + row = dictSheet.createRow(i); + } + row.createCell(keyValue.getKey()).setCellValue(keyValue.getValue().get(i)); + } + // 2.2 设置单元格下拉选择 + setColumnSelect(writeSheetHolder, workbook, helper, keyValue); + } + } + + /** + * 设置单元格下拉选择 + */ + private static void setColumnSelect(WriteSheetHolder writeSheetHolder, Workbook workbook, DataValidationHelper helper, + KeyValue> keyValue) { + // 1.1 创建可被其他单元格引用的名称 + Name name = workbook.createName(); + String excelColumn = ExcelUtil.indexToColName(keyValue.getKey()); + // 1.2 下拉框数据来源 eg:字典sheet!$B1:$B2 + String refers = DICT_SHEET_NAME + "!$" + excelColumn + "$1:$" + excelColumn + "$" + keyValue.getValue().size(); + name.setNameName("dict" + keyValue.getKey()); // 设置名称的名字 + name.setRefersToFormula(refers); // 设置公式 + + // 2.1 设置约束 + DataValidationConstraint constraint = helper.createFormulaListConstraint("dict" + keyValue.getKey()); // 设置引用约束 + // 设置下拉单元格的首行、末行、首列、末列 + CellRangeAddressList rangeAddressList = new CellRangeAddressList(FIRST_ROW, LAST_ROW, + keyValue.getKey(), keyValue.getKey()); + DataValidation validation = helper.createValidation(constraint, rangeAddressList); + if (validation instanceof HSSFDataValidation) { + validation.setSuppressDropDownArrow(false); + } else { + validation.setSuppressDropDownArrow(true); + validation.setShowErrorBox(true); + } + // 2.2 阻止输入非下拉框的值 + validation.setErrorStyle(DataValidation.ErrorStyle.STOP); + validation.createErrorBox("提示", "此值不存在于下拉选择中!"); + // 2.3 添加下拉框约束 + writeSheetHolder.getSheet().addValidationData(validation); + } + +} \ No newline at end of file diff --git a/marketing-framework/marketing-spring-boot-starter-excel/src/main/java/com/platform/marketing/framework/excel/core/util/ExcelUtils.java b/marketing-framework/marketing-spring-boot-starter-excel/src/main/java/com/platform/marketing/framework/excel/core/util/ExcelUtils.java new file mode 100644 index 0000000..a71a236 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-excel/src/main/java/com/platform/marketing/framework/excel/core/util/ExcelUtils.java @@ -0,0 +1,52 @@ +package com.platform.marketing.framework.excel.core.util; + +import com.platform.marketing.framework.common.util.http.HttpUtils; +import com.platform.marketing.framework.excel.core.handler.SelectSheetWriteHandler; +import com.alibaba.excel.EasyExcel; +import com.alibaba.excel.converters.longconverter.LongStringConverter; +import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; + +/** + * Excel 工具类 + * + + */ +public class ExcelUtils { + + /** + * 将列表以 Excel 响应给前端 + * + * @param response 响应 + * @param filename 文件名 + * @param sheetName Excel sheet 名 + * @param head Excel head 头 + * @param data 数据列表哦 + * @param 泛型,保证 head 和 data 类型的一致性 + * @throws IOException 写入失败的情况 + */ + public static void write(HttpServletResponse response, String filename, String sheetName, + Class head, List data) throws IOException { + // 输出 Excel + EasyExcel.write(response.getOutputStream(), head) + .autoCloseStream(false) // 不要自动关闭,交给 Servlet 自己处理 + .registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()) // 基于 column 长度,自动适配。最大 255 宽度 + .registerWriteHandler(new SelectSheetWriteHandler(head)) // 基于固定 sheet 实现下拉框 + .registerConverter(new LongStringConverter()) // 避免 Long 类型丢失精度 + .sheet(sheetName).doWrite(data); + // 设置 header 和 contentType。写在最后的原因是,避免报错时,响应 contentType 已经被修改了 + response.addHeader("Content-Disposition", "attachment;filename=" + HttpUtils.encodeUtf8(filename)); + response.setContentType("application/vnd.ms-excel;charset=UTF-8"); + } + + public static List read(MultipartFile file, Class head) throws IOException { + return EasyExcel.read(file.getInputStream(), head, null) + .autoCloseStream(false) // 不要自动关闭,交给 Servlet 自己处理 + .doReadAllSync(); + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-excel/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/marketing-framework/marketing-spring-boot-starter-excel/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 0000000..bd7fea4 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-excel/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +com.platform.marketing.framework.dict.config.MarketingDictAutoConfiguration \ No newline at end of file diff --git a/marketing-framework/marketing-spring-boot-starter-idgenerator/.flattened-pom.xml b/marketing-framework/marketing-spring-boot-starter-idgenerator/.flattened-pom.xml new file mode 100644 index 0000000..710e567 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-idgenerator/.flattened-pom.xml @@ -0,0 +1,59 @@ + + + 4.0.0 + com.platform + marketing-spring-boot-starter-idgenerator + 0.0.1-jdk8-SNAPSHOT + 该包是技术组件,每个子包,代表一个组件。每个组件包括两部分: + 1. core 包:是该组件的核心封装 + 2. config 包:是该组件基于 Spring 的配置 + + 技术组件,也分成两类: + 1. 框架组件:和我们熟悉的 MyBatis、Redis 等等的拓展 + 2. 业务组件:和业务相关的组件的封装,例如说数据字典、操作日志等等。 + 如果是业务组件,Maven 名字会包含 biz + https://github.com/makemyownlife/platform-sms-pro/marketing-spring-boot-starter-idgenerator + + + com.platform + marketing-spring-boot-starter-redis + 0.0.1-jdk8-SNAPSHOT + compile + + + org.apache.commons + commons-lang3 + 3.12.0 + compile + + + + + huaweicloud + huawei + https://mirrors.huaweicloud.com/repository/maven/ + + + aliyunmaven + aliyun + https://maven.aliyun.com/repository/public + + + + false + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + + + false + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + + diff --git a/marketing-framework/marketing-spring-boot-starter-idgenerator/pom.xml b/marketing-framework/marketing-spring-boot-starter-idgenerator/pom.xml new file mode 100644 index 0000000..c0179c9 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-idgenerator/pom.xml @@ -0,0 +1,35 @@ + + + 4.0.0 + + + com.platform + marketing-framework + ${revision} + + + marketing-spring-boot-starter-idgenerator + + + UTF-8 + + + + + + com.platform + marketing-spring-boot-starter-redis + + + + org.apache.commons + commons-lang3 + 3.12.0 + + + + + + \ No newline at end of file diff --git a/marketing-framework/marketing-spring-boot-starter-idgenerator/src/main/java/com/platform/marketing/framework/idgenerator/config/MarketingIdGeneratorAutoConfiguration.java b/marketing-framework/marketing-spring-boot-starter-idgenerator/src/main/java/com/platform/marketing/framework/idgenerator/config/MarketingIdGeneratorAutoConfiguration.java new file mode 100644 index 0000000..578c6be --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-idgenerator/src/main/java/com/platform/marketing/framework/idgenerator/config/MarketingIdGeneratorAutoConfiguration.java @@ -0,0 +1,22 @@ +package com.platform.marketing.framework.idgenerator.config; + +import com.platform.marketing.framework.redis.config.MarketingRedisAutoConfiguration; +import com.platform.marketing.framework.idgenerator.core.service.IdGeneratorService; +import com.platform.marketing.framework.idgenerator.core.service.impl.RedisIdGeneratorServiceImpl; +import org.springframework.boot.autoconfigure.AutoConfiguration; +import org.springframework.context.annotation.Bean; +import org.springframework.data.redis.core.StringRedisTemplate; + +/** + * ID 生成器 (通过 REDIS 自增实现) + */ +@AutoConfiguration(after = MarketingRedisAutoConfiguration.class) +public class MarketingIdGeneratorAutoConfiguration { + + @Bean(value = "idGeneratorService") + public IdGeneratorService createSecurityTokenService(StringRedisTemplate stringRedisTemplate) { + IdGeneratorService idGeneratorService = new RedisIdGeneratorServiceImpl(stringRedisTemplate); + return idGeneratorService; + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-idgenerator/src/main/java/com/platform/marketing/framework/idgenerator/core/service/IdGeneratorService.java b/marketing-framework/marketing-spring-boot-starter-idgenerator/src/main/java/com/platform/marketing/framework/idgenerator/core/service/IdGeneratorService.java new file mode 100644 index 0000000..7acbb47 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-idgenerator/src/main/java/com/platform/marketing/framework/idgenerator/core/service/IdGeneratorService.java @@ -0,0 +1,10 @@ +package com.platform.marketing.framework.idgenerator.core.service; + +/** + * 编号生成器 + */ +public interface IdGeneratorService { + + Long createUniqueId(String shardingKey); + +} diff --git a/marketing-framework/marketing-spring-boot-starter-idgenerator/src/main/java/com/platform/marketing/framework/idgenerator/core/service/impl/RedisIdGeneratorServiceImpl.java b/marketing-framework/marketing-spring-boot-starter-idgenerator/src/main/java/com/platform/marketing/framework/idgenerator/core/service/impl/RedisIdGeneratorServiceImpl.java new file mode 100644 index 0000000..95f6fd4 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-idgenerator/src/main/java/com/platform/marketing/framework/idgenerator/core/service/impl/RedisIdGeneratorServiceImpl.java @@ -0,0 +1,61 @@ +package com.platform.marketing.framework.idgenerator.core.service.impl; + +import com.platform.marketing.framework.idgenerator.core.service.IdGeneratorService; +import com.platform.marketing.framework.idgenerator.core.util.LocalSequence; +import com.platform.marketing.framework.idgenerator.core.util.ShardingConstants; +import com.platform.marketing.framework.idgenerator.core.util.SnowFlakeIdGenerator; +import com.platform.marketing.framework.idgenerator.core.util.StringHashUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.data.redis.core.RedisTemplate; + +import java.util.concurrent.TimeUnit; + +/** + * 编号生成器 + */ +public class RedisIdGeneratorServiceImpl implements IdGeneratorService { + + private final static Logger logger = LoggerFactory.getLogger(RedisIdGeneratorServiceImpl.class); + + private RedisTemplate redisTemplate; + + public RedisIdGeneratorServiceImpl(RedisTemplate redisTemplate) { + this.redisTemplate = redisTemplate; + } + + public Long createUniqueId(String shardingKey) { + Integer workerId = StringHashUtil.hashSlot(shardingKey); + Long currentTime = System.currentTimeMillis(); + // 从本地缓冲中获取 + LocalSequence.SequenceEntity sequenceEntity = LocalSequence.getSeqEntity(); + if (sequenceEntity != null) { + return SnowFlakeIdGenerator.getUniqueId(sequenceEntity.getCurrentTime(), workerId, sequenceEntity.getSeq()); + } + // 从redis自增一个步长 , 放入本地内存中待用 + String idGeneratorKey = ShardingConstants.ID_REDIS_PFEFIX + currentTime; + Long counter = redisTemplate.opsForValue().increment(idGeneratorKey, ShardingConstants.STEP_LENGTH); + // 设置过期时间:120秒 + redisTemplate.expire(idGeneratorKey, ShardingConstants.SEQ_EXPIRE_TIME, TimeUnit.SECONDS); + logger.warn("redisKey:{} 序号值:{} ", idGeneratorKey, counter); + // 判断是否有极限情况 ,1ms产生的数据超过了最大序号,那么最有可能原因是 当前机器的时间钟不一样 + if (counter - ShardingConstants.STEP_LENGTH >= ShardingConstants.MAX_SEQ) { + logger.error("redisKey:{} 序号值:{} 超过了最大阈值{}", idGeneratorKey, counter, ShardingConstants.MAX_SEQ); + return null; + } + // 当前自增的最小 id + long cursor = counter - ShardingConstants.STEP_LENGTH + 1; + while (cursor <= Math.min(counter, ShardingConstants.MAX_SEQ)) { + LocalSequence.SequenceEntity newSequenceEntity = new LocalSequence.SequenceEntity(currentTime, new Long(cursor).intValue()); + LocalSequence.addSeqEntity(newSequenceEntity); + cursor++; + } + sequenceEntity = LocalSequence.getSeqEntity(); + if (sequenceEntity == null) { + return null; + } + Long uniqueId = SnowFlakeIdGenerator.getUniqueId(sequenceEntity.getCurrentTime(), workerId.intValue(), sequenceEntity.getSeq()); + return uniqueId; + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-idgenerator/src/main/java/com/platform/marketing/framework/idgenerator/core/util/LocalSequence.java b/marketing-framework/marketing-spring-boot-starter-idgenerator/src/main/java/com/platform/marketing/framework/idgenerator/core/util/LocalSequence.java new file mode 100644 index 0000000..91382cd --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-idgenerator/src/main/java/com/platform/marketing/framework/idgenerator/core/util/LocalSequence.java @@ -0,0 +1,53 @@ +package com.platform.marketing.framework.idgenerator.core.util; + +import java.util.concurrent.ConcurrentLinkedQueue; + +/** + * 本地缓冲 (每张表预留50个) + */ +public class LocalSequence { + + private static ConcurrentLinkedQueue sequenceQueue = new ConcurrentLinkedQueue(); + + public static SequenceEntity getSeqEntity() { + SequenceEntity seqEntity = sequenceQueue.poll(); + if (seqEntity == null) { + return null; + } + return seqEntity; + } + + public static void addSeqEntity(SequenceEntity seqEntity) { + sequenceQueue.offer(seqEntity); + } + + public static class SequenceEntity { + + private Long currentTime; + + private Integer seq; + + public SequenceEntity(Long currentTime, Integer seq) { + this.currentTime = currentTime; + this.seq = seq; + } + + public Long getCurrentTime() { + return currentTime; + } + + public void setCurrentTime(Long currentTime) { + this.currentTime = currentTime; + } + + public Integer getSeq() { + return seq; + } + + public void setSeq(Integer seq) { + this.seq = seq; + } + + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-idgenerator/src/main/java/com/platform/marketing/framework/idgenerator/core/util/ShardingConstants.java b/marketing-framework/marketing-spring-boot-starter-idgenerator/src/main/java/com/platform/marketing/framework/idgenerator/core/util/ShardingConstants.java new file mode 100644 index 0000000..936959a --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-idgenerator/src/main/java/com/platform/marketing/framework/idgenerator/core/util/ShardingConstants.java @@ -0,0 +1,28 @@ +package com.platform.marketing.framework.idgenerator.core.util; + +public class ShardingConstants { + + //系统默认最大分区数 + public static final int SHARDING_LENGTH = 1024; + + //表分区列表 + private static final int PARTITION_LENGTH = ShardingConstants.SHARDING_LENGTH; + + // %转换为&操作的换算数值 + public static final long AND_VALUE = PARTITION_LENGTH - 1; + + public static final long STEP_LENGTH = 15; + + public static final int SEQ_EXPIRE_TIME = 120; + + public final static int MAX_SEQ = 4095; + + public final static String ID_REDIS_PFEFIX = "sharding:idGenerator:"; + + // 主键 + public final static String DEFAULT_PRIMARY_KEY = "id"; + + //组合键数目 默认为 1 + public final static int DEFAULT_SINGLE_COMBINE_KEY_LENGTH = 1; + +} diff --git a/marketing-framework/marketing-spring-boot-starter-idgenerator/src/main/java/com/platform/marketing/framework/idgenerator/core/util/SnowFlakeIdGenerator.java b/marketing-framework/marketing-spring-boot-starter-idgenerator/src/main/java/com/platform/marketing/framework/idgenerator/core/util/SnowFlakeIdGenerator.java new file mode 100644 index 0000000..b92df35 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-idgenerator/src/main/java/com/platform/marketing/framework/idgenerator/core/util/SnowFlakeIdGenerator.java @@ -0,0 +1,61 @@ +package com.platform.marketing.framework.idgenerator.core.util; + +public class SnowFlakeIdGenerator { + + //总的分区数 + private final static int SHARDING_NUM = ShardingConstants.SHARDING_LENGTH; + + //最大机器id 1023 也就是 1111111111 + private final static int MAX_WORKER_ID = SHARDING_NUM - 1; + + /** + * 开始时间截 (2019-08-06) + */ + private static final long twepoch = 1565020800000L; + + //最大序号 + private final static int MAX_SEQ = 4095; + + private final static long WORKERID_BITS = 10L; + + private final static long SEQUENCE_BITS = 12L; + + private final static long TIMESTAMP_LEFTSHIFT = SEQUENCE_BITS + WORKERID_BITS; + + private final static long WORKERID_SHIFT = SEQUENCE_BITS; + + public static long getUniqueId(int workerId, int seqId) { + if (workerId > MAX_WORKER_ID || workerId < 0) { + throw new IllegalArgumentException("workerId is not Illegal"); + } + if (seqId > MAX_SEQ || seqId < 0) { + throw new IllegalArgumentException("seqId is not Illegal "); + } + //时间戳 + long timestamp = System.currentTimeMillis(); + //机器编号 + return ((timestamp - twepoch) << TIMESTAMP_LEFTSHIFT) | (workerId << WORKERID_SHIFT) | seqId; + } + + public static long getUniqueId(long timestamp, int workerId, int seqId) { + if (workerId > MAX_WORKER_ID || workerId < 0) { + throw new IllegalArgumentException("workerId is not Illegal"); + } + if (seqId > MAX_SEQ || seqId < 0) { + throw new IllegalArgumentException("seqId is not Illegal "); + } + return ((timestamp - twepoch) << TIMESTAMP_LEFTSHIFT) | (workerId << WORKERID_SHIFT) | seqId; + } + + public static Integer getWorkerId(Long uniqueId) { + Long workerId = (uniqueId >> 12) & 0x03ff; + return workerId.intValue(); + } + + public static void main(String[] args) { + Long id = SnowFlakeIdGenerator.getUniqueId(1023, 12); + String s = Long.toBinaryString(id); + System.out.println(s); + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-idgenerator/src/main/java/com/platform/marketing/framework/idgenerator/core/util/StringHashUtil.java b/marketing-framework/marketing-spring-boot-starter-idgenerator/src/main/java/com/platform/marketing/framework/idgenerator/core/util/StringHashUtil.java new file mode 100644 index 0000000..06ddcad --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-idgenerator/src/main/java/com/platform/marketing/framework/idgenerator/core/util/StringHashUtil.java @@ -0,0 +1,92 @@ +package com.platform.marketing.framework.idgenerator.core.util; + +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.zip.CRC32; + +/** + * string hash 工具类 包含笛卡尔积 + * Created by diven on 2020/10/21. + */ +public class StringHashUtil { + + private final static Logger logger = LoggerFactory.getLogger(StringHashUtil.class); + + private final static String CHARSET = "UTF-8"; + + public static Integer hashSlot(String value) { + try { + CRC32 crc32 = new CRC32(); + crc32.update(value.getBytes(CHARSET)); + long crcValue = crc32.getValue(); + Long hash = crcValue % 1024; + return hash.intValue(); + } catch (Exception e) { + logger.error("hashSlot value:" + value, e); + return null; + } + } + + public static List descartes(List> collections) { + if (collections == null) { + return Collections.emptyList(); + } + //单维列表 + if (collections.size() == 1) { + return collections.get(0); + } + //两组列表 + if (collections.size() == 2) { + return descartes2(collections.get(0), collections.get(1)); + } + //多维 + if (collections.size() > 2) { + return descartes3(collections); + } + return null; + } + + public static List descartes2(List first, List second) { + List arr = new ArrayList<>(first.size() * second.size()); + for (int i = 0; i < first.size(); i++) { + String firstItem = first.get(i); + for (int j = 0; j < second.size(); j++) { + String secondItem = second.get(j); + if (StringUtils.isNotBlank(firstItem) && StringUtils.isNotBlank(secondItem)) { + arr.add(firstItem + secondItem); + } + } + } + return arr; + } + + public static List descartes3(List> collections) { + int length = collections.size(); + List list1 = collections.get(0); + List list2 = collections.get(1); + //先触发前两条记录 + List trigger = descartes2(list1, list2); + for (int i = 2; i < length; i++) { + List temp = collections.get(i); + trigger = descartes2(trigger, temp); + } + return trigger; + } + + public static int index(int slot, int shardingCount) { + int segment = 1024 / shardingCount; + int index = slot / segment; + return index; + } + + public static int indexDirect(int slot, int shardingCount) { + int index = slot % shardingCount; + return index; + } + +} \ No newline at end of file diff --git a/marketing-framework/marketing-spring-boot-starter-idgenerator/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/marketing-framework/marketing-spring-boot-starter-idgenerator/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 0000000..2a40153 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-idgenerator/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +com.platform.marketing.framework.idgenerator.config.MarketingIdGeneratorAutoConfiguration \ No newline at end of file diff --git a/marketing-framework/marketing-spring-boot-starter-job/.flattened-pom.xml b/marketing-framework/marketing-spring-boot-starter-job/.flattened-pom.xml new file mode 100644 index 0000000..305c1f1 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-job/.flattened-pom.xml @@ -0,0 +1,61 @@ + + + 4.0.0 + com.platform + marketing-spring-boot-starter-job + 0.0.1-jdk8-SNAPSHOT + marketing-spring-boot-starter-job + 任务拓展 + 1. 定时任务,基于 Quartz 拓展 + 2. 异步任务,基于 Spring Async 拓展 + https://github.com/makemyownlife/platform-sms-pro + + + com.platform + marketing-common + 0.0.1-jdk8-SNAPSHOT + compile + + + org.springframework.boot + spring-boot-starter-quartz + 2.7.18 + compile + + + jakarta.validation + jakarta.validation-api + 2.0.2 + compile + + + + + huaweicloud + huawei + https://mirrors.huaweicloud.com/repository/maven/ + + + aliyunmaven + aliyun + https://maven.aliyun.com/repository/public + + + + false + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + + + false + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + + diff --git a/marketing-framework/marketing-spring-boot-starter-job/pom.xml b/marketing-framework/marketing-spring-boot-starter-job/pom.xml new file mode 100644 index 0000000..59c9d47 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-job/pom.xml @@ -0,0 +1,41 @@ + + + + com.platform + marketing-framework + ${revision} + + 4.0.0 + marketing-spring-boot-starter-job + jar + + ${project.artifactId} + 任务拓展 + 1. 定时任务,基于 Quartz 拓展 + 2. 异步任务,基于 Spring Async 拓展 + + https://github.com/makemyownlife/platform-sms-pro + + + + com.platform + marketing-common + + + + + org.springframework.boot + spring-boot-starter-quartz + + + + + jakarta.validation + jakarta.validation-api + + + + + diff --git a/marketing-framework/marketing-spring-boot-starter-job/src/main/java/com/platform/marketing/framework/quartz/config/MarketingAsyncAutoConfiguration.java b/marketing-framework/marketing-spring-boot-starter-job/src/main/java/com/platform/marketing/framework/quartz/config/MarketingAsyncAutoConfiguration.java new file mode 100644 index 0000000..977afd2 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-job/src/main/java/com/platform/marketing/framework/quartz/config/MarketingAsyncAutoConfiguration.java @@ -0,0 +1,36 @@ +package com.platform.marketing.framework.quartz.config; + +import com.alibaba.ttl.TtlRunnable; +import org.springframework.beans.BeansException; +import org.springframework.beans.factory.config.BeanPostProcessor; +import org.springframework.boot.autoconfigure.AutoConfiguration; +import org.springframework.context.annotation.Bean; +import org.springframework.scheduling.annotation.EnableAsync; +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; + +/** + * 异步任务 Configuration + */ +@AutoConfiguration +@EnableAsync +public class MarketingAsyncAutoConfiguration { + + @Bean + public BeanPostProcessor threadPoolTaskExecutorBeanPostProcessor() { + return new BeanPostProcessor() { + + @Override + public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException { + if (!(bean instanceof ThreadPoolTaskExecutor)) { + return bean; + } + // 修改提交的任务,接入 TransmittableThreadLocal + ThreadPoolTaskExecutor executor = (ThreadPoolTaskExecutor) bean; + executor.setTaskDecorator(TtlRunnable::get); + return executor; + } + + }; + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-job/src/main/java/com/platform/marketing/framework/quartz/config/MarketingQuartzAutoConfiguration.java b/marketing-framework/marketing-spring-boot-starter-job/src/main/java/com/platform/marketing/framework/quartz/config/MarketingQuartzAutoConfiguration.java new file mode 100644 index 0000000..8d8b7c1 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-job/src/main/java/com/platform/marketing/framework/quartz/config/MarketingQuartzAutoConfiguration.java @@ -0,0 +1,29 @@ +package com.platform.marketing.framework.quartz.config; + +import com.platform.marketing.framework.quartz.core.scheduler.SchedulerManager; +import lombok.extern.slf4j.Slf4j; +import org.quartz.Scheduler; +import org.springframework.boot.autoconfigure.AutoConfiguration; +import org.springframework.context.annotation.Bean; +import org.springframework.scheduling.annotation.EnableScheduling; + +import java.util.Optional; + +/** + * 定时任务 Configuration + */ +@AutoConfiguration +@EnableScheduling // 开启 Spring 自带的定时任务 +@Slf4j +public class MarketingQuartzAutoConfiguration { + + @Bean + public SchedulerManager schedulerManager(Optional scheduler) { + if (!scheduler.isPresent()) { + log.warn("[定时任务 - 已禁用]"); + return new SchedulerManager(null); + } + return new SchedulerManager(scheduler.get()); + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-job/src/main/java/com/platform/marketing/framework/quartz/core/enums/JobDataKeyEnum.java b/marketing-framework/marketing-spring-boot-starter-job/src/main/java/com/platform/marketing/framework/quartz/core/enums/JobDataKeyEnum.java new file mode 100644 index 0000000..c2f4dd9 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-job/src/main/java/com/platform/marketing/framework/quartz/core/enums/JobDataKeyEnum.java @@ -0,0 +1,14 @@ +package com.platform.marketing.framework.quartz.core.enums; + +/** + * Quartz Job Data 的 key 枚举 + */ +public enum JobDataKeyEnum { + + JOB_ID, + JOB_HANDLER_NAME, + JOB_HANDLER_PARAM, + JOB_RETRY_COUNT, // 最大重试次数 + JOB_RETRY_INTERVAL, // 每次重试间隔 + +} diff --git a/marketing-framework/marketing-spring-boot-starter-job/src/main/java/com/platform/marketing/framework/quartz/core/handler/JobHandler.java b/marketing-framework/marketing-spring-boot-starter-job/src/main/java/com/platform/marketing/framework/quartz/core/handler/JobHandler.java new file mode 100644 index 0000000..5ebb7c6 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-job/src/main/java/com/platform/marketing/framework/quartz/core/handler/JobHandler.java @@ -0,0 +1,19 @@ +package com.platform.marketing.framework.quartz.core.handler; + +/** + * 任务处理器 + * + + */ +public interface JobHandler { + + /** + * 执行任务 + * + * @param param 参数 + * @return 结果 + * @throws Exception 异常 + */ + String execute(String param) throws Exception; + +} diff --git a/marketing-framework/marketing-spring-boot-starter-job/src/main/java/com/platform/marketing/framework/quartz/core/handler/JobHandlerInvoker.java b/marketing-framework/marketing-spring-boot-starter-job/src/main/java/com/platform/marketing/framework/quartz/core/handler/JobHandlerInvoker.java new file mode 100644 index 0000000..3174222 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-job/src/main/java/com/platform/marketing/framework/quartz/core/handler/JobHandlerInvoker.java @@ -0,0 +1,114 @@ +package com.platform.marketing.framework.quartz.core.handler; + +import cn.hutool.core.date.LocalDateTimeUtil; +import cn.hutool.core.lang.Assert; +import cn.hutool.core.thread.ThreadUtil; +import com.platform.marketing.framework.quartz.core.enums.JobDataKeyEnum; +import com.platform.marketing.framework.quartz.core.service.JobLogFrameworkService; +import lombok.extern.slf4j.Slf4j; +import org.quartz.DisallowConcurrentExecution; +import org.quartz.JobExecutionContext; +import org.quartz.JobExecutionException; +import org.quartz.PersistJobDataAfterExecution; +import org.springframework.context.ApplicationContext; +import org.springframework.scheduling.quartz.QuartzJobBean; + +import javax.annotation.Resource; +import java.time.LocalDateTime; +import java.time.temporal.ChronoUnit; + +import static cn.hutool.core.exceptions.ExceptionUtil.getRootCauseMessage; + +/** + * 基础 Job 调用者,负责调用 {@link JobHandler#execute(String)} 执行任务 + * + + */ +@DisallowConcurrentExecution +@PersistJobDataAfterExecution +@Slf4j +public class JobHandlerInvoker extends QuartzJobBean { + + @Resource + private ApplicationContext applicationContext; + + @Resource + private JobLogFrameworkService jobLogFrameworkService; + + @Override + protected void executeInternal(JobExecutionContext executionContext) throws JobExecutionException { + // 第一步,获得 Job 数据 + Long jobId = executionContext.getMergedJobDataMap().getLong(JobDataKeyEnum.JOB_ID.name()); + String jobHandlerName = executionContext.getMergedJobDataMap().getString(JobDataKeyEnum.JOB_HANDLER_NAME.name()); + String jobHandlerParam = executionContext.getMergedJobDataMap().getString(JobDataKeyEnum.JOB_HANDLER_PARAM.name()); + int refireCount = executionContext.getRefireCount(); + int retryCount = (Integer) executionContext.getMergedJobDataMap().getOrDefault(JobDataKeyEnum.JOB_RETRY_COUNT.name(), 0); + int retryInterval = (Integer) executionContext.getMergedJobDataMap().getOrDefault(JobDataKeyEnum.JOB_RETRY_INTERVAL.name(), 0); + + // 第二步,执行任务 + Long jobLogId = null; + LocalDateTime startTime = LocalDateTime.now(); + String data = null; + Throwable exception = null; + try { + // 记录 Job 日志(初始) + jobLogId = jobLogFrameworkService.createJobLog(jobId, startTime, jobHandlerName, jobHandlerParam, refireCount + 1); + // 执行任务 + data = this.executeInternal(jobHandlerName, jobHandlerParam); + } catch (Throwable ex) { + exception = ex; + } + + // 第三步,记录执行日志 + this.updateJobLogResultAsync(jobLogId, startTime, data, exception, executionContext); + + // 第四步,处理有异常的情况 + handleException(exception, refireCount, retryCount, retryInterval); + } + + private String executeInternal(String jobHandlerName, String jobHandlerParam) throws Exception { + // 获得 JobHandler 对象 + JobHandler jobHandler = applicationContext.getBean(jobHandlerName, JobHandler.class); + Assert.notNull(jobHandler, "JobHandler 不会为空"); + // 执行任务 + return jobHandler.execute(jobHandlerParam); + } + + private void updateJobLogResultAsync(Long jobLogId, LocalDateTime startTime, String data, Throwable exception, + JobExecutionContext executionContext) { + LocalDateTime endTime = LocalDateTime.now(); + // 处理是否成功 + boolean success = exception == null; + if (!success) { + data = getRootCauseMessage(exception); + } + // 更新日志 + try { + jobLogFrameworkService.updateJobLogResultAsync(jobLogId, endTime, (int) LocalDateTimeUtil.between(startTime, endTime).toMillis(), success, data); + } catch (Exception ex) { + log.error("[executeInternal][Job({}) logId({}) 记录执行日志失败({}/{})]", + executionContext.getJobDetail().getKey(), jobLogId, success, data); + } + } + + private void handleException(Throwable exception, + int refireCount, int retryCount, int retryInterval) throws JobExecutionException { + // 如果有异常,则进行重试 + if (exception == null) { + return; + } + // 情况一:如果到达重试上限,则直接抛出异常即可 + if (refireCount >= retryCount) { + throw new JobExecutionException(exception); + } + + // 情况二:如果未到达重试上限,则 sleep 一定间隔时间,然后重试 + // 这里使用 sleep 来实现,主要还是希望实现比较简单。因为,同一时间,不会存在大量失败的 Job。 + if (retryInterval > 0) { + ThreadUtil.sleep(retryInterval); + } + // 第二个参数,refireImmediately = true,表示立即重试 + throw new JobExecutionException(exception, true); + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-job/src/main/java/com/platform/marketing/framework/quartz/core/scheduler/SchedulerManager.java b/marketing-framework/marketing-spring-boot-starter-job/src/main/java/com/platform/marketing/framework/quartz/core/scheduler/SchedulerManager.java new file mode 100644 index 0000000..ae0dfd9 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-job/src/main/java/com/platform/marketing/framework/quartz/core/scheduler/SchedulerManager.java @@ -0,0 +1,150 @@ +package com.platform.marketing.framework.quartz.core.scheduler; + +import com.platform.marketing.framework.quartz.core.enums.JobDataKeyEnum; +import com.platform.marketing.framework.quartz.core.handler.JobHandlerInvoker; +import org.quartz.*; + +import static com.platform.marketing.framework.common.exception.enums.GlobalErrorCodeConstants.NOT_IMPLEMENTED; +import static com.platform.marketing.framework.common.exception.util.ServiceExceptionUtil.exception0; + +/** + * {@link org.quartz.Scheduler} 的管理器,负责创建任务 + * + * 考虑到实现的简洁性,我们使用 jobHandlerName 作为唯一标识,即: + * 1. Job 的 {@link JobDetail#getKey()} + * 2. Trigger 的 {@link Trigger#getKey()} + * + * 另外,jobHandlerName 对应到 Spring Bean 的名字,直接调用 + * + + */ +public class SchedulerManager { + + private final Scheduler scheduler; + + public SchedulerManager(Scheduler scheduler) { + this.scheduler = scheduler; + } + + /** + * 添加 Job 到 Quartz 中 + * + * @param jobId 任务编号 + * @param jobHandlerName 任务处理器的名字 + * @param jobHandlerParam 任务处理器的参数 + * @param cronExpression CRON 表达式 + * @param retryCount 重试次数 + * @param retryInterval 重试间隔 + * @throws SchedulerException 添加异常 + */ + public void addJob(Long jobId, String jobHandlerName, String jobHandlerParam, String cronExpression, + Integer retryCount, Integer retryInterval) + throws SchedulerException { + validateScheduler(); + // 创建 JobDetail 对象 + JobDetail jobDetail = JobBuilder.newJob(JobHandlerInvoker.class) + .usingJobData(JobDataKeyEnum.JOB_ID.name(), jobId) + .usingJobData(JobDataKeyEnum.JOB_HANDLER_NAME.name(), jobHandlerName) + .withIdentity(jobHandlerName).build(); + // 创建 Trigger 对象 + Trigger trigger = this.buildTrigger(jobHandlerName, jobHandlerParam, cronExpression, retryCount, retryInterval); + // 新增 Job 调度 + scheduler.scheduleJob(jobDetail, trigger); + } + + /** + * 更新 Job 到 Quartz + * + * @param jobHandlerName 任务处理器的名字 + * @param jobHandlerParam 任务处理器的参数 + * @param cronExpression CRON 表达式 + * @param retryCount 重试次数 + * @param retryInterval 重试间隔 + * @throws SchedulerException 更新异常 + */ + public void updateJob(String jobHandlerName, String jobHandlerParam, String cronExpression, + Integer retryCount, Integer retryInterval) + throws SchedulerException { + validateScheduler(); + // 创建新 Trigger 对象 + Trigger newTrigger = this.buildTrigger(jobHandlerName, jobHandlerParam, cronExpression, retryCount, retryInterval); + // 修改调度 + scheduler.rescheduleJob(new TriggerKey(jobHandlerName), newTrigger); + } + + /** + * 删除 Quartz 中的 Job + * + * @param jobHandlerName 任务处理器的名字 + * @throws SchedulerException 删除异常 + */ + public void deleteJob(String jobHandlerName) throws SchedulerException { + validateScheduler(); + // 暂停 Trigger 对象 + scheduler.pauseTrigger(new TriggerKey(jobHandlerName)); + // 取消并删除 Job 调度 + scheduler.unscheduleJob(new TriggerKey(jobHandlerName)); + scheduler.deleteJob(new JobKey(jobHandlerName)); + } + + /** + * 暂停 Quartz 中的 Job + * + * @param jobHandlerName 任务处理器的名字 + * @throws SchedulerException 暂停异常 + */ + public void pauseJob(String jobHandlerName) throws SchedulerException { + validateScheduler(); + scheduler.pauseJob(new JobKey(jobHandlerName)); + } + + /** + * 启动 Quartz 中的 Job + * + * @param jobHandlerName 任务处理器的名字 + * @throws SchedulerException 启动异常 + */ + public void resumeJob(String jobHandlerName) throws SchedulerException { + validateScheduler(); + scheduler.resumeJob(new JobKey(jobHandlerName)); + scheduler.resumeTrigger(new TriggerKey(jobHandlerName)); + } + + /** + * 立即触发一次 Quartz 中的 Job + * + * @param jobId 任务编号 + * @param jobHandlerName 任务处理器的名字 + * @param jobHandlerParam 任务处理器的参数 + * @throws SchedulerException 触发异常 + */ + public void triggerJob(Long jobId, String jobHandlerName, String jobHandlerParam) + throws SchedulerException { + validateScheduler(); + // 触发任务 + JobDataMap data = new JobDataMap(); // 无需重试,所以不设置 retryCount 和 retryInterval + data.put(JobDataKeyEnum.JOB_ID.name(), jobId); + data.put(JobDataKeyEnum.JOB_HANDLER_NAME.name(), jobHandlerName); + data.put(JobDataKeyEnum.JOB_HANDLER_PARAM.name(), jobHandlerParam); + scheduler.triggerJob(new JobKey(jobHandlerName), data); + } + + private Trigger buildTrigger(String jobHandlerName, String jobHandlerParam, String cronExpression, + Integer retryCount, Integer retryInterval) { + return TriggerBuilder.newTrigger() + .withIdentity(jobHandlerName) + .withSchedule(CronScheduleBuilder.cronSchedule(cronExpression)) + .usingJobData(JobDataKeyEnum.JOB_HANDLER_PARAM.name(), jobHandlerParam) + .usingJobData(JobDataKeyEnum.JOB_RETRY_COUNT.name(), retryCount) + .usingJobData(JobDataKeyEnum.JOB_RETRY_INTERVAL.name(), retryInterval) + .build(); + } + + private void validateScheduler() { + if (scheduler == null) { + throw exception0(NOT_IMPLEMENTED.getCode(), + "[定时任务 - 已禁用]"); + } + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-job/src/main/java/com/platform/marketing/framework/quartz/core/service/JobLogFrameworkService.java b/marketing-framework/marketing-spring-boot-starter-job/src/main/java/com/platform/marketing/framework/quartz/core/service/JobLogFrameworkService.java new file mode 100644 index 0000000..d8334bc --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-job/src/main/java/com/platform/marketing/framework/quartz/core/service/JobLogFrameworkService.java @@ -0,0 +1,43 @@ +package com.platform.marketing.framework.quartz.core.service; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import java.time.LocalDateTime; + +/** + * Job 日志 Framework Service 接口 + * + + */ +public interface JobLogFrameworkService { + + /** + * 创建 Job 日志 + * + * @param jobId 任务编号 + * @param beginTime 开始时间 + * @param jobHandlerName Job 处理器的名字 + * @param jobHandlerParam Job 处理器的参数 + * @param executeIndex 第几次执行 + * @return Job 日志的编号 + */ + Long createJobLog(@NotNull(message = "任务编号不能为空") Long jobId, + @NotNull(message = "开始时间") LocalDateTime beginTime, + @NotEmpty(message = "Job 处理器的名字不能为空") String jobHandlerName, + String jobHandlerParam, + @NotNull(message = "第几次执行不能为空") Integer executeIndex); + + /** + * 更新 Job 日志的执行结果 + * + * @param logId 日志编号 + * @param endTime 结束时间。因为是异步,避免记录时间不准去 + * @param duration 运行时长,单位:毫秒 + * @param success 是否成功 + * @param result 成功数据 + */ + void updateJobLogResultAsync(@NotNull(message = "日志编号不能为空") Long logId, + @NotNull(message = "结束时间不能为空") LocalDateTime endTime, + @NotNull(message = "运行时长不能为空") Integer duration, + boolean success, String result); +} diff --git a/marketing-framework/marketing-spring-boot-starter-job/src/main/java/com/platform/marketing/framework/quartz/core/util/CronUtils.java b/marketing-framework/marketing-spring-boot-starter-job/src/main/java/com/platform/marketing/framework/quartz/core/util/CronUtils.java new file mode 100644 index 0000000..819dd77 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-job/src/main/java/com/platform/marketing/framework/quartz/core/util/CronUtils.java @@ -0,0 +1,60 @@ +package com.platform.marketing.framework.quartz.core.util; + +import cn.hutool.core.date.LocalDateTimeUtil; +import org.quartz.CronExpression; + +import java.text.ParseException; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +/** + * Quartz Cron 表达式的工具类 + * + + */ +public class CronUtils { + + /** + * 校验 CRON 表达式是否有效 + * + * @param cronExpression CRON 表达式 + * @return 是否有效 + */ + public static boolean isValid(String cronExpression) { + return CronExpression.isValidExpression(cronExpression); + } + + /** + * 基于 CRON 表达式,获得下 n 个满足执行的时间 + * + * @param cronExpression CRON 表达式 + * @param n 数量 + * @return 满足条件的执行时间 + */ + public static List getNextTimes(String cronExpression, int n) { + // 1. 获得 CronExpression 对象 + CronExpression cron; + try { + cron = new CronExpression(cronExpression); + } catch (ParseException e) { + throw new IllegalArgumentException(e.getMessage()); + } + // 2. 从当前开始计算,n 个满足条件的 + Date now = new Date(); + List nextTimes = new ArrayList<>(n); + for (int i = 0; i < n; i++) { + Date nextTime = cron.getNextValidTimeAfter(now); + // 2.1 如果 nextTime 为 null,说明没有更多的有效时间,退出循环 + if (nextTime == null) { + break; + } + nextTimes.add(LocalDateTimeUtil.of(nextTime)); + // 2.2 切换现在,为下一个触发时间; + now = nextTime; + } + return nextTimes; + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-job/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/marketing-framework/marketing-spring-boot-starter-job/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 0000000..0641e68 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-job/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1,2 @@ +com.platform.marketing.framework.quartz.config.MarketingQuartzAutoConfiguration +com.platform.marketing.framework.quartz.config.MarketingAsyncAutoConfiguration \ No newline at end of file diff --git a/marketing-framework/marketing-spring-boot-starter-mq/.flattened-pom.xml b/marketing-framework/marketing-spring-boot-starter-mq/.flattened-pom.xml new file mode 100644 index 0000000..4f407f6 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-mq/.flattened-pom.xml @@ -0,0 +1,68 @@ + + + 4.0.0 + com.platform + marketing-spring-boot-starter-mq + 0.0.1-jdk8-SNAPSHOT + marketing-spring-boot-starter-mq + 消息队列,支持 Redis、RocketMQ、RabbitMQ、Kafka 四种 + https://github.com/makemyownlife/platform-sms-pro + + + com.platform + marketing-spring-boot-starter-redis + 0.0.1-jdk8-SNAPSHOT + compile + + + org.springframework.kafka + spring-kafka + 2.8.11 + compile + true + + + org.springframework.amqp + spring-rabbit + 2.4.17 + compile + true + + + org.apache.rocketmq + rocketmq-spring-boot-starter + 2.3.2 + compile + true + + + + + huaweicloud + huawei + https://mirrors.huaweicloud.com/repository/maven/ + + + aliyunmaven + aliyun + https://maven.aliyun.com/repository/public + + + + false + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + + + false + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + + diff --git a/marketing-framework/marketing-spring-boot-starter-mq/pom.xml b/marketing-framework/marketing-spring-boot-starter-mq/pom.xml new file mode 100644 index 0000000..7f6c5c3 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-mq/pom.xml @@ -0,0 +1,43 @@ + + + + com.platform + marketing-framework + ${revision} + + 4.0.0 + marketing-spring-boot-starter-mq + jar + + ${project.artifactId} + 消息队列,支持 Redis、RocketMQ、RabbitMQ、Kafka 四种 + https://github.com/makemyownlife/platform-sms-pro + + + + + com.platform + marketing-spring-boot-starter-redis + + + + + org.springframework.kafka + spring-kafka + true + + + org.springframework.amqp + spring-rabbit + true + + + org.apache.rocketmq + rocketmq-spring-boot-starter + true + + + + \ No newline at end of file diff --git a/marketing-framework/marketing-spring-boot-starter-mq/src/main/java/com/platform/marketing/framework/mq/rabbitmq/config/MarketingRabbitMQAutoConfiguration.java b/marketing-framework/marketing-spring-boot-starter-mq/src/main/java/com/platform/marketing/framework/mq/rabbitmq/config/MarketingRabbitMQAutoConfiguration.java new file mode 100644 index 0000000..6f4b890 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-mq/src/main/java/com/platform/marketing/framework/mq/rabbitmq/config/MarketingRabbitMQAutoConfiguration.java @@ -0,0 +1,28 @@ +package com.platform.marketing.framework.mq.rabbitmq.config; + +import lombok.extern.slf4j.Slf4j; +import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter; +import org.springframework.amqp.support.converter.MessageConverter; +import org.springframework.boot.autoconfigure.AutoConfiguration; +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.context.annotation.Bean; + +/** + * RabbitMQ 消息队列配置类 + * + + */ +@AutoConfiguration +@Slf4j +@ConditionalOnClass(name = "org.springframework.amqp.rabbit.core.RabbitTemplate") +public class MarketingRabbitMQAutoConfiguration { + + /** + * Jackson2JsonMessageConverter Bean:使用 jackson 序列化消息 + */ + @Bean + public MessageConverter createMessageConverter() { + return new Jackson2JsonMessageConverter(); + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-mq/src/main/java/com/platform/marketing/framework/mq/rabbitmq/core/package-info.java b/marketing-framework/marketing-spring-boot-starter-mq/src/main/java/com/platform/marketing/framework/mq/rabbitmq/core/package-info.java new file mode 100644 index 0000000..d987f60 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-mq/src/main/java/com/platform/marketing/framework/mq/rabbitmq/core/package-info.java @@ -0,0 +1,4 @@ +/** + * 占位符,无特殊逻辑 + */ +package com.platform.marketing.framework.mq.rabbitmq.core; \ No newline at end of file diff --git a/marketing-framework/marketing-spring-boot-starter-mq/src/main/java/com/platform/marketing/framework/mq/rabbitmq/package-info.java b/marketing-framework/marketing-spring-boot-starter-mq/src/main/java/com/platform/marketing/framework/mq/rabbitmq/package-info.java new file mode 100644 index 0000000..787b3e3 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-mq/src/main/java/com/platform/marketing/framework/mq/rabbitmq/package-info.java @@ -0,0 +1,4 @@ +/** + * 消息队列,基于 RabbitMQ 提供 + */ +package com.platform.marketing.framework.mq.rabbitmq; diff --git a/marketing-framework/marketing-spring-boot-starter-mq/src/main/java/com/platform/marketing/framework/mq/redis/config/MarketingRedisMQConsumerAutoConfiguration.java b/marketing-framework/marketing-spring-boot-starter-mq/src/main/java/com/platform/marketing/framework/mq/redis/config/MarketingRedisMQConsumerAutoConfiguration.java new file mode 100644 index 0000000..4083e61 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-mq/src/main/java/com/platform/marketing/framework/mq/redis/config/MarketingRedisMQConsumerAutoConfiguration.java @@ -0,0 +1,149 @@ +package com.platform.marketing.framework.mq.redis.config; + +import cn.hutool.core.map.MapUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.system.SystemUtil; +import com.platform.marketing.framework.mq.redis.core.RedisMQTemplate; +import com.platform.marketing.framework.mq.redis.core.job.RedisPendingMessageResendJob; +import com.platform.marketing.framework.mq.redis.core.pubsub.AbstractRedisChannelMessageListener; +import com.platform.marketing.framework.mq.redis.core.stream.AbstractRedisStreamMessageListener; +import com.platform.marketing.framework.redis.config.MarketingRedisAutoConfiguration; +import lombok.extern.slf4j.Slf4j; +import org.redisson.api.RedissonClient; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.autoconfigure.AutoConfiguration; +import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; +import org.springframework.context.annotation.Bean; +import org.springframework.data.redis.connection.RedisServerCommands; +import org.springframework.data.redis.connection.stream.Consumer; +import org.springframework.data.redis.connection.stream.ObjectRecord; +import org.springframework.data.redis.connection.stream.ReadOffset; +import org.springframework.data.redis.connection.stream.StreamOffset; +import org.springframework.data.redis.core.RedisCallback; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.data.redis.listener.ChannelTopic; +import org.springframework.data.redis.listener.RedisMessageListenerContainer; +import org.springframework.data.redis.stream.StreamMessageListenerContainer; +import org.springframework.scheduling.annotation.EnableScheduling; + +import java.util.List; +import java.util.Properties; + +/** + * Redis 消息队列 Consumer 配置类 + * + + */ +@Slf4j +@EnableScheduling // 启用定时任务,用于 RedisPendingMessageResendJob 重发消息 +@AutoConfiguration(after = MarketingRedisAutoConfiguration.class) +public class MarketingRedisMQConsumerAutoConfiguration { + + /** + * 创建 Redis Pub/Sub 广播消费的容器 + */ + @Bean + @ConditionalOnBean(AbstractRedisChannelMessageListener.class) // 只有 AbstractChannelMessageListener 存在的时候,才需要注册 Redis pubsub 监听 + public RedisMessageListenerContainer redisMessageListenerContainer( + RedisMQTemplate redisMQTemplate, List> listeners) { + // 创建 RedisMessageListenerContainer 对象 + RedisMessageListenerContainer container = new RedisMessageListenerContainer(); + // 设置 RedisConnection 工厂。 + container.setConnectionFactory(redisMQTemplate.getRedisTemplate().getRequiredConnectionFactory()); + // 添加监听器 + listeners.forEach(listener -> { + listener.setRedisMQTemplate(redisMQTemplate); + container.addMessageListener(listener, new ChannelTopic(listener.getChannel())); + log.info("[redisMessageListenerContainer][注册 Channel({}) 对应的监听器({})]", + listener.getChannel(), listener.getClass().getName()); + }); + return container; + } + + /** + * 创建 Redis Stream 重新消费的任务 + */ + @Bean + @ConditionalOnBean(AbstractRedisStreamMessageListener.class) // 只有 AbstractStreamMessageListener 存在的时候,才需要注册 Redis pubsub 监听 + public RedisPendingMessageResendJob redisPendingMessageResendJob(List> listeners, + RedisMQTemplate redisTemplate, + @Value("${spring.application.name}") String groupName, + RedissonClient redissonClient) { + return new RedisPendingMessageResendJob(listeners, redisTemplate, groupName, redissonClient); + } + + /** + * 创建 Redis Stream 集群消费的容器 + * + * 基础知识:Redis Stream 的 xreadgroup 命令 + */ + @Bean(initMethod = "start", destroyMethod = "stop") + @ConditionalOnBean(AbstractRedisStreamMessageListener.class) // 只有 AbstractStreamMessageListener 存在的时候,才需要注册 Redis pubsub 监听 + public StreamMessageListenerContainer> redisStreamMessageListenerContainer( + RedisMQTemplate redisMQTemplate, List> listeners) { + RedisTemplate redisTemplate = redisMQTemplate.getRedisTemplate(); + checkRedisVersion(redisTemplate); + // 第一步,创建 StreamMessageListenerContainer 容器 + // 创建 options 配置 + StreamMessageListenerContainer.StreamMessageListenerContainerOptions> containerOptions = + StreamMessageListenerContainer.StreamMessageListenerContainerOptions.builder() + .batchSize(10) // 一次性最多拉取多少条消息 + .targetType(String.class) // 目标类型。统一使用 String,通过自己封装的 AbstractStreamMessageListener 去反序列化 + .build(); + // 创建 container 对象 + StreamMessageListenerContainer> container = + StreamMessageListenerContainer.create(redisMQTemplate.getRedisTemplate().getRequiredConnectionFactory(), containerOptions); + + // 第二步,注册监听器,消费对应的 Stream 主题 + String consumerName = buildConsumerName(); + listeners.parallelStream().forEach(listener -> { + log.info("[redisStreamMessageListenerContainer][开始注册 StreamKey({}) 对应的监听器({})]", + listener.getStreamKey(), listener.getClass().getName()); + // 创建 listener 对应的消费者分组 + try { + redisTemplate.opsForStream().createGroup(listener.getStreamKey(), listener.getGroup()); + } catch (Exception ignore) { + } + // 设置 listener 对应的 redisTemplate + listener.setRedisMQTemplate(redisMQTemplate); + // 创建 Consumer 对象 + Consumer consumer = Consumer.from(listener.getGroup(), consumerName); + // 设置 Consumer 消费进度,以最小消费进度为准 + StreamOffset streamOffset = StreamOffset.create(listener.getStreamKey(), ReadOffset.lastConsumed()); + // 设置 Consumer 监听 + StreamMessageListenerContainer.StreamReadRequestBuilder builder = StreamMessageListenerContainer.StreamReadRequest + .builder(streamOffset).consumer(consumer) + .autoAcknowledge(false) // 不自动 ack + .cancelOnError(throwable -> false); // 默认配置,发生异常就取消消费,显然不符合预期;因此,我们设置为 false + container.register(builder.build(), listener); + log.info("[redisStreamMessageListenerContainer][完成注册 StreamKey({}) 对应的监听器({})]", + listener.getStreamKey(), listener.getClass().getName()); + }); + return container; + } + + /** + * 构建消费者名字,使用本地 IP + 进程编号的方式。 + * 参考自 RocketMQ clientId 的实现 + * + * @return 消费者名字 + */ + private static String buildConsumerName() { + return String.format("%s@%d", SystemUtil.getHostInfo().getAddress(), SystemUtil.getCurrentPID()); + } + + /** + * 校验 Redis 版本号,是否满足最低的版本号要求! + */ + private static void checkRedisVersion(RedisTemplate redisTemplate) { + // 获得 Redis 版本 + Properties info = redisTemplate.execute((RedisCallback) RedisServerCommands::info); + String version = MapUtil.getStr(info, "redis_version"); + // 校验最低版本必须大于等于 5.0.0 + int majorVersion = Integer.parseInt(StrUtil.subBefore(version, '.', false)); + if (majorVersion < 5) { + throw new IllegalStateException(StrUtil.format("您当前的 Redis 版本为 {},小于最低要求的 5.0.0 版本!", version)); + } + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-mq/src/main/java/com/platform/marketing/framework/mq/redis/config/MarketingRedisMQProducerAutoConfiguration.java b/marketing-framework/marketing-spring-boot-starter-mq/src/main/java/com/platform/marketing/framework/mq/redis/config/MarketingRedisMQProducerAutoConfiguration.java new file mode 100644 index 0000000..b7a4951 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-mq/src/main/java/com/platform/marketing/framework/mq/redis/config/MarketingRedisMQProducerAutoConfiguration.java @@ -0,0 +1,31 @@ +package com.platform.marketing.framework.mq.redis.config; + +import com.platform.marketing.framework.mq.redis.core.RedisMQTemplate; +import com.platform.marketing.framework.mq.redis.core.interceptor.RedisMessageInterceptor; +import com.platform.marketing.framework.redis.config.MarketingRedisAutoConfiguration; +import lombok.extern.slf4j.Slf4j; +import org.springframework.boot.autoconfigure.AutoConfiguration; +import org.springframework.context.annotation.Bean; +import org.springframework.data.redis.core.StringRedisTemplate; + +import java.util.List; + +/** + * Redis 消息队列 Producer 配置类 + * + + */ +@Slf4j +@AutoConfiguration(after = MarketingRedisAutoConfiguration.class) +public class MarketingRedisMQProducerAutoConfiguration { + + @Bean + public RedisMQTemplate redisMQTemplate(StringRedisTemplate redisTemplate, + List interceptors) { + RedisMQTemplate redisMQTemplate = new RedisMQTemplate(redisTemplate); + // 添加拦截器 + interceptors.forEach(redisMQTemplate::addInterceptor); + return redisMQTemplate; + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-mq/src/main/java/com/platform/marketing/framework/mq/redis/core/RedisMQTemplate.java b/marketing-framework/marketing-spring-boot-starter-mq/src/main/java/com/platform/marketing/framework/mq/redis/core/RedisMQTemplate.java new file mode 100644 index 0000000..94b6791 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-mq/src/main/java/com/platform/marketing/framework/mq/redis/core/RedisMQTemplate.java @@ -0,0 +1,87 @@ +package com.platform.marketing.framework.mq.redis.core; + +import com.platform.marketing.framework.common.util.json.JsonUtils; +import com.platform.marketing.framework.mq.redis.core.interceptor.RedisMessageInterceptor; +import com.platform.marketing.framework.mq.redis.core.message.AbstractRedisMessage; +import com.platform.marketing.framework.mq.redis.core.pubsub.AbstractRedisChannelMessage; +import com.platform.marketing.framework.mq.redis.core.stream.AbstractRedisStreamMessage; +import lombok.AllArgsConstructor; +import lombok.Getter; +import org.springframework.data.redis.connection.stream.RecordId; +import org.springframework.data.redis.connection.stream.StreamRecords; +import org.springframework.data.redis.core.RedisTemplate; + +import java.util.ArrayList; +import java.util.List; + +/** + * Redis MQ 操作模板类 + * + + */ +@AllArgsConstructor +public class RedisMQTemplate { + + @Getter + private final RedisTemplate redisTemplate; + /** + * 拦截器数组 + */ + @Getter + private final List interceptors = new ArrayList<>(); + + /** + * 发送 Redis 消息,基于 Redis pub/sub 实现 + * + * @param message 消息 + */ + public void send(T message) { + try { + sendMessageBefore(message); + // 发送消息 + redisTemplate.convertAndSend(message.getChannel(), JsonUtils.toJsonString(message)); + } finally { + sendMessageAfter(message); + } + } + + /** + * 发送 Redis 消息,基于 Redis Stream 实现 + * + * @param message 消息 + * @return 消息记录的编号对象 + */ + public RecordId send(T message) { + try { + sendMessageBefore(message); + // 发送消息 + return redisTemplate.opsForStream().add(StreamRecords.newRecord() + .ofObject(JsonUtils.toJsonString(message)) // 设置内容 + .withStreamKey(message.getStreamKey())); // 设置 stream key + } finally { + sendMessageAfter(message); + } + } + + /** + * 添加拦截器 + * + * @param interceptor 拦截器 + */ + public void addInterceptor(RedisMessageInterceptor interceptor) { + interceptors.add(interceptor); + } + + private void sendMessageBefore(AbstractRedisMessage message) { + // 正序 + interceptors.forEach(interceptor -> interceptor.sendMessageBefore(message)); + } + + private void sendMessageAfter(AbstractRedisMessage message) { + // 倒序 + for (int i = interceptors.size() - 1; i >= 0; i--) { + interceptors.get(i).sendMessageAfter(message); + } + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-mq/src/main/java/com/platform/marketing/framework/mq/redis/core/interceptor/RedisMessageInterceptor.java b/marketing-framework/marketing-spring-boot-starter-mq/src/main/java/com/platform/marketing/framework/mq/redis/core/interceptor/RedisMessageInterceptor.java new file mode 100644 index 0000000..b80a3dc --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-mq/src/main/java/com/platform/marketing/framework/mq/redis/core/interceptor/RedisMessageInterceptor.java @@ -0,0 +1,26 @@ +package com.platform.marketing.framework.mq.redis.core.interceptor; + +import com.platform.marketing.framework.mq.redis.core.message.AbstractRedisMessage; + +/** + * {@link AbstractRedisMessage} 消息拦截器 + * 通过拦截器,作为插件机制,实现拓展。 + * 例如说,多租户场景下的 MQ 消息处理 + * + + */ +public interface RedisMessageInterceptor { + + default void sendMessageBefore(AbstractRedisMessage message) { + } + + default void sendMessageAfter(AbstractRedisMessage message) { + } + + default void consumeMessageBefore(AbstractRedisMessage message) { + } + + default void consumeMessageAfter(AbstractRedisMessage message) { + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-mq/src/main/java/com/platform/marketing/framework/mq/redis/core/job/RedisPendingMessageResendJob.java b/marketing-framework/marketing-spring-boot-starter-mq/src/main/java/com/platform/marketing/framework/mq/redis/core/job/RedisPendingMessageResendJob.java new file mode 100644 index 0000000..fe29313 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-mq/src/main/java/com/platform/marketing/framework/mq/redis/core/job/RedisPendingMessageResendJob.java @@ -0,0 +1,100 @@ +package com.platform.marketing.framework.mq.redis.core.job; + +import cn.hutool.core.collection.CollUtil; +import com.platform.marketing.framework.mq.redis.core.RedisMQTemplate; +import com.platform.marketing.framework.mq.redis.core.stream.AbstractRedisStreamMessageListener; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.redisson.api.RLock; +import org.redisson.api.RedissonClient; +import org.springframework.data.domain.Range; +import org.springframework.data.redis.connection.stream.*; +import org.springframework.data.redis.core.StreamOperations; +import org.springframework.scheduling.annotation.Scheduled; + +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * 这个任务用于处理,crash 之后的消费者未消费完的消息 + */ +@Slf4j +@AllArgsConstructor +public class RedisPendingMessageResendJob { + + private static final String LOCK_KEY = "redis:pending:msg:lock"; + + /** + * 消息超时时间,默认 5 分钟 + * + * 1. 超时的消息才会被重新投递 + * 2. 由于定时任务 1 分钟一次,消息超时后不会被立即重投,极端情况下消息5分钟过期后,再等 1 分钟才会被扫瞄到 + */ + private static final int EXPIRE_TIME = 5 * 60; + + private final List> listeners; + private final RedisMQTemplate redisTemplate; + private final String groupName; + private final RedissonClient redissonClient; + + /** + * 一分钟执行一次,这里选择每分钟的35秒执行,是为了避免整点任务过多的问题 + */ + @Scheduled(cron = "35 * * * * ?") + public void messageResend() { + RLock lock = redissonClient.getLock(LOCK_KEY); + // 尝试加锁 + if (lock.tryLock()) { + try { + execute(); + } catch (Exception ex) { + log.error("[messageResend][执行异常]", ex); + } finally { + lock.unlock(); + } + } + } + + /** + * 执行清理逻辑 + * + * @see 讨论 + */ + private void execute() { + StreamOperations ops = redisTemplate.getRedisTemplate().opsForStream(); + listeners.forEach(listener -> { + PendingMessagesSummary pendingMessagesSummary = Objects.requireNonNull(ops.pending(listener.getStreamKey(), groupName)); + // 每个消费者的 pending 队列消息数量 + Map pendingMessagesPerConsumer = pendingMessagesSummary.getPendingMessagesPerConsumer(); + pendingMessagesPerConsumer.forEach((consumerName, pendingMessageCount) -> { + log.info("[processPendingMessage][消费者({}) 消息数量({})]", consumerName, pendingMessageCount); + // 每个消费者的 pending消息的详情信息 + PendingMessages pendingMessages = ops.pending(listener.getStreamKey(), Consumer.from(groupName, consumerName), Range.unbounded(), pendingMessageCount); + if (pendingMessages.isEmpty()) { + return; + } + pendingMessages.forEach(pendingMessage -> { + // 获取消息上一次传递到 consumer 的时间, + long lastDelivery = pendingMessage.getElapsedTimeSinceLastDelivery().getSeconds(); + if (lastDelivery < EXPIRE_TIME){ + return; + } + // 获取指定 id 的消息体 + List> records = ops.range(listener.getStreamKey(), + Range.of(Range.Bound.inclusive(pendingMessage.getIdAsString()), Range.Bound.inclusive(pendingMessage.getIdAsString()))); + if (CollUtil.isEmpty(records)) { + return; + } + // 重新投递消息 + redisTemplate.getRedisTemplate().opsForStream().add(StreamRecords.newRecord() + .ofObject(records.get(0).getValue()) // 设置内容 + .withStreamKey(listener.getStreamKey())); + // ack 消息消费完成 + redisTemplate.getRedisTemplate().opsForStream().acknowledge(groupName, records.get(0)); + log.info("[processPendingMessage][消息({})重新投递成功]", records.get(0).getId()); + }); + }); + }); + } +} diff --git a/marketing-framework/marketing-spring-boot-starter-mq/src/main/java/com/platform/marketing/framework/mq/redis/core/message/AbstractRedisMessage.java b/marketing-framework/marketing-spring-boot-starter-mq/src/main/java/com/platform/marketing/framework/mq/redis/core/message/AbstractRedisMessage.java new file mode 100644 index 0000000..7f604ad --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-mq/src/main/java/com/platform/marketing/framework/mq/redis/core/message/AbstractRedisMessage.java @@ -0,0 +1,29 @@ +package com.platform.marketing.framework.mq.redis.core.message; + +import lombok.Data; + +import java.util.HashMap; +import java.util.Map; + +/** + * Redis 消息抽象基类 + * + + */ +@Data +public abstract class AbstractRedisMessage { + + /** + * 头 + */ + private Map headers = new HashMap<>(); + + public String getHeader(String key) { + return headers.get(key); + } + + public void addHeader(String key, String value) { + headers.put(key, value); + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-mq/src/main/java/com/platform/marketing/framework/mq/redis/core/pubsub/AbstractRedisChannelMessage.java b/marketing-framework/marketing-spring-boot-starter-mq/src/main/java/com/platform/marketing/framework/mq/redis/core/pubsub/AbstractRedisChannelMessage.java new file mode 100644 index 0000000..394b04b --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-mq/src/main/java/com/platform/marketing/framework/mq/redis/core/pubsub/AbstractRedisChannelMessage.java @@ -0,0 +1,23 @@ +package com.platform.marketing.framework.mq.redis.core.pubsub; + +import com.platform.marketing.framework.mq.redis.core.message.AbstractRedisMessage; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** + * Redis Channel Message 抽象类 + * + + */ +public abstract class AbstractRedisChannelMessage extends AbstractRedisMessage { + + /** + * 获得 Redis Channel,默认使用类名 + * + * @return Channel + */ + @JsonIgnore // 避免序列化。原因是,Redis 发布 Channel 消息的时候,已经会指定。 + public String getChannel() { + return getClass().getSimpleName(); + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-mq/src/main/java/com/platform/marketing/framework/mq/redis/core/pubsub/AbstractRedisChannelMessageListener.java b/marketing-framework/marketing-spring-boot-starter-mq/src/main/java/com/platform/marketing/framework/mq/redis/core/pubsub/AbstractRedisChannelMessageListener.java new file mode 100644 index 0000000..cf4bc5d --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-mq/src/main/java/com/platform/marketing/framework/mq/redis/core/pubsub/AbstractRedisChannelMessageListener.java @@ -0,0 +1,103 @@ +package com.platform.marketing.framework.mq.redis.core.pubsub; + +import cn.hutool.core.util.TypeUtil; +import com.platform.marketing.framework.common.util.json.JsonUtils; +import com.platform.marketing.framework.mq.redis.core.RedisMQTemplate; +import com.platform.marketing.framework.mq.redis.core.interceptor.RedisMessageInterceptor; +import com.platform.marketing.framework.mq.redis.core.message.AbstractRedisMessage; +import lombok.Setter; +import lombok.SneakyThrows; +import org.springframework.data.redis.connection.Message; +import org.springframework.data.redis.connection.MessageListener; + +import java.lang.reflect.Type; +import java.util.List; + +/** + * Redis Pub/Sub 监听器抽象类,用于实现广播消费 + * + * @param 消息类型。一定要填写噢,不然会报错 + * + + */ +public abstract class AbstractRedisChannelMessageListener implements MessageListener { + + /** + * 消息类型 + */ + private final Class messageType; + /** + * Redis Channel + */ + private final String channel; + /** + * RedisMQTemplate + */ + @Setter + private RedisMQTemplate redisMQTemplate; + + @SneakyThrows + protected AbstractRedisChannelMessageListener() { + this.messageType = getMessageClass(); + this.channel = messageType.getDeclaredConstructor().newInstance().getChannel(); + } + + /** + * 获得 Sub 订阅的 Redis Channel 通道 + * + * @return smschannel + */ + public final String getChannel() { + return channel; + } + + @Override + public final void onMessage(Message message, byte[] bytes) { + T messageObj = JsonUtils.parseObject(message.getBody(), messageType); + try { + consumeMessageBefore(messageObj); + // 消费消息 + this.onMessage(messageObj); + } finally { + consumeMessageAfter(messageObj); + } + } + + /** + * 处理消息 + * + * @param message 消息 + */ + public abstract void onMessage(T message); + + /** + * 通过解析类上的泛型,获得消息类型 + * + * @return 消息类型 + */ + @SuppressWarnings("unchecked") + private Class getMessageClass() { + Type type = TypeUtil.getTypeArgument(getClass(), 0); + if (type == null) { + throw new IllegalStateException(String.format("类型(%s) 需要设置消息类型", getClass().getName())); + } + return (Class) type; + } + + private void consumeMessageBefore(AbstractRedisMessage message) { + assert redisMQTemplate != null; + List interceptors = redisMQTemplate.getInterceptors(); + // 正序 + interceptors.forEach(interceptor -> interceptor.consumeMessageBefore(message)); + } + + private void consumeMessageAfter(AbstractRedisMessage message) { + assert redisMQTemplate != null; + List interceptors = redisMQTemplate.getInterceptors(); + // 倒序 + for (int i = interceptors.size() - 1; i >= 0; i--) { + interceptors.get(i).consumeMessageAfter(message); + } + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-mq/src/main/java/com/platform/marketing/framework/mq/redis/core/stream/AbstractRedisStreamMessage.java b/marketing-framework/marketing-spring-boot-starter-mq/src/main/java/com/platform/marketing/framework/mq/redis/core/stream/AbstractRedisStreamMessage.java new file mode 100644 index 0000000..dcfa5d4 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-mq/src/main/java/com/platform/marketing/framework/mq/redis/core/stream/AbstractRedisStreamMessage.java @@ -0,0 +1,23 @@ +package com.platform.marketing.framework.mq.redis.core.stream; + +import com.platform.marketing.framework.mq.redis.core.message.AbstractRedisMessage; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** + * Redis Stream Message 抽象类 + * + + */ +public abstract class AbstractRedisStreamMessage extends AbstractRedisMessage { + + /** + * 获得 Redis Stream Key,默认使用类名 + * + * @return Channel + */ + @JsonIgnore // 避免序列化 + public String getStreamKey() { + return getClass().getSimpleName(); + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-mq/src/main/java/com/platform/marketing/framework/mq/redis/core/stream/AbstractRedisStreamMessageListener.java b/marketing-framework/marketing-spring-boot-starter-mq/src/main/java/com/platform/marketing/framework/mq/redis/core/stream/AbstractRedisStreamMessageListener.java new file mode 100644 index 0000000..2f6ad87 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-mq/src/main/java/com/platform/marketing/framework/mq/redis/core/stream/AbstractRedisStreamMessageListener.java @@ -0,0 +1,113 @@ +package com.platform.marketing.framework.mq.redis.core.stream; + +import cn.hutool.core.util.TypeUtil; +import com.platform.marketing.framework.common.util.json.JsonUtils; +import com.platform.marketing.framework.mq.redis.core.RedisMQTemplate; +import com.platform.marketing.framework.mq.redis.core.interceptor.RedisMessageInterceptor; +import com.platform.marketing.framework.mq.redis.core.message.AbstractRedisMessage; +import lombok.Getter; +import lombok.Setter; +import lombok.SneakyThrows; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.data.redis.connection.stream.ObjectRecord; +import org.springframework.data.redis.stream.StreamListener; + +import java.lang.reflect.Type; +import java.util.List; + +/** + * Redis Stream 监听器抽象类,用于实现集群消费 + * + * @param 消息类型。一定要填写噢,不然会报错 + * + + */ +public abstract class AbstractRedisStreamMessageListener + implements StreamListener> { + + /** + * 消息类型 + */ + private final Class messageType; + /** + * Redis Channel + */ + @Getter + private final String streamKey; + + /** + * Redis 消费者分组,默认使用 spring.application.name 名字 + */ + @Value("${spring.application.name}") + @Getter + private String group; + /** + * RedisMQTemplate + */ + @Setter + private RedisMQTemplate redisMQTemplate; + + @SneakyThrows + protected AbstractRedisStreamMessageListener() { + this.messageType = getMessageClass(); + this.streamKey = messageType.getDeclaredConstructor().newInstance().getStreamKey(); + } + + @Override + public void onMessage(ObjectRecord message) { + // 消费消息 + T messageObj = JsonUtils.parseObject(message.getValue(), messageType); + try { + consumeMessageBefore(messageObj); + // 消费消息 + this.onMessage(messageObj); + // ack 消息消费完成 + redisMQTemplate.getRedisTemplate().opsForStream().acknowledge(group, message); + // TODO 芋艿:需要额外考虑以下几个点: + // 1. 处理异常的情况 + // 2. 发送日志;以及事务的结合 + // 3. 消费日志;以及通用的幂等性 + // 4. 消费失败的重试,https://zhuanlan.zhihu.com/p/60501638 + } finally { + consumeMessageAfter(messageObj); + } + } + + /** + * 处理消息 + * + * @param message 消息 + */ + public abstract void onMessage(T message); + + /** + * 通过解析类上的泛型,获得消息类型 + * + * @return 消息类型 + */ + @SuppressWarnings("unchecked") + private Class getMessageClass() { + Type type = TypeUtil.getTypeArgument(getClass(), 0); + if (type == null) { + throw new IllegalStateException(String.format("类型(%s) 需要设置消息类型", getClass().getName())); + } + return (Class) type; + } + + private void consumeMessageBefore(AbstractRedisMessage message) { + assert redisMQTemplate != null; + List interceptors = redisMQTemplate.getInterceptors(); + // 正序 + interceptors.forEach(interceptor -> interceptor.consumeMessageBefore(message)); + } + + private void consumeMessageAfter(AbstractRedisMessage message) { + assert redisMQTemplate != null; + List interceptors = redisMQTemplate.getInterceptors(); + // 倒序 + for (int i = interceptors.size() - 1; i >= 0; i--) { + interceptors.get(i).consumeMessageAfter(message); + } + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-mq/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/marketing-framework/marketing-spring-boot-starter-mq/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 0000000..bbfa903 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-mq/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1,3 @@ +com.platform.marketing.framework.mq.redis.config.MarketingRedisMQProducerAutoConfiguration +com.platform.marketing.framework.mq.redis.config.MarketingRedisMQConsumerAutoConfiguration +com.platform.marketing.framework.mq.rabbitmq.config.MarketingRabbitMQAutoConfiguration \ No newline at end of file diff --git a/marketing-framework/marketing-spring-boot-starter-mybatis/.flattened-pom.xml b/marketing-framework/marketing-spring-boot-starter-mybatis/.flattened-pom.xml new file mode 100644 index 0000000..72a1548 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-mybatis/.flattened-pom.xml @@ -0,0 +1,117 @@ + + + 4.0.0 + com.platform + marketing-spring-boot-starter-mybatis + 0.0.1-jdk8-SNAPSHOT + marketing-spring-boot-starter-mybatis + 数据库连接池、多数据源、事务、MyBatis 拓展 + https://github.com/makemyownlife/platform-sms-pro + + + com.platform + marketing-common + 0.0.1-jdk8-SNAPSHOT + compile + + + com.platform + marketing-spring-boot-starter-web + 0.0.1-jdk8-SNAPSHOT + provided + + + com.mysql + mysql-connector-j + 8.0.33 + compile + + + com.google.protobuf + protobuf-java + + + + + com.alibaba + druid-spring-boot-starter + 1.2.24 + compile + + + com.baomidou + mybatis-plus-boot-starter + 3.5.9 + compile + + + com.baomidou + mybatis-plus-jsqlparser-4.9 + 3.5.9 + compile + + + com.baomidou + dynamic-datasource-spring-boot-starter + 4.3.1 + compile + + + com.github.yulichang + mybatis-plus-join-boot-starter + 1.4.13 + compile + + + com.fhs-opensource + easy-trans-spring-boot-starter + 3.0.6 + compile + + + org.springframework + spring-context + + + org.springframework.cloud + spring-cloud-commons + + + + + com.fhs-opensource + easy-trans-mybatis-plus-extend + 3.0.6 + compile + + + + + huaweicloud + huawei + https://mirrors.huaweicloud.com/repository/maven/ + + + aliyunmaven + aliyun + https://maven.aliyun.com/repository/public + + + + false + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + + + false + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + + diff --git a/marketing-framework/marketing-spring-boot-starter-mybatis/pom.xml b/marketing-framework/marketing-spring-boot-starter-mybatis/pom.xml new file mode 100644 index 0000000..7f6ecf8 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-mybatis/pom.xml @@ -0,0 +1,107 @@ + + + + com.platform + marketing-framework + ${revision} + + 4.0.0 + marketing-spring-boot-starter-mybatis + jar + + ${project.artifactId} + 数据库连接池、多数据源、事务、MyBatis 拓展 + https://github.com/makemyownlife/platform-sms-pro + + + + com.platform + marketing-common + + + + + com.platform + marketing-spring-boot-starter-web + provided + + + + + com.mysql + mysql-connector-j + + + + + + com.alibaba + druid-spring-boot-starter + + + com.baomidou + mybatis-plus-boot-starter + + + com.baomidou + mybatis-plus-jsqlparser-4.9 + + + com.baomidou + dynamic-datasource-spring-boot-starter + + + + com.github.yulichang + mybatis-plus-join-boot-starter + + + + com.fhs-opensource + easy-trans-spring-boot-starter + + + com.fhs-opensource + easy-trans-mybatis-plus-extend + + + + diff --git a/marketing-framework/marketing-spring-boot-starter-mybatis/src/main/java/com/platform/marketing/framework/datasource/config/MarketingDataSourceAutoConfiguration.java b/marketing-framework/marketing-spring-boot-starter-mybatis/src/main/java/com/platform/marketing/framework/datasource/config/MarketingDataSourceAutoConfiguration.java new file mode 100644 index 0000000..bb50cbc --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-mybatis/src/main/java/com/platform/marketing/framework/datasource/config/MarketingDataSourceAutoConfiguration.java @@ -0,0 +1,40 @@ +package com.platform.marketing.framework.datasource.config; + +import com.platform.marketing.framework.datasource.core.filter.DruidAdRemoveFilter; +import com.alibaba.druid.spring.boot.autoconfigure.properties.DruidStatProperties; +import org.springframework.boot.autoconfigure.AutoConfiguration; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.boot.web.servlet.FilterRegistrationBean; +import org.springframework.context.annotation.Bean; +import org.springframework.transaction.annotation.EnableTransactionManagement; + +/** + * 数据库配置类 + * + + */ +@AutoConfiguration +@EnableTransactionManagement(proxyTargetClass = true) // 启动事务管理 +@EnableConfigurationProperties(DruidStatProperties.class) +public class MarketingDataSourceAutoConfiguration { + + /** + * 创建 DruidAdRemoveFilter 过滤器,过滤 common.js 的广告 + */ + @Bean + @ConditionalOnProperty(name = "spring.datasource.druid.stat-view-servlet.enabled", havingValue = "true") + public FilterRegistrationBean druidAdRemoveFilterFilter(DruidStatProperties properties) { + // 获取 druid web 监控页面的参数 + DruidStatProperties.StatViewServlet config = properties.getStatViewServlet(); + // 提取 common.js 的配置路径 + String pattern = config.getUrlPattern() != null ? config.getUrlPattern() : "/druid/*"; + String commonJsPattern = pattern.replaceAll("\\*", "js/common.js"); + // 创建 DruidAdRemoveFilter Bean + FilterRegistrationBean registrationBean = new FilterRegistrationBean<>(); + registrationBean.setFilter(new DruidAdRemoveFilter()); + registrationBean.addUrlPatterns(commonJsPattern); + return registrationBean; + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-mybatis/src/main/java/com/platform/marketing/framework/datasource/core/enums/DataSourceEnum.java b/marketing-framework/marketing-spring-boot-starter-mybatis/src/main/java/com/platform/marketing/framework/datasource/core/enums/DataSourceEnum.java new file mode 100644 index 0000000..9e9d0b3 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-mybatis/src/main/java/com/platform/marketing/framework/datasource/core/enums/DataSourceEnum.java @@ -0,0 +1,22 @@ +package com.platform.marketing.framework.datasource.core.enums; + +/** + * 对应于多数据源中不同数据源配置 + * + * 通过在方法上,使用 {@link com.baomidou.dynamic.datasource.annotation.DS} 注解,设置使用的数据源。 + * 注意,默认是 {@link #MASTER} 数据源 + * + * 对应官方文档为 http://dynamic-datasource.com/guide/customize/Annotation.html + */ +public interface DataSourceEnum { + + /** + * 主库,推荐使用 {@link com.baomidou.dynamic.datasource.annotation.Master} 注解 + */ + String MASTER = "master"; + /** + * 从库,推荐使用 {@link com.baomidou.dynamic.datasource.annotation.Slave} 注解 + */ + String SLAVE = "slave"; + +} diff --git a/marketing-framework/marketing-spring-boot-starter-mybatis/src/main/java/com/platform/marketing/framework/datasource/core/filter/DruidAdRemoveFilter.java b/marketing-framework/marketing-spring-boot-starter-mybatis/src/main/java/com/platform/marketing/framework/datasource/core/filter/DruidAdRemoveFilter.java new file mode 100644 index 0000000..93237d1 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-mybatis/src/main/java/com/platform/marketing/framework/datasource/core/filter/DruidAdRemoveFilter.java @@ -0,0 +1,38 @@ +package com.platform.marketing.framework.datasource.core.filter; + +import com.alibaba.druid.util.Utils; +import org.springframework.web.filter.OncePerRequestFilter; + +import javax.servlet.FilterChain; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +/** + * Druid 底部广告过滤器 + * + + */ +public class DruidAdRemoveFilter extends OncePerRequestFilter { + + /** + * common.js 的路径 + */ + private static final String COMMON_JS_ILE_PATH = "support/http/resources/js/common.js"; + + @Override + protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) + throws ServletException, IOException { + chain.doFilter(request, response); + // 重置缓冲区,响应头不会被重置 + response.resetBuffer(); + // 获取 common.js + String text = Utils.readFromResource(COMMON_JS_ILE_PATH); + // 正则替换 banner, 除去底部的广告信息 + text = text.replaceAll("
", ""); + text = text.replaceAll("powered.*?shrek.wang", ""); + response.getWriter().write(text); + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-mybatis/src/main/java/com/platform/marketing/framework/mybatis/config/IdTypeEnvironmentPostProcessor.java b/marketing-framework/marketing-spring-boot-starter-mybatis/src/main/java/com/platform/marketing/framework/mybatis/config/IdTypeEnvironmentPostProcessor.java new file mode 100644 index 0000000..4e1d66d --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-mybatis/src/main/java/com/platform/marketing/framework/mybatis/config/IdTypeEnvironmentPostProcessor.java @@ -0,0 +1,108 @@ +package com.platform.marketing.framework.mybatis.config; + +import cn.hutool.core.util.StrUtil; +import com.platform.marketing.framework.common.util.collection.SetUtils; +import com.platform.marketing.framework.mybatis.core.util.JdbcUtils; +import com.baomidou.mybatisplus.annotation.DbType; +import com.baomidou.mybatisplus.annotation.IdType; +import lombok.extern.slf4j.Slf4j; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.env.EnvironmentPostProcessor; +import org.springframework.core.env.ConfigurableEnvironment; + +import java.util.Set; + +/** + * 当 IdType 为 {@link IdType#NONE} 时,根据 PRIMARY 数据源所使用的数据库,自动设置 + * + + */ +@Slf4j +public class IdTypeEnvironmentPostProcessor implements EnvironmentPostProcessor { + + private static final String ID_TYPE_KEY = "mybatis-plus.global-config.db-config.id-type"; + + private static final String DATASOURCE_DYNAMIC_KEY = "spring.datasource.dynamic"; + + private static final String QUARTZ_JOB_STORE_DRIVER_KEY = "spring.quartz.properties.org.quartz.jobStore.driverDelegateClass"; + + private static final Set INPUT_ID_TYPES = SetUtils.asSet(DbType.ORACLE, DbType.ORACLE_12C, + DbType.POSTGRE_SQL, DbType.KINGBASE_ES, DbType.DB2, DbType.H2); + + @Override + public void postProcessEnvironment(ConfigurableEnvironment environment, SpringApplication application) { + // 如果获取不到 DbType,则不进行处理 + DbType dbType = getDbType(environment); + if (dbType == null) { + return; + } + + // 设置 Quartz JobStore 对应的 Driver + // TODO 芋艿:暂时没有找到特别合适的地方,先放在这里 + setJobStoreDriverIfPresent(environment, dbType); + + // 如果非 NONE,则不进行处理 + IdType idType = getIdType(environment); + if (idType != IdType.NONE) { + return; + } + // 情况一,用户输入 ID,适合 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库 + if (INPUT_ID_TYPES.contains(dbType)) { + setIdType(environment, IdType.INPUT); + return; + } + // 情况二,自增 ID,适合 MySQL、DM 达梦等直接自增的数据库 + setIdType(environment, IdType.AUTO); + } + + public IdType getIdType(ConfigurableEnvironment environment) { + return environment.getProperty(ID_TYPE_KEY, IdType.class); + } + + public void setIdType(ConfigurableEnvironment environment, IdType idType) { + environment.getSystemProperties().put(ID_TYPE_KEY, idType); + log.info("[setIdType][修改 MyBatis Plus 的 idType 为({})]", idType); + } + + public void setJobStoreDriverIfPresent(ConfigurableEnvironment environment, DbType dbType) { + String driverClass = environment.getProperty(QUARTZ_JOB_STORE_DRIVER_KEY); + if (StrUtil.isNotEmpty(driverClass)) { + return; + } + // 根据 dbType 类型,获取对应的 driverClass + switch (dbType) { + case POSTGRE_SQL: + driverClass = "org.quartz.impl.jdbcjobstore.PostgreSQLDelegate"; + break; + case ORACLE: + case ORACLE_12C: + driverClass = "org.quartz.impl.jdbcjobstore.oracle.OracleDelegate"; + break; + case SQL_SERVER: + case SQL_SERVER2005: + driverClass = "org.quartz.impl.jdbcjobstore.MSSQLDelegate"; + break; + case DM: + case KINGBASE_ES: + driverClass = "org.quartz.impl.jdbcjobstore.StdJDBCDelegate"; + break; + } + // 设置 driverClass 变量 + if (StrUtil.isNotEmpty(driverClass)) { + environment.getSystemProperties().put(QUARTZ_JOB_STORE_DRIVER_KEY, driverClass); + } + } + + public static DbType getDbType(ConfigurableEnvironment environment) { + String primary = environment.getProperty(DATASOURCE_DYNAMIC_KEY + "." + "primary"); + if (StrUtil.isEmpty(primary)) { + return null; + } + String url = environment.getProperty(DATASOURCE_DYNAMIC_KEY + ".datasource." + primary + ".url"); + if (StrUtil.isEmpty(url)) { + return null; + } + return JdbcUtils.getDbType(url); + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-mybatis/src/main/java/com/platform/marketing/framework/mybatis/config/MarketingMybatisAutoConfiguration.java b/marketing-framework/marketing-spring-boot-starter-mybatis/src/main/java/com/platform/marketing/framework/mybatis/config/MarketingMybatisAutoConfiguration.java new file mode 100644 index 0000000..877aba4 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-mybatis/src/main/java/com/platform/marketing/framework/mybatis/config/MarketingMybatisAutoConfiguration.java @@ -0,0 +1,76 @@ +package com.platform.marketing.framework.mybatis.config; + +import cn.hutool.core.util.StrUtil; +import com.platform.marketing.framework.mybatis.core.handler.DefaultDBFieldHandler; +import com.baomidou.mybatisplus.annotation.DbType; +import com.baomidou.mybatisplus.autoconfigure.MybatisPlusAutoConfiguration; +import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler; +import com.baomidou.mybatisplus.core.incrementer.IKeyGenerator; +import com.baomidou.mybatisplus.extension.incrementer.*; +import com.baomidou.mybatisplus.extension.parser.JsqlParserGlobal; +import com.baomidou.mybatisplus.extension.parser.cache.JdkSerialCaffeineJsqlParseCache; +import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; +import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; +import org.apache.ibatis.annotations.Mapper; +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.boot.autoconfigure.AutoConfiguration; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.context.annotation.Bean; +import org.springframework.core.env.ConfigurableEnvironment; + +import java.util.concurrent.TimeUnit; + +/** + * MyBaits 配置类 + * + + */ +@AutoConfiguration(before = MybatisPlusAutoConfiguration.class) // 目的:先于 MyBatis Plus 自动配置,避免 @MapperScan 可能扫描不到 Mapper 打印 warn 日志 +@MapperScan(value = "${marketing.info.base-package}", annotationClass = Mapper.class, + lazyInitialization = "${mybatis.lazy-initialization:false}") // Mapper 懒加载,目前仅用于单元测试 +public class MarketingMybatisAutoConfiguration { + + static { + // 动态 SQL 智能优化支持本地缓存加速解析,更完善的租户复杂 XML 动态 SQL 支持,静态注入缓存 + JsqlParserGlobal.setJsqlParseCache(new JdkSerialCaffeineJsqlParseCache( + (cache) -> cache.maximumSize(1024) + .expireAfterWrite(5, TimeUnit.SECONDS)) + ); + } + + @Bean + public MybatisPlusInterceptor mybatisPlusInterceptor() { + MybatisPlusInterceptor mybatisPlusInterceptor = new MybatisPlusInterceptor(); + mybatisPlusInterceptor.addInnerInterceptor(new PaginationInnerInterceptor()); // 分页插件 + return mybatisPlusInterceptor; + } + + @Bean + public MetaObjectHandler defaultMetaObjectHandler() { + return new DefaultDBFieldHandler(); // 自动填充参数类 + } + + @Bean + @ConditionalOnProperty(prefix = "mybatis-plus.global-config.db-config", name = "id-type", havingValue = "INPUT") + public IKeyGenerator keyGenerator(ConfigurableEnvironment environment) { + DbType dbType = IdTypeEnvironmentPostProcessor.getDbType(environment); + if (dbType != null) { + switch (dbType) { + case POSTGRE_SQL: + return new PostgreKeyGenerator(); + case ORACLE: + case ORACLE_12C: + return new OracleKeyGenerator(); + case H2: + return new H2KeyGenerator(); + case KINGBASE_ES: + return new KingbaseKeyGenerator(); + case DM: + return new DmKeyGenerator(); + } + } + // 找不到合适的 IKeyGenerator 实现类 + throw new IllegalArgumentException(StrUtil.format("DbType{} 找不到合适的 IKeyGenerator 实现类", dbType)); + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-mybatis/src/main/java/com/platform/marketing/framework/mybatis/core/dataobject/BaseDO.java b/marketing-framework/marketing-spring-boot-starter-mybatis/src/main/java/com/platform/marketing/framework/mybatis/core/dataobject/BaseDO.java new file mode 100644 index 0000000..a7e1e00 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-mybatis/src/main/java/com/platform/marketing/framework/mybatis/core/dataobject/BaseDO.java @@ -0,0 +1,55 @@ +package com.platform.marketing.framework.mybatis.core.dataobject; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableLogic; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fhs.core.trans.vo.TransPojo; +import lombok.Data; +import org.apache.ibatis.type.JdbcType; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + * 基础实体对象 + * + * 为什么实现 {@link TransPojo} 接口? + * 因为使用 Easy-Trans TransType.SIMPLE 模式,集成 MyBatis Plus 查询 + * + */ +@Data +@JsonIgnoreProperties(value = "transMap") // 由于 Easy-Trans 会添加 transMap 属性,避免 Jackson 在 Spring Cache 反序列化报错 +public abstract class BaseDO implements Serializable, TransPojo { + + /** + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + /** + * 最后更新时间 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; + /** + * 创建者,目前使用 SysUser 的 id 编号 + * + * 使用 String 类型的原因是,未来可能会存在非数值的情况,留好拓展性。 + */ + @TableField(fill = FieldFill.INSERT, jdbcType = JdbcType.VARCHAR) + private String creator; + /** + * 更新者,目前使用 SysUser 的 id 编号 + * + * 使用 String 类型的原因是,未来可能会存在非数值的情况,留好拓展性。 + */ + @TableField(fill = FieldFill.INSERT_UPDATE, jdbcType = JdbcType.VARCHAR) + private String updater; + /** + * 是否删除 + */ + @TableLogic + private Boolean deleted; + +} diff --git a/marketing-framework/marketing-spring-boot-starter-mybatis/src/main/java/com/platform/marketing/framework/mybatis/core/enums/DbTypeEnum.java b/marketing-framework/marketing-spring-boot-starter-mybatis/src/main/java/com/platform/marketing/framework/mybatis/core/enums/DbTypeEnum.java new file mode 100644 index 0000000..3107e61 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-mybatis/src/main/java/com/platform/marketing/framework/mybatis/core/enums/DbTypeEnum.java @@ -0,0 +1,95 @@ +package com.platform.marketing.framework.mybatis.core.enums; + +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.annotation.DbType; +import lombok.AllArgsConstructor; +import lombok.Getter; + +import java.util.Arrays; +import java.util.Map; +import java.util.Optional; +import java.util.function.Function; +import java.util.stream.Collectors; + +/** + * 针对 MyBatis Plus 的 {@link DbType} 增强,补充更多信息 + */ +@Getter +@AllArgsConstructor +public enum DbTypeEnum { + + /** + * H2 + * + * 注意:H2 不支持 find_in_set 函数 + */ + H2(DbType.H2, "H2", ""), + + /** + * MySQL + */ + MY_SQL(DbType.MYSQL, "MySQL", "FIND_IN_SET('#{value}', #{column}) <> 0"), + + /** + * Oracle + */ + ORACLE(DbType.ORACLE, "Oracle", "FIND_IN_SET('#{value}', #{column}) <> 0"), + + /** + * PostgreSQL + * + * 华为 openGauss 使用 ProductName 与 PostgreSQL 相同 + */ + POSTGRE_SQL(DbType.POSTGRE_SQL,"PostgreSQL", "POSITION('#{value}' IN #{column}) <> 0"), + + /** + * SQL Server + */ + SQL_SERVER(DbType.SQL_SERVER, "Microsoft SQL Server", "CHARINDEX(',' + #{value} + ',', ',' + #{column} + ',') <> 0"), + /** + * SQL Server 2005 + */ + SQL_SERVER2005(DbType.SQL_SERVER2005, "Microsoft SQL Server 2005", "CHARINDEX(',' + #{value} + ',', ',' + #{column} + ',') <> 0"), + + /** + * 达梦 + */ + DM(DbType.DM, "DM DBMS", "FIND_IN_SET('#{value}', #{column}) <> 0"), + + /** + * 人大金仓 + */ + KINGBASE_ES(DbType.KINGBASE_ES, "KingbaseES", "POSITION('#{value}' IN #{column}) <> 0"), + ; + + public static final Map MAP_BY_NAME = Arrays.stream(values()) + .collect(Collectors.toMap(DbTypeEnum::getProductName, Function.identity())); + + public static final Map MAP_BY_MP = Arrays.stream(values()) + .collect(Collectors.toMap(DbTypeEnum::getMpDbType, Function.identity())); + + /** + * MyBatis Plus 类型 + */ + private final DbType mpDbType; + /** + * 数据库产品名 + */ + private final String productName; + /** + * SQL FIND_IN_SET 模板 + */ + private final String findInSetTemplate; + + public static DbType find(String databaseProductName) { + if (StrUtil.isBlank(databaseProductName)) { + return null; + } + return MAP_BY_NAME.get(databaseProductName).getMpDbType(); + } + + public static String getFindInSetTemplate(DbType dbType) { + return Optional.of(MAP_BY_MP.get(dbType).getFindInSetTemplate()) + .orElseThrow(() -> new IllegalArgumentException("FIND_IN_SET not supported")); + } +} diff --git a/marketing-framework/marketing-spring-boot-starter-mybatis/src/main/java/com/platform/marketing/framework/mybatis/core/handler/DefaultDBFieldHandler.java b/marketing-framework/marketing-spring-boot-starter-mybatis/src/main/java/com/platform/marketing/framework/mybatis/core/handler/DefaultDBFieldHandler.java new file mode 100644 index 0000000..cea5996 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-mybatis/src/main/java/com/platform/marketing/framework/mybatis/core/handler/DefaultDBFieldHandler.java @@ -0,0 +1,62 @@ +package com.platform.marketing.framework.mybatis.core.handler; + +import com.platform.marketing.framework.mybatis.core.dataobject.BaseDO; +import com.platform.marketing.framework.web.core.util.WebFrameworkUtils; +import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler; +import org.apache.ibatis.reflection.MetaObject; + +import java.time.LocalDateTime; +import java.util.Objects; + +/** + * 通用参数填充实现类 + * + * 如果没有显式的对通用参数进行赋值,这里会对通用参数进行填充、赋值 + * + * @author hexiaowu + */ +public class DefaultDBFieldHandler implements MetaObjectHandler { + + @Override + public void insertFill(MetaObject metaObject) { + if (Objects.nonNull(metaObject) && metaObject.getOriginalObject() instanceof BaseDO) { + BaseDO baseDO = (BaseDO) metaObject.getOriginalObject(); + + LocalDateTime current = LocalDateTime.now(); + // 创建时间为空,则以当前时间为插入时间 + if (Objects.isNull(baseDO.getCreateTime())) { + baseDO.setCreateTime(current); + } + // 更新时间为空,则以当前时间为更新时间 + if (Objects.isNull(baseDO.getUpdateTime())) { + baseDO.setUpdateTime(current); + } + + Long userId = WebFrameworkUtils.getLoginUserId(); + // 当前登录用户不为空,创建人为空,则当前登录用户为创建人 + if (Objects.nonNull(userId) && Objects.isNull(baseDO.getCreator())) { + baseDO.setCreator(userId.toString()); + } + // 当前登录用户不为空,更新人为空,则当前登录用户为更新人 + if (Objects.nonNull(userId) && Objects.isNull(baseDO.getUpdater())) { + baseDO.setUpdater(userId.toString()); + } + } + } + + @Override + public void updateFill(MetaObject metaObject) { + // 更新时间为空,则以当前时间为更新时间 + Object modifyTime = getFieldValByName("updateTime", metaObject); + if (Objects.isNull(modifyTime)) { + setFieldValByName("updateTime", LocalDateTime.now(), metaObject); + } + + // 当前登录用户不为空,更新人为空,则当前登录用户为更新人 + Object modifier = getFieldValByName("updater", metaObject); + Long userId = WebFrameworkUtils.getLoginUserId(); + if (Objects.nonNull(userId) && Objects.isNull(modifier)) { + setFieldValByName("updater", userId.toString(), metaObject); + } + } +} diff --git a/marketing-framework/marketing-spring-boot-starter-mybatis/src/main/java/com/platform/marketing/framework/mybatis/core/mapper/BaseMapperX.java b/marketing-framework/marketing-spring-boot-starter-mybatis/src/main/java/com/platform/marketing/framework/mybatis/core/mapper/BaseMapperX.java new file mode 100644 index 0000000..220aba4 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-mybatis/src/main/java/com/platform/marketing/framework/mybatis/core/mapper/BaseMapperX.java @@ -0,0 +1,218 @@ +package com.platform.marketing.framework.mybatis.core.mapper; + +import cn.hutool.core.collection.CollUtil; +import com.platform.marketing.framework.common.pojo.PageParam; +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.common.pojo.SortablePageParam; +import com.platform.marketing.framework.common.pojo.SortingField; +import com.platform.marketing.framework.mybatis.core.util.JdbcUtils; +import com.platform.marketing.framework.mybatis.core.util.MyBatisUtils; +import com.baomidou.mybatisplus.annotation.DbType; +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.support.SFunction; +import com.baomidou.mybatisplus.extension.toolkit.Db; +import com.github.yulichang.base.MPJBaseMapper; +import com.github.yulichang.interfaces.MPJBaseJoin; +import com.github.yulichang.wrapper.MPJLambdaWrapper; +import org.apache.ibatis.annotations.Param; + +import java.util.Collection; +import java.util.List; + +/** + * 在 MyBatis Plus 的 BaseMapper 的基础上拓展,提供更多的能力 + * + * 1. {@link BaseMapper} 为 MyBatis Plus 的基础接口,提供基础的 CRUD 能力 + * 2. {@link MPJBaseMapper} 为 MyBatis Plus Join 的基础接口,提供连表 Join 能力 + */ +public interface BaseMapperX extends MPJBaseMapper { + + default PageResult selectPage(SortablePageParam pageParam, @Param("ew") Wrapper queryWrapper) { + return selectPage(pageParam, pageParam.getSortingFields(), queryWrapper); + } + + default PageResult selectPage(PageParam pageParam, @Param("ew") Wrapper queryWrapper) { + return selectPage(pageParam, null, queryWrapper); + } + + default PageResult selectPage(PageParam pageParam, Collection sortingFields, @Param("ew") Wrapper queryWrapper) { + // 特殊:不分页,直接查询全部 + if (PageParam.PAGE_SIZE_NONE.equals(pageParam.getPageSize())) { + List list = selectList(queryWrapper); + return new PageResult<>(list, (long) list.size()); + } + + // MyBatis Plus 查询 + IPage mpPage = MyBatisUtils.buildPage(pageParam, sortingFields); + selectPage(mpPage, queryWrapper); + // 转换返回 + return new PageResult<>(mpPage.getRecords(), mpPage.getTotal()); + } + + default PageResult selectJoinPage(PageParam pageParam, Class clazz, MPJLambdaWrapper lambdaWrapper) { + // 特殊:不分页,直接查询全部 + if (PageParam.PAGE_SIZE_NONE.equals(pageParam.getPageSize())) { + List list = selectJoinList(clazz, lambdaWrapper); + return new PageResult<>(list, (long) list.size()); + } + + // MyBatis Plus Join 查询 + IPage mpPage = MyBatisUtils.buildPage(pageParam); + mpPage = selectJoinPage(mpPage, clazz, lambdaWrapper); + // 转换返回 + return new PageResult<>(mpPage.getRecords(), mpPage.getTotal()); + } + + default PageResult selectJoinPage(PageParam pageParam, Class resultTypeClass, MPJBaseJoin joinQueryWrapper) { + IPage mpPage = MyBatisUtils.buildPage(pageParam); + selectJoinPage(mpPage, resultTypeClass, joinQueryWrapper); + // 转换返回 + return new PageResult<>(mpPage.getRecords(), mpPage.getTotal()); + } + + default T selectOne(String field, Object value) { + return selectOne(new QueryWrapper().eq(field, value)); + } + + default T selectOne(SFunction field, Object value) { + return selectOne(new LambdaQueryWrapper().eq(field, value)); + } + + default T selectOne(String field1, Object value1, String field2, Object value2) { + return selectOne(new QueryWrapper().eq(field1, value1).eq(field2, value2)); + } + + default T selectOne(SFunction field1, Object value1, SFunction field2, Object value2) { + return selectOne(new LambdaQueryWrapper().eq(field1, value1).eq(field2, value2)); + } + + default T selectOne(SFunction field1, Object value1, SFunction field2, Object value2, + SFunction field3, Object value3) { + return selectOne(new LambdaQueryWrapper().eq(field1, value1).eq(field2, value2).eq(field3, value3)); + } + + /** + * 获取满足条件的第 1 条记录 + * + * 目的:解决并发场景下,插入多条记录后,使用 selectOne 会报错的问题 + * + * @param field 字段名 + * @param value 字段值 + * @return 实体 + */ + default T selectFirstOne(SFunction field, Object value) { + // 如果明确使用 MySQL 等场景,可以考虑使用 LIMIT 1 进行优化 + List list = selectList(new LambdaQueryWrapper().eq(field, value)); + return CollUtil.getFirst(list); + } + + default T selectFirstOne(SFunction field1, Object value1, SFunction field2, Object value2) { + List list = selectList(new LambdaQueryWrapper().eq(field1, value1).eq(field2, value2)); + return CollUtil.getFirst(list); + } + + default T selectFirstOne(SFunction field1, Object value1, SFunction field2, Object value2, + SFunction field3, Object value3) { + List list = selectList(new LambdaQueryWrapper().eq(field1, value1).eq(field2, value2).eq(field3, value3)); + return CollUtil.getFirst(list); + } + + + default Long selectCount() { + return selectCount(new QueryWrapper<>()); + } + + default Long selectCount(String field, Object value) { + return selectCount(new QueryWrapper().eq(field, value)); + } + + default Long selectCount(SFunction field, Object value) { + return selectCount(new LambdaQueryWrapper().eq(field, value)); + } + + default List selectList() { + return selectList(new QueryWrapper<>()); + } + + default List selectList(String field, Object value) { + return selectList(new QueryWrapper().eq(field, value)); + } + + default List selectList(SFunction field, Object value) { + return selectList(new LambdaQueryWrapper().eq(field, value)); + } + + default List selectList(String field, Collection values) { + if (CollUtil.isEmpty(values)) { + return CollUtil.newArrayList(); + } + return selectList(new QueryWrapper().in(field, values)); + } + + default List selectList(SFunction field, Collection values) { + if (CollUtil.isEmpty(values)) { + return CollUtil.newArrayList(); + } + return selectList(new LambdaQueryWrapper().in(field, values)); + } + + default List selectList(SFunction field1, Object value1, SFunction field2, Object value2) { + return selectList(new LambdaQueryWrapper().eq(field1, value1).eq(field2, value2)); + } + + /** + * 批量插入,适合大量数据插入 + * + * @param entities 实体们 + */ + default Boolean insertBatch(Collection entities) { + // 特殊:SQL Server 批量插入后,获取 id 会报错,因此通过循环处理 + DbType dbType = JdbcUtils.getDbType(); + if (JdbcUtils.isSQLServer(dbType)) { + entities.forEach(this::insert); + return CollUtil.isNotEmpty(entities); + } + return Db.saveBatch(entities); + } + + /** + * 批量插入,适合大量数据插入 + * + * @param entities 实体们 + * @param size 插入数量 Db.saveBatch 默认为 1000 + */ + default Boolean insertBatch(Collection entities, int size) { + // 特殊:SQL Server 批量插入后,获取 id 会报错,因此通过循环处理 + DbType dbType = JdbcUtils.getDbType(); + if (JdbcUtils.isSQLServer(dbType)) { + entities.forEach(this::insert); + return CollUtil.isNotEmpty(entities); + } + return Db.saveBatch(entities, size); + } + + default int updateBatch(T update) { + return update(update, new QueryWrapper<>()); + } + + default Boolean updateBatch(Collection entities) { + return Db.updateBatchById(entities); + } + + default Boolean updateBatch(Collection entities, int size) { + return Db.updateBatchById(entities, size); + } + + default int delete(String field, String value) { + return delete(new QueryWrapper().eq(field, value)); + } + + default int delete(SFunction field, Object value) { + return delete(new LambdaQueryWrapper().eq(field, value)); + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-mybatis/src/main/java/com/platform/marketing/framework/mybatis/core/query/LambdaQueryWrapperX.java b/marketing-framework/marketing-spring-boot-starter-mybatis/src/main/java/com/platform/marketing/framework/mybatis/core/query/LambdaQueryWrapperX.java new file mode 100644 index 0000000..030cb02 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-mybatis/src/main/java/com/platform/marketing/framework/mybatis/core/query/LambdaQueryWrapperX.java @@ -0,0 +1,135 @@ +package com.platform.marketing.framework.mybatis.core.query; + +import cn.hutool.core.util.ArrayUtil; +import cn.hutool.core.util.ObjectUtil; +import com.platform.marketing.framework.common.util.collection.ArrayUtils; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.support.SFunction; +import org.springframework.util.StringUtils; + +import java.util.Collection; + +/** + * 拓展 MyBatis Plus QueryWrapper 类,主要增加如下功能: + *

+ * 1. 拼接条件的方法,增加 xxxIfPresent 方法,用于判断值不存在的时候,不要拼接到条件中。 + * + * @param 数据类型 + */ +public class LambdaQueryWrapperX extends LambdaQueryWrapper { + + public LambdaQueryWrapperX likeIfPresent(SFunction column, String val) { + if (StringUtils.hasText(val)) { + return (LambdaQueryWrapperX) super.like(column, val); + } + return this; + } + + public LambdaQueryWrapperX inIfPresent(SFunction column, Collection values) { + if (ObjectUtil.isAllNotEmpty(values) && !ArrayUtil.isEmpty(values)) { + return (LambdaQueryWrapperX) super.in(column, values); + } + return this; + } + + public LambdaQueryWrapperX inIfPresent(SFunction column, Object... values) { + if (ObjectUtil.isAllNotEmpty(values) && !ArrayUtil.isEmpty(values)) { + return (LambdaQueryWrapperX) super.in(column, values); + } + return this; + } + + public LambdaQueryWrapperX eqIfPresent(SFunction column, Object val) { + if (ObjectUtil.isNotEmpty(val)) { + return (LambdaQueryWrapperX) super.eq(column, val); + } + return this; + } + + public LambdaQueryWrapperX neIfPresent(SFunction column, Object val) { + if (ObjectUtil.isNotEmpty(val)) { + return (LambdaQueryWrapperX) super.ne(column, val); + } + return this; + } + + public LambdaQueryWrapperX gtIfPresent(SFunction column, Object val) { + if (val != null) { + return (LambdaQueryWrapperX) super.gt(column, val); + } + return this; + } + + public LambdaQueryWrapperX geIfPresent(SFunction column, Object val) { + if (val != null) { + return (LambdaQueryWrapperX) super.ge(column, val); + } + return this; + } + + public LambdaQueryWrapperX ltIfPresent(SFunction column, Object val) { + if (val != null) { + return (LambdaQueryWrapperX) super.lt(column, val); + } + return this; + } + + public LambdaQueryWrapperX leIfPresent(SFunction column, Object val) { + if (val != null) { + return (LambdaQueryWrapperX) super.le(column, val); + } + return this; + } + + public LambdaQueryWrapperX betweenIfPresent(SFunction column, Object val1, Object val2) { + if (val1 != null && val2 != null) { + return (LambdaQueryWrapperX) super.between(column, val1, val2); + } + if (val1 != null) { + return (LambdaQueryWrapperX) ge(column, val1); + } + if (val2 != null) { + return (LambdaQueryWrapperX) le(column, val2); + } + return this; + } + + public LambdaQueryWrapperX betweenIfPresent(SFunction column, Object[] values) { + Object val1 = ArrayUtils.get(values, 0); + Object val2 = ArrayUtils.get(values, 1); + return betweenIfPresent(column, val1, val2); + } + + // ========== 重写父类方法,方便链式调用 ========== + + @Override + public LambdaQueryWrapperX eq(boolean condition, SFunction column, Object val) { + super.eq(condition, column, val); + return this; + } + + @Override + public LambdaQueryWrapperX eq(SFunction column, Object val) { + super.eq(column, val); + return this; + } + + @Override + public LambdaQueryWrapperX orderByDesc(SFunction column) { + super.orderByDesc(true, column); + return this; + } + + @Override + public LambdaQueryWrapperX last(String lastSql) { + super.last(lastSql); + return this; + } + + @Override + public LambdaQueryWrapperX in(SFunction column, Collection coll) { + super.in(column, coll); + return this; + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-mybatis/src/main/java/com/platform/marketing/framework/mybatis/core/query/MPJLambdaWrapperX.java b/marketing-framework/marketing-spring-boot-starter-mybatis/src/main/java/com/platform/marketing/framework/mybatis/core/query/MPJLambdaWrapperX.java new file mode 100644 index 0000000..f70e67a --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-mybatis/src/main/java/com/platform/marketing/framework/mybatis/core/query/MPJLambdaWrapperX.java @@ -0,0 +1,313 @@ +package com.platform.marketing.framework.mybatis.core.query; + +import cn.hutool.core.util.ArrayUtil; +import cn.hutool.core.util.ObjectUtil; +import com.platform.marketing.framework.common.util.collection.ArrayUtils; +import com.baomidou.mybatisplus.core.toolkit.support.SFunction; +import com.github.yulichang.toolkit.MPJWrappers; +import com.github.yulichang.wrapper.MPJLambdaWrapper; +import org.springframework.util.StringUtils; + +import java.util.Collection; +import java.util.function.Consumer; + +/** + * 拓展 MyBatis Plus Join QueryWrapper 类,主要增加如下功能: + *

+ * 1. 拼接条件的方法,增加 xxxIfPresent 方法,用于判断值不存在的时候,不要拼接到条件中。 + * + * @param 数据类型 + */ +public class MPJLambdaWrapperX extends MPJLambdaWrapper { + + public MPJLambdaWrapperX likeIfPresent(SFunction column, String val) { + MPJWrappers.lambdaJoin().like(column, val); + if (StringUtils.hasText(val)) { + return (MPJLambdaWrapperX) super.like(column, val); + } + return this; + } + + public MPJLambdaWrapperX inIfPresent(SFunction column, Collection values) { + if (ObjectUtil.isAllNotEmpty(values) && !ArrayUtil.isEmpty(values)) { + return (MPJLambdaWrapperX) super.in(column, values); + } + return this; + } + + public MPJLambdaWrapperX inIfPresent(SFunction column, Object... values) { + if (ObjectUtil.isAllNotEmpty(values) && !ArrayUtil.isEmpty(values)) { + return (MPJLambdaWrapperX) super.in(column, values); + } + return this; + } + + public MPJLambdaWrapperX eqIfPresent(SFunction column, Object val) { + if (ObjectUtil.isNotEmpty(val)) { + return (MPJLambdaWrapperX) super.eq(column, val); + } + return this; + } + + public MPJLambdaWrapperX neIfPresent(SFunction column, Object val) { + if (ObjectUtil.isNotEmpty(val)) { + return (MPJLambdaWrapperX) super.ne(column, val); + } + return this; + } + + public MPJLambdaWrapperX gtIfPresent(SFunction column, Object val) { + if (val != null) { + return (MPJLambdaWrapperX) super.gt(column, val); + } + return this; + } + + public MPJLambdaWrapperX geIfPresent(SFunction column, Object val) { + if (val != null) { + return (MPJLambdaWrapperX) super.ge(column, val); + } + return this; + } + + public MPJLambdaWrapperX ltIfPresent(SFunction column, Object val) { + if (val != null) { + return (MPJLambdaWrapperX) super.lt(column, val); + } + return this; + } + + public MPJLambdaWrapperX leIfPresent(SFunction column, Object val) { + if (val != null) { + return (MPJLambdaWrapperX) super.le(column, val); + } + return this; + } + + public MPJLambdaWrapperX betweenIfPresent(SFunction column, Object val1, Object val2) { + if (val1 != null && val2 != null) { + return (MPJLambdaWrapperX) super.between(column, val1, val2); + } + if (val1 != null) { + return (MPJLambdaWrapperX) ge(column, val1); + } + if (val2 != null) { + return (MPJLambdaWrapperX) le(column, val2); + } + return this; + } + + public MPJLambdaWrapperX betweenIfPresent(SFunction column, Object[] values) { + Object val1 = ArrayUtils.get(values, 0); + Object val2 = ArrayUtils.get(values, 1); + return betweenIfPresent(column, val1, val2); + } + + // ========== 重写父类方法,方便链式调用 ========== + + @Override + public MPJLambdaWrapperX eq(boolean condition, SFunction column, Object val) { + super.eq(condition, column, val); + return this; + } + + @Override + public MPJLambdaWrapperX eq(SFunction column, Object val) { + super.eq(column, val); + return this; + } + + @Override + public MPJLambdaWrapperX orderByDesc(SFunction column) { + //noinspection unchecked + super.orderByDesc(true, column); + return this; + } + + @Override + public MPJLambdaWrapperX last(String lastSql) { + super.last(lastSql); + return this; + } + + @Override + public MPJLambdaWrapperX in(SFunction column, Collection coll) { + super.in(column, coll); + return this; + } + + @Override + public MPJLambdaWrapperX selectAll(Class clazz) { + super.selectAll(clazz); + return this; + } + + @Override + public MPJLambdaWrapperX selectAll(Class clazz, String prefix) { + super.selectAll(clazz, prefix); + return this; + } + + @Override + public MPJLambdaWrapperX selectAs(SFunction column, String alias) { + super.selectAs(column, alias); + return this; + } + + @Override + public MPJLambdaWrapperX selectAs(String column, SFunction alias) { + super.selectAs(column, alias); + return this; + } + + @Override + public MPJLambdaWrapperX selectAs(SFunction column, SFunction alias) { + super.selectAs(column, alias); + return this; + } + + @Override + public MPJLambdaWrapperX selectAs(String index, SFunction column, SFunction alias) { + super.selectAs(index, column, alias); + return this; + } + + @Override + public MPJLambdaWrapperX selectAsClass(Class source, Class tag) { + super.selectAsClass(source, tag); + return this; + } + + @Override + public MPJLambdaWrapperX selectSub(Class clazz, Consumer> consumer, SFunction alias) { + super.selectSub(clazz, consumer, alias); + return this; + } + + @Override + public MPJLambdaWrapperX selectSub(Class clazz, String st, Consumer> consumer, SFunction alias) { + super.selectSub(clazz, st, consumer, alias); + return this; + } + + @Override + public MPJLambdaWrapperX selectCount(SFunction column) { + super.selectCount(column); + return this; + } + + @Override + public MPJLambdaWrapperX selectCount(Object column, String alias) { + super.selectCount(column, alias); + return this; + } + + @Override + public MPJLambdaWrapperX selectCount(Object column, SFunction alias) { + super.selectCount(column, alias); + return this; + } + + @Override + public MPJLambdaWrapperX selectCount(SFunction column, String alias) { + super.selectCount(column, alias); + return this; + } + + @Override + public MPJLambdaWrapperX selectCount(SFunction column, SFunction alias) { + super.selectCount(column, alias); + return this; + } + + @Override + public MPJLambdaWrapperX selectSum(SFunction column) { + super.selectSum(column); + return this; + } + + @Override + public MPJLambdaWrapperX selectSum(SFunction column, String alias) { + super.selectSum(column, alias); + return this; + } + + @Override + public MPJLambdaWrapperX selectSum(SFunction column, SFunction alias) { + super.selectSum(column, alias); + return this; + } + + @Override + public MPJLambdaWrapperX selectMax(SFunction column) { + super.selectMax(column); + return this; + } + + @Override + public MPJLambdaWrapperX selectMax(SFunction column, String alias) { + super.selectMax(column, alias); + return this; + } + + @Override + public MPJLambdaWrapperX selectMax(SFunction column, SFunction alias) { + super.selectMax(column, alias); + return this; + } + + @Override + public MPJLambdaWrapperX selectMin(SFunction column) { + super.selectMin(column); + return this; + } + + @Override + public MPJLambdaWrapperX selectMin(SFunction column, String alias) { + super.selectMin(column, alias); + return this; + } + + @Override + public MPJLambdaWrapperX selectMin(SFunction column, SFunction alias) { + super.selectMin(column, alias); + return this; + } + + @Override + public MPJLambdaWrapperX selectAvg(SFunction column) { + super.selectAvg(column); + return this; + } + + @Override + public MPJLambdaWrapperX selectAvg(SFunction column, String alias) { + super.selectAvg(column, alias); + return this; + } + + @Override + public MPJLambdaWrapperX selectAvg(SFunction column, SFunction alias) { + super.selectAvg(column, alias); + return this; + } + + @Override + public MPJLambdaWrapperX selectLen(SFunction column) { + super.selectLen(column); + return this; + } + + @Override + public MPJLambdaWrapperX selectLen(SFunction column, String alias) { + super.selectLen(column, alias); + return this; + } + + @Override + public MPJLambdaWrapperX selectLen(SFunction column, SFunction alias) { + super.selectLen(column, alias); + return this; + } + +} \ No newline at end of file diff --git a/marketing-framework/marketing-spring-boot-starter-mybatis/src/main/java/com/platform/marketing/framework/mybatis/core/query/QueryWrapperX.java b/marketing-framework/marketing-spring-boot-starter-mybatis/src/main/java/com/platform/marketing/framework/mybatis/core/query/QueryWrapperX.java new file mode 100644 index 0000000..233140b --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-mybatis/src/main/java/com/platform/marketing/framework/mybatis/core/query/QueryWrapperX.java @@ -0,0 +1,166 @@ +package com.platform.marketing.framework.mybatis.core.query; + +import com.platform.marketing.framework.mybatis.core.util.JdbcUtils; +import com.baomidou.mybatisplus.annotation.DbType; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.ArrayUtils; +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; +import org.springframework.util.StringUtils; + +import java.util.Collection; + +/** + * 拓展 MyBatis Plus QueryWrapper 类,主要增加如下功能: + * + * 1. 拼接条件的方法,增加 xxxIfPresent 方法,用于判断值不存在的时候,不要拼接到条件中。 + * + * @param 数据类型 + */ +public class QueryWrapperX extends QueryWrapper { + + public QueryWrapperX likeIfPresent(String column, String val) { + if (StringUtils.hasText(val)) { + return (QueryWrapperX) super.like(column, val); + } + return this; + } + + public QueryWrapperX inIfPresent(String column, Collection values) { + if (!CollectionUtils.isEmpty(values)) { + return (QueryWrapperX) super.in(column, values); + } + return this; + } + + public QueryWrapperX inIfPresent(String column, Object... values) { + if (!ArrayUtils.isEmpty(values)) { + return (QueryWrapperX) super.in(column, values); + } + return this; + } + + public QueryWrapperX eqIfPresent(String column, Object val) { + if (val != null) { + return (QueryWrapperX) super.eq(column, val); + } + return this; + } + + public QueryWrapperX neIfPresent(String column, Object val) { + if (val != null) { + return (QueryWrapperX) super.ne(column, val); + } + return this; + } + + public QueryWrapperX gtIfPresent(String column, Object val) { + if (val != null) { + return (QueryWrapperX) super.gt(column, val); + } + return this; + } + + public QueryWrapperX geIfPresent(String column, Object val) { + if (val != null) { + return (QueryWrapperX) super.ge(column, val); + } + return this; + } + + public QueryWrapperX ltIfPresent(String column, Object val) { + if (val != null) { + return (QueryWrapperX) super.lt(column, val); + } + return this; + } + + public QueryWrapperX leIfPresent(String column, Object val) { + if (val != null) { + return (QueryWrapperX) super.le(column, val); + } + return this; + } + + public QueryWrapperX betweenIfPresent(String column, Object val1, Object val2) { + if (val1 != null && val2 != null) { + return (QueryWrapperX) super.between(column, val1, val2); + } + if (val1 != null) { + return (QueryWrapperX) ge(column, val1); + } + if (val2 != null) { + return (QueryWrapperX) le(column, val2); + } + return this; + } + + public QueryWrapperX betweenIfPresent(String column, Object[] values) { + if (values!= null && values.length != 0 && values[0] != null && values[1] != null) { + return (QueryWrapperX) super.between(column, values[0], values[1]); + } + if (values!= null && values.length != 0 && values[0] != null) { + return (QueryWrapperX) ge(column, values[0]); + } + if (values!= null && values.length != 0 && values[1] != null) { + return (QueryWrapperX) le(column, values[1]); + } + return this; + } + + // ========== 重写父类方法,方便链式调用 ========== + + @Override + public QueryWrapperX eq(boolean condition, String column, Object val) { + super.eq(condition, column, val); + return this; + } + + @Override + public QueryWrapperX eq(String column, Object val) { + super.eq(column, val); + return this; + } + + @Override + public QueryWrapperX orderByDesc(String column) { + super.orderByDesc(true, column); + return this; + } + + @Override + public QueryWrapperX last(String lastSql) { + super.last(lastSql); + return this; + } + + @Override + public QueryWrapperX in(String column, Collection coll) { + super.in(column, coll); + return this; + } + + /** + * 设置只返回最后一条 + * + * TODO 芋艿:不是完美解,需要在思考下。如果使用多数据源,并且数据源是多种类型时,可能会存在问题:实现之返回一条的语法不同 + * + * @return this + */ + public QueryWrapperX limitN(int n) { + DbType dbType = JdbcUtils.getDbType(); + switch (dbType) { + case ORACLE: + case ORACLE_12C: + super.le("ROWNUM", n); + break; + case SQL_SERVER: + case SQL_SERVER2005: + super.select("TOP " + n + " *"); // 由于 SQL Server 是通过 SELECT TOP 1 实现限制一条,所以只好使用 * 查询剩余字段 + break; + default: // MySQL、PostgreSQL、DM 达梦、KingbaseES 大金都是采用 LIMIT 实现 + super.last("LIMIT " + n); + } + return this; + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-mybatis/src/main/java/com/platform/marketing/framework/mybatis/core/type/EncryptTypeHandler.java b/marketing-framework/marketing-spring-boot-starter-mybatis/src/main/java/com/platform/marketing/framework/mybatis/core/type/EncryptTypeHandler.java new file mode 100644 index 0000000..6454e6b --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-mybatis/src/main/java/com/platform/marketing/framework/mybatis/core/type/EncryptTypeHandler.java @@ -0,0 +1,75 @@ +package com.platform.marketing.framework.mybatis.core.type; + +import cn.hutool.core.lang.Assert; +import cn.hutool.crypto.SecureUtil; +import cn.hutool.crypto.symmetric.AES; +import cn.hutool.extra.spring.SpringUtil; +import org.apache.ibatis.type.BaseTypeHandler; +import org.apache.ibatis.type.JdbcType; + +import java.sql.CallableStatement; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; + +/** + * 字段字段的 TypeHandler 实现类,基于 {@link AES} 实现 + * 可通过 jasypt.encryptor.password 配置项,设置密钥 + * + + */ +public class EncryptTypeHandler extends BaseTypeHandler { + + private static final String ENCRYPTOR_PROPERTY_NAME = "mybatis-plus.encryptor.password"; + + private static AES aes; + + @Override + public void setNonNullParameter(PreparedStatement ps, int i, String parameter, JdbcType jdbcType) throws SQLException { + ps.setString(i, encrypt(parameter)); + } + + @Override + public String getNullableResult(ResultSet rs, String columnName) throws SQLException { + String value = rs.getString(columnName); + return decrypt(value); + } + + @Override + public String getNullableResult(ResultSet rs, int columnIndex) throws SQLException { + String value = rs.getString(columnIndex); + return decrypt(value); + } + + @Override + public String getNullableResult(CallableStatement cs, int columnIndex) throws SQLException { + String value = cs.getString(columnIndex); + return decrypt(value); + } + + private static String decrypt(String value) { + if (value == null) { + return null; + } + return getEncryptor().decryptStr(value); + } + + public static String encrypt(String rawValue) { + if (rawValue == null) { + return null; + } + return getEncryptor().encryptBase64(rawValue); + } + + private static AES getEncryptor() { + if (aes != null) { + return aes; + } + // 构建 AES + String password = SpringUtil.getProperty(ENCRYPTOR_PROPERTY_NAME); + Assert.notEmpty(password, "配置项({}) 不能为空", ENCRYPTOR_PROPERTY_NAME); + aes = SecureUtil.aes(password.getBytes()); + return aes; + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-mybatis/src/main/java/com/platform/marketing/framework/mybatis/core/type/IntegerListTypeHandler.java b/marketing-framework/marketing-spring-boot-starter-mybatis/src/main/java/com/platform/marketing/framework/mybatis/core/type/IntegerListTypeHandler.java new file mode 100644 index 0000000..f224721 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-mybatis/src/main/java/com/platform/marketing/framework/mybatis/core/type/IntegerListTypeHandler.java @@ -0,0 +1,56 @@ +package com.platform.marketing.framework.mybatis.core.type; + +import cn.hutool.core.collection.CollUtil; +import com.platform.marketing.framework.common.util.string.StrUtils; +import org.apache.ibatis.type.JdbcType; +import org.apache.ibatis.type.MappedJdbcTypes; +import org.apache.ibatis.type.MappedTypes; +import org.apache.ibatis.type.TypeHandler; + +import java.sql.CallableStatement; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.List; + +/** + * List 的类型转换器实现类,对应数据库的 varchar 类型 + * + * @author jason + */ +@MappedJdbcTypes(JdbcType.VARCHAR) +@MappedTypes(List.class) +public class IntegerListTypeHandler implements TypeHandler> { + + private static final String COMMA = ","; + + @Override + public void setParameter(PreparedStatement ps, int i, List strings, JdbcType jdbcType) throws SQLException { + ps.setString(i, CollUtil.join(strings, COMMA)); + } + + @Override + public List getResult(ResultSet rs, String columnName) throws SQLException { + String value = rs.getString(columnName); + return getResult(value); + } + + @Override + public List getResult(ResultSet rs, int columnIndex) throws SQLException { + String value = rs.getString(columnIndex); + return getResult(value); + } + + @Override + public List getResult(CallableStatement cs, int columnIndex) throws SQLException { + String value = cs.getString(columnIndex); + return getResult(value); + } + + private List getResult(String value) { + if (value == null) { + return null; + } + return StrUtils.splitToInteger(value, COMMA); + } +} diff --git a/marketing-framework/marketing-spring-boot-starter-mybatis/src/main/java/com/platform/marketing/framework/mybatis/core/type/LongListTypeHandler.java b/marketing-framework/marketing-spring-boot-starter-mybatis/src/main/java/com/platform/marketing/framework/mybatis/core/type/LongListTypeHandler.java new file mode 100644 index 0000000..228a890 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-mybatis/src/main/java/com/platform/marketing/framework/mybatis/core/type/LongListTypeHandler.java @@ -0,0 +1,57 @@ +package com.platform.marketing.framework.mybatis.core.type; + +import cn.hutool.core.collection.CollUtil; +import com.platform.marketing.framework.common.util.string.StrUtils; +import org.apache.ibatis.type.JdbcType; +import org.apache.ibatis.type.MappedJdbcTypes; +import org.apache.ibatis.type.MappedTypes; +import org.apache.ibatis.type.TypeHandler; + +import java.sql.CallableStatement; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.List; + +/** + * List 的类型转换器实现类,对应数据库的 varchar 类型 + * + + */ +@MappedJdbcTypes(JdbcType.VARCHAR) +@MappedTypes(List.class) +public class LongListTypeHandler implements TypeHandler> { + + private static final String COMMA = ","; + + @Override + public void setParameter(PreparedStatement ps, int i, List strings, JdbcType jdbcType) throws SQLException { + // 设置占位符 + ps.setString(i, CollUtil.join(strings, COMMA)); + } + + @Override + public List getResult(ResultSet rs, String columnName) throws SQLException { + String value = rs.getString(columnName); + return getResult(value); + } + + @Override + public List getResult(ResultSet rs, int columnIndex) throws SQLException { + String value = rs.getString(columnIndex); + return getResult(value); + } + + @Override + public List getResult(CallableStatement cs, int columnIndex) throws SQLException { + String value = cs.getString(columnIndex); + return getResult(value); + } + + private List getResult(String value) { + if (value == null) { + return null; + } + return StrUtils.splitToLong(value, COMMA); + } +} diff --git a/marketing-framework/marketing-spring-boot-starter-mybatis/src/main/java/com/platform/marketing/framework/mybatis/core/type/LongSetTypeHandler.java b/marketing-framework/marketing-spring-boot-starter-mybatis/src/main/java/com/platform/marketing/framework/mybatis/core/type/LongSetTypeHandler.java new file mode 100644 index 0000000..35caee9 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-mybatis/src/main/java/com/platform/marketing/framework/mybatis/core/type/LongSetTypeHandler.java @@ -0,0 +1,58 @@ +package com.platform.marketing.framework.mybatis.core.type; + +import cn.hutool.core.collection.CollUtil; +import com.platform.marketing.framework.common.util.string.StrUtils; +import org.apache.ibatis.type.JdbcType; +import org.apache.ibatis.type.MappedJdbcTypes; +import org.apache.ibatis.type.MappedTypes; +import org.apache.ibatis.type.TypeHandler; + +import java.sql.CallableStatement; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.List; +import java.util.Set; + +/** + * Set 的类型转换器实现类,对应数据库的 varchar 类型 + * + + */ +@MappedJdbcTypes(JdbcType.VARCHAR) +@MappedTypes(List.class) +public class LongSetTypeHandler implements TypeHandler> { + + private static final String COMMA = ","; + + @Override + public void setParameter(PreparedStatement ps, int i, Set strings, JdbcType jdbcType) throws SQLException { + // 设置占位符 + ps.setString(i, CollUtil.join(strings, COMMA)); + } + + @Override + public Set getResult(ResultSet rs, String columnName) throws SQLException { + String value = rs.getString(columnName); + return getResult(value); + } + + @Override + public Set getResult(ResultSet rs, int columnIndex) throws SQLException { + String value = rs.getString(columnIndex); + return getResult(value); + } + + @Override + public Set getResult(CallableStatement cs, int columnIndex) throws SQLException { + String value = cs.getString(columnIndex); + return getResult(value); + } + + private Set getResult(String value) { + if (value == null) { + return null; + } + return StrUtils.splitToLongSet(value, COMMA); + } +} diff --git a/marketing-framework/marketing-spring-boot-starter-mybatis/src/main/java/com/platform/marketing/framework/mybatis/core/type/StringListTypeHandler.java b/marketing-framework/marketing-spring-boot-starter-mybatis/src/main/java/com/platform/marketing/framework/mybatis/core/type/StringListTypeHandler.java new file mode 100644 index 0000000..c1f48ed --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-mybatis/src/main/java/com/platform/marketing/framework/mybatis/core/type/StringListTypeHandler.java @@ -0,0 +1,58 @@ +package com.platform.marketing.framework.mybatis.core.type; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.StrUtil; +import org.apache.ibatis.type.JdbcType; +import org.apache.ibatis.type.MappedJdbcTypes; +import org.apache.ibatis.type.MappedTypes; +import org.apache.ibatis.type.TypeHandler; + +import java.sql.CallableStatement; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.List; + +/** + * List 的类型转换器实现类,对应数据库的 varchar 类型 + * + * @author 永不言败 + * @since 2022 3/23 12:50:15 + */ +@MappedJdbcTypes(JdbcType.VARCHAR) +@MappedTypes(List.class) +public class StringListTypeHandler implements TypeHandler> { + + private static final String COMMA = ","; + + @Override + public void setParameter(PreparedStatement ps, int i, List strings, JdbcType jdbcType) throws SQLException { + // 设置占位符 + ps.setString(i, CollUtil.join(strings, COMMA)); + } + + @Override + public List getResult(ResultSet rs, String columnName) throws SQLException { + String value = rs.getString(columnName); + return getResult(value); + } + + @Override + public List getResult(ResultSet rs, int columnIndex) throws SQLException { + String value = rs.getString(columnIndex); + return getResult(value); + } + + @Override + public List getResult(CallableStatement cs, int columnIndex) throws SQLException { + String value = cs.getString(columnIndex); + return getResult(value); + } + + private List getResult(String value) { + if (value == null) { + return null; + } + return StrUtil.splitTrim(value, COMMA); + } +} diff --git a/marketing-framework/marketing-spring-boot-starter-mybatis/src/main/java/com/platform/marketing/framework/mybatis/core/util/JdbcUtils.java b/marketing-framework/marketing-spring-boot-starter-mybatis/src/main/java/com/platform/marketing/framework/mybatis/core/util/JdbcUtils.java new file mode 100644 index 0000000..1795e97 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-mybatis/src/main/java/com/platform/marketing/framework/mybatis/core/util/JdbcUtils.java @@ -0,0 +1,89 @@ +package com.platform.marketing.framework.mybatis.core.util; + +import com.platform.marketing.framework.common.util.object.ObjectUtils; +import com.platform.marketing.framework.common.util.spring.SpringUtils; +import com.platform.marketing.framework.mybatis.core.enums.DbTypeEnum; +import com.baomidou.dynamic.datasource.DynamicRoutingDataSource; +import com.baomidou.mybatisplus.annotation.DbType; +import org.springframework.beans.factory.NoSuchBeanDefinitionException; + +import javax.sql.DataSource; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.SQLException; + +/** + * JDBC 工具类 + * + + */ +public class JdbcUtils { + + /** + * 判断连接是否正确 + * + * @param url 数据源连接 + * @param username 账号 + * @param password 密码 + * @return 是否正确 + */ + public static boolean isConnectionOK(String url, String username, String password) { + try (Connection ignored = DriverManager.getConnection(url, username, password)) { + return true; + } catch (Exception ex) { + return false; + } + } + + /** + * 获得 URL 对应的 DB 类型 + * + * @param url URL + * @return DB 类型 + */ + public static DbType getDbType(String url) { + return com.baomidou.mybatisplus.extension.toolkit.JdbcUtils.getDbType(url); + } + + /** + * 通过当前数据库连接获得对应的 DB 类型 + * + * @return DB 类型 + */ + public static DbType getDbType() { + DataSource dataSource; + try { + DynamicRoutingDataSource dynamicRoutingDataSource = SpringUtils.getBean(DynamicRoutingDataSource.class); + dataSource = dynamicRoutingDataSource.determineDataSource(); + } catch (NoSuchBeanDefinitionException e) { + dataSource = SpringUtils.getBean(DataSource.class); + } + try (Connection conn = dataSource.getConnection()) { + return DbTypeEnum.find(conn.getMetaData().getDatabaseProductName()); + } catch (SQLException e) { + throw new IllegalArgumentException(e.getMessage()); + } + } + + /** + * 判断 JDBC 连接是否为 SQLServer 数据库 + * + * @param url JDBC 连接 + * @return 是否为 SQLServer 数据库 + */ + public static boolean isSQLServer(String url) { + DbType dbType = getDbType(url); + return isSQLServer(dbType); + } + + /** + * 判断 JDBC 连接是否为 SQLServer 数据库 + * + * @param dbType DB 类型 + * @return 是否为 SQLServer 数据库 + */ + public static boolean isSQLServer(DbType dbType) { + return ObjectUtils.equalsAny(dbType, DbType.SQL_SERVER, DbType.SQL_SERVER2005); + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-mybatis/src/main/java/com/platform/marketing/framework/mybatis/core/util/MyBatisUtils.java b/marketing-framework/marketing-spring-boot-starter-mybatis/src/main/java/com/platform/marketing/framework/mybatis/core/util/MyBatisUtils.java new file mode 100644 index 0000000..d10f446 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-mybatis/src/main/java/com/platform/marketing/framework/mybatis/core/util/MyBatisUtils.java @@ -0,0 +1,106 @@ +package com.platform.marketing.framework.mybatis.core.util; + +import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.util.StrUtil; +import com.platform.marketing.framework.common.pojo.PageParam; +import com.platform.marketing.framework.common.pojo.SortingField; +import com.platform.marketing.framework.mybatis.core.enums.DbTypeEnum; +import com.baomidou.mybatisplus.annotation.DbType; +import com.baomidou.mybatisplus.core.metadata.OrderItem; +import com.baomidou.mybatisplus.core.toolkit.StringPool; +import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; +import com.baomidou.mybatisplus.extension.plugins.inner.InnerInterceptor; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import net.sf.jsqlparser.expression.Alias; +import net.sf.jsqlparser.schema.Column; +import net.sf.jsqlparser.schema.Table; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.stream.Collectors; + +/** + * MyBatis 工具类 + */ +public class MyBatisUtils { + + private static final String MYSQL_ESCAPE_CHARACTER = "`"; + + public static Page buildPage(PageParam pageParam) { + return buildPage(pageParam, null); + } + + public static Page buildPage(PageParam pageParam, Collection sortingFields) { + // 页码 + 数量 + Page page = new Page<>(pageParam.getPageNo(), pageParam.getPageSize()); + // 排序字段 + if (!CollectionUtil.isEmpty(sortingFields)) { + page.addOrder(sortingFields.stream().map(sortingField -> SortingField.ORDER_ASC.equals(sortingField.getOrder()) + ? OrderItem.asc(StrUtil.toUnderlineCase(sortingField.getField())) + : OrderItem.desc(StrUtil.toUnderlineCase(sortingField.getField()))) + .collect(Collectors.toList())); + } + return page; + } + + /** + * 将拦截器添加到链中 + * 由于 MybatisPlusInterceptor 不支持添加拦截器,所以只能全量设置 + * + * @param interceptor 链 + * @param inner 拦截器 + * @param index 位置 + */ + public static void addInterceptor(MybatisPlusInterceptor interceptor, InnerInterceptor inner, int index) { + List inners = new ArrayList<>(interceptor.getInterceptors()); + inners.add(index, inner); + interceptor.setInterceptors(inners); + } + + /** + * 获得 Table 对应的表名 + *

+ * 兼容 MySQL 转义表名 `t_xxx` + * + * @param table 表 + * @return 去除转移字符后的表名 + */ + public static String getTableName(Table table) { + String tableName = table.getName(); + if (tableName.startsWith(MYSQL_ESCAPE_CHARACTER) && tableName.endsWith(MYSQL_ESCAPE_CHARACTER)) { + tableName = tableName.substring(1, tableName.length() - 1); + } + return tableName; + } + + /** + * 构建 Column 对象 + * + * @param tableName 表名 + * @param tableAlias 别名 + * @param column 字段名 + * @return Column 对象 + */ + public static Column buildColumn(String tableName, Alias tableAlias, String column) { + if (tableAlias != null) { + tableName = tableAlias.getName(); + } + return new Column(tableName + StringPool.DOT + column); + } + + /** + * 跨数据库的 find_in_set 实现 + * + * @param column 字段名称 + * @param value 查询值(不带单引号) + * @return sql + */ + public static String findInSet(String column, Object value) { + DbType dbType = JdbcUtils.getDbType(); + return DbTypeEnum.getFindInSetTemplate(dbType) + .replace("#{column}", column) + .replace("#{value}", StrUtil.toString(value)); + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-mybatis/src/main/java/com/platform/marketing/framework/translate/config/MarketingTranslateAutoConfiguration.java b/marketing-framework/marketing-spring-boot-starter-mybatis/src/main/java/com/platform/marketing/framework/translate/config/MarketingTranslateAutoConfiguration.java new file mode 100644 index 0000000..c50be6b --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-mybatis/src/main/java/com/platform/marketing/framework/translate/config/MarketingTranslateAutoConfiguration.java @@ -0,0 +1,18 @@ +package com.platform.marketing.framework.translate.config; + +import com.platform.marketing.framework.translate.core.TranslateUtils; +import com.fhs.trans.service.impl.TransService; +import org.springframework.boot.autoconfigure.AutoConfiguration; +import org.springframework.context.annotation.Bean; + +@AutoConfiguration +public class MarketingTranslateAutoConfiguration { + + @Bean + @SuppressWarnings({"InstantiationOfUtilityClass", "SpringJavaInjectionPointsAutowiringInspection"}) + public TranslateUtils translateUtils(TransService transService) { + TranslateUtils.init(transService); + return new TranslateUtils(); + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-mybatis/src/main/java/com/platform/marketing/framework/translate/core/TranslateUtils.java b/marketing-framework/marketing-spring-boot-starter-mybatis/src/main/java/com/platform/marketing/framework/translate/core/TranslateUtils.java new file mode 100644 index 0000000..e75894e --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-mybatis/src/main/java/com/platform/marketing/framework/translate/core/TranslateUtils.java @@ -0,0 +1,37 @@ +package com.platform.marketing.framework.translate.core; + +import cn.hutool.core.collection.CollUtil; +import com.fhs.core.trans.vo.VO; +import com.fhs.trans.service.impl.TransService; + +import java.util.List; + +/** + * VO 数据翻译 Utils + * + + */ +public class TranslateUtils { + + private static TransService transService; + + public static void init(TransService transService) { + TranslateUtils.transService = transService; + } + + /** + * 数据翻译 + * + * 使用场景:无法使用 @TransMethodResult 注解的场景,只能通过手动触发翻译 + * + * @param data 数据 + * @return 翻译结果 + */ + public static List translate(List data) { + if (CollUtil.isNotEmpty((data))) { + transService.transBatch(data); + } + return data; + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-mybatis/src/main/resources/META-INF/spring.factories b/marketing-framework/marketing-spring-boot-starter-mybatis/src/main/resources/META-INF/spring.factories new file mode 100644 index 0000000..5f2b57b --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-mybatis/src/main/resources/META-INF/spring.factories @@ -0,0 +1,2 @@ +org.springframework.boot.env.EnvironmentPostProcessor=\ + com.platform.marketing.framework.mybatis.config.IdTypeEnvironmentPostProcessor diff --git a/marketing-framework/marketing-spring-boot-starter-mybatis/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/marketing-framework/marketing-spring-boot-starter-mybatis/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 0000000..6c082a6 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-mybatis/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1,3 @@ +com.platform.marketing.framework.datasource.config.MarketingDataSourceAutoConfiguration +com.platform.marketing.framework.mybatis.config.MarketingMybatisAutoConfiguration +com.platform.marketing.framework.translate.config.MarketingTranslateAutoConfiguration \ No newline at end of file diff --git a/marketing-framework/marketing-spring-boot-starter-protection/.flattened-pom.xml b/marketing-framework/marketing-spring-boot-starter-protection/.flattened-pom.xml new file mode 100644 index 0000000..fe0ff80 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-protection/.flattened-pom.xml @@ -0,0 +1,66 @@ + + + 4.0.0 + com.platform + marketing-spring-boot-starter-protection + 0.0.1-jdk8-SNAPSHOT + marketing-spring-boot-starter-protection + 服务保证,提供分布式锁、幂等、限流、熔断、API 签名等等功能 + https://github.com/makemyownlife/platform-sms-pro + + + com.platform + marketing-spring-boot-starter-web + 0.0.1-jdk8-SNAPSHOT + provided + + + com.platform + marketing-spring-boot-starter-redis + 0.0.1-jdk8-SNAPSHOT + compile + + + com.baomidou + lock4j-redisson-spring-boot-starter + 2.2.7 + compile + + + org.redisson + redisson-spring-boot-starter + + + true + + + + + huaweicloud + huawei + https://mirrors.huaweicloud.com/repository/maven/ + + + aliyunmaven + aliyun + https://maven.aliyun.com/repository/public + + + + false + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + + + false + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + + diff --git a/marketing-framework/marketing-spring-boot-starter-protection/pom.xml b/marketing-framework/marketing-spring-boot-starter-protection/pom.xml new file mode 100644 index 0000000..5ef42b0 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-protection/pom.xml @@ -0,0 +1,41 @@ + + + + com.platform + marketing-framework + ${revision} + + 4.0.0 + marketing-spring-boot-starter-protection + jar + + ${project.artifactId} + 服务保证,提供分布式锁、幂等、限流、熔断、API 签名等等功能 + https://github.com/makemyownlife/platform-sms-pro + + + + + com.platform + marketing-spring-boot-starter-web + provided + + + + + com.platform + marketing-spring-boot-starter-redis + + + + + com.baomidou + lock4j-redisson-spring-boot-starter + true + + + + + diff --git a/marketing-framework/marketing-spring-boot-starter-protection/src/main/java/com/platform/marketing/framework/idempotent/config/MarketingIdempotentConfiguration.java b/marketing-framework/marketing-spring-boot-starter-protection/src/main/java/com/platform/marketing/framework/idempotent/config/MarketingIdempotentConfiguration.java new file mode 100644 index 0000000..9196c13 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-protection/src/main/java/com/platform/marketing/framework/idempotent/config/MarketingIdempotentConfiguration.java @@ -0,0 +1,46 @@ +package com.platform.marketing.framework.idempotent.config; + +import com.platform.marketing.framework.idempotent.core.aop.IdempotentAspect; +import com.platform.marketing.framework.idempotent.core.keyresolver.impl.DefaultIdempotentKeyResolver; +import com.platform.marketing.framework.idempotent.core.keyresolver.impl.ExpressionIdempotentKeyResolver; +import com.platform.marketing.framework.idempotent.core.keyresolver.IdempotentKeyResolver; +import com.platform.marketing.framework.idempotent.core.keyresolver.impl.UserIdempotentKeyResolver; +import com.platform.marketing.framework.idempotent.core.redis.IdempotentRedisDAO; +import org.springframework.boot.autoconfigure.AutoConfiguration; +import com.platform.marketing.framework.redis.config.MarketingRedisAutoConfiguration; +import org.springframework.context.annotation.Bean; +import org.springframework.data.redis.core.StringRedisTemplate; + +import java.util.List; + +@AutoConfiguration(after = MarketingRedisAutoConfiguration.class) +public class MarketingIdempotentConfiguration { + + @Bean + public IdempotentAspect idempotentAspect(List keyResolvers, IdempotentRedisDAO idempotentRedisDAO) { + return new IdempotentAspect(keyResolvers, idempotentRedisDAO); + } + + @Bean + public IdempotentRedisDAO idempotentRedisDAO(StringRedisTemplate stringRedisTemplate) { + return new IdempotentRedisDAO(stringRedisTemplate); + } + + // ========== 各种 IdempotentKeyResolver Bean ========== + + @Bean + public DefaultIdempotentKeyResolver defaultIdempotentKeyResolver() { + return new DefaultIdempotentKeyResolver(); + } + + @Bean + public UserIdempotentKeyResolver userIdempotentKeyResolver() { + return new UserIdempotentKeyResolver(); + } + + @Bean + public ExpressionIdempotentKeyResolver expressionIdempotentKeyResolver() { + return new ExpressionIdempotentKeyResolver(); + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-protection/src/main/java/com/platform/marketing/framework/idempotent/core/annotation/Idempotent.java b/marketing-framework/marketing-spring-boot-starter-protection/src/main/java/com/platform/marketing/framework/idempotent/core/annotation/Idempotent.java new file mode 100644 index 0000000..75b7d2e --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-protection/src/main/java/com/platform/marketing/framework/idempotent/core/annotation/Idempotent.java @@ -0,0 +1,62 @@ +package com.platform.marketing.framework.idempotent.core.annotation; + +import com.platform.marketing.framework.idempotent.core.keyresolver.impl.DefaultIdempotentKeyResolver; +import com.platform.marketing.framework.idempotent.core.keyresolver.IdempotentKeyResolver; +import com.platform.marketing.framework.idempotent.core.keyresolver.impl.ExpressionIdempotentKeyResolver; +import com.platform.marketing.framework.idempotent.core.keyresolver.impl.UserIdempotentKeyResolver; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import java.util.concurrent.TimeUnit; + +/** + * 幂等注解 + * + */ +@Target({ElementType.METHOD}) +@Retention(RetentionPolicy.RUNTIME) +public @interface Idempotent { + + /** + * 幂等的超时时间,默认为 1 秒 + * + * 注意,如果执行时间超过它,请求还是会进来 + */ + int timeout() default 1; + /** + * 时间单位,默认为 SECONDS 秒 + */ + TimeUnit timeUnit() default TimeUnit.SECONDS; + + /** + * 提示信息,正在执行中的提示 + */ + String message() default "重复请求,请稍后重试"; + + /** + * 使用的 Key 解析器 + * + * @see DefaultIdempotentKeyResolver 全局级别 + * @see UserIdempotentKeyResolver 用户级别 + * @see ExpressionIdempotentKeyResolver 自定义表达式,通过 {@link #keyArg()} 计算 + */ + Class keyResolver() default DefaultIdempotentKeyResolver.class; + /** + * 使用的 Key 参数 + */ + String keyArg() default ""; + + /** + * 删除 Key,当发生异常时候 + * + * 问题:为什么发生异常时,需要删除 Key 呢? + * 回答:发生异常时,说明业务发生错误,此时需要删除 Key,避免下次请求无法正常执行。 + * + * 问题:为什么不搞 deleteWhenSuccess 执行成功时,需要删除 Key 呢? + * 回答:这种情况下,本质上是分布式锁,推荐使用 @Lock4j 注解 + */ + boolean deleteKeyWhenException() default true; + +} diff --git a/marketing-framework/marketing-spring-boot-starter-protection/src/main/java/com/platform/marketing/framework/idempotent/core/aop/IdempotentAspect.java b/marketing-framework/marketing-spring-boot-starter-protection/src/main/java/com/platform/marketing/framework/idempotent/core/aop/IdempotentAspect.java new file mode 100644 index 0000000..06e6f2f --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-protection/src/main/java/com/platform/marketing/framework/idempotent/core/aop/IdempotentAspect.java @@ -0,0 +1,67 @@ +package com.platform.marketing.framework.idempotent.core.aop; + +import com.platform.marketing.framework.common.exception.ServiceException; +import com.platform.marketing.framework.common.exception.enums.GlobalErrorCodeConstants; +import com.platform.marketing.framework.common.util.collection.CollectionUtils; +import com.platform.marketing.framework.idempotent.core.annotation.Idempotent; +import com.platform.marketing.framework.idempotent.core.keyresolver.IdempotentKeyResolver; +import com.platform.marketing.framework.idempotent.core.redis.IdempotentRedisDAO; +import lombok.extern.slf4j.Slf4j; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; +import org.springframework.util.Assert; + +import java.util.List; +import java.util.Map; + +/** + * 拦截声明了 {@link Idempotent} 注解的方法,实现幂等操作 + * + */ +@Aspect +@Slf4j +public class IdempotentAspect { + + /** + * IdempotentKeyResolver 集合 + */ + private final Map, IdempotentKeyResolver> keyResolvers; + + private final IdempotentRedisDAO idempotentRedisDAO; + + public IdempotentAspect(List keyResolvers, IdempotentRedisDAO idempotentRedisDAO) { + this.keyResolvers = CollectionUtils.convertMap(keyResolvers, IdempotentKeyResolver::getClass); + this.idempotentRedisDAO = idempotentRedisDAO; + } + + @Around(value = "@annotation(idempotent)") + public Object aroundPointCut(ProceedingJoinPoint joinPoint, Idempotent idempotent) throws Throwable { + // 获得 IdempotentKeyResolver + IdempotentKeyResolver keyResolver = keyResolvers.get(idempotent.keyResolver()); + Assert.notNull(keyResolver, "找不到对应的 IdempotentKeyResolver"); + // 解析 Key + String key = keyResolver.resolver(joinPoint, idempotent); + + // 1. 锁定 Key + boolean success = idempotentRedisDAO.setIfAbsent(key, idempotent.timeout(), idempotent.timeUnit()); + // 锁定失败,抛出异常 + if (!success) { + log.info("[aroundPointCut][方法({}) 参数({}) 存在重复请求]", joinPoint.getSignature().toString(), joinPoint.getArgs()); + throw new ServiceException(GlobalErrorCodeConstants.REPEATED_REQUESTS.getCode(), idempotent.message()); + } + + // 2. 执行逻辑 + try { + return joinPoint.proceed(); + } catch (Throwable throwable) { + // 3. 异常时,删除 Key + // 参考美团 GTIS 思路:https://tech.meituan.com/2016/09/29/distributed-system-mutually-exclusive-idempotence-cerberus-gtis.html + if (idempotent.deleteKeyWhenException()) { + idempotentRedisDAO.delete(key); + } + throw throwable; + } + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-protection/src/main/java/com/platform/marketing/framework/idempotent/core/keyresolver/IdempotentKeyResolver.java b/marketing-framework/marketing-spring-boot-starter-protection/src/main/java/com/platform/marketing/framework/idempotent/core/keyresolver/IdempotentKeyResolver.java new file mode 100644 index 0000000..80dab92 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-protection/src/main/java/com/platform/marketing/framework/idempotent/core/keyresolver/IdempotentKeyResolver.java @@ -0,0 +1,22 @@ +package com.platform.marketing.framework.idempotent.core.keyresolver; + +import com.platform.marketing.framework.idempotent.core.annotation.Idempotent; +import org.aspectj.lang.JoinPoint; + +/** + * 幂等 Key 解析器接口 + * + + */ +public interface IdempotentKeyResolver { + + /** + * 解析一个 Key + * + * @param idempotent 幂等注解 + * @param joinPoint AOP 切面 + * @return Key + */ + String resolver(JoinPoint joinPoint, Idempotent idempotent); + +} diff --git a/marketing-framework/marketing-spring-boot-starter-protection/src/main/java/com/platform/marketing/framework/idempotent/core/keyresolver/impl/DefaultIdempotentKeyResolver.java b/marketing-framework/marketing-spring-boot-starter-protection/src/main/java/com/platform/marketing/framework/idempotent/core/keyresolver/impl/DefaultIdempotentKeyResolver.java new file mode 100644 index 0000000..0bb9d89 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-protection/src/main/java/com/platform/marketing/framework/idempotent/core/keyresolver/impl/DefaultIdempotentKeyResolver.java @@ -0,0 +1,25 @@ +package com.platform.marketing.framework.idempotent.core.keyresolver.impl; + +import cn.hutool.core.util.StrUtil; +import cn.hutool.crypto.SecureUtil; +import com.platform.marketing.framework.idempotent.core.annotation.Idempotent; +import com.platform.marketing.framework.idempotent.core.keyresolver.IdempotentKeyResolver; +import org.aspectj.lang.JoinPoint; + +/** + * 默认(全局级别)幂等 Key 解析器,使用方法名 + 方法参数,组装成一个 Key + * + * 为了避免 Key 过长,使用 MD5 进行“压缩” + * + + */ +public class DefaultIdempotentKeyResolver implements IdempotentKeyResolver { + + @Override + public String resolver(JoinPoint joinPoint, Idempotent idempotent) { + String methodName = joinPoint.getSignature().toString(); + String argsStr = StrUtil.join(",", joinPoint.getArgs()); + return SecureUtil.md5(methodName + argsStr); + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-protection/src/main/java/com/platform/marketing/framework/idempotent/core/keyresolver/impl/ExpressionIdempotentKeyResolver.java b/marketing-framework/marketing-spring-boot-starter-protection/src/main/java/com/platform/marketing/framework/idempotent/core/keyresolver/impl/ExpressionIdempotentKeyResolver.java new file mode 100644 index 0000000..48f46cc --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-protection/src/main/java/com/platform/marketing/framework/idempotent/core/keyresolver/impl/ExpressionIdempotentKeyResolver.java @@ -0,0 +1,63 @@ +package com.platform.marketing.framework.idempotent.core.keyresolver.impl; + +import cn.hutool.core.util.ArrayUtil; +import com.platform.marketing.framework.idempotent.core.annotation.Idempotent; +import com.platform.marketing.framework.idempotent.core.keyresolver.IdempotentKeyResolver; +import org.aspectj.lang.JoinPoint; +import org.aspectj.lang.reflect.MethodSignature; +import org.springframework.core.LocalVariableTableParameterNameDiscoverer; +import org.springframework.core.ParameterNameDiscoverer; +import org.springframework.expression.Expression; +import org.springframework.expression.ExpressionParser; +import org.springframework.expression.spel.standard.SpelExpressionParser; +import org.springframework.expression.spel.support.StandardEvaluationContext; + +import java.lang.reflect.Method; + +/** + * 基于 Spring EL 表达式, + * + + */ +public class ExpressionIdempotentKeyResolver implements IdempotentKeyResolver { + + private final ParameterNameDiscoverer parameterNameDiscoverer = new LocalVariableTableParameterNameDiscoverer(); + private final ExpressionParser expressionParser = new SpelExpressionParser(); + + @Override + public String resolver(JoinPoint joinPoint, Idempotent idempotent) { + // 获得被拦截方法参数名列表 + Method method = getMethod(joinPoint); + Object[] args = joinPoint.getArgs(); + String[] parameterNames = this.parameterNameDiscoverer.getParameterNames(method); + // 准备 Spring EL 表达式解析的上下文 + StandardEvaluationContext evaluationContext = new StandardEvaluationContext(); + if (ArrayUtil.isNotEmpty(parameterNames)) { + for (int i = 0; i < parameterNames.length; i++) { + evaluationContext.setVariable(parameterNames[i], args[i]); + } + } + + // 解析参数 + Expression expression = expressionParser.parseExpression(idempotent.keyArg()); + return expression.getValue(evaluationContext, String.class); + } + + private static Method getMethod(JoinPoint point) { + // 处理,声明在类上的情况 + MethodSignature signature = (MethodSignature) point.getSignature(); + Method method = signature.getMethod(); + if (!method.getDeclaringClass().isInterface()) { + return method; + } + + // 处理,声明在接口上的情况 + try { + return point.getTarget().getClass().getDeclaredMethod( + point.getSignature().getName(), method.getParameterTypes()); + } catch (NoSuchMethodException e) { + throw new RuntimeException(e); + } + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-protection/src/main/java/com/platform/marketing/framework/idempotent/core/keyresolver/impl/UserIdempotentKeyResolver.java b/marketing-framework/marketing-spring-boot-starter-protection/src/main/java/com/platform/marketing/framework/idempotent/core/keyresolver/impl/UserIdempotentKeyResolver.java new file mode 100644 index 0000000..07b18ea --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-protection/src/main/java/com/platform/marketing/framework/idempotent/core/keyresolver/impl/UserIdempotentKeyResolver.java @@ -0,0 +1,28 @@ +package com.platform.marketing.framework.idempotent.core.keyresolver.impl; + +import cn.hutool.core.util.StrUtil; +import cn.hutool.crypto.SecureUtil; +import com.platform.marketing.framework.idempotent.core.annotation.Idempotent; +import com.platform.marketing.framework.idempotent.core.keyresolver.IdempotentKeyResolver; +import com.platform.marketing.framework.web.core.util.WebFrameworkUtils; +import org.aspectj.lang.JoinPoint; + +/** + * 用户级别的幂等 Key 解析器,使用方法名 + 方法参数 + userId + userType,组装成一个 Key + * + * 为了避免 Key 过长,使用 MD5 进行“压缩” + * + + */ +public class UserIdempotentKeyResolver implements IdempotentKeyResolver { + + @Override + public String resolver(JoinPoint joinPoint, Idempotent idempotent) { + String methodName = joinPoint.getSignature().toString(); + String argsStr = StrUtil.join(",", joinPoint.getArgs()); + Long userId = WebFrameworkUtils.getLoginUserId(); + Integer userType = WebFrameworkUtils.getLoginUserType(); + return SecureUtil.md5(methodName + argsStr + userId + userType); + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-protection/src/main/java/com/platform/marketing/framework/idempotent/core/redis/IdempotentRedisDAO.java b/marketing-framework/marketing-spring-boot-starter-protection/src/main/java/com/platform/marketing/framework/idempotent/core/redis/IdempotentRedisDAO.java new file mode 100644 index 0000000..8851108 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-protection/src/main/java/com/platform/marketing/framework/idempotent/core/redis/IdempotentRedisDAO.java @@ -0,0 +1,41 @@ +package com.platform.marketing.framework.idempotent.core.redis; + +import lombok.AllArgsConstructor; +import org.springframework.data.redis.core.StringRedisTemplate; + +import java.util.concurrent.TimeUnit; + +/** + * 幂等 Redis DAO + * + + */ +@AllArgsConstructor +public class IdempotentRedisDAO { + + /** + * 幂等操作 + * + * KEY 格式:idempotent:%s // 参数为 uuid + * VALUE 格式:String + * 过期时间:不固定 + */ + private static final String IDEMPOTENT = "idempotent:%s"; + + private final StringRedisTemplate redisTemplate; + + public Boolean setIfAbsent(String key, long timeout, TimeUnit timeUnit) { + String redisKey = formatKey(key); + return redisTemplate.opsForValue().setIfAbsent(redisKey, "", timeout, timeUnit); + } + + public void delete(String key) { + String redisKey = formatKey(key); + redisTemplate.delete(redisKey); + } + + private static String formatKey(String key) { + return String.format(IDEMPOTENT, key); + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-protection/src/main/java/com/platform/marketing/framework/lock4j/config/MarketingLock4jConfiguration.java b/marketing-framework/marketing-spring-boot-starter-protection/src/main/java/com/platform/marketing/framework/lock4j/config/MarketingLock4jConfiguration.java new file mode 100644 index 0000000..936f39c --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-protection/src/main/java/com/platform/marketing/framework/lock4j/config/MarketingLock4jConfiguration.java @@ -0,0 +1,18 @@ +package com.platform.marketing.framework.lock4j.config; + +import com.platform.marketing.framework.lock4j.core.DefaultLockFailureStrategy; +import com.baomidou.lock.spring.boot.autoconfigure.LockAutoConfiguration; +import org.springframework.boot.autoconfigure.AutoConfiguration; +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.context.annotation.Bean; + +@AutoConfiguration(before = LockAutoConfiguration.class) +@ConditionalOnClass(name = "com.baomidou.lock.annotation.Lock4j") +public class MarketingLock4jConfiguration { + + @Bean + public DefaultLockFailureStrategy lockFailureStrategy() { + return new DefaultLockFailureStrategy(); + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-protection/src/main/java/com/platform/marketing/framework/lock4j/core/DefaultLockFailureStrategy.java b/marketing-framework/marketing-spring-boot-starter-protection/src/main/java/com/platform/marketing/framework/lock4j/core/DefaultLockFailureStrategy.java new file mode 100644 index 0000000..30ed32f --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-protection/src/main/java/com/platform/marketing/framework/lock4j/core/DefaultLockFailureStrategy.java @@ -0,0 +1,21 @@ +package com.platform.marketing.framework.lock4j.core; + +import com.platform.marketing.framework.common.exception.ServiceException; +import com.platform.marketing.framework.common.exception.enums.GlobalErrorCodeConstants; +import com.baomidou.lock.LockFailureStrategy; +import lombok.extern.slf4j.Slf4j; + +import java.lang.reflect.Method; + +/** + * 自定义获取锁失败策略,抛出 {@link ServiceException} 异常 + */ +@Slf4j +public class DefaultLockFailureStrategy implements LockFailureStrategy { + + @Override + public void onLockFailure(String key, Method method, Object[] arguments) { + log.debug("[onLockFailure][线程:{} 获取锁失败,key:{} 获取失败:{} ]", Thread.currentThread().getName(), key, arguments); + throw new ServiceException(GlobalErrorCodeConstants.LOCKED); + } +} diff --git a/marketing-framework/marketing-spring-boot-starter-protection/src/main/java/com/platform/marketing/framework/lock4j/core/Lock4jRedisKeyConstants.java b/marketing-framework/marketing-spring-boot-starter-protection/src/main/java/com/platform/marketing/framework/lock4j/core/Lock4jRedisKeyConstants.java new file mode 100644 index 0000000..2c0ec75 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-protection/src/main/java/com/platform/marketing/framework/lock4j/core/Lock4jRedisKeyConstants.java @@ -0,0 +1,19 @@ +package com.platform.marketing.framework.lock4j.core; + +/** + * Lock4j Redis Key 枚举类 + * + + */ +public interface Lock4jRedisKeyConstants { + + /** + * 分布式锁 + * + * KEY 格式:lock4j:%s // 参数来自 DefaultLockKeyBuilder 类 + * VALUE 数据格式:HASH // RLock.class:Redisson 的 Lock 锁,使用 Hash 数据结构 + * 过期时间:不固定 + */ + String LOCK4J = "lock4j:%s"; + +} diff --git a/marketing-framework/marketing-spring-boot-starter-protection/src/main/java/com/platform/marketing/framework/ratelimiter/config/MarketingRateLimiterConfiguration.java b/marketing-framework/marketing-spring-boot-starter-protection/src/main/java/com/platform/marketing/framework/ratelimiter/config/MarketingRateLimiterConfiguration.java new file mode 100644 index 0000000..a1cf3e7 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-protection/src/main/java/com/platform/marketing/framework/ratelimiter/config/MarketingRateLimiterConfiguration.java @@ -0,0 +1,55 @@ +package com.platform.marketing.framework.ratelimiter.config; + +import com.platform.marketing.framework.ratelimiter.core.aop.RateLimiterAspect; +import com.platform.marketing.framework.ratelimiter.core.keyresolver.RateLimiterKeyResolver; +import com.platform.marketing.framework.ratelimiter.core.keyresolver.impl.*; +import com.platform.marketing.framework.ratelimiter.core.redis.RateLimiterRedisDAO; +import com.platform.marketing.framework.redis.config.MarketingRedisAutoConfiguration; +import org.redisson.api.RedissonClient; +import org.springframework.boot.autoconfigure.AutoConfiguration; +import org.springframework.context.annotation.Bean; + +import java.util.List; + +@AutoConfiguration(after = MarketingRedisAutoConfiguration.class) +public class MarketingRateLimiterConfiguration { + + @Bean + public RateLimiterAspect rateLimiterAspect(List keyResolvers, RateLimiterRedisDAO rateLimiterRedisDAO) { + return new RateLimiterAspect(keyResolvers, rateLimiterRedisDAO); + } + + @Bean + @SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection") + public RateLimiterRedisDAO rateLimiterRedisDAO(RedissonClient redissonClient) { + return new RateLimiterRedisDAO(redissonClient); + } + + // ========== 各种 RateLimiterRedisDAO Bean ========== + + @Bean + public DefaultRateLimiterKeyResolver defaultRateLimiterKeyResolver() { + return new DefaultRateLimiterKeyResolver(); + } + + @Bean + public UserRateLimiterKeyResolver userRateLimiterKeyResolver() { + return new UserRateLimiterKeyResolver(); + } + + @Bean + public ClientIpRateLimiterKeyResolver clientIpRateLimiterKeyResolver() { + return new ClientIpRateLimiterKeyResolver(); + } + + @Bean + public ServerNodeRateLimiterKeyResolver serverNodeRateLimiterKeyResolver() { + return new ServerNodeRateLimiterKeyResolver(); + } + + @Bean + public ExpressionRateLimiterKeyResolver expressionRateLimiterKeyResolver() { + return new ExpressionRateLimiterKeyResolver(); + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-protection/src/main/java/com/platform/marketing/framework/ratelimiter/core/annotation/RateLimiter.java b/marketing-framework/marketing-spring-boot-starter-protection/src/main/java/com/platform/marketing/framework/ratelimiter/core/annotation/RateLimiter.java new file mode 100644 index 0000000..815345b --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-protection/src/main/java/com/platform/marketing/framework/ratelimiter/core/annotation/RateLimiter.java @@ -0,0 +1,62 @@ +package com.platform.marketing.framework.ratelimiter.core.annotation; + +import com.platform.marketing.framework.common.exception.enums.GlobalErrorCodeConstants; +import com.platform.marketing.framework.idempotent.core.keyresolver.impl.ExpressionIdempotentKeyResolver; +import com.platform.marketing.framework.ratelimiter.core.keyresolver.RateLimiterKeyResolver; +import com.platform.marketing.framework.ratelimiter.core.keyresolver.impl.ClientIpRateLimiterKeyResolver; +import com.platform.marketing.framework.ratelimiter.core.keyresolver.impl.DefaultRateLimiterKeyResolver; +import com.platform.marketing.framework.ratelimiter.core.keyresolver.impl.ServerNodeRateLimiterKeyResolver; +import com.platform.marketing.framework.ratelimiter.core.keyresolver.impl.UserRateLimiterKeyResolver; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import java.util.concurrent.TimeUnit; + +/** + * 限流注解 + * + + */ +@Target({ElementType.METHOD}) +@Retention(RetentionPolicy.RUNTIME) +public @interface RateLimiter { + + /** + * 限流的时间,默认为 1 秒 + */ + int time() default 1; + /** + * 时间单位,默认为 SECONDS 秒 + */ + TimeUnit timeUnit() default TimeUnit.SECONDS; + + /** + * 限流次数 + */ + int count() default 100; + + /** + * 提示信息,请求过快的提示 + * + * @see GlobalErrorCodeConstants#TOO_MANY_REQUESTS + */ + String message() default ""; // 为空时,使用 TOO_MANY_REQUESTS 错误提示 + + /** + * 使用的 Key 解析器 + * + * @see DefaultRateLimiterKeyResolver 全局级别 + * @see UserRateLimiterKeyResolver 用户 ID 级别 + * @see ClientIpRateLimiterKeyResolver 用户 IP 级别 + * @see ServerNodeRateLimiterKeyResolver 服务器 Node 级别 + * @see ExpressionIdempotentKeyResolver 自定义表达式,通过 {@link #keyArg()} 计算 + */ + Class keyResolver() default DefaultRateLimiterKeyResolver.class; + /** + * 使用的 Key 参数 + */ + String keyArg() default ""; + +} diff --git a/marketing-framework/marketing-spring-boot-starter-protection/src/main/java/com/platform/marketing/framework/ratelimiter/core/aop/RateLimiterAspect.java b/marketing-framework/marketing-spring-boot-starter-protection/src/main/java/com/platform/marketing/framework/ratelimiter/core/aop/RateLimiterAspect.java new file mode 100644 index 0000000..9b2a9fe --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-protection/src/main/java/com/platform/marketing/framework/ratelimiter/core/aop/RateLimiterAspect.java @@ -0,0 +1,60 @@ +package com.platform.marketing.framework.ratelimiter.core.aop; + +import cn.hutool.core.util.StrUtil; +import com.platform.marketing.framework.common.exception.ServiceException; +import com.platform.marketing.framework.common.exception.enums.GlobalErrorCodeConstants; +import com.platform.marketing.framework.common.util.collection.CollectionUtils; +import com.platform.marketing.framework.ratelimiter.core.annotation.RateLimiter; +import com.platform.marketing.framework.ratelimiter.core.keyresolver.RateLimiterKeyResolver; +import com.platform.marketing.framework.ratelimiter.core.redis.RateLimiterRedisDAO; +import lombok.extern.slf4j.Slf4j; +import org.aspectj.lang.JoinPoint; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Before; +import org.springframework.util.Assert; + +import java.util.List; +import java.util.Map; + +/** + * 拦截声明了 {@link RateLimiter} 注解的方法,实现限流操作 + * + + */ +@Aspect +@Slf4j +public class RateLimiterAspect { + + /** + * RateLimiterKeyResolver 集合 + */ + private final Map, RateLimiterKeyResolver> keyResolvers; + + private final RateLimiterRedisDAO rateLimiterRedisDAO; + + public RateLimiterAspect(List keyResolvers, RateLimiterRedisDAO rateLimiterRedisDAO) { + this.keyResolvers = CollectionUtils.convertMap(keyResolvers, RateLimiterKeyResolver::getClass); + this.rateLimiterRedisDAO = rateLimiterRedisDAO; + } + + @Before("@annotation(rateLimiter)") + public void beforePointCut(JoinPoint joinPoint, RateLimiter rateLimiter) { + // 获得 IdempotentKeyResolver 对象 + RateLimiterKeyResolver keyResolver = keyResolvers.get(rateLimiter.keyResolver()); + Assert.notNull(keyResolver, "找不到对应的 RateLimiterKeyResolver"); + // 解析 Key + String key = keyResolver.resolver(joinPoint, rateLimiter); + + // 获取 1 次限流 + boolean success = rateLimiterRedisDAO.tryAcquire(key, + rateLimiter.count(), rateLimiter.time(), rateLimiter.timeUnit()); + if (!success) { + log.info("[beforePointCut][方法({}) 参数({}) 请求过于频繁]", joinPoint.getSignature().toString(), joinPoint.getArgs()); + String message = StrUtil.blankToDefault(rateLimiter.message(), + GlobalErrorCodeConstants.TOO_MANY_REQUESTS.getMsg()); + throw new ServiceException(GlobalErrorCodeConstants.TOO_MANY_REQUESTS.getCode(), message); + } + } + +} + diff --git a/marketing-framework/marketing-spring-boot-starter-protection/src/main/java/com/platform/marketing/framework/ratelimiter/core/keyresolver/RateLimiterKeyResolver.java b/marketing-framework/marketing-spring-boot-starter-protection/src/main/java/com/platform/marketing/framework/ratelimiter/core/keyresolver/RateLimiterKeyResolver.java new file mode 100644 index 0000000..cf159df --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-protection/src/main/java/com/platform/marketing/framework/ratelimiter/core/keyresolver/RateLimiterKeyResolver.java @@ -0,0 +1,22 @@ +package com.platform.marketing.framework.ratelimiter.core.keyresolver; + +import com.platform.marketing.framework.ratelimiter.core.annotation.RateLimiter; +import org.aspectj.lang.JoinPoint; + +/** + * 限流 Key 解析器接口 + * + + */ +public interface RateLimiterKeyResolver { + + /** + * 解析一个 Key + * + * @param rateLimiter 限流注解 + * @param joinPoint AOP 切面 + * @return Key + */ + String resolver(JoinPoint joinPoint, RateLimiter rateLimiter); + +} diff --git a/marketing-framework/marketing-spring-boot-starter-protection/src/main/java/com/platform/marketing/framework/ratelimiter/core/keyresolver/impl/ClientIpRateLimiterKeyResolver.java b/marketing-framework/marketing-spring-boot-starter-protection/src/main/java/com/platform/marketing/framework/ratelimiter/core/keyresolver/impl/ClientIpRateLimiterKeyResolver.java new file mode 100644 index 0000000..0aefdc2 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-protection/src/main/java/com/platform/marketing/framework/ratelimiter/core/keyresolver/impl/ClientIpRateLimiterKeyResolver.java @@ -0,0 +1,27 @@ +package com.platform.marketing.framework.ratelimiter.core.keyresolver.impl; + +import cn.hutool.core.util.StrUtil; +import cn.hutool.crypto.SecureUtil; +import com.platform.marketing.framework.common.util.servlet.ServletUtils; +import com.platform.marketing.framework.ratelimiter.core.annotation.RateLimiter; +import com.platform.marketing.framework.ratelimiter.core.keyresolver.RateLimiterKeyResolver; +import org.aspectj.lang.JoinPoint; + +/** + * IP 级别的限流 Key 解析器,使用方法名 + 方法参数 + IP,组装成一个 Key + * + * 为了避免 Key 过长,使用 MD5 进行“压缩” + * + + */ +public class ClientIpRateLimiterKeyResolver implements RateLimiterKeyResolver { + + @Override + public String resolver(JoinPoint joinPoint, RateLimiter rateLimiter) { + String methodName = joinPoint.getSignature().toString(); + String argsStr = StrUtil.join(",", joinPoint.getArgs()); + String clientIp = ServletUtils.getClientIP(); + return SecureUtil.md5(methodName + argsStr + clientIp); + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-protection/src/main/java/com/platform/marketing/framework/ratelimiter/core/keyresolver/impl/DefaultRateLimiterKeyResolver.java b/marketing-framework/marketing-spring-boot-starter-protection/src/main/java/com/platform/marketing/framework/ratelimiter/core/keyresolver/impl/DefaultRateLimiterKeyResolver.java new file mode 100644 index 0000000..d17b608 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-protection/src/main/java/com/platform/marketing/framework/ratelimiter/core/keyresolver/impl/DefaultRateLimiterKeyResolver.java @@ -0,0 +1,25 @@ +package com.platform.marketing.framework.ratelimiter.core.keyresolver.impl; + +import cn.hutool.core.util.StrUtil; +import cn.hutool.crypto.SecureUtil; +import com.platform.marketing.framework.ratelimiter.core.annotation.RateLimiter; +import com.platform.marketing.framework.ratelimiter.core.keyresolver.RateLimiterKeyResolver; +import org.aspectj.lang.JoinPoint; + +/** + * 默认(全局级别)限流 Key 解析器,使用方法名 + 方法参数,组装成一个 Key + * + * 为了避免 Key 过长,使用 MD5 进行“压缩” + * + + */ +public class DefaultRateLimiterKeyResolver implements RateLimiterKeyResolver { + + @Override + public String resolver(JoinPoint joinPoint, RateLimiter rateLimiter) { + String methodName = joinPoint.getSignature().toString(); + String argsStr = StrUtil.join(",", joinPoint.getArgs()); + return SecureUtil.md5(methodName + argsStr); + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-protection/src/main/java/com/platform/marketing/framework/ratelimiter/core/keyresolver/impl/ExpressionRateLimiterKeyResolver.java b/marketing-framework/marketing-spring-boot-starter-protection/src/main/java/com/platform/marketing/framework/ratelimiter/core/keyresolver/impl/ExpressionRateLimiterKeyResolver.java new file mode 100644 index 0000000..05fbb2f --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-protection/src/main/java/com/platform/marketing/framework/ratelimiter/core/keyresolver/impl/ExpressionRateLimiterKeyResolver.java @@ -0,0 +1,64 @@ +package com.platform.marketing.framework.ratelimiter.core.keyresolver.impl; + +import cn.hutool.core.util.ArrayUtil; +import com.platform.marketing.framework.ratelimiter.core.annotation.RateLimiter; +import com.platform.marketing.framework.ratelimiter.core.keyresolver.RateLimiterKeyResolver; +import org.aspectj.lang.JoinPoint; +import org.aspectj.lang.reflect.MethodSignature; +import org.springframework.core.DefaultParameterNameDiscoverer; +import org.springframework.core.ParameterNameDiscoverer; +import org.springframework.expression.Expression; +import org.springframework.expression.ExpressionParser; +import org.springframework.expression.spel.standard.SpelExpressionParser; +import org.springframework.expression.spel.support.StandardEvaluationContext; + +import java.lang.reflect.Method; + +/** + * 基于 Spring EL 表达式的 {@link RateLimiterKeyResolver} 实现类 + * + + */ +public class ExpressionRateLimiterKeyResolver implements RateLimiterKeyResolver { + + private final ParameterNameDiscoverer parameterNameDiscoverer = new DefaultParameterNameDiscoverer(); + + private final ExpressionParser expressionParser = new SpelExpressionParser(); + + @Override + public String resolver(JoinPoint joinPoint, RateLimiter rateLimiter) { + // 获得被拦截方法参数名列表 + Method method = getMethod(joinPoint); + Object[] args = joinPoint.getArgs(); + String[] parameterNames = this.parameterNameDiscoverer.getParameterNames(method); + // 准备 Spring EL 表达式解析的上下文 + StandardEvaluationContext evaluationContext = new StandardEvaluationContext(); + if (ArrayUtil.isNotEmpty(parameterNames)) { + for (int i = 0; i < parameterNames.length; i++) { + evaluationContext.setVariable(parameterNames[i], args[i]); + } + } + + // 解析参数 + Expression expression = expressionParser.parseExpression(rateLimiter.keyArg()); + return expression.getValue(evaluationContext, String.class); + } + + private static Method getMethod(JoinPoint point) { + // 处理,声明在类上的情况 + MethodSignature signature = (MethodSignature) point.getSignature(); + Method method = signature.getMethod(); + if (!method.getDeclaringClass().isInterface()) { + return method; + } + + // 处理,声明在接口上的情况 + try { + return point.getTarget().getClass().getDeclaredMethod( + point.getSignature().getName(), method.getParameterTypes()); + } catch (NoSuchMethodException e) { + throw new RuntimeException(e); + } + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-protection/src/main/java/com/platform/marketing/framework/ratelimiter/core/keyresolver/impl/ServerNodeRateLimiterKeyResolver.java b/marketing-framework/marketing-spring-boot-starter-protection/src/main/java/com/platform/marketing/framework/ratelimiter/core/keyresolver/impl/ServerNodeRateLimiterKeyResolver.java new file mode 100644 index 0000000..403ff58 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-protection/src/main/java/com/platform/marketing/framework/ratelimiter/core/keyresolver/impl/ServerNodeRateLimiterKeyResolver.java @@ -0,0 +1,27 @@ +package com.platform.marketing.framework.ratelimiter.core.keyresolver.impl; + +import cn.hutool.core.util.StrUtil; +import cn.hutool.crypto.SecureUtil; +import cn.hutool.system.SystemUtil; +import com.platform.marketing.framework.ratelimiter.core.annotation.RateLimiter; +import com.platform.marketing.framework.ratelimiter.core.keyresolver.RateLimiterKeyResolver; +import org.aspectj.lang.JoinPoint; + +/** + * Server 节点级别的限流 Key 解析器,使用方法名 + 方法参数 + IP,组装成一个 Key + * + * 为了避免 Key 过长,使用 MD5 进行“压缩” + * + + */ +public class ServerNodeRateLimiterKeyResolver implements RateLimiterKeyResolver { + + @Override + public String resolver(JoinPoint joinPoint, RateLimiter rateLimiter) { + String methodName = joinPoint.getSignature().toString(); + String argsStr = StrUtil.join(",", joinPoint.getArgs()); + String serverNode = String.format("%s@%d", SystemUtil.getHostInfo().getAddress(), SystemUtil.getCurrentPID()); + return SecureUtil.md5(methodName + argsStr + serverNode); + } + +} \ No newline at end of file diff --git a/marketing-framework/marketing-spring-boot-starter-protection/src/main/java/com/platform/marketing/framework/ratelimiter/core/keyresolver/impl/UserRateLimiterKeyResolver.java b/marketing-framework/marketing-spring-boot-starter-protection/src/main/java/com/platform/marketing/framework/ratelimiter/core/keyresolver/impl/UserRateLimiterKeyResolver.java new file mode 100644 index 0000000..5cc939f --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-protection/src/main/java/com/platform/marketing/framework/ratelimiter/core/keyresolver/impl/UserRateLimiterKeyResolver.java @@ -0,0 +1,28 @@ +package com.platform.marketing.framework.ratelimiter.core.keyresolver.impl; + +import cn.hutool.core.util.StrUtil; +import cn.hutool.crypto.SecureUtil; +import com.platform.marketing.framework.ratelimiter.core.annotation.RateLimiter; +import com.platform.marketing.framework.ratelimiter.core.keyresolver.RateLimiterKeyResolver; +import com.platform.marketing.framework.web.core.util.WebFrameworkUtils; +import org.aspectj.lang.JoinPoint; + +/** + * 用户级别的限流 Key 解析器,使用方法名 + 方法参数 + userId + userType,组装成一个 Key + * + * 为了避免 Key 过长,使用 MD5 进行“压缩” + * + + */ +public class UserRateLimiterKeyResolver implements RateLimiterKeyResolver { + + @Override + public String resolver(JoinPoint joinPoint, RateLimiter rateLimiter) { + String methodName = joinPoint.getSignature().toString(); + String argsStr = StrUtil.join(",", joinPoint.getArgs()); + Long userId = WebFrameworkUtils.getLoginUserId(); + Integer userType = WebFrameworkUtils.getLoginUserType(); + return SecureUtil.md5(methodName + argsStr + userId + userType); + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-protection/src/main/java/com/platform/marketing/framework/ratelimiter/core/redis/RateLimiterRedisDAO.java b/marketing-framework/marketing-spring-boot-starter-protection/src/main/java/com/platform/marketing/framework/ratelimiter/core/redis/RateLimiterRedisDAO.java new file mode 100644 index 0000000..544254f --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-protection/src/main/java/com/platform/marketing/framework/ratelimiter/core/redis/RateLimiterRedisDAO.java @@ -0,0 +1,62 @@ +package com.platform.marketing.framework.ratelimiter.core.redis; + +import lombok.AllArgsConstructor; +import org.redisson.api.*; + +import java.util.Objects; +import java.util.concurrent.TimeUnit; + +/** + * 限流 Redis DAO + * + + */ +@AllArgsConstructor +public class RateLimiterRedisDAO { + + /** + * 限流操作 + * + * KEY 格式:rate_limiter:%s // 参数为 uuid + * VALUE 格式:String + * 过期时间:不固定 + */ + private static final String RATE_LIMITER = "rate_limiter:%s"; + + private final RedissonClient redissonClient; + + public Boolean tryAcquire(String key, int count, int time, TimeUnit timeUnit) { + // 1. 获得 RRateLimiter,并设置 rate 速率 + RRateLimiter rateLimiter = getRRateLimiter(key, count, time, timeUnit); + // 2. 尝试获取 1 个 + return rateLimiter.tryAcquire(); + } + + private static String formatKey(String key) { + return String.format(RATE_LIMITER, key); + } + + private RRateLimiter getRRateLimiter(String key, long count, int time, TimeUnit timeUnit) { + String redisKey = formatKey(key); + RRateLimiter rateLimiter = redissonClient.getRateLimiter(redisKey); + long rateInterval = timeUnit.toSeconds(time); + // 1. 如果不存在,设置 rate 速率 + RateLimiterConfig config = rateLimiter.getConfig(); + if (config == null) { + rateLimiter.trySetRate(RateType.OVERALL, count, rateInterval, RateIntervalUnit.SECONDS); + rateLimiter.expire(rateInterval, TimeUnit.SECONDS); + return rateLimiter; + } + // 2. 如果存在,并且配置相同,则直接返回 + if (config.getRateType() == RateType.OVERALL + && Objects.equals(config.getRate(), count) + && Objects.equals(config.getRateInterval(), TimeUnit.SECONDS.toMillis(rateInterval))) { + return rateLimiter; + } + // 3. 如果存在,并且配置不同,则进行新建 + rateLimiter.setRate(RateType.OVERALL, count, rateInterval, RateIntervalUnit.SECONDS); + rateLimiter.expire(rateInterval, TimeUnit.SECONDS); + return rateLimiter; + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-protection/src/main/java/com/platform/marketing/framework/signature/config/MarketingApiSignatureAutoConfiguration.java b/marketing-framework/marketing-spring-boot-starter-protection/src/main/java/com/platform/marketing/framework/signature/config/MarketingApiSignatureAutoConfiguration.java new file mode 100644 index 0000000..f74b5a5 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-protection/src/main/java/com/platform/marketing/framework/signature/config/MarketingApiSignatureAutoConfiguration.java @@ -0,0 +1,28 @@ +package com.platform.marketing.framework.signature.config; + +import com.platform.marketing.framework.redis.config.MarketingRedisAutoConfiguration; +import com.platform.marketing.framework.signature.core.aop.ApiSignatureAspect; +import com.platform.marketing.framework.signature.core.redis.ApiSignatureRedisDAO; +import org.springframework.boot.autoconfigure.AutoConfiguration; +import org.springframework.context.annotation.Bean; +import org.springframework.data.redis.core.StringRedisTemplate; + +/** + * HTTP API 签名的自动配置类 + * + * @author Zhougang + */ +@AutoConfiguration(after = MarketingRedisAutoConfiguration.class) +public class MarketingApiSignatureAutoConfiguration { + + @Bean + public ApiSignatureAspect signatureAspect(ApiSignatureRedisDAO signatureRedisDAO) { + return new ApiSignatureAspect(signatureRedisDAO); + } + + @Bean + public ApiSignatureRedisDAO signatureRedisDAO(StringRedisTemplate stringRedisTemplate) { + return new ApiSignatureRedisDAO(stringRedisTemplate); + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-protection/src/main/java/com/platform/marketing/framework/signature/core/annotation/ApiSignature.java b/marketing-framework/marketing-spring-boot-starter-protection/src/main/java/com/platform/marketing/framework/signature/core/annotation/ApiSignature.java new file mode 100644 index 0000000..80f89eb --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-protection/src/main/java/com/platform/marketing/framework/signature/core/annotation/ApiSignature.java @@ -0,0 +1,59 @@ +package com.platform.marketing.framework.signature.core.annotation; + +import com.platform.marketing.framework.common.exception.enums.GlobalErrorCodeConstants; + +import java.lang.annotation.*; +import java.util.concurrent.TimeUnit; + + +/** + * HTTP API 签名注解 + * + * @author Zhougang + */ +@Inherited +@Documented +@Target({ElementType.METHOD, ElementType.TYPE}) +@Retention(RetentionPolicy.RUNTIME) +public @interface ApiSignature { + + /** + * 同一个请求多长时间内有效 默认 60 秒 + */ + int timeout() default 60; + + /** + * 时间单位,默认为 SECONDS 秒 + */ + TimeUnit timeUnit() default TimeUnit.SECONDS; + + // ========================== 签名参数 ========================== + + /** + * 提示信息,签名失败的提示 + * + * @see GlobalErrorCodeConstants#BAD_REQUEST + */ + String message() default "签名不正确"; // 为空时,使用 BAD_REQUEST 错误提示 + + /** + * 签名字段:appId 应用ID + */ + String appId() default "appId"; + + /** + * 签名字段:timestamp 时间戳 + */ + String timestamp() default "timestamp"; + + /** + * 签名字段:nonce 随机数,10 位以上 + */ + String nonce() default "nonce"; + + /** + * sign 客户端签名 + */ + String sign() default "sign"; + +} diff --git a/marketing-framework/marketing-spring-boot-starter-protection/src/main/java/com/platform/marketing/framework/signature/core/aop/ApiSignatureAspect.java b/marketing-framework/marketing-spring-boot-starter-protection/src/main/java/com/platform/marketing/framework/signature/core/aop/ApiSignatureAspect.java new file mode 100644 index 0000000..b30493e --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-protection/src/main/java/com/platform/marketing/framework/signature/core/aop/ApiSignatureAspect.java @@ -0,0 +1,168 @@ +package com.platform.marketing.framework.signature.core.aop; + +import cn.hutool.core.lang.Assert; +import cn.hutool.core.map.MapUtil; +import cn.hutool.core.util.ObjUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.crypto.digest.DigestUtil; +import com.platform.marketing.framework.common.exception.ServiceException; +import com.platform.marketing.framework.common.util.servlet.ServletUtils; +import com.platform.marketing.framework.signature.core.annotation.ApiSignature; +import com.platform.marketing.framework.signature.core.redis.ApiSignatureRedisDAO; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.aspectj.lang.JoinPoint; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Before; + +import javax.servlet.http.HttpServletRequest; +import java.util.Map; +import java.util.Objects; +import java.util.SortedMap; +import java.util.TreeMap; + +import static com.platform.marketing.framework.common.exception.enums.GlobalErrorCodeConstants.BAD_REQUEST; + +/** + * 拦截声明了 {@link ApiSignature} 注解的方法,实现签名 + * + * @author Zhougang + */ +@Aspect +@Slf4j +@AllArgsConstructor +public class ApiSignatureAspect { + + private final ApiSignatureRedisDAO signatureRedisDAO; + + @Before("@annotation(signature)") + public void beforePointCut(JoinPoint joinPoint, ApiSignature signature) { + // 1. 验证通过,直接结束 + if (verifySignature(signature, Objects.requireNonNull(ServletUtils.getRequest()))) { + return; + } + + // 2. 验证不通过,抛出异常 + log.error("[beforePointCut][方法{} 参数({}) 签名失败]", joinPoint.getSignature().toString(), + joinPoint.getArgs()); + throw new ServiceException(BAD_REQUEST.getCode(), + StrUtil.blankToDefault(signature.message(), BAD_REQUEST.getMsg())); + } + + public boolean verifySignature(ApiSignature signature, HttpServletRequest request) { + // 1.1 校验 Header + if (!verifyHeaders(signature, request)) { + return false; + } + // 1.2 校验 appId 是否能获取到对应的 appSecret + String appId = request.getHeader(signature.appId()); + String appSecret = signatureRedisDAO.getAppSecret(appId); + Assert.notNull(appSecret, "[appId({})] 找不到对应的 appSecret", appId); + + // 2. 校验签名【重要!】 + String clientSignature = request.getHeader(signature.sign()); // 客户端签名 + String serverSignatureString = buildSignatureString(signature, request, appSecret); // 服务端签名字符串 + String serverSignature = DigestUtil.sha256Hex(serverSignatureString); // 服务端签名 + if (ObjUtil.notEqual(clientSignature, serverSignature)) { + return false; + } + + // 3. 将 nonce 记入缓存,防止重复使用(重点二:此处需要将 ttl 设定为允许 timestamp 时间差的值 x 2 ) + String nonce = request.getHeader(signature.nonce()); + signatureRedisDAO.setNonce(appId, nonce, signature.timeout() * 2, signature.timeUnit()); + return true; + } + + /** + * 校验请求头加签参数 + * + * 1. appId 是否为空 + * 2. timestamp 是否为空,请求是否已经超时,默认 10 分钟 + * 3. nonce 是否为空,随机数是否 10 位以上,是否在规定时间内已经访问过了 + * 4. sign 是否为空 + * + * @param signature signature + * @param request request + * @return 是否校验 Header 通过 + */ + private boolean verifyHeaders(ApiSignature signature, HttpServletRequest request) { + // 1. 非空校验 + String appId = request.getHeader(signature.appId()); + if (StrUtil.isBlank(appId)) { + return false; + } + String timestamp = request.getHeader(signature.timestamp()); + if (StrUtil.isBlank(timestamp)) { + return false; + } + String nonce = request.getHeader(signature.nonce()); + if (StrUtil.length(nonce) < 10) { + return false; + } + String sign = request.getHeader(signature.sign()); + if (StrUtil.isBlank(sign)) { + return false; + } + + // 2. 检查 timestamp 是否超出允许的范围 (重点一:此处需要取绝对值) + long expireTime = signature.timeUnit().toMillis(signature.timeout()); + long requestTimestamp = Long.parseLong(timestamp); + long timestampDisparity = Math.abs(System.currentTimeMillis() - requestTimestamp); + if (timestampDisparity > expireTime) { + return false; + } + + // 3. 检查 nonce 是否存在,有且仅能使用一次 + return signatureRedisDAO.getNonce(appId, nonce) == null; + } + + /** + * 构建签名字符串 + * + * 格式为 = 请求参数 + 请求体 + 请求头 + 密钥 + * + * @param signature signature + * @param request request + * @param appSecret appSecret + * @return 签名字符串 + */ + private String buildSignatureString(ApiSignature signature, HttpServletRequest request, String appSecret) { + SortedMap parameterMap = getRequestParameterMap(request); // 请求头 + SortedMap headerMap = getRequestHeaderMap(signature, request); // 请求参数 + String requestBody = StrUtil.nullToDefault(ServletUtils.getBody(request), ""); // 请求体 + return MapUtil.join(parameterMap, "&", "=") + + requestBody + + MapUtil.join(headerMap, "&", "=") + + appSecret; + } + + /** + * 获取请求头加签参数 Map + * + * @param request 请求 + * @param signature 签名注解 + * @return signature params + */ + private static SortedMap getRequestHeaderMap(ApiSignature signature, HttpServletRequest request) { + SortedMap sortedMap = new TreeMap<>(); + sortedMap.put(signature.appId(), request.getHeader(signature.appId())); + sortedMap.put(signature.timestamp(), request.getHeader(signature.timestamp())); + sortedMap.put(signature.nonce(), request.getHeader(signature.nonce())); + return sortedMap; + } + + /** + * 获取请求参数 Map + * + * @param request 请求 + * @return queryParams + */ + private static SortedMap getRequestParameterMap(HttpServletRequest request) { + SortedMap sortedMap = new TreeMap<>(); + for (Map.Entry entry : request.getParameterMap().entrySet()) { + sortedMap.put(entry.getKey(), entry.getValue()[0]); + } + return sortedMap; + } + +} \ No newline at end of file diff --git a/marketing-framework/marketing-spring-boot-starter-protection/src/main/java/com/platform/marketing/framework/signature/core/redis/ApiSignatureRedisDAO.java b/marketing-framework/marketing-spring-boot-starter-protection/src/main/java/com/platform/marketing/framework/signature/core/redis/ApiSignatureRedisDAO.java new file mode 100644 index 0000000..a3d4b69 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-protection/src/main/java/com/platform/marketing/framework/signature/core/redis/ApiSignatureRedisDAO.java @@ -0,0 +1,57 @@ +package com.platform.marketing.framework.signature.core.redis; + +import lombok.AllArgsConstructor; +import org.springframework.data.redis.core.StringRedisTemplate; + +import java.util.concurrent.TimeUnit; + +/** + * HTTP API 签名 Redis DAO + * + * @author Zhougang + */ +@AllArgsConstructor +public class ApiSignatureRedisDAO { + + private final StringRedisTemplate stringRedisTemplate; + + /** + * 验签随机数 + * + * KEY 格式:signature_nonce:%s // 参数为 随机数 + * VALUE 格式:String + * 过期时间:不固定 + */ + private static final String SIGNATURE_NONCE = "api_signature_nonce:%s:%s"; + + /** + * 签名密钥 + * + * HASH 结构 + * KEY 格式:%s // 参数为 appid + * VALUE 格式:String + * 过期时间:永不过期(预加载到 Redis) + */ + private static final String SIGNATURE_APPID = "api_signature_app"; + + // ========== 验签随机数 ========== + + public String getNonce(String appId, String nonce) { + return stringRedisTemplate.opsForValue().get(formatNonceKey(appId, nonce)); + } + + public void setNonce(String appId, String nonce, int time, TimeUnit timeUnit) { + stringRedisTemplate.opsForValue().set(formatNonceKey(appId, nonce), "", time, timeUnit); + } + + private static String formatNonceKey(String appId, String nonce) { + return String.format(SIGNATURE_NONCE, appId, nonce); + } + + // ========== 签名密钥 ========== + + public String getAppSecret(String appId) { + return (String) stringRedisTemplate.opsForHash().get(SIGNATURE_APPID, appId); + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-protection/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/marketing-framework/marketing-spring-boot-starter-protection/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 0000000..7721fcf --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-protection/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1,4 @@ +com.platform.marketing.framework.idempotent.config.MarketingIdempotentConfiguration +com.platform.marketing.framework.lock4j.config.MarketingLock4jConfiguration +com.platform.marketing.framework.ratelimiter.config.MarketingRateLimiterConfiguration +com.platform.marketing.framework.signature.config.MarketingApiSignatureAutoConfiguration \ No newline at end of file diff --git a/marketing-framework/marketing-spring-boot-starter-redis/.flattened-pom.xml b/marketing-framework/marketing-spring-boot-starter-redis/.flattened-pom.xml new file mode 100644 index 0000000..065700a --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-redis/.flattened-pom.xml @@ -0,0 +1,81 @@ + + + 4.0.0 + com.platform + marketing-spring-boot-starter-redis + 0.0.1-jdk8-SNAPSHOT + marketing-spring-boot-starter-redis + Redis 封装拓展 + https://github.com/makemyownlife/platform-sms-pro + + + com.platform + marketing-common + 0.0.1-jdk8-SNAPSHOT + compile + + + org.redisson + redisson-spring-boot-starter + 3.41.0 + compile + + + org.springframework.boot + spring-boot-starter-actuator + + + org.redisson + redisson-spring-data-34 + + + + + org.redisson + redisson-spring-data-27 + 3.41.0 + compile + + + org.springframework.boot + spring-boot-starter-cache + 2.7.18 + compile + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + 2.13.5 + compile + + + + + huaweicloud + huawei + https://mirrors.huaweicloud.com/repository/maven/ + + + aliyunmaven + aliyun + https://maven.aliyun.com/repository/public + + + + false + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + + + false + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + + diff --git a/marketing-framework/marketing-spring-boot-starter-redis/pom.xml b/marketing-framework/marketing-spring-boot-starter-redis/pom.xml new file mode 100644 index 0000000..4cec3c9 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-redis/pom.xml @@ -0,0 +1,47 @@ + + + + com.platform + marketing-framework + ${revision} + + 4.0.0 + marketing-spring-boot-starter-redis + jar + + ${project.artifactId} + Redis 封装拓展 + https://github.com/makemyownlife/platform-sms-pro + + + + com.platform + marketing-common + + + + + org.redisson + redisson-spring-boot-starter + + + + org.redisson + redisson-spring-data-27 + + + + org.springframework.boot + spring-boot-starter-cache + + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + + + + + diff --git a/marketing-framework/marketing-spring-boot-starter-redis/src/main/java/com/platform/marketing/framework/redis/config/MarketingCacheAutoConfiguration.java b/marketing-framework/marketing-spring-boot-starter-redis/src/main/java/com/platform/marketing/framework/redis/config/MarketingCacheAutoConfiguration.java new file mode 100644 index 0000000..4a246e0 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-redis/src/main/java/com/platform/marketing/framework/redis/config/MarketingCacheAutoConfiguration.java @@ -0,0 +1,82 @@ +package com.platform.marketing.framework.redis.config; + +import cn.hutool.core.util.StrUtil; +import com.platform.marketing.framework.redis.core.TimeoutRedisCacheManager; +import org.springframework.boot.autoconfigure.AutoConfiguration; +import org.springframework.boot.autoconfigure.cache.CacheProperties; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.cache.annotation.EnableCaching; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Primary; +import org.springframework.data.redis.cache.BatchStrategies; +import org.springframework.data.redis.cache.RedisCacheConfiguration; +import org.springframework.data.redis.cache.RedisCacheManager; +import org.springframework.data.redis.cache.RedisCacheWriter; +import org.springframework.data.redis.connection.RedisConnectionFactory; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.data.redis.serializer.RedisSerializationContext; +import org.springframework.util.StringUtils; + +import java.util.Objects; + +import static com.platform.marketing.framework.redis.config.MarketingRedisAutoConfiguration.buildRedisSerializer; + +/** + * Cache 配置类,基于 Redis 实现 + */ +@AutoConfiguration +@EnableConfigurationProperties({CacheProperties.class, MarketingCacheProperties.class}) +@EnableCaching +public class MarketingCacheAutoConfiguration { + + /** + * RedisCacheConfiguration Bean + *

+ * 参考 org.springframework.boot.autoconfigure.cache.RedisCacheConfiguration 的 createConfiguration 方法 + */ + @Bean + @Primary + public RedisCacheConfiguration redisCacheConfiguration(CacheProperties cacheProperties) { + RedisCacheConfiguration config = RedisCacheConfiguration.defaultCacheConfig(); + // 设置使用 : 单冒号,而不是双 :: 冒号,避免 Redis Desktop Manager 多余空格 + // 详细可见 https://blog.csdn.net/chuixue24/article/details/103928965 博客 + // 再次修复单冒号,而不是双 :: 冒号问题,Issues 详情:https://gitee.com/zhijiantianya/marketing-cloud/issues/I86VY2 + config = config.computePrefixWith(cacheName -> { + String keyPrefix = cacheProperties.getRedis().getKeyPrefix(); + if (StringUtils.hasText(keyPrefix)) { + keyPrefix = keyPrefix.lastIndexOf(StrUtil.COLON) == -1 ? keyPrefix + StrUtil.COLON : keyPrefix; + return keyPrefix + cacheName + StrUtil.COLON; + } + return cacheName + StrUtil.COLON; + }); + // 设置使用 JSON 序列化方式 + config = config.serializeValuesWith( + RedisSerializationContext.SerializationPair.fromSerializer(buildRedisSerializer())); + + // 设置 CacheProperties.Redis 的属性 + CacheProperties.Redis redisProperties = cacheProperties.getRedis(); + if (redisProperties.getTimeToLive() != null) { + config = config.entryTtl(redisProperties.getTimeToLive()); + } + if (!redisProperties.isCacheNullValues()) { + config = config.disableCachingNullValues(); + } + if (!redisProperties.isUseKeyPrefix()) { + config = config.disableKeyPrefix(); + } + return config; + } + + @Bean + public RedisCacheManager redisCacheManager(RedisTemplate redisTemplate, + RedisCacheConfiguration redisCacheConfiguration, + MarketingCacheProperties marketingCacheProperties) { + // 创建 RedisCacheWriter 对象 + RedisConnectionFactory connectionFactory = Objects.requireNonNull(redisTemplate.getConnectionFactory()); + RedisCacheWriter cacheWriter = RedisCacheWriter.nonLockingRedisCacheWriter(connectionFactory, + BatchStrategies.scan(marketingCacheProperties.getRedisScanBatchSize())); + // 创建 TenantRedisCacheManager 对象 + return new TimeoutRedisCacheManager(cacheWriter, redisCacheConfiguration); + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-redis/src/main/java/com/platform/marketing/framework/redis/config/MarketingCacheProperties.java b/marketing-framework/marketing-spring-boot-starter-redis/src/main/java/com/platform/marketing/framework/redis/config/MarketingCacheProperties.java new file mode 100644 index 0000000..4e5356d --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-redis/src/main/java/com/platform/marketing/framework/redis/config/MarketingCacheProperties.java @@ -0,0 +1,27 @@ +package com.platform.marketing.framework.redis.config; + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.validation.annotation.Validated; + +/** + * Cache 配置项 + * + * @author Wanwan + */ +@ConfigurationProperties("marketing.cache") +@Data +@Validated +public class MarketingCacheProperties { + + /** + * {@link #redisScanBatchSize} 默认值 + */ + private static final Integer REDIS_SCAN_BATCH_SIZE_DEFAULT = 30; + + /** + * redis scan 一次返回数量 + */ + private Integer redisScanBatchSize = REDIS_SCAN_BATCH_SIZE_DEFAULT; + +} diff --git a/marketing-framework/marketing-spring-boot-starter-redis/src/main/java/com/platform/marketing/framework/redis/config/MarketingRedisAutoConfiguration.java b/marketing-framework/marketing-spring-boot-starter-redis/src/main/java/com/platform/marketing/framework/redis/config/MarketingRedisAutoConfiguration.java new file mode 100644 index 0000000..eb58911 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-redis/src/main/java/com/platform/marketing/framework/redis/config/MarketingRedisAutoConfiguration.java @@ -0,0 +1,45 @@ +package com.platform.marketing.framework.redis.config; + +import cn.hutool.core.util.ReflectUtil; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +import org.redisson.spring.starter.RedissonAutoConfiguration; +import org.springframework.boot.autoconfigure.AutoConfiguration; +import org.springframework.context.annotation.Bean; +import org.springframework.data.redis.connection.RedisConnectionFactory; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.data.redis.serializer.RedisSerializer; + +/** + * Redis 配置类 + */ +@AutoConfiguration(before = RedissonAutoConfiguration.class) // 目的:使用自己定义的 RedisTemplate Bean +public class MarketingRedisAutoConfiguration { + + /** + * 创建 RedisTemplate Bean,使用 JSON 序列化方式 + */ + @Bean + public RedisTemplate redisTemplate(RedisConnectionFactory factory) { + // 创建 RedisTemplate 对象 + RedisTemplate template = new RedisTemplate<>(); + // 设置 RedisConnection 工厂。😈 它就是实现多种 Java Redis 客户端接入的秘密工厂。感兴趣的胖友,可以自己去撸下。 + template.setConnectionFactory(factory); + // 使用 String 序列化方式,序列化 KEY 。 + template.setKeySerializer(RedisSerializer.string()); + template.setHashKeySerializer(RedisSerializer.string()); + // 使用 JSON 序列化方式(库是 Jackson ),序列化 VALUE 。 + template.setValueSerializer(buildRedisSerializer()); + template.setHashValueSerializer(buildRedisSerializer()); + return template; + } + + public static RedisSerializer buildRedisSerializer() { + RedisSerializer json = RedisSerializer.json(); + // 解决 LocalDateTime 的序列化 + ObjectMapper objectMapper = (ObjectMapper) ReflectUtil.getFieldValue(json, "mapper"); + objectMapper.registerModules(new JavaTimeModule()); + return json; + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-redis/src/main/java/com/platform/marketing/framework/redis/core/TimeoutRedisCacheManager.java b/marketing-framework/marketing-spring-boot-starter-redis/src/main/java/com/platform/marketing/framework/redis/core/TimeoutRedisCacheManager.java new file mode 100644 index 0000000..387f878 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-redis/src/main/java/com/platform/marketing/framework/redis/core/TimeoutRedisCacheManager.java @@ -0,0 +1,86 @@ +package com.platform.marketing.framework.redis.core; + +import cn.hutool.core.util.NumberUtil; +import cn.hutool.core.util.StrUtil; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.data.redis.cache.RedisCache; +import org.springframework.data.redis.cache.RedisCacheConfiguration; +import org.springframework.data.redis.cache.RedisCacheManager; +import org.springframework.data.redis.cache.RedisCacheWriter; + +import java.time.Duration; + +/** + * 支持自定义过期时间的 {@link RedisCacheManager} 实现类 + * + * 在 {@link Cacheable#cacheNames()} 格式为 "key#ttl" 时,# 后面的 ttl 为过期时间。 + * 单位为最后一个字母(支持的单位有:d 天,h 小时,m 分钟,s 秒),默认单位为 s 秒 + * + + */ +public class TimeoutRedisCacheManager extends RedisCacheManager { + + private static final String SPLIT = "#"; + + public TimeoutRedisCacheManager(RedisCacheWriter cacheWriter, RedisCacheConfiguration defaultCacheConfiguration) { + super(cacheWriter, defaultCacheConfiguration); + } + + @Override + protected RedisCache createRedisCache(String name, RedisCacheConfiguration cacheConfig) { + if (StrUtil.isEmpty(name)) { + return super.createRedisCache(name, cacheConfig); + } + // 如果使用 # 分隔,大小不为 2,则说明不使用自定义过期时间 + String[] names = StrUtil.splitToArray(name, SPLIT); + if (names.length != 2) { + return super.createRedisCache(name, cacheConfig); + } + + // 核心:通过修改 cacheConfig 的过期时间,实现自定义过期时间 + if (cacheConfig != null) { + // 移除 # 后面的 : 以及后面的内容,避免影响解析 + String ttlStr = StrUtil.subBefore(names[1], StrUtil.COLON, false); // 获得 ttlStr 时间部分 + names[1] = StrUtil.subAfter(names[1], ttlStr, false); // 移除掉 ttlStr 时间部分 + // 解析时间 + Duration duration = parseDuration(ttlStr); + cacheConfig = cacheConfig.entryTtl(duration); + } + + // 创建 RedisCache 对象,需要忽略掉 ttlStr + return super.createRedisCache(names[0] + names[1], cacheConfig); + } + + /** + * 解析过期时间 Duration + * + * @param ttlStr 过期时间字符串 + * @return 过期时间 Duration + */ + private Duration parseDuration(String ttlStr) { + String timeUnit = StrUtil.subSuf(ttlStr, -1); + switch (timeUnit) { + case "d": + return Duration.ofDays(removeDurationSuffix(ttlStr)); + case "h": + return Duration.ofHours(removeDurationSuffix(ttlStr)); + case "m": + return Duration.ofMinutes(removeDurationSuffix(ttlStr)); + case "s": + return Duration.ofSeconds(removeDurationSuffix(ttlStr)); + default: + return Duration.ofSeconds(Long.parseLong(ttlStr)); + } + } + + /** + * 移除多余的后缀,返回具体的时间 + * + * @param ttlStr 过期时间字符串 + * @return 时间 + */ + private Long removeDurationSuffix(String ttlStr) { + return NumberUtil.parseLong(StrUtil.sub(ttlStr, 0, ttlStr.length() - 1)); + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-redis/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/marketing-framework/marketing-spring-boot-starter-redis/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 0000000..a32de6a --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-redis/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1,2 @@ +com.platform.marketing.framework.redis.config.MarketingRedisAutoConfiguration +com.platform.marketing.framework.redis.config.MarketingCacheAutoConfiguration \ No newline at end of file diff --git a/marketing-framework/marketing-spring-boot-starter-security/.flattened-pom.xml b/marketing-framework/marketing-spring-boot-starter-security/.flattened-pom.xml new file mode 100644 index 0000000..8791b2e --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-security/.flattened-pom.xml @@ -0,0 +1,84 @@ + + + 4.0.0 + com.platform + marketing-spring-boot-starter-security + 0.0.1-jdk8-SNAPSHOT + marketing-spring-boot-starter-security + 1. security:用户的认证、权限的校验,实现「谁」可以做「什么事」 + https://github.com/makemyownlife/platform-sms-pro + + + com.platform + marketing-common + 0.0.1-jdk8-SNAPSHOT + compile + + + org.springframework.boot + spring-boot-starter-aop + 2.7.18 + compile + + + com.platform + marketing-spring-boot-starter-web + 0.0.1-jdk8-SNAPSHOT + compile + + + com.platform + marketing-spring-boot-starter-token + 0.0.1-jdk8-SNAPSHOT + compile + + + org.springframework.boot + spring-boot-configuration-processor + 2.7.18 + compile + true + + + org.springframework.boot + spring-boot-starter-security + 2.7.18 + compile + + + com.google.guava + guava + 33.4.0-jre + compile + + + + + huaweicloud + huawei + https://mirrors.huaweicloud.com/repository/maven/ + + + aliyunmaven + aliyun + https://maven.aliyun.com/repository/public + + + + false + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + + + false + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + + diff --git a/marketing-framework/marketing-spring-boot-starter-security/pom.xml b/marketing-framework/marketing-spring-boot-starter-security/pom.xml new file mode 100644 index 0000000..489f3ec --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-security/pom.xml @@ -0,0 +1,67 @@ + + + + com.platform + marketing-framework + ${revision} + + + 4.0.0 + marketing-spring-boot-starter-security + jar + + ${project.artifactId} + + + 1. security:用户的认证、权限的校验,实现「谁」可以做「什么事」 + + + https://github.com/makemyownlife/platform-sms-pro + + + + com.platform + marketing-common + + + + + org.springframework.boot + spring-boot-starter-aop + + + + + com.platform + marketing-spring-boot-starter-web + + + + com.platform + marketing-spring-boot-starter-token + ${project.parent.version} + + + + + org.springframework.boot + spring-boot-configuration-processor + true + + + + org.springframework.boot + spring-boot-starter-security + + + + + com.google.guava + guava + + + + + diff --git a/marketing-framework/marketing-spring-boot-starter-security/src/main/java/com/platform/marketing/framework/security/config/AuthorizeRequestsCustomizer.java b/marketing-framework/marketing-spring-boot-starter-security/src/main/java/com/platform/marketing/framework/security/config/AuthorizeRequestsCustomizer.java new file mode 100644 index 0000000..3e1db03 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-security/src/main/java/com/platform/marketing/framework/security/config/AuthorizeRequestsCustomizer.java @@ -0,0 +1,32 @@ +package com.platform.marketing.framework.security.config; + +import com.platform.marketing.framework.web.config.WebProperties; +import org.springframework.core.Ordered; +import org.springframework.security.config.Customizer; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configurers.AuthorizeHttpRequestsConfigurer; + +import javax.annotation.Resource; + +/** + * 自定义的 URL 的安全配置 + * 目的:每个 Maven Module 可以自定义规则! + * + + */ +public abstract class AuthorizeRequestsCustomizer + implements Customizer.AuthorizationManagerRequestMatcherRegistry>, Ordered { + + @Resource + private WebProperties webProperties; + + protected String buildAdminApi(String url) { + return webProperties.getAdminApi().getPrefix() + url; + } + + @Override + public int getOrder() { + return 0; + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-security/src/main/java/com/platform/marketing/framework/security/config/MarketingSecurityAutoConfiguration.java b/marketing-framework/marketing-spring-boot-starter-security/src/main/java/com/platform/marketing/framework/security/config/MarketingSecurityAutoConfiguration.java new file mode 100644 index 0000000..3b1a122 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-security/src/main/java/com/platform/marketing/framework/security/config/MarketingSecurityAutoConfiguration.java @@ -0,0 +1,94 @@ +package com.platform.marketing.framework.security.config; + +import com.platform.marketing.framework.security.core.adapter.PermissionAdapter; +import com.platform.marketing.framework.security.core.context.TransmittableThreadLocalSecurityContextHolderStrategy; +import com.platform.marketing.framework.security.core.filter.TokenAuthenticationFilter; +import com.platform.marketing.framework.security.core.handler.AccessDeniedHandlerImpl; +import com.platform.marketing.framework.security.core.handler.AuthenticationEntryPointImpl; +import com.platform.marketing.framework.security.core.service.SecurityFrameworkService; +import com.platform.marketing.framework.security.core.service.impl.SecurityFrameworkServiceImpl; +import com.platform.marketing.framework.token.core.service.SecurityTokenService; +import com.platform.marketing.framework.web.core.handler.GlobalExceptionHandler; +import org.springframework.beans.factory.config.MethodInvokingFactoryBean; +import org.springframework.boot.autoconfigure.AutoConfiguration; +import org.springframework.boot.autoconfigure.AutoConfigureOrder; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.annotation.Bean; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; +import org.springframework.security.crypto.password.PasswordEncoder; +import org.springframework.security.web.AuthenticationEntryPoint; +import org.springframework.security.web.access.AccessDeniedHandler; + +import javax.annotation.Resource; + +/** + * Spring Security 自动配置类,主要用于相关组件的配置 + * + * 注意,不能和 {@link MarketingWebSecurityConfigurerAdapter} 用一个,原因是会导致初始化报错。 + * 参见 https://stackoverflow.com/questions/53847050/spring-boot-delegatebuilder-cannot-be-null-on-autowiring-authenticationmanager 文档。 + * + */ +@AutoConfiguration +@AutoConfigureOrder(-1) // 目的:先于 Spring Security 自动配置,避免一键改包后,org.* 基础包无法生效 +@EnableConfigurationProperties(SecurityProperties.class) +public class MarketingSecurityAutoConfiguration { + + @Resource + private SecurityProperties securityProperties; + + /** + * 认证失败处理类 Bean + */ + @Bean + public AuthenticationEntryPoint authenticationEntryPoint() { + return new AuthenticationEntryPointImpl(); + } + + /** + * 权限不够处理器 Bean + */ + @Bean + public AccessDeniedHandler accessDeniedHandler() { + return new AccessDeniedHandlerImpl(); + } + + /** + * Spring Security 加密器 + * 考虑到安全性,这里采用 BCryptPasswordEncoder 加密器 + * + * @see Password Encoding with Spring Security + */ + @Bean + public PasswordEncoder passwordEncoder() { + return new BCryptPasswordEncoder(securityProperties.getPasswordEncoderLength()); + } + + /** + * Token 认证过滤器 Bean + */ + @Bean + public TokenAuthenticationFilter authenticationTokenFilter(GlobalExceptionHandler globalExceptionHandler, + SecurityTokenService securityTokenService) { + return new TokenAuthenticationFilter(securityProperties, globalExceptionHandler, securityTokenService); + } + + @Bean("ss") // 使用 Spring Security 的缩写,方便使用 + public SecurityFrameworkService securityFrameworkService(PermissionAdapter permissionAdapter) { + return new SecurityFrameworkServiceImpl(permissionAdapter); + } + + /** + * 声明调用 {@link SecurityContextHolder#setStrategyName(String)} 方法, + * 设置使用 {@link TransmittableThreadLocalSecurityContextHolderStrategy} 作为 Security 的上下文策略 + */ + @Bean + public MethodInvokingFactoryBean securityContextHolderMethodInvokingFactoryBean() { + MethodInvokingFactoryBean methodInvokingFactoryBean = new MethodInvokingFactoryBean(); + methodInvokingFactoryBean.setTargetClass(SecurityContextHolder.class); + methodInvokingFactoryBean.setTargetMethod("setStrategyName"); + methodInvokingFactoryBean.setArguments(TransmittableThreadLocalSecurityContextHolderStrategy.class.getName()); + return methodInvokingFactoryBean; + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-security/src/main/java/com/platform/marketing/framework/security/config/MarketingWebSecurityConfigurerAdapter.java b/marketing-framework/marketing-spring-boot-starter-security/src/main/java/com/platform/marketing/framework/security/config/MarketingWebSecurityConfigurerAdapter.java new file mode 100644 index 0000000..2da0cf6 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-security/src/main/java/com/platform/marketing/framework/security/config/MarketingWebSecurityConfigurerAdapter.java @@ -0,0 +1,216 @@ +package com.platform.marketing.framework.security.config; + +import cn.hutool.core.collection.CollUtil; +import com.platform.marketing.framework.security.core.filter.TokenAuthenticationFilter; +import com.platform.marketing.framework.web.config.WebProperties; +import com.google.common.collect.HashMultimap; +import com.google.common.collect.Multimap; +import org.springframework.boot.autoconfigure.AutoConfiguration; +import org.springframework.boot.autoconfigure.AutoConfigureOrder; +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.Bean; +import org.springframework.http.HttpMethod; +import org.springframework.security.authentication.AuthenticationManager; +import org.springframework.security.config.Customizer; +import org.springframework.security.config.annotation.authentication.configuration.AuthenticationConfiguration; +import org.springframework.security.config.annotation.method.configuration.EnableMethodSecurity; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer; +import org.springframework.security.config.annotation.web.configurers.HeadersConfigurer; +import org.springframework.security.config.http.SessionCreationPolicy; +import org.springframework.security.web.AuthenticationEntryPoint; +import org.springframework.security.web.SecurityFilterChain; +import org.springframework.security.web.access.AccessDeniedHandler; +import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.method.HandlerMethod; +import org.springframework.web.servlet.mvc.method.RequestMappingInfo; +import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping; +import org.springframework.web.util.pattern.PathPattern; + +import javax.annotation.Resource; +import javax.annotation.security.PermitAll; +import javax.servlet.DispatcherType; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import static com.platform.marketing.framework.common.util.collection.CollectionUtils.convertList; + +/** + * 自定义的 Spring Security 配置适配器实现 + * + + */ +@AutoConfiguration +@AutoConfigureOrder(-1) // 目的:先于 Spring Security 自动配置,避免一键改包后,org.* 基础包无法生效 +@EnableMethodSecurity(securedEnabled = true) +public class MarketingWebSecurityConfigurerAdapter { + + @Resource + private WebProperties webProperties; + @Resource + private SecurityProperties securityProperties; + + /** + * 认证失败处理类 Bean + */ + @Resource + private AuthenticationEntryPoint authenticationEntryPoint; + /** + * 权限不够处理器 Bean + */ + @Resource + private AccessDeniedHandler accessDeniedHandler; + /** + * Token 认证过滤器 Bean + */ + @Resource + private TokenAuthenticationFilter authenticationTokenFilter; + + /** + * 自定义的权限映射 Bean 们 + * + * @see #filterChain(HttpSecurity) + */ + @Resource + private List authorizeRequestsCustomizers; + + @Resource + private ApplicationContext applicationContext; + + /** + * 由于 Spring Security 创建 AuthenticationManager 对象时,没声明 @Bean 注解,导致无法被注入 + * 通过覆写父类的该方法,添加 @Bean 注解,解决该问题 + */ + @Bean + public AuthenticationManager authenticationManagerBean(AuthenticationConfiguration authenticationConfiguration) throws Exception { + return authenticationConfiguration.getAuthenticationManager(); + } + + /** + * 配置 URL 的安全配置 + * + * anyRequest | 匹配所有请求路径 + * access | SpringEl表达式结果为true时可以访问 + * anonymous | 匿名可以访问 + * denyAll | 用户不能访问 + * fullyAuthenticated | 用户完全认证可以访问(非remember-me下自动登录) + * hasAnyAuthority | 如果有参数,参数表示权限,则其中任何一个权限可以访问 + * hasAnyRole | 如果有参数,参数表示角色,则其中任何一个角色可以访问 + * hasAuthority | 如果有参数,参数表示权限,则其权限可以访问 + * hasIpAddress | 如果有参数,参数表示IP地址,如果用户IP和参数匹配,则可以访问 + * hasRole | 如果有参数,参数表示角色,则其角色可以访问 + * permitAll | 用户可以任意访问 + * rememberMe | 允许通过remember-me登录的用户访问 + * authenticated | 用户登录后可访问 + */ + @Bean + protected SecurityFilterChain filterChain(HttpSecurity httpSecurity) throws Exception { + // 登出 + httpSecurity + // 开启跨域 + .cors(Customizer.withDefaults()) + // CSRF 禁用,因为不使用 Session + .csrf(AbstractHttpConfigurer::disable) + // 基于 token 机制,所以不需要 Session + .sessionManagement(c -> c.sessionCreationPolicy(SessionCreationPolicy.STATELESS)) + .headers(c -> c.frameOptions(HeadersConfigurer.FrameOptionsConfig::disable)) + // 一堆自定义的 Spring Security 处理器 + .exceptionHandling(c -> c.authenticationEntryPoint(authenticationEntryPoint) + .accessDeniedHandler(accessDeniedHandler)); + // 登录、登录暂时不使用 Spring Security 的拓展点,主要考虑一方面拓展多用户、多种登录方式相对复杂,一方面用户的学习成本较高 + + // 获得 @PermitAll 带来的 URL 列表,免登录 + Multimap permitAllUrls = getPermitAllUrlsFromAnnotations(); + // 设置每个请求的权限 + httpSecurity + // ①:全局共享规则 + .authorizeHttpRequests(c -> c + // 1.1 静态资源,可匿名访问 + .requestMatchers(HttpMethod.GET, "/*.html", "/*.css", "/*.js").permitAll() + // 1.2 设置 @PermitAll 无需认证 + .requestMatchers(HttpMethod.GET, permitAllUrls.get(HttpMethod.GET).toArray(new String[0])).permitAll() + .requestMatchers(HttpMethod.POST, permitAllUrls.get(HttpMethod.POST).toArray(new String[0])).permitAll() + .requestMatchers(HttpMethod.PUT, permitAllUrls.get(HttpMethod.PUT).toArray(new String[0])).permitAll() + .requestMatchers(HttpMethod.DELETE, permitAllUrls.get(HttpMethod.DELETE).toArray(new String[0])).permitAll() + .requestMatchers(HttpMethod.HEAD, permitAllUrls.get(HttpMethod.HEAD).toArray(new String[0])).permitAll() + .requestMatchers(HttpMethod.PATCH, permitAllUrls.get(HttpMethod.PATCH).toArray(new String[0])).permitAll() + // 1.3 基于 marketing.security.permit-all-urls 无需认证 + .requestMatchers(securityProperties.getPermitAllUrls().toArray(new String[0])).permitAll() + ) + // ②:每个项目的自定义规则 + .authorizeHttpRequests(c -> authorizeRequestsCustomizers.forEach(customizer -> customizer.customize(c))) + // ③:兜底规则,必须认证 + .authorizeHttpRequests(c -> c + .dispatcherTypeMatchers(DispatcherType.ASYNC).permitAll() // WebFlux 异步请求,无需认证,目的:SSE 场景 + .anyRequest().authenticated()); + + // 添加 Token Filter + httpSecurity.addFilterBefore(authenticationTokenFilter, UsernamePasswordAuthenticationFilter.class); + return httpSecurity.build(); + } + + private Multimap getPermitAllUrlsFromAnnotations() { + Multimap result = HashMultimap.create(); + // 获得接口对应的 HandlerMethod 集合 + RequestMappingHandlerMapping requestMappingHandlerMapping = (RequestMappingHandlerMapping) + applicationContext.getBean("requestMappingHandlerMapping"); + Map handlerMethodMap = requestMappingHandlerMapping.getHandlerMethods(); + // 获得有 @PermitAll 注解的接口 + for (Map.Entry entry : handlerMethodMap.entrySet()) { + HandlerMethod handlerMethod = entry.getValue(); + if (!handlerMethod.hasMethodAnnotation(PermitAll.class)) { + continue; + } + Set urls = new HashSet<>(); + if (entry.getKey().getPatternsCondition() != null) { + urls.addAll(entry.getKey().getPatternsCondition().getPatterns()); + } + if (entry.getKey().getPathPatternsCondition() != null) { + urls.addAll(convertList(entry.getKey().getPathPatternsCondition().getPatterns(), PathPattern::getPatternString)); + } + if (urls.isEmpty()) { + continue; + } + + // 特殊:使用 @RequestMapping 注解,并且未写 method 属性,此时认为都需要免登录 + Set methods = entry.getKey().getMethodsCondition().getMethods(); + if (CollUtil.isEmpty(methods)) { + result.putAll(HttpMethod.GET, urls); + result.putAll(HttpMethod.POST, urls); + result.putAll(HttpMethod.PUT, urls); + result.putAll(HttpMethod.DELETE, urls); + result.putAll(HttpMethod.HEAD, urls); + result.putAll(HttpMethod.PATCH, urls); + continue; + } + // 根据请求方法,添加到 result 结果 + entry.getKey().getMethodsCondition().getMethods().forEach(requestMethod -> { + switch (requestMethod) { + case GET: + result.putAll(HttpMethod.GET, urls); + break; + case POST: + result.putAll(HttpMethod.POST, urls); + break; + case PUT: + result.putAll(HttpMethod.PUT, urls); + break; + case DELETE: + result.putAll(HttpMethod.DELETE, urls); + break; + case HEAD: + result.putAll(HttpMethod.HEAD, urls); + break; + case PATCH: + result.putAll(HttpMethod.PATCH, urls); + break; + } + }); + } + return result; + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-security/src/main/java/com/platform/marketing/framework/security/config/SecurityProperties.java b/marketing-framework/marketing-spring-boot-starter-security/src/main/java/com/platform/marketing/framework/security/config/SecurityProperties.java new file mode 100644 index 0000000..7a179bd --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-security/src/main/java/com/platform/marketing/framework/security/config/SecurityProperties.java @@ -0,0 +1,51 @@ +package com.platform.marketing.framework.security.config; + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.validation.annotation.Validated; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import java.util.Collections; +import java.util.List; + +@ConfigurationProperties(prefix = "marketing.security") +@Validated +@Data +public class SecurityProperties { + + /** + * HTTP 请求时,访问令牌的请求 Header + */ + @NotEmpty(message = "Token Header 不能为空") + private String tokenHeader = "Authorization"; + /** + * HTTP 请求时,访问令牌的请求参数 + * + * 初始目的:解决 WebSocket 无法通过 header 传参,只能通过 token 参数拼接 + */ + @NotEmpty(message = "Token Parameter 不能为空") + private String tokenParameter = "token"; + + /** + * mock 模式的开关 + */ + @NotNull(message = "mock 模式的开关不能为空") + private Boolean mockEnable = false; + /** + * mock 模式的密钥 + * 一定要配置密钥,保证安全性 + */ + @NotEmpty(message = "mock 模式的密钥不能为空") // 这里设置了一个默认值,因为实际上只有 mockEnable 为 true 时才需要配置。 + private String mockSecret = "test"; + + /** + * 免登录的 URL 列表 + */ + private List permitAllUrls = Collections.emptyList(); + + /** + * PasswordEncoder 加密复杂度,越高开销越大 + */ + private Integer passwordEncoderLength = 4; +} diff --git a/marketing-framework/marketing-spring-boot-starter-security/src/main/java/com/platform/marketing/framework/security/core/LoginUser.java b/marketing-framework/marketing-spring-boot-starter-security/src/main/java/com/platform/marketing/framework/security/core/LoginUser.java new file mode 100644 index 0000000..b6cfa09 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-security/src/main/java/com/platform/marketing/framework/security/core/LoginUser.java @@ -0,0 +1,74 @@ +package com.platform.marketing.framework.security.core; + +import cn.hutool.core.map.MapUtil; +import com.platform.marketing.framework.common.enums.UserTypeEnum; +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; + +import java.time.LocalDateTime; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 登录用户信息 + * + + */ +@Data +public class LoginUser { + + /** + * 用户编号 + */ + private Long id; + + /** + * 用户类型 + * + * 关联 {@link UserTypeEnum} + */ + private Integer userType; + + /** + * 额外的用户信息 + */ + private Map info; + + /** + * 租户编号 + */ + private Long tenantId; + + /** + * 授权范围 + */ + private List scopes; + + /** + * 过期时间 + */ + private LocalDateTime expiresTime; + + + // ========== 上下文 ========== + /** + * 上下文字段,不进行持久化 + * + * 1. 用于基于 LoginUser 维度的临时缓存 + */ + @JsonIgnore + private Map context; + + public void setContext(String key, Object value) { + if (context == null) { + context = new HashMap<>(); + } + context.put(key, value); + } + + public T getContext(String key, Class type) { + return MapUtil.get(context, key, type); + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-security/src/main/java/com/platform/marketing/framework/security/core/adapter/PermissionAdapter.java b/marketing-framework/marketing-spring-boot-starter-security/src/main/java/com/platform/marketing/framework/security/core/adapter/PermissionAdapter.java new file mode 100644 index 0000000..77fc115 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-security/src/main/java/com/platform/marketing/framework/security/core/adapter/PermissionAdapter.java @@ -0,0 +1,45 @@ +package com.platform.marketing.framework.security.core.adapter; + +import com.platform.marketing.framework.security.core.dto.DeptDataPermissionRespDTO; + +import java.util.Collection; +import java.util.Set; + +public interface PermissionAdapter { + + /** + * 获得拥有多个角色的用户编号集合 + * + * @param roleIds 角色编号集合 + * @return 用户编号集合 + */ + Set getUserRoleIdListByRoleIds(Collection roleIds); + + /** + * 判断是否有权限,任一一个即可 + * + * @param userId 用户编号 + * @param permissions 权限 + * @return 是否 + */ + boolean hasAnyPermissions(Long userId, String... permissions); + + /** + * 判断是否有角色,任一一个即可 + * + * @param userId 用户编号 + * @param roles 角色数组 + * @return 是否 + */ + boolean hasAnyRoles(Long userId, String... roles); + + /** + * 获得登陆用户的部门数据权限 + * + * @param userId 用户编号 + * @return 部门数据权限 + */ + DeptDataPermissionRespDTO getDeptDataPermission(Long userId); + + +} diff --git a/marketing-framework/marketing-spring-boot-starter-security/src/main/java/com/platform/marketing/framework/security/core/context/TransmittableThreadLocalSecurityContextHolderStrategy.java b/marketing-framework/marketing-spring-boot-starter-security/src/main/java/com/platform/marketing/framework/security/core/context/TransmittableThreadLocalSecurityContextHolderStrategy.java new file mode 100644 index 0000000..dfa3725 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-security/src/main/java/com/platform/marketing/framework/security/core/context/TransmittableThreadLocalSecurityContextHolderStrategy.java @@ -0,0 +1,48 @@ +package com.platform.marketing.framework.security.core.context; + +import com.alibaba.ttl.TransmittableThreadLocal; +import org.springframework.security.core.context.SecurityContext; +import org.springframework.security.core.context.SecurityContextHolderStrategy; +import org.springframework.security.core.context.SecurityContextImpl; +import org.springframework.util.Assert; + +/** + * 基于 TransmittableThreadLocal 实现的 Security Context 持有者策略 + * 目的是,避免 @Async 等异步执行时,原生 ThreadLocal 的丢失问题 + * + + */ +public class TransmittableThreadLocalSecurityContextHolderStrategy implements SecurityContextHolderStrategy { + + /** + * 使用 TransmittableThreadLocal 作为上下文 + */ + private static final ThreadLocal CONTEXT_HOLDER = new TransmittableThreadLocal<>(); + + @Override + public void clearContext() { + CONTEXT_HOLDER.remove(); + } + + @Override + public SecurityContext getContext() { + SecurityContext ctx = CONTEXT_HOLDER.get(); + if (ctx == null) { + ctx = createEmptyContext(); + CONTEXT_HOLDER.set(ctx); + } + return ctx; + } + + @Override + public void setContext(SecurityContext context) { + Assert.notNull(context, "Only non-null SecurityContext instances are permitted"); + CONTEXT_HOLDER.set(context); + } + + @Override + public SecurityContext createEmptyContext() { + return new SecurityContextImpl(); + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-security/src/main/java/com/platform/marketing/framework/security/core/dto/DeptDataPermissionRespDTO.java b/marketing-framework/marketing-spring-boot-starter-security/src/main/java/com/platform/marketing/framework/security/core/dto/DeptDataPermissionRespDTO.java new file mode 100644 index 0000000..c627f42 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-security/src/main/java/com/platform/marketing/framework/security/core/dto/DeptDataPermissionRespDTO.java @@ -0,0 +1,36 @@ +package com.platform.marketing.framework.security.core.dto; + + +import lombok.Data; + +import java.util.HashSet; +import java.util.Set; + +/** + * 部门的数据权限 Response DTO + * + + */ +@Data +public class DeptDataPermissionRespDTO { + + /** + * 是否可查看全部数据 + */ + private Boolean all; + /** + * 是否可查看自己的数据 + */ + private Boolean self; + /** + * 可查看的部门编号数组 + */ + private Set deptIds; + + public DeptDataPermissionRespDTO() { + this.all = false; + this.self = false; + this.deptIds = new HashSet<>(); + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-security/src/main/java/com/platform/marketing/framework/security/core/filter/TokenAuthenticationFilter.java b/marketing-framework/marketing-spring-boot-starter-security/src/main/java/com/platform/marketing/framework/security/core/filter/TokenAuthenticationFilter.java new file mode 100644 index 0000000..eefd1d6 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-security/src/main/java/com/platform/marketing/framework/security/core/filter/TokenAuthenticationFilter.java @@ -0,0 +1,122 @@ +package com.platform.marketing.framework.security.core.filter; + +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import com.platform.marketing.framework.common.exception.ServiceException; +import com.platform.marketing.framework.common.pojo.CommonResult; +import com.platform.marketing.framework.common.util.servlet.ServletUtils; +import com.platform.marketing.framework.security.config.SecurityProperties; +import com.platform.marketing.framework.security.core.LoginUser; +import com.platform.marketing.framework.security.core.util.SecurityFrameworkUtils; +import com.platform.marketing.framework.token.core.dto.SecurityAccessTokenDTO; +import com.platform.marketing.framework.token.core.service.SecurityTokenService; +import com.platform.marketing.framework.web.core.handler.GlobalExceptionHandler; +import com.platform.marketing.framework.web.core.util.WebFrameworkUtils; +import lombok.RequiredArgsConstructor; +import org.springframework.security.access.AccessDeniedException; +import org.springframework.web.filter.OncePerRequestFilter; + +import javax.servlet.FilterChain; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; + +/** + * Token 过滤器,验证 token 的有效性 + * 验证通过后,获得 {@link LoginUser} 信息,并加入到 Spring Security 上下文 + * + + */ +@RequiredArgsConstructor +public class TokenAuthenticationFilter extends OncePerRequestFilter { + + private final SecurityProperties securityProperties; + + private final GlobalExceptionHandler globalExceptionHandler; + + private final SecurityTokenService securityTokenService; + + @Override + @SuppressWarnings("NullableProblems") + protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) + throws ServletException, IOException { + String token = SecurityFrameworkUtils.obtainAuthorization(request, + securityProperties.getTokenHeader(), securityProperties.getTokenParameter()); + if (StrUtil.isNotEmpty(token)) { + Integer userType = WebFrameworkUtils.getLoginUserType(request); + try { + // 1.1 基于 token 构建登录用户 + LoginUser loginUser = buildLoginUserByToken(token, userType); + // 1.2 模拟 Login 功能,方便日常开发调试 + if (loginUser == null) { + loginUser = mockLoginUser(request, token, userType); + } + + // 2. 设置当前用户 + if (loginUser != null) { + SecurityFrameworkUtils.setLoginUser(loginUser, request); + } + } catch (Throwable ex) { + CommonResult result = globalExceptionHandler.allExceptionHandler(request, ex); + ServletUtils.writeJSON(response, result); + return; + } + } + + // 继续过滤链 + chain.doFilter(request, response); + } + + private LoginUser buildLoginUserByToken(String token, Integer userType) { + try { + SecurityAccessTokenDTO accessTokenDTO = securityTokenService.checkAccessToken(token); + if (accessTokenDTO == null) { + return null; + } + // 用户类型不匹配,无权限 + // 注意:只有 /api/* 和 /app-api/* 有 userType,才需要比对用户类型 + // 类似 WebSocket 的 /ws/* 连接地址,是不需要比对用户类型的 + if (userType != null + && ObjectUtil.notEqual(accessTokenDTO.getUserType(), userType)) { + throw new AccessDeniedException("错误的用户类型"); + } + // 构建登录用户 + return new LoginUser().setId(accessTokenDTO.getUserId()).setUserType(accessTokenDTO.getUserType()) + .setInfo(new HashMap<>()) // 额外的用户信息 + .setTenantId(accessTokenDTO.getTenantId()) + .setScopes(Collections.EMPTY_LIST) + .setExpiresTime(accessTokenDTO.getExpiresTime()); + } catch (ServiceException serviceException) { + // 校验 Token 不通过时,考虑到一些接口是无需登录的,所以直接返回 null 即可 + return null; + } + } + + /** + * 模拟登录用户,方便日常开发调试 + * + * 注意,在线上环境下,一定要关闭该功能!!! + * + * @param request 请求 + * @param token 模拟的 token,格式为 {@link SecurityProperties#getMockSecret()} + 用户编号 + * @param userType 用户类型 + * @return 模拟的 LoginUser + */ + private LoginUser mockLoginUser(HttpServletRequest request, String token, Integer userType) { + if (!securityProperties.getMockEnable()) { + return null; + } + // 必须以 mockSecret 开头 + if (!token.startsWith(securityProperties.getMockSecret())) { + return null; + } + // 构建模拟用户 + Long userId = Long.valueOf(token.substring(securityProperties.getMockSecret().length())); + return new LoginUser().setId(userId).setUserType(userType) + .setTenantId(WebFrameworkUtils.getTenantId(request)); + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-security/src/main/java/com/platform/marketing/framework/security/core/handler/AccessDeniedHandlerImpl.java b/marketing-framework/marketing-spring-boot-starter-security/src/main/java/com/platform/marketing/framework/security/core/handler/AccessDeniedHandlerImpl.java new file mode 100644 index 0000000..ac48d7f --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-security/src/main/java/com/platform/marketing/framework/security/core/handler/AccessDeniedHandlerImpl.java @@ -0,0 +1,43 @@ +package com.platform.marketing.framework.security.core.handler; + +import com.platform.marketing.framework.common.exception.enums.GlobalErrorCodeConstants; +import com.platform.marketing.framework.common.pojo.CommonResult; +import com.platform.marketing.framework.security.core.util.SecurityFrameworkUtils; +import com.platform.marketing.framework.common.util.servlet.ServletUtils; +import lombok.extern.slf4j.Slf4j; +import org.springframework.security.access.AccessDeniedException; +import org.springframework.security.web.access.AccessDeniedHandler; +import org.springframework.security.web.access.ExceptionTranslationFilter; +import org.springframework.stereotype.Component; + +import javax.servlet.FilterChain; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +import static com.platform.marketing.framework.common.exception.enums.GlobalErrorCodeConstants.FORBIDDEN; +import static com.platform.marketing.framework.common.exception.enums.GlobalErrorCodeConstants.UNAUTHORIZED; + +/** + * 访问一个需要认证的 URL 资源,已经认证(登录)但是没有权限的情况下,返回 {@link GlobalErrorCodeConstants#FORBIDDEN} 错误码。 + * + * 补充:Spring Security 通过 {@link ExceptionTranslationFilter#handleAccessDeniedException(HttpServletRequest, HttpServletResponse, FilterChain, AccessDeniedException)} 方法,调用当前类 + * + + */ +@Slf4j +@SuppressWarnings("JavadocReference") +public class AccessDeniedHandlerImpl implements AccessDeniedHandler { + + @Override + public void handle(HttpServletRequest request, HttpServletResponse response, AccessDeniedException e) + throws IOException, ServletException { + // 打印 warn 的原因是,不定期合并 warn,看看有没恶意破坏 + log.warn("[commence][访问 URL({}) 时,用户({}) 权限不够]", request.getRequestURI(), + SecurityFrameworkUtils.getLoginUserId(), e); + // 返回 403 + ServletUtils.writeJSON(response, CommonResult.error(FORBIDDEN)); + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-security/src/main/java/com/platform/marketing/framework/security/core/handler/AuthenticationEntryPointImpl.java b/marketing-framework/marketing-spring-boot-starter-security/src/main/java/com/platform/marketing/framework/security/core/handler/AuthenticationEntryPointImpl.java new file mode 100644 index 0000000..ec1dd40 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-security/src/main/java/com/platform/marketing/framework/security/core/handler/AuthenticationEntryPointImpl.java @@ -0,0 +1,35 @@ +package com.platform.marketing.framework.security.core.handler; + +import com.platform.marketing.framework.common.exception.enums.GlobalErrorCodeConstants; +import com.platform.marketing.framework.common.pojo.CommonResult; +import com.platform.marketing.framework.common.util.servlet.ServletUtils; +import lombok.extern.slf4j.Slf4j; +import org.springframework.security.core.AuthenticationException; +import org.springframework.security.web.AuthenticationEntryPoint; +import org.springframework.security.web.access.ExceptionTranslationFilter; + +import javax.servlet.FilterChain; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import static com.platform.marketing.framework.common.exception.enums.GlobalErrorCodeConstants.UNAUTHORIZED; + +/** + * 访问一个需要认证的 URL 资源,但是此时自己尚未认证(登录)的情况下,返回 {@link GlobalErrorCodeConstants#UNAUTHORIZED} 错误码,从而使前端重定向到登录页 + * + * 补充:Spring Security 通过 {@link ExceptionTranslationFilter#sendStartAuthentication(HttpServletRequest, HttpServletResponse, FilterChain, AuthenticationException)} 方法,调用当前类 + * + * @author ruoyi + */ +@Slf4j +@SuppressWarnings("JavadocReference") // 忽略文档引用报错 +public class AuthenticationEntryPointImpl implements AuthenticationEntryPoint { + + @Override + public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException e) { + log.debug("[commence][访问 URL({}) 时,没有登录]", request.getRequestURI(), e); + // 返回 401 + ServletUtils.writeJSON(response, CommonResult.error(UNAUTHORIZED)); + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-security/src/main/java/com/platform/marketing/framework/security/core/service/SecurityFrameworkService.java b/marketing-framework/marketing-spring-boot-starter-security/src/main/java/com/platform/marketing/framework/security/core/service/SecurityFrameworkService.java new file mode 100644 index 0000000..05a2864 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-security/src/main/java/com/platform/marketing/framework/security/core/service/SecurityFrameworkService.java @@ -0,0 +1,59 @@ +package com.platform.marketing.framework.security.core.service; + +/** + * Security 框架 Service 接口,定义权限相关的校验操作 + * + + */ +public interface SecurityFrameworkService { + + /** + * 判断是否有权限 + * + * @param permission 权限 + * @return 是否 + */ + boolean hasPermission(String permission); + + /** + * 判断是否有权限,任一一个即可 + * + * @param permissions 权限 + * @return 是否 + */ + boolean hasAnyPermissions(String... permissions); + + /** + * 判断是否有角色 + * + * 注意,角色使用的是 SysRoleDO 的 code 标识 + * + * @param role 角色 + * @return 是否 + */ + boolean hasRole(String role); + + /** + * 判断是否有角色,任一一个即可 + * + * @param roles 角色数组 + * @return 是否 + */ + boolean hasAnyRoles(String... roles); + + /** + * 判断是否有授权 + * + * @param scope 授权 + * @return 是否 + */ + boolean hasScope(String scope); + + /** + * 判断是否有授权范围,任一一个即可 + * + * @param scope 授权范围数组 + * @return 是否 + */ + boolean hasAnyScopes(String... scope); +} diff --git a/marketing-framework/marketing-spring-boot-starter-security/src/main/java/com/platform/marketing/framework/security/core/service/impl/SecurityFrameworkServiceImpl.java b/marketing-framework/marketing-spring-boot-starter-security/src/main/java/com/platform/marketing/framework/security/core/service/impl/SecurityFrameworkServiceImpl.java new file mode 100644 index 0000000..8eadf08 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-security/src/main/java/com/platform/marketing/framework/security/core/service/impl/SecurityFrameworkServiceImpl.java @@ -0,0 +1,67 @@ +package com.platform.marketing.framework.security.core.service.impl; + +import cn.hutool.core.collection.CollUtil; +import com.platform.marketing.framework.security.core.LoginUser; +import com.platform.marketing.framework.security.core.adapter.PermissionAdapter; +import com.platform.marketing.framework.security.core.service.SecurityFrameworkService; +import com.platform.marketing.framework.security.core.util.SecurityFrameworkUtils; + +import lombok.AllArgsConstructor; + +import java.util.Arrays; + +import static com.platform.marketing.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; + +/** + * 默认的 {@link SecurityFrameworkService} 实现类 + * + + */ +@AllArgsConstructor +public class SecurityFrameworkServiceImpl implements SecurityFrameworkService { + + private final PermissionAdapter permissionAdapter; + + @Override + public boolean hasPermission(String permission) { + return hasAnyPermissions(permission); + } + + @Override + public boolean hasAnyPermissions(String... permissions) { + Long userId = getLoginUserId(); + if (userId == null) { + return false; + } + return permissionAdapter.hasAnyPermissions(userId, permissions); + } + + @Override + public boolean hasRole(String role) { + return hasAnyRoles(role); + } + + @Override + public boolean hasAnyRoles(String... roles) { + Long userId = getLoginUserId(); + if (userId == null) { + return false; + } + return permissionAdapter.hasAnyRoles(userId, roles); + } + + @Override + public boolean hasScope(String scope) { + return hasAnyScopes(scope); + } + + @Override + public boolean hasAnyScopes(String... scope) { + LoginUser user = SecurityFrameworkUtils.getLoginUser(); + if (user == null) { + return false; + } + return CollUtil.containsAny(user.getScopes(), Arrays.asList(scope)); + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-security/src/main/java/com/platform/marketing/framework/security/core/util/SecurityFrameworkUtils.java b/marketing-framework/marketing-spring-boot-starter-security/src/main/java/com/platform/marketing/framework/security/core/util/SecurityFrameworkUtils.java new file mode 100644 index 0000000..d3386ed --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-security/src/main/java/com/platform/marketing/framework/security/core/util/SecurityFrameworkUtils.java @@ -0,0 +1,118 @@ +package com.platform.marketing.framework.security.core.util; + +import cn.hutool.core.map.MapUtil; +import cn.hutool.core.util.StrUtil; +import com.platform.marketing.framework.security.core.LoginUser; +import com.platform.marketing.framework.web.core.util.WebFrameworkUtils; +import org.springframework.lang.Nullable; +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.context.SecurityContext; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.security.web.authentication.WebAuthenticationDetailsSource; +import org.springframework.util.StringUtils; + +import javax.servlet.http.HttpServletRequest; +import java.util.Collections; + +/** + * 安全服务工具类 + * + + */ +public class SecurityFrameworkUtils { + + /** + * HEADER 认证头 value 的前缀 + */ + public static final String AUTHORIZATION_BEARER = "Bearer"; + + private SecurityFrameworkUtils() {} + + /** + * 从请求中,获得认证 Token + * + * @param request 请求 + * @param headerName 认证 Token 对应的 Header 名字 + * @param parameterName 认证 Token 对应的 Parameter 名字 + * @return 认证 Token + */ + public static String obtainAuthorization(HttpServletRequest request, + String headerName, String parameterName) { + // 1. 获得 Token。优先级:Header > Parameter + String token = request.getHeader(headerName); + if (StrUtil.isEmpty(token)) { + token = request.getParameter(parameterName); + } + if (!StringUtils.hasText(token)) { + return null; + } + // 2. 去除 Token 中带的 Bearer + int index = token.indexOf(AUTHORIZATION_BEARER + " "); + return index >= 0 ? token.substring(index + 7).trim() : token; + } + + /** + * 获得当前认证信息 + * + * @return 认证信息 + */ + public static Authentication getAuthentication() { + SecurityContext context = SecurityContextHolder.getContext(); + if (context == null) { + return null; + } + return context.getAuthentication(); + } + + /** + * 获取当前用户 + * + * @return 当前用户 + */ + @Nullable + public static LoginUser getLoginUser() { + Authentication authentication = getAuthentication(); + if (authentication == null) { + return null; + } + return authentication.getPrincipal() instanceof LoginUser ? (LoginUser) authentication.getPrincipal() : null; + } + + /** + * 获得当前用户的编号,从上下文中 + * + * @return 用户编号 + */ + @Nullable + public static Long getLoginUserId() { + LoginUser loginUser = getLoginUser(); + return loginUser != null ? loginUser.getId() : null; + } + + /** + * 设置当前用户 + * + * @param loginUser 登录用户 + * @param request 请求 + */ + public static void setLoginUser(LoginUser loginUser, HttpServletRequest request) { + // 创建 Authentication,并设置到上下文 + Authentication authentication = buildAuthentication(loginUser, request); + SecurityContextHolder.getContext().setAuthentication(authentication); + + // 额外设置到 request 中,用于 ApiAccessLogFilter 可以获取到用户编号; + // 原因是,Spring Security 的 Filter 在 ApiAccessLogFilter 后面,在它记录访问日志时,线上上下文已经没有用户编号等信息 + WebFrameworkUtils.setLoginUserId(request, loginUser.getId()); + WebFrameworkUtils.setLoginUserType(request, loginUser.getUserType()); + } + + private static Authentication buildAuthentication(LoginUser loginUser, HttpServletRequest request) { + // 创建 UsernamePasswordAuthenticationToken 对象 + UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken( + loginUser, null, Collections.emptyList()); + authenticationToken.setDetails(new WebAuthenticationDetailsSource().buildDetails(request)); + return authenticationToken; + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-security/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/marketing-framework/marketing-spring-boot-starter-security/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 0000000..f995816 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-security/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1,2 @@ +com.platform.marketing.framework.security.config.MarketingSecurityAutoConfiguration +com.platform.marketing.framework.security.config.MarketingWebSecurityConfigurerAdapter \ No newline at end of file diff --git a/marketing-framework/marketing-spring-boot-starter-token/.flattened-pom.xml b/marketing-framework/marketing-spring-boot-starter-token/.flattened-pom.xml new file mode 100644 index 0000000..b278aea --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-token/.flattened-pom.xml @@ -0,0 +1,53 @@ + + + 4.0.0 + com.platform + marketing-spring-boot-starter-token + 0.0.1-jdk8-SNAPSHOT + 该包是技术组件,每个子包,代表一个组件。每个组件包括两部分: + 1. core 包:是该组件的核心封装 + 2. config 包:是该组件基于 Spring 的配置 + + 技术组件,也分成两类: + 1. 框架组件:和我们熟悉的 MyBatis、Redis 等等的拓展 + 2. 业务组件:和业务相关的组件的封装,例如说数据字典、操作日志等等。 + 如果是业务组件,Maven 名字会包含 biz + https://github.com/makemyownlife/platform-sms-pro/marketing-spring-boot-starter-token + + + com.platform + marketing-spring-boot-starter-redis + 0.0.1-jdk8-SNAPSHOT + compile + + + + + huaweicloud + huawei + https://mirrors.huaweicloud.com/repository/maven/ + + + aliyunmaven + aliyun + https://maven.aliyun.com/repository/public + + + + false + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + + + false + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + + diff --git a/marketing-framework/marketing-spring-boot-starter-token/pom.xml b/marketing-framework/marketing-spring-boot-starter-token/pom.xml new file mode 100644 index 0000000..4addc8d --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-token/pom.xml @@ -0,0 +1,26 @@ + + + 4.0.0 + + + com.platform + marketing-framework + ${revision} + + + marketing-spring-boot-starter-token + jar + ${parent.version} + + + + + com.platform + marketing-spring-boot-starter-redis + + + + + \ No newline at end of file diff --git a/marketing-framework/marketing-spring-boot-starter-token/src/main/java/com/platform/marketing/framework/token/config/MarketingTokenAutoConfiguration.java b/marketing-framework/marketing-spring-boot-starter-token/src/main/java/com/platform/marketing/framework/token/config/MarketingTokenAutoConfiguration.java new file mode 100644 index 0000000..e985e23 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-token/src/main/java/com/platform/marketing/framework/token/config/MarketingTokenAutoConfiguration.java @@ -0,0 +1,19 @@ +package com.platform.marketing.framework.token.config; + +import com.platform.marketing.framework.redis.config.MarketingRedisAutoConfiguration; +import com.platform.marketing.framework.token.core.service.SecurityTokenService; +import com.platform.marketing.framework.token.core.service.impl.SecurityTokenServiceImpl; +import org.springframework.boot.autoconfigure.AutoConfiguration; +import org.springframework.context.annotation.Bean; +import org.springframework.data.redis.core.StringRedisTemplate; + +@AutoConfiguration(after = MarketingRedisAutoConfiguration.class) +public class MarketingTokenAutoConfiguration { + + @Bean(value = "securityTokenService") + public SecurityTokenService createSecurityTokenService(StringRedisTemplate stringRedisTemplate) { + SecurityTokenService securityTokenService = new SecurityTokenServiceImpl(stringRedisTemplate); + return securityTokenService; + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-token/src/main/java/com/platform/marketing/framework/token/core/dto/SecurityAccessTokenDTO.java b/marketing-framework/marketing-spring-boot-starter-token/src/main/java/com/platform/marketing/framework/token/core/dto/SecurityAccessTokenDTO.java new file mode 100644 index 0000000..5fa03aa --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-token/src/main/java/com/platform/marketing/framework/token/core/dto/SecurityAccessTokenDTO.java @@ -0,0 +1,50 @@ +package com.platform.marketing.framework.token.core.dto; + +import com.platform.marketing.framework.common.enums.UserTypeEnum; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.time.LocalDateTime; + +@Data +@Accessors(chain = true) +public class SecurityAccessTokenDTO { + + /** + * 多租户编号 + */ + private Long tenantId; + + /** + * 访问令牌 + */ + private String accessToken; + + /** + * 刷新令牌 + */ + private String refreshToken; + + /** + * 用户编号 + */ + private Long userId; + + /** + * 用户类型 + *

+ * 枚举 {@link UserTypeEnum} + */ + private Integer userType; + + /** + * 客户端编号 + */ + private String clientId; + + /** + * 过期时间 + */ + private LocalDateTime expiresTime; + +} diff --git a/marketing-framework/marketing-spring-boot-starter-token/src/main/java/com/platform/marketing/framework/token/core/dto/SecurityCreateTokenDTO.java b/marketing-framework/marketing-spring-boot-starter-token/src/main/java/com/platform/marketing/framework/token/core/dto/SecurityCreateTokenDTO.java new file mode 100644 index 0000000..5da7b58 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-token/src/main/java/com/platform/marketing/framework/token/core/dto/SecurityCreateTokenDTO.java @@ -0,0 +1,29 @@ +package com.platform.marketing.framework.token.core.dto; + +import com.platform.marketing.framework.common.enums.UserTypeEnum; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class SecurityCreateTokenDTO { + + /** + * 用户编号 + */ + private Long userId; + + /** + * 多租户编号 + */ + private Long tenantId; + + /** + * 用户类型 + *

+ * 枚举 {@link UserTypeEnum} + */ + private Integer userType; + + +} diff --git a/marketing-framework/marketing-spring-boot-starter-token/src/main/java/com/platform/marketing/framework/token/core/dto/SecurityRefreshTokenDTO.java b/marketing-framework/marketing-spring-boot-starter-token/src/main/java/com/platform/marketing/framework/token/core/dto/SecurityRefreshTokenDTO.java new file mode 100644 index 0000000..daeade5 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-token/src/main/java/com/platform/marketing/framework/token/core/dto/SecurityRefreshTokenDTO.java @@ -0,0 +1,46 @@ +package com.platform.marketing.framework.token.core.dto; + +import com.platform.marketing.framework.common.enums.UserTypeEnum; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.time.LocalDateTime; +import java.util.List; + +/** + * 刷新令牌 + */ +@Data +@Accessors(chain = true) +public class SecurityRefreshTokenDTO { + + /** + * 多租户编号 + */ + private Long tenantId; + + /** + * 刷新令牌 + */ + private String refreshToken; + /** + * 用户编号 + */ + private Long userId; + /** + * 用户类型 + * + * 枚举 {@link UserTypeEnum} + */ + private Integer userType; + /** + * 客户端编号 + */ + private String clientId; + + /** + * 过期时间 + */ + private LocalDateTime expiresTime; + +} diff --git a/marketing-framework/marketing-spring-boot-starter-token/src/main/java/com/platform/marketing/framework/token/core/service/SecurityTokenService.java b/marketing-framework/marketing-spring-boot-starter-token/src/main/java/com/platform/marketing/framework/token/core/service/SecurityTokenService.java new file mode 100644 index 0000000..18296bf --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-token/src/main/java/com/platform/marketing/framework/token/core/service/SecurityTokenService.java @@ -0,0 +1,18 @@ +package com.platform.marketing.framework.token.core.service; + +import com.platform.marketing.framework.token.core.dto.SecurityAccessTokenDTO; +import com.platform.marketing.framework.token.core.dto.SecurityCreateTokenDTO; + +public interface SecurityTokenService { + + SecurityAccessTokenDTO createAccessToken(SecurityCreateTokenDTO securityCreateTokenDTO); + + SecurityAccessTokenDTO refreshAccessToken(String refreshToken); + + SecurityAccessTokenDTO removeAccessToken(String accessToken); + + SecurityAccessTokenDTO getAccessToken(String accessToken); + + SecurityAccessTokenDTO checkAccessToken(String accessToken); + +} diff --git a/marketing-framework/marketing-spring-boot-starter-token/src/main/java/com/platform/marketing/framework/token/core/service/impl/SecurityTokenServiceImpl.java b/marketing-framework/marketing-spring-boot-starter-token/src/main/java/com/platform/marketing/framework/token/core/service/impl/SecurityTokenServiceImpl.java new file mode 100644 index 0000000..117e1f5 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-token/src/main/java/com/platform/marketing/framework/token/core/service/impl/SecurityTokenServiceImpl.java @@ -0,0 +1,166 @@ +package com.platform.marketing.framework.token.core.service.impl; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.date.LocalDateTimeUtil; +import cn.hutool.core.util.IdUtil; +import cn.hutool.core.util.ObjectUtil; +import com.platform.marketing.framework.common.enums.UserTypeEnum; +import com.platform.marketing.framework.common.exception.enums.GlobalErrorCodeConstants; +import com.platform.marketing.framework.common.util.date.DateUtils; +import com.platform.marketing.framework.common.util.json.JsonUtils; +import com.platform.marketing.framework.token.core.dto.SecurityAccessTokenDTO; +import com.platform.marketing.framework.token.core.dto.SecurityCreateTokenDTO; +import com.platform.marketing.framework.token.core.dto.SecurityRefreshTokenDTO; +import com.platform.marketing.framework.token.core.service.SecurityTokenService; +import org.springframework.data.redis.core.StringRedisTemplate; + +import java.time.LocalDateTime; +import java.time.temporal.ChronoUnit; +import java.util.concurrent.TimeUnit; + +import static com.platform.marketing.framework.common.exception.util.ServiceExceptionUtil.exception0; +import static com.platform.marketing.framework.common.util.collection.CollectionUtils.convertSet; + +public class SecurityTokenServiceImpl implements SecurityTokenService { + + // 默认 登录客户端平台 1: admin后台 + private String DEFAULT_CLINET_ID = "1"; + + // 访问令牌 + private final static String SECURITY_ACCESS_TOKEN = "security_access_token:%s"; + + // 刷新令牌 + private final static String SECURITY_REFRESH_TOKEN = "security_refresh_token:%s"; + + private StringRedisTemplate stringRedisTemplate; + + public SecurityTokenServiceImpl(StringRedisTemplate stringRedisTemplate) { + this.stringRedisTemplate = stringRedisTemplate; + } + + //=========================================== 核心方法 start =================================================== + + @Override + public SecurityAccessTokenDTO createAccessToken(SecurityCreateTokenDTO securityCreateTokenDTO) { + + // step1 :创建 refreshToken + SecurityRefreshTokenDTO refreshTokenDTO = new SecurityRefreshTokenDTO().setRefreshToken(generateRefreshToken()) + .setUserId(securityCreateTokenDTO.getUserId()) + .setUserType(UserTypeEnum.ADMIN.getValue()) + .setClientId(DEFAULT_CLINET_ID) + .setExpiresTime(LocalDateTime.now().plusSeconds(2592000)).setTenantId(securityCreateTokenDTO.getTenantId()); + + // step2 : 保存 refreshToken 到 Redis + String refreshTokenKey = String.format(SECURITY_REFRESH_TOKEN, refreshTokenDTO.getRefreshToken()); + long timeDiff1 = LocalDateTimeUtil.between(LocalDateTime.now(), refreshTokenDTO.getExpiresTime(), ChronoUnit.SECONDS); + if (timeDiff1 > 0) { + stringRedisTemplate.opsForValue().set(refreshTokenKey, JsonUtils.toJsonString(refreshTokenDTO), timeDiff1, TimeUnit.SECONDS); + } + + // step3 :创建 accessToken + SecurityAccessTokenDTO accessTokenDTO = new SecurityAccessTokenDTO().setAccessToken(generateAccessToken()) + .setUserId(refreshTokenDTO.getUserId()).setUserType(refreshTokenDTO.getUserType()) + .setClientId(refreshTokenDTO.getClientId()) + .setRefreshToken(refreshTokenDTO.getRefreshToken()) + .setExpiresTime(LocalDateTime.now().plusSeconds(1800)).setTenantId(securityCreateTokenDTO.getTenantId()); + + // step4 : 保存 accessToken 到 Redis + String accessTokenKey = String.format(SECURITY_ACCESS_TOKEN, accessTokenDTO.getAccessToken()); + long timeDiff2 = LocalDateTimeUtil.between(LocalDateTime.now(), accessTokenDTO.getExpiresTime(), ChronoUnit.SECONDS); + if (timeDiff2 > 0) { + stringRedisTemplate.opsForValue().set(accessTokenKey, JsonUtils.toJsonString(accessTokenDTO), timeDiff2, TimeUnit.SECONDS); + } + + return accessTokenDTO; } + + @Override + public SecurityAccessTokenDTO refreshAccessToken(String refreshToken) { + // step1:从 Redis 查看刷新令牌 + String refreshTokenKey = String.format(SECURITY_REFRESH_TOKEN, refreshToken); + SecurityAccessTokenDTO refreshTokenDTO = + JsonUtils.parseObject( + stringRedisTemplate.opsForValue().get(refreshTokenKey), + SecurityAccessTokenDTO.class); + if (refreshTokenDTO == null) { + throw exception0(GlobalErrorCodeConstants.BAD_REQUEST.getCode(), "无效的刷新令牌"); + } + + // step2:已过期的情况下,删除刷新令牌 + if (DateUtils.isExpired(refreshTokenDTO.getExpiresTime())) { + stringRedisTemplate.delete(refreshTokenKey); + throw exception0(GlobalErrorCodeConstants.UNAUTHORIZED.getCode(), "刷新令牌已过期"); + } + + // step3 :创建 accessToken + SecurityAccessTokenDTO accessTokenDTO = new SecurityAccessTokenDTO().setAccessToken(generateAccessToken()) + .setUserId(refreshTokenDTO.getUserId()).setUserType(refreshTokenDTO.getUserType()) + .setClientId(refreshTokenDTO.getClientId()) + .setRefreshToken(refreshTokenDTO.getRefreshToken()) + .setExpiresTime(LocalDateTime.now().plusSeconds(1800)).setTenantId(refreshTokenDTO.getTenantId()); + + // step4 : 保存 accessToken 到 Redis + String accessTokenKey = String.format(SECURITY_ACCESS_TOKEN, accessTokenDTO.getAccessToken()); + long timeDiff2 = LocalDateTimeUtil.between(LocalDateTime.now(), accessTokenDTO.getExpiresTime(), ChronoUnit.SECONDS); + if (timeDiff2 > 0) { + stringRedisTemplate.opsForValue().set(accessTokenKey, JsonUtils.toJsonString(accessTokenDTO), timeDiff2, TimeUnit.SECONDS); + } + + return accessTokenDTO; + } + + @Override + public SecurityAccessTokenDTO removeAccessToken(String accessToken) { + // step1:从 Redis 获取 访问令牌对象 + String accessTokenKey = String.format(SECURITY_ACCESS_TOKEN, accessToken); + SecurityAccessTokenDTO securityAccessTokenDTO = JsonUtils.parseObject( + stringRedisTemplate.opsForValue().get(accessTokenKey), + SecurityAccessTokenDTO.class); + if (securityAccessTokenDTO == null) { + return null; + } + + // step2:从 Redis 删除访问令牌 + stringRedisTemplate.delete(accessTokenKey); + + // step3:从 Redis 删除刷新令牌 + String refreshTokenKey = String.format(SECURITY_REFRESH_TOKEN, securityAccessTokenDTO.getRefreshToken()); + stringRedisTemplate.delete(refreshTokenKey); + + return securityAccessTokenDTO; + } + + @Override + public SecurityAccessTokenDTO getAccessToken(String accessToken) { + String accessTokenKey = String.format(SECURITY_ACCESS_TOKEN, accessToken); + SecurityAccessTokenDTO securityAccessTokenDTO = JsonUtils.parseObject( + stringRedisTemplate.opsForValue().get(accessTokenKey), + SecurityAccessTokenDTO.class); + return securityAccessTokenDTO; + } + + @Override + public SecurityAccessTokenDTO checkAccessToken(String accessToken) { + SecurityAccessTokenDTO accessTokenDTO = getAccessToken(accessToken); + if (accessTokenDTO == null) { + throw exception0(GlobalErrorCodeConstants.UNAUTHORIZED.getCode(), "访问令牌不存在"); + } + if (DateUtils.isExpired(accessTokenDTO.getExpiresTime())) { + throw exception0(GlobalErrorCodeConstants.UNAUTHORIZED.getCode(), "访问令牌已过期"); + } + return accessTokenDTO; + } + + //=========================================== 核心方法 end =========================================== + + + //=========================================== 辅助方法 start =========================================== + private static String generateAccessToken() { + return IdUtil.fastSimpleUUID(); + } + + private static String generateRefreshToken() { + return IdUtil.fastSimpleUUID(); + } + //=========================================== 辅助方法 end =========================================== + +} diff --git a/marketing-framework/marketing-spring-boot-starter-token/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/marketing-framework/marketing-spring-boot-starter-token/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 0000000..f2d6719 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-token/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +com.platform.marketing.framework.token.config.MarketingTokenAutoConfiguration \ No newline at end of file diff --git a/marketing-framework/marketing-spring-boot-starter-web/.flattened-pom.xml b/marketing-framework/marketing-spring-boot-starter-web/.flattened-pom.xml new file mode 100644 index 0000000..fc9c38f --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-web/.flattened-pom.xml @@ -0,0 +1,90 @@ + + + 4.0.0 + com.platform + marketing-spring-boot-starter-web + 0.0.1-jdk8-SNAPSHOT + marketing-spring-boot-starter-web + Web 框架,全局异常、API 日志、脱敏、错误码等 + https://github.com/makemyownlife/platform-sms-pro + + + com.platform + marketing-common + 0.0.1-jdk8-SNAPSHOT + compile + + + org.springframework.boot + spring-boot-starter-web + 2.7.18 + compile + + + org.springframework.boot + spring-boot-configuration-processor + 2.7.18 + compile + true + + + org.aspectj + aspectjweaver + 1.9.7 + provided + + + com.github.xiaoymin + knife4j-openapi3-spring-boot-starter + 4.5.0 + compile + + + org.springdoc + springdoc-openapi-ui + 1.8.0 + compile + + + org.springframework.security + spring-security-core + 5.8.14 + provided + + + org.jsoup + jsoup + 1.18.3 + compile + + + + + huaweicloud + huawei + https://mirrors.huaweicloud.com/repository/maven/ + + + aliyunmaven + aliyun + https://maven.aliyun.com/repository/public + + + + false + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + + + false + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + + diff --git a/marketing-framework/marketing-spring-boot-starter-web/pom.xml b/marketing-framework/marketing-spring-boot-starter-web/pom.xml new file mode 100644 index 0000000..76974b5 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-web/pom.xml @@ -0,0 +1,78 @@ + + + + com.platform + marketing-framework + ${revision} + + + 4.0.0 + marketing-spring-boot-starter-web + jar + + ${project.artifactId} + Web 框架,全局异常、API 日志、脱敏、错误码等 + https://github.com/makemyownlife/platform-sms-pro + + + + com.platform + marketing-common + + + + + org.springframework.boot + spring-boot-starter-web + + + + + org.springframework.boot + spring-boot-configuration-processor + true + + + org.aspectj + aspectjweaver + provided + + + + com.github.xiaoymin + knife4j-openapi3-spring-boot-starter + + + + org.springdoc + springdoc-openapi-ui + + + + org.springframework.security + spring-security-core + provided + + + + + org.jsoup + jsoup + + + + + org.springframework.boot + spring-boot-starter-test + test + + + org.mockito + mockito-inline + test + + + + diff --git a/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/banner/config/MarketingBannerAutoConfiguration.java b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/banner/config/MarketingBannerAutoConfiguration.java new file mode 100644 index 0000000..6b8c67a --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/banner/config/MarketingBannerAutoConfiguration.java @@ -0,0 +1,20 @@ +package com.platform.marketing.framework.banner.config; + +import com.platform.marketing.framework.banner.core.BannerApplicationRunner; +import org.springframework.boot.autoconfigure.AutoConfiguration; +import org.springframework.context.annotation.Bean; + +/** + * Banner 的自动配置类 + * + + */ +@AutoConfiguration +public class MarketingBannerAutoConfiguration { + + @Bean + public BannerApplicationRunner bannerApplicationRunner() { + return new BannerApplicationRunner(); + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/banner/core/BannerApplicationRunner.java b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/banner/core/BannerApplicationRunner.java new file mode 100644 index 0000000..314ee59 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/banner/core/BannerApplicationRunner.java @@ -0,0 +1,30 @@ +package com.platform.marketing.framework.banner.core; + +import cn.hutool.core.thread.ThreadUtil; +import lombok.extern.slf4j.Slf4j; +import org.springframework.boot.ApplicationArguments; +import org.springframework.boot.ApplicationRunner; +import org.springframework.util.ClassUtils; + +import java.util.concurrent.TimeUnit; + +/** + * 项目启动成功后,提供文档相关的地址 + * + + */ +@Slf4j +public class BannerApplicationRunner implements ApplicationRunner { + + @Override + public void run(ApplicationArguments args) { + ThreadUtil.execute(() -> { + ThreadUtil.sleep(1, TimeUnit.SECONDS); // 延迟 1 秒,保证输出到结尾 + }); + } + + private static boolean isNotPresent(String className) { + return !ClassUtils.isPresent(className, ClassUtils.getDefaultClassLoader()); + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/desensitize/core/base/annotation/DesensitizeBy.java b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/desensitize/core/base/annotation/DesensitizeBy.java new file mode 100644 index 0000000..4c4c0d3 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/desensitize/core/base/annotation/DesensitizeBy.java @@ -0,0 +1,32 @@ +package com.platform.marketing.framework.desensitize.core.base.annotation; + +import com.platform.marketing.framework.desensitize.core.base.handler.DesensitizationHandler; +import com.platform.marketing.framework.desensitize.core.base.serializer.StringDesensitizeSerializer; +import com.fasterxml.jackson.annotation.JacksonAnnotationsInside; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * 顶级脱敏注解,自定义注解需要使用此注解 + * + * @author gaibu + */ +@Documented +@Target(ElementType.ANNOTATION_TYPE) +@Retention(RetentionPolicy.RUNTIME) +@JacksonAnnotationsInside // 此注解是其他所有 jackson 注解的元注解,打上了此注解的注解表明是 jackson 注解的一部分 +@JsonSerialize(using = StringDesensitizeSerializer.class) // 指定序列化器 +public @interface DesensitizeBy { + + /** + * 脱敏处理器 + */ + @SuppressWarnings("rawtypes") + Class handler(); + +} diff --git a/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/desensitize/core/base/handler/DesensitizationHandler.java b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/desensitize/core/base/handler/DesensitizationHandler.java new file mode 100644 index 0000000..d635918 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/desensitize/core/base/handler/DesensitizationHandler.java @@ -0,0 +1,40 @@ +package com.platform.marketing.framework.desensitize.core.base.handler; + +import cn.hutool.core.util.ReflectUtil; + +import java.lang.annotation.Annotation; + +/** + * 脱敏处理器接口 + * + * @author gaibu + */ +public interface DesensitizationHandler { + + /** + * 脱敏 + * + * @param origin 原始字符串 + * @param annotation 注解信息 + * @return 脱敏后的字符串 + */ + String desensitize(String origin, T annotation); + + /** + * 是否禁用脱敏的 Spring EL 表达式 + * + * 如果返回 true 则跳过脱敏 + * + * @param annotation 注解信息 + * @return 是否禁用脱敏的 Spring EL 表达式 + */ + default String getDisable(T annotation) { + // 约定:默认就是 enable() 属性。如果不符合,子类重写 + try { + return (String) ReflectUtil.invoke(annotation, "disable"); + } catch (Exception ex) { + return ""; + } + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/desensitize/core/base/serializer/StringDesensitizeSerializer.java b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/desensitize/core/base/serializer/StringDesensitizeSerializer.java new file mode 100644 index 0000000..edb3a22 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/desensitize/core/base/serializer/StringDesensitizeSerializer.java @@ -0,0 +1,92 @@ +package com.platform.marketing.framework.desensitize.core.base.serializer; + +import cn.hutool.core.annotation.AnnotationUtil; +import cn.hutool.core.lang.Singleton; +import cn.hutool.core.util.ArrayUtil; +import cn.hutool.core.util.ReflectUtil; +import cn.hutool.core.util.StrUtil; +import com.platform.marketing.framework.desensitize.core.base.annotation.DesensitizeBy; +import com.platform.marketing.framework.desensitize.core.base.handler.DesensitizationHandler; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.databind.BeanProperty; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.ser.ContextualSerializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import lombok.Getter; +import lombok.Setter; + +import java.io.IOException; +import java.lang.annotation.Annotation; +import java.lang.reflect.Field; + +/** + * 脱敏序列化器 + * + * 实现 JSON 返回数据时,使用 {@link DesensitizationHandler} 对声明脱敏注解的字段,进行脱敏处理。 + * + * @author gaibu + */ +@SuppressWarnings("rawtypes") +public class StringDesensitizeSerializer extends StdSerializer implements ContextualSerializer { + + @Getter + @Setter + private DesensitizationHandler desensitizationHandler; + + protected StringDesensitizeSerializer() { + super(String.class); + } + + @Override + public JsonSerializer createContextual(SerializerProvider serializerProvider, BeanProperty beanProperty) { + DesensitizeBy annotation = beanProperty.getAnnotation(DesensitizeBy.class); + if (annotation == null) { + return this; + } + // 创建一个 StringDesensitizeSerializer 对象,使用 DesensitizeBy 对应的处理器 + StringDesensitizeSerializer serializer = new StringDesensitizeSerializer(); + serializer.setDesensitizationHandler(Singleton.get(annotation.handler())); + return serializer; + } + + @Override + @SuppressWarnings("unchecked") + public void serialize(String value, JsonGenerator gen, SerializerProvider serializerProvider) throws IOException { + if (StrUtil.isBlank(value)) { + gen.writeNull(); + return; + } + // 获取序列化字段 + Field field = getField(gen); + + // 自定义处理器 + DesensitizeBy[] annotations = AnnotationUtil.getCombinationAnnotations(field, DesensitizeBy.class); + if (ArrayUtil.isEmpty(annotations)) { + gen.writeString(value); + return; + } + for (Annotation annotation : field.getAnnotations()) { + if (AnnotationUtil.hasAnnotation(annotation.annotationType(), DesensitizeBy.class)) { + value = this.desensitizationHandler.desensitize(value, annotation); + gen.writeString(value); + return; + } + } + gen.writeString(value); + } + + /** + * 获取字段 + * + * @param generator JsonGenerator + * @return 字段 + */ + private Field getField(JsonGenerator generator) { + String currentName = generator.getOutputContext().getCurrentName(); + Object currentValue = generator.getCurrentValue(); + Class currentValueClass = currentValue.getClass(); + return ReflectUtil.getField(currentValueClass, currentName); + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/desensitize/core/regex/annotation/EmailDesensitize.java b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/desensitize/core/regex/annotation/EmailDesensitize.java new file mode 100644 index 0000000..f46365e --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/desensitize/core/regex/annotation/EmailDesensitize.java @@ -0,0 +1,44 @@ +package com.platform.marketing.framework.desensitize.core.regex.annotation; + +import com.platform.marketing.framework.desensitize.core.base.annotation.DesensitizeBy; +import com.platform.marketing.framework.desensitize.core.regex.handler.EmailDesensitizationHandler; +import com.fasterxml.jackson.annotation.JacksonAnnotationsInside; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * 邮箱脱敏注解 + * + * @author gaibu + */ +@Documented +@Target({ElementType.FIELD}) +@Retention(RetentionPolicy.RUNTIME) +@JacksonAnnotationsInside +@DesensitizeBy(handler = EmailDesensitizationHandler.class) +public @interface EmailDesensitize { + + /** + * 匹配的正则表达式 + */ + String regex() default "(^.)[^@]*(@.*$)"; + + /** + * 替换规则,邮箱; + * + * 比如:example@gmail.com 脱敏之后为 e****@gmail.com + */ + String replacer() default "$1****$2"; + + /** + * 是否禁用脱敏 + * + * 支持 Spring EL 表达式,如果返回 true 则跳过脱敏 + */ + String disable() default ""; + +} diff --git a/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/desensitize/core/regex/annotation/RegexDesensitize.java b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/desensitize/core/regex/annotation/RegexDesensitize.java new file mode 100644 index 0000000..f1f8a51 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/desensitize/core/regex/annotation/RegexDesensitize.java @@ -0,0 +1,46 @@ +package com.platform.marketing.framework.desensitize.core.regex.annotation; + +import com.platform.marketing.framework.desensitize.core.base.annotation.DesensitizeBy; +import com.platform.marketing.framework.desensitize.core.regex.handler.DefaultRegexDesensitizationHandler; +import com.fasterxml.jackson.annotation.JacksonAnnotationsInside; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * 正则脱敏注解 + * + * @author gaibu + */ +@Documented +@Target({ElementType.FIELD, ElementType.ANNOTATION_TYPE}) +@Retention(RetentionPolicy.RUNTIME) +@JacksonAnnotationsInside +@DesensitizeBy(handler = DefaultRegexDesensitizationHandler.class) +public @interface RegexDesensitize { + + /** + * 匹配的正则表达式(默认匹配所有) + */ + String regex() default "^[\\s\\S]*$"; + + /** + * 替换规则,会将匹配到的字符串全部替换成 replacer + * + * 例如:regex=123; replacer=****** + * 原始字符串 123456789 + * 脱敏后字符串 ******456789 + */ + String replacer() default "******"; + + /** + * 是否禁用脱敏 + * + * 支持 Spring EL 表达式,如果返回 true 则跳过脱敏 + */ + String disable() default ""; + +} diff --git a/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/desensitize/core/regex/handler/AbstractRegexDesensitizationHandler.java b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/desensitize/core/regex/handler/AbstractRegexDesensitizationHandler.java new file mode 100644 index 0000000..2921878 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/desensitize/core/regex/handler/AbstractRegexDesensitizationHandler.java @@ -0,0 +1,46 @@ +package com.platform.marketing.framework.desensitize.core.regex.handler; + +import com.platform.marketing.framework.common.util.spring.SpringExpressionUtils; +import com.platform.marketing.framework.desensitize.core.base.handler.DesensitizationHandler; + +import java.lang.annotation.Annotation; + +/** + * 正则表达式脱敏处理器抽象类,已实现通用的方法 + * + * @author gaibu + */ +public abstract class AbstractRegexDesensitizationHandler + implements DesensitizationHandler { + + @Override + public String desensitize(String origin, T annotation) { + // 1. 判断是否禁用脱敏 + Object disable = SpringExpressionUtils.parseExpression(getDisable(annotation)); + if (Boolean.TRUE.equals(disable)) { + return origin; + } + + // 2. 执行脱敏 + String regex = getRegex(annotation); + String replacer = getReplacer(annotation); + return origin.replaceAll(regex, replacer); + } + + /** + * 获取注解上的 regex 参数 + * + * @param annotation 注解信息 + * @return 正则表达式 + */ + abstract String getRegex(T annotation); + + /** + * 获取注解上的 replacer 参数 + * + * @param annotation 注解信息 + * @return 待替换的字符串 + */ + abstract String getReplacer(T annotation); + +} diff --git a/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/desensitize/core/regex/handler/DefaultRegexDesensitizationHandler.java b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/desensitize/core/regex/handler/DefaultRegexDesensitizationHandler.java new file mode 100644 index 0000000..97113d1 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/desensitize/core/regex/handler/DefaultRegexDesensitizationHandler.java @@ -0,0 +1,27 @@ +package com.platform.marketing.framework.desensitize.core.regex.handler; + +import com.platform.marketing.framework.desensitize.core.regex.annotation.RegexDesensitize; + +/** + * {@link RegexDesensitize} 的正则脱敏处理器 + * + * @author gaibu + */ +public class DefaultRegexDesensitizationHandler extends AbstractRegexDesensitizationHandler { + + @Override + String getRegex(RegexDesensitize annotation) { + return annotation.regex(); + } + + @Override + String getReplacer(RegexDesensitize annotation) { + return annotation.replacer(); + } + + @Override + public String getDisable(RegexDesensitize annotation) { + return annotation.disable(); + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/desensitize/core/regex/handler/EmailDesensitizationHandler.java b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/desensitize/core/regex/handler/EmailDesensitizationHandler.java new file mode 100644 index 0000000..aee5f03 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/desensitize/core/regex/handler/EmailDesensitizationHandler.java @@ -0,0 +1,22 @@ +package com.platform.marketing.framework.desensitize.core.regex.handler; + +import com.platform.marketing.framework.desensitize.core.regex.annotation.EmailDesensitize; + +/** + * {@link EmailDesensitize} 的脱敏处理器 + * + * @author gaibu + */ +public class EmailDesensitizationHandler extends AbstractRegexDesensitizationHandler { + + @Override + String getRegex(EmailDesensitize annotation) { + return annotation.regex(); + } + + @Override + String getReplacer(EmailDesensitize annotation) { + return annotation.replacer(); + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/desensitize/core/slider/annotation/BankCardDesensitize.java b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/desensitize/core/slider/annotation/BankCardDesensitize.java new file mode 100644 index 0000000..136a297 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/desensitize/core/slider/annotation/BankCardDesensitize.java @@ -0,0 +1,47 @@ +package com.platform.marketing.framework.desensitize.core.slider.annotation; + +import com.platform.marketing.framework.desensitize.core.base.annotation.DesensitizeBy; +import com.platform.marketing.framework.desensitize.core.slider.handler.BankCardDesensitization; +import com.fasterxml.jackson.annotation.JacksonAnnotationsInside; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * 银行卡号 + * + * @author gaibu + */ +@Documented +@Target({ElementType.FIELD}) +@Retention(RetentionPolicy.RUNTIME) +@JacksonAnnotationsInside +@DesensitizeBy(handler = BankCardDesensitization.class) +public @interface BankCardDesensitize { + + /** + * 前缀保留长度 + */ + int prefixKeep() default 6; + + /** + * 后缀保留长度 + */ + int suffixKeep() default 2; + + /** + * 替换规则,银行卡号; 比如:9988002866797031 脱敏之后为 998800********31 + */ + String replacer() default "*"; + + /** + * 是否禁用脱敏 + * + * 支持 Spring EL 表达式,如果返回 true 则跳过脱敏 + */ + String disable() default ""; + +} diff --git a/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/desensitize/core/slider/annotation/CarLicenseDesensitize.java b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/desensitize/core/slider/annotation/CarLicenseDesensitize.java new file mode 100644 index 0000000..672c69a --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/desensitize/core/slider/annotation/CarLicenseDesensitize.java @@ -0,0 +1,47 @@ +package com.platform.marketing.framework.desensitize.core.slider.annotation; + +import com.platform.marketing.framework.desensitize.core.base.annotation.DesensitizeBy; +import com.platform.marketing.framework.desensitize.core.slider.handler.CarLicenseDesensitization; +import com.fasterxml.jackson.annotation.JacksonAnnotationsInside; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * 车牌号 + * + * @author gaibu + */ +@Documented +@Target({ElementType.FIELD}) +@Retention(RetentionPolicy.RUNTIME) +@JacksonAnnotationsInside +@DesensitizeBy(handler = CarLicenseDesensitization.class) +public @interface CarLicenseDesensitize { + + /** + * 前缀保留长度 + */ + int prefixKeep() default 3; + + /** + * 后缀保留长度 + */ + int suffixKeep() default 1; + + /** + * 替换规则,车牌号;比如:粤A66666 脱敏之后为粤A6***6 + */ + String replacer() default "*"; + + /** + * 是否禁用脱敏 + * + * 支持 Spring EL 表达式,如果返回 true 则跳过脱敏 + */ + String disable() default ""; + +} diff --git a/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/desensitize/core/slider/annotation/ChineseNameDesensitize.java b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/desensitize/core/slider/annotation/ChineseNameDesensitize.java new file mode 100644 index 0000000..0efc7f5 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/desensitize/core/slider/annotation/ChineseNameDesensitize.java @@ -0,0 +1,47 @@ +package com.platform.marketing.framework.desensitize.core.slider.annotation; + +import com.platform.marketing.framework.desensitize.core.base.annotation.DesensitizeBy; +import com.platform.marketing.framework.desensitize.core.slider.handler.ChineseNameDesensitization; +import com.fasterxml.jackson.annotation.JacksonAnnotationsInside; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * 中文名 + * + * @author gaibu + */ +@Documented +@Target({ElementType.FIELD}) +@Retention(RetentionPolicy.RUNTIME) +@JacksonAnnotationsInside +@DesensitizeBy(handler = ChineseNameDesensitization.class) +public @interface ChineseNameDesensitize { + + /** + * 前缀保留长度 + */ + int prefixKeep() default 1; + + /** + * 后缀保留长度 + */ + int suffixKeep() default 0; + + /** + * 替换规则,中文名;比如:刘子豪脱敏之后为刘** + */ + String replacer() default "*"; + + /** + * 是否禁用脱敏 + * + * 支持 Spring EL 表达式,如果返回 true 则跳过脱敏 + */ + String disable() default ""; + +} diff --git a/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/desensitize/core/slider/annotation/FixedPhoneDesensitize.java b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/desensitize/core/slider/annotation/FixedPhoneDesensitize.java new file mode 100644 index 0000000..a61f042 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/desensitize/core/slider/annotation/FixedPhoneDesensitize.java @@ -0,0 +1,47 @@ +package com.platform.marketing.framework.desensitize.core.slider.annotation; + +import com.platform.marketing.framework.desensitize.core.base.annotation.DesensitizeBy; +import com.platform.marketing.framework.desensitize.core.slider.handler.FixedPhoneDesensitization; +import com.fasterxml.jackson.annotation.JacksonAnnotationsInside; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * 固定电话 + * + * @author gaibu + */ +@Documented +@Target({ElementType.FIELD}) +@Retention(RetentionPolicy.RUNTIME) +@JacksonAnnotationsInside +@DesensitizeBy(handler = FixedPhoneDesensitization.class) +public @interface FixedPhoneDesensitize { + + /** + * 前缀保留长度 + */ + int prefixKeep() default 4; + + /** + * 后缀保留长度 + */ + int suffixKeep() default 2; + + /** + * 替换规则,固定电话;比如:01086551122 脱敏之后为 0108*****22 + */ + String replacer() default "*"; + + /** + * 是否禁用脱敏 + * + * 支持 Spring EL 表达式,如果返回 true 则跳过脱敏 + */ + String disable() default ""; + +} diff --git a/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/desensitize/core/slider/annotation/IdCardDesensitize.java b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/desensitize/core/slider/annotation/IdCardDesensitize.java new file mode 100644 index 0000000..e1613c1 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/desensitize/core/slider/annotation/IdCardDesensitize.java @@ -0,0 +1,47 @@ +package com.platform.marketing.framework.desensitize.core.slider.annotation; + +import com.platform.marketing.framework.desensitize.core.base.annotation.DesensitizeBy; +import com.platform.marketing.framework.desensitize.core.slider.handler.IdCardDesensitization; +import com.fasterxml.jackson.annotation.JacksonAnnotationsInside; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * 身份证 + * + * @author gaibu + */ +@Documented +@Target({ElementType.FIELD}) +@Retention(RetentionPolicy.RUNTIME) +@JacksonAnnotationsInside +@DesensitizeBy(handler = IdCardDesensitization.class) +public @interface IdCardDesensitize { + + /** + * 前缀保留长度 + */ + int prefixKeep() default 6; + + /** + * 后缀保留长度 + */ + int suffixKeep() default 2; + + /** + * 替换规则,身份证号码;比如:530321199204074611 脱敏之后为 530321**********11 + */ + String replacer() default "*"; + + /** + * 是否禁用脱敏 + * + * 支持 Spring EL 表达式,如果返回 true 则跳过脱敏 + */ + String disable() default ""; + +} diff --git a/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/desensitize/core/slider/annotation/MobileDesensitize.java b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/desensitize/core/slider/annotation/MobileDesensitize.java new file mode 100644 index 0000000..5b841d2 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/desensitize/core/slider/annotation/MobileDesensitize.java @@ -0,0 +1,47 @@ +package com.platform.marketing.framework.desensitize.core.slider.annotation; + +import com.platform.marketing.framework.desensitize.core.base.annotation.DesensitizeBy; +import com.platform.marketing.framework.desensitize.core.slider.handler.MobileDesensitization; +import com.fasterxml.jackson.annotation.JacksonAnnotationsInside; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * 手机号 + * + * @author gaibu + */ +@Documented +@Target({ElementType.FIELD}) +@Retention(RetentionPolicy.RUNTIME) +@JacksonAnnotationsInside +@DesensitizeBy(handler = MobileDesensitization.class) +public @interface MobileDesensitize { + + /** + * 前缀保留长度 + */ + int prefixKeep() default 3; + + /** + * 后缀保留长度 + */ + int suffixKeep() default 4; + + /** + * 替换规则,手机号;比如:13248765917 脱敏之后为 132****5917 + */ + String replacer() default "*"; + + /** + * 是否禁用脱敏 + * + * 支持 Spring EL 表达式,如果返回 true 则跳过脱敏 + */ + String disable() default ""; + +} diff --git a/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/desensitize/core/slider/annotation/PasswordDesensitize.java b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/desensitize/core/slider/annotation/PasswordDesensitize.java new file mode 100644 index 0000000..95ee3f5 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/desensitize/core/slider/annotation/PasswordDesensitize.java @@ -0,0 +1,49 @@ +package com.platform.marketing.framework.desensitize.core.slider.annotation; + +import com.platform.marketing.framework.desensitize.core.base.annotation.DesensitizeBy; +import com.platform.marketing.framework.desensitize.core.slider.handler.PasswordDesensitization; +import com.fasterxml.jackson.annotation.JacksonAnnotationsInside; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * 密码 + * + * @author gaibu + */ +@Documented +@Target({ElementType.FIELD}) +@Retention(RetentionPolicy.RUNTIME) +@JacksonAnnotationsInside +@DesensitizeBy(handler = PasswordDesensitization.class) +public @interface PasswordDesensitize { + + /** + * 前缀保留长度 + */ + int prefixKeep() default 0; + + /** + * 后缀保留长度 + */ + int suffixKeep() default 0; + + /** + * 替换规则,密码; + * + * 比如:123456 脱敏之后为 ****** + */ + String replacer() default "*"; + + /** + * 是否禁用脱敏 + * + * 支持 Spring EL 表达式,如果返回 true 则跳过脱敏 + */ + String disable() default ""; + +} diff --git a/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/desensitize/core/slider/annotation/SliderDesensitize.java b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/desensitize/core/slider/annotation/SliderDesensitize.java new file mode 100644 index 0000000..7349a3d --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/desensitize/core/slider/annotation/SliderDesensitize.java @@ -0,0 +1,51 @@ +package com.platform.marketing.framework.desensitize.core.slider.annotation; + +import com.platform.marketing.framework.desensitize.core.base.annotation.DesensitizeBy; +import com.platform.marketing.framework.desensitize.core.slider.handler.DefaultDesensitizationHandler; +import com.fasterxml.jackson.annotation.JacksonAnnotationsInside; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * 滑动脱敏注解 + * + * @author gaibu + */ +@Documented +@Target({ElementType.FIELD, ElementType.ANNOTATION_TYPE}) +@Retention(RetentionPolicy.RUNTIME) +@JacksonAnnotationsInside +@DesensitizeBy(handler = DefaultDesensitizationHandler.class) +public @interface SliderDesensitize { + + /** + * 后缀保留长度 + */ + int suffixKeep() default 0; + + /** + * 替换规则,会将前缀后缀保留后,全部替换成 replacer + * + * 例如:prefixKeep = 1; suffixKeep = 2; replacer = "*"; + * 原始字符串 123456 + * 脱敏后 1***56 + */ + String replacer() default "*"; + + /** + * 前缀保留长度 + */ + int prefixKeep() default 0; + + /** + * 是否禁用脱敏 + * + * 支持 Spring EL 表达式,如果返回 true 则跳过脱敏 + */ + String disable() default ""; + +} diff --git a/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/desensitize/core/slider/handler/AbstractSliderDesensitizationHandler.java b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/desensitize/core/slider/handler/AbstractSliderDesensitizationHandler.java new file mode 100644 index 0000000..80fe5ea --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/desensitize/core/slider/handler/AbstractSliderDesensitizationHandler.java @@ -0,0 +1,78 @@ +package com.platform.marketing.framework.desensitize.core.slider.handler; + +import cn.hutool.core.util.StrUtil; +import com.platform.marketing.framework.common.util.spring.SpringExpressionUtils; +import com.platform.marketing.framework.desensitize.core.base.handler.DesensitizationHandler; + +import java.lang.annotation.Annotation; + +/** + * 滑动脱敏处理器抽象类,已实现通用的方法 + * + * @author gaibu + */ +public abstract class AbstractSliderDesensitizationHandler + implements DesensitizationHandler { + + @Override + public String desensitize(String origin, T annotation) { + // 1. 判断是否禁用脱敏 + Object disable = SpringExpressionUtils.parseExpression(getDisable(annotation)); + if (Boolean.TRUE.equals(disable)) { + return origin; + } + + // 2. 执行脱敏 + int prefixKeep = getPrefixKeep(annotation); + int suffixKeep = getSuffixKeep(annotation); + String replacer = getReplacer(annotation); + int length = origin.length(); + int interval = length - prefixKeep - suffixKeep; + + // 情况一:原始字符串长度小于等于前后缀保留字符串长度,则原始字符串全部替换 + if (interval <= 0) { + return buildReplacerByLength(replacer, length); + } + + // 情况二:原始字符串长度大于前后缀保留字符串长度,则替换中间字符串 + return origin.substring(0, prefixKeep) + + buildReplacerByLength(replacer, interval) + + origin.substring(prefixKeep + interval); + } + + /** + * 根据长度循环构建替换符 + * + * @param replacer 替换符 + * @param length 长度 + * @return 构建后的替换符 + */ + private String buildReplacerByLength(String replacer, int length) { + return StrUtil.repeat(replacer, length); + } + + /** + * 前缀保留长度 + * + * @param annotation 注解信息 + * @return 前缀保留长度 + */ + abstract Integer getPrefixKeep(T annotation); + + /** + * 后缀保留长度 + * + * @param annotation 注解信息 + * @return 后缀保留长度 + */ + abstract Integer getSuffixKeep(T annotation); + + /** + * 替换符 + * + * @param annotation 注解信息 + * @return 替换符 + */ + abstract String getReplacer(T annotation); + +} diff --git a/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/desensitize/core/slider/handler/BankCardDesensitization.java b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/desensitize/core/slider/handler/BankCardDesensitization.java new file mode 100644 index 0000000..1ae043d --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/desensitize/core/slider/handler/BankCardDesensitization.java @@ -0,0 +1,32 @@ +package com.platform.marketing.framework.desensitize.core.slider.handler; + +import com.platform.marketing.framework.desensitize.core.slider.annotation.BankCardDesensitize; + +/** + * {@link BankCardDesensitize} 的脱敏处理器 + * + * @author gaibu + */ +public class BankCardDesensitization extends AbstractSliderDesensitizationHandler { + + @Override + Integer getPrefixKeep(BankCardDesensitize annotation) { + return annotation.prefixKeep(); + } + + @Override + Integer getSuffixKeep(BankCardDesensitize annotation) { + return annotation.suffixKeep(); + } + + @Override + String getReplacer(BankCardDesensitize annotation) { + return annotation.replacer(); + } + + @Override + public String getDisable(BankCardDesensitize annotation) { + return ""; + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/desensitize/core/slider/handler/CarLicenseDesensitization.java b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/desensitize/core/slider/handler/CarLicenseDesensitization.java new file mode 100644 index 0000000..c218664 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/desensitize/core/slider/handler/CarLicenseDesensitization.java @@ -0,0 +1,32 @@ +package com.platform.marketing.framework.desensitize.core.slider.handler; + +import com.platform.marketing.framework.desensitize.core.slider.annotation.CarLicenseDesensitize; + +/** + * {@link CarLicenseDesensitize} 的脱敏处理器 + * + * @author gaibu + */ +public class CarLicenseDesensitization extends AbstractSliderDesensitizationHandler { + + @Override + Integer getPrefixKeep(CarLicenseDesensitize annotation) { + return annotation.prefixKeep(); + } + + @Override + Integer getSuffixKeep(CarLicenseDesensitize annotation) { + return annotation.suffixKeep(); + } + + @Override + String getReplacer(CarLicenseDesensitize annotation) { + return annotation.replacer(); + } + + @Override + public String getDisable(CarLicenseDesensitize annotation) { + return annotation.disable(); + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/desensitize/core/slider/handler/ChineseNameDesensitization.java b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/desensitize/core/slider/handler/ChineseNameDesensitization.java new file mode 100644 index 0000000..43f557f --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/desensitize/core/slider/handler/ChineseNameDesensitization.java @@ -0,0 +1,27 @@ +package com.platform.marketing.framework.desensitize.core.slider.handler; + +import com.platform.marketing.framework.desensitize.core.slider.annotation.ChineseNameDesensitize; + +/** + * {@link ChineseNameDesensitize} 的脱敏处理器 + * + * @author gaibu + */ +public class ChineseNameDesensitization extends AbstractSliderDesensitizationHandler { + + @Override + Integer getPrefixKeep(ChineseNameDesensitize annotation) { + return annotation.prefixKeep(); + } + + @Override + Integer getSuffixKeep(ChineseNameDesensitize annotation) { + return annotation.suffixKeep(); + } + + @Override + String getReplacer(ChineseNameDesensitize annotation) { + return annotation.replacer(); + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/desensitize/core/slider/handler/DefaultDesensitizationHandler.java b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/desensitize/core/slider/handler/DefaultDesensitizationHandler.java new file mode 100644 index 0000000..046d33c --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/desensitize/core/slider/handler/DefaultDesensitizationHandler.java @@ -0,0 +1,27 @@ +package com.platform.marketing.framework.desensitize.core.slider.handler; + +import com.platform.marketing.framework.desensitize.core.slider.annotation.SliderDesensitize; + +/** + * {@link SliderDesensitize} 的脱敏处理器 + * + * @author gaibu + */ +public class DefaultDesensitizationHandler extends AbstractSliderDesensitizationHandler { + + @Override + Integer getPrefixKeep(SliderDesensitize annotation) { + return annotation.prefixKeep(); + } + + @Override + Integer getSuffixKeep(SliderDesensitize annotation) { + return annotation.suffixKeep(); + } + + @Override + String getReplacer(SliderDesensitize annotation) { + return annotation.replacer(); + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/desensitize/core/slider/handler/FixedPhoneDesensitization.java b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/desensitize/core/slider/handler/FixedPhoneDesensitization.java new file mode 100644 index 0000000..aad1591 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/desensitize/core/slider/handler/FixedPhoneDesensitization.java @@ -0,0 +1,27 @@ +package com.platform.marketing.framework.desensitize.core.slider.handler; + +import com.platform.marketing.framework.desensitize.core.slider.annotation.FixedPhoneDesensitize; + +/** + * {@link FixedPhoneDesensitize} 的脱敏处理器 + * + * @author gaibu + */ +public class FixedPhoneDesensitization extends AbstractSliderDesensitizationHandler { + + @Override + Integer getPrefixKeep(FixedPhoneDesensitize annotation) { + return annotation.prefixKeep(); + } + + @Override + Integer getSuffixKeep(FixedPhoneDesensitize annotation) { + return annotation.suffixKeep(); + } + + @Override + String getReplacer(FixedPhoneDesensitize annotation) { + return annotation.replacer(); + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/desensitize/core/slider/handler/IdCardDesensitization.java b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/desensitize/core/slider/handler/IdCardDesensitization.java new file mode 100644 index 0000000..c9f6e07 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/desensitize/core/slider/handler/IdCardDesensitization.java @@ -0,0 +1,26 @@ +package com.platform.marketing.framework.desensitize.core.slider.handler; + +import com.platform.marketing.framework.desensitize.core.slider.annotation.IdCardDesensitize; + +/** + * {@link IdCardDesensitize} 的脱敏处理器 + * + * @author gaibu + */ +public class IdCardDesensitization extends AbstractSliderDesensitizationHandler { + @Override + Integer getPrefixKeep(IdCardDesensitize annotation) { + return annotation.prefixKeep(); + } + + @Override + Integer getSuffixKeep(IdCardDesensitize annotation) { + return annotation.suffixKeep(); + } + + @Override + String getReplacer(IdCardDesensitize annotation) { + return annotation.replacer(); + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/desensitize/core/slider/handler/MobileDesensitization.java b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/desensitize/core/slider/handler/MobileDesensitization.java new file mode 100644 index 0000000..1dc9c3e --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/desensitize/core/slider/handler/MobileDesensitization.java @@ -0,0 +1,27 @@ +package com.platform.marketing.framework.desensitize.core.slider.handler; + +import com.platform.marketing.framework.desensitize.core.slider.annotation.MobileDesensitize; + +/** + * {@link MobileDesensitize} 的脱敏处理器 + * + * @author gaibu + */ +public class MobileDesensitization extends AbstractSliderDesensitizationHandler { + + @Override + Integer getPrefixKeep(MobileDesensitize annotation) { + return annotation.prefixKeep(); + } + + @Override + Integer getSuffixKeep(MobileDesensitize annotation) { + return annotation.suffixKeep(); + } + + @Override + String getReplacer(MobileDesensitize annotation) { + return annotation.replacer(); + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/desensitize/core/slider/handler/PasswordDesensitization.java b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/desensitize/core/slider/handler/PasswordDesensitization.java new file mode 100644 index 0000000..3bd2445 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/desensitize/core/slider/handler/PasswordDesensitization.java @@ -0,0 +1,26 @@ +package com.platform.marketing.framework.desensitize.core.slider.handler; + +import com.platform.marketing.framework.desensitize.core.slider.annotation.PasswordDesensitize; + +/** + * {@link PasswordDesensitize} 的码脱敏处理器 + * + * @author gaibu + */ +public class PasswordDesensitization extends AbstractSliderDesensitizationHandler { + @Override + Integer getPrefixKeep(PasswordDesensitize annotation) { + return annotation.prefixKeep(); + } + + @Override + Integer getSuffixKeep(PasswordDesensitize annotation) { + return annotation.suffixKeep(); + } + + @Override + String getReplacer(PasswordDesensitize annotation) { + return annotation.replacer(); + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/jackson/config/MarketingJacksonAutoConfiguration.java b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/jackson/config/MarketingJacksonAutoConfiguration.java new file mode 100644 index 0000000..d145cee --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/jackson/config/MarketingJacksonAutoConfiguration.java @@ -0,0 +1,52 @@ +package com.platform.marketing.framework.jackson.config; + +import cn.hutool.core.collection.CollUtil; +import com.platform.marketing.framework.common.util.json.JsonUtils; +import com.platform.marketing.framework.common.util.json.databind.NumberSerializer; +import com.platform.marketing.framework.common.util.json.databind.TimestampLocalDateTimeDeserializer; +import com.platform.marketing.framework.common.util.json.databind.TimestampLocalDateTimeSerializer; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.module.SimpleModule; +import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer; +import com.fasterxml.jackson.datatype.jsr310.deser.LocalTimeDeserializer; +import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer; +import com.fasterxml.jackson.datatype.jsr310.ser.LocalTimeSerializer; +import lombok.extern.slf4j.Slf4j; +import org.springframework.boot.autoconfigure.AutoConfiguration; +import org.springframework.context.annotation.Bean; + +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.util.List; + +@AutoConfiguration +@Slf4j +public class MarketingJacksonAutoConfiguration { + + @Bean + @SuppressWarnings("InstantiationOfUtilityClass") + public JsonUtils jsonUtils(List objectMappers) { + // 1.1 创建 SimpleModule 对象 + SimpleModule simpleModule = new SimpleModule(); + simpleModule + // 新增 Long 类型序列化规则,数值超过 2^53-1,在 JS 会出现精度丢失问题,因此 Long 自动序列化为字符串类型 + .addSerializer(Long.class, NumberSerializer.INSTANCE) + .addSerializer(Long.TYPE, NumberSerializer.INSTANCE) + .addSerializer(LocalDate.class, LocalDateSerializer.INSTANCE) + .addDeserializer(LocalDate.class, LocalDateDeserializer.INSTANCE) + .addSerializer(LocalTime.class, LocalTimeSerializer.INSTANCE) + .addDeserializer(LocalTime.class, LocalTimeDeserializer.INSTANCE) + // 新增 LocalDateTime 序列化、反序列化规则,使用 Long 时间戳 + .addSerializer(LocalDateTime.class, TimestampLocalDateTimeSerializer.INSTANCE) + .addDeserializer(LocalDateTime.class, TimestampLocalDateTimeDeserializer.INSTANCE); + // 1.2 注册到 objectMapper + objectMappers.forEach(objectMapper -> objectMapper.registerModule(simpleModule)); + + // 2. 设置 objectMapper 到 JsonUtils + JsonUtils.init(CollUtil.getFirst(objectMappers)); + log.info("[init][初始化 JsonUtils 成功]"); + return new JsonUtils(); + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/swagger/config/MarketingSwaggerAutoConfiguration.java b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/swagger/config/MarketingSwaggerAutoConfiguration.java new file mode 100644 index 0000000..54f4c0d --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/swagger/config/MarketingSwaggerAutoConfiguration.java @@ -0,0 +1,156 @@ +package com.platform.marketing.framework.swagger.config; + +import io.swagger.v3.oas.models.Components; +import io.swagger.v3.oas.models.OpenAPI; +import io.swagger.v3.oas.models.info.Contact; +import io.swagger.v3.oas.models.info.Info; +import io.swagger.v3.oas.models.info.License; +import io.swagger.v3.oas.models.media.IntegerSchema; +import io.swagger.v3.oas.models.media.StringSchema; +import io.swagger.v3.oas.models.parameters.Parameter; +import io.swagger.v3.oas.models.security.SecurityRequirement; +import io.swagger.v3.oas.models.security.SecurityScheme; +import org.springdoc.core.*; +import org.springdoc.core.customizers.OpenApiBuilderCustomizer; +import org.springdoc.core.customizers.ServerBaseUrlCustomizer; +import org.springdoc.core.providers.JavadocProvider; +import org.springframework.boot.autoconfigure.AutoConfiguration; +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Primary; +import org.springframework.http.HttpHeaders; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +import static com.platform.marketing.framework.web.core.util.WebFrameworkUtils.HEADER_TENANT_ID; + +/** + * Swagger 自动配置类,基于 OpenAPI + Springdoc 实现。 + * + * 友情提示: + * 1. Springdoc 文档地址:仓库 + * 2. Swagger 规范,于 2015 更名为 OpenAPI 规范,本质是一个东西 + * + + */ +@AutoConfiguration +@ConditionalOnClass({OpenAPI.class}) +@EnableConfigurationProperties(SwaggerProperties.class) +@ConditionalOnProperty(prefix = "springdoc.api-docs", name = "enabled", havingValue = "true", matchIfMissing = true) // 设置为 false 时,禁用 +public class MarketingSwaggerAutoConfiguration { + + // ========== 全局 OpenAPI 配置 ========== + + @Bean + public OpenAPI createApi(SwaggerProperties properties) { + Map securitySchemas = buildSecuritySchemes(); + OpenAPI openAPI = new OpenAPI() + // 接口信息 + .info(buildInfo(properties)) + // 接口安全配置 + .components(new Components().securitySchemes(securitySchemas)) + .addSecurityItem(new SecurityRequirement().addList(HttpHeaders.AUTHORIZATION)); + securitySchemas.keySet().forEach(key -> openAPI.addSecurityItem(new SecurityRequirement().addList(key))); + return openAPI; + } + + /** + * API 摘要信息 + */ + private Info buildInfo(SwaggerProperties properties) { + return new Info() + .title(properties.getTitle()) + .description(properties.getDescription()) + .version(properties.getVersion()) + .contact(new Contact().name(properties.getAuthor()).url(properties.getUrl()).email(properties.getEmail())) + .license(new License().name(properties.getLicense()).url(properties.getLicenseUrl())); + } + + /** + * 安全模式,这里配置通过请求头 Authorization 传递 token 参数 + */ + private Map buildSecuritySchemes() { + Map securitySchemes = new HashMap<>(); + SecurityScheme securityScheme = new SecurityScheme() + .type(SecurityScheme.Type.APIKEY) // 类型 + .name(HttpHeaders.AUTHORIZATION) // 请求头的 name + .in(SecurityScheme.In.HEADER); // token 所在位置 + securitySchemes.put(HttpHeaders.AUTHORIZATION, securityScheme); + return securitySchemes; + } + + /** + * 自定义 OpenAPI 处理器 + */ + @Bean + @Primary // 目的:以我们创建的 OpenAPIService Bean 为主,避免一键改包后,启动报错! + public OpenAPIService openApiBuilder(Optional openAPI, + SecurityService securityParser, + SpringDocConfigProperties springDocConfigProperties, + PropertyResolverUtils propertyResolverUtils, + Optional> openApiBuilderCustomizers, + Optional> serverBaseUrlCustomizers, + Optional javadocProvider) { + return new OpenAPIService(openAPI, securityParser, springDocConfigProperties, + propertyResolverUtils, openApiBuilderCustomizers, serverBaseUrlCustomizers, javadocProvider); + } + + // ========== 分组 OpenAPI 配置 ========== + + /** + * 所有模块的 API 分组 + */ + @Bean + public GroupedOpenApi allGroupedOpenApi() { + return buildGroupedOpenApi("all", ""); + } + + public static GroupedOpenApi buildGroupedOpenApi(String group) { + return buildGroupedOpenApi(group, group); + } + + public static GroupedOpenApi buildGroupedOpenApi(String group, String path) { + return GroupedOpenApi.builder() + .group(group) + .pathsToMatch("/api/" + path + "/**") + .addOperationCustomizer((operation, handlerMethod) -> operation + .addParametersItem(buildTenantHeaderParameter()) + .addParametersItem(buildSecurityHeaderParameter())) + .build(); + } + + /** + * 构建 Tenant 租户编号请求头参数 + * + * @return 多租户参数 + */ + private static Parameter buildTenantHeaderParameter() { + return new Parameter() + .name(HEADER_TENANT_ID) // header 名 + .description("租户编号") // 描述 + .in(String.valueOf(SecurityScheme.In.HEADER)) // 请求 header + .schema(new IntegerSchema()._default(1L).name(HEADER_TENANT_ID).description("租户编号")); // 默认:使用租户编号为 1 + } + + /** + * 构建 Authorization 认证请求头参数 + * + * 解决 Knife4j Authorize 未生效,请求header里未包含参数 + * + * @return 认证参数 + */ + private static Parameter buildSecurityHeaderParameter() { + return new Parameter() + .name(HttpHeaders.AUTHORIZATION) // header 名 + .description("认证 Token") // 描述 + .in(String.valueOf(SecurityScheme.In.HEADER)) // 请求 header + .schema(new StringSchema()._default("Bearer test1").name(HEADER_TENANT_ID).description("认证 Token")); // 默认:使用用户编号为 1 + } + +} + diff --git a/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/swagger/config/SwaggerProperties.java b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/swagger/config/SwaggerProperties.java new file mode 100644 index 0000000..99b37b7 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/swagger/config/SwaggerProperties.java @@ -0,0 +1,60 @@ +package com.platform.marketing.framework.swagger.config; + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; + +import javax.validation.constraints.NotEmpty; + +/** + * Swagger 配置属性 + * + + */ +@ConfigurationProperties("marketing.swagger") +@Data +public class SwaggerProperties { + + /** + * 标题 + */ + @NotEmpty(message = "标题不能为空") + private String title; + /** + * 描述 + */ + @NotEmpty(message = "描述不能为空") + private String description; + /** + * 作者 + */ + @NotEmpty(message = "作者不能为空") + private String author; + /** + * 版本 + */ + @NotEmpty(message = "版本不能为空") + private String version; + /** + * url + */ + @NotEmpty(message = "扫描的 package 不能为空") + private String url; + /** + * email + */ + @NotEmpty(message = "扫描的 email 不能为空") + private String email; + + /** + * license + */ + @NotEmpty(message = "扫描的 license 不能为空") + private String license; + + /** + * license-url + */ + @NotEmpty(message = "扫描的 license-url 不能为空") + private String licenseUrl; + +} diff --git a/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/web/config/MarketingWebAutoConfiguration.java b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/web/config/MarketingWebAutoConfiguration.java new file mode 100644 index 0000000..558266c --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/web/config/MarketingWebAutoConfiguration.java @@ -0,0 +1,130 @@ +package com.platform.marketing.framework.web.config; + +import com.platform.marketing.framework.common.enums.WebFilterOrderEnum; +import com.platform.marketing.framework.web.core.filter.CacheRequestBodyFilter; +import com.platform.marketing.framework.web.core.filter.DemoFilter; +import com.platform.marketing.framework.web.core.handler.GlobalExceptionHandler; +import com.platform.marketing.framework.web.core.handler.GlobalResponseBodyHandler; +import com.platform.marketing.framework.web.core.util.WebFrameworkUtils; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.autoconfigure.AutoConfiguration; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.boot.autoconfigure.web.client.RestTemplateAutoConfiguration; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.boot.web.client.RestTemplateBuilder; +import org.springframework.boot.web.servlet.FilterRegistrationBean; +import org.springframework.context.annotation.Bean; +import org.springframework.util.AntPathMatcher; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.client.RestTemplate; +import org.springframework.web.cors.CorsConfiguration; +import org.springframework.web.cors.UrlBasedCorsConfigurationSource; +import org.springframework.web.filter.CorsFilter; +import org.springframework.web.servlet.config.annotation.PathMatchConfigurer; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +import javax.annotation.Resource; +import javax.servlet.Filter; + +@AutoConfiguration +@EnableConfigurationProperties(WebProperties.class) +public class MarketingWebAutoConfiguration implements WebMvcConfigurer { + + @Resource + private WebProperties webProperties; + /** + * 应用名 + */ + @Value("${spring.application.name}") + private String applicationName; + + @Override + public void configurePathMatch(PathMatchConfigurer configurer) { + configurePathMatch(configurer, webProperties.getAdminApi()); + } + + /** + * 设置 API 前缀,仅仅匹配 controller 包下的 + * + * @param configurer 配置 + * @param api API 配置 + */ + private void configurePathMatch(PathMatchConfigurer configurer, WebProperties.Api api) { + AntPathMatcher antPathMatcher = new AntPathMatcher("."); + configurer.addPathPrefix(api.getPrefix(), clazz -> clazz.isAnnotationPresent(RestController.class) + && antPathMatcher.match(api.getController(), clazz.getPackage().getName())); // 仅仅匹配 controller 包 + } + + @Bean + @SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection") + public GlobalExceptionHandler globalExceptionHandler() { + return new GlobalExceptionHandler(applicationName); + } + + @Bean + public GlobalResponseBodyHandler globalResponseBodyHandler() { + return new GlobalResponseBodyHandler(); + } + + @Bean + @SuppressWarnings("InstantiationOfUtilityClass") + public WebFrameworkUtils webFrameworkUtils(WebProperties webProperties) { + // 由于 WebFrameworkUtils 需要使用到 webProperties 属性,所以注册为一个 Bean + return new WebFrameworkUtils(webProperties); + } + + // ========== Filter 相关 ========== + + /** + * 创建 CorsFilter Bean,解决跨域问题 + */ + @Bean + public FilterRegistrationBean corsFilterBean() { + // 创建 CorsConfiguration 对象 + CorsConfiguration config = new CorsConfiguration(); + config.setAllowCredentials(true); + config.addAllowedOriginPattern("*"); // 设置访问源地址 + config.addAllowedHeader("*"); // 设置访问源请求头 + config.addAllowedMethod("*"); // 设置访问源请求方法 + // 创建 UrlBasedCorsConfigurationSource 对象 + UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); + source.registerCorsConfiguration("/**", config); // 对接口配置跨域设置 + return createFilterBean(new CorsFilter(source), WebFilterOrderEnum.CORS_FILTER); + } + + /** + * 创建 RequestBodyCacheFilter Bean,可重复读取请求内容 + */ + @Bean + public FilterRegistrationBean requestBodyCacheFilter() { + return createFilterBean(new CacheRequestBodyFilter(), WebFilterOrderEnum.REQUEST_BODY_CACHE_FILTER); + } + + /** + * 创建 DemoFilter Bean,演示模式 + */ + @Bean + @ConditionalOnProperty(value = "marketing.demo", havingValue = "true") + public FilterRegistrationBean demoFilter() { + return createFilterBean(new DemoFilter(), WebFilterOrderEnum.DEMO_FILTER); + } + + public static FilterRegistrationBean createFilterBean(T filter, Integer order) { + FilterRegistrationBean bean = new FilterRegistrationBean<>(filter); + bean.setOrder(order); + return bean; + } + + /** + * 创建 RestTemplate 实例 + * + * @param restTemplateBuilder {@link RestTemplateAutoConfiguration#restTemplateBuilder} + */ + @Bean + @ConditionalOnMissingBean + public RestTemplate restTemplate(RestTemplateBuilder restTemplateBuilder) { + return restTemplateBuilder.build(); + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/web/config/WebProperties.java b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/web/config/WebProperties.java new file mode 100644 index 0000000..247f87d --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/web/config/WebProperties.java @@ -0,0 +1,61 @@ +package com.platform.marketing.framework.web.config; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.servlet.config.annotation.PathMatchConfigurer; + +import javax.validation.Valid; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; + +@ConfigurationProperties(prefix = "marketing.web") +@Validated +@Data +public class WebProperties { + + @NotNull(message = "Admin API 不能为空") + private Api adminApi = new Api("/api", "**.controller.**"); + + @Data + @AllArgsConstructor + @NoArgsConstructor + @Valid + public static class Api { + + /** + * API 前缀,实现所有 Controller 提供的 RESTFul API 的统一前缀 + * + * + * 意义:通过该前缀,避免 Swagger、Actuator 意外通过 Nginx 暴露出来给外部,带来安全性问题 + * 这样,Nginx 只需要配置转发到 /api/* 的所有接口即可。 + * + * @see MarketingWebAutoConfiguration#configurePathMatch(PathMatchConfigurer) + */ + @NotEmpty(message = "API 前缀不能为空") + private String prefix; + + /** + * Controller 所在包的 Ant 路径规则 + * + * 主要目的是,给该 Controller 设置指定的 {@link #prefix} + */ + @NotEmpty(message = "Controller 所在包不能为空") + private String controller; + + } + + @Data + @Valid + public static class Ui { + + /** + * 访问地址 + */ + private String url; + + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/web/core/filter/ApiRequestFilter.java b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/web/core/filter/ApiRequestFilter.java new file mode 100644 index 0000000..517feef --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/web/core/filter/ApiRequestFilter.java @@ -0,0 +1,27 @@ +package com.platform.marketing.framework.web.core.filter; + +import cn.hutool.core.util.StrUtil; +import com.platform.marketing.framework.web.config.WebProperties; +import lombok.RequiredArgsConstructor; +import org.springframework.web.filter.OncePerRequestFilter; + +import javax.servlet.http.HttpServletRequest; + +/** + * 过滤 /api、/app-api 等 API 请求的过滤器 + * + + */ +@RequiredArgsConstructor +public abstract class ApiRequestFilter extends OncePerRequestFilter { + + protected final WebProperties webProperties; + + @Override + protected boolean shouldNotFilter(HttpServletRequest request) { + // 只过滤 API 请求的地址 + String apiUri = request.getRequestURI().substring(request.getContextPath().length()); + return !StrUtil.startWithAny(apiUri, webProperties.getAdminApi().getPrefix()); + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/web/core/filter/CacheRequestBodyFilter.java b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/web/core/filter/CacheRequestBodyFilter.java new file mode 100644 index 0000000..6b437a3 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/web/core/filter/CacheRequestBodyFilter.java @@ -0,0 +1,29 @@ +package com.platform.marketing.framework.web.core.filter; + +import com.platform.marketing.framework.common.util.servlet.ServletUtils; +import org.springframework.web.filter.OncePerRequestFilter; + +import javax.servlet.FilterChain; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +/** + * Request Body 缓存 Filter,实现它的可重复读取 + */ +public class CacheRequestBodyFilter extends OncePerRequestFilter { + + @Override + protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) + throws IOException, ServletException { + filterChain.doFilter(new CacheRequestBodyWrapper(request), response); + } + + @Override + protected boolean shouldNotFilter(HttpServletRequest request) { + // 只处理 json 请求内容 + return !ServletUtils.isJsonRequest(request); + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/web/core/filter/CacheRequestBodyWrapper.java b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/web/core/filter/CacheRequestBodyWrapper.java new file mode 100644 index 0000000..26c9132 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/web/core/filter/CacheRequestBodyWrapper.java @@ -0,0 +1,68 @@ +package com.platform.marketing.framework.web.core.filter; + +import com.platform.marketing.framework.common.util.servlet.ServletUtils; + +import javax.servlet.ReadListener; +import javax.servlet.ServletInputStream; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletRequestWrapper; +import java.io.BufferedReader; +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStreamReader; + +/** + * Request Body 缓存 Wrapper + * + + */ +public class CacheRequestBodyWrapper extends HttpServletRequestWrapper { + + /** + * 缓存的内容 + */ + private final byte[] body; + + public CacheRequestBodyWrapper(HttpServletRequest request) { + super(request); + body = ServletUtils.getBodyBytes(request); + } + + @Override + public BufferedReader getReader() throws IOException { + return new BufferedReader(new InputStreamReader(this.getInputStream())); + } + + @Override + public ServletInputStream getInputStream() throws IOException { + final ByteArrayInputStream inputStream = new ByteArrayInputStream(body); + // 返回 ServletInputStream + return new ServletInputStream() { + + @Override + public int read() { + return inputStream.read(); + } + + @Override + public boolean isFinished() { + return false; + } + + @Override + public boolean isReady() { + return false; + } + + @Override + public void setReadListener(ReadListener readListener) {} + + @Override + public int available() { + return body.length; + } + + }; + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/web/core/filter/DemoFilter.java b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/web/core/filter/DemoFilter.java new file mode 100644 index 0000000..aec385f --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/web/core/filter/DemoFilter.java @@ -0,0 +1,35 @@ +package com.platform.marketing.framework.web.core.filter; + +import cn.hutool.core.util.StrUtil; +import com.platform.marketing.framework.common.pojo.CommonResult; +import com.platform.marketing.framework.common.util.servlet.ServletUtils; +import com.platform.marketing.framework.web.core.util.WebFrameworkUtils; +import org.springframework.web.filter.OncePerRequestFilter; + +import javax.servlet.FilterChain; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import static com.platform.marketing.framework.common.exception.enums.GlobalErrorCodeConstants.DEMO_DENY; + +/** + * 演示 Filter,禁止用户发起写操作,避免影响测试数据 + * + + */ +public class DemoFilter extends OncePerRequestFilter { + + @Override + protected boolean shouldNotFilter(HttpServletRequest request) { + String method = request.getMethod(); + return !StrUtil.equalsAnyIgnoreCase(method, "POST", "PUT", "DELETE") // 写操作时,不进行过滤率 + || WebFrameworkUtils.getLoginUserId(request) == null; // 非登录用户时,不进行过滤 + } + + @Override + protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) { + // 直接返回 DEMO_DENY 的结果。即,请求不继续 + ServletUtils.writeJSON(response, CommonResult.error(DEMO_DENY)); + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/web/core/handler/GlobalExceptionHandler.java b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/web/core/handler/GlobalExceptionHandler.java new file mode 100644 index 0000000..2af19fd --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/web/core/handler/GlobalExceptionHandler.java @@ -0,0 +1,270 @@ +package com.platform.marketing.framework.web.core.handler; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.exceptions.ExceptionUtil; +import cn.hutool.core.map.MapUtil; +import cn.hutool.core.util.ObjUtil; +import cn.hutool.core.util.StrUtil; +import com.platform.marketing.framework.common.exception.ServiceException; +import com.platform.marketing.framework.common.exception.util.ServiceExceptionUtil; +import com.platform.marketing.framework.common.pojo.CommonResult; +import com.platform.marketing.framework.common.util.collection.SetUtils; +import com.platform.marketing.framework.common.util.servlet.ServletUtils; +import com.platform.marketing.framework.web.core.util.WebFrameworkUtils; +import com.fasterxml.jackson.databind.exc.InvalidFormatException; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.http.converter.HttpMessageNotReadableException; +import org.springframework.security.access.AccessDeniedException; +import org.springframework.validation.BindException; +import org.springframework.validation.FieldError; +import org.springframework.validation.ObjectError; +import org.springframework.web.HttpRequestMethodNotSupportedException; +import org.springframework.web.bind.MethodArgumentNotValidException; +import org.springframework.web.bind.MissingServletRequestParameterException; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.RestControllerAdvice; +import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException; +import org.springframework.web.servlet.NoHandlerFoundException; + +import javax.servlet.http.HttpServletRequest; +import javax.validation.ConstraintViolation; +import javax.validation.ConstraintViolationException; +import javax.validation.ValidationException; +import java.time.LocalDateTime; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import static com.platform.marketing.framework.common.exception.enums.GlobalErrorCodeConstants.*; + +/** + * 全局异常处理器,将 Exception 翻译成 CommonResult + 对应的异常编号 + * + + */ +@RestControllerAdvice +@AllArgsConstructor +@Slf4j +public class GlobalExceptionHandler { + + /** + * 忽略的 ServiceException 错误提示,避免打印过多 logger + */ + public static final Set IGNORE_ERROR_MESSAGES = SetUtils.asSet("无效的刷新令牌"); + + @SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection") + private final String applicationName; + + /** + * 处理所有异常,主要是提供给 Filter 使用 + * 因为 Filter 不走 SpringMVC 的流程,但是我们又需要兜底处理异常,所以这里提供一个全量的异常处理过程,保持逻辑统一。 + * + * @param request 请求 + * @param ex 异常 + * @return 通用返回 + */ + public CommonResult allExceptionHandler(HttpServletRequest request, Throwable ex) { + if (ex instanceof MissingServletRequestParameterException) { + return missingServletRequestParameterExceptionHandler((MissingServletRequestParameterException) ex); + } + if (ex instanceof MethodArgumentTypeMismatchException) { + return methodArgumentTypeMismatchExceptionHandler((MethodArgumentTypeMismatchException) ex); + } + if (ex instanceof MethodArgumentNotValidException) { + return methodArgumentNotValidExceptionExceptionHandler((MethodArgumentNotValidException) ex); + } + if (ex instanceof BindException) { + return bindExceptionHandler((BindException) ex); + } + if (ex instanceof ConstraintViolationException) { + return constraintViolationExceptionHandler((ConstraintViolationException) ex); + } + if (ex instanceof ValidationException) { + return validationException((ValidationException) ex); + } + if (ex instanceof NoHandlerFoundException) { + return noHandlerFoundExceptionHandler((NoHandlerFoundException) ex); + } + if (ex instanceof HttpRequestMethodNotSupportedException) { + return httpRequestMethodNotSupportedExceptionHandler((HttpRequestMethodNotSupportedException) ex); + } + if (ex instanceof ServiceException) { + return serviceExceptionHandler((ServiceException) ex); + } + if (ex instanceof AccessDeniedException) { + return accessDeniedExceptionHandler(request, (AccessDeniedException) ex); + } + return defaultExceptionHandler(request, ex); + } + + /** + * 处理 SpringMVC 请求参数缺失 + * + * 例如说,接口上设置了 @RequestParam("xx") 参数,结果并未传递 xx 参数 + */ + @ExceptionHandler(value = MissingServletRequestParameterException.class) + public CommonResult missingServletRequestParameterExceptionHandler(MissingServletRequestParameterException ex) { + log.warn("[missingServletRequestParameterExceptionHandler]", ex); + return CommonResult.error(BAD_REQUEST.getCode(), String.format("请求参数缺失:%s", ex.getParameterName())); + } + + /** + * 处理 SpringMVC 请求参数类型错误 + * + * 例如说,接口上设置了 @RequestParam("xx") 参数为 Integer,结果传递 xx 参数类型为 String + */ + @ExceptionHandler(MethodArgumentTypeMismatchException.class) + public CommonResult methodArgumentTypeMismatchExceptionHandler(MethodArgumentTypeMismatchException ex) { + log.warn("[methodArgumentTypeMismatchExceptionHandler]", ex); + return CommonResult.error(BAD_REQUEST.getCode(), String.format("请求参数类型错误:%s", ex.getMessage())); + } + + /** + * 处理 SpringMVC 参数校验不正确 + */ + @ExceptionHandler(MethodArgumentNotValidException.class) + public CommonResult methodArgumentNotValidExceptionExceptionHandler(MethodArgumentNotValidException ex) { + log.warn("[methodArgumentNotValidExceptionExceptionHandler]", ex); + // 获取 errorMessage + String errorMessage = null; + FieldError fieldError = ex.getBindingResult().getFieldError(); + if (fieldError == null) { + List allErrors = ex.getBindingResult().getAllErrors(); + if (CollUtil.isNotEmpty(allErrors)) { + errorMessage = allErrors.get(0).getDefaultMessage(); + } + } else { + errorMessage = fieldError.getDefaultMessage(); + } + // 转换 CommonResult + if (StrUtil.isEmpty(errorMessage)) { + return CommonResult.error(BAD_REQUEST); + } + return CommonResult.error(BAD_REQUEST.getCode(), String.format("请求参数不正确:%s", errorMessage)); + } + + /** + * 处理 SpringMVC 参数绑定不正确,本质上也是通过 Validator 校验 + */ + @ExceptionHandler(BindException.class) + public CommonResult bindExceptionHandler(BindException ex) { + log.warn("[handleBindException]", ex); + FieldError fieldError = ex.getFieldError(); + assert fieldError != null; // 断言,避免告警 + return CommonResult.error(BAD_REQUEST.getCode(), String.format("请求参数不正确:%s", fieldError.getDefaultMessage())); + } + + /** + * 处理 SpringMVC 请求参数类型错误 + * + * 例如说,接口上设置了 @RequestBody实体中 xx 属性类型为 Integer,结果传递 xx 参数类型为 String + */ + @ExceptionHandler(HttpMessageNotReadableException.class) + public CommonResult methodArgumentTypeInvalidFormatExceptionHandler(HttpMessageNotReadableException ex) { + log.warn("[methodArgumentTypeInvalidFormatExceptionHandler]", ex); + if(ex.getCause() instanceof InvalidFormatException) { + InvalidFormatException invalidFormatException = (InvalidFormatException) ex.getCause(); + return CommonResult.error(BAD_REQUEST.getCode(), String.format("请求参数类型错误:%s", invalidFormatException.getValue())); + }else { + return defaultExceptionHandler(ServletUtils.getRequest(), ex); + } + } + + /** + * 处理 Validator 校验不通过产生的异常 + */ + @ExceptionHandler(value = ConstraintViolationException.class) + public CommonResult constraintViolationExceptionHandler(ConstraintViolationException ex) { + log.warn("[constraintViolationExceptionHandler]", ex); + ConstraintViolation constraintViolation = ex.getConstraintViolations().iterator().next(); + return CommonResult.error(BAD_REQUEST.getCode(), String.format("请求参数不正确:%s", constraintViolation.getMessage())); + } + + /** + * 处理 Dubbo Consumer 本地参数校验时,抛出的 ValidationException 异常 + */ + @ExceptionHandler(value = ValidationException.class) + public CommonResult validationException(ValidationException ex) { + log.warn("[constraintViolationExceptionHandler]", ex); + // 无法拼接明细的错误信息,因为 Dubbo Consumer 抛出 ValidationException 异常时,是直接的字符串信息,且人类不可读 + return CommonResult.error(BAD_REQUEST); + } + + /** + * 处理 SpringMVC 请求地址不存在 + * + * 注意,它需要设置如下两个配置项: + * 1. spring.mvc.throw-exception-if-no-handler-found 为 true + * 2. spring.mvc.static-path-pattern 为 /statics/** + */ + @ExceptionHandler(NoHandlerFoundException.class) + public CommonResult noHandlerFoundExceptionHandler(NoHandlerFoundException ex) { + log.warn("[noHandlerFoundExceptionHandler]", ex); + return CommonResult.error(NOT_FOUND.getCode(), String.format("请求地址不存在:%s", ex.getRequestURL())); + } + + /** + * 处理 SpringMVC 请求方法不正确 + * + * 例如说,A 接口的方法为 GET 方式,结果请求方法为 POST 方式,导致不匹配 + */ + @ExceptionHandler(HttpRequestMethodNotSupportedException.class) + public CommonResult httpRequestMethodNotSupportedExceptionHandler(HttpRequestMethodNotSupportedException ex) { + log.warn("[httpRequestMethodNotSupportedExceptionHandler]", ex); + return CommonResult.error(METHOD_NOT_ALLOWED.getCode(), String.format("请求方法不正确:%s", ex.getMessage())); + } + + /** + * 处理 Spring Security 权限不足的异常 + * + * 来源是,使用 @PreAuthorize 注解,AOP 进行权限拦截 + */ + @ExceptionHandler(value = AccessDeniedException.class) + public CommonResult accessDeniedExceptionHandler(HttpServletRequest req, AccessDeniedException ex) { + log.warn("[accessDeniedExceptionHandler][userId({}) 无法访问 url({})]", WebFrameworkUtils.getLoginUserId(req), + req.getRequestURL(), ex); + return CommonResult.error(FORBIDDEN); + } + + /** + * 处理业务异常 ServiceException + * + * 例如说,商品库存不足,用户手机号已存在。 + */ + @ExceptionHandler(value = ServiceException.class) + public CommonResult serviceExceptionHandler(ServiceException ex) { + // 不包含的时候,才进行打印,避免 ex 堆栈过多 + if (!IGNORE_ERROR_MESSAGES.contains(ex.getMessage())) { + // 即使打印,也只打印第一层 StackTraceElement,并且使用 warn 在控制台输出,更容易看到 + try { + StackTraceElement[] stackTraces = ex.getStackTrace(); + for (StackTraceElement stackTrace : stackTraces) { + if (ObjUtil.notEqual(stackTrace.getClassName(), ServiceExceptionUtil.class.getName())) { + log.warn("[serviceExceptionHandler]\n\t{}", stackTrace); + break; + } + } + } catch (Exception ignored) { + // 忽略日志,避免影响主流程 + } + } + return CommonResult.error(ex.getCode(), ex.getMessage()); + } + + /** + * 处理系统异常,兜底处理所有的一切 + */ + @ExceptionHandler(value = Exception.class) + public CommonResult defaultExceptionHandler(HttpServletRequest req, Throwable ex) { + log.error("[defaultExceptionHandler]", ex); + // 返回 ERROR CommonResult + return CommonResult.error(INTERNAL_SERVER_ERROR.getCode(), INTERNAL_SERVER_ERROR.getMsg()); + } + + private void createExceptionLog(HttpServletRequest req, Throwable e) { + + } + + +} diff --git a/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/web/core/handler/GlobalResponseBodyHandler.java b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/web/core/handler/GlobalResponseBodyHandler.java new file mode 100644 index 0000000..65705d3 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/web/core/handler/GlobalResponseBodyHandler.java @@ -0,0 +1,44 @@ +package com.platform.marketing.framework.web.core.handler; + +import com.platform.marketing.framework.common.pojo.CommonResult; +import com.platform.marketing.framework.web.core.util.WebFrameworkUtils; +import org.springframework.core.MethodParameter; +import org.springframework.http.MediaType; +import org.springframework.http.server.ServerHttpRequest; +import org.springframework.http.server.ServerHttpResponse; +import org.springframework.http.server.ServletServerHttpRequest; +import org.springframework.web.bind.annotation.ControllerAdvice; +import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice; + +/** + * 全局响应结果(ResponseBody)处理器 + * + * 不同于在网上看到的很多文章,会选择自动将 Controller 返回结果包上 {@link CommonResult}, + * 在 onemall 中,是 Controller 在返回时,主动自己包上 {@link CommonResult}。 + * 原因是,GlobalResponseBodyHandler 本质上是 AOP,它不应该改变 Controller 返回的数据结构 + * + * 目前,GlobalResponseBodyHandler 的主要作用是,记录 Controller 的返回结果, + */ +@ControllerAdvice +public class GlobalResponseBodyHandler implements ResponseBodyAdvice { + + @Override + @SuppressWarnings("NullableProblems") // 避免 IDEA 警告 + public boolean supports(MethodParameter returnType, Class converterType) { + if (returnType.getMethod() == null) { + return false; + } + // 只拦截返回结果为 CommonResult 类型 + return returnType.getMethod().getReturnType() == CommonResult.class; + } + + @Override + @SuppressWarnings("NullableProblems") // 避免 IDEA 警告 + public Object beforeBodyWrite(Object body, MethodParameter returnType, MediaType selectedContentType, Class selectedConverterType, + ServerHttpRequest request, ServerHttpResponse response) { + // 记录 Controller 结果 + WebFrameworkUtils.setCommonResult(((ServletServerHttpRequest) request).getServletRequest(), (CommonResult) body); + return body; + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/web/core/util/WebFrameworkUtils.java b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/web/core/util/WebFrameworkUtils.java new file mode 100644 index 0000000..dd247b6 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/web/core/util/WebFrameworkUtils.java @@ -0,0 +1,143 @@ +package com.platform.marketing.framework.web.core.util; + +import cn.hutool.core.util.NumberUtil; +import cn.hutool.extra.servlet.ServletUtil; +import com.platform.marketing.framework.common.enums.TerminalEnum; +import com.platform.marketing.framework.common.enums.UserTypeEnum; +import com.platform.marketing.framework.common.pojo.CommonResult; +import com.platform.marketing.framework.common.util.servlet.ServletUtils; +import com.platform.marketing.framework.web.config.WebProperties; +import org.springframework.web.context.request.RequestAttributes; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.servlet.ServletRequest; +import javax.servlet.http.HttpServletRequest; + +/** + * 专属于 web 包的工具类 + * + + */ +public class WebFrameworkUtils { + + private static final String REQUEST_ATTRIBUTE_LOGIN_USER_ID = "login_user_id"; + private static final String REQUEST_ATTRIBUTE_LOGIN_USER_TYPE = "login_user_type"; + + private static final String REQUEST_ATTRIBUTE_COMMON_RESULT = "common_result"; + + public static final String HEADER_TENANT_ID = "tenant-id"; + + /** + * 终端的 Header + * + * @see com.platform.marketing.framework.common.enums.TerminalEnum + */ + public static final String HEADER_TERMINAL = "terminal"; + + private static WebProperties properties; + + public WebFrameworkUtils(WebProperties webProperties) { + WebFrameworkUtils.properties = webProperties; + } + + /** + * 获得租户编号,从 header 中 + * 考虑到其它 framework 组件也会使用到租户编号,所以不得不放在 WebFrameworkUtils 统一提供 + * + * @param request 请求 + * @return 租户编号 + */ + public static Long getTenantId(HttpServletRequest request) { + String tenantId = request.getHeader(HEADER_TENANT_ID); + return NumberUtil.isNumber(tenantId) ? Long.valueOf(tenantId) : null; + } + + public static void setLoginUserId(ServletRequest request, Long userId) { + request.setAttribute(REQUEST_ATTRIBUTE_LOGIN_USER_ID, userId); + } + + /** + * 设置用户类型 + * + * @param request 请求 + * @param userType 用户类型 + */ + public static void setLoginUserType(ServletRequest request, Integer userType) { + request.setAttribute(REQUEST_ATTRIBUTE_LOGIN_USER_TYPE, userType); + } + + /** + * 获得当前用户的编号,从请求中 + * 注意:该方法仅限于 framework 框架使用!!! + * + * @param request 请求 + * @return 用户编号 + */ + public static Long getLoginUserId(HttpServletRequest request) { + if (request == null) { + return null; + } + return (Long) request.getAttribute(REQUEST_ATTRIBUTE_LOGIN_USER_ID); + } + + /** + * 获得当前用户的类型 + * 注意:该方法仅限于 web 相关的 framework 组件使用!!! + * + * @param request 请求 + * @return 用户编号 + */ + public static Integer getLoginUserType(HttpServletRequest request) { + if (request == null) { + return null; + } + // 1. 优先,从 Attribute 中获取 + Integer userType = (Integer) request.getAttribute(REQUEST_ATTRIBUTE_LOGIN_USER_TYPE); + if (userType != null) { + return userType; + } + // 2. 其次,基于 URL 前缀的约定 + if (request.getServletPath().startsWith(properties.getAdminApi().getPrefix())) { + return UserTypeEnum.ADMIN.getValue(); + } + return null; + } + + public static Integer getLoginUserType() { + HttpServletRequest request = getRequest(); + return getLoginUserType(request); + } + + public static Long getLoginUserId() { + HttpServletRequest request = getRequest(); + return getLoginUserId(request); + } + + public static Integer getTerminal() { + HttpServletRequest request = getRequest(); + if (request == null) { + return TerminalEnum.UNKNOWN.getTerminal(); + } + String terminalValue = request.getHeader(HEADER_TERMINAL); + return NumberUtil.parseInt(terminalValue, TerminalEnum.UNKNOWN.getTerminal()); + } + + public static void setCommonResult(ServletRequest request, CommonResult result) { + request.setAttribute(REQUEST_ATTRIBUTE_COMMON_RESULT, result); + } + + public static CommonResult getCommonResult(ServletRequest request) { + return (CommonResult) request.getAttribute(REQUEST_ATTRIBUTE_COMMON_RESULT); + } + + public static HttpServletRequest getRequest() { + RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes(); + if (!(requestAttributes instanceof ServletRequestAttributes)) { + return null; + } + ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) requestAttributes; + return servletRequestAttributes.getRequest(); + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/xss/config/MarketingXssAutoConfiguration.java b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/xss/config/MarketingXssAutoConfiguration.java new file mode 100644 index 0000000..82375dd --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/xss/config/MarketingXssAutoConfiguration.java @@ -0,0 +1,63 @@ +package com.platform.marketing.framework.xss.config; + +import com.platform.marketing.framework.common.enums.WebFilterOrderEnum; +import com.platform.marketing.framework.xss.core.clean.JsoupXssCleaner; +import com.platform.marketing.framework.xss.core.clean.XssCleaner; +import com.platform.marketing.framework.xss.core.filter.XssFilter; +import com.platform.marketing.framework.xss.core.json.XssStringJsonDeserializer; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.springframework.boot.autoconfigure.AutoConfiguration; +import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.boot.web.servlet.FilterRegistrationBean; +import org.springframework.context.annotation.Bean; +import org.springframework.util.PathMatcher; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +import static com.platform.marketing.framework.web.config.MarketingWebAutoConfiguration.createFilterBean; + +@AutoConfiguration +@EnableConfigurationProperties(XssProperties.class) +@ConditionalOnProperty(prefix = "marketing.xss", name = "enable", havingValue = "true", matchIfMissing = true) // 设置为 false 时,禁用 +public class MarketingXssAutoConfiguration implements WebMvcConfigurer { + + /** + * Xss 清理者 + * + * @return XssCleaner + */ + @Bean + @ConditionalOnMissingBean(XssCleaner.class) + public XssCleaner xssCleaner() { + return new JsoupXssCleaner(); + } + + /** + * 注册 Jackson 的序列化器,用于处理 json 类型参数的 xss 过滤 + * + * @return Jackson2ObjectMapperBuilderCustomizer + */ + @Bean + @ConditionalOnMissingBean(name = "xssJacksonCustomizer") + @ConditionalOnBean(ObjectMapper.class) + @ConditionalOnProperty(value = "marketing.xss.enable", havingValue = "true") + public Jackson2ObjectMapperBuilderCustomizer xssJacksonCustomizer(XssProperties properties, + PathMatcher pathMatcher, + XssCleaner xssCleaner) { + // 在反序列化时进行 xss 过滤,可以替换使用 XssStringJsonSerializer,在序列化时进行处理 + return builder -> builder.deserializerByType(String.class, new XssStringJsonDeserializer(properties, pathMatcher, xssCleaner)); + } + + /** + * 创建 XssFilter Bean,解决 Xss 安全问题 + */ + @Bean + @ConditionalOnBean(XssCleaner.class) + public FilterRegistrationBean xssFilter(XssProperties properties, PathMatcher pathMatcher, XssCleaner xssCleaner) { + return createFilterBean(new XssFilter(properties, pathMatcher, xssCleaner), WebFilterOrderEnum.XSS_FILTER); + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/xss/config/XssProperties.java b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/xss/config/XssProperties.java new file mode 100644 index 0000000..c056eda --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/xss/config/XssProperties.java @@ -0,0 +1,29 @@ +package com.platform.marketing.framework.xss.config; + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.validation.annotation.Validated; + +import java.util.Collections; +import java.util.List; + +/** + * Xss 配置属性 + * + + */ +@ConfigurationProperties(prefix = "marketing.xss") +@Validated +@Data +public class XssProperties { + + /** + * 是否开启,默认为 true + */ + private boolean enable = true; + /** + * 需要排除的 URL,默认为空 + */ + private List excludeUrls = Collections.emptyList(); + +} diff --git a/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/xss/core/clean/JsoupXssCleaner.java b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/xss/core/clean/JsoupXssCleaner.java new file mode 100644 index 0000000..06d23d6 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/xss/core/clean/JsoupXssCleaner.java @@ -0,0 +1,64 @@ +package com.platform.marketing.framework.xss.core.clean; + +import org.jsoup.Jsoup; +import org.jsoup.nodes.Document; +import org.jsoup.safety.Safelist; + +/** + * 基于 JSONP 实现 XSS 过滤字符串 + */ +public class JsoupXssCleaner implements XssCleaner { + + private final Safelist safelist; + + /** + * 用于在 src 属性使用相对路径时,强制转换为绝对路径。 为空时不处理,值应为绝对路径的前缀(包含协议部分) + */ + private final String baseUri; + + /** + * 无参构造,默认使用 {@link JsoupXssCleaner#buildSafelist} 方法构建一个安全列表 + */ + public JsoupXssCleaner() { + this.safelist = buildSafelist(); + this.baseUri = ""; + } + + /** + * 构建一个 Xss 清理的 Safelist 规则。 + * 基于 Safelist#relaxed() 的基础上: + * 1. 扩展支持了 style 和 class 属性 + * 2. a 标签额外支持了 target 属性 + * 3. img 标签额外支持了 data 协议,便于支持 base64 + * + * @return Safelist + */ + private Safelist buildSafelist() { + // 使用 jsoup 提供的默认的 + Safelist relaxedSafelist = Safelist.relaxed(); + // 富文本编辑时一些样式是使用 style 来进行实现的 + // 比如红色字体 style="color:red;", 所以需要给所有标签添加 style 属性 + // 注意:style 属性会有注入风险 + relaxedSafelist.addAttributes(":all", "style", "class"); + // 保留 a 标签的 target 属性 + relaxedSafelist.addAttributes("a", "target"); + // 支持img 为base64 + relaxedSafelist.addProtocols("img", "src", "data"); + + // 保留相对路径, 保留相对路径时,必须提供对应的 baseUri 属性,否则依然会被删除 + // WHITELIST.preserveRelativeLinks(false); + + // 移除 a 标签和 img 标签的一些协议限制,这会导致 xss 防注入失效,如 + // 虽然可以重写 WhiteList#isSafeAttribute 来处理,但是有隐患,所以暂时不支持相对路径 + // WHITELIST.removeProtocols("a", "href", "ftp", "http", "https", "mailto"); + // WHITELIST.removeProtocols("img", "src", "http", "https"); + return relaxedSafelist; + } + + @Override + public String clean(String html) { + return Jsoup.clean(html, baseUri, safelist, new Document.OutputSettings().prettyPrint(false)); + } + +} + diff --git a/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/xss/core/clean/XssCleaner.java b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/xss/core/clean/XssCleaner.java new file mode 100644 index 0000000..9c356e7 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/xss/core/clean/XssCleaner.java @@ -0,0 +1,16 @@ +package com.platform.marketing.framework.xss.core.clean; + +/** + * 对 html 文本中的有 Xss 风险的数据进行清理 + */ +public interface XssCleaner { + + /** + * 清理有 Xss 风险的文本 + * + * @param html 原 html + * @return 清理后的 html + */ + String clean(String html); + +} diff --git a/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/xss/core/filter/XssFilter.java b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/xss/core/filter/XssFilter.java new file mode 100644 index 0000000..435fb98 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/xss/core/filter/XssFilter.java @@ -0,0 +1,52 @@ +package com.platform.marketing.framework.xss.core.filter; + +import com.platform.marketing.framework.xss.config.XssProperties; +import com.platform.marketing.framework.xss.core.clean.XssCleaner; +import lombok.AllArgsConstructor; +import org.springframework.util.PathMatcher; +import org.springframework.web.filter.OncePerRequestFilter; + +import javax.servlet.FilterChain; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +/** + * Xss 过滤器 + * + + */ +@AllArgsConstructor +public class XssFilter extends OncePerRequestFilter { + + /** + * 属性 + */ + private final XssProperties properties; + /** + * 路径匹配器 + */ + private final PathMatcher pathMatcher; + + private final XssCleaner xssCleaner; + + @Override + protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) + throws IOException, ServletException { + filterChain.doFilter(new XssRequestWrapper(request, xssCleaner), response); + } + + @Override + protected boolean shouldNotFilter(HttpServletRequest request) { + // 如果关闭,则不过滤 + if (!properties.isEnable()) { + return true; + } + + // 如果匹配到无需过滤,则不过滤 + String uri = request.getRequestURI(); + return properties.getExcludeUrls().stream().anyMatch(excludeUrl -> pathMatcher.match(excludeUrl, uri)); + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/xss/core/filter/XssRequestWrapper.java b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/xss/core/filter/XssRequestWrapper.java new file mode 100644 index 0000000..9a611a9 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/xss/core/filter/XssRequestWrapper.java @@ -0,0 +1,92 @@ +package com.platform.marketing.framework.xss.core.filter; + +import com.platform.marketing.framework.xss.core.clean.XssCleaner; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletRequestWrapper; +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * Xss 请求 Wrapper + * + + */ +public class XssRequestWrapper extends HttpServletRequestWrapper { + + private final XssCleaner xssCleaner; + + public XssRequestWrapper(HttpServletRequest request, XssCleaner xssCleaner) { + super(request); + this.xssCleaner = xssCleaner; + } + + // ============================ parameter ============================ + @Override + public Map getParameterMap() { + Map map = new LinkedHashMap<>(); + Map parameters = super.getParameterMap(); + for (Map.Entry entry : parameters.entrySet()) { + String[] values = entry.getValue(); + for (int i = 0; i < values.length; i++) { + values[i] = xssCleaner.clean(values[i]); + } + map.put(entry.getKey(), values); + } + return map; + } + + @Override + public String[] getParameterValues(String name) { + String[] values = super.getParameterValues(name); + if (values == null) { + return null; + } + int count = values.length; + String[] encodedValues = new String[count]; + for (int i = 0; i < count; i++) { + encodedValues[i] = xssCleaner.clean(values[i]); + } + return encodedValues; + } + + @Override + public String getParameter(String name) { + String value = super.getParameter(name); + if (value == null) { + return null; + } + return xssCleaner.clean(value); + } + + // ============================ attribute ============================ + @Override + public Object getAttribute(String name) { + Object value = super.getAttribute(name); + if (value instanceof String) { + return xssCleaner.clean((String) value); + } + return value; + } + + // ============================ header ============================ + @Override + public String getHeader(String name) { + String value = super.getHeader(name); + if (value == null) { + return null; + } + return xssCleaner.clean(value); + } + + // ============================ queryString ============================ + @Override + public String getQueryString() { + String value = super.getQueryString(); + if (value == null) { + return null; + } + return xssCleaner.clean(value); + } + +} diff --git a/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/xss/core/json/XssStringJsonDeserializer.java b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/xss/core/json/XssStringJsonDeserializer.java new file mode 100644 index 0000000..49c45a0 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-web/src/main/java/com/platform/marketing/framework/xss/core/json/XssStringJsonDeserializer.java @@ -0,0 +1,82 @@ +package com.platform.marketing.framework.xss.core.json; + +import com.platform.marketing.framework.common.util.servlet.ServletUtils; +import com.platform.marketing.framework.xss.config.XssProperties; +import com.platform.marketing.framework.xss.core.clean.XssCleaner; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.deser.std.StringDeserializer; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.util.PathMatcher; + +import javax.servlet.http.HttpServletRequest; +import java.io.IOException; + +/** + * XSS 过滤 jackson 反序列化器。 + * 在反序列化的过程中,会对字符串进行 XSS 过滤。 + * + * @author Hccake + */ +@Slf4j +@AllArgsConstructor +public class XssStringJsonDeserializer extends StringDeserializer { + + /** + * 属性 + */ + private final XssProperties properties; + /** + * 路径匹配器 + */ + private final PathMatcher pathMatcher; + + private final XssCleaner xssCleaner; + + @Override + public String deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { + // 1. 白名单 URL 的处理 + HttpServletRequest request = ServletUtils.getRequest(); + if (request != null) { + String uri = ServletUtils.getRequest().getRequestURI(); + if (properties.getExcludeUrls().stream().anyMatch(excludeUrl -> pathMatcher.match(excludeUrl, uri))) { + return p.getText(); + } + } + + // 2. 真正使用 xssCleaner 进行过滤 + if (p.hasToken(JsonToken.VALUE_STRING)) { + return xssCleaner.clean(p.getText()); + } + JsonToken t = p.currentToken(); + // [databind#381] + if (t == JsonToken.START_ARRAY) { + return _deserializeFromArray(p, ctxt); + } + // need to gracefully handle byte[] data, as base64 + if (t == JsonToken.VALUE_EMBEDDED_OBJECT) { + Object ob = p.getEmbeddedObject(); + if (ob == null) { + return null; + } + if (ob instanceof byte[]) { + return ctxt.getBase64Variant().encode((byte[]) ob, false); + } + // otherwise, try conversion using toString()... + return ob.toString(); + } + // 29-Jun-2020, tatu: New! "Scalar from Object" (mostly for XML) + if (t == JsonToken.START_OBJECT) { + return ctxt.extractScalarFromObject(p, this, _valueClass); + } + + if (t.isScalarValue()) { + String text = p.getValueAsString(); + return xssCleaner.clean(text); + } + return (String) ctxt.handleUnexpectedToken(_valueClass, p); + } +} + diff --git a/marketing-framework/marketing-spring-boot-starter-web/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/marketing-framework/marketing-spring-boot-starter-web/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 0000000..50c3ba5 --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-web/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1,5 @@ +com.platform.marketing.framework.jackson.config.MarketingJacksonAutoConfiguration +com.platform.marketing.framework.swagger.config.MarketingSwaggerAutoConfiguration +com.platform.marketing.framework.web.config.MarketingWebAutoConfiguration +com.platform.marketing.framework.xss.config.MarketingXssAutoConfiguration +com.platform.marketing.framework.banner.config.MarketingBannerAutoConfiguration \ No newline at end of file diff --git a/marketing-framework/marketing-spring-boot-starter-web/src/main/resources/banner.txt b/marketing-framework/marketing-spring-boot-starter-web/src/main/resources/banner.txt new file mode 100644 index 0000000..ef528ae --- /dev/null +++ b/marketing-framework/marketing-spring-boot-starter-web/src/main/resources/banner.txt @@ -0,0 +1,2 @@ +Application Version: ${marketing.info.version} +Spring Boot Version: ${spring-boot.version} diff --git a/marketing-framework/pom.xml b/marketing-framework/pom.xml new file mode 100644 index 0000000..608d9d5 --- /dev/null +++ b/marketing-framework/pom.xml @@ -0,0 +1,65 @@ + + + 4.0.0 + + marketing-admin-all + com.platform + ${revision} + + pom + + + + marketing-common + + + marketing-spring-boot-starter-mybatis + + + marketing-spring-boot-starter-redis + + + marketing-spring-boot-starter-idgenerator + + + marketing-spring-boot-starter-token + + + marketing-spring-boot-starter-web + + + marketing-spring-boot-starter-security + + + marketing-spring-boot-starter-protection + + + marketing-spring-boot-starter-job + + + marketing-spring-boot-starter-mq + + + marketing-spring-boot-starter-excel + + + marketing-spring-boot-starter-biz-ip + + + + marketing-framework + + 该包是技术组件,每个子包,代表一个组件。每个组件包括两部分: + 1. core 包:是该组件的核心封装 + 2. config 包:是该组件基于 Spring 的配置 + + 技术组件,也分成两类: + 1. 框架组件:和我们熟悉的 MyBatis、Redis 等等的拓展 + 2. 业务组件:和业务相关的组件的封装,例如说数据字典、操作日志等等。 + 如果是业务组件,Maven 名字会包含 biz + + https://github.com/makemyownlife/platform-sms-pro + + diff --git a/marketing-module-channel/.flattened-pom.xml b/marketing-module-channel/.flattened-pom.xml new file mode 100644 index 0000000..5fee8b5 --- /dev/null +++ b/marketing-module-channel/.flattened-pom.xml @@ -0,0 +1,149 @@ + + + 4.0.0 + com.platform + marketing-module-channel + 0.0.1-jdk8-SNAPSHOT + marketing-admin基础脚手架 + https://github.com/makemyownlife/marketing-admin/marketing-module-channel + + + com.platform + marketing-spring-boot-starter-idgenerator + 0.0.1-jdk8-SNAPSHOT + compile + + + com.platform + marketing-spring-boot-starter-biz-ip + 0.0.1-jdk8-SNAPSHOT + compile + + + com.platform + marketing-spring-boot-starter-security + 0.0.1-jdk8-SNAPSHOT + compile + + + org.springframework.boot + spring-boot-starter-validation + 2.7.18 + compile + + + com.platform + marketing-spring-boot-starter-mybatis + 0.0.1-jdk8-SNAPSHOT + compile + + + com.platform + marketing-spring-boot-starter-redis + 0.0.1-jdk8-SNAPSHOT + compile + + + com.platform + marketing-spring-boot-starter-job + 0.0.1-jdk8-SNAPSHOT + compile + + + com.platform + marketing-spring-boot-starter-mq + 0.0.1-jdk8-SNAPSHOT + compile + + + com.platform + marketing-spring-boot-starter-excel + 0.0.1-jdk8-SNAPSHOT + compile + + + org.springframework.boot + spring-boot-starter-mail + 2.7.18 + compile + + + com.xingyuv + spring-boot-starter-justauth + 1.0.8 + compile + + + cn.hutool + hutool-core + + + + + com.xingyuv + spring-boot-starter-captcha-plus + 1.0.10 + compile + + + com.platform + marketing-module-infra + 0.0.1-jdk8-SNAPSHOT + compile + + + com.aliyun + aliyun-java-sdk-core + 4.5.16 + compile + + + com.aliyun + dysmsapi20170525 + 2.0.22 + compile + + + com.tencentcloudapi + tencentcloud-sdk-java + 3.1.850 + compile + + + cn.emay + eucp-sms-sdk + 1.3.3 + system + D:\ProgramData\idea\xteam\marketing-platform\marketing-module-channel/src/libs/eucp-sms-sdk-1.3.3.jar + + + + + huaweicloud + huawei + https://mirrors.huaweicloud.com/repository/maven/ + + + aliyunmaven + aliyun + https://maven.aliyun.com/repository/public + + + + false + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + + + false + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + + diff --git a/marketing-module-channel/pom.xml b/marketing-module-channel/pom.xml new file mode 100644 index 0000000..60d65a6 --- /dev/null +++ b/marketing-module-channel/pom.xml @@ -0,0 +1,128 @@ + + + 4.0.0 + + + com.platform + marketing-admin-all + ${revision} + + + + marketing-module-channel + jar + + + + + com.platform + marketing-spring-boot-starter-idgenerator + + + + com.platform + marketing-spring-boot-starter-biz-ip + + + + + com.platform + marketing-spring-boot-starter-security + + + + org.springframework.boot + spring-boot-starter-validation + + + + + com.platform + marketing-spring-boot-starter-mybatis + + + + com.platform + marketing-spring-boot-starter-redis + + + + + com.platform + marketing-spring-boot-starter-job + + + + + com.platform + marketing-spring-boot-starter-mq + + + + + com.platform + marketing-spring-boot-starter-excel + + + + org.springframework.boot + spring-boot-starter-mail + + + + + com.xingyuv + spring-boot-starter-justauth + + + + com.xingyuv + spring-boot-starter-captcha-plus + + + + com.platform + marketing-module-infra + ${version} + compile + + + + + com.aliyun + aliyun-java-sdk-core + 4.5.16 + + + + com.aliyun + dysmsapi20170525 + 2.0.22 + + + + + + com.tencentcloudapi + tencentcloud-sdk-java + + + 3.1.850 + + + + + + cn.emay + eucp-sms-sdk + system + 1.3.3 + ${project.basedir}/src/libs/eucp-sms-sdk-1.3.3.jar + + + + + + \ No newline at end of file diff --git a/marketing-module-channel/src/libs/eucp-sms-sdk-1.3.3.jar b/marketing-module-channel/src/libs/eucp-sms-sdk-1.3.3.jar new file mode 100644 index 0000000..479edaf Binary files /dev/null and b/marketing-module-channel/src/libs/eucp-sms-sdk-1.3.3.jar differ diff --git a/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/adapter/aliyun/AliyunSmsOuterAdapter.java b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/adapter/aliyun/AliyunSmsOuterAdapter.java new file mode 100644 index 0000000..c8eca78 --- /dev/null +++ b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/adapter/aliyun/AliyunSmsOuterAdapter.java @@ -0,0 +1,145 @@ +package com.platform.marketing.module.smschannel.adapter.aliyun; + +import com.platform.marketing.module.smschannel.adapter.core.SmsOuterAdapter; +import com.platform.marketing.module.smschannel.adapter.core.command.req.AddSmsTemplateReqCommand; +import com.platform.marketing.module.smschannel.adapter.core.command.req.QuerySmsTemplateReqCommand; +import com.platform.marketing.module.smschannel.adapter.core.command.req.SendSmsReqCommand; +import com.platform.marketing.module.smschannel.adapter.core.command.resp.SmsRespCommand; +import com.platform.marketing.module.smschannel.adapter.core.support.SmsChannelConfig; +import com.alibaba.fastjson.JSON; +import com.aliyun.dysmsapi20170525.Client; +import com.aliyun.dysmsapi20170525.models.*; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +/** + * 参考文档: https://help.aliyun.com/zh/sms/getting-started/use-sms-api + * 国外短信: https://help.aliyun.com/zh/sms/sendmessagetoglobe-intl?spm=5176.25163407.console-base_help.dexternal.4b292ec8kdLxCp + */ +public class AliyunSmsOuterAdapter implements SmsOuterAdapter { + + private final static Logger logger = LoggerFactory.getLogger(AliyunSmsOuterAdapter.class); + + private String instanceId = UUID.randomUUID().toString().replaceAll("-", ""); + + private final static int SUCCESS_CODE = 200; + + private SmsChannelConfig smsChannelConfig; + + private Client client; + + @Override + public void init(SmsChannelConfig smsChannelConfig) throws Exception { + this.smsChannelConfig = smsChannelConfig; + logger.info("阿里云短信客户端 渠道编号:[" + smsChannelConfig.getId() + "] appkey:[" + smsChannelConfig.getChannelAppkey() + "] 实例Id:" + instanceId); + com.aliyun.teaopenapi.models.Config config = new com.aliyun.teaopenapi.models.Config() + // 必填,您的 AccessKey ID + .setAccessKeyId(smsChannelConfig.getChannelAppkey()) + // 必填,您的 AccessKey Secret + .setAccessKeySecret(smsChannelConfig.getChannelAppsecret()); + // 访问的域名 + config.endpoint = "dysmsapi.aliyuncs.com"; + this.client = new com.aliyun.dysmsapi20170525.Client(config); + } + + @Override + public SmsRespCommand sendSmsByTemplateId(SendSmsReqCommand sendSmsReqCommand) { + try { + com.aliyun.dysmsapi20170525.models.SendSmsRequest sendSmsRequest = new com.aliyun.dysmsapi20170525.models.SendSmsRequest(). + setSignName(sendSmsReqCommand.getSignName()). + setTemplateCode(sendSmsReqCommand.getTemplateCode()). + setPhoneNumbers(sendSmsReqCommand.getNationcode().equals("86")? sendSmsReqCommand.getPhoneNumber() : sendSmsReqCommand.getNationcode() + sendSmsReqCommand.getPhoneNumber()). + setTemplateParam(sendSmsReqCommand.getTemplateParam()); + com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions(); + com.aliyun.dysmsapi20170525.models.SendSmsResponse resp = client.sendSmsWithOptions(sendSmsRequest, runtime); + logger.info("aliyun resp code:{} body:{}", resp.getStatusCode(), JSON.toJSON(resp.getBody())); + if (SUCCESS_CODE == resp.getStatusCode() && "OK".equals(resp.getBody().getCode())) { + return new SmsRespCommand(SmsRespCommand.SUCCESS_CODE, resp.getBody().getBizId()); + } + String erorMsg = resp.getBody().getMessage(); + return new SmsRespCommand(SmsRespCommand.FAIL_CODE, null, erorMsg); + } catch (Exception e) { + logger.error("aliyun sendSms:", e); + return new SmsRespCommand(SmsRespCommand.FAIL_CODE, null, e.getMessage()); + } + } + + @Override + public SmsRespCommand addSmsTemplate(AddSmsTemplateReqCommand addSmsTemplateReqCommand) { + try { + com.aliyun.dysmsapi20170525.models.AddSmsTemplateRequest addSmsTemplateRequest = new com.aliyun.dysmsapi20170525.models.AddSmsTemplateRequest(); + addSmsTemplateRequest.setRemark(addSmsTemplateReqCommand.getRemark()); + addSmsTemplateRequest.setTemplateContent(addSmsTemplateReqCommand.getTemplateContent()); + if (1 == addSmsTemplateReqCommand.getInternational()) { + addSmsTemplateRequest.setTemplateType(3); + } else { + addSmsTemplateRequest.setTemplateType(addSmsTemplateReqCommand.getTemplateType()); + } + addSmsTemplateRequest.setTemplateName(addSmsTemplateReqCommand.getTemplateName()); + AddSmsTemplateResponse resp = client.addSmsTemplate(addSmsTemplateRequest); + logger.info("resp=" + JSON.toJSONString(resp)); + if (SUCCESS_CODE == resp.getStatusCode()) { + AddSmsTemplateResponseBody body = resp.getBody(); + Map bodyMap = new HashMap<>(); + bodyMap.put("templateCode", body.getTemplateCode()); + bodyMap.put("templateContent", addSmsTemplateReqCommand.getTemplateContent()); + return new SmsRespCommand(SmsRespCommand.SUCCESS_CODE, bodyMap); + } + return new SmsRespCommand(SmsRespCommand.FAIL_CODE, null, resp.getBody().getMessage()); + } catch (Exception e) { + logger.error("aliyun addSmsTemplate error :", e); + return new SmsRespCommand(SmsRespCommand.FAIL_CODE, null, e.getMessage()); + } + } + + @Override + public SmsRespCommand querySmsTemplateStatus(QuerySmsTemplateReqCommand querySmsTemplateReqCommand) { + try { + com.aliyun.dysmsapi20170525.models.QuerySmsTemplateRequest querySmsTemplateRequest = new QuerySmsTemplateRequest(); + querySmsTemplateRequest.setTemplateCode(querySmsTemplateReqCommand.getTemplateCode()); + QuerySmsTemplateResponse resp = client.querySmsTemplate(querySmsTemplateRequest); + logger.info("resp=" + JSON.toJSONString(resp)); + if (SUCCESS_CODE == resp.getStatusCode() && "OK".equals(resp.getBody().getCode())) { + QuerySmsTemplateResponseBody body = resp.getBody(); + Integer templateStatus = body.getTemplateStatus(); + String reason = body.getReason(); + //模板审核状态 + //0:审核中。 + //1:审核通过。 + //2:审核未通过,请在返回参数Reason中查看审核失败原因。 + //10:取消审核。 + if (templateStatus == 0) { + return new SmsRespCommand(SmsRespCommand.SUCCESS_CODE, 1); + } + if (templateStatus == 1) { + return new SmsRespCommand(SmsRespCommand.SUCCESS_CODE, 2); + } + if (templateStatus == 2) { + return new SmsRespCommand(SmsRespCommand.SUCCESS_CODE, 3, reason); + } + if (templateStatus == 10) { + return new SmsRespCommand(SmsRespCommand.SUCCESS_CODE, 3); + } + } + return new SmsRespCommand(SmsRespCommand.FAIL_CODE, null, JSON.toJSONString(resp)); + } catch (Exception e) { + logger.error("aliyun querySmsTemplate error :", e); + return new SmsRespCommand(SmsRespCommand.FAIL_CODE, null, e.getMessage()); + } + } + + @Override + public String transferStandardTemplateContentToChannelContent(String standardTemplateContent) { + return standardTemplateContent; + } + + @Override + public void destroy() { + logger.info("销毁阿里云短信客户端渠道编号:[" + smsChannelConfig.getId() + "] appkey:[" + smsChannelConfig.getChannelAppkey() + "] 实例Id:" + instanceId); + } + +} diff --git a/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/adapter/aliyun/AliyunSmsUnifyNotifyAdapter.java b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/adapter/aliyun/AliyunSmsUnifyNotifyAdapter.java new file mode 100644 index 0000000..2301cc7 --- /dev/null +++ b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/adapter/aliyun/AliyunSmsUnifyNotifyAdapter.java @@ -0,0 +1,7 @@ +package com.platform.marketing.module.smschannel.adapter.aliyun; + +import com.platform.marketing.module.smschannel.adapter.core.SmsUnifyNotifyAdapter; + +public class AliyunSmsUnifyNotifyAdapter implements SmsUnifyNotifyAdapter { + +} diff --git a/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/adapter/chuanglan/ChuangLanOuterAdapter.java b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/adapter/chuanglan/ChuangLanOuterAdapter.java new file mode 100644 index 0000000..470e89e --- /dev/null +++ b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/adapter/chuanglan/ChuangLanOuterAdapter.java @@ -0,0 +1,214 @@ +package com.platform.marketing.module.smschannel.adapter.chuanglan; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson.TypeReference; +import com.platform.marketing.module.smschannel.adapter.core.SmsOuterAdapter; +import com.platform.marketing.module.smschannel.adapter.core.command.req.AddSmsTemplateReqCommand; +import com.platform.marketing.module.smschannel.adapter.core.command.req.QuerySmsTemplateReqCommand; +import com.platform.marketing.module.smschannel.adapter.core.command.req.SendSmsReqCommand; +import com.platform.marketing.module.smschannel.adapter.core.command.resp.SmsRespCommand; +import com.platform.marketing.module.smschannel.adapter.core.support.SmsChannelConfig; +import org.apache.commons.lang3.StringUtils; +import org.apache.http.HttpEntity; +import org.apache.http.HttpHost; +import org.apache.http.client.config.RequestConfig; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.entity.ContentType; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.util.EntityUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.util.DigestUtils; + +import java.util.HashMap; +import java.util.Map; +import java.util.TreeMap; +import java.util.UUID; + +/** + * 创蓝短信适配器 + * 参考文档 https://doc.chuanglan.com/document/O58743GF76M7754H + */ +public class ChuangLanOuterAdapter implements SmsOuterAdapter { + + private static final Logger logger = LoggerFactory.getLogger(ChuangLanOuterAdapter.class); + + private static final String HEAD_KEY_SIGN = "sign"; + private static final String HEAD_KEY_NONCE = "nonce"; + private static final String HEAD_KEY_CONTENT_TYPE = "Content-Type"; + private static final String SEND_SMS_PATH = "/send/sms"; + private SmsChannelConfig smsChannelConfig; + + private RequestConfig requestConfig = RequestConfig.custom() + .setConnectTimeout(10000) + .setSocketTimeout(10000) + .build(); + + private CloseableHttpClient httpClient = HttpClients.custom() + .setDefaultRequestConfig(requestConfig) + .setProxy(new HttpHost("127.0.0.1", 1087)) + .build(); + + @Override + public void init(SmsChannelConfig smsChannelConfig) throws Exception { + logger.info("初始化创蓝短信客户端 渠道编号:[{}] appkey:[{}]", smsChannelConfig.getId(), smsChannelConfig.getChannelAppkey()); + this.smsChannelConfig = smsChannelConfig; + } + + @Override + public SmsRespCommand sendSmsByTemplateId(SendSmsReqCommand sendSmsReqCommand) { + CloseableHttpResponse httpResponse = null; + HttpEntity httpEntity = null; + try { + // 构建请求参数 + SmsSendRequest smsRequest = new SmsSendRequest(); + smsRequest.setAccount(smsChannelConfig.getChannelAppkey()); + // 国际短信需要拼接国家码前缀 + if ("86".equals(sendSmsReqCommand.getNationcode()) || StringUtils.isBlank(sendSmsReqCommand.getNationcode())) { + smsRequest.setMobile(sendSmsReqCommand.getPhoneNumber()); + } else { + smsRequest.setMobile("00" + sendSmsReqCommand.getNationcode() + sendSmsReqCommand.getPhoneNumber()); + } + // 将模板变量替换到模板内容中,生成完整短信内容 + String msgContent = buildMsgContent(sendSmsReqCommand.getTemplateContent(), sendSmsReqCommand.getTemplateParam()); + smsRequest.setMsg(msgContent); + smsRequest.setUid(UUID.randomUUID().toString().replaceAll("-", "")); + + // 生成签名 + String nonce = String.valueOf(System.currentTimeMillis()); + TreeMap paramMap = JSON.parseObject(JSON.toJSONString(smsRequest), new TypeReference>() {}); + paramMap.put("nonce", nonce); + String sign = generateSign(smsChannelConfig.getChannelAppsecret(), paramMap); + + // 发送 HTTP 请求 + String domain = smsChannelConfig.getChannelDomain(); + String url = domain.endsWith("/") ? domain.substring(0, domain.length() - 1) + SEND_SMS_PATH : domain + SEND_SMS_PATH; + StringEntity stringEntity = new StringEntity(JSON.toJSONString(smsRequest), ContentType.APPLICATION_JSON); + HttpPost httpPost = new HttpPost(url); + httpPost.addHeader(HEAD_KEY_SIGN, sign); + httpPost.addHeader(HEAD_KEY_NONCE, nonce); + httpPost.addHeader(HEAD_KEY_CONTENT_TYPE, "application/json"); + httpPost.setEntity(stringEntity); + + logger.info("发送创蓝短信请求 手机号:{}", sendSmsReqCommand.getPhoneNumber()); +// httpResponse = httpClient.execute(httpPost); +// httpEntity = httpResponse.getEntity(); +// String result = EntityUtils.toString(httpEntity); + Thread.sleep(200); + String result = "{\"code\":\"0\",\"message\":\"提交成功\",\"data\":{\"messageId\":\""+System.currentTimeMillis()+"\"}}"; + logger.info("发送创蓝短信 手机号:{} 结果:{}", sendSmsReqCommand.getPhoneNumber(), result); + + JSONObject rtn = JSON.parseObject(result); + String code = rtn.getString("code"); + if ("0".equals(code)) { + String messageId = rtn.getJSONObject("data").getString("messageId"); + return new SmsRespCommand<>(SmsRespCommand.SUCCESS_CODE, messageId); + } else { + String message = String.format("提交失败:code=%s, message=%s", code, rtn.getString("message")); + return new SmsRespCommand<>(SmsRespCommand.FAIL_CODE, null, message); + } + } catch (Exception e) { + logger.error("创蓝短信发送失败:", e); + return new SmsRespCommand<>(SmsRespCommand.FAIL_CODE, null, e.getMessage()); + } finally { + try { + EntityUtils.consume(httpEntity); + } catch (Exception e) { + logger.error("消耗 HTTP 响应失败", e); + } + if (httpResponse != null) { + try { + httpResponse.close(); + } catch (Exception e) { + logger.error("关闭 HTTP 响应失败", e); + } + } + } + } + + @Override + public SmsRespCommand> addSmsTemplate(AddSmsTemplateReqCommand addSmsTemplateReqCommand) { + return new SmsRespCommand<>(SmsRespCommand.NOT_SUPPORT_CODE, null, "创蓝短信不支持模板管理"); + } + + @Override + public SmsRespCommand querySmsTemplateStatus(QuerySmsTemplateReqCommand querySmsTemplateReqCommand) { + return new SmsRespCommand<>(SmsRespCommand.NOT_SUPPORT_CODE, null, "创蓝短信不支持模板状态查询"); + } + + @Override + public String transferStandardTemplateContentToChannelContent(String standardTemplateContent) { + // 创蓝短信直接发送完整内容,模板变量格式与标准格式一致,无需转换 + return standardTemplateContent; + } + + @Override + public void destroy() { + logger.warn("销毁创蓝短信客户端 渠道编号:[{}] appkey:[{}]", smsChannelConfig.getId(), smsChannelConfig.getChannelAppkey()); + try { + if (httpClient != null) { + httpClient.close(); + } + } catch (Exception e) { + logger.error("关闭 HttpClient 失败", e); + } + } + + /** + * 生成创蓝 API 签名 + * 签名规则:将所有参数按 key 字典序排列,拼接 key+value,最后追加 password,做 MD5 + */ + private String generateSign(String password, TreeMap paramMap) { + StringBuilder sb = new StringBuilder(); + for (Map.Entry entry : paramMap.entrySet()) { + if (StringUtils.isNotBlank(entry.getValue())) { + sb.append(entry.getKey()); + sb.append(entry.getValue()); + } + } + return DigestUtils.md5DigestAsHex((sb.toString() + password).getBytes()).toLowerCase(); + } + + /** + * 将模板内容与模板参数合并,生成完整的短信文本 + * 例如模板内容 "您的验证码是${code}",参数 {"code":"1234"} → "您的验证码是1234" + */ + private String buildMsgContent(String templateContent, String templateParam) { + if (StringUtils.isBlank(templateContent)) { + return ""; + } + String content = templateContent; + if (StringUtils.isNotBlank(templateParam)) { + Map paramMap = JSON.parseObject(templateParam, HashMap.class); + if (paramMap != null) { + for (Map.Entry entry : paramMap.entrySet()) { + content = content.replace("${" + entry.getKey() + "}", entry.getValue()); + } + } + } + return content; + } + + /** + * 创蓝短信发送请求体 + */ + static class SmsSendRequest { + private String account; + private String mobile; + private String msg; + private String uid; + + public String getAccount() { return account; } + public void setAccount(String account) { this.account = account; } + public String getMobile() { return mobile; } + public void setMobile(String mobile) { this.mobile = mobile; } + public String getMsg() { return msg; } + public void setMsg(String msg) { this.msg = msg; } + public String getUid() { return uid; } + public void setUid(String uid) { this.uid = uid; } + } +} diff --git a/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/adapter/core/SmsAdapterFactory.java b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/adapter/core/SmsAdapterFactory.java new file mode 100644 index 0000000..4c3be19 --- /dev/null +++ b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/adapter/core/SmsAdapterFactory.java @@ -0,0 +1,42 @@ +package com.platform.marketing.module.smschannel.adapter.core; + +import com.platform.marketing.module.smschannel.adapter.aliyun.AliyunSmsOuterAdapter; +import com.platform.marketing.module.smschannel.adapter.chuanglan.ChuangLanOuterAdapter; +import com.platform.marketing.module.smschannel.adapter.core.support.SmsChannelConfig; +import com.platform.marketing.module.smschannel.adapter.emay.EmaySmsOuterAdapter; +import com.platform.marketing.module.smschannel.adapter.tencent.TencentSmsOuterAdapter; +import com.platform.marketing.module.smschannel.adapter.unisms.UnismsSmsOuterAdapter; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; + +/** + * 短信适配器工厂 + * 保存模版 id 对应的账号 + */ +@Slf4j +public class SmsAdapterFactory { + + public static SmsOuterAdapter createOuterAdapter(String channelCode, SmsChannelConfig smsChannelConfig) throws Exception { + SmsOuterAdapter smsOuterAdapter = null; + if (StringUtils.equals(channelCode, "aliyun")) { + smsOuterAdapter = new AliyunSmsOuterAdapter(); + } + if (StringUtils.equals(channelCode, "tencent")) { + smsOuterAdapter = new TencentSmsOuterAdapter(); + } + if (StringUtils.equals(channelCode, "emay")) { + smsOuterAdapter = new EmaySmsOuterAdapter(); + } + if (StringUtils.equals(channelCode, "unisms")) { + smsOuterAdapter = new UnismsSmsOuterAdapter(); + } + if (StringUtils.equals(channelCode, "chuanglan")) { + smsOuterAdapter = new ChuangLanOuterAdapter(); + } + if (smsOuterAdapter != null) { + smsOuterAdapter.init(smsChannelConfig); + } + return smsOuterAdapter; + } + +} diff --git a/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/adapter/core/SmsOuterAdapter.java b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/adapter/core/SmsOuterAdapter.java new file mode 100644 index 0000000..6a864d0 --- /dev/null +++ b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/adapter/core/SmsOuterAdapter.java @@ -0,0 +1,45 @@ +package com.platform.marketing.module.smschannel.adapter.core; + +import com.platform.marketing.module.smschannel.adapter.core.command.req.AddSmsTemplateReqCommand; +import com.platform.marketing.module.smschannel.adapter.core.command.req.QuerySmsTemplateReqCommand; +import com.platform.marketing.module.smschannel.adapter.core.command.req.SendSmsReqCommand; +import com.platform.marketing.module.smschannel.adapter.core.command.resp.SmsRespCommand; +import com.platform.marketing.module.smschannel.adapter.core.support.SmsChannelConfig; + +import java.util.Map; + +/** + * 外部适配器接口 + */ +public interface SmsOuterAdapter { + + /** + * 适配器初始化接口 + */ + void init(SmsChannelConfig smsChannelConfig) throws Exception; + + /** + * 按照模版编号发送短信 + */ + SmsRespCommand sendSmsByTemplateId(SendSmsReqCommand smsSendRequest); + + /** + * 按照模版编号发送短信 + */ + SmsRespCommand> addSmsTemplate(AddSmsTemplateReqCommand addSmsTemplateReqCommand); + + /** + * 按照模版编号查询模版状态 + */ + SmsRespCommand querySmsTemplateStatus(QuerySmsTemplateReqCommand querySmsTemplateReqCommand); + + /** + * 将标准模版抓换成对应映射模版 + */ + String transferStandardTemplateContentToChannelContent(String standardTemplateContent); + + /** + * 外部适配器销毁接口 + */ + void destroy(); +} diff --git a/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/adapter/core/SmsUnifyNotifyAdapter.java b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/adapter/core/SmsUnifyNotifyAdapter.java new file mode 100644 index 0000000..00c692e --- /dev/null +++ b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/adapter/core/SmsUnifyNotifyAdapter.java @@ -0,0 +1,10 @@ +package com.platform.marketing.module.smschannel.adapter.core; + + +/** + * 统一处理 短信厂商通知事件 + */ +public interface SmsUnifyNotifyAdapter { + + +} diff --git a/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/adapter/core/command/req/AddSmsTemplateReqCommand.java b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/adapter/core/command/req/AddSmsTemplateReqCommand.java new file mode 100644 index 0000000..332aeb9 --- /dev/null +++ b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/adapter/core/command/req/AddSmsTemplateReqCommand.java @@ -0,0 +1,76 @@ +package com.platform.marketing.module.smschannel.adapter.core.command.req; + +/** + * 添加短信模版请求 + * Created by diven on 2023/7/4. + */ +public class AddSmsTemplateReqCommand extends SmsReqCommand { + + public String signName; + + public String templateContent; + + public String templateName; + + /** + * 模板类型:0-验证码 1-短信通知 2-推广短信 + */ + public Integer templateType; + + public String remark; + + /** + * 短信区域:0-国内短信 1-国际/港澳台短信 + */ + private Integer international; + + + public String getTemplateContent() { + return templateContent; + } + + public void setTemplateContent(String templateContent) { + this.templateContent = templateContent; + } + + public String getTemplateName() { + return templateName; + } + + public void setTemplateName(String templateName) { + this.templateName = templateName; + } + + public Integer getTemplateType() { + return templateType; + } + + public void setTemplateType(Integer templateType) { + this.templateType = templateType; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getSignName() { + return signName; + } + + public void setSignName(String signName) { + this.signName = signName; + } + + public Integer getInternational() { + return international; + } + + public void setInternational(Integer international) { + this.international = international; + } + +} diff --git a/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/adapter/core/command/req/QuerySmsTemplateReqCommand.java b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/adapter/core/command/req/QuerySmsTemplateReqCommand.java new file mode 100644 index 0000000..4221b9f --- /dev/null +++ b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/adapter/core/command/req/QuerySmsTemplateReqCommand.java @@ -0,0 +1,19 @@ +package com.platform.marketing.module.smschannel.adapter.core.command.req; + +/** + * 查询短信 + * Created by diven on 2023/9/6. + */ +public class QuerySmsTemplateReqCommand { + + private String templateCode; + + public String getTemplateCode() { + return templateCode; + } + + public void setTemplateCode(String templateCode) { + this.templateCode = templateCode; + } + +} diff --git a/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/adapter/core/command/req/SendSmsReqCommand.java b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/adapter/core/command/req/SendSmsReqCommand.java new file mode 100644 index 0000000..23978d0 --- /dev/null +++ b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/adapter/core/command/req/SendSmsReqCommand.java @@ -0,0 +1,35 @@ +package com.platform.marketing.module.smschannel.adapter.core.command.req; + +import lombok.Data; + +/** + * 短信发送请求(适配器) + * Created by diven on 2023/3/1. + */ +@Data +public class SendSmsReqCommand extends SmsReqCommand { + + // 手机号 + private String phoneNumber; + + // 国家码 + private String nationcode; + + // 模版编码 + private String templateCode; + + // 标准模版内容 + private String templateContent; + + /** + * 模版参数 : 短信模板变量对应的实际值。支持传入多个参数,示例:{"name":"张三","number":"1390000****"}。 + */ + private String templateParam; + + // 签名 + private String signName; + + // 定时发送时间 + private String timerTime; + +} diff --git a/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/adapter/core/command/req/SmsReqCommand.java b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/adapter/core/command/req/SmsReqCommand.java new file mode 100644 index 0000000..47ec606 --- /dev/null +++ b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/adapter/core/command/req/SmsReqCommand.java @@ -0,0 +1,8 @@ +package com.platform.marketing.module.smschannel.adapter.core.command.req; + +/** + * Created by diven on 2023/7/14. + */ +public class SmsReqCommand { + +} diff --git a/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/adapter/core/command/resp/SmsRespCommand.java b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/adapter/core/command/resp/SmsRespCommand.java new file mode 100644 index 0000000..4936c17 --- /dev/null +++ b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/adapter/core/command/resp/SmsRespCommand.java @@ -0,0 +1,58 @@ +package com.platform.marketing.module.smschannel.adapter.core.command.resp; + +import org.apache.commons.lang3.StringUtils; + +/** + * 短信发送结果(适配器) + * Created by diven on 2023/3/1. + */ +public class SmsRespCommand { + + public static final int SUCCESS_CODE = 200; + + public static final int FAIL_CODE = 500; + + public static final int NOT_SUPPORT_CODE = 401; + + private int code; + + private T data; + + private String message = StringUtils.EMPTY; + + public SmsRespCommand(int code) { + this.code = code; + } + + public SmsRespCommand(int code, T result) { + this.data = result; + this.code = code; + } + + public SmsRespCommand(int code, T result, String message) { + this.code = code; + this.data = result; + this.message = message; + } + + public int getCode() { + return code; + } + + public T getData() { + return data; + } + + public void setData(T data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + +} diff --git a/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/adapter/core/support/ExtensionLoader.java b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/adapter/core/support/ExtensionLoader.java new file mode 100644 index 0000000..ff937c5 --- /dev/null +++ b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/adapter/core/support/ExtensionLoader.java @@ -0,0 +1,453 @@ +package com.platform.marketing.module.smschannel.adapter.core.support; + +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.BufferedReader; +import java.io.File; +import java.io.InputStreamReader; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLClassLoader; +import java.nio.charset.StandardCharsets; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.Arrays; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; +import java.util.regex.Pattern; + +/** + * SPI 类加载器 + */ +public class ExtensionLoader { + + private static final Logger logger = LoggerFactory.getLogger(ExtensionLoader.class); + + private static final String SERVICES_DIRECTORY = "META-INF/services/"; + + private static final String SMS_DIRECTORY = "META-INF/sms/"; + + private static final String DEFAULT_CLASSLOADER_POLICY = "internal"; + + private static final String WORKER_DIR_NAME = "platform-sms-admin"; + + private static final Pattern NAME_SEPARATOR = Pattern + .compile("\\s*[,]+\\s*"); + + private static final ConcurrentMap, ExtensionLoader> EXTENSION_LOADERS = new ConcurrentHashMap<>(); + + private static final ConcurrentMap, Object> EXTENSION_INSTANCES = new ConcurrentHashMap<>(); + + private static final ConcurrentMap EXTENSION_KEY_INSTANCE = new ConcurrentHashMap<>(); + + private final Class type; + + private final String classLoaderPolicy; + + private final ConcurrentMap, String> cachedNames = new ConcurrentHashMap<>(); + + private final Holder>> cachedClasses = new Holder<>(); + + private final ConcurrentMap> cachedInstances = new ConcurrentHashMap<>(); + + private String cachedDefaultName; + + private ConcurrentHashMap exceptions = new ConcurrentHashMap<>(); + + private static boolean withExtensionAnnotation(Class type) { + return type.isAnnotationPresent(SPI.class); + } + + public static ExtensionLoader getExtensionLoader(Class type) { + return getExtensionLoader(type, DEFAULT_CLASSLOADER_POLICY); + } + + @SuppressWarnings("unchecked") + public static ExtensionLoader getExtensionLoader(Class type, String classLoaderPolicy) { + if (type == null) throw new IllegalArgumentException("Extension type == null"); + if (!type.isInterface()) { + throw new IllegalArgumentException("Extension type(" + type + ") is not interface!"); + } + if (!withExtensionAnnotation(type)) { + throw new IllegalArgumentException("Extension type(" + type + ") is not extension, because WITHOUT @" + + SPI.class.getSimpleName() + " Annotation!"); + } + + ExtensionLoader loader = (ExtensionLoader) EXTENSION_LOADERS.get(type); + if (loader == null) { + EXTENSION_LOADERS.putIfAbsent(type, new ExtensionLoader(type, classLoaderPolicy)); + loader = (ExtensionLoader) EXTENSION_LOADERS.get(type); + } + return loader; + } + + private ExtensionLoader(Class type, String classLoaderPolicy) { + this.type = type; + this.classLoaderPolicy = classLoaderPolicy; + } + + /** + * 返回指定名字的扩展 + * + * @param name + * @return + */ + @SuppressWarnings("unchecked") + public T getExtension(String name) { + if (name == null || name.length() == 0) { + throw new IllegalArgumentException("Extension name == null"); + } + if ("true".equals(name)) { + return getDefaultExtension(); + } + Holder holder = cachedInstances.get(name); + if (holder == null) { + cachedInstances.putIfAbsent(name, new Holder<>()); + holder = cachedInstances.get(name); + } + Object instance = holder.get(); + if (instance == null) { + synchronized (holder) { + instance = holder.get(); + if (instance == null) { + instance = createExtension(name); + holder.set(instance); + } + } + } + return (T) instance; + } + + public T getExtensionDirectly(String name) { + if (name == null || name.length() == 0) { + throw new IllegalArgumentException("Extension name == null"); + } + return createExtensionDirectly(name); + } + + @SuppressWarnings("unchecked") + public T getExtension(String name, String key) { + if (name == null || name.length() == 0) throw new IllegalArgumentException("Extension name == null"); + if ("true".equals(name)) { + return getDefaultExtension(); + } + String extKey = name + "-" + StringUtils.trimToEmpty(key); + Holder holder = cachedInstances.get(extKey); + if (holder == null) { + cachedInstances.putIfAbsent(extKey, new Holder<>()); + holder = cachedInstances.get(extKey); + } + Object instance = holder.get(); + if (instance == null) { + synchronized (holder) { + instance = holder.get(); + if (instance == null) { + instance = createExtension(name, key); + holder.set(instance); + } + } + } + return (T) instance; + } + + /** + * 返回缺省的扩展,如果没有设置则返回null + */ + public T getDefaultExtension() { + getExtensionClasses(); + if (null == cachedDefaultName || cachedDefaultName.length() == 0 || "true".equals(cachedDefaultName)) { + return null; + } + return getExtension(cachedDefaultName); + } + + @SuppressWarnings("unchecked") + private T createExtension(String name) { + Class clazz = getExtensionClasses().get(name); + if (clazz == null) { + throw new IllegalStateException("Extension instance(name: " + name + ", class: " + type + + ") could not be instantiated: class could not be found"); + } + try { + T instance = (T) EXTENSION_INSTANCES.get(clazz); + if (instance == null) { + EXTENSION_INSTANCES.putIfAbsent(clazz, (T) clazz.newInstance()); + instance = (T) EXTENSION_INSTANCES.get(clazz); + } + return instance; + } catch (Throwable t) { + throw new IllegalStateException("Extension instance(name: " + name + ", class: " + type + + ") could not be instantiated: " + t.getMessage(), + t); + } + } + + @SuppressWarnings("unchecked") + private T createExtension(String name, String key) { + Class clazz = getExtensionClasses().get(name); + if (clazz == null) { + throw new IllegalStateException("Extension instance(name: " + name + ", class: " + type + + ") could not be instantiated: class could not be found"); + } + try { + T instance = (T) EXTENSION_KEY_INSTANCE.get(name + "-" + key); + if (instance == null) { + EXTENSION_KEY_INSTANCE.putIfAbsent(name + "-" + key, clazz.newInstance()); + instance = (T) EXTENSION_KEY_INSTANCE.get(name + "-" + key); + } + return instance; + } catch (Throwable t) { + throw new IllegalStateException("Extension instance(name: " + name + ", class: " + type + + ") could not be instantiated: " + t.getMessage(), + t); + } + } + + private T createExtensionDirectly(String name) { + Class clazz = getExtensionClasses().get(name); + if (clazz == null) { + throw new IllegalStateException("Extension instance(name: " + name + ", class: " + type + + ") could not be instantiated: class could not be found"); + } + try { + T instance = (T) clazz.newInstance(); + return instance; + } catch (Throwable t) { + throw new IllegalStateException("Extension instance(name: " + name + ", class: " + type + + ") could not be instantiated: " + t.getMessage(), + t); + } + } + + private Map> getExtensionClasses() { + Map> classes = cachedClasses.get(); + if (classes == null) { + synchronized (cachedClasses) { + classes = cachedClasses.get(); + if (classes == null) { + classes = loadExtensionClasses(); + cachedClasses.set(classes); + } + } + } + + return classes; + } + + private String getJarDirectoryPath() { + String userDir = System.getProperty("user.dir"); + URL url = Thread.currentThread().getContextClassLoader().getResource(""); + String dirtyPath; + if (url != null) { + dirtyPath = url.toString(); + } else { + File file = new File(""); + dirtyPath = file.getAbsolutePath(); + } + String jarPath = dirtyPath.replaceAll("^.*file:/", ""); // removes + // file:/ and + // everything + // before it + jarPath = jarPath.replaceAll("jar!.*", "jar"); // removes everything + // after .jar, if .jar + // exists in dirtyPath + jarPath = jarPath.replaceAll("%20", " "); // necessary if path has + // spaces within + if (!jarPath.endsWith(".jar")) { // this is needed if you plan to run + // the app using Spring Tools Suit play + // button. + jarPath = jarPath.replaceAll("/classes/.*", "/classes/"); + } + logger.info("jarPath:" + jarPath); + Path path = Paths.get(jarPath).getParent(); // Paths - from java 8 + if (path != null) { + logger.info("getJarDirectoryPath:" + path); + return path.toString(); + } + return null; + } + + private Map> loadExtensionClasses() { + final SPI defaultAnnotation = type.getAnnotation(SPI.class); + if (defaultAnnotation != null) { + String value = defaultAnnotation.value(); + if ((value = value.trim()).length() > 0) { + String[] names = NAME_SEPARATOR.split(value); + if (names.length > 1) { + throw new IllegalStateException("more than 1 default extension name on extension " + type.getName() + + ": " + Arrays.toString(names)); + } + if (names.length == 1) cachedDefaultName = names[0]; + } + } + + Map> extensionClasses = new HashMap<>(); + + String jarDirectoryPath = this.getJarDirectoryPath(); + // compatible with jdk17 + if (jarDirectoryPath.endsWith("lib") || jarDirectoryPath.endsWith("bin")) { + jarDirectoryPath = jarDirectoryPath.replaceAll("lib", "").replace("bin", ""); + } + + // 1. plugin folder,customized extension classLoader (jar_dir/plugin) + String dir = File.separator + jarDirectoryPath + File.separator + "plugin"; + + logger.info("dir:" + dir); + + File externalLibDir = new File(dir); + if (!externalLibDir.exists()) { + externalLibDir = new File(File.separator + jarDirectoryPath + File.separator + WORKER_DIR_NAME + + File.separator + "plugin"); + } + logger.info("extension classpath dir: " + externalLibDir.getAbsolutePath()); + if (externalLibDir.exists()) { + File[] files = externalLibDir.listFiles((dir1, name) -> name.endsWith(".jar")); + if (files != null) { + for (File f : files) { + URL url; + try { + url = f.toURI().toURL(); + } catch (MalformedURLException e) { + throw new RuntimeException("load extension jar failed!", e); + } + + ClassLoader parent = Thread.currentThread().getContextClassLoader(); + URLClassLoader localClassLoader; + if (classLoaderPolicy == null || "".equals(classLoaderPolicy) + || DEFAULT_CLASSLOADER_POLICY.equalsIgnoreCase(classLoaderPolicy)) { + localClassLoader = new URLClassExtensionLoader(new URL[]{url}); + } else { + localClassLoader = new URLClassLoader(new URL[]{url}, parent); + } + + loadFile(extensionClasses, SMS_DIRECTORY, localClassLoader); + loadFile(extensionClasses, SERVICES_DIRECTORY, localClassLoader); + } + } + } + // 只加载外部spi, 不加载classpath + // 2. load inner extension class with default classLoader + // ClassLoader classLoader = findClassLoader(); + // loadFile(extensionClasses, SMS_DIRECTORY, classLoader); + // loadFile(extensionClasses, SERVICES_DIRECTORY, classLoader); + + return extensionClasses; + } + + private void loadFile(Map> extensionClasses, String dir, ClassLoader classLoader) { + String fileName = dir + type.getName(); + try { + Enumeration urls; + if (classLoader != null) { + urls = classLoader.getResources(fileName); + } else { + urls = ClassLoader.getSystemResources(fileName); + } + if (urls != null) { + while (urls.hasMoreElements()) { + URL url = urls.nextElement(); + try { + try (BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream(), StandardCharsets.UTF_8))) { + String line; + while ((line = reader.readLine()) != null) { + final int ci = line.indexOf('#'); + if (ci >= 0) line = line.substring(0, ci); + line = line.trim(); + if (line.length() > 0) { + try { + String name = null; + int i = line.indexOf('='); + if (i > 0) { + name = line.substring(0, i).trim(); + line = line.substring(i + 1).trim(); + } + if (line.length() > 0) { + Class clazz = classLoader.loadClass(line); + if (!type.isAssignableFrom(clazz)) { + throw new IllegalStateException( + "Error when load extension class(interface: " + type + + ", class line: " + clazz.getName() + + "), class " + clazz.getName() + + "is not subtype of interface."); + } else { + try { + clazz.getConstructor(type); + } catch (NoSuchMethodException e) { + clazz.getConstructor(); + String[] names = NAME_SEPARATOR.split(name); + if (names != null && names.length > 0) { + for (String n : names) { + if (!cachedNames.containsKey(clazz)) { + cachedNames.put(clazz, n); + } + Class c = extensionClasses.get(n); + if (c == null) { + extensionClasses.put(n, clazz); + } else if (c != clazz) { + cachedNames.remove(clazz); + throw new IllegalStateException( + "Duplicate extension " + type.getName() + " name " + + n + " on " + + c.getName() + " and " + + clazz.getName()); + } + } + } + } + } + } + } catch (Throwable t) { + IllegalStateException e = new IllegalStateException( + "Failed to load extension class(interface: " + type + ", class line: " + + line + ") in " + url + + ", cause: " + + t.getMessage(), + t); + exceptions.put(line, e); + } + } + } // end of while read lines + } + } catch (Throwable t) { + logger.error("Exception when load extension class(interface: " + type + ", class file: " + url + + ") in " + url, + t); + } + } // end of while urls + } + } catch (Throwable t) { + logger.error( + "Exception when load extension class(interface: " + type + ", description file: " + fileName + ").", + t); + } + } + + @SuppressWarnings("unused") + private static ClassLoader findClassLoader() { + return ExtensionLoader.class.getClassLoader(); + } + + @Override + public String toString() { + return this.getClass().getName() + "[" + type.getName() + "]"; + } + + private static class Holder { + + private volatile T value; + + private void set(T value) { + this.value = value; + } + + private T get() { + return value; + } + + } +} diff --git a/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/adapter/core/support/SPI.java b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/adapter/core/support/SPI.java new file mode 100644 index 0000000..604ca44 --- /dev/null +++ b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/adapter/core/support/SPI.java @@ -0,0 +1,16 @@ +package com.platform.marketing.module.smschannel.adapter.core.support; + +import java.lang.annotation.*; + +/** + * SPI装载器注解 + */ +@Documented +@Retention(RetentionPolicy.RUNTIME) +@Target({ ElementType.TYPE }) +public @interface SPI { + + // Default SPI name + String value() default ""; + +} diff --git a/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/adapter/core/support/SmsChannelConfig.java b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/adapter/core/support/SmsChannelConfig.java new file mode 100644 index 0000000..b0bf868 --- /dev/null +++ b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/adapter/core/support/SmsChannelConfig.java @@ -0,0 +1,76 @@ +package com.platform.marketing.module.smschannel.adapter.core.support; + +/** + * 短信通道配置 + */ +public class SmsChannelConfig { + + //通道账号编号 + private Long id; + + /** + * 通道类型: aliyun/emay + */ + private String channelType; + + //通道appkey + private String channelAppkey; + + //通道appsecet + private String channelAppsecret; + + //访问地址 + private String channelDomain; + + //属性 json 格式 + private String extProperties; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getChannelType() { + return channelType; + } + + public void setChannelType(String channelType) { + this.channelType = channelType; + } + + public String getChannelDomain() { + return channelDomain; + } + + public void setChannelDomain(String channelDomain) { + this.channelDomain = channelDomain; + } + + public String getExtProperties() { + return extProperties; + } + + public void setExtProperties(String extProperties) { + this.extProperties = extProperties; + } + + public String getChannelAppkey() { + return channelAppkey; + } + + public void setChannelAppkey(String channelAppkey) { + this.channelAppkey = channelAppkey; + } + + public String getChannelAppsecret() { + return channelAppsecret; + } + + public void setChannelAppsecret(String channelAppsecret) { + this.channelAppsecret = channelAppsecret; + } + +} diff --git a/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/adapter/core/support/SmsTemplateUtil.java b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/adapter/core/support/SmsTemplateUtil.java new file mode 100644 index 0000000..ece1c1f --- /dev/null +++ b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/adapter/core/support/SmsTemplateUtil.java @@ -0,0 +1,102 @@ +package com.platform.marketing.module.smschannel.adapter.core.support; + +import com.alibaba.fastjson.JSON; +import org.apache.commons.lang3.StringUtils; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * 短信模版工具类 + */ +public class SmsTemplateUtil { + + public static String renderContentWithSignName(String templateParam, String templateContent, String signName) { + Map templateParamMap = JSON.parseObject(templateParam, HashMap.class); + return renderContentWithSignName(templateParamMap, templateContent, signName); + } + + /** + * 将模版渲染成短信内容 + * + * @param templateParam 模版参数 + * @param templateContent 模版内容 + * @return 短信内容(不包含签名) + */ + public static String renderContentWithSignName(Map templateParam, String templateContent, String signName) { + String result = templateContent; + String prefix = StringUtils.isEmpty(signName) ? StringUtils.EMPTY : "【" + signName + "】"; + if(null != templateParam && !templateParam.isEmpty()) { + // 遍历模板中的参数占位符,并替换为对应的参数值 + for (Map.Entry entry : templateParam.entrySet()) { + String placeholder = "${" + entry.getKey() + "}"; + String paramValue = entry.getValue(); + result = result.replace(placeholder, paramValue); + } + } + return prefix + result; + } + + public static String[] renderTemplateParamArray(String templateParam, String templateContent) { + Map templateParamMap = JSON.parseObject(templateParam, HashMap.class); + String[] placeholders = extractPlaceholders(templateContent); + String[] result = new String[placeholders.length]; + for (int i = 0; i < placeholders.length; i++) { + result[i] = templateParamMap.get(placeholders[i]); + } + return result; + } + + public static String[] extractPlaceholders(String template) { + List placeholders = new ArrayList<>(); + // 使用正则表达式查找模板中的占位符 + Pattern pattern = Pattern.compile("\\$\\{([a-zA-Z0-9]+)\\}"); + Matcher matcher = pattern.matcher(template); + while (matcher.find()) { + placeholders.add(matcher.group(1)); + } + return placeholders.toArray(new String[0]); + } + + public static String replaceStandardToTencent(String templateContent) { + String pattern = "\\$\\{([a-zA-Z0-9]+)\\}"; + // 编译正则表达式模式 + Pattern p = Pattern.compile(pattern); + // 创建Matcher对象 + Matcher matcher = p.matcher(templateContent); + // 定义一个替换计数器 + int count = 1; + // 开始替换 + // 迭代匹配并替换 + StringBuffer output = new StringBuffer(); + while (matcher.find()) { + // 获取匹配到的内容,即 code 和 time + String match = matcher.group(1); + // 根据匹配的内容替换为对应的计数器 + String replacement = "{" + count + "}"; + matcher.appendReplacement(output, replacement); + // 增加计数器 + count++; + } + matcher.appendTail(output); + String result = output.toString(); + return result; + } + + public static void main(String[] args) { + String template = "模版 ${code} , ${idsnb} ${name} 123 ${number123}"; + String[] extractedPlaceholders = extractPlaceholders(template); + for (String placeholder : extractedPlaceholders) { + System.out.println(placeholder); + } + + // 转换 + String input = "${code}为您的登录验证码,请于${time}分钟内填写,如非本人操作,请忽略本短信."; + System.out.println(replaceStandardToTencent(input)); + } + +} diff --git a/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/adapter/core/support/URLClassExtensionLoader.java b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/adapter/core/support/URLClassExtensionLoader.java new file mode 100644 index 0000000..e5ce6aa --- /dev/null +++ b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/adapter/core/support/URLClassExtensionLoader.java @@ -0,0 +1,89 @@ +package com.platform.marketing.module.smschannel.adapter.core.support; + +import java.io.IOException; +import java.net.URL; +import java.net.URLClassLoader; +import java.util.Enumeration; +import java.util.NoSuchElementException; + +public class URLClassExtensionLoader extends URLClassLoader { + + public URLClassExtensionLoader(URL[] urls){ + super(urls); + } + + @Override + public Class loadClass(String name) throws ClassNotFoundException { + Class c = findLoadedClass(name); + if (c != null) { + return c; + } + + if (name.startsWith("java.") || name.startsWith("org.slf4j.") || name.startsWith("org.apache.logging") + || name.startsWith("org.apache.zookeeper.") || name.startsWith("org.I0Itec.zkclient.") + || name.startsWith("org.apache.commons.logging.")) { + // || .namestartsWith("org.apache.hadoop.")) + // { + c = super.loadClass(name); + } + if (c != null) return c; + + try { + // 先加载jar内的class,可避免jar冲突 + c = findClass(name); + } catch (ClassNotFoundException e) { + c = null; + } + if (c != null) { + return c; + } + return super.loadClass(name); + } + + @Override + public Enumeration getResources(String name) throws IOException { + @SuppressWarnings("unchecked") + Enumeration[] tmp = (Enumeration[]) new Enumeration[2]; + + tmp[0] = findResources(name); // local class + // path first + // tmp[1] = super.getResources(name); + + return new CompoundEnumeration<>(tmp); + } + + private static class CompoundEnumeration implements Enumeration { + + private Enumeration[] enums; + private int index = 0; + + public CompoundEnumeration(Enumeration[] enums){ + this.enums = enums; + } + + private boolean next() { + while (this.index < this.enums.length) { + if (this.enums[this.index] != null && this.enums[this.index].hasMoreElements()) { + return true; + } + + ++this.index; + } + + return false; + } + + public boolean hasMoreElements() { + return this.next(); + } + + public E nextElement() { + if (!this.next()) { + throw new NoSuchElementException(); + } else { + return this.enums[this.index].nextElement(); + } + } + + } +} diff --git a/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/adapter/emay/EmaySmsOuterAdapter.java b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/adapter/emay/EmaySmsOuterAdapter.java new file mode 100644 index 0000000..0882729 --- /dev/null +++ b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/adapter/emay/EmaySmsOuterAdapter.java @@ -0,0 +1,114 @@ +package com.platform.marketing.module.smschannel.adapter.emay; + +import cn.emay.sdk.client.SmsSDKClient; +import cn.emay.sdk.core.dto.sms.common.ResultModel; +import cn.emay.sdk.core.dto.sms.request.SmsSingleRequest; +import cn.emay.sdk.core.dto.sms.response.SmsResponse; +import cn.emay.sdk.util.HttpUtil; +import com.platform.marketing.module.smschannel.adapter.core.SmsOuterAdapter; +import com.platform.marketing.module.smschannel.adapter.core.command.req.AddSmsTemplateReqCommand; +import com.platform.marketing.module.smschannel.adapter.core.command.req.QuerySmsTemplateReqCommand; +import com.platform.marketing.module.smschannel.adapter.core.command.req.SendSmsReqCommand; +import com.platform.marketing.module.smschannel.adapter.core.command.resp.SmsRespCommand; +import com.platform.marketing.module.smschannel.adapter.core.support.SmsChannelConfig; +import com.platform.marketing.module.smschannel.adapter.core.support.SmsTemplateUtil; +import com.alibaba.fastjson.JSON; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +/** + * 参考文档 https://www.b2m.cn/static/doc/sms/download.html + */ +public class EmaySmsOuterAdapter implements SmsOuterAdapter { + + private final static Logger logger = LoggerFactory.getLogger(EmaySmsOuterAdapter.class); + + private final static String extendedCode = "01"; + + private SmsChannelConfig smsChannelConfig; + + private String instanceId = UUID.randomUUID().toString().replaceAll("-", ""); + + private SmsSDKClient client; + + @Override + public void init(SmsChannelConfig smsChannelConfig) throws Exception { + logger.info("初始化亿美短信客户端 渠道编号:[" + smsChannelConfig.getId() + "] appkey:[" + smsChannelConfig.getChannelAppkey() + "] 实例Id:" + instanceId); + this.smsChannelConfig = smsChannelConfig; + String channelDomain = smsChannelConfig.getChannelDomain(); + String appId = smsChannelConfig.getChannelAppkey(); + String appSecret = smsChannelConfig.getChannelAppsecret(); + this.client = new SmsSDKClient(channelDomain, 80, appId, appSecret); + } + + @Override + public SmsRespCommand sendSmsByTemplateId(SendSmsReqCommand smsSendRequest) { + String mobile = smsSendRequest.getPhoneNumber(); + String signName = smsSendRequest.getSignName(); + String customSmsId = UUID.randomUUID().toString().replaceAll("-", ""); + String content = SmsTemplateUtil.renderContentWithSignName(smsSendRequest.getTemplateParam(), smsSendRequest.getTemplateContent(), signName); + SmsSingleRequest request = new SmsSingleRequest(mobile, content, customSmsId, extendedCode, ""); + ResultModel result = client.sendSingleSms(request); + logger.info("emay send result:" + JSON.toJSONString(result)); + if ("SUCCESS".equals(result.getCode())) { + return new SmsRespCommand(SmsRespCommand.SUCCESS_CODE, result.getResult().getSmsId()); + } + return new SmsRespCommand(SmsRespCommand.FAIL_CODE); + } + + @Override + public SmsRespCommand addSmsTemplate(AddSmsTemplateReqCommand addSmsTemplateReqCommand) { + // 将标准模版转换成 亿美模版 信息 + String templateContent = addSmsTemplateReqCommand.getTemplateContent(); + Map templateMap = new HashMap(); + // 标准模版: 你好,你的信息是:${code} + // 亿美模版: "templateContent":"【亿美软通】尊敬的{#name#},您好!您已成功注册,您的初始秘钥为{#password#}, + // 登录后可在个人中心修改,欢迎加入。", + String emayTemplateContent = "【" + addSmsTemplateReqCommand.getSignName() + "】" + + templateContent.replaceAll("\\$", "").replaceAll("\\{", "\\{#").replaceAll("\\}", "#\\}"); + templateMap.put("templateContent", emayTemplateContent); + templateMap.put("requestTime", String.valueOf(System.currentTimeMillis())); + templateMap.put("requestValidPeriod", "60"); + logger.info("emay addSmsTemplate templateMap:" + templateMap); + ResultModel result = HttpUtil.request( + smsChannelConfig.getChannelAppkey(), + smsChannelConfig.getChannelAppsecret(), + smsChannelConfig.getChannelDomain() + "/inter/createTemplateSMS", + templateMap, + HashMap.class); + logger.info("result:" + result.getResult()); + if ("SUCCESS".equals(result.getCode())) { + // {"templateId":"168984611698400172"} + Map bodyMap = new HashMap<>(); + bodyMap.put("templateCode", (String) result.getResult().get("templateId")); + bodyMap.put("templateContent", emayTemplateContent); + // 0 待提交: 1:待审核 2:审核成功 3:审核失败 亿美提交申请默认成功 + bodyMap.put("status", "2"); + return new SmsRespCommand(SmsRespCommand.SUCCESS_CODE, bodyMap); + } + return new SmsRespCommand(SmsRespCommand.FAIL_CODE, null, JSON.toJSONString(result.getResult())); + } + + @Override + public SmsRespCommand querySmsTemplateStatus(QuerySmsTemplateReqCommand querySmsTemplateReqCommand) { + // 亿美默认模版申请成功 + return new SmsRespCommand(SmsRespCommand.SUCCESS_CODE, 2); + } + + @Override + public String transferStandardTemplateContentToChannelContent(String standardTemplateContent) { + String emayTemplateContent = + standardTemplateContent.replaceAll("\\$", "").replaceAll("\\{", "\\{#").replaceAll("\\}", "#\\}"); + return emayTemplateContent; + } + + @Override + public void destroy() { + logger.warn("销毁亿美短信客户端 渠道编号:[" + smsChannelConfig.getId() + "] appkey:[" + smsChannelConfig.getChannelAppkey() + "] 实例Id:" + instanceId); + } + +} diff --git a/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/adapter/tencent/TencentSmsOuterAdapter.java b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/adapter/tencent/TencentSmsOuterAdapter.java new file mode 100644 index 0000000..ad68e0a --- /dev/null +++ b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/adapter/tencent/TencentSmsOuterAdapter.java @@ -0,0 +1,197 @@ +package com.platform.marketing.module.smschannel.adapter.tencent; + + +import com.platform.marketing.framework.common.util.json.JsonUtils; +import com.platform.marketing.module.smschannel.adapter.core.SmsOuterAdapter; +import com.platform.marketing.module.smschannel.adapter.core.command.req.AddSmsTemplateReqCommand; +import com.platform.marketing.module.smschannel.adapter.core.command.req.QuerySmsTemplateReqCommand; +import com.platform.marketing.module.smschannel.adapter.core.command.req.SendSmsReqCommand; +import com.platform.marketing.module.smschannel.adapter.core.command.resp.SmsRespCommand; +import com.platform.marketing.module.smschannel.adapter.core.support.SmsChannelConfig; +import com.platform.marketing.module.smschannel.adapter.core.support.SmsTemplateUtil; +import com.alibaba.fastjson.JSON; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.tencentcloudapi.common.Credential; +import com.tencentcloudapi.common.profile.ClientProfile; +import com.tencentcloudapi.common.profile.HttpProfile; +import com.tencentcloudapi.sms.v20210111.SmsClient; +import com.tencentcloudapi.sms.v20210111.models.*; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + + +/** + * 腾讯短信 参考腾讯文档 :https://cloud.tencent.com/document/product/382/43194 + */ +public class TencentSmsOuterAdapter implements SmsOuterAdapter { + + private final static Logger logger = LoggerFactory.getLogger(TencentSmsOuterAdapter.class); + + private String instanceId = UUID.randomUUID().toString().replaceAll("-", ""); + + private SmsChannelConfig smsChannelConfig; + + private String extProperties; + + private SmsClient client; + + private String appId; + + @Override + public void init(SmsChannelConfig smsChannelConfig) { + logger.info("初始化腾讯短信客户端 渠道编号:[" + smsChannelConfig.getId() + "] appkey:[" + smsChannelConfig.getChannelAppkey() + "] 实例Id:" + instanceId); + this.smsChannelConfig = smsChannelConfig; + Map extProperties = JsonUtils.parseObject(smsChannelConfig.getExtProperties(), new TypeReference>() { + }); + this.appId = extProperties.get("appId"); + // SecretId、SecretKey 查询: https://console.cloud.tencent.com/cam/capi + Credential cred = new Credential(smsChannelConfig.getChannelAppkey(), smsChannelConfig.getChannelAppsecret()); + HttpProfile httpProfile = new HttpProfile(); + httpProfile.setReqMethod("POST"); + httpProfile.setConnTimeout(60); + httpProfile.setEndpoint("sms.tencentcloudapi.com"); + ClientProfile clientProfile = new ClientProfile(); + clientProfile.setSignMethod("HmacSHA256"); + clientProfile.setHttpProfile(httpProfile); + this.client = new SmsClient(cred, "ap-guangzhou", clientProfile); + } + + @Override + public SmsRespCommand sendSmsByTemplateId(SendSmsReqCommand sendSmsReqCommand) { + // 参考腾讯文档 :https://cloud.tencent.com/document/product/382/43194 + try { + SendSmsRequest sendSmsRequest = new SendSmsRequest(); + sendSmsRequest.setSmsSdkAppId(appId); + sendSmsRequest.setSignName(sendSmsReqCommand.getSignName()); + sendSmsRequest.setTemplateId(sendSmsReqCommand.getTemplateCode()); + // 模板参数的个数需要与 TemplateId 对应模板的变量个数保持一致,若无模板参数,则设置为空 + sendSmsRequest.setTemplateParamSet(SmsTemplateUtil.renderTemplateParamArray(sendSmsReqCommand.getTemplateParam(), sendSmsReqCommand.getTemplateContent())); + sendSmsRequest.setPhoneNumberSet(new String[]{"+" + sendSmsReqCommand.getNationcode() + sendSmsReqCommand.getPhoneNumber()}); + sendSmsRequest.setExtendCode(StringUtils.EMPTY); + sendSmsRequest.setSenderId(StringUtils.EMPTY); + logger.info("tencent send sms:" + JSON.toJSONString(sendSmsRequest)); + SendSmsResponse response = client.SendSms(sendSmsRequest); + logger.info("response:" + JSON.toJSONString(response)); + SendStatus[] sendStatuArray = response.getSendStatusSet(); + if (sendStatuArray != null && sendStatuArray.length > 0) { + SendStatus sendStatus = sendStatuArray[0]; + if ("Ok".equals(sendStatus.getCode())) { + return new SmsRespCommand(SmsRespCommand.SUCCESS_CODE, sendStatus.getSerialNo()); + } else { + return new SmsRespCommand(SmsRespCommand.FAIL_CODE, null, sendStatus.getMessage()); + } + } + return new SmsRespCommand(SmsRespCommand.FAIL_CODE); + } catch (Exception e) { + logger.error("tencent sendSms error:", e); + return new SmsRespCommand(SmsRespCommand.FAIL_CODE); + } + } + + @Override + public SmsRespCommand> addSmsTemplate(AddSmsTemplateReqCommand addSmsTemplateReqCommand) { + try { + AddSmsTemplateRequest addSmsTemplateRequest = new AddSmsTemplateRequest(); + + // 标准:模板类型:0-验证码 1-短信通知 2-推广短信 + // 腾讯云:1表示营销短信,2表示通知短信,3表示验证码短信。 + // 标准模板类型到腾讯云模板类型的映射 + Long tencentTemplateType; + switch (addSmsTemplateReqCommand.getTemplateType()) { + case 0: // 验证码 -> 腾讯云: 3 + tencentTemplateType = 3L; + break; + case 1: // 短信通知 -> 腾讯云: 2 + tencentTemplateType = 2L; + break; + case 2: // 推广短信 -> 腾讯云: 1 + tencentTemplateType = 1L; + break; + default: + throw new IllegalArgumentException("不支持的模板类型: " + addSmsTemplateReqCommand.getTemplateType()); + } + addSmsTemplateRequest.setSmsType(tencentTemplateType); + + addSmsTemplateRequest.setSmsType(Long.valueOf(addSmsTemplateReqCommand.getTemplateType())); + addSmsTemplateRequest.setTemplateName(addSmsTemplateReqCommand.getTemplateName()); + // 腾讯云:{1}为您的登录验证码,请于{2}分钟内填写,如非本人操作,请忽略本短信。 + // 标准版:${code}为您的登录验证码,请于${time}分钟内填写,如非本人操作,请忽略本短信。 + String templateContent = SmsTemplateUtil.replaceStandardToTencent(addSmsTemplateReqCommand.getTemplateContent()); + addSmsTemplateRequest.setTemplateContent(templateContent); + addSmsTemplateRequest.setInternational(Long.valueOf(addSmsTemplateReqCommand.getInternational())); + addSmsTemplateRequest.setRemark(addSmsTemplateReqCommand.getRemark()); + logger.info("tencent addSmsTemplateRequest:" + JSON.toJSONString(addSmsTemplateRequest)); + AddSmsTemplateResponse addSmsTemplateResponse = client.AddSmsTemplate(addSmsTemplateRequest); + logger.info("tencent addSmsTemplateResponse:" + JSON.toJSONString(addSmsTemplateResponse)); + if (addSmsTemplateResponse != null) { + AddTemplateStatus addTemplateStatus = addSmsTemplateResponse.getAddTemplateStatus(); + if (addTemplateStatus != null) { + Map bodyMap = new HashMap<>(); + bodyMap.put("templateCode", addTemplateStatus.getTemplateId()); + bodyMap.put("templateContent", templateContent); + return new SmsRespCommand(SmsRespCommand.SUCCESS_CODE, bodyMap); + } + } + } catch (Exception e) { + logger.error("tencent addSmsTemplate error: ", e); + return new SmsRespCommand(SmsRespCommand.FAIL_CODE, null, e.getMessage()); + } + return new SmsRespCommand(SmsRespCommand.FAIL_CODE, null, "提交失败"); + } + + @Override + public SmsRespCommand querySmsTemplateStatus(QuerySmsTemplateReqCommand querySmsTemplateReqCommand) { + try { + DescribeSmsTemplateListRequest describeSmsTemplateListRequest = new DescribeSmsTemplateListRequest(); + describeSmsTemplateListRequest.setTemplateIdSet(new Long[]{Long.valueOf(querySmsTemplateReqCommand.getTemplateCode())}); + describeSmsTemplateListRequest.setInternational(0L); + DescribeSmsTemplateListResponse response = client.DescribeSmsTemplateList(describeSmsTemplateListRequest); + if (response != null) { + DescribeTemplateListStatus[] arr = response.getDescribeTemplateStatusSet(); + if (arr == null) { + logger.error("tencent templateId:" + querySmsTemplateReqCommand.getTemplateCode() + " 不存在"); + } else { + Long statusCode = arr[0].getStatusCode(); + //腾讯:申请模板状态,其中0表示审核通过且已生效,1表示审核中,2表示审核通过待生效,-1表示审核未通过或审核失败。注:只有状态值为0时该模板才能使用。 + //标准: 0 : 待提交 1:待审核 2:审核成功 3:审核失败 + if (statusCode == 0L) { + return new SmsRespCommand(SmsRespCommand.SUCCESS_CODE, 2); + } + if (statusCode == 1L) { + return new SmsRespCommand(SmsRespCommand.SUCCESS_CODE, 1); + } + if (statusCode == -1L) { + return new SmsRespCommand(SmsRespCommand.SUCCESS_CODE, 3); + } + if (statusCode == 2L) { + return new SmsRespCommand(SmsRespCommand.SUCCESS_CODE, 1); + } + } + } + return new SmsRespCommand(SmsRespCommand.FAIL_CODE); + } catch (Exception e) { + logger.error("tencent addSmsTemplate error: ", e); + return new SmsRespCommand(SmsRespCommand.FAIL_CODE, e.getMessage()); + } + } + + @Override + public String transferStandardTemplateContentToChannelContent(String standardTemplateContent) { + // 腾讯云:{1}为您的登录验证码,请于{2}分钟内填写,如非本人操作,请忽略本短信。 + // 标准版:${code}为您的登录验证码,请于${time}分钟内填写,如非本人操作,请忽略本短信。 + String templateContent = SmsTemplateUtil.replaceStandardToTencent(standardTemplateContent); + return templateContent; + } + + @Override + public void destroy() { + logger.warn("销毁腾讯短信客户端 渠道编号:[" + smsChannelConfig.getId() + "] appkey:[" + smsChannelConfig.getChannelAppkey() + "] 实例Id:" + instanceId); + } + +} diff --git a/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/adapter/unisms/UnismsSmsOuterAdapter.java b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/adapter/unisms/UnismsSmsOuterAdapter.java new file mode 100644 index 0000000..56531a5 --- /dev/null +++ b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/adapter/unisms/UnismsSmsOuterAdapter.java @@ -0,0 +1,203 @@ +package com.platform.marketing.module.smschannel.adapter.unisms; + +import com.platform.marketing.module.smschannel.adapter.core.SmsOuterAdapter; +import com.platform.marketing.module.smschannel.adapter.core.command.req.AddSmsTemplateReqCommand; +import com.platform.marketing.module.smschannel.adapter.core.command.req.QuerySmsTemplateReqCommand; +import com.platform.marketing.module.smschannel.adapter.core.command.req.SendSmsReqCommand; +import com.platform.marketing.module.smschannel.adapter.core.command.resp.SmsRespCommand; +import com.platform.marketing.module.smschannel.adapter.core.support.SmsChannelConfig; +import com.alibaba.fastjson.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; +import org.apache.commons.lang3.StringUtils; +import org.apache.http.HttpEntity; +import org.apache.http.HttpResponse; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.client.utils.URIBuilder; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.util.EntityUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.crypto.Mac; +import javax.crypto.spec.SecretKeySpec; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.*; + +/** + * 文档地址:https://unisms.apistd.com/docs/api/send + */ +public class UnismsSmsOuterAdapter implements SmsOuterAdapter { + + private static final String BASE_URL = "https://uni.apistd.com/"; + + private static final String ACTION = "sms.message.send"; + + private final static Logger logger = LoggerFactory.getLogger(UnismsSmsOuterAdapter.class); + + private String instanceId = UUID.randomUUID().toString().replaceAll("-", ""); + + private SmsChannelConfig smsChannelConfig; + + @Override + public void init(SmsChannelConfig smsChannelConfig) { + logger.info("初始化合一短信客户端 渠道编号:[" + smsChannelConfig.getId() + "] appkey:[" + smsChannelConfig.getChannelAppkey() + "] 实例Id:" + instanceId); + this.smsChannelConfig = smsChannelConfig; + } + + @Override + public SmsRespCommand sendSmsByTemplateId(SendSmsReqCommand sendSmsReqCommand) { + String url = BASE_URL; + + Gson gson = new Gson(); + try { + // 构建请求体 + Map bodyMap = new HashMap<>(); + bodyMap.put("to", sendSmsReqCommand.getNationcode().equals("86")? sendSmsReqCommand.getPhoneNumber() : "+" + sendSmsReqCommand.getNationcode() + sendSmsReqCommand.getPhoneNumber()); + bodyMap.put("signature", sendSmsReqCommand.getSignName()); + bodyMap.put("templateId", sendSmsReqCommand.getTemplateCode()); + Map templateParamMap = JSON.parseObject(sendSmsReqCommand.getTemplateParam(), HashMap.class); + bodyMap.put("templateData", templateParamMap); + + Map headerMap = new HashMap<>(); + headerMap.put("action", ACTION); + headerMap.put("accessKeyId", smsChannelConfig.getChannelAppkey()); + // 设置请求体 + if (StringUtils.isNotEmpty(smsChannelConfig.getChannelAppsecret()) && !"-".equals(smsChannelConfig.getChannelAppsecret())) { + headerMap.put("algorithm", "hmac-sha256"); + headerMap.put("timestamp", new Date().getTime()); + headerMap.put("nonce", UUID.randomUUID().toString().replaceAll("-", "")); + String strToSign = queryStringify(headerMap); + headerMap.put("signature", getSignature(strToSign, smsChannelConfig.getChannelAppsecret())); + } + + URIBuilder uriBuilder = new URIBuilder(smsChannelConfig.getChannelDomain()); + for (Map.Entry entry : headerMap.entrySet()) { + uriBuilder.addParameter(entry.getKey(), entry.getValue().toString()); + } + + URI uri = null; + try { + uri = uriBuilder.build(); + } catch (URISyntaxException e) { + logger.error("构建 URI 失败", e); + } + + HttpPost httpPost = new HttpPost(uri); + httpPost.setHeader("Content-Type", "application/json"); // 可选,如果服务器需要 + CloseableHttpClient httpClient = HttpClients.createDefault(); + + String requestBody = gson.toJson(bodyMap); + logger.info("发送合一短信请求:" + requestBody); + httpPost.setEntity(new StringEntity(requestBody, "UTF-8")); + // 执行请求 + HttpResponse response = httpClient.execute(httpPost); + HttpEntity entity = response.getEntity(); + // 处理响应 + if (entity != null) { + // 检查HTTP状态码 + int statusCode = response.getStatusLine().getStatusCode(); + String responseBody = EntityUtils.toString(entity); + logger.info("发送合一短信 手机号" + sendSmsReqCommand.getPhoneNumber() + " 结果 statusCode:" + statusCode + " responseBody:" + responseBody); + if (statusCode == 200) { + JsonObject jsonResponse = gson.fromJson(responseBody, JsonObject.class); + // 检查业务状态码 + String code = jsonResponse.get("code").getAsString(); + if ("0".equals(code)) { + // 提取第一条消息ID + JsonObject data = jsonResponse.getAsJsonObject("data"); + JsonArray messages = data.getAsJsonArray("messages"); + if (messages != null && messages.size() > 0) { + String firstMessageId = messages.get(0).getAsJsonObject().get("id").getAsString(); + return new SmsRespCommand<>(SmsRespCommand.SUCCESS_CODE, firstMessageId); + } + return new SmsRespCommand<>(SmsRespCommand.FAIL_CODE, "No message details in response"); + } else { + // 业务错误 + return new SmsRespCommand<>(SmsRespCommand.FAIL_CODE, responseBody); + } + } else { + return new SmsRespCommand(SmsRespCommand.FAIL_CODE, responseBody); + } + } + return new SmsRespCommand(SmsRespCommand.FAIL_CODE, null, "Empty response from server"); + } catch (Exception e) { + logger.error("unisms sendSmsByTemplateId error:", e); + return new SmsRespCommand(SmsRespCommand.FAIL_CODE, null, e.getMessage()); + } + } + + @Override + public SmsRespCommand> addSmsTemplate(AddSmsTemplateReqCommand addSmsTemplateReqCommand) { + return new SmsRespCommand(SmsRespCommand.NOT_SUPPORT_CODE, null, "不支持"); + } + + @Override + public SmsRespCommand querySmsTemplateStatus(QuerySmsTemplateReqCommand querySmsTemplateReqCommand) { + return new SmsRespCommand(SmsRespCommand.NOT_SUPPORT_CODE, null, "不支持"); + } + + @Override + public String transferStandardTemplateContentToChannelContent(String standardTemplateContent) { + // 阿里云短信: 您的验证码是${code}。如非本人操作,请忽略本短信。 + // 合一短信: 您的验证码是{code}。如非本人操作,请忽略本短信。 + // 假设标准模板使用 ${variable} 格式(如阿里云) + // 转换为合一短信的 {variable} 格式 + String channelContent = standardTemplateContent.replaceAll("\\$\\{(\\w+)\\}", "{$1}"); + return channelContent; + } + + @Override + public void destroy() { + logger.warn("销毁合一短信客户端 渠道编号:[" + smsChannelConfig.getId() + "] appkey:[" + smsChannelConfig.getChannelAppkey() + "] 实例Id:" + instanceId); + } + + private static String getSignature(final String message, final String secretKey) { + try { + Mac hmac = Mac.getInstance("HmacSHA256"); + SecretKeySpec secretKeySpec = new SecretKeySpec(secretKey.getBytes(), "HmacSHA256"); + hmac.init(secretKeySpec); + + byte[] bytes = hmac.doFinal(message.getBytes()); + return Base64.getEncoder().encodeToString(bytes); + } catch (Exception e) { + logger.error("获取签名失败", e); + return null; + } + } + + private static String queryStringify(final Map params) { + Map sortedMap = new TreeMap<>(new MapKeyComparator()); + sortedMap.putAll(params); + StringBuilder sb = new StringBuilder(); + Iterator iter = sortedMap.entrySet().iterator(); + + while (iter.hasNext()) { + if (sb.length() > 0) { + sb.append('&'); + } + Map.Entry entry = (Map.Entry) iter.next(); + sb.append(entry.getKey()).append("=").append(entry.getValue()); + } + + return sb.toString(); + } + + static class MapKeyComparator implements Comparator { + @Override + public int compare(String str1, String str2) { + return str1.compareTo(str2); + } + } + + public static void main(String[] args) { + UnismsSmsOuterAdapter unismsSmsOuterAdapter = new UnismsSmsOuterAdapter(); + String template = "您的验证码是${code}。如非本人操作,请忽略本短信。"; + System.out.println(unismsSmsOuterAdapter.transferStandardTemplateContentToChannelContent(template)); + } + +} diff --git a/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/controller/ChannelAccountController.java b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/controller/ChannelAccountController.java new file mode 100644 index 0000000..8380d51 --- /dev/null +++ b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/controller/ChannelAccountController.java @@ -0,0 +1,98 @@ +package com.platform.marketing.module.smschannel.controller; + +import com.platform.marketing.framework.common.util.json.JsonUtils; +import com.platform.marketing.module.smschannel.domain.vo.ChannelAccountPageReqVO; +import com.platform.marketing.module.smschannel.domain.vo.ChannelAccountRespVO; +import com.platform.marketing.module.smschannel.domain.vo.ChannelAccountSaveReqVO; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; + +import org.springframework.validation.annotation.Validated; +import org.springframework.security.access.prepost.PreAuthorize; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Operation; + +import javax.validation.*; +import java.util.*; +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.common.pojo.CommonResult; +import com.platform.marketing.framework.common.util.object.BeanUtils; + +import static com.platform.marketing.framework.common.pojo.CommonResult.success; + +import com.platform.marketing.module.smschannel.domain.dataobject.SmsChannelAccountDO; +import com.platform.marketing.module.smschannel.service.SmsChannelAccountService; + +@Tag(name = "管理后台 - 短信渠道账号") +@RestController +@RequestMapping("/smschannel/channel-account") +@Validated +public class ChannelAccountController { + + @Resource + private SmsChannelAccountService smsChannelAccountService; + + @PostMapping("/create") + @Operation(summary = "创建短信渠道账号") + @PreAuthorize("@ss.hasPermission('smschannel:channel-account:create')") + public CommonResult createChannelAccount(@Valid @RequestBody ChannelAccountSaveReqVO createReqVO) { + return success(smsChannelAccountService.createChannelAccount(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新短信渠道账号") + @PreAuthorize("@ss.hasPermission('smschannel:channel-account:update')") + public CommonResult updateChannelAccount(@Valid @RequestBody ChannelAccountSaveReqVO updateReqVO) { + smsChannelAccountService.updateChannelAccount(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除短信渠道账号") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('smschannel:channel-account:delete')") + public CommonResult deleteChannelAccount(@RequestParam("id") Long id) { + smsChannelAccountService.deleteChannelAccount(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得短信渠道账号") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('smschannel:channel-account:query')") + public CommonResult getChannelAccount(@RequestParam("id") Long id) { + SmsChannelAccountDO channelAccount = smsChannelAccountService.getChannelAccount(id); + + ChannelAccountRespVO channelAccountRespVO = BeanUtils.toBean(channelAccount, ChannelAccountRespVO.class); + channelAccountRespVO.setSupportSmsType(JsonUtils.parseArray(channelAccount.getSupportSmsType(), Integer.class)); + + return success(channelAccountRespVO); + } + + @GetMapping("/list") + @Operation(summary = "获得短信渠道账号") + @PreAuthorize("@ss.hasPermission('smschannel:channel-account:query')") + public CommonResult> getChannelAccountList() { + List channelAccountList = smsChannelAccountService.getChannelAccountList(); + return success(BeanUtils.toBean(channelAccountList, ChannelAccountRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得短信渠道账号分页") + @PreAuthorize("@ss.hasPermission('smschannel:channel-account:query')") + public CommonResult> getChannelAccountPage(@Valid ChannelAccountPageReqVO pageReqVO) { + PageResult pageResult = smsChannelAccountService.getChannelAccountPage(pageReqVO); + + PageResult result = new PageResult<>(pageResult.getTotal()); + for (SmsChannelAccountDO smsChannelAccountDO : pageResult.getList()) { + ChannelAccountRespVO channelAccountRespVO = BeanUtils.toBean(smsChannelAccountDO, ChannelAccountRespVO.class); + channelAccountRespVO.setSupportSmsType(JsonUtils.parseArray(smsChannelAccountDO.getSupportSmsType(), Integer.class)); + result.getList().add(channelAccountRespVO); + } + + return CommonResult.success(result); + } + +} \ No newline at end of file diff --git a/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/controller/SmsChannelInfoController.java b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/controller/SmsChannelInfoController.java new file mode 100644 index 0000000..44a161a --- /dev/null +++ b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/controller/SmsChannelInfoController.java @@ -0,0 +1,103 @@ +package com.platform.marketing.module.smschannel.controller; + +import com.platform.marketing.module.smschannel.domain.vo.SmsChannelInfoPageReqVO; +import com.platform.marketing.module.smschannel.domain.vo.SmsChannelInfoRespVO; +import com.platform.marketing.module.smschannel.domain.vo.SmsChannelInfoSaveReqVO; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; + +import org.springframework.validation.annotation.Validated; +import org.springframework.security.access.prepost.PreAuthorize; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Operation; + +import javax.validation.*; +import javax.servlet.http.*; +import java.util.*; +import java.io.IOException; + +import com.platform.marketing.framework.common.pojo.PageParam; +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.common.pojo.CommonResult; +import com.platform.marketing.framework.common.util.object.BeanUtils; + +import static com.platform.marketing.framework.common.pojo.CommonResult.success; + +import com.platform.marketing.framework.excel.core.util.ExcelUtils; + +import com.platform.marketing.module.smschannel.domain.dataobject.SmsChannelInfoDO; +import com.platform.marketing.module.smschannel.service.SmsChannelInfoService; + +@Tag(name = "管理后台 - 短信渠道配置表(含扩展属性字段)") +@RestController +@RequestMapping("/smschannel/sms-channel-info") +@Validated +public class SmsChannelInfoController { + + @Resource + private SmsChannelInfoService smsChannelInfoService; + + @PostMapping("/create") + @Operation(summary = "创建短信渠道配置表(含扩展属性字段)") + @PreAuthorize("@ss.hasPermission('t:sms-channel-info:create')") + public CommonResult createSmsChannelInfo(@Valid @RequestBody SmsChannelInfoSaveReqVO createReqVO) { + return success(smsChannelInfoService.createSmsChannelInfo(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新短信渠道配置表(含扩展属性字段)") + @PreAuthorize("@ss.hasPermission('t:sms-channel-info:update')") + public CommonResult updateSmsChannelInfo(@Valid @RequestBody SmsChannelInfoSaveReqVO updateReqVO) { + smsChannelInfoService.updateSmsChannelInfo(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除短信渠道配置表(含扩展属性字段)") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('t:sms-channel-info:delete')") + public CommonResult deleteSmsChannelInfo(@RequestParam("id") Integer id) { + smsChannelInfoService.deleteSmsChannelInfo(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得短信渠道配置表(含扩展属性字段)") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('t:sms-channel-info:query')") + public CommonResult getSmsChannelInfo(@RequestParam("id") Integer id) { + SmsChannelInfoDO smsChannelInfo = smsChannelInfoService.getSmsChannelInfo(id); + return success(BeanUtils.toBean(smsChannelInfo, SmsChannelInfoRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得短信渠道配置表(含扩展属性字段)分页") + @PreAuthorize("@ss.hasPermission('t:sms-channel-info:query')") + public CommonResult> getSmsChannelInfoPage(@Valid SmsChannelInfoPageReqVO pageReqVO) { + PageResult pageResult = smsChannelInfoService.getSmsChannelInfoPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, SmsChannelInfoRespVO.class)); + } + + @GetMapping("/list") + @Operation(summary = "获得短信渠道配置表") + @PreAuthorize("@ss.hasPermission('t:sms-channel-info:query')") + public CommonResult> getSmsChannelInfoList(@Valid SmsChannelInfoPageReqVO pageReqVO) { + List data = smsChannelInfoService.getSmsChannelInfoList(); + return success(BeanUtils.toBean(data, SmsChannelInfoRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出短信渠道配置表(含扩展属性字段) Excel") + @PreAuthorize("@ss.hasPermission('t:sms-channel-info:export')") + public void exportSmsChannelInfoExcel(@Valid SmsChannelInfoPageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = smsChannelInfoService.getSmsChannelInfoPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "短信渠道配置表(含扩展属性字段).xls", "数据", SmsChannelInfoRespVO.class, + BeanUtils.toBean(list, SmsChannelInfoRespVO.class)); + } + +} \ No newline at end of file diff --git a/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/controller/SmsSignInfoController.java b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/controller/SmsSignInfoController.java new file mode 100644 index 0000000..2c2279b --- /dev/null +++ b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/controller/SmsSignInfoController.java @@ -0,0 +1,126 @@ +package com.platform.marketing.module.smschannel.controller; + +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.module.smschannel.domain.dataobject.SmsSignInfoDO; +import com.platform.marketing.module.smschannel.domain.vo.SmsSignInfoPageReqVO; +import com.platform.marketing.module.smschannel.domain.vo.SmsSignInfoRespVO; +import com.platform.marketing.module.smschannel.domain.vo.SmsSignInfoSaveReqVO; +import com.platform.marketing.module.smschannel.service.SmsSignInfoService; +import com.platform.marketing.module.smschannel.service.SmsTemplateInfoService; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; + +import org.springframework.validation.annotation.Validated; +import org.springframework.security.access.prepost.PreAuthorize; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Operation; + +import javax.validation.constraints.*; +import javax.validation.*; +import javax.servlet.http.*; +import java.util.*; +import java.io.IOException; + +import com.platform.marketing.framework.common.pojo.PageParam; +import com.platform.marketing.framework.common.pojo.CommonResult; +import com.platform.marketing.framework.common.util.object.BeanUtils; + +import static com.platform.marketing.framework.common.pojo.CommonResult.success; + +import com.platform.marketing.framework.excel.core.util.ExcelUtils; + + +@Tag(name = "管理后台 - 短信签名信息") +@RestController +@RequestMapping("/smschannel/sign-info") +@Validated +public class SmsSignInfoController { + + @Resource + private SmsSignInfoService signInfoService; + + @Resource + private SmsTemplateInfoService smsTemplateInfoService; + + @PostMapping("/create") + @Operation(summary = "创建短信签名信息") + @PreAuthorize("@ss.hasPermission('sms:sign-info:create')") + public CommonResult createSignInfo(@Valid @RequestBody SmsSignInfoSaveReqVO createReqVO) { + return success(signInfoService.createSignInfo(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新短信签名信息") + @PreAuthorize("@ss.hasPermission('sms:sign-info:update')") + public CommonResult updateSignInfo(@Valid @RequestBody SmsSignInfoSaveReqVO updateReqVO) { + signInfoService.updateSignInfo(updateReqVO); + + // 刷新模版信息 (因为更改绑定账号,需要刷新模版绑定信息) + smsTemplateInfoService.flushTemplateBindingInfo(updateReqVO.getId()); + + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除短信签名信息") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('sms:sign-info:delete')") + public CommonResult deleteSignInfo(@RequestParam("id") Long id) { + signInfoService.deleteSignInfo(id); + return success(true); + } + +// @DeleteMapping("/delete-list") +// @Parameter(name = "ids", description = "编号", required = true) +// @Operation(summary = "批量删除短信签名信息") +// @PreAuthorize("@ss.hasPermission('sms:sign-info:delete')") +// public CommonResult deleteSignInfoList(@RequestParam("ids") List ids) { +// signInfoService.deleteSignInfoListByIds(ids); +// return success(true); +// } + + @GetMapping("/get") + @Operation(summary = "获得短信签名信息") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('sms:sign-info:query')") + public CommonResult getSignInfo(@RequestParam("id") Long id) { + SmsSignInfoDO signInfo = signInfoService.getSignInfo(id); + return success(BeanUtils.toBean(signInfo, SmsSignInfoRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得短信签名信息分页") + @PreAuthorize("@ss.hasPermission('sms:sign-info:query')") + public CommonResult> getSignInfoPage(@Valid SmsSignInfoPageReqVO pageReqVO) { + PageResult pageResult = signInfoService.getSignInfoRespPage(pageReqVO); + return success(pageResult); + } + + @GetMapping("/list") + @Operation(summary = "获得短信签名信息列表") + @PreAuthorize("@ss.hasPermission('sms:sign-info:query')") + public CommonResult> getSignInfoList(@RequestParam(value = "international", required = false) Integer international) { + List data; + if (international != null) { + data = signInfoService.getSignInfoDOListByInternational(international); + } else { + data = signInfoService.getSignInfoDOList(); + } + return success(BeanUtils.toBean(data, SmsSignInfoRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出短信签名信息 Excel") + @PreAuthorize("@ss.hasPermission('sms:sign-info:export')") + public void exportSignInfoExcel(@Valid SmsSignInfoPageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = signInfoService.getSignInfoPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "短信签名信息.xls", "数据", SmsSignInfoRespVO.class, + BeanUtils.toBean(list, SmsSignInfoRespVO.class)); + } + +} \ No newline at end of file diff --git a/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/controller/SmsTemplateInfoController.java b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/controller/SmsTemplateInfoController.java new file mode 100644 index 0000000..84e78e9 --- /dev/null +++ b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/controller/SmsTemplateInfoController.java @@ -0,0 +1,85 @@ +package com.platform.marketing.module.smschannel.controller; + +import com.platform.marketing.framework.common.pojo.CommonResult; +import com.platform.marketing.framework.common.pojo.PageParam; +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.common.util.object.BeanUtils; +import com.platform.marketing.framework.excel.core.util.ExcelUtils; +import com.platform.marketing.module.smschannel.domain.dataobject.SmsTemplateInfoDO; +import com.platform.marketing.module.smschannel.domain.vo.TemplateInfoPageReqVO; +import com.platform.marketing.module.smschannel.domain.vo.TemplateInfoRespVO; +import com.platform.marketing.module.smschannel.domain.vo.TemplateInfoSaveReqVO; +import com.platform.marketing.module.smschannel.service.SmsTemplateInfoService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; +import java.io.IOException; +import java.util.List; + +import static com.platform.marketing.framework.common.pojo.CommonResult.success; + +@Tag(name = "管理后台 - 短信模板信息") +@RestController +@RequestMapping("/smschannel/template-info") +@Validated +public class SmsTemplateInfoController { + @Resource + private SmsTemplateInfoService smsTemplateInfoService; + @PostMapping("/create") + @Operation(summary = "创建短信模板信息") + @PreAuthorize("@ss.hasPermission('smschannel:template-info:create')") + public CommonResult createTemplateInfo(@Valid @RequestBody TemplateInfoSaveReqVO createReqVO) { + return success(smsTemplateInfoService.createTemplateInfo(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新短信模板信息") + @PreAuthorize("@ss.hasPermission('smschannel:template-info:update')") + public CommonResult updateTemplateInfo(@Valid @RequestBody TemplateInfoSaveReqVO updateReqVO) { + smsTemplateInfoService.updateTemplateInfo(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除短信模板信息") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('smschannel:template-info:delete')") + public CommonResult deleteTemplateInfo(@RequestParam("id") Long id) { + smsTemplateInfoService.deleteTemplateInfo(id); + return success(true); + } + +// @DeleteMapping("/delete-list") +// @Parameter(name = "ids", description = "编号", required = true) +// @Operation(summary = "批量删除短信模板信息") +// @PreAuthorize("@ss.hasPermission('smschannel:template-info:delete')") +// public CommonResult deleteTemplateInfoList(@RequestParam("ids") List ids) { +// smsTemplateInfoService.deleteTemplateInfoListByIds(ids); +// return success(true); +// } + + @GetMapping("/get") + @Operation(summary = "获得短信模板信息") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('smschannel:template-info:query')") + public CommonResult getTemplateInfo(@RequestParam("id") Long id) { + SmsTemplateInfoDO templateInfo = smsTemplateInfoService.getTemplateInfo(id); + return success(BeanUtils.toBean(templateInfo, TemplateInfoRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得短信模板信息分页") + @PreAuthorize("@ss.hasPermission('smschannel:template-info:query')") + public CommonResult> getTemplateInfoPage(@Valid TemplateInfoPageReqVO pageReqVO) { + PageResult pageResult = smsTemplateInfoService.getTemplateInfoPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, TemplateInfoRespVO.class)); + } + +} \ No newline at end of file diff --git a/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/controller/TemplateBindingInfoController.java b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/controller/TemplateBindingInfoController.java new file mode 100644 index 0000000..33f73e5 --- /dev/null +++ b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/controller/TemplateBindingInfoController.java @@ -0,0 +1,91 @@ +package com.platform.marketing.module.smschannel.controller; + +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.module.smschannel.domain.dataobject.SmsTemplateBindingInfoDO; +import com.platform.marketing.module.smschannel.domain.enums.CreateTemplateStatus; +import com.platform.marketing.module.smschannel.domain.vo.TemplateBindingInfoPageReqVO; +import com.platform.marketing.module.smschannel.domain.vo.TemplateBindingInfoRespVO; +import com.platform.marketing.module.smschannel.domain.vo.TemplateBindingInfoSaveReqVO; +import com.platform.marketing.module.smschannel.service.TemplateBindingInfoService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import org.springframework.security.access.prepost.PreAuthorize; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Operation; +import javax.validation.*; +import javax.servlet.http.*; +import java.util.*; +import java.io.IOException; +import com.platform.marketing.framework.common.pojo.PageParam; +import com.platform.marketing.framework.common.pojo.CommonResult; +import com.platform.marketing.framework.common.util.object.BeanUtils; +import static com.platform.marketing.framework.common.pojo.CommonResult.success; +import com.platform.marketing.framework.excel.core.util.ExcelUtils; + +@Tag(name = "管理后台 - 短信模板渠道绑定") +@RestController +@RequestMapping("/sms/template-binding-info") +@Validated +public class TemplateBindingInfoController { + + @Resource + private TemplateBindingInfoService templateBindingInfoService; + + @PostMapping("/create") + @Operation(summary = "创建短信模板渠道绑定") + public CommonResult createTemplateBindingInfo(@Valid @RequestBody TemplateBindingInfoSaveReqVO createReqVO) { + return success(templateBindingInfoService.createTemplateBindingInfo(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新短信模板渠道绑定") + public CommonResult updateTemplateBindingInfo(@Valid @RequestBody TemplateBindingInfoSaveReqVO updateReqVO) { + templateBindingInfoService.updateTemplateBindingInfo(updateReqVO); + return success(true); + } + + @PutMapping("/handBind") + @Operation(summary = "手工短信模板渠道绑定") + public CommonResult bindTemplateBindingInfo(@Valid @RequestBody TemplateBindingInfoSaveReqVO updateReqVO) { + updateReqVO.setStatus(CreateTemplateStatus.REVIEW_SUCCESS.getCode()); + updateReqVO.setAuditRemark(StringUtils.EMPTY); + templateBindingInfoService.updateTemplateBindingInfo(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除短信模板渠道绑定") + @Parameter(name = "id", description = "编号", required = true) + public CommonResult deleteTemplateBindingInfo(@RequestParam("id") Long id) { + templateBindingInfoService.deleteTemplateBindingInfo(id); + return success(true); + } + + @DeleteMapping("/delete-list") + @Parameter(name = "ids", description = "编号", required = true) + @Operation(summary = "批量删除短信模板渠道绑定") + public CommonResult deleteTemplateBindingInfoList(@RequestParam("ids") List ids) { + templateBindingInfoService.deleteTemplateBindingInfoListByIds(ids); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得短信模板渠道绑定") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + public CommonResult getTemplateBindingInfo(@RequestParam("id") Long id) { + SmsTemplateBindingInfoDO templateBindingInfo = templateBindingInfoService.getTemplateBindingInfo(id); + return success(BeanUtils.toBean(templateBindingInfo, TemplateBindingInfoRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得短信模板渠道绑定分页") + public CommonResult> getTemplateBindingInfoPage(@Valid TemplateBindingInfoPageReqVO pageReqVO) { + PageResult pageResult = templateBindingInfoService.getTemplateBindingInfoPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, TemplateBindingInfoRespVO.class)); + } + +} \ No newline at end of file diff --git a/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/domain/dataobject/SmsChannelAccountDO.java b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/domain/dataobject/SmsChannelAccountDO.java new file mode 100644 index 0000000..712d8cd --- /dev/null +++ b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/domain/dataobject/SmsChannelAccountDO.java @@ -0,0 +1,72 @@ +package com.platform.marketing.module.smschannel.domain.dataobject; + +import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.*; +import com.baomidou.mybatisplus.annotation.*; +import com.platform.marketing.framework.mybatis.core.dataobject.BaseDO; + +import java.util.List; + +/** + * 短信渠道账号 DO + * + * @author admin + */ +@TableName("sms_channel_account") +@KeySequence("sms_channel_account_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class SmsChannelAccountDO extends BaseDO { + + /** + * 主键ID + */ + @TableId + private Long id; + /** + * 逻辑关联渠道ID + */ + private Long channelId; + /** + * 渠道标识 + */ + private String channelCode; + /** + * 账号名称 + */ + private String accountName; + /** + * API密钥 + */ + private String appKey; + /** + * API密钥 + */ + private String appSecret; + /** + * 关键字段MD5值(算法:MD5(channel_id|account_name|app_key|app_secret)) + */ + private String md5Value; + + /** + * 支持的短信类型[0:验证码,1:短信通知,2:推广短信,3:国际/港澳台消息] + */ + String supportSmsType; + + /** + * 扩展参数 + */ + private String extParams; + + /** + * 备注 + */ + private String remark; + + +} \ No newline at end of file diff --git a/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/domain/dataobject/SmsChannelInfoDO.java b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/domain/dataobject/SmsChannelInfoDO.java new file mode 100644 index 0000000..b8202a6 --- /dev/null +++ b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/domain/dataobject/SmsChannelInfoDO.java @@ -0,0 +1,76 @@ +package com.platform.marketing.module.smschannel.domain.dataobject; + +import com.platform.marketing.framework.mybatis.core.dataobject.BaseDO; +import com.baomidou.mybatisplus.annotation.KeySequence; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.*; +import org.apache.commons.lang3.StringUtils; + +/** + * 短信渠道配置表(含扩展属性字段) DO + * + * @author admin + */ +@TableName("sms_channel_info") +@KeySequence("sms_channel_info_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class SmsChannelInfoDO extends BaseDO { + + /** + * 渠道ID + */ + @TableId + private Integer id; + /** + * 渠道名称 + */ + private String channelName; + /** + * 渠道标识(如:aliyun/tencent等) + */ + private String channelCode; + /** + * 请求地址 + */ + private String domainUrl; + /** + * 渠道标签(逗号分隔) + */ + private String label = StringUtils.EMPTY; + /** + * 是否支持申请模板(1-支持 0-不支持) + */ + private Boolean supportApplyTemplate; + /** + * 是否支持申请签名(1-支持 0-不支持) + */ + private Boolean supportApplySign; + /** + * 是否支持批量发送(1-支持 0-不支持) + */ + private Boolean supportBatchSend; + /** + * 是否支持国际短信(1-支持 0-不支持) + */ + private Boolean supportInternational; + /** + * 是否支持查询模板信息(1-支持 0-不支持) + */ + private Boolean supportQueryTemplate; + /** + * 是否支持上行回复(1-支持 0-不支持) + */ + private Boolean supportReply; + /** + * 渠道扩展属性(JSON格式配置/动态参数) + */ + private String channelProperties; + + +} \ No newline at end of file diff --git a/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/domain/dataobject/SmsSignInfoDO.java b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/domain/dataobject/SmsSignInfoDO.java new file mode 100644 index 0000000..18dd5dc --- /dev/null +++ b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/domain/dataobject/SmsSignInfoDO.java @@ -0,0 +1,62 @@ +package com.platform.marketing.module.smschannel.domain.dataobject; + +import com.platform.marketing.framework.mybatis.core.dataobject.BaseDO; +import com.baomidou.mybatisplus.annotation.KeySequence; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.*; + +/** + * 短信签名信息 DO + * + * @author admin + */ +@TableName("sms_sign_info") +@KeySequence("sms_sign_info_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class SmsSignInfoDO extends BaseDO { + + /** + * 主键ID + */ + @TableId + private Long id; + + /** + * 租户编号 + */ + private Long tenantId; + + /** + * 签名名称 + */ + private String signName; + + /** + * 签名类型:0-企业,1-APP,2-商标,3-政府/事业单位/其他企业 + */ + private Integer signType; + + /** + * 绑定的账号ID集合(JSON数组格式,如 ["1001","1002"]) + */ + private String bindingAccountIds; + + /** + * 短信区域:0-国内短信 1-国际/港澳台短信 + */ + private Integer international; + + + /** + * 备注说明 + */ + private String remark; + + +} \ No newline at end of file diff --git a/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/domain/dataobject/SmsTemplateBindingInfoDO.java b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/domain/dataobject/SmsTemplateBindingInfoDO.java new file mode 100644 index 0000000..95e92bd --- /dev/null +++ b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/domain/dataobject/SmsTemplateBindingInfoDO.java @@ -0,0 +1,73 @@ +package com.platform.marketing.module.smschannel.domain.dataobject; + +import lombok.*; + +import java.util.*; +import java.time.LocalDateTime; +import java.time.LocalDateTime; + +import com.baomidou.mybatisplus.annotation.*; +import com.platform.marketing.framework.mybatis.core.dataobject.BaseDO; + +/** + * 短信模板渠道绑定 DO + * + * @author admin + */ +@TableName("sms_template_binding_info") +@KeySequence("sms_template_binding_info_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class SmsTemplateBindingInfoDO extends BaseDO { + + /** + * 绑定ID + */ + @TableId + private Long id; + + /** + * 模板ID + */ + private Long templateId; + + /** + * accountID + */ + private Long accountId; + + /** + * 三方模板编码 + */ + private String templateCode; + + /** + * 三方模板内容 + */ + private String templateContent; + + /** + * 渠道ID + */ + private Long channelId; + + /** + * 渠道 code + */ + private String channelCode; + + /** + * 审核状态:0-待提交 1-待审核 2-审核成功 3-审核失败 + */ + private Integer status; + + /** + * 审核备注 + */ + private String auditRemark; + +} \ No newline at end of file diff --git a/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/domain/dataobject/SmsTemplateInfoDO.java b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/domain/dataobject/SmsTemplateInfoDO.java new file mode 100644 index 0000000..f845f4b --- /dev/null +++ b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/domain/dataobject/SmsTemplateInfoDO.java @@ -0,0 +1,66 @@ +package com.platform.marketing.module.smschannel.domain.dataobject; + +import com.platform.marketing.framework.mybatis.core.dataobject.BaseDO; +import com.baomidou.mybatisplus.annotation.KeySequence; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.*; + +/** + * 短信模板信息 DO + * + * @author admin + */ +@TableName("sms_template_info") +@KeySequence("sms_template_info_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class SmsTemplateInfoDO extends BaseDO { + + /** + * 模板ID + */ + @TableId + private Long id; + /** + * 模板名称 + */ + private String templateName; + /** + * 模板内容 + */ + private String content; + + /** + * 签名ID + */ + private Long signId; + + /** + * 短信区域:0-国内短信 1-国际/港澳台短信 + */ + private Integer international; + + /** + * 签名名称 + */ + private String signName; + /** + * 模板类型 + */ + private Integer templateType; + /** + * 启用开关 + */ + private Integer switchOpen; + /** + * 备注 + */ + private String remark; + + +} \ No newline at end of file diff --git a/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/domain/enums/ChannelErrorCodeConstants.java b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/domain/enums/ChannelErrorCodeConstants.java new file mode 100644 index 0000000..5c857b6 --- /dev/null +++ b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/domain/enums/ChannelErrorCodeConstants.java @@ -0,0 +1,26 @@ +package com.platform.marketing.module.smschannel.domain.enums; + +import com.platform.marketing.framework.common.exception.ErrorCode; + +public interface ChannelErrorCodeConstants { + + // ========== 短信渠道配置表(含扩展属性字段) + ErrorCode SMS_CHANNEL_INFO_NOT_EXISTS = new ErrorCode(1_002_000_001, "短信渠道配置记录不存在"); + + ErrorCode SMS_CHANNEL_INFO_CAN_NOT_DELETE = new ErrorCode(1_002_001_001, "内置短信渠道不能删除"); + + ErrorCode CHANNEL_ACCOUNT_NOT_EXISTS = new ErrorCode(1_002_000_002, "短信渠道配置记录不存在"); + + ErrorCode CHANNEL_ACCOUNT_EXIST_SIGN = new ErrorCode(1_002_000_003, "该短信渠道账号已存在签名,请先删除签名"); + + ErrorCode SIGN_INFO_NOT_EXISTS = new ErrorCode(1_002_001_001, "短信签名信息不存在"); + + ErrorCode SIGN_EXSIT_TEMPLATE = new ErrorCode(1_002_001_002, "该短信签名下存在短信模版,请先删除短信模版!"); + + ErrorCode TEMPLATE_INFO_NOT_EXISTS = new ErrorCode(1_002_002_001, "短信模板信息不存在"); + + ErrorCode TEMPLATE_BINDING_INFO_NOT_EXISTS = new ErrorCode(1_002_002_002, "短信模版绑定信息不存在"); + + ErrorCode TEMPLATE_INFO_HAS_BINDING = new ErrorCode(1_002_002_003, "该短信模版已绑定渠道,无法删除!"); + +} diff --git a/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/domain/enums/ChannelRedisConstants.java b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/domain/enums/ChannelRedisConstants.java new file mode 100644 index 0000000..19c677e --- /dev/null +++ b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/domain/enums/ChannelRedisConstants.java @@ -0,0 +1,9 @@ +package com.platform.marketing.module.smschannel.domain.enums; + +public interface ChannelRedisConstants { + + String TEMPLATE_CACHE = "SmsTemplateCache"; + + String TEMPLATE_BINGDING_CACHE = "SmsTemplateBindingCache"; + +} diff --git a/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/domain/enums/CreateTemplateStatus.java b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/domain/enums/CreateTemplateStatus.java new file mode 100644 index 0000000..d186a7b --- /dev/null +++ b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/domain/enums/CreateTemplateStatus.java @@ -0,0 +1,44 @@ +package com.platform.marketing.module.smschannel.domain.enums; + +public enum CreateTemplateStatus { + + /** + * 审核状态:0-待提交 1-待审核 2-审核成功 3-审核失败 + */ + PENDING_SUBMISSION(0, "待提交"), + + PENDING_REVIEW(1, "待审核"), + + REVIEW_SUCCESS(2, "审核成功"), + + REVIEW_FAILED(3, "审核失败"); + + private final int code; + private final String description; + + CreateTemplateStatus(int code, String description) { + this.code = code; + this.description = description; + } + + public int getCode() { + return code; + } + + public String getDescription() { + return description; + } + + /** + * 根据code获取枚举值 + */ + public static CreateTemplateStatus getByCode(int code) { + for (CreateTemplateStatus status : values()) { + if (status.code == code) { + return status; + } + } + return null; + } + +} diff --git a/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/domain/vo/ChannelAccountPageReqVO.java b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/domain/vo/ChannelAccountPageReqVO.java new file mode 100644 index 0000000..b642bad --- /dev/null +++ b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/domain/vo/ChannelAccountPageReqVO.java @@ -0,0 +1,32 @@ +package com.platform.marketing.module.smschannel.domain.vo; + +import lombok.*; +import io.swagger.v3.oas.annotations.media.Schema; +import com.platform.marketing.framework.common.pojo.PageParam; + +@Schema(description = "管理后台 - 短信渠道账号分页 Request VO") +@Data +public class ChannelAccountPageReqVO extends PageParam { + + @Schema(description = "逻辑关联渠道ID", example = "26651") + private Integer channelId; + + @Schema(description = "渠道标识") + private String channelCode; + + @Schema(description = "账号名称", example = "李四") + private String accountName; + + @Schema(description = "API密钥") + private String appKey; + + @Schema(description = "API密钥") + private String appSecret; + + @Schema(description = "扩展参数") + private String extParams; + + @Schema(description = "备注", example = "你说的对") + private String remark; + +} \ No newline at end of file diff --git a/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/domain/vo/ChannelAccountRespVO.java b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/domain/vo/ChannelAccountRespVO.java new file mode 100644 index 0000000..2413e8a --- /dev/null +++ b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/domain/vo/ChannelAccountRespVO.java @@ -0,0 +1,52 @@ +package com.platform.marketing.module.smschannel.domain.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import com.alibaba.excel.annotation.*; +import org.apache.commons.lang3.StringUtils; + +import javax.validation.constraints.Size; +import java.util.List; + +@Schema(description = "管理后台 - 短信渠道账号 Response VO") +@Data +@ExcelIgnoreUnannotated +public class ChannelAccountRespVO { + + @Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "7876") + @ExcelProperty("主键ID") + private Integer id; + + @Schema(description = "逻辑关联渠道ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "26651") + @ExcelProperty("逻辑关联渠道ID") + private Integer channelId; + + @Schema(description = "渠道标识", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("渠道标识") + private String channelCode; + + @Schema(description = "账号名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四") + @ExcelProperty("账号名称") + private String accountName; + + @Schema(description = "appKey", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("API密钥") + private String appKey; + + @Schema(description = "appSecret", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("API密钥") + private String appSecret; + + @Schema(description = "短信类型", requiredMode = Schema.RequiredMode.REQUIRED) + private List supportSmsType; + + @Schema(description = "扩展参数") + @ExcelProperty("扩展参数") + private String extParams = "{}"; + + @Schema(description = "备注信息", example = "") + @ExcelProperty("备注") + @Size(max = 200, message = "备注长度不能超过200个字符") + private String remark; + +} \ No newline at end of file diff --git a/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/domain/vo/ChannelAccountSaveReqVO.java b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/domain/vo/ChannelAccountSaveReqVO.java new file mode 100644 index 0000000..7ae23ed --- /dev/null +++ b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/domain/vo/ChannelAccountSaveReqVO.java @@ -0,0 +1,49 @@ +package com.platform.marketing.module.smschannel.domain.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import org.apache.commons.lang3.StringUtils; + +import javax.validation.constraints.*; +import java.util.List; + +@Schema(description = "管理后台 - 短信渠道账号新增/修改 Request VO") +@Data +public class ChannelAccountSaveReqVO { + + @Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "7876") + private Long id; + + @Schema(description = "逻辑关联渠道ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "26651") + @NotNull(message = "逻辑关联渠道ID不能为空") + private Integer channelId; + + @Schema(description = "渠道标识", requiredMode = Schema.RequiredMode.REQUIRED) + private String channelCode; + + @Schema(description = "账号名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四") + @NotEmpty(message = "账号名称不能为空") + private String accountName; + + @Schema(description = "API密钥", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "API密钥不能为空") + private String appKey; + + @Schema(description = "API密钥", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "API密钥不能为空") + private String appSecret; + + @Schema(description = "关键字段MD5值(算法:MD5(channel_id|account_name|app_key|app_secret))", requiredMode = Schema.RequiredMode.REQUIRED) + private String md5Value; + + @Schema(description = "支持的短信类型[0:验证码,1:短信通知,2:推广短信,3:国际/港澳台消息]", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @NotNull(message = "支持的短信类型[0:验证码,1:短信通知,2:推广短信,3:国际/港澳台消息]不能为空") + List supportSmsType; + + @Schema(description = "扩展参数") + private String extParams = "{}"; + + @Schema(description = "备注", example = "你说的对") + private String remark; + +} \ No newline at end of file diff --git a/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/domain/vo/SmsChannelInfoPageReqVO.java b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/domain/vo/SmsChannelInfoPageReqVO.java new file mode 100644 index 0000000..131c7ef --- /dev/null +++ b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/domain/vo/SmsChannelInfoPageReqVO.java @@ -0,0 +1,52 @@ +package com.platform.marketing.module.smschannel.domain.vo; + +import lombok.*; +import io.swagger.v3.oas.annotations.media.Schema; +import com.platform.marketing.framework.common.pojo.PageParam; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; + +import static com.platform.marketing.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 短信渠道配置表(含扩展属性字段)分页 Request VO") +@Data +public class SmsChannelInfoPageReqVO extends PageParam { + + @Schema(description = "渠道名称", example = "赵六") + private String channelName; + + @Schema(description = "渠道标识(如:aliyun/tencent等)") + private String channelCode; + + @Schema(description = "请求地址", example = "https://www.iocoder.cn") + private String domainUrl; + + @Schema(description = "渠道标签(逗号分隔)") + private String label; + + @Schema(description = "是否支持申请模板(1-支持 0-不支持)") + private Boolean supportApplyTemplate; + + @Schema(description = "是否支持申请签名(1-支持 0-不支持)") + private Boolean supportApplySign; + + @Schema(description = "是否支持批量发送(1-支持 0-不支持)") + private Boolean supportBatchSend; + + @Schema(description = "是否支持国际短信(1-支持 0-不支持)") + private Boolean supportInternational; + + @Schema(description = "是否支持查询模板信息(1-支持 0-不支持)") + private Boolean supportQueryTemplate; + + @Schema(description = "是否支持上行回复(1-支持 0-不支持)") + private Boolean supportReply; + + @Schema(description = "渠道扩展属性(JSON格式配置/动态参数)") + private String channelProperties; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + +} \ No newline at end of file diff --git a/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/domain/vo/SmsChannelInfoRespVO.java b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/domain/vo/SmsChannelInfoRespVO.java new file mode 100644 index 0000000..84a3e90 --- /dev/null +++ b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/domain/vo/SmsChannelInfoRespVO.java @@ -0,0 +1,66 @@ +package com.platform.marketing.module.smschannel.domain.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; + +import java.time.LocalDateTime; +import com.alibaba.excel.annotation.*; + +@Schema(description = "管理后台 - 短信渠道配置表(含扩展属性字段) Response VO") +@Data +@ExcelIgnoreUnannotated +public class SmsChannelInfoRespVO { + + @Schema(description = "渠道ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "9522") + @ExcelProperty("渠道ID") + private Integer id; + + @Schema(description = "渠道名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六") + @ExcelProperty("渠道名称") + private String channelName; + + @Schema(description = "渠道标识(如:aliyun/tencent等)", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("渠道标识(如:aliyun/tencent等)") + private String channelCode; + + @Schema(description = "请求地址", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn") + @ExcelProperty("请求地址") + private String domainUrl; + + @Schema(description = "渠道标签(逗号分隔)") + @ExcelProperty("渠道标签(逗号分隔)") + private String label; + + @Schema(description = "是否支持申请模板(1-支持 0-不支持)", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("是否支持申请模板(1-支持 0-不支持)") + private Integer supportApplyTemplate; + + @Schema(description = "是否支持申请签名(1-支持 0-不支持)", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("是否支持申请签名(1-支持 0-不支持)") + private Integer supportApplySign; + + @Schema(description = "是否支持批量发送(1-支持 0-不支持)", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("是否支持批量发送(1-支持 0-不支持)") + private Integer supportBatchSend; + + @Schema(description = "是否支持国际短信(1-支持 0-不支持)", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("是否支持国际短信(1-支持 0-不支持)") + private Integer supportInternational; + + @Schema(description = "是否支持查询模板信息(1-支持 0-不支持)", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("是否支持查询模板信息(1-支持 0-不支持)") + private Integer supportQueryTemplate; + + @Schema(description = "是否支持上行回复(1-支持 0-不支持)", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("是否支持上行回复(1-支持 0-不支持)") + private Integer supportReply; + + @Schema(description = "渠道扩展属性(JSON格式配置/动态参数)") + @ExcelProperty("渠道扩展属性(JSON格式配置/动态参数)") + private String channelProperties; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("创建时间") + private LocalDateTime createTime; + +} \ No newline at end of file diff --git a/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/domain/vo/SmsChannelInfoSaveReqVO.java b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/domain/vo/SmsChannelInfoSaveReqVO.java new file mode 100644 index 0000000..98a52a0 --- /dev/null +++ b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/domain/vo/SmsChannelInfoSaveReqVO.java @@ -0,0 +1,57 @@ +package com.platform.marketing.module.smschannel.domain.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; + +import javax.validation.constraints.*; + +@Schema(description = "管理后台 - 短信渠道配置表(含扩展属性字段)新增/修改 Request VO") +@Data +public class SmsChannelInfoSaveReqVO { + + @Schema(description = "渠道ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "9522") + private Integer id; + + @Schema(description = "渠道名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六") + @NotEmpty(message = "渠道名称不能为空") + private String channelName; + + @Schema(description = "渠道标识(如:aliyun/tencent等)", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "渠道标识(如:aliyun/tencent等)不能为空") + private String channelCode; + + @Schema(description = "请求地址", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn") + @NotEmpty(message = "请求地址不能为空") + private String domainUrl; + + @Schema(description = "渠道标签(逗号分隔)") + private String label; + + @Schema(description = "是否支持申请模板(1-支持 0-不支持)", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "是否支持申请模板(1-支持 0-不支持)不能为空") + private Integer supportApplyTemplate; + + @Schema(description = "是否支持申请签名(1-支持 0-不支持)", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "是否支持申请签名(1-支持 0-不支持)不能为空") + private Integer supportApplySign; + + @Schema(description = "是否支持批量发送(1-支持 0-不支持)", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "是否支持批量发送(1-支持 0-不支持)不能为空") + private Integer supportBatchSend; + + @Schema(description = "是否支持国际短信(1-支持 0-不支持)", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "是否支持国际短信(1-支持 0-不支持)不能为空") + private Integer supportInternational; + + @Schema(description = "是否支持查询模板信息(1-支持 0-不支持)", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "是否支持查询模板信息(1-支持 0-不支持)不能为空") + private Integer supportQueryTemplate; + + @Schema(description = "是否支持上行回复(1-支持 0-不支持)", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "是否支持上行回复(1-支持 0-不支持)不能为空") + private Integer supportReply; + + @Schema(description = "渠道扩展属性(JSON格式配置/动态参数)") + private String channelProperties; + +} \ No newline at end of file diff --git a/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/domain/vo/SmsSignInfoPageReqVO.java b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/domain/vo/SmsSignInfoPageReqVO.java new file mode 100644 index 0000000..6e4dd49 --- /dev/null +++ b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/domain/vo/SmsSignInfoPageReqVO.java @@ -0,0 +1,35 @@ +package com.platform.marketing.module.smschannel.domain.vo; + +import com.platform.marketing.framework.common.pojo.PageParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.time.LocalDateTime; + +import static com.platform.marketing.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 短信签名信息分页 Request VO") +@Data +public class SmsSignInfoPageReqVO extends PageParam { + + @Schema(description = "签名名称", example = "王五") + private String signName; + + @Schema(description = "签名类型:0-企业,1-APP,2-商标,3-政府/事业单位/其他企业", example = "2") + private Integer signType; + + @Schema(description = "绑定的账号ID集合(JSON数组格式)") + private String bindingAccountIds; + + @Schema(description = "备注说明", example = "随便") + private String remark; + + @Schema(description = "短信区域:0-国内短信 1-国际/港澳台短信", example = "0") + private Integer international; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + +} \ No newline at end of file diff --git a/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/domain/vo/SmsSignInfoRespVO.java b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/domain/vo/SmsSignInfoRespVO.java new file mode 100644 index 0000000..7cf592f --- /dev/null +++ b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/domain/vo/SmsSignInfoRespVO.java @@ -0,0 +1,52 @@ +package com.platform.marketing.module.smschannel.domain.vo; + +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; +import java.util.List; + +@Schema(description = "管理后台 - 短信签名信息 Response VO") +@Data +@ExcelIgnoreUnannotated +public class SmsSignInfoRespVO { + + @Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "9236") + @ExcelProperty("主键ID") + private Long id; + + @Schema(description = "签名名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五") + @ExcelProperty("签名名称") + private String signName; + + @Schema(description = "签名类型:0-企业,1-APP,2-商标,3-政府/事业单位/其他企业", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") + @ExcelProperty("签名类型:0-企业,1-APP,2-商标,3-政府/事业单位/其他企业") + private Integer signType; + + @Schema(description = "租户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") + private Long tenantId; + + @Schema(description = "绑定账号ID列表", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") + private List bindingAccountIds; + + @Schema(description = "绑定账号名称列表", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") + private List bindingAccountNames; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("创建时间") + private LocalDateTime createTime; + + @Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五") + @ExcelProperty("备注") + private String remark; + + /** + * 短信区域:0-国内短信 1-国际/港澳台短信 + */ + @Schema(description = "短信区域", requiredMode = Schema.RequiredMode.REQUIRED, example = "0") + @ExcelProperty("短信区域") + private Integer international; + +} \ No newline at end of file diff --git a/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/domain/vo/SmsSignInfoSaveReqVO.java b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/domain/vo/SmsSignInfoSaveReqVO.java new file mode 100644 index 0000000..7daa532 --- /dev/null +++ b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/domain/vo/SmsSignInfoSaveReqVO.java @@ -0,0 +1,37 @@ +package com.platform.marketing.module.smschannel.domain.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import java.util.List; + +@Schema(description = "管理后台 - 短信签名信息新增/修改 Request VO") +@Data +public class SmsSignInfoSaveReqVO { + + @Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "9236") + private Long id; + + @Schema(description = "签名名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五") + @NotEmpty(message = "签名名称不能为空") + private String signName; + + @Schema(description = "签名类型:0-企业,1-APP,2-商标,3-政府/事业单位/其他企业", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") + @NotNull(message = "签名类型:0-企业,1-APP,2-商标,3-政府/事业单位/其他企业不能为空") + private Integer signType; + + @Schema(description = "绑定的账号ID集合(JSON数组格式") + private List bindingAccountIds; + + @Schema(description = "备注说明", example = "随便") + private String remark; + + /** + * 短信区域:0-国内短信 1-国际/港澳台短信 + */ + @NotNull(message = "短信区域不能为空") + private Integer international; + +} \ No newline at end of file diff --git a/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/domain/vo/TemplateBindingInfoPageReqVO.java b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/domain/vo/TemplateBindingInfoPageReqVO.java new file mode 100644 index 0000000..6fcd8ab --- /dev/null +++ b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/domain/vo/TemplateBindingInfoPageReqVO.java @@ -0,0 +1,38 @@ +package com.platform.marketing.module.smschannel.domain.vo; + +import com.platform.marketing.framework.common.pojo.PageParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.time.LocalDateTime; + +import static com.platform.marketing.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 短信模板渠道绑定分页 Request VO") +@Data +public class TemplateBindingInfoPageReqVO extends PageParam { + + @Schema(description = "模板ID", example = "29335") + private Long templateId; + + @Schema(description = "三方模板编码") + private String templateCode; + + @Schema(description = "三方模板内容") + private String templateContent; + + @Schema(description = "渠道ID", example = "20823") + private Long channelId; + + @Schema(description = "审核状态:0-待提交 1-待审核 2-审核成功 3-审核失败", example = "2") + private Integer status; + + @Schema(description = "审核备注", example = "你说的对") + private String auditRemark; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + +} \ No newline at end of file diff --git a/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/domain/vo/TemplateBindingInfoRespVO.java b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/domain/vo/TemplateBindingInfoRespVO.java new file mode 100644 index 0000000..98cc0d3 --- /dev/null +++ b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/domain/vo/TemplateBindingInfoRespVO.java @@ -0,0 +1,49 @@ +package com.platform.marketing.module.smschannel.domain.vo; + +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Schema(description = "管理后台 - 短信模板渠道绑定 Response VO") +@Data +@ExcelIgnoreUnannotated +public class TemplateBindingInfoRespVO { + + @Schema(description = "绑定ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "27193") + @ExcelProperty("绑定ID") + private Long id; + + @Schema(description = "模板ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "29335") + @ExcelProperty("模板ID") + private Long templateId; + + @Schema(description = "渠道编码", requiredMode = Schema.RequiredMode.REQUIRED) + private String channelCode; + + @Schema(description = "三方模板内容", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("三方模板内容") + private String templateContent; + + @Schema(description = "三方模版编码", requiredMode = Schema.RequiredMode.REQUIRED) + private String templateCode; + + @Schema(description = "渠道ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "20823") + @ExcelProperty("渠道ID") + private Long channelId; + + @Schema(description = "审核状态:0-待提交 1-待审核 2-审核成功 3-审核失败 4-主动撤销", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") + @ExcelProperty("审核状态:0-待提交 1-待审核 2-审核成功 3-审核失败") + private Integer status; + + @Schema(description = "审核备注", example = "你说的对") + @ExcelProperty("审核备注") + private String auditRemark; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("创建时间") + private LocalDateTime createTime; + +} \ No newline at end of file diff --git a/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/domain/vo/TemplateBindingInfoSaveReqVO.java b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/domain/vo/TemplateBindingInfoSaveReqVO.java new file mode 100644 index 0000000..294c2c6 --- /dev/null +++ b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/domain/vo/TemplateBindingInfoSaveReqVO.java @@ -0,0 +1,39 @@ +package com.platform.marketing.module.smschannel.domain.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; + +@Schema(description = "管理后台 - 短信模板渠道绑定新增/修改 Request VO") +@Data +public class TemplateBindingInfoSaveReqVO { + + @Schema(description = "绑定ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "27193") + private Long id; + + @Schema(description = "模板ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "29335") + @NotNull(message = "模板ID不能为空") + private Long templateId; + + @Schema(description = "三方模板编码", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "三方模板编码不能为空") + private String templateCode; + + @Schema(description = "三方模板内容", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "三方模板内容不能为空") + private String templateContent; + + @Schema(description = "渠道ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "20823") + @NotNull(message = "渠道ID不能为空") + private Long channelId; + + @Schema(description = "审核状态:0-待提交 1-待审核 2-审核成功 3-审核失败", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") + @NotNull(message = "审核状态:0-待提交 1-待审核 2-审核成功 3-审核失败不能为空") + private Integer status; + + @Schema(description = "审核备注", example = "你说的对") + private String auditRemark; + +} \ No newline at end of file diff --git a/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/domain/vo/TemplateInfoPageReqVO.java b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/domain/vo/TemplateInfoPageReqVO.java new file mode 100644 index 0000000..1ce9534 --- /dev/null +++ b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/domain/vo/TemplateInfoPageReqVO.java @@ -0,0 +1,44 @@ +package com.platform.marketing.module.smschannel.domain.vo; + +import com.platform.marketing.framework.common.pojo.PageParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.time.LocalDateTime; + +import static com.platform.marketing.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 短信模板信息分页 Request VO") +@Data +public class TemplateInfoPageReqVO extends PageParam { + + @Schema(description = "模板名称", example = "张三") + private String templateName; + + @Schema(description = "模板内容") + private String content; + + @Schema(description = "签名ID", example = "17628") + private Long signId; + + @Schema(description = "签名名称", example = "张三") + private String signName; + + @Schema(description = "模板类型", example = "2") + private Integer templateType; + + @Schema(description = "启用开关") + private Boolean switchOpen; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + + @Schema(description = "备注", example = "你猜") + private String remark; + + @Schema(description = "短信区域:0-国内短信 1-国际/港澳台短信") + private Integer international; + +} \ No newline at end of file diff --git a/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/domain/vo/TemplateInfoRespVO.java b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/domain/vo/TemplateInfoRespVO.java new file mode 100644 index 0000000..b538926 --- /dev/null +++ b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/domain/vo/TemplateInfoRespVO.java @@ -0,0 +1,57 @@ +package com.platform.marketing.module.smschannel.domain.vo; + +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Schema(description = "管理后台 - 短信模板信息 Response VO") +@Data +@ExcelIgnoreUnannotated +public class TemplateInfoRespVO { + + @Schema(description = "模板ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "27920") + @ExcelProperty("模板ID") + private Long id; + + @Schema(description = "模板名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三") + @ExcelProperty("模板名称") + private String templateName; + + @Schema(description = "模板内容", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("模板内容") + private String content; + + @Schema(description = "签名ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "17628") + @ExcelProperty("签名ID") + private Long signId; + + @Schema(description = "签名名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三") + @ExcelProperty("签名名称") + private String signName; + + @Schema(description = "模板类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") + @ExcelProperty("模板类型") + private Integer templateType; + + @Schema(description = "启用开关", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("启用开关") + private Integer switchOpen; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("创建时间") + private LocalDateTime createTime; + + @Schema(description = "备注", example = "你猜") + @ExcelProperty("备注") + private String remark; + + @Schema(description = "短信区域", requiredMode = Schema.RequiredMode.REQUIRED, example = "0") + /** + * 短信区域:0-国内短信 1-国际/港澳台短信 + */ + private Integer international; + +} \ No newline at end of file diff --git a/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/domain/vo/TemplateInfoSaveReqVO.java b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/domain/vo/TemplateInfoSaveReqVO.java new file mode 100644 index 0000000..a959b99 --- /dev/null +++ b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/domain/vo/TemplateInfoSaveReqVO.java @@ -0,0 +1,48 @@ +package com.platform.marketing.module.smschannel.domain.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; + +@Schema(description = "管理后台 - 短信模板信息新增/修改 Request VO") +@Data +public class TemplateInfoSaveReqVO { + + @Schema(description = "模板ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "27920") + private Long id; + + @Schema(description = "模板名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三") + @NotEmpty(message = "模板名称不能为空") + private String templateName; + + @Schema(description = "模板内容", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "模板内容不能为空") + private String content; + + @Schema(description = "签名ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "17628") + @NotNull(message = "签名ID不能为空") + private Long signId; + + @Schema(description = "签名名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三") + private String signName; + + @Schema(description = "模板类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") + @NotNull(message = "模板类型不能为空") + private Integer templateType; + + /** + * 短信区域:0-国内短信 1-国际/港澳台短信 + */ + @NotNull(message = "短信区域不能为空") + private Integer international; + + @Schema(description = "启用开关", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "启用开关不能为空") + private Integer switchOpen; + + @Schema(description = "备注", example = "你猜") + private String remark; + +} \ No newline at end of file diff --git a/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/job/SmsTemplateJob.java b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/job/SmsTemplateJob.java new file mode 100644 index 0000000..6320686 --- /dev/null +++ b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/job/SmsTemplateJob.java @@ -0,0 +1,95 @@ +package com.platform.marketing.module.smschannel.job; + +import com.platform.marketing.framework.quartz.core.handler.JobHandler; +import com.platform.marketing.module.smschannel.adapter.core.SmsOuterAdapter; +import com.platform.marketing.module.smschannel.adapter.core.command.req.AddSmsTemplateReqCommand; +import com.platform.marketing.module.smschannel.adapter.core.command.req.QuerySmsTemplateReqCommand; +import com.platform.marketing.module.smschannel.adapter.core.command.resp.SmsRespCommand; +import com.platform.marketing.module.smschannel.domain.dataobject.SmsTemplateBindingInfoDO; +import com.platform.marketing.module.smschannel.domain.dataobject.SmsTemplateInfoDO; +import com.platform.marketing.module.smschannel.domain.enums.CreateTemplateStatus; +import com.platform.marketing.module.smschannel.mapper.SmsTemplateBindingInfoMapper; +import com.platform.marketing.module.smschannel.mapper.SmsTemplateInfoMapper; +import com.platform.marketing.module.smschannel.service.SmsAdapterService; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.util.List; +import java.util.Map; + +@Component +@Slf4j +public class SmsTemplateJob implements JobHandler { + + @Resource + private SmsTemplateInfoMapper smsTemplateInfoMapper; + + @Resource + private SmsTemplateBindingInfoMapper templateBindingInfoMapper; + + @Resource + private SmsAdapterService smsAdapterService; + + @Override + public String execute(String param) { + log.info("开始申请模版任务 , 仅仅支持阿里云 腾讯云"); + try { + List smsTemplateInfoDOList = smsTemplateInfoMapper.selectList(); + for (SmsTemplateInfoDO templateInfoDO : smsTemplateInfoDOList) { + // 获取模版绑定信息 + List smsTemplateBindingInfoDOList = templateBindingInfoMapper.selectList(SmsTemplateBindingInfoDO::getTemplateId, templateInfoDO.getId()); + for (SmsTemplateBindingInfoDO bindingInfoDO : smsTemplateBindingInfoDOList) { + String channelCode = bindingInfoDO.getChannelCode(); + if ("aliyun".equals(channelCode) || "tencent".equals(channelCode)) { + if (bindingInfoDO.getStatus() == 0) { // 待提交: 将请求提交到 云平台 + // 提交审核 + SmsOuterAdapter smsOuterAdapter = smsAdapterService.getSmsOuterAdapterByAccountId(bindingInfoDO.getAccountId()); + + AddSmsTemplateReqCommand addSmsTemplateReqCommand = new AddSmsTemplateReqCommand(); + addSmsTemplateReqCommand.setSignName(templateInfoDO.getSignName()); + addSmsTemplateReqCommand.setTemplateType(templateInfoDO.getTemplateType()); + addSmsTemplateReqCommand.setRemark(templateInfoDO.getRemark()); + addSmsTemplateReqCommand.setTemplateContent(templateInfoDO.getContent()); + addSmsTemplateReqCommand.setTemplateName(templateInfoDO.getTemplateName()); + addSmsTemplateReqCommand.setInternational(templateInfoDO.getInternational()); + + SmsRespCommand> result = smsOuterAdapter.addSmsTemplate(addSmsTemplateReqCommand); + if (result.getCode() == 200) { + bindingInfoDO.setTemplateCode(result.getData().get("templateCode")); + bindingInfoDO.setStatus(CreateTemplateStatus.PENDING_REVIEW.getCode()); // 审核中 + } else { + bindingInfoDO.setAuditRemark(result.getMessage()); + bindingInfoDO.setStatus(CreateTemplateStatus.REVIEW_FAILED.getCode()); // 审核失败 + } + + templateBindingInfoMapper.updateById(bindingInfoDO); + } + + if (bindingInfoDO.getStatus() == 1) { // 审核中 , 查询云端是否 + SmsOuterAdapter smsOuterAdapter = smsAdapterService.getSmsOuterAdapterByAccountId(bindingInfoDO.getAccountId()); + QuerySmsTemplateReqCommand querySmsTemplateReqCommand = new QuerySmsTemplateReqCommand(); + querySmsTemplateReqCommand.setTemplateCode(bindingInfoDO.getTemplateCode()); + SmsRespCommand statusResult = smsOuterAdapter.querySmsTemplateStatus(querySmsTemplateReqCommand); + if (statusResult.getCode() == SmsRespCommand.SUCCESS_CODE) { + SmsTemplateBindingInfoDO updateObj = new SmsTemplateBindingInfoDO(); + updateObj.setId(bindingInfoDO.getId()); + if (StringUtils.isNotEmpty(statusResult.getMessage())) { + updateObj.setAuditRemark(statusResult.getMessage()); + } + updateObj.setStatus(statusResult.getData()); + templateBindingInfoMapper.updateById(updateObj); + } + } + } + } + } + } catch (Exception e) { + log.error("autoApplyTemplate error: ", e); + } + log.info("结束申请模版任务"); + return "success"; + } + +} diff --git a/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/mapper/SmsChannelAccountMapper.java b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/mapper/SmsChannelAccountMapper.java new file mode 100644 index 0000000..ae9d25c --- /dev/null +++ b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/mapper/SmsChannelAccountMapper.java @@ -0,0 +1,47 @@ +package com.platform.marketing.module.smschannel.mapper; + +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.mybatis.core.query.LambdaQueryWrapperX; +import com.platform.marketing.framework.mybatis.core.mapper.BaseMapperX; +import com.platform.marketing.module.smschannel.domain.dataobject.SmsChannelAccountDO; +import com.platform.marketing.module.smschannel.domain.vo.ChannelAccountPageReqVO; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Select; + +import java.util.List; + +/** + * 短信渠道账号 Mapper + * + * @author admin + */ +@Mapper +public interface SmsChannelAccountMapper extends BaseMapperX { + + default PageResult selectPage(ChannelAccountPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(SmsChannelAccountDO::getChannelId, reqVO.getChannelId()) + .eqIfPresent(SmsChannelAccountDO::getChannelCode, reqVO.getChannelCode()) + .likeIfPresent(SmsChannelAccountDO::getAccountName, reqVO.getAccountName()) + .eqIfPresent(SmsChannelAccountDO::getAppKey, reqVO.getAppKey()) + .eqIfPresent(SmsChannelAccountDO::getAppSecret, reqVO.getAppSecret()) + .eqIfPresent(SmsChannelAccountDO::getExtParams, reqVO.getExtParams()) + .eqIfPresent(SmsChannelAccountDO::getRemark, reqVO.getRemark()) + .orderByDesc(SmsChannelAccountDO::getId)); + } + + default List selectSmsChannelAccountDOListByIds(List ids) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.in(SmsChannelAccountDO::getId, ids); + return selectList(queryWrapper); + } + + /** + * 查询所有 account 列表,包括被标记为删除 (delete = 1) 的记录 + * @return 所有 account 列表 + */ + @Select("SELECT * FROM sms_channel_account") + List selectAllSmsChannelAccountList(); + +} \ No newline at end of file diff --git a/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/mapper/SmsChannelInfoMapper.java b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/mapper/SmsChannelInfoMapper.java new file mode 100644 index 0000000..f239218 --- /dev/null +++ b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/mapper/SmsChannelInfoMapper.java @@ -0,0 +1,35 @@ +package com.platform.marketing.module.smschannel.mapper; + +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.mybatis.core.mapper.BaseMapperX; +import com.platform.marketing.framework.mybatis.core.query.LambdaQueryWrapperX; +import com.platform.marketing.module.smschannel.domain.dataobject.SmsChannelInfoDO; +import com.platform.marketing.module.smschannel.domain.vo.SmsChannelInfoPageReqVO; +import org.apache.ibatis.annotations.Mapper; + +/** + * 短信渠道配置表(含扩展属性字段) Mapper + * + * @author admin + */ +@Mapper +public interface SmsChannelInfoMapper extends BaseMapperX { + + default PageResult selectPage(SmsChannelInfoPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .likeIfPresent(SmsChannelInfoDO::getChannelName, reqVO.getChannelName()) + .eqIfPresent(SmsChannelInfoDO::getChannelCode, reqVO.getChannelCode()) + .eqIfPresent(SmsChannelInfoDO::getDomainUrl, reqVO.getDomainUrl()) + .eqIfPresent(SmsChannelInfoDO::getLabel, reqVO.getLabel()) + .eqIfPresent(SmsChannelInfoDO::getSupportApplyTemplate, reqVO.getSupportApplyTemplate()) + .eqIfPresent(SmsChannelInfoDO::getSupportApplySign, reqVO.getSupportApplySign()) + .eqIfPresent(SmsChannelInfoDO::getSupportBatchSend, reqVO.getSupportBatchSend()) + .eqIfPresent(SmsChannelInfoDO::getSupportInternational, reqVO.getSupportInternational()) + .eqIfPresent(SmsChannelInfoDO::getSupportQueryTemplate, reqVO.getSupportQueryTemplate()) + .eqIfPresent(SmsChannelInfoDO::getSupportReply, reqVO.getSupportReply()) + .eqIfPresent(SmsChannelInfoDO::getChannelProperties, reqVO.getChannelProperties()) + .betweenIfPresent(SmsChannelInfoDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(SmsChannelInfoDO::getId)); + } + +} \ No newline at end of file diff --git a/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/mapper/SmsSignInfoMapper.java b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/mapper/SmsSignInfoMapper.java new file mode 100644 index 0000000..e7f994f --- /dev/null +++ b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/mapper/SmsSignInfoMapper.java @@ -0,0 +1,43 @@ +package com.platform.marketing.module.smschannel.mapper; + +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.mybatis.core.mapper.BaseMapperX; +import com.platform.marketing.framework.mybatis.core.query.LambdaQueryWrapperX; +import com.platform.marketing.module.smschannel.domain.dataobject.SmsSignInfoDO; +import com.platform.marketing.module.smschannel.domain.vo.SmsSignInfoPageReqVO; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * 短信签名信息 Mapper + * + * @author admin + */ +@Mapper +public interface SmsSignInfoMapper extends BaseMapperX { + + default PageResult selectPage(SmsSignInfoPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .likeIfPresent(SmsSignInfoDO::getSignName, reqVO.getSignName()) + .eqIfPresent(SmsSignInfoDO::getSignType, reqVO.getSignType()) + .eqIfPresent(SmsSignInfoDO::getBindingAccountIds, reqVO.getBindingAccountIds()) + .eqIfPresent(SmsSignInfoDO::getInternational, reqVO.getInternational()) + .eqIfPresent(SmsSignInfoDO::getRemark, reqVO.getRemark()) + .betweenIfPresent(SmsSignInfoDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(SmsSignInfoDO::getId)); + } + + /** + * 根据国际短信标识查询签名列表 + * + * @param international 国际短信标识:0-国内短信 1-国际/港澳台短信 + * @return 签名列表 + */ + default List selectListByInternational(Integer international) { + return selectList(new LambdaQueryWrapperX() + .eqIfPresent(SmsSignInfoDO::getInternational, international) + .orderByDesc(SmsSignInfoDO::getId)); + } + +} \ No newline at end of file diff --git a/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/mapper/SmsTemplateBindingInfoMapper.java b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/mapper/SmsTemplateBindingInfoMapper.java new file mode 100644 index 0000000..defef90 --- /dev/null +++ b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/mapper/SmsTemplateBindingInfoMapper.java @@ -0,0 +1,52 @@ +package com.platform.marketing.module.smschannel.mapper; + + +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.mybatis.core.mapper.BaseMapperX; +import com.platform.marketing.framework.mybatis.core.query.LambdaQueryWrapperX; +import com.platform.marketing.module.smschannel.domain.dataobject.SmsTemplateBindingInfoDO; +import com.platform.marketing.module.smschannel.domain.vo.TemplateBindingInfoPageReqVO; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * 短信模板渠道绑定 Mapper + */ +@Mapper +public interface SmsTemplateBindingInfoMapper extends BaseMapperX { + + default PageResult selectPage(TemplateBindingInfoPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(SmsTemplateBindingInfoDO::getTemplateId, reqVO.getTemplateId()) + .eqIfPresent(SmsTemplateBindingInfoDO::getTemplateCode, reqVO.getTemplateCode()) + .eqIfPresent(SmsTemplateBindingInfoDO::getTemplateContent, reqVO.getTemplateContent()) + .eqIfPresent(SmsTemplateBindingInfoDO::getChannelId, reqVO.getChannelId()) + .eqIfPresent(SmsTemplateBindingInfoDO::getStatus, reqVO.getStatus()) + .eqIfPresent(SmsTemplateBindingInfoDO::getAuditRemark, reqVO.getAuditRemark()) + .betweenIfPresent(SmsTemplateBindingInfoDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(SmsTemplateBindingInfoDO::getId)); + } + + default SmsTemplateBindingInfoDO getSmsTemplateBindingInfoByTemplateIdAndChannelId(Long templateId, Long channelId) { + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + lambdaQueryWrapper.eq(SmsTemplateBindingInfoDO::getTemplateId, templateId); + lambdaQueryWrapper.eq(SmsTemplateBindingInfoDO::getChannelId, channelId); + return selectOne(lambdaQueryWrapper); + } + + default SmsTemplateBindingInfoDO getSmsTemplateBindingInfoByTemplateIdAndAccountId(Long templateId, Long accountId) { + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + lambdaQueryWrapper.eq(SmsTemplateBindingInfoDO::getTemplateId, templateId); + lambdaQueryWrapper.eq(SmsTemplateBindingInfoDO::getAccountId, accountId); + return selectOne(lambdaQueryWrapper); + } + + default List getSmsTemplateBindingInfoListByTemplateId(Long templateId) { + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + lambdaQueryWrapper.eq(SmsTemplateBindingInfoDO::getTemplateId, templateId); + return selectList(lambdaQueryWrapper); + } + +} \ No newline at end of file diff --git a/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/mapper/SmsTemplateInfoMapper.java b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/mapper/SmsTemplateInfoMapper.java new file mode 100644 index 0000000..bfb472a --- /dev/null +++ b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/mapper/SmsTemplateInfoMapper.java @@ -0,0 +1,58 @@ +package com.platform.marketing.module.smschannel.mapper; + +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.mybatis.core.mapper.BaseMapperX; +import com.platform.marketing.framework.mybatis.core.query.LambdaQueryWrapperX; +import com.platform.marketing.module.smschannel.domain.dataobject.SmsTemplateInfoDO; +import com.platform.marketing.module.smschannel.domain.vo.TemplateInfoPageReqVO; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; +import java.util.stream.Collectors; + +/** + * 短信模板信息 Mapper + * + * @author admin + */ +@Mapper +public interface SmsTemplateInfoMapper extends BaseMapperX { + + default PageResult selectPage(TemplateInfoPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .likeIfPresent(SmsTemplateInfoDO::getTemplateName, reqVO.getTemplateName()) + .eqIfPresent(SmsTemplateInfoDO::getContent, reqVO.getContent()) + .eqIfPresent(SmsTemplateInfoDO::getInternational, reqVO.getInternational()) + .eqIfPresent(SmsTemplateInfoDO::getSignId, reqVO.getSignId()) + .likeIfPresent(SmsTemplateInfoDO::getSignName, reqVO.getSignName()) + .eqIfPresent(SmsTemplateInfoDO::getTemplateType, reqVO.getTemplateType()) + .eqIfPresent(SmsTemplateInfoDO::getSwitchOpen, reqVO.getSwitchOpen()) + .betweenIfPresent(SmsTemplateInfoDO::getCreateTime, reqVO.getCreateTime()) + .eqIfPresent(SmsTemplateInfoDO::getRemark, reqVO.getRemark()) + .orderByDesc(SmsTemplateInfoDO::getId)); + } + + default Long countBySignId(Long signId) { + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + lambdaQueryWrapper.eq(SmsTemplateInfoDO::getSignId, signId); + return selectCount(lambdaQueryWrapper); + } + + // 通过 signId 获取所有的 Id 列表 + default List selectIdListBySignId(Long signId) { + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + lambdaQueryWrapper.select(SmsTemplateInfoDO::getId) + .eq(SmsTemplateInfoDO::getSignId, signId); + List list = selectList(lambdaQueryWrapper); + return list.stream().map(SmsTemplateInfoDO::getId).collect(Collectors.toList()); + } + + default List selectListBySignId(Long signId) { + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + lambdaQueryWrapper.eq(SmsTemplateInfoDO::getSignId, signId); + List list = selectList(lambdaQueryWrapper); + return list; + } + +} \ No newline at end of file diff --git a/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/service/SmsAdapterService.java b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/service/SmsAdapterService.java new file mode 100644 index 0000000..689db39 --- /dev/null +++ b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/service/SmsAdapterService.java @@ -0,0 +1,9 @@ +package com.platform.marketing.module.smschannel.service; + +import com.platform.marketing.module.smschannel.adapter.core.SmsOuterAdapter; + +public interface SmsAdapterService { + + SmsOuterAdapter getSmsOuterAdapterByAccountId(Long accountId); + +} diff --git a/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/service/SmsChannelAccountService.java b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/service/SmsChannelAccountService.java new file mode 100644 index 0000000..82bf888 --- /dev/null +++ b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/service/SmsChannelAccountService.java @@ -0,0 +1,68 @@ +package com.platform.marketing.module.smschannel.service; + +import java.util.*; +import javax.validation.*; + +import com.platform.marketing.module.smschannel.domain.dataobject.SmsChannelAccountDO; +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.module.smschannel.domain.vo.ChannelAccountPageReqVO; +import com.platform.marketing.module.smschannel.domain.vo.ChannelAccountSaveReqVO; + +/** + * 短信渠道账号 Service 接口 + * + * @author admin + */ +public interface SmsChannelAccountService { + + /** + * 创建短信渠道账号 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createChannelAccount(@Valid ChannelAccountSaveReqVO createReqVO); + + /** + * 更新短信渠道账号 + * + * @param updateReqVO 更新信息 + */ + void updateChannelAccount(@Valid ChannelAccountSaveReqVO updateReqVO); + + /** + * 删除短信渠道账号 + * + * @param id 编号 + */ + void deleteChannelAccount(Long id); + + /** + * 批量删除短信渠道账号 + * + * @param ids 编号 + */ + void deleteChannelAccountListByIds(List ids); + + /** + * 获得短信渠道账号 + * + * @param id 编号 + * @return 短信渠道账号 + */ + SmsChannelAccountDO getChannelAccount(Long id); + + /** + * 获取全部的渠道账户 + */ + List getChannelAccountList(); + + /** + * 获得短信渠道账号分页 + * + * @param pageReqVO 分页查询 + * @return 短信渠道账号分页 + */ + PageResult getChannelAccountPage(ChannelAccountPageReqVO pageReqVO); + +} \ No newline at end of file diff --git a/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/service/SmsChannelInfoService.java b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/service/SmsChannelInfoService.java new file mode 100644 index 0000000..7646802 --- /dev/null +++ b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/service/SmsChannelInfoService.java @@ -0,0 +1,65 @@ +package com.platform.marketing.module.smschannel.service; + +import java.util.*; +import javax.validation.*; + +import com.platform.marketing.module.smschannel.domain.dataobject.SmsChannelInfoDO; +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.module.smschannel.domain.vo.SmsChannelInfoPageReqVO; +import com.platform.marketing.module.smschannel.domain.vo.SmsChannelInfoSaveReqVO; + +/** + * 短信渠道配置表(含扩展属性字段) Service 接口 + * + * @author admin + */ +public interface SmsChannelInfoService { + + /** + * 创建短信渠道配置表(含扩展属性字段) + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Integer createSmsChannelInfo(@Valid SmsChannelInfoSaveReqVO createReqVO); + + /** + * 更新短信渠道配置表(含扩展属性字段) + * + * @param updateReqVO 更新信息 + */ + void updateSmsChannelInfo(@Valid SmsChannelInfoSaveReqVO updateReqVO); + + /** + * 删除短信渠道配置表(含扩展属性字段) + * + * @param id 编号 + */ + void deleteSmsChannelInfo(Integer id); + + /** + * 批量删除短信渠道配置表(含扩展属性字段) + * + * @param ids 编号 + */ + void deleteSmsChannelInfoListByIds(List ids); + + /** + * 获得短信渠道配置表(含扩展属性字段) + * + * @param id 编号 + * @return 短信渠道配置表(含扩展属性字段) + */ + SmsChannelInfoDO getSmsChannelInfo(Integer id); + + /** + * 获得短信渠道配置表(含扩展属性字段)分页 + * + * @param pageReqVO 分页查询 + * @return 短信渠道配置表(含扩展属性字段)分页 + */ + PageResult getSmsChannelInfoPage(SmsChannelInfoPageReqVO pageReqVO); + + List getSmsChannelInfoList(); + +} \ No newline at end of file diff --git a/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/service/SmsSignInfoService.java b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/service/SmsSignInfoService.java new file mode 100644 index 0000000..23de337 --- /dev/null +++ b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/service/SmsSignInfoService.java @@ -0,0 +1,76 @@ +package com.platform.marketing.module.smschannel.service; + +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.module.smschannel.domain.dataobject.SmsSignInfoDO; +import com.platform.marketing.module.smschannel.domain.vo.SmsSignInfoPageReqVO; +import com.platform.marketing.module.smschannel.domain.vo.SmsSignInfoRespVO; +import com.platform.marketing.module.smschannel.domain.vo.SmsSignInfoSaveReqVO; + +import java.util.*; +import javax.validation.*; + +/** + * 短信签名信息 Service 接口 + * + * @author admin + */ +public interface SmsSignInfoService { + + /** + * 创建短信签名信息 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createSignInfo(@Valid SmsSignInfoSaveReqVO createReqVO); + + /** + * 更新短信签名信息 + * + * @param updateReqVO 更新信息 + */ + void updateSignInfo(@Valid SmsSignInfoSaveReqVO updateReqVO); + + /** + * 删除短信签名信息 + * + * @param id 编号 + */ + void deleteSignInfo(Long id); + + /** + * 批量删除短信签名信息 + * + * @param ids 编号 + */ + void deleteSignInfoListByIds(List ids); + + /** + * 获得短信签名信息 + * + * @param id 编号 + * @return 短信签名信息 + */ + SmsSignInfoDO getSignInfo(Long id); + + /** + * 获得短信签名信息分页 + * + * @param pageReqVO 分页查询 + * @return 短信签名信息分页 + */ + PageResult getSignInfoPage(SmsSignInfoPageReqVO pageReqVO); + + PageResult getSignInfoRespPage(SmsSignInfoPageReqVO pageReqVO); + + List getSignInfoDOList(); + + /** + * 根据国际短信标识查询签名列表 + * + * @param international 国际短信标识:0-国内短信 1-国际/港澳台短信 + * @return 签名列表 + */ + List getSignInfoDOListByInternational(Integer international); + +} \ No newline at end of file diff --git a/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/service/SmsTemplateInfoService.java b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/service/SmsTemplateInfoService.java new file mode 100644 index 0000000..61e8e47 --- /dev/null +++ b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/service/SmsTemplateInfoService.java @@ -0,0 +1,65 @@ +package com.platform.marketing.module.smschannel.service; + +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.module.smschannel.domain.dataobject.SmsTemplateInfoDO; +import com.platform.marketing.module.smschannel.domain.vo.TemplateInfoPageReqVO; +import com.platform.marketing.module.smschannel.domain.vo.TemplateInfoSaveReqVO; + +import java.util.*; +import javax.validation.*; + +/** + * 短信模板信息 Service 接口 + * + * @author admin + */ +public interface SmsTemplateInfoService { + + /** + * 创建短信模板信息 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createTemplateInfo(@Valid TemplateInfoSaveReqVO createReqVO); + + /** + * 更新短信模板信息 + * + * @param updateReqVO 更新信息 + */ + void updateTemplateInfo(@Valid TemplateInfoSaveReqVO updateReqVO); + + void flushTemplateBindingInfo(Long signId); + + /** + * 删除短信模板信息 + * + * @param id 编号 + */ + void deleteTemplateInfo(Long id); + + /** + * 批量删除短信模板信息 + * + * @param ids 编号 + */ + void deleteTemplateInfoListByIds(List ids); + + /** + * 获得短信模板信息 + * + * @param id 编号 + * @return 短信模板信息 + */ + SmsTemplateInfoDO getTemplateInfo(Long id); + + /** + * 获得短信模板信息分页 + * + * @param pageReqVO 分页查询 + * @return 短信模板信息分页 + */ + PageResult getTemplateInfoPage(TemplateInfoPageReqVO pageReqVO); + +} \ No newline at end of file diff --git a/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/service/TemplateBindingInfoService.java b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/service/TemplateBindingInfoService.java new file mode 100644 index 0000000..8d3ea94 --- /dev/null +++ b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/service/TemplateBindingInfoService.java @@ -0,0 +1,71 @@ +package com.platform.marketing.module.smschannel.service; + +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.module.smschannel.domain.dataobject.SmsTemplateBindingInfoDO; +import com.platform.marketing.module.smschannel.domain.vo.TemplateBindingInfoPageReqVO; +import com.platform.marketing.module.smschannel.domain.vo.TemplateBindingInfoSaveReqVO; + +import java.util.*; +import javax.validation.*; + +/** + * 短信模板渠道绑定 Service 接口 + * + * @author courage + */ +public interface TemplateBindingInfoService { + + /** + * 创建短信模板渠道绑定 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createTemplateBindingInfo(@Valid TemplateBindingInfoSaveReqVO createReqVO); + + /** + * 获得短信模板渠道绑定列表 + * + * @param templateId 模板编号 + * @return 短信模板渠道绑定列表 + */ + List getTemplateBindingInfoList(Long templateId); + + /** + * 更新短信模板渠道绑定 + * + * @param updateReqVO 更新信息 + */ + void updateTemplateBindingInfo(@Valid TemplateBindingInfoSaveReqVO updateReqVO); + + /** + * 删除短信模板渠道绑定 + * + * @param id 编号 + */ + void deleteTemplateBindingInfo(Long id); + + /** + * 批量删除短信模板渠道绑定 + * + * @param ids 编号 + */ + void deleteTemplateBindingInfoListByIds(List ids); + + /** + * 获得短信模板渠道绑定 + * + * @param id 编号 + * @return 短信模板渠道绑定 + */ + SmsTemplateBindingInfoDO getTemplateBindingInfo(Long id); + + /** + * 获得短信模板渠道绑定分页 + * + * @param pageReqVO 分页查询 + * @return 短信模板渠道绑定分页 + */ + PageResult getTemplateBindingInfoPage(TemplateBindingInfoPageReqVO pageReqVO); + +} \ No newline at end of file diff --git a/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/service/impl/SignInfoServiceImpl.java b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/service/impl/SignInfoServiceImpl.java new file mode 100644 index 0000000..c0ba566 --- /dev/null +++ b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/service/impl/SignInfoServiceImpl.java @@ -0,0 +1,140 @@ +package com.platform.marketing.module.smschannel.service.impl; + +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.common.util.collection.CollectionUtils; +import com.platform.marketing.framework.common.util.json.JsonUtils; +import com.platform.marketing.framework.common.util.object.BeanUtils; +import com.platform.marketing.module.smschannel.domain.dataobject.SmsChannelAccountDO; +import com.platform.marketing.module.smschannel.domain.dataobject.SmsSignInfoDO; +import com.platform.marketing.module.smschannel.domain.vo.SmsSignInfoPageReqVO; +import com.platform.marketing.module.smschannel.domain.vo.SmsSignInfoRespVO; +import com.platform.marketing.module.smschannel.domain.vo.SmsSignInfoSaveReqVO; +import com.platform.marketing.module.smschannel.mapper.SmsChannelAccountMapper; +import com.platform.marketing.module.smschannel.mapper.SmsSignInfoMapper; +import com.platform.marketing.module.smschannel.mapper.SmsTemplateInfoMapper; +import com.platform.marketing.module.smschannel.service.SmsSignInfoService; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; + +import org.springframework.validation.annotation.Validated; + +import java.util.*; +import java.util.stream.Collectors; + +import static com.platform.marketing.framework.common.exception.util.ServiceExceptionUtil.exception; +import static com.platform.marketing.module.smschannel.domain.enums.ChannelErrorCodeConstants.SIGN_EXSIT_TEMPLATE; +import static com.platform.marketing.module.smschannel.domain.enums.ChannelErrorCodeConstants.SIGN_INFO_NOT_EXISTS; + +/** + * 短信签名信息 Service 实现类 + * + * @author admin + */ +@Service +@Validated +public class SignInfoServiceImpl implements SmsSignInfoService { + + @Resource + private SmsSignInfoMapper signInfoMapper; + + @Resource + private SmsChannelAccountMapper channelAccountMapper; + + @Resource + private SmsTemplateInfoMapper smsTemplateInfoMapper; + + @Override + public Long createSignInfo(SmsSignInfoSaveReqVO createReqVO) { + // 插入 + SmsSignInfoDO signInfo = BeanUtils.toBean(createReqVO, SmsSignInfoDO.class); + signInfo.setBindingAccountIds(JsonUtils.toJsonString(createReqVO.getBindingAccountIds())); + + signInfoMapper.insert(signInfo); + + // 返回 + return signInfo.getId(); + } + + @Override + public void updateSignInfo(SmsSignInfoSaveReqVO updateReqVO) { + // 校验存在 + validateSignInfoExists(updateReqVO.getId()); + // 更新 + SmsSignInfoDO updateObj = BeanUtils.toBean(updateReqVO, SmsSignInfoDO.class); + signInfoMapper.updateById(updateObj); + } + + @Override + public void deleteSignInfo(Long id) { + // 校验存在 + validateSignInfoExists(id); + + // 判断签名下的模版是否存在 + Long count = smsTemplateInfoMapper.countBySignId(id); + if (count > 0) { + throw exception(SIGN_EXSIT_TEMPLATE); + } + + // 删除 + signInfoMapper.deleteById(id); + } + + @Override + public void deleteSignInfoListByIds(List ids) { + + + // 删除 + signInfoMapper.deleteByIds(ids); + } + + private void validateSignInfoExists(Long id) { + if (signInfoMapper.selectById(id) == null) { + throw exception(SIGN_INFO_NOT_EXISTS); + } + } + + @Override + public SmsSignInfoDO getSignInfo(Long id) { + return signInfoMapper.selectById(id); + } + + @Override + public PageResult getSignInfoPage(SmsSignInfoPageReqVO pageReqVO) { + return signInfoMapper.selectPage(pageReqVO); + } + + @Override + public PageResult getSignInfoRespPage(SmsSignInfoPageReqVO pageReqVO) { + PageResult infoDOPageResult = getSignInfoPage(pageReqVO); + + PageResult repseVOPageResult = new PageResult<>(infoDOPageResult.getTotal()); + for (SmsSignInfoDO smsSignInfoDO : infoDOPageResult.getList()) { + SmsSignInfoRespVO smsSignInfoRespVO = BeanUtils.toBean(smsSignInfoDO, SmsSignInfoRespVO.class); + List accountIds = JsonUtils.parseArray(smsSignInfoDO.getBindingAccountIds(), Integer.class); + + if (accountIds.size() > 0) { + List channelAccountDOList = channelAccountMapper.selectSmsChannelAccountDOListByIds(accountIds); + List accountNames = channelAccountDOList.stream() + .map(SmsChannelAccountDO::getAccountName) + .collect(Collectors.toList()); + smsSignInfoRespVO.setBindingAccountNames(accountNames); + } + + repseVOPageResult.getList().add(smsSignInfoRespVO); + } + + return repseVOPageResult; + + } + + public List getSignInfoDOList() { + return signInfoMapper.selectList(); + } + + @Override + public List getSignInfoDOListByInternational(Integer international) { + return signInfoMapper.selectListByInternational(international); + } + +} \ No newline at end of file diff --git a/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/service/impl/SmsAdapterServiceImpl.java b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/service/impl/SmsAdapterServiceImpl.java new file mode 100644 index 0000000..0a3e98c --- /dev/null +++ b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/service/impl/SmsAdapterServiceImpl.java @@ -0,0 +1,114 @@ +package com.platform.marketing.module.smschannel.service.impl; + +import com.platform.marketing.module.smschannel.adapter.core.SmsAdapterFactory; +import com.platform.marketing.module.smschannel.adapter.core.SmsOuterAdapter; +import com.platform.marketing.module.smschannel.adapter.core.support.SmsChannelConfig; +import com.platform.marketing.module.smschannel.domain.dataobject.SmsChannelAccountDO; +import com.platform.marketing.module.smschannel.domain.dataobject.SmsChannelInfoDO; +import com.platform.marketing.module.smschannel.mapper.SmsChannelAccountMapper; +import com.platform.marketing.module.smschannel.mapper.SmsChannelInfoMapper; +import com.platform.marketing.module.smschannel.service.SmsAdapterService; +import com.platform.marketing.module.smschannel.service.SmsChannelInfoService; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.PostMapping; + +import javax.annotation.PostConstruct; +import javax.annotation.Resource; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.locks.ReadWriteLock; +import java.util.concurrent.locks.ReentrantReadWriteLock; + +@Service +@Validated +@Slf4j +public class SmsAdapterServiceImpl implements SmsAdapterService { + + private static ReadWriteLock readWriteLock = new ReentrantReadWriteLock(); + + @Resource + private SmsChannelAccountMapper smsChannelAccountMapper; + + @Resource + private SmsChannelInfoMapper smsChannelInfoMapper; + + /** + * 一个账号对应一个适配器 + **/ + private Map accountAdapterMapping = new HashMap(); + + /** + * 所有的账号缓存 + **/ + private Map accountDOMap = new ConcurrentHashMap(); + + /** + * 所有的渠道缓存 + **/ + private Map channelInfoDOMap = new ConcurrentHashMap(); + + @PostConstruct + @Scheduled(cron = "0/30 * * * * ?") // 每20秒执行一次 + public void loadTemplateAdaptersMappingJobs() { + long start = System.currentTimeMillis(); + try { + log.info("开始加载缓存渠道信息"); + List channelInfoDOList = smsChannelInfoMapper.selectList(); + for (SmsChannelInfoDO channelInfoDO : channelInfoDOList) { + channelInfoDOMap.put(channelInfoDO.getChannelCode(), channelInfoDO); + } + log.info("结束加载缓存渠道信息"); + + log.info("开始加载缓适配器信息"); + List smsChannelAccountDOList = smsChannelAccountMapper.selectAllSmsChannelAccountList(); + readWriteLock.writeLock().lock(); + + for (SmsChannelAccountDO smsChannelAccountDO : smsChannelAccountDOList) { + boolean reload = false; + if (!accountDOMap.containsKey(smsChannelAccountDO.getId()) || + !StringUtils.equals(accountDOMap.get(smsChannelAccountDO.getId()).getMd5Value(), smsChannelAccountDO.getMd5Value())) { + accountDOMap.put(smsChannelAccountDO.getId(), smsChannelAccountDO); + reload = true; + } + if (reload) { + SmsChannelConfig smsChannelConfig = new SmsChannelConfig(); + smsChannelConfig.setChannelAppkey(smsChannelAccountDO.getAppKey()); + smsChannelConfig.setChannelAppsecret(smsChannelAccountDO.getAppSecret()); + + SmsChannelInfoDO smsChannelInfoDO = channelInfoDOMap.get(smsChannelAccountDO.getChannelCode()); + smsChannelConfig.setChannelDomain(smsChannelInfoDO.getDomainUrl()); + + smsChannelConfig.setChannelType(smsChannelAccountDO.getChannelCode()); + smsChannelConfig.setExtProperties(smsChannelAccountDO.getExtParams()); + smsChannelConfig.setId(smsChannelAccountDO.getId()); + + SmsOuterAdapter smsOuterAdapter = SmsAdapterFactory.createOuterAdapter(smsChannelAccountDO.getChannelCode(), smsChannelConfig); + if (smsOuterAdapter != null) { + // 先销毁原来的 适配器 ,再放入到容器 + SmsOuterAdapter oldSmsOuterAdapter = accountAdapterMapping.get(smsChannelAccountDO.getId()); + if (oldSmsOuterAdapter != null) { + oldSmsOuterAdapter.destroy(); + } + accountAdapterMapping.put(smsChannelAccountDO.getId(), smsOuterAdapter); + } + } + } + } catch (Exception e) { + log.error("loadTemplateAdaptersMappingJobs error : ", e); + } finally { + readWriteLock.writeLock().unlock(); + } + log.info("结束加载适配器 , 耗时:" + (System.currentTimeMillis() - start) + "毫秒"); + } + + public SmsOuterAdapter getSmsOuterAdapterByAccountId(Long accountId) { + return accountAdapterMapping.get(accountId); + } + +} diff --git a/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/service/impl/SmsChannelAccountServiceImpl.java b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/service/impl/SmsChannelAccountServiceImpl.java new file mode 100644 index 0000000..b598778 --- /dev/null +++ b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/service/impl/SmsChannelAccountServiceImpl.java @@ -0,0 +1,158 @@ +package com.platform.marketing.module.smschannel.service.impl; + +import cn.hutool.core.lang.hash.Hash; +import com.platform.marketing.framework.common.util.json.JsonUtils; +import com.platform.marketing.module.infra.domain.enums.ErrorCodeConstants; +import com.platform.marketing.module.smschannel.domain.dataobject.SmsChannelInfoDO; +import com.platform.marketing.module.smschannel.domain.dataobject.SmsSignInfoDO; +import com.platform.marketing.module.smschannel.domain.enums.ChannelErrorCodeConstants; +import com.platform.marketing.module.smschannel.domain.vo.ChannelAccountPageReqVO; +import com.platform.marketing.module.smschannel.domain.vo.ChannelAccountSaveReqVO; +import com.platform.marketing.module.smschannel.mapper.SmsSignInfoMapper; +import com.platform.marketing.module.smschannel.mapper.SmsTemplateInfoMapper; +import com.platform.marketing.module.smschannel.service.SmsChannelAccountService; +import com.platform.marketing.module.smschannel.service.SmsChannelInfoService; +import com.xingyuv.captcha.util.MD5Util; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; + +import org.springframework.validation.annotation.Validated; + +import java.util.*; + +import com.platform.marketing.module.smschannel.domain.dataobject.SmsChannelAccountDO; +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.common.util.object.BeanUtils; + +import com.platform.marketing.module.smschannel.mapper.SmsChannelAccountMapper; + +import static com.platform.marketing.framework.common.exception.util.ServiceExceptionUtil.exception; +import static com.platform.marketing.module.smschannel.domain.enums.ChannelErrorCodeConstants.*; + + +/** + * 短信渠道账号 Service 实现类 + * + * @author admin + */ +@Service +@Validated +public class SmsChannelAccountServiceImpl implements SmsChannelAccountService { + + private final static String SALT = "channelSALT"; + + @Resource + private SmsChannelInfoService channelInfoService; + + @Resource + private SmsChannelAccountMapper smsChannelAccountMapper; + + @Resource + private SmsTemplateInfoMapper smsTemplateInfoMapper; + + @Resource + private SmsSignInfoMapper signInfoMapper; + + @Override + public Long createChannelAccount(ChannelAccountSaveReqVO createReqVO) { + SmsChannelInfoDO smsChannelInfoDO = channelInfoService.getSmsChannelInfo(createReqVO.getChannelId()); + if (smsChannelInfoDO == null) { + throw exception(SMS_CHANNEL_INFO_NOT_EXISTS); + } + createReqVO.setChannelCode(smsChannelInfoDO.getChannelCode()); + + String md5Value = MD5Util.md5WithSalt( + StringUtils.join(createReqVO.getAccountName(), + String.valueOf(createReqVO.getChannelId()), + createReqVO.getAccountName(), + createReqVO.getAppKey(), + createReqVO.getAppSecret(), + createReqVO.getExtParams(), + StringUtils.join(createReqVO.getSupportSmsType())), SALT); + createReqVO.setMd5Value(md5Value); + + // 插入 + SmsChannelAccountDO channelAccount = BeanUtils.toBean(createReqVO, SmsChannelAccountDO.class); + + channelAccount.setSupportSmsType(JsonUtils.toJsonString(createReqVO.getSupportSmsType())); + smsChannelAccountMapper.insert(channelAccount); + + // 返回 + return channelAccount.getId(); + } + + @Override + public void updateChannelAccount(ChannelAccountSaveReqVO updateReqVO) { + // 校验存在 + validateChannelAccountExists(updateReqVO.getId()); + + if (StringUtils.isEmpty(updateReqVO.getExtParams())) { + updateReqVO.setExtParams(JsonUtils.toJsonString(new HashMap())); + } + SmsChannelAccountDO updateObj = BeanUtils.toBean(updateReqVO, SmsChannelAccountDO.class); + + String md5Value = MD5Util.md5WithSalt(StringUtils.join( + updateReqVO.getAccountName(), + String.valueOf(updateObj.getChannelId()), + updateObj.getAppKey(), + updateObj.getAppSecret(), + updateObj.getExtParams(), + StringUtils.join(updateReqVO.getSupportSmsType())), SALT); + updateObj.setMd5Value(md5Value); + + // 更新 + smsChannelAccountMapper.updateById(updateObj); + } + + @Override + public synchronized void deleteChannelAccount(Long id) { + // 校验存在 + validateChannelAccountExists(id); + + // 遍历所有的账号 查看是否存在签名 + List smsSignInfoDOList = signInfoMapper.selectList(); + for (SmsSignInfoDO smsSignInfoDO : smsSignInfoDOList) { + String bindingAccountIds = smsSignInfoDO.getBindingAccountIds(); + List accountIds = JsonUtils.parseArray(bindingAccountIds, Long.class); + if (accountIds.contains(id)) { + throw exception(CHANNEL_ACCOUNT_EXIST_SIGN); + } + } + + // 删除 + smsChannelAccountMapper.deleteById(id); + } + + @Override + public synchronized void deleteChannelAccountListByIds(List ids) { + // 删除 + smsChannelAccountMapper.deleteByIds(ids); + } + + private void validateChannelAccountExists(Long id) { + if (smsChannelAccountMapper.selectById(id) == null) { + throw exception(CHANNEL_ACCOUNT_NOT_EXISTS); + } + } + + @Override + public SmsChannelAccountDO getChannelAccount(Long id) { + return smsChannelAccountMapper.selectById(id); + } + + /** + * 获取全部的渠道账户 + */ + @Override + public List getChannelAccountList() { + return smsChannelAccountMapper.selectList(); + } + + @Override + public PageResult getChannelAccountPage(ChannelAccountPageReqVO pageReqVO) { + return smsChannelAccountMapper.selectPage(pageReqVO); + } + +} \ No newline at end of file diff --git a/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/service/impl/SmsChannelInfoServiceImpl.java b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/service/impl/SmsChannelInfoServiceImpl.java new file mode 100644 index 0000000..7ba20fe --- /dev/null +++ b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/service/impl/SmsChannelInfoServiceImpl.java @@ -0,0 +1,98 @@ +package com.platform.marketing.module.smschannel.service.impl; + +import com.platform.marketing.module.smschannel.domain.vo.SmsChannelInfoPageReqVO; +import com.platform.marketing.module.smschannel.domain.vo.SmsChannelInfoSaveReqVO; +import com.platform.marketing.module.smschannel.service.SmsChannelInfoService; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; + +import org.springframework.validation.annotation.Validated; + +import java.util.*; + +import com.platform.marketing.module.smschannel.domain.dataobject.SmsChannelInfoDO; +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.common.util.object.BeanUtils; + +import com.platform.marketing.module.smschannel.mapper.SmsChannelInfoMapper; + +import static com.platform.marketing.framework.common.exception.util.ServiceExceptionUtil.exception; +import static com.platform.marketing.module.smschannel.domain.enums.ChannelErrorCodeConstants.SMS_CHANNEL_INFO_CAN_NOT_DELETE; +import static com.platform.marketing.module.smschannel.domain.enums.ChannelErrorCodeConstants.SMS_CHANNEL_INFO_NOT_EXISTS; + +/** + * 短信渠道配置表(含扩展属性字段) Service 实现类 + * + * @author admin + */ +@Service +@Validated +public class SmsChannelInfoServiceImpl implements SmsChannelInfoService { + + @Resource + private SmsChannelInfoMapper smsChannelInfoMapper; + + @Override + public Integer createSmsChannelInfo(SmsChannelInfoSaveReqVO createReqVO) { + // 插入 + SmsChannelInfoDO smsChannelInfo = BeanUtils.toBean(createReqVO, SmsChannelInfoDO.class); + smsChannelInfoMapper.insert(smsChannelInfo); + + // 返回 + return smsChannelInfo.getId(); + } + + @Override + public void updateSmsChannelInfo(SmsChannelInfoSaveReqVO updateReqVO) { + // 校验存在 + validateSmsChannelInfoExists(updateReqVO.getId()); + // 更新 + SmsChannelInfoDO updateObj = BeanUtils.toBean(updateReqVO, SmsChannelInfoDO.class); + smsChannelInfoMapper.updateById(updateObj); + } + + @Override + public synchronized void deleteSmsChannelInfo(Integer id) { + // 校验存在 + SmsChannelInfoDO smsChannelInfoDO = smsChannelInfoMapper.selectById(id); + if (smsChannelInfoDO == null) { + throw exception(SMS_CHANNEL_INFO_NOT_EXISTS); + } + + if (smsChannelInfoDO.getLabel().contains("内置")) { + throw exception(SMS_CHANNEL_INFO_CAN_NOT_DELETE); + } + + // 删除 + smsChannelInfoMapper.deleteById(id); + } + + @Override + public void deleteSmsChannelInfoListByIds(List ids) { + // 删除 + smsChannelInfoMapper.deleteByIds(ids); + } + + private void validateSmsChannelInfoExists(Integer id) { + if (smsChannelInfoMapper.selectById(id) == null) { + throw exception(SMS_CHANNEL_INFO_NOT_EXISTS); + } + } + + @Override + public SmsChannelInfoDO getSmsChannelInfo(Integer id) { + return smsChannelInfoMapper.selectById(id); + } + + @Override + public PageResult getSmsChannelInfoPage(SmsChannelInfoPageReqVO pageReqVO) { + return smsChannelInfoMapper.selectPage(pageReqVO); + } + + @Override + public List getSmsChannelInfoList() { + return smsChannelInfoMapper.selectList(); + } + +} \ No newline at end of file diff --git a/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/service/impl/SmsTemplateInfoServiceImpl.java b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/service/impl/SmsTemplateInfoServiceImpl.java new file mode 100644 index 0000000..9ce954a --- /dev/null +++ b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/service/impl/SmsTemplateInfoServiceImpl.java @@ -0,0 +1,233 @@ +package com.platform.marketing.module.smschannel.service.impl; + +import com.platform.marketing.framework.common.util.json.JsonUtils; +import com.platform.marketing.module.smschannel.adapter.core.SmsOuterAdapter; +import com.platform.marketing.module.smschannel.adapter.core.support.SmsTemplateUtil; +import com.platform.marketing.module.smschannel.domain.dataobject.SmsChannelAccountDO; +import com.platform.marketing.module.smschannel.domain.dataobject.SmsSignInfoDO; +import com.platform.marketing.module.smschannel.domain.dataobject.SmsTemplateBindingInfoDO; +import com.platform.marketing.module.smschannel.domain.dataobject.SmsTemplateInfoDO; +import com.platform.marketing.module.smschannel.domain.enums.ChannelErrorCodeConstants; +import com.platform.marketing.module.smschannel.domain.enums.ChannelRedisConstants; +import com.platform.marketing.module.smschannel.domain.enums.CreateTemplateStatus; +import com.platform.marketing.module.smschannel.domain.vo.TemplateInfoPageReqVO; +import com.platform.marketing.module.smschannel.domain.vo.TemplateInfoSaveReqVO; +import com.platform.marketing.module.smschannel.mapper.SmsChannelAccountMapper; +import com.platform.marketing.module.smschannel.mapper.SmsSignInfoMapper; +import com.platform.marketing.module.smschannel.mapper.SmsTemplateBindingInfoMapper; +import com.platform.marketing.module.smschannel.mapper.SmsTemplateInfoMapper; +import com.platform.marketing.module.smschannel.service.SmsAdapterService; +import com.platform.marketing.module.smschannel.service.SmsTemplateInfoService; +import com.baomidou.dynamic.datasource.annotation.DSTransactional; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import org.apache.commons.lang3.StringUtils; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; + +import org.springframework.validation.annotation.Validated; + +import java.util.*; +import java.util.stream.Collectors; + +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.common.util.object.BeanUtils; + +import static com.platform.marketing.framework.common.exception.util.ServiceExceptionUtil.exception; +import static com.platform.marketing.module.smschannel.domain.enums.ChannelErrorCodeConstants.SIGN_INFO_NOT_EXISTS; +import static com.platform.marketing.module.smschannel.domain.enums.ChannelErrorCodeConstants.TEMPLATE_INFO_NOT_EXISTS; + +/** + * 短信模板信息 Service 实现类 + * + * @author admin + */ +@Service +@Validated +public class SmsTemplateInfoServiceImpl implements SmsTemplateInfoService { + + @Resource + private SmsTemplateInfoMapper templateInfoMapper; + + @Resource + private SmsSignInfoMapper signInfoMapper; + + @Resource + private SmsTemplateInfoMapper smsTemplateInfoMapper; + + @Resource + private SmsChannelAccountMapper accountMapper; + + @Resource + private SmsTemplateBindingInfoMapper bindingInfoMapper; + + @Resource + private SmsAdapterService smsAdapterService; + + @Override + @DSTransactional(rollbackFor = Exception.class) + public synchronized Long createTemplateInfo(TemplateInfoSaveReqVO createReqVO) { + + SmsSignInfoDO smsSignInfoDO = signInfoMapper.selectById(createReqVO.getSignId()); + if (smsSignInfoDO == null) { + throw exception(SIGN_INFO_NOT_EXISTS); + } + + createReqVO.setSignName(smsSignInfoDO.getSignName()); + + // 插入 + SmsTemplateInfoDO templateInfo = BeanUtils.toBean(createReqVO, SmsTemplateInfoDO.class); + templateInfoMapper.insert(templateInfo); + + // 绑定的渠道账号 , 插入到 绑定模版表里 + String bindingAccountIds = smsSignInfoDO.getBindingAccountIds(); + List accountIds = JsonUtils.parseArray(bindingAccountIds, Long.class); + for (Long accountId : accountIds) { + SmsChannelAccountDO smsChannelAccountDO = accountMapper.selectById(accountId); + SmsTemplateBindingInfoDO bindingInfoDO = new SmsTemplateBindingInfoDO(); + bindingInfoDO.setTemplateId(templateInfo.getId()); + bindingInfoDO.setTemplateCode(StringUtils.EMPTY); // 初始化默认是 空字符串 + + SmsOuterAdapter smsOuterAdapter = smsAdapterService.getSmsOuterAdapterByAccountId(accountId); + bindingInfoDO.setTemplateContent(smsOuterAdapter.transferStandardTemplateContentToChannelContent(templateInfo.getContent())); + + bindingInfoDO.setChannelCode(smsChannelAccountDO.getChannelCode()); + bindingInfoDO.setAuditRemark(StringUtils.EMPTY); + bindingInfoDO.setStatus(CreateTemplateStatus.PENDING_SUBMISSION.getCode()); //审核状态:0-待提交 1-待审核 2-审核成功 3-审核失败 + + bindingInfoDO.setChannelId(smsChannelAccountDO.getChannelId()); // 渠道 ID + bindingInfoDO.setAccountId(accountId); // 绑定账号ID + + bindingInfoMapper.insert(bindingInfoDO); + } + + // 返回 + return templateInfo.getId(); + } + + @Override + @DSTransactional(rollbackFor = Exception.class) + @CacheEvict(value = ChannelRedisConstants.TEMPLATE_CACHE, key = "#updateReqVO.id") + public void updateTemplateInfo(TemplateInfoSaveReqVO updateReqVO) { + SmsSignInfoDO smsSignInfoDO = signInfoMapper.selectById(updateReqVO.getSignId()); + if (smsSignInfoDO == null) { + throw exception(SIGN_INFO_NOT_EXISTS); + } + + // 校验存在 + validateTemplateInfoExists(updateReqVO.getId()); + // 更新 + SmsTemplateInfoDO updateObj = BeanUtils.toBean(updateReqVO, SmsTemplateInfoDO.class); + templateInfoMapper.updateById(updateObj); + + // 绑定的渠道账号 , 插入到 绑定模版表里 + String bindingAccountIds = smsSignInfoDO.getBindingAccountIds(); + List accountIds = JsonUtils.parseArray(bindingAccountIds, Long.class); + for (Long accountId : accountIds) { + SmsChannelAccountDO smsChannelAccountDO = accountMapper.selectById(accountId); + SmsTemplateBindingInfoDO smsTemplateBindingInfoDO = bindingInfoMapper.getSmsTemplateBindingInfoByTemplateIdAndAccountId(updateReqVO.getId(), accountId); + if (smsTemplateBindingInfoDO == null) { + SmsTemplateBindingInfoDO bindingInfoDO = new SmsTemplateBindingInfoDO(); + bindingInfoDO.setTemplateId(updateReqVO.getId()); + bindingInfoDO.setTemplateCode(StringUtils.EMPTY); // 初始化默认是 空字符串 + + SmsOuterAdapter smsOuterAdapter = smsAdapterService.getSmsOuterAdapterByAccountId(accountId); + bindingInfoDO.setTemplateContent(smsOuterAdapter.transferStandardTemplateContentToChannelContent(updateObj.getContent())); + + bindingInfoDO.setAccountId(accountId); + + bindingInfoDO.setChannelCode(smsChannelAccountDO.getChannelCode()); + bindingInfoDO.setAuditRemark(StringUtils.EMPTY); + // 审核状态:0-待提交 1-待审核 2-审核成功 3-审核失败 + bindingInfoDO.setStatus(CreateTemplateStatus.PENDING_SUBMISSION.getCode()); + + bindingInfoDO.setChannelId(smsChannelAccountDO.getChannelId()); + bindingInfoDO.setAccountId(accountId); // 绑定账号ID + + bindingInfoMapper.insert(bindingInfoDO); + } + } + } + + @Override + public void flushTemplateBindingInfo(Long signId) { + SmsSignInfoDO smsSignInfoDO = signInfoMapper.selectById(signId); + if (smsSignInfoDO == null) { + throw exception(SIGN_INFO_NOT_EXISTS); + } + // 绑定的渠道账号 , 插入到 绑定模版表里 + String bindingAccountIds = smsSignInfoDO.getBindingAccountIds(); + List accountIds = JsonUtils.parseArray(bindingAccountIds, Long.class); + List templateInfoDOList = smsTemplateInfoMapper.selectListBySignId(signId); + for (Long accountId : accountIds) { + SmsChannelAccountDO smsChannelAccountDO = accountMapper.selectById(accountId); + for (SmsTemplateInfoDO templateInfoDO : templateInfoDOList) { + SmsTemplateBindingInfoDO smsTemplateBindingInfoDO = bindingInfoMapper.getSmsTemplateBindingInfoByTemplateIdAndAccountId(templateInfoDO.getId(), accountId); + if (smsTemplateBindingInfoDO == null) { + SmsTemplateBindingInfoDO bindingInfoDO = new SmsTemplateBindingInfoDO(); + bindingInfoDO.setTemplateId(templateInfoDO.getId()); + bindingInfoDO.setTemplateCode(StringUtils.EMPTY); // 初始化默认是 空字符串 + + SmsOuterAdapter smsOuterAdapter = smsAdapterService.getSmsOuterAdapterByAccountId(accountId); + bindingInfoDO.setTemplateContent(smsOuterAdapter.transferStandardTemplateContentToChannelContent(templateInfoDO.getContent())); + + bindingInfoDO.setChannelCode(smsChannelAccountDO.getChannelCode()); + bindingInfoDO.setAuditRemark(StringUtils.EMPTY); + // 审核状态:0-待提交 1-待审核 2-审核成功 3-审核失败 + bindingInfoDO.setStatus(CreateTemplateStatus.PENDING_SUBMISSION.getCode()); + + bindingInfoDO.setChannelId(smsChannelAccountDO.getChannelId()); + bindingInfoDO.setAccountId(accountId); + + bindingInfoMapper.insert(bindingInfoDO); + } + } + } + + } + + @Override + @CacheEvict(value = ChannelRedisConstants.TEMPLATE_CACHE, key = "#id") + public void deleteTemplateInfo(Long id) { + // 校验存在 + validateTemplateInfoExists(id); + + // 判断是否有成功绑定的模版 + List bindingInfoDOList = bindingInfoMapper.getSmsTemplateBindingInfoListByTemplateId(id); + for (SmsTemplateBindingInfoDO bindingInfoDO : bindingInfoDOList) { + if (StringUtils.isNotEmpty(bindingInfoDO.getTemplateCode())) { + throw exception(ChannelErrorCodeConstants.TEMPLATE_INFO_HAS_BINDING); + } + } + + // 删除 + templateInfoMapper.deleteById(id); + } + + @Override + public void deleteTemplateInfoListByIds(List ids) { + // 删除 + templateInfoMapper.deleteByIds(ids); + } + + private void validateTemplateInfoExists(Long id) { + if (templateInfoMapper.selectById(id) == null) { + throw exception(TEMPLATE_INFO_NOT_EXISTS); + } + } + + @Cacheable(value = ChannelRedisConstants.TEMPLATE_CACHE, key = "#id", + unless = "#result == null") + @Override + public SmsTemplateInfoDO getTemplateInfo(Long id) { + return templateInfoMapper.selectById(id); + } + + @Override + public PageResult getTemplateInfoPage(TemplateInfoPageReqVO pageReqVO) { + return templateInfoMapper.selectPage(pageReqVO); + } + +} \ No newline at end of file diff --git a/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/service/impl/TemplateBindingInfoServiceImpl.java b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/service/impl/TemplateBindingInfoServiceImpl.java new file mode 100644 index 0000000..faffeee --- /dev/null +++ b/marketing-module-channel/src/main/java/com/platform/marketing/module/smschannel/service/impl/TemplateBindingInfoServiceImpl.java @@ -0,0 +1,113 @@ +package com.platform.marketing.module.smschannel.service.impl; + +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.module.smschannel.domain.dataobject.SmsTemplateBindingInfoDO; +import com.platform.marketing.module.smschannel.domain.dataobject.SmsTemplateInfoDO; +import com.platform.marketing.module.smschannel.domain.enums.ChannelRedisConstants; +import com.platform.marketing.module.smschannel.domain.enums.CreateTemplateStatus; +import com.platform.marketing.module.smschannel.domain.vo.TemplateBindingInfoPageReqVO; +import com.platform.marketing.module.smschannel.domain.vo.TemplateBindingInfoSaveReqVO; +import com.platform.marketing.module.smschannel.mapper.SmsChannelAccountMapper; +import com.platform.marketing.module.smschannel.mapper.SmsTemplateBindingInfoMapper; +import com.platform.marketing.module.smschannel.mapper.SmsTemplateInfoMapper; +import com.platform.marketing.module.smschannel.service.TemplateBindingInfoService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; + +import org.springframework.validation.annotation.Validated; + +import java.util.*; + +import com.platform.marketing.framework.common.util.object.BeanUtils; + +import static com.platform.marketing.framework.common.exception.util.ServiceExceptionUtil.exception; +import static com.platform.marketing.module.smschannel.domain.enums.ChannelErrorCodeConstants.TEMPLATE_BINDING_INFO_NOT_EXISTS; + +/** + * 短信模板渠道绑定 Service 实现类 + * + * @author admin + */ +@Service +@Validated +public class TemplateBindingInfoServiceImpl implements TemplateBindingInfoService { + + @Resource + private SmsTemplateBindingInfoMapper templateBindingInfoMapper; + + @Resource + private SmsTemplateInfoMapper smsTemplateInfoMapper; + + @Resource + private SmsChannelAccountMapper smsChannelAccountMapper; + + @CacheEvict(value = ChannelRedisConstants.TEMPLATE_BINGDING_CACHE, allEntries = true) + @Override + public Long createTemplateBindingInfo(TemplateBindingInfoSaveReqVO createReqVO) { + SmsTemplateInfoDO smsTemplateInfoDO = smsTemplateInfoMapper.selectById(createReqVO.getTemplateId()); + + // 插入 + SmsTemplateBindingInfoDO templateBindingInfo = BeanUtils.toBean(createReqVO, SmsTemplateBindingInfoDO.class); + templateBindingInfoMapper.insert(templateBindingInfo); + + // 返回 + return templateBindingInfo.getId(); + } + + @Cacheable(value = ChannelRedisConstants.TEMPLATE_BINGDING_CACHE, key = "#templateId", + unless = "#result == null") + @Override + public List getTemplateBindingInfoList(Long templateId) { + return templateBindingInfoMapper.selectList(SmsTemplateBindingInfoDO::getTemplateId, templateId); + } + + @CacheEvict(value = ChannelRedisConstants.TEMPLATE_BINGDING_CACHE, allEntries = true) + @Override + public void updateTemplateBindingInfo(TemplateBindingInfoSaveReqVO updateReqVO) { + // 校验存在 + validateTemplateBindingInfoExists(updateReqVO.getId()); + // 更新 + SmsTemplateBindingInfoDO updateObj = BeanUtils.toBean(updateReqVO, SmsTemplateBindingInfoDO.class); + templateBindingInfoMapper.updateById(updateObj); + } + + @CacheEvict(value = ChannelRedisConstants.TEMPLATE_BINGDING_CACHE, allEntries = true) + @Override + public void deleteTemplateBindingInfo(Long id) { + SmsTemplateBindingInfoDO smsTemplateBindingInfoDO = templateBindingInfoMapper.selectById(id); + smsTemplateBindingInfoDO.setStatus(CreateTemplateStatus.PENDING_SUBMISSION.getCode()); + smsTemplateBindingInfoDO.setId(id); + smsTemplateBindingInfoDO.setTemplateCode(StringUtils.EMPTY); + smsTemplateBindingInfoDO.setAuditRemark(StringUtils.EMPTY); + templateBindingInfoMapper.updateById(smsTemplateBindingInfoDO); + } + + @Override + @CacheEvict(value = ChannelRedisConstants.TEMPLATE_BINGDING_CACHE, allEntries = true) + public void deleteTemplateBindingInfoListByIds(List ids) { + // 删除 + templateBindingInfoMapper.deleteByIds(ids); + } + + + private void validateTemplateBindingInfoExists(Long id) { + if (templateBindingInfoMapper.selectById(id) == null) { + throw exception(TEMPLATE_BINDING_INFO_NOT_EXISTS); + } + } + + @Override + public SmsTemplateBindingInfoDO getTemplateBindingInfo(Long id) { + return templateBindingInfoMapper.selectById(id); + } + + @Override + public PageResult getTemplateBindingInfoPage(TemplateBindingInfoPageReqVO pageReqVO) { + return templateBindingInfoMapper.selectPage(pageReqVO); + } + +} \ No newline at end of file diff --git a/marketing-module-channel/src/main/resources/mapper/SmsChannelAccountMapper.xml b/marketing-module-channel/src/main/resources/mapper/SmsChannelAccountMapper.xml new file mode 100644 index 0000000..bf3cd1f --- /dev/null +++ b/marketing-module-channel/src/main/resources/mapper/SmsChannelAccountMapper.xml @@ -0,0 +1,12 @@ + + + + + + + + \ No newline at end of file diff --git a/marketing-module-channel/src/main/resources/mapper/SmsChannelInfoMapper.xml b/marketing-module-channel/src/main/resources/mapper/SmsChannelInfoMapper.xml new file mode 100644 index 0000000..2b099cd --- /dev/null +++ b/marketing-module-channel/src/main/resources/mapper/SmsChannelInfoMapper.xml @@ -0,0 +1,11 @@ + + + + + + + \ No newline at end of file diff --git a/marketing-module-channel/src/main/resources/mapper/SmsSignInfoMapper.xml b/marketing-module-channel/src/main/resources/mapper/SmsSignInfoMapper.xml new file mode 100644 index 0000000..4c5e431 --- /dev/null +++ b/marketing-module-channel/src/main/resources/mapper/SmsSignInfoMapper.xml @@ -0,0 +1,11 @@ + + + + + + + \ No newline at end of file diff --git a/marketing-module-channel/src/main/resources/mapper/SmsTemplateBindingInfoMapper.xml b/marketing-module-channel/src/main/resources/mapper/SmsTemplateBindingInfoMapper.xml new file mode 100644 index 0000000..25f8904 --- /dev/null +++ b/marketing-module-channel/src/main/resources/mapper/SmsTemplateBindingInfoMapper.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/marketing-module-channel/src/main/resources/mapper/SmsTemplateInfoMapper.xml b/marketing-module-channel/src/main/resources/mapper/SmsTemplateInfoMapper.xml new file mode 100644 index 0000000..cb75dda --- /dev/null +++ b/marketing-module-channel/src/main/resources/mapper/SmsTemplateInfoMapper.xml @@ -0,0 +1,11 @@ + + + + + + + \ No newline at end of file diff --git a/marketing-module-gateway/.flattened-pom.xml b/marketing-module-gateway/.flattened-pom.xml new file mode 100644 index 0000000..9683c17 --- /dev/null +++ b/marketing-module-gateway/.flattened-pom.xml @@ -0,0 +1,64 @@ + + + 4.0.0 + com.platform + marketing-module-gateway + 0.0.1-jdk8-SNAPSHOT + marketing-admin基础脚手架 + https://github.com/makemyownlife/marketing-admin/marketing-module-gateway + + + com.platform + marketing-module-channel + 0.0.1-jdk8-SNAPSHOT + compile + + + com.platform + marketing-module-record + 0.0.1-jdk8-SNAPSHOT + compile + + + com.platform + marketing-module-tenant + 0.0.1-jdk8-SNAPSHOT + compile + + + com.platform + marketing-client-sdk + 0.0.1-jdk8-SNAPSHOT + compile + + + + + huaweicloud + huawei + https://mirrors.huaweicloud.com/repository/maven/ + + + aliyunmaven + aliyun + https://maven.aliyun.com/repository/public + + + + false + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + + + false + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + + diff --git a/marketing-module-gateway/pom.xml b/marketing-module-gateway/pom.xml new file mode 100644 index 0000000..49528be --- /dev/null +++ b/marketing-module-gateway/pom.xml @@ -0,0 +1,44 @@ + + + 4.0.0 + + + com.platform + marketing-admin-all + ${revision} + + + marketing-module-gateway + jar + + + + + com.platform + marketing-module-channel + ${parent.version} + + + + com.platform + marketing-module-record + ${parent.version} + + + + com.platform + marketing-module-tenant + ${parent.version} + + + + com.platform + marketing-client-sdk + ${parent.version} + + + + + \ No newline at end of file diff --git a/marketing-module-gateway/src/main/java/com/platform/marketing/module/gateway/config/ClientApiInterceptor.java b/marketing-module-gateway/src/main/java/com/platform/marketing/module/gateway/config/ClientApiInterceptor.java new file mode 100644 index 0000000..18f0324 --- /dev/null +++ b/marketing-module-gateway/src/main/java/com/platform/marketing/module/gateway/config/ClientApiInterceptor.java @@ -0,0 +1,80 @@ +package com.platform.marketing.module.gateway.config; + +import com.platform.marketing.client.sdk.util.SmsSenderUtil; +import com.platform.marketing.framework.common.pojo.CommonResult; +import com.platform.marketing.framework.common.util.json.JsonUtils; +import com.platform.marketing.module.record.domain.enums.GatewayErrorCodeConstants; +import com.platform.marketing.module.record.util.UtilsAll; +import com.platform.marketing.module.tenant.domain.dataobject.SmsAppinfoDO; +import com.platform.marketing.module.tenant.service.SmsAppinfoService; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * 协议请求拦截器 + * Created by diven on 2025/9/22. + */ +@Component +@Slf4j +public class ClientApiInterceptor extends HandlerInterceptorAdapter { + + @Autowired + private SmsAppinfoService smsAppinfoService; + + @Override + public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { + try { + String q = request.getParameter("q"); + String sign = request.getParameter("sign"); + String time = request.getParameter("time"); + String random = request.getParameter("random"); + String appKey = request.getParameter("appKey"); + + // 基础参数判断 + if (StringUtils.isEmpty(q) || StringUtils.isEmpty(sign) || StringUtils.isEmpty(time) || StringUtils.isEmpty(appKey)) { + UtilsAll.responseJSONToClient( + response, + JsonUtils.toJsonString(CommonResult.error(GatewayErrorCodeConstants.PARAM_NOT_ERROR)) + ); + return false; + } + + // 判断 应用是否存在 + SmsAppinfoDO smsAppinfoDO = smsAppinfoService.getAppinfoByAppKeyFromLocalCache(appKey); + if (smsAppinfoDO == null) { + UtilsAll.responseJSONToClient( + response, + JsonUtils.toJsonString(CommonResult.error(GatewayErrorCodeConstants.APP_NOT_EXISTS)) + ); + return false; + } + + //验证签名开始 + String apiSign = SmsSenderUtil.calculateSignature(smsAppinfoDO.getAppSecret(), random, time, q); + if (!StringUtils.equals(sign, apiSign)) { + UtilsAll.responseJSONToClient( + response, + JsonUtils.toJsonString(CommonResult.error(GatewayErrorCodeConstants.SIGN_CHECK_ERROR)) + ); + return false; + } + + //验证签名结束 + return true; + } catch (Exception e) { + log.error("preHandle error: ", e); + UtilsAll.responseJSONToClient( + response, + JsonUtils.toJsonString(CommonResult.error(GatewayErrorCodeConstants.GATEWAY_EXCEPTION)) + ); + return false; + } + } + +} diff --git a/marketing-module-gateway/src/main/java/com/platform/marketing/module/gateway/config/GatewayConfiguration.java b/marketing-module-gateway/src/main/java/com/platform/marketing/module/gateway/config/GatewayConfiguration.java new file mode 100644 index 0000000..c90d1ae --- /dev/null +++ b/marketing-module-gateway/src/main/java/com/platform/marketing/module/gateway/config/GatewayConfiguration.java @@ -0,0 +1,22 @@ +package com.platform.marketing.module.gateway.config; + +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.InterceptorRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +import javax.annotation.Resource; + +@Configuration +public class GatewayConfiguration implements WebMvcConfigurer { + + @Resource + private ClientApiInterceptor clientApiInterceptor; + + @Override + public void addInterceptors(InterceptorRegistry registry) { + // api网关 + registry.addInterceptor(clientApiInterceptor).addPathPatterns("/gateway/client/**"); + } + + +} diff --git a/marketing-module-gateway/src/main/java/com/platform/marketing/module/gateway/controller/GatewayCallBackController.java b/marketing-module-gateway/src/main/java/com/platform/marketing/module/gateway/controller/GatewayCallBackController.java new file mode 100644 index 0000000..c5dadde --- /dev/null +++ b/marketing-module-gateway/src/main/java/com/platform/marketing/module/gateway/controller/GatewayCallBackController.java @@ -0,0 +1,13 @@ +package com.platform.marketing.module.gateway.controller; + +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; + +@Controller +@RequestMapping("/gateway/callback/") +@Slf4j +public class GatewayCallBackController { + + +} diff --git a/marketing-module-gateway/src/main/java/com/platform/marketing/module/gateway/controller/GatewayClientController.java b/marketing-module-gateway/src/main/java/com/platform/marketing/module/gateway/controller/GatewayClientController.java new file mode 100644 index 0000000..47c5204 --- /dev/null +++ b/marketing-module-gateway/src/main/java/com/platform/marketing/module/gateway/controller/GatewayClientController.java @@ -0,0 +1,74 @@ +package com.platform.marketing.module.gateway.controller; + +import com.platform.marketing.framework.common.pojo.CommonResult; +import com.platform.marketing.framework.common.util.json.JsonUtils; +import com.platform.marketing.module.gateway.domain.vo.SendBatchSmsByTemplateIdReqVO; +import com.platform.marketing.module.gateway.domain.vo.SendSingleSmsByTemplateIdReqVO; +import com.platform.marketing.module.gateway.service.GatewayService; +import com.platform.marketing.module.record.util.UtilsAll; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; + +@Controller +@RequestMapping("/gateway/client/") +public class GatewayClientController { + + private final static Logger logger = LoggerFactory.getLogger(GatewayClientController.class); + + @Resource + private GatewayService gatewayService; + + @RequestMapping("/sendByTemplateId") + @ResponseBody + public CommonResult sendByTemplateId(HttpServletRequest request) { + // 接收请求参数 + String q = request.getParameter("q"); + String appKey = request.getParameter("appKey"); + String time = request.getParameter("time"); + String random = request.getParameter("random"); + String senderIp = UtilsAll.getClientIp(request); + + // 构造唯一请求 id + String uniqueId = time + random; + logger.info("SingleSend uniqueId: {} , q: {} , appKey: {} senderIp:{}", uniqueId, q, appKey, senderIp); + + SendSingleSmsByTemplateIdReqVO sendSingleSmsByTemplateIdReqVO = JsonUtils.parseObject(q, SendSingleSmsByTemplateIdReqVO.class); + assert sendSingleSmsByTemplateIdReqVO != null; + sendSingleSmsByTemplateIdReqVO.setUniqueId(uniqueId); + sendSingleSmsByTemplateIdReqVO.setAppKey(appKey); + sendSingleSmsByTemplateIdReqVO.setSenderIp(senderIp); + sendSingleSmsByTemplateIdReqVO.setSource(0); + + return gatewayService.sendByTemplateId(sendSingleSmsByTemplateIdReqVO); + } + + @RequestMapping("/batchSendByTemplateId") + @ResponseBody + public CommonResult batchSendByTemplateId(HttpServletRequest request) { + String q = request.getParameter("q"); + String appKey = request.getParameter("appKey"); + String time = request.getParameter("time"); + String random = request.getParameter("random"); + String senderIp = UtilsAll.getClientIp(request); + + // 构造唯一请求 id + String uniqueId = time + random; + logger.info("BatchSend uniqueId: {} , appKey: {} senderIp:{}", uniqueId, appKey, senderIp); + + SendBatchSmsByTemplateIdReqVO sendBatchSmsByTemplateIdReqVO = JsonUtils.parseObject(q, SendBatchSmsByTemplateIdReqVO.class); + assert sendBatchSmsByTemplateIdReqVO != null; + sendBatchSmsByTemplateIdReqVO.setUniqueId(uniqueId); + sendBatchSmsByTemplateIdReqVO.setAppKey(appKey); + sendBatchSmsByTemplateIdReqVO.setSenderIp(senderIp); + sendBatchSmsByTemplateIdReqVO.setSource(0); + + return gatewayService.batchSendByTemplateId(sendBatchSmsByTemplateIdReqVO); + } + +} diff --git a/marketing-module-gateway/src/main/java/com/platform/marketing/module/gateway/domain/enums/package-info.java b/marketing-module-gateway/src/main/java/com/platform/marketing/module/gateway/domain/enums/package-info.java new file mode 100644 index 0000000..d1b705d --- /dev/null +++ b/marketing-module-gateway/src/main/java/com/platform/marketing/module/gateway/domain/enums/package-info.java @@ -0,0 +1 @@ +package com.platform.marketing.module.gateway.domain.enums; \ No newline at end of file diff --git a/marketing-module-gateway/src/main/java/com/platform/marketing/module/gateway/domain/vo/SendBatchSmsByTemplateIdReqVO.java b/marketing-module-gateway/src/main/java/com/platform/marketing/module/gateway/domain/vo/SendBatchSmsByTemplateIdReqVO.java new file mode 100644 index 0000000..96e72df --- /dev/null +++ b/marketing-module-gateway/src/main/java/com/platform/marketing/module/gateway/domain/vo/SendBatchSmsByTemplateIdReqVO.java @@ -0,0 +1,47 @@ +package com.platform.marketing.module.gateway.domain.vo; + +import lombok.Data; + +import java.util.Map; + +@Data +public class SendBatchSmsByTemplateIdReqVO { + + public SendBatchSmsByTemplateIdReqVO() { + } + + private Integer source; + + private String uniqueId; + + /** + * 发送IP + */ + private String senderIp; + + /** + * 接收短信的电话号码,以逗号, 分隔 。国内手机号: 15011319235 国际手机号:+852000012**** + */ + private String phoneNumbers; + + /** + * 模版编码 + */ + private String templateId; + + /** + * 延时时间 + */ + private String attime; + + /** + * 应用 appKey + */ + private String appKey; + + /** + * 模版参数 + */ + private Map templateParam; + +} diff --git a/marketing-module-gateway/src/main/java/com/platform/marketing/module/gateway/domain/vo/SendSingleSmsByTemplateIdReqVO.java b/marketing-module-gateway/src/main/java/com/platform/marketing/module/gateway/domain/vo/SendSingleSmsByTemplateIdReqVO.java new file mode 100644 index 0000000..35d2bcf --- /dev/null +++ b/marketing-module-gateway/src/main/java/com/platform/marketing/module/gateway/domain/vo/SendSingleSmsByTemplateIdReqVO.java @@ -0,0 +1,52 @@ +package com.platform.marketing.module.gateway.domain.vo; + +import lombok.Data; + +import java.util.Map; + +@Data +public class SendSingleSmsByTemplateIdReqVO { + + public SendSingleSmsByTemplateIdReqVO() { + } + + private Integer source; + + private String uniqueId; + + /** + * 发送IP + */ + private String senderIp; + + /** + * 国家区号 + */ + private String nationcode; + + /** + * 真实手机号码 不包含国家区号 + */ + private String mobile; + + /** + * 模版编码 + */ + private String templateId; + + /** + * 延时时间 + */ + private String attime; + + /** + * 应用 appKey + */ + private String appKey; + + /** + * 模版参数 + */ + private Map templateParam; + +} diff --git a/marketing-module-gateway/src/main/java/com/platform/marketing/module/gateway/service/GatewayService.java b/marketing-module-gateway/src/main/java/com/platform/marketing/module/gateway/service/GatewayService.java new file mode 100644 index 0000000..b68c92d --- /dev/null +++ b/marketing-module-gateway/src/main/java/com/platform/marketing/module/gateway/service/GatewayService.java @@ -0,0 +1,19 @@ +package com.platform.marketing.module.gateway.service; + +import com.platform.marketing.framework.common.pojo.CommonResult; +import com.platform.marketing.module.gateway.domain.vo.SendBatchSmsByTemplateIdReqVO; +import com.platform.marketing.module.gateway.domain.vo.SendSingleSmsByTemplateIdReqVO; + +public interface GatewayService { + + /** + * 根据模板id发送短信 + */ + CommonResult sendByTemplateId(SendSingleSmsByTemplateIdReqVO sendSingleSmsByTemplateIdReqVO); + + /** + * 批量根据模板id发送短信 + */ + CommonResult batchSendByTemplateId(SendBatchSmsByTemplateIdReqVO sendBatchSmsByTemplateIdReqVO); + +} diff --git a/marketing-module-gateway/src/main/java/com/platform/marketing/module/gateway/service/impl/GatewayServiceImpl.java b/marketing-module-gateway/src/main/java/com/platform/marketing/module/gateway/service/impl/GatewayServiceImpl.java new file mode 100644 index 0000000..4270537 --- /dev/null +++ b/marketing-module-gateway/src/main/java/com/platform/marketing/module/gateway/service/impl/GatewayServiceImpl.java @@ -0,0 +1,41 @@ +package com.platform.marketing.module.gateway.service.impl; + +import com.platform.marketing.framework.common.pojo.CommonResult; +import com.platform.marketing.framework.common.util.object.BeanUtils; +import com.platform.marketing.framework.idgenerator.core.service.IdGeneratorService; +import com.platform.marketing.module.gateway.domain.vo.SendBatchSmsByTemplateIdReqVO; +import com.platform.marketing.module.gateway.domain.vo.SendSingleSmsByTemplateIdReqVO; +import com.platform.marketing.module.gateway.service.GatewayService; +import com.platform.marketing.module.record.domain.dto.SendBatchSmsReqDTO; +import com.platform.marketing.module.record.domain.dto.SendSingleSmsReqDTO; +import com.platform.marketing.module.record.facade.SendShortMessageFacade; +import com.platform.marketing.module.record.service.SmsTaskService; +import com.platform.marketing.module.smschannel.service.SmsTemplateInfoService; +import com.platform.marketing.module.tenant.service.SmsAppinfoService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; + +@Service +@Slf4j +public class GatewayServiceImpl implements GatewayService { + + @Resource + private SendShortMessageFacade sendShortMessageFacade; + + @Override + public CommonResult sendByTemplateId(SendSingleSmsByTemplateIdReqVO sendSmsByTemplateIdReqVO) { + SendSingleSmsReqDTO sendSingleSmsReqDTO = new SendSingleSmsReqDTO(); + BeanUtils.copyProperties(sendSmsByTemplateIdReqVO, sendSingleSmsReqDTO); + return sendShortMessageFacade.sendByTemplateId(sendSingleSmsReqDTO); + } + + @Override + public CommonResult batchSendByTemplateId(SendBatchSmsByTemplateIdReqVO sendBatchSmsByTemplateIdReqVO) { + SendBatchSmsReqDTO sendBatchSmsReqDTO = new SendBatchSmsReqDTO(); + BeanUtils.copyProperties(sendBatchSmsByTemplateIdReqVO, sendBatchSmsReqDTO); + return sendShortMessageFacade.batchSendByTemplateId(sendBatchSmsReqDTO); + } + +} diff --git a/marketing-module-gateway/src/test/java/HttpUnitTest.java b/marketing-module-gateway/src/test/java/HttpUnitTest.java new file mode 100644 index 0000000..2b8d153 --- /dev/null +++ b/marketing-module-gateway/src/test/java/HttpUnitTest.java @@ -0,0 +1,32 @@ +import com.platform.marketing.client.sdk.SmsConfig; +import com.platform.marketing.client.sdk.SmsSenderClient; +import com.platform.marketing.client.sdk.SmsSenderResult; +import com.alibaba.fastjson.JSON; + +import java.util.HashMap; +import java.util.Map; + +/** + * Created by diven on 2020/9/12. + */ +public class HttpUnitTest { + + public static void main(String[] args) throws Exception { + SmsConfig smsConfig = new SmsConfig(); + smsConfig.setAppKey("qQjEiFzn80v8VM4h"); + smsConfig.setSmsServerUrl("http://localhost:8089"); + smsConfig.setAppSecret("9c465ece754bd26a9be77f3d0e2606bd"); + SmsSenderClient smsSenderClient = new SmsSenderClient(smsConfig); + String mobile = "15011319235"; + String templateId = "1"; + // ${code}为您的登录验证码,请于${time}分钟内填写,如非本人操作,请忽略本短信。 + Map param = new HashMap(); + param.put("code", "1234"); + param.put("time", "10"); + // 30 秒之后发送 + String attime = String.valueOf(System.currentTimeMillis() + 30 * 1000L); + SmsSenderResult senderResult = smsSenderClient.sendSmsByTemplateId(mobile, templateId, attime, param); + System.out.println("senderResult:" + JSON.toJSONString(senderResult)); + } + +} diff --git a/marketing-module-infra/.flattened-pom.xml b/marketing-module-infra/.flattened-pom.xml new file mode 100644 index 0000000..3839b9a --- /dev/null +++ b/marketing-module-infra/.flattened-pom.xml @@ -0,0 +1,115 @@ + + + 4.0.0 + com.platform + marketing-module-infra + 0.0.1-jdk8-SNAPSHOT + marketing-module-infra + infra 模块,主要提供两块能力: + 1. 我们放基础设施的运维与管理,支撑上层的通用与核心业务。 例如说:定时任务的管理、服务器的信息等等 + 2. 研发工具,提升研发效率与质量。 例如说:代码生成器、接口文档等等 + https://github.com/makemyownlife/marketing-admin/marketing-module-infra + + + com.platform + marketing-spring-boot-starter-security + 0.0.1-jdk8-SNAPSHOT + compile + + + com.platform + marketing-spring-boot-starter-mybatis + 0.0.1-jdk8-SNAPSHOT + compile + + + com.baomidou + mybatis-plus-generator + 3.5.9 + compile + + + com.platform + marketing-spring-boot-starter-redis + 0.0.1-jdk8-SNAPSHOT + compile + + + com.platform + marketing-spring-boot-starter-job + 0.0.1-jdk8-SNAPSHOT + compile + + + com.platform + marketing-spring-boot-starter-mq + 0.0.1-jdk8-SNAPSHOT + compile + + + com.platform + marketing-spring-boot-starter-excel + 0.0.1-jdk8-SNAPSHOT + compile + + + org.apache.velocity + velocity-engine-core + 2.4 + compile + + + commons-net + commons-net + 3.11.1 + compile + + + com.jcraft + jsch + 0.1.55 + compile + + + com.amazonaws + aws-java-sdk-s3 + 1.12.777 + compile + + + org.apache.tika + tika-core + 2.9.3 + compile + + + + + huaweicloud + huawei + https://mirrors.huaweicloud.com/repository/maven/ + + + aliyunmaven + aliyun + https://maven.aliyun.com/repository/public + + + + false + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + + + false + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + + diff --git a/marketing-module-infra/pom.xml b/marketing-module-infra/pom.xml new file mode 100644 index 0000000..75dd7f3 --- /dev/null +++ b/marketing-module-infra/pom.xml @@ -0,0 +1,97 @@ + + + + + com.platform + marketing-admin-all + ${revision} + + + 4.0.0 + marketing-module-infra + jar + + ${project.artifactId} + + infra 模块,主要提供两块能力: + 1. 我们放基础设施的运维与管理,支撑上层的通用与核心业务。 例如说:定时任务的管理、服务器的信息等等 + 2. 研发工具,提升研发效率与质量。 例如说:代码生成器、接口文档等等 + + + + + + + com.platform + marketing-spring-boot-starter-security + + + + + com.platform + marketing-spring-boot-starter-mybatis + + + + com.baomidou + mybatis-plus-generator + + + + com.platform + marketing-spring-boot-starter-redis + + + + + + + com.platform + marketing-spring-boot-starter-job + + + + + com.platform + marketing-spring-boot-starter-mq + + + + + + + + com.platform + marketing-spring-boot-starter-excel + + + + org.apache.velocity + velocity-engine-core + + + + commons-net + commons-net + + + + com.jcraft + jsch + + + + com.amazonaws + aws-java-sdk-s3 + + + + org.apache.tika + tika-core + + + + + diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/controller/CodegenController.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/controller/CodegenController.java new file mode 100644 index 0000000..d065003 --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/controller/CodegenController.java @@ -0,0 +1,160 @@ +package com.platform.marketing.module.infra.controller; + +import cn.hutool.core.io.IoUtil; +import cn.hutool.core.util.ZipUtil; +import com.platform.marketing.framework.common.pojo.CommonResult; +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.common.util.object.BeanUtils; +import com.platform.marketing.module.infra.domain.convert.CodegenConvert; +import com.platform.marketing.module.infra.domain.dataobject.CodegenColumnDO; +import com.platform.marketing.module.infra.domain.dataobject.CodegenTableDO; +import com.platform.marketing.module.infra.domain.vo.CodegenCreateListReqVO; +import com.platform.marketing.module.infra.domain.vo.CodegenDetailRespVO; +import com.platform.marketing.module.infra.domain.vo.CodegenPreviewRespVO; +import com.platform.marketing.module.infra.domain.vo.CodegenUpdateReqVO; +import com.platform.marketing.module.infra.domain.vo.table.CodegenTablePageReqVO; +import com.platform.marketing.module.infra.domain.vo.table.CodegenTableRespVO; +import com.platform.marketing.module.infra.domain.vo.table.DatabaseTableRespVO; +import com.platform.marketing.module.infra.service.CodegenService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Parameters; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +import static com.platform.marketing.framework.common.pojo.CommonResult.success; +import static com.platform.marketing.module.infra.framework.file.core.utils.FileTypeUtils.writeAttachment; + + +@Tag(name = "管理后台 - 代码生成器") +@RestController +@RequestMapping("/infra/codegen") +@Validated +public class CodegenController { + + @Resource + private CodegenService codegenService; + + @GetMapping("/db/table/list") + @Operation(summary = "获得数据库自带的表定义列表", description = "会过滤掉已经导入 Codegen 的表") + @Parameters({ + @Parameter(name = "dataSourceConfigId", description = "数据源配置的编号", required = true, example = "1"), + @Parameter(name = "name", description = "表名,模糊匹配", example = "yudao"), + @Parameter(name = "comment", description = "描述,模糊匹配", example = "芋道") + }) + @PreAuthorize("@ss.hasPermission('infra:codegen:query')") + public CommonResult> getDatabaseTableList( + @RequestParam(value = "dataSourceConfigId") Long dataSourceConfigId, + @RequestParam(value = "name", required = false) String name, + @RequestParam(value = "comment", required = false) String comment) { + return success(codegenService.getDatabaseTableList(dataSourceConfigId, name, comment)); + } + + @GetMapping("/table/list") + @Operation(summary = "获得表定义列表") + @Parameter(name = "dataSourceConfigId", description = "数据源配置的编号", required = true, example = "1") + @PreAuthorize("@ss.hasPermission('infra:codegen:query')") + public CommonResult> getCodegenTableList(@RequestParam(value = "dataSourceConfigId") Long dataSourceConfigId) { + List list = codegenService.getCodegenTableList(dataSourceConfigId); + return success(BeanUtils.toBean(list, CodegenTableRespVO.class)); + } + + @GetMapping("/table/page") + @Operation(summary = "获得表定义分页") + @PreAuthorize("@ss.hasPermission('infra:codegen:query')") + public CommonResult> getCodegenTablePage(@Valid CodegenTablePageReqVO pageReqVO) { + PageResult pageResult = codegenService.getCodegenTablePage(pageReqVO); + return success(BeanUtils.toBean(pageResult, CodegenTableRespVO.class)); + } + + @GetMapping("/detail") + @Operation(summary = "获得表和字段的明细") + @Parameter(name = "tableId", description = "表编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('infra:codegen:query')") + public CommonResult getCodegenDetail(@RequestParam("tableId") Long tableId) { + CodegenTableDO table = codegenService.getCodegenTable(tableId); + List columns = codegenService.getCodegenColumnListByTableId(tableId); + // 拼装返回 + return success(CodegenConvert.INSTANCE.convert(table, columns)); + } + + @Operation(summary = "基于数据库的表结构,创建代码生成器的表和字段定义") + @PostMapping("/create-list") + @PreAuthorize("@ss.hasPermission('infra:codegen:create')") + public CommonResult> createCodegenList(@Valid @RequestBody CodegenCreateListReqVO reqVO) { + return success(codegenService.createCodegenList("admin", reqVO)); + } + + @Operation(summary = "更新数据库的表和字段定义") + @PutMapping("/update") + @PreAuthorize("@ss.hasPermission('infra:codegen:update')") + public CommonResult updateCodegen(@Valid @RequestBody CodegenUpdateReqVO updateReqVO) { + codegenService.updateCodegen(updateReqVO); + return success(true); + } + + @Operation(summary = "基于数据库的表结构,同步数据库的表和字段定义") + @PutMapping("/sync-from-db") + @Parameter(name = "tableId", description = "表编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('infra:codegen:update')") + public CommonResult syncCodegenFromDB(@RequestParam("tableId") Long tableId) { + codegenService.syncCodegenFromDB(tableId); + return success(true); + } + + @Operation(summary = "删除数据库的表和字段定义") + @DeleteMapping("/delete") + @Parameter(name = "tableId", description = "表编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('infra:codegen:delete')") + public CommonResult deleteCodegen(@RequestParam("tableId") Long tableId) { + codegenService.deleteCodegen(tableId); + return success(true); + } + + @Operation(summary = "批量删除数据库的表和字段定义") + @DeleteMapping("/delete-list") + @Parameter(name = "tableIds", description = "表编号列表", required = true) + @PreAuthorize("@ss.hasPermission('infra:codegen:delete')") + public CommonResult deleteCodegenList(@RequestParam("tableIds") List tableIds) { + codegenService.deleteCodegenList(tableIds); + return success(true); + } + + @Operation(summary = "预览生成代码") + @GetMapping("/preview") + @Parameter(name = "tableId", description = "表编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('infra:codegen:preview')") + public CommonResult> previewCodegen(@RequestParam("tableId") Long tableId) { + Map codes = codegenService.generationCodes(tableId); + return success(CodegenConvert.INSTANCE.convert(codes)); + } + + @Operation(summary = "下载生成代码") + @GetMapping("/download") + @Parameter(name = "tableId", description = "表编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('infra:codegen:download')") + public void downloadCodegen(@RequestParam("tableId") Long tableId, + HttpServletResponse response) throws IOException { + // 生成代码 + Map codes = codegenService.generationCodes(tableId); + // 构建 zip 包 + String[] paths = codes.keySet().toArray(new String[0]); + ByteArrayInputStream[] ins = codes.values().stream().map(IoUtil::toUtf8Stream).toArray(ByteArrayInputStream[]::new); + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + ZipUtil.zip(outputStream, paths, ins); + // 输出 + writeAttachment(response, "codegen.zip", outputStream.toByteArray()); + } + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/controller/ConfigController.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/controller/ConfigController.java new file mode 100644 index 0000000..84bd045 --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/controller/ConfigController.java @@ -0,0 +1,105 @@ +package com.platform.marketing.module.infra.controller; + +import com.platform.marketing.framework.common.pojo.CommonResult; +import com.platform.marketing.framework.common.pojo.PageParam; +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.excel.core.util.ExcelUtils; +import com.platform.marketing.module.infra.domain.convert.ConfigConvert; +import com.platform.marketing.module.infra.domain.dataobject.ConfigDO; +import com.platform.marketing.module.infra.domain.enums.ErrorCodeConstants; +import com.platform.marketing.module.infra.domain.vo.ConfigPageReqVO; +import com.platform.marketing.module.infra.domain.vo.ConfigRespVO; +import com.platform.marketing.module.infra.domain.vo.ConfigSaveReqVO; +import com.platform.marketing.module.infra.service.ConfigService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; +import java.io.IOException; +import java.util.List; + +import static com.platform.marketing.framework.common.exception.util.ServiceExceptionUtil.exception; +import static com.platform.marketing.framework.common.pojo.CommonResult.success; + +@Tag(name = "管理后台 - 参数配置") +@RestController +@RequestMapping("/infra/config") +@Validated +public class ConfigController { + + @Resource + private ConfigService configService; + + @PostMapping("/create") + @Operation(summary = "创建参数配置") + @PreAuthorize("@ss.hasPermission('infra:config:create')") + public CommonResult createConfig(@Valid @RequestBody ConfigSaveReqVO createReqVO) { + return success(configService.createConfig(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "修改参数配置") + @PreAuthorize("@ss.hasPermission('infra:config:update')") + public CommonResult updateConfig(@Valid @RequestBody ConfigSaveReqVO updateReqVO) { + configService.updateConfig(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除参数配置") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('infra:config:delete')") + public CommonResult deleteConfig(@RequestParam("id") Long id) { + configService.deleteConfig(id); + return success(true); + } + + @GetMapping(value = "/get") + @Operation(summary = "获得参数配置") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('infra:config:query')") + public CommonResult getConfig(@RequestParam("id") Long id) { + return success(ConfigConvert.INSTANCE.convert(configService.getConfig(id))); + } + + @GetMapping(value = "/get-value-by-key") + @Operation(summary = "根据参数键名查询参数值", description = "不可见的配置,不允许返回给前端") + @Parameter(name = "key", description = "参数键", required = true, example = "yunai.biz.username") + public CommonResult getConfigKey(@RequestParam("key") String key) { + ConfigDO config = configService.getConfigByKey(key); + if (config == null) { + return success(null); + } + if (!config.getVisible()) { + throw exception(ErrorCodeConstants.CONFIG_GET_VALUE_ERROR_IF_VISIBLE); + } + return success(config.getValue()); + } + + @GetMapping("/page") + @Operation(summary = "获取参数配置分页") + @PreAuthorize("@ss.hasPermission('infra:config:query')") + public CommonResult> getConfigPage(@Valid ConfigPageReqVO pageReqVO) { + PageResult page = configService.getConfigPage(pageReqVO); + return success(ConfigConvert.INSTANCE.convertPage(page)); + } + + @GetMapping("/export") + @Operation(summary = "导出参数配置") + @PreAuthorize("@ss.hasPermission('infra:config:export')") + public void exportConfig(ConfigPageReqVO exportReqVO, + HttpServletResponse response) throws IOException { + exportReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = configService.getConfigPage(exportReqVO).getList(); + // 输出 + ExcelUtils.write(response, "参数配置.xls", "数据", ConfigRespVO.class, + ConfigConvert.INSTANCE.convertList(list)); + } + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/controller/DataSourceConfigController.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/controller/DataSourceConfigController.java new file mode 100644 index 0000000..5e39bdd --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/controller/DataSourceConfigController.java @@ -0,0 +1,72 @@ +package com.platform.marketing.module.infra.controller; + +import com.platform.marketing.framework.common.pojo.CommonResult; +import com.platform.marketing.framework.common.util.object.BeanUtils; +import com.platform.marketing.module.infra.domain.dataobject.DataSourceConfigDO; +import com.platform.marketing.module.infra.domain.vo.DataSourceConfigRespVO; +import com.platform.marketing.module.infra.domain.vo.DataSourceConfigSaveReqVO; +import com.platform.marketing.module.infra.service.DataSourceConfigService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.validation.Valid; +import java.util.List; + +import static com.platform.marketing.framework.common.pojo.CommonResult.success; + +@Tag(name = "管理后台 - 数据源配置") +@RestController +@RequestMapping("/infra/data-source-config") +@Validated +public class DataSourceConfigController { + + @Resource + private DataSourceConfigService dataSourceConfigService; + + @PostMapping("/create") + @Operation(summary = "创建数据源配置") + @PreAuthorize("@ss.hasPermission('infra:data-source-config:create')") + public CommonResult createDataSourceConfig(@Valid @RequestBody DataSourceConfigSaveReqVO createReqVO) { + return success(dataSourceConfigService.createDataSourceConfig(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新数据源配置") + @PreAuthorize("@ss.hasPermission('infra:data-source-config:update')") + public CommonResult updateDataSourceConfig(@Valid @RequestBody DataSourceConfigSaveReqVO updateReqVO) { + dataSourceConfigService.updateDataSourceConfig(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除数据源配置") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('infra:data-source-config:delete')") + public CommonResult deleteDataSourceConfig(@RequestParam("id") Long id) { + dataSourceConfigService.deleteDataSourceConfig(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得数据源配置") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('infra:data-source-config:query')") + public CommonResult getDataSourceConfig(@RequestParam("id") Long id) { + DataSourceConfigDO config = dataSourceConfigService.getDataSourceConfig(id); + return success(BeanUtils.toBean(config, DataSourceConfigRespVO.class)); + } + + @GetMapping("/list") + @Operation(summary = "获得数据源配置列表") + @PreAuthorize("@ss.hasPermission('infra:data-source-config:query')") + public CommonResult> getDataSourceConfigList() { + List list = dataSourceConfigService.getDataSourceConfigList(); + return success(BeanUtils.toBean(list, DataSourceConfigRespVO.class)); + } + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/controller/FileConfigController.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/controller/FileConfigController.java new file mode 100644 index 0000000..92939ef --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/controller/FileConfigController.java @@ -0,0 +1,88 @@ +package com.platform.marketing.module.infra.controller; + +import com.platform.marketing.framework.common.pojo.CommonResult; +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.common.util.object.BeanUtils; +import com.platform.marketing.module.infra.domain.dataobject.FileConfigDO; +import com.platform.marketing.module.infra.domain.vo.FileConfigPageReqVO; +import com.platform.marketing.module.infra.domain.vo.FileConfigRespVO; +import com.platform.marketing.module.infra.domain.vo.FileConfigSaveReqVO; +import com.platform.marketing.module.infra.service.FileConfigService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.validation.Valid; + +import static com.platform.marketing.framework.common.pojo.CommonResult.success; + +@Tag(name = "管理后台 - 文件配置") +@RestController +@RequestMapping("/infra/file-config") +@Validated +public class FileConfigController { + + @Resource + private FileConfigService fileConfigService; + + @PostMapping("/create") + @Operation(summary = "创建文件配置") + @PreAuthorize("@ss.hasPermission('infra:file-config:create')") + public CommonResult createFileConfig(@Valid @RequestBody FileConfigSaveReqVO createReqVO) { + return success(fileConfigService.createFileConfig(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新文件配置") + @PreAuthorize("@ss.hasPermission('infra:file-config:update')") + public CommonResult updateFileConfig(@Valid @RequestBody FileConfigSaveReqVO updateReqVO) { + fileConfigService.updateFileConfig(updateReqVO); + return success(true); + } + + @PutMapping("/update-master") + @Operation(summary = "更新文件配置为 Master") + @PreAuthorize("@ss.hasPermission('infra:file-config:update')") + public CommonResult updateFileConfigMaster(@RequestParam("id") Long id) { + fileConfigService.updateFileConfigMaster(id); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除文件配置") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('infra:file-config:delete')") + public CommonResult deleteFileConfig(@RequestParam("id") Long id) { + fileConfigService.deleteFileConfig(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得文件配置") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('infra:file-config:query')") + public CommonResult getFileConfig(@RequestParam("id") Long id) { + FileConfigDO config = fileConfigService.getFileConfig(id); + return success(BeanUtils.toBean(config, FileConfigRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得文件配置分页") + @PreAuthorize("@ss.hasPermission('infra:file-config:query')") + public CommonResult> getFileConfigPage(@Valid FileConfigPageReqVO pageVO) { + PageResult pageResult = fileConfigService.getFileConfigPage(pageVO); + return success(BeanUtils.toBean(pageResult, FileConfigRespVO.class)); + } + + @GetMapping("/test") + @Operation(summary = "测试文件配置是否正确") + @PreAuthorize("@ss.hasPermission('infra:file-config:query')") + public CommonResult testFileConfig(@RequestParam("id") Long id) throws Exception { + String url = fileConfigService.testFileConfig(id); + return success(url); + } +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/controller/FileController.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/controller/FileController.java new file mode 100644 index 0000000..72598fc --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/controller/FileController.java @@ -0,0 +1,103 @@ +package com.platform.marketing.module.infra.controller; + +import cn.hutool.core.io.IoUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.core.util.URLUtil; +import com.platform.marketing.framework.common.pojo.CommonResult; +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.common.util.object.BeanUtils; +import com.platform.marketing.module.infra.domain.dataobject.FileDO; +import com.platform.marketing.module.infra.domain.vo.*; +import com.platform.marketing.module.infra.service.FileService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.extern.slf4j.Slf4j; +import org.springframework.http.HttpStatus; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import javax.annotation.security.PermitAll; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; + +import static com.platform.marketing.framework.common.pojo.CommonResult.success; +import static com.platform.marketing.module.infra.framework.file.core.utils.FileTypeUtils.writeAttachment; + +@Tag(name = "管理后台 - 文件存储") +@RestController +@RequestMapping("/infra/file") +@Validated +@Slf4j +public class FileController { + + @Resource + private FileService fileService; + + @PostMapping("/upload") + @Operation(summary = "上传文件", description = "模式一:后端上传文件") + public CommonResult uploadFile(FileUploadReqVO uploadReqVO) throws Exception { + MultipartFile file = uploadReqVO.getFile(); + String path = uploadReqVO.getPath(); + return success(fileService.createFile(file.getOriginalFilename(), path, IoUtil.readBytes(file.getInputStream()))); + } + + @GetMapping("/presigned-url") + @Operation(summary = "获取文件预签名地址", description = "模式二:前端上传文件:用于前端直接上传七牛、阿里云 OSS 等文件存储器") + public CommonResult getFilePresignedUrl(@RequestParam("path") String path) throws Exception { + return success(fileService.getFilePresignedUrl(path)); + } + + @PostMapping("/create") + @Operation(summary = "创建文件", description = "模式二:前端上传文件:配合 presigned-url 接口,记录上传了上传的文件") + public CommonResult createFile(@Valid @RequestBody FileCreateReqVO createReqVO) { + return success(fileService.createFile(createReqVO)); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除文件") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('infra:file:delete')") + public CommonResult deleteFile(@RequestParam("id") Long id) throws Exception { + fileService.deleteFile(id); + return success(true); + } + + @GetMapping("/{configId}/get/**") + @PermitAll + @Operation(summary = "下载文件") + @Parameter(name = "configId", description = "配置编号", required = true) + public void getFileContent(HttpServletRequest request, + HttpServletResponse response, + @PathVariable("configId") Long configId) throws Exception { + // 获取请求的路径 + String path = StrUtil.subAfter(request.getRequestURI(), "/get/", false); + if (StrUtil.isEmpty(path)) { + throw new IllegalArgumentException("结尾的 path 路径必须传递"); + } + // 解码,解决中文路径的问题 https://gitee.com/zhijiantianya/ruoyi-vue-pro/pulls/807/ + path = URLUtil.decode(path); + + // 读取内容 + byte[] content = fileService.getFileContent(configId, path); + if (content == null) { + log.warn("[getFileContent][configId({}) path({}) 文件不存在]", configId, path); + response.setStatus(HttpStatus.NOT_FOUND.value()); + return; + } + writeAttachment(response, path, content); + } + + @GetMapping("/page") + @Operation(summary = "获得文件分页") + @PreAuthorize("@ss.hasPermission('infra:file:query')") + public CommonResult> getFilePage(@Valid FilePageReqVO pageVO) { + PageResult pageResult = fileService.getFilePage(pageVO); + return success(BeanUtils.toBean(pageResult, FileRespVO.class)); + } + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/controller/JobController.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/controller/JobController.java new file mode 100644 index 0000000..8fedc8c --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/controller/JobController.java @@ -0,0 +1,145 @@ +package com.platform.marketing.module.infra.controller; + +import com.platform.marketing.framework.common.pojo.CommonResult; +import com.platform.marketing.framework.common.pojo.PageParam; +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.common.util.object.BeanUtils; +import com.platform.marketing.framework.excel.core.util.ExcelUtils; +import com.platform.marketing.framework.quartz.core.util.CronUtils; +import com.platform.marketing.module.infra.domain.dataobject.JobDO; +import com.platform.marketing.module.infra.domain.vo.JobPageReqVO; +import com.platform.marketing.module.infra.domain.vo.JobRespVO; +import com.platform.marketing.module.infra.domain.vo.JobSaveReqVO; +import com.platform.marketing.module.infra.service.JobService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Parameters; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.quartz.SchedulerException; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; +import java.io.IOException; +import java.time.LocalDateTime; +import java.util.Collections; +import java.util.List; + +import static com.platform.marketing.framework.common.pojo.CommonResult.success; + +@Tag(name = "管理后台 - 定时任务") +@RestController +@RequestMapping("/infra/job") +@Validated +public class JobController { + + @Resource + private JobService jobService; + + @PostMapping("/create") + @Operation(summary = "创建定时任务") + @PreAuthorize("@ss.hasPermission('infra:job:create')") + public CommonResult createJob(@Valid @RequestBody JobSaveReqVO createReqVO) + throws SchedulerException { + return success(jobService.createJob(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新定时任务") + @PreAuthorize("@ss.hasPermission('infra:job:update')") + public CommonResult updateJob(@Valid @RequestBody JobSaveReqVO updateReqVO) + throws SchedulerException { + jobService.updateJob(updateReqVO); + return success(true); + } + + @PutMapping("/update-status") + @Operation(summary = "更新定时任务的状态") + @Parameters({ + @Parameter(name = "id", description = "编号", required = true, example = "1024"), + @Parameter(name = "status", description = "状态", required = true, example = "1"), + }) + @PreAuthorize("@ss.hasPermission('infra:job:update')") + public CommonResult updateJobStatus(@RequestParam(value = "id") Long id, @RequestParam("status") Integer status) + throws SchedulerException { + jobService.updateJobStatus(id, status); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除定时任务") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('infra:job:delete')") + public CommonResult deleteJob(@RequestParam("id") Long id) + throws SchedulerException { + jobService.deleteJob(id); + return success(true); + } + + @PutMapping("/trigger") + @Operation(summary = "触发定时任务") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('infra:job:trigger')") + public CommonResult triggerJob(@RequestParam("id") Long id) throws SchedulerException { + jobService.triggerJob(id); + return success(true); + } + + @PostMapping("/sync") + @Operation(summary = "同步定时任务") + @PreAuthorize("@ss.hasPermission('infra:job:create')") + public CommonResult syncJob() throws SchedulerException { + jobService.syncJob(); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得定时任务") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('infra:job:query')") + public CommonResult getJob(@RequestParam("id") Long id) { + JobDO job = jobService.getJob(id); + return success(BeanUtils.toBean(job, JobRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得定时任务分页") + @PreAuthorize("@ss.hasPermission('infra:job:query')") + public CommonResult> getJobPage(@Valid JobPageReqVO pageVO) { + PageResult pageResult = jobService.getJobPage(pageVO); + return success(BeanUtils.toBean(pageResult, JobRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出定时任务 Excel") + @PreAuthorize("@ss.hasPermission('infra:job:export')") + public void exportJobExcel(@Valid JobPageReqVO exportReqVO, + HttpServletResponse response) throws IOException { + exportReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = jobService.getJobPage(exportReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "定时任务.xls", "数据", JobRespVO.class, + BeanUtils.toBean(list, JobRespVO.class)); + } + + @GetMapping("/get_next_times") + @Operation(summary = "获得定时任务的下 n 次执行时间") + @Parameters({ + @Parameter(name = "id", description = "编号", required = true, example = "1024"), + @Parameter(name = "count", description = "数量", example = "5") + }) + @PreAuthorize("@ss.hasPermission('infra:job:query')") + public CommonResult> getJobNextTimes( + @RequestParam("id") Long id, + @RequestParam(value = "count", required = false, defaultValue = "5") Integer count) { + JobDO job = jobService.getJob(id); + if (job == null) { + return success(Collections.emptyList()); + } + return success(CronUtils.getNextTimes(job.getCronExpression(), count)); + } + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/controller/JobLogController.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/controller/JobLogController.java new file mode 100644 index 0000000..e476677 --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/controller/JobLogController.java @@ -0,0 +1,68 @@ +package com.platform.marketing.module.infra.controller; + +import com.platform.marketing.framework.common.pojo.CommonResult; +import com.platform.marketing.framework.common.pojo.PageParam; +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.common.util.object.BeanUtils; +import com.platform.marketing.framework.excel.core.util.ExcelUtils; +import com.platform.marketing.module.infra.domain.dataobject.JobLogDO; +import com.platform.marketing.module.infra.domain.vo.JobLogPageReqVO; +import com.platform.marketing.module.infra.domain.vo.JobLogRespVO; +import com.platform.marketing.module.infra.service.JobLogService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; +import java.io.IOException; +import java.util.List; + +import static com.platform.marketing.framework.common.pojo.CommonResult.success; + +@Tag(name = "管理后台 - 定时任务日志") +@RestController +@RequestMapping("/infra/job-log") +@Validated +public class JobLogController { + + @Resource + private JobLogService jobLogService; + + @GetMapping("/get") + @Operation(summary = "获得定时任务日志") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('infra:job:query')") + public CommonResult getJobLog(@RequestParam("id") Long id) { + JobLogDO jobLog = jobLogService.getJobLog(id); + return success(BeanUtils.toBean(jobLog, JobLogRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得定时任务日志分页") + @PreAuthorize("@ss.hasPermission('infra:job:query')") + public CommonResult> getJobLogPage(@Valid JobLogPageReqVO pageVO) { + PageResult pageResult = jobLogService.getJobLogPage(pageVO); + return success(BeanUtils.toBean(pageResult, JobLogRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出定时任务日志 Excel") + @PreAuthorize("@ss.hasPermission('infra:job:export')") + public void exportJobLogExcel(@Valid JobLogPageReqVO exportReqVO, + HttpServletResponse response) throws IOException { + exportReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = jobLogService.getJobLogPage(exportReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "任务日志.xls", "数据", JobLogRespVO.class, + BeanUtils.toBean(list, JobLogRespVO.class)); + } + +} \ No newline at end of file diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/convert/CodegenConvert.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/convert/CodegenConvert.java new file mode 100644 index 0000000..1856e5c --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/convert/CodegenConvert.java @@ -0,0 +1,68 @@ +package com.platform.marketing.module.infra.domain.convert; + +import com.platform.marketing.framework.common.util.collection.CollectionUtils; +import com.platform.marketing.framework.common.util.object.BeanUtils; +import com.platform.marketing.module.infra.domain.dataobject.CodegenColumnDO; +import com.platform.marketing.module.infra.domain.dataobject.CodegenTableDO; +import com.platform.marketing.module.infra.domain.vo.CodegenDetailRespVO; +import com.platform.marketing.module.infra.domain.vo.CodegenPreviewRespVO; +import com.platform.marketing.module.infra.domain.vo.column.CodegenColumnRespVO; +import com.platform.marketing.module.infra.domain.vo.table.CodegenTableRespVO; +import com.baomidou.mybatisplus.generator.config.po.TableField; +import com.baomidou.mybatisplus.generator.config.po.TableInfo; +import org.apache.ibatis.type.JdbcType; +import org.mapstruct.Mapper; +import org.mapstruct.Mapping; +import org.mapstruct.Mappings; +import org.mapstruct.Named; +import org.mapstruct.factory.Mappers; + +import java.util.List; +import java.util.Map; + +@Mapper +public interface CodegenConvert { + + CodegenConvert INSTANCE = Mappers.getMapper(CodegenConvert.class); + + // ========== TableInfo 相关 ========== + + @Mappings({ + @Mapping(source = "name", target = "tableName"), + @Mapping(source = "comment", target = "tableComment"), + }) + CodegenTableDO convert(TableInfo bean); + + List convertList(List list); + + @Mappings({ + @Mapping(source = "name", target = "columnName"), + @Mapping(source = "metaInfo.jdbcType", target = "dataType", qualifiedByName = "getDataType"), + @Mapping(source = "comment", target = "columnComment"), + @Mapping(source = "metaInfo.nullable", target = "nullable"), + @Mapping(source = "keyFlag", target = "primaryKey"), + @Mapping(source = "columnType.type", target = "javaType"), + @Mapping(source = "propertyName", target = "javaField"), + }) + CodegenColumnDO convert(TableField bean); + + @Named("getDataType") + default String getDataType(JdbcType jdbcType) { + return jdbcType.name(); + } + + // ========== 其它 ========== + + default CodegenDetailRespVO convert(CodegenTableDO table, List columns) { + CodegenDetailRespVO respVO = new CodegenDetailRespVO(); + respVO.setTable(BeanUtils.toBean(table, CodegenTableRespVO.class)); + respVO.setColumns(BeanUtils.toBean(columns, CodegenColumnRespVO.class)); + return respVO; + } + + default List convert(Map codes) { + return CollectionUtils.convertList(codes.entrySet(), + entry -> new CodegenPreviewRespVO().setFilePath(entry.getKey()).setCode(entry.getValue())); + } + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/convert/ConfigConvert.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/convert/ConfigConvert.java new file mode 100644 index 0000000..1457f0c --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/convert/ConfigConvert.java @@ -0,0 +1,28 @@ +package com.platform.marketing.module.infra.domain.convert; + +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.module.infra.domain.dataobject.ConfigDO; +import com.platform.marketing.module.infra.domain.vo.ConfigRespVO; +import com.platform.marketing.module.infra.domain.vo.ConfigSaveReqVO; +import org.mapstruct.Mapper; +import org.mapstruct.Mapping; +import org.mapstruct.factory.Mappers; + +import java.util.List; + +@Mapper +public interface ConfigConvert { + + ConfigConvert INSTANCE = Mappers.getMapper(ConfigConvert.class); + + PageResult convertPage(PageResult page); + + List convertList(List list); + + @Mapping(source = "configKey", target = "key") + ConfigRespVO convert(ConfigDO bean); + + @Mapping(source = "key", target = "configKey") + ConfigDO convert(ConfigSaveReqVO bean); + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/convert/FileConfigConvert.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/convert/FileConfigConvert.java new file mode 100644 index 0000000..90641a5 --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/convert/FileConfigConvert.java @@ -0,0 +1,22 @@ +package com.platform.marketing.module.infra.domain.convert; + +import com.platform.marketing.module.infra.domain.dataobject.FileConfigDO; +import com.platform.marketing.module.infra.domain.vo.FileConfigSaveReqVO; +import org.mapstruct.Mapper; +import org.mapstruct.Mapping; +import org.mapstruct.factory.Mappers; + +/** + * 文件配置 Convert + * + + */ +@Mapper +public interface FileConfigConvert { + + FileConfigConvert INSTANCE = Mappers.getMapper(FileConfigConvert.class); + + @Mapping(target = "config", ignore = true) + FileConfigDO convert(FileConfigSaveReqVO bean); + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/dataobject/CodegenColumnDO.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/dataobject/CodegenColumnDO.java new file mode 100644 index 0000000..4795e5f --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/dataobject/CodegenColumnDO.java @@ -0,0 +1,136 @@ +package com.platform.marketing.module.infra.domain.dataobject; + +import com.platform.marketing.framework.mybatis.core.dataobject.BaseDO; +import com.platform.marketing.module.infra.domain.enums.CodegenColumnHtmlTypeEnum; +import com.platform.marketing.module.infra.domain.enums.CodegenColumnListConditionEnum; +import com.baomidou.mybatisplus.annotation.KeySequence; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.generator.config.po.TableField; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + * 代码生成 column 字段定义 + * + + */ +@TableName(value = "infra_codegen_column", autoResultMap = true) +@KeySequence("infra_codegen_column_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = true) +public class CodegenColumnDO extends BaseDO { + + /** + * ID 编号 + */ + @TableId + private Long id; + /** + * 表编号 + *

+ * 关联 {@link CodegenTableDO#getId()} + */ + private Long tableId; + + // ========== 表相关字段 ========== + + /** + * 字段名 + * + * 关联 {@link TableField#getName()} + */ + private String columnName; + /** + * 数据库字段类型 + * + * 关联 {@link TableField.MetaInfo#getJdbcType()} + */ + private String dataType; + /** + * 字段描述 + * + * 关联 {@link TableField#getComment()} + */ + private String columnComment; + /** + * 是否允许为空 + * + * 关联 {@link TableField.MetaInfo#isNullable()} + */ + private Boolean nullable; + /** + * 是否主键 + * + * 关联 {@link TableField#isKeyFlag()} + */ + private Boolean primaryKey; + /** + * 排序 + */ + private Integer ordinalPosition; + + // ========== Java 相关字段 ========== + + /** + * Java 属性类型 + * + * 例如说 String、Boolean 等等 + * + * 关联 {@link TableField#getColumnType()} + */ + private String javaType; + /** + * Java 属性名 + * + * 关联 {@link TableField#getPropertyName()} + */ + private String javaField; + /** + * 字典类型 + *

+ * 关联 DictTypeDO 的 type 属性 + */ + private String dictType; + /** + * 数据示例,主要用于生成 Swagger 注解的 example 字段 + */ + private String example; + + // ========== CRUD 相关字段 ========== + + /** + * 是否为 Create 创建操作的字段 + */ + private Boolean createOperation; + /** + * 是否为 Update 更新操作的字段 + */ + private Boolean updateOperation; + /** + * 是否为 List 查询操作的字段 + */ + private Boolean listOperation; + /** + * List 查询操作的条件类型 + *

+ * 枚举 {@link CodegenColumnListConditionEnum} + */ + private String listOperationCondition; + /** + * 是否为 List 查询操作的返回字段 + */ + private Boolean listOperationResult; + + // ========== UI 相关字段 ========== + + /** + * 显示类型 + *

+ * 枚举 {@link CodegenColumnHtmlTypeEnum} + */ + private String htmlType; + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/dataobject/CodegenTableDO.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/dataobject/CodegenTableDO.java new file mode 100644 index 0000000..63e7a9d --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/dataobject/CodegenTableDO.java @@ -0,0 +1,157 @@ +package com.platform.marketing.module.infra.domain.dataobject; + +import com.platform.marketing.framework.mybatis.core.dataobject.BaseDO; +import com.platform.marketing.module.infra.domain.enums.CodegenFrontTypeEnum; +import com.platform.marketing.module.infra.domain.enums.CodegenSceneEnum; +import com.platform.marketing.module.infra.domain.enums.CodegenTemplateTypeEnum; +import com.baomidou.mybatisplus.annotation.KeySequence; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.generator.config.po.TableInfo; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + * 代码生成 table 表定义 + * + + */ +@TableName(value = "infra_codegen_table", autoResultMap = true) +@KeySequence("infra_codegen_table_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = true) +public class CodegenTableDO extends BaseDO { + + /** + * ID 编号 + */ + @TableId + private Long id; + + /** + * 数据源编号 + * + * 关联 {@link DataSourceConfigDO#getId()} + */ + private Long dataSourceConfigId; + /** + * 生成场景 + * + * 枚举 {@link CodegenSceneEnum} + */ + private Integer scene; + + // ========== 表相关字段 ========== + + /** + * 表名称 + * + * 关联 {@link TableInfo#getName()} + */ + private String tableName; + /** + * 表描述 + * + * 关联 {@link TableInfo#getComment()} + */ + private String tableComment; + /** + * 备注 + */ + private String remark; + + // ========== 类相关字段 ========== + + /** + * 模块名,即一级目录 + * + * 例如说,system、infra、tool 等等 + */ + private String moduleName; + /** + * 业务名,即二级目录 + * + * 例如说,user、permission、dict 等等 + */ + private String businessName; + /** + * 类名称(首字母大写) + * + * 例如说,SysUser、SysMenu、SysDictData 等等 + */ + private String className; + /** + * 类描述 + */ + private String classComment; + /** + * 作者 + */ + private String author; + + // ========== 生成相关字段 ========== + + /** + * 模板类型 + * + * 枚举 {@link CodegenTemplateTypeEnum} + */ + private Integer templateType; + /** + * 代码生成的前端类型 + * + * 枚举 {@link CodegenFrontTypeEnum} + */ + private Integer frontType; + + // ========== 菜单相关字段 ========== + + /** + * 父菜单编号 + * + * 关联 MenuDO 的 id 属性 + */ + private Long parentMenuId; + + // ========== 主子表相关字段 ========== + + /** + * 主表的编号 + * + * 关联 {@link CodegenTableDO#getId()} + */ + private Long masterTableId; + /** + * 【自己】子表关联主表的字段编号 + * + * 关联 {@link CodegenColumnDO#getId()} + */ + private Long subJoinColumnId; + /** + * 主表与子表是否一对多 + * + * true:一对多 + * false:一对一 + */ + private Boolean subJoinMany; + + // ========== 树表相关字段 ========== + + /** + * 树表的父字段编号 + * + * 关联 {@link CodegenColumnDO#getId()} + */ + private Long treeParentColumnId; + /** + * 树表的名字字段编号 + * + * 名字的用途:新增或修改时,select 框展示的字段 + * + * 关联 {@link CodegenColumnDO#getId()} + */ + private Long treeNameColumnId; + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/dataobject/ConfigDO.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/dataobject/ConfigDO.java new file mode 100644 index 0000000..92fe8b4 --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/dataobject/ConfigDO.java @@ -0,0 +1,64 @@ +package com.platform.marketing.module.infra.domain.dataobject; + +import com.platform.marketing.framework.mybatis.core.dataobject.BaseDO; +import com.platform.marketing.module.infra.domain.enums.ConfigTypeEnum; +import com.baomidou.mybatisplus.annotation.KeySequence; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +/** + * 参数配置表 + * + + */ +@TableName("infra_config") +@KeySequence("infra_config_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class ConfigDO extends BaseDO { + + /** + * 参数主键 + */ + @TableId + private Long id; + /** + * 参数分类 + */ + private String category; + /** + * 参数名称 + */ + private String name; + /** + * 参数键名 + * + * 支持多 DB 类型时,无法直接使用 key + @TableField("config_key") 来实现转换,原因是 "config_key" AS key 而存在报错 + */ + private String configKey; + /** + * 参数键值 + */ + private String value; + /** + * 参数类型 + * + * 枚举 {@link ConfigTypeEnum} + */ + private Integer type; + /** + * 是否可见 + * + * 不可见的参数,一般是敏感参数,前端不可获取 + */ + private Boolean visible; + /** + * 备注 + */ + private String remark; + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/dataobject/DataSourceConfigDO.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/dataobject/DataSourceConfigDO.java new file mode 100644 index 0000000..85a2a99 --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/dataobject/DataSourceConfigDO.java @@ -0,0 +1,48 @@ +package com.platform.marketing.module.infra.domain.dataobject; + +import com.platform.marketing.framework.mybatis.core.dataobject.BaseDO; +import com.platform.marketing.framework.mybatis.core.type.EncryptTypeHandler; +import com.baomidou.mybatisplus.annotation.KeySequence; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +/** + * 数据源配置 + * + + */ +@TableName(value = "infra_data_source_config", autoResultMap = true) +@KeySequence("infra_data_source_config_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +public class DataSourceConfigDO extends BaseDO { + + /** + * 主键编号 - Master 数据源 + */ + public static final Long ID_MASTER = 0L; + + /** + * 主键编号 + */ + private Long id; + /** + * 连接名 + */ + private String name; + + /** + * 数据源连接 + */ + private String url; + /** + * 用户名 + */ + private String username; + /** + * 密码 + */ + @TableField(typeHandler = EncryptTypeHandler.class) + private String password; + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/dataobject/FileConfigDO.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/dataobject/FileConfigDO.java new file mode 100644 index 0000000..3b7d749 --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/dataobject/FileConfigDO.java @@ -0,0 +1,111 @@ +package com.platform.marketing.module.infra.domain.dataobject; + +import cn.hutool.core.util.StrUtil; +import com.platform.marketing.framework.common.util.json.JsonUtils; +import com.platform.marketing.framework.mybatis.core.dataobject.BaseDO; +import com.platform.marketing.module.infra.framework.file.core.client.FileClientConfig; +import com.platform.marketing.module.infra.framework.file.core.client.db.DBFileClientConfig; +import com.platform.marketing.module.infra.framework.file.core.client.ftp.FtpFileClientConfig; +import com.platform.marketing.module.infra.framework.file.core.client.local.LocalFileClientConfig; +import com.platform.marketing.module.infra.framework.file.core.client.s3.S3FileClientConfig; +import com.platform.marketing.module.infra.framework.file.core.client.sftp.SftpFileClientConfig; +import com.platform.marketing.module.infra.framework.file.core.enums.FileStorageEnum; +import com.baomidou.mybatisplus.annotation.KeySequence; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.handlers.AbstractJsonTypeHandler; +import com.fasterxml.jackson.core.type.TypeReference; +import lombok.*; + +import java.lang.reflect.Field; + +/** + * 文件配置表 + * + + */ +@TableName(value = "infra_file_config", autoResultMap = true) +@KeySequence("infra_file_config_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class FileConfigDO extends BaseDO { + + /** + * 配置编号,数据库自增 + */ + private Long id; + /** + * 配置名 + */ + private String name; + /** + * 存储器 + * + * 枚举 {@link FileStorageEnum} + */ + private Integer storage; + /** + * 备注 + */ + private String remark; + /** + * 是否为主配置 + * + * 由于我们可以配置多个文件配置,默认情况下,使用主配置进行文件的上传 + */ + private Boolean master; + + /** + * 支付渠道配置 + */ + @TableField(typeHandler = FileClientConfigTypeHandler.class) + private FileClientConfig config; + + public static class FileClientConfigTypeHandler extends AbstractJsonTypeHandler { + + public FileClientConfigTypeHandler(Class type) { + super(type); + } + + public FileClientConfigTypeHandler(Class type, Field field) { + super(type, field); + } + + @Override + public Object parse(String json) { + FileClientConfig config = JsonUtils.parseObjectQuietly(json, new TypeReference() {}); + if (config != null) { + return config; + } + + // 兼容老版本的包路径 + String className = JsonUtils.parseObject(json, "@class", String.class); + className = StrUtil.subAfter(className, ".", true); + switch (className) { + case "DBFileClientConfig": + return JsonUtils.parseObject2(json, DBFileClientConfig.class); + case "FtpFileClientConfig": + return JsonUtils.parseObject2(json, FtpFileClientConfig.class); + case "LocalFileClientConfig": + return JsonUtils.parseObject2(json, LocalFileClientConfig.class); + case "SftpFileClientConfig": + return JsonUtils.parseObject2(json, SftpFileClientConfig.class); + case "S3FileClientConfig": + return JsonUtils.parseObject2(json, S3FileClientConfig.class); + default: + throw new IllegalArgumentException("未知的 FileClientConfig 类型:" + json); + } + } + + @Override + public String toJson(Object obj) { + return JsonUtils.toJsonString(obj); + } + + } + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/dataobject/FileContentDO.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/dataobject/FileContentDO.java new file mode 100644 index 0000000..5740b46 --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/dataobject/FileContentDO.java @@ -0,0 +1,47 @@ +package com.platform.marketing.module.infra.domain.dataobject; + +import com.platform.marketing.framework.mybatis.core.dataobject.BaseDO; +import com.platform.marketing.module.infra.framework.file.core.client.db.DBFileClient; +import com.baomidou.mybatisplus.annotation.KeySequence; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.*; + +/** + * 文件内容表 + * + * 专门用于存储 {@link DBFileClient} 的文件内容 + * + + */ +@TableName("infra_file_content") +@KeySequence("infra_file_content_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class FileContentDO extends BaseDO { + + /** + * 编号,数据库自增 + */ + @TableId + private Long id; + /** + * 配置编号 + * + * 关联 {@link FileConfigDO#getId()} + */ + private Long configId; + /** + * 路径,即文件名 + */ + private String path; + /** + * 文件内容 + */ + private byte[] content; + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/dataobject/FileDO.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/dataobject/FileDO.java new file mode 100644 index 0000000..39f3cd9 --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/dataobject/FileDO.java @@ -0,0 +1,55 @@ +package com.platform.marketing.module.infra.domain.dataobject; + +import com.platform.marketing.framework.mybatis.core.dataobject.BaseDO; +import com.baomidou.mybatisplus.annotation.KeySequence; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.*; + +/** + * 文件表 + * 每次文件上传,都会记录一条记录到该表中 + * + + */ +@TableName("infra_file") +@KeySequence("infra_file_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class FileDO extends BaseDO { + + /** + * 编号,数据库自增 + */ + private Long id; + /** + * 配置编号 + * + * 关联 {@link FileConfigDO#getId()} + */ + private Long configId; + /** + * 原文件名 + */ + private String name; + /** + * 路径,即文件名 + */ + private String path; + /** + * 访问地址 + */ + private String url; + /** + * 文件的 MIME 类型,例如 "application/octet-stream" + */ + private String type; + /** + * 文件大小 + */ + private Integer size; + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/dataobject/JobDO.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/dataobject/JobDO.java new file mode 100644 index 0000000..12845d9 --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/dataobject/JobDO.java @@ -0,0 +1,74 @@ +package com.platform.marketing.module.infra.domain.dataobject; + +import com.platform.marketing.framework.mybatis.core.dataobject.BaseDO; +import com.platform.marketing.module.infra.domain.enums.JobStatusEnum; +import com.baomidou.mybatisplus.annotation.KeySequence; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.*; + +/** + * 定时任务 DO + * + + */ +@TableName("infra_job") +@KeySequence("infra_job_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class JobDO extends BaseDO { + + /** + * 任务编号 + */ + @TableId + private Long id; + /** + * 任务名称 + */ + private String name; + /** + * 任务状态 + * + * 枚举 {@link JobStatusEnum} + */ + private Integer status; + /** + * 处理器的名字 + */ + private String handlerName; + /** + * 处理器的参数 + */ + private String handlerParam; + /** + * CRON 表达式 + */ + private String cronExpression; + + // ========== 重试相关字段 ========== + /** + * 重试次数 + * 如果不重试,则设置为 0 + */ + private Integer retryCount; + /** + * 重试间隔,单位:毫秒 + * 如果没有间隔,则设置为 0 + */ + private Integer retryInterval; + + // ========== 监控相关字段 ========== + /** + * 监控超时时间,单位:毫秒 + * 为空时,表示不监控 + * + * 注意,这里的超时的目的,不是进行任务的取消,而是告警任务的执行时间过长 + */ + private Integer monitorTimeout; + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/dataobject/JobLogDO.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/dataobject/JobLogDO.java new file mode 100644 index 0000000..eaf079e --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/dataobject/JobLogDO.java @@ -0,0 +1,82 @@ +package com.platform.marketing.module.infra.domain.dataobject; + +import com.platform.marketing.framework.mybatis.core.dataobject.BaseDO; +import com.platform.marketing.framework.quartz.core.handler.JobHandler; +import com.platform.marketing.module.infra.domain.enums.JobLogStatusEnum; +import com.baomidou.mybatisplus.annotation.KeySequence; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.*; + +import java.time.LocalDateTime; + +/** + * 定时任务的执行日志 + * + + */ +@TableName("infra_job_log") +@KeySequence("infra_job_log_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class JobLogDO extends BaseDO { + + /** + * 日志编号 + */ + private Long id; + /** + * 任务编号 + * + * 关联 {@link JobDO#getId()} + */ + private Long jobId; + /** + * 处理器的名字 + * + * 冗余字段 {@link JobDO#getHandlerName()} + */ + private String handlerName; + /** + * 处理器的参数 + * + * 冗余字段 {@link JobDO#getHandlerParam()} + */ + private String handlerParam; + /** + * 第几次执行 + * + * 用于区分是不是重试执行。如果是重试执行,则 index 大于 1 + */ + private Integer executeIndex; + + /** + * 开始执行时间 + */ + private LocalDateTime beginTime; + /** + * 结束执行时间 + */ + private LocalDateTime endTime; + /** + * 执行时长,单位:毫秒 + */ + private Integer duration; + /** + * 状态 + * + * 枚举 {@link JobLogStatusEnum} + */ + private Integer status; + /** + * 结果数据 + * + * 成功时,使用 {@link JobHandler#execute(String)} 的结果 + * 失败时,使用 {@link JobHandler#execute(String)} 的异常堆栈 + */ + private String result; + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/enums/ApiErrorLogProcessStatusEnum.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/enums/ApiErrorLogProcessStatusEnum.java new file mode 100644 index 0000000..dc84b8d --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/enums/ApiErrorLogProcessStatusEnum.java @@ -0,0 +1,28 @@ +package com.platform.marketing.module.infra.domain.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * API 异常数据的处理状态 + * + + */ +@AllArgsConstructor +@Getter +public enum ApiErrorLogProcessStatusEnum { + + INIT(0, "未处理"), + DONE(1, "已处理"), + IGNORE(2, "已忽略"); + + /** + * 状态 + */ + private final Integer status; + /** + * 资源类型名 + */ + private final String name; + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/enums/CodegenColumnHtmlTypeEnum.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/enums/CodegenColumnHtmlTypeEnum.java new file mode 100644 index 0000000..2989f14 --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/enums/CodegenColumnHtmlTypeEnum.java @@ -0,0 +1,29 @@ +package com.platform.marketing.module.infra.domain.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * 代码生成器的字段 HTML 展示枚举 + */ +@AllArgsConstructor +@Getter +public enum CodegenColumnHtmlTypeEnum { + + INPUT("input"), // 文本框 + TEXTAREA("textarea"), // 文本域 + SELECT("select"), // 下拉框 + RADIO("radio"), // 单选框 + CHECKBOX("checkbox"), // 复选框 + DATETIME("datetime"), // 日期控件 + IMAGE_UPLOAD("imageUpload"), // 上传图片 + FILE_UPLOAD("fileUpload"), // 上传文件 + EDITOR("editor"), // 富文本控件 + ; + + /** + * 条件 + */ + private final String type; + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/enums/CodegenColumnListConditionEnum.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/enums/CodegenColumnListConditionEnum.java new file mode 100644 index 0000000..f3be993 --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/enums/CodegenColumnListConditionEnum.java @@ -0,0 +1,27 @@ +package com.platform.marketing.module.infra.domain.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * 代码生成器的字段过滤条件枚举 + */ +@AllArgsConstructor +@Getter +public enum CodegenColumnListConditionEnum { + + EQ("="), + NE("!="), + GT(">"), + GTE(">="), + LT("<"), + LTE("<="), + LIKE("LIKE"), + BETWEEN("BETWEEN"); + + /** + * 条件 + */ + private final String condition; + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/enums/CodegenFrontTypeEnum.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/enums/CodegenFrontTypeEnum.java new file mode 100644 index 0000000..32c3ab9 --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/enums/CodegenFrontTypeEnum.java @@ -0,0 +1,34 @@ +package com.platform.marketing.module.infra.domain.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * 代码生成的前端类型枚举 + * + * @author 芋道源码 + */ +@AllArgsConstructor +@Getter +public enum CodegenFrontTypeEnum { + + VUE2_ELEMENT_UI(10), // Vue2 Element UI 标准模版 + + VUE3_ELEMENT_PLUS(20), // Vue3 Element Plus 标准模版 + + VUE3_VBEN2_ANTD_SCHEMA(30), // Vue3 VBEN2 + ANTD + Schema 模版 + + VUE3_VBEN5_ANTD_SCHEMA(40), // Vue3 VBEN5 + ANTD + schema 模版 + VUE3_VBEN5_ANTD_GENERAL(41), // Vue3 VBEN5 + ANTD 标准模版 + + // TODO @puhui999::50、51 会好点; + VUE3_VBEN5_EP_SCHEMA(42), // Vue3 VBEN5 + EP + schema 模版 + VUE3_VBEN5_EP_GENERAL(43), // Vue3 VBEN5 + EP 标准模版 + ; + + /** + * 类型 + */ + private final Integer type; + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/enums/CodegenSceneEnum.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/enums/CodegenSceneEnum.java new file mode 100644 index 0000000..04880e4 --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/enums/CodegenSceneEnum.java @@ -0,0 +1,41 @@ +package com.platform.marketing.module.infra.domain.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +import static cn.hutool.core.util.ArrayUtil.firstMatch; + +/** + * 代码生成的场景枚举 + * + * @author 芋道源码 + */ +@AllArgsConstructor +@Getter +public enum CodegenSceneEnum { + + ADMIN(1, "管理后台", "admin", ""), + APP(2, "用户 APP", "app", "App"); + + /** + * 场景 + */ + private final Integer scene; + /** + * 场景名 + */ + private final String name; + /** + * 基础包名 + */ + private final String basePackage; + /** + * Controller 和 VO 类的前缀 + */ + private final String prefixClass; + + public static CodegenSceneEnum valueOf(Integer scene) { + return firstMatch(sceneEnum -> sceneEnum.getScene().equals(scene), values()); + } + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/enums/CodegenTemplateTypeEnum.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/enums/CodegenTemplateTypeEnum.java new file mode 100644 index 0000000..6768793 --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/enums/CodegenTemplateTypeEnum.java @@ -0,0 +1,53 @@ +package com.platform.marketing.module.infra.domain.enums; + +import com.platform.marketing.framework.common.util.object.ObjectUtils; +import lombok.AllArgsConstructor; +import lombok.Getter; + +import java.util.Objects; + +/** + * 代码生成模板类型 + * + * @author 芋道源码 + */ +@AllArgsConstructor +@Getter +public enum CodegenTemplateTypeEnum { + + ONE(1), // 单表(增删改查) + TREE(2), // 树表(增删改查) + + MASTER_NORMAL(10), // 主子表 - 主表 - 普通模式 + MASTER_ERP(11), // 主子表 - 主表 - ERP 模式 + MASTER_INNER(12), // 主子表 - 主表 - 内嵌模式 + SUB(15), // 主子表 - 子表 + ; + + /** + * 类型 + */ + private final Integer type; + + /** + * 是否为主表 + * + * @param type 类型 + * @return 是否主表 + */ + public static boolean isMaster(Integer type) { + return ObjectUtils.equalsAny(type, + MASTER_NORMAL.type, MASTER_ERP.type, MASTER_INNER.type); + } + + /** + * 是否为树表 + * + * @param type 类型 + * @return 是否树表 + */ + public static boolean isTree(Integer type) { + return Objects.equals(type, TREE.type); + } + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/enums/CodegenVOTypeEnum.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/enums/CodegenVOTypeEnum.java new file mode 100644 index 0000000..86e63bb --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/enums/CodegenVOTypeEnum.java @@ -0,0 +1,30 @@ +package com.platform.marketing.module.infra.domain.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * 代码生成的 VO 类型枚举 + * + * 目前的作用:Controller 新增、修改、响应时,使用 VO 还是 DO + * 注意:不包括 Controller 的分页参数! + * + * @author 芋道源码 + */ +@AllArgsConstructor +@Getter +public enum CodegenVOTypeEnum { + + VO(10, "VO"), + DO(20, "DO"); + + /** + * 场景 + */ + private final Integer type; + /** + * 场景名 + */ + private final String name; + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/enums/ConfigTypeEnum.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/enums/ConfigTypeEnum.java new file mode 100644 index 0000000..f8bf206 --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/enums/ConfigTypeEnum.java @@ -0,0 +1,21 @@ +package com.platform.marketing.module.infra.domain.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +@Getter +@AllArgsConstructor +public enum ConfigTypeEnum { + + /** + * 系统配置 + */ + SYSTEM(1), + /** + * 自定义配置 + */ + CUSTOM(2); + + private final Integer type; + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/enums/DictTypeConstants.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/enums/DictTypeConstants.java new file mode 100644 index 0000000..4b24e44 --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/enums/DictTypeConstants.java @@ -0,0 +1,19 @@ +package com.platform.marketing.module.infra.domain.enums; + +/** + * Infra 字典类型的枚举类 + * + */ +public interface DictTypeConstants { + + String JOB_STATUS = "infra_job_status"; // 定时任务状态的枚举 + String JOB_LOG_STATUS = "infra_job_log_status"; // 定时任务日志状态的枚举 + + String API_ERROR_LOG_PROCESS_STATUS = "infra_api_error_log_process_status"; // API 错误日志的处理状态的枚举 + + String CONFIG_TYPE = "infra_config_type"; // 参数配置类型 + String BOOLEAN_STRING = "infra_boolean_string"; // Boolean 是否类型 + + String OPERATE_TYPE = "infra_operate_type"; // 操作类型 + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/enums/ErrorCodeConstants.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/enums/ErrorCodeConstants.java new file mode 100644 index 0000000..2632f28 --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/enums/ErrorCodeConstants.java @@ -0,0 +1,59 @@ +package com.platform.marketing.module.infra.domain.enums; + +import com.platform.marketing.framework.common.exception.ErrorCode; + +/** + * Infra 错误码枚举类 + * + * infra 系统,使用 1-001-000-000 段 + */ +public interface ErrorCodeConstants { + + // ========== 参数配置 1-001-000-000 ========== + ErrorCode CONFIG_NOT_EXISTS = new ErrorCode(1_001_000_001, "参数配置不存在"); + ErrorCode CONFIG_KEY_DUPLICATE = new ErrorCode(1_001_000_002, "参数配置 key 重复"); + ErrorCode CONFIG_CAN_NOT_DELETE_SYSTEM_TYPE = new ErrorCode(1_001_000_003, "不能删除类型为系统内置的参数配置"); + ErrorCode CONFIG_GET_VALUE_ERROR_IF_VISIBLE = new ErrorCode(1_001_000_004, "获取参数配置失败,原因:不允许获取不可见配置"); + + // ========== 定时任务 1-001-001-000 ========== + ErrorCode JOB_NOT_EXISTS = new ErrorCode(1_001_001_000, "定时任务不存在"); + ErrorCode JOB_HANDLER_EXISTS = new ErrorCode(1_001_001_001, "定时任务的处理器已经存在"); + ErrorCode JOB_CHANGE_STATUS_INVALID = new ErrorCode(1_001_001_002, "只允许修改为开启或者关闭状态"); + ErrorCode JOB_CHANGE_STATUS_EQUALS = new ErrorCode(1_001_001_003, "定时任务已经处于该状态,无需修改"); + ErrorCode JOB_UPDATE_ONLY_NORMAL_STATUS = new ErrorCode(1_001_001_004, "只有开启状态的任务,才可以修改"); + ErrorCode JOB_CRON_EXPRESSION_VALID = new ErrorCode(1_001_001_005, "CRON 表达式不正确"); + ErrorCode JOB_HANDLER_BEAN_NOT_EXISTS = new ErrorCode(1_001_001_006, "定时任务的处理器 Bean 不存在,注意 Bean 默认首字母小写"); + ErrorCode JOB_HANDLER_BEAN_TYPE_ERROR = new ErrorCode(1_001_001_007, "定时任务的处理器 Bean 类型不正确,未实现 JobHandler 接口"); + + // ========== API 错误日志 1-001-002-000 ========== + ErrorCode API_ERROR_LOG_NOT_FOUND = new ErrorCode(1_001_002_000, "API 错误日志不存在"); + ErrorCode API_ERROR_LOG_PROCESSED = new ErrorCode(1_001_002_001, "API 错误日志已处理"); + + // ========= 文件相关 1-001-003-000 ================= + ErrorCode FILE_PATH_EXISTS = new ErrorCode(1_001_003_000, "文件路径已存在"); + ErrorCode FILE_NOT_EXISTS = new ErrorCode(1_001_003_001, "文件不存在"); + ErrorCode FILE_IS_EMPTY = new ErrorCode(1_001_003_002, "文件为空"); + + // ========== 代码生成器 1-001-004-000 ========== + ErrorCode CODEGEN_TABLE_EXISTS = new ErrorCode(1_001_004_002, "表定义已经存在"); + ErrorCode CODEGEN_IMPORT_TABLE_NULL = new ErrorCode(1_001_004_001, "导入的表不存在"); + ErrorCode CODEGEN_IMPORT_COLUMNS_NULL = new ErrorCode(1_001_004_002, "导入的字段不存在"); + ErrorCode CODEGEN_TABLE_NOT_EXISTS = new ErrorCode(1_001_004_004, "表定义不存在"); + ErrorCode CODEGEN_COLUMN_NOT_EXISTS = new ErrorCode(1_001_004_005, "字段义不存在"); + ErrorCode CODEGEN_SYNC_COLUMNS_NULL = new ErrorCode(1_001_004_006, "同步的字段不存在"); + ErrorCode CODEGEN_SYNC_NONE_CHANGE = new ErrorCode(1_001_004_007, "同步失败,不存在改变"); + ErrorCode CODEGEN_TABLE_INFO_TABLE_COMMENT_IS_NULL = new ErrorCode(1_001_004_008, "数据库的表注释未填写"); + ErrorCode CODEGEN_TABLE_INFO_COLUMN_COMMENT_IS_NULL = new ErrorCode(1_001_004_009, "数据库的表字段({})注释未填写"); + ErrorCode CODEGEN_MASTER_TABLE_NOT_EXISTS = new ErrorCode(1_001_004_010, "主表(id={})定义不存在,请检查"); + ErrorCode CODEGEN_SUB_COLUMN_NOT_EXISTS = new ErrorCode(1_001_004_011, "子表的字段(id={})不存在,请检查"); + ErrorCode CODEGEN_MASTER_GENERATION_FAIL_NO_SUB_TABLE = new ErrorCode(1_001_004_012, "主表生成代码失败,原因:它没有子表"); + + // ========== 文件配置 1-001-006-000 ========== + ErrorCode FILE_CONFIG_NOT_EXISTS = new ErrorCode(1_001_006_000, "文件配置不存在"); + ErrorCode FILE_CONFIG_DELETE_FAIL_MASTER = new ErrorCode(1_001_006_001, "该文件配置不允许删除,原因:它是主配置,删除会导致无法上传文件"); + + // ========== 数据源配置 1-001-007-000 ========== + ErrorCode DATA_SOURCE_CONFIG_NOT_EXISTS = new ErrorCode(1_001_007_000, "数据源配置不存在"); + ErrorCode DATA_SOURCE_CONFIG_NOT_OK = new ErrorCode(1_001_007_001, "数据源配置不正确,无法进行连接"); + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/enums/JobLogStatusEnum.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/enums/JobLogStatusEnum.java new file mode 100644 index 0000000..53b8346 --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/enums/JobLogStatusEnum.java @@ -0,0 +1,24 @@ +package com.platform.marketing.module.infra.domain.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * 任务日志的状态枚举 + * + + */ +@Getter +@AllArgsConstructor +public enum JobLogStatusEnum { + + RUNNING(0), // 运行中 + SUCCESS(1), // 成功 + FAILURE(2); // 失败 + + /** + * 状态 + */ + private final Integer status; + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/enums/JobStatusEnum.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/enums/JobStatusEnum.java new file mode 100644 index 0000000..47b5a6d --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/enums/JobStatusEnum.java @@ -0,0 +1,42 @@ +package com.platform.marketing.module.infra.domain.enums; + +import com.google.common.collect.Sets; +import lombok.AllArgsConstructor; +import lombok.Getter; +import org.quartz.impl.jdbcjobstore.Constants; + +import java.util.Collections; +import java.util.Set; + +/** + * 任务状态的枚举 + * + + */ +@Getter +@AllArgsConstructor +public enum JobStatusEnum { + + /** + * 初始化中 + */ + INIT(0, Collections.emptySet()), + /** + * 开启 + */ + NORMAL(1, Sets.newHashSet(Constants.STATE_WAITING, Constants.STATE_ACQUIRED, Constants.STATE_BLOCKED)), + /** + * 暂停 + */ + STOP(2, Sets.newHashSet(Constants.STATE_PAUSED, Constants.STATE_PAUSED_BLOCKED)); + + /** + * 状态 + */ + private final Integer status; + /** + * 对应的 Quartz 触发器的状态集合 + */ + private final Set quartzStates; + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/enums/package-info.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/enums/package-info.java new file mode 100644 index 0000000..7efd09e --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/enums/package-info.java @@ -0,0 +1,4 @@ +/** + * 占位 + */ +package com.platform.marketing.module.infra.domain.enums; diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/AppFileUploadReqVO.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/AppFileUploadReqVO.java new file mode 100644 index 0000000..f72c3a1 --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/AppFileUploadReqVO.java @@ -0,0 +1,20 @@ +package com.platform.marketing.module.infra.domain.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import org.springframework.web.multipart.MultipartFile; + +import javax.validation.constraints.NotNull; + +@Schema(description = "用户 App - 上传文件 Request VO") +@Data +public class AppFileUploadReqVO { + + @Schema(description = "文件附件", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "文件附件不能为空") + private MultipartFile file; + + @Schema(description = "文件附件", example = "marketingyuanma.png") + private String path; + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/CodegenCreateListReqVO.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/CodegenCreateListReqVO.java new file mode 100644 index 0000000..39f3e5f --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/CodegenCreateListReqVO.java @@ -0,0 +1,21 @@ +package com.platform.marketing.module.infra.domain.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.util.List; + +@Schema(description = "管理后台 - 基于数据库的表结构,创建代码生成器的表和字段定义 Request VO") +@Data +public class CodegenCreateListReqVO { + + @Schema(description = "数据源配置的编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @NotNull(message = "数据源配置的编号不能为空") + private Long dataSourceConfigId; + + @Schema(description = "表名数组", requiredMode = Schema.RequiredMode.REQUIRED, example = "[1, 2, 3]") + @NotNull(message = "表名数组不能为空") + private List tableNames; + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/CodegenDetailRespVO.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/CodegenDetailRespVO.java new file mode 100644 index 0000000..024631f --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/CodegenDetailRespVO.java @@ -0,0 +1,20 @@ +package com.platform.marketing.module.infra.domain.vo; + +import com.platform.marketing.module.infra.domain.vo.column.CodegenColumnRespVO; +import com.platform.marketing.module.infra.domain.vo.table.CodegenTableRespVO; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.util.List; + +@Schema(description = "管理后台 - 代码生成表和字段的明细 Response VO") +@Data +public class CodegenDetailRespVO { + + @Schema(description = "表定义") + private CodegenTableRespVO table; + + @Schema(description = "字段定义") + private List columns; + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/CodegenPreviewRespVO.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/CodegenPreviewRespVO.java new file mode 100644 index 0000000..a0e0ad8 --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/CodegenPreviewRespVO.java @@ -0,0 +1,16 @@ +package com.platform.marketing.module.infra.domain.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Schema(description = "管理后台 - 代码生成预览 Response VO,注意,每个文件都是一个该对象") +@Data +public class CodegenPreviewRespVO { + + @Schema(description = "文件路径", requiredMode = Schema.RequiredMode.REQUIRED, example = "java/com.platform.marketing/adminserver/modules/system/controller/test/SysTestDemoController.java") + private String filePath; + + @Schema(description = "代码", requiredMode = Schema.RequiredMode.REQUIRED, example = "Hello World") + private String code; + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/CodegenUpdateReqVO.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/CodegenUpdateReqVO.java new file mode 100644 index 0000000..10afdeb --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/CodegenUpdateReqVO.java @@ -0,0 +1,24 @@ +package com.platform.marketing.module.infra.domain.vo; + +import com.platform.marketing.module.infra.domain.vo.column.CodegenColumnSaveReqVO; +import com.platform.marketing.module.infra.domain.vo.table.CodegenTableSaveReqVO; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import javax.validation.Valid; +import javax.validation.constraints.NotNull; +import java.util.List; + +@Schema(description = "管理后台 - 代码生成表和字段的修改 Request VO") +@Data +public class CodegenUpdateReqVO { + + @Valid // 校验内嵌的字段 + @NotNull(message = "表定义不能为空") + private CodegenTableSaveReqVO table; + + @Valid // 校验内嵌的字段 + @NotNull(message = "字段定义不能为空") + private List columns; + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/ConfigPageReqVO.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/ConfigPageReqVO.java new file mode 100644 index 0000000..2fa7cff --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/ConfigPageReqVO.java @@ -0,0 +1,33 @@ +package com.platform.marketing.module.infra.domain.vo; + +import com.platform.marketing.framework.common.pojo.PageParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; +import org.springframework.format.annotation.DateTimeFormat; + +import java.time.LocalDateTime; + +import static com.platform.marketing.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 参数配置分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class ConfigPageReqVO extends PageParam { + + @Schema(description = "数据源名称,模糊匹配", example = "名称") + private String name; + + @Schema(description = "参数键名,模糊匹配", example = "yunai.db.username") + private String key; + + @Schema(description = "参数类型,参见 SysConfigTypeEnum 枚举", example = "1") + private Integer type; + + @Schema(description = "创建时间", example = "[2022-07-01 00:00:00,2022-07-01 23:59:59]") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/ConfigRespVO.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/ConfigRespVO.java new file mode 100644 index 0000000..519b93f --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/ConfigRespVO.java @@ -0,0 +1,56 @@ +package com.platform.marketing.module.infra.domain.vo; + +import com.platform.marketing.framework.excel.core.annotations.DictFormat; +import com.platform.marketing.framework.excel.core.convert.DictConvert; +import com.platform.marketing.module.infra.domain.enums.DictTypeConstants; +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Schema(description = "管理后台 - 参数配置信息 Response VO") +@Data +@ExcelIgnoreUnannotated +public class ConfigRespVO { + + @Schema(description = "参数配置序号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") + @ExcelProperty("参数配置序号") + private Long id; + + @Schema(description = "参数分类", requiredMode = Schema.RequiredMode.REQUIRED, example = "biz") + @ExcelProperty("参数分类") + private String category; + + @Schema(description = "参数名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "数据库名") + @ExcelProperty("参数名称") + private String name; + + @Schema(description = "参数键名", requiredMode = Schema.RequiredMode.REQUIRED, example = "yunai.db.username") + @ExcelProperty("参数键名") + private String key; + + @Schema(description = "参数键值", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") + @ExcelProperty("参数键值") + private String value; + + @Schema(description = "参数类型,参见 SysConfigTypeEnum 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @ExcelProperty(value = "参数类型", converter = DictConvert.class) + @DictFormat(DictTypeConstants.CONFIG_TYPE) + private Integer type; + + @Schema(description = "是否可见", requiredMode = Schema.RequiredMode.REQUIRED, example = "true") + @ExcelProperty(value = "是否可见", converter = DictConvert.class) + @DictFormat(DictTypeConstants.BOOLEAN_STRING) + private Boolean visible; + + @Schema(description = "备注", example = "备注一下很帅气!") + @ExcelProperty("备注") + private String remark; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "时间戳格式") + @ExcelProperty("创建时间") + private LocalDateTime createTime; + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/ConfigSaveReqVO.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/ConfigSaveReqVO.java new file mode 100644 index 0000000..13e142f --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/ConfigSaveReqVO.java @@ -0,0 +1,45 @@ +package com.platform.marketing.module.infra.domain.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; + +@Schema(description = "管理后台 - 参数配置创建/修改 Request VO") +@Data +public class ConfigSaveReqVO { + + @Schema(description = "参数配置序号", example = "1024") + private Long id; + + @Schema(description = "参数分组", requiredMode = Schema.RequiredMode.REQUIRED, example = "biz") + @NotEmpty(message = "参数分组不能为空") + @Size(max = 50, message = "参数名称不能超过 50 个字符") + private String category; + + @Schema(description = "参数名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "数据库名") + @NotBlank(message = "参数名称不能为空") + @Size(max = 100, message = "参数名称不能超过 100 个字符") + private String name; + + @Schema(description = "参数键名", requiredMode = Schema.RequiredMode.REQUIRED, example = "yunai.db.username") + @NotBlank(message = "参数键名长度不能为空") + @Size(max = 100, message = "参数键名长度不能超过 100 个字符") + private String key; + + @Schema(description = "参数键值", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") + @NotBlank(message = "参数键值不能为空") + @Size(max = 500, message = "参数键值长度不能超过 500 个字符") + private String value; + + @Schema(description = "是否可见", requiredMode = Schema.RequiredMode.REQUIRED, example = "true") + @NotNull(message = "是否可见不能为空") + private Boolean visible; + + @Schema(description = "备注", example = "备注一下很帅气!") + private String remark; + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/DataSourceConfigRespVO.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/DataSourceConfigRespVO.java new file mode 100644 index 0000000..6d1ed8c --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/DataSourceConfigRespVO.java @@ -0,0 +1,27 @@ +package com.platform.marketing.module.infra.domain.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Schema(description = "管理后台 - 数据源配置 Response VO") +@Data +public class DataSourceConfigRespVO { + + @Schema(description = "主键编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") + private Integer id; + + @Schema(description = "数据源名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "test") + private String name; + + @Schema(description = "数据源连接", requiredMode = Schema.RequiredMode.REQUIRED, example = "jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro") + private String url; + + @Schema(description = "用户名", requiredMode = Schema.RequiredMode.REQUIRED, example = "root") + private String username; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + private LocalDateTime createTime; + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/DataSourceConfigSaveReqVO.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/DataSourceConfigSaveReqVO.java new file mode 100644 index 0000000..1e18907 --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/DataSourceConfigSaveReqVO.java @@ -0,0 +1,31 @@ +package com.platform.marketing.module.infra.domain.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import javax.validation.constraints.NotNull; + +@Schema(description = "管理后台 - 数据源配置创建/修改 Request VO") +@Data +public class DataSourceConfigSaveReqVO { + + @Schema(description = "主键编号", example = "1024") + private Long id; + + @Schema(description = "数据源名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "test") + @NotNull(message = "数据源名称不能为空") + private String name; + + @Schema(description = "数据源连接", requiredMode = Schema.RequiredMode.REQUIRED, example = "jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro") + @NotNull(message = "数据源连接不能为空") + private String url; + + @Schema(description = "用户名", requiredMode = Schema.RequiredMode.REQUIRED, example = "root") + @NotNull(message = "用户名不能为空") + private String username; + + @Schema(description = "密码", requiredMode = Schema.RequiredMode.REQUIRED, example = "123456") + @NotNull(message = "密码不能为空") + private String password; + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/FileConfigPageReqVO.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/FileConfigPageReqVO.java new file mode 100644 index 0000000..cbd489f --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/FileConfigPageReqVO.java @@ -0,0 +1,30 @@ +package com.platform.marketing.module.infra.domain.vo; + +import com.platform.marketing.framework.common.pojo.PageParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; +import org.springframework.format.annotation.DateTimeFormat; + +import java.time.LocalDateTime; + +import static com.platform.marketing.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 文件配置分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class FileConfigPageReqVO extends PageParam { + + @Schema(description = "配置名", example = "S3 - 阿里云") + private String name; + + @Schema(description = "存储器", example = "1") + private Integer storage; + + @Schema(description = "创建时间", example = "[2022-07-01 00:00:00, 2022-07-01 23:59:59]") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + +} \ No newline at end of file diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/FileConfigRespVO.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/FileConfigRespVO.java new file mode 100644 index 0000000..9a8af53 --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/FileConfigRespVO.java @@ -0,0 +1,34 @@ +package com.platform.marketing.module.infra.domain.vo; + +import com.platform.marketing.module.infra.framework.file.core.client.FileClientConfig; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Schema(description = "管理后台 - 文件配置 Response VO") +@Data +public class FileConfigRespVO { + + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + private Long id; + + @Schema(description = "配置名", requiredMode = Schema.RequiredMode.REQUIRED, example = "S3 - 阿里云") + private String name; + + @Schema(description = "存储器,参见 FileStorageEnum 枚举类", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + private Integer storage; + + @Schema(description = "是否为主配置", requiredMode = Schema.RequiredMode.REQUIRED, example = "true") + private Boolean master; + + @Schema(description = "存储配置", requiredMode = Schema.RequiredMode.REQUIRED) + private FileClientConfig config; + + @Schema(description = "备注", example = "我是备注") + private String remark; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + private LocalDateTime createTime; + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/FileConfigSaveReqVO.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/FileConfigSaveReqVO.java new file mode 100644 index 0000000..ba3ddd5 --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/FileConfigSaveReqVO.java @@ -0,0 +1,31 @@ +package com.platform.marketing.module.infra.domain.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.util.Map; + +@Schema(description = "管理后台 - 文件配置创建/修改 Request VO") +@Data +public class FileConfigSaveReqVO { + + @Schema(description = "编号", example = "1") + private Long id; + + @Schema(description = "配置名", requiredMode = Schema.RequiredMode.REQUIRED, example = "S3 - 阿里云") + @NotNull(message = "配置名不能为空") + private String name; + + @Schema(description = "存储器,参见 FileStorageEnum 枚举类", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @NotNull(message = "存储器不能为空") + private Integer storage; + + @Schema(description = "存储配置,配置是动态参数,所以使用 Map 接收", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "存储配置不能为空") + private Map config; + + @Schema(description = "备注", example = "我是备注") + private String remark; + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/FileCreateReqVO.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/FileCreateReqVO.java new file mode 100644 index 0000000..2a129cf --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/FileCreateReqVO.java @@ -0,0 +1,34 @@ +package com.platform.marketing.module.infra.domain.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import javax.validation.constraints.NotNull; + +@Schema(description = "管理后台 - 文件创建 Request VO") +@Data +public class FileCreateReqVO { + + @NotNull(message = "文件配置编号不能为空") + @Schema(description = "文件配置编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "11") + private Long configId; + + @NotNull(message = "文件路径不能为空") + @Schema(description = "文件路径", requiredMode = Schema.RequiredMode.REQUIRED, example = "marketing.jpg") + private String path; + + @NotNull(message = "原文件名不能为空") + @Schema(description = "原文件名", requiredMode = Schema.RequiredMode.REQUIRED, example = "marketing.jpg") + private String name; + + @NotNull(message = "文件 URL不能为空") + @Schema(description = "文件 URL", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn/marketing.jpg") + private String url; + + @Schema(description = "文件 MIME 类型", example = "application/octet-stream") + private String type; + + @Schema(description = "文件大小", example = "2048", requiredMode = Schema.RequiredMode.REQUIRED) + private Integer size; + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/FilePageReqVO.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/FilePageReqVO.java new file mode 100644 index 0000000..25c3182 --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/FilePageReqVO.java @@ -0,0 +1,30 @@ +package com.platform.marketing.module.infra.domain.vo; + +import com.platform.marketing.framework.common.pojo.PageParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; +import org.springframework.format.annotation.DateTimeFormat; + +import java.time.LocalDateTime; + +import static com.platform.marketing.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 文件分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class FilePageReqVO extends PageParam { + + @Schema(description = "文件路径,模糊匹配", example = "marketing") + private String path; + + @Schema(description = "文件类型,模糊匹配", example = "jpg") + private String type; + + @Schema(description = "创建时间", example = "[2022-07-01 00:00:00, 2022-07-01 23:59:59]") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/FilePresignedUrlRespVO.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/FilePresignedUrlRespVO.java new file mode 100644 index 0000000..20e136f --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/FilePresignedUrlRespVO.java @@ -0,0 +1,29 @@ +package com.platform.marketing.module.infra.domain.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@AllArgsConstructor +@NoArgsConstructor +@Schema(description = "管理后台 - 文件预签名地址 Response VO") +@Data +public class FilePresignedUrlRespVO { + + @Schema(description = "配置编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "11") + private Long configId; + + @Schema(description = "文件上传 URL", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://s3.cn-south-1.qiniucs.com/ruoyi-vue-pro/758d3a5387507358c7236de4c8f96de1c7f5097ff6a7722b34772fb7b76b140f.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=3TvrJ70gl2Gt6IBe7_IZT1F6i_k0iMuRtyEv4EyS%2F20240217%2Fcn-south-1%2Fs3%2Faws4_request&X-Amz-Date=20240217T123222Z&X-Amz-Expires=600&X-Amz-SignedHeaders=host&X-Amz-Signature=a29f33770ab79bf523ccd4034d0752ac545f3c2a3b17baa1eb4e280cfdccfda5") + private String uploadUrl; + + /** + * 为什么要返回 url 字段? + * + * 前端上传完文件后,需要使用该 URL 进行访问 + */ + @Schema(description = "文件访问 URL", requiredMode = Schema.RequiredMode.REQUIRED, + example = "https://test.marketing.iocoder.cn/758d3a5387507358c7236de4c8f96de1c7f5097ff6a7722b34772fb7b76b140f.png") + private String url; + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/FileRespVO.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/FileRespVO.java new file mode 100644 index 0000000..b7c71cf --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/FileRespVO.java @@ -0,0 +1,36 @@ +package com.platform.marketing.module.infra.domain.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Schema(description = "管理后台 - 文件 Response VO,不返回 content 字段,太大") +@Data +public class FileRespVO { + + @Schema(description = "文件编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") + private Long id; + + @Schema(description = "配置编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "11") + private Long configId; + + @Schema(description = "文件路径", requiredMode = Schema.RequiredMode.REQUIRED, example = "marketing.jpg") + private String path; + + @Schema(description = "原文件名", requiredMode = Schema.RequiredMode.REQUIRED, example = "marketing.jpg") + private String name; + + @Schema(description = "文件 URL", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn/marketing.jpg") + private String url; + + @Schema(description = "文件MIME类型", example = "application/octet-stream") + private String type; + + @Schema(description = "文件大小", example = "2048", requiredMode = Schema.RequiredMode.REQUIRED) + private Integer size; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + private LocalDateTime createTime; + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/FileUploadReqVO.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/FileUploadReqVO.java new file mode 100644 index 0000000..9453ab3 --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/FileUploadReqVO.java @@ -0,0 +1,20 @@ +package com.platform.marketing.module.infra.domain.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import org.springframework.web.multipart.MultipartFile; + +import javax.validation.constraints.NotNull; + +@Schema(description = "管理后台 - 上传文件 Request VO") +@Data +public class FileUploadReqVO { + + @Schema(description = "文件附件", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "文件附件不能为空") + private MultipartFile file; + + @Schema(description = "文件附件", example = "marketingyuanma.png") + private String path; + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/JobLogPageReqVO.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/JobLogPageReqVO.java new file mode 100644 index 0000000..5deeda0 --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/JobLogPageReqVO.java @@ -0,0 +1,37 @@ +package com.platform.marketing.module.infra.domain.vo; + +import com.platform.marketing.framework.common.pojo.PageParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; +import org.springframework.format.annotation.DateTimeFormat; + +import java.time.LocalDateTime; + +import static com.platform.marketing.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 定时任务日志分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class JobLogPageReqVO extends PageParam { + + @Schema(description = "任务编号", example = "10") + private Long jobId; + + @Schema(description = "处理器的名字,模糊匹配") + private String handlerName; + + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + @Schema(description = "开始执行时间") + private LocalDateTime beginTime; + + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + @Schema(description = "结束执行时间") + private LocalDateTime endTime; + + @Schema(description = "任务状态,参见 JobLogStatusEnum 枚举") + private Integer status; + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/JobLogRespVO.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/JobLogRespVO.java new file mode 100644 index 0000000..7af0be0 --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/JobLogRespVO.java @@ -0,0 +1,63 @@ +package com.platform.marketing.module.infra.domain.vo; + +import com.platform.marketing.framework.excel.core.annotations.DictFormat; +import com.platform.marketing.framework.excel.core.convert.DictConvert; +import com.platform.marketing.module.infra.domain.enums.DictTypeConstants; +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Schema(description = "管理后台 - 定时任务日志 Response VO") +@Data +@ExcelIgnoreUnannotated +public class JobLogRespVO { + + @Schema(description = "日志编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") + @ExcelProperty("日志编号") + private Long id; + + @Schema(description = "任务编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") + @ExcelProperty("任务编号") + private Long jobId; + + @Schema(description = "处理器的名字", requiredMode = Schema.RequiredMode.REQUIRED, example = "sysUserSessionTimeoutJob") + @ExcelProperty("处理器的名字") + private String handlerName; + + @Schema(description = "处理器的参数", example = "marketing") + @ExcelProperty("处理器的参数") + private String handlerParam; + + @Schema(description = "第几次执行", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @ExcelProperty("第几次执行") + private Integer executeIndex; + + @Schema(description = "开始执行时间", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("开始执行时间") + private LocalDateTime beginTime; + + @Schema(description = "结束执行时间") + @ExcelProperty("结束执行时间") + private LocalDateTime endTime; + + @Schema(description = "执行时长", example = "123") + @ExcelProperty("执行时长") + private Integer duration; + + @Schema(description = "任务状态,参见 JobLogStatusEnum 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @ExcelProperty(value = "任务状态", converter = DictConvert.class) + @DictFormat(DictTypeConstants.JOB_STATUS) + private Integer status; + + @Schema(description = "结果数据", example = "执行成功") + @ExcelProperty("结果数据") + private String result; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("创建时间") + private LocalDateTime createTime; + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/JobPageReqVO.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/JobPageReqVO.java new file mode 100644 index 0000000..0a0b379 --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/JobPageReqVO.java @@ -0,0 +1,24 @@ +package com.platform.marketing.module.infra.domain.vo; + +import com.platform.marketing.framework.common.pojo.PageParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +@Schema(description = "管理后台 - 定时任务分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class JobPageReqVO extends PageParam { + + @Schema(description = "任务名称,模糊匹配", example = "测试任务") + private String name; + + @Schema(description = "任务状态,参见 JobStatusEnum 枚举", example = "1") + private Integer status; + + @Schema(description = "处理器的名字,模糊匹配", example = "sysUserSessionTimeoutJob") + private String handlerName; + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/JobRespVO.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/JobRespVO.java new file mode 100644 index 0000000..c6a47d8 --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/JobRespVO.java @@ -0,0 +1,59 @@ +package com.platform.marketing.module.infra.domain.vo; + +import com.platform.marketing.framework.excel.core.annotations.DictFormat; +import com.platform.marketing.framework.excel.core.convert.DictConvert; +import com.platform.marketing.module.infra.domain.enums.DictTypeConstants; +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.time.LocalDateTime; + +@Schema(description = "管理后台 - 定时任务 Response VO") +@Data +@ExcelIgnoreUnannotated +public class JobRespVO { + + @Schema(description = "任务编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") + @ExcelProperty("任务编号") + private Long id; + + @Schema(description = "任务名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "测试任务") + @ExcelProperty("任务名称") + private String name; + + @Schema(description = "任务状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @ExcelProperty(value = "任务状态", converter = DictConvert.class) + @DictFormat(DictTypeConstants.JOB_STATUS) + private Integer status; + + @Schema(description = "处理器的名字", requiredMode = Schema.RequiredMode.REQUIRED, example = "sysUserSessionTimeoutJob") + @ExcelProperty("处理器的名字") + private String handlerName; + + @Schema(description = "处理器的参数", example = "marketing") + @ExcelProperty("处理器的参数") + private String handlerParam; + + @Schema(description = "CRON 表达式", requiredMode = Schema.RequiredMode.REQUIRED, example = "0/10 * * * * ? *") + @ExcelProperty("CRON 表达式") + private String cronExpression; + + @Schema(description = "重试次数", requiredMode = Schema.RequiredMode.REQUIRED, example = "3") + @NotNull(message = "重试次数不能为空") + private Integer retryCount; + + @Schema(description = "重试间隔", requiredMode = Schema.RequiredMode.REQUIRED, example = "1000") + private Integer retryInterval; + + @Schema(description = "监控超时时间", example = "1000") + @ExcelProperty("监控超时时间") + private Integer monitorTimeout; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("创建时间") + private LocalDateTime createTime; + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/JobSaveReqVO.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/JobSaveReqVO.java new file mode 100644 index 0000000..2f902e2 --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/JobSaveReqVO.java @@ -0,0 +1,42 @@ +package com.platform.marketing.module.infra.domain.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; + +@Schema(description = "管理后台 - 定时任务创建/修改 Request VO") +@Data +public class JobSaveReqVO { + + @Schema(description = "任务编号", example = "1024") + private Long id; + + @Schema(description = "任务名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "测试任务") + @NotEmpty(message = "任务名称不能为空") + private String name; + + @Schema(description = "处理器的名字", requiredMode = Schema.RequiredMode.REQUIRED, example = "sysUserSessionTimeoutJob") + @NotEmpty(message = "处理器的名字不能为空") + private String handlerName; + + @Schema(description = "处理器的参数", example = "marketing") + private String handlerParam; + + @Schema(description = "CRON 表达式", requiredMode = Schema.RequiredMode.REQUIRED, example = "0/10 * * * * ? *") + @NotEmpty(message = "CRON 表达式不能为空") + private String cronExpression; + + @Schema(description = "重试次数", requiredMode = Schema.RequiredMode.REQUIRED, example = "3") + @NotNull(message = "重试次数不能为空") + private Integer retryCount; + + @Schema(description = "重试间隔", requiredMode = Schema.RequiredMode.REQUIRED, example = "1000") + @NotNull(message = "重试间隔不能为空") + private Integer retryInterval; + + @Schema(description = "监控超时时间", example = "1000") + private Integer monitorTimeout; + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/column/CodegenColumnRespVO.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/column/CodegenColumnRespVO.java new file mode 100644 index 0000000..8c1f006 --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/column/CodegenColumnRespVO.java @@ -0,0 +1,69 @@ +package com.platform.marketing.module.infra.domain.vo.column; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Schema(description = "管理后台 - 代码生成字段定义 Response VO") +@Data +public class CodegenColumnRespVO { + + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + private Long id; + + @Schema(description = "表编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + private Long tableId; + + @Schema(description = "字段名", requiredMode = Schema.RequiredMode.REQUIRED, example = "user_age") + private String columnName; + + @Schema(description = "字段类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "int(11)") + private String dataType; + + @Schema(description = "字段描述", requiredMode = Schema.RequiredMode.REQUIRED, example = "年龄") + private String columnComment; + + @Schema(description = "是否允许为空", requiredMode = Schema.RequiredMode.REQUIRED, example = "true") + private Boolean nullable; + + @Schema(description = "是否主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "false") + private Boolean primaryKey; + + @Schema(description = "排序", requiredMode = Schema.RequiredMode.REQUIRED, example = "10") + private Integer ordinalPosition; + + @Schema(description = "Java 属性类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "userAge") + private String javaType; + + @Schema(description = "Java 属性名", requiredMode = Schema.RequiredMode.REQUIRED, example = "Integer") + private String javaField; + + @Schema(description = "字典类型", example = "sys_gender") + private String dictType; + + @Schema(description = "数据示例", example = "1024") + private String example; + + @Schema(description = "是否为 Create 创建操作的字段", requiredMode = Schema.RequiredMode.REQUIRED, example = "true") + private Boolean createOperation; + + @Schema(description = "是否为 Update 更新操作的字段", requiredMode = Schema.RequiredMode.REQUIRED, example = "false") + private Boolean updateOperation; + + @Schema(description = "是否为 List 查询操作的字段", requiredMode = Schema.RequiredMode.REQUIRED, example = "true") + private Boolean listOperation; + + @Schema(description = "List 查询操作的条件类型,参见 CodegenColumnListConditionEnum 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "LIKE") + private String listOperationCondition; + + @Schema(description = "是否为 List 查询操作的返回字段", requiredMode = Schema.RequiredMode.REQUIRED, example = "true") + private Boolean listOperationResult; + + @Schema(description = "显示类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "input") + private String htmlType; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + private LocalDateTime createTime; + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/column/CodegenColumnSaveReqVO.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/column/CodegenColumnSaveReqVO.java new file mode 100644 index 0000000..59b1d99 --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/column/CodegenColumnSaveReqVO.java @@ -0,0 +1,81 @@ +package com.platform.marketing.module.infra.domain.vo.column; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import javax.validation.constraints.NotNull; + +@Schema(description = "管理后台 - 代码生成字段定义创建/修改 Request VO") +@Data +public class CodegenColumnSaveReqVO { + + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + private Long id; + + @Schema(description = "表编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @NotNull(message = "表编号不能为空") + private Long tableId; + + @Schema(description = "字段名", requiredMode = Schema.RequiredMode.REQUIRED, example = "user_age") + @NotNull(message = "字段名不能为空") + private String columnName; + + @Schema(description = "字段类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "int(11)") + @NotNull(message = "字段类型不能为空") + private String dataType; + + @Schema(description = "字段描述", requiredMode = Schema.RequiredMode.REQUIRED, example = "年龄") + @NotNull(message = "字段描述不能为空") + private String columnComment; + + @Schema(description = "是否允许为空", requiredMode = Schema.RequiredMode.REQUIRED, example = "true") + @NotNull(message = "是否允许为空不能为空") + private Boolean nullable; + + @Schema(description = "是否主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "false") + @NotNull(message = "是否主键不能为空") + private Boolean primaryKey; + + @Schema(description = "排序", requiredMode = Schema.RequiredMode.REQUIRED, example = "10") + @NotNull(message = "排序不能为空") + private Integer ordinalPosition; + + @Schema(description = "Java 属性类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "userAge") + @NotNull(message = "Java 属性类型不能为空") + private String javaType; + + @Schema(description = "Java 属性名", requiredMode = Schema.RequiredMode.REQUIRED, example = "Integer") + @NotNull(message = "Java 属性名不能为空") + private String javaField; + + @Schema(description = "字典类型", example = "sys_gender") + private String dictType; + + @Schema(description = "数据示例", example = "1024") + private String example; + + @Schema(description = "是否为 Create 创建操作的字段", requiredMode = Schema.RequiredMode.REQUIRED, example = "true") + @NotNull(message = "是否为 Create 创建操作的字段不能为空") + private Boolean createOperation; + + @Schema(description = "是否为 Update 更新操作的字段", requiredMode = Schema.RequiredMode.REQUIRED, example = "false") + @NotNull(message = "是否为 Update 更新操作的字段不能为空") + private Boolean updateOperation; + + @Schema(description = "是否为 List 查询操作的字段", requiredMode = Schema.RequiredMode.REQUIRED, example = "true") + @NotNull(message = "是否为 List 查询操作的字段不能为空") + private Boolean listOperation; + + @Schema(description = "List 查询操作的条件类型,参见 CodegenColumnListConditionEnum 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "LIKE") + @NotNull(message = "List 查询操作的条件类型不能为空") + private String listOperationCondition; + + @Schema(description = "是否为 List 查询操作的返回字段", requiredMode = Schema.RequiredMode.REQUIRED, example = "true") + @NotNull(message = "是否为 List 查询操作的返回字段不能为空") + private Boolean listOperationResult; + + @Schema(description = "显示类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "input") + @NotNull(message = "显示类型不能为空") + private String htmlType; + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/table/CodegenTablePageReqVO.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/table/CodegenTablePageReqVO.java new file mode 100644 index 0000000..47a027b --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/table/CodegenTablePageReqVO.java @@ -0,0 +1,33 @@ +package com.platform.marketing.module.infra.domain.vo.table; + +import com.platform.marketing.framework.common.pojo.PageParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; +import org.springframework.format.annotation.DateTimeFormat; + +import java.time.LocalDateTime; + +import static com.platform.marketing.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 表定义分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class CodegenTablePageReqVO extends PageParam { + + @Schema(description = "表名称,模糊匹配", example = "表名") + private String tableName; + + @Schema(description = "表描述,模糊匹配", example = "表描述") + private String tableComment; + + @Schema(description = "实体,模糊匹配", example = "Marketing") + private String className; + + @Schema(description = "创建时间", example = "[2022-07-01 00:00:00,2022-07-01 23:59:59]") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/table/CodegenTableRespVO.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/table/CodegenTableRespVO.java new file mode 100644 index 0000000..d53658f --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/table/CodegenTableRespVO.java @@ -0,0 +1,72 @@ +package com.platform.marketing.module.infra.domain.vo.table; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Schema(description = "管理后台 - 代码生成表定义 Response VO") +@Data +public class CodegenTableRespVO { + + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + private Long id; + + @Schema(description = "生成场景,参见 CodegenSceneEnum 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + private Integer scene; + + @Schema(description = "表名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "marketing") + private String tableName; + + @Schema(description = "表描述", requiredMode = Schema.RequiredMode.REQUIRED, example = "marketing") + private String tableComment; + + @Schema(description = "备注", example = "我是备注") + private String remark; + + @Schema(description = "模块名", requiredMode = Schema.RequiredMode.REQUIRED, example = "system") + private String moduleName; + + @Schema(description = "业务名", requiredMode = Schema.RequiredMode.REQUIRED, example = "codegen") + private String businessName; + + @Schema(description = "类名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "CodegenTable") + private String className; + + @Schema(description = "类描述", requiredMode = Schema.RequiredMode.REQUIRED, example = "代码生成器的表定义") + private String classComment; + + @Schema(description = "作者", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道源码") + private String author; + + @Schema(description = "模板类型,参见 CodegenTemplateTypeEnum 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + private Integer templateType; + + @Schema(description = "前端类型,参见 CodegenFrontTypeEnum 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "20") + private Integer frontType; + + @Schema(description = "父菜单编号", example = "1024") + private Long parentMenuId; + + @Schema(description = "主表的编号", example = "2048") + private Long masterTableId; + @Schema(description = "子表关联主表的字段编号", example = "4096") + private Long subJoinColumnId; + @Schema(description = "主表与子表是否一对多", example = "4096") + private Boolean subJoinMany; + + @Schema(description = "树表的父字段编号", example = "8192") + private Long treeParentColumnId; + @Schema(description = "树表的名字字段编号", example = "16384") + private Long treeNameColumnId; + + @Schema(description = "主键编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") + private Integer dataSourceConfigId; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + private LocalDateTime createTime; + + @Schema(description = "更新时间", requiredMode = Schema.RequiredMode.REQUIRED) + private LocalDateTime updateTime; + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/table/CodegenTableSaveReqVO.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/table/CodegenTableSaveReqVO.java new file mode 100644 index 0000000..bc3463c --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/table/CodegenTableSaveReqVO.java @@ -0,0 +1,100 @@ +package com.platform.marketing.module.infra.domain.vo.table; + +import cn.hutool.core.util.ObjectUtil; +import com.platform.marketing.module.infra.domain.enums.CodegenSceneEnum; +import com.platform.marketing.module.infra.domain.enums.CodegenTemplateTypeEnum; +import com.fasterxml.jackson.annotation.JsonIgnore; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import javax.validation.constraints.AssertTrue; +import javax.validation.constraints.NotNull; + +@Schema(description = "管理后台 - 代码生成表定义创建/修改 Response VO") +@Data +public class CodegenTableSaveReqVO { + + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + private Long id; + + @Schema(description = "生成场景,参见 CodegenSceneEnum 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @NotNull(message = "导入类型不能为空") + private Integer scene; + + @Schema(description = "表名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "marketing") + @NotNull(message = "表名称不能为空") + private String tableName; + + @Schema(description = "表描述", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道") + @NotNull(message = "表描述不能为空") + private String tableComment; + + @Schema(description = "备注", example = "我是备注") + private String remark; + + @Schema(description = "模块名", requiredMode = Schema.RequiredMode.REQUIRED, example = "system") + @NotNull(message = "模块名不能为空") + private String moduleName; + + @Schema(description = "业务名", requiredMode = Schema.RequiredMode.REQUIRED, example = "codegen") + @NotNull(message = "业务名不能为空") + private String businessName; + + @Schema(description = "类名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "CodegenTable") + @NotNull(message = "类名称不能为空") + private String className; + + @Schema(description = "类描述", requiredMode = Schema.RequiredMode.REQUIRED, example = "代码生成器的表定义") + @NotNull(message = "类描述不能为空") + private String classComment; + + @Schema(description = "作者", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道源码") + @NotNull(message = "作者不能为空") + private String author; + + @Schema(description = "模板类型,参见 CodegenTemplateTypeEnum 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @NotNull(message = "模板类型不能为空") + private Integer templateType; + + @Schema(description = "前端类型,参见 CodegenFrontTypeEnum 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "20") + @NotNull(message = "前端类型不能为空") + private Integer frontType; + + @Schema(description = "父菜单编号", example = "1024") + private Long parentMenuId; + + @Schema(description = "主表的编号", example = "2048") + private Long masterTableId; + @Schema(description = "子表关联主表的字段编号", example = "4096") + private Long subJoinColumnId; + @Schema(description = "主表与子表是否一对多", example = "4096") + private Boolean subJoinMany; + + @Schema(description = "树表的父字段编号", example = "8192") + private Long treeParentColumnId; + @Schema(description = "树表的名字字段编号", example = "16384") + private Long treeNameColumnId; + + @AssertTrue(message = "上级菜单不能为空,请前往 [修改生成配置 -> 生成信息] 界面,设置“上级菜单”字段") + @JsonIgnore + public boolean isParentMenuIdValid() { + // 生成场景为管理后台时,必须设置上级菜单,不然生成的菜单 SQL 是无父级菜单的 + return ObjectUtil.notEqual(getScene(), CodegenSceneEnum.ADMIN.getScene()) + || getParentMenuId() != null; + } + + @AssertTrue(message = "关联的父表信息不全") + @JsonIgnore + public boolean isSubValid() { + return ObjectUtil.notEqual(getTemplateType(), CodegenTemplateTypeEnum.SUB) + || (ObjectUtil.isAllNotEmpty(masterTableId, subJoinColumnId, subJoinMany)); + } + + @AssertTrue(message = "关联的树表信息不全") + @JsonIgnore + public boolean isTreeValid() { + return ObjectUtil.notEqual(templateType, CodegenTemplateTypeEnum.TREE) + || (ObjectUtil.isAllNotEmpty(treeParentColumnId, treeNameColumnId)); + } + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/table/DatabaseTableRespVO.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/table/DatabaseTableRespVO.java new file mode 100644 index 0000000..4813a19 --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/domain/vo/table/DatabaseTableRespVO.java @@ -0,0 +1,16 @@ +package com.platform.marketing.module.infra.domain.vo.table; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Schema(description = "管理后台 - 数据库的表定义 Response VO") +@Data +public class DatabaseTableRespVO { + + @Schema(description = "表名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "yuanma") + private String name; + + @Schema(description = "表描述", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道源码") + private String comment; + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/framework/codegen/config/CodegenConfiguration.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/framework/codegen/config/CodegenConfiguration.java new file mode 100644 index 0000000..e25cb9a --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/framework/codegen/config/CodegenConfiguration.java @@ -0,0 +1,9 @@ +package com.platform.marketing.module.infra.framework.codegen.config; + +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +@Configuration(proxyBeanMethods = false) +@EnableConfigurationProperties(CodegenProperties.class) +public class CodegenConfiguration { +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/framework/codegen/config/CodegenProperties.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/framework/codegen/config/CodegenProperties.java new file mode 100644 index 0000000..959000b --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/framework/codegen/config/CodegenProperties.java @@ -0,0 +1,56 @@ +package com.platform.marketing.module.infra.framework.codegen.config; + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.validation.annotation.Validated; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import java.util.Collection; + +@ConfigurationProperties(prefix = "marketing.codegen") +@Validated +@Data +public class CodegenProperties { + + /** + * 生成的 Java 代码的基础包 + */ + @NotNull(message = "Java 代码的基础包不能为空") + private String basePackage; + + /** + * 数据库名数组 + */ + @NotEmpty(message = "数据库不能为空") + private Collection dbSchemas; + + /** + * 代码生成的前端类型(默认) + * + * 枚举 {@link com.platform.marketing.module.infra.domain.enums.CodegenFrontTypeEnum#getType()} + */ + @NotNull(message = "代码生成的前端类型不能为空") + private Integer frontType; + + /** + * 代码生成的 VO 类型 + * + * 枚举 {@link com.platform.marketing.module.infra.domain.enums.CodegenVOTypeEnum#getType()} + */ + @NotNull(message = "代码生成的 VO 类型不能为空") + private Integer voType; + + /** + * 是否生成批量删除接口 + */ + @NotNull(message = "是否生成批量删除接口不能为空") + private Boolean deleteBatchEnable; + + /** + * 是否生成单元测试 + */ + @NotNull(message = "是否生成单元测试不能为空") + private Boolean unitTestEnable; + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/framework/file/config/MarketingFileAutoConfiguration.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/framework/file/config/MarketingFileAutoConfiguration.java new file mode 100644 index 0000000..aa30f8f --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/framework/file/config/MarketingFileAutoConfiguration.java @@ -0,0 +1,21 @@ +package com.platform.marketing.module.infra.framework.file.config; + +import com.platform.marketing.module.infra.framework.file.core.client.FileClientFactory; +import com.platform.marketing.module.infra.framework.file.core.client.FileClientFactoryImpl; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * 文件配置类 + * + + */ +@Configuration(proxyBeanMethods = false) +public class MarketingFileAutoConfiguration { + + @Bean + public FileClientFactory fileClientFactory() { + return new FileClientFactoryImpl(); + } + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/framework/file/core/client/AbstractFileClient.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/framework/file/core/client/AbstractFileClient.java new file mode 100644 index 0000000..f33f5f0 --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/framework/file/core/client/AbstractFileClient.java @@ -0,0 +1,69 @@ +package com.platform.marketing.module.infra.framework.file.core.client; + +import cn.hutool.core.util.StrUtil; +import lombok.extern.slf4j.Slf4j; + +/** + * 文件客户端的抽象类,提供模板方法,减少子类的冗余代码 + * + + */ +@Slf4j +public abstract class AbstractFileClient implements FileClient { + + /** + * 配置编号 + */ + private final Long id; + /** + * 文件配置 + */ + protected Config config; + + public AbstractFileClient(Long id, Config config) { + this.id = id; + this.config = config; + } + + /** + * 初始化 + */ + public final void init() { + doInit(); + log.debug("[init][配置({}) 初始化完成]", config); + } + + /** + * 自定义初始化 + */ + protected abstract void doInit(); + + public final void refresh(Config config) { + // 判断是否更新 + if (config.equals(this.config)) { + return; + } + log.info("[refresh][配置({})发生变化,重新初始化]", config); + this.config = config; + // 初始化 + this.init(); + } + + @Override + public Long getId() { + return id; + } + + /** + * 格式化文件的 URL 访问地址 + * 使用场景:local、ftp、db,通过 FileController 的 getFile 来获取文件内容 + * + * @param domain 自定义域名 + * @param path 文件路径 + * @return URL 访问地址 + */ + protected String formatFileUrl(String domain, String path) { + return StrUtil.format("{}/api/infra/file/{}/get/{}", domain, getId(), path); + } + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/framework/file/core/client/FileClient.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/framework/file/core/client/FileClient.java new file mode 100644 index 0000000..ababc67 --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/framework/file/core/client/FileClient.java @@ -0,0 +1,55 @@ +package com.platform.marketing.module.infra.framework.file.core.client; + +import com.platform.marketing.module.infra.framework.file.core.client.s3.FilePresignedUrlRespDTO; + +/** + * 文件客户端 + * + + */ +public interface FileClient { + + /** + * 获得客户端编号 + * + * @return 客户端编号 + */ + Long getId(); + + /** + * 上传文件 + * + * @param content 文件流 + * @param path 相对路径 + * @return 完整路径,即 HTTP 访问地址 + * @throws Exception 上传文件时,抛出 Exception 异常 + */ + String upload(byte[] content, String path, String type) throws Exception; + + /** + * 删除文件 + * + * @param path 相对路径 + * @throws Exception 删除文件时,抛出 Exception 异常 + */ + void delete(String path) throws Exception; + + /** + * 获得文件的内容 + * + * @param path 相对路径 + * @return 文件的内容 + */ + byte[] getContent(String path) throws Exception; + + /** + * 获得文件预签名地址 + * + * @param path 相对路径 + * @return 文件预签名地址 + */ + default FilePresignedUrlRespDTO getPresignedObjectUrl(String path) throws Exception { + throw new UnsupportedOperationException("不支持的操作"); + } + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/framework/file/core/client/FileClientConfig.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/framework/file/core/client/FileClientConfig.java new file mode 100644 index 0000000..0e167fb --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/framework/file/core/client/FileClientConfig.java @@ -0,0 +1,16 @@ +package com.platform.marketing.module.infra.framework.file.core.client; + +import com.fasterxml.jackson.annotation.JsonTypeInfo; + +/** + * 文件客户端的配置 + * 不同实现的客户端,需要不同的配置,通过子类来定义 + * + + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.CLASS) +// @JsonTypeInfo 注解的作用,Jackson 多态 +// 1. 序列化到时数据库时,增加 @class 属性。 +// 2. 反序列化到内存对象时,通过 @class 属性,可以创建出正确的类型 +public interface FileClientConfig { +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/framework/file/core/client/FileClientFactory.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/framework/file/core/client/FileClientFactory.java new file mode 100644 index 0000000..1a197fc --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/framework/file/core/client/FileClientFactory.java @@ -0,0 +1,24 @@ +package com.platform.marketing.module.infra.framework.file.core.client; + +import com.platform.marketing.module.infra.framework.file.core.enums.FileStorageEnum; + +public interface FileClientFactory { + + /** + * 获得文件客户端 + * + * @param configId 配置编号 + * @return 文件客户端 + */ + FileClient getFileClient(Long configId); + + /** + * 创建文件客户端 + * + * @param configId 配置编号 + * @param storage 存储器的枚举 {@link FileStorageEnum} + * @param config 文件配置 + */ + void createOrUpdateFileClient(Long configId, Integer storage, Config config); + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/framework/file/core/client/FileClientFactoryImpl.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/framework/file/core/client/FileClientFactoryImpl.java new file mode 100644 index 0000000..355118a --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/framework/file/core/client/FileClientFactoryImpl.java @@ -0,0 +1,56 @@ +package com.platform.marketing.module.infra.framework.file.core.client; + +import cn.hutool.core.lang.Assert; +import cn.hutool.core.util.ReflectUtil; +import com.platform.marketing.module.infra.framework.file.core.enums.FileStorageEnum; +import lombok.extern.slf4j.Slf4j; + +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; + +/** + * 文件客户端的工厂实现类 + * + + */ +@Slf4j +public class FileClientFactoryImpl implements FileClientFactory { + + /** + * 文件客户端 Map + * key:配置编号 + */ + private final ConcurrentMap> clients = new ConcurrentHashMap<>(); + + @Override + public FileClient getFileClient(Long configId) { + AbstractFileClient client = clients.get(configId); + if (client == null) { + log.error("[getFileClient][配置编号({}) 找不到客户端]", configId); + } + return client; + } + + @Override + @SuppressWarnings("unchecked") + public void createOrUpdateFileClient(Long configId, Integer storage, Config config) { + AbstractFileClient client = (AbstractFileClient) clients.get(configId); + if (client == null) { + client = this.createFileClient(configId, storage, config); + client.init(); + clients.put(client.getId(), client); + } else { + client.refresh(config); + } + } + + @SuppressWarnings("unchecked") + private AbstractFileClient createFileClient( + Long configId, Integer storage, Config config) { + FileStorageEnum storageEnum = FileStorageEnum.getByStorage(storage); + Assert.notNull(storageEnum, String.format("文件配置(%s) 为空", storageEnum)); + // 创建客户端 + return (AbstractFileClient) ReflectUtil.newInstance(storageEnum.getClientClass(), configId, config); + } + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/framework/file/core/client/db/DBFileClient.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/framework/file/core/client/db/DBFileClient.java new file mode 100644 index 0000000..573f59a --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/framework/file/core/client/db/DBFileClient.java @@ -0,0 +1,55 @@ +package com.platform.marketing.module.infra.framework.file.core.client.db; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.extra.spring.SpringUtil; +import com.platform.marketing.module.infra.domain.dataobject.FileContentDO; +import com.platform.marketing.module.infra.framework.file.core.client.AbstractFileClient; +import com.platform.marketing.module.infra.mapper.FileContentMapper; + +import java.util.Comparator; +import java.util.List; + +/** + * 基于 DB 存储的文件客户端的配置类 + * + + */ +public class DBFileClient extends AbstractFileClient { + + private FileContentMapper fileContentMapper; + + public DBFileClient(Long id, DBFileClientConfig config) { + super(id, config); + } + + @Override + protected void doInit() { + fileContentMapper = SpringUtil.getBean(FileContentMapper.class); + } + + @Override + public String upload(byte[] content, String path, String type) { + FileContentDO contentDO = new FileContentDO().setConfigId(getId()) + .setPath(path).setContent(content); + fileContentMapper.insert(contentDO); + // 拼接返回路径 + return super.formatFileUrl(config.getDomain(), path); + } + + @Override + public void delete(String path) { + fileContentMapper.deleteByConfigIdAndPath(getId(), path); + } + + @Override + public byte[] getContent(String path) { + List list = fileContentMapper.selectListByConfigIdAndPath(getId(), path); + if (CollUtil.isEmpty(list)) { + return null; + } + // 排序后,拿 id 最大的,即最后上传的 + list.sort(Comparator.comparing(FileContentDO::getId)); + return CollUtil.getLast(list).getContent(); + } + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/framework/file/core/client/db/DBFileClientConfig.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/framework/file/core/client/db/DBFileClientConfig.java new file mode 100644 index 0000000..f36bb96 --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/framework/file/core/client/db/DBFileClientConfig.java @@ -0,0 +1,24 @@ +package com.platform.marketing.module.infra.framework.file.core.client.db; + +import com.platform.marketing.module.infra.framework.file.core.client.FileClientConfig; +import lombok.Data; +import org.hibernate.validator.constraints.URL; + +import javax.validation.constraints.NotEmpty; + +/** + * 基于 DB 存储的文件客户端的配置类 + * + + */ +@Data +public class DBFileClientConfig implements FileClientConfig { + + /** + * 自定义域名 + */ + @NotEmpty(message = "domain 不能为空") + @URL(message = "domain 必须是 URL 格式") + private String domain; + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/framework/file/core/client/ftp/FtpFileClient.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/framework/file/core/client/ftp/FtpFileClient.java new file mode 100644 index 0000000..4a1b7e8 --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/framework/file/core/client/ftp/FtpFileClient.java @@ -0,0 +1,77 @@ +package com.platform.marketing.module.infra.framework.file.core.client.ftp; + +import cn.hutool.core.io.FileUtil; +import cn.hutool.core.util.CharsetUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.extra.ftp.Ftp; +import cn.hutool.extra.ftp.FtpException; +import cn.hutool.extra.ftp.FtpMode; +import com.platform.marketing.module.infra.framework.file.core.client.AbstractFileClient; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; + +/** + * Ftp 文件客户端 + * + + */ +public class FtpFileClient extends AbstractFileClient { + + private Ftp ftp; + + public FtpFileClient(Long id, FtpFileClientConfig config) { + super(id, config); + } + + @Override + protected void doInit() { + // 把配置的 \ 替换成 /, 如果路径配置 \a\test, 替换成 /a/test, 替换方法已经处理 null 情况 + config.setBasePath(StrUtil.replace(config.getBasePath(), StrUtil.BACKSLASH, StrUtil.SLASH)); + // ftp的路径是 / 结尾 + if (!config.getBasePath().endsWith(StrUtil.SLASH)) { + config.setBasePath(config.getBasePath() + StrUtil.SLASH); + } + // 初始化 Ftp 对象 + this.ftp = new Ftp(config.getHost(), config.getPort(), config.getUsername(), config.getPassword(), + CharsetUtil.CHARSET_UTF_8, null, null, FtpMode.valueOf(config.getMode())); + } + + @Override + public String upload(byte[] content, String path, String type) { + // 执行写入 + String filePath = getFilePath(path); + String fileName = FileUtil.getName(filePath); + String dir = StrUtil.removeSuffix(filePath, fileName); + ftp.reconnectIfTimeout(); + boolean success = ftp.upload(dir, fileName, new ByteArrayInputStream(content)); + if (!success) { + throw new FtpException(StrUtil.format("上传文件到目标目录 ({}) 失败", filePath)); + } + // 拼接返回路径 + return super.formatFileUrl(config.getDomain(), path); + } + + @Override + public void delete(String path) { + String filePath = getFilePath(path); + ftp.reconnectIfTimeout(); + ftp.delFile(filePath); + } + + @Override + public byte[] getContent(String path) { + String filePath = getFilePath(path); + String fileName = FileUtil.getName(filePath); + String dir = StrUtil.removeSuffix(filePath, fileName); + ByteArrayOutputStream out = new ByteArrayOutputStream(); + ftp.reconnectIfTimeout(); + ftp.download(dir, fileName, out); + return out.toByteArray(); + } + + private String getFilePath(String path) { + return config.getBasePath() + path; + } + +} \ No newline at end of file diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/framework/file/core/client/ftp/FtpFileClientConfig.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/framework/file/core/client/ftp/FtpFileClientConfig.java new file mode 100644 index 0000000..0559136 --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/framework/file/core/client/ftp/FtpFileClientConfig.java @@ -0,0 +1,59 @@ +package com.platform.marketing.module.infra.framework.file.core.client.ftp; + +import com.platform.marketing.module.infra.framework.file.core.client.FileClientConfig; +import lombok.Data; +import org.hibernate.validator.constraints.URL; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; + +/** + * Ftp 文件客户端的配置类 + * + + */ +@Data +public class FtpFileClientConfig implements FileClientConfig { + + /** + * 基础路径 + */ + @NotEmpty(message = "基础路径不能为空") + private String basePath; + + /** + * 自定义域名 + */ + @NotEmpty(message = "domain 不能为空") + @URL(message = "domain 必须是 URL 格式") + private String domain; + + /** + * 主机地址 + */ + @NotEmpty(message = "host 不能为空") + private String host; + /** + * 主机端口 + */ + @NotNull(message = "port 不能为空") + private Integer port; + /** + * 用户名 + */ + @NotEmpty(message = "用户名不能为空") + private String username; + /** + * 密码 + */ + @NotEmpty(message = "密码不能为空") + private String password; + /** + * 连接模式 + * + * 使用 {@link cn.hutool.extra.ftp.FtpMode} 对应的字符串 + */ + @NotEmpty(message = "连接模式不能为空") + private String mode; + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/framework/file/core/client/local/LocalFileClient.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/framework/file/core/client/local/LocalFileClient.java new file mode 100644 index 0000000..e43cc5c --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/framework/file/core/client/local/LocalFileClient.java @@ -0,0 +1,52 @@ +package com.platform.marketing.module.infra.framework.file.core.client.local; + +import cn.hutool.core.io.FileUtil; +import com.platform.marketing.module.infra.framework.file.core.client.AbstractFileClient; + +import java.io.File; + +/** + * 本地文件客户端 + * + + */ +public class LocalFileClient extends AbstractFileClient { + + public LocalFileClient(Long id, LocalFileClientConfig config) { + super(id, config); + } + + @Override + protected void doInit() { + // 补全风格。例如说 Linux 是 /,Windows 是 \ + if (!config.getBasePath().endsWith(File.separator)) { + config.setBasePath(config.getBasePath() + File.separator); + } + } + + @Override + public String upload(byte[] content, String path, String type) { + // 执行写入 + String filePath = getFilePath(path); + FileUtil.writeBytes(content, filePath); + // 拼接返回路径 + return super.formatFileUrl(config.getDomain(), path); + } + + @Override + public void delete(String path) { + String filePath = getFilePath(path); + FileUtil.del(filePath); + } + + @Override + public byte[] getContent(String path) { + String filePath = getFilePath(path); + return FileUtil.readBytes(filePath); + } + + private String getFilePath(String path) { + return config.getBasePath() + path; + } + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/framework/file/core/client/local/LocalFileClientConfig.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/framework/file/core/client/local/LocalFileClientConfig.java new file mode 100644 index 0000000..6a370ae --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/framework/file/core/client/local/LocalFileClientConfig.java @@ -0,0 +1,30 @@ +package com.platform.marketing.module.infra.framework.file.core.client.local; + +import com.platform.marketing.module.infra.framework.file.core.client.FileClientConfig; +import lombok.Data; +import org.hibernate.validator.constraints.URL; + +import javax.validation.constraints.NotEmpty; + +/** + * 本地文件客户端的配置类 + * + + */ +@Data +public class LocalFileClientConfig implements FileClientConfig { + + /** + * 基础路径 + */ + @NotEmpty(message = "基础路径不能为空") + private String basePath; + + /** + * 自定义域名 + */ + @NotEmpty(message = "domain 不能为空") + @URL(message = "domain 必须是 URL 格式") + private String domain; + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/framework/file/core/client/s3/FilePresignedUrlRespDTO.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/framework/file/core/client/s3/FilePresignedUrlRespDTO.java new file mode 100644 index 0000000..068d0e1 --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/framework/file/core/client/s3/FilePresignedUrlRespDTO.java @@ -0,0 +1,29 @@ +package com.platform.marketing.module.infra.framework.file.core.client.s3; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 文件预签名地址 Response DTO + * + * @author owen + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class FilePresignedUrlRespDTO { + + /** + * 文件上传 URL(用于上传) + * + * 例如说: + */ + private String uploadUrl; + + /** + * 文件 URL(用于读取、下载等) + */ + private String url; + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/framework/file/core/client/s3/S3FileClient.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/framework/file/core/client/s3/S3FileClient.java new file mode 100644 index 0000000..ce1733d --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/framework/file/core/client/s3/S3FileClient.java @@ -0,0 +1,118 @@ +package com.platform.marketing.module.infra.framework.file.core.client.s3; + +import cn.hutool.core.io.IoUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.http.HttpUtil; +import com.platform.marketing.module.infra.framework.file.core.client.AbstractFileClient; +import com.amazonaws.HttpMethod; +import com.amazonaws.auth.AWSStaticCredentialsProvider; +import com.amazonaws.auth.BasicAWSCredentials; +import com.amazonaws.client.builder.AwsClientBuilder; +import com.amazonaws.services.s3.AmazonS3Client; +import com.amazonaws.services.s3.AmazonS3ClientBuilder; +import com.amazonaws.services.s3.model.ObjectMetadata; +import com.amazonaws.services.s3.model.S3Object; + +import java.io.ByteArrayInputStream; +import java.util.Date; +import java.util.concurrent.TimeUnit; + +/** + * 基于 S3 协议的文件客户端,实现 MinIO、阿里云、腾讯云、七牛云、华为云等云服务 + *

+ * S3 协议的客户端,采用亚马逊提供的 software.amazon.awssdk.s3 库 + * + + */ +public class S3FileClient extends AbstractFileClient { + + private AmazonS3Client client; + + public S3FileClient(Long id, S3FileClientConfig config) { + super(id, config); + } + + @Override + protected void doInit() { + // 补全 domain + if (StrUtil.isEmpty(config.getDomain())) { + config.setDomain(buildDomain()); + } + // 初始化客户端 + client = (AmazonS3Client)AmazonS3ClientBuilder.standard() + .withCredentials(buildCredentials()) + .withEndpointConfiguration(buildEndpointConfiguration()) + .build(); + } + + /** + * 基于 config 秘钥,构建 S3 客户端的认证信息 + * + * @return S3 客户端的认证信息 + */ + private AWSStaticCredentialsProvider buildCredentials() { + return new AWSStaticCredentialsProvider( + new BasicAWSCredentials(config.getAccessKey(), config.getAccessSecret())); + } + + /** + * 构建 S3 客户端的 Endpoint 配置,包括 region、endpoint + * + * @return S3 客户端的 EndpointConfiguration 配置 + */ + private AwsClientBuilder.EndpointConfiguration buildEndpointConfiguration() { + return new AwsClientBuilder.EndpointConfiguration(config.getEndpoint(), + null); // 无需设置 region + } + + /** + * 基于 bucket + endpoint 构建访问的 Domain 地址 + * + * @return Domain 地址 + */ + private String buildDomain() { + // 如果已经是 http 或者 https,则不进行拼接.主要适配 MinIO + if (HttpUtil.isHttp(config.getEndpoint()) || HttpUtil.isHttps(config.getEndpoint())) { + return StrUtil.format("{}/{}", config.getEndpoint(), config.getBucket()); + } + // 阿里云、腾讯云、华为云都适合。七牛云比较特殊,必须有自定义域名 + return StrUtil.format("https://{}.{}", config.getBucket(), config.getEndpoint()); + } + + @Override + public String upload(byte[] content, String path, String type) throws Exception { + // 元数据,主要用于设置文件类型 + ObjectMetadata objectMetadata = new ObjectMetadata(); + objectMetadata.setContentType(type); + objectMetadata.setContentLength(content.length); // 如果不设置,会有 “ No content length specified for stream data” 警告日志 + // 执行上传 + client.putObject(config.getBucket(), + path, // 相对路径 + new ByteArrayInputStream(content), // 文件内容 + objectMetadata); + + // 拼接返回路径 + return config.getDomain() + "/" + path; + } + + @Override + public void delete(String path) throws Exception { + client.deleteObject(config.getBucket(), path); + } + + @Override + public byte[] getContent(String path) throws Exception { + S3Object tempS3Object = client.getObject(config.getBucket(), path); + return IoUtil.readBytes(tempS3Object.getObjectContent()); + } + + @Override + public FilePresignedUrlRespDTO getPresignedObjectUrl(String path) throws Exception { + // 设定过期时间为 10 分钟。取值范围:1 秒 ~ 7 天 + Date expiration = new Date(System.currentTimeMillis() + TimeUnit.MINUTES.toMillis(10)); + // 生成上传 URL + String uploadUrl = String.valueOf(client.generatePresignedUrl(config.getBucket(), path, expiration , HttpMethod.PUT)); + return new FilePresignedUrlRespDTO(uploadUrl, config.getDomain() + "/" + path); + } + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/framework/file/core/client/s3/S3FileClientConfig.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/framework/file/core/client/s3/S3FileClientConfig.java new file mode 100644 index 0000000..f314a7d --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/framework/file/core/client/s3/S3FileClientConfig.java @@ -0,0 +1,81 @@ +package com.platform.marketing.module.infra.framework.file.core.client.s3; + +import cn.hutool.core.util.StrUtil; +import com.platform.marketing.module.infra.framework.file.core.client.FileClientConfig; +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; +import org.hibernate.validator.constraints.URL; + +import javax.validation.constraints.AssertTrue; +import javax.validation.constraints.NotNull; + +/** + * S3 文件客户端的配置类 + * + + */ +@Data +public class S3FileClientConfig implements FileClientConfig { + + public static final String ENDPOINT_QINIU = "qiniucs.com"; + public static final String ENDPOINT_ALIYUN = "aliyuncs.com"; + public static final String ENDPOINT_TENCENT = "myqcloud.com"; + public static final String ENDPOINT_VOLCES = "volces.com"; // 火山云(字节) + + /** + * 节点地址 + * 1. MinIO:https://www.iocoder.cn/Spring-Boot/MinIO 。例如说,http://127.0.0.1:9000 + * 2. 阿里云:https://help.aliyun.com/document_detail/31837.html + * 3. 腾讯云:https://cloud.tencent.com/document/product/436/6224 + * 4. 七牛云:https://developer.qiniu.com/kodo/4088/s3-access-domainname + * 5. 华为云:https://console.huaweicloud.com/apiexplorer/#/endpoint/OBS + * 6. 火山云:https://www.volcengine.com/docs/6349/107356 + */ + @NotNull(message = "endpoint 不能为空") + private String endpoint; + /** + * 自定义域名 + * 1. MinIO:通过 Nginx 配置 + * 2. 阿里云:https://help.aliyun.com/document_detail/31836.html + * 3. 腾讯云:https://cloud.tencent.com/document/product/436/11142 + * 4. 七牛云:https://developer.qiniu.com/kodo/8556/set-the-custom-source-domain-name + * 5. 华为云:https://support.huaweicloud.com/usermanual-obs/obs_03_0032.html + * 6. 火山云:https://www.volcengine.com/docs/6349/128983 + */ + @URL(message = "domain 必须是 URL 格式") + private String domain; + /** + * 存储 Bucket + */ + @NotNull(message = "bucket 不能为空") + private String bucket; + + /** + * 访问 Key + * 1. MinIO:https://www.iocoder.cn/Spring-Boot/MinIO + * 2. 阿里云:https://ram.console.aliyun.com/manage/ak + * 3. 腾讯云:https://console.cloud.tencent.com/cam/capi + * 4. 七牛云:https://portal.qiniu.com/user/key + * 5. 华为云:https://support.huaweicloud.com/qs-obs/obs_qs_0005.html + * 6. 火山云:https://console.volcengine.com/iam/keymanage/ + */ + @NotNull(message = "accessKey 不能为空") + private String accessKey; + /** + * 访问 Secret + */ + @NotNull(message = "accessSecret 不能为空") + private String accessSecret; + + @SuppressWarnings("RedundantIfStatement") + @AssertTrue(message = "domain 不能为空") + @JsonIgnore + public boolean isDomainValid() { + // 如果是七牛,必须带有 domain + if (StrUtil.contains(endpoint, ENDPOINT_QINIU) && StrUtil.isEmpty(domain)) { + return false; + } + return true; + } + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/framework/file/core/client/sftp/SftpFileClient.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/framework/file/core/client/sftp/SftpFileClient.java new file mode 100644 index 0000000..b0c94dc --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/framework/file/core/client/sftp/SftpFileClient.java @@ -0,0 +1,61 @@ +package com.platform.marketing.module.infra.framework.file.core.client.sftp; + +import cn.hutool.core.io.FileUtil; +import cn.hutool.extra.ssh.Sftp; +import com.platform.marketing.framework.common.util.io.FileUtils; +import com.platform.marketing.module.infra.framework.file.core.client.AbstractFileClient; + +import java.io.File; + +/** + * Sftp 文件客户端 + * + + */ +public class SftpFileClient extends AbstractFileClient { + + private Sftp sftp; + + public SftpFileClient(Long id, SftpFileClientConfig config) { + super(id, config); + } + + @Override + protected void doInit() { + // 补全风格。例如说 Linux 是 /,Windows 是 \ + if (!config.getBasePath().endsWith(File.separator)) { + config.setBasePath(config.getBasePath() + File.separator); + } + // 初始化 Ftp 对象 + this.sftp = new Sftp(config.getHost(), config.getPort(), config.getUsername(), config.getPassword()); + } + + @Override + public String upload(byte[] content, String path, String type) { + // 执行写入 + String filePath = getFilePath(path); + File file = FileUtils.createTempFile(content); + sftp.upload(filePath, file); + // 拼接返回路径 + return super.formatFileUrl(config.getDomain(), path); + } + + @Override + public void delete(String path) { + String filePath = getFilePath(path); + sftp.delFile(filePath); + } + + @Override + public byte[] getContent(String path) { + String filePath = getFilePath(path); + File destFile = FileUtils.createTempFile(); + sftp.download(filePath, destFile); + return FileUtil.readBytes(destFile); + } + + private String getFilePath(String path) { + return config.getBasePath() + path; + } + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/framework/file/core/client/sftp/SftpFileClientConfig.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/framework/file/core/client/sftp/SftpFileClientConfig.java new file mode 100644 index 0000000..55a94b6 --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/framework/file/core/client/sftp/SftpFileClientConfig.java @@ -0,0 +1,52 @@ +package com.platform.marketing.module.infra.framework.file.core.client.sftp; + +import com.platform.marketing.module.infra.framework.file.core.client.FileClientConfig; +import lombok.Data; +import org.hibernate.validator.constraints.URL; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; + +/** + * Sftp 文件客户端的配置类 + * + + */ +@Data +public class SftpFileClientConfig implements FileClientConfig { + + /** + * 基础路径 + */ + @NotEmpty(message = "基础路径不能为空") + private String basePath; + + /** + * 自定义域名 + */ + @NotEmpty(message = "domain 不能为空") + @URL(message = "domain 必须是 URL 格式") + private String domain; + + /** + * 主机地址 + */ + @NotEmpty(message = "host 不能为空") + private String host; + /** + * 主机端口 + */ + @NotNull(message = "port 不能为空") + private Integer port; + /** + * 用户名 + */ + @NotEmpty(message = "用户名不能为空") + private String username; + /** + * 密码 + */ + @NotEmpty(message = "密码不能为空") + private String password; + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/framework/file/core/enums/FileStorageEnum.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/framework/file/core/enums/FileStorageEnum.java new file mode 100644 index 0000000..d711565 --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/framework/file/core/enums/FileStorageEnum.java @@ -0,0 +1,55 @@ +package com.platform.marketing.module.infra.framework.file.core.enums; + +import cn.hutool.core.util.ArrayUtil; +import com.platform.marketing.module.infra.framework.file.core.client.FileClient; +import com.platform.marketing.module.infra.framework.file.core.client.FileClientConfig; +import com.platform.marketing.module.infra.framework.file.core.client.db.DBFileClient; +import com.platform.marketing.module.infra.framework.file.core.client.db.DBFileClientConfig; +import com.platform.marketing.module.infra.framework.file.core.client.ftp.FtpFileClient; +import com.platform.marketing.module.infra.framework.file.core.client.ftp.FtpFileClientConfig; +import com.platform.marketing.module.infra.framework.file.core.client.local.LocalFileClient; +import com.platform.marketing.module.infra.framework.file.core.client.local.LocalFileClientConfig; +import com.platform.marketing.module.infra.framework.file.core.client.s3.S3FileClient; +import com.platform.marketing.module.infra.framework.file.core.client.s3.S3FileClientConfig; +import com.platform.marketing.module.infra.framework.file.core.client.sftp.SftpFileClient; +import com.platform.marketing.module.infra.framework.file.core.client.sftp.SftpFileClientConfig; +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * 文件存储器枚举 + * + + */ +@AllArgsConstructor +@Getter +public enum FileStorageEnum { + + DB(1, DBFileClientConfig.class, DBFileClient.class), + + LOCAL(10, LocalFileClientConfig.class, LocalFileClient.class), + FTP(11, FtpFileClientConfig.class, FtpFileClient.class), + SFTP(12, SftpFileClientConfig.class, SftpFileClient.class), + + S3(20, S3FileClientConfig.class, S3FileClient.class), + ; + + /** + * 存储器 + */ + private final Integer storage; + + /** + * 配置类 + */ + private final Class configClass; + /** + * 客户端类 + */ + private final Class clientClass; + + public static FileStorageEnum getByStorage(Integer storage) { + return ArrayUtil.firstMatch(o -> o.getStorage().equals(storage), values()); + } + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/framework/file/core/utils/FileTypeUtils.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/framework/file/core/utils/FileTypeUtils.java new file mode 100644 index 0000000..3834c5b --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/framework/file/core/utils/FileTypeUtils.java @@ -0,0 +1,76 @@ +package com.platform.marketing.module.infra.framework.file.core.utils; + +import cn.hutool.core.io.IoUtil; +import cn.hutool.core.util.StrUtil; +import com.platform.marketing.framework.common.util.http.HttpUtils; +import com.alibaba.ttl.TransmittableThreadLocal; +import lombok.SneakyThrows; +import org.apache.tika.Tika; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +/** + * 文件类型 Utils + * + + */ +public class FileTypeUtils { + + private static final ThreadLocal TIKA = TransmittableThreadLocal.withInitial(Tika::new); + + /** + * 获得文件的 mineType,对于doc,jar等文件会有误差 + * + * @param data 文件内容 + * @return mineType 无法识别时会返回“application/octet-stream” + */ + @SneakyThrows + public static String getMineType(byte[] data) { + return TIKA.get().detect(data); + } + + /** + * 已知文件名,获取文件类型,在某些情况下比通过字节数组准确,例如使用jar文件时,通过名字更为准确 + * + * @param name 文件名 + * @return mineType 无法识别时会返回“application/octet-stream” + */ + public static String getMineType(String name) { + return TIKA.get().detect(name); + } + + /** + * 在拥有文件和数据的情况下,最好使用此方法,最为准确 + * + * @param data 文件内容 + * @param name 文件名 + * @return mineType 无法识别时会返回“application/octet-stream” + */ + public static String getMineType(byte[] data, String name) { + return TIKA.get().detect(data, name); + } + + /** + * 返回附件 + * + * @param response 响应 + * @param filename 文件名 + * @param content 附件内容 + */ + public static void writeAttachment(HttpServletResponse response, String filename, byte[] content) throws IOException { + // 设置 header 和 contentType + response.setHeader("Content-Disposition", "attachment;filename=" + HttpUtils.encodeUtf8(filename)); + String contentType = getMineType(content, filename); + response.setContentType(contentType); + // 针对 video 的特殊处理,解决视频地址在移动端播放的兼容性问题 + if (StrUtil.containsIgnoreCase(contentType, "video")) { + response.setHeader("Content-Length", String.valueOf(content.length - 1)); + response.setHeader("Content-Range", String.valueOf(content.length - 1)); + response.setHeader("Accept-Ranges", "bytes"); + } + // 输出附件 + IoUtil.write(response.getOutputStream(), false, content); + } + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/framework/security/config/SecurityConfiguration.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/framework/security/config/SecurityConfiguration.java new file mode 100644 index 0000000..8188830 --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/framework/security/config/SecurityConfiguration.java @@ -0,0 +1,45 @@ +package com.platform.marketing.module.infra.framework.security.config; + +import com.platform.marketing.framework.security.config.AuthorizeRequestsCustomizer; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configurers.AuthorizeHttpRequestsConfigurer; + +/** + * Infra 模块的 Security 配置 + */ +@Configuration(proxyBeanMethods = false, value = "infraSecurityConfiguration") +public class SecurityConfiguration { + + @Value("${spring.boot.admin.context-path:''}") + private String adminSeverContextPath; + + @Bean("infraAuthorizeRequestsCustomizer") + public AuthorizeRequestsCustomizer authorizeRequestsCustomizer() { + return new AuthorizeRequestsCustomizer() { + + @Override + public void customize(AuthorizeHttpRequestsConfigurer.AuthorizationManagerRequestMatcherRegistry registry) { + // Swagger 接口文档 + registry.requestMatchers("/v3/api-docs/**").permitAll() + .requestMatchers("/webjars/**").permitAll() + .requestMatchers("/swagger-ui.html").permitAll() + .requestMatchers("/swagger-ui/**").permitAll(); + // Spring Boot Actuator 的安全配置 + registry.requestMatchers("/actuator").permitAll() + .requestMatchers("/actuator/**").permitAll(); + // Druid 监控 + registry.requestMatchers("/druid/**").permitAll(); + // Spring Boot Admin Server 的安全配置 + registry.requestMatchers(adminSeverContextPath).permitAll() + .requestMatchers(adminSeverContextPath + "/**").permitAll(); + // 文件读取 + registry.requestMatchers(buildAdminApi("/infra/file/*/get/**")).permitAll(); + } + + }; + } + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/framework/web/config/InfraWebConfiguration.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/framework/web/config/InfraWebConfiguration.java new file mode 100644 index 0000000..21ef62f --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/framework/web/config/InfraWebConfiguration.java @@ -0,0 +1,24 @@ +package com.platform.marketing.module.infra.framework.web.config; + +import com.platform.marketing.framework.swagger.config.MarketingSwaggerAutoConfiguration; +import org.springdoc.core.GroupedOpenApi; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * infra 模块的 web 组件的 Configuration + * + + */ +@Configuration(proxyBeanMethods = false) +public class InfraWebConfiguration { + + /** + * infra 模块的 API 分组 + */ + @Bean + public GroupedOpenApi infraGroupedOpenApi() { + return MarketingSwaggerAutoConfiguration.buildGroupedOpenApi("infra"); + } + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/mapper/CodegenColumnMapper.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/mapper/CodegenColumnMapper.java new file mode 100644 index 0000000..2ae8a13 --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/mapper/CodegenColumnMapper.java @@ -0,0 +1,29 @@ +package com.platform.marketing.module.infra.mapper; + +import com.platform.marketing.framework.mybatis.core.mapper.BaseMapperX; +import com.platform.marketing.framework.mybatis.core.query.LambdaQueryWrapperX; +import com.platform.marketing.module.infra.domain.dataobject.CodegenColumnDO; +import org.apache.ibatis.annotations.Mapper; + +import java.util.Collection; +import java.util.List; + +@Mapper +public interface CodegenColumnMapper extends BaseMapperX { + + default List selectListByTableId(Long tableId) { + return selectList(new LambdaQueryWrapperX() + .eq(CodegenColumnDO::getTableId, tableId) + .orderByAsc(CodegenColumnDO::getOrdinalPosition)); + } + + default void deleteListByTableId(Long tableId) { + delete(CodegenColumnDO::getTableId, tableId); + } + + default void deleteListByTableId(Collection tableIds) { + delete(new LambdaQueryWrapperX() + .in(CodegenColumnDO::getTableId, tableIds)); + } + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/mapper/CodegenTableMapper.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/mapper/CodegenTableMapper.java new file mode 100644 index 0000000..541ccf6 --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/mapper/CodegenTableMapper.java @@ -0,0 +1,39 @@ +package com.platform.marketing.module.infra.mapper; + +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.mybatis.core.mapper.BaseMapperX; +import com.platform.marketing.framework.mybatis.core.query.LambdaQueryWrapperX; +import com.platform.marketing.module.infra.domain.dataobject.CodegenTableDO; +import com.platform.marketing.module.infra.domain.vo.table.CodegenTablePageReqVO; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +@Mapper +public interface CodegenTableMapper extends BaseMapperX { + + default CodegenTableDO selectByTableNameAndDataSourceConfigId(String tableName, Long dataSourceConfigId) { + return selectOne(CodegenTableDO::getTableName, tableName, + CodegenTableDO::getDataSourceConfigId, dataSourceConfigId); + } + + default PageResult selectPage(CodegenTablePageReqVO pageReqVO) { + return selectPage(pageReqVO, new LambdaQueryWrapperX() + .likeIfPresent(CodegenTableDO::getTableName, pageReqVO.getTableName()) + .likeIfPresent(CodegenTableDO::getTableComment, pageReqVO.getTableComment()) + .likeIfPresent(CodegenTableDO::getClassName, pageReqVO.getClassName()) + .betweenIfPresent(CodegenTableDO::getCreateTime, pageReqVO.getCreateTime()) + .orderByDesc(CodegenTableDO::getUpdateTime) + ); + } + + default List selectListByDataSourceConfigId(Long dataSourceConfigId) { + return selectList(CodegenTableDO::getDataSourceConfigId, dataSourceConfigId); + } + + default List selectListByTemplateTypeAndMasterTableId(Integer templateType, Long masterTableId) { + return selectList(CodegenTableDO::getTemplateType, templateType, + CodegenTableDO::getMasterTableId, masterTableId); + } + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/mapper/ConfigMapper.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/mapper/ConfigMapper.java new file mode 100644 index 0000000..ef99e2b --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/mapper/ConfigMapper.java @@ -0,0 +1,25 @@ +package com.platform.marketing.module.infra.mapper; + +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.mybatis.core.mapper.BaseMapperX; +import com.platform.marketing.framework.mybatis.core.query.LambdaQueryWrapperX; +import com.platform.marketing.module.infra.domain.dataobject.ConfigDO; +import com.platform.marketing.module.infra.domain.vo.ConfigPageReqVO; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface ConfigMapper extends BaseMapperX { + + default ConfigDO selectByKey(String key) { + return selectOne(ConfigDO::getConfigKey, key); + } + + default PageResult selectPage(ConfigPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .likeIfPresent(ConfigDO::getName, reqVO.getName()) + .likeIfPresent(ConfigDO::getConfigKey, reqVO.getKey()) + .eqIfPresent(ConfigDO::getType, reqVO.getType()) + .betweenIfPresent(ConfigDO::getCreateTime, reqVO.getCreateTime())); + } + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/mapper/DataSourceConfigMapper.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/mapper/DataSourceConfigMapper.java new file mode 100644 index 0000000..dbf3857 --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/mapper/DataSourceConfigMapper.java @@ -0,0 +1,14 @@ +package com.platform.marketing.module.infra.mapper; + +import com.platform.marketing.framework.mybatis.core.mapper.BaseMapperX; +import com.platform.marketing.module.infra.domain.dataobject.DataSourceConfigDO; +import org.apache.ibatis.annotations.Mapper; + +/** + * 数据源配置 Mapper + * + + */ +@Mapper +public interface DataSourceConfigMapper extends BaseMapperX { +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/mapper/FileConfigMapper.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/mapper/FileConfigMapper.java new file mode 100644 index 0000000..8e9d7a3 --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/mapper/FileConfigMapper.java @@ -0,0 +1,25 @@ +package com.platform.marketing.module.infra.mapper; + +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.mybatis.core.mapper.BaseMapperX; +import com.platform.marketing.framework.mybatis.core.query.LambdaQueryWrapperX; +import com.platform.marketing.module.infra.domain.dataobject.FileConfigDO; +import com.platform.marketing.module.infra.domain.vo.FileConfigPageReqVO; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface FileConfigMapper extends BaseMapperX { + + default PageResult selectPage(FileConfigPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .likeIfPresent(FileConfigDO::getName, reqVO.getName()) + .eqIfPresent(FileConfigDO::getStorage, reqVO.getStorage()) + .betweenIfPresent(FileConfigDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(FileConfigDO::getId)); + } + + default FileConfigDO selectByMaster() { + return selectOne(FileConfigDO::getMaster, true); + } + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/mapper/FileContentMapper.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/mapper/FileContentMapper.java new file mode 100644 index 0000000..83b3d38 --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/mapper/FileContentMapper.java @@ -0,0 +1,25 @@ +package com.platform.marketing.module.infra.mapper; + +import com.platform.marketing.module.infra.domain.dataobject.FileContentDO; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +@Mapper +public interface FileContentMapper extends BaseMapper { + + default void deleteByConfigIdAndPath(Long configId, String path) { + this.delete(new LambdaQueryWrapper() + .eq(FileContentDO::getConfigId, configId) + .eq(FileContentDO::getPath, path)); + } + + default List selectListByConfigIdAndPath(Long configId, String path) { + return selectList(new LambdaQueryWrapper() + .eq(FileContentDO::getConfigId, configId) + .eq(FileContentDO::getPath, path)); + } + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/mapper/FileMapper.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/mapper/FileMapper.java new file mode 100644 index 0000000..7b12a15 --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/mapper/FileMapper.java @@ -0,0 +1,26 @@ +package com.platform.marketing.module.infra.mapper; + +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.mybatis.core.mapper.BaseMapperX; +import com.platform.marketing.framework.mybatis.core.query.LambdaQueryWrapperX; +import com.platform.marketing.module.infra.domain.dataobject.FileDO; +import com.platform.marketing.module.infra.domain.vo.FilePageReqVO; +import org.apache.ibatis.annotations.Mapper; + +/** + * 文件操作 Mapper + * + + */ +@Mapper +public interface FileMapper extends BaseMapperX { + + default PageResult selectPage(FilePageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .likeIfPresent(FileDO::getPath, reqVO.getPath()) + .likeIfPresent(FileDO::getType, reqVO.getType()) + .betweenIfPresent(FileDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(FileDO::getId)); + } + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/mapper/JobLogMapper.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/mapper/JobLogMapper.java new file mode 100644 index 0000000..22b32d2 --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/mapper/JobLogMapper.java @@ -0,0 +1,43 @@ +package com.platform.marketing.module.infra.mapper; + +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.mybatis.core.mapper.BaseMapperX; +import com.platform.marketing.framework.mybatis.core.query.LambdaQueryWrapperX; +import com.platform.marketing.module.infra.domain.dataobject.JobLogDO; +import com.platform.marketing.module.infra.domain.vo.JobLogPageReqVO; +import org.apache.ibatis.annotations.Delete; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.time.LocalDateTime; + +/** + * 任务日志 Mapper + * + + */ +@Mapper +public interface JobLogMapper extends BaseMapperX { + + default PageResult selectPage(JobLogPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(JobLogDO::getJobId, reqVO.getJobId()) + .likeIfPresent(JobLogDO::getHandlerName, reqVO.getHandlerName()) + .geIfPresent(JobLogDO::getBeginTime, reqVO.getBeginTime()) + .leIfPresent(JobLogDO::getEndTime, reqVO.getEndTime()) + .eqIfPresent(JobLogDO::getStatus, reqVO.getStatus()) + .orderByDesc(JobLogDO::getId) // ID 倒序 + ); + } + + /** + * 物理删除指定时间之前的日志 + * + * @param createTime 最大时间 + * @param limit 删除条数,防止一次删除太多 + * @return 删除条数 + */ + @Delete("DELETE FROM infra_job_log WHERE create_time < #{createTime} LIMIT #{limit}") + Integer deleteByCreateTimeLt(@Param("createTime") LocalDateTime createTime, @Param("limit") Integer limit); + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/mapper/JobMapper.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/mapper/JobMapper.java new file mode 100644 index 0000000..cbe8987 --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/mapper/JobMapper.java @@ -0,0 +1,30 @@ +package com.platform.marketing.module.infra.mapper; + +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.mybatis.core.mapper.BaseMapperX; +import com.platform.marketing.framework.mybatis.core.query.LambdaQueryWrapperX; +import com.platform.marketing.module.infra.domain.dataobject.JobDO; +import com.platform.marketing.module.infra.domain.vo.JobPageReqVO; +import org.apache.ibatis.annotations.Mapper; + +/** + * 定时任务 Mapper + * + + */ +@Mapper +public interface JobMapper extends BaseMapperX { + + default JobDO selectByHandlerName(String handlerName) { + return selectOne(JobDO::getHandlerName, handlerName); + } + + default PageResult selectPage(JobPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .likeIfPresent(JobDO::getName, reqVO.getName()) + .eqIfPresent(JobDO::getStatus, reqVO.getStatus()) + .likeIfPresent(JobDO::getHandlerName, reqVO.getHandlerName()) + ); + } + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/service/CodegenService.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/service/CodegenService.java new file mode 100644 index 0000000..c00e344 --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/service/CodegenService.java @@ -0,0 +1,108 @@ +package com.platform.marketing.module.infra.service; + +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.module.infra.domain.dataobject.CodegenColumnDO; +import com.platform.marketing.module.infra.domain.dataobject.CodegenTableDO; +import com.platform.marketing.module.infra.domain.vo.CodegenCreateListReqVO; +import com.platform.marketing.module.infra.domain.vo.CodegenUpdateReqVO; +import com.platform.marketing.module.infra.domain.vo.table.CodegenTablePageReqVO; +import com.platform.marketing.module.infra.domain.vo.table.DatabaseTableRespVO; + +import java.util.List; +import java.util.Map; + +/** + * 代码生成 Service 接口 + * + * @author 芋道源码 + */ +public interface CodegenService { + + /** + * 基于数据库的表结构,创建代码生成器的表定义 + * + * @param author 作者 + * @param reqVO 表信息 + * @return 创建的表定义的编号数组 + */ + List createCodegenList(String author, CodegenCreateListReqVO reqVO); + + /** + * 更新数据库的表和字段定义 + * + * @param updateReqVO 更新信息 + */ + void updateCodegen(CodegenUpdateReqVO updateReqVO); + + /** + * 基于数据库的表结构,同步数据库的表和字段定义 + * + * @param tableId 表编号 + */ + void syncCodegenFromDB(Long tableId); + + /** + * 删除数据库的表和字段定义 + * + * @param tableId 数据编号 + */ + void deleteCodegen(Long tableId); + + /** + * 批量删除数据库的表和字段定义 + * + * @param tableIds 数据编号列表 + */ + void deleteCodegenList(List tableIds); + + /** + * 获得表定义列表 + * + * @param dataSourceConfigId 数据源配置的编号 + * @return 表定义列表 + */ + List getCodegenTableList(Long dataSourceConfigId); + + /** + * 获得表定义分页 + * + * @param pageReqVO 分页条件 + * @return 表定义分页 + */ + PageResult getCodegenTablePage(CodegenTablePageReqVO pageReqVO); + + /** + * 获得表定义 + * + * @param id 表编号 + * @return 表定义 + */ + CodegenTableDO getCodegenTable(Long id); + + /** + * 获得指定表的字段定义数组 + * + * @param tableId 表编号 + * @return 字段定义数组 + */ + List getCodegenColumnListByTableId(Long tableId); + + /** + * 执行指定表的代码生成 + * + * @param tableId 表编号 + * @return 生成结果。key 为文件路径,value 为对应的代码内容 + */ + Map generationCodes(Long tableId); + + /** + * 获得数据库自带的表定义列表 + * + * @param dataSourceConfigId 数据源的配置编号 + * @param name 表名称 + * @param comment 表描述 + * @return 表定义列表 + */ + List getDatabaseTableList(Long dataSourceConfigId, String name, String comment); + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/service/ConfigService.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/service/ConfigService.java new file mode 100644 index 0000000..5448acc --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/service/ConfigService.java @@ -0,0 +1,63 @@ +package com.platform.marketing.module.infra.service; + +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.module.infra.domain.dataobject.ConfigDO; +import com.platform.marketing.module.infra.domain.vo.ConfigPageReqVO; +import com.platform.marketing.module.infra.domain.vo.ConfigSaveReqVO; + +import javax.validation.Valid; + +/** + * 参数配置 Service 接口 + * + + */ +public interface ConfigService { + + /** + * 创建参数配置 + * + * @param createReqVO 创建信息 + * @return 配置编号 + */ + Long createConfig(@Valid ConfigSaveReqVO createReqVO); + + /** + * 更新参数配置 + * + * @param updateReqVO 更新信息 + */ + void updateConfig(@Valid ConfigSaveReqVO updateReqVO); + + /** + * 删除参数配置 + * + * @param id 配置编号 + */ + void deleteConfig(Long id); + + /** + * 获得参数配置 + * + * @param id 配置编号 + * @return 参数配置 + */ + ConfigDO getConfig(Long id); + + /** + * 根据参数键,获得参数配置 + * + * @param key 配置键 + * @return 参数配置 + */ + ConfigDO getConfigByKey(String key); + + /** + * 获得参数配置分页列表 + * + * @param reqVO 分页条件 + * @return 分页列表 + */ + PageResult getConfigPage(ConfigPageReqVO reqVO); + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/service/DataSourceConfigService.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/service/DataSourceConfigService.java new file mode 100644 index 0000000..87f6238 --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/service/DataSourceConfigService.java @@ -0,0 +1,53 @@ +package com.platform.marketing.module.infra.service; + +import com.platform.marketing.module.infra.domain.dataobject.DataSourceConfigDO; +import com.platform.marketing.module.infra.domain.vo.DataSourceConfigSaveReqVO; + +import javax.validation.Valid; +import java.util.List; + +/** + * 数据源配置 Service 接口 + * + + */ +public interface DataSourceConfigService { + + /** + * 创建数据源配置 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createDataSourceConfig(@Valid DataSourceConfigSaveReqVO createReqVO); + + /** + * 更新数据源配置 + * + * @param updateReqVO 更新信息 + */ + void updateDataSourceConfig(@Valid DataSourceConfigSaveReqVO updateReqVO); + + /** + * 删除数据源配置 + * + * @param id 编号 + */ + void deleteDataSourceConfig(Long id); + + /** + * 获得数据源配置 + * + * @param id 编号 + * @return 数据源配置 + */ + DataSourceConfigDO getDataSourceConfig(Long id); + + /** + * 获得数据源配置列表 + * + * @return 数据源配置列表 + */ + List getDataSourceConfigList(); + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/service/DatabaseTableService.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/service/DatabaseTableService.java new file mode 100644 index 0000000..0872201 --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/service/DatabaseTableService.java @@ -0,0 +1,33 @@ +package com.platform.marketing.module.infra.service; + +import com.baomidou.mybatisplus.generator.config.po.TableInfo; + +import java.util.List; + +/** + * 数据库表 Service + * + + */ +public interface DatabaseTableService { + + /** + * 获得表列表,基于表名称 + 表描述进行模糊匹配 + * + * @param dataSourceConfigId 数据源配置的编号 + * @param nameLike 表名称,模糊匹配 + * @param commentLike 表描述,模糊匹配 + * @return 表列表 + */ + List getTableList(Long dataSourceConfigId, String nameLike, String commentLike); + + /** + * 获得指定表名 + * + * @param dataSourceConfigId 数据源配置的编号 + * @param tableName 表名称 + * @return 表 + */ + TableInfo getTable(Long dataSourceConfigId, String tableName); + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/service/FileConfigService.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/service/FileConfigService.java new file mode 100644 index 0000000..f93e01d --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/service/FileConfigService.java @@ -0,0 +1,86 @@ +package com.platform.marketing.module.infra.service; + +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.module.infra.domain.dataobject.FileConfigDO; +import com.platform.marketing.module.infra.domain.vo.FileConfigPageReqVO; +import com.platform.marketing.module.infra.domain.vo.FileConfigSaveReqVO; +import com.platform.marketing.module.infra.framework.file.core.client.FileClient; + +import javax.validation.Valid; + +/** + * 文件配置 Service 接口 + * + + */ +public interface FileConfigService { + + /** + * 创建文件配置 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createFileConfig(@Valid FileConfigSaveReqVO createReqVO); + + /** + * 更新文件配置 + * + * @param updateReqVO 更新信息 + */ + void updateFileConfig(@Valid FileConfigSaveReqVO updateReqVO); + + /** + * 更新文件配置为 Master + * + * @param id 编号 + */ + void updateFileConfigMaster(Long id); + + /** + * 删除文件配置 + * + * @param id 编号 + */ + void deleteFileConfig(Long id); + + /** + * 获得文件配置 + * + * @param id 编号 + * @return 文件配置 + */ + FileConfigDO getFileConfig(Long id); + + /** + * 获得文件配置分页 + * + * @param pageReqVO 分页查询 + * @return 文件配置分页 + */ + PageResult getFileConfigPage(FileConfigPageReqVO pageReqVO); + + /** + * 测试文件配置是否正确,通过上传文件 + * + * @param id 编号 + * @return 文件 URL + */ + String testFileConfig(Long id) throws Exception; + + /** + * 获得指定编号的文件客户端 + * + * @param id 配置编号 + * @return 文件客户端 + */ + FileClient getFileClient(Long id); + + /** + * 获得 Master 文件客户端 + * + * @return 文件客户端 + */ + FileClient getMasterFileClient(); + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/service/FileService.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/service/FileService.java new file mode 100644 index 0000000..382dad5 --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/service/FileService.java @@ -0,0 +1,64 @@ +package com.platform.marketing.module.infra.service; + +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.module.infra.domain.dataobject.FileDO; +import com.platform.marketing.module.infra.domain.vo.FileCreateReqVO; +import com.platform.marketing.module.infra.domain.vo.FilePageReqVO; +import com.platform.marketing.module.infra.domain.vo.FilePresignedUrlRespVO; + +/** + * 文件 Service 接口 + */ +public interface FileService { + + /** + * 获得文件分页 + * + * @param pageReqVO 分页查询 + * @return 文件分页 + */ + PageResult getFilePage(FilePageReqVO pageReqVO); + + /** + * 保存文件,并返回文件的访问路径 + * + * @param name 文件名称 + * @param path 文件路径 + * @param content 文件内容 + * @return 文件路径 + */ + String createFile(String name, String path, byte[] content); + + /** + * 创建文件 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createFile(FileCreateReqVO createReqVO); + + /** + * 删除文件 + * + * @param id 编号 + */ + void deleteFile(Long id) throws Exception; + + /** + * 获得文件内容 + * + * @param configId 配置编号 + * @param path 文件路径 + * @return 文件内容 + */ + byte[] getFileContent(Long configId, String path) throws Exception; + + /** + * 生成文件预签名地址信息 + * + * @param path 文件路径 + * @return 预签名地址信息 + */ + FilePresignedUrlRespVO getFilePresignedUrl(String path) throws Exception; + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/service/JobLogService.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/service/JobLogService.java new file mode 100644 index 0000000..ab15007 --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/service/JobLogService.java @@ -0,0 +1,39 @@ +package com.platform.marketing.module.infra.service; + +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.quartz.core.service.JobLogFrameworkService; +import com.platform.marketing.module.infra.domain.dataobject.JobLogDO; +import com.platform.marketing.module.infra.domain.vo.JobLogPageReqVO; + +/** + * Job 日志 Service 接口 + * + + */ +public interface JobLogService extends JobLogFrameworkService { + + /** + * 获得定时任务 + * + * @param id 编号 + * @return 定时任务 + */ + JobLogDO getJobLog(Long id); + + /** + * 获得定时任务分页 + * + * @param pageReqVO 分页查询 + * @return 定时任务分页 + */ + PageResult getJobLogPage(JobLogPageReqVO pageReqVO); + + /** + * 清理 exceedDay 天前的任务日志 + * + * @param exceedDay 超过多少天就进行清理 + * @param deleteLimit 清理的间隔条数 + */ + Integer cleanJobLog(Integer exceedDay, Integer deleteLimit); + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/service/JobService.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/service/JobService.java new file mode 100644 index 0000000..fb41946 --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/service/JobService.java @@ -0,0 +1,78 @@ +package com.platform.marketing.module.infra.service; + +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.module.infra.domain.dataobject.JobDO; +import com.platform.marketing.module.infra.domain.vo.JobPageReqVO; +import com.platform.marketing.module.infra.domain.vo.JobSaveReqVO; +import org.quartz.SchedulerException; + +import javax.validation.Valid; + +/** + * 定时任务 Service 接口 + * + + */ +public interface JobService { + + /** + * 创建定时任务 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createJob(@Valid JobSaveReqVO createReqVO) throws SchedulerException; + + /** + * 更新定时任务 + * + * @param updateReqVO 更新信息 + */ + void updateJob(@Valid JobSaveReqVO updateReqVO) throws SchedulerException; + + /** + * 更新定时任务的状态 + * + * @param id 任务编号 + * @param status 状态 + */ + void updateJobStatus(Long id, Integer status) throws SchedulerException; + + /** + * 触发定时任务 + * + * @param id 任务编号 + */ + void triggerJob(Long id) throws SchedulerException; + + /** + * 同步定时任务 + * + * 目的:自己存储的 Job 信息,强制同步到 Quartz 中 + */ + void syncJob() throws SchedulerException; + + /** + * 删除定时任务 + * + * @param id 编号 + */ + void deleteJob(Long id) throws SchedulerException; + + /** + * 获得定时任务 + * + * @param id 编号 + * @return 定时任务 + */ + JobDO getJob(Long id); + + /** + * 获得定时任务分页 + * + * @param pageReqVO 分页查询 + * @return 定时任务分页 + */ + PageResult getJobPage(JobPageReqVO pageReqVO); + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/service/impl/CodegenServiceImpl.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/service/impl/CodegenServiceImpl.java new file mode 100644 index 0000000..8a7aae7 --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/service/impl/CodegenServiceImpl.java @@ -0,0 +1,302 @@ +package com.platform.marketing.module.infra.service.impl; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.StrUtil; +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.common.util.object.BeanUtils; +import com.platform.marketing.module.infra.domain.dataobject.CodegenColumnDO; +import com.platform.marketing.module.infra.domain.dataobject.CodegenTableDO; +import com.platform.marketing.module.infra.domain.enums.CodegenSceneEnum; +import com.platform.marketing.module.infra.domain.enums.CodegenTemplateTypeEnum; +import com.platform.marketing.module.infra.domain.vo.CodegenCreateListReqVO; +import com.platform.marketing.module.infra.domain.vo.CodegenUpdateReqVO; +import com.platform.marketing.module.infra.domain.vo.table.CodegenTablePageReqVO; +import com.platform.marketing.module.infra.domain.vo.table.DatabaseTableRespVO; +import com.platform.marketing.module.infra.framework.codegen.config.CodegenProperties; +import com.platform.marketing.module.infra.mapper.CodegenColumnMapper; +import com.platform.marketing.module.infra.mapper.CodegenTableMapper; +import com.platform.marketing.module.infra.service.CodegenService; +import com.platform.marketing.module.infra.service.DatabaseTableService; +import com.platform.marketing.module.infra.util.CodegenBuilder; +import com.platform.marketing.module.infra.util.CodegenEngine; +import com.baomidou.mybatisplus.generator.config.po.TableField; +import com.baomidou.mybatisplus.generator.config.po.TableInfo; +import com.google.common.annotations.VisibleForTesting; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.util.*; +import java.util.function.BiPredicate; +import java.util.stream.Collectors; +import java.util.stream.IntStream; + +import static com.platform.marketing.framework.common.exception.util.ServiceExceptionUtil.exception; +import static com.platform.marketing.framework.common.util.collection.CollectionUtils.convertMap; +import static com.platform.marketing.framework.common.util.collection.CollectionUtils.convertSet; +import static com.platform.marketing.module.infra.domain.enums.ErrorCodeConstants.*; + +/** + * 代码生成 Service 实现类 + * + * @author 芋道源码 + */ +@Service +public class CodegenServiceImpl implements CodegenService { + + @Resource + private DatabaseTableService databaseTableService; + + @Resource + private CodegenTableMapper codegenTableMapper; + @Resource + private CodegenColumnMapper codegenColumnMapper; + + @Resource + private CodegenBuilder codegenBuilder; + @Resource + private CodegenEngine codegenEngine; + + @Resource + private CodegenProperties codegenProperties; + + @Override + @Transactional(rollbackFor = Exception.class) + public List createCodegenList(String author, CodegenCreateListReqVO reqVO) { + List ids = new ArrayList<>(reqVO.getTableNames().size()); + // 遍历添加。虽然效率会低一点,但是没必要做成完全批量,因为不会这么大量 + reqVO.getTableNames().forEach(tableName -> ids.add(createCodegen(author, reqVO.getDataSourceConfigId(), tableName))); + return ids; + } + + private Long createCodegen(String author, Long dataSourceConfigId, String tableName) { + // 从数据库中,获得数据库表结构 + TableInfo tableInfo = databaseTableService.getTable(dataSourceConfigId, tableName); + // 导入 + return createCodegen0(author, dataSourceConfigId, tableInfo); + } + + private Long createCodegen0(String author, Long dataSourceConfigId, TableInfo tableInfo) { + // 校验导入的表和字段非空 + validateTableInfo(tableInfo); + // 校验是否已经存在 + if (codegenTableMapper.selectByTableNameAndDataSourceConfigId(tableInfo.getName(), + dataSourceConfigId) != null) { + throw exception(CODEGEN_TABLE_EXISTS); + } + + // 构建 CodegenTableDO 对象,插入到 DB 中 + CodegenTableDO table = codegenBuilder.buildTable(tableInfo); + table.setDataSourceConfigId(dataSourceConfigId); + table.setScene(CodegenSceneEnum.ADMIN.getScene()); // 默认配置下,使用管理后台的模板 + table.setFrontType(codegenProperties.getFrontType()); + table.setAuthor(author); + codegenTableMapper.insert(table); + + // 构建 CodegenColumnDO 数组,插入到 DB 中 + List columns = codegenBuilder.buildColumns(table.getId(), tableInfo.getFields()); + // 如果没有主键,则使用第一个字段作为主键 + if (!tableInfo.isHavePrimaryKey()) { + columns.get(0).setPrimaryKey(true); + } + codegenColumnMapper.insertBatch(columns); + return table.getId(); + } + + @VisibleForTesting + void validateTableInfo(TableInfo tableInfo) { + if (tableInfo == null) { + throw exception(CODEGEN_IMPORT_TABLE_NULL); + } + if (StrUtil.isEmpty(tableInfo.getComment())) { + throw exception(CODEGEN_TABLE_INFO_TABLE_COMMENT_IS_NULL); + } + if (CollUtil.isEmpty(tableInfo.getFields())) { + throw exception(CODEGEN_IMPORT_COLUMNS_NULL); + } + tableInfo.getFields().forEach(field -> { + if (StrUtil.isEmpty(field.getComment())) { + throw exception(CODEGEN_TABLE_INFO_COLUMN_COMMENT_IS_NULL, field.getName()); + } + }); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void updateCodegen(CodegenUpdateReqVO updateReqVO) { + // 校验是否已经存在 + if (codegenTableMapper.selectById(updateReqVO.getTable().getId()) == null) { + throw exception(CODEGEN_TABLE_NOT_EXISTS); + } + // 校验主表字段存在 + if (Objects.equals(updateReqVO.getTable().getTemplateType(), CodegenTemplateTypeEnum.SUB.getType())) { + if (codegenTableMapper.selectById(updateReqVO.getTable().getMasterTableId()) == null) { + throw exception(CODEGEN_MASTER_TABLE_NOT_EXISTS, updateReqVO.getTable().getMasterTableId()); + } + if (CollUtil.findOne(updateReqVO.getColumns(), // 关联主表的字段不存在 + column -> column.getId().equals(updateReqVO.getTable().getSubJoinColumnId())) == null) { + throw exception(CODEGEN_SUB_COLUMN_NOT_EXISTS, updateReqVO.getTable().getSubJoinColumnId()); + } + } + + // 更新 table 表定义 + CodegenTableDO updateTableObj = BeanUtils.toBean(updateReqVO.getTable(), CodegenTableDO.class); + codegenTableMapper.updateById(updateTableObj); + // 更新 column 字段定义 + List updateColumnObjs = BeanUtils.toBean(updateReqVO.getColumns(), CodegenColumnDO.class); + updateColumnObjs.forEach(updateColumnObj -> codegenColumnMapper.updateById(updateColumnObj)); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void syncCodegenFromDB(Long tableId) { + // 校验是否已经存在 + CodegenTableDO table = codegenTableMapper.selectById(tableId); + if (table == null) { + throw exception(CODEGEN_TABLE_NOT_EXISTS); + } + // 从数据库中,获得数据库表结构 + TableInfo tableInfo = databaseTableService.getTable(table.getDataSourceConfigId(), table.getTableName()); + // 执行同步 + syncCodegen0(tableId, tableInfo); + } + + private void syncCodegen0(Long tableId, TableInfo tableInfo) { + // 1. 校验导入的表和字段非空 + validateTableInfo(tableInfo); + List tableFields = tableInfo.getFields(); + + // 2. 构建 CodegenColumnDO 数组,只同步新增的字段 + List codegenColumns = codegenColumnMapper.selectListByTableId(tableId); + Set codegenColumnNames = convertSet(codegenColumns, CodegenColumnDO::getColumnName); + + // 3.1 计算需要【修改】的字段,插入时重新插入,删除时将原来的删除 + Map codegenColumnDOMap = convertMap(codegenColumns, CodegenColumnDO::getColumnName); + BiPredicate primaryKeyPredicate = + (tableField, codegenColumn) -> tableField.getMetaInfo().getJdbcType().name().equals(codegenColumn.getDataType()) + && tableField.getMetaInfo().isNullable() == codegenColumn.getNullable() + && tableField.isKeyFlag() == codegenColumn.getPrimaryKey() + && tableField.getComment().equals(codegenColumn.getColumnComment()); + Set modifyFieldNames = IntStream.range(0, tableFields.size()).mapToObj(index -> { + TableField tableField = tableFields.get(index); + String columnName = tableField.getColumnName(); + CodegenColumnDO codegenColumn = codegenColumnDOMap.get(columnName); + if (codegenColumn == null) { + return null; + } + if (!primaryKeyPredicate.test(tableField, codegenColumn) || codegenColumn.getOrdinalPosition() != index) { + return columnName; + } + return null; + }).filter(Objects::nonNull).collect(Collectors.toSet()); + // 3.2 计算需要【删除】的字段 + Set tableFieldNames = convertSet(tableFields, TableField::getName); + Set deleteColumnIds = codegenColumns.stream() + .filter(column -> (!tableFieldNames.contains(column.getColumnName())) || modifyFieldNames.contains(column.getColumnName())) + .map(CodegenColumnDO::getId).collect(Collectors.toSet()); + // 移除已经存在的字段 + tableFields.removeIf(column -> codegenColumnNames.contains(column.getColumnName()) && (!modifyFieldNames.contains(column.getColumnName()))); + if (CollUtil.isEmpty(tableFields) && CollUtil.isEmpty(deleteColumnIds)) { + throw exception(CODEGEN_SYNC_NONE_CHANGE); + } + + // 4.1 插入新增的字段 + List columns = codegenBuilder.buildColumns(tableId, tableFields); + codegenColumnMapper.insertBatch(columns); + // 4.2 删除不存在的字段 + if (CollUtil.isNotEmpty(deleteColumnIds)) { + codegenColumnMapper.deleteByIds(deleteColumnIds); + } + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void deleteCodegen(Long tableId) { + // 校验是否已经存在 + if (codegenTableMapper.selectById(tableId) == null) { + throw exception(CODEGEN_TABLE_NOT_EXISTS); + } + + // 删除 table 表定义 + codegenTableMapper.deleteById(tableId); + // 删除 column 字段定义 + codegenColumnMapper.deleteListByTableId(tableId); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void deleteCodegenList(List tableIds) { + // 批量删除 table 表定义 + codegenTableMapper.deleteByIds(tableIds); + // 批量删除 column 字段定义 + codegenColumnMapper.deleteListByTableId(tableIds); + } + + @Override + public List getCodegenTableList(Long dataSourceConfigId) { + return codegenTableMapper.selectListByDataSourceConfigId(dataSourceConfigId); + } + + @Override + public PageResult getCodegenTablePage(CodegenTablePageReqVO pageReqVO) { + return codegenTableMapper.selectPage(pageReqVO); + } + + @Override + public CodegenTableDO getCodegenTable(Long id) { + return codegenTableMapper.selectById(id); + } + + @Override + public List getCodegenColumnListByTableId(Long tableId) { + return codegenColumnMapper.selectListByTableId(tableId); + } + + @Override + public Map generationCodes(Long tableId) { + // 校验是否已经存在 + CodegenTableDO table = codegenTableMapper.selectById(tableId); + if (table == null) { + throw exception(CODEGEN_TABLE_NOT_EXISTS); + } + List columns = codegenColumnMapper.selectListByTableId(tableId); + if (CollUtil.isEmpty(columns)) { + throw exception(CODEGEN_COLUMN_NOT_EXISTS); + } + + // 如果是主子表,则加载对应的子表信息 + List subTables = null; + List> subColumnsList = null; + if (CodegenTemplateTypeEnum.isMaster(table.getTemplateType())) { + // 校验子表存在 + subTables = codegenTableMapper.selectListByTemplateTypeAndMasterTableId( + CodegenTemplateTypeEnum.SUB.getType(), tableId); + if (CollUtil.isEmpty(subTables)) { + throw exception(CODEGEN_MASTER_GENERATION_FAIL_NO_SUB_TABLE); + } + // 校验子表的关联字段存在 + subColumnsList = new ArrayList<>(); + for (CodegenTableDO subTable : subTables) { + List subColumns = codegenColumnMapper.selectListByTableId(subTable.getId()); + if (CollUtil.findOne(subColumns, column -> column.getId().equals(subTable.getSubJoinColumnId())) == null) { + throw exception(CODEGEN_SUB_COLUMN_NOT_EXISTS, subTable.getId()); + } + subColumnsList.add(subColumns); + } + } + + // 执行生成 + return codegenEngine.execute(table, columns, subTables, subColumnsList); + } + + @Override + public List getDatabaseTableList(Long dataSourceConfigId, String name, String comment) { + List tables = databaseTableService.getTableList(dataSourceConfigId, name, comment); + // 移除在 Codegen 中,已经存在的 + Set existsTables = convertSet( + codegenTableMapper.selectListByDataSourceConfigId(dataSourceConfigId), CodegenTableDO::getTableName); + tables.removeIf(table -> existsTables.contains(table.getName())); + return BeanUtils.toBean(tables, DatabaseTableRespVO.class); + } + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/service/impl/ConfigServiceImpl.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/service/impl/ConfigServiceImpl.java new file mode 100644 index 0000000..f9caa32 --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/service/impl/ConfigServiceImpl.java @@ -0,0 +1,110 @@ +package com.platform.marketing.module.infra.service.impl; + +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.module.infra.domain.convert.ConfigConvert; +import com.platform.marketing.module.infra.domain.dataobject.ConfigDO; +import com.platform.marketing.module.infra.domain.enums.ConfigTypeEnum; +import com.platform.marketing.module.infra.domain.vo.ConfigPageReqVO; +import com.platform.marketing.module.infra.domain.vo.ConfigSaveReqVO; +import com.platform.marketing.module.infra.mapper.ConfigMapper; +import com.platform.marketing.module.infra.service.ConfigService; +import com.google.common.annotations.VisibleForTesting; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; + +import javax.annotation.Resource; + +import static com.platform.marketing.framework.common.exception.util.ServiceExceptionUtil.exception; +import static com.platform.marketing.module.infra.domain.enums.ErrorCodeConstants.*; + +/** + * 参数配置 Service 实现类 + */ +@Service +@Slf4j +@Validated +public class ConfigServiceImpl implements ConfigService { + + @Resource + private ConfigMapper configMapper; + + @Override + public Long createConfig(ConfigSaveReqVO createReqVO) { + // 校验参数配置 key 的唯一性 + validateConfigKeyUnique(null, createReqVO.getKey()); + + // 插入参数配置 + ConfigDO config = ConfigConvert.INSTANCE.convert(createReqVO); + config.setType(ConfigTypeEnum.CUSTOM.getType()); + configMapper.insert(config); + return config.getId(); + } + + @Override + public void updateConfig(ConfigSaveReqVO updateReqVO) { + // 校验自己存在 + validateConfigExists(updateReqVO.getId()); + // 校验参数配置 key 的唯一性 + validateConfigKeyUnique(updateReqVO.getId(), updateReqVO.getKey()); + + // 更新参数配置 + ConfigDO updateObj = ConfigConvert.INSTANCE.convert(updateReqVO); + configMapper.updateById(updateObj); + } + + @Override + public void deleteConfig(Long id) { + // 校验配置存在 + ConfigDO config = validateConfigExists(id); + // 内置配置,不允许删除 + if (ConfigTypeEnum.SYSTEM.getType().equals(config.getType())) { + throw exception(CONFIG_CAN_NOT_DELETE_SYSTEM_TYPE); + } + // 删除 + configMapper.deleteById(id); + } + + @Override + public ConfigDO getConfig(Long id) { + return configMapper.selectById(id); + } + + @Override + public ConfigDO getConfigByKey(String key) { + return configMapper.selectByKey(key); + } + + @Override + public PageResult getConfigPage(ConfigPageReqVO pageReqVO) { + return configMapper.selectPage(pageReqVO); + } + + @VisibleForTesting + public ConfigDO validateConfigExists(Long id) { + if (id == null) { + return null; + } + ConfigDO config = configMapper.selectById(id); + if (config == null) { + throw exception(CONFIG_NOT_EXISTS); + } + return config; + } + + @VisibleForTesting + public void validateConfigKeyUnique(Long id, String key) { + ConfigDO config = configMapper.selectByKey(key); + if (config == null) { + return; + } + // 如果 id 为空,说明不用比较是否为相同 id 的参数配置 + if (id == null) { + throw exception(CONFIG_KEY_DUPLICATE); + } + if (!config.getId().equals(id)) { + throw exception(CONFIG_KEY_DUPLICATE); + } + } + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/service/impl/DataSourceConfigServiceImpl.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/service/impl/DataSourceConfigServiceImpl.java new file mode 100644 index 0000000..718a5a0 --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/service/impl/DataSourceConfigServiceImpl.java @@ -0,0 +1,107 @@ +package com.platform.marketing.module.infra.service.impl; + +import com.platform.marketing.framework.common.util.object.BeanUtils; +import com.platform.marketing.framework.mybatis.core.util.JdbcUtils; +import com.platform.marketing.module.infra.domain.dataobject.DataSourceConfigDO; +import com.platform.marketing.module.infra.domain.vo.DataSourceConfigSaveReqVO; +import com.platform.marketing.module.infra.mapper.DataSourceConfigMapper; +import com.platform.marketing.module.infra.service.DataSourceConfigService; +import com.baomidou.dynamic.datasource.creator.DataSourceProperty; +import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DynamicDataSourceProperties; +import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; + +import javax.annotation.Resource; +import java.util.List; +import java.util.Objects; + +import static com.platform.marketing.framework.common.exception.util.ServiceExceptionUtil.exception; +import static com.platform.marketing.module.infra.domain.enums.ErrorCodeConstants.DATA_SOURCE_CONFIG_NOT_EXISTS; +import static com.platform.marketing.module.infra.domain.enums.ErrorCodeConstants.DATA_SOURCE_CONFIG_NOT_OK; + +/** + * 数据源配置 Service 实现类 + * + + */ +@Service +@Validated +public class DataSourceConfigServiceImpl implements DataSourceConfigService { + + @Resource + private DataSourceConfigMapper dataSourceConfigMapper; + + @Resource + private DynamicDataSourceProperties dynamicDataSourceProperties; + + @Override + public Long createDataSourceConfig(DataSourceConfigSaveReqVO createReqVO) { + DataSourceConfigDO config = BeanUtils.toBean(createReqVO, DataSourceConfigDO.class); + validateConnectionOK(config); + + // 插入 + dataSourceConfigMapper.insert(config); + // 返回 + return config.getId(); + } + + @Override + public void updateDataSourceConfig(DataSourceConfigSaveReqVO updateReqVO) { + // 校验存在 + validateDataSourceConfigExists(updateReqVO.getId()); + DataSourceConfigDO updateObj = BeanUtils.toBean(updateReqVO, DataSourceConfigDO.class); + validateConnectionOK(updateObj); + + // 更新 + dataSourceConfigMapper.updateById(updateObj); + } + + @Override + public void deleteDataSourceConfig(Long id) { + // 校验存在 + validateDataSourceConfigExists(id); + // 删除 + dataSourceConfigMapper.deleteById(id); + } + + private void validateDataSourceConfigExists(Long id) { + if (dataSourceConfigMapper.selectById(id) == null) { + throw exception(DATA_SOURCE_CONFIG_NOT_EXISTS); + } + } + + @Override + public DataSourceConfigDO getDataSourceConfig(Long id) { + // 如果 id 为 0,默认为 master 的数据源 + if (Objects.equals(id, DataSourceConfigDO.ID_MASTER)) { + return buildMasterDataSourceConfig(); + } + // 从 DB 中读取 + return dataSourceConfigMapper.selectById(id); + } + + @Override + public List getDataSourceConfigList() { + List result = dataSourceConfigMapper.selectList(); + // 补充 master 数据源 + result.add(0, buildMasterDataSourceConfig()); + return result; + } + + private void validateConnectionOK(DataSourceConfigDO config) { + boolean success = JdbcUtils.isConnectionOK(config.getUrl(), config.getUsername(), config.getPassword()); + if (!success) { + throw exception(DATA_SOURCE_CONFIG_NOT_OK); + } + } + + private DataSourceConfigDO buildMasterDataSourceConfig() { + String primary = dynamicDataSourceProperties.getPrimary(); + DataSourceProperty dataSourceProperty = dynamicDataSourceProperties.getDatasource().get(primary); + return new DataSourceConfigDO().setId(DataSourceConfigDO.ID_MASTER).setName(primary) + .setUrl(dataSourceProperty.getUrl()) + .setUsername(dataSourceProperty.getUsername()) + .setPassword(dataSourceProperty.getPassword()); + } + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/service/impl/DatabaseTableServiceImpl.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/service/impl/DatabaseTableServiceImpl.java new file mode 100644 index 0000000..3cf0e71 --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/service/impl/DatabaseTableServiceImpl.java @@ -0,0 +1,79 @@ +package com.platform.marketing.module.infra.service.impl; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.lang.Assert; +import cn.hutool.core.util.StrUtil; +import com.platform.marketing.framework.mybatis.core.util.JdbcUtils; +import com.platform.marketing.module.infra.domain.dataobject.DataSourceConfigDO; +import com.platform.marketing.module.infra.service.DataSourceConfigService; +import com.platform.marketing.module.infra.service.DatabaseTableService; +import com.baomidou.mybatisplus.generator.config.DataSourceConfig; +import com.baomidou.mybatisplus.generator.config.GlobalConfig; +import com.baomidou.mybatisplus.generator.config.StrategyConfig; +import com.baomidou.mybatisplus.generator.config.builder.ConfigBuilder; +import com.baomidou.mybatisplus.generator.config.po.TableInfo; +import com.baomidou.mybatisplus.generator.config.rules.DateType; +import com.baomidou.mybatisplus.generator.query.SQLQuery; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.Comparator; +import java.util.List; +import java.util.stream.Collectors; + +/** + * 数据库表 Service 实现类 + * + + */ +@Service +public class DatabaseTableServiceImpl implements DatabaseTableService { + + @Resource + private DataSourceConfigService dataSourceConfigService; + + @Override + public List getTableList(Long dataSourceConfigId, String nameLike, String commentLike) { + List tables = getTableList0(dataSourceConfigId, null); + return tables.stream().filter(tableInfo -> (StrUtil.isEmpty(nameLike) || tableInfo.getName().contains(nameLike)) + && (StrUtil.isEmpty(commentLike) || tableInfo.getComment().contains(commentLike))) + .collect(Collectors.toList()); + } + + @Override + public TableInfo getTable(Long dataSourceConfigId, String name) { + return CollUtil.getFirst(getTableList0(dataSourceConfigId, name)); + } + + private List getTableList0(Long dataSourceConfigId, String name) { + // 获得数据源配置 + DataSourceConfigDO config = dataSourceConfigService.getDataSourceConfig(dataSourceConfigId); + Assert.notNull(config, "数据源({}) 不存在!", dataSourceConfigId); + + // 使用 MyBatis Plus Generator 解析表结构 + DataSourceConfig.Builder dataSourceConfigBuilder = new DataSourceConfig.Builder(config.getUrl(), config.getUsername(), + config.getPassword()); + if (JdbcUtils.isSQLServer(config.getUrl())) { // 特殊:SQLServer jdbc 非标准,参见 https://github.com/baomidou/mybatis-plus/issues/5419 + dataSourceConfigBuilder.databaseQueryClass(SQLQuery.class); + } + StrategyConfig.Builder strategyConfig = new StrategyConfig.Builder().enableSkipView(); // 忽略视图,业务上一般用不到 + if (StrUtil.isNotEmpty(name)) { + strategyConfig.addInclude(name); + } else { + // 移除工作流和定时任务前缀的表名 + strategyConfig.addExclude("ACT_[\\S\\s]+|QRTZ_[\\S\\s]+|FLW_[\\S\\s]+"); + // 移除 ORACLE 相关的系统表 + strategyConfig.addExclude("IMPDP_[\\S\\s]+|ALL_[\\S\\s]+|HS_[\\S\\\\s]+"); + strategyConfig.addExclude("[\\S\\s]+\\$[\\S\\s]+|[\\S\\s]+\\$"); // 表里不能有 $,一般有都是系统的表 + } + + GlobalConfig globalConfig = new GlobalConfig.Builder().dateType(DateType.TIME_PACK).build(); // 只使用 LocalDateTime 类型,不使用 LocalDate + ConfigBuilder builder = new ConfigBuilder(null, dataSourceConfigBuilder.build(), strategyConfig.build(), + null, globalConfig, null); + // 按照名字排序 + List tables = builder.getTableInfoList(); + tables.sort(Comparator.comparing(TableInfo::getName)); + return tables; + } + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/service/impl/FileConfigServiceImpl.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/service/impl/FileConfigServiceImpl.java new file mode 100644 index 0000000..b4aef8d --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/service/impl/FileConfigServiceImpl.java @@ -0,0 +1,190 @@ +package com.platform.marketing.module.infra.service.impl; + +import cn.hutool.core.io.resource.ResourceUtil; +import cn.hutool.core.util.IdUtil; +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.common.util.json.JsonUtils; +import com.platform.marketing.framework.common.util.validation.ValidationUtils; +import com.platform.marketing.module.infra.domain.convert.FileConfigConvert; +import com.platform.marketing.module.infra.domain.dataobject.FileConfigDO; +import com.platform.marketing.module.infra.domain.vo.FileConfigPageReqVO; +import com.platform.marketing.module.infra.domain.vo.FileConfigSaveReqVO; +import com.platform.marketing.module.infra.framework.file.core.client.FileClient; +import com.platform.marketing.module.infra.framework.file.core.client.FileClientConfig; +import com.platform.marketing.module.infra.framework.file.core.client.FileClientFactory; +import com.platform.marketing.module.infra.framework.file.core.enums.FileStorageEnum; +import com.platform.marketing.module.infra.mapper.FileConfigMapper; +import com.platform.marketing.module.infra.service.FileConfigService; +import com.google.common.cache.CacheLoader; +import com.google.common.cache.LoadingCache; +import lombok.Getter; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.validation.annotation.Validated; + +import javax.annotation.Resource; +import javax.validation.Validator; +import java.time.Duration; +import java.util.Map; +import java.util.Objects; + +import static com.platform.marketing.framework.common.exception.util.ServiceExceptionUtil.exception; +import static com.platform.marketing.framework.common.util.cache.CacheUtils.buildAsyncReloadingCache; +import static com.platform.marketing.module.infra.domain.enums.ErrorCodeConstants.FILE_CONFIG_DELETE_FAIL_MASTER; +import static com.platform.marketing.module.infra.domain.enums.ErrorCodeConstants.FILE_CONFIG_NOT_EXISTS; + +/** + * 文件配置 Service 实现类 + * + + */ +@Service +@Validated +@Slf4j +public class FileConfigServiceImpl implements FileConfigService { + + private static final Long CACHE_MASTER_ID = 0L; + + /** + * {@link FileClient} 缓存,通过它异步刷新 fileClientFactory + */ + @Getter + private final LoadingCache clientCache = buildAsyncReloadingCache(Duration.ofSeconds(10L), + new CacheLoader() { + + @Override + public FileClient load(Long id) { + FileConfigDO config = Objects.equals(CACHE_MASTER_ID, id) ? + fileConfigMapper.selectByMaster() : fileConfigMapper.selectById(id); + if (config != null) { + fileClientFactory.createOrUpdateFileClient(config.getId(), config.getStorage(), config.getConfig()); + } + return fileClientFactory.getFileClient(null == config ? id : config.getId()); + } + + }); + + @Resource + private FileClientFactory fileClientFactory; + + @Resource + private FileConfigMapper fileConfigMapper; + + @Resource + private Validator validator; + + @Override + public Long createFileConfig(FileConfigSaveReqVO createReqVO) { + FileConfigDO fileConfig = FileConfigConvert.INSTANCE.convert(createReqVO) + .setConfig(parseClientConfig(createReqVO.getStorage(), createReqVO.getConfig())) + .setMaster(false); // 默认非 master + fileConfigMapper.insert(fileConfig); + return fileConfig.getId(); + } + + @Override + public void updateFileConfig(FileConfigSaveReqVO updateReqVO) { + // 校验存在 + FileConfigDO config = validateFileConfigExists(updateReqVO.getId()); + // 更新 + FileConfigDO updateObj = FileConfigConvert.INSTANCE.convert(updateReqVO) + .setConfig(parseClientConfig(config.getStorage(), updateReqVO.getConfig())); + fileConfigMapper.updateById(updateObj); + + // 清空缓存 + clearCache(config.getId(), null); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void updateFileConfigMaster(Long id) { + // 校验存在 + validateFileConfigExists(id); + // 更新其它为非 master + fileConfigMapper.updateBatch(new FileConfigDO().setMaster(false)); + // 更新 + fileConfigMapper.updateById(new FileConfigDO().setId(id).setMaster(true)); + + // 清空缓存 + clearCache(null, true); + } + + private FileClientConfig parseClientConfig(Integer storage, Map config) { + // 获取配置类 + Class configClass = FileStorageEnum.getByStorage(storage) + .getConfigClass(); + FileClientConfig clientConfig = JsonUtils.parseObject2(JsonUtils.toJsonString(config), configClass); + // 参数校验 + ValidationUtils.validate(validator, clientConfig); + // 设置参数 + return clientConfig; + } + + @Override + public void deleteFileConfig(Long id) { + // 校验存在 + FileConfigDO config = validateFileConfigExists(id); + if (Boolean.TRUE.equals(config.getMaster())) { + throw exception(FILE_CONFIG_DELETE_FAIL_MASTER); + } + // 删除 + fileConfigMapper.deleteById(id); + + // 清空缓存 + clearCache(id, null); + } + + /** + * 清空指定文件配置 + * + * @param id 配置编号 + * @param master 是否主配置 + */ + private void clearCache(Long id, Boolean master) { + if (id != null) { + clientCache.invalidate(id); + } + if (Boolean.TRUE.equals(master)) { + clientCache.invalidate(CACHE_MASTER_ID); + } + } + + private FileConfigDO validateFileConfigExists(Long id) { + FileConfigDO config = fileConfigMapper.selectById(id); + if (config == null) { + throw exception(FILE_CONFIG_NOT_EXISTS); + } + return config; + } + + @Override + public FileConfigDO getFileConfig(Long id) { + return fileConfigMapper.selectById(id); + } + + @Override + public PageResult getFileConfigPage(FileConfigPageReqVO pageReqVO) { + return fileConfigMapper.selectPage(pageReqVO); + } + + @Override + public String testFileConfig(Long id) throws Exception { + // 校验存在 + validateFileConfigExists(id); + // 上传文件 + byte[] content = ResourceUtil.readBytes("file/qcode.jpeg"); + return getFileClient(id).upload(content, IdUtil.fastSimpleUUID() + ".jpg", "image/jpeg"); + } + + @Override + public FileClient getFileClient(Long id) { + return clientCache.getUnchecked(id); + } + + @Override + public FileClient getMasterFileClient() { + return clientCache.getUnchecked(CACHE_MASTER_ID); + } + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/service/impl/FileServiceImpl.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/service/impl/FileServiceImpl.java new file mode 100644 index 0000000..eae726f --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/service/impl/FileServiceImpl.java @@ -0,0 +1,119 @@ +package com.platform.marketing.module.infra.service.impl; + +import cn.hutool.core.lang.Assert; +import cn.hutool.core.util.StrUtil; +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.common.util.io.FileUtils; +import com.platform.marketing.framework.common.util.object.BeanUtils; +import com.platform.marketing.module.infra.domain.dataobject.FileDO; +import com.platform.marketing.module.infra.domain.vo.FileCreateReqVO; +import com.platform.marketing.module.infra.domain.vo.FilePageReqVO; +import com.platform.marketing.module.infra.domain.vo.FilePresignedUrlRespVO; +import com.platform.marketing.module.infra.framework.file.core.client.FileClient; +import com.platform.marketing.module.infra.framework.file.core.client.s3.FilePresignedUrlRespDTO; +import com.platform.marketing.module.infra.framework.file.core.utils.FileTypeUtils; +import com.platform.marketing.module.infra.mapper.FileMapper; +import com.platform.marketing.module.infra.service.FileConfigService; +import com.platform.marketing.module.infra.service.FileService; +import lombok.SneakyThrows; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; + +import static com.platform.marketing.framework.common.exception.util.ServiceExceptionUtil.exception; +import static com.platform.marketing.module.infra.domain.enums.ErrorCodeConstants.FILE_NOT_EXISTS; + +/** + * 文件 Service 实现类 + * + + */ +@Service +public class FileServiceImpl implements FileService { + + @Resource + private FileConfigService fileConfigService; + + @Resource + private FileMapper fileMapper; + + @Override + public PageResult getFilePage(FilePageReqVO pageReqVO) { + return fileMapper.selectPage(pageReqVO); + } + + @Override + @SneakyThrows + public String createFile(String name, String path, byte[] content) { + // 计算默认的 path 名 + String type = FileTypeUtils.getMineType(content, name); + if (StrUtil.isEmpty(path)) { + path = FileUtils.generatePath(content, name); + } + // 如果 name 为空,则使用 path 填充 + if (StrUtil.isEmpty(name)) { + name = path; + } + + // 上传到文件存储器 + FileClient client = fileConfigService.getMasterFileClient(); + Assert.notNull(client, "客户端(master) 不能为空"); + String url = client.upload(content, path, type); + + // 保存到数据库 + FileDO file = new FileDO(); + file.setConfigId(client.getId()); + file.setName(name); + file.setPath(path); + file.setUrl(url); + file.setType(type); + file.setSize(content.length); + fileMapper.insert(file); + return url; + } + + @Override + public Long createFile(FileCreateReqVO createReqVO) { + FileDO file = BeanUtils.toBean(createReqVO, FileDO.class); + fileMapper.insert(file); + return file.getId(); + } + + @Override + public void deleteFile(Long id) throws Exception { + // 校验存在 + FileDO file = validateFileExists(id); + + // 从文件存储器中删除 + FileClient client = fileConfigService.getFileClient(file.getConfigId()); + Assert.notNull(client, "客户端({}) 不能为空", file.getConfigId()); + client.delete(file.getPath()); + + // 删除记录 + fileMapper.deleteById(id); + } + + private FileDO validateFileExists(Long id) { + FileDO fileDO = fileMapper.selectById(id); + if (fileDO == null) { + throw exception(FILE_NOT_EXISTS); + } + return fileDO; + } + + @Override + public byte[] getFileContent(Long configId, String path) throws Exception { + FileClient client = fileConfigService.getFileClient(configId); + Assert.notNull(client, "客户端({}) 不能为空", configId); + return client.getContent(path); + } + + @Override + public FilePresignedUrlRespVO getFilePresignedUrl(String path) throws Exception { + FileClient fileClient = fileConfigService.getMasterFileClient(); + FilePresignedUrlRespDTO presignedObjectUrl = fileClient.getPresignedObjectUrl(path); + return BeanUtils.toBean(presignedObjectUrl, FilePresignedUrlRespVO.class, + object -> object.setConfigId(fileClient.getId())); + } + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/service/impl/JobLogServiceImpl.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/service/impl/JobLogServiceImpl.java new file mode 100644 index 0000000..d59333e --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/service/impl/JobLogServiceImpl.java @@ -0,0 +1,81 @@ +package com.platform.marketing.module.infra.service.impl; + +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.module.infra.domain.dataobject.JobLogDO; +import com.platform.marketing.module.infra.domain.enums.JobLogStatusEnum; +import com.platform.marketing.module.infra.domain.vo.JobLogPageReqVO; +import com.platform.marketing.module.infra.mapper.JobLogMapper; +import com.platform.marketing.module.infra.service.JobLogService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.scheduling.annotation.Async; +import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; + +import javax.annotation.Resource; +import java.time.LocalDateTime; + +/** + * Job 日志 Service 实现类 + * + + */ +@Service +@Validated +@Slf4j +public class JobLogServiceImpl implements JobLogService { + + @Resource + private JobLogMapper jobLogMapper; + + @Override + public Long createJobLog(Long jobId, LocalDateTime beginTime, + String jobHandlerName, String jobHandlerParam, Integer executeIndex) { + JobLogDO log = JobLogDO.builder().jobId(jobId).handlerName(jobHandlerName) + .handlerParam(jobHandlerParam).executeIndex(executeIndex) + .beginTime(beginTime).status(JobLogStatusEnum.RUNNING.getStatus()).build(); + jobLogMapper.insert(log); + return log.getId(); + } + + @Override + @Async + public void updateJobLogResultAsync(Long logId, LocalDateTime endTime, Integer duration, boolean success, String result) { + try { + JobLogDO updateObj = JobLogDO.builder().id(logId).endTime(endTime).duration(duration) + .status(success ? JobLogStatusEnum.SUCCESS.getStatus() : JobLogStatusEnum.FAILURE.getStatus()) + .result(result).build(); + jobLogMapper.updateById(updateObj); + } catch (Exception ex) { + log.error("[updateJobLogResultAsync][logId({}) endTime({}) duration({}) success({}) result({})]", + logId, endTime, duration, success, result); + } + } + + @Override + @SuppressWarnings("DuplicatedCode") + public Integer cleanJobLog(Integer exceedDay, Integer deleteLimit) { + int count = 0; + LocalDateTime expireDate = LocalDateTime.now().minusDays(exceedDay); + // 循环删除,直到没有满足条件的数据 + for (int i = 0; i < Short.MAX_VALUE; i++) { + int deleteCount = jobLogMapper.deleteByCreateTimeLt(expireDate, deleteLimit); + count += deleteCount; + // 达到删除预期条数,说明到底了 + if (deleteCount < deleteLimit) { + break; + } + } + return count; + } + + @Override + public JobLogDO getJobLog(Long id) { + return jobLogMapper.selectById(id); + } + + @Override + public PageResult getJobLogPage(JobLogPageReqVO pageReqVO) { + return jobLogMapper.selectPage(pageReqVO); + } + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/service/impl/JobServiceImpl.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/service/impl/JobServiceImpl.java new file mode 100644 index 0000000..1cdf6e1 --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/service/impl/JobServiceImpl.java @@ -0,0 +1,203 @@ +package com.platform.marketing.module.infra.service.impl; + +import cn.hutool.extra.spring.SpringUtil; +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.common.util.object.BeanUtils; +import com.platform.marketing.framework.quartz.core.handler.JobHandler; +import com.platform.marketing.framework.quartz.core.scheduler.SchedulerManager; +import com.platform.marketing.framework.quartz.core.util.CronUtils; +import com.platform.marketing.module.infra.domain.dataobject.JobDO; +import com.platform.marketing.module.infra.domain.enums.JobStatusEnum; +import com.platform.marketing.module.infra.domain.vo.JobPageReqVO; +import com.platform.marketing.module.infra.domain.vo.JobSaveReqVO; +import com.platform.marketing.module.infra.mapper.JobMapper; +import com.platform.marketing.module.infra.service.JobService; +import lombok.extern.slf4j.Slf4j; +import org.quartz.SchedulerException; +import org.springframework.beans.factory.NoSuchBeanDefinitionException; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.validation.annotation.Validated; + +import javax.annotation.Resource; +import java.util.List; +import java.util.Objects; + +import static com.platform.marketing.framework.common.exception.util.ServiceExceptionUtil.exception; +import static com.platform.marketing.framework.common.util.collection.CollectionUtils.containsAny; +import static com.platform.marketing.module.infra.domain.enums.ErrorCodeConstants.*; + +/** + * 定时任务 Service 实现类 + * + + */ +@Service +@Validated +@Slf4j +public class JobServiceImpl implements JobService { + + @Resource + private JobMapper jobMapper; + + @Resource + private SchedulerManager schedulerManager; + + @Override + @Transactional(rollbackFor = Exception.class) + public Long createJob(JobSaveReqVO createReqVO) throws SchedulerException { + validateCronExpression(createReqVO.getCronExpression()); + // 1.1 校验唯一性 + if (jobMapper.selectByHandlerName(createReqVO.getHandlerName()) != null) { + throw exception(JOB_HANDLER_EXISTS); + } + // 1.2 校验 JobHandler 是否存在 + validateJobHandlerExists(createReqVO.getHandlerName()); + + // 2. 插入 JobDO + JobDO job = BeanUtils.toBean(createReqVO, JobDO.class); + job.setStatus(JobStatusEnum.INIT.getStatus()); + fillJobMonitorTimeoutEmpty(job); + jobMapper.insert(job); + + // 3.1 添加 Job 到 Quartz 中 + schedulerManager.addJob(job.getId(), job.getHandlerName(), job.getHandlerParam(), job.getCronExpression(), + createReqVO.getRetryCount(), createReqVO.getRetryInterval()); + // 3.2 更新 JobDO + JobDO updateObj = JobDO.builder().id(job.getId()).status(JobStatusEnum.NORMAL.getStatus()).build(); + jobMapper.updateById(updateObj); + return job.getId(); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void updateJob(JobSaveReqVO updateReqVO) throws SchedulerException { + validateCronExpression(updateReqVO.getCronExpression()); + // 1.1 校验存在 + JobDO job = validateJobExists(updateReqVO.getId()); + // 1.2 只有开启状态,才可以修改.原因是,如果出暂停状态,修改 Quartz Job 时,会导致任务又开始执行 + if (!job.getStatus().equals(JobStatusEnum.NORMAL.getStatus())) { + throw exception(JOB_UPDATE_ONLY_NORMAL_STATUS); + } + // 1.3 校验 JobHandler 是否存在 + validateJobHandlerExists(updateReqVO.getHandlerName()); + + // 2. 更新 JobDO + JobDO updateObj = BeanUtils.toBean(updateReqVO, JobDO.class); + fillJobMonitorTimeoutEmpty(updateObj); + jobMapper.updateById(updateObj); + + // 3. 更新 Job 到 Quartz 中 + schedulerManager.updateJob(job.getHandlerName(), updateReqVO.getHandlerParam(), updateReqVO.getCronExpression(), + updateReqVO.getRetryCount(), updateReqVO.getRetryInterval()); + } + + private void validateJobHandlerExists(String handlerName) { + try { + Object handler = SpringUtil.getBean(handlerName); + assert handler != null; + if (!(handler instanceof JobHandler)) { + throw exception(JOB_HANDLER_BEAN_TYPE_ERROR); + } + } catch (NoSuchBeanDefinitionException e) { + throw exception(JOB_HANDLER_BEAN_NOT_EXISTS); + } + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void updateJobStatus(Long id, Integer status) throws SchedulerException { + // 校验 status + if (!containsAny(status, JobStatusEnum.NORMAL.getStatus(), JobStatusEnum.STOP.getStatus())) { + throw exception(JOB_CHANGE_STATUS_INVALID); + } + // 校验存在 + JobDO job = validateJobExists(id); + // 校验是否已经为当前状态 + if (job.getStatus().equals(status)) { + throw exception(JOB_CHANGE_STATUS_EQUALS); + } + // 更新 Job 状态 + JobDO updateObj = JobDO.builder().id(id).status(status).build(); + jobMapper.updateById(updateObj); + + // 更新状态 Job 到 Quartz 中 + if (JobStatusEnum.NORMAL.getStatus().equals(status)) { // 开启 + schedulerManager.resumeJob(job.getHandlerName()); + } else { // 暂停 + schedulerManager.pauseJob(job.getHandlerName()); + } + } + + @Override + public void triggerJob(Long id) throws SchedulerException { + // 校验存在 + JobDO job = validateJobExists(id); + + // 触发 Quartz 中的 Job + schedulerManager.triggerJob(job.getId(), job.getHandlerName(), job.getHandlerParam()); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void syncJob() throws SchedulerException { + // 1. 查询 Job 配置 + List jobList = jobMapper.selectList(); + + // 2. 遍历处理 + for (JobDO job : jobList) { + // 2.1 先删除,再创建 + schedulerManager.deleteJob(job.getHandlerName()); + schedulerManager.addJob(job.getId(), job.getHandlerName(), job.getHandlerParam(), job.getCronExpression(), + job.getRetryCount(), job.getRetryInterval()); + // 2.2 如果 status 为暂停,则需要暂停 + if (Objects.equals(job.getStatus(), JobStatusEnum.STOP.getStatus())) { + schedulerManager.pauseJob(job.getHandlerName()); + } + log.info("[syncJob][id({}) handlerName({}) 同步完成]", job.getId(), job.getHandlerName()); + } + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void deleteJob(Long id) throws SchedulerException { + // 校验存在 + JobDO job = validateJobExists(id); + // 更新 + jobMapper.deleteById(id); + + // 删除 Job 到 Quartz 中 + schedulerManager.deleteJob(job.getHandlerName()); + } + + private JobDO validateJobExists(Long id) { + JobDO job = jobMapper.selectById(id); + if (job == null) { + throw exception(JOB_NOT_EXISTS); + } + return job; + } + + private void validateCronExpression(String cronExpression) { + if (!CronUtils.isValid(cronExpression)) { + throw exception(JOB_CRON_EXPRESSION_VALID); + } + } + + @Override + public JobDO getJob(Long id) { + return jobMapper.selectById(id); + } + + @Override + public PageResult getJobPage(JobPageReqVO pageReqVO) { + return jobMapper.selectPage(pageReqVO); + } + + private static void fillJobMonitorTimeoutEmpty(JobDO job) { + if (job.getMonitorTimeout() == null) { + job.setMonitorTimeout(0); + } + } + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/util/CodegenBuilder.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/util/CodegenBuilder.java new file mode 100644 index 0000000..6287e1c --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/util/CodegenBuilder.java @@ -0,0 +1,220 @@ +package com.platform.marketing.module.infra.util; + +import cn.hutool.core.map.MapUtil; +import cn.hutool.core.util.ReflectUtil; +import cn.hutool.core.util.StrUtil; +import com.platform.marketing.framework.mybatis.core.dataobject.BaseDO; +import com.platform.marketing.module.infra.domain.convert.CodegenConvert; +import com.platform.marketing.module.infra.domain.dataobject.CodegenColumnDO; +import com.platform.marketing.module.infra.domain.dataobject.CodegenTableDO; +import com.platform.marketing.module.infra.domain.enums.CodegenColumnHtmlTypeEnum; +import com.platform.marketing.module.infra.domain.enums.CodegenColumnListConditionEnum; +import com.platform.marketing.module.infra.domain.enums.CodegenTemplateTypeEnum; +import com.baomidou.mybatisplus.generator.config.po.TableField; +import com.baomidou.mybatisplus.generator.config.po.TableInfo; +import com.google.common.collect.Sets; +import org.springframework.stereotype.Component; + +import java.time.LocalDateTime; +import java.util.*; + +import static cn.hutool.core.text.CharSequenceUtil.*; +import static cn.hutool.core.util.RandomUtil.randomEle; +import static cn.hutool.core.util.RandomUtil.randomInt; + +/** + * 代码生成器的 Builder,负责: + * 1. 将数据库的表 {@link TableInfo} 定义,构建成 {@link CodegenTableDO} + * 2. 将数据库的列 {@link TableField} 构定义,建成 {@link CodegenColumnDO} + */ +@Component +public class CodegenBuilder { + + /** + * 字段名与 {@link CodegenColumnListConditionEnum} 的默认映射 + * 注意,字段的匹配以后缀的方式 + */ + private static final Map COLUMN_LIST_OPERATION_CONDITION_MAPPINGS = + MapUtil.builder() + .put("name", CodegenColumnListConditionEnum.LIKE) + .put("time", CodegenColumnListConditionEnum.BETWEEN) + .put("date", CodegenColumnListConditionEnum.BETWEEN) + .build(); + + /** + * 字段名与 {@link com.platform.marketing.module.infra.domain.enums.CodegenColumnHtmlTypeEnum} 的默认映射 + * 注意,字段的匹配以后缀的方式 + */ + private static final Map COLUMN_HTML_TYPE_MAPPINGS = + MapUtil.builder() + .put("status", CodegenColumnHtmlTypeEnum.RADIO) + .put("sex", CodegenColumnHtmlTypeEnum.RADIO) + .put("type", CodegenColumnHtmlTypeEnum.SELECT) + .put("image", CodegenColumnHtmlTypeEnum.IMAGE_UPLOAD) + .put("file", CodegenColumnHtmlTypeEnum.FILE_UPLOAD) + .put("content", CodegenColumnHtmlTypeEnum.EDITOR) + .put("description", CodegenColumnHtmlTypeEnum.EDITOR) + .put("demo", CodegenColumnHtmlTypeEnum.EDITOR) + .put("time", CodegenColumnHtmlTypeEnum.DATETIME) + .put("date", CodegenColumnHtmlTypeEnum.DATETIME) + .build(); + + /** + * 多租户编号的字段名 + */ + public static final String TENANT_ID_FIELD = "tenantId"; + /** + * {@link com.platform.marketing.framework.mybatis.core.dataobject.BaseDO} 的字段 + */ + public static final Set BASE_DO_FIELDS = new HashSet<>(); + /** + * 新增操作,不需要传递的字段 + */ + private static final Set CREATE_OPERATION_EXCLUDE_COLUMN = Sets.newHashSet("id"); + /** + * 修改操作,不需要传递的字段 + */ + private static final Set UPDATE_OPERATION_EXCLUDE_COLUMN = Sets.newHashSet(); + /** + * 列表操作的条件,不需要传递的字段 + */ + private static final Set LIST_OPERATION_EXCLUDE_COLUMN = Sets.newHashSet("id"); + /** + * 列表操作的结果,不需要返回的字段 + */ + private static final Set LIST_OPERATION_RESULT_EXCLUDE_COLUMN = Sets.newHashSet(); + + static { + Arrays.stream(ReflectUtil.getFields(BaseDO.class)).forEach(field -> BASE_DO_FIELDS.add(field.getName())); + BASE_DO_FIELDS.add(TENANT_ID_FIELD); + // 处理 OPERATION 相关的字段 + CREATE_OPERATION_EXCLUDE_COLUMN.addAll(BASE_DO_FIELDS); + UPDATE_OPERATION_EXCLUDE_COLUMN.addAll(BASE_DO_FIELDS); + LIST_OPERATION_EXCLUDE_COLUMN.addAll(BASE_DO_FIELDS); + LIST_OPERATION_EXCLUDE_COLUMN.remove("createTime"); // 创建时间,还是可能需要传递的 + LIST_OPERATION_RESULT_EXCLUDE_COLUMN.addAll(BASE_DO_FIELDS); + LIST_OPERATION_RESULT_EXCLUDE_COLUMN.remove("createTime"); // 创建时间,还是需要返回的 + } + + public CodegenTableDO buildTable(TableInfo tableInfo) { + CodegenTableDO table = CodegenConvert.INSTANCE.convert(tableInfo); + initTableDefault(table); + return table; + } + + /** + * 初始化 Table 表的默认字段 + * + * @param table 表定义 + */ + private void initTableDefault(CodegenTableDO table) { + // 以 system_dept 举例子。moduleName 为 system、businessName 为 dept、className 为 Dept + // 如果希望以 System 前缀,则可以手动在【代码生成 - 修改生成配置 - 基本信息】,将实体类名称改为 SystemDept 即可 + String tableName = table.getTableName().toLowerCase(); + // 第一步,_ 前缀的前面,作为 module 名字;第二步,moduleName 必须小写; + table.setModuleName(subBefore(tableName, '_', false).toLowerCase()); + // 第一步,第一个 _ 前缀的后面,作为 module 名字; 第二步,可能存在多个 _ 的情况,转换成驼峰; 第三步,businessName 必须小写; + table.setBusinessName(toCamelCase(subAfter(tableName, '_', false)).toLowerCase()); + // 驼峰 + 首字母大写;第一步,第一个 _ 前缀的后面,作为 class 名字;第二步,驼峰命名 + table.setClassName(upperFirst(toCamelCase(subAfter(tableName, '_', false)))); + // 去除结尾的表,作为类描述 + table.setClassComment(StrUtil.removeSuffixIgnoreCase(table.getTableComment(), "表")); + table.setTemplateType(CodegenTemplateTypeEnum.ONE.getType()); + } + + public List buildColumns(Long tableId, List tableFields) { + List columns = CodegenConvert.INSTANCE.convertList(tableFields); + int index = 1; + for (CodegenColumnDO column : columns) { + column.setTableId(tableId); + column.setOrdinalPosition(index++); + // 特殊处理:Byte => Integer + if (Byte.class.getSimpleName().equals(column.getJavaType())) { + column.setJavaType(Integer.class.getSimpleName()); + } + // 初始化 Column 列的默认字段 + processColumnOperation(column); // 处理 CRUD 相关的字段的默认值 + processColumnUI(column); // 处理 UI 相关的字段的默认值 + processColumnExample(column); // 处理字段的 swagger example 示例 + } + return columns; + } + + private void processColumnOperation(CodegenColumnDO column) { + // 处理 createOperation 字段 + column.setCreateOperation(!CREATE_OPERATION_EXCLUDE_COLUMN.contains(column.getJavaField()) + && !column.getPrimaryKey()); // 对于主键,创建时无需传递 + // 处理 updateOperation 字段 + column.setUpdateOperation(!UPDATE_OPERATION_EXCLUDE_COLUMN.contains(column.getJavaField()) + || column.getPrimaryKey()); // 对于主键,更新时需要传递 + // 处理 listOperation 字段 + column.setListOperation(!LIST_OPERATION_EXCLUDE_COLUMN.contains(column.getJavaField()) + && !column.getPrimaryKey()); // 对于主键,列表过滤不需要传递 + // 处理 listOperationCondition 字段 + COLUMN_LIST_OPERATION_CONDITION_MAPPINGS.entrySet().stream() + .filter(entry -> StrUtil.endWithIgnoreCase(column.getJavaField(), entry.getKey())) + .findFirst().ifPresent(entry -> column.setListOperationCondition(entry.getValue().getCondition())); + if (column.getListOperationCondition() == null) { + column.setListOperationCondition(CodegenColumnListConditionEnum.EQ.getCondition()); + } + // 处理 listOperationResult 字段 + column.setListOperationResult(!LIST_OPERATION_RESULT_EXCLUDE_COLUMN.contains(column.getJavaField())); + } + + private void processColumnUI(CodegenColumnDO column) { + // 基于后缀进行匹配 + COLUMN_HTML_TYPE_MAPPINGS.entrySet().stream() + .filter(entry -> StrUtil.endWithIgnoreCase(column.getJavaField(), entry.getKey())) + .findFirst().ifPresent(entry -> column.setHtmlType(entry.getValue().getType())); + // 如果是 Boolean 类型时,设置为 radio 类型. + if (Boolean.class.getSimpleName().equals(column.getJavaType())) { + column.setHtmlType(CodegenColumnHtmlTypeEnum.RADIO.getType()); + } + // 如果是 LocalDateTime 类型,则设置为 datetime 类型 + if (LocalDateTime.class.getSimpleName().equals(column.getJavaType())) { + column.setHtmlType(CodegenColumnHtmlTypeEnum.DATETIME.getType()); + } + // 兜底,设置默认为 input 类型 + if (column.getHtmlType() == null) { + column.setHtmlType(CodegenColumnHtmlTypeEnum.INPUT.getType()); + } + } + + /** + * 处理字段的 swagger example 示例 + * + * @param column 字段 + */ + private void processColumnExample(CodegenColumnDO column) { + // id、price、count 等可能是整数的后缀 + if (StrUtil.endWithAnyIgnoreCase(column.getJavaField(), "id", "price", "count")) { + column.setExample(String.valueOf(randomInt(1, Short.MAX_VALUE))); + return; + } + // name + if (StrUtil.endWithIgnoreCase(column.getJavaField(), "name")) { + column.setExample(randomEle(new String[]{"张三", "李四", "王五", "赵六", "芋艿"})); + return; + } + // status + if (StrUtil.endWithAnyIgnoreCase(column.getJavaField(), "status", "type")) { + column.setExample(randomEle(new String[]{"1", "2"})); + return; + } + // url + if (StrUtil.endWithIgnoreCase(column.getColumnName(), "url")) { + column.setExample("https://www.iocoder.cn"); + return; + } + // reason + if (StrUtil.endWithIgnoreCase(column.getColumnName(), "reason")) { + column.setExample(randomEle(new String[]{"不喜欢", "不对", "不好", "不香"})); + return; + } + // description、memo、remark + if (StrUtil.endWithAnyIgnoreCase(column.getColumnName(), "description", "memo", "remark")) { + column.setExample(randomEle(new String[]{"你猜", "随便", "你说的对"})); + } + } + +} diff --git a/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/util/CodegenEngine.java b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/util/CodegenEngine.java new file mode 100644 index 0000000..61a07e2 --- /dev/null +++ b/marketing-module-infra/src/main/java/com/platform/marketing/module/infra/util/CodegenEngine.java @@ -0,0 +1,558 @@ +package com.platform.marketing.module.infra.util; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.map.MapUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.extra.template.TemplateConfig; +import cn.hutool.extra.template.TemplateEngine; +import cn.hutool.extra.template.engine.velocity.VelocityEngine; +import cn.hutool.system.SystemUtil; +import com.platform.marketing.framework.common.exception.util.ServiceExceptionUtil; +import com.platform.marketing.framework.common.pojo.CommonResult; +import com.platform.marketing.framework.common.pojo.PageParam; +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.common.util.collection.CollectionUtils; +import com.platform.marketing.framework.common.util.date.DateUtils; +import com.platform.marketing.framework.common.util.date.LocalDateTimeUtils; +import com.platform.marketing.framework.common.util.object.BeanUtils; +import com.platform.marketing.framework.common.util.object.ObjectUtils; +import com.platform.marketing.framework.common.util.string.StrUtils; +import com.platform.marketing.framework.excel.core.annotations.DictFormat; +import com.platform.marketing.framework.excel.core.convert.DictConvert; +import com.platform.marketing.framework.excel.core.util.ExcelUtils; +import com.platform.marketing.framework.mybatis.core.dataobject.BaseDO; +import com.platform.marketing.framework.mybatis.core.mapper.BaseMapperX; +import com.platform.marketing.framework.mybatis.core.query.LambdaQueryWrapperX; +import com.platform.marketing.module.infra.domain.dataobject.CodegenColumnDO; +import com.platform.marketing.module.infra.domain.dataobject.CodegenTableDO; +import com.platform.marketing.module.infra.domain.enums.CodegenFrontTypeEnum; +import com.platform.marketing.module.infra.domain.enums.CodegenSceneEnum; +import com.platform.marketing.module.infra.domain.enums.CodegenTemplateTypeEnum; +import com.platform.marketing.module.infra.domain.enums.CodegenVOTypeEnum; +import com.platform.marketing.module.infra.framework.codegen.config.CodegenProperties; +import com.google.common.annotations.VisibleForTesting; +import com.google.common.collect.ImmutableTable; +import com.google.common.collect.Maps; +import com.google.common.collect.Table; +import lombok.Setter; +import org.springframework.stereotype.Component; +import org.springframework.util.ClassUtils; + +import javax.annotation.PostConstruct; +import javax.annotation.Resource; +import java.util.*; + +import static cn.hutool.core.map.MapUtil.getStr; +import static cn.hutool.core.text.CharSequenceUtil.*; + +/** + * 代码生成的引擎,用于具体生成代码 + * 目前基于 {@link org.apache.velocity.app.Velocity} 模板引擎实现 + * + * 考虑到 Java 模板引擎的框架非常多,Freemarker、Velocity、Thymeleaf 等等,所以我们采用 hutool 封装的 {@link cn.hutool.extra.template.Template} 抽象 + * + * + */ +@Component +public class CodegenEngine { + + /** + * 后端的模板配置 + * + * key:模板在 resources 的地址 + * value:生成的路径 + */ + private static final Map SERVER_TEMPLATES = MapUtil.builder(new LinkedHashMap<>()) // 有序 + + // Java module-biz(server) Main + .put(javaTemplatePath("domain/vo/pageReqVO"), javaModuleImplVOFilePath("PageReqVO")) + + .put(javaTemplatePath("domain/vo/listReqVO"), javaModuleImplVOFilePath("ListReqVO")) + + .put(javaTemplatePath("domain/vo/respVO"), javaModuleImplVOFilePath("RespVO")) + + .put(javaTemplatePath("domain/vo/saveReqVO"), javaModuleImplVOFilePath("SaveReqVO")) + + .put(javaTemplatePath("controller/controller"), javaModuleImplControllerFilePath()) + + .put(javaTemplatePath("domain/dataobject/do"), + javaModuleImplMainFilePath("domain/dataobject/${table.className}DO")) + + .put(javaTemplatePath("domain/dataobject/do_sub"), // 特殊:主子表专属逻辑 + javaModuleImplMainFilePath("domain/dataobject/${subTable.className}DO")) + + .put(javaTemplatePath("mapper/mapper"), + javaModuleImplMainFilePath("mapper/${table.className}Mapper")) + + .put(javaTemplatePath("mapper/mapper_sub"), // 特殊:主子表专属逻辑 + javaModuleImplMainFilePath("mapper/${subTable.className}Mapper")) + + .put(javaTemplatePath("mapper/mapper.xml"), mapperXmlFilePath()) + + .put(javaTemplatePath("service/serviceImpl"), + javaModuleImplMainFilePath("service/impl/${table.className}ServiceImpl")) + .put(javaTemplatePath("service/service"), + javaModuleImplMainFilePath("service/${table.className}Service")) + // Java module-api Main + // .put(javaTemplatePath("domain/enums/errorcode"), javaModuleApiMainFilePath("domain/enums/ErrorCodeConstants_手动操作")) + .put(javaTemplatePath("domain/enums/errorcode"), javaModuleApiMainFilePath("domain/enums/ErrorCodeConstants")) + // SQL + .put("codegen/sql/sql.vm", "sql/sql.sql") + .put("codegen/sql/h2.vm", "sql/h2.sql") + .build(); + + /** + * 后端的配置模版 + * + * key1:UI 模版的类型 {@link CodegenFrontTypeEnum#getType()} + * key2:模板在 resources 的地址 + * value:生成的路径 + */ + private static final Table FRONT_TEMPLATES = ImmutableTable.builder() + // VUE3_ELEMENT_PLUS + .put(CodegenFrontTypeEnum.VUE3_ELEMENT_PLUS.getType(), vue3TemplatePath("views/index.vue"), + vue3FilePath("views/${table.moduleName}/${table.businessName}/index.vue")) + .put(CodegenFrontTypeEnum.VUE3_ELEMENT_PLUS.getType(), vue3TemplatePath("views/form.vue"), + vue3FilePath("views/${table.moduleName}/${table.businessName}/${simpleClassName}Form.vue")) + .put(CodegenFrontTypeEnum.VUE3_ELEMENT_PLUS.getType(), vue3TemplatePath("views/components/form_sub_normal.vue"), // 特殊:主子表专属逻辑 + vue3FilePath("views/${table.moduleName}/${table.businessName}/components/${subSimpleClassName}Form.vue")) + .put(CodegenFrontTypeEnum.VUE3_ELEMENT_PLUS.getType(), vue3TemplatePath("views/components/form_sub_inner.vue"), // 特殊:主子表专属逻辑 + vue3FilePath("views/${table.moduleName}/${table.businessName}/components/${subSimpleClassName}Form.vue")) + .put(CodegenFrontTypeEnum.VUE3_ELEMENT_PLUS.getType(), vue3TemplatePath("views/components/form_sub_erp.vue"), // 特殊:主子表专属逻辑 + vue3FilePath("views/${table.moduleName}/${table.businessName}/components/${subSimpleClassName}Form.vue")) + .put(CodegenFrontTypeEnum.VUE3_ELEMENT_PLUS.getType(), vue3TemplatePath("views/components/list_sub_inner.vue"), // 特殊:主子表专属逻辑 + vue3FilePath("views/${table.moduleName}/${table.businessName}/components/${subSimpleClassName}List.vue")) + .put(CodegenFrontTypeEnum.VUE3_ELEMENT_PLUS.getType(), vue3TemplatePath("views/components/list_sub_erp.vue"), // 特殊:主子表专属逻辑 + vue3FilePath("views/${table.moduleName}/${table.businessName}/components/${subSimpleClassName}List.vue")) + .put(CodegenFrontTypeEnum.VUE3_ELEMENT_PLUS.getType(), vue3TemplatePath("api/api.ts"), + vue3FilePath("api/${table.moduleName}/${table.businessName}/index.ts")) + .build(); + + @Resource + private CodegenProperties codegenProperties; + + /** + * 是否使用 jakarta 包,用于解决 Spring Boot 2.X 和 3.X 的兼容性问题 + * + * true - 使用 jakarta.validation.constraints.* + * false - 使用 javax.validation.constraints.* + */ + @Setter // 允许设置的原因,是因为单测需要手动改变 + private Boolean jakartaEnable; + + /** + * 是否为 magic-cloud 项目,用于解决 Boot 和 Cloud 的 api 模块兼容性问题 + * + * true - 需要有 magic-module-xxx-api 模块 + * false - 不需要有,使用 api、enum 包即可 + */ + @Setter + private Boolean cloudEnable; + + /** + * 模板引擎,由 hutool 实现 + */ + private final TemplateEngine templateEngine; + /** + * 全局通用变量映射 + */ + private final Map globalBindingMap = new HashMap<>(); + + public CodegenEngine() { + // 初始化 TemplateEngine 属性 + TemplateConfig config = new TemplateConfig(); + config.setResourceMode(TemplateConfig.ResourceMode.CLASSPATH); + this.templateEngine = new VelocityEngine(config); + // 设置 javaxEnable,按照是否使用 JDK17 来判断 + this.jakartaEnable = SystemUtil.getJavaInfo().isJavaVersionAtLeast(1700) // 17.00 * 100 + && ClassUtils.isPresent("jakarta.annotation.Resource", ClassUtils.getDefaultClassLoader()); + // 设置 cloudEnable,按照是否使用 Spring Cloud 来判断 + this.cloudEnable = ClassUtils.isPresent("cn.iocoder.marketing.module.infra.framework.rpc.config.RpcConfiguration", + ClassUtils.getDefaultClassLoader()); + } + + @PostConstruct + @VisibleForTesting + void initGlobalBindingMap() { + // 全局配置 + globalBindingMap.put("basePackage", codegenProperties.getBasePackage()); + globalBindingMap.put("baseFrameworkPackage", codegenProperties.getBasePackage() + + '.' + "framework"); // 用于后续获取测试类的 package 地址 + globalBindingMap.put("jakartaPackage", jakartaEnable ? "jakarta" : "javax"); + globalBindingMap.put("voType", codegenProperties.getVoType()); + globalBindingMap.put("deleteBatchEnable", codegenProperties.getDeleteBatchEnable()); + // 全局 Java Bean + globalBindingMap.put("CommonResultClassName", CommonResult.class.getName()); + globalBindingMap.put("PageResultClassName", PageResult.class.getName()); + // VO 类,独有字段 + globalBindingMap.put("PageParamClassName", PageParam.class.getName()); + globalBindingMap.put("DictFormatClassName", DictFormat.class.getName()); + // DO 类,独有字段 + globalBindingMap.put("BaseDOClassName", BaseDO.class.getName()); + globalBindingMap.put("baseDOFields", CodegenBuilder.BASE_DO_FIELDS); + globalBindingMap.put("QueryWrapperClassName", LambdaQueryWrapperX.class.getName()); + globalBindingMap.put("BaseMapperClassName", BaseMapperX.class.getName()); + // Util 工具类 + globalBindingMap.put("ServiceExceptionUtilClassName", ServiceExceptionUtil.class.getName()); + globalBindingMap.put("DateUtilsClassName", DateUtils.class.getName()); + globalBindingMap.put("ExcelUtilsClassName", ExcelUtils.class.getName()); + globalBindingMap.put("LocalDateTimeUtilsClassName", LocalDateTimeUtils.class.getName()); + globalBindingMap.put("ObjectUtilsClassName", ObjectUtils.class.getName()); + globalBindingMap.put("DictConvertClassName", DictConvert.class.getName()); + + // globalBindingMap.put("OperateTypeEnumClassName", OperateTypeEnum.class.getName()); + + globalBindingMap.put("BeanUtils", BeanUtils.class.getName()); + globalBindingMap.put("CollectionUtilsClassName", CollectionUtils.class.getName()); + } + + /** + * 生成代码 + * + * @param table 表定义 + * @param columns table 的字段定义数组 + * @param subTables 子表数组,当且仅当主子表时使用 + * @param subColumnsList subTables 的字段定义数组 + * @return 生成的代码,key 是路径,value 是对应代码 + */ + public Map execute(CodegenTableDO table, List columns, + List subTables, List> subColumnsList) { + // 1.1 初始化 bindMap 上下文 + Map bindingMap = initBindingMap(table, columns, subTables, subColumnsList); + // 1.2 获得模版 + Map templates = getTemplates(table.getFrontType()); + + // 2. 执行生成 + Map result = Maps.newLinkedHashMapWithExpectedSize(templates.size()); // 有序 + templates.forEach((vmPath, filePath) -> { + // 2.1 特殊:主子表专属逻辑 + if (isSubTemplate(vmPath)) { + generateSubCode(table, subTables, result, vmPath, filePath, bindingMap); + return; + // 2.2 特殊:树表专属逻辑 + } else if (isPageReqVOTemplate(vmPath)) { + // 减少多余的类生成,例如说 PageVO.java 类 + if (CodegenTemplateTypeEnum.isTree(table.getTemplateType())) { + return; + } + } else if (isListReqVOTemplate(vmPath)) { + // 减少多余的类生成,例如说 ListVO.java 类 + if (!CodegenTemplateTypeEnum.isTree(table.getTemplateType())) { + return; + } + } + // 2.3 默认生成 + generateCode(result, vmPath, filePath, bindingMap); + }); + return result; + } + + private void generateCode(Map result, String vmPath, + String filePath, Map bindingMap) { + filePath = formatFilePath(filePath, bindingMap); + String content = templateEngine.getTemplate(vmPath).render(bindingMap); + // 格式化代码 + content = prettyCode(content); + result.put(filePath, content); + } + + private void generateSubCode(CodegenTableDO table, List subTables, + Map result, String vmPath, + String filePath, Map bindingMap) { + // 没有子表,所以不生成 + if (CollUtil.isEmpty(subTables)) { + return; + } + // 主子表的模式匹配。目的:过滤掉个性化的模版 + if (vmPath.contains("_normal") + && ObjectUtil.notEqual(table.getTemplateType(), CodegenTemplateTypeEnum.MASTER_NORMAL.getType())) { + return; + } + if (vmPath.contains("_erp") + && ObjectUtil.notEqual(table.getTemplateType(), CodegenTemplateTypeEnum.MASTER_ERP.getType())) { + return; + } + if (vmPath.contains("_inner") + && ObjectUtil.notEqual(table.getTemplateType(), CodegenTemplateTypeEnum.MASTER_INNER.getType())) { + return; + } + + // 逐个生成 + for (int i = 0; i < subTables.size(); i++) { + bindingMap.put("subIndex", i); + generateCode(result, vmPath, filePath, bindingMap); + } + bindingMap.remove("subIndex"); + } + + /** + * 格式化生成后的代码 + * + * 因为尽量让 vm 模版简单,所以统一的处理都在这个方法。 + * 如果不处理,Vue 的 Pretty 格式校验可能会报错 + * + * @param content 格式化前的代码 + * @return 格式化后的代码 + */ + private String prettyCode(String content) { + // Vue 界面:去除字段后面多余的 , 逗号,解决前端的 Pretty 代码格式检查的报错 + content = content.replaceAll(",\n}", "\n}").replaceAll(",\n }", "\n }"); + // Vue 界面:去除多的 dateFormatter,只有一个的情况下,说明没使用到 + if (StrUtil.count(content, "dateFormatter") == 1) { + content = StrUtils.removeLineContains(content, "dateFormatter"); + } + // Vue2 界面:修正 $refs + if (StrUtil.count(content, "this.refs") >= 1) { + content = content.replace("this.refs", "this.$refs"); + } + // Vue 界面:去除多的 dict 相关,只有一个的情况下,说明没使用到 + if (StrUtil.count(content, "getIntDictOptions") == 1) { + content = content.replace("getIntDictOptions, ", ""); + } + if (StrUtil.count(content, "getStrDictOptions") == 1) { + content = content.replace("getStrDictOptions, ", ""); + } + if (StrUtil.count(content, "getBoolDictOptions") == 1) { + content = content.replace("getBoolDictOptions, ", ""); + } + if (StrUtil.count(content, "DICT_TYPE.") == 0) { + content = StrUtils.removeLineContains(content, "DICT_TYPE"); + } + return content; + } + + private Map initBindingMap(CodegenTableDO table, List columns, + List subTables, List> subColumnsList) { + // 创建 bindingMap + Map bindingMap = new HashMap<>(globalBindingMap); + bindingMap.put("table", table); + bindingMap.put("columns", columns); + bindingMap.put("primaryColumn", CollectionUtils.findFirst(columns, CodegenColumnDO::getPrimaryKey)); // 主键字段 + bindingMap.put("sceneEnum", CodegenSceneEnum.valueOf(table.getScene())); + // className 相关 + // 去掉指定前缀,将 TestDictType 转换成 DictType. 因为在 create 等方法后,不需要带上 Test 前缀 + String className = table.getClassName(); + String simpleClassName = equalsAnyIgnoreCase(table.getClassName(), table.getModuleName()) ? table.getClassName() + : removePrefix(table.getClassName(), upperFirst(table.getModuleName())); + String classNameVar = lowerFirst(simpleClassName); + bindingMap.put("simpleClassName", simpleClassName); + bindingMap.put("simpleClassName_underlineCase", toUnderlineCase(simpleClassName)); // 将 DictType 转换成 dict_type + bindingMap.put("classNameVar", classNameVar); // 将 DictType 转换成 dictType,用于变量 + // 将 DictType 转换成 dict-type + String simpleClassNameStrikeCase = toSymbolCase(simpleClassName, '-'); + bindingMap.put("simpleClassName_strikeCase", simpleClassNameStrikeCase); + // permission 前缀 + bindingMap.put("permissionPrefix", table.getModuleName() + ":" + simpleClassNameStrikeCase); + + // 特殊:树表专属逻辑 + if (CodegenTemplateTypeEnum.isTree(table.getTemplateType())) { + CodegenColumnDO treeParentColumn = CollUtil.findOne(columns, + column -> Objects.equals(column.getId(), table.getTreeParentColumnId())); + bindingMap.put("treeParentColumn", treeParentColumn); + bindingMap.put("treeParentColumn_javaField_underlineCase", toUnderlineCase(treeParentColumn.getJavaField())); + CodegenColumnDO treeNameColumn = CollUtil.findOne(columns, + column -> Objects.equals(column.getId(), table.getTreeNameColumnId())); + bindingMap.put("treeNameColumn", treeNameColumn); + bindingMap.put("treeNameColumn_javaField_underlineCase", toUnderlineCase(treeNameColumn.getJavaField())); + } + + // 特殊:主子表专属逻辑 + if (CollUtil.isNotEmpty(subTables)) { + // 创建 bindingMap + bindingMap.put("subTables", subTables); + bindingMap.put("subColumnsList", subColumnsList); + List subPrimaryColumns = new ArrayList<>(); + List subJoinColumns = new ArrayList<>(); + List subJoinColumnStrikeCases = new ArrayList<>(); + List subSimpleClassNames = new ArrayList<>(); + List subClassNameVars = new ArrayList<>(); + List simpleClassNameUnderlineCases = new ArrayList<>(); + List subSimpleClassNameStrikeCases = new ArrayList<>(); + for (int i = 0; i < subTables.size(); i++) { + CodegenTableDO subTable = subTables.get(i); + List subColumns = subColumnsList.get(i); + subPrimaryColumns.add(CollectionUtils.findFirst(subColumns, CodegenColumnDO::getPrimaryKey)); // + CodegenColumnDO subColumn = CollectionUtils.findFirst(subColumns, // 关联的字段 + column -> Objects.equals(column.getId(), subTable.getSubJoinColumnId())); + subJoinColumns.add(subColumn); + subJoinColumnStrikeCases.add(toSymbolCase(subColumn.getJavaField(), '-')); // 将 DictType 转换成 dict-type + // className 相关 + String subSimpleClassName = removePrefix(subTable.getClassName(), upperFirst(subTable.getModuleName())); + subSimpleClassNames.add(subSimpleClassName); + simpleClassNameUnderlineCases.add(toUnderlineCase(subSimpleClassName)); // 将 DictType 转换成 dict_type + subClassNameVars.add(lowerFirst(subSimpleClassName)); // 将 DictType 转换成 dictType,用于变量 + subSimpleClassNameStrikeCases.add(toSymbolCase(subSimpleClassName, '-')); // 将 DictType 转换成 dict-type + } + bindingMap.put("subPrimaryColumns", subPrimaryColumns); + bindingMap.put("subJoinColumns", subJoinColumns); + bindingMap.put("subJoinColumn_strikeCases", subJoinColumnStrikeCases); + bindingMap.put("subSimpleClassNames", subSimpleClassNames); + bindingMap.put("simpleClassNameUnderlineCases", simpleClassNameUnderlineCases); + bindingMap.put("subClassNameVars", subClassNameVars); + bindingMap.put("subSimpleClassName_strikeCases", subSimpleClassNameStrikeCases); + } + + // 多个 vm 公用的 VO 变量 + if (ObjectUtil.equal(codegenProperties.getVoType(), CodegenVOTypeEnum.VO.getType())) { + String prefixClass = CodegenSceneEnum.valueOf(table.getScene()).getPrefixClass(); + bindingMap.put("saveReqVOClass", prefixClass + className + "SaveReqVO"); + bindingMap.put("updateReqVOClass", prefixClass + className + "SaveReqVO"); + bindingMap.put("respVOClass", prefixClass + className + "RespVO"); + bindingMap.put("saveReqVOVar", "createReqVO"); + bindingMap.put("updateReqVOVar", "updateReqVO"); + } else if (ObjectUtil.equal(codegenProperties.getVoType(), CodegenVOTypeEnum.DO.getType())) { + bindingMap.put("saveReqVOClass", className + "DO"); + bindingMap.put("updateReqVOClass", className + "DO"); + bindingMap.put("respVOClass", className + "DO"); + bindingMap.put("saveReqVOVar", classNameVar); + bindingMap.put("updateReqVOVar", classNameVar); + } + return bindingMap; + } + + private Map getTemplates(Integer frontType) { + Map templates = new LinkedHashMap<>(); + templates.putAll(SERVER_TEMPLATES); + templates.putAll(FRONT_TEMPLATES.row(frontType)); + // 如果是 Boot 项目,则不使用 api/server 模块 + if (Boolean.FALSE.equals(cloudEnable)) { + SERVER_TEMPLATES.forEach((templatePath, filePath) -> { + filePath = StrUtil.replace(filePath, "/magic-module-${table.moduleName}-api", ""); + filePath = StrUtil.replace(filePath, "/magic-module-${table.moduleName}-server", ""); + templates.put(templatePath, filePath); + }); + } + // 如果禁用单元测试,则移除对应的模版 + if (Boolean.FALSE.equals(codegenProperties.getUnitTestEnable())) { + templates.remove(javaTemplatePath("test/serviceTest")); + templates.remove("codegen/sql/h2.vm"); + } + // 如果禁用 VO 类型,则移除对应的模版 + if (ObjectUtil.notEqual(codegenProperties.getVoType(), CodegenVOTypeEnum.VO.getType())) { + templates.remove(javaTemplatePath("controller/vo/respVO")); + templates.remove(javaTemplatePath("controller/vo/saveReqVO")); + } + return templates; + } + + @SuppressWarnings("unchecked") + private String formatFilePath(String filePath, Map bindingMap) { + filePath = StrUtil.replace(filePath, "${basePackage}", + getStr(bindingMap, "basePackage").replaceAll("\\.", "/")); + filePath = StrUtil.replace(filePath, "${classNameVar}", + getStr(bindingMap, "classNameVar")); + filePath = StrUtil.replace(filePath, "${simpleClassName}", + getStr(bindingMap, "simpleClassName")); + // sceneEnum 包含的字段 + CodegenSceneEnum sceneEnum = (CodegenSceneEnum) bindingMap.get("sceneEnum"); + filePath = StrUtil.replace(filePath, "${sceneEnum.prefixClass}", sceneEnum.getPrefixClass()); + filePath = StrUtil.replace(filePath, "${sceneEnum.basePackage}", sceneEnum.getBasePackage()); + // table 包含的字段 + CodegenTableDO table = (CodegenTableDO) bindingMap.get("table"); + filePath = StrUtil.replace(filePath, "${table.moduleName}", table.getModuleName()); + filePath = StrUtil.replace(filePath, "${table.businessName}", table.getBusinessName()); + filePath = StrUtil.replace(filePath, "${table.className}", table.getClassName()); + // 特殊:主子表专属逻辑 + Integer subIndex = (Integer) bindingMap.get("subIndex"); + if (subIndex != null) { + CodegenTableDO subTable = ((List) bindingMap.get("subTables")).get(subIndex); + filePath = StrUtil.replace(filePath, "${subTable.moduleName}", subTable.getModuleName()); + filePath = StrUtil.replace(filePath, "${subTable.businessName}", subTable.getBusinessName()); + filePath = StrUtil.replace(filePath, "${subTable.className}", subTable.getClassName()); + filePath = StrUtil.replace(filePath, "${subSimpleClassName}", + ((List) bindingMap.get("subSimpleClassNames")).get(subIndex)); + filePath = StrUtil.replace(filePath, "${subSimpleClassName_strikeCase}", + ((List) bindingMap.get("subSimpleClassName_strikeCases")).get(subIndex)); + } + return filePath; + } + + private static String javaTemplatePath(String path) { + return "codegen/java/" + path + ".vm"; + } + + private static String javaModuleImplVOFilePath(String path) { + return javaModuleFilePath("domain/vo/${sceneEnum.prefixClass}${table.className}" + path, "server", "main"); + } + + private static String javaModuleImplControllerFilePath() { + return javaModuleFilePath("controller/" + + "${sceneEnum.prefixClass}${table.className}Controller", "server", "main"); + } + + private static String javaModuleImplMainFilePath(String path) { + return javaModuleFilePath(path, "server", "main"); + } + + private static String javaModuleApiMainFilePath(String path) { + return javaModuleFilePath(path, "api", "main"); + } + + private static String javaModuleImplTestFilePath(String path) { + return javaModuleFilePath(path, "server", "test"); + } + + private static String javaModuleFilePath(String path, String module, String src) { + return "magic-module-${table.moduleName}/" + // 顶级模块 + "magic-module-${table.moduleName}-" + module + "/" + // 子模块 + "src/" + src + "/java/${basePackage}/module/${table.moduleName}/" + path + ".java"; + } + + private static String mapperXmlFilePath() { + return "magic-module-${table.moduleName}/" + // 顶级模块 + "magic-module-${table.moduleName}-server/" + // 子模块 + "src/main/resources/mapper/${table.className}Mapper.xml"; + } + + private static String vueTemplatePath(String path) { + return "codegen/vue/" + path + ".vm"; + } + + private static String vueFilePath(String path) { + return "magic-ui-${sceneEnum.basePackage}-vue2/" + // 顶级目录 + "src/" + path; + } + + private static String vue3TemplatePath(String path) { + return "codegen/vue3/" + path + ".vm"; + } + + private static String vue3FilePath(String path) { + return "magic-ui-${sceneEnum.basePackage}-vue3/" + // 顶级目录 + "src/" + path; + } + + private static String vue3VbenTemplatePath(String path) { + return "codegen/vue3_vben/" + path + ".vm"; + } + + private static String vue3Vben5AntdSchemaTemplatePath(String path) { + return "codegen/vue3_vben5_antd/schema/" + path + ".vm"; + } + + private static String vue3Vben5AntdGeneralTemplatePath(String path) { + return "codegen/vue3_vben5_antd/general/" + path + ".vm"; + } + + private static String vue3Vben5EpSchemaTemplatePath(String path) { + return "codegen/vue3_vben5_ele/schema/" + path + ".vm"; + } + + private static String vue3Vben5EpGeneralTemplatePath(String path) { + return "codegen/vue3_vben5_ele/general/" + path + ".vm"; + } + + private static boolean isSubTemplate(String path) { + return path.contains("_sub"); + } + + private static boolean isPageReqVOTemplate(String path) { + return path.contains("pageReqVO"); + } + + private static boolean isListReqVOTemplate(String path) { + return path.contains("listReqVO"); + } + +} diff --git a/marketing-module-infra/src/main/resources/codegen/java/controller/controller.vm b/marketing-module-infra/src/main/resources/codegen/java/controller/controller.vm new file mode 100644 index 0000000..3d1caaf --- /dev/null +++ b/marketing-module-infra/src/main/resources/codegen/java/controller/controller.vm @@ -0,0 +1,268 @@ +package ${basePackage}.module.${table.moduleName}.controller; + +import org.springframework.web.bind.annotation.*; +import ${jakartaPackage}.annotation.Resource; +import org.springframework.validation.annotation.Validated; +#if ($sceneEnum.scene == 1)import org.springframework.security.access.prepost.PreAuthorize;#end + +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Operation; + +import ${jakartaPackage}.validation.constraints.*; +import ${jakartaPackage}.validation.*; +import ${jakartaPackage}.servlet.http.*; +import java.util.*; +import java.io.IOException; + +import ${PageParamClassName}; +import ${PageResultClassName}; +import ${CommonResultClassName}; +import ${BeanUtils}; +import static ${CommonResultClassName}.success; + +import ${ExcelUtilsClassName}; + +import ${basePackage}.module.${table.moduleName}.domain.vo.*; +import ${basePackage}.module.${table.moduleName}.domain.dataobject.${table.className}DO; +## 特殊:主子表专属逻辑 +#foreach ($subTable in $subTables) +import ${basePackage}.module.${subTable.moduleName}.domain.dataobject.${subTable.className}DO; +#end +import ${basePackage}.module.${table.moduleName}.service.${table.className}Service; + +@Tag(name = "${sceneEnum.name} - ${table.classComment}") +@RestController +##二级的 businessName 暂时不算在 HTTP 路径上,可以根据需要写 +@RequestMapping("/${table.moduleName}/${simpleClassName_strikeCase}") +@Validated +public class ${sceneEnum.prefixClass}${table.className}Controller { + + @Resource + private ${table.className}Service ${classNameVar}Service; + + @PostMapping("/create") + @Operation(summary = "创建${table.classComment}") +#if ($sceneEnum.scene == 1) + @PreAuthorize("@ss.hasPermission('${permissionPrefix}:create')") +#end + public CommonResult<${primaryColumn.javaType}> create${simpleClassName}(@Valid @RequestBody ${saveReqVOClass} ${saveReqVOVar}) { + return success(${classNameVar}Service.create${simpleClassName}(${saveReqVOVar})); + } + + @PutMapping("/update") + @Operation(summary = "更新${table.classComment}") +#if ($sceneEnum.scene == 1) + @PreAuthorize("@ss.hasPermission('${permissionPrefix}:update')") +#end + public CommonResult update${simpleClassName}(@Valid @RequestBody ${updateReqVOClass} ${updateReqVOVar}) { + ${classNameVar}Service.update${simpleClassName}(${updateReqVOVar}); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除${table.classComment}") + @Parameter(name = "id", description = "编号", required = true) +#if ($sceneEnum.scene == 1) + @PreAuthorize("@ss.hasPermission('${permissionPrefix}:delete')") +#end + public CommonResult delete${simpleClassName}(@RequestParam("id") ${primaryColumn.javaType} id) { + ${classNameVar}Service.delete${simpleClassName}(id); + return success(true); + } + +#if ( $table.templateType != 2 && $deleteBatchEnable) + @DeleteMapping("/delete-list") + @Parameter(name = "ids", description = "编号", required = true) + @Operation(summary = "批量删除${table.classComment}") + #if ($sceneEnum.scene == 1) + @PreAuthorize("@ss.hasPermission('${permissionPrefix}:delete')") + #end + public CommonResult delete${simpleClassName}List(@RequestParam("ids") List<${primaryColumn.javaType}> ids) { + ${classNameVar}Service.delete${simpleClassName}ListByIds(ids); + return success(true); + } +#end + + @GetMapping("/get") + @Operation(summary = "获得${table.classComment}") + @Parameter(name = "id", description = "编号", required = true, example = "1024") +#if ($sceneEnum.scene == 1) + @PreAuthorize("@ss.hasPermission('${permissionPrefix}:query')") +#end + public CommonResult<${respVOClass}> get${simpleClassName}(@RequestParam("id") ${primaryColumn.javaType} id) { + ${table.className}DO ${classNameVar} = ${classNameVar}Service.get${simpleClassName}(id); +#if ($voType == 10) + return success(BeanUtils.toBean(${classNameVar}, ${respVOClass}.class)); +#else + return success(${classNameVar}); +#end + } + +#if ( $table.templateType != 2 ) + @GetMapping("/page") + @Operation(summary = "获得${table.classComment}分页") +#if ($sceneEnum.scene == 1) + @PreAuthorize("@ss.hasPermission('${permissionPrefix}:query')") +#end + public CommonResult> get${simpleClassName}Page(@Valid ${sceneEnum.prefixClass}${table.className}PageReqVO pageReqVO) { + PageResult<${table.className}DO> pageResult = ${classNameVar}Service.get${simpleClassName}Page(pageReqVO); +#if ($voType == 10) + return success(BeanUtils.toBean(pageResult, ${respVOClass}.class)); +#else + return success(pageResult); +#end + } + +## 特殊:树表专属逻辑(树不需要分页接口) +#else + @GetMapping("/list") + @Operation(summary = "获得${table.classComment}列表") +#if ($sceneEnum.scene == 1) + @PreAuthorize("@ss.hasPermission('${permissionPrefix}:query')") +#end + public CommonResult> get${simpleClassName}List(@Valid ${sceneEnum.prefixClass}${table.className}ListReqVO listReqVO) { + List<${table.className}DO> list = ${classNameVar}Service.get${simpleClassName}List(listReqVO); +#if ($voType == 10) + return success(BeanUtils.toBean(list, ${respVOClass}.class)); +#else + return success(list); +#end + } + +#end + @GetMapping("/export-excel") + @Operation(summary = "导出${table.classComment} Excel") +#if ($sceneEnum.scene == 1) + @PreAuthorize("@ss.hasPermission('${permissionPrefix}:export')") +#end + +#if ( $table.templateType != 2 ) + public void export${simpleClassName}Excel(@Valid ${sceneEnum.prefixClass}${table.className}PageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List<${table.className}DO> list = ${classNameVar}Service.get${simpleClassName}Page(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "${table.classComment}.xls", "数据", ${respVOClass}.class, + BeanUtils.toBean(list, ${respVOClass}.class)); + } +## 特殊:树表专属逻辑(树不需要分页接口) +#else + public void export${simpleClassName}Excel(@Valid ${sceneEnum.prefixClass}${table.className}ListReqVO listReqVO, + HttpServletResponse response) throws IOException { + List<${table.className}DO> list = ${classNameVar}Service.get${simpleClassName}List(listReqVO); + // 导出 Excel + ExcelUtils.write(response, "${table.classComment}.xls", "数据", ${table.className}RespVO.class, + BeanUtils.toBean(list, ${table.className}RespVO.class)); + } +#end + +## 特殊:主子表专属逻辑 +#foreach ($subTable in $subTables) +#set ($index = $foreach.count - 1) +#set ($subSimpleClassName = $subSimpleClassNames.get($index)) +#set ($subPrimaryColumn = $subPrimaryColumns.get($index))##当前 primary 字段 +#set ($subJoinColumn = $subJoinColumns.get($index))##当前 join 字段 +#set ($SubJoinColumnName = $subJoinColumn.javaField.substring(0,1).toUpperCase() + ${subJoinColumn.javaField.substring(1)})##首字母大写 +#set ($subSimpleClassName_strikeCase = $subSimpleClassName_strikeCases.get($index)) +#set ($subJoinColumn_strikeCase = $subJoinColumn_strikeCases.get($index)) +#set ($subClassNameVar = $subClassNameVars.get($index)) + // ==================== 子表($subTable.classComment) ==================== + +## 情况一:MASTER_ERP 时,需要分查询页子表 +#if ( $table.templateType == 11 ) + @GetMapping("/${subSimpleClassName_strikeCase}/page") + @Operation(summary = "获得${subTable.classComment}分页") + @Parameter(name = "${subJoinColumn.javaField}", description = "${subJoinColumn.columnComment}") +#if ($sceneEnum.scene == 1) + @PreAuthorize("@ss.hasPermission('${permissionPrefix}:query')") +#end + public CommonResult> get${subSimpleClassName}Page(PageParam pageReqVO, + @RequestParam("${subJoinColumn.javaField}") ${subJoinColumn.javaType} ${subJoinColumn.javaField}) { + return success(${classNameVar}Service.get${subSimpleClassName}Page(pageReqVO, ${subJoinColumn.javaField})); + } + +## 情况二:非 MASTER_ERP 时,需要列表查询子表 +#else + #if ( $subTable.subJoinMany ) + @GetMapping("/${subSimpleClassName_strikeCase}/list-by-${subJoinColumn_strikeCase}") + @Operation(summary = "获得${subTable.classComment}列表") + @Parameter(name = "${subJoinColumn.javaField}", description = "${subJoinColumn.columnComment}") +#if ($sceneEnum.scene == 1) + @PreAuthorize("@ss.hasPermission('${permissionPrefix}:query')") +#end + public CommonResult> get${subSimpleClassName}ListBy${SubJoinColumnName}(@RequestParam("${subJoinColumn.javaField}") ${subJoinColumn.javaType} ${subJoinColumn.javaField}) { + return success(${classNameVar}Service.get${subSimpleClassName}ListBy${SubJoinColumnName}(${subJoinColumn.javaField})); + } + + #else + @GetMapping("/${subSimpleClassName_strikeCase}/get-by-${subJoinColumn_strikeCase}") + @Operation(summary = "获得${subTable.classComment}") + @Parameter(name = "${subJoinColumn.javaField}", description = "${subJoinColumn.columnComment}") +#if ($sceneEnum.scene == 1) + @PreAuthorize("@ss.hasPermission('${permissionPrefix}:query')") +#end + public CommonResult<${subTable.className}DO> get${subSimpleClassName}By${SubJoinColumnName}(@RequestParam("${subJoinColumn.javaField}") ${subJoinColumn.javaType} ${subJoinColumn.javaField}) { + return success(${classNameVar}Service.get${subSimpleClassName}By${SubJoinColumnName}(${subJoinColumn.javaField})); + } + + #end +#end +## 特殊:MASTER_ERP 时,支持单个的新增、修改、删除操作 +#if ( $table.templateType == 11 ) + @PostMapping("/${subSimpleClassName_strikeCase}/create") + @Operation(summary = "创建${subTable.classComment}") +#if ($sceneEnum.scene == 1) + @PreAuthorize("@ss.hasPermission('${permissionPrefix}:create')") +#end + public CommonResult<${subPrimaryColumn.javaType}> create${subSimpleClassName}(@Valid @RequestBody ${subTable.className}DO ${subClassNameVar}) { + return success(${classNameVar}Service.create${subSimpleClassName}(${subClassNameVar})); + } + + @PutMapping("/${subSimpleClassName_strikeCase}/update") + @Operation(summary = "更新${subTable.classComment}") +#if ($sceneEnum.scene == 1) + @PreAuthorize("@ss.hasPermission('${permissionPrefix}:update')") +#end + public CommonResult update${subSimpleClassName}(@Valid @RequestBody ${subTable.className}DO ${subClassNameVar}) { + ${classNameVar}Service.update${subSimpleClassName}(${subClassNameVar}); + return success(true); + } + + @DeleteMapping("/${subSimpleClassName_strikeCase}/delete") + @Parameter(name = "id", description = "编号", required = true) + @Operation(summary = "删除${subTable.classComment}") +#if ($sceneEnum.scene == 1) + @PreAuthorize("@ss.hasPermission('${permissionPrefix}:delete')") +#end + public CommonResult delete${subSimpleClassName}(@RequestParam("id") ${subPrimaryColumn.javaType} id) { + ${classNameVar}Service.delete${subSimpleClassName}(id); + return success(true); + } + +#if ($deleteBatchEnable) + @DeleteMapping("/${subSimpleClassName_strikeCase}/delete-list") + @Parameter(name = "ids", description = "编号", required = true) + @Operation(summary = "批量删除${subTable.classComment}") +#if ($sceneEnum.scene == 1) + @PreAuthorize("@ss.hasPermission('${permissionPrefix}:delete')") +#end + public CommonResult delete${subSimpleClassName}List(@RequestParam("ids") List<${subPrimaryColumn.javaType}> ids) { + ${classNameVar}Service.delete${subSimpleClassName}ListByIds(ids); + return success(true); + } +#end + + @GetMapping("/${subSimpleClassName_strikeCase}/get") + @Operation(summary = "获得${subTable.classComment}") + @Parameter(name = "id", description = "编号", required = true) +#if ($sceneEnum.scene == 1) + @PreAuthorize("@ss.hasPermission('${permissionPrefix}:query')") +#end + public CommonResult<${subTable.className}DO> get${subSimpleClassName}(@RequestParam("id") ${subPrimaryColumn.javaType} id) { + return success(${classNameVar}Service.get${subSimpleClassName}(id)); + } + +#end +#end +} \ No newline at end of file diff --git a/marketing-module-infra/src/main/resources/codegen/java/domain/dataobject/do.vm b/marketing-module-infra/src/main/resources/codegen/java/domain/dataobject/do.vm new file mode 100644 index 0000000..af1aeae --- /dev/null +++ b/marketing-module-infra/src/main/resources/codegen/java/domain/dataobject/do.vm @@ -0,0 +1,103 @@ +package ${basePackage}.module.${table.moduleName}.domain.dataobject; + +import lombok.*; +import java.util.*; +#foreach ($column in $columns) +#if (${column.javaType} == "BigDecimal") +import java.math.BigDecimal; +#end +#if (${column.javaType} == "LocalDateTime") +import java.time.LocalDateTime; +#end +#end +import com.baomidou.mybatisplus.annotation.*; +import ${BaseDOClassName}; +## 处理 Excel 导出 + Schema 注解(仅 DO 模式) +#if ($voType == 20) +import io.swagger.v3.oas.annotations.media.Schema; +import com.alibaba.excel.annotation.*; +#foreach ($column in $columns) + #if ("$!column.dictType" != "")## 有设置数据字典 + import ${DictFormatClassName}; + import ${DictConvertClassName}; + #break + #end +#end +#end + +/** + * ${table.classComment} DO + * + * @author ${table.author} + */ +@TableName("${table.tableName.toLowerCase()}") +@KeySequence("${table.tableName.toLowerCase()}_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +## 处理 Excel 导出 + Schema 注解(仅 DO 模式) +#if ($voType == 20) +@Schema(description = "${sceneEnum.name} - ${table.classComment} Response VO") +@ExcelIgnoreUnannotated +#end +public class ${table.className}DO extends BaseDO { + +## 特殊:树表专属逻辑 +#if ( $table.templateType == 2 ) + public static final Long ${treeParentColumn_javaField_underlineCase.toUpperCase()}_ROOT = 0L; + +#end +#foreach ($column in $columns) +#if (!${baseDOFields.contains(${column.javaField})})##排除 BaseDO 的字段 + /** + * ${column.columnComment} + #if ("$!column.dictType" != "")##处理枚举值 + * + * 枚举 {@link TODO ${column.dictType} 对应的类} + #end + */ + #if (${column.primaryKey})##处理主键 + @TableId#if (${column.javaType} == 'String')(type = IdType.INPUT)#end + #end +#if ($voType == 20) +## 1. 处理 Swagger 注解 + @Schema(description = "${column.columnComment}"#if (!${column.nullable}), requiredMode = Schema.RequiredMode.REQUIRED#end#if ("$!column.example" != ""), example = "${column.example}"#end) +## 2. 处理 Excel 导出 +#if ("$!column.dictType" != "")##处理枚举值 + @ExcelProperty(value = "${column.columnComment}", converter = DictConvert.class) + @DictFormat("${column.dictType}") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中 +#else + @ExcelProperty("${column.columnComment}") +#end +#end +## 3. 处理字段定义 + private ${column.javaType} ${column.javaField}; +#end +#end + +## 特殊:主子表专属逻辑(非 ERP 模式) +#if ( $voType == 20 && $subTables && $subTables.size() > 0 && $table.templateType != 11 ) + #foreach ($subTable in $subTables) + #set ($index = $foreach.count - 1) + #if ( $subTable.subJoinMany) + /** + * ${subTable.classComment}列表 + */ + @Schema(description = "${subTable.classComment}列表") + @TableField(exist = false) + private List<${subTable.className}DO> ${subClassNameVars.get($index)}s; + #else + /** + * ${subTable.classComment} + */ + @Schema(description = "${subTable.classComment}") + @TableField(exist = false) + private ${subTable.className}DO ${subClassNameVars.get($index)}; + #end + #end +#end + +} \ No newline at end of file diff --git a/marketing-module-infra/src/main/resources/codegen/java/domain/dataobject/do_sub.vm b/marketing-module-infra/src/main/resources/codegen/java/domain/dataobject/do_sub.vm new file mode 100644 index 0000000..96558c7 --- /dev/null +++ b/marketing-module-infra/src/main/resources/codegen/java/domain/dataobject/do_sub.vm @@ -0,0 +1,69 @@ +#set ($subTable = $subTables.get($subIndex))##当前表 +#set ($subColumns = $subColumnsList.get($subIndex))##当前字段数组 +package ${basePackage}.module.${subTable.moduleName}.domain.dataobject; + +import lombok.*; +import java.util.*; +#foreach ($column in $subColumns) +#if (${column.javaType} == "BigDecimal") +import java.math.BigDecimal; +#end +#if (${column.javaType} == "LocalDateTime") +import java.time.LocalDateTime; +#end +#end +import com.baomidou.mybatisplus.annotation.*; +import ${BaseDOClassName}; +## 处理 Schema 注解(仅 DO 模式) +#if ($voType == 20) +import io.swagger.v3.oas.annotations.media.Schema; +#foreach ($column in $columns) + #if ("$!column.dictType" != "")## 有设置数据字典 + import ${DictFormatClassName}; + import ${DictConvertClassName}; + #break + #end +#end +#end + +/** + * ${subTable.classComment} DO + * + * @author ${subTable.author} + */ +@TableName("${subTable.tableName.toLowerCase()}") +@KeySequence("${subTable.tableName.toLowerCase()}_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +## 处理 Schema 注解(仅 DO 模式) +#if ($voType == 20) +@Schema(description = "${sceneEnum.name} - ${table.classComment} Response VO") +#end +public class ${subTable.className}DO extends BaseDO { + +#foreach ($column in $subColumns) +#if (!${baseDOFields.contains(${column.javaField})})##排除 BaseDO 的字段 + /** + * ${column.columnComment} + #if ("$!column.dictType" != "")##处理枚举值 + * + * 枚举 {@link TODO ${column.dictType} 对应的类} + #end + */ + #if (${column.primaryKey})##处理主键 + @TableId#if (${column.javaType} == 'String')(type = IdType.INPUT)#end + #end +#if ($voType == 20) +## 1. 处理 Swagger 注解 + @Schema(description = "${column.columnComment}"#if (!${column.nullable}), requiredMode = Schema.RequiredMode.REQUIRED#end#if ("$!column.example" != ""), example = "${column.example}"#end) +#end +## 2. 处理字段定义 + private ${column.javaType} ${column.javaField}; +#end +#end + +} \ No newline at end of file diff --git a/marketing-module-infra/src/main/resources/codegen/java/domain/enums/errorcode.vm b/marketing-module-infra/src/main/resources/codegen/java/domain/enums/errorcode.vm new file mode 100644 index 0000000..ca816e8 --- /dev/null +++ b/marketing-module-infra/src/main/resources/codegen/java/domain/enums/errorcode.vm @@ -0,0 +1,31 @@ +// TODO 待办:请将下面的错误码复制到 magic-module-${table.moduleName} 模块的 ErrorCodeConstants 类中。注意,请给“TODO 补充编号”设置一个错误码编号!!! +// ========== ${table.classComment} TODO 补充编号 ========== + +package ${basePackage}.module.${table.moduleName}.domain.dataobject.enums; + +import ${basePackage}.framework.common.exception.ErrorCode; + +public interface ErrorCodeConstants { + +ErrorCode ${simpleClassName_underlineCase.toUpperCase()}_NOT_EXISTS = new ErrorCode(TODO 补充编号, "${table.classComment}不存在"); +## 特殊:树表专属逻辑 +#if ( $table.templateType == 2 ) +ErrorCode ${simpleClassName_underlineCase.toUpperCase()}_EXITS_CHILDREN = new ErrorCode(TODO 补充编号, "存在存在子${table.classComment},无法删除"); +ErrorCode ${simpleClassName_underlineCase.toUpperCase()}_PARENT_NOT_EXITS = new ErrorCode(TODO 补充编号,"父级${table.classComment}不存在"); +ErrorCode ${simpleClassName_underlineCase.toUpperCase()}_PARENT_ERROR = new ErrorCode(TODO 补充编号, "不能设置自己为父${table.classComment}"); +ErrorCode ${simpleClassName_underlineCase.toUpperCase()}_${treeNameColumn_javaField_underlineCase.toUpperCase()}_DUPLICATE = new ErrorCode(TODO 补充编号, "已经存在该${treeNameColumn.columnComment}的${table.classComment}"); +ErrorCode ${simpleClassName_underlineCase.toUpperCase()}_PARENT_IS_CHILD = new ErrorCode(TODO 补充编号, "不能设置自己的子${table.className}为父${table.className}"); +#end +## 特殊:主子表专属逻辑 +#if ( $table.templateType == 11 )## 特殊:ERP 情况 +#foreach ($subTable in $subTables) +#set ($index = $foreach.count - 1) +#set ($simpleClassNameUnderlineCase = $simpleClassNameUnderlineCases.get($index)) +ErrorCode ${simpleClassNameUnderlineCase.toUpperCase()}_NOT_EXISTS = new ErrorCode(TODO 补充编号, "${subTable.classComment}不存在"); +#if ( !$subTable.subJoinMany ) +ErrorCode ${simpleClassNameUnderlineCase.toUpperCase()}_EXISTS = new ErrorCode(TODO 补充编号, "${subTable.classComment}已存在"); +#end +#end +#end + +} \ No newline at end of file diff --git a/marketing-module-infra/src/main/resources/codegen/java/domain/vo/listReqVO.vm b/marketing-module-infra/src/main/resources/codegen/java/domain/vo/listReqVO.vm new file mode 100644 index 0000000..42d7f94 --- /dev/null +++ b/marketing-module-infra/src/main/resources/codegen/java/domain/vo/listReqVO.vm @@ -0,0 +1,45 @@ +package ${basePackage}.module.${table.moduleName}.domain.vo; + +import lombok.*; +import java.util.*; +import io.swagger.v3.oas.annotations.media.Schema; +import ${PageParamClassName}; +#foreach ($column in $columns) +#if (${column.javaType} == "BigDecimal") +import java.math.BigDecimal; +#break +#end +#end +## 处理 LocalDateTime 字段的引入 +#foreach ($column in $columns) +#if (${column.listOperation} && ${column.javaType} == "LocalDateTime") +import java.time.LocalDateTime; +import org.springframework.format.annotation.DateTimeFormat; + +import static ${DateUtilsClassName}.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; +#break +#end +#end +## 字段模板 +#macro(columnTpl $prefix $prefixStr) + @Schema(description = "${prefixStr}${column.columnComment}"#if ("$!column.example" != ""), example = "${column.example}"#end) + private ${column.javaType}#if ("$!prefix" != "") ${prefix}${JavaField}#else ${column.javaField}#end; +#end + +@Schema(description = "${sceneEnum.name} - ${table.classComment}列表 Request VO") +@Data +public class ${sceneEnum.prefixClass}${table.className}ListReqVO { + +#foreach ($column in $columns) +#if (${column.listOperation})##查询操作 +#if (${column.listOperationCondition} == "BETWEEN")## 情况一,Between 的时候 + @Schema(description = "${column.columnComment}"#if ("$!column.example" != ""), example = "${column.example}"#end) + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private ${column.javaType}[] ${column.javaField}; +#else##情况二,非 Between 的时间 + #columnTpl('', '') +#end + +#end +#end +} \ No newline at end of file diff --git a/marketing-module-infra/src/main/resources/codegen/java/domain/vo/pageReqVO.vm b/marketing-module-infra/src/main/resources/codegen/java/domain/vo/pageReqVO.vm new file mode 100644 index 0000000..b72bd53 --- /dev/null +++ b/marketing-module-infra/src/main/resources/codegen/java/domain/vo/pageReqVO.vm @@ -0,0 +1,45 @@ +package ${basePackage}.module.${table.moduleName}.domain.vo; + +import lombok.*; +import java.util.*; +import io.swagger.v3.oas.annotations.media.Schema; +import ${PageParamClassName}; +#foreach ($column in $columns) +#if (${column.javaType} == "BigDecimal") +import java.math.BigDecimal; +#break +#end +#end +## 处理 LocalDateTime 字段的引入 +#foreach ($column in $columns) +#if (${column.listOperationCondition} && ${column.javaType} == "LocalDateTime") +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; + +import static ${DateUtilsClassName}.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; +#break +#end +#end +## 字段模板 +#macro(columnTpl $prefix $prefixStr) + @Schema(description = "${prefixStr}${column.columnComment}"#if ("$!column.example" != ""), example = "${column.example}"#end) + private ${column.javaType}#if ("$!prefix" != "") ${prefix}${JavaField}#else ${column.javaField}#end; +#end + +@Schema(description = "${sceneEnum.name} - ${table.classComment}分页 Request VO") +@Data +public class ${sceneEnum.prefixClass}${table.className}PageReqVO extends PageParam { + +#foreach ($column in $columns) +#if (${column.listOperation})##查询操作 +#if (${column.listOperationCondition} == "BETWEEN")## 情况一,Between 的时候 + @Schema(description = "${column.columnComment}"#if ("$!column.example" != ""), example = "${column.example}"#end) + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private ${column.javaType}[] ${column.javaField}; +#else##情况二,非 Between 的时间 + #columnTpl('', '') +#end + +#end +#end +} \ No newline at end of file diff --git a/marketing-module-infra/src/main/resources/codegen/java/domain/vo/respVO.vm b/marketing-module-infra/src/main/resources/codegen/java/domain/vo/respVO.vm new file mode 100644 index 0000000..e767156 --- /dev/null +++ b/marketing-module-infra/src/main/resources/codegen/java/domain/vo/respVO.vm @@ -0,0 +1,53 @@ +package ${basePackage}.module.${table.moduleName}.domain.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +## 处理 BigDecimal 字段的引入 +#foreach ($column in $columns) +#if (${column.javaType} == "BigDecimal") +import java.math.BigDecimal; +#break +#end +#end +## 处理 LocalDateTime 字段的引入 +#foreach ($column in $columns) +#if (${column.listOperationResult} && ${column.javaType} == "LocalDateTime") +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; +#break +#end +#end +## 处理 Excel 导出 +import com.alibaba.excel.annotation.*; +#foreach ($column in $columns) +#if ("$!column.dictType" != "")## 有设置数据字典 +import ${DictFormatClassName}; +import ${DictConvertClassName}; +#break +#end +#end + +@Schema(description = "${sceneEnum.name} - ${table.classComment} Response VO") +@Data +@ExcelIgnoreUnannotated +public class ${sceneEnum.prefixClass}${table.className}RespVO { + +## 逐个处理字段 +#foreach ($column in $columns) +#if (${column.listOperationResult}) +## 1. 处理 Swagger 注解 + @Schema(description = "${column.columnComment}"#if (!${column.nullable}), requiredMode = Schema.RequiredMode.REQUIRED#end#if ("$!column.example" != ""), example = "${column.example}"#end) +## 2. 处理 Excel 导出 +#if ("$!column.dictType" != "")##处理枚举值 + @ExcelProperty(value = "${column.columnComment}", converter = DictConvert.class) + @DictFormat("${column.dictType}") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中 +#else + @ExcelProperty("${column.columnComment}") +#end +## 3. 处理字段定义 + private ${column.javaType} ${column.javaField}; + +#end +#end +} \ No newline at end of file diff --git a/marketing-module-infra/src/main/resources/codegen/java/domain/vo/saveReqVO.vm b/marketing-module-infra/src/main/resources/codegen/java/domain/vo/saveReqVO.vm new file mode 100644 index 0000000..47eaf43 --- /dev/null +++ b/marketing-module-infra/src/main/resources/codegen/java/domain/vo/saveReqVO.vm @@ -0,0 +1,64 @@ +package ${basePackage}.module.${table.moduleName}.domain.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import ${jakartaPackage}.validation.constraints.*; +## 处理 BigDecimal 字段的引入 +#foreach ($column in $columns) +#if (${column.javaType} == "BigDecimal") +import java.math.BigDecimal; +#break +#end +#end +## 处理 LocalDateTime 字段的引入 +#foreach ($column in $columns) +#if ((${column.createOperation} || ${column.updateOperation}) && ${column.javaType} == "LocalDateTime") +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; +#break +#end +#end +## 特殊:主子表专属逻辑 +#foreach ($subTable in $subTables) +import ${basePackage}.module.${subTable.moduleName}.dal.dataobject.${subTable.businessName}.${subTable.className}DO; +#end + +@Schema(description = "${sceneEnum.name} - ${table.classComment}新增/修改 Request VO") +@Data +public class ${sceneEnum.prefixClass}${table.className}SaveReqVO { + +## 逐个处理字段 +#foreach ($column in $columns) +#if (${column.createOperation} || ${column.updateOperation}) +## 1. 处理 Swagger 注解 + @Schema(description = "${column.columnComment}"#if (!${column.nullable}), requiredMode = Schema.RequiredMode.REQUIRED#end#if ("$!column.example" != ""), example = "${column.example}"#end) +## 2. 处理 Validator 参数校验 +#if (!${column.nullable} && !${column.primaryKey}) +#if (${column.javaType} == 'String') + @NotEmpty(message = "${column.columnComment}不能为空") +#else + @NotNull(message = "${column.columnComment}不能为空") +#end +#end +## 3. 处理字段定义 + private ${column.javaType} ${column.javaField}; + +#end +#end +## 特殊:主子表专属逻辑(非 ERP 模式) +#if ( $subTables && $subTables.size() > 0 && $table.templateType != 11 ) +#foreach ($subTable in $subTables) +#set ($index = $foreach.count - 1) + #if ( $subTable.subJoinMany) + @Schema(description = "${subTable.classComment}列表") + private List<${subTable.className}DO> ${subClassNameVars.get($index)}s; + + #else + @Schema(description = "${subTable.classComment}") + private ${subTable.className}DO ${subClassNameVars.get($index)}; + + #end +#end +#end +} \ No newline at end of file diff --git a/marketing-module-infra/src/main/resources/codegen/java/mapper/mapper.vm b/marketing-module-infra/src/main/resources/codegen/java/mapper/mapper.vm new file mode 100644 index 0000000..49076ad --- /dev/null +++ b/marketing-module-infra/src/main/resources/codegen/java/mapper/mapper.vm @@ -0,0 +1,82 @@ +package ${basePackage}.module.${table.moduleName}.mapper; + +import java.util.*; + +import ${PageResultClassName}; +import ${QueryWrapperClassName}; +import ${BaseMapperClassName}; +import ${basePackage}.module.${table.moduleName}.domain.dataobject.${table.className}DO; +import org.apache.ibatis.annotations.Mapper; +import ${basePackage}.module.${table.moduleName}.domain.vo.*; + +## 字段模板 +#macro(listCondition) +#foreach ($column in $columns) +#if (${column.listOperation}) +#set ($JavaField = $column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})##首字母大写 +#if (${column.listOperationCondition} == "=")##情况一,= 的时候 + .eqIfPresent(${table.className}DO::get${JavaField}, reqVO.get${JavaField}()) +#end +#if (${column.listOperationCondition} == "!=")##情况二,!= 的时候 + .neIfPresent(${table.className}DO::get${JavaField}, reqVO.get${JavaField}()) +#end +#if (${column.listOperationCondition} == ">")##情况三,> 的时候 + .gtIfPresent(${table.className}DO::get${JavaField}, reqVO.get${JavaField}()) +#end +#if (${column.listOperationCondition} == ">=")##情况四,>= 的时候 + .geIfPresent(${table.className}DO::get${JavaField}, reqVO.get${JavaField}()) +#end +#if (${column.listOperationCondition} == "<")##情况五,< 的时候 + .ltIfPresent(${table.className}DO::get${JavaField}, reqVO.get${JavaField}()) +#end +#if (${column.listOperationCondition} == "<=")##情况五,<= 的时候 + .leIfPresent(${table.className}DO::get${JavaField}, reqVO.get${JavaField}()) +#end +#if (${column.listOperationCondition} == "LIKE")##情况七,Like 的时候 + .likeIfPresent(${table.className}DO::get${JavaField}, reqVO.get${JavaField}()) +#end +#if (${column.listOperationCondition} == "BETWEEN")##情况八,Between 的时候 + .betweenIfPresent(${table.className}DO::get${JavaField}, reqVO.get${JavaField}()) +#end +#end +#end +#end +/** + * ${table.classComment} Mapper + * + * @author ${table.author} + */ +@Mapper +public interface ${table.className}Mapper extends BaseMapperX<${table.className}DO> { + +## 特殊:树表专属逻辑(树不需要分页接口) +#if ( $table.templateType != 2 ) + default PageResult<${table.className}DO> selectPage(${sceneEnum.prefixClass}${table.className}PageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX<${table.className}DO>() + #listCondition() + .orderByDesc(${table.className}DO::getId));## 大多数情况下,id 倒序 + + } +#else + default List<${table.className}DO> selectList(${sceneEnum.prefixClass}${table.className}ListReqVO reqVO) { + return selectList(new LambdaQueryWrapperX<${table.className}DO>() + #listCondition() + .orderByDesc(${table.className}DO::getId));## 大多数情况下,id 倒序 + + } +#end + +## 特殊:树表专属逻辑 +#if ( $table.templateType == 2 ) +#set ($TreeParentJavaField = $treeParentColumn.javaField.substring(0,1).toUpperCase() + ${treeParentColumn.javaField.substring(1)})##首字母大写 +#set ($TreeNameJavaField = $treeNameColumn.javaField.substring(0,1).toUpperCase() + ${treeNameColumn.javaField.substring(1)})##首字母大写 + default ${table.className}DO selectBy${TreeParentJavaField}And${TreeNameJavaField}(Long ${treeParentColumn.javaField}, String ${treeNameColumn.javaField}) { + return selectOne(${table.className}DO::get${TreeParentJavaField}, ${treeParentColumn.javaField}, ${table.className}DO::get${TreeNameJavaField}, ${treeNameColumn.javaField}); + } + + default Long selectCountBy${TreeParentJavaField}(${treeParentColumn.javaType} ${treeParentColumn.javaField}) { + return selectCount(${table.className}DO::get${TreeParentJavaField}, ${treeParentColumn.javaField}); + } + +#end +} \ No newline at end of file diff --git a/marketing-module-infra/src/main/resources/codegen/java/mapper/mapper.xml.vm b/marketing-module-infra/src/main/resources/codegen/java/mapper/mapper.xml.vm new file mode 100644 index 0000000..4c03cd6 --- /dev/null +++ b/marketing-module-infra/src/main/resources/codegen/java/mapper/mapper.xml.vm @@ -0,0 +1,11 @@ + + + + + + + \ No newline at end of file diff --git a/marketing-module-infra/src/main/resources/codegen/java/mapper/mapper_sub.vm b/marketing-module-infra/src/main/resources/codegen/java/mapper/mapper_sub.vm new file mode 100644 index 0000000..3650bf5 --- /dev/null +++ b/marketing-module-infra/src/main/resources/codegen/java/mapper/mapper_sub.vm @@ -0,0 +1,63 @@ +#set ($subTable = $subTables.get($subIndex))##当前表 +#set ($subColumns = $subJoinColumnsList.get($subIndex))##当前字段数组 +#set ($subJoinColumn = $subJoinColumns.get($subIndex))##当前 join 字段 +#set ($SubJoinColumnName = $subJoinColumn.javaField.substring(0,1).toUpperCase() + ${subJoinColumn.javaField.substring(1)})##首字母大写 +package ${basePackage}.module.${subTable.moduleName}.mapper; + +import java.util.*; + +import ${PageResultClassName}; +import ${PageParamClassName}; +import ${QueryWrapperClassName}; +import ${BaseMapperClassName}; +import ${basePackage}.module.${subTable.moduleName}.domain.dataobject.${subTable.className}DO; +import org.apache.ibatis.annotations.Mapper; + +/** + * ${subTable.classComment} Mapper + * + * @author ${subTable.author} + */ +@Mapper +public interface ${subTable.className}Mapper extends BaseMapperX<${subTable.className}DO> { + +## 情况一:MASTER_ERP 时,需要分查询页子表 +#if ( $table.templateType == 11 ) + default PageResult<${subTable.className}DO> selectPage(PageParam reqVO, ${subJoinColumn.javaType} ${subJoinColumn.javaField}) { + return selectPage(reqVO, new LambdaQueryWrapperX<${subTable.className}DO>() + .eq(${subTable.className}DO::get${SubJoinColumnName}, ${subJoinColumn.javaField}) + .orderByDesc(${subTable.className}DO::getId));## 大多数情况下,id 倒序 + + } +## 主表与子表是一对一时 + #if (!$subTable.subJoinMany) + default ${subTable.className}DO selectBy${SubJoinColumnName}(${subJoinColumn.javaType} ${subJoinColumn.javaField}) { + return selectOne(${subTable.className}DO::get${SubJoinColumnName}, ${subJoinColumn.javaField}); + } + #end + +## 情况二:非 MASTER_ERP 时,需要列表查询子表 +#else + #if ( $subTable.subJoinMany) + default List<${subTable.className}DO> selectListBy${SubJoinColumnName}(${subJoinColumn.javaType} ${subJoinColumn.javaField}) { + return selectList(${subTable.className}DO::get${SubJoinColumnName}, ${subJoinColumn.javaField}); + } + + #else + default ${subTable.className}DO selectBy${SubJoinColumnName}(${subJoinColumn.javaType} ${subJoinColumn.javaField}) { + return selectOne(${subTable.className}DO::get${SubJoinColumnName}, ${subJoinColumn.javaField}); + } + + #end + #end + default int deleteBy${SubJoinColumnName}(${subJoinColumn.javaType} ${subJoinColumn.javaField}) { + return delete(${subTable.className}DO::get${SubJoinColumnName}, ${subJoinColumn.javaField}); + } + +#if ( $table.templateType != 2 && $deleteBatchEnable) + default int deleteBy${SubJoinColumnName}s(List<${subJoinColumn.javaType}> ${subJoinColumn.javaField}s) { + return deleteBatch(${subTable.className}DO::get${SubJoinColumnName}, ${subJoinColumn.javaField}s); + } +#end + +} diff --git a/marketing-module-infra/src/main/resources/codegen/java/service/service.vm b/marketing-module-infra/src/main/resources/codegen/java/service/service.vm new file mode 100644 index 0000000..af92329 --- /dev/null +++ b/marketing-module-infra/src/main/resources/codegen/java/service/service.vm @@ -0,0 +1,165 @@ +package ${basePackage}.module.${table.moduleName}.service; + +import java.util.*; +import ${jakartaPackage}.validation.*; +import ${basePackage}.module.${table.moduleName}.domain.vo.*; +import ${basePackage}.module.${table.moduleName}.domain.dataobject.${table.className}DO; +## 特殊:主子表专属逻辑 +#foreach ($subTable in $subTables) +import ${basePackage}.module.${subTable.moduleName}.domain.dataobject.${subTable.businessName}.${subTable.className}DO; +#end +import ${PageResultClassName}; +import ${PageParamClassName}; + +/** + * ${table.classComment} Service 接口 + * + * @author ${table.author} + */ +public interface ${table.className}Service { + + /** + * 创建${table.classComment} + * + * @param ${saveReqVOVar} 创建信息 + * @return 编号 + */ + ${primaryColumn.javaType} create${simpleClassName}(@Valid ${saveReqVOClass} ${saveReqVOVar}); + + /** + * 更新${table.classComment} + * + * @param ${updateReqVOVar} 更新信息 + */ + void update${simpleClassName}(@Valid ${updateReqVOClass} ${updateReqVOVar}); + + /** + * 删除${table.classComment} + * + * @param id 编号 + */ + void delete${simpleClassName}(${primaryColumn.javaType} id); + +#if ( $table.templateType != 2 && $deleteBatchEnable) + /** + * 批量删除${table.classComment} + * + * @param ids 编号 + */ + void delete${simpleClassName}ListByIds(List<${primaryColumn.javaType}> ids); +#end + + /** + * 获得${table.classComment} + * + * @param id 编号 + * @return ${table.classComment} + */ + ${table.className}DO get${simpleClassName}(${primaryColumn.javaType} id); + +## 特殊:树表专属逻辑(树不需要分页接口) +#if ( $table.templateType != 2 ) + /** + * 获得${table.classComment}分页 + * + * @param pageReqVO 分页查询 + * @return ${table.classComment}分页 + */ + PageResult<${table.className}DO> get${simpleClassName}Page(${sceneEnum.prefixClass}${table.className}PageReqVO pageReqVO); +#else + /** + * 获得${table.classComment}列表 + * + * @param listReqVO 查询条件 + * @return ${table.classComment}列表 + */ + List<${table.className}DO> get${simpleClassName}List(${sceneEnum.prefixClass}${table.className}ListReqVO listReqVO); +#end + +## 特殊:主子表专属逻辑 +#foreach ($subTable in $subTables) +#set ($index = $foreach.count - 1) +#set ($subSimpleClassName = $subSimpleClassNames.get($index)) +#set ($subPrimaryColumn = $subPrimaryColumns.get($index))##当前 primary 字段 +#set ($subJoinColumn = $subJoinColumns.get($index))##当前 join 字段 +#set ($SubJoinColumnName = $subJoinColumn.javaField.substring(0,1).toUpperCase() + ${subJoinColumn.javaField.substring(1)})##首字母大写 +#set ($subClassNameVar = $subClassNameVars.get($index)) + // ==================== 子表($subTable.classComment) ==================== + +## 情况一:MASTER_ERP 时,需要分查询页子表 +#if ( $table.templateType == 11 ) + /** + * 获得${subTable.classComment}分页 + * + * @param pageReqVO 分页查询 + * @param ${subJoinColumn.javaField} ${subJoinColumn.columnComment} + * @return ${subTable.classComment}分页 + */ + PageResult<${subTable.className}DO> get${subSimpleClassName}Page(PageParam pageReqVO, ${subJoinColumn.javaType} ${subJoinColumn.javaField}); + +## 情况二:非 MASTER_ERP 时,需要列表查询子表 +#else + #if ( $subTable.subJoinMany ) + /** + * 获得${subTable.classComment}列表 + * + * @param ${subJoinColumn.javaField} ${subJoinColumn.columnComment} + * @return ${subTable.classComment}列表 + */ + List<${subTable.className}DO> get${subSimpleClassName}ListBy${SubJoinColumnName}(${subJoinColumn.javaType} ${subJoinColumn.javaField}); + + #else + /** + * 获得${subTable.classComment} + * + * @param ${subJoinColumn.javaField} ${subJoinColumn.columnComment} + * @return ${subTable.classComment} + */ + ${subTable.className}DO get${subSimpleClassName}By${SubJoinColumnName}(${subJoinColumn.javaType} ${subJoinColumn.javaField}); + + #end +#end +## 特殊:MASTER_ERP 时,支持单个的新增、修改、删除操作 +#if ( $table.templateType == 11 ) + /** + * 创建${subTable.classComment} + * + * @param ${subClassNameVar} 创建信息 + * @return 编号 + */ + ${subPrimaryColumn.javaType} create${subSimpleClassName}(@Valid ${subTable.className}DO ${subClassNameVar}); + + /** + * 更新${subTable.classComment} + * + * @param ${subClassNameVar} 更新信息 + */ + void update${subSimpleClassName}(@Valid ${subTable.className}DO ${subClassNameVar}); + + /** + * 删除${subTable.classComment} + * + * @param id 编号 + */ + void delete${subSimpleClassName}(${subPrimaryColumn.javaType} id); + +#if ($deleteBatchEnable) + /** + * 批量删除${subTable.classComment} + * + * @param ids 编号 + */ + void delete${subSimpleClassName}ListByIds(List<${subPrimaryColumn.javaType}> ids); +#end + + /** + * 获得${subTable.classComment} + * + * @param id 编号 + * @return ${subTable.classComment} + */ + ${subTable.className}DO get${subSimpleClassName}(${subPrimaryColumn.javaType} id); + +#end +#end +} \ No newline at end of file diff --git a/marketing-module-infra/src/main/resources/codegen/java/service/serviceImpl.vm b/marketing-module-infra/src/main/resources/codegen/java/service/serviceImpl.vm new file mode 100644 index 0000000..faecdc4 --- /dev/null +++ b/marketing-module-infra/src/main/resources/codegen/java/service/serviceImpl.vm @@ -0,0 +1,421 @@ +package ${basePackage}.module.${table.moduleName}.service.${table.businessName}; + +import cn.hutool.core.collection.CollUtil; +import org.springframework.stereotype.Service; +import ${jakartaPackage}.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import org.springframework.transaction.annotation.Transactional; + +import java.util.*; +import ${basePackage}.module.${table.moduleName}.domain.vo.*; +import ${basePackage}.module.${table.moduleName}.domain.dataobject.${table.className}DO; +## 特殊:主子表专属逻辑 +#foreach ($subTable in $subTables) +import ${basePackage}.module.${subTable.moduleName}.domain.dataobject.${subTable.className}DO; +#end +import ${PageResultClassName}; +import ${PageParamClassName}; +import ${BeanUtils}; + +import ${basePackage}.module.${table.moduleName}.service.${table.className}Service; + +import ${basePackage}.module.${table.moduleName}.mapper.${table.className}Mapper; +## 特殊:主子表专属逻辑 +#foreach ($subTable in $subTables) +#set ($index = $foreach.count - 1) +import ${basePackage}.module.${subTable.moduleName}.mapper.${subTable.className}Mapper; +#end + +import static ${ServiceExceptionUtilClassName}.exception; +import static ${CollectionUtilsClassName}.convertList; +import static ${CollectionUtilsClassName}.diffList; +import static ${basePackage}.module.${table.moduleName}.domain.enums.ErrorCodeConstants.*; + +/** + * ${table.classComment} Service 实现类 + * + * @author ${table.author} + */ +@Service +@Validated +public class ${table.className}ServiceImpl implements ${table.className}Service { + + @Resource + private ${table.className}Mapper ${classNameVar}Mapper; +## 特殊:主子表专属逻辑 +#foreach ($subTable in $subTables) +#set ($index = $foreach.count - 1) + @Resource + private ${subTable.className}Mapper ${subClassNameVars.get($index)}Mapper; +#end + + @Override +## 特殊:主子表专属逻辑(非 ERP 模式) +#if ( $subTables && $subTables.size() > 0 && $table.templateType != 11 ) + @Transactional(rollbackFor = Exception.class) +#end + public ${primaryColumn.javaType} create${simpleClassName}(${saveReqVOClass} ${saveReqVOVar}) { +## 特殊:树表专属逻辑 +#if ( $table.templateType == 2 ) +#set ($TreeParentJavaField = $treeParentColumn.javaField.substring(0,1).toUpperCase() + ${treeParentColumn.javaField.substring(1)})##首字母大写 +#set ($TreeNameJavaField = $treeNameColumn.javaField.substring(0,1).toUpperCase() + ${treeNameColumn.javaField.substring(1)})##首字母大写 + // 校验${treeParentColumn.columnComment}的有效性 + validateParent${simpleClassName}(null, ${saveReqVOVar}.get${TreeParentJavaField}()); + // 校验${treeNameColumn.columnComment}的唯一性 + validate${simpleClassName}${TreeNameJavaField}Unique(null, ${saveReqVOVar}.get${TreeParentJavaField}(), ${saveReqVOVar}.get${TreeNameJavaField}()); + +#end + // 插入 +#if ($voType == 10) + ${table.className}DO ${classNameVar} = BeanUtils.toBean(createReqVO, ${table.className}DO.class); + ${classNameVar}Mapper.insert(${classNameVar}); +#else + ${saveReqVOVar}.clean() // 清理掉创建、更新时间等相关属性值 + ${classNameVar}Mapper.insert(${saveReqVOVar}); +#end + +## 特殊:主子表专属逻辑(非 ERP 模式) +#if ( $subTables && $subTables.size() > 0 && $table.templateType != 11 ) + + // 插入子表 +#foreach ($subTable in $subTables) +#set ($index = $foreach.count - 1) +#set ($subSimpleClassName = $subSimpleClassNames.get($index)) +#set ($subJoinColumn = $subJoinColumns.get($index))##当前 join 字段 +#set ($SubJoinColumnName = $subJoinColumn.javaField.substring(0,1).toUpperCase() + ${subJoinColumn.javaField.substring(1)})##首字母大写 + #if ( $subTable.subJoinMany) + create${subSimpleClassName}List(${classNameVar}.getId(), ${saveReqVOVar}.get${subSimpleClassNames.get($index)}s()); + #else + create${subSimpleClassName}(${classNameVar}.getId(), ${saveReqVOVar}.get${subSimpleClassNames.get($index)}()); + #end +#end +#end + // 返回 + return ${classNameVar}.getId(); + } + + @Override +## 特殊:主子表专属逻辑(非 ERP 模式) +#if ( $subTables && $subTables.size() > 0 && $table.templateType != 11 ) + @Transactional(rollbackFor = Exception.class) +#end + public void update${simpleClassName}(${updateReqVOClass} ${updateReqVOVar}) { + // 校验存在 + validate${simpleClassName}Exists(${updateReqVOVar}.getId()); +## 特殊:树表专属逻辑 +#if ( $table.templateType == 2 ) +#set ($TreeParentJavaField = $treeParentColumn.javaField.substring(0,1).toUpperCase() + ${treeParentColumn.javaField.substring(1)})##首字母大写 +#set ($TreeNameJavaField = $treeNameColumn.javaField.substring(0,1).toUpperCase() + ${treeNameColumn.javaField.substring(1)})##首字母大写 + // 校验${treeParentColumn.columnComment}的有效性 + validateParent${simpleClassName}(${updateReqVOVar}.getId(), ${updateReqVOVar}.get${TreeParentJavaField}()); + // 校验${treeNameColumn.columnComment}的唯一性 + validate${simpleClassName}${TreeNameJavaField}Unique(${updateReqVOVar}.getId(), ${updateReqVOVar}.get${TreeParentJavaField}(), ${updateReqVOVar}.get${TreeNameJavaField}()); + +#end + // 更新 +#if ($voType == 10) + ${table.className}DO updateObj = BeanUtils.toBean(updateReqVO, ${table.className}DO.class); + ${classNameVar}Mapper.updateById(updateObj); +#else + ${updateReqVOVar}.clean() // 清理掉创建、更新时间等相关属性值 + ${classNameVar}Mapper.updateById(${updateReqVOVar}); +#end +## 特殊:主子表专属逻辑(非 ERP 模式) +#if ( $subTables && $subTables.size() > 0 && $table.templateType != 11) + + // 更新子表 +#foreach ($subTable in $subTables) +#set ($index = $foreach.count - 1) +#set ($subSimpleClassName = $subSimpleClassNames.get($index)) +#set ($subJoinColumn = $subJoinColumns.get($index))##当前 join 字段 +#set ($SubJoinColumnName = $subJoinColumn.javaField.substring(0,1).toUpperCase() + ${subJoinColumn.javaField.substring(1)})##首字母大写 + #if ( $subTable.subJoinMany) + update${subSimpleClassName}List(${updateReqVOVar}.getId(), ${updateReqVOVar}.get${subSimpleClassNames.get($index)}s()); + #else + update${subSimpleClassName}(${updateReqVOVar}.getId(), ${updateReqVOVar}.get${subSimpleClassNames.get($index)}()); + #end +#end +#end + } + + @Override +## 特殊:主子表专属逻辑 +#if ( $subTables && $subTables.size() > 0) + @Transactional(rollbackFor = Exception.class) +#end + public void delete${simpleClassName}(${primaryColumn.javaType} id) { + // 校验存在 + validate${simpleClassName}Exists(id); +## 特殊:树表专属逻辑 +#if ( $table.templateType == 2 ) +#set ($ParentJavaField = $treeParentColumn.javaField.substring(0,1).toUpperCase() + ${treeParentColumn.javaField.substring(1)})##首字母大写 + // 校验是否有子${table.classComment} + if (${classNameVar}Mapper.selectCountBy${ParentJavaField}(id) > 0) { + throw exception(${simpleClassName_underlineCase.toUpperCase()}_EXITS_CHILDREN); + } +#end + // 删除 + ${classNameVar}Mapper.deleteById(id); +## 特殊:主子表专属逻辑 +#if ( $subTables && $subTables.size() > 0) + + // 删除子表 +#foreach ($subTable in $subTables) +#set ($index = $foreach.count - 1) +#set ($subSimpleClassName = $subSimpleClassNames.get($index)) +#set ($subJoinColumn = $subJoinColumns.get($index))##当前 join 字段 +#set ($SubJoinColumnName = $subJoinColumn.javaField.substring(0,1).toUpperCase() + ${subJoinColumn.javaField.substring(1)})##首字母大写 + delete${subSimpleClassName}By${SubJoinColumnName}(id); +#end +#end + } + +#if ( $table.templateType != 2 && $deleteBatchEnable) + @Override + ## 特殊:主子表专属逻辑 + #if ( $subTables && $subTables.size() > 0) + @Transactional(rollbackFor = Exception.class) + #end + public void delete${simpleClassName}ListByIds(List<${primaryColumn.javaType}> ids) { + // 删除 + ${classNameVar}Mapper.deleteByIds(ids); + ## 特殊:主子表专属逻辑 + #if ( $subTables && $subTables.size() > 0) + + // 删除子表 + #foreach ($subTable in $subTables) + #set ($index = $foreach.count - 1) + #set ($subSimpleClassName = $subSimpleClassNames.get($index)) + #set ($subJoinColumn = $subJoinColumns.get($index))##当前 join 字段 + #set ($SubJoinColumnName = $subJoinColumn.javaField.substring(0,1).toUpperCase() + ${subJoinColumn.javaField.substring(1)})##首字母大写 + delete${subSimpleClassName}By${SubJoinColumnName}s(ids); + #end + #end + } + +#end + + private void validate${simpleClassName}Exists(${primaryColumn.javaType} id) { + if (${classNameVar}Mapper.selectById(id) == null) { + throw exception(${simpleClassName_underlineCase.toUpperCase()}_NOT_EXISTS); + } + } + +## 特殊:树表专属逻辑 +#if ( $table.templateType == 2 ) +#set ($TreeParentJavaField = $treeParentColumn.javaField.substring(0,1).toUpperCase() + ${treeParentColumn.javaField.substring(1)})##首字母大写 +#set ($TreeNameJavaField = $treeNameColumn.javaField.substring(0,1).toUpperCase() + ${treeNameColumn.javaField.substring(1)})##首字母大写 + private void validateParent${simpleClassName}(Long id, Long ${treeParentColumn.javaField}) { + if (${treeParentColumn.javaField} == null || ${simpleClassName}DO.${treeParentColumn_javaField_underlineCase.toUpperCase()}_ROOT.equals(${treeParentColumn.javaField})) { + return; + } + // 1. 不能设置自己为父${table.classComment} + if (Objects.equals(id, ${treeParentColumn.javaField})) { + throw exception(${simpleClassName_underlineCase.toUpperCase()}_PARENT_ERROR); + } + // 2. 父${table.classComment}不存在 + ${simpleClassName}DO parent${simpleClassName} = ${classNameVar}Mapper.selectById(${treeParentColumn.javaField}); + if (parent${simpleClassName} == null) { + throw exception(${simpleClassName_underlineCase.toUpperCase()}_PARENT_NOT_EXITS); + } + // 3. 递归校验父${table.classComment},如果父${table.classComment}是自己的子${table.classComment},则报错,避免形成环路 + if (id == null) { // id 为空,说明新增,不需要考虑环路 + return; + } + for (int i = 0; i < Short.MAX_VALUE; i++) { + // 3.1 校验环路 + ${treeParentColumn.javaField} = parent${simpleClassName}.get${TreeParentJavaField}(); + if (Objects.equals(id, ${treeParentColumn.javaField})) { + throw exception(${simpleClassName_underlineCase.toUpperCase()}_PARENT_IS_CHILD); + } + // 3.2 继续递归下一级父${table.classComment} + if (${treeParentColumn.javaField} == null || ${simpleClassName}DO.${treeParentColumn_javaField_underlineCase.toUpperCase()}_ROOT.equals(${treeParentColumn.javaField})) { + break; + } + parent${simpleClassName} = ${classNameVar}Mapper.selectById(${treeParentColumn.javaField}); + if (parent${simpleClassName} == null) { + break; + } + } + } + + private void validate${simpleClassName}${TreeNameJavaField}Unique(Long id, Long ${treeParentColumn.javaField}, String ${treeNameColumn.javaField}) { + ${simpleClassName}DO ${classNameVar} = ${classNameVar}Mapper.selectBy${TreeParentJavaField}And${TreeNameJavaField}(${treeParentColumn.javaField}, ${treeNameColumn.javaField}); + if (${classNameVar} == null) { + return; + } + // 如果 id 为空,说明不用比较是否为相同 id 的${table.classComment} + if (id == null) { + throw exception(${simpleClassName_underlineCase.toUpperCase()}_${treeNameColumn_javaField_underlineCase.toUpperCase()}_DUPLICATE); + } + if (!Objects.equals(${classNameVar}.getId(), id)) { + throw exception(${simpleClassName_underlineCase.toUpperCase()}_${treeNameColumn_javaField_underlineCase.toUpperCase()}_DUPLICATE); + } + } + +#end + @Override + public ${table.className}DO get${simpleClassName}(${primaryColumn.javaType} id) { + return ${classNameVar}Mapper.selectById(id); + } + +## 特殊:树表专属逻辑(树不需要分页接口) +#if ( $table.templateType != 2 ) + @Override + public PageResult<${table.className}DO> get${simpleClassName}Page(${sceneEnum.prefixClass}${table.className}PageReqVO pageReqVO) { + return ${classNameVar}Mapper.selectPage(pageReqVO); + } +#else + @Override + public List<${table.className}DO> get${simpleClassName}List(${sceneEnum.prefixClass}${table.className}ListReqVO listReqVO) { + return ${classNameVar}Mapper.selectList(listReqVO); + } +#end + +## 特殊:主子表专属逻辑 +#foreach ($subTable in $subTables) +#set ($index = $foreach.count - 1) +#set ($subSimpleClassName = $subSimpleClassNames.get($index)) +#set ($simpleClassNameUnderlineCase = $simpleClassNameUnderlineCases.get($index)) +#set ($subPrimaryColumn = $subPrimaryColumns.get($index))##当前 primary 字段 +#set ($subJoinColumn = $subJoinColumns.get($index))##当前 join 字段 +#set ($SubJoinColumnName = $subJoinColumn.javaField.substring(0,1).toUpperCase() + ${subJoinColumn.javaField.substring(1)})##首字母大写 +#set ($subClassNameVar = $subClassNameVars.get($index)) + // ==================== 子表($subTable.classComment) ==================== + +## 情况一:MASTER_ERP 时,需要分查询页子表 +#if ( $table.templateType == 11 ) + @Override + public PageResult<${subTable.className}DO> get${subSimpleClassName}Page(PageParam pageReqVO, ${subJoinColumn.javaType} ${subJoinColumn.javaField}) { + return ${subClassNameVars.get($index)}Mapper.selectPage(pageReqVO, ${subJoinColumn.javaField}); + } + +## 情况二:非 MASTER_ERP 时,需要列表查询子表 +#else + #if ( $subTable.subJoinMany ) + @Override + public List<${subTable.className}DO> get${subSimpleClassName}ListBy${SubJoinColumnName}(${subJoinColumn.javaType} ${subJoinColumn.javaField}) { + return ${subClassNameVars.get($index)}Mapper.selectListBy${SubJoinColumnName}(${subJoinColumn.javaField}); + } + + #else + @Override + public ${subTable.className}DO get${subSimpleClassName}By${SubJoinColumnName}(${subJoinColumn.javaType} ${subJoinColumn.javaField}) { + return ${subClassNameVars.get($index)}Mapper.selectBy${SubJoinColumnName}(${subJoinColumn.javaField}); + } + + #end +#end +## 情况一:MASTER_ERP 时,支持单个的新增、修改、删除操作 +#if ( $table.templateType == 11 ) + @Override + public ${subPrimaryColumn.javaType} create${subSimpleClassName}(${subTable.className}DO ${subClassNameVar}) { +## 特殊:一对一时,需要保证只有一条,不能重复插入 +#if ( !$subTable.subJoinMany) + // 校验是否已经存在 + if (${subClassNameVars.get($index)}Mapper.selectBy${SubJoinColumnName}(${subClassNameVar}.get${SubJoinColumnName}()) != null) { + throw exception(${simpleClassNameUnderlineCase.toUpperCase()}_EXISTS); + } + // 插入 +#end + ${subClassNameVar}.clean() // 清理掉创建、更新时间等相关属性值 + ${subClassNameVars.get($index)}Mapper.insert(${subClassNameVar}); + return ${subClassNameVar}.getId(); + } + + @Override + public void update${subSimpleClassName}(${subTable.className}DO ${subClassNameVar}) { + // 校验存在 + validate${subSimpleClassName}Exists(${subClassNameVar}.getId()); + // 更新 + ${subClassNameVar}.clean(); // 解决更新情况下:updateTime 不更新 + ${subClassNameVars.get($index)}Mapper.updateById(${subClassNameVar}); + } + + @Override + public void delete${subSimpleClassName}(${subPrimaryColumn.javaType} id) { + // 删除 + ${subClassNameVars.get($index)}Mapper.deleteById(id); + } + +#if ($deleteBatchEnable) + @Override + public void delete${subSimpleClassName}ListByIds(List<${subPrimaryColumn.javaType}> ids) { + // 删除 + ${subClassNameVars.get($index)}Mapper.deleteByIds(ids); + } +#end + + @Override + public ${subTable.className}DO get${subSimpleClassName}(${subPrimaryColumn.javaType} id) { + return ${subClassNameVars.get($index)}Mapper.selectById(id); + } + + private void validate${subSimpleClassName}Exists(${subPrimaryColumn.javaType} id) { + if (${subClassNameVar}Mapper.selectById(id) == null) { + throw exception(${simpleClassNameUnderlineCase.toUpperCase()}_NOT_EXISTS); + } + } + +## 情况二:非 MASTER_ERP 时,支持批量的新增、修改操作 +#else + #if ( $subTable.subJoinMany) + private void create${subSimpleClassName}List(${primaryColumn.javaType} ${subJoinColumn.javaField}, List<${subTable.className}DO> list) { + list.forEach(o -> o.set${SubJoinColumnName}(${subJoinColumn.javaField}).clean()); + ${subClassNameVars.get($index)}Mapper.insertBatch(list); + } + + private void update${subSimpleClassName}List(${primaryColumn.javaType} ${subJoinColumn.javaField}, List<${subTable.className}DO> list) { + list.forEach(o -> o.set${SubJoinColumnName}(${subJoinColumn.javaField}).clean()); + List<${subTable.className}DO> oldList = ${subClassNameVar}Mapper.selectListBy${SubJoinColumnName}(${subJoinColumn.javaField}); + List> diffList = diffList(oldList, list, (oldVal, newVal) -> { + boolean same = ObjectUtil.equal(oldVal.getId(), newVal.getId()); + if (same) { + newVal.setId(oldVal.getId()).clean(); // 解决更新情况下:updateTime 不更新 + } + return same; + }); + + // 第二步,批量添加、修改、删除 + if (CollUtil.isNotEmpty(diffList.get(0))) { + ${subClassNameVar}Mapper.insertBatch(diffList.get(0)); + } + if (CollUtil.isNotEmpty(diffList.get(1))) { + ${subClassNameVar}Mapper.updateBatch(diffList.get(1)); + } + if (CollUtil.isNotEmpty(diffList.get(2))) { + ${subClassNameVar}Mapper.deleteByIds(convertList(diffList.get(2), ${subTable.className}DO::getId)); + } + } + + #else + private void create${subSimpleClassName}(${primaryColumn.javaType} ${subJoinColumn.javaField}, ${subTable.className}DO ${subClassNameVar}) { + if (${subClassNameVar} == null) { + return; + } + ${subClassNameVar}.set$SubJoinColumnName(${subJoinColumn.javaField}); + ${subClassNameVars.get($index)}Mapper.insert(${subClassNameVar}); + } + + private void update${subSimpleClassName}(${primaryColumn.javaType} ${subJoinColumn.javaField}, ${subTable.className}DO ${subClassNameVar}) { + if (${subClassNameVar} == null) { + return; + } + ${subClassNameVar}.set$SubJoinColumnName(${subJoinColumn.javaField}).clean();// 解决更新情况下:updateTime 不更新 + ${subClassNameVars.get($index)}Mapper.insertOrUpdate(${subClassNameVar}); + } + + #end +#end + private void delete${subSimpleClassName}By${SubJoinColumnName}(${primaryColumn.javaType} ${subJoinColumn.javaField}) { + ${subClassNameVars.get($index)}Mapper.deleteBy${SubJoinColumnName}(${subJoinColumn.javaField}); + } + +#if ( $table.templateType != 2 && $deleteBatchEnable) + private void delete${subSimpleClassName}By${SubJoinColumnName}s(List<${primaryColumn.javaType}> ${subJoinColumn.javaField}s) { + ${subClassNameVars.get($index)}Mapper.deleteBy${SubJoinColumnName}s(${subJoinColumn.javaField}s); + } +#end + +#end +} \ No newline at end of file diff --git a/marketing-module-infra/src/main/resources/codegen/java/test/serviceTest.vm b/marketing-module-infra/src/main/resources/codegen/java/test/serviceTest.vm new file mode 100644 index 0000000..bfd4600 --- /dev/null +++ b/marketing-module-infra/src/main/resources/codegen/java/test/serviceTest.vm @@ -0,0 +1,168 @@ +package ${basePackage}.module.${table.moduleName}.service.${table.businessName}; + +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.mock.mockito.MockBean; + +import ${jakartaPackage}.annotation.Resource; + +import ${baseFrameworkPackage}.test.core.ut.BaseDbUnitTest; + +import ${basePackage}.module.${table.moduleName}.controller.${sceneEnum.basePackage}.${table.businessName}.vo.*; +import ${basePackage}.module.${table.moduleName}.dal.dataobject.${table.businessName}.${table.className}DO; +import ${basePackage}.module.${table.moduleName}.dal.mysql.${table.businessName}.${table.className}Mapper; +import ${PageResultClassName}; + +import ${jakartaPackage}.annotation.Resource; +import org.springframework.context.annotation.Import; +import java.util.*; +import java.time.LocalDateTime; + +import static cn.hutool.core.util.RandomUtil.*; +import static ${basePackage}.module.${table.moduleName}.enums.ErrorCodeConstants.*; +import static ${baseFrameworkPackage}.test.core.util.AssertUtils.*; +import static ${baseFrameworkPackage}.test.core.util.RandomUtils.*; +import static ${LocalDateTimeUtilsClassName}.*; +import static ${ObjectUtilsClassName}.*; +import static ${DateUtilsClassName}.*; +import static org.junit.jupiter.api.Assertions.*; +import static org.mockito.Mockito.*; + +## 字段模板 +#macro(getPageCondition $VO) + // mock 数据 + ${table.className}DO db${simpleClassName} = randomPojo(${table.className}DO.class, o -> { // 等会查询到 + #foreach ($column in $columns) + #if (${column.listOperation}) + #set ($JavaField = $column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})##首字母大写 + o.set$JavaField(null); + #end + #end + }); + ${classNameVar}Mapper.insert(db${simpleClassName}); + #foreach ($column in $columns) + #if (${column.listOperation}) + #set ($JavaField = $column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})##首字母大写 + // 测试 ${column.javaField} 不匹配 + ${classNameVar}Mapper.insert(cloneIgnoreId(db${simpleClassName}, o -> o.set$JavaField(null))); + #end + #end + // 准备参数 + ${sceneEnum.prefixClass}${table.className}${VO} reqVO = new ${sceneEnum.prefixClass}${table.className}${VO}(); + #foreach ($column in $columns) + #if (${column.listOperation}) + #set ($JavaField = $column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})##首字母大写 + #if (${column.listOperationCondition} == "BETWEEN")## BETWEEN 的情况 + reqVO.set${JavaField}(buildBetweenTime(2023, 2, 1, 2023, 2, 28)); + #else + reqVO.set$JavaField(null); + #end + #end + #end +#end +/** + * {@link ${table.className}ServiceImpl} 的单元测试类 + * + * @author ${table.author} + */ +@Import(${table.className}ServiceImpl.class) +public class ${table.className}ServiceImplTest extends BaseDbUnitTest { + + @Resource + private ${table.className}ServiceImpl ${classNameVar}Service; + + @Resource + private ${table.className}Mapper ${classNameVar}Mapper; + + @Test + public void testCreate${simpleClassName}_success() { + // 准备参数 + ${sceneEnum.prefixClass}${table.className}SaveReqVO createReqVO = randomPojo(${sceneEnum.prefixClass}${table.className}SaveReqVO.class).setId(null); + + // 调用 + ${primaryColumn.javaType} ${classNameVar}Id = ${classNameVar}Service.create${simpleClassName}(createReqVO); + // 断言 + assertNotNull(${classNameVar}Id); + // 校验记录的属性是否正确 + ${table.className}DO ${classNameVar} = ${classNameVar}Mapper.selectById(${classNameVar}Id); + assertPojoEquals(createReqVO, ${classNameVar}, "id"); + } + + @Test + public void testUpdate${simpleClassName}_success() { + // mock 数据 + ${table.className}DO db${simpleClassName} = randomPojo(${table.className}DO.class); + ${classNameVar}Mapper.insert(db${simpleClassName});// @Sql: 先插入出一条存在的数据 + // 准备参数 + ${sceneEnum.prefixClass}${table.className}SaveReqVO updateReqVO = randomPojo(${sceneEnum.prefixClass}${table.className}SaveReqVO.class, o -> { + o.setId(db${simpleClassName}.getId()); // 设置更新的 ID + }); + + // 调用 + ${classNameVar}Service.update${simpleClassName}(updateReqVO); + // 校验是否更新正确 + ${table.className}DO ${classNameVar} = ${classNameVar}Mapper.selectById(updateReqVO.getId()); // 获取最新的 + assertPojoEquals(updateReqVO, ${classNameVar}); + } + + @Test + public void testUpdate${simpleClassName}_notExists() { + // 准备参数 + ${sceneEnum.prefixClass}${table.className}SaveReqVO updateReqVO = randomPojo(${sceneEnum.prefixClass}${table.className}SaveReqVO.class); + + // 调用, 并断言异常 + assertServiceException(() -> ${classNameVar}Service.update${simpleClassName}(updateReqVO), ${simpleClassName_underlineCase.toUpperCase()}_NOT_EXISTS); + } + + @Test + public void testDelete${simpleClassName}_success() { + // mock 数据 + ${table.className}DO db${simpleClassName} = randomPojo(${table.className}DO.class); + ${classNameVar}Mapper.insert(db${simpleClassName});// @Sql: 先插入出一条存在的数据 + // 准备参数 + ${primaryColumn.javaType} id = db${simpleClassName}.getId(); + + // 调用 + ${classNameVar}Service.delete${simpleClassName}(id); + // 校验数据不存在了 + assertNull(${classNameVar}Mapper.selectById(id)); + } + + @Test + public void testDelete${simpleClassName}_notExists() { + // 准备参数 + ${primaryColumn.javaType} id = random${primaryColumn.javaType}Id(); + + // 调用, 并断言异常 + assertServiceException(() -> ${classNameVar}Service.delete${simpleClassName}(id), ${simpleClassName_underlineCase.toUpperCase()}_NOT_EXISTS); + } + +## 特殊:树表专属逻辑(树不需要分页接口) +#if ( $table.templateType != 2 ) + @Test + @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 + public void testGet${simpleClassName}Page() { + #getPageCondition("PageReqVO") + + // 调用 + PageResult<${table.className}DO> pageResult = ${classNameVar}Service.get${simpleClassName}Page(reqVO); + // 断言 + assertEquals(1, pageResult.getTotal()); + assertEquals(1, pageResult.getList().size()); + assertPojoEquals(db${simpleClassName}, pageResult.getList().get(0)); + } +#else + @Test + @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 + public void testGet${simpleClassName}List() { + #getPageCondition("ListReqVO") + + // 调用 + List<${table.className}DO> list = ${classNameVar}Service.get${simpleClassName}List(reqVO); + // 断言 + assertEquals(1, list.size()); + assertPojoEquals(db${simpleClassName}, list.get(0)); + } +#end + +} \ No newline at end of file diff --git a/marketing-module-infra/src/main/resources/codegen/sql/h2.vm b/marketing-module-infra/src/main/resources/codegen/sql/h2.vm new file mode 100644 index 0000000..a073fdb --- /dev/null +++ b/marketing-module-infra/src/main/resources/codegen/sql/h2.vm @@ -0,0 +1,37 @@ +-- 将该建表 SQL 语句,添加到 yudao-module-${table.moduleName}-biz 模块的 test/resources/sql/create_tables.sql 文件里 +CREATE TABLE IF NOT EXISTS "${table.tableName.toLowerCase()}" ( +#foreach ($column in $columns) +#if (${column.javaType} == 'Long') + #set ($dataType='bigint') +#elseif (${column.javaType} == 'Integer') + #set ($dataType='int') +#elseif (${column.javaType} == 'Boolean') + #set ($dataType='bit') +#elseif (${column.javaType} == 'Date') + #set ($dataType='datetime') +#else + #set ($dataType='varchar') +#end + #if (${column.primaryKey})##处理主键 + "${column.javaField}"#if (${column.javaType} == 'String') ${dataType} NOT NULL#else ${dataType} NOT NULL GENERATED BY DEFAULT AS IDENTITY#end, + #else + #if (${column.columnName} == 'create_time') + "create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + #elseif (${column.columnName} == 'update_time') + "update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + #elseif (${column.columnName} == 'creator' || ${column.columnName} == 'updater') + "${column.columnName}" ${dataType} DEFAULT '', + #elseif (${column.columnName} == 'deleted') + "deleted" bit NOT NULL DEFAULT FALSE, + #elseif (${column.columnName} == 'tenant_id') + "tenant_id" bigint NOT NULL DEFAULT 0, + #else + "${column.columnName.toLowerCase()}" ${dataType}#if (${column.nullable} == false) NOT NULL#end, + #end + #end +#end + PRIMARY KEY ("${primaryColumn.columnName.toLowerCase()}") +) COMMENT '${table.tableComment}'; + +-- 将该删表 SQL 语句,添加到 yudao-module-${table.moduleName}-biz 模块的 test/resources/sql/clean.sql 文件里 +DELETE FROM "${table.tableName}"; \ No newline at end of file diff --git a/marketing-module-infra/src/main/resources/codegen/sql/sql.vm b/marketing-module-infra/src/main/resources/codegen/sql/sql.vm new file mode 100644 index 0000000..41b107d --- /dev/null +++ b/marketing-module-infra/src/main/resources/codegen/sql/sql.vm @@ -0,0 +1,28 @@ +-- 菜单 SQL +INSERT INTO system_menu( + name, permission, type, sort, parent_id, + path, icon, component, status, component_name +) +VALUES ( + '${table.classComment}管理', '', 2, 0, ${table.parentMenuId}, + '${simpleClassName_strikeCase}', '', '${table.moduleName}/${table.businessName}/index', 0, '${table.className}' +); + +-- 按钮父菜单ID +-- 暂时只支持 MySQL。如果你是 Oracle、PostgreSQL、SQLServer 的话,需要手动修改 @parentId 的部分的代码 +SELECT @parentId := LAST_INSERT_ID(); + +-- 按钮 SQL +#set ($functionNames = ['查询', '创建', '更新', '删除', '导出']) +#set ($functionOps = ['query', 'create', 'update', 'delete', 'export']) +#foreach ($functionName in $functionNames) +#set ($index = $foreach.count - 1) +INSERT INTO system_menu( + name, permission, type, sort, parent_id, + path, icon, component, status +) +VALUES ( + '${table.classComment}${functionName}', '${permissionPrefix}:${functionOps.get($index)}', 3, $foreach.count, @parentId, + '', '', '', 0 +); +#end \ No newline at end of file diff --git a/marketing-module-infra/src/main/resources/codegen/vue3/api/api.ts.vm b/marketing-module-infra/src/main/resources/codegen/vue3/api/api.ts.vm new file mode 100644 index 0000000..c9f7361 --- /dev/null +++ b/marketing-module-infra/src/main/resources/codegen/vue3/api/api.ts.vm @@ -0,0 +1,166 @@ +import request from '@/config/axios' +import type { Dayjs } from 'dayjs'; +#set ($baseURL = "/${table.moduleName}/${simpleClassName_strikeCase}") + +## 特殊:主子表专属逻辑 +#foreach ($subTable in $subTables) + #set ($index = $foreach.count - 1) + #set ($subSimpleClassName = $subSimpleClassNames.get($index)) + #set ($subColumns = $subColumnsList.get($index))##当前字段数组 +/** ${subTable.classComment}信息 */ +export interface ${subSimpleClassName} { + #foreach ($column in $subColumns) + #if ($column.createOperation || $column.updateOperation) + #if(${column.javaType.toLowerCase()} == "long" || ${column.javaType.toLowerCase()} == "integer" || ${column.javaType.toLowerCase()} == "short" || ${column.javaType.toLowerCase()} == "double" || ${column.javaType.toLowerCase()} == "bigdecimal") + ${column.javaField}#if($column.updateOperation && !$column.primaryKey && !$column.nullable)?#end: number; // ${column.columnComment} + #elseif(${column.javaType.toLowerCase()} == "date" || ${column.javaType.toLowerCase()} == "localdate" || ${column.javaType.toLowerCase()} == "localdatetime") + ${column.javaField}#if($column.updateOperation && !$column.primaryKey && !$column.nullable)?#end: string | Dayjs; // ${column.columnComment} + #else + ${column.javaField}#if($column.updateOperation && !$column.primaryKey && !$column.nullable)?#end: ${column.javaType.toLowerCase()}; // ${column.columnComment} + #end + #end + #end +} + +#end +/** ${table.classComment}信息 */ +export interface ${simpleClassName} { + #foreach ($column in $columns) + #if ($column.createOperation || $column.updateOperation) + #if(${column.javaType.toLowerCase()} == "long" || ${column.javaType.toLowerCase()} == "integer" || ${column.javaType.toLowerCase()} == "short" || ${column.javaType.toLowerCase()} == "double" || ${column.javaType.toLowerCase()} == "bigdecimal") + ${column.javaField}#if($column.updateOperation && !$column.primaryKey && !$column.nullable)?#end: number; // ${column.columnComment} + #elseif(${column.javaType.toLowerCase()} == "date" || ${column.javaType.toLowerCase()} == "localdate" || ${column.javaType.toLowerCase()} == "localdatetime") + ${column.javaField}#if($column.updateOperation && !$column.primaryKey && !$column.nullable)?#end: string | Dayjs; // ${column.columnComment} + #else + ${column.javaField}#if($column.updateOperation && !$column.primaryKey && !$column.nullable)?#end: ${column.javaType.toLowerCase()}; // ${column.columnComment} + #end + #end + #end + #if ( $table.templateType == 2 ) + children?: ${simpleClassName}[]; + #end + ## 特殊:主子表专属逻辑 + #if ( $table.templateType == 10 || $table.templateType == 12 ) + #foreach ($subTable in $subTables) + #set ($index = $foreach.count - 1) + #set ($subSimpleClassName = $subSimpleClassNames.get($index)) + #if ( $subTable.subJoinMany ) + ${subSimpleClassName.toLowerCase()}s?: ${subSimpleClassName}[] + #else + ${subSimpleClassName.toLowerCase()}?: ${subSimpleClassName} + #end + #end + #end +} + +// ${table.classComment} API +export const ${simpleClassName}Api = { +#if ( $table.templateType != 2 ) + // 查询${table.classComment}分页 + get${simpleClassName}Page: async (params: any) => { + return await request.get({ url: `${baseURL}/page`, params }) + }, +#else + // 查询${table.classComment}列表 + get${simpleClassName}List: async (params) => { + return await request.get({ url: `${baseURL}/list`, params }) + }, +#end + + // 查询${table.classComment}详情 + get${simpleClassName}: async (id: number) => { + return await request.get({ url: `${baseURL}/get?id=` + id }) + }, + + // 新增${table.classComment} + create${simpleClassName}: async (data: ${simpleClassName}) => { + return await request.post({ url: `${baseURL}/create`, data }) + }, + + // 修改${table.classComment} + update${simpleClassName}: async (data: ${simpleClassName}) => { + return await request.put({ url: `${baseURL}/update`, data }) + }, + + // 删除${table.classComment} + delete${simpleClassName}: async (id: number) => { + return await request.delete({ url: `${baseURL}/delete?id=` + id }) + }, + +#if ( $table.templateType != 2 && $deleteBatchEnable) + /** 批量删除${table.classComment} */ + delete${simpleClassName}List: async (ids: number[]) => { + return await request.delete({ url: `${baseURL}/delete-list?ids=${ids.join(',')}` }) + }, +#end + + // 导出${table.classComment} Excel + export${simpleClassName}: async (params) => { + return await request.download({ url: `${baseURL}/export-excel`, params }) + }, +## 特殊:主子表专属逻辑 +#foreach ($subTable in $subTables) +#set ($index = $foreach.count - 1) +#set ($subSimpleClassName = $subSimpleClassNames.get($index)) +#set ($subPrimaryColumn = $subPrimaryColumns.get($index))##当前 primary 字段 +#set ($subJoinColumn = $subJoinColumns.get($index))##当前 join 字段 +#set ($SubJoinColumnName = $subJoinColumn.javaField.substring(0,1).toUpperCase() + ${subJoinColumn.javaField.substring(1)})##首字母大写 +#set ($subSimpleClassName_strikeCase = $subSimpleClassName_strikeCases.get($index)) +#set ($subJoinColumn_strikeCase = $subJoinColumn_strikeCases.get($index)) +#set ($subClassNameVar = $subClassNameVars.get($index)) + +// ==================== 子表($subTable.classComment) ==================== +## 情况一:MASTER_ERP 时,需要分查询页子表 +#if ( $table.templateType == 11 ) + + // 获得${subTable.classComment}分页 + get${subSimpleClassName}Page: async (params) => { + return await request.get({ url: `${baseURL}/${subSimpleClassName_strikeCase}/page`, params }) + }, +## 情况二:非 MASTER_ERP 时,需要列表查询子表 +#else + #if ( $subTable.subJoinMany ) + + // 获得${subTable.classComment}列表 + get${subSimpleClassName}ListBy${SubJoinColumnName}: async (${subJoinColumn.javaField}) => { + return await request.get({ url: `${baseURL}/${subSimpleClassName_strikeCase}/list-by-${subJoinColumn_strikeCase}?${subJoinColumn.javaField}=` + ${subJoinColumn.javaField} }) + }, + #else + + // 获得${subTable.classComment} + get${subSimpleClassName}By${SubJoinColumnName}: async (${subJoinColumn.javaField}) => { + return await request.get({ url: `${baseURL}/${subSimpleClassName_strikeCase}/get-by-${subJoinColumn_strikeCase}?${subJoinColumn.javaField}=` + ${subJoinColumn.javaField} }) + }, + #end +#end +## 特殊:MASTER_ERP 时,支持单个的新增、修改、删除操作 +#if ( $table.templateType == 11 ) + // 新增${subTable.classComment} + create${subSimpleClassName}: async (data: ${subSimpleClassName}) => { + return await request.post({ url: `${baseURL}/${subSimpleClassName_strikeCase}/create`, data }) + }, + + // 修改${subTable.classComment} + update${subSimpleClassName}: async (data: ${subSimpleClassName}) => { + return await request.put({ url: `${baseURL}/${subSimpleClassName_strikeCase}/update`, data }) + }, + + // 删除${subTable.classComment} + delete${subSimpleClassName}: async (id: number) => { + return await request.delete({ url: `${baseURL}/${subSimpleClassName_strikeCase}/delete?id=` + id }) + }, + + #if ($deleteBatchEnable) + /** 批量删除${subTable.classComment} */ + delete${subSimpleClassName}List: async (ids: number[]) => { + return await request.delete({ url: `${baseURL}/${subSimpleClassName_strikeCase}/delete-list?ids=${ids.join(',')}` }) + }, + #end + + // 获得${subTable.classComment} + get${subSimpleClassName}: async (id: number) => { + return await request.get({ url: `${baseURL}/${subSimpleClassName_strikeCase}/get?id=` + id }) + }, +#end +#end +} diff --git a/marketing-module-infra/src/main/resources/codegen/vue3/views/components/form_sub_erp.vue.vm b/marketing-module-infra/src/main/resources/codegen/vue3/views/components/form_sub_erp.vue.vm new file mode 100644 index 0000000..8277e9b --- /dev/null +++ b/marketing-module-infra/src/main/resources/codegen/vue3/views/components/form_sub_erp.vue.vm @@ -0,0 +1,204 @@ +#set ($subColumns = $subColumnsList.get($subIndex))##当前字段数组 +#set ($subSimpleClassName = $subSimpleClassNames.get($subIndex)) +#set ($subJoinColumn = $subJoinColumns.get($subIndex))##当前 join 字段 + + \ No newline at end of file diff --git a/marketing-module-infra/src/main/resources/codegen/vue3/views/components/form_sub_inner.vue.vm b/marketing-module-infra/src/main/resources/codegen/vue3/views/components/form_sub_inner.vue.vm new file mode 100644 index 0000000..d8542c3 --- /dev/null +++ b/marketing-module-infra/src/main/resources/codegen/vue3/views/components/form_sub_inner.vue.vm @@ -0,0 +1,2 @@ +## 主表的 normal 和 inner 使用相同的 form 表单 +#parse("codegen/vue3/views/components/form_sub_normal.vue.vm") \ No newline at end of file diff --git a/marketing-module-infra/src/main/resources/codegen/vue3/views/components/form_sub_normal.vue.vm b/marketing-module-infra/src/main/resources/codegen/vue3/views/components/form_sub_normal.vue.vm new file mode 100644 index 0000000..2212d4a --- /dev/null +++ b/marketing-module-infra/src/main/resources/codegen/vue3/views/components/form_sub_normal.vue.vm @@ -0,0 +1,360 @@ +#set ($subTable = $subTables.get($subIndex))##当前表 +#set ($subColumns = $subColumnsList.get($subIndex))##当前字段数组 +#set ($subJoinColumn = $subJoinColumns.get($subIndex))##当前 join 字段 +#set ($subSimpleClassName = $subSimpleClassNames.get($subIndex)) +#set ($subJoinColumn = $subJoinColumns.get($subIndex))##当前 join 字段 +#set ($SubJoinColumnName = $subJoinColumn.javaField.substring(0,1).toUpperCase() + ${subJoinColumn.javaField.substring(1)})##首字母大写 + + \ No newline at end of file diff --git a/marketing-module-infra/src/main/resources/codegen/vue3/views/components/list_sub_erp.vue.vm b/marketing-module-infra/src/main/resources/codegen/vue3/views/components/list_sub_erp.vue.vm new file mode 100644 index 0000000..c0dddc0 --- /dev/null +++ b/marketing-module-infra/src/main/resources/codegen/vue3/views/components/list_sub_erp.vue.vm @@ -0,0 +1,229 @@ +#set ($subTable = $subTables.get($subIndex))##当前表 +#set ($subColumns = $subColumnsList.get($subIndex))##当前字段数组 +#set ($subJoinColumn = $subJoinColumns.get($subIndex))##当前 join 字段 +#set ($subSimpleClassName = $subSimpleClassNames.get($subIndex)) +#set ($subJoinColumn = $subJoinColumns.get($subIndex))##当前 join 字段 +#set ($SubJoinColumnName = $subJoinColumn.javaField.substring(0,1).toUpperCase() + ${subJoinColumn.javaField.substring(1)})##首字母大写 + + \ No newline at end of file diff --git a/marketing-module-infra/src/main/resources/codegen/vue3/views/components/list_sub_inner.vue.vm b/marketing-module-infra/src/main/resources/codegen/vue3/views/components/list_sub_inner.vue.vm new file mode 100644 index 0000000..3fe6488 --- /dev/null +++ b/marketing-module-infra/src/main/resources/codegen/vue3/views/components/list_sub_inner.vue.vm @@ -0,0 +1,4 @@ +## 子表的 erp 和 inner 使用相似的 list 列表,差异主要两点: +## 1)inner 使用 list 不分页,erp 使用 page 分页 +## 2)erp 支持单个子表的新增、修改、删除,inner 不支持 +#parse("codegen/vue3/views/components/list_sub_erp.vue.vm") \ No newline at end of file diff --git a/marketing-module-infra/src/main/resources/codegen/vue3/views/form.vue.vm b/marketing-module-infra/src/main/resources/codegen/vue3/views/form.vue.vm new file mode 100644 index 0000000..466ea45 --- /dev/null +++ b/marketing-module-infra/src/main/resources/codegen/vue3/views/form.vue.vm @@ -0,0 +1,300 @@ + + \ No newline at end of file diff --git a/marketing-module-infra/src/main/resources/codegen/vue3/views/index.vue.vm b/marketing-module-infra/src/main/resources/codegen/vue3/views/index.vue.vm new file mode 100644 index 0000000..f6ce0e5 --- /dev/null +++ b/marketing-module-infra/src/main/resources/codegen/vue3/views/index.vue.vm @@ -0,0 +1,420 @@ + + + \ No newline at end of file diff --git a/marketing-module-infra/src/main/resources/file/qcode.jpeg b/marketing-module-infra/src/main/resources/file/qcode.jpeg new file mode 100644 index 0000000..e3e52d5 Binary files /dev/null and b/marketing-module-infra/src/main/resources/file/qcode.jpeg differ diff --git a/marketing-module-record/.flattened-pom.xml b/marketing-module-record/.flattened-pom.xml new file mode 100644 index 0000000..e32691b --- /dev/null +++ b/marketing-module-record/.flattened-pom.xml @@ -0,0 +1,52 @@ + + + 4.0.0 + com.platform + marketing-module-record + 0.0.1-jdk8-SNAPSHOT + marketing-admin基础脚手架 + https://github.com/makemyownlife/marketing-admin/marketing-module-record + + + com.platform + marketing-module-channel + 0.0.1-jdk8-SNAPSHOT + compile + + + com.platform + marketing-module-tenant + 0.0.1-jdk8-SNAPSHOT + compile + + + + + huaweicloud + huawei + https://mirrors.huaweicloud.com/repository/maven/ + + + aliyunmaven + aliyun + https://maven.aliyun.com/repository/public + + + + false + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + + + false + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + + diff --git a/marketing-module-record/pom.xml b/marketing-module-record/pom.xml new file mode 100644 index 0000000..6a55217 --- /dev/null +++ b/marketing-module-record/pom.xml @@ -0,0 +1,39 @@ + + + 4.0.0 + + + com.platform + marketing-admin-all + ${revision} + + + marketing-module-record + jar + + + 1.8 + 1.8 + UTF-8 + + + + + + com.platform + marketing-module-channel + ${revision} + + + + com.platform + marketing-module-tenant + ${revision} + + + + + + \ No newline at end of file diff --git a/marketing-module-record/src/main/java/com/platform/marketing/module/record/controller/RecordController.java b/marketing-module-record/src/main/java/com/platform/marketing/module/record/controller/RecordController.java new file mode 100644 index 0000000..2d23b85 --- /dev/null +++ b/marketing-module-record/src/main/java/com/platform/marketing/module/record/controller/RecordController.java @@ -0,0 +1,118 @@ +package com.platform.marketing.module.record.controller; + +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; + +import org.springframework.validation.annotation.Validated; +import org.springframework.security.access.prepost.PreAuthorize; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Operation; + +import javax.validation.*; +import javax.servlet.http.*; +import java.util.*; +import java.io.IOException; + +import com.platform.marketing.framework.common.pojo.PageParam; +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.common.pojo.CommonResult; +import com.platform.marketing.framework.common.util.object.BeanUtils; + +import static com.platform.marketing.framework.common.pojo.CommonResult.success; + +import com.platform.marketing.framework.excel.core.util.ExcelUtils; + +import com.platform.marketing.module.record.domain.vo.*; +import com.platform.marketing.module.record.domain.dataobject.SmsRecordDO; +import com.platform.marketing.module.record.service.SmsRecordService; + +@Tag(name = "管理后台 - 短信记录") +@RestController +@RequestMapping("/sms/record") +@Validated +public class RecordController { + + @Resource + private SmsRecordService smsRecordService; + + @PostMapping("/create") + @Operation(summary = "创建短信记录") + @PreAuthorize("@ss.hasPermission('sms:record:create')") + public CommonResult createRecord(@Valid @RequestBody RecordSaveReqVO createReqVO) { + return success(smsRecordService.createRecord(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新短信记录") + @PreAuthorize("@ss.hasPermission('sms:record:update')") + public CommonResult updateRecord(@Valid @RequestBody RecordSaveReqVO updateReqVO) { + smsRecordService.updateRecord(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除短信记录") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('sms:record:delete')") + public CommonResult deleteRecord(@RequestParam("id") Long id) { + smsRecordService.deleteRecord(id); + return success(true); + } + + @DeleteMapping("/delete-list") + @Parameter(name = "ids", description = "编号", required = true) + @Operation(summary = "批量删除短信记录") + @PreAuthorize("@ss.hasPermission('sms:record:delete')") + public CommonResult deleteRecordList(@RequestParam("ids") List ids) { + smsRecordService.deleteRecordListByIds(ids); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得短信记录") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('sms:record:query')") + public CommonResult getRecord(@RequestParam("id") Long id) { + SmsRecordDO record = smsRecordService.getRecord(id); + return success(BeanUtils.toBean(record, RecordRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得短信记录分页") + @PreAuthorize("@ss.hasPermission('sms:record:query')") + public CommonResult> getRecordPage(@Valid RecordPageReqVO pageReqVO) { + PageResult pageResult = smsRecordService.getRecordPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, RecordRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出短信记录 Excel") + @PreAuthorize("@ss.hasPermission('sms:record:export')") + + public void exportRecordExcel(@Valid RecordPageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = smsRecordService.getRecordPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "短信记录.xls", "数据", RecordRespVO.class, + BeanUtils.toBean(list, RecordRespVO.class)); + } + + @GetMapping("/count-by-task") + @Operation(summary = "根据任务ID列表查询各任务的发送记录计数") + @Parameter(name = "taskIds", description = "任务ID列表,逗号分隔", required = true, example = "1,2,3") + @PreAuthorize("@ss.hasPermission('sms:record:query')") + public CommonResult>> countByTaskIds(@RequestParam("taskIds") String taskIdsStr) { + List taskIds = new ArrayList<>(); + for (String s : taskIdsStr.split(",")) { + String trimmed = s.trim(); + if (!trimmed.isEmpty()) { + taskIds.add(Long.parseLong(trimmed)); + } + } + return success(smsRecordService.countRecordsByTaskIds(taskIds)); + } + +} \ No newline at end of file diff --git a/marketing-module-record/src/main/java/com/platform/marketing/module/record/controller/RecordDetailController.java b/marketing-module-record/src/main/java/com/platform/marketing/module/record/controller/RecordDetailController.java new file mode 100644 index 0000000..e75b7d2 --- /dev/null +++ b/marketing-module-record/src/main/java/com/platform/marketing/module/record/controller/RecordDetailController.java @@ -0,0 +1,102 @@ +package com.platform.marketing.module.record.controller; + +import com.platform.marketing.module.record.domain.dataobject.SmsRecordDetailDO; +import org.springframework.web.bind.annotation.*; +import javax.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import org.springframework.security.access.prepost.PreAuthorize; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Operation; + +import javax.validation.constraints.*; +import javax.validation.*; +import javax.servlet.http.*; +import java.util.*; +import java.io.IOException; + +import com.platform.marketing.framework.common.pojo.PageParam; +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.common.pojo.CommonResult; +import com.platform.marketing.framework.common.util.object.BeanUtils; +import static com.platform.marketing.framework.common.pojo.CommonResult.success; + +import com.platform.marketing.framework.excel.core.util.ExcelUtils; + +import com.platform.marketing.module.record.domain.vo.*; +import com.platform.marketing.module.record.domain.dataobject.RecordDetailDO; +import com.platform.marketing.module.record.service.RecordDetailService; + +@Tag(name = "管理后台 - 短信记录详情") +@RestController +@RequestMapping("/sms/record-detail") +@Validated +public class RecordDetailController { + + @Resource + private RecordDetailService recordDetailService; + + @PostMapping("/create") + @Operation(summary = "创建短信记录详情") + @PreAuthorize("@ss.hasPermission('sms:record-detail:create')") + public CommonResult createRecordDetail(@Valid @RequestBody RecordDetailSaveReqVO createReqVO) { + return success(recordDetailService.createRecordDetail(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新短信记录详情") + @PreAuthorize("@ss.hasPermission('sms:record-detail:update')") + public CommonResult updateRecordDetail(@Valid @RequestBody RecordDetailSaveReqVO updateReqVO) { + recordDetailService.updateRecordDetail(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除短信记录详情") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('sms:record-detail:delete')") + public CommonResult deleteRecordDetail(@RequestParam("id") Long id) { + recordDetailService.deleteRecordDetail(id); + return success(true); + } + + @DeleteMapping("/delete-list") + @Parameter(name = "ids", description = "编号", required = true) + @Operation(summary = "批量删除短信记录详情") + @PreAuthorize("@ss.hasPermission('sms:record-detail:delete')") + public CommonResult deleteRecordDetailList(@RequestParam("ids") List ids) { + recordDetailService.deleteRecordDetailListByIds(ids); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得短信记录详情") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('sms:record-detail:query')") + public CommonResult getRecordDetail(@RequestParam("id") Long id) { + SmsRecordDetailDO recordDetail = recordDetailService.getRecordDetail(id); + return success(BeanUtils.toBean(recordDetail, RecordDetailRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得短信记录详情分页") + @PreAuthorize("@ss.hasPermission('sms:record-detail:query')") + public CommonResult> getRecordDetailPage(@Valid RecordDetailPageReqVO pageReqVO) { + PageResult pageResult = recordDetailService.getRecordDetailPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, RecordDetailRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出短信记录详情 Excel") + @PreAuthorize("@ss.hasPermission('sms:record-detail:export')") + + public void exportRecordDetailExcel(@Valid RecordDetailPageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = recordDetailService.getRecordDetailPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "短信记录详情.xls", "数据", RecordDetailRespVO.class, + BeanUtils.toBean(list, RecordDetailRespVO.class)); + } + +} \ No newline at end of file diff --git a/marketing-module-record/src/main/java/com/platform/marketing/module/record/controller/SmsTaskController.java b/marketing-module-record/src/main/java/com/platform/marketing/module/record/controller/SmsTaskController.java new file mode 100644 index 0000000..c4e79d1 --- /dev/null +++ b/marketing-module-record/src/main/java/com/platform/marketing/module/record/controller/SmsTaskController.java @@ -0,0 +1,155 @@ +package com.platform.marketing.module.record.controller; + +import cn.hutool.core.io.IoUtil; +import com.platform.marketing.module.record.util.UtilsAll; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import com.platform.marketing.framework.common.pojo.CommonResult; +import com.platform.marketing.framework.common.pojo.PageParam; +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.common.util.object.BeanUtils; +import com.platform.marketing.framework.excel.core.util.ExcelUtils; +import com.platform.marketing.module.record.domain.dataobject.SmsTaskDO; +import com.platform.marketing.module.record.domain.vo.*; +import com.platform.marketing.module.record.service.AdminSmsTaskService; +import com.platform.marketing.module.record.service.SmsTaskService; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; +import java.io.IOException; +import java.io.InputStream; +import java.net.URLEncoder; +import java.util.List; + +import static com.platform.marketing.framework.common.pojo.CommonResult.success; + +@Tag(name = "管理后台 - 短信任务") +@RestController +@RequestMapping("/record/sms-task") +@Validated +public class SmsTaskController { + + @Resource + private SmsTaskService smsTaskService; + + @Resource + private AdminSmsTaskService adminSmsTaskService; + + @PostMapping("/create") + @Operation(summary = "创建短信任务") + @PreAuthorize("@ss.hasPermission('record:sms-task:create')") + public CommonResult createSmsTask(@Valid @RequestBody AdminSmsTaskSaveReqVO createReqVO, HttpServletRequest request) { + createReqVO.setSenderIp(UtilsAll.getClientIp(request)); + return success(adminSmsTaskService.createSmsTask(createReqVO)); + } + + @PostMapping("/create-by-file") + @Operation(summary = "通过Excel文件创建短信任务") + @PreAuthorize("@ss.hasPermission('record:sms-task:create')") + public CommonResult createSmsTaskByFile(@Valid AdminSmsTaskUploadReqVO uploadReqVO) throws Exception { + return adminSmsTaskService.uploadFileToCreateSmsTask(uploadReqVO); + } + + @PutMapping("/update") + @Operation(summary = "更新短信任务") + @PreAuthorize("@ss.hasPermission('record:sms-task:update')") + public CommonResult updateSmsTask(@Valid @RequestBody SmsTaskSaveReqVO updateReqVO) { + smsTaskService.updateSmsTask(updateReqVO); + return success(true); + } + + @PutMapping("/pause") + @Operation(summary = "暂停短信任务") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('record:sms-task:update')") + public CommonResult pauseTask(@RequestParam("id") Long id) { + smsTaskService.pauseTask(id); + return success(true); + } + + @PutMapping("/resume") + @Operation(summary = "恢复短信任务") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('record:sms-task:update')") + public CommonResult resumeTask(@RequestParam("id") Long id) { + smsTaskService.resumeTask(id); + return success(true); + } + + @PutMapping("/terminate") + @Operation(summary = "终止短信任务") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('record:sms-task:update')") + public CommonResult terminateTask(@RequestParam("id") Long id) { + smsTaskService.terminateTask(id); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除短信任务") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('record:sms-task:delete')") + public CommonResult deleteSmsTask(@RequestParam("id") Long id) { + smsTaskService.deleteSmsTask(id); + return success(true); + } + + @DeleteMapping("/delete-list") + @Parameter(name = "ids", description = "编号", required = true) + @Operation(summary = "批量删除短信任务") + @PreAuthorize("@ss.hasPermission('record:sms-task:delete')") + public CommonResult deleteSmsTaskList(@RequestParam("ids") List ids) { + smsTaskService.deleteSmsTaskListByIds(ids); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得短信任务") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('record:sms-task:query')") + public CommonResult getSmsTask(@RequestParam("id") Long id) { + SmsTaskDO smsTask = smsTaskService.getSmsTask(id); + return success(BeanUtils.toBean(smsTask, SmsTaskRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得短信任务分页") + @PreAuthorize("@ss.hasPermission('record:sms-task:query')") + public CommonResult> getSmsTaskPage(@Valid SmsTaskPageReqVO pageReqVO) { + PageResult pageResult = smsTaskService.getSmsTaskPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, SmsTaskRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出短信任务 Excel") + @PreAuthorize("@ss.hasPermission('record:sms-task:export')") + public void exportSmsTaskExcel(@Valid SmsTaskPageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = smsTaskService.getSmsTaskPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "短信任务.xls", "数据", SmsTaskRespVO.class, + BeanUtils.toBean(list, SmsTaskRespVO.class)); + } + + @GetMapping("/downloadDemo") + @Operation(summary = "下载短信任务示例文件") + @PreAuthorize("@ss.hasPermission('record:sms-task:export')") + public void downloadDemo(HttpServletResponse response) throws IOException { + // 设置响应头 + String fileName = URLEncoder.encode("示例1.xlsx", "UTF-8").replaceAll("\\+", "%20"); + response.setHeader("Content-Disposition", + "attachment; filename*=UTF-8''" + fileName); + InputStream inputStream = getClass().getClassLoader().getResourceAsStream("demo/示例.xlsx"); + byte[] content = IoUtil.readBytes(inputStream); + IoUtil.write(response.getOutputStream(), false, content); + } + +} \ No newline at end of file diff --git a/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/dataobject/RecordDetailDO.java b/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/dataobject/RecordDetailDO.java new file mode 100644 index 0000000..9376c02 --- /dev/null +++ b/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/dataobject/RecordDetailDO.java @@ -0,0 +1,94 @@ +package com.platform.marketing.module.record.domain.dataobject; + +import lombok.*; +import java.util.*; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.*; +import com.platform.marketing.framework.mybatis.core.dataobject.BaseDO; + +/** + * 短信记录详情 DO + * + * @author 勇哥 + */ +@TableName("sms_record_detail") +@KeySequence("sms_record_detail_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class RecordDetailDO extends BaseDO { + + /** + * 主键 雪花算法 + */ + @TableId + private Long id; + /** + * sms_record表外键 + */ + private Long recordId; + /** + * 任务编号 + */ + private Long taskId; + /** + * 调用服务方 + */ + private String appId; + /** + * 手机号码 + */ + private String mobile; + /** + * 国际电话区号 + */ + private String nationcode; + /** + * 短信内容 + */ + private String content; + /** + * 短信类型:0-国内 1-国际 + */ + private Boolean international; + /** + * -1:待发送 / 0:已发送 / 1:发送失败 + */ + private Integer sendStatus; + /** + * 短信报告 0:待回执 / 1:发送成功 / 2:发送失败 + */ + private Integer reportStatus; + /** + * 渠道编码 + */ + private String channelCode; + /** + * 渠道账户ID + */ + private Integer channelAccountId; + /** + * 三方短信ID + */ + private String msgid; + /** + * 发送失败时,渠道返回的错误信息 + */ + private String errorMsg; + /** + * 消费金额 + */ + private BigDecimal price; + /** + * 实际发送时间 + */ + private LocalDateTime senderTime; + + +} \ No newline at end of file diff --git a/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/dataobject/SmsRecordDO.java b/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/dataobject/SmsRecordDO.java new file mode 100644 index 0000000..23150be --- /dev/null +++ b/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/dataobject/SmsRecordDO.java @@ -0,0 +1,80 @@ +package com.platform.marketing.module.record.domain.dataobject; + +import lombok.*; +import com.baomidou.mybatisplus.annotation.*; +import com.platform.marketing.framework.mybatis.core.dataobject.BaseDO; + +/** + * 短信记录 DO + * + * @author admin + */ +@TableName("sms_record") +@KeySequence("sms_record_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class SmsRecordDO extends BaseDO { + + /** + * 主键 雪花算法 + */ + @TableId + private Long id; + + /** + * 任务编号 + */ + private Long taskId; + + /** + * 手机号 + */ + private String mobile; + /** + * 国际电话区号如 86 + */ + private String nationcode; + /** + * 调用服务方 + */ + private String appId; + /** + * 0-验证码 1-短信通知 2-推广短信 + */ + private Integer recordType; + /** + * 模版编号 + */ + private Long templateId; + /** + * 模版参数 + */ + private String templateParam; + + /** + * 短信内容 + */ + private String content; + + /** + * 记录备注(比如发送失败信息) + */ + private String remark; + + /** + * 指定发送时间 + */ + private String attime; + /** + * -1:待发送 / 0:已发送 /1 : 发送失败 + */ + private Integer sendStatus; + + + private Integer international; + +} \ No newline at end of file diff --git a/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/dataobject/SmsRecordDetailDO.java b/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/dataobject/SmsRecordDetailDO.java new file mode 100644 index 0000000..bd39708 --- /dev/null +++ b/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/dataobject/SmsRecordDetailDO.java @@ -0,0 +1,86 @@ +package com.platform.marketing.module.record.domain.dataobject; + +import lombok.*; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +import com.baomidou.mybatisplus.annotation.*; +import com.platform.marketing.framework.mybatis.core.dataobject.BaseDO; + +/** + * 短信记录详情 DO + * + * @author 勇哥 + */ +@TableName("sms_record_detail") +@KeySequence("sms_record_detail_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class SmsRecordDetailDO extends BaseDO { + + /** + * 主键 雪花算法 + */ + @TableId + private Long id; + /** + * sms_record表外键 + */ + private Long recordId; + /** + * 任务编号 + */ + private Long taskId; + /** + * 调用服务方 + */ + private String appId; + /** + * 手机号码 + */ + private String mobile; + /** + * 国际电话区号 + */ + private String nationcode; + + /** + * 0:待发送 / 1:已发送 / 2:发送失败 + */ + private Integer sendStatus; + /** + * 短信报告 0:待回执 / 1:发送成功 / 2:发送失败 + */ + private Integer reportStatus; + /** + * 渠道编码 + */ + private String channelCode; + /** + * 渠道账户ID + */ + private Integer channelAccountId; + /** + * 三方短信ID + */ + private String msgid; + /** + * 发送失败时,渠道返回的错误信息 + */ + private String errorMsg; + /** + * 消费金额 + */ + private BigDecimal price; + /** + * 实际发送时间 + */ + private LocalDateTime senderTime; + + +} \ No newline at end of file diff --git a/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/dataobject/SmsTaskContentDO.java b/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/dataobject/SmsTaskContentDO.java new file mode 100644 index 0000000..c466cbe --- /dev/null +++ b/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/dataobject/SmsTaskContentDO.java @@ -0,0 +1,36 @@ +package com.platform.marketing.module.record.domain.dataobject; + +import com.platform.marketing.framework.mybatis.core.dataobject.BaseDO; +import com.baomidou.mybatisplus.annotation.KeySequence; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.*; + +/** + * 短信任务 DO + * + * @author 勇哥 + */ +@TableName("sms_task_content") +@KeySequence("sms_task_content_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class SmsTaskContentDO { + + /** + * 任务编号 + */ + @TableId + private Long id; + + /** + * 分两种情况, + * 若无模板参数,则手机号码列表,手机号用英文逗号分隔 ,手机号1,手机号2,手机号3 + * 若模板参数,则手机号码列表,手机号用英文逗号分隔,参数用英文冒号分隔,参数格式为:手机号1^参数1^参数2^参数3,手机号2^参数1^参数2^参数3 + */ + private String taskContent; + +} \ No newline at end of file diff --git a/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/dataobject/SmsTaskDO.java b/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/dataobject/SmsTaskDO.java new file mode 100644 index 0000000..3f0bff6 --- /dev/null +++ b/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/dataobject/SmsTaskDO.java @@ -0,0 +1,109 @@ +package com.platform.marketing.module.record.domain.dataobject; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; + +import java.util.*; +import java.time.LocalDateTime; +import java.time.LocalDateTime; + +import com.baomidou.mybatisplus.annotation.*; +import com.platform.marketing.framework.mybatis.core.dataobject.BaseDO; + +/** + * 短信任务 DO + * + * @author 勇哥 + */ +@TableName("sms_task") +@KeySequence("sms_task_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class SmsTaskDO extends BaseDO { + + /** + * 任务编号 + */ + @TableId + private Long id; + /** + * 应用编号 + */ + private Long appId; + /** + * 任务名称 + */ + private String taskName; + /** + * 签名编号 + */ + private Long signId; + /** + * 签名名称 + */ + private String signName; + /** + * 模版编号 + */ + private Long templateId; + + /** + * 模版名称 + */ + private String templateName; + + /** + * 模版参数 + */ + private String templateParam; + + /** + * 模版内容 + */ + private String templateContent; + /** + * 手机总数量 + */ + private Integer totalCount; + /** + * 发送成功数量 + */ + private Integer successCount; + /** + * 发送失败数量 + */ + private Integer failCount; + /** + * 任务状态:-1-待发送 0-发送中(加载到 MQ) 1-已完成 2-已取消 + */ + private Integer taskStatus; + + /** + * 短信区域:0-国内短信 1-国际/港澳台短信 + */ + private Integer international; + + /** + * 指定发送时间 + */ + private String attime; + /** + * 备注信息 + */ + private String remark; + + /** + * 发送 IP + */ + private String senderIp; + + /** + * 发送来源 (0:网关 1:admin) + */ + private Integer source; + +} \ No newline at end of file diff --git a/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/dto/ConsumeMQResult.java b/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/dto/ConsumeMQResult.java new file mode 100644 index 0000000..0b87448 --- /dev/null +++ b/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/dto/ConsumeMQResult.java @@ -0,0 +1,29 @@ +package com.platform.marketing.module.record.domain.dto; + +import com.alibaba.excel.util.StringUtils; +import lombok.Data; + +/** + * 消费消息结果(发送到三方供应商请求结果) + */ +@Data +public class ConsumeMQResult { + + + private Boolean success = false; + + private String message = StringUtils.EMPTY; + + // 短信任务ID + private String taskId; + + // 三方供商返回的 bizId + private String bizId; + + // 三方供应商 code 比如 aliyun \tencent \ emay \ yunpian \ unisms + private String channelCode; + + // 三方供应商账号ID + private Long channelAccountId; + +} diff --git a/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/dto/SendBatchSmsReqDTO.java b/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/dto/SendBatchSmsReqDTO.java new file mode 100644 index 0000000..4a6bb1a --- /dev/null +++ b/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/dto/SendBatchSmsReqDTO.java @@ -0,0 +1,53 @@ +package com.platform.marketing.module.record.domain.dto; + +import lombok.Data; + +import java.util.Map; + +@Data + +public class SendBatchSmsReqDTO { + + public SendBatchSmsReqDTO() { + } + + /* + 0: 网关 1 : admin + */ + private Integer source; + + private String taskName; + + private String uniqueId; + + /** + * 发送IP + */ + private String senderIp; + + /** + * 接收短信的电话号码,以逗号, 分隔 。国内手机号: 15011319235 国际手机号:+852000012**** + */ + private String phoneNumbers; + + /** + * 模版编码 + */ + private String templateId; + + /** + * 延时时间 + */ + private String attime; + + /** + * 应用 appKey + */ + private String appKey; + + /** + * 模版参数 + */ + private Map templateParam; + +} diff --git a/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/dto/SendSingleSmsReqDTO.java b/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/dto/SendSingleSmsReqDTO.java new file mode 100644 index 0000000..baaec9d --- /dev/null +++ b/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/dto/SendSingleSmsReqDTO.java @@ -0,0 +1,54 @@ +package com.platform.marketing.module.record.domain.dto; + +import lombok.Data; + +import java.util.Map; + +@Data +public class SendSingleSmsReqDTO { + + public SendSingleSmsReqDTO() { + } + + private Integer source; + + private String taskName; + + private String uniqueId; + + /** + * 发送IP + */ + private String senderIp; + + /** + * 国家区号 + */ + private String nationcode; + + /** + * 真实手机号码 不包含国家区号 + */ + private String mobile; + + /** + * 模版编码 + */ + private String templateId; + + /** + * 延时时间 + */ + private String attime; + + /** + * 应用 appKey + */ + private String appKey; + + /** + * 模版参数 + */ + private Map templateParam; + +} diff --git a/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/dto/SendToMQParamDTO.java b/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/dto/SendToMQParamDTO.java new file mode 100644 index 0000000..257e781 --- /dev/null +++ b/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/dto/SendToMQParamDTO.java @@ -0,0 +1,70 @@ +package com.platform.marketing.module.record.domain.dto; + +import lombok.Data; + +/** + * taskId 和 nationcode + mobile 组合唯一的值 + */ +@Data +public class SendToMQParamDTO { + + /** + * 任务 ID + */ + private String taskId; + + /** + * 手机号 + */ + private String mobile; + + /** + * 国际电话区号如 86 + */ + private String nationcode; + + /** + * 调用服务方 + */ + private String appId; + + /** + * 0-验证码 1-短信通知 2-推广短信 + */ + private Integer recordType; + + /** + * 模版编号 + */ + private Long templateId; + + /** + * 模版参数 + */ + private String templateParam; + + /** + * 指定发送时间 + */ + private String attime; + + /** + * 发送IP + */ + private String senderIp; + + public String toString() { + return "SendToMQParamDTO{" + + "taskId='" + taskId + '\'' + + ", mobile='" + mobile + '\'' + + ", nationcode='" + nationcode + '\'' + + ", appId='" + appId + '\'' + + ", recordType=" + recordType + + ", templateId=" + templateId + + ", templateParam='" + templateParam + '\'' + + ", attime='" + attime + '\'' + + ", senderIp='" + senderIp + '\'' + + '}'; + } + +} diff --git a/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/dto/SendToMQResultDTO.java b/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/dto/SendToMQResultDTO.java new file mode 100644 index 0000000..c70c6ba --- /dev/null +++ b/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/dto/SendToMQResultDTO.java @@ -0,0 +1,27 @@ +package com.platform.marketing.module.record.domain.dto; + +import lombok.Data; +import org.apache.commons.lang3.StringUtils; + +/** + * 发送到消息队列的结果封装类 + */ +@Data +public class SendToMQResultDTO { + + /** + * 是否发送成功,默认为false + */ + private Boolean success = false; + + /** + * 返回的消息内容,默认为空字符串 + */ + private String message = StringUtils.EMPTY; + + /** + * 是否是延迟消息,默认为false + */ + private Boolean isDelayMessage = false; + +} diff --git a/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/enums/GatewayErrorCodeConstants.java b/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/enums/GatewayErrorCodeConstants.java new file mode 100644 index 0000000..a4efee4 --- /dev/null +++ b/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/enums/GatewayErrorCodeConstants.java @@ -0,0 +1,19 @@ +package com.platform.marketing.module.record.domain.enums; + +import com.platform.marketing.framework.common.exception.ErrorCode; + +public interface GatewayErrorCodeConstants { + + ErrorCode APP_NOT_EXISTS = new ErrorCode(1_005_000_000, "应用不存在"); + + ErrorCode PARAM_NOT_ERROR = new ErrorCode(1_005_000_001, "参数错误"); + + ErrorCode SIGN_CHECK_ERROR = new ErrorCode(1_005_000_002, "签名验证失败"); + + ErrorCode GATEWAY_EXCEPTION = new ErrorCode(1_005_000_003, "网关异常"); + + ErrorCode TEMPLATE_NOT_EXIST = new ErrorCode(1_005_000_004, "模版不存在"); + + ErrorCode SMS_SIGN_NOT_EXIST = new ErrorCode(1_005_000_005, "短信签名不存在"); + +} diff --git a/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/enums/RecordErrorCodeConstants.java b/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/enums/RecordErrorCodeConstants.java new file mode 100644 index 0000000..16ba966 --- /dev/null +++ b/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/enums/RecordErrorCodeConstants.java @@ -0,0 +1,25 @@ +package com.platform.marketing.module.record.domain.enums; + +import com.platform.marketing.framework.common.exception.ErrorCode; + +public interface RecordErrorCodeConstants { + + ErrorCode RECORD_NOT_EXISTS = new ErrorCode(1_003_001_001, "短信记录不存在"); + + ErrorCode SMS_TASK_NOT_EXISTS = new ErrorCode(1_003_001_002, "短信任务不存在"); + + ErrorCode SMS_TYPE_NOT_EXISTS = new ErrorCode(1_003_001_003, "短信类型不是 0-验证码 1-短信通知 2-推广短信"); + + ErrorCode RECORD_DETAIL_NOT_EXISTS = new ErrorCode(1_003_001_004, "短信记录详情不存在"); + + ErrorCode UPLOAD_FILE_EMPTY = new ErrorCode(1_003_001_005, "文件内容为空"); + + ErrorCode TASK_ITEM_PROCESSED = new ErrorCode(1_003_001_006, "任务条目已被处理"); + + ErrorCode SMS_TASK_STATUS_NOT_ALLOW_PAUSE = new ErrorCode(1_003_001_007, "任务状态不允许暂停,只有待发送或发送中的任务才能暂停"); + + ErrorCode SMS_TASK_STATUS_NOT_ALLOW_RESUME = new ErrorCode(1_003_001_008, "任务状态不允许恢复,只有已暂停的任务才能恢复"); + + ErrorCode SMS_TASK_STATUS_NOT_ALLOW_TERMINATE = new ErrorCode(1_003_001_009, "任务状态不允许终止,只有已暂停的任务才能终止"); + +} \ No newline at end of file diff --git a/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/enums/SendStatusEnum.java b/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/enums/SendStatusEnum.java new file mode 100644 index 0000000..9bb6936 --- /dev/null +++ b/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/enums/SendStatusEnum.java @@ -0,0 +1,28 @@ +package com.platform.marketing.module.record.domain.enums; + +/** + * + */ +public enum SendStatusEnum { + + /** + * 0:待发送 / 1:已发送 /2 : 发送失败 / 3 : 已终止 + */ + PENDING(0), + + SENT(1), + + FAILED(2), + + TERMINATED(3); + + private Integer sendStatus; + + SendStatusEnum(Integer sendStatus) { + this.sendStatus = sendStatus; + } + + public Integer getSendStatus() { + return sendStatus; + } +} diff --git a/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/enums/SmsTypeTopicEnum.java b/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/enums/SmsTypeTopicEnum.java new file mode 100644 index 0000000..537b285 --- /dev/null +++ b/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/enums/SmsTypeTopicEnum.java @@ -0,0 +1,97 @@ +package com.platform.marketing.module.record.domain.enums; + +import lombok.Getter; + +import java.util.Arrays; +import java.util.Objects; + +@Getter +public enum SmsTypeTopicEnum { + + /** + * 验证码短信 + */ + VERIFICATION_CODE_TOPIC(0, "验证码短信", "sms_verification_code_topic"), + + /** + * 通知短信 + */ + NOTIFICATION_TOPIC(1, "通知短信", "sms_notification_topic"), + + /** + * 营销短信 + */ + MARKETING_TOPIC(2, "营销短信", "sms_marketing_topic"), + ; + + /** + * 类型编码 + */ + private final Integer typeCode; + + /** + * 类型描述 + */ + private final String description; + + /** + * 对应的消息队列主题名称 + */ + private final String topic; + + SmsTypeTopicEnum(Integer typeCode, String description, String topic) { + this.typeCode = typeCode; + this.description = description; + this.topic = topic; + } + + /** + * 根据类型编码获取枚举 + * + * @param typeCode 类型编码 + * @return 对应的枚举值,如果未找到返回 null + */ + public static SmsTypeTopicEnum getByTypeCode(Integer typeCode) { + if (Objects.isNull(typeCode)) { + return null; + } + return Arrays.stream(values()) + .filter(e -> e.getTypeCode().equals(typeCode)) + .findFirst() + .orElse(null); + } + + /** + * 根据主题名称获取枚举 + * + * @param topic 主题名称 + * @return 对应的枚举值,如果未找到返回 null + */ + public static SmsTypeTopicEnum getByTopic(String topic) { + if (Objects.isNull(topic) || topic.isEmpty()) { + return null; + } + return Arrays.stream(values()) + .filter(e -> e.getTopic().equals(topic)) + .findFirst() + .orElse(null); + } + + /** + * 校验类型编码是否有效 + * + * @param typeCode 类型编码 + * @return 是否有效 + */ + public static boolean isValidType(Integer typeCode) { + return getByTypeCode(typeCode) != null; + } + + /** + * 获取类型编码的字符串表示(避免NPE) + */ + public String getTypeCodeStr() { + return String.valueOf(typeCode); + } + +} diff --git a/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/enums/TaskSource.java b/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/enums/TaskSource.java new file mode 100644 index 0000000..d632111 --- /dev/null +++ b/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/enums/TaskSource.java @@ -0,0 +1,34 @@ +package com.platform.marketing.module.record.domain.enums; + +public enum TaskSource { + + // 0: 网关 1:admin + GATEWAY(0, "网关"), + ADMIN(1, "admin"); + + private final int code; + private final String description; + + TaskSource(int code, String description) { + this.code = code; + this.description = description; + } + + public int getCode() { + return code; + } + + public String getDescription() { + return description; + } + + public static TaskSource fromCode(int code) { + for (TaskSource source : TaskSource.values()) { + if (source.getCode() == code) { + return source; + } + } + throw new IllegalArgumentException("No matching TaskSource for code: " + code); + } + +} diff --git a/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/enums/TaskStatusEnum.java b/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/enums/TaskStatusEnum.java new file mode 100644 index 0000000..8dfb92e --- /dev/null +++ b/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/enums/TaskStatusEnum.java @@ -0,0 +1,61 @@ +package com.platform.marketing.module.record.domain.enums; + +import io.swagger.v3.oas.annotations.media.Schema; + +import javax.validation.constraints.NotNull; + +public enum TaskStatusEnum { + + @Schema(description = "待发送", requiredMode = Schema.RequiredMode.REQUIRED, example = "0") + PENDING(0, "待发送"), + + @Schema(description = "发送中(加载到MQ)", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + SENDING(1, "发送中(加载到MQ)"), + + @Schema(description = "已完成", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") + COMPLETED(2, "已完成"), + + @Deprecated + @Schema(description = "已取消", requiredMode = Schema.RequiredMode.REQUIRED, example = "3") + CANCELLED(3, "已取消"), + + @Schema(description = "已暂停", requiredMode = Schema.RequiredMode.REQUIRED, example = "4") + PAUSED(4, "已暂停"), + + @Schema(description = "已终止", requiredMode = Schema.RequiredMode.REQUIRED, example = "5") + TERMINATED(5, "已终止"); + + private final Integer code; + private final String description; + + TaskStatusEnum(Integer code, String description) { + this.code = code; + this.description = description; + } + + public Integer getCode() { + return code; + } + + public String getDescription() { + return description; + } + + public static TaskStatusEnum fromCode(Integer code) { + for (TaskStatusEnum status : TaskStatusEnum.values()) { + if (status.code.equals(code)) { + return status; + } + } + throw new IllegalArgumentException("No matching TaskStatusEnum for code: " + code); + } + + @Override + public String toString() { + return "TaskStatusEnum{" + + "code=" + code + + ", description='" + description + '\'' + + '}'; + } + +} diff --git a/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/vo/AdminSmsTaskSaveReqVO.java b/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/vo/AdminSmsTaskSaveReqVO.java new file mode 100644 index 0000000..5d8de5d --- /dev/null +++ b/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/vo/AdminSmsTaskSaveReqVO.java @@ -0,0 +1,49 @@ +package com.platform.marketing.module.record.domain.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; + +/** + * admin 手工输入手机号 + */ +@Data +public class AdminSmsTaskSaveReqVO { + + @Schema(description = "任务名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五") + @NotEmpty(message = "任务名称不能为空") + private String taskName; + + @Schema(description = "签名编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10268") + @NotNull(message = "签名编号不能为空") + private Long signId; + + @Schema(description = "模版编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "382") + @NotNull(message = "模版编号不能为空") + private Long templateId; + + @Schema(description = "手机号", requiredMode = Schema.RequiredMode.REQUIRED, example = "15601691300,17607197036") + private String phoneNumbers; + + @Schema(description = "指定发送时间") + private String attime; + + @Schema(description = "备注信息", example = "你说的对") + private String remark; + + @Schema(description = "来源", example = "0:网关 1:admin控制台") + private Integer source = 1; + + /** + * 短信区域:0-国内短信 1-国际/港澳台短信 + */ + private Integer international; + + /** + * 发送 IP + */ + private String senderIp; + +} diff --git a/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/vo/AdminSmsTaskUploadReqVO.java b/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/vo/AdminSmsTaskUploadReqVO.java new file mode 100644 index 0000000..6d8a578 --- /dev/null +++ b/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/vo/AdminSmsTaskUploadReqVO.java @@ -0,0 +1,46 @@ +package com.platform.marketing.module.record.domain.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import org.springframework.web.multipart.MultipartFile; + +import javax.validation.constraints.NotNull; + +/** + * 管理后台 - 短信任务上传 Request VO + */ +@Schema(description = "管理后台 - 短信任务上传 Request VO") +@Data +public class AdminSmsTaskUploadReqVO { + + @Schema(description = "Excel文件", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "Excel文件不能为空") + private MultipartFile file; + + @Schema(description = "任务名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五") + @NotNull(message = "任务名称不能为空") + private String taskName; + + @Schema(description = "签名编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10268") + @NotNull(message = "签名编号不能为空") + private Long signId; + + @Schema(description = "模版编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "382") + @NotNull(message = "模版编号不能为空") + private Long templateId; + + @Schema(description = "指定发送时间") + private String attime; + + @Schema(description = "备注信息", example = "你说的对") + private String remark; + + @Schema(description = "来源", example = "0:网关 1:admin控制台") + private Integer source; + + /** + * 发送 IP + */ + private String senderIp; + +} \ No newline at end of file diff --git a/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/vo/RecordDetailPageReqVO.java b/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/vo/RecordDetailPageReqVO.java new file mode 100644 index 0000000..8258ce9 --- /dev/null +++ b/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/vo/RecordDetailPageReqVO.java @@ -0,0 +1,67 @@ +package com.platform.marketing.module.record.domain.vo; + +import lombok.*; +import java.util.*; +import io.swagger.v3.oas.annotations.media.Schema; +import com.platform.marketing.framework.common.pojo.PageParam; +import java.math.BigDecimal; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; + +import static com.platform.marketing.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 短信记录详情分页 Request VO") +@Data +public class RecordDetailPageReqVO extends PageParam { + + @Schema(description = "sms_record表外键", example = "7740") + private Long recordId; + + @Schema(description = "任务编号", example = "8882") + private Long taskId; + + @Schema(description = "调用服务方", example = "31283") + private String appId; + + @Schema(description = "手机号码") + private String mobile; + + @Schema(description = "国际电话区号") + private String nationcode; + + @Schema(description = "短信内容") + private String content; + + @Schema(description = "短信类型:0-国内 1-国际") + private Boolean international; + + @Schema(description = "-1:待发送 / 0:已发送 / 1:发送失败", example = "1") + private Integer sendStatus; + + @Schema(description = "短信报告 0:待回执 / 1:发送成功 / 2:发送失败", example = "1") + private Integer reportStatus; + + @Schema(description = "渠道编码") + private String channelCode; + + @Schema(description = "渠道账户ID", example = "25616") + private Integer channelAccountId; + + @Schema(description = "三方短信ID", example = "24266") + private String msgid; + + @Schema(description = "发送失败时,渠道返回的错误信息") + private String errorMsg; + + @Schema(description = "消费金额", example = "30794") + private BigDecimal price; + + @Schema(description = "实际发送时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] senderTime; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + +} \ No newline at end of file diff --git a/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/vo/RecordDetailRespVO.java b/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/vo/RecordDetailRespVO.java new file mode 100644 index 0000000..b764c23 --- /dev/null +++ b/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/vo/RecordDetailRespVO.java @@ -0,0 +1,84 @@ +package com.platform.marketing.module.record.domain.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import java.math.BigDecimal; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; +import com.alibaba.excel.annotation.*; + +@Schema(description = "管理后台 - 短信记录详情 Response VO") +@Data +@ExcelIgnoreUnannotated +public class RecordDetailRespVO { + + @Schema(description = "主键 雪花算法", requiredMode = Schema.RequiredMode.REQUIRED, example = "11594") + @ExcelProperty("主键 雪花算法") + private Long id; + + @Schema(description = "sms_record表外键", requiredMode = Schema.RequiredMode.REQUIRED, example = "7740") + @ExcelProperty("sms_record表外键") + private Long recordId; + + @Schema(description = "任务编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "8882") + @ExcelProperty("任务编号") + private Long taskId; + + @Schema(description = "调用服务方", requiredMode = Schema.RequiredMode.REQUIRED, example = "31283") + @ExcelProperty("调用服务方") + private String appId; + + @Schema(description = "手机号码", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("手机号码") + private String mobile; + + @Schema(description = "国际电话区号", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("国际电话区号") + private String nationcode; + + @Schema(description = "短信内容", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("短信内容") + private String content; + + @Schema(description = "短信类型:0-国内 1-国际", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("短信类型:0-国内 1-国际") + private Boolean international; + + @Schema(description = "-1:待发送 / 0:已发送 / 1:发送失败", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @ExcelProperty("-1:待发送 / 0:已发送 / 1:发送失败") + private Integer sendStatus; + + @Schema(description = "短信报告 0:待回执 / 1:发送成功 / 2:发送失败", example = "1") + @ExcelProperty("短信报告 0:待回执 / 1:发送成功 / 2:发送失败") + private Integer reportStatus; + + @Schema(description = "渠道编码", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("渠道编码") + private String channelCode; + + @Schema(description = "渠道账户ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "25616") + @ExcelProperty("渠道账户ID") + private Integer channelAccountId; + + @Schema(description = "三方短信ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "24266") + @ExcelProperty("三方短信ID") + private String msgid; + + @Schema(description = "发送失败时,渠道返回的错误信息") + @ExcelProperty("发送失败时,渠道返回的错误信息") + private String errorMsg; + + @Schema(description = "消费金额", example = "30794") + @ExcelProperty("消费金额") + private BigDecimal price; + + @Schema(description = "实际发送时间") + @ExcelProperty("实际发送时间") + private LocalDateTime senderTime; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("创建时间") + private LocalDateTime createTime; + +} \ No newline at end of file diff --git a/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/vo/RecordDetailSaveReqVO.java b/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/vo/RecordDetailSaveReqVO.java new file mode 100644 index 0000000..2294480 --- /dev/null +++ b/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/vo/RecordDetailSaveReqVO.java @@ -0,0 +1,65 @@ +package com.platform.marketing.module.record.domain.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import javax.validation.constraints.*; +import java.math.BigDecimal; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; + +@Schema(description = "管理后台 - 短信记录详情新增/修改 Request VO") +@Data +public class RecordDetailSaveReqVO { + + @Schema(description = "主键 雪花算法", requiredMode = Schema.RequiredMode.REQUIRED, example = "11594") + private Long id; + + @Schema(description = "sms_record表外键", requiredMode = Schema.RequiredMode.REQUIRED, example = "7740") + @NotNull(message = "sms_record表外键不能为空") + private Long recordId; + + @Schema(description = "任务编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "8882") + @NotNull(message = "任务编号不能为空") + private Long taskId; + + @Schema(description = "调用服务方", requiredMode = Schema.RequiredMode.REQUIRED, example = "31283") + @NotEmpty(message = "调用服务方不能为空") + private String appId; + + @Schema(description = "手机号码", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "手机号码不能为空") + private String mobile; + + @Schema(description = "国际电话区号", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "国际电话区号不能为空") + private String nationcode; + + @Schema(description = "-1:待发送 / 0:已发送 / 1:发送失败", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @NotNull(message = "-1:待发送 / 0:已发送 / 1:发送失败不能为空") + private Integer sendStatus; + + @Schema(description = "短信报告 0:待回执 / 1:发送成功 / 2:发送失败", example = "1") + private Integer reportStatus; + + @Schema(description = "渠道编码", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "渠道编码不能为空") + private String channelCode; + + @Schema(description = "渠道账户ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "25616") + @NotNull(message = "渠道账户ID不能为空") + private Long channelAccountId; + + @Schema(description = "三方短信ID") + private String msgid; + + @Schema(description = "发送失败时,渠道返回的错误信息") + private String errorMsg; + + @Schema(description = "消费金额", example = "30794") + private BigDecimal price; + + @Schema(description = "实际发送时间") + private LocalDateTime senderTime; + +} \ No newline at end of file diff --git a/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/vo/RecordPageReqVO.java b/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/vo/RecordPageReqVO.java new file mode 100644 index 0000000..9ee64ac --- /dev/null +++ b/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/vo/RecordPageReqVO.java @@ -0,0 +1,56 @@ +package com.platform.marketing.module.record.domain.vo; + +import lombok.*; + +import java.util.*; + +import io.swagger.v3.oas.annotations.media.Schema; +import com.platform.marketing.framework.common.pojo.PageParam; +import org.springframework.format.annotation.DateTimeFormat; + +import java.time.LocalDateTime; + +import static com.platform.marketing.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 短信记录分页 Request VO") +@Data +public class RecordPageReqVO extends PageParam { + + @Schema(description = "任务编号") + private Long taskId; + + @Schema(description = "手机号") + private String mobile; + + @Schema(description = "国际电话区号如 86") + private String nationcode; + + @Schema(description = "调用服务方", example = "996") + private String appId; + + @Schema(description = "0-验证码 1-短信通知 2-推广短信", example = "1") + private Integer recordType; + + @Schema(description = "模版编号", example = "5309") + private Long templateId; + + @Schema(description = "模版参数") + private String templateParam; + + @Schema(description = "发送IP") + private String senderIp; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + + @Schema(description = "发送状态") + private Integer sendStatus; + + @Schema(description = "短信区域", requiredMode = Schema.RequiredMode.REQUIRED, example = "0") + /** + * 短信区域:0-国内短信 1-国际/港澳台短信 + */ + private Integer international; + +} \ No newline at end of file diff --git a/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/vo/RecordRespVO.java b/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/vo/RecordRespVO.java new file mode 100644 index 0000000..7496504 --- /dev/null +++ b/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/vo/RecordRespVO.java @@ -0,0 +1,78 @@ +package com.platform.marketing.module.record.domain.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; + +import java.util.*; + +import org.springframework.format.annotation.DateTimeFormat; + +import java.time.LocalDateTime; + +import com.alibaba.excel.annotation.*; + +@Schema(description = "管理后台 - 短信记录 Response VO") +@Data +@ExcelIgnoreUnannotated +public class RecordRespVO { + + @Schema(description = "主键 雪花算法", requiredMode = Schema.RequiredMode.REQUIRED, example = "724") + @ExcelProperty("主键 雪花算法") + private Long id; + + @Schema(description = "手机号", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("手机号") + private String mobile; + + @Schema(description = "国际电话区号如 86", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("国际电话区号如 86") + private String nationcode; + + @Schema(description = "短信内容", requiredMode = Schema.RequiredMode.REQUIRED) + private String content; + + @Schema(description = "调用服务方", example = "996") + @ExcelProperty("调用服务方") + private String appId; + + @Schema(description = "0-验证码 1-短信通知 2-推广短信", example = "1") + @ExcelProperty("0-验证码 1-短信通知 2-推广短信") + private Integer recordType; + + @Schema(description = "模版编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "5309") + @ExcelProperty("模版编号") + private Long templateId; + + @Schema(description = "模版参数", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("模版参数") + private String templateParam; + + @Schema(description = "指定发送时间") + @ExcelProperty("指定发送时间") + private String attime; + + @Schema(description = "-1:待发送 / 0:已发送 /1 : 发送失败", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @ExcelProperty("-1:待发送 / 0:已发送 /1 : 发送失败") + private Integer sendStatus; + + @Schema(description = "发送IP") + @ExcelProperty("发送IP") + private String senderIp; + + /** + * 记录备注(比如发送失败信息) + */ + @Schema(description = "备注") + private String remark; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("创建时间") + private LocalDateTime createTime; + + @Schema(description = "短信区域", requiredMode = Schema.RequiredMode.REQUIRED, example = "0") + /** + * 短信区域:0-国内短信 1-国际/港澳台短信 + */ + private Integer international; + +} \ No newline at end of file diff --git a/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/vo/RecordSaveReqVO.java b/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/vo/RecordSaveReqVO.java new file mode 100644 index 0000000..64a4307 --- /dev/null +++ b/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/vo/RecordSaveReqVO.java @@ -0,0 +1,56 @@ +package com.platform.marketing.module.record.domain.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; + +import java.util.*; +import javax.validation.constraints.*; + +@Schema(description = "管理后台 - 短信记录新增/修改 Request VO") +@Data +public class RecordSaveReqVO { + + @Schema(description = "主键雪花算法", requiredMode = Schema.RequiredMode.REQUIRED, example = "724") + private Long id; + + @Schema(description = "任务编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "724") + private Long taskId; + + @Schema(description = "手机号", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "手机号不能为空") + private String mobile; + + @Schema(description = "国际电话区号如 86", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "国际电话区号如 86不能为空") + private String nationcode; + + @Schema(description = "调用服务方", example = "996") + private String appId; + + @Schema(description = "0-验证码 1-短信通知 2-推广短信", example = "1") + private Integer recordType; + + @Schema(description = "模版编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "5309") + @NotNull(message = "模版编号不能为空") + private Long templateId; + + @Schema(description = "模版参数", requiredMode = Schema.RequiredMode.REQUIRED) +// @NotEmpty(message = "模版参数不能为空") + private String templateParam; + + @Schema(description = "短信内容") + private String content; + + @Schema(description = "指定发送时间") + private String attime; + + @Schema(description = "-1:待发送 / 0:已发送 /1 : 发送失败", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @NotNull(message = "-1:待发送 / 0:已发送 /1 : 发送失败不能为空") + private Integer sendStatus; + + /** + * 是否国际短信 (0: 国内 1:国际) + */ + private Integer international; + +} \ No newline at end of file diff --git a/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/vo/SmsTaskImportExcelVO.java b/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/vo/SmsTaskImportExcelVO.java new file mode 100644 index 0000000..dfbfd90 --- /dev/null +++ b/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/vo/SmsTaskImportExcelVO.java @@ -0,0 +1,52 @@ +package com.platform.marketing.module.record.domain.vo; + +import com.alibaba.excel.annotation.ExcelProperty; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.Pattern; +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * 短信任务 Excel 导入 VO + */ +@Data +public class SmsTaskImportExcelVO { + + @ExcelProperty("手机号") + @NotEmpty(message = "手机号不能为空") + private String mobile; + + /** + * 动态模板参数,key为参数名,value为参数值 + * 使用LinkedHashMap保持插入顺序 + */ + private Map templateParams = new LinkedHashMap<>(); + + /** + * 添加模板参数 + * @param paramName 参数名 + * @param paramValue 参数值 + */ + public void addTemplateParam(String paramName, String paramValue) { + templateParams.put(paramName, paramValue); + } + + /** + * 根据参数名获取参数值 + * @param paramName 参数名 + * @return 参数值 + */ + public String getTemplateParam(String paramName) { + return templateParams.get(paramName); + } + + /** + * 获取所有模板参数 + * @return 模板参数Map + */ + public Map getTemplateParams() { + return templateParams; + } +} \ No newline at end of file diff --git a/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/vo/SmsTaskPageReqVO.java b/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/vo/SmsTaskPageReqVO.java new file mode 100644 index 0000000..5bea0d0 --- /dev/null +++ b/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/vo/SmsTaskPageReqVO.java @@ -0,0 +1,66 @@ +package com.platform.marketing.module.record.domain.vo; + +import lombok.*; + +import java.util.*; + +import io.swagger.v3.oas.annotations.media.Schema; +import com.platform.marketing.framework.common.pojo.PageParam; +import org.springframework.format.annotation.DateTimeFormat; + +import java.time.LocalDateTime; + +import static com.platform.marketing.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 短信任务分页 Request VO") +@Data +public class SmsTaskPageReqVO extends PageParam { + + @Schema(description = "应用编号", example = "1164") + private Long appId; + + @Schema(description = "任务名称", example = "王五") + private String taskName; + + @Schema(description = "签名编号", example = "10268") + private Long signId; + + @Schema(description = "签名名称", example = "王五") + private String signName; + + @Schema(description = "模版编号", example = "382") + private Long templateId; + + @Schema(description = "模版名称", example = "芋艿") + private String templateName; + + @Schema(description = "模版内容") + private String templateContent; + + @Schema(description = "手机总数量", example = "1737") + private Integer totalCount; + + @Schema(description = "发送成功数量", example = "25149") + private Integer successCount; + + @Schema(description = "发送失败数量", example = "25064") + private Integer failCount; + + @Schema(description = "任务状态:0-待发送 1-发送中 2-已完成 3-已取消", example = "2") + private Integer taskStatus; + + @Schema(description = "短信区域:0-国内短信 1-国际/港澳台短信", example = "0") + private Integer international; + + @Schema(description = "指定发送时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private String[] attime; + + @Schema(description = "备注信息", example = "你说的对") + private String remark; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + +} \ No newline at end of file diff --git a/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/vo/SmsTaskRespVO.java b/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/vo/SmsTaskRespVO.java new file mode 100644 index 0000000..371103d --- /dev/null +++ b/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/vo/SmsTaskRespVO.java @@ -0,0 +1,86 @@ +package com.platform.marketing.module.record.domain.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; + +import java.util.*; + +import org.springframework.format.annotation.DateTimeFormat; + +import java.time.LocalDateTime; + +import com.alibaba.excel.annotation.*; + +@Schema(description = "管理后台 - 短信任务 Response VO") +@Data +@ExcelIgnoreUnannotated +public class SmsTaskRespVO { + + @Schema(description = "任务编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "26575") + @ExcelProperty("任务编号") + private Long id; + + @Schema(description = "应用编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1164") + @ExcelProperty("应用编号") + private Long appId; + + @Schema(description = "任务名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五") + @ExcelProperty("任务名称") + private String taskName; + + @Schema(description = "签名编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10268") + @ExcelProperty("签名编号") + private Long signId; + + @Schema(description = "签名名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五") + @ExcelProperty("签名名称") + private String signName; + + @Schema(description = "模版编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "382") + @ExcelProperty("模版编号") + private Long templateId; + + @Schema(description = "模版名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿") + @ExcelProperty("模版名称") + private String templateName; + + @Schema(description = "模版内容", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("模版内容") + private String templateContent; + + @Schema(description = "手机总数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "1737") + @ExcelProperty("手机总数量") + private Integer totalCount; + + @Schema(description = "发送成功数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "25149") + @ExcelProperty("发送成功数量") + private Integer successCount; + + @Schema(description = "发送失败数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "25064") + @ExcelProperty("发送失败数量") + private Integer failCount; + + @Schema(description = "任务状态:0-待发送 1-发送中 2-已完成 3-已取消 4-已暂停 5-已终止", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") + @ExcelProperty("任务状态:0-待发送 1-发送中 2-已完成 3-已取消 4-已暂停 5-已终止") + private Integer taskStatus; + + @Schema(description = "短信区域:0-国内短信 1-国际/港澳台短信", requiredMode = Schema.RequiredMode.REQUIRED, example = "0") + @ExcelProperty("短信区域") + private Integer international; + + @Schema(description = "指定发送时间") + @ExcelProperty("指定发送时间") + private Long attime; + + @Schema(description = "备注信息", example = "你说的对") + @ExcelProperty("备注信息") + private String remark; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("创建时间") + private LocalDateTime createTime; + + @Schema(description = "发送IP") + private String senderIp; + +} \ No newline at end of file diff --git a/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/vo/SmsTaskSaveReqVO.java b/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/vo/SmsTaskSaveReqVO.java new file mode 100644 index 0000000..888b683 --- /dev/null +++ b/marketing-module-record/src/main/java/com/platform/marketing/module/record/domain/vo/SmsTaskSaveReqVO.java @@ -0,0 +1,87 @@ +package com.platform.marketing.module.record.domain.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; + +import java.util.*; +import javax.validation.constraints.*; + +@Schema(description = "管理后台 - 短信任务新增/修改 Request VO") +@Data +public class SmsTaskSaveReqVO { + + @Schema(description = "任务编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "26575") + private Long id; + + @Schema(description = "应用编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1164") + @NotNull(message = "应用编号不能为空") + private Long appId; + + @Schema(description = "任务名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五") + @NotEmpty(message = "任务名称不能为空") + private String taskName; + + @Schema(description = "签名编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10268") + @NotNull(message = "签名编号不能为空") + private Long signId; + + @Schema(description = "签名名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五") + @NotEmpty(message = "签名名称不能为空") + private String signName; + + @Schema(description = "模版编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "382") + @NotNull(message = "模版编号不能为空") + private Long templateId; + + @Schema(description = "模版名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿") + @NotEmpty(message = "模版名称不能为空") + private String templateName; + + @Schema(description = "手机号", requiredMode = Schema.RequiredMode.REQUIRED, example = "15601691300,17607197036") + private String phoneNumbers; + + /** + * 模版参数 + */ + private String templateParam; + + @Schema(description = "模版内容", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "模版内容不能为空") + private String templateContent; + + @Schema(description = "手机总数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "1737") + @NotNull(message = "手机总数量不能为空") + private Integer totalCount; + + @Schema(description = "发送成功数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "25149") + @NotNull(message = "发送成功数量不能为空") + private Integer successCount; + + @Schema(description = "发送失败数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "25064") + @NotNull(message = "发送失败数量不能为空") + private Integer failCount; + + @Schema(description = "任务状态:-1-待发送 0-发送中 1-已完成 2-已取消", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") + @NotNull(message = "任务状态:-1-待发送 0-发送中 1-已完成 2-已取消") + private Integer taskStatus; + + @Schema(description = "指定发送时间") + private String attime; + + @Schema(description = "备注信息", example = "你说的对") + private String remark; + + @Schema(description = "来源", example = "0:网关 1:admin控制台") + private Integer source; + + private Integer international; + + @Schema(description = "任务内容", example = "手机号1^参数1^参数2^参数3,手机号2^参数1^参数2^参数3") + private String taskContent; + + /** + * 发送 IP + */ + private String senderIp; + +} \ No newline at end of file diff --git a/marketing-module-record/src/main/java/com/platform/marketing/module/record/facade/ConsumeShortMessageFacade.java b/marketing-module-record/src/main/java/com/platform/marketing/module/record/facade/ConsumeShortMessageFacade.java new file mode 100644 index 0000000..a318002 --- /dev/null +++ b/marketing-module-record/src/main/java/com/platform/marketing/module/record/facade/ConsumeShortMessageFacade.java @@ -0,0 +1,10 @@ +package com.platform.marketing.module.record.facade; + +import com.platform.marketing.module.record.domain.dto.ConsumeMQResult; +import com.platform.marketing.module.record.domain.dto.SendToMQParamDTO; + +public interface ConsumeShortMessageFacade { + + ConsumeMQResult consumeSingleShortMessage(SendToMQParamDTO sendToMQParamDTO); + +} diff --git a/marketing-module-record/src/main/java/com/platform/marketing/module/record/facade/LoadTaskToMQFacade.java b/marketing-module-record/src/main/java/com/platform/marketing/module/record/facade/LoadTaskToMQFacade.java new file mode 100644 index 0000000..dfedd81 --- /dev/null +++ b/marketing-module-record/src/main/java/com/platform/marketing/module/record/facade/LoadTaskToMQFacade.java @@ -0,0 +1,17 @@ +package com.platform.marketing.module.record.facade; + +import com.platform.marketing.framework.common.exception.ServiceException; +import lombok.NonNull; + +/** + * 负责将任务加载到消息队列的门面接口 + */ +public interface LoadTaskToMQFacade { + + /** + * 将指定任务加载到消息队列 + * @param taskId 任务ID,不能为空 + */ + void loadTaskContentToMQ(@NonNull Long taskId , boolean checkTimeExpired) throws ServiceException; + +} diff --git a/marketing-module-record/src/main/java/com/platform/marketing/module/record/facade/MQSenderFacade.java b/marketing-module-record/src/main/java/com/platform/marketing/module/record/facade/MQSenderFacade.java new file mode 100644 index 0000000..214475f --- /dev/null +++ b/marketing-module-record/src/main/java/com/platform/marketing/module/record/facade/MQSenderFacade.java @@ -0,0 +1,13 @@ +package com.platform.marketing.module.record.facade; + +import com.platform.marketing.module.record.domain.dto.SendToMQParamDTO; +import com.platform.marketing.module.record.domain.dto.SendToMQResultDTO; + +public interface MQSenderFacade { + + /** + * 发送单条短信(子方法,供发送流程调用) + */ + SendToMQResultDTO sendSingleShortMessageToMQ(SendToMQParamDTO sendToMQParamDTO); + +} diff --git a/marketing-module-record/src/main/java/com/platform/marketing/module/record/facade/SendShortMessageFacade.java b/marketing-module-record/src/main/java/com/platform/marketing/module/record/facade/SendShortMessageFacade.java new file mode 100644 index 0000000..f64dd49 --- /dev/null +++ b/marketing-module-record/src/main/java/com/platform/marketing/module/record/facade/SendShortMessageFacade.java @@ -0,0 +1,30 @@ +package com.platform.marketing.module.record.facade; + +import com.platform.marketing.framework.common.pojo.CommonResult; +import com.platform.marketing.module.record.domain.dto.SendBatchSmsReqDTO; +import com.platform.marketing.module.record.domain.dto.SendSingleSmsReqDTO; +import com.platform.marketing.module.record.domain.dto.SendToMQParamDTO; +import com.platform.marketing.module.record.domain.dto.SendToMQResultDTO; +import com.platform.marketing.module.record.domain.vo.AdminSmsTaskUploadReqVO; + +/** + * 发送短信门面 + */ +public interface SendShortMessageFacade { + + /** + * 根据模板id发送短信 + */ + CommonResult sendByTemplateId(SendSingleSmsReqDTO sendSmsByTemplateIdReqVO); + + /** + * 批量根据模板id发送短信 + */ + CommonResult batchSendByTemplateId(SendBatchSmsReqDTO batchSendSmsByTemplateIdReqVO); + + /** + * 根据上传文件创建任务 + */ + CommonResult uploadFileToCreateSmsTask(AdminSmsTaskUploadReqVO smsTaskSaveReqVO); + +} diff --git a/marketing-module-record/src/main/java/com/platform/marketing/module/record/facade/TaskControlFacade.java b/marketing-module-record/src/main/java/com/platform/marketing/module/record/facade/TaskControlFacade.java new file mode 100644 index 0000000..ef5a091 --- /dev/null +++ b/marketing-module-record/src/main/java/com/platform/marketing/module/record/facade/TaskControlFacade.java @@ -0,0 +1,30 @@ +package com.platform.marketing.module.record.facade; + +/** + * 任务控制门面接口(暂停/恢复/终止) + */ +public interface TaskControlFacade { + + /** + * 暂停任务 + * + * @param taskId 任务ID + */ + void pauseTask(Long taskId); + + /** + * 恢复任务 + * + * @param taskId 任务ID + */ + void resumeTask(Long taskId); + + /** + * 终止任务 + * + * @param taskId 任务ID + * @return 终止的记录数量(未发送的手机号数量) + */ + int terminateTask(Long taskId); + +} diff --git a/marketing-module-record/src/main/java/com/platform/marketing/module/record/mapper/RecordDetailMapper.java b/marketing-module-record/src/main/java/com/platform/marketing/module/record/mapper/RecordDetailMapper.java new file mode 100644 index 0000000..82cec07 --- /dev/null +++ b/marketing-module-record/src/main/java/com/platform/marketing/module/record/mapper/RecordDetailMapper.java @@ -0,0 +1,37 @@ +package com.platform.marketing.module.record.mapper; + +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.mybatis.core.query.LambdaQueryWrapperX; +import com.platform.marketing.framework.mybatis.core.mapper.BaseMapperX; +import com.platform.marketing.module.record.domain.dataobject.SmsRecordDetailDO; +import org.apache.ibatis.annotations.Mapper; +import com.platform.marketing.module.record.domain.vo.*; + +/** + * 短信记录详情 Mapper + * + * @author 勇哥 + */ +@Mapper +public interface RecordDetailMapper extends BaseMapperX { + + default PageResult selectPage(RecordDetailPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(SmsRecordDetailDO::getRecordId, reqVO.getRecordId()) + .eqIfPresent(SmsRecordDetailDO::getTaskId, reqVO.getTaskId()) + .eqIfPresent(SmsRecordDetailDO::getAppId, reqVO.getAppId()) + .eqIfPresent(SmsRecordDetailDO::getMobile, reqVO.getMobile()) + .eqIfPresent(SmsRecordDetailDO::getNationcode, reqVO.getNationcode()) + .eqIfPresent(SmsRecordDetailDO::getSendStatus, reqVO.getSendStatus()) + .eqIfPresent(SmsRecordDetailDO::getReportStatus, reqVO.getReportStatus()) + .eqIfPresent(SmsRecordDetailDO::getChannelCode, reqVO.getChannelCode()) + .eqIfPresent(SmsRecordDetailDO::getChannelAccountId, reqVO.getChannelAccountId()) + .eqIfPresent(SmsRecordDetailDO::getMsgid, reqVO.getMsgid()) + .eqIfPresent(SmsRecordDetailDO::getErrorMsg, reqVO.getErrorMsg()) + .eqIfPresent(SmsRecordDetailDO::getPrice, reqVO.getPrice()) + .betweenIfPresent(SmsRecordDetailDO::getSenderTime, reqVO.getSenderTime()) + .betweenIfPresent(SmsRecordDetailDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(SmsRecordDetailDO::getId)); + } + +} \ No newline at end of file diff --git a/marketing-module-record/src/main/java/com/platform/marketing/module/record/mapper/RecordMapper.java b/marketing-module-record/src/main/java/com/platform/marketing/module/record/mapper/RecordMapper.java new file mode 100644 index 0000000..4db64b9 --- /dev/null +++ b/marketing-module-record/src/main/java/com/platform/marketing/module/record/mapper/RecordMapper.java @@ -0,0 +1,51 @@ +package com.platform.marketing.module.record.mapper; + +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.mybatis.core.query.LambdaQueryWrapperX; +import com.platform.marketing.framework.mybatis.core.mapper.BaseMapperX; +import com.platform.marketing.module.record.domain.dataobject.SmsRecordDO; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; +import com.platform.marketing.module.record.domain.vo.*; + +import java.util.List; +import java.util.Map; + +/** + * 短信记录 Mapper + * + * @author admin + */ +@Mapper +public interface RecordMapper extends BaseMapperX { + + default PageResult selectPage(RecordPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(SmsRecordDO::getMobile, reqVO.getMobile()) + .eqIfPresent(SmsRecordDO::getTaskId, reqVO.getTaskId()) + .eqIfPresent(SmsRecordDO::getSendStatus, reqVO.getSendStatus()) + .eqIfPresent(SmsRecordDO::getNationcode, reqVO.getNationcode()) + .eqIfPresent(SmsRecordDO::getAppId, reqVO.getAppId()) + .eqIfPresent(SmsRecordDO::getRecordType, reqVO.getRecordType()) + .eqIfPresent(SmsRecordDO::getTemplateId, reqVO.getTemplateId()) + .eqIfPresent(SmsRecordDO::getTemplateParam, reqVO.getTemplateParam()) + .eqIfPresent(SmsRecordDO::getInternational, reqVO.getInternational()) + .betweenIfPresent(SmsRecordDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(SmsRecordDO::getId)); + } + + /** + * 从 sms_record 表实时查询各任务的发送计数(按 sendStatus 分组) + */ + @Select("") + List> countByTaskIds(@Param("taskIds") List taskIds); + +} \ No newline at end of file diff --git a/marketing-module-record/src/main/java/com/platform/marketing/module/record/mapper/SmsTaskContentMapper.java b/marketing-module-record/src/main/java/com/platform/marketing/module/record/mapper/SmsTaskContentMapper.java new file mode 100644 index 0000000..63f5a51 --- /dev/null +++ b/marketing-module-record/src/main/java/com/platform/marketing/module/record/mapper/SmsTaskContentMapper.java @@ -0,0 +1,15 @@ +package com.platform.marketing.module.record.mapper; + +import com.platform.marketing.framework.mybatis.core.mapper.BaseMapperX; +import com.platform.marketing.module.record.domain.dataobject.SmsTaskContentDO; +import org.apache.ibatis.annotations.Mapper; + +/** + * 短信任务内容 Mapper + * + * @author 勇哥 + */ +@Mapper +public interface SmsTaskContentMapper extends BaseMapperX { + +} \ No newline at end of file diff --git a/marketing-module-record/src/main/java/com/platform/marketing/module/record/mapper/SmsTaskMapper.java b/marketing-module-record/src/main/java/com/platform/marketing/module/record/mapper/SmsTaskMapper.java new file mode 100644 index 0000000..56e68eb --- /dev/null +++ b/marketing-module-record/src/main/java/com/platform/marketing/module/record/mapper/SmsTaskMapper.java @@ -0,0 +1,65 @@ +package com.platform.marketing.module.record.mapper; + +import java.util.*; + +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.mybatis.core.query.LambdaQueryWrapperX; +import com.platform.marketing.framework.mybatis.core.mapper.BaseMapperX; +import com.platform.marketing.module.record.domain.dataobject.SmsTaskDO; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Update; +import com.platform.marketing.module.record.domain.vo.*; + +/** + * 短信任务 Mapper + * + * @author 勇哥 + */ +@Mapper +public interface SmsTaskMapper extends BaseMapperX { + + default PageResult selectPage(SmsTaskPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(SmsTaskDO::getAppId, reqVO.getAppId()) + .likeIfPresent(SmsTaskDO::getTaskName, reqVO.getTaskName()) + .eqIfPresent(SmsTaskDO::getSignId, reqVO.getSignId()) + .likeIfPresent(SmsTaskDO::getSignName, reqVO.getSignName()) + .eqIfPresent(SmsTaskDO::getTemplateId, reqVO.getTemplateId()) + .likeIfPresent(SmsTaskDO::getTemplateName, reqVO.getTemplateName()) + .eqIfPresent(SmsTaskDO::getTemplateContent, reqVO.getTemplateContent()) + .eqIfPresent(SmsTaskDO::getTotalCount, reqVO.getTotalCount()) + .eqIfPresent(SmsTaskDO::getSuccessCount, reqVO.getSuccessCount()) + .eqIfPresent(SmsTaskDO::getFailCount, reqVO.getFailCount()) + .eqIfPresent(SmsTaskDO::getTaskStatus, reqVO.getTaskStatus()) + .eqIfPresent(SmsTaskDO::getInternational, reqVO.getInternational()) + .betweenIfPresent(SmsTaskDO::getAttime, reqVO.getAttime()) + .eqIfPresent(SmsTaskDO::getRemark, reqVO.getRemark()) + .betweenIfPresent(SmsTaskDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(SmsTaskDO::getId)); + } + + @Update({""}) + int updateSmsTaskCount(@Param("id") Long id, @Param("success") boolean success); + + @Update("UPDATE sms_task SET task_status = #{newStatus} WHERE id = #{id} AND task_status = #{expectedStatus}") + int updateTaskStatusConditionally(@Param("id") Long id, @Param("newStatus") int newStatus, @Param("expectedStatus") int expectedStatus); + + @Update("UPDATE sms_task SET fail_count = fail_count + #{terminatedCount}, task_status = 5 WHERE id = #{id}") + int updateTerminateTask(@Param("id") Long id, @Param("terminatedCount") int terminatedCount); + +} \ No newline at end of file diff --git a/marketing-module-record/src/main/java/com/platform/marketing/module/record/service/AdminSmsTaskService.java b/marketing-module-record/src/main/java/com/platform/marketing/module/record/service/AdminSmsTaskService.java new file mode 100644 index 0000000..c40258d --- /dev/null +++ b/marketing-module-record/src/main/java/com/platform/marketing/module/record/service/AdminSmsTaskService.java @@ -0,0 +1,13 @@ +package com.platform.marketing.module.record.service; + +import com.platform.marketing.framework.common.pojo.CommonResult; +import com.platform.marketing.module.record.domain.vo.AdminSmsTaskSaveReqVO; +import com.platform.marketing.module.record.domain.vo.AdminSmsTaskUploadReqVO; + +public interface AdminSmsTaskService { + + Long createSmsTask(AdminSmsTaskSaveReqVO adminSmsTaskSaveReqVO); + + CommonResult uploadFileToCreateSmsTask(AdminSmsTaskUploadReqVO smsTaskSaveReqVO); + +} diff --git a/marketing-module-record/src/main/java/com/platform/marketing/module/record/service/RecordDetailService.java b/marketing-module-record/src/main/java/com/platform/marketing/module/record/service/RecordDetailService.java new file mode 100644 index 0000000..2d3fcb3 --- /dev/null +++ b/marketing-module-record/src/main/java/com/platform/marketing/module/record/service/RecordDetailService.java @@ -0,0 +1,61 @@ +package com.platform.marketing.module.record.service; + +import java.util.*; +import javax.validation.*; +import com.platform.marketing.module.record.domain.vo.*; +import com.platform.marketing.module.record.domain.dataobject.SmsRecordDetailDO; +import com.platform.marketing.framework.common.pojo.PageResult; + +/** + * 短信记录详情 Service 接口 + * + * @author 勇哥 + */ +public interface RecordDetailService { + + /** + * 创建短信记录详情 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createRecordDetail(@Valid RecordDetailSaveReqVO createReqVO); + + /** + * 更新短信记录详情 + * + * @param updateReqVO 更新信息 + */ + void updateRecordDetail(@Valid RecordDetailSaveReqVO updateReqVO); + + /** + * 删除短信记录详情 + * + * @param id 编号 + */ + void deleteRecordDetail(Long id); + + /** + * 批量删除短信记录详情 + * + * @param ids 编号 + */ + void deleteRecordDetailListByIds(List ids); + + /** + * 获得短信记录详情 + * + * @param id 编号 + * @return 短信记录详情 + */ + SmsRecordDetailDO getRecordDetail(Long id); + + /** + * 获得短信记录详情分页 + * + * @param pageReqVO 分页查询 + * @return 短信记录详情分页 + */ + PageResult getRecordDetailPage(RecordDetailPageReqVO pageReqVO); + +} \ No newline at end of file diff --git a/marketing-module-record/src/main/java/com/platform/marketing/module/record/service/SmsRecordService.java b/marketing-module-record/src/main/java/com/platform/marketing/module/record/service/SmsRecordService.java new file mode 100644 index 0000000..51472f7 --- /dev/null +++ b/marketing-module-record/src/main/java/com/platform/marketing/module/record/service/SmsRecordService.java @@ -0,0 +1,80 @@ +package com.platform.marketing.module.record.service; + +import java.util.*; +import javax.validation.*; + +import com.platform.marketing.module.record.domain.vo.*; +import com.platform.marketing.module.record.domain.dataobject.SmsRecordDO; +import com.platform.marketing.framework.common.pojo.PageResult; + +/** + * 短信记录 Service 接口 + * + * @author admin + */ +public interface SmsRecordService { + + /** + * 创建短信记录 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createRecord(@Valid RecordSaveReqVO createReqVO); + + /** + * 更新短信记录 + * + * @param updateReqVO 更新信息 + */ + void updateRecord(@Valid RecordSaveReqVO updateReqVO); + + /** + * 更新短信记录状态 + * + * @param id 编号 + * @param sendStatus 短信发送状态 + * @param remark 短信发送结果 + * @return 更新结果 + */ + public Integer updateRecordStatus(Long id, Integer sendStatus , String remark) ; + + /** + * 删除短信记录 + * + * @param id 编号 + */ + void deleteRecord(Long id); + + /** + * 批量删除短信记录 + * + * @param ids 编号 + */ + void deleteRecordListByIds(List ids); + + /** + * 获得短信记录 + * + * @param id 编号 + * @return 短信记录 + */ + SmsRecordDO getRecord(Long id); + + /** + * 获得短信记录分页 + * + * @param pageReqVO 分页查询 + * @return 短信记录分页 + */ + PageResult getRecordPage(RecordPageReqVO pageReqVO); + + /** + * 从 sms_record 表实时查询各任务的发送计数 + * + * @param taskIds 任务ID列表 + * @return 各任务各状态的计数 + */ + List> countRecordsByTaskIds(List taskIds); + +} \ No newline at end of file diff --git a/marketing-module-record/src/main/java/com/platform/marketing/module/record/service/SmsTaskService.java b/marketing-module-record/src/main/java/com/platform/marketing/module/record/service/SmsTaskService.java new file mode 100644 index 0000000..c4c2e7f --- /dev/null +++ b/marketing-module-record/src/main/java/com/platform/marketing/module/record/service/SmsTaskService.java @@ -0,0 +1,105 @@ +package com.platform.marketing.module.record.service; + +import java.util.*; +import javax.validation.*; + +import com.platform.marketing.module.record.domain.dto.ConsumeMQResult; +import com.platform.marketing.module.record.domain.vo.*; +import com.platform.marketing.module.record.domain.dataobject.SmsTaskDO; +import com.platform.marketing.framework.common.pojo.PageResult; + +/** + * 短信任务 Service 接口 + * + * @author 勇哥 + */ +public interface SmsTaskService { + + /** + * 创建短信任务 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createSmsTask(@Valid SmsTaskSaveReqVO createReqVO); + + /** + * 更新短信任务 + * + * @param updateReqVO 更新信息 + */ + void updateSmsTask(@Valid SmsTaskSaveReqVO updateReqVO); + + /** + * 更新短信任务状态 + * + * @param updateReqVO 更新信息 + */ + void updateSmsTaskStatus(SmsTaskSaveReqVO updateReqVO); + + /** + * 删除短信任务 + * + * @param id 编号 + */ + void deleteSmsTask(Long id); + + /** + * 批量删除短信任务 + * + * @param ids 编号 + */ + void deleteSmsTaskListByIds(List ids); + + /** + * 获得短信任务 + * + * @param id 编号 + * @return 短信任务 + */ + SmsTaskDO getSmsTask(Long id); + + /** + * 获得短信任务分页 + * + * @param pageReqVO 分页查询 + * @return 短信任务分页 + */ + PageResult getSmsTaskPage(SmsTaskPageReqVO pageReqVO); + + /** + * 更新短信任务 + */ + void updateSingleSmsTask(ConsumeMQResult consumeMQResult); + + /** + * 通过Excel文件创建短信任务 + * + * @param uploadReqVO 上传请求参数 + * @return 任务编号 + * @throws Exception 处理异常 + */ + Long createSmsTaskByFile(AdminSmsTaskUploadReqVO uploadReqVO) throws Exception; + + /** + * 暂停短信任务 + * + * @param id 任务编号 + */ + void pauseTask(Long id); + + /** + * 恢复短信任务 + * + * @param id 任务编号 + */ + void resumeTask(Long id); + + /** + * 终止短信任务 + * + * @param id 任务编号 + */ + void terminateTask(Long id); + +} \ No newline at end of file diff --git a/marketing-module-record/src/main/java/com/platform/marketing/module/record/service/impl/AdminSmsTaskServiceImpl.java b/marketing-module-record/src/main/java/com/platform/marketing/module/record/service/impl/AdminSmsTaskServiceImpl.java new file mode 100644 index 0000000..37ebc95 --- /dev/null +++ b/marketing-module-record/src/main/java/com/platform/marketing/module/record/service/impl/AdminSmsTaskServiceImpl.java @@ -0,0 +1,95 @@ +package com.platform.marketing.module.record.service.impl; + +import com.platform.marketing.framework.common.pojo.CommonResult; +import com.platform.marketing.framework.common.util.json.JsonUtils; +import com.platform.marketing.framework.excel.core.util.ExcelUtils; +import com.platform.marketing.module.record.domain.dto.SendBatchSmsReqDTO; +import com.platform.marketing.module.record.domain.vo.AdminSmsTaskSaveReqVO; +import com.platform.marketing.module.record.domain.vo.AdminSmsTaskUploadReqVO; +import com.platform.marketing.module.record.domain.vo.SmsTaskImportExcelVO; +import com.platform.marketing.module.record.facade.SendShortMessageFacade; +import com.platform.marketing.module.record.service.AdminSmsTaskService; +import com.platform.marketing.module.smschannel.adapter.core.support.SmsTemplateUtil; +import com.platform.marketing.module.smschannel.domain.dataobject.SmsSignInfoDO; +import com.platform.marketing.module.smschannel.domain.dataobject.SmsTemplateInfoDO; +import com.platform.marketing.module.smschannel.service.SmsSignInfoService; +import com.platform.marketing.module.smschannel.service.SmsTemplateInfoService; +import com.platform.marketing.module.tenant.domain.dataobject.SmsAppinfoDO; +import com.platform.marketing.module.tenant.service.SmsAppinfoService; +import com.alibaba.excel.context.AnalysisContext; +import com.alibaba.excel.event.AnalysisEventListener; +import com.alibaba.excel.EasyExcel; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@Service +@Validated +@Slf4j +public class AdminSmsTaskServiceImpl implements AdminSmsTaskService { + + @Resource + private SendShortMessageFacade sendShortMessageFacade; + + @Resource + private SmsTemplateInfoService smsTemplateInfoService; + + @Resource + private SmsSignInfoService smsSignInfoService; + + @Resource + private SmsAppinfoService smsAppInfoService; + + @Override + public Long createSmsTask(AdminSmsTaskSaveReqVO adminSmsTaskSaveReqVO) { + log.info("admin 开始创建短信任务:{}", JsonUtils.toJsonString(adminSmsTaskSaveReqVO)); + SmsTemplateInfoDO smsTemplateInfoDO = smsTemplateInfoService.getTemplateInfo(Long.valueOf(adminSmsTaskSaveReqVO.getTemplateId())); + + Long signId = smsTemplateInfoDO.getSignId(); + SmsSignInfoDO smsSignInfoDO = smsSignInfoService.getSignInfo(signId); + Long tenantId = smsSignInfoDO.getTenantId(); + SmsAppinfoDO smsAppinfoDO = smsAppInfoService.getAppinfoByTenantId(tenantId); + + // 创建并填充批量发送短信请求对象 + SendBatchSmsReqDTO sendBatchSmsReqDTO = new SendBatchSmsReqDTO(); + sendBatchSmsReqDTO.setSource(adminSmsTaskSaveReqVO.getSource()); + sendBatchSmsReqDTO.setAppKey(smsAppinfoDO.getAppKey()); + sendBatchSmsReqDTO.setTaskName(adminSmsTaskSaveReqVO.getTaskName()); + sendBatchSmsReqDTO.setPhoneNumbers(adminSmsTaskSaveReqVO.getPhoneNumbers()); + sendBatchSmsReqDTO.setTemplateId(adminSmsTaskSaveReqVO.getTemplateId().toString()); + sendBatchSmsReqDTO.setAttime(adminSmsTaskSaveReqVO.getAttime()); + sendBatchSmsReqDTO.setSource(1); + sendBatchSmsReqDTO.setSenderIp(adminSmsTaskSaveReqVO.getSenderIp()); + sendBatchSmsReqDTO.setTemplateParam(new HashMap()); // 手工输入手机号 批量发送短信 ,不支持有动态参数的模板 + + // 调用批量发送短信方法并获取结果 + CommonResult result = + sendShortMessageFacade.batchSendByTemplateId(sendBatchSmsReqDTO); + + // 检查结果并返回任务ID + if (result == null || !result.isSuccess()) { + String errorMsg = result != null && result.getMsg() != null ? result.getMsg() : "发送短信任务失败"; + log.error("创建短信任务失败:{}", errorMsg); + throw new RuntimeException(errorMsg); + } + + log.info("短信任务创建成功,任务ID:{}", result.getData()); + return result.getData(); + } + + @Override + public CommonResult uploadFileToCreateSmsTask(AdminSmsTaskUploadReqVO smsTaskSaveReqVO) { + CommonResult result = sendShortMessageFacade.uploadFileToCreateSmsTask(smsTaskSaveReqVO); + return result; + } + +} diff --git a/marketing-module-record/src/main/java/com/platform/marketing/module/record/service/impl/RecordDetailServiceImpl.java b/marketing-module-record/src/main/java/com/platform/marketing/module/record/service/impl/RecordDetailServiceImpl.java new file mode 100644 index 0000000..897d7a8 --- /dev/null +++ b/marketing-module-record/src/main/java/com/platform/marketing/module/record/service/impl/RecordDetailServiceImpl.java @@ -0,0 +1,70 @@ +package com.platform.marketing.module.record.service.impl; + +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; + +import org.springframework.validation.annotation.Validated; + +import java.util.*; + +import com.platform.marketing.module.record.domain.vo.*; +import com.platform.marketing.module.record.domain.dataobject.SmsRecordDetailDO; +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.common.util.object.BeanUtils; + +import com.platform.marketing.module.record.service.RecordDetailService; + +import com.platform.marketing.module.record.mapper.RecordDetailMapper; +/** + * 短信记录详情 Service 实现类 + * + * @author 勇哥 + */ +@Service +@Validated +public class RecordDetailServiceImpl implements RecordDetailService { + + @Resource + private RecordDetailMapper recordDetailMapper; + + @Override + public Long createRecordDetail(RecordDetailSaveReqVO createReqVO) { + // 插入 + SmsRecordDetailDO recordDetail = BeanUtils.toBean(createReqVO, SmsRecordDetailDO.class); + recordDetailMapper.insert(recordDetail); + + // 返回 + return recordDetail.getId(); + } + + @Override + public void updateRecordDetail(RecordDetailSaveReqVO updateReqVO) { + // 更新 + SmsRecordDetailDO updateObj = BeanUtils.toBean(updateReqVO, SmsRecordDetailDO.class); + recordDetailMapper.updateById(updateObj); + } + + @Override + public void deleteRecordDetail(Long id) { + // 删除 + recordDetailMapper.deleteById(id); + } + + @Override + public void deleteRecordDetailListByIds(List ids) { + // 删除 + recordDetailMapper.deleteByIds(ids); + } + + @Override + public SmsRecordDetailDO getRecordDetail(Long id) { + return recordDetailMapper.selectById(id); + } + + @Override + public PageResult getRecordDetailPage(RecordDetailPageReqVO pageReqVO) { + return recordDetailMapper.selectPage(pageReqVO); + } + +} \ No newline at end of file diff --git a/marketing-module-record/src/main/java/com/platform/marketing/module/record/service/impl/SmsRecordServiceImpl.java b/marketing-module-record/src/main/java/com/platform/marketing/module/record/service/impl/SmsRecordServiceImpl.java new file mode 100644 index 0000000..a368a32 --- /dev/null +++ b/marketing-module-record/src/main/java/com/platform/marketing/module/record/service/impl/SmsRecordServiceImpl.java @@ -0,0 +1,105 @@ +package com.platform.marketing.module.record.service.impl; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; + +import org.springframework.validation.annotation.Validated; + +import java.time.LocalDateTime; +import java.util.*; + +import com.platform.marketing.module.record.domain.vo.*; +import com.platform.marketing.module.record.domain.dataobject.SmsRecordDO; +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.common.util.object.BeanUtils; + +import com.platform.marketing.module.record.service.SmsRecordService; + +import com.platform.marketing.module.record.mapper.RecordMapper; + +import static com.platform.marketing.framework.common.exception.util.ServiceExceptionUtil.exception; +import static com.platform.marketing.module.record.domain.enums.RecordErrorCodeConstants.*; + +/** + * 短信记录 Service 实现类 + * + * @author admin + */ +@Service +@Validated +public class SmsRecordServiceImpl implements SmsRecordService { + + @Resource + private RecordMapper recordMapper; + + @Override + public List> countRecordsByTaskIds(List taskIds) { + if (taskIds == null || taskIds.isEmpty()) { + return Collections.emptyList(); + } + return recordMapper.countByTaskIds(taskIds); + } + + @Override + public Long createRecord(RecordSaveReqVO createReqVO) { + // 插入 + SmsRecordDO record = BeanUtils.toBean(createReqVO, SmsRecordDO.class); + recordMapper.insert(record); + // 返回 + return record.getId(); + } + + @Override + public void updateRecord(RecordSaveReqVO updateReqVO) { + // 校验存在 + validateRecordExists(updateReqVO.getId()); + // 更新 + SmsRecordDO updateObj = BeanUtils.toBean(updateReqVO, SmsRecordDO.class); + recordMapper.updateById(updateObj); + } + + public Integer updateRecordStatus(Long id, Integer sendStatus, String remark) { + SmsRecordDO smsRecordDO = new SmsRecordDO(); + smsRecordDO.setId(id); + smsRecordDO.setSendStatus(sendStatus); + if (StringUtils.isNotEmpty(remark)) { + smsRecordDO.setRemark(remark); + } + smsRecordDO.setUpdateTime(LocalDateTime.now()); + return recordMapper.updateById(smsRecordDO); + } + + @Override + public void deleteRecord(Long id) { + // 校验存在 + validateRecordExists(id); + // 删除 + recordMapper.deleteById(id); + } + + @Override + public void deleteRecordListByIds(List ids) { + // 删除 + recordMapper.deleteByIds(ids); + } + + + private void validateRecordExists(Long id) { + if (recordMapper.selectById(id) == null) { + throw exception(RECORD_NOT_EXISTS); + } + } + + @Override + public SmsRecordDO getRecord(Long id) { + return recordMapper.selectById(id); + } + + @Override + public PageResult getRecordPage(RecordPageReqVO pageReqVO) { + return recordMapper.selectPage(pageReqVO); + } + +} \ No newline at end of file diff --git a/marketing-module-record/src/main/java/com/platform/marketing/module/record/service/impl/SmsTaskServiceImpl.java b/marketing-module-record/src/main/java/com/platform/marketing/module/record/service/impl/SmsTaskServiceImpl.java new file mode 100644 index 0000000..b9c06d3 --- /dev/null +++ b/marketing-module-record/src/main/java/com/platform/marketing/module/record/service/impl/SmsTaskServiceImpl.java @@ -0,0 +1,208 @@ +package com.platform.marketing.module.record.service.impl; + +import com.platform.marketing.module.record.domain.dataobject.SmsTaskContentDO; +import com.platform.marketing.module.record.domain.dto.ConsumeMQResult; +import com.platform.marketing.module.record.domain.enums.TaskStatusEnum; +import com.platform.marketing.module.record.facade.TaskControlFacade; +import com.platform.marketing.module.record.mapper.SmsTaskContentMapper; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; + +import org.springframework.transaction.annotation.Transactional; +import org.springframework.validation.annotation.Validated; + +import java.util.*; + +import com.platform.marketing.module.record.domain.vo.*; +import com.platform.marketing.module.record.domain.dataobject.SmsTaskDO; +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.common.util.object.BeanUtils; +import com.platform.marketing.framework.excel.core.util.ExcelUtils; +import cn.hutool.core.util.StrUtil; + +import com.platform.marketing.module.record.service.SmsTaskService; +import lombok.extern.slf4j.Slf4j; + +import com.platform.marketing.module.record.mapper.SmsTaskMapper; + +import static com.platform.marketing.framework.common.exception.util.ServiceExceptionUtil.exception; +import static com.platform.marketing.module.record.domain.enums.RecordErrorCodeConstants.*; + +/** + * 短信任务 Service 实现类 + * + * @author 勇哥 + */ +@Service +@Validated +@Slf4j +public class SmsTaskServiceImpl implements SmsTaskService { + + @Resource + private SmsTaskMapper smsTaskMapper; + + @Resource + private SmsTaskContentMapper smsTaskContentMapper; + + @Resource + private TaskControlFacade taskControlFacade; + + @Override + @Transactional(rollbackFor = Exception.class) + public Long createSmsTask(SmsTaskSaveReqVO createReqVO) { + // 插入 + SmsTaskDO smsTask = BeanUtils.toBean(createReqVO, SmsTaskDO.class); + smsTaskMapper.insert(smsTask); + + SmsTaskContentDO smsTaskContentDO = new SmsTaskContentDO(); + smsTaskContentDO.setTaskContent(createReqVO.getPhoneNumbers()); + smsTaskContentDO.setId(createReqVO.getId()); + smsTaskContentMapper.insert(smsTaskContentDO); + + // 返回 + return smsTask.getId(); + } + + @Override + public void updateSmsTask(SmsTaskSaveReqVO updateReqVO) { + // 校验存在 + validateSmsTaskExists(updateReqVO.getId()); + // 更新 + SmsTaskDO updateObj = BeanUtils.toBean(updateReqVO, SmsTaskDO.class); + smsTaskMapper.updateById(updateObj); + } + + @Override + public void updateSmsTaskStatus(SmsTaskSaveReqVO updateReqVO) { + SmsTaskDO updateObj = BeanUtils.toBean(updateReqVO, SmsTaskDO.class); + smsTaskMapper.updateById(updateObj); + } + + @Override + public void deleteSmsTask(Long id) { + // 校验存在 + validateSmsTaskExists(id); + // 删除 + smsTaskMapper.deleteById(id); + } + + @Override + public void deleteSmsTaskListByIds(List ids) { + // 删除 + smsTaskMapper.deleteByIds(ids); + } + + + private void validateSmsTaskExists(Long id) { + if (smsTaskMapper.selectById(id) == null) { + throw exception(SMS_TASK_NOT_EXISTS); + } + } + + @Override + public SmsTaskDO getSmsTask(Long id) { + return smsTaskMapper.selectById(id); + } + + @Override + public PageResult getSmsTaskPage(SmsTaskPageReqVO pageReqVO) { + return smsTaskMapper.selectPage(pageReqVO); + } + + @Override + public void updateSingleSmsTask(ConsumeMQResult consumeMQResult) { + // 根据任务ID和成功标志,使用SQL形式更新计数和发送状态 + String taskIdStr = consumeMQResult.getTaskId(); + Long taskId = Long.valueOf(taskIdStr); + boolean success = consumeMQResult.getSuccess(); + smsTaskMapper.updateSmsTaskCount(taskId, success); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Long createSmsTaskByFile(AdminSmsTaskUploadReqVO uploadReqVO) throws Exception { + + List importList = ExcelUtils.read(uploadReqVO.getFile(), SmsTaskImportExcelVO.class); + + // 2. 检查数据量是否超过限制(10000条) + if (importList.size() > 10000) { + throw new Exception("导入数据量超过限制,最多支持10000条数据"); + } + + // 3. 去重处理 + Set uniquePhones = new HashSet<>(); + for (SmsTaskImportExcelVO importVO : importList) { + if (StrUtil.isNotEmpty(importVO.getMobile())) { + uniquePhones.add(importVO.getMobile()); + } + } + + // 4. 构建手机号字符串 + String phoneNumbers = String.join(",", uniquePhones); + int totalCount = uniquePhones.size(); + + log.info("创建短信任务,从Excel导入手机号数量:{}(去重后:{})", importList.size(), totalCount); + + // 4. 转换为普通的创建请求 + SmsTaskSaveReqVO saveReqVO = new SmsTaskSaveReqVO(); + BeanUtils.copyProperties(uploadReqVO, saveReqVO); + saveReqVO.setPhoneNumbers(phoneNumbers); + saveReqVO.setTotalCount(totalCount); + saveReqVO.setSuccessCount(0); + saveReqVO.setFailCount(0); + saveReqVO.setTaskStatus(-1); // -1-待发送 + + // 5. 创建短信任务 + return createSmsTask(saveReqVO); + } + + @Override + public void pauseTask(Long id) { + // 校验存在 + SmsTaskDO smsTaskDO = smsTaskMapper.selectById(id); + if (smsTaskDO == null) { + throw exception(SMS_TASK_NOT_EXISTS); + } + // 校验状态:只有 PENDING(0) 或 SENDING(1) 才能暂停 + Integer status = smsTaskDO.getTaskStatus(); + if (!TaskStatusEnum.PENDING.getCode().equals(status) && !TaskStatusEnum.SENDING.getCode().equals(status)) { + throw exception(SMS_TASK_STATUS_NOT_ALLOW_PAUSE); + } + // 设置 Redis 暂停标记 + taskControlFacade.pauseTask(id); + // 条件更新任务状态为 PAUSED + smsTaskMapper.updateTaskStatusConditionally(id, TaskStatusEnum.PAUSED.getCode(), status); + } + + @Override + public void resumeTask(Long id) { + // 校验存在 + SmsTaskDO smsTaskDO = smsTaskMapper.selectById(id); + if (smsTaskDO == null) { + throw exception(SMS_TASK_NOT_EXISTS); + } + // 校验状态:只有 PAUSED(4) 才能恢复 + if (!TaskStatusEnum.PAUSED.getCode().equals(smsTaskDO.getTaskStatus())) { + throw exception(SMS_TASK_STATUS_NOT_ALLOW_RESUME); + } + // 恢复任务(清理 Redis、重新入队、补充加载、更新状态) + taskControlFacade.resumeTask(id); + } + + @Override + public void terminateTask(Long id) { + // 校验存在 + SmsTaskDO smsTaskDO = smsTaskMapper.selectById(id); + if (smsTaskDO == null) { + throw exception(SMS_TASK_NOT_EXISTS); + } + // 校验状态:只有 PAUSED(4) 才能终止 + if (!TaskStatusEnum.PAUSED.getCode().equals(smsTaskDO.getTaskStatus())) { + throw exception(SMS_TASK_STATUS_NOT_ALLOW_TERMINATE); + } + // 终止任务 + taskControlFacade.terminateTask(id); + } + +} \ No newline at end of file diff --git a/marketing-module-record/src/main/java/com/platform/marketing/module/record/util/Pair.java b/marketing-module-record/src/main/java/com/platform/marketing/module/record/util/Pair.java new file mode 100644 index 0000000..46139fc --- /dev/null +++ b/marketing-module-record/src/main/java/com/platform/marketing/module/record/util/Pair.java @@ -0,0 +1,29 @@ +package com.platform.marketing.module.record.util; + +public class Pair { + + private T1 object1; + + private volatile T2 object2; + + public Pair(T1 object1, T2 object2) { + this.object1 = object1; + this.object2 = object2; + } + + public T1 getObject1() { + return object1; + } + + public void setObject1(T1 object1) { + this.object1 = object1; + } + + public T2 getObject2() { + return object2; + } + + public void setObject2(T2 object2) { + this.object2 = object2; + } +} diff --git a/marketing-module-record/src/main/java/com/platform/marketing/module/record/util/UtilsAll.java b/marketing-module-record/src/main/java/com/platform/marketing/module/record/util/UtilsAll.java new file mode 100644 index 0000000..5f1b1fc --- /dev/null +++ b/marketing-module-record/src/main/java/com/platform/marketing/module/record/util/UtilsAll.java @@ -0,0 +1,80 @@ +package com.platform.marketing.module.record.util; + +import org.apache.commons.lang3.time.DateFormatUtils; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.io.PrintWriter; +import java.time.LocalDateTime; +import java.util.Date; + +public class UtilsAll { + + public static void responseJSONToClient(HttpServletResponse httpServletResponse, String result) throws IOException { + httpServletResponse.setCharacterEncoding("utf-8"); + httpServletResponse.setContentType("application/json; charset=utf-8"); + PrintWriter writer = httpServletResponse.getWriter(); + writer.write(result); + } + + public static Long getNextHourLastSecondTimestamp() { + // 获取当前时间 + LocalDateTime dateTime = LocalDateTime.now(); + // 将小时、分钟和秒设置为0 + dateTime = dateTime.plusHours(2).withMinute(0).withSecond(0).withNano(0); + long milliseconds = dateTime.atZone(java.time.ZoneId.systemDefault()).toInstant().toEpochMilli(); + return milliseconds; + } + + public static Long getNextHouFirstSecondTimestamp() { + // 获取当前时间 + LocalDateTime dateTime = LocalDateTime.now(); + // 将小时、分钟和秒设置为0 + dateTime = dateTime.plusHours(1).withMinute(0).withSecond(0).withNano(0); + long milliseconds = dateTime.atZone(java.time.ZoneId.systemDefault()).toInstant().toEpochMilli(); + return milliseconds; + } + + public static Pair getNextHourFirstAndLast() { + return new Pair<>(getNextHouFirstSecondTimestamp(), getNextHourLastSecondTimestamp()); + } + + public static String getClientIp(HttpServletRequest request) { + String ip = request.getHeader("X-Forwarded-For"); + + if (ip == null || ip.isEmpty() || "unknown".equalsIgnoreCase(ip)) { + ip = request.getHeader("X-Real-IP"); + } + if (ip == null || ip.isEmpty() || "unknown".equalsIgnoreCase(ip)) { + ip = request.getRemoteAddr(); + } + + // 处理多个IP的情况 + if (ip != null && ip.contains(",")) { + ip = ip.split(",")[0].trim(); + } + + return ip; + } + + public static void main(String[] args) { + System.out.println("下一个小时的最后一秒的毫秒数:" + getNextHourLastSecondTimestamp()); + LocalDateTime currentDateTime = LocalDateTime.now(); + + // 下一个小时的时间 + LocalDateTime nextHourDateTime = currentDateTime.plusHours(1).withMinute(0).withSecond(0).withNano(0); + + // 下一个小时的最后一秒 + LocalDateTime nextHourLastSecond = nextHourDateTime.minusSeconds(1); + + // 转换成毫秒 + long milliseconds = nextHourLastSecond.atZone(java.time.ZoneId.systemDefault()).toInstant().toEpochMilli(); + Date d = new Date(milliseconds); + System.out.println(DateFormatUtils.format(d, "yyyy-MM-dd HH:mm:ss")); + + + System.out.println("下一个小时的最后一秒的毫秒数:" + milliseconds); + } + +} diff --git a/marketing-module-system/.flattened-pom.xml b/marketing-module-system/.flattened-pom.xml new file mode 100644 index 0000000..e720607 --- /dev/null +++ b/marketing-module-system/.flattened-pom.xml @@ -0,0 +1,138 @@ + + + 4.0.0 + com.platform + marketing-module-system + 0.0.1-jdk8-SNAPSHOT + marketing-module-system + system 模块下,我们放通用业务,支撑上层的核心业务。 + 例如说:用户、部门、权限、数据字典等等 + https://github.com/makemyownlife/marketing-admin/marketing-module-system + + + com.platform + marketing-spring-boot-starter-idgenerator + 0.0.1-jdk8-SNAPSHOT + compile + + + com.platform + marketing-spring-boot-starter-biz-ip + 0.0.1-jdk8-SNAPSHOT + compile + + + com.platform + marketing-spring-boot-starter-security + 0.0.1-jdk8-SNAPSHOT + compile + + + org.springframework.boot + spring-boot-starter-validation + 2.7.18 + compile + + + com.platform + marketing-spring-boot-starter-mybatis + 0.0.1-jdk8-SNAPSHOT + compile + + + com.platform + marketing-spring-boot-starter-redis + 0.0.1-jdk8-SNAPSHOT + compile + + + com.platform + marketing-spring-boot-starter-job + 0.0.1-jdk8-SNAPSHOT + compile + + + com.platform + marketing-spring-boot-starter-mq + 0.0.1-jdk8-SNAPSHOT + compile + + + com.platform + marketing-spring-boot-starter-excel + 0.0.1-jdk8-SNAPSHOT + compile + + + org.springframework.boot + spring-boot-starter-mail + 2.7.18 + compile + + + com.xingyuv + spring-boot-starter-justauth + 1.0.8 + compile + + + cn.hutool + hutool-core + + + + + com.xingyuv + spring-boot-starter-captcha-plus + 1.0.10 + compile + + + com.platform + marketing-module-infra + 0.0.1-jdk8-SNAPSHOT + compile + + + io.github.mouzt + bizlog-sdk + 3.0.6 + compile + + + org.springframework.boot + spring-boot-starter + + + + + + + huaweicloud + huawei + https://mirrors.huaweicloud.com/repository/maven/ + + + aliyunmaven + aliyun + https://maven.aliyun.com/repository/public + + + + false + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + + + false + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + + diff --git a/marketing-module-system/pom.xml b/marketing-module-system/pom.xml new file mode 100644 index 0000000..4b25c40 --- /dev/null +++ b/marketing-module-system/pom.xml @@ -0,0 +1,106 @@ + + + + + com.platform + marketing-admin-all + ${revision} + + + 4.0.0 + marketing-module-system + jar + + ${project.artifactId} + + system 模块下,我们放通用业务,支撑上层的核心业务。 + 例如说:用户、部门、权限、数据字典等等 + + + + + + com.platform + marketing-spring-boot-starter-idgenerator + + + + com.platform + marketing-spring-boot-starter-biz-ip + + + + + com.platform + marketing-spring-boot-starter-security + + + + org.springframework.boot + spring-boot-starter-validation + + + + + com.platform + marketing-spring-boot-starter-mybatis + + + + com.platform + marketing-spring-boot-starter-redis + + + + + com.platform + marketing-spring-boot-starter-job + + + + + com.platform + marketing-spring-boot-starter-mq + + + + + com.platform + marketing-spring-boot-starter-excel + + + + org.springframework.boot + spring-boot-starter-mail + + + + + com.xingyuv + spring-boot-starter-justauth + + + + com.xingyuv + spring-boot-starter-captcha-plus + + + + com.platform + marketing-module-infra + ${version} + compile + + + + + + io.github.mouzt + bizlog-sdk + + + + + diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/controller/AreaController.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/controller/AreaController.java new file mode 100644 index 0000000..55c5745 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/controller/AreaController.java @@ -0,0 +1,50 @@ +package com.platform.marketing.module.system.controller; + +import cn.hutool.core.lang.Assert; +import com.platform.marketing.framework.common.pojo.CommonResult; +import com.platform.marketing.framework.common.util.object.BeanUtils; +import com.platform.marketing.framework.ip.core.Area; +import com.platform.marketing.framework.ip.core.utils.AreaUtils; +import com.platform.marketing.framework.ip.core.utils.IPUtils; +import com.platform.marketing.module.system.domain.vo.AreaNodeRespVO; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +import static com.platform.marketing.framework.common.pojo.CommonResult.success; + +@Tag(name = "管理后台 - 地区") +@RestController +@RequestMapping("/system/area") +@Validated +public class AreaController { + + @GetMapping("/tree") + @Operation(summary = "获得地区树") + public CommonResult> getAreaTree() { + Area area = AreaUtils.getArea(Area.ID_CHINA); + Assert.notNull(area, "获取不到中国"); + return success(BeanUtils.toBean(area.getChildren(), AreaNodeRespVO.class)); + } + + @GetMapping("/get-by-ip") + @Operation(summary = "获得 IP 对应的地区名") + @Parameter(name = "ip", description = "IP", required = true) + public CommonResult getAreaByIp(@RequestParam("ip") String ip) { + // 获得城市 + Area area = IPUtils.getArea(ip); + if (area == null) { + return success("未知"); + } + // 格式化返回 + return success(AreaUtils.format(area.getId())); + } + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/controller/AuthController.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/controller/AuthController.java new file mode 100644 index 0000000..a22c940 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/controller/AuthController.java @@ -0,0 +1,128 @@ +package com.platform.marketing.module.system.controller; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.StrUtil; +import com.platform.marketing.framework.common.enums.CommonStatusEnum; +import com.platform.marketing.framework.common.pojo.CommonResult; +import com.platform.marketing.framework.security.config.SecurityProperties; +import com.platform.marketing.framework.security.core.util.SecurityFrameworkUtils; +import com.platform.marketing.module.system.domain.convert.AuthConvert; +import com.platform.marketing.module.system.domain.dataobject.MenuDO; +import com.platform.marketing.module.system.domain.dataobject.RoleDO; +import com.platform.marketing.module.system.domain.dataobject.AdminUserDO; +import com.platform.marketing.module.system.domain.vo.*; +import com.platform.marketing.module.system.domain.enums.LoginLogTypeEnum; +import com.platform.marketing.module.system.service.AdminAuthService; +import com.platform.marketing.module.system.service.MenuService; +import com.platform.marketing.module.system.service.PermissionService; +import com.platform.marketing.module.system.service.RoleService; +import com.platform.marketing.module.system.service.AdminUserService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.annotation.security.PermitAll; +import javax.servlet.http.HttpServletRequest; +import javax.validation.Valid; +import java.util.Collections; +import java.util.List; +import java.util.Set; + +import static com.platform.marketing.framework.common.pojo.CommonResult.success; +import static com.platform.marketing.framework.common.util.collection.CollectionUtils.convertSet; +import static com.platform.marketing.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; + +@Tag(name = "管理后台 - 认证") +@RestController +@RequestMapping("/system/auth") +@Validated +@Slf4j +public class AuthController { + + @Resource + private AdminAuthService authService; + @Resource + private AdminUserService userService; + @Resource + private RoleService roleService; + @Resource + private MenuService menuService; + @Resource + private PermissionService permissionService; + + @Resource + private SecurityProperties securityProperties; + + @PostMapping("/login") + @PermitAll + @Operation(summary = "使用账号密码登录") + public CommonResult login(@RequestBody @Valid AuthLoginReqVO reqVO) { + return success(authService.login(reqVO)); + } + + @PostMapping("/logout") + @PermitAll + @Operation(summary = "登出系统") + public CommonResult logout(HttpServletRequest request) { + String token = SecurityFrameworkUtils.obtainAuthorization(request, + securityProperties.getTokenHeader(), securityProperties.getTokenParameter()); + if (StrUtil.isNotBlank(token)) { + authService.logout(token, LoginLogTypeEnum.LOGOUT_SELF.getType()); + } + return success(true); + } + + @PostMapping("/refresh-token") + @PermitAll + @Operation(summary = "刷新令牌") + @Parameter(name = "refreshToken", description = "刷新令牌", required = true) + public CommonResult refreshToken(@RequestParam("refreshToken") String refreshToken) { + return success(authService.refreshToken(refreshToken)); + } + + @GetMapping("/get-permission-info") + @Operation(summary = "获取登录用户的权限信息") + public CommonResult getPermissionInfo() { + // 1.1 获得用户信息 + AdminUserDO user = userService.getUser(getLoginUserId()); + if (user == null) { + return success(null); + } + + // 1.2 获得角色列表 + Set roleIds = permissionService.getUserRoleIdListByUserId(getLoginUserId()); + if (CollUtil.isEmpty(roleIds)) { + return success(AuthConvert.INSTANCE.convert(user, Collections.emptyList(), Collections.emptyList())); + } + List roles = roleService.getRoleList(roleIds); + roles.removeIf(role -> !CommonStatusEnum.ENABLE.getStatus().equals(role.getStatus())); // 移除禁用的角色 + + // 1.3 获得菜单列表 + Set menuIds = permissionService.getRoleMenuListByRoleId(convertSet(roles, RoleDO::getId)); + List menuList = menuService.getMenuList(menuIds); + menuList = menuService.filterDisableMenus(menuList); + + // 2. 拼接结果返回 + return success(AuthConvert.INSTANCE.convert(user, roles, menuList)); + } + + @PostMapping("/register") + @PermitAll + @Operation(summary = "注册用户") + public CommonResult register(@RequestBody @Valid AuthRegisterReqVO registerReqVO) { + return success(authService.register(registerReqVO)); + } + + @PostMapping("/reset-password") + @PermitAll + @Operation(summary = "重置密码") + public CommonResult resetPassword(@RequestBody @Valid AuthResetPasswordReqVO reqVO) { + authService.resetPassword(reqVO); + return success(true); + } + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/controller/CaptchaController.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/controller/CaptchaController.java new file mode 100644 index 0000000..62096ec --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/controller/CaptchaController.java @@ -0,0 +1,53 @@ +package com.platform.marketing.module.system.controller; + +import cn.hutool.core.util.StrUtil; +import com.platform.marketing.framework.common.util.servlet.ServletUtils; +import com.xingyuv.captcha.model.common.ResponseModel; +import com.xingyuv.captcha.model.vo.CaptchaVO; +import com.xingyuv.captcha.service.CaptchaService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; +import javax.annotation.security.PermitAll; +import javax.servlet.http.HttpServletRequest; + +@Tag(name = "管理后台 - 验证码") +@RestController("adminCaptchaController") +@RequestMapping("/system/captcha") +public class CaptchaController { + + @Resource + private CaptchaService captchaService; + + @PostMapping({"/get"}) + @Operation(summary = "获得验证码") + @PermitAll + public ResponseModel get(@RequestBody CaptchaVO data, HttpServletRequest request) { + assert request.getRemoteHost() != null; + data.setBrowserInfo(getRemoteId(request)); + return captchaService.get(data); + } + + @PostMapping("/check") + @Operation(summary = "校验验证码") + @PermitAll + public ResponseModel check(@RequestBody CaptchaVO data, HttpServletRequest request) { + data.setBrowserInfo(getRemoteId(request)); + return captchaService.check(data); + } + + public static String getRemoteId(HttpServletRequest request) { + String ip = ServletUtils.getClientIP(request); + String ua = request.getHeader("user-agent"); + if (StrUtil.isNotBlank(ip)) { + return ip + ua; + } + return request.getRemoteAddr() + ua; + } + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/controller/DeptController.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/controller/DeptController.java new file mode 100644 index 0000000..b7506f7 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/controller/DeptController.java @@ -0,0 +1,84 @@ +package com.platform.marketing.module.system.controller; + +import com.platform.marketing.framework.common.enums.CommonStatusEnum; +import com.platform.marketing.framework.common.pojo.CommonResult; +import com.platform.marketing.framework.common.util.object.BeanUtils; +import com.platform.marketing.module.system.domain.vo.DeptListReqVO; +import com.platform.marketing.module.system.domain.vo.DeptRespVO; +import com.platform.marketing.module.system.domain.vo.DeptSaveReqVO; +import com.platform.marketing.module.system.domain.vo.DeptSimpleRespVO; +import com.platform.marketing.module.system.domain.dataobject.DeptDO; +import com.platform.marketing.module.system.service.DeptService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.validation.Valid; +import java.util.List; + +import static com.platform.marketing.framework.common.pojo.CommonResult.success; + +@Tag(name = "管理后台 - 部门") +@RestController +@RequestMapping("/system/dept") +@Validated +public class DeptController { + + @Resource + private DeptService deptService; + + @PostMapping("create") + @Operation(summary = "创建部门") + @PreAuthorize("@ss.hasPermission('system:dept:create')") + public CommonResult createDept(@Valid @RequestBody DeptSaveReqVO createReqVO) { + Long deptId = deptService.createDept(createReqVO); + return success(deptId); + } + + @PutMapping("update") + @Operation(summary = "更新部门") + @PreAuthorize("@ss.hasPermission('system:dept:update')") + public CommonResult updateDept(@Valid @RequestBody DeptSaveReqVO updateReqVO) { + deptService.updateDept(updateReqVO); + return success(true); + } + + @DeleteMapping("delete") + @Operation(summary = "删除部门") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('system:dept:delete')") + public CommonResult deleteDept(@RequestParam("id") Long id) { + deptService.deleteDept(id); + return success(true); + } + + @GetMapping("/list") + @Operation(summary = "获取部门列表") + @PreAuthorize("@ss.hasPermission('system:dept:query')") + public CommonResult> getDeptList(DeptListReqVO reqVO) { + List list = deptService.getDeptList(reqVO); + return success(BeanUtils.toBean(list, DeptRespVO.class)); + } + + @GetMapping(value = {"/list-all-simple", "/simple-list"}) + @Operation(summary = "获取部门精简信息列表", description = "只包含被开启的部门,主要用于前端的下拉选项") + public CommonResult> getSimpleDeptList() { + List list = deptService.getDeptList( + new DeptListReqVO().setStatus(CommonStatusEnum.ENABLE.getStatus())); + return success(BeanUtils.toBean(list, DeptSimpleRespVO.class)); + } + + @GetMapping("/get") + @Operation(summary = "获得部门信息") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('system:dept:query')") + public CommonResult getDept(@RequestParam("id") Long id) { + DeptDO dept = deptService.getDept(id); + return success(BeanUtils.toBean(dept, DeptRespVO.class)); + } + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/controller/DictDataController.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/controller/DictDataController.java new file mode 100644 index 0000000..6575a16 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/controller/DictDataController.java @@ -0,0 +1,101 @@ +package com.platform.marketing.module.system.controller; + +import com.platform.marketing.framework.common.enums.CommonStatusEnum; +import com.platform.marketing.framework.common.pojo.CommonResult; +import com.platform.marketing.framework.common.pojo.PageParam; +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.common.util.object.BeanUtils; +import com.platform.marketing.framework.excel.core.util.ExcelUtils; +import com.platform.marketing.module.system.domain.vo.DictDataPageReqVO; +import com.platform.marketing.module.system.domain.vo.DictDataRespVO; +import com.platform.marketing.module.system.domain.vo.DictDataSaveReqVO; +import com.platform.marketing.module.system.domain.vo.DictDataSimpleRespVO; +import com.platform.marketing.module.system.domain.dataobject.DictDataDO; +import com.platform.marketing.module.system.service.DictDataService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; +import java.io.IOException; +import java.util.List; + +import static com.platform.marketing.framework.common.pojo.CommonResult.success; + +@Tag(name = "管理后台 - 字典数据") +@RestController +@RequestMapping("/system/dict-data") +@Validated +public class DictDataController { + + @Resource + private DictDataService dictDataService; + + @PostMapping("/create") + @Operation(summary = "新增字典数据") + @PreAuthorize("@ss.hasPermission('system:dict:create')") + public CommonResult createDictData(@Valid @RequestBody DictDataSaveReqVO createReqVO) { + Long dictDataId = dictDataService.createDictData(createReqVO); + return success(dictDataId); + } + + @PutMapping("/update") + @Operation(summary = "修改字典数据") + @PreAuthorize("@ss.hasPermission('system:dict:update')") + public CommonResult updateDictData(@Valid @RequestBody DictDataSaveReqVO updateReqVO) { + dictDataService.updateDictData(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除字典数据") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('system:dict:delete')") + public CommonResult deleteDictData(Long id) { + dictDataService.deleteDictData(id); + return success(true); + } + + @GetMapping(value = {"/list-all-simple", "simple-list"}) + @Operation(summary = "获得全部字典数据列表", description = "一般用于管理后台缓存字典数据在本地") + // 无需添加权限认证,因为前端全局都需要 + public CommonResult> getSimpleDictDataList() { + List list = dictDataService.getDictDataList( + CommonStatusEnum.ENABLE.getStatus(), null); + return success(BeanUtils.toBean(list, DictDataSimpleRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "/获得字典类型的分页列表") + @PreAuthorize("@ss.hasPermission('system:dict:query')") + public CommonResult> getDictTypePage(@Valid DictDataPageReqVO pageReqVO) { + PageResult pageResult = dictDataService.getDictDataPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, DictDataRespVO.class)); + } + + @GetMapping(value = "/get") + @Operation(summary = "/查询字典数据详细") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('system:dict:query')") + public CommonResult getDictData(@RequestParam("id") Long id) { + DictDataDO dictData = dictDataService.getDictData(id); + return success(BeanUtils.toBean(dictData, DictDataRespVO.class)); + } + + @GetMapping("/export") + @Operation(summary = "导出字典数据") + @PreAuthorize("@ss.hasPermission('system:dict:export')") + public void export(HttpServletResponse response, @Valid DictDataPageReqVO exportReqVO) throws IOException { + exportReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = dictDataService.getDictDataPage(exportReqVO).getList(); + // 输出 + ExcelUtils.write(response, "字典数据.xls", "数据", DictDataRespVO.class, + BeanUtils.toBean(list, DictDataRespVO.class)); + } + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/controller/DictTypeController.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/controller/DictTypeController.java new file mode 100644 index 0000000..02d128c --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/controller/DictTypeController.java @@ -0,0 +1,99 @@ +package com.platform.marketing.module.system.controller; + +import com.platform.marketing.framework.common.pojo.CommonResult; +import com.platform.marketing.framework.common.pojo.PageParam; +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.common.util.object.BeanUtils; +import com.platform.marketing.framework.excel.core.util.ExcelUtils; +import com.platform.marketing.module.system.domain.vo.DictTypePageReqVO; +import com.platform.marketing.module.system.domain.vo.DictTypeRespVO; +import com.platform.marketing.module.system.domain.vo.DictTypeSaveReqVO; +import com.platform.marketing.module.system.domain.vo.DictTypeSimpleRespVO; +import com.platform.marketing.module.system.domain.dataobject.DictTypeDO; +import com.platform.marketing.module.system.service.DictTypeService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; +import java.io.IOException; +import java.util.List; + +import static com.platform.marketing.framework.common.pojo.CommonResult.success; + +@Tag(name = "管理后台 - 字典类型") +@RestController +@RequestMapping("/system/dict-type") +@Validated +public class DictTypeController { + + @Resource + private DictTypeService dictTypeService; + + @PostMapping("/create") + @Operation(summary = "创建字典类型") + @PreAuthorize("@ss.hasPermission('system:dict:create')") + public CommonResult createDictType(@Valid @RequestBody DictTypeSaveReqVO createReqVO) { + Long dictTypeId = dictTypeService.createDictType(createReqVO); + return success(dictTypeId); + } + + @PutMapping("/update") + @Operation(summary = "修改字典类型") + @PreAuthorize("@ss.hasPermission('system:dict:update')") + public CommonResult updateDictType(@Valid @RequestBody DictTypeSaveReqVO updateReqVO) { + dictTypeService.updateDictType(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除字典类型") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('system:dict:delete')") + public CommonResult deleteDictType(Long id) { + dictTypeService.deleteDictType(id); + return success(true); + } + + @GetMapping("/page") + @Operation(summary = "获得字典类型的分页列表") + @PreAuthorize("@ss.hasPermission('system:dict:query')") + public CommonResult> pageDictTypes(@Valid DictTypePageReqVO pageReqVO) { + PageResult pageResult = dictTypeService.getDictTypePage(pageReqVO); + return success(BeanUtils.toBean(pageResult, DictTypeRespVO.class)); + } + + @Operation(summary = "/查询字典类型详细") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @GetMapping(value = "/get") + @PreAuthorize("@ss.hasPermission('system:dict:query')") + public CommonResult getDictType(@RequestParam("id") Long id) { + DictTypeDO dictType = dictTypeService.getDictType(id); + return success(BeanUtils.toBean(dictType, DictTypeRespVO.class)); + } + + @GetMapping(value = {"/list-all-simple", "simple-list"}) + @Operation(summary = "获得全部字典类型列表", description = "包括开启 + 禁用的字典类型,主要用于前端的下拉选项") + // 无需添加权限认证,因为前端全局都需要 + public CommonResult> getSimpleDictTypeList() { + List list = dictTypeService.getDictTypeList(); + return success(BeanUtils.toBean(list, DictTypeSimpleRespVO.class)); + } + + @Operation(summary = "导出数据类型") + @GetMapping("/export") + @PreAuthorize("@ss.hasPermission('system:dict:query')") + public void export(HttpServletResponse response, @Valid DictTypePageReqVO exportReqVO) throws IOException { + exportReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = dictTypeService.getDictTypePage(exportReqVO).getList(); + // 导出 + ExcelUtils.write(response, "字典类型.xls", "数据", DictTypeRespVO.class, + BeanUtils.toBean(list, DictTypeRespVO.class)); + } + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/controller/LoginLogController.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/controller/LoginLogController.java new file mode 100644 index 0000000..439d32a --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/controller/LoginLogController.java @@ -0,0 +1,56 @@ +package com.platform.marketing.module.system.controller; + +import com.platform.marketing.framework.common.pojo.CommonResult; +import com.platform.marketing.framework.common.pojo.PageParam; +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.common.util.object.BeanUtils; +import com.platform.marketing.framework.excel.core.util.ExcelUtils; +import com.platform.marketing.module.system.domain.vo.LoginLogPageReqVO; +import com.platform.marketing.module.system.domain.vo.LoginLogRespVO; +import com.platform.marketing.module.system.domain.dataobject.LoginLogDO; +import com.platform.marketing.module.system.service.LoginLogService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; +import java.io.IOException; +import java.util.List; + +import static com.platform.marketing.framework.common.pojo.CommonResult.success; + +@Tag(name = "管理后台 - 登录日志") +@RestController +@RequestMapping("/system/login-log") +@Validated +public class LoginLogController { + + @Resource + private LoginLogService loginLogService; + + @GetMapping("/page") + @Operation(summary = "获得登录日志分页列表") + @PreAuthorize("@ss.hasPermission('system:login-log:query')") + public CommonResult> getLoginLogPage(@Valid LoginLogPageReqVO pageReqVO) { + PageResult pageResult = loginLogService.getLoginLogPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, LoginLogRespVO.class)); + } + + @GetMapping("/export") + @Operation(summary = "导出登录日志 Excel") + @PreAuthorize("@ss.hasPermission('system:login-log:export')") + public void exportLoginLog(HttpServletResponse response, @Valid LoginLogPageReqVO exportReqVO) throws IOException { + exportReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = loginLogService.getLoginLogPage(exportReqVO).getList(); + // 输出 + ExcelUtils.write(response, "登录日志.xls", "数据列表", LoginLogRespVO.class, + BeanUtils.toBean(list, LoginLogRespVO.class)); + } + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/controller/MenuController.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/controller/MenuController.java new file mode 100644 index 0000000..f3c92ce --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/controller/MenuController.java @@ -0,0 +1,88 @@ +package com.platform.marketing.module.system.controller; + +import com.platform.marketing.framework.common.enums.CommonStatusEnum; +import com.platform.marketing.framework.common.pojo.CommonResult; +import com.platform.marketing.framework.common.util.object.BeanUtils; +import com.platform.marketing.module.system.domain.vo.MenuListReqVO; +import com.platform.marketing.module.system.domain.vo.MenuRespVO; +import com.platform.marketing.module.system.domain.vo.MenuSaveVO; +import com.platform.marketing.module.system.domain.vo.MenuSimpleRespVO; +import com.platform.marketing.module.system.domain.dataobject.MenuDO; +import com.platform.marketing.module.system.service.MenuService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.validation.Valid; +import java.util.Comparator; +import java.util.List; + +import static com.platform.marketing.framework.common.pojo.CommonResult.success; + +@Tag(name = "管理后台 - 菜单") +@RestController +@RequestMapping("/system/menu") +@Validated +public class MenuController { + + @Resource + private MenuService menuService; + + @PostMapping("/create") + @Operation(summary = "创建菜单") + @PreAuthorize("@ss.hasPermission('system:menu:create')") + public CommonResult createMenu(@Valid @RequestBody MenuSaveVO createReqVO) { + Long menuId = menuService.createMenu(createReqVO); + return success(menuId); + } + + @PutMapping("/update") + @Operation(summary = "修改菜单") + @PreAuthorize("@ss.hasPermission('system:menu:update')") + public CommonResult updateMenu(@Valid @RequestBody MenuSaveVO updateReqVO) { + menuService.updateMenu(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除菜单") + @Parameter(name = "id", description = "菜单编号", required= true, example = "1024") + @PreAuthorize("@ss.hasPermission('system:menu:delete')") + public CommonResult deleteMenu(@RequestParam("id") Long id) { + menuService.deleteMenu(id); + return success(true); + } + + @GetMapping("/list") + @Operation(summary = "获取菜单列表", description = "用于【菜单管理】界面") + @PreAuthorize("@ss.hasPermission('system:menu:query')") + public CommonResult> getMenuList(MenuListReqVO reqVO) { + List list = menuService.getMenuList(reqVO); + list.sort(Comparator.comparing(MenuDO::getSort)); + return success(BeanUtils.toBean(list, MenuRespVO.class)); + } + + @GetMapping({"/list-all-simple", "simple-list"}) + @Operation(summary = "获取菜单精简信息列表", + description = "只包含被开启的菜单,用于【角色分配菜单】功能的选项。在多租户的场景下,会只返回租户所在套餐有的菜单") + public CommonResult> getSimpleMenuList() { + List list = menuService.getMenuListByTenant( + new MenuListReqVO().setStatus(CommonStatusEnum.ENABLE.getStatus())); + list = menuService.filterDisableMenus(list); + list.sort(Comparator.comparing(MenuDO::getSort)); + return success(BeanUtils.toBean(list, MenuSimpleRespVO.class)); + } + + @GetMapping("/get") + @Operation(summary = "获取菜单信息") + @PreAuthorize("@ss.hasPermission('system:menu:query')") + public CommonResult getMenu(Long id) { + MenuDO menu = menuService.getMenu(id); + return success(BeanUtils.toBean(menu, MenuRespVO.class)); + } + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/controller/NoticeController.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/controller/NoticeController.java new file mode 100644 index 0000000..6e50aa2 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/controller/NoticeController.java @@ -0,0 +1,85 @@ +package com.platform.marketing.module.system.controller; + +import cn.hutool.core.lang.Assert; +import com.platform.marketing.framework.common.pojo.CommonResult; +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.common.util.object.BeanUtils; +import com.platform.marketing.module.system.domain.vo.NoticePageReqVO; +import com.platform.marketing.module.system.domain.vo.NoticeRespVO; +import com.platform.marketing.module.system.domain.vo.NoticeSaveReqVO; +import com.platform.marketing.module.system.domain.dataobject.NoticeDO; +import com.platform.marketing.module.system.service.NoticeService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.validation.Valid; + +import static com.platform.marketing.framework.common.pojo.CommonResult.success; + +@Tag(name = "管理后台 - 通知公告") +@RestController +@RequestMapping("/system/notice") +@Validated +public class NoticeController { + + @Resource + private NoticeService noticeService; + + @PostMapping("/create") + @Operation(summary = "创建通知公告") + @PreAuthorize("@ss.hasPermission('system:notice:create')") + public CommonResult createNotice(@Valid @RequestBody NoticeSaveReqVO createReqVO) { + Long noticeId = noticeService.createNotice(createReqVO); + return success(noticeId); + } + + @PutMapping("/update") + @Operation(summary = "修改通知公告") + @PreAuthorize("@ss.hasPermission('system:notice:update')") + public CommonResult updateNotice(@Valid @RequestBody NoticeSaveReqVO updateReqVO) { + noticeService.updateNotice(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除通知公告") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('system:notice:delete')") + public CommonResult deleteNotice(@RequestParam("id") Long id) { + noticeService.deleteNotice(id); + return success(true); + } + + @GetMapping("/page") + @Operation(summary = "获取通知公告列表") + @PreAuthorize("@ss.hasPermission('system:notice:query')") + public CommonResult> getNoticePage(@Validated NoticePageReqVO pageReqVO) { + PageResult pageResult = noticeService.getNoticePage(pageReqVO); + return success(BeanUtils.toBean(pageResult, NoticeRespVO.class)); + } + + @GetMapping("/get") + @Operation(summary = "获得通知公告") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('system:notice:query')") + public CommonResult getNotice(@RequestParam("id") Long id) { + NoticeDO notice = noticeService.getNotice(id); + return success(BeanUtils.toBean(notice, NoticeRespVO.class)); + } + + @PostMapping("/push") + @Operation(summary = "推送通知公告", description = "只发送给 websocket 连接在线的用户") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('system:notice:update')") + public CommonResult push(@RequestParam("id") Long id) { + NoticeDO notice = noticeService.getNotice(id); + Assert.notNull(notice, "公告不能为空"); + return success(true); + } + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/controller/OperateLogController.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/controller/OperateLogController.java new file mode 100644 index 0000000..ac0b8cb --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/controller/OperateLogController.java @@ -0,0 +1,56 @@ +package com.platform.marketing.module.system.controller; + +import com.platform.marketing.framework.common.pojo.CommonResult; +import com.platform.marketing.framework.common.pojo.PageParam; +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.common.util.object.BeanUtils; +import com.platform.marketing.framework.excel.core.util.ExcelUtils; +import com.platform.marketing.framework.translate.core.TranslateUtils; +import com.platform.marketing.module.system.domain.vo.OperateLogPageReqVO; +import com.platform.marketing.module.system.domain.vo.OperateLogRespVO; +import com.platform.marketing.module.system.domain.dataobject.OperateLogDO; +import com.platform.marketing.module.system.service.OperateLogService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; +import java.io.IOException; +import java.util.List; + +import static com.platform.marketing.framework.common.pojo.CommonResult.success; + +@Tag(name = "管理后台 - 操作日志") +@RestController +@RequestMapping("/system/operate-log") +@Validated +public class OperateLogController { + + @Resource + private OperateLogService operateLogService; + + @GetMapping("/page") + @Operation(summary = "查看操作日志分页列表") + @PreAuthorize("@ss.hasPermission('system:operate-log:query')") + public CommonResult> pageOperateLog(@Valid OperateLogPageReqVO pageReqVO) { + PageResult pageResult = operateLogService.getOperateLogPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, OperateLogRespVO.class)); + } + + @Operation(summary = "导出操作日志") + @GetMapping("/export") + @PreAuthorize("@ss.hasPermission('system:operate-log:export')") + public void exportOperateLog(HttpServletResponse response, @Valid OperateLogPageReqVO exportReqVO) throws IOException { + exportReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = operateLogService.getOperateLogPage(exportReqVO).getList(); + ExcelUtils.write(response, "操作日志.xls", "数据列表", OperateLogRespVO.class, + TranslateUtils.translate(BeanUtils.toBean(list, OperateLogRespVO.class))); + } + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/controller/PermissionController.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/controller/PermissionController.java new file mode 100644 index 0000000..b1d7ab5 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/controller/PermissionController.java @@ -0,0 +1,75 @@ +package com.platform.marketing.module.system.controller; + +import com.platform.marketing.framework.common.pojo.CommonResult; +import com.platform.marketing.module.system.domain.vo.PermissionAssignRoleDataScopeReqVO; +import com.platform.marketing.module.system.domain.vo.PermissionAssignRoleMenuReqVO; +import com.platform.marketing.module.system.domain.vo.PermissionAssignUserRoleReqVO; +import com.platform.marketing.module.system.service.PermissionService; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.validation.Valid; +import java.util.Set; + +import static com.platform.marketing.framework.common.pojo.CommonResult.success; + +/** + * 权限 Controller,提供赋予用户、角色的权限的 API 接口 + * + + */ +@Tag(name = "管理后台 - 权限") +@RestController +@RequestMapping("/system/permission") +public class PermissionController { + + @Resource + private PermissionService permissionService; + + @Operation(summary = "获得角色拥有的菜单编号") + @Parameter(name = "roleId", description = "角色编号", required = true) + @GetMapping("/list-role-menus") + @PreAuthorize("@ss.hasPermission('system:permission:assign-role-menu')") + public CommonResult> getRoleMenuList(Long roleId) { + return success(permissionService.getRoleMenuListByRoleId(roleId)); + } + + @PostMapping("/assign-role-menu") + @Operation(summary = "赋予角色菜单") + @PreAuthorize("@ss.hasPermission('system:permission:assign-role-menu')") + public CommonResult assignRoleMenu(@Validated @RequestBody PermissionAssignRoleMenuReqVO reqVO) { + // 执行菜单的分配 + permissionService.assignRoleMenu(reqVO.getRoleId(), reqVO.getMenuIds()); + return success(true); + } + + @PostMapping("/assign-role-data-scope") + @Operation(summary = "赋予角色数据权限") + @PreAuthorize("@ss.hasPermission('system:permission:assign-role-data-scope')") + public CommonResult assignRoleDataScope(@Valid @RequestBody PermissionAssignRoleDataScopeReqVO reqVO) { + permissionService.assignRoleDataScope(reqVO.getRoleId(), reqVO.getDataScope(), reqVO.getDataScopeDeptIds()); + return success(true); + } + + @Operation(summary = "获得管理员拥有的角色编号列表") + @Parameter(name = "userId", description = "用户编号", required = true) + @GetMapping("/list-user-roles") + @PreAuthorize("@ss.hasPermission('system:permission:assign-user-role')") + public CommonResult> listAdminRoles(@RequestParam("userId") Long userId) { + return success(permissionService.getUserRoleIdListByUserId(userId)); + } + + @Operation(summary = "赋予用户角色") + @PostMapping("/assign-user-role") + @PreAuthorize("@ss.hasPermission('system:permission:assign-user-role')") + public CommonResult assignUserRole(@Validated @RequestBody PermissionAssignUserRoleReqVO reqVO) { + permissionService.assignUserRole(reqVO.getUserId(), reqVO.getRoleIds()); + return success(true); + } + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/controller/PostController.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/controller/PostController.java new file mode 100644 index 0000000..b8fb7be --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/controller/PostController.java @@ -0,0 +1,102 @@ +package com.platform.marketing.module.system.controller; + +import com.platform.marketing.framework.common.enums.CommonStatusEnum; +import com.platform.marketing.framework.common.pojo.CommonResult; +import com.platform.marketing.framework.common.pojo.PageParam; +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.common.util.object.BeanUtils; +import com.platform.marketing.framework.excel.core.util.ExcelUtils; +import com.platform.marketing.module.system.domain.vo.PostPageReqVO; +import com.platform.marketing.module.system.domain.vo.PostRespVO; +import com.platform.marketing.module.system.domain.vo.PostSaveReqVO; +import com.platform.marketing.module.system.domain.vo.PostSimpleRespVO; +import com.platform.marketing.module.system.domain.dataobject.PostDO; +import com.platform.marketing.module.system.service.PostService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; +import java.io.IOException; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; +import static com.platform.marketing.framework.common.pojo.CommonResult.success; + +@Tag(name = "管理后台 - 岗位") +@RestController +@RequestMapping("/system/post") +@Validated +public class PostController { + + @Resource + private PostService postService; + + @PostMapping("/create") + @Operation(summary = "创建岗位") + @PreAuthorize("@ss.hasPermission('system:post:create')") + public CommonResult createPost(@Valid @RequestBody PostSaveReqVO createReqVO) { + Long postId = postService.createPost(createReqVO); + return success(postId); + } + + @PutMapping("/update") + @Operation(summary = "修改岗位") + @PreAuthorize("@ss.hasPermission('system:post:update')") + public CommonResult updatePost(@Valid @RequestBody PostSaveReqVO updateReqVO) { + postService.updatePost(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除岗位") + @PreAuthorize("@ss.hasPermission('system:post:delete')") + public CommonResult deletePost(@RequestParam("id") Long id) { + postService.deletePost(id); + return success(true); + } + + @GetMapping(value = "/get") + @Operation(summary = "获得岗位信息") + @Parameter(name = "id", description = "岗位编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('system:post:query')") + public CommonResult getPost(@RequestParam("id") Long id) { + PostDO post = postService.getPost(id); + return success(BeanUtils.toBean(post, PostRespVO.class)); + } + + @GetMapping(value = {"/list-all-simple", "simple-list"}) + @Operation(summary = "获取岗位全列表", description = "只包含被开启的岗位,主要用于前端的下拉选项") + public CommonResult> getSimplePostList() { + // 获得岗位列表,只要开启状态的 + List list = postService.getPostList(null, Collections.singleton(CommonStatusEnum.ENABLE.getStatus())); + // 排序后,返回给前端 + list.sort(Comparator.comparing(PostDO::getSort)); + return success(BeanUtils.toBean(list, PostSimpleRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得岗位分页列表") + @PreAuthorize("@ss.hasPermission('system:post:query')") + public CommonResult> getPostPage(@Validated PostPageReqVO pageReqVO) { + PageResult pageResult = postService.getPostPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, PostRespVO.class)); + } + + @GetMapping("/export") + @Operation(summary = "岗位管理") + @PreAuthorize("@ss.hasPermission('system:post:export')") + public void export(HttpServletResponse response, @Validated PostPageReqVO reqVO) throws IOException { + reqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = postService.getPostPage(reqVO).getList(); + // 输出 + ExcelUtils.write(response, "岗位数据.xls", "岗位列表", PostRespVO.class, + BeanUtils.toBean(list, PostRespVO.class)); + } + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/controller/RoleController.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/controller/RoleController.java new file mode 100644 index 0000000..fa99f9e --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/controller/RoleController.java @@ -0,0 +1,99 @@ +package com.platform.marketing.module.system.controller; + +import com.platform.marketing.framework.common.enums.CommonStatusEnum; +import com.platform.marketing.framework.common.pojo.CommonResult; +import com.platform.marketing.framework.common.pojo.PageParam; +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.common.util.object.BeanUtils; +import com.platform.marketing.framework.excel.core.util.ExcelUtils; +import com.platform.marketing.module.system.domain.dataobject.RoleDO; +import com.platform.marketing.module.system.domain.vo.RolePageReqVO; +import com.platform.marketing.module.system.domain.vo.RoleRespVO; +import com.platform.marketing.module.system.domain.vo.RoleSaveReqVO; +import com.platform.marketing.module.system.service.RoleService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; +import java.io.IOException; +import java.util.Comparator; +import java.util.List; + +import static com.platform.marketing.framework.common.pojo.CommonResult.success; +import static java.util.Collections.singleton; + +@Tag(name = "管理后台 - 角色") +@RestController +@RequestMapping("/system/role") +@Validated +public class RoleController { + + @Resource + private RoleService roleService; + + @PostMapping("/create") + @Operation(summary = "创建角色") + @PreAuthorize("@ss.hasPermission('system:role:create')") + public CommonResult createRole(@Valid @RequestBody RoleSaveReqVO createReqVO) { + return success(roleService.createRole(createReqVO, null)); + } + + @PutMapping("/update") + @Operation(summary = "修改角色") + @PreAuthorize("@ss.hasPermission('system:role:update')") + public CommonResult updateRole(@Valid @RequestBody RoleSaveReqVO updateReqVO) { + roleService.updateRole(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除角色") + @Parameter(name = "id", description = "角色编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('system:role:delete')") + public CommonResult deleteRole(@RequestParam("id") Long id) { + roleService.deleteRole(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得角色信息") + @PreAuthorize("@ss.hasPermission('system:role:query')") + public CommonResult getRole(@RequestParam("id") Long id) { + RoleDO role = roleService.getRole(id); + return success(BeanUtils.toBean(role, RoleRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得角色分页") + @PreAuthorize("@ss.hasPermission('system:role:query')") + public CommonResult> getRolePage(RolePageReqVO pageReqVO) { + PageResult pageResult = roleService.getRolePage(pageReqVO); + return success(BeanUtils.toBean(pageResult, RoleRespVO.class)); + } + + @GetMapping({"/list-all-simple", "/simple-list"}) + @Operation(summary = "获取角色精简信息列表", description = "只包含被开启的角色,主要用于前端的下拉选项") + public CommonResult> getSimpleRoleList() { + List list = roleService.getRoleListByStatus(singleton(CommonStatusEnum.ENABLE.getStatus())); + list.sort(Comparator.comparing(RoleDO::getSort)); + return success(BeanUtils.toBean(list, RoleRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出角色 Excel") + @PreAuthorize("@ss.hasPermission('system:role:export')") + public void export(HttpServletResponse response, @Validated RolePageReqVO exportReqVO) throws IOException { + exportReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = roleService.getRolePage(exportReqVO).getList(); + // 输出 + ExcelUtils.write(response, "角色数据.xls", "数据", RoleRespVO.class, + BeanUtils.toBean(list, RoleRespVO.class)); + } + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/controller/UserController.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/controller/UserController.java new file mode 100644 index 0000000..aa52918 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/controller/UserController.java @@ -0,0 +1,169 @@ +package com.platform.marketing.module.system.controller; + +import cn.hutool.core.collection.CollUtil; +import com.platform.marketing.framework.common.enums.CommonStatusEnum; +import com.platform.marketing.framework.common.pojo.CommonResult; +import com.platform.marketing.framework.common.pojo.PageParam; +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.excel.core.util.ExcelUtils; +import com.platform.marketing.module.system.domain.convert.UserConvert; +import com.platform.marketing.module.system.domain.dataobject.DeptDO; +import com.platform.marketing.module.system.domain.dataobject.AdminUserDO; +import com.platform.marketing.module.system.domain.vo.*; +import com.platform.marketing.module.system.domain.enums.SexEnum; +import com.platform.marketing.module.system.service.DeptService; +import com.platform.marketing.module.system.service.AdminUserService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Parameters; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +import static com.platform.marketing.framework.common.pojo.CommonResult.success; +import static com.platform.marketing.framework.common.util.collection.CollectionUtils.convertList; + +@Tag(name = "管理后台 - 用户") +@RestController +@RequestMapping("/system/user") +@Validated +public class UserController { + + @Resource + private AdminUserService userService; + @Resource + private DeptService deptService; + + @PostMapping("/create") + @Operation(summary = "新增用户") + @PreAuthorize("@ss.hasPermission('system:user:create')") + public CommonResult createUser(@Valid @RequestBody UserSaveReqVO reqVO) { + Long id = userService.createUser(reqVO); + return success(id); + } + + @PutMapping("update") + @Operation(summary = "修改用户") + @PreAuthorize("@ss.hasPermission('system:user:update')") + public CommonResult updateUser(@Valid @RequestBody UserSaveReqVO reqVO) { + userService.updateUser(reqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除用户") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('system:user:delete')") + public CommonResult deleteUser(@RequestParam("id") Long id) { + userService.deleteUser(id); + return success(true); + } + + @PutMapping("/update-password") + @Operation(summary = "重置用户密码") + @PreAuthorize("@ss.hasPermission('system:user:update-password')") + public CommonResult updateUserPassword(@Valid @RequestBody UserUpdatePasswordReqVO reqVO) { + userService.updateUserPassword(reqVO.getId(), reqVO.getPassword()); + return success(true); + } + + @PutMapping("/update-status") + @Operation(summary = "修改用户状态") + @PreAuthorize("@ss.hasPermission('system:user:update')") + public CommonResult updateUserStatus(@Valid @RequestBody UserUpdateStatusReqVO reqVO) { + userService.updateUserStatus(reqVO.getId(), reqVO.getStatus()); + return success(true); + } + + @GetMapping("/page") + @Operation(summary = "获得用户分页列表") + @PreAuthorize("@ss.hasPermission('system:user:query')") + public CommonResult> getUserPage(@Valid UserPageReqVO pageReqVO) { + // 获得用户分页列表 + PageResult pageResult = userService.getUserPage(pageReqVO); + if (CollUtil.isEmpty(pageResult.getList())) { + return success(new PageResult<>(pageResult.getTotal())); + } + // 拼接数据 + Map deptMap = deptService.getDeptMap( + convertList(pageResult.getList(), AdminUserDO::getDeptId)); + return success(new PageResult<>(UserConvert.INSTANCE.convertList(pageResult.getList(), deptMap), + pageResult.getTotal())); + } + + @GetMapping({"/list-all-simple", "/simple-list"}) + @Operation(summary = "获取用户精简信息列表", description = "只包含被开启的用户,主要用于前端的下拉选项") + public CommonResult> getSimpleUserList() { + List list = userService.getUserListByStatus(CommonStatusEnum.ENABLE.getStatus()); + // 拼接数据 + Map deptMap = deptService.getDeptMap( + convertList(list, AdminUserDO::getDeptId)); + return success(UserConvert.INSTANCE.convertSimpleList(list, deptMap)); + } + + @GetMapping("/get") + @Operation(summary = "获得用户详情") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('system:user:query')") + public CommonResult getUser(@RequestParam("id") Long id) { + AdminUserDO user = userService.getUser(id); + if (user == null) { + return success(null); + } + // 拼接数据 + DeptDO dept = deptService.getDept(user.getDeptId()); + return success(UserConvert.INSTANCE.convert(user, dept)); + } + + @GetMapping("/export") + @Operation(summary = "导出用户") + @PreAuthorize("@ss.hasPermission('system:user:export')") + public void exportUserList(@Validated UserPageReqVO exportReqVO, + HttpServletResponse response) throws IOException { + exportReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = userService.getUserPage(exportReqVO).getList(); + // 输出 Excel + Map deptMap = deptService.getDeptMap( + convertList(list, AdminUserDO::getDeptId)); + ExcelUtils.write(response, "用户数据.xls", "数据", UserRespVO.class, + UserConvert.INSTANCE.convertList(list, deptMap)); + } + + @GetMapping("/get-import-template") + @Operation(summary = "获得导入用户模板") + public void importTemplate(HttpServletResponse response) throws IOException { + // 手动创建导出 demo + List list = Arrays.asList( + UserImportExcelVO.builder().username("yunai").deptId(1L).email("yunai@iocoder.cn").mobile("15601691300") + .nickname("芋道").status(CommonStatusEnum.ENABLE.getStatus()).sex(SexEnum.MALE.getSex()).build(), + UserImportExcelVO.builder().username("yuanma").deptId(2L).email("yuanma@iocoder.cn").mobile("15601701300") + .nickname("源码").status(CommonStatusEnum.DISABLE.getStatus()).sex(SexEnum.FEMALE.getSex()).build() + ); + // 输出 + ExcelUtils.write(response, "用户导入模板.xls", "用户列表", UserImportExcelVO.class, list); + } + + @PostMapping("/import") + @Operation(summary = "导入用户") + @Parameters({ + @Parameter(name = "file", description = "Excel 文件", required = true), + @Parameter(name = "updateSupport", description = "是否支持更新,默认为 false", example = "true") + }) + @PreAuthorize("@ss.hasPermission('system:user:import')") + public CommonResult importExcel(@RequestParam("file") MultipartFile file, + @RequestParam(value = "updateSupport", required = false, defaultValue = "false") Boolean updateSupport) throws Exception { + List list = ExcelUtils.read(file, UserImportExcelVO.class); + return success(userService.importUserList(list, updateSupport)); + } + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/controller/UserProfileController.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/controller/UserProfileController.java new file mode 100644 index 0000000..0001d50 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/controller/UserProfileController.java @@ -0,0 +1,91 @@ +package com.platform.marketing.module.system.controller; + +import cn.hutool.core.collection.CollUtil; +import com.platform.marketing.framework.common.pojo.CommonResult; +import com.platform.marketing.module.infra.domain.enums.ErrorCodeConstants; +import com.platform.marketing.module.system.domain.vo.UserProfileRespVO; +import com.platform.marketing.module.system.domain.vo.UserProfileUpdatePasswordReqVO; +import com.platform.marketing.module.system.domain.vo.UserProfileUpdateReqVO; +import com.platform.marketing.module.system.domain.convert.UserConvert; +import com.platform.marketing.module.system.domain.dataobject.DeptDO; +import com.platform.marketing.module.system.domain.dataobject.PostDO; +import com.platform.marketing.module.system.domain.dataobject.RoleDO; +import com.platform.marketing.module.system.domain.dataobject.AdminUserDO; +import com.platform.marketing.module.system.service.DeptService; +import com.platform.marketing.module.system.service.PostService; +import com.platform.marketing.module.system.service.PermissionService; +import com.platform.marketing.module.system.service.RoleService; +import com.platform.marketing.module.system.service.AdminUserService; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import javax.validation.Valid; +import java.util.List; + +import static com.platform.marketing.framework.common.exception.util.ServiceExceptionUtil.exception; +import static com.platform.marketing.framework.common.pojo.CommonResult.success; +import static com.platform.marketing.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; + +@Tag(name = "管理后台 - 用户个人中心") +@RestController +@RequestMapping("/system/user/profile") +@Validated +@Slf4j +public class UserProfileController { + + @Resource + private AdminUserService userService; + @Resource + private DeptService deptService; + @Resource + private PostService postService; + @Resource + private PermissionService permissionService; + @Resource + private RoleService roleService; + + @GetMapping("/get") + @Operation(summary = "获得登录用户信息") + public CommonResult getUserProfile() { + // 获得用户基本信息 + AdminUserDO user = userService.getUser(getLoginUserId()); + // 获得用户角色 + List userRoles = roleService.getRoleListFromCache(permissionService.getUserRoleIdListByUserId(user.getId())); + // 获得部门信息 + DeptDO dept = user.getDeptId() != null ? deptService.getDept(user.getDeptId()) : null; + // 获得岗位信息 + List posts = CollUtil.isNotEmpty(user.getPostIds()) ? postService.getPostList(user.getPostIds()) : null; + return success(UserConvert.INSTANCE.convert(user, userRoles, dept, posts)); + } + + @PutMapping("/update") + @Operation(summary = "修改用户个人信息") + public CommonResult updateUserProfile(@Valid @RequestBody UserProfileUpdateReqVO reqVO) { + userService.updateUserProfile(getLoginUserId(), reqVO); + return success(true); + } + + @PutMapping("/update-password") + @Operation(summary = "修改用户个人密码") + public CommonResult updateUserProfilePassword(@Valid @RequestBody UserProfileUpdatePasswordReqVO reqVO) { + userService.updateUserPassword(getLoginUserId(), reqVO); + return success(true); + } + + @RequestMapping(value = "/update-avatar", + method = {RequestMethod.POST, RequestMethod.PUT}) // 解决 uni-app 不支持 Put 上传文件的问题 + @Operation(summary = "上传用户个人头像") + public CommonResult updateUserAvatar(@RequestParam("avatarFile") MultipartFile file) throws Exception { + if (file.isEmpty()) { + throw exception(ErrorCodeConstants.FILE_IS_EMPTY); + } + String avatar = userService.updateUserAvatar(getLoginUserId(), file.getInputStream()); + return success(avatar); + } + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/convert/AuthConvert.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/convert/AuthConvert.java new file mode 100644 index 0000000..17d199f --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/convert/AuthConvert.java @@ -0,0 +1,80 @@ +package com.platform.marketing.module.system.domain.convert; + +import cn.hutool.core.collection.CollUtil; +import com.platform.marketing.framework.common.util.object.BeanUtils; +import com.platform.marketing.framework.token.core.dto.SecurityAccessTokenDTO; +import com.platform.marketing.module.system.domain.dataobject.MenuDO; +import com.platform.marketing.module.system.domain.dataobject.RoleDO; +import com.platform.marketing.module.system.domain.dataobject.AdminUserDO; +import com.platform.marketing.module.system.domain.vo.AuthLoginRespVO; +import com.platform.marketing.module.system.domain.vo.AuthPermissionInfoRespVO; +import com.platform.marketing.module.system.domain.enums.MenuTypeEnum; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; +import org.slf4j.LoggerFactory; + +import java.util.*; + +import static com.platform.marketing.framework.common.util.collection.CollectionUtils.convertSet; +import static com.platform.marketing.framework.common.util.collection.CollectionUtils.filterList; +import static com.platform.marketing.module.system.domain.dataobject.MenuDO.ID_ROOT; + +@Mapper +public interface AuthConvert { + + AuthConvert INSTANCE = Mappers.getMapper(AuthConvert.class); + + AuthLoginRespVO convert(SecurityAccessTokenDTO securityAccessTokenDTO); + + default AuthPermissionInfoRespVO convert(AdminUserDO user, List roleList, List menuList) { + return AuthPermissionInfoRespVO.builder() + .user(BeanUtils.toBean(user, AuthPermissionInfoRespVO.UserVO.class)) + .roles(convertSet(roleList, RoleDO::getCode)) + // 权限标识信息 + .permissions(convertSet(menuList, MenuDO::getPermission)) + // 菜单树 + .menus(buildMenuTree(menuList)) + .build(); + } + + AuthPermissionInfoRespVO.MenuVO convertTreeNode(MenuDO menu); + + /** + * 将菜单列表,构建成菜单树 + * + * @param menuList 菜单列表 + * @return 菜单树 + */ + default List buildMenuTree(List menuList) { + if (CollUtil.isEmpty(menuList)) { + return Collections.emptyList(); + } + // 移除按钮 + menuList.removeIf(menu -> menu.getType().equals(MenuTypeEnum.BUTTON.getType())); + // 排序,保证菜单的有序性 + menuList.sort(Comparator.comparing(MenuDO::getSort)); + + // 构建菜单树 + // 使用 LinkedHashMap 的原因,是为了排序 。实际也可以用 Stream API ,就是太丑了。 + Map treeNodeMap = new LinkedHashMap<>(); + menuList.forEach(menu -> treeNodeMap.put(menu.getId(), AuthConvert.INSTANCE.convertTreeNode(menu))); + // 处理父子关系 + treeNodeMap.values().stream().filter(node -> !node.getParentId().equals(ID_ROOT)).forEach(childNode -> { + // 获得父节点 + AuthPermissionInfoRespVO.MenuVO parentNode = treeNodeMap.get(childNode.getParentId()); + if (parentNode == null) { + LoggerFactory.getLogger(getClass()).error("[buildRouterTree][resource({}) 找不到父资源({})]", + childNode.getId(), childNode.getParentId()); + return; + } + // 将自己添加到父节点中 + if (parentNode.getChildren() == null) { + parentNode.setChildren(new ArrayList<>()); + } + parentNode.getChildren().add(childNode); + }); + // 获得到所有的根节点 + return filterList(treeNodeMap.values(), node -> ID_ROOT.equals(node.getParentId())); + } + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/convert/TenantConvert.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/convert/TenantConvert.java new file mode 100644 index 0000000..f5024f4 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/convert/TenantConvert.java @@ -0,0 +1,26 @@ +package com.platform.marketing.module.system.domain.convert; + +import com.platform.marketing.module.system.domain.vo.TenantSaveReqVO; +import com.platform.marketing.module.system.domain.vo.UserSaveReqVO; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +/** + * 租户 Convert + * + + */ +@Mapper +public interface TenantConvert { + + TenantConvert INSTANCE = Mappers.getMapper(TenantConvert.class); + + default UserSaveReqVO convert02(TenantSaveReqVO bean) { + UserSaveReqVO reqVO = new UserSaveReqVO(); + reqVO.setUsername(bean.getUsername()); + reqVO.setPassword(bean.getPassword()); + reqVO.setNickname(bean.getContactName()).setMobile(bean.getContactMobile()); + return reqVO; + } + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/convert/UserConvert.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/convert/UserConvert.java new file mode 100644 index 0000000..7cdff65 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/convert/UserConvert.java @@ -0,0 +1,58 @@ +package com.platform.marketing.module.system.domain.convert; + +import com.platform.marketing.framework.common.util.collection.CollectionUtils; +import com.platform.marketing.framework.common.util.collection.MapUtils; +import com.platform.marketing.framework.common.util.object.BeanUtils; +import com.platform.marketing.module.system.domain.vo.DeptSimpleRespVO; +import com.platform.marketing.module.system.domain.vo.PostSimpleRespVO; +import com.platform.marketing.module.system.domain.vo.RoleSimpleRespVO; +import com.platform.marketing.module.system.domain.vo.UserProfileRespVO; +import com.platform.marketing.module.system.domain.vo.UserRespVO; +import com.platform.marketing.module.system.domain.vo.UserSimpleRespVO; +import com.platform.marketing.module.system.domain.dataobject.DeptDO; +import com.platform.marketing.module.system.domain.dataobject.PostDO; +import com.platform.marketing.module.system.domain.dataobject.RoleDO; +import com.platform.marketing.module.system.domain.dataobject.AdminUserDO; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +import java.util.List; +import java.util.Map; + +@Mapper +public interface UserConvert { + + UserConvert INSTANCE = Mappers.getMapper(UserConvert.class); + + default List convertList(List list, Map deptMap) { + return CollectionUtils.convertList(list, user -> convert(user, deptMap.get(user.getDeptId()))); + } + + default UserRespVO convert(AdminUserDO user, DeptDO dept) { + UserRespVO userVO = BeanUtils.toBean(user, UserRespVO.class); + if (dept != null) { + userVO.setDeptName(dept.getName()); + } + return userVO; + } + + default List convertSimpleList(List list, Map deptMap) { + return CollectionUtils.convertList(list, user -> { + UserSimpleRespVO userVO = BeanUtils.toBean(user, UserSimpleRespVO.class); + MapUtils.findAndThen(deptMap, user.getDeptId(), dept -> userVO.setDeptName(dept.getName())); + return userVO; + }); + } + + default UserProfileRespVO convert(AdminUserDO user, + List userRoles, + DeptDO dept, + List posts) { + UserProfileRespVO userVO = BeanUtils.toBean(user, UserProfileRespVO.class); + userVO.setRoles(BeanUtils.toBean(userRoles, RoleSimpleRespVO.class)); + userVO.setDept(BeanUtils.toBean(dept, DeptSimpleRespVO.class)); + userVO.setPosts(BeanUtils.toBean(posts, PostSimpleRespVO.class)); + return userVO; + } + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/dataobject/AdminUserDO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/dataobject/AdminUserDO.java new file mode 100644 index 0000000..513e5a7 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/dataobject/AdminUserDO.java @@ -0,0 +1,96 @@ +package com.platform.marketing.module.system.domain.dataobject; + +import com.platform.marketing.framework.common.enums.CommonStatusEnum; +import com.platform.marketing.framework.mybatis.core.dataobject.BaseDO; +import com.platform.marketing.module.system.domain.enums.SexEnum; +import com.baomidou.mybatisplus.annotation.KeySequence; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; +import lombok.*; +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; + +import java.time.LocalDateTime; +import java.util.Set; + +/** + * 管理后台的用户 DO + * + + */ +@TableName(value = "system_users", autoResultMap = true) // 由于 SQL Server 的 system_user 是关键字,所以使用 system_users +@KeySequence("system_users_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class AdminUserDO extends BaseDO { + + /** + * 用户ID + */ + @TableId + private Long id; + /** + * 用户账号 + */ + private String username; + /** + * 加密后的密码 + * + * 因为目前使用 {@link BCryptPasswordEncoder} 加密器,所以无需自己处理 salt 盐 + */ + private String password; + /** + * 用户昵称 + */ + private String nickname; + /** + * 备注 + */ + private String remark; + /** + * 部门 ID + */ + private Long deptId; + /** + * 岗位编号数组 + */ + @TableField(typeHandler = JacksonTypeHandler.class) + private Set postIds; + /** + * 用户邮箱 + */ + private String email; + /** + * 手机号码 + */ + private String mobile; + /** + * 用户性别 + * + * 枚举类 {@link SexEnum} + */ + private Integer sex; + /** + * 用户头像 + */ + private String avatar; + /** + * 帐号状态 + * + * 枚举 {@link CommonStatusEnum} + */ + private Integer status; + /** + * 最后登录IP + */ + private String loginIp; + /** + * 最后登录时间 + */ + private LocalDateTime loginDate; + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/dataobject/DeptDO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/dataobject/DeptDO.java new file mode 100644 index 0000000..380a15e --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/dataobject/DeptDO.java @@ -0,0 +1,65 @@ +package com.platform.marketing.module.system.domain.dataobject; + +import com.platform.marketing.framework.common.enums.CommonStatusEnum; +import com.platform.marketing.framework.mybatis.core.dataobject.BaseDO; +import com.baomidou.mybatisplus.annotation.KeySequence; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 部门表 + * + * @author ruoyi + + */ +@TableName("system_dept") +@KeySequence("system_dept_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +public class DeptDO extends BaseDO { + + public static final Long PARENT_ID_ROOT = 0L; + + /** + * 部门ID + */ + @TableId + private Long id; + /** + * 部门名称 + */ + private String name; + /** + * 父部门ID + * + * 关联 {@link #id} + */ + private Long parentId; + /** + * 显示顺序 + */ + private Integer sort; + /** + * 负责人 + * + * 关联 {@link AdminUserDO#getId()} + */ + private Long leaderUserId; + /** + * 联系电话 + */ + private String phone; + /** + * 邮箱 + */ + private String email; + /** + * 部门状态 + * + * 枚举 {@link CommonStatusEnum} + */ + private Integer status; + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/dataobject/DictDataDO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/dataobject/DictDataDO.java new file mode 100644 index 0000000..3f6562a --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/dataobject/DictDataDO.java @@ -0,0 +1,65 @@ +package com.platform.marketing.module.system.domain.dataobject; + +import com.platform.marketing.framework.common.enums.CommonStatusEnum; +import com.platform.marketing.framework.mybatis.core.dataobject.BaseDO; +import com.baomidou.mybatisplus.annotation.*; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 字典数据表 + * + * @author ruoyi + */ +@TableName("system_dict_data") +@KeySequence("system_dict_data_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +public class DictDataDO extends BaseDO { + + /** + * 字典数据编号 + */ + @TableId + private Long id; + /** + * 字典排序 + */ + private Integer sort; + /** + * 字典标签 + */ + private String label; + /** + * 字典值 + */ + private String value; + /** + * 字典类型 + * + * 冗余 {@link DictDataDO#getDictType()} + */ + private String dictType; + /** + * 状态 + * + * 枚举 {@link CommonStatusEnum} + */ + private Integer status; + /** + * 颜色类型 + * + * 对应到 element-ui 为 default、primary、success、info、warning、danger + */ + private String colorType; + /** + * css 样式 + */ + @TableField(updateStrategy = FieldStrategy.ALWAYS) + private String cssClass; + /** + * 备注 + */ + private String remark; + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/dataobject/DictTypeDO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/dataobject/DictTypeDO.java new file mode 100644 index 0000000..1982fde --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/dataobject/DictTypeDO.java @@ -0,0 +1,57 @@ +package com.platform.marketing.module.system.domain.dataobject; + +import com.platform.marketing.framework.common.enums.CommonStatusEnum; +import com.platform.marketing.framework.mybatis.core.dataobject.BaseDO; +import com.baomidou.mybatisplus.annotation.KeySequence; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.*; + +import java.time.LocalDateTime; + +/** + * 字典类型表 + * + * @author ruoyi + */ +@TableName("system_dict_type") +@KeySequence("system_dict_type_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class DictTypeDO extends BaseDO { + + /** + * 字典主键 + */ + @TableId + private Long id; + /** + * 字典名称 + */ + private String name; + /** + * 字典类型 + */ + private String type; + /** + * 状态 + * + * 枚举 {@link CommonStatusEnum} + */ + private Integer status; + /** + * 备注 + */ + private String remark; + + /** + * 删除时间 + */ + private LocalDateTime deletedTime; + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/dataobject/LoginLogDO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/dataobject/LoginLogDO.java new file mode 100644 index 0000000..8b4d8f1 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/dataobject/LoginLogDO.java @@ -0,0 +1,72 @@ +package com.platform.marketing.module.system.domain.dataobject; + +import com.platform.marketing.framework.common.enums.UserTypeEnum; +import com.platform.marketing.framework.mybatis.core.dataobject.BaseDO; +import com.platform.marketing.module.system.domain.enums.LoginLogTypeEnum; +import com.platform.marketing.module.system.domain.enums.LoginResultEnum; +import com.baomidou.mybatisplus.annotation.KeySequence; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +/** + * 登录日志表 + * + * 注意,包括登录和登出两种行为 + * + + */ +@TableName("system_login_log") +@KeySequence("system_login_log_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class LoginLogDO extends BaseDO { + + /** + * 日志主键 + */ + private Long id; + /** + * 日志类型 + * + * 枚举 {@link LoginLogTypeEnum} + */ + private Integer logType; + /** + * 链路追踪编号 + */ + private String traceId; + /** + * 用户编号 + */ + private Long userId; + /** + * 用户类型 + * + * 枚举 {@link UserTypeEnum} + */ + private Integer userType; + /** + * 用户账号 + * + * 冗余,因为账号可以变更 + */ + private String username; + /** + * 登录结果 + * + * 枚举 {@link LoginResultEnum} + */ + private Integer result; + /** + * 用户 IP + */ + private String userIp; + /** + * 浏览器 UA + */ + private String userAgent; + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/dataobject/MenuDO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/dataobject/MenuDO.java new file mode 100644 index 0000000..e7a6040 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/dataobject/MenuDO.java @@ -0,0 +1,107 @@ +package com.platform.marketing.module.system.domain.dataobject; + +import com.platform.marketing.framework.common.enums.CommonStatusEnum; +import com.platform.marketing.framework.mybatis.core.dataobject.BaseDO; +import com.platform.marketing.module.system.domain.enums.MenuTypeEnum; +import com.baomidou.mybatisplus.annotation.KeySequence; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 菜单 DO + * + * @author ruoyi + */ +@TableName("system_menu") +@KeySequence("system_menu_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +public class MenuDO extends BaseDO { + + /** + * 菜单编号 - 根节点 + */ + public static final Long ID_ROOT = 0L; + + /** + * 菜单编号 + */ + @TableId + private Long id; + /** + * 菜单名称 + */ + private String name; + /** + * 权限标识 + * + * 一般格式为:${系统}:${模块}:${操作} + * 例如说:system:admin:add,即 system 服务的添加管理员。 + * + * 当我们把该 MenuDO 赋予给角色后,意味着该角色有该资源: + * - 对于后端,配合 @PreAuthorize 注解,配置 API 接口需要该权限,从而对 API 接口进行权限控制。 + * - 对于前端,配合前端标签,配置按钮是否展示,避免用户没有该权限时,结果可以看到该操作。 + */ + private String permission; + /** + * 菜单类型 + * + * 枚举 {@link MenuTypeEnum} + */ + private Integer type; + /** + * 显示顺序 + */ + private Integer sort; + /** + * 父菜单ID + */ + private Long parentId; + /** + * 路由地址 + * + * 如果 path 为 http(s) 时,则它是外链 + */ + private String path; + /** + * 菜单图标 + */ + private String icon; + /** + * 组件路径 + */ + private String component; + /** + * 组件名 + */ + private String componentName; + /** + * 状态 + * + * 枚举 {@link CommonStatusEnum} + */ + private Integer status; + /** + * 是否可见 + * + * 只有菜单、目录使用 + * 当设置为 true 时,该菜单不会展示在侧边栏,但是路由还是存在。例如说,一些独立的编辑页面 /edit/1024 等等 + */ + private Boolean visible; + /** + * 是否缓存 + * + * 只有菜单、目录使用,否使用 Vue 路由的 keep-alive 特性 + * 注意:如果开启缓存,则必须填写 {@link #componentName} 属性,否则无法缓存 + */ + private Boolean keepAlive; + /** + * 是否总是显示 + * + * 如果为 false 时,当该菜单只有一个子菜单时,不展示自己,直接展示子菜单 + */ + private Boolean alwaysShow; + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/dataobject/NoticeDO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/dataobject/NoticeDO.java new file mode 100644 index 0000000..0a493a7 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/dataobject/NoticeDO.java @@ -0,0 +1,47 @@ +package com.platform.marketing.module.system.domain.dataobject; + +import com.platform.marketing.framework.common.enums.CommonStatusEnum; +import com.platform.marketing.framework.mybatis.core.dataobject.BaseDO; +import com.platform.marketing.module.system.domain.enums.NoticeTypeEnum; +import com.baomidou.mybatisplus.annotation.KeySequence; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 通知公告表 + * + * @author ruoyi + */ +@TableName("system_notice") +@KeySequence("system_notice_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +public class NoticeDO extends BaseDO { + + /** + * 公告ID + */ + private Long id; + /** + * 公告标题 + */ + private String title; + /** + * 公告类型 + * + * 枚举 {@link NoticeTypeEnum} + */ + private Integer type; + /** + * 公告内容 + */ + private String content; + /** + * 公告状态 + * + * 枚举 {@link CommonStatusEnum} + */ + private Integer status; + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/dataobject/OperateLogDO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/dataobject/OperateLogDO.java new file mode 100644 index 0000000..d84febd --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/dataobject/OperateLogDO.java @@ -0,0 +1,85 @@ +package com.platform.marketing.module.system.domain.dataobject; + +import com.platform.marketing.framework.common.enums.UserTypeEnum; +import com.platform.marketing.framework.mybatis.core.dataobject.BaseDO; +import com.baomidou.mybatisplus.annotation.KeySequence; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +/** + * 操作日志表 + * + + */ +@TableName(value = "system_operate_log", autoResultMap = true) +@KeySequence("system_operate_log_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +public class OperateLogDO extends BaseDO { + + /** + * 日志主键 + */ + @TableId + private Long id; + /** + * 链路追踪编号 + * + * 一般来说,通过链路追踪编号,可以将访问日志,错误日志,链路追踪日志,logger 打印日志等,结合在一起,从而进行排错。 + */ + private String traceId; + /** + * 用户编号 + * + * 关联 MemberUserDO 的 id 属性,或者 AdminUserDO 的 id 属性 + */ + private Long userId; + /** + * 用户类型 + * + * 关联 {@link UserTypeEnum} + */ + private Integer userType; + /** + * 操作模块类型 + */ + private String type; + /** + * 操作名 + */ + private String subType; + /** + * 操作模块业务编号 + */ + private Long bizId; + /** + * 日志内容,记录整个操作的明细 + * + * 例如说,修改编号为 1 的用户信息,将性别从男改成女,将姓名从芋道改成源码。 + */ + private String action; + /** + * 拓展字段,有些复杂的业务,需要记录一些字段 ( JSON 格式 ) + * + * 例如说,记录订单编号,{ orderId: "1"} + */ + private String extra; + + /** + * 请求方法名 + */ + private String requestMethod; + /** + * 请求地址 + */ + private String requestUrl; + /** + * 用户 IP + */ + private String userIp; + /** + * 浏览器 UA + */ + private String userAgent; + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/dataobject/PostDO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/dataobject/PostDO.java new file mode 100644 index 0000000..1d1fefb --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/dataobject/PostDO.java @@ -0,0 +1,50 @@ +package com.platform.marketing.module.system.domain.dataobject; + +import com.platform.marketing.framework.common.enums.CommonStatusEnum; +import com.platform.marketing.framework.mybatis.core.dataobject.BaseDO; +import com.baomidou.mybatisplus.annotation.KeySequence; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 岗位表 + * + * @author ruoyi + */ +@TableName("system_post") +@KeySequence("system_post_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +public class PostDO extends BaseDO { + + /** + * 岗位序号 + */ + @TableId + private Long id; + /** + * 岗位名称 + */ + private String name; + /** + * 岗位编码 + */ + private String code; + /** + * 岗位排序 + */ + private Integer sort; + /** + * 状态 + * + * 枚举 {@link CommonStatusEnum} + */ + private Integer status; + /** + * 备注 + */ + private String remark; + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/dataobject/RoleDO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/dataobject/RoleDO.java new file mode 100644 index 0000000..84d7c22 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/dataobject/RoleDO.java @@ -0,0 +1,78 @@ +package com.platform.marketing.module.system.domain.dataobject; + +import com.platform.marketing.framework.common.enums.CommonStatusEnum; +import com.platform.marketing.framework.mybatis.core.dataobject.BaseDO; +import com.platform.marketing.module.system.domain.enums.DataScopeEnum; +import com.platform.marketing.module.system.domain.enums.RoleTypeEnum; +import com.baomidou.mybatisplus.annotation.KeySequence; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Set; + +/** + * 角色 DO + * + * @author ruoyi + */ +@TableName(value = "system_role", autoResultMap = true) +@KeySequence("system_role_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +public class RoleDO extends BaseDO { + + /** + * 角色ID + */ + @TableId + private Long id; + /** + * 角色名称 + */ + private String name; + /** + * 角色标识 + * + * 枚举 + */ + private String code; + /** + * 角色排序 + */ + private Integer sort; + /** + * 角色状态 + * + * 枚举 {@link CommonStatusEnum} + */ + private Integer status; + /** + * 角色类型 + * + * 枚举 {@link RoleTypeEnum} + */ + private Integer type; + /** + * 备注 + */ + private String remark; + + /** + * 数据范围 + * + * 枚举 {@link DataScopeEnum} + */ + private Integer dataScope; + /** + * 数据范围(指定部门数组) + * + * 适用于 {@link #dataScope} 的值为 {@link DataScopeEnum#DEPT_CUSTOM} 时 + */ + @TableField(typeHandler = JacksonTypeHandler.class) + private Set dataScopeDeptIds; + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/dataobject/RoleMenuDO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/dataobject/RoleMenuDO.java new file mode 100644 index 0000000..34c4046 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/dataobject/RoleMenuDO.java @@ -0,0 +1,35 @@ +package com.platform.marketing.module.system.domain.dataobject; + +import com.platform.marketing.framework.mybatis.core.dataobject.BaseDO; +import com.baomidou.mybatisplus.annotation.KeySequence; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 角色和菜单关联 + * + * @author ruoyi + */ +@TableName("system_role_menu") +@KeySequence("system_role_menu_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +public class RoleMenuDO extends BaseDO { + + /** + * 自增主键 + */ + @TableId + private Long id; + /** + * 角色ID + */ + private Long roleId; + /** + * 菜单ID + */ + private Long menuId; + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/dataobject/TenantDO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/dataobject/TenantDO.java new file mode 100644 index 0000000..b35c7fb --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/dataobject/TenantDO.java @@ -0,0 +1,79 @@ +package com.platform.marketing.module.system.domain.dataobject; + +import com.platform.marketing.framework.common.enums.CommonStatusEnum; +import com.platform.marketing.framework.mybatis.core.dataobject.BaseDO; +import com.baomidou.mybatisplus.annotation.KeySequence; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.*; + +import java.time.LocalDateTime; + +/** + * 租户 DO + * + + */ +@TableName(value = "system_tenant", autoResultMap = true) +@KeySequence("system_tenant_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class TenantDO extends BaseDO { + + /** + * 套餐编号 - 系统 + */ + public static final Long PACKAGE_ID_SYSTEM = 0L; + + /** + * 租户编号,自增 + */ + private Long id; + /** + * 租户名,唯一 + */ + private String name; + /** + * 联系人的用户编号 + * + * 关联 {@link AdminUserDO#getId()} + */ + private Long contactUserId; + /** + * 联系人 + */ + private String contactName; + /** + * 联系手机 + */ + private String contactMobile; + /** + * 租户状态 + * + * 枚举 {@link CommonStatusEnum} + */ + private Integer status; + /** + * 绑定域名 + */ + private String website; + /** + * 租户套餐编号 + * + * 关联 {@link TenantPackageDO#getId()} + * 特殊逻辑:系统内置租户,不使用套餐,暂时使用 {@link #PACKAGE_ID_SYSTEM} 标识 + */ + private Long packageId; + /** + * 过期时间 + */ + private LocalDateTime expireTime; + /** + * 账号数量 + */ + private Integer accountCount; + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/dataobject/TenantPackageDO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/dataobject/TenantPackageDO.java new file mode 100644 index 0000000..2fe2ec6 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/dataobject/TenantPackageDO.java @@ -0,0 +1,52 @@ +package com.platform.marketing.module.system.domain.dataobject; + +import com.platform.marketing.framework.common.enums.CommonStatusEnum; +import com.platform.marketing.framework.mybatis.core.dataobject.BaseDO; +import com.baomidou.mybatisplus.annotation.KeySequence; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; +import lombok.*; + +import java.util.Set; + +/** + * 租户套餐 DO + * + + */ +@TableName(value = "system_tenant_package", autoResultMap = true) +@KeySequence("system_tenant_package_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class TenantPackageDO extends BaseDO { + + /** + * 套餐编号,自增 + */ + private Long id; + /** + * 套餐名,唯一 + */ + private String name; + /** + * 租户套餐状态 + * + * 枚举 {@link CommonStatusEnum} + */ + private Integer status; + /** + * 备注 + */ + private String remark; + /** + * 关联的菜单编号 + */ + @TableField(typeHandler = JacksonTypeHandler.class) + private Set menuIds; + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/dataobject/UserPostDO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/dataobject/UserPostDO.java new file mode 100644 index 0000000..0662257 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/dataobject/UserPostDO.java @@ -0,0 +1,39 @@ +package com.platform.marketing.module.system.domain.dataobject; + +import com.platform.marketing.framework.mybatis.core.dataobject.BaseDO; +import com.baomidou.mybatisplus.annotation.KeySequence; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 用户和岗位关联 + * + * @author ruoyi + */ +@TableName("system_user_post") +@KeySequence("system_user_post_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +public class UserPostDO extends BaseDO { + + /** + * 自增主键 + */ + @TableId + private Long id; + /** + * 用户 ID + * + * 关联 {@link AdminUserDO#getId()} + */ + private Long userId; + /** + * 角色 ID + * + * 关联 {@link PostDO#getId()} + */ + private Long postId; + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/dataobject/UserRoleDO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/dataobject/UserRoleDO.java new file mode 100644 index 0000000..76c8535 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/dataobject/UserRoleDO.java @@ -0,0 +1,35 @@ +package com.platform.marketing.module.system.domain.dataobject; + +import com.platform.marketing.framework.mybatis.core.dataobject.BaseDO; +import com.baomidou.mybatisplus.annotation.KeySequence; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 用户和角色关联 + * + * @author ruoyi + */ +@TableName("system_user_role") +@KeySequence("system_user_role_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +public class UserRoleDO extends BaseDO { + + /** + * 自增主键 + */ + @TableId + private Long id; + /** + * 用户 ID + */ + private Long userId; + /** + * 角色 ID + */ + private Long roleId; + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/dto/LoginLogCreateReqDTO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/dto/LoginLogCreateReqDTO.java new file mode 100644 index 0000000..9208341 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/dto/LoginLogCreateReqDTO.java @@ -0,0 +1,55 @@ +package com.platform.marketing.module.system.domain.dto; + +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; + +@Data +public class LoginLogCreateReqDTO { + + /** + * 日志类型 + */ + @NotNull(message = "日志类型不能为空") + private Integer logType; + /** + * 链路追踪编号 + */ + private String traceId; + + /** + * 用户编号 + */ + private Long userId; + /** + * 用户类型 + */ + @NotNull(message = "用户类型不能为空") + private Integer userType; + /** + * 用户账号 + * + * 不再强制校验 username 非空,因为 Member 社交登录时,此时暂时没有 username(mobile)! + */ + private String username; + + /** + * 登录结果 + */ + @NotNull(message = "登录结果不能为空") + private Integer result; + + /** + * 用户 IP + */ + @NotEmpty(message = "用户 IP 不能为空") + private String userIp; + /** + * 浏览器 UserAgent + * + * 允许空,原因:Job 过期登出时,是无法传递 UserAgent 的 + */ + private String userAgent; + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/enums/DataScopeEnum.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/enums/DataScopeEnum.java new file mode 100644 index 0000000..c01c2dc --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/enums/DataScopeEnum.java @@ -0,0 +1,40 @@ +package com.platform.marketing.module.system.domain.enums; + +import com.platform.marketing.framework.common.core.ArrayValuable; +import lombok.AllArgsConstructor; +import lombok.Getter; + +import java.util.Arrays; + +/** + * 数据范围枚举类 + * + * 用于实现数据级别的权限 + * + + */ +@Getter +@AllArgsConstructor +public enum DataScopeEnum implements ArrayValuable { + + ALL(1), // 全部数据权限 + + DEPT_CUSTOM(2), // 指定部门数据权限 + DEPT_ONLY(3), // 部门数据权限 + DEPT_AND_CHILD(4), // 部门及以下数据权限 + + SELF(5); // 仅本人数据权限 + + /** + * 范围 + */ + private final Integer scope; + + public static final Integer[] ARRAYS = Arrays.stream(values()).map(DataScopeEnum::getScope).toArray(Integer[]::new); + + @Override + public Integer[] array() { + return ARRAYS; + } + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/enums/DictTypeConstants.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/enums/DictTypeConstants.java new file mode 100644 index 0000000..303af73 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/enums/DictTypeConstants.java @@ -0,0 +1,26 @@ +package com.platform.marketing.module.system.domain.enums; + +/** + * System 字典类型的枚举类 + * + + */ +public interface DictTypeConstants { + + String USER_TYPE = "user_type"; // 用户类型 + String COMMON_STATUS = "common_status"; // 系统状态 + + // ========== SYSTEM 模块 ========== + + String USER_SEX = "system_user_sex"; // 用户性别 + String DATA_SCOPE = "system_data_scope"; // 数据范围 + + String LOGIN_TYPE = "system_login_type"; // 登录日志的类型 + String LOGIN_RESULT = "system_login_result"; // 登录结果 + + String SMS_CHANNEL_CODE = "system_sms_channel_code"; // 短信渠道编码 + String SMS_TEMPLATE_TYPE = "system_sms_template_type"; // 短信模板类型 + String SMS_SEND_STATUS = "system_sms_send_status"; // 短信发送状态 + String SMS_RECEIVE_STATUS = "system_sms_receive_status"; // 短信接收状态 + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/enums/ErrorCodeConstants.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/enums/ErrorCodeConstants.java new file mode 100644 index 0000000..f703762 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/enums/ErrorCodeConstants.java @@ -0,0 +1,169 @@ +package com.platform.marketing.module.system.domain.enums; + +import com.platform.marketing.framework.common.exception.ErrorCode; + +/** + * System 错误码枚举类 + * + * system 系统,使用 1-002-000-000 段 + */ +public interface ErrorCodeConstants { + + // ========== AUTH 模块 1-002-000-000 ========== + ErrorCode AUTH_LOGIN_BAD_CREDENTIALS = new ErrorCode(1_002_000_000, "登录失败,账号密码不正确"); + ErrorCode AUTH_LOGIN_USER_DISABLED = new ErrorCode(1_002_000_001, "登录失败,账号被禁用"); + ErrorCode AUTH_LOGIN_CAPTCHA_CODE_ERROR = new ErrorCode(1_002_000_004, "验证码不正确,原因:{}"); + ErrorCode AUTH_THIRD_LOGIN_NOT_BIND = new ErrorCode(1_002_000_005, "未绑定账号,需要进行绑定"); + ErrorCode AUTH_MOBILE_NOT_EXISTS = new ErrorCode(1_002_000_007, "手机号不存在"); + ErrorCode AUTH_REGISTER_CAPTCHA_CODE_ERROR = new ErrorCode(1_002_000_008, "验证码不正确,原因:{}"); + + // ========== 菜单模块 1-002-001-000 ========== + ErrorCode MENU_NAME_DUPLICATE = new ErrorCode(1_002_001_000, "已经存在该名字的菜单"); + ErrorCode MENU_PARENT_NOT_EXISTS = new ErrorCode(1_002_001_001, "父菜单不存在"); + ErrorCode MENU_PARENT_ERROR = new ErrorCode(1_002_001_002, "不能设置自己为父菜单"); + ErrorCode MENU_NOT_EXISTS = new ErrorCode(1_002_001_003, "菜单不存在"); + ErrorCode MENU_EXISTS_CHILDREN = new ErrorCode(1_002_001_004, "存在子菜单,无法删除"); + ErrorCode MENU_PARENT_NOT_DIR_OR_MENU = new ErrorCode(1_002_001_005, "父菜单的类型必须是目录或者菜单"); + ErrorCode MENU_COMPONENT_NAME_DUPLICATE = new ErrorCode(1_002_001_006, "已经存在该组件名的菜单"); + + // ========== 角色模块 1-002-002-000 ========== + ErrorCode ROLE_NOT_EXISTS = new ErrorCode(1_002_002_000, "角色不存在"); + ErrorCode ROLE_NAME_DUPLICATE = new ErrorCode(1_002_002_001, "已经存在名为【{}】的角色"); + ErrorCode ROLE_CODE_DUPLICATE = new ErrorCode(1_002_002_002, "已经存在标识为【{}】的角色"); + ErrorCode ROLE_CAN_NOT_UPDATE_SYSTEM_TYPE_ROLE = new ErrorCode(1_002_002_003, "不能操作类型为系统内置的角色"); + ErrorCode ROLE_IS_DISABLE = new ErrorCode(1_002_002_004, "名字为【{}】的角色已被禁用"); + ErrorCode ROLE_ADMIN_CODE_ERROR = new ErrorCode(1_002_002_005, "标识【{}】不能使用"); + + // ========== 用户模块 1-002-003-000 ========== + ErrorCode USER_USERNAME_EXISTS = new ErrorCode(1_002_003_000, "用户账号已经存在"); + ErrorCode USER_MOBILE_EXISTS = new ErrorCode(1_002_003_001, "手机号已经存在"); + ErrorCode USER_EMAIL_EXISTS = new ErrorCode(1_002_003_002, "邮箱已经存在"); + ErrorCode USER_NOT_EXISTS = new ErrorCode(1_002_003_003, "用户不存在"); + ErrorCode USER_IMPORT_LIST_IS_EMPTY = new ErrorCode(1_002_003_004, "导入用户数据不能为空!"); + ErrorCode USER_PASSWORD_FAILED = new ErrorCode(1_002_003_005, "用户密码校验失败"); + ErrorCode USER_IS_DISABLE = new ErrorCode(1_002_003_006, "名字为【{}】的用户已被禁用"); + ErrorCode USER_COUNT_MAX = new ErrorCode(1_002_003_008, "创建用户失败,原因:超过租户最大租户配额({})!"); + ErrorCode USER_IMPORT_INIT_PASSWORD = new ErrorCode(1_002_003_009, "初始密码不能为空"); + ErrorCode USER_MOBILE_NOT_EXISTS = new ErrorCode(1_002_003_010, "该手机号尚未注册"); + + // ========== 部门模块 1-002-004-000 ========== + ErrorCode DEPT_NAME_DUPLICATE = new ErrorCode(1_002_004_000, "已经存在该名字的部门"); + ErrorCode DEPT_PARENT_NOT_EXITS = new ErrorCode(1_002_004_001,"父级部门不存在"); + ErrorCode DEPT_NOT_FOUND = new ErrorCode(1_002_004_002, "当前部门不存在"); + ErrorCode DEPT_EXITS_CHILDREN = new ErrorCode(1_002_004_003, "存在子部门,无法删除"); + ErrorCode DEPT_PARENT_ERROR = new ErrorCode(1_002_004_004, "不能设置自己为父部门"); + ErrorCode DEPT_NOT_ENABLE = new ErrorCode(1_002_004_006, "部门({})不处于开启状态,不允许选择"); + ErrorCode DEPT_PARENT_IS_CHILD = new ErrorCode(1_002_004_007, "不能设置自己的子部门为父部门"); + + // ========== 岗位模块 1-002-005-000 ========== + ErrorCode POST_NOT_FOUND = new ErrorCode(1_002_005_000, "当前岗位不存在"); + ErrorCode POST_NOT_ENABLE = new ErrorCode(1_002_005_001, "岗位({}) 不处于开启状态,不允许选择"); + ErrorCode POST_NAME_DUPLICATE = new ErrorCode(1_002_005_002, "已经存在该名字的岗位"); + ErrorCode POST_CODE_DUPLICATE = new ErrorCode(1_002_005_003, "已经存在该标识的岗位"); + + // ========== 字典类型 1-002-006-000 ========== + ErrorCode DICT_TYPE_NOT_EXISTS = new ErrorCode(1_002_006_001, "当前字典类型不存在"); + ErrorCode DICT_TYPE_NOT_ENABLE = new ErrorCode(1_002_006_002, "字典类型不处于开启状态,不允许选择"); + ErrorCode DICT_TYPE_NAME_DUPLICATE = new ErrorCode(1_002_006_003, "已经存在该名字的字典类型"); + ErrorCode DICT_TYPE_TYPE_DUPLICATE = new ErrorCode(1_002_006_004, "已经存在该类型的字典类型"); + ErrorCode DICT_TYPE_HAS_CHILDREN = new ErrorCode(1_002_006_005, "无法删除,该字典类型还有字典数据"); + + // ========== 字典数据 1-002-007-000 ========== + ErrorCode DICT_DATA_NOT_EXISTS = new ErrorCode(1_002_007_001, "当前字典数据不存在"); + ErrorCode DICT_DATA_NOT_ENABLE = new ErrorCode(1_002_007_002, "字典数据({})不处于开启状态,不允许选择"); + ErrorCode DICT_DATA_VALUE_DUPLICATE = new ErrorCode(1_002_007_003, "已经存在该值的字典数据"); + + // ========== 通知公告 1-002-008-000 ========== + ErrorCode NOTICE_NOT_FOUND = new ErrorCode(1_002_008_001, "当前通知公告不存在"); + + // ========== 短信渠道 1-002-011-000 ========== + ErrorCode SMS_CHANNEL_NOT_EXISTS = new ErrorCode(1_002_011_000, "短信渠道不存在"); + ErrorCode SMS_CHANNEL_DISABLE = new ErrorCode(1_002_011_001, "短信渠道不处于开启状态,不允许选择"); + ErrorCode SMS_CHANNEL_HAS_CHILDREN = new ErrorCode(1_002_011_002, "无法删除,该短信渠道还有短信模板"); + + // ========== 短信模板 1-002-012-000 ========== + ErrorCode SMS_TEMPLATE_NOT_EXISTS = new ErrorCode(1_002_012_000, "短信模板不存在"); + ErrorCode SMS_TEMPLATE_CODE_DUPLICATE = new ErrorCode(1_002_012_001, "已经存在编码为【{}】的短信模板"); + ErrorCode SMS_TEMPLATE_API_ERROR = new ErrorCode(1_002_012_002, "短信 API 模板调用失败,原因是:{}"); + ErrorCode SMS_TEMPLATE_API_AUDIT_CHECKING = new ErrorCode(1_002_012_003, "短信 API 模版无法使用,原因:审批中"); + ErrorCode SMS_TEMPLATE_API_AUDIT_FAIL = new ErrorCode(1_002_012_004, "短信 API 模版无法使用,原因:审批不通过,{}"); + ErrorCode SMS_TEMPLATE_API_NOT_FOUND = new ErrorCode(1_002_012_005, "短信 API 模版无法使用,原因:模版不存在"); + + // ========== 短信发送 1-002-013-000 ========== + ErrorCode SMS_SEND_MOBILE_NOT_EXISTS = new ErrorCode(1_002_013_000, "手机号不存在"); + ErrorCode SMS_SEND_MOBILE_TEMPLATE_PARAM_MISS = new ErrorCode(1_002_013_001, "模板参数({})缺失"); + ErrorCode SMS_SEND_TEMPLATE_NOT_EXISTS = new ErrorCode(1_002_013_002, "短信模板不存在"); + + // ========== 短信验证码 1-002-014-000 ========== + ErrorCode SMS_CODE_NOT_FOUND = new ErrorCode(1_002_014_000, "验证码不存在"); + ErrorCode SMS_CODE_EXPIRED = new ErrorCode(1_002_014_001, "验证码已过期"); + ErrorCode SMS_CODE_USED = new ErrorCode(1_002_014_002, "验证码已使用"); + ErrorCode SMS_CODE_EXCEED_SEND_MAXIMUM_QUANTITY_PER_DAY = new ErrorCode(1_002_014_004, "超过每日短信发送数量"); + ErrorCode SMS_CODE_SEND_TOO_FAST = new ErrorCode(1_002_014_005, "短信发送过于频繁"); + + // ========== 租户信息 1-002-015-000 ========== + ErrorCode TENANT_NOT_EXISTS = new ErrorCode(1_002_015_000, "租户不存在"); + ErrorCode TENANT_DISABLE = new ErrorCode(1_002_015_001, "名字为【{}】的租户已被禁用"); + ErrorCode TENANT_EXPIRE = new ErrorCode(1_002_015_002, "名字为【{}】的租户已过期"); + ErrorCode TENANT_CAN_NOT_UPDATE_SYSTEM = new ErrorCode(1_002_015_003, "系统租户不能进行修改、删除等操作!"); + ErrorCode TENANT_NAME_DUPLICATE = new ErrorCode(1_002_015_004, "名字为【{}】的租户已存在"); + ErrorCode TENANT_WEBSITE_DUPLICATE = new ErrorCode(1_002_015_005, "域名为【{}】的租户已存在"); + + // ========== 租户套餐 1-002-016-000 ========== + ErrorCode TENANT_PACKAGE_NOT_EXISTS = new ErrorCode(1_002_016_000, "租户套餐不存在"); + ErrorCode TENANT_PACKAGE_USED = new ErrorCode(1_002_016_001, "租户正在使用该套餐,请给租户重新设置套餐后再尝试删除"); + ErrorCode TENANT_PACKAGE_DISABLE = new ErrorCode(1_002_016_002, "名字为【{}】的租户套餐已被禁用"); + ErrorCode TENANT_PACKAGE_NAME_DUPLICATE = new ErrorCode(1_002_016_003, "已经存在该名字的租户套餐"); + + // ========== 社交用户 1-002-018-000 ========== + ErrorCode SOCIAL_USER_AUTH_FAILURE = new ErrorCode(1_002_018_000, "社交授权失败,原因是:{}"); + ErrorCode SOCIAL_USER_NOT_FOUND = new ErrorCode(1_002_018_001, "社交授权失败,找不到对应的用户"); + + ErrorCode SOCIAL_CLIENT_WEIXIN_MINI_APP_PHONE_CODE_ERROR = new ErrorCode(1_002_018_200, "获得手机号失败"); + ErrorCode SOCIAL_CLIENT_WEIXIN_MINI_APP_QRCODE_ERROR = new ErrorCode(1_002_018_201, "获得小程序码失败"); + ErrorCode SOCIAL_CLIENT_WEIXIN_MINI_APP_SUBSCRIBE_TEMPLATE_ERROR = new ErrorCode(1_002_018_202, "获得小程序订阅消息模版失败"); + ErrorCode SOCIAL_CLIENT_WEIXIN_MINI_APP_SUBSCRIBE_MESSAGE_ERROR = new ErrorCode(1_002_018_203, "发送小程序订阅消息失败"); + ErrorCode SOCIAL_CLIENT_NOT_EXISTS = new ErrorCode(1_002_018_210, "社交客户端不存在"); + ErrorCode SOCIAL_CLIENT_UNIQUE = new ErrorCode(1_002_018_211, "社交客户端已存在配置"); + + + // ========== OAuth2 客户端 1-002-020-000 ========= + ErrorCode OAUTH2_CLIENT_NOT_EXISTS = new ErrorCode(1_002_020_000, "OAuth2 客户端不存在"); + ErrorCode OAUTH2_CLIENT_EXISTS = new ErrorCode(1_002_020_001, "OAuth2 客户端编号已存在"); + ErrorCode OAUTH2_CLIENT_DISABLE = new ErrorCode(1_002_020_002, "OAuth2 客户端已禁用"); + ErrorCode OAUTH2_CLIENT_AUTHORIZED_GRANT_TYPE_NOT_EXISTS = new ErrorCode(1_002_020_003, "不支持该授权类型"); + ErrorCode OAUTH2_CLIENT_SCOPE_OVER = new ErrorCode(1_002_020_004, "授权范围过大"); + ErrorCode OAUTH2_CLIENT_REDIRECT_URI_NOT_MATCH = new ErrorCode(1_002_020_005, "无效 redirect_uri: {}"); + ErrorCode OAUTH2_CLIENT_CLIENT_SECRET_ERROR = new ErrorCode(1_002_020_006, "无效 client_secret: {}"); + + // ========== OAuth2 授权 1-002-021-000 ========= + ErrorCode OAUTH2_GRANT_CLIENT_ID_MISMATCH = new ErrorCode(1_002_021_000, "client_id 不匹配"); + ErrorCode OAUTH2_GRANT_REDIRECT_URI_MISMATCH = new ErrorCode(1_002_021_001, "redirect_uri 不匹配"); + ErrorCode OAUTH2_GRANT_STATE_MISMATCH = new ErrorCode(1_002_021_002, "state 不匹配"); + + // ========== OAuth2 授权 1-002-022-000 ========= + ErrorCode OAUTH2_CODE_NOT_EXISTS = new ErrorCode(1_002_022_000, "code 不存在"); + ErrorCode OAUTH2_CODE_EXPIRE = new ErrorCode(1_002_022_001, "code 已过期"); + + // ========== 邮箱账号 1-002-023-000 ========== + ErrorCode MAIL_ACCOUNT_NOT_EXISTS = new ErrorCode(1_002_023_000, "邮箱账号不存在"); + ErrorCode MAIL_ACCOUNT_RELATE_TEMPLATE_EXISTS = new ErrorCode(1_002_023_001, "无法删除,该邮箱账号还有邮件模板"); + + // ========== 邮件模版 1-002-024-000 ========== + ErrorCode MAIL_TEMPLATE_NOT_EXISTS = new ErrorCode(1_002_024_000, "邮件模版不存在"); + ErrorCode MAIL_TEMPLATE_CODE_EXISTS = new ErrorCode(1_002_024_001, "邮件模版 code({}) 已存在"); + + // ========== 邮件发送 1-002-025-000 ========== + ErrorCode MAIL_SEND_TEMPLATE_PARAM_MISS = new ErrorCode(1_002_025_000, "模板参数({})缺失"); + ErrorCode MAIL_SEND_MAIL_NOT_EXISTS = new ErrorCode(1_002_025_001, "邮箱不存在"); + + // ========== 站内信模版 1-002-026-000 ========== + ErrorCode NOTIFY_TEMPLATE_NOT_EXISTS = new ErrorCode(1_002_026_000, "站内信模版不存在"); + ErrorCode NOTIFY_TEMPLATE_CODE_DUPLICATE = new ErrorCode(1_002_026_001, "已经存在编码为【{}】的站内信模板"); + + // ========== 站内信模版 1-002-027-000 ========== + + // ========== 站内信发送 1-002-028-000 ========== + ErrorCode NOTIFY_SEND_TEMPLATE_PARAM_MISS = new ErrorCode(1_002_028_000, "模板参数({})缺失"); + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/enums/LogRecordConstants.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/enums/LogRecordConstants.java new file mode 100644 index 0000000..e20d811 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/enums/LogRecordConstants.java @@ -0,0 +1,33 @@ +package com.platform.marketing.module.system.domain.enums; + +/** + * System 操作日志枚举 + * 目的:统一管理,也减少 Service 里各种“复杂”字符串 + * + + */ +public interface LogRecordConstants { + + // ======================= SYSTEM_USER 用户 ======================= + + String SYSTEM_USER_TYPE = "SYSTEM 用户"; + String SYSTEM_USER_CREATE_SUB_TYPE = "创建用户"; + String SYSTEM_USER_CREATE_SUCCESS = "创建了用户【{{#user.nickname}}】"; + String SYSTEM_USER_UPDATE_SUB_TYPE = "更新用户"; + String SYSTEM_USER_UPDATE_SUCCESS = "更新了用户【{{#user.nickname}}】: {_DIFF{#updateReqVO}}"; + String SYSTEM_USER_DELETE_SUB_TYPE = "删除用户"; + String SYSTEM_USER_DELETE_SUCCESS = "删除了用户【{{#user.nickname}}】"; + String SYSTEM_USER_UPDATE_PASSWORD_SUB_TYPE = "重置用户密码"; + String SYSTEM_USER_UPDATE_PASSWORD_SUCCESS = "将用户【{{#user.nickname}}】的密码从【{{#user.password}}】重置为【{{#newPassword}}】"; + + // ======================= SYSTEM_ROLE 角色 ======================= + + String SYSTEM_ROLE_TYPE = "SYSTEM 角色"; + String SYSTEM_ROLE_CREATE_SUB_TYPE = "创建角色"; + String SYSTEM_ROLE_CREATE_SUCCESS = "创建了角色【{{#role.name}}】"; + String SYSTEM_ROLE_UPDATE_SUB_TYPE = "更新角色"; + String SYSTEM_ROLE_UPDATE_SUCCESS = "更新了角色【{{#role.name}}】: {_DIFF{#updateReqVO}}"; + String SYSTEM_ROLE_DELETE_SUB_TYPE = "删除角色"; + String SYSTEM_ROLE_DELETE_SUCCESS = "删除了角色【{{#role.name}}】"; + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/enums/LoginLogTypeEnum.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/enums/LoginLogTypeEnum.java new file mode 100644 index 0000000..d3ba1d3 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/enums/LoginLogTypeEnum.java @@ -0,0 +1,31 @@ +package com.platform.marketing.module.system.domain.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * 登录日志的类型枚举 + */ +@Getter +@AllArgsConstructor +public enum LoginLogTypeEnum { + + LOGIN_USERNAME(100), // 使用账号登录 + + LOGIN_SOCIAL(101), // 使用社交登录 + + LOGIN_MOBILE(103), // 使用手机登陆 + + LOGIN_SMS(104), // 使用短信登陆 + + LOGOUT_SELF(200), // 自己主动登出 + + LOGOUT_DELETE(202), // 强制退出 + ; + + /** + * 日志类型 + */ + private final Integer type; + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/enums/LoginResultEnum.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/enums/LoginResultEnum.java new file mode 100644 index 0000000..172e829 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/enums/LoginResultEnum.java @@ -0,0 +1,26 @@ +package com.platform.marketing.module.system.domain.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * 登录结果的枚举类 + */ +@Getter +@AllArgsConstructor +public enum LoginResultEnum { + + SUCCESS(0), // 成功 + BAD_CREDENTIALS(10), // 账号或密码不正确 + USER_DISABLED(20), // 用户被禁用 + CAPTCHA_NOT_FOUND(30), // 图片验证码不存在 + CAPTCHA_CODE_ERROR(31), // 图片验证码不正确 + + ; + + /** + * 结果 + */ + private final Integer result; + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/enums/MenuTypeEnum.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/enums/MenuTypeEnum.java new file mode 100644 index 0000000..58b000b --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/enums/MenuTypeEnum.java @@ -0,0 +1,25 @@ +package com.platform.marketing.module.system.domain.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * 菜单类型枚举类 + * + + */ +@Getter +@AllArgsConstructor +public enum MenuTypeEnum { + + DIR(1), // 目录 + MENU(2), // 菜单 + BUTTON(3) // 按钮 + ; + + /** + * 类型 + */ + private final Integer type; + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/enums/NoticeTypeEnum.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/enums/NoticeTypeEnum.java new file mode 100644 index 0000000..b97b4db --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/enums/NoticeTypeEnum.java @@ -0,0 +1,23 @@ +package com.platform.marketing.module.system.domain.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * 通知类型 + * + + */ +@Getter +@AllArgsConstructor +public enum NoticeTypeEnum { + + NOTICE(1), + ANNOUNCEMENT(2); + + /** + * 类型 + */ + private final Integer type; + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/enums/RedisKeyConstants.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/enums/RedisKeyConstants.java new file mode 100644 index 0000000..a19fc3e --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/enums/RedisKeyConstants.java @@ -0,0 +1,50 @@ +package com.platform.marketing.module.system.domain.enums; + +/** + * System Redis Key 枚举类 + * + + */ +public interface RedisKeyConstants { + + /** + * 指定部门的所有子部门编号数组的缓存 + *

+ * KEY 格式:dept_children_ids:{id} + * VALUE 数据类型:String 子部门编号集合 + */ + String DEPT_CHILDREN_ID_LIST = "dept_children_ids"; + + /** + * 角色的缓存 + *

+ * KEY 格式:role:{id} + * VALUE 数据类型:String 角色信息 + */ + String ROLE = "role"; + + /** + * 用户拥有的角色编号的缓存 + *

+ * KEY 格式:user_role_ids:{userId} + * VALUE 数据类型:String 角色编号集合 + */ + String USER_ROLE_ID_LIST = "user_role_ids"; + + /** + * 拥有指定菜单的角色编号的缓存 + *

+ * KEY 格式:menu_role_ids:{menuId} + * VALUE 数据类型:String 角色编号集合 + */ + String MENU_ROLE_ID_LIST = "menu_role_ids"; + + /** + * 拥有权限对应的菜单编号数组的缓存 + *

+ * KEY 格式:permission_menu_ids:{permission} + * VALUE 数据类型:String 菜单编号数组 + */ + String PERMISSION_MENU_ID_LIST = "permission_menu_ids"; + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/enums/RoleCodeEnum.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/enums/RoleCodeEnum.java new file mode 100644 index 0000000..bbabb7e --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/enums/RoleCodeEnum.java @@ -0,0 +1,32 @@ +package com.platform.marketing.module.system.domain.enums; + +import com.platform.marketing.framework.common.util.object.ObjectUtils; +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * 角色标识枚举 + */ +@Getter +@AllArgsConstructor +public enum RoleCodeEnum { + + SUPER_ADMIN("super_admin", "超级管理员"), + TENANT_ADMIN("tenant_admin", "租户管理员"), + CRM_ADMIN("crm_admin", "CRM 管理员"); // CRM 系统专用 + ; + + /** + * 角色编码 + */ + private final String code; + /** + * 名字 + */ + private final String name; + + public static boolean isSuperAdmin(String code) { + return ObjectUtils.equalsAny(code, SUPER_ADMIN.getCode()); + } + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/enums/RoleTypeEnum.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/enums/RoleTypeEnum.java new file mode 100644 index 0000000..26cd554 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/enums/RoleTypeEnum.java @@ -0,0 +1,21 @@ +package com.platform.marketing.module.system.domain.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +@Getter +@AllArgsConstructor +public enum RoleTypeEnum { + + /** + * 内置角色 + */ + SYSTEM(1), + /** + * 自定义角色 + */ + CUSTOM(2); + + private final Integer type; + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/enums/SexEnum.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/enums/SexEnum.java new file mode 100644 index 0000000..cd652a5 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/enums/SexEnum.java @@ -0,0 +1,27 @@ +package com.platform.marketing.module.system.domain.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * 性别的枚举值 + * + + */ +@Getter +@AllArgsConstructor +public enum SexEnum { + + /** 男 */ + MALE(1), + /** 女 */ + FEMALE(2), + /* 未知 */ + UNKNOWN(0); + + /** + * 性别 + */ + private final Integer sex; + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/AreaNodeRespVO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/AreaNodeRespVO.java new file mode 100644 index 0000000..51291f6 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/AreaNodeRespVO.java @@ -0,0 +1,23 @@ +package com.platform.marketing.module.system.domain.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.util.List; + +@Schema(description = "管理后台 - 地区节点 Response VO") +@Data +public class AreaNodeRespVO { + + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "110000") + private Integer id; + + @Schema(description = "名字", requiredMode = Schema.RequiredMode.REQUIRED, example = "北京") + private String name; + + /** + * 子节点 + */ + private List children; + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/AuthLoginReqVO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/AuthLoginReqVO.java new file mode 100644 index 0000000..20db9af --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/AuthLoginReqVO.java @@ -0,0 +1,31 @@ +package com.platform.marketing.module.system.domain.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.hibernate.validator.constraints.Length; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.Pattern; + +@Schema(description = "管理后台 - 账号密码登录 Request VO") +@Data +@NoArgsConstructor +@AllArgsConstructor +@Builder +public class AuthLoginReqVO extends CaptchaVerificationReqVO { + + @Schema(description = "账号", requiredMode = Schema.RequiredMode.REQUIRED, example = "admin") + @NotEmpty(message = "登录账号不能为空") + @Length(min = 4, max = 16, message = "账号长度为 4-16 位") + @Pattern(regexp = "^[A-Za-z0-9]+$", message = "账号格式为数字以及字母") + private String username; + + @Schema(description = "密码", requiredMode = Schema.RequiredMode.REQUIRED, example = "admin123") + @NotEmpty(message = "密码不能为空") + @Length(min = 4, max = 16, message = "密码长度为 4-16 位") + private String password; + +} \ No newline at end of file diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/AuthLoginRespVO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/AuthLoginRespVO.java new file mode 100644 index 0000000..685374e --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/AuthLoginRespVO.java @@ -0,0 +1,30 @@ +package com.platform.marketing.module.system.domain.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.time.LocalDateTime; + +@Schema(description = "管理后台 - 登录 Response VO") +@Data +@NoArgsConstructor +@AllArgsConstructor +@Builder +public class AuthLoginRespVO { + + @Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") + private Long userId; + + @Schema(description = "访问令牌", requiredMode = Schema.RequiredMode.REQUIRED, example = "happy") + private String accessToken; + + @Schema(description = "刷新令牌", requiredMode = Schema.RequiredMode.REQUIRED, example = "nice") + private String refreshToken; + + @Schema(description = "过期时间", requiredMode = Schema.RequiredMode.REQUIRED) + private LocalDateTime expiresTime; + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/AuthMenuRespVO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/AuthMenuRespVO.java new file mode 100644 index 0000000..51a7de3 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/AuthMenuRespVO.java @@ -0,0 +1,53 @@ +package com.platform.marketing.module.system.domain.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; + +@Schema(description = "管理后台 - 登录用户的菜单信息 Response VO") +@Data +@NoArgsConstructor +@AllArgsConstructor +@Builder +public class AuthMenuRespVO { + + @Schema(description = "菜单名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道") + private Long id; + + @Schema(description = "父菜单 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") + private Long parentId; + + @Schema(description = "菜单名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道") + private String name; + + @Schema(description = "路由地址,仅菜单类型为菜单或者目录时,才需要传", example = "post") + private String path; + + @Schema(description = "组件路径,仅菜单类型为菜单时,才需要传", example = "system/post/index") + private String component; + + @Schema(description = "组件名", example = "SystemUser") + private String componentName; + + @Schema(description = "菜单图标,仅菜单类型为菜单或者目录时,才需要传", example = "/menu/list") + private String icon; + + @Schema(description = "是否可见", requiredMode = Schema.RequiredMode.REQUIRED, example = "false") + private Boolean visible; + + @Schema(description = "是否缓存", requiredMode = Schema.RequiredMode.REQUIRED, example = "false") + private Boolean keepAlive; + + @Schema(description = "是否总是显示", example = "false") + private Boolean alwaysShow; + + /** + * 子路由 + */ + private List children; + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/AuthPermissionInfoRespVO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/AuthPermissionInfoRespVO.java new file mode 100644 index 0000000..82f4476 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/AuthPermissionInfoRespVO.java @@ -0,0 +1,96 @@ +package com.platform.marketing.module.system.domain.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; +import java.util.Set; + +@Schema(description = "管理后台 - 登录用户的权限信息 Response VO,额外包括用户信息和角色列表") +@Data +@NoArgsConstructor +@AllArgsConstructor +@Builder +public class AuthPermissionInfoRespVO { + + @Schema(description = "用户信息", requiredMode = Schema.RequiredMode.REQUIRED) + private UserVO user; + + @Schema(description = "角色标识数组", requiredMode = Schema.RequiredMode.REQUIRED) + private Set roles; + + @Schema(description = "操作权限数组", requiredMode = Schema.RequiredMode.REQUIRED) + private Set permissions; + + @Schema(description = "菜单树", requiredMode = Schema.RequiredMode.REQUIRED) + private List menus; + + @Schema(description = "用户信息 VO") + @Data + @NoArgsConstructor + @AllArgsConstructor + @Builder + public static class UserVO { + + @Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") + private Long id; + + @Schema(description = "用户昵称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道源码") + private String nickname; + + @Schema(description = "用户头像", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn/xx.jpg") + private String avatar; + + @Schema(description = "部门编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "2048") + private Long deptId; + + } + + @Schema(description = "管理后台 - 登录用户的菜单信息 Response VO") + @Data + @NoArgsConstructor + @AllArgsConstructor + @Builder + public static class MenuVO { + + @Schema(description = "菜单名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道") + private Long id; + + @Schema(description = "父菜单 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") + private Long parentId; + + @Schema(description = "菜单名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道") + private String name; + + @Schema(description = "路由地址,仅菜单类型为菜单或者目录时,才需要传", example = "post") + private String path; + + @Schema(description = "组件路径,仅菜单类型为菜单时,才需要传", example = "system/post/index") + private String component; + + @Schema(description = "组件名", example = "SystemUser") + private String componentName; + + @Schema(description = "菜单图标,仅菜单类型为菜单或者目录时,才需要传", example = "/menu/list") + private String icon; + + @Schema(description = "是否可见", requiredMode = Schema.RequiredMode.REQUIRED, example = "false") + private Boolean visible; + + @Schema(description = "是否缓存", requiredMode = Schema.RequiredMode.REQUIRED, example = "false") + private Boolean keepAlive; + + @Schema(description = "是否总是显示", example = "false") + private Boolean alwaysShow; + + /** + * 子路由 + */ + private List children; + + } + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/AuthRegisterReqVO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/AuthRegisterReqVO.java new file mode 100644 index 0000000..f39a66a --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/AuthRegisterReqVO.java @@ -0,0 +1,32 @@ +package com.platform.marketing.module.system.domain.vo; + + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import org.hibernate.validator.constraints.Length; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.Pattern; +import javax.validation.constraints.Size; + +@Schema(description = "管理后台 - Register Request VO") +@Data +public class AuthRegisterReqVO extends CaptchaVerificationReqVO { + + @Schema(description = "用户账号", requiredMode = Schema.RequiredMode.REQUIRED, example = "marketing") + @NotBlank(message = "用户账号不能为空") + @Pattern(regexp = "^[a-zA-Z0-9]{4,30}$", message = "用户账号由 数字、字母 组成") + @Size(min = 4, max = 30, message = "用户账号长度为 4-30 个字符") + private String username; + + @Schema(description = "用户昵称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿") + @NotBlank(message = "用户昵称不能为空") + @Size(max = 30, message = "用户昵称长度不能超过 30 个字符") + private String nickname; + + @Schema(description = "密码", requiredMode = Schema.RequiredMode.REQUIRED, example = "123456") + @NotEmpty(message = "密码不能为空") + @Length(min = 4, max = 16, message = "密码长度为 4-16 位") + private String password; +} \ No newline at end of file diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/AuthResetPasswordReqVO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/AuthResetPasswordReqVO.java new file mode 100644 index 0000000..46e4ef5 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/AuthResetPasswordReqVO.java @@ -0,0 +1,33 @@ +package com.platform.marketing.module.system.domain.vo; + +import com.platform.marketing.framework.common.validation.Mobile; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.hibernate.validator.constraints.Length; + +import javax.validation.constraints.NotEmpty; + +@Schema(description = "管理后台 - 短信重置账号密码 Request VO") +@Data +@NoArgsConstructor +@AllArgsConstructor +@Builder +public class AuthResetPasswordReqVO { + + @Schema(description = "密码", requiredMode = Schema.RequiredMode.REQUIRED, example = "1234") + @NotEmpty(message = "密码不能为空") + @Length(min = 4, max = 16, message = "密码长度为 4-16 位") + private String password; + + @Schema(description = "手机号", requiredMode = Schema.RequiredMode.REQUIRED, example = "13312341234") + @NotEmpty(message = "手机号不能为空") + @Mobile + private String mobile; + + @Schema(description = "手机短信验证码", requiredMode = Schema.RequiredMode.REQUIRED, example = "123456") + @NotEmpty(message = "手机手机短信验证码不能为空") + private String code; +} \ No newline at end of file diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/CaptchaVerificationReqVO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/CaptchaVerificationReqVO.java new file mode 100644 index 0000000..c4c46eb --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/CaptchaVerificationReqVO.java @@ -0,0 +1,23 @@ +package com.platform.marketing.module.system.domain.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; + +@Schema(description = "管理后台 - 验证码 Request VO") +@Data +public class CaptchaVerificationReqVO { + + // ========== 图片验证码相关 ========== + @Schema(description = "验证码,验证码开启时,需要传递", requiredMode = Schema.RequiredMode.REQUIRED, + example = "PfcH6mgr8tpXuMWFjvW6YVaqrswIuwmWI5dsVZSg7sGpWtDCUbHuDEXl3cFB1+VvCC/rAkSwK8Fad52FSuncVg==") + @NotEmpty(message = "验证码不能为空", groups = CodeEnableGroup.class) + private String captchaVerification; + + /** + * 开启验证码的 Group + */ + public interface CodeEnableGroup { + } +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/DeptListReqVO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/DeptListReqVO.java new file mode 100644 index 0000000..b81abfd --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/DeptListReqVO.java @@ -0,0 +1,16 @@ +package com.platform.marketing.module.system.domain.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Schema(description = "管理后台 - 部门列表 Request VO") +@Data +public class DeptListReqVO { + + @Schema(description = "部门名称,模糊匹配", example = "芋道") + private String name; + + @Schema(description = "展示状态,参见 CommonStatusEnum 枚举类", example = "1") + private Integer status; + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/DeptRespVO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/DeptRespVO.java new file mode 100644 index 0000000..49c4150 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/DeptRespVO.java @@ -0,0 +1,39 @@ +package com.platform.marketing.module.system.domain.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Schema(description = "管理后台 - 部门信息 Response VO") +@Data +public class DeptRespVO { + + @Schema(description = "部门编号", example = "1024") + private Long id; + + @Schema(description = "部门名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道") + private String name; + + @Schema(description = "父部门 ID", example = "1024") + private Long parentId; + + @Schema(description = "显示顺序", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") + private Integer sort; + + @Schema(description = "负责人的用户编号", example = "2048") + private Long leaderUserId; + + @Schema(description = "联系电话", example = "15601691000") + private String phone; + + @Schema(description = "邮箱", example = "marketing@iocoder.cn") + private String email; + + @Schema(description = "状态,见 CommonStatusEnum 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + private Integer status; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "时间戳格式") + private LocalDateTime createTime; + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/DeptSaveReqVO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/DeptSaveReqVO.java new file mode 100644 index 0000000..0f63156 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/DeptSaveReqVO.java @@ -0,0 +1,49 @@ +package com.platform.marketing.module.system.domain.vo; + +import com.platform.marketing.framework.common.enums.CommonStatusEnum; +import com.platform.marketing.framework.common.validation.InEnum; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import javax.validation.constraints.Email; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; + +@Schema(description = "管理后台 - 部门创建/修改 Request VO") +@Data +public class DeptSaveReqVO { + + @Schema(description = "部门编号", example = "1024") + private Long id; + + @Schema(description = "部门名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道") + @NotBlank(message = "部门名称不能为空") + @Size(max = 30, message = "部门名称长度不能超过 30 个字符") + private String name; + + @Schema(description = "父部门 ID", example = "1024") + private Long parentId; + + @Schema(description = "显示顺序", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") + @NotNull(message = "显示顺序不能为空") + private Integer sort; + + @Schema(description = "负责人的用户编号", example = "2048") + private Long leaderUserId; + + @Schema(description = "联系电话", example = "15601691000") + @Size(max = 11, message = "联系电话长度不能超过11个字符") + private String phone; + + @Schema(description = "邮箱", example = "marketing@iocoder.cn") + @Email(message = "邮箱格式不正确") + @Size(max = 50, message = "邮箱长度不能超过 50 个字符") + private String email; + + @Schema(description = "状态,见 CommonStatusEnum 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @NotNull(message = "状态不能为空") + @InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}") + private Integer status; + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/DeptSimpleRespVO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/DeptSimpleRespVO.java new file mode 100644 index 0000000..e35cb8f --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/DeptSimpleRespVO.java @@ -0,0 +1,23 @@ +package com.platform.marketing.module.system.domain.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Schema(description = "管理后台 - 部门精简信息 Response VO") +@Data +@NoArgsConstructor +@AllArgsConstructor +public class DeptSimpleRespVO { + + @Schema(description = "部门编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") + private Long id; + + @Schema(description = "部门名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道") + private String name; + + @Schema(description = "父部门 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") + private Long parentId; + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/DictDataPageReqVO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/DictDataPageReqVO.java new file mode 100644 index 0000000..87c1ab8 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/DictDataPageReqVO.java @@ -0,0 +1,29 @@ +package com.platform.marketing.module.system.domain.vo; + +import com.platform.marketing.framework.common.enums.CommonStatusEnum; +import com.platform.marketing.framework.common.pojo.PageParam; +import com.platform.marketing.framework.common.validation.InEnum; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import javax.validation.constraints.Size; + +@Schema(description = "管理后台 - 字典类型分页列表 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +public class DictDataPageReqVO extends PageParam { + + @Schema(description = "字典标签", example = "芋道") + @Size(max = 100, message = "字典标签长度不能超过100个字符") + private String label; + + @Schema(description = "字典类型,模糊匹配", example = "sys_common_sex") + @Size(max = 100, message = "字典类型类型长度不能超过100个字符") + private String dictType; + + @Schema(description = "展示状态,参见 CommonStatusEnum 枚举类", example = "1") + @InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}") + private Integer status; + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/DictDataRespVO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/DictDataRespVO.java new file mode 100644 index 0000000..5f489ed --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/DictDataRespVO.java @@ -0,0 +1,55 @@ +package com.platform.marketing.module.system.domain.vo; + +import com.platform.marketing.framework.excel.core.annotations.DictFormat; +import com.platform.marketing.framework.excel.core.convert.DictConvert; +import com.platform.marketing.module.system.domain.enums.DictTypeConstants; +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Schema(description = "管理后台 - 字典数据信息 Response VO") +@Data +@ExcelIgnoreUnannotated +public class DictDataRespVO { + + @Schema(description = "字典数据编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") + @ExcelProperty("字典编码") + private Long id; + + @Schema(description = "显示顺序", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") + @ExcelProperty("字典排序") + private Integer sort; + + @Schema(description = "字典标签", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道") + @ExcelProperty("字典标签") + private String label; + + @Schema(description = "字典值", requiredMode = Schema.RequiredMode.REQUIRED, example = "iocoder") + @ExcelProperty("字典键值") + private String value; + + @Schema(description = "字典类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "sys_common_sex") + @ExcelProperty("字典类型") + private String dictType; + + @Schema(description = "状态,见 CommonStatusEnum 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @ExcelProperty(value = "状态", converter = DictConvert.class) + @DictFormat(DictTypeConstants.COMMON_STATUS) + private Integer status; + + @Schema(description = "颜色类型,default、primary、success、info、warning、danger", example = "default") + private String colorType; + + @Schema(description = "css 样式", example = "btn-visible") + private String cssClass; + + @Schema(description = "备注", example = "我是一个角色") + private String remark; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "时间戳格式") + private LocalDateTime createTime; + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/DictDataSaveReqVO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/DictDataSaveReqVO.java new file mode 100644 index 0000000..a273f68 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/DictDataSaveReqVO.java @@ -0,0 +1,52 @@ +package com.platform.marketing.module.system.domain.vo; + +import com.platform.marketing.framework.common.enums.CommonStatusEnum; +import com.platform.marketing.framework.common.validation.InEnum; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; + +@Schema(description = "管理后台 - 字典数据创建/修改 Request VO") +@Data +public class DictDataSaveReqVO { + + @Schema(description = "字典数据编号", example = "1024") + private Long id; + + @Schema(description = "显示顺序", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") + @NotNull(message = "显示顺序不能为空") + private Integer sort; + + @Schema(description = "字典标签", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道") + @NotBlank(message = "字典标签不能为空") + @Size(max = 100, message = "字典标签长度不能超过100个字符") + private String label; + + @Schema(description = "字典值", requiredMode = Schema.RequiredMode.REQUIRED, example = "iocoder") + @NotBlank(message = "字典键值不能为空") + @Size(max = 100, message = "字典键值长度不能超过100个字符") + private String value; + + @Schema(description = "字典类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "sys_common_sex") + @NotBlank(message = "字典类型不能为空") + @Size(max = 100, message = "字典类型长度不能超过100个字符") + private String dictType; + + @Schema(description = "状态,见 CommonStatusEnum 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @NotNull(message = "状态不能为空") + @InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}") + private Integer status; + + @Schema(description = "颜色类型,default、primary、success、info、warning、danger", example = "default") + private String colorType; + + @Schema(description = "css 样式", example = "btn-visible") + private String cssClass; + + @Schema(description = "备注", example = "我是一个角色") + private String remark; + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/DictDataSimpleRespVO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/DictDataSimpleRespVO.java new file mode 100644 index 0000000..b907284 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/DictDataSimpleRespVO.java @@ -0,0 +1,25 @@ +package com.platform.marketing.module.system.domain.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Schema(description = "管理后台 - 数据字典精简 Response VO") +@Data +public class DictDataSimpleRespVO { + + @Schema(description = "字典类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "gender") + private String dictType; + + @Schema(description = "字典键值", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + private String value; + + @Schema(description = "字典标签", requiredMode = Schema.RequiredMode.REQUIRED, example = "男") + private String label; + + @Schema(description = "颜色类型,default、primary、success、info、warning、danger", example = "default") + private String colorType; + + @Schema(description = "css 样式", example = "btn-visible") + private String cssClass; + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/DictTypePageReqVO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/DictTypePageReqVO.java new file mode 100644 index 0000000..d1a261e --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/DictTypePageReqVO.java @@ -0,0 +1,33 @@ +package com.platform.marketing.module.system.domain.vo; + +import com.platform.marketing.framework.common.pojo.PageParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.springframework.format.annotation.DateTimeFormat; + +import javax.validation.constraints.Size; +import java.time.LocalDateTime; + +import static com.platform.marketing.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 字典类型分页列表 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +public class DictTypePageReqVO extends PageParam { + + @Schema(description = "字典类型名称,模糊匹配", example = "芋道") + private String name; + + @Schema(description = "字典类型,模糊匹配", example = "sys_common_sex") + @Size(max = 100, message = "字典类型类型长度不能超过100个字符") + private String type; + + @Schema(description = "展示状态,参见 CommonStatusEnum 枚举类", example = "1") + private Integer status; + + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + @Schema(description = "创建时间") + private LocalDateTime[] createTime; + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/DictTypeRespVO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/DictTypeRespVO.java new file mode 100644 index 0000000..82d8b1f --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/DictTypeRespVO.java @@ -0,0 +1,41 @@ +package com.platform.marketing.module.system.domain.vo; + +import com.platform.marketing.framework.excel.core.annotations.DictFormat; +import com.platform.marketing.framework.excel.core.convert.DictConvert; +import com.platform.marketing.module.system.domain.enums.DictTypeConstants; +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Schema(description = "管理后台 - 字典类型信息 Response VO") +@Data +@ExcelIgnoreUnannotated +public class DictTypeRespVO { + + @Schema(description = "字典类型编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") + @ExcelProperty("字典主键") + private Long id; + + @Schema(description = "字典名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "性别") + @ExcelProperty("字典名称") + private String name; + + @Schema(description = "字典类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "sys_common_sex") + @ExcelProperty("字典类型") + private String type; + + @Schema(description = "状态,参见 CommonStatusEnum 枚举类", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @ExcelProperty(value = "状态", converter = DictConvert.class) + @DictFormat(DictTypeConstants.COMMON_STATUS) + private Integer status; + + @Schema(description = "备注", example = "快乐的备注") + private String remark; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "时间戳格式") + private LocalDateTime createTime; + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/DictTypeSaveReqVO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/DictTypeSaveReqVO.java new file mode 100644 index 0000000..8d5d3bc --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/DictTypeSaveReqVO.java @@ -0,0 +1,34 @@ +package com.platform.marketing.module.system.domain.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; + +@Schema(description = "管理后台 - 字典类型创建/修改 Request VO") +@Data +public class DictTypeSaveReqVO { + + @Schema(description = "字典类型编号", example = "1024") + private Long id; + + @Schema(description = "字典名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "性别") + @NotBlank(message = "字典名称不能为空") + @Size(max = 100, message = "字典类型名称长度不能超过100个字符") + private String name; + + @Schema(description = "字典类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "sys_common_sex") + @NotNull(message = "字典类型不能为空") + @Size(max = 100, message = "字典类型类型长度不能超过 100 个字符") + private String type; + + @Schema(description = "状态,参见 CommonStatusEnum 枚举类", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @NotNull(message = "状态不能为空") + private Integer status; + + @Schema(description = "备注", example = "快乐的备注") + private String remark; + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/DictTypeSimpleRespVO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/DictTypeSimpleRespVO.java new file mode 100644 index 0000000..e23051a --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/DictTypeSimpleRespVO.java @@ -0,0 +1,19 @@ +package com.platform.marketing.module.system.domain.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Schema(description = "管理后台 - 字典类型精简信息 Response VO") +@Data +public class DictTypeSimpleRespVO { + + @Schema(description = "字典类型编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") + private Long id; + + @Schema(description = "字典类型名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道") + private String name; + + @Schema(description = "字典类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "sys_common_sex") + private String type; + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/LoginLogPageReqVO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/LoginLogPageReqVO.java new file mode 100644 index 0000000..2d8c38f --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/LoginLogPageReqVO.java @@ -0,0 +1,31 @@ +package com.platform.marketing.module.system.domain.vo; + +import com.platform.marketing.framework.common.pojo.PageParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.springframework.format.annotation.DateTimeFormat; + +import java.time.LocalDateTime; + +import static com.platform.marketing.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 登录日志分页列表 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +public class LoginLogPageReqVO extends PageParam { + + @Schema(description = "用户 IP,模拟匹配", example = "127.0.0.1") + private String userIp; + + @Schema(description = "用户账号,模拟匹配", example = "芋道") + private String username; + + @Schema(description = "操作状态", example = "true") + private Boolean status; + + @Schema(description = "登录时间", example = "[2022-07-01 00:00:00,2022-07-01 23:59:59]") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/LoginLogRespVO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/LoginLogRespVO.java new file mode 100644 index 0000000..c4d2ef6 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/LoginLogRespVO.java @@ -0,0 +1,57 @@ +package com.platform.marketing.module.system.domain.vo; + +import com.platform.marketing.framework.excel.core.annotations.DictFormat; +import com.platform.marketing.framework.excel.core.convert.DictConvert; +import com.platform.marketing.module.system.domain.enums.DictTypeConstants; +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Schema(description = "管理后台 - 登录日志 Response VO") +@Data +@ExcelIgnoreUnannotated +public class LoginLogRespVO { + + @Schema(description = "日志编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") + @ExcelProperty("日志主键") + private Long id; + + @Schema(description = "日志类型,参见 LoginLogTypeEnum 枚举类", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @ExcelProperty(value = "日志类型", converter = DictConvert.class) + @DictFormat(DictTypeConstants.LOGIN_TYPE) + private Integer logType; + + @Schema(description = "用户编号", example = "666") + private Long userId; + + @Schema(description = "用户类型,参见 UserTypeEnum 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") + private Integer userType; + + @Schema(description = "链路追踪编号", example = "89aca178-a370-411c-ae02-3f0d672be4ab") + private String traceId; + + @Schema(description = "用户账号", requiredMode = Schema.RequiredMode.REQUIRED, example = "marketing") + @ExcelProperty("用户账号") + private String username; + + @Schema(description = "登录结果,参见 LoginResultEnum 枚举类", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @ExcelProperty(value = "登录结果", converter = DictConvert.class) + @DictFormat(DictTypeConstants.LOGIN_RESULT) + private Integer result; + + @Schema(description = "用户 IP", requiredMode = Schema.RequiredMode.REQUIRED, example = "127.0.0.1") + @ExcelProperty("登录 IP") + private String userIp; + + @Schema(description = "浏览器 UserAgent", example = "Mozilla/5.0") + @ExcelProperty("浏览器 UA") + private String userAgent; + + @Schema(description = "登录时间", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("登录时间") + private LocalDateTime createTime; + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/MenuListReqVO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/MenuListReqVO.java new file mode 100644 index 0000000..8a478a6 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/MenuListReqVO.java @@ -0,0 +1,16 @@ +package com.platform.marketing.module.system.domain.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Schema(description = "管理后台 - 菜单列表 Request VO") +@Data +public class MenuListReqVO { + + @Schema(description = "菜单名称,模糊匹配", example = "芋道") + private String name; + + @Schema(description = "展示状态,参见 CommonStatusEnum 枚举类", example = "1") + private Integer status; + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/MenuRespVO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/MenuRespVO.java new file mode 100644 index 0000000..f25ef2b --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/MenuRespVO.java @@ -0,0 +1,72 @@ +package com.platform.marketing.module.system.domain.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; +import java.time.LocalDateTime; + +@Schema(description = "管理后台 - 菜单信息 Response VO") +@Data +public class MenuRespVO { + + @Schema(description = "菜单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") + private Long id; + + @Schema(description = "菜单名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道") + @NotBlank(message = "菜单名称不能为空") + @Size(max = 50, message = "菜单名称长度不能超过50个字符") + private String name; + + @Schema(description = "权限标识,仅菜单类型为按钮时,才需要传递", example = "sys:menu:add") + @Size(max = 100) + private String permission; + + @Schema(description = "类型,参见 MenuTypeEnum 枚举类", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @NotNull(message = "菜单类型不能为空") + private Integer type; + + @Schema(description = "显示顺序", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") + @NotNull(message = "显示顺序不能为空") + private Integer sort; + + @Schema(description = "父菜单 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") + @NotNull(message = "父菜单 ID 不能为空") + private Long parentId; + + @Schema(description = "路由地址,仅菜单类型为菜单或者目录时,才需要传", example = "post") + @Size(max = 200, message = "路由地址不能超过200个字符") + private String path; + + @Schema(description = "菜单图标,仅菜单类型为菜单或者目录时,才需要传", example = "/menu/list") + private String icon; + + @Schema(description = "组件路径,仅菜单类型为菜单时,才需要传", example = "system/post/index") + @Size(max = 200, message = "组件路径不能超过255个字符") + private String component; + + @Schema(description = "组件名", example = "SystemUser") + private String componentName; + + @Schema(description = "状态,见 CommonStatusEnum 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @NotNull(message = "状态不能为空") + private Integer status; + + @Schema(description = "是否可见", example = "false") + private Boolean visible; + + @Schema(description = "是否缓存", example = "false") + private Boolean keepAlive; + + @Schema(description = "是否总是显示", example = "false") + private Boolean alwaysShow; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "时间戳格式") + private LocalDateTime createTime; + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/MenuSaveVO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/MenuSaveVO.java new file mode 100644 index 0000000..a125719 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/MenuSaveVO.java @@ -0,0 +1,65 @@ +package com.platform.marketing.module.system.domain.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; + +@Schema(description = "管理后台 - 菜单创建/修改 Request VO") +@Data +public class MenuSaveVO { + + @Schema(description = "菜单编号", example = "1024") + private Long id; + + @Schema(description = "菜单名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道") + @NotBlank(message = "菜单名称不能为空") + @Size(max = 50, message = "菜单名称长度不能超过50个字符") + private String name; + + @Schema(description = "权限标识,仅菜单类型为按钮时,才需要传递", example = "sys:menu:add") + @Size(max = 100) + private String permission; + + @Schema(description = "类型,参见 MenuTypeEnum 枚举类", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @NotNull(message = "菜单类型不能为空") + private Integer type; + + @Schema(description = "显示顺序", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") + @NotNull(message = "显示顺序不能为空") + private Integer sort; + + @Schema(description = "父菜单 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") + @NotNull(message = "父菜单 ID 不能为空") + private Long parentId; + + @Schema(description = "路由地址,仅菜单类型为菜单或者目录时,才需要传", example = "post") + @Size(max = 200, message = "路由地址不能超过200个字符") + private String path; + + @Schema(description = "菜单图标,仅菜单类型为菜单或者目录时,才需要传", example = "/menu/list") + private String icon; + + @Schema(description = "组件路径,仅菜单类型为菜单时,才需要传", example = "system/post/index") + @Size(max = 200, message = "组件路径不能超过255个字符") + private String component; + + @Schema(description = "组件名", example = "SystemUser") + private String componentName; + + @Schema(description = "状态,见 CommonStatusEnum 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @NotNull(message = "状态不能为空") + private Integer status; + + @Schema(description = "是否可见", example = "false") + private Boolean visible; + + @Schema(description = "是否缓存", example = "false") + private Boolean keepAlive; + + @Schema(description = "是否总是显示", example = "false") + private Boolean alwaysShow; + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/MenuSimpleRespVO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/MenuSimpleRespVO.java new file mode 100644 index 0000000..70c3100 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/MenuSimpleRespVO.java @@ -0,0 +1,26 @@ +package com.platform.marketing.module.system.domain.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import javax.validation.constraints.NotNull; + +@Schema(description = "管理后台 - 菜单精简信息 Response VO") +@Data +public class MenuSimpleRespVO { + + @Schema(description = "菜单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") + private Long id; + + @Schema(description = "菜单名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道") + private String name; + + @Schema(description = "父菜单 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") + private Long parentId; + + @Schema(description = "类型,参见 MenuTypeEnum 枚举类", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + private Integer type; + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/NoticePageReqVO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/NoticePageReqVO.java new file mode 100644 index 0000000..70eb17a --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/NoticePageReqVO.java @@ -0,0 +1,19 @@ +package com.platform.marketing.module.system.domain.vo; + +import com.platform.marketing.framework.common.pojo.PageParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +@Schema(description = "管理后台 - 通知公告分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +public class NoticePageReqVO extends PageParam { + + @Schema(description = "通知公告名称,模糊匹配", example = "芋道") + private String title; + + @Schema(description = "展示状态,参见 CommonStatusEnum 枚举类", example = "1") + private Integer status; + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/NoticeRespVO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/NoticeRespVO.java new file mode 100644 index 0000000..3cf2df9 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/NoticeRespVO.java @@ -0,0 +1,30 @@ +package com.platform.marketing.module.system.domain.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Schema(description = "管理后台 - 通知公告信息 Response VO") +@Data +public class NoticeRespVO { + + @Schema(description = "通知公告序号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") + private Long id; + + @Schema(description = "公告标题", requiredMode = Schema.RequiredMode.REQUIRED, example = "小博主") + private String title; + + @Schema(description = "公告类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "小博主") + private Integer type; + + @Schema(description = "公告内容", requiredMode = Schema.RequiredMode.REQUIRED, example = "半生编码") + private String content; + + @Schema(description = "状态,参见 CommonStatusEnum 枚举类", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + private Integer status; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "时间戳格式") + private LocalDateTime createTime; + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/NoticeSaveReqVO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/NoticeSaveReqVO.java new file mode 100644 index 0000000..6d1e223 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/NoticeSaveReqVO.java @@ -0,0 +1,32 @@ +package com.platform.marketing.module.system.domain.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; + +@Schema(description = "管理后台 - 通知公告创建/修改 Request VO") +@Data +public class NoticeSaveReqVO { + + @Schema(description = "岗位公告编号", example = "1024") + private Long id; + + @Schema(description = "公告标题", requiredMode = Schema.RequiredMode.REQUIRED, example = "小博主") + @NotBlank(message = "公告标题不能为空") + @Size(max = 50, message = "公告标题不能超过50个字符") + private String title; + + @Schema(description = "公告类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "小博主") + @NotNull(message = "公告类型不能为空") + private Integer type; + + @Schema(description = "公告内容", requiredMode = Schema.RequiredMode.REQUIRED, example = "半生编码") + private String content; + + @Schema(description = "状态,参见 CommonStatusEnum 枚举类", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + private Integer status; + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/OperateLogPageReqVO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/OperateLogPageReqVO.java new file mode 100644 index 0000000..a1188a0 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/OperateLogPageReqVO.java @@ -0,0 +1,35 @@ +package com.platform.marketing.module.system.domain.vo; + +import com.platform.marketing.framework.common.pojo.PageParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.time.LocalDateTime; + +import static com.platform.marketing.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 操作日志分页列表 Request VO") +@Data +public class OperateLogPageReqVO extends PageParam { + + @Schema(description = "用户编号", example = "芋道") + private Long userId; + + @Schema(description = "操作模块业务编号", example = "1") + private Long bizId; + + @Schema(description = "操作模块,模拟匹配", example = "订单") + private String type; + + @Schema(description = "操作名,模拟匹配", example = "创建订单") + private String subType; + + @Schema(description = "操作明细,模拟匹配", example = "修改编号为 1 的用户信息") + private String action; + + @Schema(description = "开始时间", example = "[2022-07-01 00:00:00,2022-07-01 23:59:59]") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/OperateLogRespVO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/OperateLogRespVO.java new file mode 100644 index 0000000..61853a3 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/OperateLogRespVO.java @@ -0,0 +1,68 @@ +package com.platform.marketing.module.system.domain.vo; + +import com.platform.marketing.module.system.domain.dataobject.AdminUserDO; +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.excel.annotation.ExcelProperty; +import com.fhs.core.trans.anno.Trans; +import com.fhs.core.trans.constant.TransType; +import com.fhs.core.trans.vo.VO; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import java.time.LocalDateTime; + +@Schema(description = "管理后台 - 操作日志 Response VO") +@Data +@ExcelIgnoreUnannotated +public class OperateLogRespVO implements VO { + + @Schema(description = "日志编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") + @ExcelProperty("日志编号") + private Long id; + + @Schema(description = "链路追踪编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "89aca178-a370-411c-ae02-3f0d672be4ab") + private String traceId; + + @Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") + @Trans(type = TransType.SIMPLE, target = AdminUserDO.class, fields = "nickname", ref = "userName") + private Long userId; + @Schema(description = "用户昵称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿") + @ExcelProperty("操作人") + private String userName; + + @Schema(description = "操作模块类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "订单") + @ExcelProperty("操作模块类型") + private String type; + + @Schema(description = "操作名", requiredMode = Schema.RequiredMode.REQUIRED, example = "创建订单") + @ExcelProperty("操作名") + private String subType; + + @Schema(description = "操作模块业务编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @ExcelProperty("操作模块业务编号") + private Long bizId; + + @Schema(description = "操作明细", example = "修改编号为 1 的用户信息,将性别从男改成女,将姓名从芋道改成源码。") + private String action; + + @Schema(description = "拓展字段", example = "{'orderId': 1}") + private String extra; + + @Schema(description = "请求方法名", requiredMode = Schema.RequiredMode.REQUIRED, example = "GET") + @NotEmpty(message = "请求方法名不能为空") + private String requestMethod; + + @Schema(description = "请求地址", requiredMode = Schema.RequiredMode.REQUIRED, example = "/xxx/yyy") + private String requestUrl; + + @Schema(description = "用户 IP", requiredMode = Schema.RequiredMode.REQUIRED, example = "127.0.0.1") + private String userIp; + + @Schema(description = "浏览器 UserAgent", requiredMode = Schema.RequiredMode.REQUIRED, example = "Mozilla/5.0") + private String userAgent; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + private LocalDateTime createTime; + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/PermissionAssignRoleDataScopeReqVO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/PermissionAssignRoleDataScopeReqVO.java new file mode 100644 index 0000000..a402dbb --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/PermissionAssignRoleDataScopeReqVO.java @@ -0,0 +1,28 @@ +package com.platform.marketing.module.system.domain.vo; + +import com.platform.marketing.framework.common.validation.InEnum; +import com.platform.marketing.module.system.domain.enums.DataScopeEnum; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.util.Collections; +import java.util.Set; + +@Schema(description = "管理后台 - 赋予角色数据权限 Request VO") +@Data +public class PermissionAssignRoleDataScopeReqVO { + + @Schema(description = "角色编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @NotNull(message = "角色编号不能为空") + private Long roleId; + + @Schema(description = "数据范围,参见 DataScopeEnum 枚举类", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @NotNull(message = "数据范围不能为空") + @InEnum(value = DataScopeEnum.class, message = "数据范围必须是 {value}") + private Integer dataScope; + + @Schema(description = "部门编号列表,只有范围类型为 DEPT_CUSTOM 时,该字段才需要", example = "1,3,5") + private Set dataScopeDeptIds = Collections.emptySet(); // 兜底 + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/PermissionAssignRoleMenuReqVO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/PermissionAssignRoleMenuReqVO.java new file mode 100644 index 0000000..268db69 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/PermissionAssignRoleMenuReqVO.java @@ -0,0 +1,21 @@ +package com.platform.marketing.module.system.domain.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.util.Collections; +import java.util.Set; + +@Schema(description = "管理后台 - 赋予角色菜单 Request VO") +@Data +public class PermissionAssignRoleMenuReqVO { + + @Schema(description = "角色编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @NotNull(message = "角色编号不能为空") + private Long roleId; + + @Schema(description = "菜单编号列表", example = "1,3,5") + private Set menuIds = Collections.emptySet(); // 兜底 + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/PermissionAssignUserRoleReqVO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/PermissionAssignUserRoleReqVO.java new file mode 100644 index 0000000..830efcf --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/PermissionAssignUserRoleReqVO.java @@ -0,0 +1,21 @@ +package com.platform.marketing.module.system.domain.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.util.Collections; +import java.util.Set; + +@Schema(description = "管理后台 - 赋予用户角色 Request VO") +@Data +public class PermissionAssignUserRoleReqVO { + + @Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @NotNull(message = "用户编号不能为空") + private Long userId; + + @Schema(description = "角色编号列表", example = "1,3,5") + private Set roleIds = Collections.emptySet(); // 兜底 + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/PostPageReqVO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/PostPageReqVO.java new file mode 100644 index 0000000..6b0ec55 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/PostPageReqVO.java @@ -0,0 +1,22 @@ +package com.platform.marketing.module.system.domain.vo; + +import com.platform.marketing.framework.common.pojo.PageParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +@Schema(description = "管理后台 - 岗位分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +public class PostPageReqVO extends PageParam { + + @Schema(description = "岗位编码,模糊匹配", example = "marketing") + private String code; + + @Schema(description = "岗位名称,模糊匹配", example = "芋道") + private String name; + + @Schema(description = "展示状态,参见 CommonStatusEnum 枚举类", example = "1") + private Integer status; + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/PostRespVO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/PostRespVO.java new file mode 100644 index 0000000..83eaa31 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/PostRespVO.java @@ -0,0 +1,45 @@ +package com.platform.marketing.module.system.domain.vo; + +import com.platform.marketing.framework.excel.core.annotations.DictFormat; +import com.platform.marketing.framework.excel.core.convert.DictConvert; +import com.platform.marketing.module.system.domain.enums.DictTypeConstants; +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Schema(description = "管理后台 - 岗位信息 Response VO") +@Data +@ExcelIgnoreUnannotated +public class PostRespVO { + + @Schema(description = "岗位序号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") + @ExcelProperty("岗位序号") + private Long id; + + @Schema(description = "岗位名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "小土豆") + @ExcelProperty("岗位名称") + private String name; + + @Schema(description = "岗位编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "marketing") + @ExcelProperty("岗位编码") + private String code; + + @Schema(description = "显示顺序", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") + @ExcelProperty("岗位排序") + private Integer sort; + + @Schema(description = "状态,参见 CommonStatusEnum 枚举类", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @ExcelProperty(value = "状态", converter = DictConvert.class) + @DictFormat(DictTypeConstants.COMMON_STATUS) + private Integer status; + + @Schema(description = "备注", example = "快乐的备注") + private String remark; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + private LocalDateTime createTime; + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/PostSaveReqVO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/PostSaveReqVO.java new file mode 100644 index 0000000..1bdfd1a --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/PostSaveReqVO.java @@ -0,0 +1,40 @@ +package com.platform.marketing.module.system.domain.vo; + +import com.platform.marketing.framework.common.enums.CommonStatusEnum; +import com.platform.marketing.framework.common.validation.InEnum; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; + +@Schema(description = "管理后台 - 岗位创建/修改 Request VO") +@Data +public class PostSaveReqVO { + + @Schema(description = "岗位编号", example = "1024") + private Long id; + + @Schema(description = "岗位名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "小土豆") + @NotBlank(message = "岗位名称不能为空") + @Size(max = 50, message = "岗位名称长度不能超过 50 个字符") + private String name; + + @Schema(description = "岗位编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "marketing") + @NotBlank(message = "岗位编码不能为空") + @Size(max = 64, message = "岗位编码长度不能超过64个字符") + private String code; + + @Schema(description = "显示顺序", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") + @NotNull(message = "显示顺序不能为空") + private Integer sort; + + @Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @InEnum(CommonStatusEnum.class) + private Integer status; + + @Schema(description = "备注", example = "快乐的备注") + private String remark; + +} \ No newline at end of file diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/PostSimpleRespVO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/PostSimpleRespVO.java new file mode 100644 index 0000000..dc8d002 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/PostSimpleRespVO.java @@ -0,0 +1,19 @@ +package com.platform.marketing.module.system.domain.vo; + +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Schema(description = "管理后台 - 岗位信息的精简 Response VO") +@Data +public class PostSimpleRespVO { + + @Schema(description = "岗位序号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") + @ExcelProperty("岗位序号") + private Long id; + + @Schema(description = "岗位名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "小土豆") + @ExcelProperty("岗位名称") + private String name; + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/RolePageReqVO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/RolePageReqVO.java new file mode 100644 index 0000000..ad130ad --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/RolePageReqVO.java @@ -0,0 +1,31 @@ +package com.platform.marketing.module.system.domain.vo; + +import com.platform.marketing.framework.common.pojo.PageParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.springframework.format.annotation.DateTimeFormat; + +import java.time.LocalDateTime; + +import static com.platform.marketing.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 角色分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +public class RolePageReqVO extends PageParam { + + @Schema(description = "角色名称,模糊匹配", example = "芋道") + private String name; + + @Schema(description = "角色标识,模糊匹配", example = "marketing") + private String code; + + @Schema(description = "展示状态,参见 CommonStatusEnum 枚举类", example = "1") + private Integer status; + + @Schema(description = "创建时间", example = "[2022-07-01 00:00:00,2022-07-01 23:59:59]") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/RoleRespVO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/RoleRespVO.java new file mode 100644 index 0000000..2d847d4 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/RoleRespVO.java @@ -0,0 +1,59 @@ +package com.platform.marketing.module.system.domain.vo; + +import com.platform.marketing.framework.excel.core.annotations.DictFormat; +import com.platform.marketing.framework.excel.core.convert.DictConvert; +import com.platform.marketing.module.system.domain.enums.DictTypeConstants; +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.time.LocalDateTime; +import java.util.Set; + +@Schema(description = "管理后台 - 角色信息 Response VO") +@Data +@ExcelIgnoreUnannotated +public class RoleRespVO { + + @Schema(description = "角色编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @ExcelProperty("角色序号") + private Long id; + + @Schema(description = "角色名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "管理员") + @ExcelProperty("角色名称") + private String name; + + @Schema(description = "角色标志", requiredMode = Schema.RequiredMode.REQUIRED, example = "admin") + @NotBlank(message = "角色标志不能为空") + @ExcelProperty("角色标志") + private String code; + + @Schema(description = "显示顺序", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") + @ExcelProperty("角色排序") + private Integer sort; + + @Schema(description = "状态,参见 CommonStatusEnum 枚举类", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @ExcelProperty(value = "角色状态", converter = DictConvert.class) + @DictFormat(DictTypeConstants.COMMON_STATUS) + private Integer status; + + @Schema(description = "角色类型,参见 RoleTypeEnum 枚举类", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + private Integer type; + + @Schema(description = "备注", example = "我是一个角色") + private String remark; + + @Schema(description = "数据范围,参见 DataScopeEnum 枚举类", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @ExcelProperty(value = "数据范围", converter = DictConvert.class) + @DictFormat(DictTypeConstants.DATA_SCOPE) + private Integer dataScope; + + @Schema(description = "数据范围(指定部门数组)", example = "1") + private Set dataScopeDeptIds; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "时间戳格式") + private LocalDateTime createTime; + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/RoleSaveReqVO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/RoleSaveReqVO.java new file mode 100644 index 0000000..c6cfb34 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/RoleSaveReqVO.java @@ -0,0 +1,48 @@ +package com.platform.marketing.module.system.domain.vo; + +import com.platform.marketing.framework.common.enums.CommonStatusEnum; +import com.platform.marketing.framework.common.validation.InEnum; +import com.mzt.logapi.starter.annotation.DiffLogField; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; + +@Schema(description = "管理后台 - 角色创建/更新 Request VO") +@Data +public class RoleSaveReqVO { + + @Schema(description = "角色编号", example = "1") + private Long id; + + @Schema(description = "角色名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "管理员") + @NotBlank(message = "角色名称不能为空") + @Size(max = 30, message = "角色名称长度不能超过 30 个字符") + @DiffLogField(name = "角色名称") + private String name; + + @NotBlank(message = "角色标志不能为空") + @Size(max = 100, message = "角色标志长度不能超过 100 个字符") + @Schema(description = "角色标志", requiredMode = Schema.RequiredMode.REQUIRED, example = "ADMIN") + @DiffLogField(name = "角色标志") + private String code; + + @Schema(description = "显示顺序", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") + @NotNull(message = "显示顺序不能为空") + @DiffLogField(name = "显示顺序") + private Integer sort; + + @Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "0") + @DiffLogField(name = "状态") + @NotNull(message = "状态不能为空") + @InEnum(value = CommonStatusEnum.class, message = "状态必须是 {value}") + private Integer status; + + @Schema(description = "备注", example = "我是一个角色") + @Size(max = 500, message = "备注长度不能超过 500 个字符") + @DiffLogField(name = "备注") + private String remark; + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/RoleSimpleRespVO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/RoleSimpleRespVO.java new file mode 100644 index 0000000..85cecad --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/RoleSimpleRespVO.java @@ -0,0 +1,18 @@ +package com.platform.marketing.module.system.domain.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Schema(description = "管理后台 - 角色精简信息 Response VO") +@Data +public class RoleSimpleRespVO { + + @Schema(description = "角色编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") + private Long id; + + @Schema(description = "角色名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道") + private String name; + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/TenantPackagePageReqVO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/TenantPackagePageReqVO.java new file mode 100644 index 0000000..5caf03b --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/TenantPackagePageReqVO.java @@ -0,0 +1,32 @@ +package com.platform.marketing.module.system.domain.vo; + +import com.platform.marketing.framework.common.pojo.PageParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; +import org.springframework.format.annotation.DateTimeFormat; + +import java.time.LocalDateTime; + +import static com.platform.marketing.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 租户套餐分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class TenantPackagePageReqVO extends PageParam { + + @Schema(description = "套餐名", example = "VIP") + private String name; + + @Schema(description = "状态", example = "1") + private Integer status; + + @Schema(description = "备注", example = "好") + private String remark; + + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + @Schema(description = "创建时间") + private LocalDateTime[] createTime; +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/TenantPackageRespVO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/TenantPackageRespVO.java new file mode 100644 index 0000000..b9964c2 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/TenantPackageRespVO.java @@ -0,0 +1,31 @@ +package com.platform.marketing.module.system.domain.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; +import java.util.Set; + +@Schema(description = "管理后台 - 租户套餐 Response VO") +@Data +public class TenantPackageRespVO { + + @Schema(description = "套餐编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") + private Long id; + + @Schema(description = "套餐名", requiredMode = Schema.RequiredMode.REQUIRED, example = "VIP") + private String name; + + @Schema(description = "状态,参见 CommonStatusEnum 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + private Integer status; + + @Schema(description = "备注", example = "好") + private String remark; + + @Schema(description = "关联的菜单编号", requiredMode = Schema.RequiredMode.REQUIRED) + private Set menuIds; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + private LocalDateTime createTime; + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/TenantPackageSaveReqVO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/TenantPackageSaveReqVO.java new file mode 100644 index 0000000..9e507fd --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/TenantPackageSaveReqVO.java @@ -0,0 +1,35 @@ +package com.platform.marketing.module.system.domain.vo; + +import com.platform.marketing.framework.common.enums.CommonStatusEnum; +import com.platform.marketing.framework.common.validation.InEnum; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import java.util.Set; + +@Schema(description = "管理后台 - 租户套餐创建/修改 Request VO") +@Data +public class TenantPackageSaveReqVO { + + @Schema(description = "套餐编号", example = "1024") + private Long id; + + @Schema(description = "套餐名", requiredMode = Schema.RequiredMode.REQUIRED, example = "VIP") + @NotEmpty(message = "套餐名不能为空") + private String name; + + @Schema(description = "状态,参见 CommonStatusEnum 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @NotNull(message = "状态不能为空") + @InEnum(value = CommonStatusEnum.class, message = "状态必须是 {value}") + private Integer status; + + @Schema(description = "备注", example = "好") + private String remark; + + @Schema(description = "关联的菜单编号", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "关联的菜单编号不能为空") + private Set menuIds; + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/TenantPackageSimpleRespVO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/TenantPackageSimpleRespVO.java new file mode 100644 index 0000000..0bed759 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/TenantPackageSimpleRespVO.java @@ -0,0 +1,20 @@ +package com.platform.marketing.module.system.domain.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import javax.validation.constraints.NotNull; + +@Schema(description = "管理后台 - 租户套餐精简 Response VO") +@Data +public class TenantPackageSimpleRespVO { + + @Schema(description = "套餐编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") + @NotNull(message = "套餐编号不能为空") + private Long id; + + @Schema(description = "套餐名", requiredMode = Schema.RequiredMode.REQUIRED, example = "VIP") + @NotNull(message = "套餐名不能为空") + private String name; + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/TenantPageReqVO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/TenantPageReqVO.java new file mode 100644 index 0000000..e22bb31 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/TenantPageReqVO.java @@ -0,0 +1,36 @@ +package com.platform.marketing.module.system.domain.vo; + +import com.platform.marketing.framework.common.pojo.PageParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; +import org.springframework.format.annotation.DateTimeFormat; + +import java.time.LocalDateTime; + +import static com.platform.marketing.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 租户分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class TenantPageReqVO extends PageParam { + + @Schema(description = "租户名", example = "芋道") + private String name; + + @Schema(description = "联系人", example = "芋艿") + private String contactName; + + @Schema(description = "联系手机", example = "15601691300") + private String contactMobile; + + @Schema(description = "租户状态(0正常 1停用)", example = "1") + private Integer status; + + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + @Schema(description = "创建时间") + private LocalDateTime[] createTime; + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/TenantRespVO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/TenantRespVO.java new file mode 100644 index 0000000..0e1930a --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/TenantRespVO.java @@ -0,0 +1,55 @@ +package com.platform.marketing.module.system.domain.vo; + +import com.platform.marketing.framework.excel.core.annotations.DictFormat; +import com.platform.marketing.framework.excel.core.convert.DictConvert; +import com.platform.marketing.module.system.domain.enums.DictTypeConstants; +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Schema(description = "管理后台 - 租户 Response VO") +@Data +@ExcelIgnoreUnannotated +public class TenantRespVO { + + @Schema(description = "租户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") + @ExcelProperty("租户编号") + private Long id; + + @Schema(description = "租户名", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道") + @ExcelProperty("租户名") + private String name; + + @Schema(description = "联系人", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿") + @ExcelProperty("联系人") + private String contactName; + + @Schema(description = "联系手机", example = "15601691300") + @ExcelProperty("联系手机") + private String contactMobile; + + @Schema(description = "租户状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @ExcelProperty(value = "状态", converter = DictConvert.class) + @DictFormat(DictTypeConstants.COMMON_STATUS) + private Integer status; + + @Schema(description = "绑定域名", example = "https://www.iocoder.cn") + private String website; + + @Schema(description = "租户套餐编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") + private Long packageId; + + @Schema(description = "过期时间", requiredMode = Schema.RequiredMode.REQUIRED) + private LocalDateTime expireTime; + + @Schema(description = "账号数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") + private Integer accountCount; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("创建时间") + private LocalDateTime createTime; + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/TenantSaveReqVO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/TenantSaveReqVO.java new file mode 100644 index 0000000..39e5892 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/TenantSaveReqVO.java @@ -0,0 +1,70 @@ +package com.platform.marketing.module.system.domain.vo; + +import cn.hutool.core.util.ObjectUtil; +import com.fasterxml.jackson.annotation.JsonIgnore; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import org.hibernate.validator.constraints.Length; + +import javax.validation.constraints.AssertTrue; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Pattern; +import javax.validation.constraints.Size; +import java.time.LocalDateTime; + +@Schema(description = "管理后台 - 租户创建/修改 Request VO") +@Data +public class TenantSaveReqVO { + + @Schema(description = "租户编号", example = "1024") + private Long id; + + @Schema(description = "租户名", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道") + @NotNull(message = "租户名不能为空") + private String name; + + @Schema(description = "联系人", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿") + @NotNull(message = "联系人不能为空") + private String contactName; + + @Schema(description = "联系手机", example = "15601691300") + private String contactMobile; + + @Schema(description = "租户状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @NotNull(message = "租户状态") + private Integer status; + + @Schema(description = "绑定域名", example = "https://www.iocoder.cn") + private String website; + + @Schema(description = "租户套餐编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") + @NotNull(message = "租户套餐编号不能为空") + private Long packageId; + + @Schema(description = "过期时间", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "过期时间不能为空") + private LocalDateTime expireTime; + + @Schema(description = "账号数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") + @NotNull(message = "账号数量不能为空") + private Integer accountCount; + + // ========== 仅【创建】时,需要传递的字段 ========== + + @Schema(description = "用户账号", requiredMode = Schema.RequiredMode.REQUIRED, example = "marketing") + @Pattern(regexp = "^[a-zA-Z0-9]{4,30}$", message = "用户账号由 数字、字母 组成") + @Size(min = 4, max = 30, message = "用户账号长度为 4-30 个字符") + private String username; + + @Schema(description = "密码", requiredMode = Schema.RequiredMode.REQUIRED, example = "123456") + @Length(min = 4, max = 16, message = "密码长度为 4-16 位") + private String password; + + @AssertTrue(message = "用户账号、密码不能为空") + @JsonIgnore + public boolean isUsernameValid() { + return id != null // 修改时,不需要传递 + || (ObjectUtil.isAllNotEmpty(username, password)); // 新增时,必须都传递 username、password + } + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/UserImportExcelVO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/UserImportExcelVO.java new file mode 100644 index 0000000..6e08641 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/UserImportExcelVO.java @@ -0,0 +1,46 @@ +package com.platform.marketing.module.system.domain.vo; + +import com.platform.marketing.framework.excel.core.annotations.DictFormat; +import com.platform.marketing.framework.excel.core.convert.DictConvert; +import com.platform.marketing.module.system.domain.enums.DictTypeConstants; +import com.alibaba.excel.annotation.ExcelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; + +/** + * 用户 Excel 导入 VO + */ +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +@Accessors(chain = false) // 设置 chain = false,避免用户导入有问题 +public class UserImportExcelVO { + + @ExcelProperty("登录名称") + private String username; + + @ExcelProperty("用户名称") + private String nickname; + + @ExcelProperty("部门编号") + private Long deptId; + + @ExcelProperty("用户邮箱") + private String email; + + @ExcelProperty("手机号码") + private String mobile; + + @ExcelProperty(value = "用户性别", converter = DictConvert.class) + @DictFormat(DictTypeConstants.USER_SEX) + private Integer sex; + + @ExcelProperty(value = "账号状态", converter = DictConvert.class) + @DictFormat(DictTypeConstants.COMMON_STATUS) + private Integer status; + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/UserImportRespVO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/UserImportRespVO.java new file mode 100644 index 0000000..2b5084b --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/UserImportRespVO.java @@ -0,0 +1,24 @@ +package com.platform.marketing.module.system.domain.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Builder; +import lombok.Data; + +import java.util.List; +import java.util.Map; + +@Schema(description = "管理后台 - 用户导入 Response VO") +@Data +@Builder +public class UserImportRespVO { + + @Schema(description = "创建成功的用户名数组", requiredMode = Schema.RequiredMode.REQUIRED) + private List createUsernames; + + @Schema(description = "更新成功的用户名数组", requiredMode = Schema.RequiredMode.REQUIRED) + private List updateUsernames; + + @Schema(description = "导入失败的用户集合,key 为用户名,value 为失败原因", requiredMode = Schema.RequiredMode.REQUIRED) + private Map failureUsernames; + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/UserPageReqVO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/UserPageReqVO.java new file mode 100644 index 0000000..17d3079 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/UserPageReqVO.java @@ -0,0 +1,41 @@ +package com.platform.marketing.module.system.domain.vo; + +import com.platform.marketing.framework.common.pojo.PageParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; +import org.springframework.format.annotation.DateTimeFormat; + +import java.time.LocalDateTime; + +import static com.platform.marketing.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 用户分页 Request VO") +@Data +@NoArgsConstructor +@AllArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class UserPageReqVO extends PageParam { + + @Schema(description = "用户账号,模糊匹配", example = "marketing") + private String username; + + @Schema(description = "手机号码,模糊匹配", example = "marketing") + private String mobile; + + @Schema(description = "展示状态,参见 CommonStatusEnum 枚举类", example = "1") + private Integer status; + + @Schema(description = "创建时间", example = "[2022-07-01 00:00:00, 2022-07-01 23:59:59]") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + + @Schema(description = "部门编号,同时筛选子部门", example = "1024") + private Long deptId; + + @Schema(description = "角色编号", example = "1024") + private Long roleId; + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/UserProfileRespVO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/UserProfileRespVO.java new file mode 100644 index 0000000..e3e38da --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/UserProfileRespVO.java @@ -0,0 +1,59 @@ +package com.platform.marketing.module.system.domain.vo; + +import com.platform.marketing.module.system.domain.vo.DeptSimpleRespVO; +import com.platform.marketing.module.system.domain.vo.PostSimpleRespVO; +import com.platform.marketing.module.system.domain.vo.RoleSimpleRespVO; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; +import java.util.List; + +@Data +@Schema(description = "管理后台 - 用户个人中心信息 Response VO") +public class UserProfileRespVO { + + @Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + private Long id; + + @Schema(description = "用户账号", requiredMode = Schema.RequiredMode.REQUIRED, example = "marketing") + private String username; + + @Schema(description = "用户昵称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿") + private String nickname; + + @Schema(description = "用户邮箱", example = "marketing@iocoder.cn") + private String email; + + @Schema(description = "手机号码", example = "15601691300") + private String mobile; + + @Schema(description = "用户性别,参见 SexEnum 枚举类", example = "1") + private Integer sex; + + @Schema(description = "用户头像", example = "https://www.iocoder.cn/xxx.png") + private String avatar; + + @Schema(description = "最后登录 IP", requiredMode = Schema.RequiredMode.REQUIRED, example = "192.168.1.1") + private String loginIp; + + @Schema(description = "最后登录时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "时间戳格式") + private LocalDateTime loginDate; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "时间戳格式") + private LocalDateTime createTime; + + /** + * 所属角色 + */ + private List roles; + /** + * 所在部门 + */ + private DeptSimpleRespVO dept; + /** + * 所属岗位数组 + */ + private List posts; + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/UserProfileUpdatePasswordReqVO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/UserProfileUpdatePasswordReqVO.java new file mode 100644 index 0000000..ab946a2 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/UserProfileUpdatePasswordReqVO.java @@ -0,0 +1,23 @@ +package com.platform.marketing.module.system.domain.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import org.hibernate.validator.constraints.Length; + +import javax.validation.constraints.NotEmpty; + +@Schema(description = "管理后台 - 用户个人中心更新密码 Request VO") +@Data +public class UserProfileUpdatePasswordReqVO { + + @Schema(description = "旧密码", requiredMode = Schema.RequiredMode.REQUIRED, example = "123456") + @NotEmpty(message = "旧密码不能为空") + @Length(min = 4, max = 16, message = "密码长度为 4-16 位") + private String oldPassword; + + @Schema(description = "新密码", requiredMode = Schema.RequiredMode.REQUIRED, example = "654321") + @NotEmpty(message = "新密码不能为空") + @Length(min = 4, max = 16, message = "密码长度为 4-16 位") + private String newPassword; + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/UserProfileUpdateReqVO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/UserProfileUpdateReqVO.java new file mode 100644 index 0000000..e4d1be8 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/UserProfileUpdateReqVO.java @@ -0,0 +1,31 @@ +package com.platform.marketing.module.system.domain.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import org.hibernate.validator.constraints.Length; + +import javax.validation.constraints.Email; +import javax.validation.constraints.Size; + + +@Schema(description = "管理后台 - 用户个人信息更新 Request VO") +@Data +public class UserProfileUpdateReqVO { + + @Schema(description = "用户昵称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿") + @Size(max = 30, message = "用户昵称长度不能超过 30 个字符") + private String nickname; + + @Schema(description = "用户邮箱", example = "marketing@iocoder.cn") + @Email(message = "邮箱格式不正确") + @Size(max = 50, message = "邮箱长度不能超过 50 个字符") + private String email; + + @Schema(description = "手机号码", example = "15601691300") + @Length(min = 11, max = 11, message = "手机号长度必须 11 位") + private String mobile; + + @Schema(description = "用户性别,参见 SexEnum 枚举类", example = "1") + private Integer sex; + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/UserRespVO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/UserRespVO.java new file mode 100644 index 0000000..6d567aa --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/UserRespVO.java @@ -0,0 +1,75 @@ +package com.platform.marketing.module.system.domain.vo; + +import com.platform.marketing.framework.excel.core.annotations.DictFormat; +import com.platform.marketing.framework.excel.core.convert.DictConvert; +import com.platform.marketing.module.system.domain.enums.DictTypeConstants; +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; +import java.util.Set; + +@Schema(description = "管理后台 - 用户信息 Response VO") +@Data +@ExcelIgnoreUnannotated +public class UserRespVO{ + + @Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @ExcelProperty("用户编号") + private Long id; + + @Schema(description = "用户账号", requiredMode = Schema.RequiredMode.REQUIRED, example = "marketing") + @ExcelProperty("用户名称") + private String username; + + @Schema(description = "用户昵称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿") + @ExcelProperty("用户昵称") + private String nickname; + + @Schema(description = "备注", example = "我是一个用户") + private String remark; + + @Schema(description = "部门ID", example = "我是一个用户") + private Long deptId; + @Schema(description = "部门名称", example = "IT 部") + @ExcelProperty("部门名称") + private String deptName; + + @Schema(description = "岗位编号数组", example = "1") + private Set postIds; + + @Schema(description = "用户邮箱", example = "marketing@iocoder.cn") + @ExcelProperty("用户邮箱") + private String email; + + @Schema(description = "手机号码", example = "15601691300") + @ExcelProperty("手机号码") + private String mobile; + + @Schema(description = "用户性别,参见 SexEnum 枚举类", example = "1") + @ExcelProperty(value = "用户性别", converter = DictConvert.class) + @DictFormat(DictTypeConstants.USER_SEX) + private Integer sex; + + @Schema(description = "用户头像", example = "https://www.iocoder.cn/xxx.png") + private String avatar; + + @Schema(description = "状态,参见 CommonStatusEnum 枚举类", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @ExcelProperty(value = "帐号状态", converter = DictConvert.class) + @DictFormat(DictTypeConstants.COMMON_STATUS) + private Integer status; + + @Schema(description = "最后登录 IP", requiredMode = Schema.RequiredMode.REQUIRED, example = "192.168.1.1") + @ExcelProperty("最后登录IP") + private String loginIp; + + @Schema(description = "最后登录时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "时间戳格式") + @ExcelProperty("最后登录时间") + private LocalDateTime loginDate; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "时间戳格式") + private LocalDateTime createTime; + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/UserSaveReqVO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/UserSaveReqVO.java new file mode 100644 index 0000000..c8a285e --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/UserSaveReqVO.java @@ -0,0 +1,80 @@ +package com.platform.marketing.module.system.domain.vo; + +import cn.hutool.core.util.ObjectUtil; +import com.platform.marketing.framework.common.validation.Mobile; +import com.platform.marketing.module.system.framework.operatelog.core.DeptParseFunction; +import com.platform.marketing.module.system.framework.operatelog.core.PostParseFunction; +import com.platform.marketing.module.system.framework.operatelog.core.SexParseFunction; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.mzt.logapi.starter.annotation.DiffLogField; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import org.hibernate.validator.constraints.Length; + +import javax.validation.constraints.*; +import java.util.Set; + +@Schema(description = "管理后台 - 用户创建/修改 Request VO") +@Data +public class UserSaveReqVO { + + @Schema(description = "用户编号", example = "1024") + private Long id; + + @Schema(description = "用户账号", requiredMode = Schema.RequiredMode.REQUIRED, example = "marketing") + @NotBlank(message = "用户账号不能为空") + @Pattern(regexp = "^[a-zA-Z0-9]+$", message = "用户账号由 数字、字母 组成") + @Size(min = 4, max = 30, message = "用户账号长度为 4-30 个字符") + @DiffLogField(name = "用户账号") + private String username; + + @Schema(description = "用户昵称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿") + @Size(max = 30, message = "用户昵称长度不能超过30个字符") + @DiffLogField(name = "用户昵称") + private String nickname; + + @Schema(description = "备注", example = "我是一个用户") + @DiffLogField(name = "备注") + private String remark; + + @Schema(description = "部门编号", example = "我是一个用户") + @DiffLogField(name = "部门", function = DeptParseFunction.NAME) + private Long deptId; + + @Schema(description = "岗位编号数组", example = "1") + @DiffLogField(name = "岗位", function = PostParseFunction.NAME) + private Set postIds; + + @Schema(description = "用户邮箱", example = "marketing@iocoder.cn") + @Email(message = "邮箱格式不正确") + @Size(max = 50, message = "邮箱长度不能超过 50 个字符") + @DiffLogField(name = "用户邮箱") + private String email; + + @Schema(description = "手机号码", example = "15601691300") + @Mobile + @DiffLogField(name = "手机号码") + private String mobile; + + @Schema(description = "用户性别,参见 SexEnum 枚举类", example = "1") + @DiffLogField(name = "用户性别", function = SexParseFunction.NAME) + private Integer sex; + + @Schema(description = "用户头像", example = "https://www.iocoder.cn/xxx.png") + @DiffLogField(name = "用户头像") + private String avatar; + + // ========== 仅【创建】时,需要传递的字段 ========== + + @Schema(description = "密码", requiredMode = Schema.RequiredMode.REQUIRED, example = "123456") + @Length(min = 4, max = 16, message = "密码长度为 4-16 位") + private String password; + + @AssertTrue(message = "密码不能为空") + @JsonIgnore + public boolean isPasswordValid() { + return id != null // 修改时,不需要传递 + || (ObjectUtil.isAllNotEmpty(password)); // 新增时,必须都传递 password + } + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/UserSimpleRespVO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/UserSimpleRespVO.java new file mode 100644 index 0000000..33d8773 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/UserSimpleRespVO.java @@ -0,0 +1,25 @@ +package com.platform.marketing.module.system.domain.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Schema(description = "管理后台 - 用户精简信息 Response VO") +@Data +@NoArgsConstructor +@AllArgsConstructor +public class UserSimpleRespVO { + + @Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") + private Long id; + + @Schema(description = "用户昵称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道") + private String nickname; + + @Schema(description = "部门ID", example = "我是一个用户") + private Long deptId; + @Schema(description = "部门名称", example = "IT 部") + private String deptName; + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/UserUpdatePasswordReqVO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/UserUpdatePasswordReqVO.java new file mode 100644 index 0000000..94d9b7d --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/UserUpdatePasswordReqVO.java @@ -0,0 +1,23 @@ +package com.platform.marketing.module.system.domain.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import org.hibernate.validator.constraints.Length; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; + +@Schema(description = "管理后台 - 用户更新密码 Request VO") +@Data +public class UserUpdatePasswordReqVO { + + @Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") + @NotNull(message = "用户编号不能为空") + private Long id; + + @Schema(description = "密码", requiredMode = Schema.RequiredMode.REQUIRED, example = "123456") + @NotEmpty(message = "密码不能为空") + @Length(min = 4, max = 16, message = "密码长度为 4-16 位") + private String password; + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/UserUpdateStatusReqVO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/UserUpdateStatusReqVO.java new file mode 100644 index 0000000..dcb41a8 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/domain/vo/UserUpdateStatusReqVO.java @@ -0,0 +1,23 @@ +package com.platform.marketing.module.system.domain.vo; + +import com.platform.marketing.framework.common.enums.CommonStatusEnum; +import com.platform.marketing.framework.common.validation.InEnum; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import javax.validation.constraints.NotNull; + +@Schema(description = "管理后台 - 用户更新状态 Request VO") +@Data +public class UserUpdateStatusReqVO { + + @Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") + @NotNull(message = "角色编号不能为空") + private Long id; + + @Schema(description = "状态,见 CommonStatusEnum 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @NotNull(message = "状态不能为空") + @InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}") + private Integer status; + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/framework/captcha/config/MarketingCaptchaConfiguration.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/framework/captcha/config/MarketingCaptchaConfiguration.java new file mode 100644 index 0000000..318a471 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/framework/captcha/config/MarketingCaptchaConfiguration.java @@ -0,0 +1,29 @@ +package com.platform.marketing.module.system.framework.captcha.config; + +import com.platform.marketing.module.system.framework.captcha.core.RedisCaptchaServiceImpl; +import com.xingyuv.captcha.properties.AjCaptchaProperties; +import com.xingyuv.captcha.service.CaptchaCacheService; +import com.xingyuv.captcha.service.impl.CaptchaServiceFactory; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.data.redis.core.StringRedisTemplate; + +/** + * 验证码的配置类 + * + + */ +@Configuration(proxyBeanMethods = false) +public class MarketingCaptchaConfiguration { + + @Bean + public CaptchaCacheService captchaCacheService(AjCaptchaProperties config, + StringRedisTemplate stringRedisTemplate) { + CaptchaCacheService captchaCacheService = CaptchaServiceFactory.getCache(config.getCacheType().name()); + if (captchaCacheService instanceof RedisCaptchaServiceImpl) { + ((RedisCaptchaServiceImpl) captchaCacheService).setStringRedisTemplate(stringRedisTemplate); + } + return captchaCacheService; + } + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/framework/captcha/core/RedisCaptchaServiceImpl.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/framework/captcha/core/RedisCaptchaServiceImpl.java new file mode 100644 index 0000000..14ed883 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/framework/captcha/core/RedisCaptchaServiceImpl.java @@ -0,0 +1,49 @@ +package com.platform.marketing.module.system.framework.captcha.core; + +import com.xingyuv.captcha.service.CaptchaCacheService; +import lombok.Setter; +import org.springframework.data.redis.core.StringRedisTemplate; + +import java.util.concurrent.TimeUnit; + +/** + * 基于 Redis 实现验证码的存储 + * + * @author 星语 + */ +@Setter +public class RedisCaptchaServiceImpl implements CaptchaCacheService { + + private StringRedisTemplate stringRedisTemplate; + + @Override + public String type() { + return "redis"; + } + + @Override + public void set(String key, String value, long expiresInSeconds) { + stringRedisTemplate.opsForValue().set(key, value, expiresInSeconds, TimeUnit.SECONDS); + } + + @Override + public boolean exists(String key) { + return Boolean.TRUE.equals(stringRedisTemplate.hasKey(key)); + } + + @Override + public void delete(String key) { + stringRedisTemplate.delete(key); + } + + @Override + public String get(String key) { + return stringRedisTemplate.opsForValue().get(key); + } + + @Override + public Long increment(String key, long val) { + return stringRedisTemplate.opsForValue().increment(key,val); + } + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/framework/operatelog/config/OperateLogConfiguration.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/framework/operatelog/config/OperateLogConfiguration.java new file mode 100644 index 0000000..3e93833 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/framework/operatelog/config/OperateLogConfiguration.java @@ -0,0 +1,26 @@ +package com.platform.marketing.module.system.framework.operatelog.config; + +import com.platform.marketing.module.system.framework.operatelog.core.service.LogRecordServiceImpl; +import com.mzt.logapi.service.ILogRecordService; +import com.mzt.logapi.starter.annotation.EnableLogRecord; +import lombok.extern.slf4j.Slf4j; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Primary; + +/** + * 操作日志配置类 + */ +@EnableLogRecord(tenant = "") // 貌似用不上 tenant 这玩意给个空好啦 此处注解非常关键 +@Configuration(proxyBeanMethods = false) +@Slf4j +public class OperateLogConfiguration { + + @Bean + @Primary + public ILogRecordService iLogRecordServiceImpl() { + log.info("创建 ILogRecordService "); + return new LogRecordServiceImpl(); + } + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/framework/operatelog/core/AdminUserParseFunction.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/framework/operatelog/core/AdminUserParseFunction.java new file mode 100644 index 0000000..466fd21 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/framework/operatelog/core/AdminUserParseFunction.java @@ -0,0 +1,51 @@ +package com.platform.marketing.module.system.framework.operatelog.core; + +import cn.hutool.core.convert.Convert; +import cn.hutool.core.util.StrUtil; +import com.platform.marketing.module.system.domain.dataobject.AdminUserDO; +import com.platform.marketing.module.system.service.AdminUserService; +import com.mzt.logapi.service.IParseFunction; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; + +/** + * 管理员名字的 {@link IParseFunction} 实现类 + * + * @author HUIHUI + */ +@Slf4j +@Component +public class AdminUserParseFunction implements IParseFunction { + + public static final String NAME = "getAdminUserById"; + + @Resource + private AdminUserService adminUserService; + + @Override + public String functionName() { + return NAME; + } + + @Override + public String apply(Object value) { + if (StrUtil.isEmptyIfStr(value)) { + return ""; + } + + // 获取用户信息 + AdminUserDO user = adminUserService.getUser(Convert.toLong(value)); + if (user == null) { + log.warn("[apply][获取用户{{}}为空", value); + return ""; + } + String nickname = user.getNickname(); + if (StrUtil.isEmpty(user.getMobile())) { + return nickname; + } + return StrUtil.format("{}({})", nickname, user.getMobile()); + } + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/framework/operatelog/core/AreaParseFunction.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/framework/operatelog/core/AreaParseFunction.java new file mode 100644 index 0000000..44adc1a --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/framework/operatelog/core/AreaParseFunction.java @@ -0,0 +1,39 @@ +package com.platform.marketing.module.system.framework.operatelog.core; + +import cn.hutool.core.convert.Convert; +import cn.hutool.core.util.StrUtil; +import com.platform.marketing.framework.ip.core.utils.AreaUtils; +import com.mzt.logapi.service.IParseFunction; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +/** + * 地名的 {@link IParseFunction} 实现类 + * + * @author HUIHUI + */ +@Slf4j +@Component +public class AreaParseFunction implements IParseFunction { + + public static final String NAME = "getArea"; + + @Override + public boolean executeBefore() { + return true; // 先转换值后对比 + } + + @Override + public String functionName() { + return NAME; + } + + @Override + public String apply(Object value) { + if (StrUtil.isEmptyIfStr(value)) { + return ""; + } + return AreaUtils.format(Convert.toInt(value)); + } + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/framework/operatelog/core/BooleanParseFunction.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/framework/operatelog/core/BooleanParseFunction.java new file mode 100644 index 0000000..b7f6831 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/framework/operatelog/core/BooleanParseFunction.java @@ -0,0 +1,39 @@ +package com.platform.marketing.module.system.framework.operatelog.core; + +import cn.hutool.core.util.StrUtil; +import com.platform.marketing.framework.dict.core.DictFrameworkUtils; +import com.platform.marketing.module.infra.domain.enums.DictTypeConstants; +import com.mzt.logapi.service.IParseFunction; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +/** + * 是否类型的 {@link IParseFunction} 实现类 + * + * @author HUIHUI + */ +@Component +@Slf4j +public class BooleanParseFunction implements IParseFunction { + + public static final String NAME = "getBoolean"; + + @Override + public boolean executeBefore() { + return true; // 先转换值后对比 + } + + @Override + public String functionName() { + return NAME; + } + + @Override + public String apply(Object value) { + if (StrUtil.isEmptyIfStr(value)) { + return ""; + } + return DictFrameworkUtils.getDictDataLabel(DictTypeConstants.BOOLEAN_STRING, value.toString()); + } + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/framework/operatelog/core/DeptParseFunction.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/framework/operatelog/core/DeptParseFunction.java new file mode 100644 index 0000000..24c62fd --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/framework/operatelog/core/DeptParseFunction.java @@ -0,0 +1,47 @@ +package com.platform.marketing.module.system.framework.operatelog.core; + +import cn.hutool.core.convert.Convert; +import cn.hutool.core.util.StrUtil; +import com.platform.marketing.module.system.domain.dataobject.DeptDO; +import com.platform.marketing.module.system.service.DeptService; +import com.mzt.logapi.service.IParseFunction; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; + +/** + * 部门名字的 {@link IParseFunction} 实现类 + * + * @author HUIHUI + */ +@Slf4j +@Component +public class DeptParseFunction implements IParseFunction { + + public static final String NAME = "getDeptById"; + + @Resource + private DeptService deptService; + + @Override + public String functionName() { + return NAME; + } + + @Override + public String apply(Object value) { + if (StrUtil.isEmptyIfStr(value)) { + return ""; + } + + // 获取部门信息 + DeptDO dept = deptService.getDept(Convert.toLong(value)); + if (dept == null) { + log.warn("[apply][获取部门{{}}为空", value); + return ""; + } + return dept.getName(); + } + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/framework/operatelog/core/PostParseFunction.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/framework/operatelog/core/PostParseFunction.java new file mode 100644 index 0000000..62c9b5b --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/framework/operatelog/core/PostParseFunction.java @@ -0,0 +1,47 @@ +package com.platform.marketing.module.system.framework.operatelog.core; + +import cn.hutool.core.convert.Convert; +import cn.hutool.core.util.StrUtil; +import com.platform.marketing.module.system.domain.dataobject.PostDO; +import com.platform.marketing.module.system.service.PostService; +import com.mzt.logapi.service.IParseFunction; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; + +/** + * 岗位名字的 {@link IParseFunction} 实现类 + * + * @author HUIHUI + */ +@Slf4j +@Component +public class PostParseFunction implements IParseFunction { + + public static final String NAME = "getPostById"; + + @Resource + private PostService postService; + + @Override + public String functionName() { + return NAME; + } + + @Override + public String apply(Object value) { + if (StrUtil.isEmptyIfStr(value)) { + return ""; + } + + // 获取岗位信息 + PostDO post = postService.getPost(Convert.toLong(value)); + if (post == null) { + log.warn("[apply][获取岗位{{}}为空", value); + return ""; + } + return post.getName(); + } + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/framework/operatelog/core/SexParseFunction.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/framework/operatelog/core/SexParseFunction.java new file mode 100644 index 0000000..0367051 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/framework/operatelog/core/SexParseFunction.java @@ -0,0 +1,39 @@ +package com.platform.marketing.module.system.framework.operatelog.core; + +import cn.hutool.core.util.StrUtil; +import com.platform.marketing.framework.dict.core.DictFrameworkUtils; +import com.platform.marketing.module.system.domain.enums.DictTypeConstants; +import com.mzt.logapi.service.IParseFunction; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +/** + * 行业的 {@link IParseFunction} 实现类 + * + * @author HUIHUI + */ +@Component +@Slf4j +public class SexParseFunction implements IParseFunction { + + public static final String NAME = "getSex"; + + @Override + public boolean executeBefore() { + return true; // 先转换值后对比 + } + + @Override + public String functionName() { + return NAME; + } + + @Override + public String apply(Object value) { + if (StrUtil.isEmptyIfStr(value)) { + return ""; + } + return DictFrameworkUtils.getDictDataLabel(DictTypeConstants.USER_SEX, value.toString()); + } + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/framework/operatelog/core/dto/OperateLogCreateReqDTO.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/framework/operatelog/core/dto/OperateLogCreateReqDTO.java new file mode 100644 index 0000000..9b11632 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/framework/operatelog/core/dto/OperateLogCreateReqDTO.java @@ -0,0 +1,92 @@ +package com.platform.marketing.module.system.framework.operatelog.core.dto; + +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; + +/** + * 系统操作日志 Create Request DTO + * @author HUIHUI + */ +@Data +public class OperateLogCreateReqDTO { + + /** + * 链路追踪编号 + * + * 一般来说,通过链路追踪编号,可以将访问日志,错误日志,链路追踪日志,logger 打印日志等,结合在一起,从而进行排错。 + */ + private String traceId; + /** + * 用户编号 + * + * 关联 MemberUserDO 的 id 属性,或者 AdminUserDO 的 id 属性 + */ + @NotNull(message = "用户编号不能为空") + private Long userId; + + /** + * 用户类型 + * + * 关联 {@link com.platform.magic.framework.common.enums.UserTypeEnum} + */ + @NotNull(message = "用户类型不能为空") + private Integer userType; + + /** + * 操作模块类型 + */ + @NotEmpty(message = "操作模块类型不能为空") + private String type; + + /** + * 操作名 + */ + @NotEmpty(message = "操作名不能为空") + private String subType; + + /** + * 操作模块业务编号 + */ + @NotNull(message = "操作模块业务编号不能为空") + private Long bizId; + + /** + * 操作内容,记录整个操作的明细 + * 例如说,修改编号为 1 的用户信息,将性别从男改成女,将姓名从芋道改成源码。 + */ + @NotEmpty(message = "操作内容不能为空") + private String action; + + /** + * 拓展字段,有些复杂的业务,需要记录一些字段 ( JSON 格式 ) + * 例如说,记录订单编号,{ orderId: "1"} + */ + private String extra; + + /** + * 请求方法名 + */ + @NotEmpty(message = "请求方法名不能为空") + private String requestMethod; + + /** + * 请求地址 + */ + @NotEmpty(message = "请求地址不能为空") + private String requestUrl; + + /** + * 用户 IP + */ + @NotEmpty(message = "用户 IP 不能为空") + private String userIp; + + /** + * 浏览器 UA + */ + @NotEmpty(message = "浏览器 UA 不能为空") + private String userAgent; + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/framework/operatelog/core/service/LogRecordServiceImpl.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/framework/operatelog/core/service/LogRecordServiceImpl.java new file mode 100644 index 0000000..fe26344 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/framework/operatelog/core/service/LogRecordServiceImpl.java @@ -0,0 +1,89 @@ +package com.platform.marketing.module.system.framework.operatelog.core.service; + +import com.platform.marketing.framework.common.util.monitor.TracerUtils; +import com.platform.marketing.framework.common.util.servlet.ServletUtils; +import com.platform.marketing.framework.security.core.LoginUser; +import com.platform.marketing.framework.security.core.util.SecurityFrameworkUtils; +import com.platform.marketing.module.system.framework.operatelog.core.dto.OperateLogCreateReqDTO; +import com.platform.marketing.module.system.service.OperateLogService; +import com.mzt.logapi.beans.LogRecord; +import com.mzt.logapi.service.ILogRecordService; +import lombok.extern.slf4j.Slf4j; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import java.util.List; + +/** + * 操作日志 ILogRecordService 实现类 + * + * @author HUIHUI + */ +@Slf4j +public class LogRecordServiceImpl implements ILogRecordService { + + @Resource + private OperateLogService operateLogService; + + @Override + public void record(LogRecord logRecord) { + OperateLogCreateReqDTO reqDTO = new OperateLogCreateReqDTO(); + try { + reqDTO.setTraceId(TracerUtils.getTraceId()); + // 补充用户信息 + fillUserFields(reqDTO); + // 补全模块信息 + fillModuleFields(reqDTO, logRecord); + // 补全请求信息 + fillRequestFields(reqDTO); + + // 2. 异步记录日志 + operateLogService.createOperateLog(reqDTO); + } catch (Throwable ex) { + // 由于 异步调用,这里打印下日志,更容易跟进 + log.error("[record][url({}) log({}) 发生异常]", reqDTO.getRequestUrl(), reqDTO, ex); + } + } + + private static void fillUserFields(OperateLogCreateReqDTO reqDTO) { + // 使用 SecurityFrameworkUtils。因为要考虑,rpc、mq、job,它其实不是 web; + LoginUser loginUser = SecurityFrameworkUtils.getLoginUser(); + if (loginUser == null) { + return; + } + reqDTO.setUserId(loginUser.getId()); + reqDTO.setUserType(loginUser.getUserType()); + } + + public static void fillModuleFields(OperateLogCreateReqDTO reqDTO, LogRecord logRecord) { + reqDTO.setType(logRecord.getType()); // 大模块类型,例如:CRM 客户 + reqDTO.setSubType(logRecord.getSubType());// 操作名称,例如:转移客户 + reqDTO.setBizId(Long.parseLong(logRecord.getBizNo())); // 业务编号,例如:客户编号 + reqDTO.setAction(logRecord.getAction());// 操作内容,例如:修改编号为 1 的用户信息,将性别从男改成女,将姓名从芋道改成源码。 + reqDTO.setExtra(logRecord.getExtra()); // 拓展字段,有些复杂的业务,需要记录一些字段 ( JSON 格式 ),例如说,记录订单编号,{ orderId: "1"} + } + + private static void fillRequestFields(OperateLogCreateReqDTO reqDTO) { + // 获得 Request 对象 + HttpServletRequest request = ServletUtils.getRequest(); + if (request == null) { + return; + } + // 补全请求信息 + reqDTO.setRequestMethod(request.getMethod()); + reqDTO.setRequestUrl(request.getRequestURI()); + reqDTO.setUserIp(ServletUtils.getClientIP(request)); + reqDTO.setUserAgent(ServletUtils.getUserAgent(request)); + } + + @Override + public List queryLog(String bizNo, String type) { + throw new UnsupportedOperationException("使用 OperateLogApi 进行操作日志的查询"); + } + + @Override + public List queryLogByBizNo(String bizNo, String type, String subType) { + throw new UnsupportedOperationException("使用 OperateLogApi 进行操作日志的查询"); + } + +} \ No newline at end of file diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/framework/web/adapter/SystemDictDataAdapter.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/framework/web/adapter/SystemDictDataAdapter.java new file mode 100644 index 0000000..919dbad --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/framework/web/adapter/SystemDictDataAdapter.java @@ -0,0 +1,48 @@ +package com.platform.marketing.module.system.framework.web.adapter; + +import com.platform.marketing.framework.common.util.object.BeanUtils; +import com.platform.marketing.framework.dict.core.adapter.DictDataAdapter; +import com.platform.marketing.framework.dict.core.dto.DictDataRespDTO; +import com.platform.marketing.module.system.domain.dataobject.DictDataDO; +import com.platform.marketing.module.system.service.DictDataService; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.Collection; +import java.util.List; + +/** + * 字典数据 API 实现类 + * + + */ +@Service +public class SystemDictDataAdapter implements DictDataAdapter { + + @Resource + private DictDataService dictDataService; + + @Override + public void validateDictDataList(String dictType, Collection values) { + dictDataService.validateDictDataList(dictType, values); + } + + @Override + public DictDataRespDTO getDictData(String dictType, String value) { + DictDataDO dictData = dictDataService.getDictData(dictType, value); + return BeanUtils.toBean(dictData, DictDataRespDTO.class); + } + + @Override + public DictDataRespDTO parseDictData(String dictType, String label) { + DictDataDO dictData = dictDataService.parseDictData(dictType, label); + return BeanUtils.toBean(dictData, DictDataRespDTO.class); + } + + @Override + public List getDictDataList(String dictType) { + List list = dictDataService.getDictDataListByDictType(dictType); + return BeanUtils.toBean(list, DictDataRespDTO.class); + } + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/framework/web/adapter/SystemPermissionAdapter.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/framework/web/adapter/SystemPermissionAdapter.java new file mode 100644 index 0000000..9b89ef1 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/framework/web/adapter/SystemPermissionAdapter.java @@ -0,0 +1,39 @@ +package com.platform.marketing.module.system.framework.web.adapter; + +import com.platform.marketing.framework.security.core.adapter.PermissionAdapter; +import com.platform.marketing.framework.security.core.dto.DeptDataPermissionRespDTO; +import com.platform.marketing.module.system.service.PermissionService; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.util.Collection; +import java.util.Set; + +/** + * 权限 API 实现类 + * + + */ +@Component +public class SystemPermissionAdapter implements PermissionAdapter { + + @Resource + private PermissionService permissionService; + + public Set getUserRoleIdListByRoleIds(Collection roleIds) { + return permissionService.getUserRoleIdListByRoleId(roleIds); + } + + public boolean hasAnyPermissions(Long userId, String... permissions) { + return permissionService.hasAnyPermissions(userId, permissions); + } + + public boolean hasAnyRoles(Long userId, String... roles) { + return permissionService.hasAnyRoles(userId, roles); + } + + public DeptDataPermissionRespDTO getDeptDataPermission(Long userId) { + return permissionService.getDeptDataPermission(userId); + } + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/framework/web/config/SystemWebConfiguration.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/framework/web/config/SystemWebConfiguration.java new file mode 100644 index 0000000..5c75838 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/framework/web/config/SystemWebConfiguration.java @@ -0,0 +1,24 @@ +package com.platform.marketing.module.system.framework.web.config; + +import com.platform.marketing.framework.swagger.config.MarketingSwaggerAutoConfiguration; +import org.springdoc.core.GroupedOpenApi; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * system 模块的 web 组件的 Configuration + * + + */ +@Configuration(proxyBeanMethods = false) +public class SystemWebConfiguration { + + /** + * system 模块的 API 分组 + */ + @Bean + public GroupedOpenApi systemGroupedOpenApi() { + return MarketingSwaggerAutoConfiguration.buildGroupedOpenApi("system"); + } + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/job/DemoJob.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/job/DemoJob.java new file mode 100644 index 0000000..d03812e --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/job/DemoJob.java @@ -0,0 +1,23 @@ +package com.platform.marketing.module.system.job; + +import com.platform.marketing.framework.quartz.core.handler.JobHandler; +import com.platform.marketing.module.system.domain.dataobject.AdminUserDO; +import com.platform.marketing.module.system.mapper.AdminUserMapper; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.util.List; + +@Component +public class DemoJob implements JobHandler { + + @Resource + private AdminUserMapper adminUserMapper; + + @Override + public String execute(String param) { + List users = adminUserMapper.selectList(); + return "用户数量:" + users.size(); + } + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/mapper/AdminUserMapper.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/mapper/AdminUserMapper.java new file mode 100644 index 0000000..43b0113 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/mapper/AdminUserMapper.java @@ -0,0 +1,51 @@ +package com.platform.marketing.module.system.mapper; + +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.mybatis.core.mapper.BaseMapperX; +import com.platform.marketing.framework.mybatis.core.query.LambdaQueryWrapperX; +import com.platform.marketing.module.system.domain.vo.UserPageReqVO; +import com.platform.marketing.module.system.domain.dataobject.AdminUserDO; +import org.apache.ibatis.annotations.Mapper; + +import java.util.Collection; +import java.util.List; + +@Mapper +public interface AdminUserMapper extends BaseMapperX { + + default AdminUserDO selectByUsername(String username) { + return selectOne(AdminUserDO::getUsername, username); + } + + default AdminUserDO selectByEmail(String email) { + return selectOne(AdminUserDO::getEmail, email); + } + + default AdminUserDO selectByMobile(String mobile) { + return selectOne(AdminUserDO::getMobile, mobile); + } + + default PageResult selectPage(UserPageReqVO reqVO, Collection deptIds, Collection userIds) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .likeIfPresent(AdminUserDO::getUsername, reqVO.getUsername()) + .likeIfPresent(AdminUserDO::getMobile, reqVO.getMobile()) + .eqIfPresent(AdminUserDO::getStatus, reqVO.getStatus()) + .betweenIfPresent(AdminUserDO::getCreateTime, reqVO.getCreateTime()) + .inIfPresent(AdminUserDO::getDeptId, deptIds) + .inIfPresent(AdminUserDO::getId, userIds) + .orderByDesc(AdminUserDO::getId)); + } + + default List selectListByNickname(String nickname) { + return selectList(new LambdaQueryWrapperX().like(AdminUserDO::getNickname, nickname)); + } + + default List selectListByStatus(Integer status) { + return selectList(AdminUserDO::getStatus, status); + } + + default List selectListByDeptIds(Collection deptIds) { + return selectList(AdminUserDO::getDeptId, deptIds); + } + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/mapper/DeptMapper.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/mapper/DeptMapper.java new file mode 100644 index 0000000..5f43e77 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/mapper/DeptMapper.java @@ -0,0 +1,37 @@ +package com.platform.marketing.module.system.mapper; + +import com.platform.marketing.framework.mybatis.core.mapper.BaseMapperX; +import com.platform.marketing.framework.mybatis.core.query.LambdaQueryWrapperX; +import com.platform.marketing.module.system.domain.vo.DeptListReqVO; +import com.platform.marketing.module.system.domain.dataobject.DeptDO; +import org.apache.ibatis.annotations.Mapper; + +import java.util.Collection; +import java.util.List; + +@Mapper +public interface DeptMapper extends BaseMapperX { + + default List selectList(DeptListReqVO reqVO) { + return selectList(new LambdaQueryWrapperX() + .likeIfPresent(DeptDO::getName, reqVO.getName()) + .eqIfPresent(DeptDO::getStatus, reqVO.getStatus())); + } + + default DeptDO selectByParentIdAndName(Long parentId, String name) { + return selectOne(DeptDO::getParentId, parentId, DeptDO::getName, name); + } + + default Long selectCountByParentId(Long parentId) { + return selectCount(DeptDO::getParentId, parentId); + } + + default List selectListByParentId(Collection parentIds) { + return selectList(DeptDO::getParentId, parentIds); + } + + default List selectListByLeaderUserId(Long id) { + return selectList(DeptDO::getLeaderUserId, id); + } + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/mapper/DictDataMapper.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/mapper/DictDataMapper.java new file mode 100644 index 0000000..2114beb --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/mapper/DictDataMapper.java @@ -0,0 +1,49 @@ +package com.platform.marketing.module.system.mapper; + +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.mybatis.core.mapper.BaseMapperX; +import com.platform.marketing.framework.mybatis.core.query.LambdaQueryWrapperX; +import com.platform.marketing.module.system.domain.vo.DictDataPageReqVO; +import com.platform.marketing.module.system.domain.dataobject.DictDataDO; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import org.apache.ibatis.annotations.Mapper; + +import java.util.Arrays; +import java.util.Collection; +import java.util.List; + +@Mapper +public interface DictDataMapper extends BaseMapperX { + + default DictDataDO selectByDictTypeAndValue(String dictType, String value) { + return selectOne(DictDataDO::getDictType, dictType, DictDataDO::getValue, value); + } + + default DictDataDO selectByDictTypeAndLabel(String dictType, String label) { + return selectOne(DictDataDO::getDictType, dictType, DictDataDO::getLabel, label); + } + + default List selectByDictTypeAndValues(String dictType, Collection values) { + return selectList(new LambdaQueryWrapper().eq(DictDataDO::getDictType, dictType) + .in(DictDataDO::getValue, values)); + } + + default long selectCountByDictType(String dictType) { + return selectCount(DictDataDO::getDictType, dictType); + } + + default PageResult selectPage(DictDataPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .likeIfPresent(DictDataDO::getLabel, reqVO.getLabel()) + .eqIfPresent(DictDataDO::getDictType, reqVO.getDictType()) + .eqIfPresent(DictDataDO::getStatus, reqVO.getStatus()) + .orderByDesc(Arrays.asList(DictDataDO::getDictType, DictDataDO::getSort))); + } + + default List selectListByStatusAndDictType(Integer status, String dictType) { + return selectList(new LambdaQueryWrapperX() + .eqIfPresent(DictDataDO::getStatus, status) + .eqIfPresent(DictDataDO::getDictType, dictType)); + } + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/mapper/DictTypeMapper.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/mapper/DictTypeMapper.java new file mode 100644 index 0000000..d97f525 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/mapper/DictTypeMapper.java @@ -0,0 +1,37 @@ +package com.platform.marketing.module.system.mapper; + +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.mybatis.core.mapper.BaseMapperX; +import com.platform.marketing.framework.mybatis.core.query.LambdaQueryWrapperX; +import com.platform.marketing.module.system.domain.vo.DictTypePageReqVO; +import com.platform.marketing.module.system.domain.dataobject.DictTypeDO; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Update; + +import java.time.LocalDateTime; + +@Mapper +public interface DictTypeMapper extends BaseMapperX { + + default PageResult selectPage(DictTypePageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .likeIfPresent(DictTypeDO::getName, reqVO.getName()) + .likeIfPresent(DictTypeDO::getType, reqVO.getType()) + .eqIfPresent(DictTypeDO::getStatus, reqVO.getStatus()) + .betweenIfPresent(DictTypeDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(DictTypeDO::getId)); + } + + default DictTypeDO selectByType(String type) { + return selectOne(DictTypeDO::getType, type); + } + + default DictTypeDO selectByName(String name) { + return selectOne(DictTypeDO::getName, name); + } + + @Update("UPDATE system_dict_type SET deleted = 1, deleted_time = #{deletedTime} WHERE id = #{id}") + void updateToDelete(@Param("id") Long id, @Param("deletedTime") LocalDateTime deletedTime); + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/mapper/LoginLogMapper.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/mapper/LoginLogMapper.java new file mode 100644 index 0000000..665786d --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/mapper/LoginLogMapper.java @@ -0,0 +1,28 @@ +package com.platform.marketing.module.system.mapper; + +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.mybatis.core.mapper.BaseMapperX; +import com.platform.marketing.framework.mybatis.core.query.LambdaQueryWrapperX; +import com.platform.marketing.module.system.domain.vo.LoginLogPageReqVO; +import com.platform.marketing.module.system.domain.dataobject.LoginLogDO; +import com.platform.marketing.module.system.domain.enums.LoginResultEnum; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface LoginLogMapper extends BaseMapperX { + + default PageResult selectPage(LoginLogPageReqVO reqVO) { + LambdaQueryWrapperX query = new LambdaQueryWrapperX() + .likeIfPresent(LoginLogDO::getUserIp, reqVO.getUserIp()) + .likeIfPresent(LoginLogDO::getUsername, reqVO.getUsername()) + .betweenIfPresent(LoginLogDO::getCreateTime, reqVO.getCreateTime()); + if (Boolean.TRUE.equals(reqVO.getStatus())) { + query.eq(LoginLogDO::getResult, LoginResultEnum.SUCCESS.getResult()); + } else if (Boolean.FALSE.equals(reqVO.getStatus())) { + query.gt(LoginLogDO::getResult, LoginResultEnum.SUCCESS.getResult()); + } + query.orderByDesc(LoginLogDO::getId); // 降序 + return selectPage(reqVO, query); + } + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/mapper/MenuMapper.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/mapper/MenuMapper.java new file mode 100644 index 0000000..a732d6d --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/mapper/MenuMapper.java @@ -0,0 +1,36 @@ +package com.platform.marketing.module.system.mapper; + +import com.platform.marketing.framework.mybatis.core.mapper.BaseMapperX; +import com.platform.marketing.framework.mybatis.core.query.LambdaQueryWrapperX; +import com.platform.marketing.module.system.domain.vo.MenuListReqVO; +import com.platform.marketing.module.system.domain.dataobject.MenuDO; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +@Mapper +public interface MenuMapper extends BaseMapperX { + + default MenuDO selectByParentIdAndName(Long parentId, String name) { + return selectOne(MenuDO::getParentId, parentId, MenuDO::getName, name); + } + + default Long selectCountByParentId(Long parentId) { + return selectCount(MenuDO::getParentId, parentId); + } + + default List selectList(MenuListReqVO reqVO) { + return selectList(new LambdaQueryWrapperX() + .likeIfPresent(MenuDO::getName, reqVO.getName()) + .eqIfPresent(MenuDO::getStatus, reqVO.getStatus())); + } + + default List selectListByPermission(String permission) { + return selectList(MenuDO::getPermission, permission); + } + + default MenuDO selectByComponentName(String componentName) { + return selectOne(MenuDO::getComponentName, componentName); + } + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/mapper/NoticeMapper.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/mapper/NoticeMapper.java new file mode 100644 index 0000000..1e94c78 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/mapper/NoticeMapper.java @@ -0,0 +1,20 @@ +package com.platform.marketing.module.system.mapper; + +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.mybatis.core.mapper.BaseMapperX; +import com.platform.marketing.framework.mybatis.core.query.LambdaQueryWrapperX; +import com.platform.marketing.module.system.domain.vo.NoticePageReqVO; +import com.platform.marketing.module.system.domain.dataobject.NoticeDO; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface NoticeMapper extends BaseMapperX { + + default PageResult selectPage(NoticePageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .likeIfPresent(NoticeDO::getTitle, reqVO.getTitle()) + .eqIfPresent(NoticeDO::getStatus, reqVO.getStatus()) + .orderByDesc(NoticeDO::getId)); + } + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/mapper/OperateLogMapper.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/mapper/OperateLogMapper.java new file mode 100644 index 0000000..f2d1cf5 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/mapper/OperateLogMapper.java @@ -0,0 +1,24 @@ +package com.platform.marketing.module.system.mapper; + +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.mybatis.core.mapper.BaseMapperX; +import com.platform.marketing.framework.mybatis.core.query.LambdaQueryWrapperX; +import com.platform.marketing.module.system.domain.vo.OperateLogPageReqVO; +import com.platform.marketing.module.system.domain.dataobject.OperateLogDO; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface OperateLogMapper extends BaseMapperX { + + default PageResult selectPage(OperateLogPageReqVO pageReqDTO) { + return selectPage(pageReqDTO, new LambdaQueryWrapperX() + .eqIfPresent(OperateLogDO::getUserId, pageReqDTO.getUserId()) + .eqIfPresent(OperateLogDO::getBizId, pageReqDTO.getBizId()) + .likeIfPresent(OperateLogDO::getType, pageReqDTO.getType()) + .likeIfPresent(OperateLogDO::getSubType, pageReqDTO.getSubType()) + .likeIfPresent(OperateLogDO::getAction, pageReqDTO.getAction()) + .betweenIfPresent(OperateLogDO::getCreateTime, pageReqDTO.getCreateTime()) + .orderByDesc(OperateLogDO::getId)); + } + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/mapper/PostMapper.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/mapper/PostMapper.java new file mode 100644 index 0000000..282c720 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/mapper/PostMapper.java @@ -0,0 +1,38 @@ +package com.platform.marketing.module.system.mapper; + +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.mybatis.core.mapper.BaseMapperX; +import com.platform.marketing.framework.mybatis.core.query.LambdaQueryWrapperX; +import com.platform.marketing.module.system.domain.vo.PostPageReqVO; +import com.platform.marketing.module.system.domain.dataobject.PostDO; +import org.apache.ibatis.annotations.Mapper; + +import java.util.Collection; +import java.util.List; + +@Mapper +public interface PostMapper extends BaseMapperX { + + default List selectList(Collection ids, Collection statuses) { + return selectList(new LambdaQueryWrapperX() + .inIfPresent(PostDO::getId, ids) + .inIfPresent(PostDO::getStatus, statuses)); + } + + default PageResult selectPage(PostPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .likeIfPresent(PostDO::getCode, reqVO.getCode()) + .likeIfPresent(PostDO::getName, reqVO.getName()) + .eqIfPresent(PostDO::getStatus, reqVO.getStatus()) + .orderByDesc(PostDO::getId)); + } + + default PostDO selectByName(String name) { + return selectOne(PostDO::getName, name); + } + + default PostDO selectByCode(String code) { + return selectOne(PostDO::getCode, code); + } + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/mapper/RoleMapper.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/mapper/RoleMapper.java new file mode 100644 index 0000000..25e6da3 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/mapper/RoleMapper.java @@ -0,0 +1,39 @@ +package com.platform.marketing.module.system.mapper; + +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.mybatis.core.dataobject.BaseDO; +import com.platform.marketing.framework.mybatis.core.mapper.BaseMapperX; +import com.platform.marketing.framework.mybatis.core.query.LambdaQueryWrapperX; +import com.platform.marketing.module.system.domain.vo.RolePageReqVO; +import com.platform.marketing.module.system.domain.dataobject.RoleDO; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.lang.Nullable; + +import java.util.Collection; +import java.util.List; + +@Mapper +public interface RoleMapper extends BaseMapperX { + + default PageResult selectPage(RolePageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .likeIfPresent(RoleDO::getName, reqVO.getName()) + .likeIfPresent(RoleDO::getCode, reqVO.getCode()) + .eqIfPresent(RoleDO::getStatus, reqVO.getStatus()) + .betweenIfPresent(BaseDO::getCreateTime, reqVO.getCreateTime()) + .orderByAsc(RoleDO::getSort)); + } + + default RoleDO selectByName(String name) { + return selectOne(RoleDO::getName, name); + } + + default RoleDO selectByCode(String code) { + return selectOne(RoleDO::getCode, code); + } + + default List selectListByStatus(@Nullable Collection statuses) { + return selectList(RoleDO::getStatus, statuses); + } + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/mapper/RoleMenuMapper.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/mapper/RoleMenuMapper.java new file mode 100644 index 0000000..314cb6a --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/mapper/RoleMenuMapper.java @@ -0,0 +1,40 @@ +package com.platform.marketing.module.system.mapper; + +import com.platform.marketing.framework.mybatis.core.mapper.BaseMapperX; +import com.platform.marketing.module.system.domain.dataobject.RoleMenuDO; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import org.apache.ibatis.annotations.Mapper; + +import java.util.Collection; +import java.util.List; + +@Mapper +public interface RoleMenuMapper extends BaseMapperX { + + default List selectListByRoleId(Long roleId) { + return selectList(RoleMenuDO::getRoleId, roleId); + } + + default List selectListByRoleId(Collection roleIds) { + return selectList(RoleMenuDO::getRoleId, roleIds); + } + + default List selectListByMenuId(Long menuId) { + return selectList(RoleMenuDO::getMenuId, menuId); + } + + default void deleteListByRoleIdAndMenuIds(Long roleId, Collection menuIds) { + delete(new LambdaQueryWrapper() + .eq(RoleMenuDO::getRoleId, roleId) + .in(RoleMenuDO::getMenuId, menuIds)); + } + + default void deleteListByMenuId(Long menuId) { + delete(new LambdaQueryWrapper().eq(RoleMenuDO::getMenuId, menuId)); + } + + default void deleteListByRoleId(Long roleId) { + delete(new LambdaQueryWrapper().eq(RoleMenuDO::getRoleId, roleId)); + } + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/mapper/TenantPackageMapper.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/mapper/TenantPackageMapper.java new file mode 100644 index 0000000..5a8cecb --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/mapper/TenantPackageMapper.java @@ -0,0 +1,36 @@ +package com.platform.marketing.module.system.mapper; + +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.mybatis.core.mapper.BaseMapperX; +import com.platform.marketing.framework.mybatis.core.query.LambdaQueryWrapperX; +import com.platform.marketing.module.system.domain.vo.TenantPackagePageReqVO; +import com.platform.marketing.module.system.domain.dataobject.TenantPackageDO; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * 租户套餐 Mapper + * + + */ +@Mapper +public interface TenantPackageMapper extends BaseMapperX { + + default PageResult selectPage(TenantPackagePageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .likeIfPresent(TenantPackageDO::getName, reqVO.getName()) + .eqIfPresent(TenantPackageDO::getStatus, reqVO.getStatus()) + .likeIfPresent(TenantPackageDO::getRemark, reqVO.getRemark()) + .betweenIfPresent(TenantPackageDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(TenantPackageDO::getId)); + } + + default List selectListByStatus(Integer status) { + return selectList(TenantPackageDO::getStatus, status); + } + + default TenantPackageDO selectByName(String name) { + return selectOne(TenantPackageDO::getName, name); + } +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/mapper/UserPostMapper.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/mapper/UserPostMapper.java new file mode 100644 index 0000000..7cce74f --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/mapper/UserPostMapper.java @@ -0,0 +1,32 @@ +package com.platform.marketing.module.system.mapper; + +import com.platform.marketing.framework.mybatis.core.mapper.BaseMapperX; +import com.platform.marketing.framework.mybatis.core.query.LambdaQueryWrapperX; +import com.platform.marketing.module.system.domain.dataobject.UserPostDO; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import org.apache.ibatis.annotations.Mapper; + +import java.util.Collection; +import java.util.List; + +@Mapper +public interface UserPostMapper extends BaseMapperX { + + default List selectListByUserId(Long userId) { + return selectList(UserPostDO::getUserId, userId); + } + + default void deleteByUserIdAndPostId(Long userId, Collection postIds) { + delete(new LambdaQueryWrapperX() + .eq(UserPostDO::getUserId, userId) + .in(UserPostDO::getPostId, postIds)); + } + + default List selectListByPostIds(Collection postIds) { + return selectList(UserPostDO::getPostId, postIds); + } + + default void deleteByUserId(Long userId) { + delete(Wrappers.lambdaUpdate(UserPostDO.class).eq(UserPostDO::getUserId, userId)); + } +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/mapper/UserRoleMapper.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/mapper/UserRoleMapper.java new file mode 100644 index 0000000..443ac8c --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/mapper/UserRoleMapper.java @@ -0,0 +1,36 @@ +package com.platform.marketing.module.system.mapper; + +import com.platform.marketing.framework.mybatis.core.mapper.BaseMapperX; +import com.platform.marketing.module.system.domain.dataobject.UserRoleDO; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import org.apache.ibatis.annotations.Mapper; + +import java.util.Collection; +import java.util.List; + +@Mapper +public interface UserRoleMapper extends BaseMapperX { + + default List selectListByUserId(Long userId) { + return selectList(UserRoleDO::getUserId, userId); + } + + default void deleteListByUserIdAndRoleIdIds(Long userId, Collection roleIds) { + delete(new LambdaQueryWrapper() + .eq(UserRoleDO::getUserId, userId) + .in(UserRoleDO::getRoleId, roleIds)); + } + + default void deleteListByUserId(Long userId) { + delete(new LambdaQueryWrapper().eq(UserRoleDO::getUserId, userId)); + } + + default void deleteListByRoleId(Long roleId) { + delete(new LambdaQueryWrapper().eq(UserRoleDO::getRoleId, roleId)); + } + + default List selectListByRoleIds(Collection roleIds) { + return selectList(UserRoleDO::getRoleId, roleIds); + } + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/service/AdminAuthService.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/service/AdminAuthService.java new file mode 100644 index 0000000..e27c94a --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/service/AdminAuthService.java @@ -0,0 +1,65 @@ +package com.platform.marketing.module.system.service; + +import com.platform.marketing.module.system.domain.dataobject.AdminUserDO; +import com.platform.marketing.module.system.domain.vo.AuthLoginReqVO; +import com.platform.marketing.module.system.domain.vo.AuthLoginRespVO; +import com.platform.marketing.module.system.domain.vo.AuthRegisterReqVO; +import com.platform.marketing.module.system.domain.vo.AuthResetPasswordReqVO; + +import javax.validation.Valid; + +/** + * 管理后台的认证 Service 接口 + * 提供用户的登录、登出的能力 + */ +public interface AdminAuthService { + + /** + * 验证账号 + 密码。如果通过,则返回用户 + * + * @param username 账号 + * @param password 密码 + * @return 用户 + */ + AdminUserDO authenticate(String username, String password); + + /** + * 账号登录 + * + * @param reqVO 登录信息 + * @return 登录结果 + */ + AuthLoginRespVO login(@Valid AuthLoginReqVO reqVO); + + /** + * 基于 token 退出登录 + * + * @param token token + * @param logType 登出类型 + */ + void logout(String token, Integer logType); + + /** + * 刷新访问令牌 + * + * @param refreshToken 刷新令牌 + * @return 登录结果 + */ + AuthLoginRespVO refreshToken(String refreshToken); + + /** + * 用户注册 + * + * @param createReqVO 注册用户 + * @return 注册结果 + */ + AuthLoginRespVO register(AuthRegisterReqVO createReqVO); + + /** + * 重置密码 + * + * @param reqVO 验证码信息 + */ + void resetPassword(AuthResetPasswordReqVO reqVO); + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/service/AdminUserService.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/service/AdminUserService.java new file mode 100644 index 0000000..d55d0d7 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/service/AdminUserService.java @@ -0,0 +1,219 @@ +package com.platform.marketing.module.system.service; + +import cn.hutool.core.collection.CollUtil; +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.common.util.collection.CollectionUtils; +import com.platform.marketing.module.system.domain.vo.AuthRegisterReqVO; +import com.platform.marketing.module.system.domain.vo.UserProfileUpdatePasswordReqVO; +import com.platform.marketing.module.system.domain.vo.UserProfileUpdateReqVO; +import com.platform.marketing.module.system.domain.vo.UserImportExcelVO; +import com.platform.marketing.module.system.domain.vo.UserImportRespVO; +import com.platform.marketing.module.system.domain.vo.UserPageReqVO; +import com.platform.marketing.module.system.domain.vo.UserSaveReqVO; +import com.platform.marketing.module.system.domain.dataobject.AdminUserDO; + +import javax.validation.Valid; +import java.io.InputStream; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 后台用户 Service 接口 + * + + */ +public interface AdminUserService { + + /** + * 创建用户 + * + * @param createReqVO 用户信息 + * @return 用户编号 + */ + Long createUser(@Valid UserSaveReqVO createReqVO); + + /** + * 注册用户 + * + * @param registerReqVO 用户信息 + * @return 用户编号 + */ + Long registerUser(@Valid AuthRegisterReqVO registerReqVO); + + /** + * 修改用户 + * + * @param updateReqVO 用户信息 + */ + void updateUser(@Valid UserSaveReqVO updateReqVO); + + /** + * 更新用户的最后登陆信息 + * + * @param id 用户编号 + * @param loginIp 登陆 IP + */ + void updateUserLogin(Long id, String loginIp); + + /** + * 修改用户个人信息 + * + * @param id 用户编号 + * @param reqVO 用户个人信息 + */ + void updateUserProfile(Long id, @Valid UserProfileUpdateReqVO reqVO); + + /** + * 修改用户个人密码 + * + * @param id 用户编号 + * @param reqVO 更新用户个人密码 + */ + void updateUserPassword(Long id, @Valid UserProfileUpdatePasswordReqVO reqVO); + + /** + * 更新用户头像 + * + * @param id 用户 id + * @param avatarFile 头像文件 + */ + String updateUserAvatar(Long id, InputStream avatarFile) throws Exception; + + /** + * 修改密码 + * + * @param id 用户编号 + * @param password 密码 + */ + void updateUserPassword(Long id, String password); + + /** + * 修改状态 + * + * @param id 用户编号 + * @param status 状态 + */ + void updateUserStatus(Long id, Integer status); + + /** + * 删除用户 + * + * @param id 用户编号 + */ + void deleteUser(Long id); + + /** + * 通过用户名查询用户 + * + * @param username 用户名 + * @return 用户对象信息 + */ + AdminUserDO getUserByUsername(String username); + + /** + * 通过手机号获取用户 + * + * @param mobile 手机号 + * @return 用户对象信息 + */ + AdminUserDO getUserByMobile(String mobile); + + /** + * 获得用户分页列表 + * + * @param reqVO 分页条件 + * @return 分页列表 + */ + PageResult getUserPage(UserPageReqVO reqVO); + + /** + * 通过用户 ID 查询用户 + * + * @param id 用户ID + * @return 用户对象信息 + */ + AdminUserDO getUser(Long id); + + /** + * 获得指定部门的用户数组 + * + * @param deptIds 部门数组 + * @return 用户数组 + */ + List getUserListByDeptIds(Collection deptIds); + + /** + * 获得指定岗位的用户数组 + * + * @param postIds 岗位数组 + * @return 用户数组 + */ + List getUserListByPostIds(Collection postIds); + + /** + * 获得用户列表 + * + * @param ids 用户编号数组 + * @return 用户列表 + */ + List getUserList(Collection ids); + + /** + * 校验用户们是否有效。如下情况,视为无效: + * 1. 用户编号不存在 + * 2. 用户被禁用 + * + * @param ids 用户编号数组 + */ + void validateUserList(Collection ids); + + /** + * 获得用户 Map + * + * @param ids 用户编号数组 + * @return 用户 Map + */ + default Map getUserMap(Collection ids) { + if (CollUtil.isEmpty(ids)) { + return new HashMap<>(); + } + return CollectionUtils.convertMap(getUserList(ids), AdminUserDO::getId); + } + + /** + * 获得用户列表,基于昵称模糊匹配 + * + * @param nickname 昵称 + * @return 用户列表 + */ + List getUserListByNickname(String nickname); + + /** + * 批量导入用户 + * + * @param importUsers 导入用户列表 + * @param isUpdateSupport 是否支持更新 + * @return 导入结果 + */ + UserImportRespVO importUserList(List importUsers, boolean isUpdateSupport); + + /** + * 获得指定状态的用户们 + * + * @param status 状态 + * @return 用户们 + */ + List getUserListByStatus(Integer status); + + /** + * 判断密码是否匹配 + * + * @param rawPassword 未加密的密码 + * @param encodedPassword 加密后的密码 + * @return 是否匹配 + */ + boolean isPasswordMatch(String rawPassword, String encodedPassword); + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/service/DeptService.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/service/DeptService.java new file mode 100644 index 0000000..8f2a5c8 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/service/DeptService.java @@ -0,0 +1,117 @@ +package com.platform.marketing.module.system.service; + +import com.platform.marketing.framework.common.util.collection.CollectionUtils; +import com.platform.marketing.module.system.domain.vo.DeptListReqVO; +import com.platform.marketing.module.system.domain.vo.DeptSaveReqVO; +import com.platform.marketing.module.system.domain.dataobject.DeptDO; + +import java.util.*; + +/** + * 部门 Service 接口 + * + + */ +public interface DeptService { + + /** + * 创建部门 + * + * @param createReqVO 部门信息 + * @return 部门编号 + */ + Long createDept(DeptSaveReqVO createReqVO); + + /** + * 更新部门 + * + * @param updateReqVO 部门信息 + */ + void updateDept(DeptSaveReqVO updateReqVO); + + /** + * 删除部门 + * + * @param id 部门编号 + */ + void deleteDept(Long id); + + /** + * 获得部门信息 + * + * @param id 部门编号 + * @return 部门信息 + */ + DeptDO getDept(Long id); + + /** + * 获得部门信息数组 + * + * @param ids 部门编号数组 + * @return 部门信息数组 + */ + List getDeptList(Collection ids); + + /** + * 筛选部门列表 + * + * @param reqVO 筛选条件请求 VO + * @return 部门列表 + */ + List getDeptList(DeptListReqVO reqVO); + + /** + * 获得指定编号的部门 Map + * + * @param ids 部门编号数组 + * @return 部门 Map + */ + default Map getDeptMap(Collection ids) { + List list = getDeptList(ids); + return CollectionUtils.convertMap(list, DeptDO::getId); + } + + /** + * 获得指定部门的所有子部门 + * + * @param id 部门编号 + * @return 子部门列表 + */ + default List getChildDeptList(Long id) { + return getChildDeptList(Collections.singleton(id)); + } + + /** + * 获得指定部门的所有子部门 + * + * @param ids 部门编号数组 + * @return 子部门列表 + */ + List getChildDeptList(Collection ids); + + /** + * 获得指定领导者的部门列表 + * + * @param id 领导者编号 + * @return 部门列表 + */ + List getDeptListByLeaderUserId(Long id); + + /** + * 获得所有子部门,从缓存中 + * + * @param id 父部门编号 + * @return 子部门列表 + */ + Set getChildDeptIdListFromCache(Long id); + + /** + * 校验部门们是否有效。如下情况,视为无效: + * 1. 部门编号不存在 + * 2. 部门被禁用 + * + * @param ids 角色编号数组 + */ + void validateDeptList(Collection ids); + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/service/DictDataService.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/service/DictDataService.java new file mode 100644 index 0000000..e295403 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/service/DictDataService.java @@ -0,0 +1,110 @@ +package com.platform.marketing.module.system.service; + +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.module.system.domain.vo.DictDataPageReqVO; +import com.platform.marketing.module.system.domain.vo.DictDataSaveReqVO; +import com.platform.marketing.module.system.domain.dataobject.DictDataDO; +import org.springframework.lang.Nullable; + +import java.util.Collection; +import java.util.List; + +/** + * 字典数据 Service 接口 + * + * @author ruoyi + */ +public interface DictDataService { + + /** + * 创建字典数据 + * + * @param createReqVO 字典数据信息 + * @return 字典数据编号 + */ + Long createDictData(DictDataSaveReqVO createReqVO); + + /** + * 更新字典数据 + * + * @param updateReqVO 字典数据信息 + */ + void updateDictData(DictDataSaveReqVO updateReqVO); + + /** + * 删除字典数据 + * + * @param id 字典数据编号 + */ + void deleteDictData(Long id); + + /** + * 获得字典数据列表 + * + * @param status 状态 + * @param dictType 字典类型 + * @return 字典数据全列表 + */ + List getDictDataList(@Nullable Integer status, @Nullable String dictType); + + /** + * 获得字典数据分页列表 + * + * @param pageReqVO 分页请求 + * @return 字典数据分页列表 + */ + PageResult getDictDataPage(DictDataPageReqVO pageReqVO); + + /** + * 获得字典数据详情 + * + * @param id 字典数据编号 + * @return 字典数据 + */ + DictDataDO getDictData(Long id); + + /** + * 获得指定字典类型的数据数量 + * + * @param dictType 字典类型 + * @return 数据数量 + */ + long getDictDataCountByDictType(String dictType); + + /** + * 校验字典数据们是否有效。如下情况,视为无效: + * 1. 字典数据不存在 + * 2. 字典数据被禁用 + * + * @param dictType 字典类型 + * @param values 字典数据值的数组 + */ + void validateDictDataList(String dictType, Collection values); + + /** + * 获得指定的字典数据 + * + * @param dictType 字典类型 + * @param value 字典数据值 + * @return 字典数据 + */ + DictDataDO getDictData(String dictType, String value); + + /** + * 解析获得指定的字典数据,从缓存中 + * + * @param dictType 字典类型 + * @param label 字典数据标签 + * @return 字典数据 + */ + DictDataDO parseDictData(String dictType, String label); + + /** + * 获得指定数据类型的字典数据列表 + * + * @param dictType 字典类型 + * @return 字典数据列表 + */ + List getDictDataListByDictType(String dictType); + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/service/DictTypeService.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/service/DictTypeService.java new file mode 100644 index 0000000..d1be800 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/service/DictTypeService.java @@ -0,0 +1,70 @@ +package com.platform.marketing.module.system.service; + +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.module.system.domain.vo.DictTypePageReqVO; +import com.platform.marketing.module.system.domain.vo.DictTypeSaveReqVO; +import com.platform.marketing.module.system.domain.dataobject.DictTypeDO; + +import java.util.List; + +/** + * 字典类型 Service 接口 + * + + */ +public interface DictTypeService { + + /** + * 创建字典类型 + * + * @param createReqVO 字典类型信息 + * @return 字典类型编号 + */ + Long createDictType(DictTypeSaveReqVO createReqVO); + + /** + * 更新字典类型 + * + * @param updateReqVO 字典类型信息 + */ + void updateDictType(DictTypeSaveReqVO updateReqVO); + + /** + * 删除字典类型 + * + * @param id 字典类型编号 + */ + void deleteDictType(Long id); + + /** + * 获得字典类型分页列表 + * + * @param pageReqVO 分页请求 + * @return 字典类型分页列表 + */ + PageResult getDictTypePage(DictTypePageReqVO pageReqVO); + + /** + * 获得字典类型详情 + * + * @param id 字典类型编号 + * @return 字典类型 + */ + DictTypeDO getDictType(Long id); + + /** + * 获得字典类型详情 + * + * @param type 字典类型 + * @return 字典类型详情 + */ + DictTypeDO getDictType(String type); + + /** + * 获得全部字典类型列表 + * + * @return 字典类型列表 + */ + List getDictTypeList(); + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/service/LoginLogService.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/service/LoginLogService.java new file mode 100644 index 0000000..4da83a6 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/service/LoginLogService.java @@ -0,0 +1,30 @@ +package com.platform.marketing.module.system.service; + +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.module.system.domain.dto.LoginLogCreateReqDTO; +import com.platform.marketing.module.system.domain.vo.LoginLogPageReqVO; +import com.platform.marketing.module.system.domain.dataobject.LoginLogDO; + +import javax.validation.Valid; + +/** + * 登录日志 Service 接口 + */ +public interface LoginLogService { + + /** + * 获得登录日志分页 + * + * @param pageReqVO 分页条件 + * @return 登录日志分页 + */ + PageResult getLoginLogPage(LoginLogPageReqVO pageReqVO); + + /** + * 创建登录日志 + * + * @param reqDTO 日志信息 + */ + void createLoginLog(@Valid LoginLogCreateReqDTO reqDTO); + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/service/MenuService.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/service/MenuService.java new file mode 100644 index 0000000..4f28720 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/service/MenuService.java @@ -0,0 +1,95 @@ +package com.platform.marketing.module.system.service; + +import com.platform.marketing.module.system.domain.vo.MenuSaveVO; +import com.platform.marketing.module.system.domain.vo.MenuListReqVO; +import com.platform.marketing.module.system.domain.dataobject.MenuDO; + +import java.util.Collection; +import java.util.List; + +/** + * 菜单 Service 接口 + * + + */ +public interface MenuService { + + /** + * 创建菜单 + * + * @param createReqVO 菜单信息 + * @return 创建出来的菜单编号 + */ + Long createMenu(MenuSaveVO createReqVO); + + /** + * 更新菜单 + * + * @param updateReqVO 菜单信息 + */ + void updateMenu(MenuSaveVO updateReqVO); + + /** + * 删除菜单 + * + * @param id 菜单编号 + */ + void deleteMenu(Long id); + + /** + * 获得所有菜单列表 + * + * @return 菜单列表 + */ + List getMenuList(); + + /** + * 基于租户,筛选菜单列表 + * 注意,如果是系统租户,返回的还是全菜单 + * + * @param reqVO 筛选条件请求 VO + * @return 菜单列表 + */ + List getMenuListByTenant(MenuListReqVO reqVO); + + /** + * 过滤掉关闭的菜单及其子菜单 + * + * @param list 菜单列表 + * @return 过滤后的菜单列表 + */ + List filterDisableMenus(List list); + + /** + * 筛选菜单列表 + * + * @param reqVO 筛选条件请求 VO + * @return 菜单列表 + */ + List getMenuList(MenuListReqVO reqVO); + + /** + * 获得权限对应的菜单编号数组 + * + * @param permission 权限标识 + * @return 数组 + */ + List getMenuIdListByPermissionFromCache(String permission); + + /** + * 获得菜单 + * + * @param id 菜单编号 + * @return 菜单 + */ + MenuDO getMenu(Long id); + + /** + * 获得菜单数组 + * + * @param ids 菜单编号数组 + * @return 菜单数组 + */ + List getMenuList(Collection ids); + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/service/NoticeService.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/service/NoticeService.java new file mode 100644 index 0000000..1703507 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/service/NoticeService.java @@ -0,0 +1,51 @@ +package com.platform.marketing.module.system.service; + +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.module.system.domain.vo.NoticePageReqVO; +import com.platform.marketing.module.system.domain.vo.NoticeSaveReqVO; +import com.platform.marketing.module.system.domain.dataobject.NoticeDO; + +/** + * 通知公告 Service 接口 + */ +public interface NoticeService { + + /** + * 创建通知公告 + * + * @param createReqVO 通知公告 + * @return 编号 + */ + Long createNotice(NoticeSaveReqVO createReqVO); + + /** + * 更新通知公告 + * + * @param reqVO 通知公告 + */ + void updateNotice(NoticeSaveReqVO reqVO); + + /** + * 删除通知公告 + * + * @param id 编号 + */ + void deleteNotice(Long id); + + /** + * 获得通知公告分页列表 + * + * @param reqVO 分页条件 + * @return 部门分页列表 + */ + PageResult getNoticePage(NoticePageReqVO reqVO); + + /** + * 获得通知公告 + * + * @param id 编号 + * @return 通知公告 + */ + NoticeDO getNotice(Long id); + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/service/OperateLogService.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/service/OperateLogService.java new file mode 100644 index 0000000..e810c24 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/service/OperateLogService.java @@ -0,0 +1,29 @@ +package com.platform.marketing.module.system.service; + +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.module.system.domain.vo.OperateLogPageReqVO; +import com.platform.marketing.module.system.domain.dataobject.OperateLogDO; +import com.platform.marketing.module.system.framework.operatelog.core.dto.OperateLogCreateReqDTO; + +/** + * 操作日志 Service 接口 + * + */ +public interface OperateLogService { + + /** + * 获得操作日志分页列表 + * + * @param pageReqVO 分页条件 + * @return 操作日志分页列表 + */ + PageResult getOperateLogPage(OperateLogPageReqVO pageReqVO); + + /** + * 记录操作日志 + * + * @param createReqDTO 创建请求 + */ + void createOperateLog(OperateLogCreateReqDTO createReqDTO); + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/service/PermissionService.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/service/PermissionService.java new file mode 100644 index 0000000..4c448f7 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/service/PermissionService.java @@ -0,0 +1,146 @@ +package com.platform.marketing.module.system.service; + +import com.platform.marketing.framework.security.core.dto.DeptDataPermissionRespDTO; + +import java.util.Collection; +import java.util.Set; + +import static java.util.Collections.singleton; + +/** + * 权限 Service 接口 + *

+ * 提供用户-角色、角色-菜单、角色-部门的关联权限处理 + * + + */ +public interface PermissionService { + + /** + * 判断是否有权限,任一一个即可 + * + * @param userId 用户编号 + * @param permissions 权限 + * @return 是否 + */ + boolean hasAnyPermissions(Long userId, String... permissions); + + /** + * 判断是否有角色,任一一个即可 + * + * @param roles 角色数组 + * @return 是否 + */ + boolean hasAnyRoles(Long userId, String... roles); + + // ========== 角色-菜单的相关方法 ========== + + /** + * 设置角色菜单 + * + * @param roleId 角色编号 + * @param menuIds 菜单编号集合 + */ + void assignRoleMenu(Long roleId, Set menuIds); + + /** + * 处理角色删除时,删除关联授权数据 + * + * @param roleId 角色编号 + */ + void processRoleDeleted(Long roleId); + + /** + * 处理菜单删除时,删除关联授权数据 + * + * @param menuId 菜单编号 + */ + void processMenuDeleted(Long menuId); + + /** + * 获得角色拥有的菜单编号集合 + * + * @param roleId 角色编号 + * @return 菜单编号集合 + */ + default Set getRoleMenuListByRoleId(Long roleId) { + return getRoleMenuListByRoleId(singleton(roleId)); + } + + /** + * 获得角色们拥有的菜单编号集合 + * + * @param roleIds 角色编号数组 + * @return 菜单编号集合 + */ + Set getRoleMenuListByRoleId(Collection roleIds); + + /** + * 获得拥有指定菜单的角色编号数组,从缓存中获取 + * + * @param menuId 菜单编号 + * @return 角色编号数组 + */ + Set getMenuRoleIdListByMenuIdFromCache(Long menuId); + + // ========== 用户-角色的相关方法 ========== + + /** + * 设置用户角色 + * + * @param userId 角色编号 + * @param roleIds 角色编号集合 + */ + void assignUserRole(Long userId, Set roleIds); + + /** + * 处理用户删除时,删除关联授权数据 + * + * @param userId 用户编号 + */ + void processUserDeleted(Long userId); + + /** + * 获得拥有多个角色的用户编号集合 + * + * @param roleIds 角色编号集合 + * @return 用户编号集合 + */ + Set getUserRoleIdListByRoleId(Collection roleIds); + + /** + * 获得用户拥有的角色编号集合 + * + * @param userId 用户编号 + * @return 角色编号集合 + */ + Set getUserRoleIdListByUserId(Long userId); + + /** + * 获得用户拥有的角色编号集合,从缓存中获取 + * + * @param userId 用户编号 + * @return 角色编号集合 + */ + Set getUserRoleIdListByUserIdFromCache(Long userId); + + // ========== 用户-部门的相关方法 ========== + + /** + * 设置角色的数据权限 + * + * @param roleId 角色编号 + * @param dataScope 数据范围 + * @param dataScopeDeptIds 部门编号数组 + */ + void assignRoleDataScope(Long roleId, Integer dataScope, Set dataScopeDeptIds); + + /** + * 获得登陆用户的部门数据权限 + * + * @param userId 用户编号 + * @return 部门数据权限 + */ + DeptDataPermissionRespDTO getDeptDataPermission(Long userId); + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/service/PostService.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/service/PostService.java new file mode 100644 index 0000000..be9308b --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/service/PostService.java @@ -0,0 +1,84 @@ +package com.platform.marketing.module.system.service; + +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.module.system.domain.vo.PostPageReqVO; +import com.platform.marketing.module.system.domain.vo.PostSaveReqVO; +import com.platform.marketing.module.system.domain.dataobject.PostDO; +import org.springframework.lang.Nullable; + +import java.util.Collection; +import java.util.List; + +/** + * 岗位 Service 接口 + * + + */ +public interface PostService { + + /** + * 创建岗位 + * + * @param createReqVO 岗位信息 + * @return 岗位编号 + */ + Long createPost(PostSaveReqVO createReqVO); + + /** + * 更新岗位 + * + * @param updateReqVO 岗位信息 + */ + void updatePost(PostSaveReqVO updateReqVO); + + /** + * 删除岗位信息 + * + * @param id 岗位编号 + */ + void deletePost(Long id); + + /** + * 获得岗位列表 + * + * @param ids 岗位编号数组 + * @return 部门列表 + */ + List getPostList(@Nullable Collection ids); + + /** + * 获得符合条件的岗位列表 + * + * @param ids 岗位编号数组。如果为空,不进行筛选 + * @param statuses 状态数组。如果为空,不进行筛选 + * @return 部门列表 + */ + List getPostList(@Nullable Collection ids, + @Nullable Collection statuses); + + /** + * 获得岗位分页列表 + * + * @param reqVO 分页条件 + * @return 部门分页列表 + */ + PageResult getPostPage(PostPageReqVO reqVO); + + /** + * 获得岗位信息 + * + * @param id 岗位编号 + * @return 岗位信息 + */ + PostDO getPost(Long id); + + /** + * 校验岗位们是否有效。如下情况,视为无效: + * 1. 岗位编号不存在 + * 2. 岗位被禁用 + * + * @param ids 岗位编号数组 + */ + void validatePostList(Collection ids); + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/service/RoleService.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/service/RoleService.java new file mode 100644 index 0000000..4ab483d --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/service/RoleService.java @@ -0,0 +1,124 @@ +package com.platform.marketing.module.system.service; + +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.module.system.domain.vo.RolePageReqVO; +import com.platform.marketing.module.system.domain.vo.RoleSaveReqVO; +import com.platform.marketing.module.system.domain.dataobject.RoleDO; + +import javax.validation.Valid; +import java.util.Collection; +import java.util.List; +import java.util.Set; + +/** + * 角色 Service 接口 + * + + */ +public interface RoleService { + + /** + * 创建角色 + * + * @param createReqVO 创建角色信息 + * @param type 角色类型 + * @return 角色编号 + */ + Long createRole(@Valid RoleSaveReqVO createReqVO, Integer type); + + /** + * 更新角色 + * + * @param updateReqVO 更新角色信息 + */ + void updateRole(@Valid RoleSaveReqVO updateReqVO); + + /** + * 删除角色 + * + * @param id 角色编号 + */ + void deleteRole(Long id); + + /** + * 设置角色的数据权限 + * + * @param id 角色编号 + * @param dataScope 数据范围 + * @param dataScopeDeptIds 部门编号数组 + */ + void updateRoleDataScope(Long id, Integer dataScope, Set dataScopeDeptIds); + + /** + * 获得角色 + * + * @param id 角色编号 + * @return 角色 + */ + RoleDO getRole(Long id); + + /** + * 获得角色,从缓存中 + * + * @param id 角色编号 + * @return 角色 + */ + RoleDO getRoleFromCache(Long id); + + /** + * 获得角色列表 + * + * @param ids 角色编号数组 + * @return 角色列表 + */ + List getRoleList(Collection ids); + + /** + * 获得角色数组,从缓存中 + * + * @param ids 角色编号数组 + * @return 角色数组 + */ + List getRoleListFromCache(Collection ids); + + /** + * 获得角色列表 + * + * @param statuses 筛选的状态 + * @return 角色列表 + */ + List getRoleListByStatus(Collection statuses); + + /** + * 获得所有角色列表 + * + * @return 角色列表 + */ + List getRoleList(); + + /** + * 获得角色分页 + * + * @param reqVO 角色分页查询 + * @return 角色分页结果 + */ + PageResult getRolePage(RolePageReqVO reqVO); + + /** + * 判断角色编号数组中,是否有管理员 + * + * @param ids 角色编号数组 + * @return 是否有管理员 + */ + boolean hasAnySuperAdmin(Collection ids); + + /** + * 校验角色们是否有效。如下情况,视为无效: + * 1. 角色编号不存在 + * 2. 角色被禁用 + * + * @param ids 角色编号数组 + */ + void validateRoleList(Collection ids); + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/service/impl/AdminAuthServiceImpl.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/service/impl/AdminAuthServiceImpl.java new file mode 100644 index 0000000..33ab0d0 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/service/impl/AdminAuthServiceImpl.java @@ -0,0 +1,230 @@ +package com.platform.marketing.module.system.service.impl; + +import cn.hutool.core.util.ObjectUtil; +import com.platform.marketing.framework.common.enums.CommonStatusEnum; +import com.platform.marketing.framework.common.enums.UserTypeEnum; +import com.platform.marketing.framework.common.util.monitor.TracerUtils; +import com.platform.marketing.framework.common.util.servlet.ServletUtils; +import com.platform.marketing.framework.common.util.validation.ValidationUtils; +import com.platform.marketing.framework.token.core.dto.SecurityAccessTokenDTO; +import com.platform.marketing.framework.token.core.dto.SecurityCreateTokenDTO; +import com.platform.marketing.framework.token.core.service.SecurityTokenService; +import com.platform.marketing.module.system.domain.convert.AuthConvert; +import com.platform.marketing.module.system.domain.dataobject.AdminUserDO; +import com.platform.marketing.module.system.domain.dto.LoginLogCreateReqDTO; +import com.platform.marketing.module.system.domain.vo.*; +import com.platform.marketing.module.system.domain.enums.LoginLogTypeEnum; +import com.platform.marketing.module.system.domain.enums.LoginResultEnum; +import com.platform.marketing.module.system.service.AdminAuthService; +import com.platform.marketing.module.system.service.AdminUserService; +import com.platform.marketing.module.system.service.LoginLogService; +import com.google.common.annotations.VisibleForTesting; +import com.xingyuv.captcha.model.common.ResponseModel; +import com.xingyuv.captcha.model.vo.CaptchaVO; +import com.xingyuv.captcha.service.CaptchaService; +import lombok.Setter; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import javax.validation.Validator; +import java.util.Objects; + +import static com.platform.marketing.framework.common.exception.util.ServiceExceptionUtil.exception; +import static com.platform.marketing.module.system.domain.enums.ErrorCodeConstants.*; + +/** + * Auth Service 实现类 + */ +@Service +@Slf4j +public class AdminAuthServiceImpl implements AdminAuthService { + + @Resource + private AdminUserService userService; + + @Resource + private LoginLogService loginLogService; + + @Resource + private Validator validator; + + @Resource + private CaptchaService captchaService; + + /** + * 验证码的开关,默认为 true + */ + @Value("${marketing.captcha.enable:true}") + @Setter // 为了单测:开启或者关闭验证码 + private Boolean captchaEnable; + + @Resource + private SecurityTokenService securityTokenService; + + @Override + public AdminUserDO authenticate(String username, String password) { + final LoginLogTypeEnum logTypeEnum = LoginLogTypeEnum.LOGIN_USERNAME; + // 校验账号是否存在 + AdminUserDO user = userService.getUserByUsername(username); + if (user == null) { + createLoginLog(null, username, logTypeEnum, LoginResultEnum.BAD_CREDENTIALS); + throw exception(AUTH_LOGIN_BAD_CREDENTIALS); + } + if (!userService.isPasswordMatch(password, user.getPassword())) { + createLoginLog(user.getId(), username, logTypeEnum, LoginResultEnum.BAD_CREDENTIALS); + throw exception(AUTH_LOGIN_BAD_CREDENTIALS); + } + // 校验是否禁用 + if (CommonStatusEnum.isDisable(user.getStatus())) { + createLoginLog(user.getId(), username, logTypeEnum, LoginResultEnum.USER_DISABLED); + throw exception(AUTH_LOGIN_USER_DISABLED); + } + return user; + } + + @Override + public AuthLoginRespVO login(AuthLoginReqVO reqVO) { + // 校验验证码 + validateCaptcha(reqVO); + + // 使用账号密码,进行登录 + AdminUserDO user = authenticate(reqVO.getUsername(), reqVO.getPassword()); + + // 创建 Token 令牌,记录登录日志 + return createTokenAfterLoginSuccess(user.getId(), reqVO.getUsername(), LoginLogTypeEnum.LOGIN_USERNAME); + } + + private void createLoginLog(Long userId, String username, + LoginLogTypeEnum logTypeEnum, LoginResultEnum loginResult) { + // 插入登录日志 + LoginLogCreateReqDTO reqDTO = new LoginLogCreateReqDTO(); + reqDTO.setLogType(logTypeEnum.getType()); + reqDTO.setTraceId(TracerUtils.getTraceId()); + reqDTO.setUserId(userId); + reqDTO.setUserType(getUserType().getValue()); + reqDTO.setUsername(username); + reqDTO.setUserAgent(ServletUtils.getUserAgent()); + reqDTO.setUserIp(ServletUtils.getClientIP()); + reqDTO.setResult(loginResult.getResult()); + loginLogService.createLoginLog(reqDTO); + // 更新最后登录时间 + if (userId != null && Objects.equals(LoginResultEnum.SUCCESS.getResult(), loginResult.getResult())) { + userService.updateUserLogin(userId, ServletUtils.getClientIP()); + } + } + + @VisibleForTesting + void validateCaptcha(AuthLoginReqVO reqVO) { + ResponseModel response = doValidateCaptcha(reqVO); + // 校验验证码 + if (!response.isSuccess()) { + // 创建登录失败日志(验证码不正确) + createLoginLog(null, reqVO.getUsername(), LoginLogTypeEnum.LOGIN_USERNAME, LoginResultEnum.CAPTCHA_CODE_ERROR); + throw exception(AUTH_LOGIN_CAPTCHA_CODE_ERROR, response.getRepMsg()); + } + } + + private ResponseModel doValidateCaptcha(CaptchaVerificationReqVO reqVO) { + // 如果验证码关闭,则不进行校验 + if (!captchaEnable) { + return ResponseModel.success(); + } + ValidationUtils.validate(validator, reqVO, CaptchaVerificationReqVO.CodeEnableGroup.class); + CaptchaVO captchaVO = new CaptchaVO(); + captchaVO.setCaptchaVerification(reqVO.getCaptchaVerification()); + return captchaService.verification(captchaVO); + } + + private AuthLoginRespVO createTokenAfterLoginSuccess(Long userId, String username, LoginLogTypeEnum logType) { + // 插入登陆日志 + createLoginLog(userId, username, logType, LoginResultEnum.SUCCESS); + + // 创建访问令牌 + SecurityCreateTokenDTO securityCreateTokenDTO = new SecurityCreateTokenDTO(); + securityCreateTokenDTO.setUserId(userId). + setUserType(UserTypeEnum.ADMIN.getValue()); + SecurityAccessTokenDTO securityAccessTokenDTO = securityTokenService.createAccessToken(securityCreateTokenDTO); + + // 构建返回结果 + return AuthConvert.INSTANCE.convert(securityAccessTokenDTO); + } + + @Override + public AuthLoginRespVO refreshToken(String refreshToken) { + SecurityAccessTokenDTO securityAccessTokenDTO = securityTokenService.refreshAccessToken(refreshToken); + return AuthConvert.INSTANCE.convert(securityAccessTokenDTO); + } + + @Override + public void logout(String token, Integer logType) { + // 删除访问令牌 + SecurityAccessTokenDTO accessTokenDTO = securityTokenService.removeAccessToken(token); + if (accessTokenDTO == null) { + return; + } + // 删除成功,则记录登出日志 + createLogoutLog(accessTokenDTO.getUserId(), accessTokenDTO.getUserType(), logType); + } + + private void createLogoutLog(Long userId, Integer userType, Integer logType) { + LoginLogCreateReqDTO reqDTO = new LoginLogCreateReqDTO(); + reqDTO.setLogType(logType); + reqDTO.setTraceId(TracerUtils.getTraceId()); + reqDTO.setUserId(userId); + reqDTO.setUserType(userType); + if (ObjectUtil.equal(getUserType().getValue(), userType)) { + reqDTO.setUsername(getUsername(userId)); + } + reqDTO.setUserAgent(ServletUtils.getUserAgent()); + reqDTO.setUserIp(ServletUtils.getClientIP()); + reqDTO.setResult(LoginResultEnum.SUCCESS.getResult()); + loginLogService.createLoginLog(reqDTO); + } + + private String getUsername(Long userId) { + if (userId == null) { + return null; + } + AdminUserDO user = userService.getUser(userId); + return user != null ? user.getUsername() : null; + } + + private UserTypeEnum getUserType() { + return UserTypeEnum.ADMIN; + } + + @Override + public AuthLoginRespVO register(AuthRegisterReqVO registerReqVO) { + // 1. 校验验证码 + validateCaptcha(registerReqVO); + + // 2. 校验用户名是否已存在 + Long userId = userService.registerUser(registerReqVO); + + // 3. 创建 Token 令牌,记录登录日志 + return createTokenAfterLoginSuccess(userId, registerReqVO.getUsername(), LoginLogTypeEnum.LOGIN_USERNAME); + } + + @VisibleForTesting + void validateCaptcha(AuthRegisterReqVO reqVO) { + ResponseModel response = doValidateCaptcha(reqVO); + // 验证不通过 + if (!response.isSuccess()) { + throw exception(AUTH_REGISTER_CAPTCHA_CODE_ERROR, response.getRepMsg()); + } + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void resetPassword(AuthResetPasswordReqVO reqVO) { + AdminUserDO userByMobile = userService.getUserByMobile(reqVO.getMobile()); + if (userByMobile == null) { + throw exception(USER_MOBILE_NOT_EXISTS); + } + + userService.updateUserPassword(userByMobile.getId(), reqVO.getPassword()); + } +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/service/impl/AdminUserServiceImpl.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/service/impl/AdminUserServiceImpl.java new file mode 100644 index 0000000..1d65fb5 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/service/impl/AdminUserServiceImpl.java @@ -0,0 +1,510 @@ +package com.platform.marketing.module.system.service.impl; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.io.IoUtil; +import cn.hutool.core.util.StrUtil; +import com.platform.marketing.framework.common.enums.CommonStatusEnum; +import com.platform.marketing.framework.common.exception.ServiceException; +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.common.util.collection.CollectionUtils; +import com.platform.marketing.framework.common.util.object.BeanUtils; +import com.platform.marketing.framework.common.util.validation.ValidationUtils; +import com.platform.marketing.module.infra.domain.dataobject.ConfigDO; +import com.platform.marketing.module.infra.service.ConfigService; +import com.platform.marketing.module.infra.service.FileService; +import com.platform.marketing.module.system.domain.vo.AuthRegisterReqVO; +import com.platform.marketing.module.system.domain.vo.UserProfileUpdatePasswordReqVO; +import com.platform.marketing.module.system.domain.vo.UserProfileUpdateReqVO; +import com.platform.marketing.module.system.domain.vo.UserImportExcelVO; +import com.platform.marketing.module.system.domain.vo.UserImportRespVO; +import com.platform.marketing.module.system.domain.vo.UserPageReqVO; +import com.platform.marketing.module.system.domain.vo.UserSaveReqVO; +import com.platform.marketing.module.system.domain.dataobject.DeptDO; +import com.platform.marketing.module.system.domain.dataobject.UserPostDO; +import com.platform.marketing.module.system.domain.dataobject.AdminUserDO; +import com.platform.marketing.module.system.mapper.UserPostMapper; +import com.platform.marketing.module.system.mapper.AdminUserMapper; +import com.platform.marketing.module.system.service.*; +import com.google.common.annotations.VisibleForTesting; +import com.mzt.logapi.context.LogRecordContext; +import com.mzt.logapi.service.impl.DiffParseFunction; +import com.mzt.logapi.starter.annotation.LogRecord; +import lombok.extern.slf4j.Slf4j; +import org.springframework.security.crypto.password.PasswordEncoder; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import javax.validation.ConstraintViolationException; +import java.io.InputStream; +import java.time.LocalDateTime; +import java.util.*; + +import static com.platform.marketing.framework.common.exception.util.ServiceExceptionUtil.exception; +import static com.platform.marketing.framework.common.util.collection.CollectionUtils.*; +import static com.platform.marketing.module.system.domain.enums.ErrorCodeConstants.*; +import static com.platform.marketing.module.system.domain.enums.LogRecordConstants.*; + +/** + * 后台用户 Service 实现类 + * + + */ +@Service("adminUserService") +@Slf4j +public class AdminUserServiceImpl implements AdminUserService { + + static final String USER_INIT_PASSWORD_KEY = "system.user.init-password"; + + @Resource + private AdminUserMapper userMapper; + + @Resource + private DeptService deptService; + @Resource + private PostService postService; + @Resource + private PermissionService permissionService; + @Resource + private PasswordEncoder passwordEncoder; + + @Resource + private UserPostMapper userPostMapper; + + @Resource + private FileService fileService; + + @Resource + private ConfigService configApi; + + @Override + @Transactional(rollbackFor = Exception.class) + @LogRecord(type = SYSTEM_USER_TYPE, subType = SYSTEM_USER_CREATE_SUB_TYPE, bizNo = "{{#user.id}}", + success = SYSTEM_USER_CREATE_SUCCESS) + public Long createUser(UserSaveReqVO createReqVO) { + // 1.1 校验正确性 + validateUserForCreateOrUpdate(null, createReqVO.getUsername(), + createReqVO.getMobile(), createReqVO.getEmail(), createReqVO.getDeptId(), createReqVO.getPostIds()); + // 2.1 插入用户 + AdminUserDO user = BeanUtils.toBean(createReqVO, AdminUserDO.class); + user.setStatus(CommonStatusEnum.ENABLE.getStatus()); // 默认开启 + user.setPassword(encodePassword(createReqVO.getPassword())); // 加密密码 + userMapper.insert(user); + // 2.2 插入关联岗位 + if (CollectionUtil.isNotEmpty(user.getPostIds())) { + userPostMapper.insertBatch(convertList(user.getPostIds(), + postId -> new UserPostDO().setUserId(user.getId()).setPostId(postId))); + } + + // 3. 记录操作日志上下文 + LogRecordContext.putVariable("user", user); + return user.getId(); + } + + @Override + public Long registerUser(AuthRegisterReqVO registerReqVO) { + // 1.2 校验正确性 + validateUserForCreateOrUpdate(null, registerReqVO.getUsername(), null, null, null, null); + + // 2. 插入用户 + AdminUserDO user = BeanUtils.toBean(registerReqVO, AdminUserDO.class); + user.setStatus(CommonStatusEnum.ENABLE.getStatus()); // 默认开启 + user.setPassword(encodePassword(registerReqVO.getPassword())); // 加密密码 + userMapper.insert(user); + return user.getId(); + } + + @Override + @Transactional(rollbackFor = Exception.class) + @LogRecord(type = SYSTEM_USER_TYPE, subType = SYSTEM_USER_UPDATE_SUB_TYPE, bizNo = "{{#updateReqVO.id}}", + success = SYSTEM_USER_UPDATE_SUCCESS) + public void updateUser(UserSaveReqVO updateReqVO) { + updateReqVO.setPassword(null); // 特殊:此处不更新密码 + // 1. 校验正确性 + AdminUserDO oldUser = validateUserForCreateOrUpdate(updateReqVO.getId(), updateReqVO.getUsername(), + updateReqVO.getMobile(), updateReqVO.getEmail(), updateReqVO.getDeptId(), updateReqVO.getPostIds()); + + // 2.1 更新用户 + AdminUserDO updateObj = BeanUtils.toBean(updateReqVO, AdminUserDO.class); + userMapper.updateById(updateObj); + // 2.2 更新岗位 + updateUserPost(updateReqVO, updateObj); + + // 3. 记录操作日志上下文 + LogRecordContext.putVariable(DiffParseFunction.OLD_OBJECT, BeanUtils.toBean(oldUser, UserSaveReqVO.class)); + LogRecordContext.putVariable("user", oldUser); + } + + private void updateUserPost(UserSaveReqVO reqVO, AdminUserDO updateObj) { + Long userId = reqVO.getId(); + Set dbPostIds = convertSet(userPostMapper.selectListByUserId(userId), UserPostDO::getPostId); + // 计算新增和删除的岗位编号 + Set postIds = CollUtil.emptyIfNull(updateObj.getPostIds()); + Collection createPostIds = CollUtil.subtract(postIds, dbPostIds); + Collection deletePostIds = CollUtil.subtract(dbPostIds, postIds); + // 执行新增和删除。对于已经授权的岗位,不用做任何处理 + if (!CollectionUtil.isEmpty(createPostIds)) { + userPostMapper.insertBatch(convertList(createPostIds, + postId -> new UserPostDO().setUserId(userId).setPostId(postId))); + } + if (!CollectionUtil.isEmpty(deletePostIds)) { + userPostMapper.deleteByUserIdAndPostId(userId, deletePostIds); + } + } + + @Override + public void updateUserLogin(Long id, String loginIp) { + userMapper.updateById(new AdminUserDO().setId(id).setLoginIp(loginIp).setLoginDate(LocalDateTime.now())); + } + + @Override + public void updateUserProfile(Long id, UserProfileUpdateReqVO reqVO) { + // 校验正确性 + validateUserExists(id); + validateEmailUnique(id, reqVO.getEmail()); + validateMobileUnique(id, reqVO.getMobile()); + // 执行更新 + userMapper.updateById(BeanUtils.toBean(reqVO, AdminUserDO.class).setId(id)); + } + + @Override + public void updateUserPassword(Long id, UserProfileUpdatePasswordReqVO reqVO) { + // 校验旧密码密码 + validateOldPassword(id, reqVO.getOldPassword()); + // 执行更新 + AdminUserDO updateObj = new AdminUserDO().setId(id); + updateObj.setPassword(encodePassword(reqVO.getNewPassword())); // 加密密码 + userMapper.updateById(updateObj); + } + + @Override + public String updateUserAvatar(Long id, InputStream avatarFile) { + validateUserExists(id); + // 存储文件 + String avatar = fileService.createFile(null, null, IoUtil.readBytes(avatarFile)); + // 更新路径 + AdminUserDO sysUserDO = new AdminUserDO(); + sysUserDO.setId(id); + sysUserDO.setAvatar(avatar); + userMapper.updateById(sysUserDO); + return avatar; + } + + @Override + @LogRecord(type = SYSTEM_USER_TYPE, subType = SYSTEM_USER_UPDATE_PASSWORD_SUB_TYPE, bizNo = "{{#id}}", + success = SYSTEM_USER_UPDATE_PASSWORD_SUCCESS) + public void updateUserPassword(Long id, String password) { + // 1. 校验用户存在 + AdminUserDO user = validateUserExists(id); + + // 2. 更新密码 + AdminUserDO updateObj = new AdminUserDO(); + updateObj.setId(id); + updateObj.setPassword(encodePassword(password)); // 加密密码 + userMapper.updateById(updateObj); + + // 3. 记录操作日志上下文 + LogRecordContext.putVariable("user", user); + LogRecordContext.putVariable("newPassword", updateObj.getPassword()); + } + + @Override + public void updateUserStatus(Long id, Integer status) { + // 校验用户存在 + validateUserExists(id); + // 更新状态 + AdminUserDO updateObj = new AdminUserDO(); + updateObj.setId(id); + updateObj.setStatus(status); + userMapper.updateById(updateObj); + } + + @Override + @Transactional(rollbackFor = Exception.class) + @LogRecord(type = SYSTEM_USER_TYPE, subType = SYSTEM_USER_DELETE_SUB_TYPE, bizNo = "{{#id}}", + success = SYSTEM_USER_DELETE_SUCCESS) + public void deleteUser(Long id) { + // 1. 校验用户存在 + AdminUserDO user = validateUserExists(id); + + // 2.1 删除用户 + userMapper.deleteById(id); + // 2.2 删除用户关联数据 + permissionService.processUserDeleted(id); + // 2.2 删除用户岗位 + userPostMapper.deleteByUserId(id); + + // 3. 记录操作日志上下文 + LogRecordContext.putVariable("user", user); + } + + @Override + public AdminUserDO getUserByUsername(String username) { + return userMapper.selectByUsername(username); + } + + @Override + public AdminUserDO getUserByMobile(String mobile) { + return userMapper.selectByMobile(mobile); + } + + @Override + public PageResult getUserPage(UserPageReqVO reqVO) { + // 如果有角色编号,查询角色对应的用户编号 + Set userIds = reqVO.getRoleId() != null ? + permissionService.getUserRoleIdListByRoleId(singleton(reqVO.getRoleId())) : null; + + // 分页查询 + return userMapper.selectPage(reqVO, getDeptCondition(reqVO.getDeptId()), userIds); + } + + @Override + public AdminUserDO getUser(Long id) { + return userMapper.selectById(id); + } + + @Override + public List getUserListByDeptIds(Collection deptIds) { + if (CollUtil.isEmpty(deptIds)) { + return Collections.emptyList(); + } + return userMapper.selectListByDeptIds(deptIds); + } + + @Override + public List getUserListByPostIds(Collection postIds) { + if (CollUtil.isEmpty(postIds)) { + return Collections.emptyList(); + } + Set userIds = convertSet(userPostMapper.selectListByPostIds(postIds), UserPostDO::getUserId); + if (CollUtil.isEmpty(userIds)) { + return Collections.emptyList(); + } + return userMapper.selectBatchIds(userIds); + } + + @Override + public List getUserList(Collection ids) { + if (CollUtil.isEmpty(ids)) { + return Collections.emptyList(); + } + return userMapper.selectBatchIds(ids); + } + + @Override + public void validateUserList(Collection ids) { + if (CollUtil.isEmpty(ids)) { + return; + } + // 获得岗位信息 + List users = userMapper.selectBatchIds(ids); + Map userMap = CollectionUtils.convertMap(users, AdminUserDO::getId); + // 校验 + ids.forEach(id -> { + AdminUserDO user = userMap.get(id); + if (user == null) { + throw exception(USER_NOT_EXISTS); + } + if (!CommonStatusEnum.ENABLE.getStatus().equals(user.getStatus())) { + throw exception(USER_IS_DISABLE, user.getNickname()); + } + }); + } + + @Override + public List getUserListByNickname(String nickname) { + return userMapper.selectListByNickname(nickname); + } + + /** + * 获得部门条件:查询指定部门的子部门编号们,包括自身 + * + * @param deptId 部门编号 + * @return 部门编号集合 + */ + private Set getDeptCondition(Long deptId) { + if (deptId == null) { + return Collections.emptySet(); + } + Set deptIds = convertSet(deptService.getChildDeptList(deptId), DeptDO::getId); + deptIds.add(deptId); // 包括自身 + return deptIds; + } + + private AdminUserDO validateUserForCreateOrUpdate(Long id, String username, String mobile, String email, + Long deptId, Set postIds) { + // 校验用户存在 + AdminUserDO user = validateUserExists(id); + // 校验用户名唯一 + validateUsernameUnique(id, username); + // 校验手机号唯一 + validateMobileUnique(id, mobile); + // 校验邮箱唯一 + validateEmailUnique(id, email); + // 校验部门处于开启状态 + deptService.validateDeptList(CollectionUtils.singleton(deptId)); + // 校验岗位处于开启状态 + postService.validatePostList(postIds); + return user; + } + + @VisibleForTesting + AdminUserDO validateUserExists(Long id) { + if (id == null) { + return null; + } + AdminUserDO user = userMapper.selectById(id); + if (user == null) { + throw exception(USER_NOT_EXISTS); + } + return user; + } + + @VisibleForTesting + void validateUsernameUnique(Long id, String username) { + if (StrUtil.isBlank(username)) { + return; + } + AdminUserDO user = userMapper.selectByUsername(username); + if (user == null) { + return; + } + // 如果 id 为空,说明不用比较是否为相同 id 的用户 + if (id == null) { + throw exception(USER_USERNAME_EXISTS); + } + if (!user.getId().equals(id)) { + throw exception(USER_USERNAME_EXISTS); + } + } + + @VisibleForTesting + void validateEmailUnique(Long id, String email) { + if (StrUtil.isBlank(email)) { + return; + } + AdminUserDO user = userMapper.selectByEmail(email); + if (user == null) { + return; + } + // 如果 id 为空,说明不用比较是否为相同 id 的用户 + if (id == null) { + throw exception(USER_EMAIL_EXISTS); + } + if (!user.getId().equals(id)) { + throw exception(USER_EMAIL_EXISTS); + } + } + + @VisibleForTesting + void validateMobileUnique(Long id, String mobile) { + if (StrUtil.isBlank(mobile)) { + return; + } + AdminUserDO user = userMapper.selectByMobile(mobile); + if (user == null) { + return; + } + // 如果 id 为空,说明不用比较是否为相同 id 的用户 + if (id == null) { + throw exception(USER_MOBILE_EXISTS); + } + if (!user.getId().equals(id)) { + throw exception(USER_MOBILE_EXISTS); + } + } + + /** + * 校验旧密码 + * + * @param id 用户 id + * @param oldPassword 旧密码 + */ + @VisibleForTesting + void validateOldPassword(Long id, String oldPassword) { + AdminUserDO user = userMapper.selectById(id); + if (user == null) { + throw exception(USER_NOT_EXISTS); + } + if (!isPasswordMatch(oldPassword, user.getPassword())) { + throw exception(USER_PASSWORD_FAILED); + } + } + + @Override + @Transactional(rollbackFor = Exception.class) // 添加事务,异常则回滚所有导入 + public UserImportRespVO importUserList(List importUsers, boolean isUpdateSupport) { + // 1.1 参数校验 + if (CollUtil.isEmpty(importUsers)) { + throw exception(USER_IMPORT_LIST_IS_EMPTY); + } + // 1.2 初始化密码不能为空 + ConfigDO config = configApi.getConfigByKey(USER_INIT_PASSWORD_KEY); + String initPassword = (config != null)? config.getValue() : null; + if (StrUtil.isEmpty(initPassword)) { + throw exception(USER_IMPORT_INIT_PASSWORD); + } + + // 2. 遍历,逐个创建 or 更新 + UserImportRespVO respVO = UserImportRespVO.builder().createUsernames(new ArrayList<>()) + .updateUsernames(new ArrayList<>()).failureUsernames(new LinkedHashMap<>()).build(); + importUsers.forEach(importUser -> { + // 2.1.1 校验字段是否符合要求 + try { + ValidationUtils.validate(BeanUtils.toBean(importUser, UserSaveReqVO.class).setPassword(initPassword)); + } catch (ConstraintViolationException ex) { + respVO.getFailureUsernames().put(importUser.getUsername(), ex.getMessage()); + return; + } + // 2.1.2 校验,判断是否有不符合的原因 + try { + validateUserForCreateOrUpdate(null, null, importUser.getMobile(), importUser.getEmail(), + importUser.getDeptId(), null); + } catch (ServiceException ex) { + respVO.getFailureUsernames().put(importUser.getUsername(), ex.getMessage()); + return; + } + + // 2.2.1 判断如果不存在,在进行插入 + AdminUserDO existUser = userMapper.selectByUsername(importUser.getUsername()); + if (existUser == null) { + userMapper.insert(BeanUtils.toBean(importUser, AdminUserDO.class) + .setPassword(encodePassword(initPassword)).setPostIds(new HashSet<>())); // 设置默认密码及空岗位编号数组 + respVO.getCreateUsernames().add(importUser.getUsername()); + return; + } + // 2.2.2 如果存在,判断是否允许更新 + if (!isUpdateSupport) { + respVO.getFailureUsernames().put(importUser.getUsername(), USER_USERNAME_EXISTS.getMsg()); + return; + } + AdminUserDO updateUser = BeanUtils.toBean(importUser, AdminUserDO.class); + updateUser.setId(existUser.getId()); + userMapper.updateById(updateUser); + respVO.getUpdateUsernames().add(importUser.getUsername()); + }); + return respVO; + } + + @Override + public List getUserListByStatus(Integer status) { + return userMapper.selectListByStatus(status); + } + + @Override + public boolean isPasswordMatch(String rawPassword, String encodedPassword) { + return passwordEncoder.matches(rawPassword, encodedPassword); + } + + /** + * 对密码进行加密 + * + * @param password 密码 + * @return 加密后的密码 + */ + private String encodePassword(String password) { + return passwordEncoder.encode(password); + } + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/service/impl/DeptServiceImpl.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/service/impl/DeptServiceImpl.java new file mode 100644 index 0000000..e0ca1dd --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/service/impl/DeptServiceImpl.java @@ -0,0 +1,222 @@ +package com.platform.marketing.module.system.service.impl; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.ObjectUtil; +import com.platform.marketing.framework.common.enums.CommonStatusEnum; +import com.platform.marketing.framework.common.util.object.BeanUtils; +import com.platform.marketing.module.system.domain.vo.DeptListReqVO; +import com.platform.marketing.module.system.domain.vo.DeptSaveReqVO; +import com.platform.marketing.module.system.domain.dataobject.DeptDO; +import com.platform.marketing.module.system.mapper.DeptMapper; +import com.platform.marketing.module.system.domain.enums.RedisKeyConstants; +import com.platform.marketing.module.system.service.DeptService; +import com.google.common.annotations.VisibleForTesting; +import lombok.extern.slf4j.Slf4j; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; + +import javax.annotation.Resource; +import java.util.*; + +import static com.platform.marketing.framework.common.exception.util.ServiceExceptionUtil.exception; +import static com.platform.marketing.framework.common.util.collection.CollectionUtils.convertSet; +import static com.platform.marketing.module.system.domain.enums.ErrorCodeConstants.*; + +/** + * 部门 Service 实现类 + * + + */ +@Service +@Validated +@Slf4j +public class DeptServiceImpl implements DeptService { + + @Resource + private DeptMapper deptMapper; + + @Override + @CacheEvict(cacheNames = RedisKeyConstants.DEPT_CHILDREN_ID_LIST, + allEntries = true) // allEntries 清空所有缓存,因为操作一个部门,涉及到多个缓存 + public Long createDept(DeptSaveReqVO createReqVO) { + if (createReqVO.getParentId() == null) { + createReqVO.setParentId(DeptDO.PARENT_ID_ROOT); + } + // 校验父部门的有效性 + validateParentDept(null, createReqVO.getParentId()); + // 校验部门名的唯一性 + validateDeptNameUnique(null, createReqVO.getParentId(), createReqVO.getName()); + + // 插入部门 + DeptDO dept = BeanUtils.toBean(createReqVO, DeptDO.class); + deptMapper.insert(dept); + return dept.getId(); + } + + @Override + @CacheEvict(cacheNames = RedisKeyConstants.DEPT_CHILDREN_ID_LIST, + allEntries = true) // allEntries 清空所有缓存,因为操作一个部门,涉及到多个缓存 + public void updateDept(DeptSaveReqVO updateReqVO) { + if (updateReqVO.getParentId() == null) { + updateReqVO.setParentId(DeptDO.PARENT_ID_ROOT); + } + // 校验自己存在 + validateDeptExists(updateReqVO.getId()); + // 校验父部门的有效性 + validateParentDept(updateReqVO.getId(), updateReqVO.getParentId()); + // 校验部门名的唯一性 + validateDeptNameUnique(updateReqVO.getId(), updateReqVO.getParentId(), updateReqVO.getName()); + + // 更新部门 + DeptDO updateObj = BeanUtils.toBean(updateReqVO, DeptDO.class); + deptMapper.updateById(updateObj); + } + + @Override + @CacheEvict(cacheNames = RedisKeyConstants.DEPT_CHILDREN_ID_LIST, + allEntries = true) // allEntries 清空所有缓存,因为操作一个部门,涉及到多个缓存 + public void deleteDept(Long id) { + // 校验是否存在 + validateDeptExists(id); + // 校验是否有子部门 + if (deptMapper.selectCountByParentId(id) > 0) { + throw exception(DEPT_EXITS_CHILDREN); + } + // 删除部门 + deptMapper.deleteById(id); + } + + @VisibleForTesting + void validateDeptExists(Long id) { + if (id == null) { + return; + } + DeptDO dept = deptMapper.selectById(id); + if (dept == null) { + throw exception(DEPT_NOT_FOUND); + } + } + + @VisibleForTesting + void validateParentDept(Long id, Long parentId) { + if (parentId == null || DeptDO.PARENT_ID_ROOT.equals(parentId)) { + return; + } + // 1. 不能设置自己为父部门 + if (Objects.equals(id, parentId)) { + throw exception(DEPT_PARENT_ERROR); + } + // 2. 父部门不存在 + DeptDO parentDept = deptMapper.selectById(parentId); + if (parentDept == null) { + throw exception(DEPT_PARENT_NOT_EXITS); + } + // 3. 递归校验父部门,如果父部门是自己的子部门,则报错,避免形成环路 + if (id == null) { // id 为空,说明新增,不需要考虑环路 + return; + } + for (int i = 0; i < Short.MAX_VALUE; i++) { + // 3.1 校验环路 + parentId = parentDept.getParentId(); + if (Objects.equals(id, parentId)) { + throw exception(DEPT_PARENT_IS_CHILD); + } + // 3.2 继续递归下一级父部门 + if (parentId == null || DeptDO.PARENT_ID_ROOT.equals(parentId)) { + break; + } + parentDept = deptMapper.selectById(parentId); + if (parentDept == null) { + break; + } + } + } + + @VisibleForTesting + void validateDeptNameUnique(Long id, Long parentId, String name) { + DeptDO dept = deptMapper.selectByParentIdAndName(parentId, name); + if (dept == null) { + return; + } + // 如果 id 为空,说明不用比较是否为相同 id 的部门 + if (id == null) { + throw exception(DEPT_NAME_DUPLICATE); + } + if (ObjectUtil.notEqual(dept.getId(), id)) { + throw exception(DEPT_NAME_DUPLICATE); + } + } + + @Override + public DeptDO getDept(Long id) { + return deptMapper.selectById(id); + } + + @Override + public List getDeptList(Collection ids) { + if (CollUtil.isEmpty(ids)) { + return Collections.emptyList(); + } + return deptMapper.selectBatchIds(ids); + } + + @Override + public List getDeptList(DeptListReqVO reqVO) { + List list = deptMapper.selectList(reqVO); + list.sort(Comparator.comparing(DeptDO::getSort)); + return list; + } + + @Override + public List getChildDeptList(Collection ids) { + List children = new LinkedList<>(); + // 遍历每一层 + Collection parentIds = ids; + for (int i = 0; i < Short.MAX_VALUE; i++) { // 使用 Short.MAX_VALUE 避免 bug 场景下,存在死循环 + // 查询当前层,所有的子部门 + List depts = deptMapper.selectListByParentId(parentIds); + // 1. 如果没有子部门,则结束遍历 + if (CollUtil.isEmpty(depts)) { + break; + } + // 2. 如果有子部门,继续遍历 + children.addAll(depts); + parentIds = convertSet(depts, DeptDO::getId); + } + return children; + } + + @Override + public List getDeptListByLeaderUserId(Long id) { + return deptMapper.selectListByLeaderUserId(id); + } + + @Override + @Cacheable(cacheNames = RedisKeyConstants.DEPT_CHILDREN_ID_LIST, key = "#id") + public Set getChildDeptIdListFromCache(Long id) { + List children = getChildDeptList(id); + return convertSet(children, DeptDO::getId); + } + + @Override + public void validateDeptList(Collection ids) { + if (CollUtil.isEmpty(ids)) { + return; + } + // 获得科室信息 + Map deptMap = getDeptMap(ids); + // 校验 + ids.forEach(id -> { + DeptDO dept = deptMap.get(id); + if (dept == null) { + throw exception(DEPT_NOT_FOUND); + } + if (!CommonStatusEnum.ENABLE.getStatus().equals(dept.getStatus())) { + throw exception(DEPT_NOT_ENABLE, dept.getName()); + } + }); + } + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/service/impl/DictDataServiceImpl.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/service/impl/DictDataServiceImpl.java new file mode 100644 index 0000000..57a7f75 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/service/impl/DictDataServiceImpl.java @@ -0,0 +1,181 @@ +package com.platform.marketing.module.system.service.impl; + +import cn.hutool.core.collection.CollUtil; +import com.platform.marketing.framework.common.enums.CommonStatusEnum; +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.common.util.collection.CollectionUtils; +import com.platform.marketing.framework.common.util.object.BeanUtils; +import com.platform.marketing.module.system.domain.vo.DictDataPageReqVO; +import com.platform.marketing.module.system.domain.vo.DictDataSaveReqVO; +import com.platform.marketing.module.system.domain.dataobject.DictDataDO; +import com.platform.marketing.module.system.domain.dataobject.DictTypeDO; +import com.platform.marketing.module.system.mapper.DictDataMapper; +import com.platform.marketing.module.system.service.DictDataService; +import com.platform.marketing.module.system.service.DictTypeService; +import com.google.common.annotations.VisibleForTesting; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.Collection; +import java.util.Comparator; +import java.util.List; +import java.util.Map; + +import static com.platform.marketing.framework.common.exception.util.ServiceExceptionUtil.exception; +import static com.platform.marketing.module.system.domain.enums.ErrorCodeConstants.*; + +/** + * 字典数据 Service 实现类 + * + * @author ruoyi + */ +@Service +@Slf4j +public class DictDataServiceImpl implements DictDataService { + + /** + * 排序 dictType > sort + */ + private static final Comparator COMPARATOR_TYPE_AND_SORT = Comparator + .comparing(DictDataDO::getDictType) + .thenComparingInt(DictDataDO::getSort); + + @Resource + private DictTypeService dictTypeService; + + @Resource + private DictDataMapper dictDataMapper; + + @Override + public List getDictDataList(Integer status, String dictType) { + List list = dictDataMapper.selectListByStatusAndDictType(status, dictType); + list.sort(COMPARATOR_TYPE_AND_SORT); + return list; + } + + @Override + public PageResult getDictDataPage(DictDataPageReqVO pageReqVO) { + return dictDataMapper.selectPage(pageReqVO); + } + + @Override + public DictDataDO getDictData(Long id) { + return dictDataMapper.selectById(id); + } + + @Override + public Long createDictData(DictDataSaveReqVO createReqVO) { + // 校验字典类型有效 + validateDictTypeExists(createReqVO.getDictType()); + // 校验字典数据的值的唯一性 + validateDictDataValueUnique(null, createReqVO.getDictType(), createReqVO.getValue()); + + // 插入字典类型 + DictDataDO dictData = BeanUtils.toBean(createReqVO, DictDataDO.class); + dictDataMapper.insert(dictData); + return dictData.getId(); + } + + @Override + public void updateDictData(DictDataSaveReqVO updateReqVO) { + // 校验自己存在 + validateDictDataExists(updateReqVO.getId()); + // 校验字典类型有效 + validateDictTypeExists(updateReqVO.getDictType()); + // 校验字典数据的值的唯一性 + validateDictDataValueUnique(updateReqVO.getId(), updateReqVO.getDictType(), updateReqVO.getValue()); + + // 更新字典类型 + DictDataDO updateObj = BeanUtils.toBean(updateReqVO, DictDataDO.class); + dictDataMapper.updateById(updateObj); + } + + @Override + public void deleteDictData(Long id) { + // 校验是否存在 + validateDictDataExists(id); + + // 删除字典数据 + dictDataMapper.deleteById(id); + } + + @Override + public long getDictDataCountByDictType(String dictType) { + return dictDataMapper.selectCountByDictType(dictType); + } + + @VisibleForTesting + public void validateDictDataValueUnique(Long id, String dictType, String value) { + DictDataDO dictData = dictDataMapper.selectByDictTypeAndValue(dictType, value); + if (dictData == null) { + return; + } + // 如果 id 为空,说明不用比较是否为相同 id 的字典数据 + if (id == null) { + throw exception(DICT_DATA_VALUE_DUPLICATE); + } + if (!dictData.getId().equals(id)) { + throw exception(DICT_DATA_VALUE_DUPLICATE); + } + } + + @VisibleForTesting + public void validateDictDataExists(Long id) { + if (id == null) { + return; + } + DictDataDO dictData = dictDataMapper.selectById(id); + if (dictData == null) { + throw exception(DICT_DATA_NOT_EXISTS); + } + } + + @VisibleForTesting + public void validateDictTypeExists(String type) { + DictTypeDO dictType = dictTypeService.getDictType(type); + if (dictType == null) { + throw exception(DICT_TYPE_NOT_EXISTS); + } + if (!CommonStatusEnum.ENABLE.getStatus().equals(dictType.getStatus())) { + throw exception(DICT_TYPE_NOT_ENABLE); + } + } + + @Override + public void validateDictDataList(String dictType, Collection values) { + if (CollUtil.isEmpty(values)) { + return; + } + Map dictDataMap = CollectionUtils.convertMap( + dictDataMapper.selectByDictTypeAndValues(dictType, values), DictDataDO::getValue); + // 校验 + values.forEach(value -> { + DictDataDO dictData = dictDataMap.get(value); + if (dictData == null) { + throw exception(DICT_DATA_NOT_EXISTS); + } + if (!CommonStatusEnum.ENABLE.getStatus().equals(dictData.getStatus())) { + throw exception(DICT_DATA_NOT_ENABLE, dictData.getLabel()); + } + }); + } + + @Override + public DictDataDO getDictData(String dictType, String value) { + return dictDataMapper.selectByDictTypeAndValue(dictType, value); + } + + @Override + public DictDataDO parseDictData(String dictType, String label) { + return dictDataMapper.selectByDictTypeAndLabel(dictType, label); + } + + @Override + public List getDictDataListByDictType(String dictType) { + List list = dictDataMapper.selectList(DictDataDO::getDictType, dictType); + list.sort(Comparator.comparing(DictDataDO::getSort)); + return list; + } + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/service/impl/DictTypeServiceImpl.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/service/impl/DictTypeServiceImpl.java new file mode 100644 index 0000000..7453366 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/service/impl/DictTypeServiceImpl.java @@ -0,0 +1,142 @@ +package com.platform.marketing.module.system.service.impl; + +import cn.hutool.core.util.StrUtil; +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.common.util.date.LocalDateTimeUtils; +import com.platform.marketing.framework.common.util.object.BeanUtils; +import com.platform.marketing.module.system.domain.vo.DictTypePageReqVO; +import com.platform.marketing.module.system.domain.vo.DictTypeSaveReqVO; +import com.platform.marketing.module.system.domain.dataobject.DictTypeDO; +import com.platform.marketing.module.system.mapper.DictTypeMapper; +import com.platform.marketing.module.system.service.DictDataService; +import com.platform.marketing.module.system.service.DictTypeService; +import com.google.common.annotations.VisibleForTesting; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.time.LocalDateTime; +import java.util.List; + +import static com.platform.marketing.framework.common.exception.util.ServiceExceptionUtil.exception; +import static com.platform.marketing.module.system.domain.enums.ErrorCodeConstants.*; + +/** + * 字典类型 Service 实现类 + * + + */ +@Service +public class DictTypeServiceImpl implements DictTypeService { + + @Resource + private DictDataService dictDataService; + + @Resource + private DictTypeMapper dictTypeMapper; + + @Override + public PageResult getDictTypePage(DictTypePageReqVO pageReqVO) { + return dictTypeMapper.selectPage(pageReqVO); + } + + @Override + public DictTypeDO getDictType(Long id) { + return dictTypeMapper.selectById(id); + } + + @Override + public DictTypeDO getDictType(String type) { + return dictTypeMapper.selectByType(type); + } + + @Override + public Long createDictType(DictTypeSaveReqVO createReqVO) { + // 校验字典类型的名字的唯一性 + validateDictTypeNameUnique(null, createReqVO.getName()); + // 校验字典类型的类型的唯一性 + validateDictTypeUnique(null, createReqVO.getType()); + + // 插入字典类型 + DictTypeDO dictType = BeanUtils.toBean(createReqVO, DictTypeDO.class); + dictType.setDeletedTime(LocalDateTimeUtils.EMPTY); // 唯一索引,避免 null 值 + dictTypeMapper.insert(dictType); + return dictType.getId(); + } + + @Override + public void updateDictType(DictTypeSaveReqVO updateReqVO) { + // 校验自己存在 + validateDictTypeExists(updateReqVO.getId()); + // 校验字典类型的名字的唯一性 + validateDictTypeNameUnique(updateReqVO.getId(), updateReqVO.getName()); + // 校验字典类型的类型的唯一性 + validateDictTypeUnique(updateReqVO.getId(), updateReqVO.getType()); + + // 更新字典类型 + DictTypeDO updateObj = BeanUtils.toBean(updateReqVO, DictTypeDO.class); + dictTypeMapper.updateById(updateObj); + } + + @Override + public void deleteDictType(Long id) { + // 校验是否存在 + DictTypeDO dictType = validateDictTypeExists(id); + // 校验是否有字典数据 + if (dictDataService.getDictDataCountByDictType(dictType.getType()) > 0) { + throw exception(DICT_TYPE_HAS_CHILDREN); + } + // 删除字典类型 + dictTypeMapper.updateToDelete(id, LocalDateTime.now()); + } + + @Override + public List getDictTypeList() { + return dictTypeMapper.selectList(); + } + + @VisibleForTesting + void validateDictTypeNameUnique(Long id, String name) { + DictTypeDO dictType = dictTypeMapper.selectByName(name); + if (dictType == null) { + return; + } + // 如果 id 为空,说明不用比较是否为相同 id 的字典类型 + if (id == null) { + throw exception(DICT_TYPE_NAME_DUPLICATE); + } + if (!dictType.getId().equals(id)) { + throw exception(DICT_TYPE_NAME_DUPLICATE); + } + } + + @VisibleForTesting + void validateDictTypeUnique(Long id, String type) { + if (StrUtil.isEmpty(type)) { + return; + } + DictTypeDO dictType = dictTypeMapper.selectByType(type); + if (dictType == null) { + return; + } + // 如果 id 为空,说明不用比较是否为相同 id 的字典类型 + if (id == null) { + throw exception(DICT_TYPE_TYPE_DUPLICATE); + } + if (!dictType.getId().equals(id)) { + throw exception(DICT_TYPE_TYPE_DUPLICATE); + } + } + + @VisibleForTesting + DictTypeDO validateDictTypeExists(Long id) { + if (id == null) { + return null; + } + DictTypeDO dictType = dictTypeMapper.selectById(id); + if (dictType == null) { + throw exception(DICT_TYPE_NOT_EXISTS); + } + return dictType; + } + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/service/impl/LoginLogServiceImpl.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/service/impl/LoginLogServiceImpl.java new file mode 100644 index 0000000..dfe3dda --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/service/impl/LoginLogServiceImpl.java @@ -0,0 +1,36 @@ +package com.platform.marketing.module.system.service.impl; + +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.common.util.object.BeanUtils; +import com.platform.marketing.module.system.domain.dto.LoginLogCreateReqDTO; +import com.platform.marketing.module.system.domain.vo.LoginLogPageReqVO; +import com.platform.marketing.module.system.domain.dataobject.LoginLogDO; +import com.platform.marketing.module.system.mapper.LoginLogMapper; +import com.platform.marketing.module.system.service.LoginLogService; +import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; + +import javax.annotation.Resource; + +/** + * 登录日志 Service 实现 + */ +@Service +@Validated +public class LoginLogServiceImpl implements LoginLogService { + + @Resource + private LoginLogMapper loginLogMapper; + + @Override + public PageResult getLoginLogPage(LoginLogPageReqVO pageReqVO) { + return loginLogMapper.selectPage(pageReqVO); + } + + @Override + public void createLoginLog(LoginLogCreateReqDTO reqDTO) { + LoginLogDO loginLog = BeanUtils.toBean(reqDTO, LoginLogDO.class); + loginLogMapper.insert(loginLog); + } + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/service/impl/MenuServiceImpl.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/service/impl/MenuServiceImpl.java new file mode 100644 index 0000000..627edac --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/service/impl/MenuServiceImpl.java @@ -0,0 +1,285 @@ +package com.platform.marketing.module.system.service.impl; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.ObjUtil; +import cn.hutool.core.util.StrUtil; +import com.platform.marketing.framework.common.enums.CommonStatusEnum; +import com.platform.marketing.framework.common.util.object.BeanUtils; +import com.platform.marketing.module.system.domain.vo.MenuListReqVO; +import com.platform.marketing.module.system.domain.vo.MenuSaveVO; +import com.platform.marketing.module.system.domain.dataobject.MenuDO; +import com.platform.marketing.module.system.mapper.MenuMapper; +import com.platform.marketing.module.system.domain.enums.RedisKeyConstants; +import com.platform.marketing.module.system.domain.enums.MenuTypeEnum; +import com.platform.marketing.module.system.service.MenuService; +import com.platform.marketing.module.system.service.PermissionService; +import com.google.common.annotations.VisibleForTesting; +import com.google.common.collect.Lists; +import lombok.extern.slf4j.Slf4j; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.util.*; + +import static com.platform.marketing.framework.common.exception.util.ServiceExceptionUtil.exception; +import static com.platform.marketing.framework.common.util.collection.CollectionUtils.convertList; +import static com.platform.marketing.framework.common.util.collection.CollectionUtils.convertMap; +import static com.platform.marketing.module.system.domain.dataobject.MenuDO.ID_ROOT; +import static com.platform.marketing.module.system.domain.enums.ErrorCodeConstants.*; + +/** + * 菜单 Service 实现 + * + + */ +@Service +@Slf4j +public class MenuServiceImpl implements MenuService { + + @Resource + private MenuMapper menuMapper; + @Resource + private PermissionService permissionService; + + + @Override + @CacheEvict(value = RedisKeyConstants.PERMISSION_MENU_ID_LIST, key = "#createReqVO.permission", + condition = "#createReqVO.permission != null") + public Long createMenu(MenuSaveVO createReqVO) { + // 校验父菜单存在 + validateParentMenu(createReqVO.getParentId(), null); + // 校验菜单(自己) + validateMenuName(createReqVO.getParentId(), createReqVO.getName(), null); + validateMenuComponentName(createReqVO.getComponentName(), null); + + // 插入数据库 + MenuDO menu = BeanUtils.toBean(createReqVO, MenuDO.class); + initMenuProperty(menu); + menuMapper.insert(menu); + // 返回 + return menu.getId(); + } + + @Override + @CacheEvict(value = RedisKeyConstants.PERMISSION_MENU_ID_LIST, + allEntries = true) // allEntries 清空所有缓存,因为 permission 如果变更,涉及到新老两个 permission。直接清理,简单有效 + public void updateMenu(MenuSaveVO updateReqVO) { + // 校验更新的菜单是否存在 + if (menuMapper.selectById(updateReqVO.getId()) == null) { + throw exception(MENU_NOT_EXISTS); + } + // 校验父菜单存在 + validateParentMenu(updateReqVO.getParentId(), updateReqVO.getId()); + // 校验菜单(自己) + validateMenuName(updateReqVO.getParentId(), updateReqVO.getName(), updateReqVO.getId()); + validateMenuComponentName(updateReqVO.getComponentName(), updateReqVO.getId()); + + // 更新到数据库 + MenuDO updateObj = BeanUtils.toBean(updateReqVO, MenuDO.class); + initMenuProperty(updateObj); + menuMapper.updateById(updateObj); + } + + @Override + @Transactional(rollbackFor = Exception.class) + @CacheEvict(value = RedisKeyConstants.PERMISSION_MENU_ID_LIST, + allEntries = true) // allEntries 清空所有缓存,因为此时不知道 id 对应的 permission 是多少。直接清理,简单有效 + public void deleteMenu(Long id) { + // 校验是否还有子菜单 + if (menuMapper.selectCountByParentId(id) > 0) { + throw exception(MENU_EXISTS_CHILDREN); + } + // 校验删除的菜单是否存在 + if (menuMapper.selectById(id) == null) { + throw exception(MENU_NOT_EXISTS); + } + // 标记删除 + menuMapper.deleteById(id); + // 删除授予给角色的权限 + permissionService.processMenuDeleted(id); + } + + @Override + public List getMenuList() { + return menuMapper.selectList(); + } + + @Override + public List getMenuListByTenant(MenuListReqVO reqVO) { + // 查询所有菜单,并过滤掉关闭的节点 + List menus = getMenuList(reqVO); + return menus; + } + + @Override + public List filterDisableMenus(List menuList) { + if (CollUtil.isEmpty(menuList)){ + return Collections.emptyList(); + } + Map menuMap = convertMap(menuList, MenuDO::getId); + + // 遍历 menu 菜单,查找不是禁用的菜单,添加到 enabledMenus 结果 + List enabledMenus = new ArrayList<>(); + Set disabledMenuCache = new HashSet<>(); // 存下递归搜索过被禁用的菜单,防止重复的搜索 + for (MenuDO menu : menuList) { + if (isMenuDisabled(menu, menuMap, disabledMenuCache)) { + continue; + } + enabledMenus.add(menu); + } + return enabledMenus; + } + + private boolean isMenuDisabled(MenuDO node, Map menuMap, Set disabledMenuCache) { + // 如果已经判定是禁用的节点,直接结束 + if (disabledMenuCache.contains(node.getId())) { + return true; + } + + // 1. 先判断自身是否禁用 + if (CommonStatusEnum.isDisable(node.getStatus())) { + disabledMenuCache.add(node.getId()); + return true; + } + + // 2. 遍历到 parentId 为根节点,则无需判断 + Long parentId = node.getParentId(); + if (ObjUtil.equal(parentId, ID_ROOT)) { + return false; + } + + // 3. 继续遍历 parent 节点 + MenuDO parent = menuMap.get(parentId); + if (parent == null || isMenuDisabled(parent, menuMap, disabledMenuCache)) { + disabledMenuCache.add(node.getId()); + return true; + } + return false; + } + + @Override + public List getMenuList(MenuListReqVO reqVO) { + return menuMapper.selectList(reqVO); + } + + @Override + @Cacheable(value = RedisKeyConstants.PERMISSION_MENU_ID_LIST, key = "#permission") + public List getMenuIdListByPermissionFromCache(String permission) { + List menus = menuMapper.selectListByPermission(permission); + return convertList(menus, MenuDO::getId); + } + + @Override + public MenuDO getMenu(Long id) { + return menuMapper.selectById(id); + } + + @Override + public List getMenuList(Collection ids) { + // 当 ids 为空时,返回一个空的实例对象 + if (CollUtil.isEmpty(ids)) { + return Lists.newArrayList(); + } + return menuMapper.selectBatchIds(ids); + } + + /** + * 校验父菜单是否合法 + *

+ * 1. 不能设置自己为父菜单 + * 2. 父菜单不存在 + * 3. 父菜单必须是 {@link MenuTypeEnum#MENU} 菜单类型 + * + * @param parentId 父菜单编号 + * @param childId 当前菜单编号 + */ + @VisibleForTesting + void validateParentMenu(Long parentId, Long childId) { + if (parentId == null || ID_ROOT.equals(parentId)) { + return; + } + // 不能设置自己为父菜单 + if (parentId.equals(childId)) { + throw exception(MENU_PARENT_ERROR); + } + MenuDO menu = menuMapper.selectById(parentId); + // 父菜单不存在 + if (menu == null) { + throw exception(MENU_PARENT_NOT_EXISTS); + } + // 父菜单必须是目录或者菜单类型 + if (!MenuTypeEnum.DIR.getType().equals(menu.getType()) + && !MenuTypeEnum.MENU.getType().equals(menu.getType())) { + throw exception(MENU_PARENT_NOT_DIR_OR_MENU); + } + } + + /** + * 校验菜单是否合法 + *

+ * 1. 校验相同父菜单编号下,是否存在相同的菜单名 + * + * @param name 菜单名字 + * @param parentId 父菜单编号 + * @param id 菜单编号 + */ + @VisibleForTesting + void validateMenuName(Long parentId, String name, Long id) { + MenuDO menu = menuMapper.selectByParentIdAndName(parentId, name); + if (menu == null) { + return; + } + // 如果 id 为空,说明不用比较是否为相同 id 的菜单 + if (id == null) { + throw exception(MENU_NAME_DUPLICATE); + } + if (!menu.getId().equals(id)) { + throw exception(MENU_NAME_DUPLICATE); + } + } + + /** + * 校验菜单组件名是否合法 + * + * @param componentName 组件名 + * @param id 菜单编号 + */ + @VisibleForTesting + void validateMenuComponentName(String componentName, Long id) { + if (StrUtil.isBlank(componentName)) { + return; + } + MenuDO menu = menuMapper.selectByComponentName(componentName); + if (menu == null) { + return; + } + // 如果 id 为空,说明不用比较是否为相同 id 的菜单 + if (id == null) { + return; + } + if (!menu.getId().equals(id)) { + throw exception(MENU_COMPONENT_NAME_DUPLICATE); + } + } + + /** + * 初始化菜单的通用属性。 + *

+ * 例如说,只有目录或者菜单类型的菜单,才设置 icon + * + * @param menu 菜单 + */ + private void initMenuProperty(MenuDO menu) { + // 菜单为按钮类型时,无需 component、icon、path 属性,进行置空 + if (MenuTypeEnum.BUTTON.getType().equals(menu.getType())) { + menu.setComponent(""); + menu.setComponentName(""); + menu.setIcon(""); + menu.setPath(""); + } + } + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/service/impl/NoticeServiceImpl.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/service/impl/NoticeServiceImpl.java new file mode 100644 index 0000000..e9982d4 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/service/impl/NoticeServiceImpl.java @@ -0,0 +1,74 @@ +package com.platform.marketing.module.system.service.impl; + +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.common.util.object.BeanUtils; +import com.platform.marketing.module.system.domain.vo.NoticePageReqVO; +import com.platform.marketing.module.system.domain.vo.NoticeSaveReqVO; +import com.platform.marketing.module.system.domain.dataobject.NoticeDO; +import com.platform.marketing.module.system.mapper.NoticeMapper; +import com.platform.marketing.module.system.service.NoticeService; +import com.google.common.annotations.VisibleForTesting; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; + +import static com.platform.marketing.framework.common.exception.util.ServiceExceptionUtil.exception; +import static com.platform.marketing.module.system.domain.enums.ErrorCodeConstants.NOTICE_NOT_FOUND; + +/** + * 通知公告 Service 实现类 + * + + */ +@Service +public class NoticeServiceImpl implements NoticeService { + + @Resource + private NoticeMapper noticeMapper; + + @Override + public Long createNotice(NoticeSaveReqVO createReqVO) { + NoticeDO notice = BeanUtils.toBean(createReqVO, NoticeDO.class); + noticeMapper.insert(notice); + return notice.getId(); + } + + @Override + public void updateNotice(NoticeSaveReqVO updateReqVO) { + // 校验是否存在 + validateNoticeExists(updateReqVO.getId()); + // 更新通知公告 + NoticeDO updateObj = BeanUtils.toBean(updateReqVO, NoticeDO.class); + noticeMapper.updateById(updateObj); + } + + @Override + public void deleteNotice(Long id) { + // 校验是否存在 + validateNoticeExists(id); + // 删除通知公告 + noticeMapper.deleteById(id); + } + + @Override + public PageResult getNoticePage(NoticePageReqVO reqVO) { + return noticeMapper.selectPage(reqVO); + } + + @Override + public NoticeDO getNotice(Long id) { + return noticeMapper.selectById(id); + } + + @VisibleForTesting + public void validateNoticeExists(Long id) { + if (id == null) { + return; + } + NoticeDO notice = noticeMapper.selectById(id); + if (notice == null) { + throw exception(NOTICE_NOT_FOUND); + } + } + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/service/impl/OperateLogServiceImpl.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/service/impl/OperateLogServiceImpl.java new file mode 100644 index 0000000..2c9ad51 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/service/impl/OperateLogServiceImpl.java @@ -0,0 +1,41 @@ +package com.platform.marketing.module.system.service.impl; + +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.common.util.object.BeanUtils; +import com.platform.marketing.module.system.domain.vo.OperateLogPageReqVO; +import com.platform.marketing.module.system.domain.dataobject.OperateLogDO; +import com.platform.marketing.module.system.framework.operatelog.core.dto.OperateLogCreateReqDTO; +import com.platform.marketing.module.system.mapper.OperateLogMapper; +import com.platform.marketing.module.system.service.OperateLogService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; + +import javax.annotation.Resource; + +/** + * 操作日志 Service 实现类 + * + + */ +@Service +@Validated +@Slf4j +public class OperateLogServiceImpl implements OperateLogService { + + @Resource + private OperateLogMapper operateLogMapper; + + @Override + public PageResult getOperateLogPage(OperateLogPageReqVO pageReqVO) { + return operateLogMapper.selectPage(pageReqVO); + } + + @Override + public void createOperateLog(OperateLogCreateReqDTO createReqDTO) { + OperateLogDO log = BeanUtils.toBean(createReqDTO, OperateLogDO.class); + operateLogMapper.insert(log); + } + + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/service/impl/PermissionServiceImpl.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/service/impl/PermissionServiceImpl.java new file mode 100644 index 0000000..2d8e25d --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/service/impl/PermissionServiceImpl.java @@ -0,0 +1,338 @@ +package com.platform.marketing.module.system.service.impl; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.util.ArrayUtil; +import cn.hutool.extra.spring.SpringUtil; +import com.platform.marketing.framework.common.enums.CommonStatusEnum; +import com.platform.marketing.framework.common.util.collection.CollectionUtils; +import com.platform.marketing.framework.security.core.dto.DeptDataPermissionRespDTO; +import com.platform.marketing.module.system.domain.dataobject.MenuDO; +import com.platform.marketing.module.system.domain.dataobject.RoleDO; +import com.platform.marketing.module.system.domain.dataobject.RoleMenuDO; +import com.platform.marketing.module.system.domain.dataobject.UserRoleDO; +import com.platform.marketing.module.system.mapper.RoleMenuMapper; +import com.platform.marketing.module.system.mapper.UserRoleMapper; +import com.platform.marketing.module.system.domain.enums.RedisKeyConstants; +import com.platform.marketing.module.system.domain.enums.DataScopeEnum; +import com.platform.marketing.module.system.service.*; +import com.baomidou.dynamic.datasource.annotation.DSTransactional; +import com.google.common.annotations.VisibleForTesting; +import com.google.common.base.Suppliers; +import com.google.common.collect.Sets; +import lombok.extern.slf4j.Slf4j; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.cache.annotation.Caching; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.util.*; +import java.util.function.Supplier; + +import static com.platform.marketing.framework.common.util.collection.CollectionUtils.convertSet; +import static com.platform.marketing.framework.common.util.json.JsonUtils.toJsonString; + +/** + * 权限 Service 实现类 + * + + */ +@Service +@Slf4j +public class PermissionServiceImpl implements PermissionService { + + @Resource + private RoleMenuMapper roleMenuMapper; + @Resource + private UserRoleMapper userRoleMapper; + + @Resource + private RoleService roleService; + @Resource + private MenuService menuService; + @Resource + private DeptService deptService; + @Resource + private AdminUserService userService; + + @Override + public boolean hasAnyPermissions(Long userId, String... permissions) { + // 如果为空,说明已经有权限 + if (ArrayUtil.isEmpty(permissions)) { + return true; + } + + // 获得当前登录的角色。如果为空,说明没有权限 + List roles = getEnableUserRoleListByUserIdFromCache(userId); + if (CollUtil.isEmpty(roles)) { + return false; + } + + // 情况一:遍历判断每个权限,如果有一满足,说明有权限 + for (String permission : permissions) { + if (hasAnyPermission(roles, permission)) { + return true; + } + } + + // 情况二:如果是超管,也说明有权限 + return roleService.hasAnySuperAdmin(convertSet(roles, RoleDO::getId)); + } + + /** + * 判断指定角色,是否拥有该 permission 权限 + * + * @param roles 指定角色数组 + * @param permission 权限标识 + * @return 是否拥有 + */ + private boolean hasAnyPermission(List roles, String permission) { + List menuIds = menuService.getMenuIdListByPermissionFromCache(permission); + // 采用严格模式,如果权限找不到对应的 Menu 的话,也认为没有权限 + if (CollUtil.isEmpty(menuIds)) { + return false; + } + + // 判断是否有权限 + Set roleIds = convertSet(roles, RoleDO::getId); + for (Long menuId : menuIds) { + // 获得拥有该菜单的角色编号集合 + Set menuRoleIds = getSelf().getMenuRoleIdListByMenuIdFromCache(menuId); + // 如果有交集,说明有权限 + if (CollUtil.containsAny(menuRoleIds, roleIds)) { + return true; + } + } + return false; + } + + @Override + public boolean hasAnyRoles(Long userId, String... roles) { + // 如果为空,说明已经有权限 + if (ArrayUtil.isEmpty(roles)) { + return true; + } + + // 获得当前登录的角色。如果为空,说明没有权限 + List roleList = getEnableUserRoleListByUserIdFromCache(userId); + if (CollUtil.isEmpty(roleList)) { + return false; + } + + // 判断是否有角色 + Set userRoles = convertSet(roleList, RoleDO::getCode); + return CollUtil.containsAny(userRoles, Sets.newHashSet(roles)); + } + + // ========== 角色-菜单的相关方法 ========== + + @Override + @DSTransactional // 多数据源,使用 @DSTransactional 保证本地事务,以及数据源的切换 + @Caching(evict = { + @CacheEvict(value = RedisKeyConstants.MENU_ROLE_ID_LIST, + allEntries = true), + @CacheEvict(value = RedisKeyConstants.PERMISSION_MENU_ID_LIST, + allEntries = true) // allEntries 清空所有缓存,主要一次更新涉及到的 menuIds 较多,反倒批量会更快 + }) + public void assignRoleMenu(Long roleId, Set menuIds) { + // 获得角色拥有菜单编号 + Set dbMenuIds = convertSet(roleMenuMapper.selectListByRoleId(roleId), RoleMenuDO::getMenuId); + // 计算新增和删除的菜单编号 + Set menuIdList = CollUtil.emptyIfNull(menuIds); + Collection createMenuIds = CollUtil.subtract(menuIdList, dbMenuIds); + Collection deleteMenuIds = CollUtil.subtract(dbMenuIds, menuIdList); + // 执行新增和删除。对于已经授权的菜单,不用做任何处理 + if (CollUtil.isNotEmpty(createMenuIds)) { + roleMenuMapper.insertBatch(CollectionUtils.convertList(createMenuIds, menuId -> { + RoleMenuDO entity = new RoleMenuDO(); + entity.setRoleId(roleId); + entity.setMenuId(menuId); + return entity; + })); + } + if (CollUtil.isNotEmpty(deleteMenuIds)) { + roleMenuMapper.deleteListByRoleIdAndMenuIds(roleId, deleteMenuIds); + } + } + + @Override + @Transactional(rollbackFor = Exception.class) + @Caching(evict = { + @CacheEvict(value = RedisKeyConstants.MENU_ROLE_ID_LIST, + allEntries = true), // allEntries 清空所有缓存,此处无法方便获得 roleId 对应的 menu 缓存们 + @CacheEvict(value = RedisKeyConstants.USER_ROLE_ID_LIST, + allEntries = true) // allEntries 清空所有缓存,此处无法方便获得 roleId 对应的 user 缓存们 + }) + public void processRoleDeleted(Long roleId) { + // 标记删除 UserRole + userRoleMapper.deleteListByRoleId(roleId); + // 标记删除 RoleMenu + roleMenuMapper.deleteListByRoleId(roleId); + } + + @Override + @CacheEvict(value = RedisKeyConstants.MENU_ROLE_ID_LIST, key = "#menuId") + public void processMenuDeleted(Long menuId) { + roleMenuMapper.deleteListByMenuId(menuId); + } + + @Override + public Set getRoleMenuListByRoleId(Collection roleIds) { + if (CollUtil.isEmpty(roleIds)) { + return Collections.emptySet(); + } + + // 如果是管理员的情况下,获取全部菜单编号 + if (roleService.hasAnySuperAdmin(roleIds)) { + return convertSet(menuService.getMenuList(), MenuDO::getId); + } + // 如果是非管理员的情况下,获得拥有的菜单编号 + return convertSet(roleMenuMapper.selectListByRoleId(roleIds), RoleMenuDO::getMenuId); + } + + @Override + @Cacheable(value = RedisKeyConstants.MENU_ROLE_ID_LIST, key = "#menuId") + public Set getMenuRoleIdListByMenuIdFromCache(Long menuId) { + return convertSet(roleMenuMapper.selectListByMenuId(menuId), RoleMenuDO::getRoleId); + } + + // ========== 用户-角色的相关方法 ========== + + @Override + @DSTransactional // 多数据源,使用 @DSTransactional 保证本地事务,以及数据源的切换 + @CacheEvict(value = RedisKeyConstants.USER_ROLE_ID_LIST, key = "#userId") + public void assignUserRole(Long userId, Set roleIds) { + // 获得角色拥有角色编号 + Set dbRoleIds = convertSet(userRoleMapper.selectListByUserId(userId), + UserRoleDO::getRoleId); + // 计算新增和删除的角色编号 + Set roleIdList = CollUtil.emptyIfNull(roleIds); + Collection createRoleIds = CollUtil.subtract(roleIdList, dbRoleIds); + Collection deleteMenuIds = CollUtil.subtract(dbRoleIds, roleIdList); + // 执行新增和删除。对于已经授权的角色,不用做任何处理 + if (!CollectionUtil.isEmpty(createRoleIds)) { + userRoleMapper.insertBatch(CollectionUtils.convertList(createRoleIds, roleId -> { + UserRoleDO entity = new UserRoleDO(); + entity.setUserId(userId); + entity.setRoleId(roleId); + return entity; + })); + } + if (!CollectionUtil.isEmpty(deleteMenuIds)) { + userRoleMapper.deleteListByUserIdAndRoleIdIds(userId, deleteMenuIds); + } + } + + @Override + @CacheEvict(value = RedisKeyConstants.USER_ROLE_ID_LIST, key = "#userId") + public void processUserDeleted(Long userId) { + userRoleMapper.deleteListByUserId(userId); + } + + @Override + public Set getUserRoleIdListByUserId(Long userId) { + return convertSet(userRoleMapper.selectListByUserId(userId), UserRoleDO::getRoleId); + } + + @Override + @Cacheable(value = RedisKeyConstants.USER_ROLE_ID_LIST, key = "#userId") + public Set getUserRoleIdListByUserIdFromCache(Long userId) { + return getUserRoleIdListByUserId(userId); + } + + @Override + public Set getUserRoleIdListByRoleId(Collection roleIds) { + return convertSet(userRoleMapper.selectListByRoleIds(roleIds), UserRoleDO::getUserId); + } + + /** + * 获得用户拥有的角色,并且这些角色是开启状态的 + * + * @param userId 用户编号 + * @return 用户拥有的角色 + */ + @VisibleForTesting + List getEnableUserRoleListByUserIdFromCache(Long userId) { + // 获得用户拥有的角色编号 + Set roleIds = getSelf().getUserRoleIdListByUserIdFromCache(userId); + // 获得角色数组,并移除被禁用的 + List roles = roleService.getRoleListFromCache(roleIds); + roles.removeIf(role -> !CommonStatusEnum.ENABLE.getStatus().equals(role.getStatus())); + return roles; + } + + // ========== 用户-部门的相关方法 ========== + + @Override + public void assignRoleDataScope(Long roleId, Integer dataScope, Set dataScopeDeptIds) { + roleService.updateRoleDataScope(roleId, dataScope, dataScopeDeptIds); + } + + @Override + public DeptDataPermissionRespDTO getDeptDataPermission(Long userId) { + // 获得用户的角色 + List roles = getEnableUserRoleListByUserIdFromCache(userId); + + // 如果角色为空,则只能查看自己 + DeptDataPermissionRespDTO result = new DeptDataPermissionRespDTO(); + if (CollUtil.isEmpty(roles)) { + result.setSelf(true); + return result; + } + + // 获得用户的部门编号的缓存,通过 Guava 的 Suppliers 惰性求值,即有且仅有第一次发起 DB 的查询 + Supplier userDeptId = Suppliers.memoize(() -> userService.getUser(userId).getDeptId()); + // 遍历每个角色,计算 + for (RoleDO role : roles) { + // 为空时,跳过 + if (role.getDataScope() == null) { + continue; + } + // 情况一,ALL + if (Objects.equals(role.getDataScope(), DataScopeEnum.ALL.getScope())) { + result.setAll(true); + continue; + } + // 情况二,DEPT_CUSTOM + if (Objects.equals(role.getDataScope(), DataScopeEnum.DEPT_CUSTOM.getScope())) { + CollUtil.addAll(result.getDeptIds(), role.getDataScopeDeptIds()); + // 自定义可见部门时,保证可以看到自己所在的部门。否则,一些场景下可能会有问题。 + // 例如说,登录时,基于 t_user 的 username 查询会可能被 dept_id 过滤掉 + CollUtil.addAll(result.getDeptIds(), userDeptId.get()); + continue; + } + // 情况三,DEPT_ONLY + if (Objects.equals(role.getDataScope(), DataScopeEnum.DEPT_ONLY.getScope())) { + CollectionUtils.addIfNotNull(result.getDeptIds(), userDeptId.get()); + continue; + } + // 情况四,DEPT_DEPT_AND_CHILD + if (Objects.equals(role.getDataScope(), DataScopeEnum.DEPT_AND_CHILD.getScope())) { + CollUtil.addAll(result.getDeptIds(), deptService.getChildDeptIdListFromCache(userDeptId.get())); + // 添加本身部门编号 + CollUtil.addAll(result.getDeptIds(), userDeptId.get()); + continue; + } + // 情况五,SELF + if (Objects.equals(role.getDataScope(), DataScopeEnum.SELF.getScope())) { + result.setSelf(true); + continue; + } + // 未知情况,error log 即可 + log.error("[getDeptDataPermission][LoginUser({}) role({}) 无法处理]", userId, toJsonString(result)); + } + return result; + } + + /** + * 获得自身的代理对象,解决 AOP 生效问题 + * + * @return 自己 + */ + private PermissionServiceImpl getSelf() { + return SpringUtil.getBean(getClass()); + } + +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/service/impl/PostServiceImpl.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/service/impl/PostServiceImpl.java new file mode 100644 index 0000000..b32f4dd --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/service/impl/PostServiceImpl.java @@ -0,0 +1,154 @@ +package com.platform.marketing.module.system.service.impl; + +import cn.hutool.core.collection.CollUtil; +import com.platform.marketing.framework.common.enums.CommonStatusEnum; +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.common.util.object.BeanUtils; +import com.platform.marketing.module.system.domain.vo.PostPageReqVO; +import com.platform.marketing.module.system.domain.vo.PostSaveReqVO; +import com.platform.marketing.module.system.domain.dataobject.PostDO; +import com.platform.marketing.module.system.mapper.PostMapper; +import com.platform.marketing.module.system.service.PostService; +import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; + +import javax.annotation.Resource; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import static com.platform.marketing.framework.common.exception.util.ServiceExceptionUtil.exception; +import static com.platform.marketing.framework.common.util.collection.CollectionUtils.convertMap; +import static com.platform.marketing.module.system.domain.enums.ErrorCodeConstants.*; + +/** + * 岗位 Service 实现类 + * + + */ +@Service +@Validated +public class PostServiceImpl implements PostService { + + @Resource + private PostMapper postMapper; + + @Override + public Long createPost(PostSaveReqVO createReqVO) { + // 校验正确性 + validatePostForCreateOrUpdate(null, createReqVO.getName(), createReqVO.getCode()); + + // 插入岗位 + PostDO post = BeanUtils.toBean(createReqVO, PostDO.class); + postMapper.insert(post); + return post.getId(); + } + + @Override + public void updatePost(PostSaveReqVO updateReqVO) { + // 校验正确性 + validatePostForCreateOrUpdate(updateReqVO.getId(), updateReqVO.getName(), updateReqVO.getCode()); + + // 更新岗位 + PostDO updateObj = BeanUtils.toBean(updateReqVO, PostDO.class); + postMapper.updateById(updateObj); + } + + @Override + public void deletePost(Long id) { + // 校验是否存在 + validatePostExists(id); + // 删除部门 + postMapper.deleteById(id); + } + + private void validatePostForCreateOrUpdate(Long id, String name, String code) { + // 校验自己存在 + validatePostExists(id); + // 校验岗位名的唯一性 + validatePostNameUnique(id, name); + // 校验岗位编码的唯一性 + validatePostCodeUnique(id, code); + } + + private void validatePostNameUnique(Long id, String name) { + PostDO post = postMapper.selectByName(name); + if (post == null) { + return; + } + // 如果 id 为空,说明不用比较是否为相同 id 的岗位 + if (id == null) { + throw exception(POST_NAME_DUPLICATE); + } + if (!post.getId().equals(id)) { + throw exception(POST_NAME_DUPLICATE); + } + } + + private void validatePostCodeUnique(Long id, String code) { + PostDO post = postMapper.selectByCode(code); + if (post == null) { + return; + } + // 如果 id 为空,说明不用比较是否为相同 id 的岗位 + if (id == null) { + throw exception(POST_CODE_DUPLICATE); + } + if (!post.getId().equals(id)) { + throw exception(POST_CODE_DUPLICATE); + } + } + + private void validatePostExists(Long id) { + if (id == null) { + return; + } + if (postMapper.selectById(id) == null) { + throw exception(POST_NOT_FOUND); + } + } + + @Override + public List getPostList(Collection ids) { + if (CollUtil.isEmpty(ids)) { + return Collections.emptyList(); + } + return postMapper.selectBatchIds(ids); + } + + @Override + public List getPostList(Collection ids, Collection statuses) { + return postMapper.selectList(ids, statuses); + } + + @Override + public PageResult getPostPage(PostPageReqVO reqVO) { + return postMapper.selectPage(reqVO); + } + + @Override + public PostDO getPost(Long id) { + return postMapper.selectById(id); + } + + @Override + public void validatePostList(Collection ids) { + if (CollUtil.isEmpty(ids)) { + return; + } + // 获得岗位信息 + List posts = postMapper.selectBatchIds(ids); + Map postMap = convertMap(posts, PostDO::getId); + // 校验 + ids.forEach(id -> { + PostDO post = postMap.get(id); + if (post == null) { + throw exception(POST_NOT_FOUND); + } + if (!CommonStatusEnum.ENABLE.getStatus().equals(post.getStatus())) { + throw exception(POST_NOT_ENABLE, post.getName()); + } + }); + } +} diff --git a/marketing-module-system/src/main/java/com/platform/marketing/module/system/service/impl/RoleServiceImpl.java b/marketing-module-system/src/main/java/com/platform/marketing/module/system/service/impl/RoleServiceImpl.java new file mode 100644 index 0000000..84175c7 --- /dev/null +++ b/marketing-module-system/src/main/java/com/platform/marketing/module/system/service/impl/RoleServiceImpl.java @@ -0,0 +1,264 @@ +package com.platform.marketing.module.system.service.impl; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.util.ObjUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.extra.spring.SpringUtil; +import com.platform.marketing.framework.common.enums.CommonStatusEnum; +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.common.util.collection.CollectionUtils; +import com.platform.marketing.framework.common.util.object.BeanUtils; +import com.platform.marketing.module.system.domain.vo.RolePageReqVO; +import com.platform.marketing.module.system.domain.vo.RoleSaveReqVO; +import com.platform.marketing.module.system.domain.dataobject.RoleDO; +import com.platform.marketing.module.system.mapper.RoleMapper; +import com.platform.marketing.module.system.domain.enums.RedisKeyConstants; +import com.platform.marketing.module.system.domain.enums.DataScopeEnum; +import com.platform.marketing.module.system.domain.enums.RoleCodeEnum; +import com.platform.marketing.module.system.domain.enums.RoleTypeEnum; +import com.platform.marketing.module.system.service.PermissionService; +import com.platform.marketing.module.system.service.RoleService; +import com.google.common.annotations.VisibleForTesting; +import com.mzt.logapi.context.LogRecordContext; +import com.mzt.logapi.service.impl.DiffParseFunction; +import com.mzt.logapi.starter.annotation.LogRecord; +import lombok.extern.slf4j.Slf4j; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.StringUtils; + +import javax.annotation.Resource; +import java.util.*; + +import static com.platform.marketing.framework.common.exception.util.ServiceExceptionUtil.exception; +import static com.platform.marketing.framework.common.util.collection.CollectionUtils.convertMap; +import static com.platform.marketing.module.system.domain.enums.ErrorCodeConstants.*; +import static com.platform.marketing.module.system.domain.enums.LogRecordConstants.*; + +/** + * 角色 Service 实现类 + * + + */ +@Service +@Slf4j +public class RoleServiceImpl implements RoleService { + + @Resource + private PermissionService permissionService; + + @Resource + private RoleMapper roleMapper; + + @Override + @Transactional(rollbackFor = Exception.class) + @LogRecord(type = SYSTEM_ROLE_TYPE, subType = SYSTEM_ROLE_CREATE_SUB_TYPE, bizNo = "{{#role.id}}", + success = SYSTEM_ROLE_CREATE_SUCCESS) + public Long createRole(RoleSaveReqVO createReqVO, Integer type) { + // 1. 校验角色 + validateRoleDuplicate(createReqVO.getName(), createReqVO.getCode(), null); + + // 2. 插入到数据库 + RoleDO role = BeanUtils.toBean(createReqVO, RoleDO.class) + .setType(ObjectUtil.defaultIfNull(type, RoleTypeEnum.CUSTOM.getType())) + .setStatus(ObjUtil.defaultIfNull(createReqVO.getStatus(), CommonStatusEnum.ENABLE.getStatus())) + .setDataScope(DataScopeEnum.ALL.getScope()); // 默认可查看所有数据。原因是,可能一些项目不需要项目权限 + roleMapper.insert(role); + + // 3. 记录操作日志上下文 + LogRecordContext.putVariable("role", role); + return role.getId(); + } + + @Override + @CacheEvict(value = RedisKeyConstants.ROLE, key = "#updateReqVO.id") + @LogRecord(type = SYSTEM_ROLE_TYPE, subType = SYSTEM_ROLE_UPDATE_SUB_TYPE, bizNo = "{{#updateReqVO.id}}", + success = SYSTEM_ROLE_UPDATE_SUCCESS) + public void updateRole(RoleSaveReqVO updateReqVO) { + // 1.1 校验是否可以更新 + RoleDO role = validateRoleForUpdate(updateReqVO.getId()); + // 1.2 校验角色的唯一字段是否重复 + validateRoleDuplicate(updateReqVO.getName(), updateReqVO.getCode(), updateReqVO.getId()); + + // 2. 更新到数据库 + RoleDO updateObj = BeanUtils.toBean(updateReqVO, RoleDO.class); + roleMapper.updateById(updateObj); + + // 3. 记录操作日志上下文 + LogRecordContext.putVariable(DiffParseFunction.OLD_OBJECT, BeanUtils.toBean(role, RoleSaveReqVO.class)); + LogRecordContext.putVariable("role", role); + } + + @Override + @CacheEvict(value = RedisKeyConstants.ROLE, key = "#id") + public void updateRoleDataScope(Long id, Integer dataScope, Set dataScopeDeptIds) { + // 校验是否可以更新 + validateRoleForUpdate(id); + + // 更新数据范围 + RoleDO updateObject = new RoleDO(); + updateObject.setId(id); + updateObject.setDataScope(dataScope); + updateObject.setDataScopeDeptIds(dataScopeDeptIds); + roleMapper.updateById(updateObject); + } + + @Override + @Transactional(rollbackFor = Exception.class) + @CacheEvict(value = RedisKeyConstants.ROLE, key = "#id") + @LogRecord(type = SYSTEM_ROLE_TYPE, subType = SYSTEM_ROLE_DELETE_SUB_TYPE, bizNo = "{{#id}}", + success = SYSTEM_ROLE_DELETE_SUCCESS) + public void deleteRole(Long id) { + // 1. 校验是否可以更新 + RoleDO role = validateRoleForUpdate(id); + + // 2.1 标记删除 + roleMapper.deleteById(id); + // 2.2 删除相关数据 + permissionService.processRoleDeleted(id); + + // 3. 记录操作日志上下文 + LogRecordContext.putVariable("role", role); + } + + /** + * 校验角色的唯一字段是否重复 + * + * 1. 是否存在相同名字的角色 + * 2. 是否存在相同编码的角色 + * + * @param name 角色名字 + * @param code 角色额编码 + * @param id 角色编号 + */ + @VisibleForTesting + void validateRoleDuplicate(String name, String code, Long id) { + // 0. 超级管理员,不允许创建 + if (RoleCodeEnum.isSuperAdmin(code)) { + throw exception(ROLE_ADMIN_CODE_ERROR, code); + } + // 1. 该 name 名字被其它角色所使用 + RoleDO role = roleMapper.selectByName(name); + if (role != null && !role.getId().equals(id)) { + throw exception(ROLE_NAME_DUPLICATE, name); + } + // 2. 是否存在相同编码的角色 + if (!StringUtils.hasText(code)) { + return; + } + // 该 code 编码被其它角色所使用 + role = roleMapper.selectByCode(code); + if (role != null && !role.getId().equals(id)) { + throw exception(ROLE_CODE_DUPLICATE, code); + } + } + + /** + * 校验角色是否可以被更新 + * + * @param id 角色编号 + */ + @VisibleForTesting + RoleDO validateRoleForUpdate(Long id) { + RoleDO role = roleMapper.selectById(id); + if (role == null) { + throw exception(ROLE_NOT_EXISTS); + } + // 内置角色,不允许删除 + if (RoleTypeEnum.SYSTEM.getType().equals(role.getType())) { + throw exception(ROLE_CAN_NOT_UPDATE_SYSTEM_TYPE_ROLE); + } + return role; + } + + @Override + public RoleDO getRole(Long id) { + return roleMapper.selectById(id); + } + + @Override + @Cacheable(value = RedisKeyConstants.ROLE, key = "#id", + unless = "#result == null") + public RoleDO getRoleFromCache(Long id) { + return roleMapper.selectById(id); + } + + + @Override + public List getRoleListByStatus(Collection statuses) { + return roleMapper.selectListByStatus(statuses); + } + + @Override + public List getRoleList() { + return roleMapper.selectList(); + } + + @Override + public List getRoleList(Collection ids) { + if (CollectionUtil.isEmpty(ids)) { + return Collections.emptyList(); + } + return roleMapper.selectBatchIds(ids); + } + + @Override + public List getRoleListFromCache(Collection ids) { + if (CollectionUtil.isEmpty(ids)) { + return Collections.emptyList(); + } + // 这里采用 for 循环从缓存中获取,主要考虑 Spring CacheManager 无法批量操作的问题 + RoleServiceImpl self = getSelf(); + return CollectionUtils.convertList(ids, self::getRoleFromCache); + } + + @Override + public PageResult getRolePage(RolePageReqVO reqVO) { + return roleMapper.selectPage(reqVO); + } + + @Override + public boolean hasAnySuperAdmin(Collection ids) { + if (CollectionUtil.isEmpty(ids)) { + return false; + } + RoleServiceImpl self = getSelf(); + return ids.stream().anyMatch(id -> { + RoleDO role = self.getRoleFromCache(id); + return role != null && RoleCodeEnum.isSuperAdmin(role.getCode()); + }); + } + + @Override + public void validateRoleList(Collection ids) { + if (CollUtil.isEmpty(ids)) { + return; + } + // 获得角色信息 + List roles = roleMapper.selectBatchIds(ids); + Map roleMap = convertMap(roles, RoleDO::getId); + // 校验 + ids.forEach(id -> { + RoleDO role = roleMap.get(id); + if (role == null) { + throw exception(ROLE_NOT_EXISTS); + } + if (!CommonStatusEnum.ENABLE.getStatus().equals(role.getStatus())) { + throw exception(ROLE_IS_DISABLE, role.getName()); + } + }); + } + + /** + * 获得自身的代理对象,解决 AOP 生效问题 + * + * @return 自己 + */ + private RoleServiceImpl getSelf() { + return SpringUtil.getBean(getClass()); + } + +} diff --git a/marketing-module-system/src/main/resources/META-INF/services/com.xingyuv.captcha.service.CaptchaCacheService b/marketing-module-system/src/main/resources/META-INF/services/com.xingyuv.captcha.service.CaptchaCacheService new file mode 100644 index 0000000..d2b005f --- /dev/null +++ b/marketing-module-system/src/main/resources/META-INF/services/com.xingyuv.captcha.service.CaptchaCacheService @@ -0,0 +1 @@ +com.platform.marketing.module.system.framework.captcha.core.RedisCaptchaServiceImpl diff --git a/marketing-module-system/src/main/resources/images/jigsaw/original/bg1.png b/marketing-module-system/src/main/resources/images/jigsaw/original/bg1.png new file mode 100644 index 0000000..c481457 Binary files /dev/null and b/marketing-module-system/src/main/resources/images/jigsaw/original/bg1.png differ diff --git a/marketing-module-system/src/main/resources/images/jigsaw/original/bg2.png b/marketing-module-system/src/main/resources/images/jigsaw/original/bg2.png new file mode 100644 index 0000000..bf8fb38 Binary files /dev/null and b/marketing-module-system/src/main/resources/images/jigsaw/original/bg2.png differ diff --git a/marketing-module-system/src/main/resources/images/jigsaw/original/bg3.png b/marketing-module-system/src/main/resources/images/jigsaw/original/bg3.png new file mode 100644 index 0000000..f871d3d Binary files /dev/null and b/marketing-module-system/src/main/resources/images/jigsaw/original/bg3.png differ diff --git a/marketing-module-system/src/main/resources/images/jigsaw/original/bg4.png b/marketing-module-system/src/main/resources/images/jigsaw/original/bg4.png new file mode 100644 index 0000000..2e3d871 Binary files /dev/null and b/marketing-module-system/src/main/resources/images/jigsaw/original/bg4.png differ diff --git a/marketing-module-system/src/main/resources/images/jigsaw/original/bg5.png b/marketing-module-system/src/main/resources/images/jigsaw/original/bg5.png new file mode 100644 index 0000000..fe383b7 Binary files /dev/null and b/marketing-module-system/src/main/resources/images/jigsaw/original/bg5.png differ diff --git a/marketing-module-system/src/main/resources/images/jigsaw/original/bg6.png b/marketing-module-system/src/main/resources/images/jigsaw/original/bg6.png new file mode 100644 index 0000000..5024ceb Binary files /dev/null and b/marketing-module-system/src/main/resources/images/jigsaw/original/bg6.png differ diff --git a/marketing-module-system/src/main/resources/images/jigsaw/original/bg7.png b/marketing-module-system/src/main/resources/images/jigsaw/original/bg7.png new file mode 100644 index 0000000..efe76f8 Binary files /dev/null and b/marketing-module-system/src/main/resources/images/jigsaw/original/bg7.png differ diff --git a/marketing-module-system/src/main/resources/images/jigsaw/original/bg8.png b/marketing-module-system/src/main/resources/images/jigsaw/original/bg8.png new file mode 100644 index 0000000..2727aa3 Binary files /dev/null and b/marketing-module-system/src/main/resources/images/jigsaw/original/bg8.png differ diff --git a/marketing-module-system/src/main/resources/images/jigsaw/original/bg9.png b/marketing-module-system/src/main/resources/images/jigsaw/original/bg9.png new file mode 100644 index 0000000..4463aa2 Binary files /dev/null and b/marketing-module-system/src/main/resources/images/jigsaw/original/bg9.png differ diff --git a/marketing-module-system/src/main/resources/images/jigsaw/slidingBlock/1.png b/marketing-module-system/src/main/resources/images/jigsaw/slidingBlock/1.png new file mode 100644 index 0000000..ef11324 Binary files /dev/null and b/marketing-module-system/src/main/resources/images/jigsaw/slidingBlock/1.png differ diff --git a/marketing-module-system/src/main/resources/images/jigsaw/slidingBlock/11/10.png b/marketing-module-system/src/main/resources/images/jigsaw/slidingBlock/11/10.png new file mode 100644 index 0000000..297e44c Binary files /dev/null and b/marketing-module-system/src/main/resources/images/jigsaw/slidingBlock/11/10.png differ diff --git a/marketing-module-system/src/main/resources/images/jigsaw/slidingBlock/11/11.png b/marketing-module-system/src/main/resources/images/jigsaw/slidingBlock/11/11.png new file mode 100644 index 0000000..d9b1da8 Binary files /dev/null and b/marketing-module-system/src/main/resources/images/jigsaw/slidingBlock/11/11.png differ diff --git a/marketing-module-system/src/main/resources/images/jigsaw/slidingBlock/11/12.png b/marketing-module-system/src/main/resources/images/jigsaw/slidingBlock/11/12.png new file mode 100644 index 0000000..07e7313 Binary files /dev/null and b/marketing-module-system/src/main/resources/images/jigsaw/slidingBlock/11/12.png differ diff --git a/marketing-module-system/src/main/resources/images/jigsaw/slidingBlock/11/13.png b/marketing-module-system/src/main/resources/images/jigsaw/slidingBlock/11/13.png new file mode 100644 index 0000000..82c3dd9 Binary files /dev/null and b/marketing-module-system/src/main/resources/images/jigsaw/slidingBlock/11/13.png differ diff --git a/marketing-module-system/src/main/resources/images/jigsaw/slidingBlock/11/14.png b/marketing-module-system/src/main/resources/images/jigsaw/slidingBlock/11/14.png new file mode 100644 index 0000000..0b9a866 Binary files /dev/null and b/marketing-module-system/src/main/resources/images/jigsaw/slidingBlock/11/14.png differ diff --git a/marketing-module-system/src/main/resources/images/jigsaw/slidingBlock/11/15.png b/marketing-module-system/src/main/resources/images/jigsaw/slidingBlock/11/15.png new file mode 100644 index 0000000..86b0d1c Binary files /dev/null and b/marketing-module-system/src/main/resources/images/jigsaw/slidingBlock/11/15.png differ diff --git a/marketing-module-system/src/main/resources/images/jigsaw/slidingBlock/11/16.png b/marketing-module-system/src/main/resources/images/jigsaw/slidingBlock/11/16.png new file mode 100644 index 0000000..e90a6e2 Binary files /dev/null and b/marketing-module-system/src/main/resources/images/jigsaw/slidingBlock/11/16.png differ diff --git a/marketing-module-system/src/main/resources/images/jigsaw/slidingBlock/11/17.png b/marketing-module-system/src/main/resources/images/jigsaw/slidingBlock/11/17.png new file mode 100644 index 0000000..a82cbc7 Binary files /dev/null and b/marketing-module-system/src/main/resources/images/jigsaw/slidingBlock/11/17.png differ diff --git a/marketing-module-system/src/main/resources/images/jigsaw/slidingBlock/11/18.png b/marketing-module-system/src/main/resources/images/jigsaw/slidingBlock/11/18.png new file mode 100644 index 0000000..d3f3cfd Binary files /dev/null and b/marketing-module-system/src/main/resources/images/jigsaw/slidingBlock/11/18.png differ diff --git a/marketing-module-system/src/main/resources/images/jigsaw/slidingBlock/11/19.png b/marketing-module-system/src/main/resources/images/jigsaw/slidingBlock/11/19.png new file mode 100644 index 0000000..eb2855b Binary files /dev/null and b/marketing-module-system/src/main/resources/images/jigsaw/slidingBlock/11/19.png differ diff --git a/marketing-module-system/src/main/resources/images/jigsaw/slidingBlock/11/8.png b/marketing-module-system/src/main/resources/images/jigsaw/slidingBlock/11/8.png new file mode 100644 index 0000000..3cb5ce1 Binary files /dev/null and b/marketing-module-system/src/main/resources/images/jigsaw/slidingBlock/11/8.png differ diff --git a/marketing-module-system/src/main/resources/images/jigsaw/slidingBlock/11/9.png b/marketing-module-system/src/main/resources/images/jigsaw/slidingBlock/11/9.png new file mode 100644 index 0000000..384d354 Binary files /dev/null and b/marketing-module-system/src/main/resources/images/jigsaw/slidingBlock/11/9.png differ diff --git a/marketing-module-system/src/main/resources/images/jigsaw/slidingBlock/2.png b/marketing-module-system/src/main/resources/images/jigsaw/slidingBlock/2.png new file mode 100644 index 0000000..baf3f06 Binary files /dev/null and b/marketing-module-system/src/main/resources/images/jigsaw/slidingBlock/2.png differ diff --git a/marketing-module-system/src/main/resources/images/jigsaw/slidingBlock/3.png b/marketing-module-system/src/main/resources/images/jigsaw/slidingBlock/3.png new file mode 100644 index 0000000..ccaf617 Binary files /dev/null and b/marketing-module-system/src/main/resources/images/jigsaw/slidingBlock/3.png differ diff --git a/marketing-module-system/src/main/resources/images/jigsaw/slidingBlock/4.png b/marketing-module-system/src/main/resources/images/jigsaw/slidingBlock/4.png new file mode 100644 index 0000000..7dab162 Binary files /dev/null and b/marketing-module-system/src/main/resources/images/jigsaw/slidingBlock/4.png differ diff --git a/marketing-module-system/src/main/resources/images/pic-click/bg1.png b/marketing-module-system/src/main/resources/images/pic-click/bg1.png new file mode 100644 index 0000000..14e7345 Binary files /dev/null and b/marketing-module-system/src/main/resources/images/pic-click/bg1.png differ diff --git a/marketing-module-system/src/main/resources/images/pic-click/bg10.png b/marketing-module-system/src/main/resources/images/pic-click/bg10.png new file mode 100644 index 0000000..1ea1d6d Binary files /dev/null and b/marketing-module-system/src/main/resources/images/pic-click/bg10.png differ diff --git a/marketing-module-system/src/main/resources/images/pic-click/bg2.png b/marketing-module-system/src/main/resources/images/pic-click/bg2.png new file mode 100644 index 0000000..0edb329 Binary files /dev/null and b/marketing-module-system/src/main/resources/images/pic-click/bg2.png differ diff --git a/marketing-module-system/src/main/resources/images/pic-click/bg3.png b/marketing-module-system/src/main/resources/images/pic-click/bg3.png new file mode 100644 index 0000000..9167996 Binary files /dev/null and b/marketing-module-system/src/main/resources/images/pic-click/bg3.png differ diff --git a/marketing-module-system/src/main/resources/images/pic-click/bg4.png b/marketing-module-system/src/main/resources/images/pic-click/bg4.png new file mode 100644 index 0000000..e8e8e6c Binary files /dev/null and b/marketing-module-system/src/main/resources/images/pic-click/bg4.png differ diff --git a/marketing-module-system/src/main/resources/images/pic-click/bg5.png b/marketing-module-system/src/main/resources/images/pic-click/bg5.png new file mode 100644 index 0000000..66a3181 Binary files /dev/null and b/marketing-module-system/src/main/resources/images/pic-click/bg5.png differ diff --git a/marketing-module-system/src/main/resources/images/pic-click/bg6.png b/marketing-module-system/src/main/resources/images/pic-click/bg6.png new file mode 100644 index 0000000..9b0f5d8 Binary files /dev/null and b/marketing-module-system/src/main/resources/images/pic-click/bg6.png differ diff --git a/marketing-module-system/src/main/resources/images/pic-click/bg7.png b/marketing-module-system/src/main/resources/images/pic-click/bg7.png new file mode 100644 index 0000000..db41c74 Binary files /dev/null and b/marketing-module-system/src/main/resources/images/pic-click/bg7.png differ diff --git a/marketing-module-system/src/main/resources/images/pic-click/bg8.png b/marketing-module-system/src/main/resources/images/pic-click/bg8.png new file mode 100644 index 0000000..3496813 Binary files /dev/null and b/marketing-module-system/src/main/resources/images/pic-click/bg8.png differ diff --git a/marketing-module-system/src/main/resources/images/pic-click/bg9.png b/marketing-module-system/src/main/resources/images/pic-click/bg9.png new file mode 100644 index 0000000..4e7b477 Binary files /dev/null and b/marketing-module-system/src/main/resources/images/pic-click/bg9.png differ diff --git a/marketing-module-tenant/.flattened-pom.xml b/marketing-module-tenant/.flattened-pom.xml new file mode 100644 index 0000000..05d2643 --- /dev/null +++ b/marketing-module-tenant/.flattened-pom.xml @@ -0,0 +1,58 @@ + + + 4.0.0 + com.platform + marketing-module-tenant + 0.0.1-jdk8-SNAPSHOT + marketing-admin基础脚手架 + https://github.com/makemyownlife/marketing-admin/marketing-module-tenant + + + com.platform + marketing-module-system + 0.0.1-jdk8-SNAPSHOT + compile + + + com.platform + marketing-module-infra + 0.0.1-jdk8-SNAPSHOT + compile + + + org.bouncycastle + bcprov-jdk18on + 1.78 + compile + + + + + huaweicloud + huawei + https://mirrors.huaweicloud.com/repository/maven/ + + + aliyunmaven + aliyun + https://maven.aliyun.com/repository/public + + + + false + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + + + false + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + + diff --git a/marketing-module-tenant/pom.xml b/marketing-module-tenant/pom.xml new file mode 100644 index 0000000..9a32c3a --- /dev/null +++ b/marketing-module-tenant/pom.xml @@ -0,0 +1,43 @@ + + + 4.0.0 + + + com.platform + marketing-admin-all + ${revision} + + + marketing-module-tenant + + + 1.8 + 1.8 + UTF-8 + + + + + + com.platform + marketing-module-system + ${parent.version} + + + + com.platform + marketing-module-infra + ${parent.version} + + + + + org.bouncycastle + bcprov-jdk18on + + + + + \ No newline at end of file diff --git a/marketing-module-tenant/src/main/java/com/platform/marketing/module/tenant/controller/SmsAppinfoController.java b/marketing-module-tenant/src/main/java/com/platform/marketing/module/tenant/controller/SmsAppinfoController.java new file mode 100644 index 0000000..12b1b92 --- /dev/null +++ b/marketing-module-tenant/src/main/java/com/platform/marketing/module/tenant/controller/SmsAppinfoController.java @@ -0,0 +1,101 @@ +package com.platform.marketing.module.tenant.controller; + +import org.springframework.web.bind.annotation.*; +import javax.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import org.springframework.security.access.prepost.PreAuthorize; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Operation; + +import javax.validation.constraints.*; +import javax.validation.*; +import javax.servlet.http.*; +import java.util.*; +import java.io.IOException; + +import com.platform.marketing.framework.common.pojo.PageParam; +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.common.pojo.CommonResult; +import com.platform.marketing.framework.common.util.object.BeanUtils; +import static com.platform.marketing.framework.common.pojo.CommonResult.success; + +import com.platform.marketing.framework.excel.core.util.ExcelUtils; + +import com.platform.marketing.module.tenant.domain.vo.*; +import com.platform.marketing.module.tenant.domain.dataobject.SmsAppinfoDO; +import com.platform.marketing.module.tenant.service.SmsAppinfoService; + +@Tag(name = "管理后台 - 租户应用") +@RestController +@RequestMapping("/tenant/sms-appinfo") +@Validated +public class SmsAppinfoController { + + @Resource + private SmsAppinfoService smsAppinfoService; + + @PostMapping("/create") + @Operation(summary = "创建租户应用") + @PreAuthorize("@ss.hasPermission('tenant:sms-appinfo:create')") + public CommonResult createSmsAppinfo(@Valid @RequestBody SmsAppinfoSaveReqVO createReqVO) { + return success(smsAppinfoService.createSmsAppinfo(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新租户应用") + @PreAuthorize("@ss.hasPermission('tenant:sms-appinfo:update')") + public CommonResult updateSmsAppinfo(@Valid @RequestBody SmsAppinfoSaveReqVO updateReqVO) { + smsAppinfoService.updateSmsAppinfo(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除租户应用") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('tenant:sms-appinfo:delete')") + public CommonResult deleteSmsAppinfo(@RequestParam("id") Long id) { + smsAppinfoService.deleteSmsAppinfo(id); + return success(true); + } + + @DeleteMapping("/delete-list") + @Parameter(name = "ids", description = "编号", required = true) + @Operation(summary = "批量删除租户应用") + @PreAuthorize("@ss.hasPermission('tenant:sms-appinfo:delete')") + public CommonResult deleteSmsAppinfoList(@RequestParam("ids") List ids) { + smsAppinfoService.deleteSmsAppinfoListByIds(ids); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得租户应用") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('tenant:sms-appinfo:query')") + public CommonResult getSmsAppinfo(@RequestParam("id") Long id) { + SmsAppinfoDO smsAppinfo = smsAppinfoService.getSmsAppinfo(id); + return success(BeanUtils.toBean(smsAppinfo, SmsAppinfoRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得租户应用分页") + @PreAuthorize("@ss.hasPermission('tenant:sms-appinfo:query')") + public CommonResult> getSmsAppinfoPage(@Valid SmsAppinfoPageReqVO pageReqVO) { + PageResult pageResult = smsAppinfoService.getSmsAppinfoPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, SmsAppinfoRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出租户应用 Excel") + @PreAuthorize("@ss.hasPermission('tenant:sms-appinfo:export')") + + public void exportSmsAppinfoExcel(@Valid SmsAppinfoPageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = smsAppinfoService.getSmsAppinfoPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "租户应用.xls", "数据", SmsAppinfoRespVO.class, + BeanUtils.toBean(list, SmsAppinfoRespVO.class)); + } + +} \ No newline at end of file diff --git a/marketing-module-tenant/src/main/java/com/platform/marketing/module/tenant/controller/SmsTenantController.java b/marketing-module-tenant/src/main/java/com/platform/marketing/module/tenant/controller/SmsTenantController.java new file mode 100644 index 0000000..f74b2ed --- /dev/null +++ b/marketing-module-tenant/src/main/java/com/platform/marketing/module/tenant/controller/SmsTenantController.java @@ -0,0 +1,101 @@ +package com.platform.marketing.module.tenant.controller; + +import org.springframework.web.bind.annotation.*; +import javax.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import org.springframework.security.access.prepost.PreAuthorize; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Operation; + +import javax.validation.constraints.*; +import javax.validation.*; +import javax.servlet.http.*; +import java.util.*; +import java.io.IOException; + +import com.platform.marketing.framework.common.pojo.PageParam; +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.common.pojo.CommonResult; +import com.platform.marketing.framework.common.util.object.BeanUtils; +import static com.platform.marketing.framework.common.pojo.CommonResult.success; + +import com.platform.marketing.framework.excel.core.util.ExcelUtils; + +import com.platform.marketing.module.tenant.domain.vo.*; +import com.platform.marketing.module.tenant.domain.dataobject.SmsTenantDO; +import com.platform.marketing.module.tenant.service.SmsTenantService; + +@Tag(name = "管理后台 - 租户") +@RestController +@RequestMapping("/sms/tenant") +@Validated +public class SmsTenantController { + + @Resource + private SmsTenantService tenantService; + + @PostMapping("/create") + @Operation(summary = "创建租户") + @PreAuthorize("@ss.hasPermission('sms:tenant:create')") + public CommonResult createTenant(@Valid @RequestBody SmsTenantSaveReqVO createReqVO) { + return success(tenantService.createTenant(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新租户") + @PreAuthorize("@ss.hasPermission('sms:tenant:update')") + public CommonResult updateTenant(@Valid @RequestBody SmsTenantSaveReqVO updateReqVO) { + tenantService.updateTenant(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除租户") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('sms:tenant:delete')") + public CommonResult deleteTenant(@RequestParam("id") Long id) { + tenantService.deleteTenant(id); + return success(true); + } + + @DeleteMapping("/delete-list") + @Parameter(name = "ids", description = "编号", required = true) + @Operation(summary = "批量删除租户") + @PreAuthorize("@ss.hasPermission('sms:tenant:delete')") + public CommonResult deleteTenantList(@RequestParam("ids") List ids) { + tenantService.deleteTenantListByIds(ids); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得租户") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('sms:tenant:query')") + public CommonResult getTenant(@RequestParam("id") Long id) { + SmsTenantDO tenant = tenantService.getTenant(id); + return success(BeanUtils.toBean(tenant, SmsTenantRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得租户分页") + @PreAuthorize("@ss.hasPermission('sms:tenant:query')") + public CommonResult> getTenantPage(@Valid SmsTenantPageReqVO pageReqVO) { + PageResult pageResult = tenantService.getTenantPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, SmsTenantRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出租户 Excel") + @PreAuthorize("@ss.hasPermission('sms:tenant:export')") + + public void exportTenantExcel(@Valid SmsTenantPageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = tenantService.getTenantPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "租户.xls", "数据", SmsTenantRespVO.class, + BeanUtils.toBean(list, SmsTenantRespVO.class)); + } + +} \ No newline at end of file diff --git a/marketing-module-tenant/src/main/java/com/platform/marketing/module/tenant/domain/dataobject/SmsAppinfoDO.java b/marketing-module-tenant/src/main/java/com/platform/marketing/module/tenant/domain/dataobject/SmsAppinfoDO.java new file mode 100644 index 0000000..f0a877b --- /dev/null +++ b/marketing-module-tenant/src/main/java/com/platform/marketing/module/tenant/domain/dataobject/SmsAppinfoDO.java @@ -0,0 +1,59 @@ +package com.platform.marketing.module.tenant.domain.dataobject; + +import lombok.*; +import java.util.*; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.*; +import com.platform.marketing.framework.mybatis.core.dataobject.BaseDO; + +/** + * 租户应用 DO + * + * @author 勇哥 + */ +@TableName("sms_appinfo") +@KeySequence("sms_appinfo_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class SmsAppinfoDO extends BaseDO { + + /** + * 应用编号 + */ + @TableId + private Long id; + + /** + * 租户ID + */ + private String tenantId; + + /** + * 应用密钥Key + */ + private String appKey; + + /** + * 应用名称 + */ + private String appName; + /** + * 应用密钥Secret + */ + private String appSecret; + /** + * 状态:0-有效 / 1-无效 + */ + private Integer status; + /** + * 备注信息 + */ + private String remark; + + +} \ No newline at end of file diff --git a/marketing-module-tenant/src/main/java/com/platform/marketing/module/tenant/domain/dataobject/SmsTenantDO.java b/marketing-module-tenant/src/main/java/com/platform/marketing/module/tenant/domain/dataobject/SmsTenantDO.java new file mode 100644 index 0000000..7c77ff5 --- /dev/null +++ b/marketing-module-tenant/src/main/java/com/platform/marketing/module/tenant/domain/dataobject/SmsTenantDO.java @@ -0,0 +1,52 @@ +package com.platform.marketing.module.tenant.domain.dataobject; + +import lombok.*; +import java.util.*; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.*; +import com.platform.marketing.framework.mybatis.core.dataobject.BaseDO; + +/** + * 租户 DO + * + * @author 勇哥 + */ +@TableName("sms_tenant") +@KeySequence("sms_tenant_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class SmsTenantDO extends BaseDO { + + /** + * 租户编号 + */ + @TableId + private Long id; + /** + * 租户用户名 + */ + private String tenantUserName; + /** + * 密码 + */ + private String password; + /** + * 邮箱 + */ + private String email; + /** + * 手机号 + */ + private String mobile; + /** + * 手机国家编码 + */ + private String nationcode; + + +} \ No newline at end of file diff --git a/marketing-module-tenant/src/main/java/com/platform/marketing/module/tenant/domain/enums/TenantErrorCodeConstants.java b/marketing-module-tenant/src/main/java/com/platform/marketing/module/tenant/domain/enums/TenantErrorCodeConstants.java new file mode 100644 index 0000000..7020b23 --- /dev/null +++ b/marketing-module-tenant/src/main/java/com/platform/marketing/module/tenant/domain/enums/TenantErrorCodeConstants.java @@ -0,0 +1,14 @@ +// TODO 待办:请将下面的错误码复制到 magic-module-sms 模块的 ErrorCodeConstants 类中。注意,请给“TODO 补充编号”设置一个错误码编号!!! +// ========== 租户 TODO 补充编号 ========== + +package com.platform.marketing.module.tenant.domain.enums; + +import com.platform.marketing.framework.common.exception.ErrorCode; + +public interface TenantErrorCodeConstants { + + ErrorCode TENANT_NOT_EXISTS = new ErrorCode(1_004_001_001, "租户记录不存在"); + + ErrorCode SMS_APPINFO_NOT_EXISTS = new ErrorCode(1_004_001_002, "租户应用不存在"); + +} \ No newline at end of file diff --git a/marketing-module-tenant/src/main/java/com/platform/marketing/module/tenant/domain/vo/SmsAppinfoPageReqVO.java b/marketing-module-tenant/src/main/java/com/platform/marketing/module/tenant/domain/vo/SmsAppinfoPageReqVO.java new file mode 100644 index 0000000..d428dc4 --- /dev/null +++ b/marketing-module-tenant/src/main/java/com/platform/marketing/module/tenant/domain/vo/SmsAppinfoPageReqVO.java @@ -0,0 +1,35 @@ +package com.platform.marketing.module.tenant.domain.vo; + +import lombok.*; +import java.util.*; +import io.swagger.v3.oas.annotations.media.Schema; +import com.platform.marketing.framework.common.pojo.PageParam; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; + +import static com.platform.marketing.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 租户应用分页 Request VO") +@Data +public class SmsAppinfoPageReqVO extends PageParam { + + @Schema(description = "应用密钥Key") + private String appKey; + + @Schema(description = "应用名称", example = "李四") + private String appName; + + @Schema(description = "应用密钥Secret") + private String appSecret; + + @Schema(description = "状态:0-有效 / 1-无效", example = "2") + private Integer status; + + @Schema(description = "备注信息", example = "随便") + private String remark; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + +} \ No newline at end of file diff --git a/marketing-module-tenant/src/main/java/com/platform/marketing/module/tenant/domain/vo/SmsAppinfoRespVO.java b/marketing-module-tenant/src/main/java/com/platform/marketing/module/tenant/domain/vo/SmsAppinfoRespVO.java new file mode 100644 index 0000000..1c89aa4 --- /dev/null +++ b/marketing-module-tenant/src/main/java/com/platform/marketing/module/tenant/domain/vo/SmsAppinfoRespVO.java @@ -0,0 +1,49 @@ +package com.platform.marketing.module.tenant.domain.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; +import com.alibaba.excel.annotation.*; + +@Schema(description = "管理后台 - 租户应用 Response VO") +@Data +@ExcelIgnoreUnannotated +public class SmsAppinfoRespVO { + + @Schema(description = "应用编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "29819") + @ExcelProperty("应用编号") + private Long id; + + /** + * 租户ID + */ + @Schema(description = "租户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + private String tenantId; + + @Schema(description = "应用密钥Key", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("应用密钥Key") + private String appKey; + + @Schema(description = "应用名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四") + @ExcelProperty("应用名称") + private String appName; + + @Schema(description = "应用密钥Secret", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("应用密钥Secret") + private String appSecret; + + @Schema(description = "状态:0-有效 / 1-无效", example = "2") + @ExcelProperty("状态:0-有效 / 1-无效") + private Integer status; + + @Schema(description = "备注信息", example = "随便") + @ExcelProperty("备注信息") + private String remark; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("创建时间") + private LocalDateTime createTime; + +} \ No newline at end of file diff --git a/marketing-module-tenant/src/main/java/com/platform/marketing/module/tenant/domain/vo/SmsAppinfoSaveReqVO.java b/marketing-module-tenant/src/main/java/com/platform/marketing/module/tenant/domain/vo/SmsAppinfoSaveReqVO.java new file mode 100644 index 0000000..c02bdf0 --- /dev/null +++ b/marketing-module-tenant/src/main/java/com/platform/marketing/module/tenant/domain/vo/SmsAppinfoSaveReqVO.java @@ -0,0 +1,35 @@ +package com.platform.marketing.module.tenant.domain.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import javax.validation.constraints.*; + +@Schema(description = "管理后台 - 租户应用新增/修改 Request VO") +@Data +public class SmsAppinfoSaveReqVO { + + @Schema(description = "应用编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "29819") + private Long id; + + @Schema(description = "应用密钥Key", requiredMode = Schema.RequiredMode.REQUIRED) + private String appKey; + + @Schema(description = "租户ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "租户不能为空") + private String tenantId; + + @Schema(description = "应用名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "用户中心") + @NotEmpty(message = "应用名称不能为空") + private String appName; + + @Schema(description = "应用密钥Secret", requiredMode = Schema.RequiredMode.REQUIRED) + private String appSecret; + + @Schema(description = "状态:0-有效 / 1-无效", example = "0") + private Integer status; + + @Schema(description = "备注信息", example = "") + private String remark; + +} \ No newline at end of file diff --git a/marketing-module-tenant/src/main/java/com/platform/marketing/module/tenant/domain/vo/SmsTenantPageReqVO.java b/marketing-module-tenant/src/main/java/com/platform/marketing/module/tenant/domain/vo/SmsTenantPageReqVO.java new file mode 100644 index 0000000..ba9f815 --- /dev/null +++ b/marketing-module-tenant/src/main/java/com/platform/marketing/module/tenant/domain/vo/SmsTenantPageReqVO.java @@ -0,0 +1,35 @@ +package com.platform.marketing.module.tenant.domain.vo; + +import lombok.*; +import java.util.*; +import io.swagger.v3.oas.annotations.media.Schema; +import com.platform.marketing.framework.common.pojo.PageParam; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; + +import static com.platform.marketing.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 租户分页 Request VO") +@Data +public class SmsTenantPageReqVO extends PageParam { + + @Schema(description = "租户用户名", example = "王五") + private String tenantUserName; + + @Schema(description = "密码") + private String password; + + @Schema(description = "邮箱") + private String email; + + @Schema(description = "手机号") + private String mobile; + + @Schema(description = "手机国家编码") + private String nationcode; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + +} \ No newline at end of file diff --git a/marketing-module-tenant/src/main/java/com/platform/marketing/module/tenant/domain/vo/SmsTenantRespVO.java b/marketing-module-tenant/src/main/java/com/platform/marketing/module/tenant/domain/vo/SmsTenantRespVO.java new file mode 100644 index 0000000..7a71d54 --- /dev/null +++ b/marketing-module-tenant/src/main/java/com/platform/marketing/module/tenant/domain/vo/SmsTenantRespVO.java @@ -0,0 +1,39 @@ +package com.platform.marketing.module.tenant.domain.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; +import com.alibaba.excel.annotation.*; + +@Schema(description = "管理后台 - 租户 Response VO") +@Data +@ExcelIgnoreUnannotated +public class SmsTenantRespVO { + + @Schema(description = "租户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "6255") + @ExcelProperty("租户编号") + private Long id; + + @Schema(description = "租户用户名", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五") + @ExcelProperty("租户用户名") + private String tenantUserName; + + @Schema(description = "邮箱") + @ExcelProperty("邮箱") + private String email; + + @Schema(description = "手机号") + @ExcelProperty("手机号") + private String mobile; + + @Schema(description = "手机国家编码") + @ExcelProperty("手机国家编码") + private String nationcode; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("创建时间") + private LocalDateTime createTime; + +} \ No newline at end of file diff --git a/marketing-module-tenant/src/main/java/com/platform/marketing/module/tenant/domain/vo/SmsTenantSaveReqVO.java b/marketing-module-tenant/src/main/java/com/platform/marketing/module/tenant/domain/vo/SmsTenantSaveReqVO.java new file mode 100644 index 0000000..ace6364 --- /dev/null +++ b/marketing-module-tenant/src/main/java/com/platform/marketing/module/tenant/domain/vo/SmsTenantSaveReqVO.java @@ -0,0 +1,40 @@ +package com.platform.marketing.module.tenant.domain.vo; + +import cn.hutool.core.util.ObjectUtil; +import com.fasterxml.jackson.annotation.JsonIgnore; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import javax.validation.constraints.*; + +@Schema(description = "管理后台 - 租户新增/修改 Request VO") +@Data +public class SmsTenantSaveReqVO { + + @Schema(description = "租户编号", example = "6255") + private Long id; + + @Schema(description = "租户用户名", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五") + @NotEmpty(message = "租户用户名不能为空") + private String tenantUserName; + + @Schema(description = "密码", requiredMode = Schema.RequiredMode.REQUIRED, example = "123456") + private String password; + + @Schema(description = "邮箱") + private String email; + + @Schema(description = "手机号") + private String mobile; + + @Schema(description = "手机国家编码") + private String nationcode; + + @AssertTrue(message = "密码不能为空") + @JsonIgnore + public boolean isPasswordValid() { + return id != null // 修改时,不需要传递 + || (ObjectUtil.isNotEmpty(password)); // 新增时,必须传递 password + } + +} \ No newline at end of file diff --git a/marketing-module-tenant/src/main/java/com/platform/marketing/module/tenant/mapper/SmsAppinfoMapper.java b/marketing-module-tenant/src/main/java/com/platform/marketing/module/tenant/mapper/SmsAppinfoMapper.java new file mode 100644 index 0000000..cdda4a2 --- /dev/null +++ b/marketing-module-tenant/src/main/java/com/platform/marketing/module/tenant/mapper/SmsAppinfoMapper.java @@ -0,0 +1,31 @@ +package com.platform.marketing.module.tenant.mapper; + +import java.util.*; + +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.mybatis.core.query.LambdaQueryWrapperX; +import com.platform.marketing.framework.mybatis.core.mapper.BaseMapperX; +import com.platform.marketing.module.tenant.domain.dataobject.SmsAppinfoDO; +import org.apache.ibatis.annotations.Mapper; +import com.platform.marketing.module.tenant.domain.vo.*; + +/** + * 租户应用 Mapper + * + * @author 勇哥 + */ +@Mapper +public interface SmsAppinfoMapper extends BaseMapperX { + + default PageResult selectPage(SmsAppinfoPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(SmsAppinfoDO::getAppKey, reqVO.getAppKey()) + .likeIfPresent(SmsAppinfoDO::getAppName, reqVO.getAppName()) + .eqIfPresent(SmsAppinfoDO::getAppSecret, reqVO.getAppSecret()) + .eqIfPresent(SmsAppinfoDO::getStatus, reqVO.getStatus()) + .eqIfPresent(SmsAppinfoDO::getRemark, reqVO.getRemark()) + .betweenIfPresent(SmsAppinfoDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(SmsAppinfoDO::getId)); + } + +} \ No newline at end of file diff --git a/marketing-module-tenant/src/main/java/com/platform/marketing/module/tenant/mapper/SmsTenantMapper.java b/marketing-module-tenant/src/main/java/com/platform/marketing/module/tenant/mapper/SmsTenantMapper.java new file mode 100644 index 0000000..ce6a6f0 --- /dev/null +++ b/marketing-module-tenant/src/main/java/com/platform/marketing/module/tenant/mapper/SmsTenantMapper.java @@ -0,0 +1,31 @@ +package com.platform.marketing.module.tenant.mapper; + +import java.util.*; + +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.mybatis.core.query.LambdaQueryWrapperX; +import com.platform.marketing.framework.mybatis.core.mapper.BaseMapperX; +import com.platform.marketing.module.tenant.domain.dataobject.SmsTenantDO; +import org.apache.ibatis.annotations.Mapper; +import com.platform.marketing.module.tenant.domain.vo.*; + +/** + * 租户 Mapper + * + * @author 勇哥 + */ +@Mapper +public interface SmsTenantMapper extends BaseMapperX { + + default PageResult selectPage(SmsTenantPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .likeIfPresent(SmsTenantDO::getTenantUserName, reqVO.getTenantUserName()) + .eqIfPresent(SmsTenantDO::getPassword, reqVO.getPassword()) + .eqIfPresent(SmsTenantDO::getEmail, reqVO.getEmail()) + .eqIfPresent(SmsTenantDO::getMobile, reqVO.getMobile()) + .eqIfPresent(SmsTenantDO::getNationcode, reqVO.getNationcode()) + .betweenIfPresent(SmsTenantDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(SmsTenantDO::getId)); + } + +} \ No newline at end of file diff --git a/marketing-module-tenant/src/main/java/com/platform/marketing/module/tenant/service/SmsAppinfoService.java b/marketing-module-tenant/src/main/java/com/platform/marketing/module/tenant/service/SmsAppinfoService.java new file mode 100644 index 0000000..10cae4f --- /dev/null +++ b/marketing-module-tenant/src/main/java/com/platform/marketing/module/tenant/service/SmsAppinfoService.java @@ -0,0 +1,66 @@ +package com.platform.marketing.module.tenant.service; + +import java.util.*; +import javax.validation.*; +import com.platform.marketing.module.tenant.domain.vo.*; +import com.platform.marketing.module.tenant.domain.dataobject.SmsAppinfoDO; +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.common.pojo.PageParam; + +/** + * 租户应用 Service 接口 + * + * @author 勇哥 + */ +public interface SmsAppinfoService { + + SmsAppinfoDO getAppinfoByAppKeyFromLocalCache(String appKey); + + SmsAppinfoDO getAppinfoByTenantId(Long tenantId); + + /** + * 创建租户应用 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createSmsAppinfo(@Valid SmsAppinfoSaveReqVO createReqVO); + + /** + * 更新租户应用 + * + * @param updateReqVO 更新信息 + */ + void updateSmsAppinfo(@Valid SmsAppinfoSaveReqVO updateReqVO); + + /** + * 删除租户应用 + * + * @param id 编号 + */ + void deleteSmsAppinfo(Long id); + + /** + * 批量删除租户应用 + * + * @param ids 编号 + */ + void deleteSmsAppinfoListByIds(List ids); + + /** + * 获得租户应用 + * + * @param id 编号 + * @return 租户应用 + */ + SmsAppinfoDO getSmsAppinfo(Long id); + + /** + * 获得租户应用分页 + * + * @param pageReqVO 分页查询 + * @return 租户应用分页 + */ + PageResult getSmsAppinfoPage(SmsAppinfoPageReqVO pageReqVO); + +} \ No newline at end of file diff --git a/marketing-module-tenant/src/main/java/com/platform/marketing/module/tenant/service/SmsTenantService.java b/marketing-module-tenant/src/main/java/com/platform/marketing/module/tenant/service/SmsTenantService.java new file mode 100644 index 0000000..d3ecc77 --- /dev/null +++ b/marketing-module-tenant/src/main/java/com/platform/marketing/module/tenant/service/SmsTenantService.java @@ -0,0 +1,62 @@ +package com.platform.marketing.module.tenant.service; + +import java.util.*; +import javax.validation.*; +import com.platform.marketing.module.tenant.domain.vo.*; +import com.platform.marketing.module.tenant.domain.dataobject.SmsTenantDO; +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.common.pojo.PageParam; + +/** + * 租户 Service 接口 + * + * @author 勇哥 + */ +public interface SmsTenantService { + + /** + * 创建租户 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createTenant(@Valid SmsTenantSaveReqVO createReqVO); + + /** + * 更新租户 + * + * @param updateReqVO 更新信息 + */ + void updateTenant(@Valid SmsTenantSaveReqVO updateReqVO); + + /** + * 删除租户 + * + * @param id 编号 + */ + void deleteTenant(Long id); + + /** + * 批量删除租户 + * + * @param ids 编号 + */ + void deleteTenantListByIds(List ids); + + /** + * 获得租户 + * + * @param id 编号 + * @return 租户 + */ + SmsTenantDO getTenant(Long id); + + /** + * 获得租户分页 + * + * @param pageReqVO 分页查询 + * @return 租户分页 + */ + PageResult getTenantPage(SmsTenantPageReqVO pageReqVO); + +} \ No newline at end of file diff --git a/marketing-module-tenant/src/main/java/com/platform/marketing/module/tenant/service/impl/SmsAppinfoServiceImpl.java b/marketing-module-tenant/src/main/java/com/platform/marketing/module/tenant/service/impl/SmsAppinfoServiceImpl.java new file mode 100644 index 0000000..1131955 --- /dev/null +++ b/marketing-module-tenant/src/main/java/com/platform/marketing/module/tenant/service/impl/SmsAppinfoServiceImpl.java @@ -0,0 +1,135 @@ +package com.platform.marketing.module.tenant.service.impl; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.lang.UUID; +import com.platform.marketing.module.tenant.util.AppUtils; +import lombok.extern.slf4j.Slf4j; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Service; + +import javax.annotation.PostConstruct; +import javax.annotation.Resource; + +import org.springframework.validation.annotation.Validated; +import org.springframework.transaction.annotation.Transactional; + +import java.util.*; +import java.util.concurrent.ConcurrentHashMap; + +import com.platform.marketing.module.tenant.domain.vo.*; +import com.platform.marketing.module.tenant.domain.dataobject.SmsAppinfoDO; +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.common.pojo.PageParam; +import com.platform.marketing.framework.common.util.object.BeanUtils; + +import com.platform.marketing.module.tenant.service.SmsAppinfoService; + +import com.platform.marketing.module.tenant.mapper.SmsAppinfoMapper; + +import static com.platform.marketing.framework.common.exception.util.ServiceExceptionUtil.exception; +import static com.platform.marketing.framework.common.util.collection.CollectionUtils.convertList; +import static com.platform.marketing.framework.common.util.collection.CollectionUtils.diffList; +import static com.platform.marketing.module.tenant.domain.enums.TenantErrorCodeConstants.SMS_APPINFO_NOT_EXISTS; + +/** + * 租户应用 Service 实现类 + * + * @author 勇哥 + */ +@Service +@Validated +@Slf4j +public class SmsAppinfoServiceImpl implements SmsAppinfoService { + + private static String APPKEY_PREFIX = "APPKEY_PREFIX_"; + + private static String APPID_PREFIX = "APPID_PREFIX_"; + + @Resource + private SmsAppinfoMapper smsAppinfoMapper; + + private final static ConcurrentHashMap localAppCache = new ConcurrentHashMap(1024); + + @PostConstruct + @Scheduled(cron = "0/30 * * * * ?") + public void startLoadAppInfo() { + long start = System.currentTimeMillis(); + log.info("开始加载应用列表到缓存中"); + try { + List appinfoList = smsAppinfoMapper.selectList(); + appinfoList.forEach(item -> { + localAppCache.put(APPKEY_PREFIX + item.getAppKey(), item); + localAppCache.put(APPID_PREFIX + item.getId(), item); + }); + } catch (Exception e) { + log.error("startLoadAppInfo error: ", e); + } finally { + log.info("结束加载应用列表到缓存中,总耗时:" + (System.currentTimeMillis() - start) + "ms"); + } + } + + @Override + public SmsAppinfoDO getAppinfoByAppKeyFromLocalCache(String appKey) { + return localAppCache.get(APPKEY_PREFIX + appKey); + } + + @Override + public SmsAppinfoDO getAppinfoByTenantId(Long tenantId) { + return smsAppinfoMapper.selectFirstOne(SmsAppinfoDO::getTenantId, tenantId); + } + + @Override + public Long createSmsAppinfo(SmsAppinfoSaveReqVO createReqVO) { + // 插入 + SmsAppinfoDO smsAppinfo = BeanUtils.toBean(createReqVO, SmsAppinfoDO.class); + + // 定义 appkey appsecret + smsAppinfo.setAppKey(AppUtils.generateAppKey()); + smsAppinfo.setAppSecret(UUID.fastUUID().toString()); + + smsAppinfoMapper.insert(smsAppinfo); + // 返回 + return smsAppinfo.getId(); + } + + @Override + public void updateSmsAppinfo(SmsAppinfoSaveReqVO updateReqVO) { + // 校验存在 + validateSmsAppinfoExists(updateReqVO.getId()); + // 更新 + SmsAppinfoDO updateObj = BeanUtils.toBean(updateReqVO, SmsAppinfoDO.class); + smsAppinfoMapper.updateById(updateObj); + } + + @Override + public void deleteSmsAppinfo(Long id) { + // 校验存在 + validateSmsAppinfoExists(id); + // 删除 + smsAppinfoMapper.deleteById(id); + } + + @Override + public void deleteSmsAppinfoListByIds(List ids) { + // 删除 + smsAppinfoMapper.deleteByIds(ids); + } + + + private void validateSmsAppinfoExists(Long id) { + if (smsAppinfoMapper.selectById(id) == null) { + throw exception(SMS_APPINFO_NOT_EXISTS); + } + } + + @Override + public SmsAppinfoDO getSmsAppinfo(Long id) { + return smsAppinfoMapper.selectById(id); + } + + @Override + public PageResult getSmsAppinfoPage(SmsAppinfoPageReqVO pageReqVO) { + return smsAppinfoMapper.selectPage(pageReqVO); + } + +} \ No newline at end of file diff --git a/marketing-module-tenant/src/main/java/com/platform/marketing/module/tenant/service/impl/SmsTenantServiceImpl.java b/marketing-module-tenant/src/main/java/com/platform/marketing/module/tenant/service/impl/SmsTenantServiceImpl.java new file mode 100644 index 0000000..f55afa6 --- /dev/null +++ b/marketing-module-tenant/src/main/java/com/platform/marketing/module/tenant/service/impl/SmsTenantServiceImpl.java @@ -0,0 +1,103 @@ +package com.platform.marketing.module.tenant.service.impl; + +import org.springframework.stereotype.Service; +import javax.annotation.Resource; +import org.springframework.validation.annotation.Validated; + +import java.util.*; +import com.platform.marketing.module.tenant.domain.vo.*; +import com.platform.marketing.module.tenant.domain.dataobject.SmsTenantDO; +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.common.util.object.BeanUtils; + +import com.platform.marketing.module.tenant.service.SmsTenantService; +import com.platform.marketing.module.tenant.util.SM4Utils; + +import com.platform.marketing.module.tenant.mapper.SmsTenantMapper; + +import static com.platform.marketing.framework.common.exception.util.ServiceExceptionUtil.exception; +import static com.platform.marketing.framework.common.util.collection.CollectionUtils.convertList; +import static com.platform.marketing.module.tenant.domain.enums.TenantErrorCodeConstants.*; + +/** + * 租户 Service 实现类 + * + * @author 勇哥 + */ +@Service +@Validated +public class SmsTenantServiceImpl implements SmsTenantService { + + @Resource + private SmsTenantMapper tenantMapper; + + @Override + public Long createTenant(SmsTenantSaveReqVO createReqVO) { + try { + // SM4 加密密码 + String encryptedPassword = SM4Utils.encryptEcb(createReqVO.getPassword()); + createReqVO.setPassword(encryptedPassword); + } catch (Exception e) { + throw new RuntimeException("密码加密失败:" + e.getMessage(), e); + } + + // 插入 + SmsTenantDO tenant = BeanUtils.toBean(createReqVO, SmsTenantDO.class); + tenantMapper.insert(tenant); + + // 返回 + return tenant.getId(); + } + + @Override + public void updateTenant(SmsTenantSaveReqVO updateReqVO) { + // 校验存在 + validateTenantExists(updateReqVO.getId()); + + // 如果密码不为空,说明要修改密码,则使用 SM4 加密 + if (updateReqVO.getPassword() != null && !updateReqVO.getPassword().isEmpty()) { + try { + String encryptedPassword = SM4Utils.encryptEcb(updateReqVO.getPassword()); + updateReqVO.setPassword(encryptedPassword); + } catch (Exception e) { + throw new RuntimeException("密码加密失败:" + e.getMessage(), e); + } + } + + // 更新 + SmsTenantDO updateObj = BeanUtils.toBean(updateReqVO, SmsTenantDO.class); + tenantMapper.updateById(updateObj); + } + + @Override + public void deleteTenant(Long id) { + // 校验存在 + validateTenantExists(id); + // 删除 + tenantMapper.deleteById(id); + } + + @Override + public void deleteTenantListByIds(List ids) { + // 删除 + tenantMapper.deleteByIds(ids); + } + + + private void validateTenantExists(Long id) { + if (tenantMapper.selectById(id) == null) { + throw exception(TENANT_NOT_EXISTS); + } + } + + @Override + public SmsTenantDO getTenant(Long id) { + return tenantMapper.selectById(id); + } + + @Override + public PageResult getTenantPage(SmsTenantPageReqVO pageReqVO) { + return tenantMapper.selectPage(pageReqVO); + } + +} \ No newline at end of file diff --git a/marketing-module-tenant/src/main/java/com/platform/marketing/module/tenant/util/AppUtils.java b/marketing-module-tenant/src/main/java/com/platform/marketing/module/tenant/util/AppUtils.java new file mode 100644 index 0000000..ccc1a1e --- /dev/null +++ b/marketing-module-tenant/src/main/java/com/platform/marketing/module/tenant/util/AppUtils.java @@ -0,0 +1,25 @@ +package com.platform.marketing.module.tenant.util; + +import java.util.Random; + +public class AppUtils { + + public static String generateAppKey() { + String chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; + Random random = new Random(); + StringBuilder appKey = new StringBuilder(); + + for (int i = 0; i < 16; i++) { + int index = random.nextInt(chars.length()); + appKey.append(chars.charAt(index)); + } + + return appKey.toString(); + } + + // 测试方法 + public static void main(String[] args) { + System.out.println("生成的AppKey: " + generateAppKey()); + } + +} diff --git a/marketing-module-tenant/src/main/java/com/platform/marketing/module/tenant/util/SM4Utils.java b/marketing-module-tenant/src/main/java/com/platform/marketing/module/tenant/util/SM4Utils.java new file mode 100644 index 0000000..b96c26a --- /dev/null +++ b/marketing-module-tenant/src/main/java/com/platform/marketing/module/tenant/util/SM4Utils.java @@ -0,0 +1,240 @@ +package com.platform.marketing.module.tenant.util; + +import org.bouncycastle.crypto.engines.SM4Engine; +import org.bouncycastle.crypto.modes.CBCBlockCipher; +import org.bouncycastle.crypto.paddings.PKCS7Padding; +import org.bouncycastle.crypto.params.KeyParameter; +import org.bouncycastle.crypto.params.ParametersWithIV; +import org.bouncycastle.jce.provider.BouncyCastleProvider; + +import javax.crypto.Cipher; +import javax.crypto.KeyGenerator; +import javax.crypto.SecretKey; +import javax.crypto.spec.IvParameterSpec; +import javax.crypto.spec.SecretKeySpec; +import java.security.Key; +import java.security.SecureRandom; +import java.security.Security; + +/** + * SM4 加密工具类 + * SM4 是中国国家密码管理局发布的对称加密算法 + * + * @author 勇哥 + */ +public class SM4Utils { + + private static final String ALGORITHM_NAME = "SM4"; + private static final String ALGORITHM_NAME_ECB_PADDING = "SM4/ECB/PKCS5Padding"; + private static final String ALGORITHM_NAME_CBC_PADDING = "SM4/CBC/PKCS5Padding"; + private static final int DEFAULT_KEY_SIZE = 128; + + /** + * SM4 算法密钥(16字节=128位) + * 实际项目中应该从配置文件中读取 + */ + private static final String DEFAULT_KEY = "0123456789ABCDEF0123456789ABCDEF"; // 32个十六进制字符 = 16字节 + + /** + * 向量(16字节) + */ + private static final String DEFAULT_IV = "FEDCBA9876543210FEDCBA9876543210"; // 32个十六进制字符 = 16字节 + + static { + // 注册 BouncyCastle 提供者 + Security.addProvider(new BouncyCastleProvider()); + } + + /** + * ECB 模式加密 + * + * @param plainText 明文 + * @return 密文(十六进制字符串) + * @throws Exception 加密异常 + */ + public static String encryptEcb(String plainText) throws Exception { + return encryptEcb(plainText, DEFAULT_KEY); + } + + /** + * ECB 模式加密(自定义密钥) + * + * @param plainText 明文 + * @param key 密钥(16字节十六进制字符串) + * @return 密文(十六进制字符串) + * @throws Exception 加密异常 + */ + public static String encryptEcb(String plainText, String key) throws Exception { + if (plainText == null || plainText.isEmpty()) { + return plainText; + } + + Cipher cipher = Cipher.getInstance(ALGORITHM_NAME_ECB_PADDING, BouncyCastleProvider.PROVIDER_NAME); + Key sm4Key = new SecretKeySpec(hexToByte(key), ALGORITHM_NAME); + cipher.init(Cipher.ENCRYPT_MODE, sm4Key); + byte[] encrypted = cipher.doFinal(plainText.getBytes("UTF-8")); + return byteToHex(encrypted); + } + + /** + * ECB 模式解密 + * + * @param cipherText 密文(十六进制字符串) + * @return 明文 + * @throws Exception 解密异常 + */ + public static String decryptEcb(String cipherText) throws Exception { + return decryptEcb(cipherText, DEFAULT_KEY); + } + + /** + * ECB 模式解密(自定义密钥) + * + * @param cipherText 密文(十六进制字符串) + * @param key 密钥(16字节十六进制字符串) + * @return 明文 + * @throws Exception 解密异常 + */ + public static String decryptEcb(String cipherText, String key) throws Exception { + if (cipherText == null || cipherText.isEmpty()) { + return cipherText; + } + + Cipher cipher = Cipher.getInstance(ALGORITHM_NAME_ECB_PADDING, BouncyCastleProvider.PROVIDER_NAME); + Key sm4Key = new SecretKeySpec(hexToByte(key), ALGORITHM_NAME); + cipher.init(Cipher.DECRYPT_MODE, sm4Key); + byte[] decrypted = cipher.doFinal(hexToByte(cipherText)); + return new String(decrypted, "UTF-8"); + } + + /** + * CBC 模式加密 + * + * @param plainText 明文 + * @return 密文(十六进制字符串) + * @throws Exception 加密异常 + */ + public static String encryptCbc(String plainText) throws Exception { + return encryptCbc(plainText, DEFAULT_KEY, DEFAULT_IV); + } + + /** + * CBC 模式加密(自定义密钥和向量) + * + * @param plainText 明文 + * @param key 密钥(16字节十六进制字符串) + * @param iv 向量(16字节十六进制字符串) + * @return 密文(十六进制字符串) + * @throws Exception 加密异常 + */ + public static String encryptCbc(String plainText, String key, String iv) throws Exception { + if (plainText == null || plainText.isEmpty()) { + return plainText; + } + + Cipher cipher = Cipher.getInstance(ALGORITHM_NAME_CBC_PADDING, BouncyCastleProvider.PROVIDER_NAME); + Key sm4Key = new SecretKeySpec(hexToByte(key), ALGORITHM_NAME); + IvParameterSpec ivSpec = new IvParameterSpec(hexToByte(iv)); + cipher.init(Cipher.ENCRYPT_MODE, sm4Key, ivSpec); + byte[] encrypted = cipher.doFinal(plainText.getBytes("UTF-8")); + return byteToHex(encrypted); + } + + /** + * CBC 模式解密 + * + * @param cipherText 密文(十六进制字符串) + * @return 明文 + * @throws Exception 解密异常 + */ + public static String decryptCbc(String cipherText) throws Exception { + return decryptCbc(cipherText, DEFAULT_KEY, DEFAULT_IV); + } + + /** + * CBC 模式解密(自定义密钥和向量) + * + * @param cipherText 密文(十六进制字符串) + * @param key 密钥(16字节十六进制字符串) + * @param iv 向量(16字节十六进制字符串) + * @return 明文 + * @throws Exception 解密异常 + */ + public static String decryptCbc(String cipherText, String key, String iv) throws Exception { + if (cipherText == null || cipherText.isEmpty()) { + return cipherText; + } + + Cipher cipher = Cipher.getInstance(ALGORITHM_NAME_CBC_PADDING, BouncyCastleProvider.PROVIDER_NAME); + Key sm4Key = new SecretKeySpec(hexToByte(key), ALGORITHM_NAME); + IvParameterSpec ivSpec = new IvParameterSpec(hexToByte(iv)); + cipher.init(Cipher.DECRYPT_MODE, sm4Key, ivSpec); + byte[] decrypted = cipher.doFinal(hexToByte(cipherText)); + return new String(decrypted, "UTF-8"); + } + + /** + * 生成 SM4 密钥 + * + * @return 密钥(十六进制字符串) + * @throws Exception 生成异常 + */ + public static String generateKey() throws Exception { + KeyGenerator keyGenerator = KeyGenerator.getInstance(ALGORITHM_NAME, BouncyCastleProvider.PROVIDER_NAME); + keyGenerator.init(DEFAULT_KEY_SIZE, new SecureRandom()); + SecretKey secretKey = keyGenerator.generateKey(); + return byteToHex(secretKey.getEncoded()); + } + + /** + * 字节数组转十六进制字符串 + */ + private static String byteToHex(byte[] bytes) { + StringBuilder sb = new StringBuilder(); + for (byte b : bytes) { + sb.append(String.format("%02x", b)); + } + return sb.toString().toUpperCase(); + } + + /** + * 十六进制字符串转字节数组 + */ + private static byte[] hexToByte(String hex) { + if (hex == null || hex.length() % 2 != 0) { + throw new IllegalArgumentException("Invalid hex string"); + } + int len = hex.length(); + byte[] bytes = new byte[len / 2]; + for (int i = 0; i < len; i += 2) { + bytes[i / 2] = (byte) ((Character.digit(hex.charAt(i), 16) << 4) + + Character.digit(hex.charAt(i + 1), 16)); + } + return bytes; + } + + // 测试方法 + public static void main(String[] args) { + try { + String plainText = "Hello, SM4 Encryption!"; + System.out.println("明文: " + plainText); + + // ECB 模式加密解密 + String ecbCipher = encryptEcb(plainText); + System.out.println("ECB 密文: " + ecbCipher); + String ecbPlain = decryptEcb(ecbCipher); + System.out.println("ECB 解密: " + ecbPlain); + + System.out.println(); + + // CBC 模式加密解密 + String cbcCipher = encryptCbc(plainText); + System.out.println("CBC 密文: " + cbcCipher); + String cbcPlain = decryptCbc(cbcCipher); + System.out.println("CBC 解密: " + cbcPlain); + + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/marketing-module-worker/.flattened-pom.xml b/marketing-module-worker/.flattened-pom.xml new file mode 100644 index 0000000..0e732ef --- /dev/null +++ b/marketing-module-worker/.flattened-pom.xml @@ -0,0 +1,58 @@ + + + 4.0.0 + com.platform + marketing-module-worker + 0.0.1-jdk8-SNAPSHOT + marketing-admin基础脚手架 + https://github.com/makemyownlife/marketing-admin/marketing-module-worker + + + com.platform + marketing-module-record + 0.0.1-jdk8-SNAPSHOT + compile + + + com.platform + marketing-module-tenant + 0.0.1-jdk8-SNAPSHOT + compile + + + com.platform + marketing-client-sdk + 0.0.1-jdk8-SNAPSHOT + compile + + + + + huaweicloud + huawei + https://mirrors.huaweicloud.com/repository/maven/ + + + aliyunmaven + aliyun + https://maven.aliyun.com/repository/public + + + + false + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + + + false + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + + diff --git a/marketing-module-worker/pom.xml b/marketing-module-worker/pom.xml new file mode 100644 index 0000000..8c201fb --- /dev/null +++ b/marketing-module-worker/pom.xml @@ -0,0 +1,39 @@ + + + 4.0.0 + + + com.platform + marketing-admin-all + ${revision} + + + marketing-module-worker + jar + + + + + + com.platform + marketing-module-record + ${parent.version} + + + + com.platform + marketing-module-tenant + ${parent.version} + + + + com.platform + marketing-client-sdk + ${parent.version} + + + + + \ No newline at end of file diff --git a/marketing-module-worker/src/main/java/com/platform/marketing/module/worker/config/SmsWorkerConfig.java b/marketing-module-worker/src/main/java/com/platform/marketing/module/worker/config/SmsWorkerConfig.java new file mode 100644 index 0000000..a1705e5 --- /dev/null +++ b/marketing-module-worker/src/main/java/com/platform/marketing/module/worker/config/SmsWorkerConfig.java @@ -0,0 +1,24 @@ +package com.platform.marketing.module.worker.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; + +import java.util.concurrent.ThreadPoolExecutor; + +@Configuration +public class SmsWorkerConfig { + @Bean("async-worker-executor") + public ThreadPoolTaskExecutor taskExecutor() { + ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); + executor.setCorePoolSize(4); + executor.setMaxPoolSize(4); + executor.setQueueCapacity(5000); + executor.setKeepAliveSeconds(60); + executor.setThreadNamePrefix("async-worker-executor-"); + executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy()); + executor.initialize(); + return executor; + } + +} diff --git a/marketing-module-worker/src/main/java/com/platform/marketing/module/worker/domain/enums/WorkerConstants.java b/marketing-module-worker/src/main/java/com/platform/marketing/module/worker/domain/enums/WorkerConstants.java new file mode 100644 index 0000000..1c7d903 --- /dev/null +++ b/marketing-module-worker/src/main/java/com/platform/marketing/module/worker/domain/enums/WorkerConstants.java @@ -0,0 +1,40 @@ +package com.platform.marketing.module.worker.domain.enums; + +import org.apache.commons.lang3.StringUtils; + +public class WorkerConstants { + + // 任务条目详情 每个任务条目key = taskId^nationcode^mobile + public static String SMS_BUCKET_TASK_ITEM_KEY_PREFIX = "sms:bucket:task:item:"; + + // TASK 单个 record 执行结果 Redis 存储 每个任务条目key = taskId^nationcode^mobile + public static String SMS_BUCKET_TASK_CONSUME_RESULT_KEY_PREFIX = "sms:bucket:consume:result:"; + + // 加载任务 到 MQ + public static final String TASK_LOAD_LOCK = "task:load:to:mq:"; + + // 任务暂停标记 key: sms:task:paused:{taskId} + public static final String SMS_TASK_PAUSED_KEY_PREFIX = "sms:task:paused:"; + + // 任务停泊列表 key: sms:task:parked:{taskId} + public static final String SMS_TASK_PARKED_KEY_PREFIX = "sms:task:parked:"; + + public static String generateSmsTaskItemKey(String taskId, String nationcode, String mobile) { + return StringUtils.join(new Object[]{ + taskId, + nationcode, + mobile + }, "^"); + } + + public static String[] reverseSmsTaskItemKey(String itemKey) { + return StringUtils.split(itemKey, "^"); + } + + public static void main(String[] args) { + System.out.println(generateSmsTaskItemKey("1", "86", "123")); + String[] arr = reverseSmsTaskItemKey("1^12^1213"); + System.out.println(arr); + } + +} diff --git a/marketing-module-worker/src/main/java/com/platform/marketing/module/worker/facade/ConsumeShortMessageFacadeImpl.java b/marketing-module-worker/src/main/java/com/platform/marketing/module/worker/facade/ConsumeShortMessageFacadeImpl.java new file mode 100644 index 0000000..d114373 --- /dev/null +++ b/marketing-module-worker/src/main/java/com/platform/marketing/module/worker/facade/ConsumeShortMessageFacadeImpl.java @@ -0,0 +1,214 @@ +package com.platform.marketing.module.worker.facade; + +import com.platform.marketing.framework.common.exception.ServiceException; +import com.platform.marketing.framework.common.pojo.CommonResult; +import com.platform.marketing.framework.idgenerator.core.service.IdGeneratorService; +import com.platform.marketing.module.record.domain.dto.ConsumeMQResult; +import com.platform.marketing.module.record.domain.dto.SendToMQParamDTO; +import com.platform.marketing.module.record.domain.enums.GatewayErrorCodeConstants; +import com.platform.marketing.module.record.domain.enums.RecordErrorCodeConstants; +import com.platform.marketing.module.record.domain.enums.SendStatusEnum; +import com.platform.marketing.module.record.domain.vo.RecordDetailSaveReqVO; +import com.platform.marketing.module.record.domain.vo.RecordSaveReqVO; +import com.platform.marketing.module.record.facade.ConsumeShortMessageFacade; +import com.platform.marketing.module.record.service.RecordDetailService; +import com.platform.marketing.module.record.service.SmsRecordService; +import com.platform.marketing.module.record.service.SmsTaskService; +import com.platform.marketing.module.smschannel.adapter.core.SmsOuterAdapter; +import com.platform.marketing.module.smschannel.adapter.core.command.req.SendSmsReqCommand; +import com.platform.marketing.module.smschannel.adapter.core.command.resp.SmsRespCommand; +import com.platform.marketing.module.smschannel.adapter.core.support.SmsTemplateUtil; +import com.platform.marketing.module.smschannel.domain.dataobject.SmsTemplateBindingInfoDO; +import com.platform.marketing.module.smschannel.domain.dataobject.SmsTemplateInfoDO; +import com.platform.marketing.module.smschannel.service.SmsAdapterService; +import com.platform.marketing.module.smschannel.service.SmsTemplateInfoService; +import com.platform.marketing.module.smschannel.service.TemplateBindingInfoService; +import com.platform.marketing.module.worker.domain.enums.WorkerConstants; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.redisson.api.RBucket; +import org.redisson.api.RList; +import org.redisson.api.RedissonClient; +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.time.Duration; +import java.time.LocalDateTime; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +import static com.platform.marketing.framework.common.exception.util.ServiceExceptionUtil.exception; + +@Component +@Slf4j +public class ConsumeShortMessageFacadeImpl implements ConsumeShortMessageFacade { + + @Resource + private SmsRecordService smsRecordService; + + @Resource + private IdGeneratorService idGeneratorService; + + @Resource + private SmsTemplateInfoService templateInfoService; + + @Resource + private TemplateBindingInfoService templateBindingInfoService; + + @Resource + private RecordDetailService recordDetailService; + + @Resource + private SmsAdapterService smsAdapterService; + + @Resource(name = "async-worker-executor") + private ThreadPoolTaskExecutor taskExecutor; + + @Resource + private SmsTaskService smsTaskService; + + @Resource + private RedissonClient redissonClient; + + @Override + public ConsumeMQResult consumeSingleShortMessage(SendToMQParamDTO sendToMQParamDTO) { + long start = System.currentTimeMillis(); + + // 创建结果对象 + ConsumeMQResult consumeMQResult = new ConsumeMQResult(); + consumeMQResult.setTaskId(sendToMQParamDTO.getTaskId()); + + log.info("开始处理单条短信任务:{}", sendToMQParamDTO); + + final String taskItemKey = WorkerConstants.generateSmsTaskItemKey(sendToMQParamDTO.getTaskId(), sendToMQParamDTO.getNationcode(), sendToMQParamDTO.getMobile()); + RBucket recordStatusCache = redissonClient.getBucket(WorkerConstants.SMS_BUCKET_TASK_CONSUME_RESULT_KEY_PREFIX + taskItemKey); + if (recordStatusCache.get() != null && StringUtils.isNotEmpty(recordStatusCache.get())) { + log.info("单条短信任务:{} 已被处理,不用消费", taskItemKey); + throw new ServiceException(RecordErrorCodeConstants.TASK_ITEM_PROCESSED); + } + + // 暂停检测:已在队列中但尚未处理的消息,检查任务是否被暂停 + RBucket pausedFlag = redissonClient.getBucket(WorkerConstants.SMS_TASK_PAUSED_KEY_PREFIX + sendToMQParamDTO.getTaskId()); + if (pausedFlag.isExists()) { + log.info("任务{}已暂停,停泊已在处理中的消息:{}", sendToMQParamDTO.getTaskId(), taskItemKey); + RList parkedList = redissonClient.getList(WorkerConstants.SMS_TASK_PARKED_KEY_PREFIX + sendToMQParamDTO.getTaskId()); + parkedList.add(taskItemKey); + return consumeMQResult; + } + + recordStatusCache.set(String.valueOf(SendStatusEnum.PENDING.getSendStatus()), Duration.ofDays(2L)); + + // step 1 : 插入到短信记录表 + SmsTemplateInfoDO smsTemplateInfoDO = templateInfoService.getTemplateInfo(sendToMQParamDTO.getTemplateId()); + + Long recordId = idGeneratorService.createUniqueId(sendToMQParamDTO.getAppId()); + RecordSaveReqVO recordSaveReqVO = new RecordSaveReqVO(); + recordSaveReqVO.setId(recordId); + recordSaveReqVO.setMobile(sendToMQParamDTO.getMobile()); + recordSaveReqVO.setTaskId(Long.valueOf(sendToMQParamDTO.getTaskId())); + recordSaveReqVO.setRecordType(sendToMQParamDTO.getRecordType()); + recordSaveReqVO.setAttime(sendToMQParamDTO.getAttime()); + recordSaveReqVO.setSendStatus(SendStatusEnum.PENDING.getSendStatus()); + recordSaveReqVO.setNationcode(sendToMQParamDTO.getNationcode()); + recordSaveReqVO.setInternational(smsTemplateInfoDO.getInternational()); + recordSaveReqVO.setTemplateId(sendToMQParamDTO.getTemplateId()); + recordSaveReqVO.setTemplateParam(sendToMQParamDTO.getTemplateParam()); + recordSaveReqVO.setAppId(sendToMQParamDTO.getAppId()); + + String content = SmsTemplateUtil.renderContentWithSignName(sendToMQParamDTO.getTemplateParam(), smsTemplateInfoDO.getContent(), smsTemplateInfoDO.getSignName()); + recordSaveReqVO.setContent(content); + smsRecordService.createRecord(recordSaveReqVO); + + // step 2 : 遍历绑定渠道账号,调用 三方接口,插入到短信记录详情表 + List templateBindingInfoDOList = templateBindingInfoService.getTemplateBindingInfoList(sendToMQParamDTO.getTemplateId()).stream().filter(templateBindingInfoDO -> templateBindingInfoDO.getStatus() == 2) //审核状态:0-待提交 1-待审核 2-审核成功 3-审核失败 + .collect(Collectors.toList()); + + if (templateBindingInfoDOList.size() >= 1) { + Collections.shuffle(templateBindingInfoDOList); + for (SmsTemplateBindingInfoDO templateBindingInfoDO : templateBindingInfoDOList) { + SmsOuterAdapter smsOuterAdapter = smsAdapterService.getSmsOuterAdapterByAccountId(templateBindingInfoDO.getAccountId()); + + // 定义 step 3: 构建发送短信参数 + SendSmsReqCommand sendSmsReqCommand = new SendSmsReqCommand(); + sendSmsReqCommand.setPhoneNumber(sendToMQParamDTO.getMobile()); + sendSmsReqCommand.setNationcode(sendToMQParamDTO.getNationcode()); + sendSmsReqCommand.setTemplateCode(templateBindingInfoDO.getTemplateCode()); + sendSmsReqCommand.setTemplateContent(smsTemplateInfoDO.getContent()); + sendSmsReqCommand.setTemplateParam(sendToMQParamDTO.getTemplateParam()); + sendSmsReqCommand.setSignName(smsTemplateInfoDO.getSignName()); + sendSmsReqCommand.setTemplateCode(templateBindingInfoDO.getTemplateCode()); + SmsRespCommand smsRespCommand = smsOuterAdapter.sendSmsByTemplateId(sendSmsReqCommand); + + int sendStatus = (smsRespCommand.getCode() == SmsRespCommand.SUCCESS_CODE) ? 0 : 1; + String errorMsg = StringUtils.trimToEmpty(smsRespCommand.getMessage()); + String msgId = StringUtils.trimToEmpty(smsRespCommand.getData()); + + // 定义 step 4: 插入到短信记录详情表 + Long detailId = idGeneratorService.createUniqueId(sendToMQParamDTO.getAppId()); + RecordDetailSaveReqVO recordDetailSaveReqVO = new RecordDetailSaveReqVO(); + recordDetailSaveReqVO.setId(detailId); + recordDetailSaveReqVO.setRecordId(recordId); + recordDetailSaveReqVO.setTaskId(Long.valueOf(sendToMQParamDTO.getTaskId())); + recordDetailSaveReqVO.setAppId(sendToMQParamDTO.getAppId()); + recordDetailSaveReqVO.setMobile(sendToMQParamDTO.getMobile()); + recordDetailSaveReqVO.setNationcode(sendToMQParamDTO.getNationcode()); + recordDetailSaveReqVO.setSendStatus(sendStatus); + recordDetailSaveReqVO.setChannelCode(templateBindingInfoDO.getChannelCode()); + recordDetailSaveReqVO.setChannelAccountId(templateBindingInfoDO.getAccountId()); + recordDetailSaveReqVO.setErrorMsg(errorMsg); + recordDetailSaveReqVO.setMsgid(msgId); + recordDetailSaveReqVO.setSenderTime(LocalDateTime.now()); + recordDetailService.createRecordDetail(recordDetailSaveReqVO); + + // 定义 step 5: 若某一个通道发送成功,则停止发送。 + if (sendStatus == 0) { + consumeMQResult.setChannelCode(templateBindingInfoDO.getChannelCode()); + consumeMQResult.setChannelAccountId(templateBindingInfoDO.getAccountId()); + consumeMQResult.setSuccess(true); + consumeMQResult.setBizId(msgId); + break; + } else { + consumeMQResult.setSuccess(false); + consumeMQResult.setMessage(errorMsg); + } + } + } else { + consumeMQResult.setSuccess(false); + consumeMQResult.setMessage("没有可选择的渠道供选择"); + } + + String remark = consumeMQResult.getSuccess() ? "发送成功" : consumeMQResult.getMessage(); + Integer recordStatus = consumeMQResult.getSuccess() ? SendStatusEnum.SENT.getSendStatus() : SendStatusEnum.FAILED.getSendStatus(); + // 设置消费状态 + recordStatusCache.set( + String.valueOf(recordStatus), + Duration.ofDays(2L) + ); + + + // step 6: 同步修改 task 表的计数(关键:必须同步,防止计数丢失导致 successCount + failCount != totalCount) + try { + smsTaskService.updateSingleSmsTask(consumeMQResult); + } catch (Exception e) { + log.error("更新任务计数失败 taskId:" + sendToMQParamDTO.getTaskId() + " item:" + taskItemKey, e); + } + + // step 7: 异步修改 sms_record 表的 send_status(非关键,允许异步) + taskExecutor.execute(new Runnable() { + @Override + public void run() { + try { + smsRecordService.updateRecordStatus(recordId, recordStatus, remark); + } catch (Exception e) { + log.error("更新短信记录状态失败 recordId:" + recordId, e); + } + } + }); + + log.info("结束处理单条短信任务ID:{} 耗时:{}ms", sendToMQParamDTO.getTaskId(), (System.currentTimeMillis() - start)); + return consumeMQResult; + } + +} diff --git a/marketing-module-worker/src/main/java/com/platform/marketing/module/worker/facade/LoadTaskToMQFacadeImpl.java b/marketing-module-worker/src/main/java/com/platform/marketing/module/worker/facade/LoadTaskToMQFacadeImpl.java new file mode 100644 index 0000000..d28db19 --- /dev/null +++ b/marketing-module-worker/src/main/java/com/platform/marketing/module/worker/facade/LoadTaskToMQFacadeImpl.java @@ -0,0 +1,155 @@ +package com.platform.marketing.module.worker.facade; + +import com.platform.marketing.client.sdk.util.CountryCallingCodes; +import com.platform.marketing.framework.common.exception.ServiceException; +import com.platform.marketing.framework.common.util.json.JsonUtils; +import com.platform.marketing.module.record.domain.dataobject.SmsTaskContentDO; +import com.platform.marketing.module.record.domain.dataobject.SmsTaskDO; +import com.platform.marketing.module.record.domain.dto.SendToMQParamDTO; +import com.platform.marketing.module.record.domain.enums.TaskStatusEnum; +import com.platform.marketing.module.record.facade.LoadTaskToMQFacade; +import com.platform.marketing.module.record.facade.MQSenderFacade; +import com.platform.marketing.module.record.mapper.SmsTaskContentMapper; +import com.platform.marketing.module.record.mapper.SmsTaskMapper; +import com.platform.marketing.module.record.service.SmsTaskService; +import com.platform.marketing.module.record.util.UtilsAll; +import com.platform.marketing.module.smschannel.adapter.core.support.SmsTemplateUtil; +import com.platform.marketing.module.smschannel.domain.dataobject.SmsTemplateInfoDO; +import com.platform.marketing.module.smschannel.service.SmsTemplateInfoService; +import com.platform.marketing.module.worker.domain.enums.WorkerConstants; +import lombok.NonNull; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.time.DateFormatUtils; +import org.apache.commons.lang3.tuple.Pair; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.TimeUnit; + +import org.redisson.api.RBucket; +import org.redisson.api.RLock; +import org.redisson.api.RedissonClient; + +import static com.platform.marketing.module.worker.domain.enums.WorkerConstants.TASK_LOAD_LOCK; + +@Component +@Slf4j +public class LoadTaskToMQFacadeImpl implements LoadTaskToMQFacade { + + @Resource + private SmsTaskService smsTaskService; + + @Resource + private SmsTaskContentMapper smsTaskContentMapper; + + @Resource + private SmsTaskMapper smsTaskMapper; + + @Resource + private SmsTemplateInfoService smsTemplateInfoService; + + @Resource + private MQSenderFacade mqSenderFacade; + + @Resource + private RedissonClient redissonClient; + + @Override + public void loadTaskContentToMQ(@NonNull Long taskId, boolean checkTimeExpired) throws ServiceException { + // 任务锁的 key,每个任务一个锁 + String lockKey = TASK_LOAD_LOCK + taskId; + // 获取锁 + RLock lock = redissonClient.getLock(lockKey); + boolean isLocked = false; + try { + // 尝试获取锁,等待时间 10 秒,自动释放时间 2 分钟 + isLocked = lock.tryLock(10, 120, TimeUnit.SECONDS); + if (!isLocked) { + log.info("任务{}获取锁失败,跳过处理", taskId); + return; + } + SmsTaskDO smsTaskDO = smsTaskService.getSmsTask(taskId); + if (smsTaskDO != null) { + if (checkTimeExpired) { + String attime = smsTaskDO.getAttime(); + if (StringUtils.isNotEmpty(attime)) { + Long nextHourLastSecondTimestamp = UtilsAll.getNextHourLastSecondTimestamp(); + if (Long.parseLong(attime) > nextHourLastSecondTimestamp) { + log.info("任务{}未到下个小时以内 {},请稍后重试", taskId, DateFormatUtils.format(nextHourLastSecondTimestamp, "yyyy-MM-dd HH:mm:ss")); + return; + } + } + } + + SmsTemplateInfoDO templateInfo = smsTemplateInfoService.getTemplateInfo(smsTaskDO.getTemplateId()); + String templateInfoContent = templateInfo.getContent(); + + SmsTaskContentDO taskContentDO = smsTaskContentMapper.selectById(taskId); + if (taskContentDO != null) { + String[] phoneItems = taskContentDO.getTaskContent().split(","); + /** + * 分两种情况, + * 若无模板参数,则手机号码列表,手机号用英文逗号分隔 ,手机号1,手机号2,手机号3 + * 若模板参数,则手机号码列表,手机号用英文逗号分隔,参数用英文冒号分隔,参数格式为:手机号1^参数1^参数2^参数3,手机号2^参数1^参数2^参数3 + */ + for (String phoneItem : phoneItems) { + // 暂停检测 + RBucket pausedFlag = redissonClient.getBucket(WorkerConstants.SMS_TASK_PAUSED_KEY_PREFIX + taskId); + if (pausedFlag.isExists()) { + log.info("任务{}已暂停,停止加载到MQ,已加载部分数据", taskId); + return; + } + + String mobile = StringUtils.EMPTY; + String templateParam = StringUtils.EMPTY; + + // 参数格式为:手机号1^参数1^参数2^参数3 + String[] itemSplit = phoneItem.split("\\^"); + if (itemSplit.length == 1) { // 没有参数 + mobile = itemSplit[0]; + templateParam = smsTaskDO.getTemplateParam(); + } else { + mobile = itemSplit[0]; + String[] placeholders = SmsTemplateUtil.extractPlaceholders(templateInfoContent); + Map templateParamMap = new HashMap(); + for (int i = 0; i < placeholders.length; i++) { + templateParamMap.put(placeholders[i], itemSplit[i + 1]); + } + templateParam = JsonUtils.toJsonString(templateParamMap); + } + + SendToMQParamDTO sendToMQParamDTO = new SendToMQParamDTO(); + sendToMQParamDTO.setTaskId(String.valueOf(taskId)); + Pair pair = CountryCallingCodes.detectCountryCode(mobile); + sendToMQParamDTO.setNationcode(pair.getLeft()); + sendToMQParamDTO.setMobile(pair.getRight()); + sendToMQParamDTO.setAppId(String.valueOf(smsTaskDO.getAppId())); + sendToMQParamDTO.setTemplateId(smsTaskDO.getTemplateId()); + sendToMQParamDTO.setTemplateParam(templateParam); + sendToMQParamDTO.setAttime(smsTaskDO.getAttime()); + sendToMQParamDTO.setSenderIp(smsTaskDO.getSenderIp()); + sendToMQParamDTO.setRecordType(templateInfo.getTemplateType()); + mqSenderFacade.sendSingleShortMessageToMQ(sendToMQParamDTO); + } + } + // 发送到队列后,条件更新任务状态为发送中(仅当状态仍为 PENDING 时更新) + smsTaskMapper.updateTaskStatusConditionally(taskId, TaskStatusEnum.SENDING.getCode(), TaskStatusEnum.PENDING.getCode()); + } + } catch (InterruptedException e) { + log.error("任务{}获取锁被中断", taskId, e); + Thread.currentThread().interrupt(); + } catch (Exception e) { + log.error("处理任务{}失败", taskId, e); + throw e; + } finally { + // 释放锁 + if (isLocked && lock.isHeldByCurrentThread()) { + lock.unlock(); + } + } + } + +} diff --git a/marketing-module-worker/src/main/java/com/platform/marketing/module/worker/facade/MQSenderFacadeImpl.java b/marketing-module-worker/src/main/java/com/platform/marketing/module/worker/facade/MQSenderFacadeImpl.java new file mode 100644 index 0000000..70caba7 --- /dev/null +++ b/marketing-module-worker/src/main/java/com/platform/marketing/module/worker/facade/MQSenderFacadeImpl.java @@ -0,0 +1,83 @@ +package com.platform.marketing.module.worker.facade; + +import com.platform.marketing.framework.common.util.json.JsonUtils; +import com.platform.marketing.framework.idgenerator.core.service.IdGeneratorService; +import com.platform.marketing.module.record.domain.dto.SendToMQParamDTO; +import com.platform.marketing.module.record.domain.dto.SendToMQResultDTO; +import com.platform.marketing.module.record.domain.enums.RecordErrorCodeConstants; +import com.platform.marketing.module.record.domain.enums.SmsTypeTopicEnum; +import com.platform.marketing.module.record.facade.MQSenderFacade; +import com.platform.marketing.module.worker.domain.enums.WorkerConstants; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.redisson.api.RBlockingQueue; +import org.redisson.api.RDelayedQueue; +import org.redisson.api.RedissonClient; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.time.Duration; +import java.util.concurrent.TimeUnit; + +import static com.platform.marketing.framework.common.exception.util.ServiceExceptionUtil.exception; + +@Component +@Slf4j +public class MQSenderFacadeImpl implements MQSenderFacade { + + @Resource + private RedissonClient redissonClient; + + @Override + public SendToMQResultDTO sendSingleShortMessageToMQ(SendToMQParamDTO sendToMQParamDTO) { + log.info("开始发送短信到MQ,sendToMQParamDTO:{}", sendToMQParamDTO); + SmsTypeTopicEnum smsTypeTopicEnum = SmsTypeTopicEnum.getByTypeCode(sendToMQParamDTO.getRecordType()); + if (smsTypeTopicEnum == null) { + throw exception(RecordErrorCodeConstants.SMS_TYPE_NOT_EXISTS); + } + + SendToMQResultDTO sendToMQResultDTO = new SendToMQResultDTO(); + + // 是否发送到 MQ 成功 + boolean sendMQFlag = false; + + // 是否延迟消息 + boolean isDelayMessage = false; + + String paramJson = JsonUtils.toJsonString(sendToMQParamDTO); + String taskItemKey = WorkerConstants.generateSmsTaskItemKey(sendToMQParamDTO.getTaskId(), sendToMQParamDTO.getNationcode(), sendToMQParamDTO.getMobile()); + + // step 1 : 首先将 task 内容添加到 Redis 的 string 对象里 (过期时间两天) + redissonClient.getBucket(WorkerConstants.SMS_BUCKET_TASK_ITEM_KEY_PREFIX + taskItemKey).set(paramJson, Duration.ofDays(2)); + + // step 2: 定义阻塞队列 (消费使用) + RBlockingQueue blockingQueue = redissonClient.getBlockingQueue(smsTypeTopicEnum.getTopic()); + + // step3 : 判断是否延迟队列 + if (StringUtils.isNotEmpty(sendToMQParamDTO.getAttime())) { + long attimeLong = Long.parseLong(sendToMQParamDTO.getAttime()); + long delay = attimeLong - System.currentTimeMillis(); + if (delay > 0L) { + isDelayMessage = true; + // 发送端:两个自然小时的延迟短信,直接将数据添加到 Redis 的延迟队列 zset 容器 + // 定时任务端:会加载当前小时的延迟短信,添加到 zset 中 List recordList = smsRecordDAO.queryWaitingSendSmsList(String.valueOf(currentHourFirstTimeStamp), String.valueOf(currentHourLastTimeStamp), startId); + RDelayedQueue delayedQueue = redissonClient.getDelayedQueue(blockingQueue); + delayedQueue.offer(taskItemKey, delay, TimeUnit.MILLISECONDS); + log.info("发送到延迟队列成功,taskItemKey:{}", taskItemKey); + } + } + + // step4 : 若不是延迟队列,则直接添加到阻塞队列中 ,消费者可以直接获取到。 + if (!isDelayMessage) { + sendMQFlag = blockingQueue.offer(taskItemKey); + log.info("非延迟队列,发送到队列成功,taskItemKey:{}", taskItemKey); + } + + if (sendMQFlag) { + log.info(" 发送成功,sendToMQParamDTO:{}", paramJson); + } + + sendToMQResultDTO.setSuccess(sendMQFlag); + return sendToMQResultDTO; + } +} diff --git a/marketing-module-worker/src/main/java/com/platform/marketing/module/worker/facade/SendShortMessageFacadeImpl.java b/marketing-module-worker/src/main/java/com/platform/marketing/module/worker/facade/SendShortMessageFacadeImpl.java new file mode 100644 index 0000000..dc9af3a --- /dev/null +++ b/marketing-module-worker/src/main/java/com/platform/marketing/module/worker/facade/SendShortMessageFacadeImpl.java @@ -0,0 +1,359 @@ +package com.platform.marketing.module.worker.facade; + +import com.platform.marketing.client.sdk.util.CountryCallingCodes; +import com.platform.marketing.framework.common.pojo.CommonResult; +import com.platform.marketing.framework.common.util.json.JsonUtils; +import com.platform.marketing.framework.idgenerator.core.service.IdGeneratorService; +import com.platform.marketing.module.record.domain.dto.SendBatchSmsReqDTO; +import com.platform.marketing.module.record.domain.dto.SendSingleSmsReqDTO; +import com.platform.marketing.module.record.domain.dto.SendToMQParamDTO; +import com.platform.marketing.module.record.domain.dto.SendToMQResultDTO; +import com.platform.marketing.module.record.domain.enums.*; +import com.platform.marketing.module.record.domain.vo.AdminSmsTaskUploadReqVO; +import com.platform.marketing.module.record.domain.vo.SmsTaskImportExcelVO; +import com.platform.marketing.module.record.domain.vo.SmsTaskSaveReqVO; +import com.platform.marketing.module.record.facade.LoadTaskToMQFacade; +import com.platform.marketing.module.record.facade.MQSenderFacade; +import com.platform.marketing.module.record.facade.SendShortMessageFacade; +import com.platform.marketing.module.record.service.SmsTaskService; +import com.platform.marketing.module.record.util.UtilsAll; +import com.platform.marketing.module.smschannel.adapter.core.support.SmsTemplateUtil; +import com.platform.marketing.module.smschannel.domain.dataobject.SmsSignInfoDO; +import com.platform.marketing.module.smschannel.domain.dataobject.SmsTemplateInfoDO; +import com.platform.marketing.module.smschannel.service.SmsSignInfoService; +import com.platform.marketing.module.smschannel.service.SmsTemplateInfoService; +import com.platform.marketing.module.tenant.domain.dataobject.SmsAppinfoDO; +import com.platform.marketing.module.tenant.service.SmsAppinfoService; +import com.platform.marketing.module.tenant.service.SmsTenantService; +import com.alibaba.excel.EasyExcel; +import com.alibaba.excel.context.AnalysisContext; +import com.alibaba.excel.event.AnalysisEventListener; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.tuple.Pair; +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; +import org.springframework.stereotype.Component; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import java.util.*; + +/** + * 发送短信门面 + */ +@Component +@Slf4j +public class SendShortMessageFacadeImpl implements SendShortMessageFacade { + + @Resource + private SmsAppinfoService smsAppinfoService; + + @Resource + private SmsTenantService smsTenantService; + + @Resource + private SmsTemplateInfoService smsTemplateInfoService; + + @Resource + private IdGeneratorService idGeneratorService; + + @Resource + private SmsTaskService smsTaskService; + + @Resource + private SmsSignInfoService smsSignInfoService; + + @Resource(name = "async-worker-executor") + private ThreadPoolTaskExecutor taskExecutor; + + @Resource + private LoadTaskToMQFacade loadTaskToMQFacade; + + @Override + public CommonResult sendByTemplateId(SendSingleSmsReqDTO sendSingleSmsReqDTO) { + // step 1 : 判断应用是否存在 + SmsAppinfoDO smsAppinfoDO = smsAppinfoService.getAppinfoByAppKeyFromLocalCache(sendSingleSmsReqDTO.getAppKey()); + if (smsAppinfoDO == null || smsAppinfoDO.getStatus() == 1) { + return CommonResult.error(GatewayErrorCodeConstants.APP_NOT_EXISTS); + } + // step 2 : 判断模版是否存在 + SmsTemplateInfoDO smsTemplateInfoDO = smsTemplateInfoService.getTemplateInfo(Long.valueOf(sendSingleSmsReqDTO.getTemplateId())); + if (smsTemplateInfoDO == null) { + return CommonResult.error(GatewayErrorCodeConstants.TEMPLATE_NOT_EXIST); + } + // step 3 : 保存发送任务到短信任务表里 + final Long taskId = idGeneratorService.createUniqueId(sendSingleSmsReqDTO.getAppKey()); + SmsTaskSaveReqVO taskSaveReqVO = new SmsTaskSaveReqVO(); + taskSaveReqVO.setId(taskId); + taskSaveReqVO.setTaskName(sendSingleSmsReqDTO.getSource() == 0 ? "网关发送短信" : sendSingleSmsReqDTO.getTaskName()); + taskSaveReqVO.setSignName(smsTemplateInfoDO.getSignName()); + taskSaveReqVO.setTemplateId(smsTemplateInfoDO.getId()); + taskSaveReqVO.setTotalCount(1); + taskSaveReqVO.setTaskStatus(TaskStatusEnum.PENDING.getCode()); + taskSaveReqVO.setFailCount(0); + taskSaveReqVO.setSuccessCount(0); + taskSaveReqVO.setPhoneNumbers(sendSingleSmsReqDTO.getMobile()); + taskSaveReqVO.setTemplateName(smsTemplateInfoDO.getTemplateName()); + taskSaveReqVO.setSignId(smsTemplateInfoDO.getSignId()); + taskSaveReqVO.setTemplateContent(smsTemplateInfoDO.getContent()); + taskSaveReqVO.setTemplateParam(JsonUtils.toJsonString(sendSingleSmsReqDTO.getTemplateParam())); + taskSaveReqVO.setAppId(smsAppinfoDO.getId()); + taskSaveReqVO.setSenderIp(sendSingleSmsReqDTO.getSenderIp()); + taskSaveReqVO.setSource(0); // 0: 网关 1:admin + if (StringUtils.isNotEmpty(sendSingleSmsReqDTO.getAttime())) { + taskSaveReqVO.setAttime(sendSingleSmsReqDTO.getAttime()); + } + taskSaveReqVO.setInternational(smsTemplateInfoDO.getInternational()); + smsTaskService.createSmsTask(taskSaveReqVO); + + // step 4 : 将任务信息发送到 MQ (当前是 Redis 后续可以扩展到 RocketMQ ) + taskExecutor.execute(new Runnable() { + @Override + public void run() { + try { + loadTaskToMQFacade.loadTaskContentToMQ(taskId, true); + } catch (Exception e) { + log.error("将任务信息发送 MQ 失败", e); + } + } + }); + + return CommonResult.success(taskId); + } + + @Override + public CommonResult batchSendByTemplateId(SendBatchSmsReqDTO sendBatchSmsReqDTO) { + // step 1 : 判断应用是否存在 + SmsAppinfoDO smsAppinfoDO = smsAppinfoService.getAppinfoByAppKeyFromLocalCache(sendBatchSmsReqDTO.getAppKey()); + if (smsAppinfoDO == null || smsAppinfoDO.getStatus() == 1) { + return CommonResult.error(GatewayErrorCodeConstants.APP_NOT_EXISTS); + } + // step 2 : 判断模版是否存在 + SmsTemplateInfoDO smsTemplateInfoDO = smsTemplateInfoService.getTemplateInfo(Long.valueOf(sendBatchSmsReqDTO.getTemplateId())); + if (smsTemplateInfoDO == null) { + return CommonResult.error(GatewayErrorCodeConstants.TEMPLATE_NOT_EXIST); + } + // step 3 : 保存发送任务到短信任务表里 + Long taskId = idGeneratorService.createUniqueId(String.valueOf(smsAppinfoDO.getId())); + + SmsTaskSaveReqVO taskSaveReqVO = new SmsTaskSaveReqVO(); + taskSaveReqVO.setId(taskId); + taskSaveReqVO.setTaskName(sendBatchSmsReqDTO.getSource() == 0 ? "网关发送短信" : sendBatchSmsReqDTO.getTaskName()); + taskSaveReqVO.setSignName(smsTemplateInfoDO.getSignName()); + taskSaveReqVO.setTemplateId(smsTemplateInfoDO.getId()); + + String phoneNumbers = sendBatchSmsReqDTO.getPhoneNumbers(); + String[] uniquePhoneNumbers = Arrays.stream(phoneNumbers.split(",")) + .distinct() + .toArray(String[]::new); + String purePhoneNumbers = String.join(",", uniquePhoneNumbers); + + taskSaveReqVO.setTotalCount(uniquePhoneNumbers.length); + taskSaveReqVO.setTaskStatus(TaskStatusEnum.PENDING.getCode()); + taskSaveReqVO.setFailCount(0); + taskSaveReqVO.setSuccessCount(0); + taskSaveReqVO.setPhoneNumbers(purePhoneNumbers); + taskSaveReqVO.setTemplateName(smsTemplateInfoDO.getTemplateName()); + taskSaveReqVO.setSignId(smsTemplateInfoDO.getSignId()); + taskSaveReqVO.setTemplateContent(smsTemplateInfoDO.getContent()); + taskSaveReqVO.setTemplateParam(JsonUtils.toJsonString(sendBatchSmsReqDTO.getTemplateParam())); + taskSaveReqVO.setAppId(smsAppinfoDO.getId()); + taskSaveReqVO.setSenderIp(sendBatchSmsReqDTO.getSenderIp()); + taskSaveReqVO.setSource(TaskSource.GATEWAY.getCode()); // 0: 网关 1:admin + if (StringUtils.isNotEmpty(sendBatchSmsReqDTO.getAttime())) { + taskSaveReqVO.setAttime(sendBatchSmsReqDTO.getAttime()); + } + taskSaveReqVO.setInternational(smsTemplateInfoDO.getInternational()); + smsTaskService.createSmsTask(taskSaveReqVO); + + // step 4 : 将任务信息发送到MQ(批量处理程序定时任务) , 假如有10万条短信,同步发就会阻塞网关或者控制台。 + taskExecutor.execute(new Runnable() { + @Override + public void run() { + try { + loadTaskToMQFacade.loadTaskContentToMQ(taskId, true); + } catch (Exception e) { + log.error("批量将任务信息发送 MQ 失败", e); + } + } + }); + + return CommonResult.success(taskId); + } + + @Override + public CommonResult uploadFileToCreateSmsTask(AdminSmsTaskUploadReqVO smsTaskSaveReqVO) { + SmsTemplateInfoDO smsTemplateInfoDO = smsTemplateInfoService.getTemplateInfo(Long.valueOf(smsTaskSaveReqVO.getTemplateId())); + if (smsTemplateInfoDO == null) { + return CommonResult.error(GatewayErrorCodeConstants.TEMPLATE_NOT_EXIST); + } + + Long signId = smsTemplateInfoDO.getSignId(); + SmsSignInfoDO smsSignInfoDO = smsSignInfoService.getSignInfo(signId); + if (smsSignInfoDO == null) { + return CommonResult.error(GatewayErrorCodeConstants.SMS_SIGN_NOT_EXIST); + } + + Long tenantId = smsSignInfoDO.getTenantId(); + SmsAppinfoDO smsAppinfoDO = smsAppinfoService.getAppinfoByTenantId(tenantId); + if (smsAppinfoDO == null) { + return CommonResult.error(GatewayErrorCodeConstants.APP_NOT_EXISTS); + } + + String templateContent = smsTemplateInfoDO.getContent(); + + // step 1 : 判断是否有空文件 并且 excel 的模板是否和 excel 第一行的列是否一致 + + // 第一列是 phone 手机号,后面的列是模板参数 比如 name ,第二个 是 code 。 + // phone name code + // 008524667 JACK 123 + // 00174859785 RYAN 456 + // 0023495834 JAY 789 + // step 1. 读取Excel文件中的手机号和参数 + List excelDataList = readExcelWithDynamicParams(smsTaskSaveReqVO.getFile(), templateContent); + if (CollectionUtils.isEmpty(excelDataList)) { + return CommonResult.error(RecordErrorCodeConstants.UPLOAD_FILE_EMPTY); + } + + //step 2. 检查模板是否包含参数 + String[] placeholders = SmsTemplateUtil.extractPlaceholders(templateContent); + boolean hasTemplateParams = (placeholders != null && placeholders.length > 0); + String taskContent = StringUtils.EMPTY; // 按照参数的顺序组装参数值 + + //step 3. 组装短信参数 + if (hasTemplateParams) { + // 若有模板参数,则手机号码列表,手机号用英文逗号分隔,参数用英文冒号分隔,参数格式为:手机号1^参数1^参数2^参数3,手机号2^参数1^参数2^参数3 + StringBuilder contentBuilder = new StringBuilder(); + for (int i = 0; i < excelDataList.size(); i++) { + SmsTaskImportExcelVO excelData = excelDataList.get(i); + if (i > 0) { + contentBuilder.append(","); + } + + // 按照模板中参数的顺序组装参数值 + StringBuilder paramBuilder = new StringBuilder(); + paramBuilder.append(excelData.getMobile()); + + for (String placeholder : placeholders) { + paramBuilder.append("^"); + String paramValue = excelData.getTemplateParam(placeholder); + paramBuilder.append(paramValue != null ? paramValue : ""); + } + + contentBuilder.append(paramBuilder.toString()); + } + taskContent = contentBuilder.toString(); + } else { + // 若无模板参数,则手机号码列表,手机号用英文逗号分隔 ,手机号1,手机号2,手机号3 + StringBuilder phoneNumbersBuilder = new StringBuilder(); + for (int i = 0; i < excelDataList.size(); i++) { + SmsTaskImportExcelVO excelData = excelDataList.get(i); + if (i > 0) { + phoneNumbersBuilder.append(","); + } + phoneNumbersBuilder.append(excelData.getMobile()); + } + taskContent = phoneNumbersBuilder.toString(); + } + + // step 4. 创建批量发送短信请求 + Long taskId = idGeneratorService.createUniqueId(String.valueOf(smsSignInfoDO.getId())); + SmsTaskSaveReqVO taskSaveReqVO = new SmsTaskSaveReqVO(); + taskSaveReqVO.setId(taskId); + taskSaveReqVO.setTaskName(smsTaskSaveReqVO.getTaskName()); + taskSaveReqVO.setSignName(smsTemplateInfoDO.getSignName()); + taskSaveReqVO.setTemplateId(smsTemplateInfoDO.getId()); + taskSaveReqVO.setTotalCount(excelDataList.size()); + taskSaveReqVO.setTaskStatus(TaskStatusEnum.PENDING.getCode()); + taskSaveReqVO.setFailCount(0); + taskSaveReqVO.setSuccessCount(0); + taskSaveReqVO.setPhoneNumbers(taskContent); + taskSaveReqVO.setTemplateName(smsTemplateInfoDO.getTemplateName()); + taskSaveReqVO.setSignId(smsTemplateInfoDO.getSignId()); + taskSaveReqVO.setTemplateContent(smsTemplateInfoDO.getContent()); + taskSaveReqVO.setRemark(smsTaskSaveReqVO.getRemark()); + taskSaveReqVO.setTemplateParam(StringUtils.EMPTY); + taskSaveReqVO.setAppId(smsAppinfoDO.getId()); + taskSaveReqVO.setSenderIp(smsTaskSaveReqVO.getSenderIp()); + taskSaveReqVO.setSource(TaskSource.ADMIN.getCode()); // 0: 网关 1:admin + if (StringUtils.isNotEmpty(smsTaskSaveReqVO.getAttime())) { + taskSaveReqVO.setAttime(smsTaskSaveReqVO.getAttime()); + } + taskSaveReqVO.setInternational(smsTemplateInfoDO.getInternational()); + smsTaskService.createSmsTask(taskSaveReqVO); + + // step 4 : 将任务信息发送到MQ(批量处理程序定时任务) , 假如有10万条短信,同步发就会阻塞网关或者控制台。 + taskExecutor.execute(new Runnable() { + @Override + public void run() { + try { + loadTaskToMQFacade.loadTaskContentToMQ(taskId, true); + } catch (Exception e) { + log.error("批量将任务信息发送 MQ 失败", e); + } + } + }); + + return CommonResult.success(taskId); + } + + private List readExcelWithDynamicParams(MultipartFile file, String templateContent) { + try { + // 获取模板中的参数占位符 + String[] placeholders = SmsTemplateUtil.extractPlaceholders(templateContent); + + // 使用EasyExcel的监听器模式读取Excel + List resultList = new ArrayList<>(); + + // 创建监听器 + AnalysisEventListener> listener = new AnalysisEventListener>() { + @Override + public void invoke(Map data, AnalysisContext context) { + if (data.isEmpty()) { + return; + } + + // 创建导入VO对象 + SmsTaskImportExcelVO vo = new SmsTaskImportExcelVO(); + + // 第一列是手机号(索引从0开始) + String mobile = data.get(0); + if (mobile != null) { + vo.setMobile(mobile.trim()); + } + + // 后续列是参数值,按照模板参数的顺序对应 + if (placeholders != null && placeholders.length > 0) { + for (int i = 0; i < placeholders.length; i++) { + // Excel中参数列的索引为 i + 1(第一列是手机号) + String paramValue = data.get(i + 1); + if (paramValue != null) { + vo.addTemplateParam(placeholders[i], paramValue.trim()); + } else { + vo.addTemplateParam(placeholders[i], ""); + } + } + } + + resultList.add(vo); + } + + @Override + public void doAfterAllAnalysed(AnalysisContext context) { + // 解析完成后的处理 + } + }; + + // 读取Excel文件 + EasyExcel.read(file.getInputStream(), listener).sheet().doRead(); + + return resultList; + + } catch (Exception e) { + log.error("读取Excel文件失败:", e); + throw new RuntimeException("读取Excel文件失败:" + e.getMessage(), e); + } + } + +} diff --git a/marketing-module-worker/src/main/java/com/platform/marketing/module/worker/facade/TaskControlFacadeImpl.java b/marketing-module-worker/src/main/java/com/platform/marketing/module/worker/facade/TaskControlFacadeImpl.java new file mode 100644 index 0000000..17c66df --- /dev/null +++ b/marketing-module-worker/src/main/java/com/platform/marketing/module/worker/facade/TaskControlFacadeImpl.java @@ -0,0 +1,280 @@ +package com.platform.marketing.module.worker.facade; + +import com.platform.marketing.client.sdk.util.CountryCallingCodes; +import com.platform.marketing.framework.common.util.json.JsonUtils; +import com.platform.marketing.framework.idgenerator.core.service.IdGeneratorService; +import com.platform.marketing.module.record.domain.dataobject.SmsTaskContentDO; +import com.platform.marketing.module.record.domain.dataobject.SmsTaskDO; +import com.platform.marketing.module.record.domain.dto.SendToMQParamDTO; +import com.platform.marketing.module.record.domain.enums.SendStatusEnum; +import com.platform.marketing.module.record.domain.enums.SmsTypeTopicEnum; +import com.platform.marketing.module.record.domain.enums.TaskStatusEnum; +import com.platform.marketing.module.record.domain.vo.RecordSaveReqVO; +import com.platform.marketing.module.record.facade.MQSenderFacade; +import com.platform.marketing.module.record.facade.TaskControlFacade; +import com.platform.marketing.module.record.mapper.SmsTaskContentMapper; +import com.platform.marketing.module.record.mapper.SmsTaskMapper; +import com.platform.marketing.module.record.service.SmsRecordService; +import com.platform.marketing.module.smschannel.adapter.core.support.SmsTemplateUtil; +import com.platform.marketing.module.smschannel.domain.dataobject.SmsTemplateInfoDO; +import com.platform.marketing.module.smschannel.service.SmsTemplateInfoService; +import com.platform.marketing.module.worker.domain.enums.WorkerConstants; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.tuple.Pair; +import org.redisson.api.RBucket; +import org.redisson.api.RList; +import org.redisson.api.RedissonClient; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.time.Duration; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +@Component +@Slf4j +public class TaskControlFacadeImpl implements TaskControlFacade { + + @Resource + private RedissonClient redissonClient; + + @Resource + private SmsTaskMapper smsTaskMapper; + + @Resource + private SmsTaskContentMapper smsTaskContentMapper; + + @Resource + private SmsTemplateInfoService smsTemplateInfoService; + + @Resource + private SmsRecordService smsRecordService; + + @Resource + private IdGeneratorService idGeneratorService; + + @Resource + private MQSenderFacade mqSenderFacade; + + @Override + public void pauseTask(Long taskId) { + // 设置 Redis 暂停标记,TTL 7 天 + RBucket pausedFlag = redissonClient.getBucket(WorkerConstants.SMS_TASK_PAUSED_KEY_PREFIX + taskId); + pausedFlag.set("1", Duration.ofDays(7)); + log.info("任务{}已设置暂停标记", taskId); + } + + @Override + public void resumeTask(Long taskId) { + SmsTaskDO smsTaskDO = smsTaskMapper.selectById(taskId); + if (smsTaskDO == null) { + log.warn("恢复任务{}不存在", taskId); + return; + } + + // 1. 删除暂停标记 + redissonClient.getBucket(WorkerConstants.SMS_TASK_PAUSED_KEY_PREFIX + taskId).delete(); + + // 2. 将停泊列表中的消息重新入队,并记录已入队的 key 防止重复 + Set reEnqueuedKeys = new HashSet<>(); + RList parkedList = redissonClient.getList(WorkerConstants.SMS_TASK_PARKED_KEY_PREFIX + taskId); + if (parkedList.isExists()) { + int parkCount = parkedList.size(); + for (int i = 0; i < parkCount; i++) { + String taskItemKey = parkedList.get(i); + if (taskItemKey == null) continue; + + RBucket bucket = redissonClient.getBucket(WorkerConstants.SMS_BUCKET_TASK_ITEM_KEY_PREFIX + taskItemKey); + String json = bucket.get(); + if (StringUtils.isNotBlank(json)) { + SendToMQParamDTO dto = JsonUtils.parseObject(json, SendToMQParamDTO.class); + if (dto != null) { + SmsTypeTopicEnum topicEnum = SmsTypeTopicEnum.getByTypeCode(dto.getRecordType()); + if (topicEnum != null) { + redissonClient.getBlockingQueue(topicEnum.getTopic()).offer(taskItemKey); + reEnqueuedKeys.add(taskItemKey); + log.info("恢复任务{} 停泊消息重新入队:{}", taskId, taskItemKey); + } + } + } + } + parkedList.delete(); + } + + // 3. 检查是否有未加载到 MQ 的手机号,补充加载(跳过已从停泊列表重新入队的) + loadRemainingContentToMQ(smsTaskDO, reEnqueuedKeys); + + // 4. 更新任务状态为 SENDING + smsTaskMapper.updateTaskStatusConditionally(taskId, TaskStatusEnum.SENDING.getCode(), TaskStatusEnum.PAUSED.getCode()); + log.info("任务{}已恢复发送", taskId); + } + + @Override + public int terminateTask(Long taskId) { + SmsTaskDO smsTaskDO = smsTaskMapper.selectById(taskId); + if (smsTaskDO == null) { + log.warn("终止任务{}不存在", taskId); + return 0; + } + + int terminatedCount = 0; + + // 1. 遍历所有手机号,对未消费的创建终止记录 + SmsTaskContentDO taskContentDO = smsTaskContentMapper.selectById(taskId); + if (taskContentDO != null && StringUtils.isNotBlank(taskContentDO.getTaskContent())) { + SmsTemplateInfoDO templateInfo = smsTemplateInfoService.getTemplateInfo(smsTaskDO.getTemplateId()); + String[] phoneItems = taskContentDO.getTaskContent().split(","); + + for (String phoneItem : phoneItems) { + String mobile = StringUtils.EMPTY; + String templateParam = StringUtils.EMPTY; + + String[] itemSplit = phoneItem.split("\\^"); + if (itemSplit.length == 1) { + mobile = itemSplit[0]; + templateParam = smsTaskDO.getTemplateParam(); + } else { + mobile = itemSplit[0]; + String[] placeholders = SmsTemplateUtil.extractPlaceholders(templateInfo.getContent()); + Map templateParamMap = new HashMap<>(); + for (int i = 0; i < placeholders.length; i++) { + templateParamMap.put(placeholders[i], itemSplit[i + 1]); + } + templateParam = JsonUtils.toJsonString(templateParamMap); + } + + Pair pair = CountryCallingCodes.detectCountryCode(mobile); + String nationcode = pair.getLeft(); + String phone = pair.getRight(); + + String taskItemKey = WorkerConstants.generateSmsTaskItemKey(String.valueOf(taskId), nationcode, phone); + + // 检查是否已被消费 + RBucket consumeResult = redissonClient.getBucket(WorkerConstants.SMS_BUCKET_TASK_CONSUME_RESULT_KEY_PREFIX + taskItemKey); + if (consumeResult.isExists()) { + continue; // 已消费,跳过 + } + + // 设置消费结果标记,防止消费者重复处理 + consumeResult.set(String.valueOf(SendStatusEnum.TERMINATED.getSendStatus()), Duration.ofDays(2)); + + // 删除 RBucket 中的任务数据 + redissonClient.getBucket(WorkerConstants.SMS_BUCKET_TASK_ITEM_KEY_PREFIX + taskItemKey).delete(); + + // 创建终止记录 + Long recordId = idGeneratorService.createUniqueId(String.valueOf(smsTaskDO.getAppId())); + RecordSaveReqVO recordSaveReqVO = new RecordSaveReqVO(); + recordSaveReqVO.setId(recordId); + recordSaveReqVO.setMobile(phone); + recordSaveReqVO.setTaskId(taskId); + recordSaveReqVO.setRecordType(templateInfo.getTemplateType()); + recordSaveReqVO.setAttime(smsTaskDO.getAttime()); + recordSaveReqVO.setSendStatus(SendStatusEnum.TERMINATED.getSendStatus()); + recordSaveReqVO.setNationcode(nationcode); + recordSaveReqVO.setInternational(templateInfo.getInternational()); + recordSaveReqVO.setTemplateId(smsTaskDO.getTemplateId()); + recordSaveReqVO.setTemplateParam(templateParam); + recordSaveReqVO.setAppId(String.valueOf(smsTaskDO.getAppId())); + + String content = SmsTemplateUtil.renderContentWithSignName(templateParam, templateInfo.getContent(), templateInfo.getSignName()); + recordSaveReqVO.setContent(content); + smsRecordService.createRecord(recordSaveReqVO); + + terminatedCount++; + } + } + + // 2. 清理 Redis 数据 + redissonClient.getBucket(WorkerConstants.SMS_TASK_PAUSED_KEY_PREFIX + taskId).delete(); + redissonClient.getList(WorkerConstants.SMS_TASK_PARKED_KEY_PREFIX + taskId).delete(); + + // 3. 更新 DB: failCount += terminatedCount, taskStatus = TERMINATED(5) + if (terminatedCount > 0) { + smsTaskMapper.updateTerminateTask(taskId, terminatedCount); + } else { + // 如果没有未发送的记录,直接更新状态 + smsTaskMapper.updateTaskStatusConditionally(taskId, TaskStatusEnum.TERMINATED.getCode(), TaskStatusEnum.PAUSED.getCode()); + } + + log.info("任务{}已终止,终止记录数:{}", taskId, terminatedCount); + return terminatedCount; + } + + /** + * 加载未入队的手机号到 MQ(用于恢复时补充加载) + * @param smsTaskDO 任务信息 + * @param reEnqueuedKeys 已从停泊列表重新入队的 key 集合,跳过避免重复 + */ + private void loadRemainingContentToMQ(SmsTaskDO smsTaskDO, Set reEnqueuedKeys) { + Long taskId = smsTaskDO.getId(); + SmsTaskContentDO taskContentDO = smsTaskContentMapper.selectById(taskId); + if (taskContentDO == null || StringUtils.isBlank(taskContentDO.getTaskContent())) { + return; + } + + SmsTemplateInfoDO templateInfo = smsTemplateInfoService.getTemplateInfo(smsTaskDO.getTemplateId()); + String templateInfoContent = templateInfo.getContent(); + String[] phoneItems = taskContentDO.getTaskContent().split(","); + + int loadedCount = 0; + for (String phoneItem : phoneItems) { + String mobile = StringUtils.EMPTY; + String templateParam = StringUtils.EMPTY; + + String[] itemSplit = phoneItem.split("\\^"); + if (itemSplit.length == 1) { + mobile = itemSplit[0]; + templateParam = smsTaskDO.getTemplateParam(); + } else { + mobile = itemSplit[0]; + String[] placeholders = SmsTemplateUtil.extractPlaceholders(templateInfoContent); + Map templateParamMap = new HashMap<>(); + for (int i = 0; i < placeholders.length; i++) { + templateParamMap.put(placeholders[i], itemSplit[i + 1]); + } + templateParam = JsonUtils.toJsonString(templateParamMap); + } + + Pair pair = CountryCallingCodes.detectCountryCode(mobile); + String taskItemKey = WorkerConstants.generateSmsTaskItemKey(String.valueOf(taskId), pair.getLeft(), pair.getRight()); + + // 跳过已从停泊列表重新入队的 key,避免重复入队 + if (reEnqueuedKeys.contains(taskItemKey)) { + continue; + } + + // 检查 RBucket 是否已存在(已加载过) + RBucket bucket = redissonClient.getBucket(WorkerConstants.SMS_BUCKET_TASK_ITEM_KEY_PREFIX + taskItemKey); + if (bucket.isExists()) { + continue; // 已加载,跳过 + } + + // 检查是否已被消费 + RBucket consumeResult = redissonClient.getBucket(WorkerConstants.SMS_BUCKET_TASK_CONSUME_RESULT_KEY_PREFIX + taskItemKey); + if (consumeResult.isExists()) { + continue; // 已消费,跳过 + } + + // 构建 DTO 并发送到 MQ + SendToMQParamDTO sendToMQParamDTO = new SendToMQParamDTO(); + sendToMQParamDTO.setTaskId(String.valueOf(taskId)); + sendToMQParamDTO.setNationcode(pair.getLeft()); + sendToMQParamDTO.setMobile(pair.getRight()); + sendToMQParamDTO.setAppId(String.valueOf(smsTaskDO.getAppId())); + sendToMQParamDTO.setTemplateId(smsTaskDO.getTemplateId()); + sendToMQParamDTO.setTemplateParam(templateParam); + sendToMQParamDTO.setAttime(smsTaskDO.getAttime()); + sendToMQParamDTO.setSenderIp(smsTaskDO.getSenderIp()); + sendToMQParamDTO.setRecordType(templateInfo.getTemplateType()); + mqSenderFacade.sendSingleShortMessageToMQ(sendToMQParamDTO); + loadedCount++; + } + + if (loadedCount > 0) { + log.info("恢复任务{} 补充加载{}条未入队手机号", taskId, loadedCount); + } + } +} diff --git a/marketing-module-worker/src/main/java/com/platform/marketing/module/worker/job/LoadDelayShortMessageToMQJob.java b/marketing-module-worker/src/main/java/com/platform/marketing/module/worker/job/LoadDelayShortMessageToMQJob.java new file mode 100644 index 0000000..96ef625 --- /dev/null +++ b/marketing-module-worker/src/main/java/com/platform/marketing/module/worker/job/LoadDelayShortMessageToMQJob.java @@ -0,0 +1,157 @@ +package com.platform.marketing.module.worker.job; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.date.LocalDateTimeUtil; +import com.platform.marketing.client.sdk.util.CountryCallingCodes; +import com.platform.marketing.framework.common.pojo.PageResult; +import com.platform.marketing.framework.common.util.date.DateUtils; +import com.platform.marketing.framework.common.util.json.JsonUtils; +import com.platform.marketing.framework.quartz.core.handler.JobHandler; +import com.platform.marketing.module.record.domain.dataobject.SmsTaskContentDO; +import com.platform.marketing.module.record.domain.dataobject.SmsTaskDO; +import com.platform.marketing.module.record.domain.dto.SendToMQParamDTO; +import com.platform.marketing.module.record.domain.enums.SendStatusEnum; +import com.platform.marketing.module.record.domain.enums.TaskStatusEnum; +import com.platform.marketing.module.record.domain.vo.SmsTaskPageReqVO; +import com.platform.marketing.module.record.facade.LoadTaskToMQFacade; +import com.platform.marketing.module.record.facade.MQSenderFacade; +import com.platform.marketing.module.record.facade.SendShortMessageFacade; +import com.platform.marketing.module.record.mapper.SmsTaskContentMapper; +import com.platform.marketing.module.record.service.SmsTaskService; +import com.platform.marketing.module.record.util.UtilsAll; +import com.platform.marketing.module.smschannel.adapter.core.support.SmsTemplateUtil; +import com.platform.marketing.module.smschannel.domain.dataobject.SmsTemplateInfoDO; +import com.platform.marketing.module.smschannel.service.SmsTemplateInfoService; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.time.DateFormatUtils; +import org.apache.commons.lang3.tuple.Pair; +import org.redisson.api.RedissonClient; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.time.LocalDateTime; +import java.time.ZoneOffset; +import java.util.*; + +/** + * 任务 每半个小时执行一次 将 task 的内容加载到 MQ + *

+ * // 发送端:两个自然小时的延迟短信,直接将数据添加到 Redis 的延迟队列 zset 容器 + * // 定时任务端:会加载当前小时的延迟短信,添加到 zset 中 List recordList = smsRecordDAO.queryWaitingSendSmsList(String.valueOf(currentHourFirstTimeStamp), String.valueOf(currentHourLastTimeStamp), startId); + * Long nextHourLastSecondTimestamp = UtilsAll.getNextHourLastSecondTimestamp(); + */ +@Slf4j +@Component(value = "loadDelayShortMessageToMQJob") +public class LoadDelayShortMessageToMQJob implements JobHandler { + + private static final int BATCH_SIZE = 500; + + @Resource + private SmsTaskService smsTaskService; + + @Resource + private SmsTaskContentMapper smsTaskContentMapper; + + @Resource + private MQSenderFacade mqSenderFacade; + + @Resource + private RedisTemplate redisTemplate; + + @Resource + private SmsTemplateInfoService smsTemplateInfoService; + + @Resource + private LoadTaskToMQFacade loadTaskToMQFacade; + + @Resource + private RedissonClient redissonClient; + + @Override + public String execute(String param) throws Exception { + long startTime = System.currentTimeMillis(); + log.info("开始加载延迟短信任务"); + // 获取当前小时的起始和结束时间戳 + try { + doLoadDelayMsgToMQJob(); + } catch (Exception e) { + log.error("加载延迟短信任务异常:", e); + } + log.info("结束加载延迟短信任务,耗时:{}ms", System.currentTimeMillis() - startTime); + return "success"; + } + + private void doLoadDelayMsgToMQJob() { + long[] timeRange = getCurrentHourFirstAndLastTimestamp(); + Long currentHourFirstTimeStamp = timeRange[0]; + Long nextHourLastSecondTimestamp = UtilsAll.getNextHourLastSecondTimestamp(); + + String currentHour = LocalDateTimeUtil.format(LocalDateTime.ofInstant(new Date(currentHourFirstTimeStamp).toInstant(), ZoneOffset.systemDefault()), "yyyyMMddHH"); + + log.info("startTime: {} endTime:{}", + LocalDateTimeUtil.format(LocalDateTime.ofInstant(new Date(currentHourFirstTimeStamp).toInstant(), ZoneOffset.systemDefault()), "yyyy-MM-dd HH:mm:ss"), + LocalDateTimeUtil.format(LocalDateTime.ofInstant(new Date(nextHourLastSecondTimestamp).toInstant(), ZoneOffset.systemDefault()), "yyyy-MM-dd HH:mm:ss")); + + // 分页查询当前小时的任务 + int pageNo = 1; + int totalCount = 0; + + while (true) { + SmsTaskPageReqVO pageReqVO = new SmsTaskPageReqVO(); + pageReqVO.setPageNo(pageNo); + pageReqVO.setPageSize(BATCH_SIZE); + // 设置时间范围查询条件 + pageReqVO.setAttime(new String[]{ + LocalDateTimeUtil.format(LocalDateTime.ofInstant(new Date(currentHourFirstTimeStamp).toInstant(), ZoneOffset.systemDefault()), DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND), + LocalDateTimeUtil.format(LocalDateTime.ofInstant(new Date(nextHourLastSecondTimestamp).toInstant(), ZoneOffset.systemDefault()), DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + }); + // 查询待发送到 MQ 的任务 + pageReqVO.setTaskStatus(TaskStatusEnum.PENDING.getCode()); + + PageResult pageResult = smsTaskService.getSmsTaskPage(pageReqVO); + List smsTaskList = pageResult.getList(); + + if (CollUtil.isNotEmpty(smsTaskList)) { + for (SmsTaskDO smsTask : smsTaskList) { + try { + String attime = smsTask.getAttime(); + if (StringUtils.isNotEmpty(attime) && Long.parseLong(attime) > nextHourLastSecondTimestamp) { + log.info("任务{}未到下个小时以内 {},请稍后重试", smsTask.getId(), DateFormatUtils.format(nextHourLastSecondTimestamp, "yyyy-MM-dd HH:mm:ss")); + continue; + } + loadTaskToMQFacade.loadTaskContentToMQ(smsTask.getId(), false); + } catch (Exception e) { + log.error("处理任务ID:{}失败", smsTask.getId(), e); + } + } + } + + if (pageResult.getList().size() < BATCH_SIZE) { + break; + } + + pageNo++; + } + log.info("currentHour:{}, 处理数据条数:{}", currentHour, totalCount); + } + + /** + * 获取当前小时的开始和结束时间戳 + */ + private long[] getCurrentHourFirstAndLastTimestamp() { + Calendar calendar = Calendar.getInstance(); + calendar.set(Calendar.MINUTE, 0); + calendar.set(Calendar.SECOND, 0); + calendar.set(Calendar.MILLISECOND, 0); + long firstSecond = calendar.getTimeInMillis(); + + calendar.add(Calendar.HOUR_OF_DAY, 1); + calendar.add(Calendar.MILLISECOND, -1); + long lastSecond = calendar.getTimeInMillis(); + + return new long[]{firstSecond, lastSecond}; + } + +} \ No newline at end of file diff --git a/marketing-module-worker/src/main/java/com/platform/marketing/module/worker/job/SingleShortMessageTaskConsumer.java b/marketing-module-worker/src/main/java/com/platform/marketing/module/worker/job/SingleShortMessageTaskConsumer.java new file mode 100644 index 0000000..cd98492 --- /dev/null +++ b/marketing-module-worker/src/main/java/com/platform/marketing/module/worker/job/SingleShortMessageTaskConsumer.java @@ -0,0 +1,243 @@ +package com.platform.marketing.module.worker.job; + +import com.platform.marketing.framework.common.util.json.JsonUtils; +import com.platform.marketing.framework.common.util.thread.PlatformServiceThread; +import com.platform.marketing.framework.common.util.thread.ThreadFactoryImpl; +import com.platform.marketing.module.record.domain.dto.SendToMQParamDTO; +import com.platform.marketing.module.record.domain.enums.SmsTypeTopicEnum; +import com.platform.marketing.module.record.facade.ConsumeShortMessageFacade; +import com.platform.marketing.module.worker.domain.enums.WorkerConstants; +import lombok.extern.slf4j.Slf4j; +import org.redisson.api.RBlockingQueue; +import org.redisson.api.RBucket; +import org.redisson.api.RList; +import org.redisson.api.RedissonClient; +import org.springframework.stereotype.Component; + +import javax.annotation.PostConstruct; +import javax.annotation.PreDestroy; +import javax.annotation.Resource; +import java.util.concurrent.*; + +@Component +@Slf4j +public class SingleShortMessageTaskConsumer { + + @Resource + private RedissonClient redissonClient; + + @Resource + private ConsumeShortMessageFacade consumeShortMessageFacade; + + private PlatformServiceThread verificationCodeWorker; + + // 验证码短信线程池 + private ThreadPoolExecutor verificationCodeThreadPoolExecutor; + + private PlatformServiceThread notificationWorker; + + // 通知短信线程池 + private ThreadPoolExecutor notificationThreadPoolExecutor; + + private PlatformServiceThread marketingWorker; + + // 营销短信线程池 + private ThreadPoolExecutor marketingThreadPoolExecutor; + + @PostConstruct + public void init() { + this.verificationCodeThreadPoolExecutor = new ThreadPoolExecutor( + 15, + 15, + 1000 * 60, + TimeUnit.MILLISECONDS, + new LinkedBlockingQueue<>(500), + new ThreadFactoryImpl("verificationCodeThreadPoolExecutor"), + new ThreadPoolExecutor.CallerRunsPolicy() + ); + + this.verificationCodeWorker = new PlatformServiceThread() { + @Override + public String getServiceName() { + return "verificationCodeWorker"; + } + + @Override + public void run() { + while (!this.isStopped()) { + try { + RBlockingQueue blockingQueue = redissonClient.getBlockingQueue(SmsTypeTopicEnum.VERIFICATION_CODE_TOPIC.getTopic()); + String taskItemKey = blockingQueue.take(); + RBucket bucket = redissonClient.getBucket(WorkerConstants.SMS_BUCKET_TASK_ITEM_KEY_PREFIX + taskItemKey); + String json = bucket.get(); + SendToMQParamDTO sendToMQParamDTO = JsonUtils.parseObject(json, SendToMQParamDTO.class); + if (sendToMQParamDTO != null) { + // 暂停检测 + RBucket pausedFlag = redissonClient.getBucket(WorkerConstants.SMS_TASK_PAUSED_KEY_PREFIX + sendToMQParamDTO.getTaskId()); + if (pausedFlag.isExists()) { + RList parkedList = redissonClient.getList(WorkerConstants.SMS_TASK_PARKED_KEY_PREFIX + sendToMQParamDTO.getTaskId()); + parkedList.add(taskItemKey); + log.info("任务{}已暂停,停泊验证码消息:{}", sendToMQParamDTO.getTaskId(), taskItemKey); + continue; + } + verificationCodeThreadPoolExecutor.submit(new Runnable() { + @Override + public void run() { + try { + consumeShortMessageFacade.consumeSingleShortMessage(sendToMQParamDTO); + } catch (Throwable e) { + log.error("单条验证码短信任务消费者异常:", e); + } + } + }); + } + } catch (Exception e) { + log.error("单条验证码短信任务消费者异常:", e); + waitForRunning(1000L); + } + } + } + }; + + this.verificationCodeWorker.start(); + + // 通知类短信线程池 + this.notificationThreadPoolExecutor = new ThreadPoolExecutor( + 5, + 5, + 1000 * 60, + TimeUnit.MILLISECONDS, + new LinkedBlockingQueue<>(500), + new ThreadFactoryImpl("notificationThreadPoolExecutor"), + new ThreadPoolExecutor.CallerRunsPolicy() + ); + + this.notificationWorker = new PlatformServiceThread() { + @Override + public String getServiceName() { + return "notificationWorker"; + } + + @Override + public void run() { + while (!this.isStopped()) { + try { + RBlockingQueue blockingQueue = redissonClient.getBlockingQueue(SmsTypeTopicEnum.NOTIFICATION_TOPIC.getTopic()); + String taskItemKey = blockingQueue.take(); + RBucket bucket = redissonClient.getBucket(WorkerConstants.SMS_BUCKET_TASK_ITEM_KEY_PREFIX + taskItemKey); + String json = bucket.get(); + SendToMQParamDTO sendToMQParamDTO = JsonUtils.parseObject(json, SendToMQParamDTO.class); + if (sendToMQParamDTO != null) { + // 暂停检测 + RBucket pausedFlag = redissonClient.getBucket(WorkerConstants.SMS_TASK_PAUSED_KEY_PREFIX + sendToMQParamDTO.getTaskId()); + if (pausedFlag.isExists()) { + RList parkedList = redissonClient.getList(WorkerConstants.SMS_TASK_PARKED_KEY_PREFIX + sendToMQParamDTO.getTaskId()); + parkedList.add(taskItemKey); + log.info("任务{}已暂停,停泊通知消息:{}", sendToMQParamDTO.getTaskId(), taskItemKey); + continue; + } + notificationThreadPoolExecutor.submit(new Runnable() { + @Override + public void run() { + try { + consumeShortMessageFacade.consumeSingleShortMessage(sendToMQParamDTO); + } catch (Throwable e) { + log.error("单条通知短信任务消费者异常:", e); + } + } + }); + } + } catch (Exception e) { + log.error("单条通知短信任务消费者异常:", e); + waitForRunning(1000L); + } + } + } + }; + + this.notificationWorker.start(); + + this.marketingThreadPoolExecutor = new ThreadPoolExecutor( + 1, + 2, + 1000 * 60, + TimeUnit.MILLISECONDS, + new LinkedBlockingQueue<>(500), + new ThreadFactoryImpl("marketingThreadPoolExecutor"), + new ThreadPoolExecutor.CallerRunsPolicy() + ); + + this.marketingWorker = new PlatformServiceThread() { + @Override + public String getServiceName() { + return "marketingWorker"; + } + + @Override + public void run() { + while (!this.isStopped()) { + try { + RBlockingQueue blockingQueue = redissonClient.getBlockingQueue(SmsTypeTopicEnum.MARKETING_TOPIC.getTopic()); + String taskItemKey = blockingQueue.take(); + RBucket bucket = redissonClient.getBucket(WorkerConstants.SMS_BUCKET_TASK_ITEM_KEY_PREFIX + taskItemKey); + String json = bucket.get(); + SendToMQParamDTO sendToMQParamDTO = JsonUtils.parseObject(json, SendToMQParamDTO.class); + if (sendToMQParamDTO != null) { + // 暂停检测 + RBucket pausedFlag = redissonClient.getBucket(WorkerConstants.SMS_TASK_PAUSED_KEY_PREFIX + sendToMQParamDTO.getTaskId()); + if (pausedFlag.isExists()) { + RList parkedList = redissonClient.getList(WorkerConstants.SMS_TASK_PARKED_KEY_PREFIX + sendToMQParamDTO.getTaskId()); + parkedList.add(taskItemKey); + log.info("任务{}已暂停,停泊营销消息:{}", sendToMQParamDTO.getTaskId(), taskItemKey); + continue; + } + marketingThreadPoolExecutor.submit(new Runnable() { + @Override + public void run() { + try { + consumeShortMessageFacade.consumeSingleShortMessage(sendToMQParamDTO); + } catch (Throwable e) { + log.error("营销通知短信任务消费者异常:", e); + } + } + }); + } + } catch (Exception e) { + log.error("单条营销短信任务消费者异常:", e); + waitForRunning(1000L); + } + } + } + }; + this.marketingWorker.start(); + + log.info("结束初始化单条短信任务消费者"); + } + + @PreDestroy + public void destroy() { + log.info("开始销毁单条短信任务消费者"); + if (this.verificationCodeWorker != null) { + this.verificationCodeWorker.shutdown(); + } + if (this.verificationCodeThreadPoolExecutor != null) { + this.verificationCodeThreadPoolExecutor.shutdown(); + } + if (this.notificationWorker != null) { + this.notificationWorker.shutdown(); + } + if (this.notificationThreadPoolExecutor != null) { + this.notificationThreadPoolExecutor.shutdown(); + } + if (this.marketingWorker != null) { + this.marketingWorker.shutdown(); + } + + if (this.marketingThreadPoolExecutor != null) { + this.marketingThreadPoolExecutor.shutdown(); + } + + log.info("结束销毁单条短信任务消费者"); + } + +} \ No newline at end of file diff --git a/marketing-ui/README.md b/marketing-ui/README.md new file mode 100644 index 0000000..4140a5f --- /dev/null +++ b/marketing-ui/README.md @@ -0,0 +1,3 @@ +基于 Vue3 + element-plus 实现的管理后台。仓库地址: + +* GitHub: diff --git a/marketing-ui/admin-ui/.editorconfig b/marketing-ui/admin-ui/.editorconfig new file mode 100644 index 0000000..79a12ff --- /dev/null +++ b/marketing-ui/admin-ui/.editorconfig @@ -0,0 +1,12 @@ +root = true +[*.{js,ts,vue}] +charset = utf-8 # 设置文件字符集为 utf-8 +end_of_line = lf # 控制换行类型(lf | cr | crlf) +insert_final_newline = true # 始终在文件末尾插入一个新行 +indent_style = space # 缩进风格(tab | space) +indent_size = 2 # 缩进大小 +max_line_length = 100 # 最大行长度 + +[*.md] # 仅 md 文件适用以下规则 +max_line_length = off # 关闭最大行长度限制 +trim_trailing_whitespace = false # 关闭末尾空格修剪 diff --git a/marketing-ui/admin-ui/.env b/marketing-ui/admin-ui/.env new file mode 100644 index 0000000..99d89dc --- /dev/null +++ b/marketing-ui/admin-ui/.env @@ -0,0 +1,25 @@ +# 标题 +VITE_APP_TITLE=营销平台 + +# 项目本地运行端口号 +VITE_PORT=80 + +# open 运行 npm run dev 时自动打开浏览器 +VITE_OPEN=true + +# 租户开关 +VITE_APP_TENANT_ENABLE=false + +# 验证码的开关 +VITE_APP_CAPTCHA_ENABLE=true + +# 文档地址的开关 +VITE_APP_DOCALERT_ENABLE=true + +# 百度统计 +VITE_APP_BAIDU_CODE = + +# 默认账户密码 +VITE_APP_DEFAULT_LOGIN_TENANT = 系统登录 +VITE_APP_DEFAULT_LOGIN_USERNAME = admin +VITE_APP_DEFAULT_LOGIN_PASSWORD = diff --git a/marketing-ui/admin-ui/.env.dev b/marketing-ui/admin-ui/.env.dev new file mode 100644 index 0000000..74de8d2 --- /dev/null +++ b/marketing-ui/admin-ui/.env.dev @@ -0,0 +1,34 @@ +# 开发环境:本地只启动前端项目,依赖开发环境(后端、APP) +NODE_ENV=production + +VITE_DEV=true + +# 请求路径 +VITE_BASE_URL='http://api-dashboard.yudao.iocoder.cn' + +# 文件上传类型:server - 后端上传, client - 前端直连上传,仅支持S3服务 +VITE_UPLOAD_TYPE=server + +# 接口地址 +VITE_API_URL=/api + +# 是否删除debugger +VITE_DROP_DEBUGGER=false + +# 是否删除console.log +VITE_DROP_CONSOLE=false + +# 是否sourcemap +VITE_SOURCEMAP=true + +# 打包路径 +VITE_BASE_PATH=/ + +# 输出路径 +VITE_OUT_DIR=dist + +# 验证码的开关 +VITE_APP_CAPTCHA_ENABLE=false + +# 租户开关 +VITE_APP_TENANT_ENABLE=false \ No newline at end of file diff --git a/marketing-ui/admin-ui/.env.local b/marketing-ui/admin-ui/.env.local new file mode 100644 index 0000000..783634e --- /dev/null +++ b/marketing-ui/admin-ui/.env.local @@ -0,0 +1,31 @@ +# 本地开发环境:本地启动所有项目(前端、后端、APP)时使用,不依赖外部环境 +NODE_ENV=development + +VITE_DEV=true + +# 请求路径 +VITE_BASE_URL='http://localhost:8089' + +# 文件上传类型:server - 后端上传, client - 前端直连上传,仅支持 S3 服务 +VITE_UPLOAD_TYPE=server + +# 接口地址 +VITE_API_URL=/api + +# 是否删除debugger +VITE_DROP_DEBUGGER=false + +# 是否删除console.log +VITE_DROP_CONSOLE=false + +# 是否sourcemap +VITE_SOURCEMAP=false + +# 打包路径 +VITE_BASE_PATH=/ + +# 验证码的开关 +VITE_APP_CAPTCHA_ENABLE=false + +# 租户开关 +VITE_APP_TENANT_ENABLE=false \ No newline at end of file diff --git a/marketing-ui/admin-ui/.env.prod b/marketing-ui/admin-ui/.env.prod new file mode 100644 index 0000000..f041a1d --- /dev/null +++ b/marketing-ui/admin-ui/.env.prod @@ -0,0 +1,34 @@ +# 生产环境:只在打包时使用 +NODE_ENV=production + +VITE_DEV=false + +# 请求路径 +VITE_BASE_URL='' + +# 文件上传类型:server - 后端上传, client - 前端直连上传,仅支持S3服务 +VITE_UPLOAD_TYPE=server + +# 接口地址 +VITE_API_URL=/api + +# 是否删除debugger +VITE_DROP_DEBUGGER=true + +# 是否删除console.log +VITE_DROP_CONSOLE=true + +# 是否sourcemap +VITE_SOURCEMAP=false + +# 打包路径 +VITE_BASE_PATH=/ + +# 输出路径 +VITE_OUT_DIR=dist-prod + +# 默认账户密码 +VITE_APP_TENANT_ENABLE=false +VITE_APP_DEFAULT_LOGIN_TENANT = 短信营销系统 +VITE_APP_DEFAULT_LOGIN_USERNAME = +VITE_APP_DEFAULT_LOGIN_PASSWORD = \ No newline at end of file diff --git a/marketing-ui/admin-ui/.env.stage b/marketing-ui/admin-ui/.env.stage new file mode 100644 index 0000000..805a0f2 --- /dev/null +++ b/marketing-ui/admin-ui/.env.stage @@ -0,0 +1,34 @@ +# 预发布环境:只在打包时使用 +NODE_ENV=production + +VITE_DEV=false + +# 请求路径 +VITE_BASE_URL='http://api-dashboard.yudao.iocoder.cn' + +# 文件上传类型:server - 后端上传, client - 前端直连上传,仅支持S3服务 +VITE_UPLOAD_TYPE=server + +# 接口地址 +VITE_API_URL=/api + +# 是否删除debugger +VITE_DROP_DEBUGGER=true + +# 是否删除console.log +VITE_DROP_CONSOLE=true + +# 是否sourcemap +VITE_SOURCEMAP=false + +# 打包路径 +VITE_BASE_PATH='http://static-vue3.yudao.iocoder.cn/' + +# 输出路径 +VITE_OUT_DIR=dist-stage + +# 商城H5会员端域名 +VITE_MALL_H5_DOMAIN='http://mall.yudao.iocoder.cn' + +# GoView域名 +VITE_GOVIEW_URL='http://127.0.0.1:3000' \ No newline at end of file diff --git a/marketing-ui/admin-ui/.env.test b/marketing-ui/admin-ui/.env.test new file mode 100644 index 0000000..da4d476 --- /dev/null +++ b/marketing-ui/admin-ui/.env.test @@ -0,0 +1,34 @@ +# 测试环境:只在打包时使用 +NODE_ENV=production + +VITE_DEV=false + +# 请求路径 +VITE_BASE_URL='http://localhost:48080' + +# 文件上传类型:server - 后端上传, client - 前端直连上传,仅支持S3服务 +VITE_UPLOAD_TYPE=server + +# 接口地址 +VITE_API_URL=/api + +# 是否删除debugger +VITE_DROP_DEBUGGER=true + +# 是否删除console.log +VITE_DROP_CONSOLE=true + +# 是否sourcemap +VITE_SOURCEMAP=false + +# 打包路径 +VITE_BASE_PATH=/admin-ui-vue3/ + +# 输出路径 +VITE_OUT_DIR=dist-test + +# 商城H5会员端域名 +VITE_MALL_H5_DOMAIN='http://mall.yudao.iocoder.cn' + +# GoView域名 +VITE_GOVIEW_URL='http://127.0.0.1:3000' \ No newline at end of file diff --git a/marketing-ui/admin-ui/.eslintignore b/marketing-ui/admin-ui/.eslintignore new file mode 100644 index 0000000..1e85c0f --- /dev/null +++ b/marketing-ui/admin-ui/.eslintignore @@ -0,0 +1,8 @@ +/build/ +/config/ +/dist/ +/*.js +/test/unit/coverage/ +/node_modules/* +/dist* +/src/main.ts diff --git a/marketing-ui/admin-ui/.eslintrc-auto-import.json b/marketing-ui/admin-ui/.eslintrc-auto-import.json new file mode 100644 index 0000000..024c96a --- /dev/null +++ b/marketing-ui/admin-ui/.eslintrc-auto-import.json @@ -0,0 +1,259 @@ +{ + "globals": { + "EffectScope": true, + "ElMessage": true, + "ElMessageBox": true, + "ElTag": true, + "asyncComputed": true, + "autoResetRef": true, + "computed": true, + "computedAsync": true, + "computedEager": true, + "computedInject": true, + "computedWithControl": true, + "controlledComputed": true, + "controlledRef": true, + "createApp": true, + "createEventHook": true, + "createGlobalState": true, + "createInjectionState": true, + "createReactiveFn": true, + "createSharedComposable": true, + "createUnrefFn": true, + "customRef": true, + "debouncedRef": true, + "debouncedWatch": true, + "defineAsyncComponent": true, + "defineComponent": true, + "eagerComputed": true, + "effectScope": true, + "extendRef": true, + "getCurrentInstance": true, + "getCurrentScope": true, + "h": true, + "ignorableWatch": true, + "inject": true, + "isDefined": true, + "isProxy": true, + "isReactive": true, + "isReadonly": true, + "isRef": true, + "makeDestructurable": true, + "markRaw": true, + "nextTick": true, + "onActivated": true, + "onBeforeMount": true, + "onBeforeUnmount": true, + "onBeforeUpdate": true, + "onClickOutside": true, + "onDeactivated": true, + "onErrorCaptured": true, + "onKeyStroke": true, + "onLongPress": true, + "onMounted": true, + "onRenderTracked": true, + "onRenderTriggered": true, + "onScopeDispose": true, + "onServerPrefetch": true, + "onStartTyping": true, + "onUnmounted": true, + "onUpdated": true, + "pausableWatch": true, + "provide": true, + "reactify": true, + "reactifyObject": true, + "reactive": true, + "reactiveComputed": true, + "reactiveOmit": true, + "reactivePick": true, + "readonly": true, + "ref": true, + "refAutoReset": true, + "refDebounced": true, + "refDefault": true, + "refThrottled": true, + "refWithControl": true, + "resolveComponent": true, + "resolveRef": true, + "resolveUnref": true, + "shallowReactive": true, + "shallowReadonly": true, + "shallowRef": true, + "syncRef": true, + "syncRefs": true, + "templateRef": true, + "throttledRef": true, + "throttledWatch": true, + "toRaw": true, + "toReactive": true, + "toRef": true, + "toRefs": true, + "triggerRef": true, + "tryOnBeforeMount": true, + "tryOnBeforeUnmount": true, + "tryOnMounted": true, + "tryOnScopeDispose": true, + "tryOnUnmounted": true, + "unref": true, + "unrefElement": true, + "until": true, + "useActiveElement": true, + "useArrayEvery": true, + "useArrayFilter": true, + "useArrayFind": true, + "useArrayFindIndex": true, + "useArrayJoin": true, + "useArrayMap": true, + "useArrayReduce": true, + "useArraySome": true, + "useAsyncQueue": true, + "useAsyncState": true, + "useAttrs": true, + "useBase64": true, + "useBattery": true, + "useBluetooth": true, + "useBreakpoints": true, + "useBroadcastChannel": true, + "useBrowserLocation": true, + "useCached": true, + "useClipboard": true, + "useColorMode": true, + "useConfirmDialog": true, + "useCounter": true, + "useCssModule": true, + "useCssVar": true, + "useCssVars": true, + "useCurrentElement": true, + "useCycleList": true, + "useDark": true, + "useDateFormat": true, + "useDebounce": true, + "useDebounceFn": true, + "useDebouncedRefHistory": true, + "useDeviceMotion": true, + "useDeviceOrientation": true, + "useDevicePixelRatio": true, + "useDevicesList": true, + "useDisplayMedia": true, + "useDocumentVisibility": true, + "useDraggable": true, + "useDropZone": true, + "useElementBounding": true, + "useElementByPoint": true, + "useElementHover": true, + "useElementSize": true, + "useElementVisibility": true, + "useEventBus": true, + "useEventListener": true, + "useEventSource": true, + "useEyeDropper": true, + "useFavicon": true, + "useFetch": true, + "useFileDialog": true, + "useFileSystemAccess": true, + "useFocus": true, + "useFocusWithin": true, + "useFps": true, + "useFullscreen": true, + "useGamepad": true, + "useGeolocation": true, + "useIdle": true, + "useImage": true, + "useInfiniteScroll": true, + "useIntersectionObserver": true, + "useInterval": true, + "useIntervalFn": true, + "useKeyModifier": true, + "useLastChanged": true, + "useLocalStorage": true, + "useMagicKeys": true, + "useManualRefHistory": true, + "useMediaControls": true, + "useMediaQuery": true, + "useMemoize": true, + "useMemory": true, + "useMounted": true, + "useMouse": true, + "useMouseInElement": true, + "useMousePressed": true, + "useMutationObserver": true, + "useNavigatorLanguage": true, + "useNetwork": true, + "useNow": true, + "useObjectUrl": true, + "useOffsetPagination": true, + "useOnline": true, + "usePageLeave": true, + "useParallax": true, + "usePermission": true, + "usePointer": true, + "usePointerSwipe": true, + "usePreferredColorScheme": true, + "usePreferredDark": true, + "usePreferredLanguages": true, + "useRafFn": true, + "useRefHistory": true, + "useResizeObserver": true, + "useRoute": true, + "useRouter": true, + "useScreenOrientation": true, + "useScreenSafeArea": true, + "useScriptTag": true, + "useScroll": true, + "useScrollLock": true, + "useSessionStorage": true, + "useShare": true, + "useSlots": true, + "useSpeechRecognition": true, + "useSpeechSynthesis": true, + "useStepper": true, + "useStorage": true, + "useStorageAsync": true, + "useStyleTag": true, + "useSupported": true, + "useSwipe": true, + "useTemplateRefsList": true, + "useTextDirection": true, + "useTextSelection": true, + "useTextareaAutosize": true, + "useThrottle": true, + "useThrottleFn": true, + "useThrottledRefHistory": true, + "useTimeAgo": true, + "useTimeout": true, + "useTimeoutFn": true, + "useTimeoutPoll": true, + "useTimestamp": true, + "useTitle": true, + "useToggle": true, + "useTransition": true, + "useUrlSearchParams": true, + "useUserMedia": true, + "useVModel": true, + "useVModels": true, + "useVibrate": true, + "useVirtualList": true, + "useWakeLock": true, + "useWebNotification": true, + "useWebSocket": true, + "useWebWorker": true, + "useWebWorkerFn": true, + "useWindowFocus": true, + "useWindowScroll": true, + "useWindowSize": true, + "watch": true, + "watchArray": true, + "watchAtMost": true, + "watchDebounced": true, + "watchEffect": true, + "watchIgnorable": true, + "watchOnce": true, + "watchPausable": true, + "watchPostEffect": true, + "watchSyncEffect": true, + "watchThrottled": true, + "watchTriggerable": true, + "watchWithFilter": true, + "whenever": true + } +} diff --git a/marketing-ui/admin-ui/.eslintrc.js b/marketing-ui/admin-ui/.eslintrc.js new file mode 100644 index 0000000..b28255c --- /dev/null +++ b/marketing-ui/admin-ui/.eslintrc.js @@ -0,0 +1,75 @@ +// @ts-check +const { defineConfig } = require('eslint-define-config') +module.exports = defineConfig({ + root: true, + env: { + browser: true, + node: true, + es6: true + }, + parser: 'vue-eslint-parser', + parserOptions: { + parser: '@typescript-eslint/parser', + ecmaVersion: 2020, + sourceType: 'module', + jsxPragma: 'React', + ecmaFeatures: { + jsx: true + } + }, + extends: [ + 'plugin:vue/vue3-recommended', + 'plugin:@typescript-eslint/recommended', + 'prettier', + 'plugin:prettier/recommended', + '@unocss' + ], + rules: { + 'vue/no-setup-props-destructure': 'off', + 'vue/script-setup-uses-vars': 'error', + 'vue/no-reserved-component-names': 'off', + '@typescript-eslint/ban-ts-ignore': 'off', + '@typescript-eslint/explicit-function-return-type': 'off', + '@typescript-eslint/no-explicit-any': 'off', + '@typescript-eslint/no-var-requires': 'off', + '@typescript-eslint/no-empty-function': 'off', + 'vue/custom-event-name-casing': 'off', + 'no-use-before-define': 'off', + '@typescript-eslint/no-use-before-define': 'off', + '@typescript-eslint/ban-ts-comment': 'off', + '@typescript-eslint/ban-types': 'off', + '@typescript-eslint/no-non-null-assertion': 'off', + '@typescript-eslint/explicit-module-boundary-types': 'off', + '@typescript-eslint/no-unused-vars': 'off', + 'no-unused-vars': 'off', + 'space-before-function-paren': 'off', + + 'vue/attributes-order': 'off', + 'vue/one-component-per-file': 'off', + 'vue/html-closing-bracket-newline': 'off', + 'vue/max-attributes-per-line': 'off', + 'vue/multiline-html-element-content-newline': 'off', + 'vue/singleline-html-element-content-newline': 'off', + 'vue/attribute-hyphenation': 'off', + 'vue/require-default-prop': 'off', + 'vue/require-explicit-emits': 'off', + 'vue/require-toggle-inside-transition': 'off', + 'vue/html-self-closing': [ + 'error', + { + html: { + void: 'always', + normal: 'never', + component: 'always' + }, + svg: 'always', + math: 'always' + } + ], + 'vue/multi-word-component-names': 'off', + 'vue/no-v-html': 'off', + 'prettier/prettier': 'off', // 芋艿:默认关闭 prettier 的 ESLint 校验,因为我们使用的是 IDE 的 Prettier 插件 + '@unocss/order': 'off', // 芋艿:禁用 unocss 【css】顺序的提示,因为暂时不需要这么严格,警告也有点繁琐 + '@unocss/order-attributify': 'off' // 芋艿:禁用 unocss 【属性】顺序的提示,因为暂时不需要这么严格,警告也有点繁琐 + } +}) diff --git a/marketing-ui/admin-ui/.gitignore b/marketing-ui/admin-ui/.gitignore new file mode 100644 index 0000000..7d18ef0 --- /dev/null +++ b/marketing-ui/admin-ui/.gitignore @@ -0,0 +1,28 @@ +.DS_Store +.history +node_modules/ +dist/ +npm-debug.log* +yarn-debug.log* +yarn-error.log* +**/*.log + +tests/**/coverage/ +tests/e2e/reports +selenium-debug.log + +# Editor directories and files +.idea +.vscode +*.suo +*.ntvs* +*.njsproj +*.sln + +package-lock.json +yarn.lock +pnpm-lock.yaml + +# 编译生成的文件 +auto-imports.d.ts +components.d.ts diff --git a/marketing-ui/admin-ui/.image/Java监控.jpg b/marketing-ui/admin-ui/.image/Java监控.jpg new file mode 100644 index 0000000..6ad522a Binary files /dev/null and b/marketing-ui/admin-ui/.image/Java监控.jpg differ diff --git a/marketing-ui/admin-ui/.image/MySQL.jpg b/marketing-ui/admin-ui/.image/MySQL.jpg new file mode 100644 index 0000000..64a1940 Binary files /dev/null and b/marketing-ui/admin-ui/.image/MySQL.jpg differ diff --git a/marketing-ui/admin-ui/.image/OA请假-列表.jpg b/marketing-ui/admin-ui/.image/OA请假-列表.jpg new file mode 100644 index 0000000..787bb73 Binary files /dev/null and b/marketing-ui/admin-ui/.image/OA请假-列表.jpg differ diff --git a/marketing-ui/admin-ui/.image/OA请假-发起.jpg b/marketing-ui/admin-ui/.image/OA请假-发起.jpg new file mode 100644 index 0000000..1a7342d Binary files /dev/null and b/marketing-ui/admin-ui/.image/OA请假-发起.jpg differ diff --git a/marketing-ui/admin-ui/.image/OA请假-详情.jpg b/marketing-ui/admin-ui/.image/OA请假-详情.jpg new file mode 100644 index 0000000..a83e7c1 Binary files /dev/null and b/marketing-ui/admin-ui/.image/OA请假-详情.jpg differ diff --git a/marketing-ui/admin-ui/.image/Redis.jpg b/marketing-ui/admin-ui/.image/Redis.jpg new file mode 100644 index 0000000..9569352 Binary files /dev/null and b/marketing-ui/admin-ui/.image/Redis.jpg differ diff --git a/marketing-ui/admin-ui/.image/admin-uniapp/01.png b/marketing-ui/admin-ui/.image/admin-uniapp/01.png new file mode 100644 index 0000000..0f65d99 Binary files /dev/null and b/marketing-ui/admin-ui/.image/admin-uniapp/01.png differ diff --git a/marketing-ui/admin-ui/.image/admin-uniapp/02.png b/marketing-ui/admin-ui/.image/admin-uniapp/02.png new file mode 100644 index 0000000..05ec781 Binary files /dev/null and b/marketing-ui/admin-ui/.image/admin-uniapp/02.png differ diff --git a/marketing-ui/admin-ui/.image/admin-uniapp/03.png b/marketing-ui/admin-ui/.image/admin-uniapp/03.png new file mode 100644 index 0000000..f400c68 Binary files /dev/null and b/marketing-ui/admin-ui/.image/admin-uniapp/03.png differ diff --git a/marketing-ui/admin-ui/.image/admin-uniapp/04.png b/marketing-ui/admin-ui/.image/admin-uniapp/04.png new file mode 100644 index 0000000..d5d5ea0 Binary files /dev/null and b/marketing-ui/admin-ui/.image/admin-uniapp/04.png differ diff --git a/marketing-ui/admin-ui/.image/admin-uniapp/05.png b/marketing-ui/admin-ui/.image/admin-uniapp/05.png new file mode 100644 index 0000000..1de6d8a Binary files /dev/null and b/marketing-ui/admin-ui/.image/admin-uniapp/05.png differ diff --git a/marketing-ui/admin-ui/.image/admin-uniapp/06.png b/marketing-ui/admin-ui/.image/admin-uniapp/06.png new file mode 100644 index 0000000..400ae90 Binary files /dev/null and b/marketing-ui/admin-ui/.image/admin-uniapp/06.png differ diff --git a/marketing-ui/admin-ui/.image/admin-uniapp/07.png b/marketing-ui/admin-ui/.image/admin-uniapp/07.png new file mode 100644 index 0000000..2ed8c0f Binary files /dev/null and b/marketing-ui/admin-ui/.image/admin-uniapp/07.png differ diff --git a/marketing-ui/admin-ui/.image/admin-uniapp/08.png b/marketing-ui/admin-ui/.image/admin-uniapp/08.png new file mode 100644 index 0000000..090e64a Binary files /dev/null and b/marketing-ui/admin-ui/.image/admin-uniapp/08.png differ diff --git a/marketing-ui/admin-ui/.image/admin-uniapp/09.png b/marketing-ui/admin-ui/.image/admin-uniapp/09.png new file mode 100644 index 0000000..f2032c8 Binary files /dev/null and b/marketing-ui/admin-ui/.image/admin-uniapp/09.png differ diff --git a/marketing-ui/admin-ui/.image/common/ai-feature.png b/marketing-ui/admin-ui/.image/common/ai-feature.png new file mode 100644 index 0000000..552ed59 Binary files /dev/null and b/marketing-ui/admin-ui/.image/common/ai-feature.png differ diff --git a/marketing-ui/admin-ui/.image/common/ai-preview.gif b/marketing-ui/admin-ui/.image/common/ai-preview.gif new file mode 100644 index 0000000..5f13ac4 Binary files /dev/null and b/marketing-ui/admin-ui/.image/common/ai-preview.gif differ diff --git a/marketing-ui/admin-ui/.image/common/bpm-feature.png b/marketing-ui/admin-ui/.image/common/bpm-feature.png new file mode 100644 index 0000000..23787fb Binary files /dev/null and b/marketing-ui/admin-ui/.image/common/bpm-feature.png differ diff --git a/marketing-ui/admin-ui/.image/common/crm-feature.png b/marketing-ui/admin-ui/.image/common/crm-feature.png new file mode 100644 index 0000000..e1c9670 Binary files /dev/null and b/marketing-ui/admin-ui/.image/common/crm-feature.png differ diff --git a/marketing-ui/admin-ui/.image/common/erp-feature.png b/marketing-ui/admin-ui/.image/common/erp-feature.png new file mode 100644 index 0000000..d30b30e Binary files /dev/null and b/marketing-ui/admin-ui/.image/common/erp-feature.png differ diff --git a/marketing-ui/admin-ui/.image/common/infra-feature.png b/marketing-ui/admin-ui/.image/common/infra-feature.png new file mode 100644 index 0000000..f5cef50 Binary files /dev/null and b/marketing-ui/admin-ui/.image/common/infra-feature.png differ diff --git a/marketing-ui/admin-ui/.image/common/mall-feature.png b/marketing-ui/admin-ui/.image/common/mall-feature.png new file mode 100644 index 0000000..cca05c0 Binary files /dev/null and b/marketing-ui/admin-ui/.image/common/mall-feature.png differ diff --git a/marketing-ui/admin-ui/.image/common/mall-preview.png b/marketing-ui/admin-ui/.image/common/mall-preview.png new file mode 100644 index 0000000..f939214 Binary files /dev/null and b/marketing-ui/admin-ui/.image/common/mall-preview.png differ diff --git a/marketing-ui/admin-ui/.image/common/project-vs.png b/marketing-ui/admin-ui/.image/common/project-vs.png new file mode 100644 index 0000000..561e092 Binary files /dev/null and b/marketing-ui/admin-ui/.image/common/project-vs.png differ diff --git a/marketing-ui/admin-ui/.image/common/ruoyi-vue-pro-architecture.png b/marketing-ui/admin-ui/.image/common/ruoyi-vue-pro-architecture.png new file mode 100644 index 0000000..7bd7d59 Binary files /dev/null and b/marketing-ui/admin-ui/.image/common/ruoyi-vue-pro-architecture.png differ diff --git a/marketing-ui/admin-ui/.image/common/ruoyi-vue-pro-biz.png b/marketing-ui/admin-ui/.image/common/ruoyi-vue-pro-biz.png new file mode 100644 index 0000000..24a385a Binary files /dev/null and b/marketing-ui/admin-ui/.image/common/ruoyi-vue-pro-biz.png differ diff --git a/marketing-ui/admin-ui/.image/common/system-feature.png b/marketing-ui/admin-ui/.image/common/system-feature.png new file mode 100644 index 0000000..366087c Binary files /dev/null and b/marketing-ui/admin-ui/.image/common/system-feature.png differ diff --git a/marketing-ui/admin-ui/.image/common/yudao-cloud-architecture.png b/marketing-ui/admin-ui/.image/common/yudao-cloud-architecture.png new file mode 100644 index 0000000..59416d8 Binary files /dev/null and b/marketing-ui/admin-ui/.image/common/yudao-cloud-architecture.png differ diff --git a/marketing-ui/admin-ui/.image/common/yudao-roadmap.png b/marketing-ui/admin-ui/.image/common/yudao-roadmap.png new file mode 100644 index 0000000..f4becc9 Binary files /dev/null and b/marketing-ui/admin-ui/.image/common/yudao-roadmap.png differ diff --git a/marketing-ui/admin-ui/.image/个人中心.jpg b/marketing-ui/admin-ui/.image/个人中心.jpg new file mode 100644 index 0000000..ce57f6e Binary files /dev/null and b/marketing-ui/admin-ui/.image/个人中心.jpg differ diff --git a/marketing-ui/admin-ui/.image/代码生成.jpg b/marketing-ui/admin-ui/.image/代码生成.jpg new file mode 100644 index 0000000..751603e Binary files /dev/null and b/marketing-ui/admin-ui/.image/代码生成.jpg differ diff --git a/marketing-ui/admin-ui/.image/令牌管理.jpg b/marketing-ui/admin-ui/.image/令牌管理.jpg new file mode 100644 index 0000000..04abf4d Binary files /dev/null and b/marketing-ui/admin-ui/.image/令牌管理.jpg differ diff --git a/marketing-ui/admin-ui/.image/任务列表-审批.jpg b/marketing-ui/admin-ui/.image/任务列表-审批.jpg new file mode 100644 index 0000000..cba312a Binary files /dev/null and b/marketing-ui/admin-ui/.image/任务列表-审批.jpg differ diff --git a/marketing-ui/admin-ui/.image/任务列表-已办.jpg b/marketing-ui/admin-ui/.image/任务列表-已办.jpg new file mode 100644 index 0000000..7a8d0fb Binary files /dev/null and b/marketing-ui/admin-ui/.image/任务列表-已办.jpg differ diff --git a/marketing-ui/admin-ui/.image/任务列表-待办.jpg b/marketing-ui/admin-ui/.image/任务列表-待办.jpg new file mode 100644 index 0000000..a90323f Binary files /dev/null and b/marketing-ui/admin-ui/.image/任务列表-待办.jpg differ diff --git a/marketing-ui/admin-ui/.image/任务日志.jpg b/marketing-ui/admin-ui/.image/任务日志.jpg new file mode 100644 index 0000000..599e50a Binary files /dev/null and b/marketing-ui/admin-ui/.image/任务日志.jpg differ diff --git a/marketing-ui/admin-ui/.image/商户信息.jpg b/marketing-ui/admin-ui/.image/商户信息.jpg new file mode 100644 index 0000000..483eace Binary files /dev/null and b/marketing-ui/admin-ui/.image/商户信息.jpg differ diff --git a/marketing-ui/admin-ui/.image/在线用户.jpg b/marketing-ui/admin-ui/.image/在线用户.jpg new file mode 100644 index 0000000..b183009 Binary files /dev/null and b/marketing-ui/admin-ui/.image/在线用户.jpg differ diff --git a/marketing-ui/admin-ui/.image/大屏设计器-列表.jpg b/marketing-ui/admin-ui/.image/大屏设计器-列表.jpg new file mode 100644 index 0000000..9a45c3b Binary files /dev/null and b/marketing-ui/admin-ui/.image/大屏设计器-列表.jpg differ diff --git a/marketing-ui/admin-ui/.image/大屏设计器-编辑.jpg b/marketing-ui/admin-ui/.image/大屏设计器-编辑.jpg new file mode 100644 index 0000000..63298a0 Binary files /dev/null and b/marketing-ui/admin-ui/.image/大屏设计器-编辑.jpg differ diff --git a/marketing-ui/admin-ui/.image/大屏设计器-预览.jpg b/marketing-ui/admin-ui/.image/大屏设计器-预览.jpg new file mode 100644 index 0000000..501d9ea Binary files /dev/null and b/marketing-ui/admin-ui/.image/大屏设计器-预览.jpg differ diff --git a/marketing-ui/admin-ui/.image/字典数据.jpg b/marketing-ui/admin-ui/.image/字典数据.jpg new file mode 100644 index 0000000..8298c89 Binary files /dev/null and b/marketing-ui/admin-ui/.image/字典数据.jpg differ diff --git a/marketing-ui/admin-ui/.image/字典类型.jpg b/marketing-ui/admin-ui/.image/字典类型.jpg new file mode 100644 index 0000000..6613392 Binary files /dev/null and b/marketing-ui/admin-ui/.image/字典类型.jpg differ diff --git a/marketing-ui/admin-ui/.image/定时任务.jpg b/marketing-ui/admin-ui/.image/定时任务.jpg new file mode 100644 index 0000000..d5bbd85 Binary files /dev/null and b/marketing-ui/admin-ui/.image/定时任务.jpg differ diff --git a/marketing-ui/admin-ui/.image/岗位管理.jpg b/marketing-ui/admin-ui/.image/岗位管理.jpg new file mode 100644 index 0000000..42b64d2 Binary files /dev/null and b/marketing-ui/admin-ui/.image/岗位管理.jpg differ diff --git a/marketing-ui/admin-ui/.image/工作流设计器-bpmn.jpg b/marketing-ui/admin-ui/.image/工作流设计器-bpmn.jpg new file mode 100644 index 0000000..2a61f60 Binary files /dev/null and b/marketing-ui/admin-ui/.image/工作流设计器-bpmn.jpg differ diff --git a/marketing-ui/admin-ui/.image/工作流设计器-simple.jpg b/marketing-ui/admin-ui/.image/工作流设计器-simple.jpg new file mode 100644 index 0000000..9ef2c9e Binary files /dev/null and b/marketing-ui/admin-ui/.image/工作流设计器-simple.jpg differ diff --git a/marketing-ui/admin-ui/.image/应用信息-列表.jpg b/marketing-ui/admin-ui/.image/应用信息-列表.jpg new file mode 100644 index 0000000..da419a2 Binary files /dev/null and b/marketing-ui/admin-ui/.image/应用信息-列表.jpg differ diff --git a/marketing-ui/admin-ui/.image/应用信息-编辑.jpg b/marketing-ui/admin-ui/.image/应用信息-编辑.jpg new file mode 100644 index 0000000..913cfbc Binary files /dev/null and b/marketing-ui/admin-ui/.image/应用信息-编辑.jpg differ diff --git a/marketing-ui/admin-ui/.image/应用管理.jpg b/marketing-ui/admin-ui/.image/应用管理.jpg new file mode 100644 index 0000000..6e7789f Binary files /dev/null and b/marketing-ui/admin-ui/.image/应用管理.jpg differ diff --git a/marketing-ui/admin-ui/.image/我的流程-列表.jpg b/marketing-ui/admin-ui/.image/我的流程-列表.jpg new file mode 100644 index 0000000..223d17a Binary files /dev/null and b/marketing-ui/admin-ui/.image/我的流程-列表.jpg differ diff --git a/marketing-ui/admin-ui/.image/我的流程-发起.jpg b/marketing-ui/admin-ui/.image/我的流程-发起.jpg new file mode 100644 index 0000000..7a83306 Binary files /dev/null and b/marketing-ui/admin-ui/.image/我的流程-发起.jpg differ diff --git a/marketing-ui/admin-ui/.image/我的流程-详情.jpg b/marketing-ui/admin-ui/.image/我的流程-详情.jpg new file mode 100644 index 0000000..6a01541 Binary files /dev/null and b/marketing-ui/admin-ui/.image/我的流程-详情.jpg differ diff --git a/marketing-ui/admin-ui/.image/报表设计器-图形报表.jpg b/marketing-ui/admin-ui/.image/报表设计器-图形报表.jpg new file mode 100644 index 0000000..681b318 Binary files /dev/null and b/marketing-ui/admin-ui/.image/报表设计器-图形报表.jpg differ diff --git a/marketing-ui/admin-ui/.image/报表设计器-打印设计.jpg b/marketing-ui/admin-ui/.image/报表设计器-打印设计.jpg new file mode 100644 index 0000000..bb86da6 Binary files /dev/null and b/marketing-ui/admin-ui/.image/报表设计器-打印设计.jpg differ diff --git a/marketing-ui/admin-ui/.image/报表设计器-数据报表.jpg b/marketing-ui/admin-ui/.image/报表设计器-数据报表.jpg new file mode 100644 index 0000000..9ca5b9b Binary files /dev/null and b/marketing-ui/admin-ui/.image/报表设计器-数据报表.jpg differ diff --git a/marketing-ui/admin-ui/.image/操作日志.jpg b/marketing-ui/admin-ui/.image/操作日志.jpg new file mode 100644 index 0000000..4a0611a Binary files /dev/null and b/marketing-ui/admin-ui/.image/操作日志.jpg differ diff --git a/marketing-ui/admin-ui/.image/支付订单.jpg b/marketing-ui/admin-ui/.image/支付订单.jpg new file mode 100644 index 0000000..0a56dd7 Binary files /dev/null and b/marketing-ui/admin-ui/.image/支付订单.jpg differ diff --git a/marketing-ui/admin-ui/.image/敏感词.jpg b/marketing-ui/admin-ui/.image/敏感词.jpg new file mode 100644 index 0000000..92a5397 Binary files /dev/null and b/marketing-ui/admin-ui/.image/敏感词.jpg differ diff --git a/marketing-ui/admin-ui/.image/数据库文档.jpg b/marketing-ui/admin-ui/.image/数据库文档.jpg new file mode 100644 index 0000000..a4339d9 Binary files /dev/null and b/marketing-ui/admin-ui/.image/数据库文档.jpg differ diff --git a/marketing-ui/admin-ui/.image/文件管理.jpg b/marketing-ui/admin-ui/.image/文件管理.jpg new file mode 100644 index 0000000..054b19f Binary files /dev/null and b/marketing-ui/admin-ui/.image/文件管理.jpg differ diff --git a/marketing-ui/admin-ui/.image/文件管理2.jpg b/marketing-ui/admin-ui/.image/文件管理2.jpg new file mode 100644 index 0000000..b12e5c3 Binary files /dev/null and b/marketing-ui/admin-ui/.image/文件管理2.jpg differ diff --git a/marketing-ui/admin-ui/.image/文件配置.jpg b/marketing-ui/admin-ui/.image/文件配置.jpg new file mode 100644 index 0000000..e618049 Binary files /dev/null and b/marketing-ui/admin-ui/.image/文件配置.jpg differ diff --git a/marketing-ui/admin-ui/.image/日志中心.jpg b/marketing-ui/admin-ui/.image/日志中心.jpg new file mode 100644 index 0000000..27c1c6c Binary files /dev/null and b/marketing-ui/admin-ui/.image/日志中心.jpg differ diff --git a/marketing-ui/admin-ui/.image/流程模型-列表.jpg b/marketing-ui/admin-ui/.image/流程模型-列表.jpg new file mode 100644 index 0000000..ffdc584 Binary files /dev/null and b/marketing-ui/admin-ui/.image/流程模型-列表.jpg differ diff --git a/marketing-ui/admin-ui/.image/流程模型-定义.jpg b/marketing-ui/admin-ui/.image/流程模型-定义.jpg new file mode 100644 index 0000000..18b316c Binary files /dev/null and b/marketing-ui/admin-ui/.image/流程模型-定义.jpg differ diff --git a/marketing-ui/admin-ui/.image/流程模型-设计.jpg b/marketing-ui/admin-ui/.image/流程模型-设计.jpg new file mode 100644 index 0000000..9614969 Binary files /dev/null and b/marketing-ui/admin-ui/.image/流程模型-设计.jpg differ diff --git a/marketing-ui/admin-ui/.image/流程表单.jpg b/marketing-ui/admin-ui/.image/流程表单.jpg new file mode 100644 index 0000000..60669c1 Binary files /dev/null and b/marketing-ui/admin-ui/.image/流程表单.jpg differ diff --git a/marketing-ui/admin-ui/.image/生成效果.jpg b/marketing-ui/admin-ui/.image/生成效果.jpg new file mode 100644 index 0000000..98ff2cc Binary files /dev/null and b/marketing-ui/admin-ui/.image/生成效果.jpg differ diff --git a/marketing-ui/admin-ui/.image/用户分组.jpg b/marketing-ui/admin-ui/.image/用户分组.jpg new file mode 100644 index 0000000..39af1cd Binary files /dev/null and b/marketing-ui/admin-ui/.image/用户分组.jpg differ diff --git a/marketing-ui/admin-ui/.image/用户管理.jpg b/marketing-ui/admin-ui/.image/用户管理.jpg new file mode 100644 index 0000000..844604a Binary files /dev/null and b/marketing-ui/admin-ui/.image/用户管理.jpg differ diff --git a/marketing-ui/admin-ui/.image/登录.jpg b/marketing-ui/admin-ui/.image/登录.jpg new file mode 100644 index 0000000..b782b98 Binary files /dev/null and b/marketing-ui/admin-ui/.image/登录.jpg differ diff --git a/marketing-ui/admin-ui/.image/登录日志.jpg b/marketing-ui/admin-ui/.image/登录日志.jpg new file mode 100644 index 0000000..25662d9 Binary files /dev/null and b/marketing-ui/admin-ui/.image/登录日志.jpg differ diff --git a/marketing-ui/admin-ui/.image/短信日志.jpg b/marketing-ui/admin-ui/.image/短信日志.jpg new file mode 100644 index 0000000..ada8e56 Binary files /dev/null and b/marketing-ui/admin-ui/.image/短信日志.jpg differ diff --git a/marketing-ui/admin-ui/.image/短信模板.jpg b/marketing-ui/admin-ui/.image/短信模板.jpg new file mode 100644 index 0000000..09381cc Binary files /dev/null and b/marketing-ui/admin-ui/.image/短信模板.jpg differ diff --git a/marketing-ui/admin-ui/.image/短信渠道.jpg b/marketing-ui/admin-ui/.image/短信渠道.jpg new file mode 100644 index 0000000..df3a5c3 Binary files /dev/null and b/marketing-ui/admin-ui/.image/短信渠道.jpg differ diff --git a/marketing-ui/admin-ui/.image/租户套餐.png b/marketing-ui/admin-ui/.image/租户套餐.png new file mode 100644 index 0000000..9663167 Binary files /dev/null and b/marketing-ui/admin-ui/.image/租户套餐.png differ diff --git a/marketing-ui/admin-ui/.image/租户管理.jpg b/marketing-ui/admin-ui/.image/租户管理.jpg new file mode 100644 index 0000000..647416a Binary files /dev/null and b/marketing-ui/admin-ui/.image/租户管理.jpg differ diff --git a/marketing-ui/admin-ui/.image/系统接口.jpg b/marketing-ui/admin-ui/.image/系统接口.jpg new file mode 100644 index 0000000..6d39d42 Binary files /dev/null and b/marketing-ui/admin-ui/.image/系统接口.jpg differ diff --git a/marketing-ui/admin-ui/.image/菜单管理.jpg b/marketing-ui/admin-ui/.image/菜单管理.jpg new file mode 100644 index 0000000..ad3b797 Binary files /dev/null and b/marketing-ui/admin-ui/.image/菜单管理.jpg differ diff --git a/marketing-ui/admin-ui/.image/表单构建.jpg b/marketing-ui/admin-ui/.image/表单构建.jpg new file mode 100644 index 0000000..81f0374 Binary files /dev/null and b/marketing-ui/admin-ui/.image/表单构建.jpg differ diff --git a/marketing-ui/admin-ui/.image/角色管理.jpg b/marketing-ui/admin-ui/.image/角色管理.jpg new file mode 100644 index 0000000..eed776e Binary files /dev/null and b/marketing-ui/admin-ui/.image/角色管理.jpg differ diff --git a/marketing-ui/admin-ui/.image/访问日志.jpg b/marketing-ui/admin-ui/.image/访问日志.jpg new file mode 100644 index 0000000..ef301aa Binary files /dev/null and b/marketing-ui/admin-ui/.image/访问日志.jpg differ diff --git a/marketing-ui/admin-ui/.image/退款订单.jpg b/marketing-ui/admin-ui/.image/退款订单.jpg new file mode 100644 index 0000000..2c6c6c9 Binary files /dev/null and b/marketing-ui/admin-ui/.image/退款订单.jpg differ diff --git a/marketing-ui/admin-ui/.image/通知公告.jpg b/marketing-ui/admin-ui/.image/通知公告.jpg new file mode 100644 index 0000000..97bb42f Binary files /dev/null and b/marketing-ui/admin-ui/.image/通知公告.jpg differ diff --git a/marketing-ui/admin-ui/.image/部门管理.jpg b/marketing-ui/admin-ui/.image/部门管理.jpg new file mode 100644 index 0000000..6eab233 Binary files /dev/null and b/marketing-ui/admin-ui/.image/部门管理.jpg differ diff --git a/marketing-ui/admin-ui/.image/配置管理.jpg b/marketing-ui/admin-ui/.image/配置管理.jpg new file mode 100644 index 0000000..0abaec9 Binary files /dev/null and b/marketing-ui/admin-ui/.image/配置管理.jpg differ diff --git a/marketing-ui/admin-ui/.image/链路追踪.jpg b/marketing-ui/admin-ui/.image/链路追踪.jpg new file mode 100644 index 0000000..12f7aa8 Binary files /dev/null and b/marketing-ui/admin-ui/.image/链路追踪.jpg differ diff --git a/marketing-ui/admin-ui/.image/错误日志.jpg b/marketing-ui/admin-ui/.image/错误日志.jpg new file mode 100644 index 0000000..eb615ea Binary files /dev/null and b/marketing-ui/admin-ui/.image/错误日志.jpg differ diff --git a/marketing-ui/admin-ui/.image/错误码管理.jpg b/marketing-ui/admin-ui/.image/错误码管理.jpg new file mode 100644 index 0000000..ea91dde Binary files /dev/null and b/marketing-ui/admin-ui/.image/错误码管理.jpg differ diff --git a/marketing-ui/admin-ui/.image/首页.jpg b/marketing-ui/admin-ui/.image/首页.jpg new file mode 100644 index 0000000..10a7fde Binary files /dev/null and b/marketing-ui/admin-ui/.image/首页.jpg differ diff --git a/marketing-ui/admin-ui/.prettierignore b/marketing-ui/admin-ui/.prettierignore new file mode 100644 index 0000000..f68ea86 --- /dev/null +++ b/marketing-ui/admin-ui/.prettierignore @@ -0,0 +1,11 @@ +/node_modules/** +/dist/ +/dist* +/public/* +/docs/* +/vite.config.ts +/src/types/env.d.ts +/src/types/auto-components.d.ts +/src/types/auto-imports.d.ts +/docs/**/* +CHANGELOG diff --git a/marketing-ui/admin-ui/.stylelintignore b/marketing-ui/admin-ui/.stylelintignore new file mode 100644 index 0000000..aa605b4 --- /dev/null +++ b/marketing-ui/admin-ui/.stylelintignore @@ -0,0 +1,6 @@ +/dist/* +/public/* +public/* +/dist* +/src/types/env.d.ts +/docs/**/* diff --git a/marketing-ui/admin-ui/CLAUDE.md b/marketing-ui/admin-ui/CLAUDE.md new file mode 100644 index 0000000..dd103bf --- /dev/null +++ b/marketing-ui/admin-ui/CLAUDE.md @@ -0,0 +1,111 @@ +# SMS Pro Admin UI - 项目说明 + +## 项目概述 + +这是 **SMS Pro (短信平台)** 的前端管理界面,用于管理和监控短信服务的各个方面。 + +## 技术栈 + +- **框架**: Vue 3.5.12 +- **构建工具**: Vite 5.1.4 +- **UI 组件库**: Element Plus 2.9.1 +- **语言**: TypeScript 5.3.3 +- **状态管理**: Pinia 2.1.7 (持久化: pinia-plugin-persistedstate) +- **路由**: Vue Router 4.4.5 +- **包管理器**: pnpm (强制使用,版本 >= 8.6.0) +- **样式**: UnoCSS + SCSS +- **国际化**: Vue I18n 9.10.2 + +## 核心功能 + +这是一个企业级短信平台管理后台,主要功能包括: + +1. **短信渠道管理** - 管理多个短信服务提供商渠道 +2. **短信发送记录** - 查询和管理短信发送历史 +3. **网关管理** - 处理短信请求的接收入口 +4. **工作台** - 短信发送任务的实际执行 +5. **租户管理** - 多租户支持 +6. **系统管理** - 用户、角色、权限等系统配置 + +## 项目结构 + +``` +src/ +├── api/ # API 接口定义 +├── assets/ # 静态资源 +├── components/ # 公共组件 +├── config/ # 配置文件 +├── directives/ # 自定义指令 +├── hooks/ # 组合式函数 +├── layout/ # 布局组件 +├── locales/ # 国际化文件 +├── plugins/ # 插件配置 +├── router/ # 路由配置 +├── store/ # Pinia 状态管理 +├── styles/ # 全局样式 +├── types/ # TypeScript 类型定义 +├── utils/ # 工具函数 +└── views/ # 页面组件 +``` + +## 开发环境要求 + +- Node.js >= 16.18.0 +- pnpm >= 8.6.0 + +## 常用命令 + +```bash +# 安装依赖 +pnpm install + +# 本地开发 +npm run dev + +# 构建 +npm run build:local # 本地环境 +npm run build:dev # 开发环境 +npm run build:test # 测试环境 +npm run build:stage # 预发布环境 +npm run build:prod # 生产环境 + +# 代码检查 +npm run lint:eslint +npm run lint:format +npm run lint:style + +# 类型检查 +npm run ts:check +``` + +## 后端服务 + +前端对应的后端项目位于: +- 路径: `/Users/zhangyong/workspace/java/platform-sms-pro` +- 技术栈: Spring Boot 2.7.18 + Java 8 +- 主要模块: + - `marketing-admin-server` - 主服务 + - `marketing-module-system` - 系统管理 + - `marketing-module-channel` - 短信渠道 + - `marketing-module-record` - 发送记录 + - `marketing-module-gateway` - 网关 + - `marketing-module-worker` - 消息处理 + - `marketing-module-tenant` - 租户管理 + +## 重要提示 + +- 项目使用 `env.local`、`dev`、`test`、`stage`、`prod` 等不同环境配置 +- 组件自动导入: 使用 `unplugin-vue-components` 和 `unplugin-auto-import` +- 图标使用: UnoCSS 和 Iconify +- 样式采用 UnoCSS 原子化 CSS 框架 + +## 特殊功能 + +- BPMN 流程图编辑 (bpmn-js) +- 富文本编辑器 (wangeditor) +- 图片裁剪 (cropperjs) +- 语音录制 (benz-amr-recorder) +- 代码高亮 (highlight.js) +- 图表展示 (echarts) +- 二维码生成 (qrcode) +- 视频播放 (video.js) diff --git a/marketing-ui/admin-ui/LICENSE b/marketing-ui/admin-ui/LICENSE new file mode 100644 index 0000000..9861118 --- /dev/null +++ b/marketing-ui/admin-ui/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021-present Archer + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/marketing-ui/admin-ui/README.md b/marketing-ui/admin-ui/README.md new file mode 100644 index 0000000..7e849eb --- /dev/null +++ b/marketing-ui/admin-ui/README.md @@ -0,0 +1,11 @@ + +如果这个项目让你有所收获,记得 Star 关注哦,这对我是非常不错的鼓励与支持。 + +## 🐶 新手必读 +* nodejs > 16.18.0 && pnpm > 8.6.0 (强制使用pnpm) + +```bash +pnpm install +npm run dev +``` + diff --git a/marketing-ui/admin-ui/build/vite/index.ts b/marketing-ui/admin-ui/build/vite/index.ts new file mode 100644 index 0000000..585759f --- /dev/null +++ b/marketing-ui/admin-ui/build/vite/index.ts @@ -0,0 +1,100 @@ +import { resolve } from 'path' +import Vue from '@vitejs/plugin-vue' +import VueJsx from '@vitejs/plugin-vue-jsx' +import progress from 'vite-plugin-progress' +import EslintPlugin from 'vite-plugin-eslint' +import PurgeIcons from 'vite-plugin-purge-icons' +import { ViteEjsPlugin } from 'vite-plugin-ejs' +// @ts-ignore +import ElementPlus from 'unplugin-element-plus/vite' +import AutoImport from 'unplugin-auto-import/vite' +import Components from 'unplugin-vue-components/vite' +import { ElementPlusResolver } from 'unplugin-vue-components/resolvers' +import viteCompression from 'vite-plugin-compression' +import topLevelAwait from 'vite-plugin-top-level-await' +import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite' +import { createSvgIconsPlugin } from 'vite-plugin-svg-icons' +import UnoCSS from 'unocss/vite' + +export function createVitePlugins() { + const root = process.cwd() + + // 路径查找 + function pathResolve(dir: string) { + return resolve(root, '.', dir) + } + + return [ + Vue(), + VueJsx(), + UnoCSS(), + progress(), + PurgeIcons(), + ElementPlus({}), + AutoImport({ + include: [ + /\.[tj]sx?$/, // .ts, .tsx, .js, .jsx + /\.vue$/, + /\.vue\?vue/, // .vue + /\.md$/ // .md + ], + imports: [ + 'vue', + 'vue-router', + // 可额外添加需要 autoImport 的组件 + { + '@/hooks/web/useI18n': ['useI18n'], + '@/hooks/web/useMessage': ['useMessage'], + '@/hooks/web/useTable': ['useTable'], + '@/hooks/web/useCrudSchemas': ['useCrudSchemas'], + '@/utils/formRules': ['required'], + '@/utils/dict': ['DICT_TYPE'] + } + ], + dts: 'src/types/auto-imports.d.ts', + resolvers: [ElementPlusResolver()], + eslintrc: { + enabled: false, // Default `false` + filepath: './.eslintrc-auto-import.json', // Default `./.eslintrc-auto-import.json` + globalsPropValue: true // Default `true`, (true | false | 'readonly' | 'readable' | 'writable' | 'writeable') + } + }), + Components({ + // 生成自定义 `auto-components.d.ts` 全局声明 + dts: 'src/types/auto-components.d.ts', + // 自定义组件的解析器 + resolvers: [ElementPlusResolver()], + globs: ["src/components/**/**.{vue, md}", '!src/components/DiyEditor/components/mobile/**'] + }), + EslintPlugin({ + cache: false, + include: ['src/**/*.vue', 'src/**/*.ts', 'src/**/*.tsx'] // 检查的文件 + }), + VueI18nPlugin({ + runtimeOnly: true, + compositionOnly: true, + include: [resolve(__dirname, 'src/locales/**')] + }), + createSvgIconsPlugin({ + iconDirs: [pathResolve('src/assets/svgs')], + symbolId: 'icon-[dir]-[name]', + svgoOptions: true + }), + viteCompression({ + verbose: true, // 是否在控制台输出压缩结果 + disable: false, // 是否禁用 + threshold: 10240, // 体积大于 threshold 才会被压缩,单位 b + algorithm: 'gzip', // 压缩算法,可选 [ 'gzip' , 'brotliCompress' ,'deflate' , 'deflateRaw'] + ext: '.gz', // 生成的压缩包后缀 + deleteOriginFile: false //压缩后是否删除源文件 + }), + ViteEjsPlugin(), + topLevelAwait({ + // https://juejin.cn/post/7152191742513512485 + // The export name of top-level await promise for each chunk module + promiseExportName: '__tla', + // The function to generate import names of top-level await promise in each chunk module + promiseImportName: (i) => `__tla_${i}` + }) + ] +} diff --git a/marketing-ui/admin-ui/build/vite/optimize.ts b/marketing-ui/admin-ui/build/vite/optimize.ts new file mode 100644 index 0000000..9de496a --- /dev/null +++ b/marketing-ui/admin-ui/build/vite/optimize.ts @@ -0,0 +1,123 @@ +const include = [ + 'qs', + 'url', + 'vue', + 'sass', + 'mitt', + 'axios', + 'pinia', + 'dayjs', + 'qrcode', + 'unocss', + 'vue-router', + 'vue-types', + 'vue-i18n', + 'crypto-js', + 'cropperjs', + 'lodash-es', + 'nprogress', + 'web-storage-cache', + '@iconify/iconify', + '@vueuse/core', + '@zxcvbn-ts/core', + 'echarts/core', + 'echarts/charts', + 'echarts/components', + 'echarts/renderers', + 'echarts-wordcloud', + '@wangeditor/editor', + '@wangeditor/editor-for-vue', + '@microsoft/fetch-event-source', + 'markdown-it', + 'markmap-view', + 'markmap-lib', + 'markmap-toolbar', + 'highlight.js', + 'element-plus', + 'element-plus/es', + 'element-plus/es/locale/lang/zh-cn', + 'element-plus/es/locale/lang/en', + 'element-plus/es/components/avatar/style/css', + 'element-plus/es/components/space/style/css', + 'element-plus/es/components/backtop/style/css', + 'element-plus/es/components/form/style/css', + 'element-plus/es/components/radio-group/style/css', + 'element-plus/es/components/radio/style/css', + 'element-plus/es/components/checkbox/style/css', + 'element-plus/es/components/checkbox-group/style/css', + 'element-plus/es/components/switch/style/css', + 'element-plus/es/components/time-picker/style/css', + 'element-plus/es/components/date-picker/style/css', + 'element-plus/es/components/descriptions/style/css', + 'element-plus/es/components/descriptions-item/style/css', + 'element-plus/es/components/link/style/css', + 'element-plus/es/components/tooltip/style/css', + 'element-plus/es/components/drawer/style/css', + 'element-plus/es/components/dialog/style/css', + 'element-plus/es/components/checkbox-button/style/css', + 'element-plus/es/components/option-group/style/css', + 'element-plus/es/components/radio-button/style/css', + 'element-plus/es/components/cascader/style/css', + 'element-plus/es/components/color-picker/style/css', + 'element-plus/es/components/input-number/style/css', + 'element-plus/es/components/rate/style/css', + 'element-plus/es/components/select-v2/style/css', + 'element-plus/es/components/tree-select/style/css', + 'element-plus/es/components/slider/style/css', + 'element-plus/es/components/time-select/style/css', + 'element-plus/es/components/autocomplete/style/css', + 'element-plus/es/components/image-viewer/style/css', + 'element-plus/es/components/upload/style/css', + 'element-plus/es/components/col/style/css', + 'element-plus/es/components/form-item/style/css', + 'element-plus/es/components/alert/style/css', + 'element-plus/es/components/breadcrumb/style/css', + 'element-plus/es/components/select/style/css', + 'element-plus/es/components/input/style/css', + 'element-plus/es/components/breadcrumb-item/style/css', + 'element-plus/es/components/tag/style/css', + 'element-plus/es/components/pagination/style/css', + 'element-plus/es/components/table/style/css', + 'element-plus/es/components/table-v2/style/css', + 'element-plus/es/components/table-column/style/css', + 'element-plus/es/components/card/style/css', + 'element-plus/es/components/row/style/css', + 'element-plus/es/components/button/style/css', + 'element-plus/es/components/menu/style/css', + 'element-plus/es/components/sub-menu/style/css', + 'element-plus/es/components/menu-item/style/css', + 'element-plus/es/components/option/style/css', + 'element-plus/es/components/dropdown/style/css', + 'element-plus/es/components/dropdown-menu/style/css', + 'element-plus/es/components/dropdown-item/style/css', + 'element-plus/es/components/skeleton/style/css', + 'element-plus/es/components/skeleton/style/css', + 'element-plus/es/components/backtop/style/css', + 'element-plus/es/components/menu/style/css', + 'element-plus/es/components/sub-menu/style/css', + 'element-plus/es/components/menu-item/style/css', + 'element-plus/es/components/dropdown/style/css', + 'element-plus/es/components/tree/style/css', + 'element-plus/es/components/dropdown-menu/style/css', + 'element-plus/es/components/dropdown-item/style/css', + 'element-plus/es/components/badge/style/css', + 'element-plus/es/components/breadcrumb/style/css', + 'element-plus/es/components/breadcrumb-item/style/css', + 'element-plus/es/components/image/style/css', + 'element-plus/es/components/collapse-transition/style/css', + 'element-plus/es/components/timeline/style/css', + 'element-plus/es/components/timeline-item/style/css', + 'element-plus/es/components/collapse/style/css', + 'element-plus/es/components/collapse-item/style/css', + 'element-plus/es/components/button-group/style/css', + 'element-plus/es/components/text/style/css', + 'element-plus/es/components/segmented/style/css', + '@element-plus/icons-vue', + 'element-plus/es/components/footer/style/css', + 'element-plus/es/components/empty/style/css', + 'element-plus/es/components/mention/style/css' +] + +const exclude = ['@iconify/json'] + +export { include, exclude } diff --git a/marketing-ui/admin-ui/index.html b/marketing-ui/admin-ui/index.html new file mode 100644 index 0000000..8cfcbef --- /dev/null +++ b/marketing-ui/admin-ui/index.html @@ -0,0 +1,151 @@ + + + + + + + + + + %VITE_APP_TITLE% + + +

+ +
+
+
+ +
%VITE_APP_TITLE%
+
+
+
+
+
+
+
+
+ + + diff --git a/marketing-ui/admin-ui/package.json b/marketing-ui/admin-ui/package.json new file mode 100644 index 0000000..9325848 --- /dev/null +++ b/marketing-ui/admin-ui/package.json @@ -0,0 +1,152 @@ +{ + "name": "magic-ui-admin-vue3", + "version": "0.0.1-snapshot", + "description": "基于vue3、vite4、element-plus、typesScript", + "author": "xingyu", + "private": false, + "scripts": { + "i": "pnpm install", + "dev": "vite --mode env.local", + "dev-server": "vite --mode dev", + "ts:check": "vue-tsc --noEmit", + "build:local": "node --max_old_space_size=4096 ./node_modules/vite/bin/vite.js build", + "build:dev": "node --max_old_space_size=4096 ./node_modules/vite/bin/vite.js build --mode dev", + "build:test": "node --max_old_space_size=4096 ./node_modules/vite/bin/vite.js build --mode test", + "build:stage": "node --max_old_space_size=4096 ./node_modules/vite/bin/vite.js build --mode stage", + "build:prod": "node --max_old_space_size=4096 ./node_modules/vite/bin/vite.js build --mode prod", + "serve:dev": "vite preview --mode dev", + "serve:prod": "vite preview --mode prod", + "preview": "pnpm build:local && vite preview", + "clean": "npx rimraf node_modules", + "clean:cache": "npx rimraf node_modules/.cache", + "lint:eslint": "eslint --fix --ext .js,.ts,.vue ./src", + "lint:format": "prettier --write --loglevel warn \"src/**/*.{js,ts,json,tsx,css,less,scss,vue,html,md}\"", + "lint:style": "stylelint --fix \"./src/**/*.{vue,less,postcss,css,scss}\" --cache --cache-location node_modules/.cache/stylelint/", + "lint:lint-staged": "lint-staged -c " + }, + "dependencies": { + "@element-plus/icons-vue": "^2.1.0", + "@form-create/designer": "^3.2.6", + "@form-create/element-ui": "^3.2.11", + "@iconify/iconify": "^3.1.1", + "@microsoft/fetch-event-source": "^2.0.1", + "@videojs-player/vue": "^1.0.0", + "@vueuse/core": "^10.9.0", + "@wangeditor/editor": "^5.1.23", + "@wangeditor/editor-for-vue": "^5.1.10", + "@zxcvbn-ts/core": "^3.0.4", + "animate.css": "^4.1.1", + "axios": "^1.6.8", + "benz-amr-recorder": "^1.1.5", + "bpmn-js-token-simulation": "^0.36.0", + "camunda-bpmn-moddle": "^7.0.1", + "cropperjs": "^1.6.1", + "crypto-js": "^4.2.0", + "dayjs": "^1.11.10", + "diagram-js": "^12.8.0", + "driver.js": "^1.3.1", + "echarts": "^5.5.0", + "echarts-wordcloud": "^2.1.0", + "element-plus": "2.9.1", + "fast-xml-parser": "^4.3.2", + "highlight.js": "^11.9.0", + "jsencrypt": "^3.3.2", + "lodash-es": "^4.17.21", + "markdown-it": "^14.1.0", + "markmap-common": "^0.16.0", + "markmap-lib": "^0.16.1", + "markmap-toolbar": "^0.17.0", + "markmap-view": "^0.16.0", + "min-dash": "^4.1.1", + "mitt": "^3.0.1", + "nprogress": "^0.2.0", + "pinia": "^2.1.7", + "pinia-plugin-persistedstate": "^3.2.1", + "qrcode": "^1.5.3", + "qs": "^6.12.0", + "sortablejs": "^1.15.3", + "steady-xml": "^0.1.0", + "url": "^0.11.3", + "v3-jsoneditor": "^0.0.6", + "video.js": "^7.21.5", + "vue": "3.5.12", + "vue-dompurify-html": "^4.1.4", + "vue-i18n": "9.10.2", + "vue-router": "4.4.5", + "vue-types": "^5.1.1", + "vue3-signature": "^0.2.4", + "vuedraggable": "^4.1.0", + "web-storage-cache": "^1.1.1", + "xml-js": "^1.6.11" + }, + "devDependencies": { + "@commitlint/cli": "^19.0.1", + "@commitlint/config-conventional": "^19.0.0", + "@iconify/json": "^2.2.187", + "@intlify/unplugin-vue-i18n": "^2.0.0", + "@purge-icons/generated": "^0.9.0", + "@types/lodash-es": "^4.17.12", + "@types/node": "^20.11.21", + "@types/nprogress": "^0.2.3", + "@types/qrcode": "^1.5.5", + "@types/qs": "^6.9.12", + "@typescript-eslint/eslint-plugin": "^7.1.0", + "@typescript-eslint/parser": "^7.1.0", + "@unocss/eslint-config": "^0.57.4", + "@unocss/eslint-plugin": "66.1.0-beta.5", + "@unocss/transformer-variant-group": "^0.58.5", + "@vitejs/plugin-legacy": "^5.3.1", + "@vitejs/plugin-vue": "^5.0.4", + "@vitejs/plugin-vue-jsx": "^3.1.0", + "autoprefixer": "^10.4.17", + "bpmn-js": "^17.9.2", + "bpmn-js-properties-panel": "5.23.0", + "consola": "^3.2.3", + "eslint": "^8.57.0", + "eslint-config-prettier": "^9.1.0", + "eslint-define-config": "^2.1.0", + "eslint-plugin-prettier": "^5.1.3", + "eslint-plugin-vue": "^9.22.0", + "lint-staged": "^15.2.2", + "postcss": "^8.4.35", + "postcss-html": "^1.6.0", + "postcss-scss": "^4.0.9", + "prettier": "^3.2.5", + "prettier-eslint": "^16.3.0", + "rimraf": "^5.0.5", + "rollup": "^4.12.0", + "sass": "^1.69.5", + "stylelint": "^16.2.1", + "stylelint-config-html": "^1.1.0", + "stylelint-config-recommended": "^14.0.0", + "stylelint-config-standard": "^36.0.0", + "stylelint-order": "^6.0.4", + "terser": "^5.28.1", + "typescript": "5.3.3", + "unocss": "^0.58.5", + "unplugin-auto-import": "^0.16.7", + "unplugin-element-plus": "^0.8.0", + "unplugin-vue-components": "^0.25.2", + "vite": "5.1.4", + "vite-plugin-compression": "^0.5.1", + "vite-plugin-ejs": "^1.7.0", + "vite-plugin-eslint": "^1.8.1", + "vite-plugin-progress": "^0.0.7", + "vite-plugin-purge-icons": "^0.10.0", + "vite-plugin-svg-icons": "^2.0.1", + "vite-plugin-top-level-await": "^1.4.4", + "vue-eslint-parser": "^9.3.2", + "vue-tsc": "^1.8.27" + }, + "license": "MIT", + "repository": { + "type": "git", + "url": "git+https://github.com/makemyownlife/magic-admin-ui" + }, + "homepage": "https://github.com/makemyownlife/magic-admin-ui", + "web-types": "./web-types.json", + "engines": { + "node": ">= 16.0.0", + "pnpm": ">=8.6.0" + } +} diff --git a/marketing-ui/admin-ui/postcss.config.js b/marketing-ui/admin-ui/postcss.config.js new file mode 100644 index 0000000..961986e --- /dev/null +++ b/marketing-ui/admin-ui/postcss.config.js @@ -0,0 +1,5 @@ +module.exports = { + plugins: { + autoprefixer: {} + } +} diff --git a/marketing-ui/admin-ui/prettier.config.js b/marketing-ui/admin-ui/prettier.config.js new file mode 100644 index 0000000..b014bbf --- /dev/null +++ b/marketing-ui/admin-ui/prettier.config.js @@ -0,0 +1,22 @@ +module.exports = { + printWidth: 100, // 每行代码长度(默认80) + tabWidth: 2, // 每个tab相当于多少个空格(默认2)ab进行缩进(默认false) + useTabs: false, // 是否使用tab + semi: false, // 声明结尾使用分号(默认true) + vueIndentScriptAndStyle: false, + singleQuote: true, // 使用单引号(默认false) + quoteProps: 'as-needed', + bracketSpacing: true, // 对象字面量的大括号间使用空格(默认true) + trailingComma: 'none', // 多行使用拖尾逗号(默认none) + jsxSingleQuote: false, + // 箭头函数参数括号 默认avoid 可选 avoid| always + // avoid 能省略括号的时候就省略 例如x => x + // always 总是有括号 + arrowParens: 'always', + insertPragma: false, + requirePragma: false, + proseWrap: 'never', + htmlWhitespaceSensitivity: 'strict', + endOfLine: 'auto', + rangeStart: 0 +} diff --git a/marketing-ui/admin-ui/stylelint.config.js b/marketing-ui/admin-ui/stylelint.config.js new file mode 100644 index 0000000..b336785 --- /dev/null +++ b/marketing-ui/admin-ui/stylelint.config.js @@ -0,0 +1,235 @@ +module.exports = { + root: true, + plugins: ['stylelint-order'], + customSyntax: 'postcss-html', + extends: ['stylelint-config-standard'], + rules: { + 'selector-pseudo-class-no-unknown': [ + true, + { + ignorePseudoClasses: ['global', 'deep'] + } + ], + 'at-rule-no-unknown': [ + true, + { + ignoreAtRules: ['function', 'if', 'each', 'include', 'mixin', 'extend'] + } + ], + 'media-query-no-invalid': null, + 'function-no-unknown': null, + 'no-empty-source': null, + 'named-grid-areas-no-invalid': null, + // 'unicode-bom': 'never', + 'no-descending-specificity': null, + 'font-family-no-missing-generic-family-keyword': null, + // 'declaration-colon-space-after': 'always-single-line', + // 'declaration-colon-space-before': 'never', + // 'declaration-block-trailing-semicolon': null, + 'rule-empty-line-before': [ + 'always', + { + ignore: ['after-comment', 'first-nested'] + } + ], + 'unit-no-unknown': [ + true, + { + ignoreUnits: ['rpx'] + } + ], + 'order/order': [ + [ + 'dollar-variables', + 'custom-properties', + 'at-rules', + 'declarations', + { + type: 'at-rule', + name: 'supports' + }, + { + type: 'at-rule', + name: 'media' + }, + 'rules' + ], + { + severity: 'warning' + } + ], + // Specify the alphabetical order of the attributes in the declaration block + 'order/properties-order': [ + 'position', + 'top', + 'right', + 'bottom', + 'left', + 'z-index', + 'display', + 'float', + 'width', + 'height', + 'max-width', + 'max-height', + 'min-width', + 'min-height', + 'padding', + 'padding-top', + 'padding-right', + 'padding-bottom', + 'padding-left', + 'margin', + 'margin-top', + 'margin-right', + 'margin-bottom', + 'margin-left', + 'margin-collapse', + 'margin-top-collapse', + 'margin-right-collapse', + 'margin-bottom-collapse', + 'margin-left-collapse', + 'overflow', + 'overflow-x', + 'overflow-y', + 'clip', + 'clear', + 'font', + 'font-family', + 'font-size', + 'font-smoothing', + 'osx-font-smoothing', + 'font-style', + 'font-weight', + 'hyphens', + 'src', + 'line-height', + 'letter-spacing', + 'word-spacing', + 'color', + 'text-align', + 'text-decoration', + 'text-indent', + 'text-overflow', + 'text-rendering', + 'text-size-adjust', + 'text-shadow', + 'text-transform', + 'word-break', + 'word-wrap', + 'white-space', + 'vertical-align', + 'list-style', + 'list-style-type', + 'list-style-position', + 'list-style-image', + 'pointer-events', + 'cursor', + 'background', + 'background-attachment', + 'background-color', + 'background-image', + 'background-position', + 'background-repeat', + 'background-size', + 'border', + 'border-collapse', + 'border-top', + 'border-right', + 'border-bottom', + 'border-left', + 'border-color', + 'border-image', + 'border-top-color', + 'border-right-color', + 'border-bottom-color', + 'border-left-color', + 'border-spacing', + 'border-style', + 'border-top-style', + 'border-right-style', + 'border-bottom-style', + 'border-left-style', + 'border-width', + 'border-top-width', + 'border-right-width', + 'border-bottom-width', + 'border-left-width', + 'border-radius', + 'border-top-right-radius', + 'border-bottom-right-radius', + 'border-bottom-left-radius', + 'border-top-left-radius', + 'border-radius-topright', + 'border-radius-bottomright', + 'border-radius-bottomleft', + 'border-radius-topleft', + 'content', + 'quotes', + 'outline', + 'outline-offset', + 'opacity', + 'filter', + 'visibility', + 'size', + 'zoom', + 'transform', + 'box-align', + 'box-flex', + 'box-orient', + 'box-pack', + 'box-shadow', + 'box-sizing', + 'table-layout', + 'animation', + 'animation-delay', + 'animation-duration', + 'animation-iteration-count', + 'animation-name', + 'animation-play-state', + 'animation-timing-function', + 'animation-fill-mode', + 'transition', + 'transition-delay', + 'transition-duration', + 'transition-property', + 'transition-timing-function', + 'background-clip', + 'backface-visibility', + 'resize', + 'appearance', + 'user-select', + 'interpolation-mode', + 'direction', + 'marks', + 'page', + 'set-link-source', + 'unicode-bidi', + 'speak' + ] + }, + ignoreFiles: ['**/*.js', '**/*.jsx', '**/*.tsx', '**/*.ts'], + overrides: [ + { + files: ['*.vue', '**/*.vue', '*.html', '**/*.html'], + extends: ['stylelint-config-recommended', 'stylelint-config-html'], + rules: { + 'keyframes-name-pattern': null, + 'selector-class-pattern': null, + 'no-duplicate-selectors': null, + 'selector-pseudo-class-no-unknown': [ + true, + { + ignorePseudoClasses: ['deep', 'global'] + } + ], + 'selector-pseudo-element-no-unknown': [ + true, + { + ignorePseudoElements: ['v-deep', 'v-global', 'v-slotted'] + } + ] + } + } + ] +} diff --git a/marketing-ui/admin-ui/tsconfig.json b/marketing-ui/admin-ui/tsconfig.json new file mode 100644 index 0000000..38376ef --- /dev/null +++ b/marketing-ui/admin-ui/tsconfig.json @@ -0,0 +1,43 @@ +{ + "compilerOptions": { + "target": "esnext", + "useDefineForClassFields": true, + "module": "esnext", + "moduleResolution": "node", + "strict": true, + "jsx": "preserve", + "sourceMap": true, + "resolveJsonModule": true, + "esModuleInterop": true, + "lib": ["esnext", "dom"], + "baseUrl": "./", + "allowJs": true, + "forceConsistentCasingInFileNames": true, + "allowSyntheticDefaultImports": true, + "strictFunctionTypes": false, + "noUnusedLocals": true, + "noUnusedParameters": true, + "experimentalDecorators": true, + "noImplicitAny": false, + "skipLibCheck": true, + "paths": { + "@/*": ["src/*"] + }, + "types": [ + // "@intlify/unplugin-vue-i18n/types", + "vite/client" + // "element-plus/global", + // "@types/qrcode", + // "vite-plugin-svg-icons/client" + ], + "outDir": "target", // 请保留这个属性,防止tsconfig.json文件报错 + "typeRoots": ["./node_modules/@types/", "./types"] + }, + "include": [ + "src", + "types/**/*.d.ts", + "src/types/auto-imports.d.ts", + "src/types/auto-components.d.ts" + ], + "exclude": ["dist", "target", "node_modules"] +} diff --git a/marketing-ui/admin-ui/uno.config.ts b/marketing-ui/admin-ui/uno.config.ts new file mode 100644 index 0000000..e52457a --- /dev/null +++ b/marketing-ui/admin-ui/uno.config.ts @@ -0,0 +1,108 @@ +import { defineConfig, toEscapedSelector as e, presetUno } from 'unocss' +// import transformerVariantGroup from '@unocss/transformer-variant-group' + +export default defineConfig({ + // ...UnoCSS options + rules: [ + [ + /^custom-hover$/, + ([], { rawSelector }) => { + const selector = e(rawSelector) + return ` +${selector} { + display: flex; + height: 100%; + padding: 0 10px; + cursor: pointer; + align-items: center; + transition: background var(--transition-time-02); +} +/* you can have multiple rules */ +${selector}:hover { + background-color: var(--top-header-hover-color); +} +.dark ${selector}:hover { + background-color: var(--el-bg-color-overlay); +} +` + } + ], + [ + /^layout-border__left$/, + ([], { rawSelector }) => { + const selector = e(rawSelector) + return ` +${selector}:before { + content: ""; + position: absolute; + top: 0; + left: 0; + width: 1px; + height: 100%; + background-color: var(--el-border-color); + z-index: 3; +} +` + } + ], + [ + /^layout-border__right$/, + ([], { rawSelector }) => { + const selector = e(rawSelector) + return ` +${selector}:after { + content: ""; + position: absolute; + top: 0; + right: 0; + width: 1px; + height: 100%; + background-color: var(--el-border-color); + z-index: 3; +} +` + } + ], + [ + /^layout-border__top$/, + ([], { rawSelector }) => { + const selector = e(rawSelector) + return ` +${selector}:before { + content: ""; + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 1px; + background-color: var(--el-border-color); + z-index: 3; +} +` + } + ], + [ + /^layout-border__bottom$/, + ([], { rawSelector }) => { + const selector = e(rawSelector) + return ` +${selector}:after { + content: ""; + position: absolute; + bottom: 0; + left: 0; + width: 100%; + height: 1px; + background-color: var(--el-border-color); + z-index: 3; +} +` + } + ] + ], + presets: [presetUno({ dark: 'class', attributify: false })], + // transformers: [transformerVariantGroup()], + shortcuts: { + 'wh-full': 'w-full h-full' + } +}) diff --git a/marketing-ui/admin-ui/vite.config.ts b/marketing-ui/admin-ui/vite.config.ts new file mode 100644 index 0000000..6c2432e --- /dev/null +++ b/marketing-ui/admin-ui/vite.config.ts @@ -0,0 +1,86 @@ +import {resolve} from 'path' +import type {ConfigEnv, UserConfig} from 'vite' +import {loadEnv} from 'vite' +import {createVitePlugins} from './build/vite' +import {exclude, include} from "./build/vite/optimize" +// 当前执行node命令时文件夹的地址(工作目录) +const root = process.cwd() + +// 路径查找 +function pathResolve(dir: string) { + return resolve(root, '.', dir) +} + +// https://vitejs.dev/config/ +export default ({command, mode}: ConfigEnv): UserConfig => { + let env = {} as any + const isBuild = command === 'build' + if (!isBuild) { + env = loadEnv((process.argv[3] === '--mode' ? process.argv[4] : process.argv[3]), root) + } else { + env = loadEnv(mode, root) + } + return { + base: env.VITE_BASE_PATH, + root: root, + // 服务端渲染 + server: { + port: env.VITE_PORT, // 端口号 + host: "0.0.0.0", + open: env.VITE_OPEN === 'true', + // 本地跨域代理. 目前注释的原因:暂时没有用途,server 端已经支持跨域 + // proxy: { + // ['/api']: { + // target: env.VITE_BASE_URL, + // ws: false, + // changeOrigin: true, + // rewrite: (path) => path.replace(new RegExp(`^/api`), ''), + // }, + // }, + }, + // 项目使用的vite插件。 单独提取到build/vite/plugin中管理 + plugins: createVitePlugins(), + css: { + preprocessorOptions: { + scss: { + additionalData: '@use "@/styles/variables.scss" as *;', + javascriptEnabled: true, + silenceDeprecations: ["legacy-js-api"], // 参考自 https://stackoverflow.com/questions/78997907/the-legacy-js-api-is-deprecated-and-will-be-removed-in-dart-sass-2-0-0 + } + } + }, + resolve: { + extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.scss', '.css'], + alias: [ + { + find: 'vue-i18n', + replacement: 'vue-i18n/dist/vue-i18n.cjs.js' + }, + { + find: /\@\//, + replacement: `${pathResolve('src')}/` + } + ] + }, + build: { + minify: 'terser', + outDir: env.VITE_OUT_DIR || 'dist', + sourcemap: env.VITE_SOURCEMAP === 'true' ? 'inline' : false, + // brotliSize: false, + terserOptions: { + compress: { + drop_debugger: env.VITE_DROP_DEBUGGER === 'true', + drop_console: env.VITE_DROP_CONSOLE === 'true' + } + }, + rollupOptions: { + output: { + manualChunks: { + echarts: ['echarts'] // 将 echarts 单独打包,参考 https://gitee.com/yudaocode/yudao-ui-admin-vue3/issues/IAB1SX 讨论 + } + }, + }, + }, + optimizeDeps: {include, exclude} + } +} diff --git a/marketing-ui/admin-ui/web-types.json b/marketing-ui/admin-ui/web-types.json new file mode 100644 index 0000000..602f212 --- /dev/null +++ b/marketing-ui/admin-ui/web-types.json @@ -0,0 +1,19 @@ +{ + "$schema": "https://json.schemastore.org/web-types", + "framework": "vue", + "name": "name written in package.json", + "version": "version written in package.json", + "contributions": { + "html": { + "types-syntax": "typescript", + "attributes": [ + { + "name": "v-hasPermi" + }, + { + "name": "v-hasRole" + } + ] + } + } +} diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..0c76c24 --- /dev/null +++ b/pom.xml @@ -0,0 +1,183 @@ + + + + 4.0.0 + com.platform + marketing-admin-all + ${revision} + pom + + + + marketing-dependencies + + marketing-framework + + marketing-client-sdk + + marketing-admin-server + + + marketing-module-system + + marketing-module-infra + + marketing-module-channel + + marketing-module-record + + marketing-module-gateway + + marketing-module-worker + + marketing-module-tenant + + + + ${project.artifactId} + marketing-admin基础脚手架 + + https://github.com/makemyownlife/marketing-admin + + + 0.0.1-jdk8-SNAPSHOT + + 1.8 + ${java.version} + ${java.version} + 3.0.0-M5 + 3.13.0 + 1.6.0 + + 1.18.36 + 2.7.18 + 1.6.3 + UTF-8 + + + + + + + + com.platform + marketing-dependencies + ${revision} + pom + import + + + + + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + ${maven-surefire-plugin.version} + + + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven-compiler-plugin.version} + + + + org.springframework.boot + spring-boot-configuration-processor + ${spring.boot.version} + + + org.projectlombok + lombok + ${lombok.version} + + + org.mapstruct + mapstruct-processor + ${mapstruct.version} + + + + + + org.codehaus.mojo + flatten-maven-plugin + + + + + + + + org.codehaus.mojo + flatten-maven-plugin + ${flatten-maven-plugin.version} + + oss + true + + + + + flatten + + flatten + process-resources + + + + clean + + flatten.clean + clean + + + + + + + + + + + huaweicloud + huawei + https://mirrors.huaweicloud.com/repository/maven/ + + + + aliyunmaven + aliyun + https://maven.aliyun.com/repository/public + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + false + + + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + false + + + + + +