Commit 315aa30c by 赵剑炜

版本V2

parents
/jyzb-process/target
/jyzb-api/target/
/jyzb-biz/target/
##ignore this file##
/target/
.classpath
.project
/.settings/
##filter databfile、sln file##
*.mdb
*.ldb
*.sln
##class file##
*.com
*.class
*.dll
*.exe
*.o
*.so
# compression file
*.7z
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.zip
*.via
*.tmp
*.err
# OS generated files #
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
Icon?
ehthumbs.db
Thumbs.db
/*/target/*
/.idea/misc.xml
<<<<<<< HEAD
/jyzb-process/target
/jyzb-api/target/
/jyzb-biz/target/
##ignore this file##
/target/
.classpath
.project
/.settings/
##filter databfile、sln file##
*.mdb
*.ldb
*.sln
##class file##
*.com
*.class
*.dll
*.exe
*.o
*.so
# compression file
*.7z
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.zip
*.via
*.tmp
*.err
# OS generated files #
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
Icon?
ehthumbs.db
Thumbs.db
/*/target/*
=======
/jyzb-boot/target
>>>>>>> develop
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
# Zeppelin ignored files
/ZeppelinRemoteNotebooks/
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="MyBatisCodeHelperDatasource">
<option name="projectProfile">
<ProjectProfile>
<option name="addSerializeUid" value="true" />
<option name="deleteByPrimayKeyEnabled" value="false" />
<option name="generateService" value="true" />
<option name="generateServiceInterface" value="true" />
<option name="insertMethodEnabled" value="false" />
<option name="insertSelectiveMethodEnabled" value="false" />
<option name="javaMapperPackage" value="com.junmp.jyzb.mapper" />
<option name="javaMapperPath" value="$PROJECT_DIR$/jyzb-biz/src/main/java" />
<option name="javaModelPackage" value="com.junmp.jyzb.domain" />
<option name="javaModelPath" value="$PROJECT_DIR$/jyzb-biz/src/main/java" />
<option name="lastDatabaseCrudChooseModuleName" value="jyzb-biz" />
<option name="lombokAllArgConstructor" value="true" />
<option name="lombokDataAnnotation" value="true" />
<option name="lombokNoArgsConstructor" value="true" />
<option name="mapperAnnotaion" value="true" />
<option name="modelAddToString" value="true" />
<option name="moduleNameToPackageAndPathMap">
<map>
<entry key="jyzb-api">
<value>
<UserPackageAndPathInfoByModule>
<option name="javaMapperPackage" value="com.junmp.jyzb.mapper" />
<option name="javaMapperPath" value="D:\java-project\jyzb\jyzb-platform\jyzb-biz\src\main\java" />
<option name="javaModelPacakge" value="com.junmp.jyzb.domain" />
<option name="javaModelPath" value="D:\java-project\jyzb\jyzb-platform\jyzb-biz\src\main\java" />
<option name="javaServiceInterfacePackage" value="com.junmp.jyzb.service" />
<option name="javaServiceInterfacePath" value="D:\java-project\jyzb\jyzb-platform\jyzb-biz\src\main\java\com\junmp\jyzb" />
<option name="javaServicePackage" value="com.junmp.jyzb.service.impl" />
<option name="javaServicePath" value="D:\java-project\jyzb\jyzb-platform\jyzb-biz\src\main\java\com\junmp\jyzb" />
<option name="xmlPackage" value="mapper" />
<option name="xmlPath" value="D:\java-project\jyzb\jyzb-platform\jyzb-biz\src\main\resources" />
</UserPackageAndPathInfoByModule>
</value>
</entry>
<entry key="jyzb-biz">
<value>
<UserPackageAndPathInfoByModule>
<option name="javaMapperPackage" value="com.junmp.jyzb.mapper" />
<option name="javaMapperPath" value="$PROJECT_DIR$/jyzb-biz/src/main/java" />
<option name="javaModelPacakge" value="com.junmp.jyzb.domain" />
<option name="javaModelPath" value="$PROJECT_DIR$/jyzb-biz/src/main/java" />
<option name="javaServiceInterfacePackage" value="com.junmp.jyzb.service" />
<option name="javaServiceInterfacePath" value="$PROJECT_DIR$/jyzb-biz/src/main/java" />
<option name="javaServicePackage" value="com.junmp.jyzb.service.impl" />
<option name="javaServicePath" value="$PROJECT_DIR$/jyzb-biz/src/main/java" />
<option name="xmlPackage" value="mapper" />
<option name="xmlPath" value="$PROJECT_DIR$/jyzb-biz/src/main/resources" />
</UserPackageAndPathInfoByModule>
</value>
</entry>
</map>
</option>
<option name="mybatisPlusStaticField" value="false" />
<option name="p3CComment" value="true" />
<option name="removeTablePreName" value="base_;" />
<option name="selectByPrimaryKeyEnabled" value="false" />
<option name="tableGenerateConfigs">
<map>
<entry key="db_jyzb:base_cabinet">
<value>
<TableGenerateConfig>
<option name="deleteByPrimayKeyEnabled" value="false" />
<option name="insertMethodEnabled" value="false" />
<option name="insertSelectiveMethodEnabled" value="false" />
<option name="javaModelName" value="Cabinet" />
<option name="moduleName" value="jyzb-api" />
<option name="selectByPrimaryKeyEnabled" value="false" />
<option name="updateByPrimaryKeySelectiveEnabled" value="false" />
<option name="updateByPrimaykeyEnabled" value="false" />
<option name="useActualColumnName" value="false" />
</TableGenerateConfig>
</value>
</entry>
<entry key="db_jyzb:base_cabinet_box">
<value>
<TableGenerateConfig>
<option name="deleteByPrimayKeyEnabled" value="false" />
<option name="generatedKey" value="" />
<option name="insertMethodEnabled" value="false" />
<option name="insertSelectiveMethodEnabled" value="false" />
<option name="javaModelName" value="CabinetBox" />
<option name="moduleName" value="jyzb-api" />
<option name="selectByPrimaryKeyEnabled" value="false" />
<option name="sequenceColumn" value="" />
<option name="sequenceId" value="" />
<option name="updateByPrimaryKeySelectiveEnabled" value="false" />
<option name="updateByPrimaykeyEnabled" value="false" />
<option name="useActualColumnName" value="false" />
</TableGenerateConfig>
</value>
</entry>
<entry key="db_jyzb:base_equipment_size">
<value>
<TableGenerateConfig>
<option name="deleteByPrimayKeyEnabled" value="false" />
<option name="insertMethodEnabled" value="false" />
<option name="insertSelectiveMethodEnabled" value="false" />
<option name="javaModelName" value="EquipmentSize" />
<option name="moduleName" value="jyzb-api" />
<option name="selectByPrimaryKeyEnabled" value="false" />
<option name="updateByPrimaryKeySelectiveEnabled" value="false" />
<option name="updateByPrimaykeyEnabled" value="false" />
<option name="useActualColumnName" value="false" />
</TableGenerateConfig>
</value>
</entry>
<entry key="db_jyzb:base_equipment_type">
<value>
<TableGenerateConfig>
<option name="deleteByPrimayKeyEnabled" value="false" />
<option name="insertMethodEnabled" value="false" />
<option name="insertSelectiveMethodEnabled" value="false" />
<option name="javaModelName" value="EquipmentType" />
<option name="moduleName" value="jyzb-api" />
<option name="selectByPrimaryKeyEnabled" value="false" />
<option name="updateByPrimaryKeySelectiveEnabled" value="false" />
<option name="updateByPrimaykeyEnabled" value="false" />
<option name="useActualColumnName" value="false" />
</TableGenerateConfig>
</value>
</entry>
<entry key="db_jyzb:base_history">
<value>
<TableGenerateConfig>
<option name="deleteByPrimayKeyEnabled" value="false" />
<option name="insertMethodEnabled" value="false" />
<option name="insertSelectiveMethodEnabled" value="false" />
<option name="javaModelName" value="History" />
<option name="moduleName" value="jyzb-api" />
<option name="selectByPrimaryKeyEnabled" value="false" />
<option name="updateByPrimaryKeySelectiveEnabled" value="false" />
<option name="updateByPrimaykeyEnabled" value="false" />
<option name="useActualColumnName" value="false" />
</TableGenerateConfig>
</value>
</entry>
<entry key="db_jyzb:base_inventory">
<value>
<TableGenerateConfig>
<option name="deleteByPrimayKeyEnabled" value="false" />
<option name="insertMethodEnabled" value="false" />
<option name="insertSelectiveMethodEnabled" value="false" />
<option name="javaModelName" value="Inventory" />
<option name="moduleName" value="jyzb-api" />
<option name="selectByPrimaryKeyEnabled" value="false" />
<option name="updateByPrimaryKeySelectiveEnabled" value="false" />
<option name="updateByPrimaykeyEnabled" value="false" />
<option name="useActualColumnName" value="false" />
</TableGenerateConfig>
</value>
</entry>
<entry key="db_jyzb:base_inventory_summary">
<value>
<TableGenerateConfig>
<option name="deleteByPrimayKeyEnabled" value="false" />
<option name="insertMethodEnabled" value="false" />
<option name="insertSelectiveMethodEnabled" value="false" />
<option name="javaModelName" value="InventorySummary" />
<option name="moduleName" value="jyzb-api" />
<option name="selectByPrimaryKeyEnabled" value="false" />
<option name="updateByPrimaryKeySelectiveEnabled" value="false" />
<option name="updateByPrimaykeyEnabled" value="false" />
<option name="useActualColumnName" value="false" />
</TableGenerateConfig>
</value>
</entry>
<entry key="db_jyzb:base_log_detail">
<value>
<TableGenerateConfig>
<option name="deleteByPrimayKeyEnabled" value="false" />
<option name="generatedKey" value="id" />
<option name="insertMethodEnabled" value="false" />
<option name="insertSelectiveMethodEnabled" value="false" />
<option name="javaModelName" value="LogDetail" />
<option name="moduleName" value="jyzb-api" />
<option name="selectByPrimaryKeyEnabled" value="false" />
<option name="updateByPrimaryKeySelectiveEnabled" value="false" />
<option name="updateByPrimaykeyEnabled" value="false" />
<option name="useActualColumnName" value="false" />
</TableGenerateConfig>
</value>
</entry>
<entry key="db_jyzb:base_log_summary">
<value>
<TableGenerateConfig>
<option name="deleteByPrimayKeyEnabled" value="false" />
<option name="generatedKey" value="id" />
<option name="insertMethodEnabled" value="false" />
<option name="insertSelectiveMethodEnabled" value="false" />
<option name="javaModelName" value="LogSummary" />
<option name="moduleName" value="jyzb-api" />
<option name="selectByPrimaryKeyEnabled" value="false" />
<option name="updateByPrimaryKeySelectiveEnabled" value="false" />
<option name="updateByPrimaykeyEnabled" value="false" />
<option name="useActualColumnName" value="false" />
</TableGenerateConfig>
</value>
</entry>
<entry key="db_jyzb:base_organization">
<value>
<TableGenerateConfig>
<option name="deleteByPrimayKeyEnabled" value="false" />
<option name="insertMethodEnabled" value="false" />
<option name="insertSelectiveMethodEnabled" value="false" />
<option name="javaModelName" value="Organization" />
<option name="moduleName" value="jyzb-api" />
<option name="selectByPrimaryKeyEnabled" value="false" />
<option name="updateByPrimaryKeySelectiveEnabled" value="false" />
<option name="updateByPrimaykeyEnabled" value="false" />
<option name="useActualColumnName" value="false" />
</TableGenerateConfig>
</value>
</entry>
<entry key="db_jyzb:base_package">
<value>
<TableGenerateConfig>
<option name="deleteByPrimayKeyEnabled" value="false" />
<option name="insertMethodEnabled" value="false" />
<option name="insertSelectiveMethodEnabled" value="false" />
<option name="javaModelName" value="Package" />
<option name="moduleName" value="jyzb-api" />
<option name="selectByPrimaryKeyEnabled" value="false" />
<option name="updateByPrimaryKeySelectiveEnabled" value="false" />
<option name="updateByPrimaykeyEnabled" value="false" />
<option name="useActualColumnName" value="false" />
</TableGenerateConfig>
</value>
</entry>
<entry key="db_jyzb:base_package_information">
<value>
<TableGenerateConfig>
<option name="deleteByPrimayKeyEnabled" value="false" />
<option name="insertMethodEnabled" value="false" />
<option name="insertSelectiveMethodEnabled" value="false" />
<option name="javaModelName" value="PackageInformation" />
<option name="moduleName" value="jyzb-api" />
<option name="selectByPrimaryKeyEnabled" value="false" />
<option name="updateByPrimaryKeySelectiveEnabled" value="false" />
<option name="updateByPrimaykeyEnabled" value="false" />
<option name="useActualColumnName" value="false" />
</TableGenerateConfig>
</value>
</entry>
<entry key="db_jyzb:base_police_finger">
<value>
<TableGenerateConfig>
<option name="deleteByPrimayKeyEnabled" value="false" />
<option name="insertMethodEnabled" value="false" />
<option name="insertSelectiveMethodEnabled" value="false" />
<option name="javaModelName" value="PoliceFinger" />
<option name="moduleName" value="jyzb-api" />
<option name="selectByPrimaryKeyEnabled" value="false" />
<option name="updateByPrimaryKeySelectiveEnabled" value="false" />
<option name="updateByPrimaykeyEnabled" value="false" />
<option name="useActualColumnName" value="false" />
</TableGenerateConfig>
</value>
</entry>
<entry key="db_jyzb:base_policeman">
<value>
<TableGenerateConfig>
<option name="javaModelName" value="Policeman" />
<option name="moduleName" value="jyzb-api" />
<option name="useActualColumnName" value="false" />
</TableGenerateConfig>
</value>
</entry>
<entry key="db_jyzb:base_shelf">
<value>
<TableGenerateConfig>
<option name="deleteByPrimayKeyEnabled" value="false" />
<option name="insertMethodEnabled" value="false" />
<option name="insertSelectiveMethodEnabled" value="false" />
<option name="javaModelName" value="Shelf" />
<option name="moduleName" value="jyzb-biz" />
<option name="selectByPrimaryKeyEnabled" value="false" />
<option name="updateByPrimaryKeySelectiveEnabled" value="false" />
<option name="updateByPrimaykeyEnabled" value="false" />
<option name="useActualColumnName" value="false" />
</TableGenerateConfig>
</value>
</entry>
<entry key="db_jyzb:base_supplier">
<value>
<TableGenerateConfig>
<option name="deleteByPrimayKeyEnabled" value="false" />
<option name="insertMethodEnabled" value="false" />
<option name="insertSelectiveMethodEnabled" value="false" />
<option name="javaModelName" value="Supplier" />
<option name="moduleName" value="jyzb-api" />
<option name="selectByPrimaryKeyEnabled" value="false" />
<option name="updateByPrimaryKeySelectiveEnabled" value="false" />
<option name="updateByPrimaykeyEnabled" value="false" />
<option name="useActualColumnName" value="false" />
</TableGenerateConfig>
</value>
</entry>
<entry key="db_jyzb:base_supplier_equipment">
<value>
<TableGenerateConfig>
<option name="deleteByPrimayKeyEnabled" value="false" />
<option name="insertMethodEnabled" value="false" />
<option name="insertSelectiveMethodEnabled" value="false" />
<option name="javaModelName" value="SupplierEquipment" />
<option name="moduleName" value="jyzb-api" />
<option name="selectByPrimaryKeyEnabled" value="false" />
<option name="updateByPrimaryKeySelectiveEnabled" value="false" />
<option name="updateByPrimaykeyEnabled" value="false" />
<option name="useActualColumnName" value="false" />
</TableGenerateConfig>
</value>
</entry>
<entry key="db_jyzb:base_supplier_type">
<value>
<TableGenerateConfig>
<option name="deleteByPrimayKeyEnabled" value="false" />
<option name="insertMethodEnabled" value="false" />
<option name="insertSelectiveMethodEnabled" value="false" />
<option name="javaModelName" value="SupplierType" />
<option name="moduleName" value="jyzb-biz" />
<option name="selectByPrimaryKeyEnabled" value="false" />
<option name="updateByPrimaryKeySelectiveEnabled" value="false" />
<option name="updateByPrimaykeyEnabled" value="false" />
<option name="useActualColumnName" value="false" />
</TableGenerateConfig>
</value>
</entry>
<entry key="db_jyzb:base_warehouse">
<value>
<TableGenerateConfig>
<option name="deleteByPrimayKeyEnabled" value="false" />
<option name="insertMethodEnabled" value="false" />
<option name="insertSelectiveMethodEnabled" value="false" />
<option name="javaModelName" value="Warehouse" />
<option name="moduleName" value="jyzb-api" />
<option name="selectByPrimaryKeyEnabled" value="false" />
<option name="updateByPrimaryKeySelectiveEnabled" value="false" />
<option name="updateByPrimaykeyEnabled" value="false" />
<option name="useActualColumnName" value="false" />
</TableGenerateConfig>
</value>
</entry>
<entry key="db_jyzb:base_warehouse_area">
<value>
<TableGenerateConfig>
<option name="deleteByPrimayKeyEnabled" value="false" />
<option name="insertMethodEnabled" value="false" />
<option name="insertSelectiveMethodEnabled" value="false" />
<option name="javaModelName" value="WarehouseArea" />
<option name="moduleName" value="jyzb-biz" />
<option name="selectByPrimaryKeyEnabled" value="false" />
<option name="updateByPrimaryKeySelectiveEnabled" value="false" />
<option name="updateByPrimaykeyEnabled" value="false" />
<option name="useActualColumnName" value="false" />
</TableGenerateConfig>
</value>
</entry>
<entry key="db_jyzb:base_year_report">
<value>
<TableGenerateConfig>
<option name="deleteByPrimayKeyEnabled" value="false" />
<option name="insertMethodEnabled" value="false" />
<option name="insertSelectiveMethodEnabled" value="false" />
<option name="javaModelName" value="YearReport" />
<option name="moduleName" value="jyzb-api" />
<option name="selectByPrimaryKeyEnabled" value="false" />
<option name="updateByPrimaryKeySelectiveEnabled" value="false" />
<option name="updateByPrimaykeyEnabled" value="false" />
<option name="useActualColumnName" value="false" />
</TableGenerateConfig>
</value>
</entry>
<entry key="db_jyzb:pub_org">
<value>
<TableGenerateConfig>
<option name="deleteByPrimayKeyEnabled" value="false" />
<option name="generatedKey" value="org_id" />
<option name="insertMethodEnabled" value="false" />
<option name="insertSelectiveMethodEnabled" value="false" />
<option name="javaModelName" value="PubOrg" />
<option name="moduleName" value="jyzb-biz" />
<option name="selectByPrimaryKeyEnabled" value="false" />
<option name="updateByPrimaryKeySelectiveEnabled" value="false" />
<option name="updateByPrimaykeyEnabled" value="false" />
<option name="useActualColumnName" value="false" />
</TableGenerateConfig>
</value>
</entry>
</map>
</option>
<option name="updateByPrimaryKeySelectiveEnabled" value="false" />
<option name="updateByPrimaykeyEnabled" value="false" />
<option name="useSwagger" value="true" />
<option name="xmlMapperPackage" value="mapper" />
<option name="xmlMapperPath" value="$PROJECT_DIR$/jyzb-biz/src/main/resources" />
</ProjectProfile>
</option>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<annotationProcessing>
<profile default="true" name="Default" enabled="true" />
<profile name="Maven default annotation processors profile" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<module name="jyzb-common" />
<module name="jyzb-process" />
<module name="jyzb-api" />
<module name="jyzb-biz" />
<module name="jyzb-boot" />
</profile>
</annotationProcessing>
<bytecodeTargetLevel target="9" />
</component>
<component name="JavacSettings">
<option name="ADDITIONAL_OPTIONS_OVERRIDE">
<module name="junmp-jyzb-app" options="-parameters" />
<module name="jyzb-api" options="-parameters" />
<module name="jyzb-biz" options="-parameters" />
<module name="jyzb-boot" options="-parameters" />
<module name="jyzb-common" options="-parameters" />
<module name="jyzb-process" options="-parameters" />
</option>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
<data-source source="LOCAL" name="jdbc:mysql://192.168.3.128:3306/db_jyzb?characterEncoding=UTF-8&amp;useUnicode=true&amp;useSSL=false&amp;tinyInt1isBit=false&amp;allowPublicKeyRetrieval=true&amp;serverTimezone=Asia/Shanghai" uuid="ce8e9dd8-fc56-41f7-9a8b-6cbd906018c3">
<driver-ref>mysql.8</driver-ref>
<synchronize>true</synchronize>
<jdbc-driver>com.mysql.cj.jdbc.Driver</jdbc-driver>
<jdbc-url>jdbc:mysql://192.168.3.128:3306/db_jyzb?characterEncoding=UTF-8&amp;useUnicode=true&amp;useSSL=false&amp;tinyInt1isBit=false&amp;allowPublicKeyRetrieval=true&amp;serverTimezone=Asia/Shanghai</jdbc-url>
</data-source>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$/jyzb-api/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/jyzb-api/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/jyzb-biz/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/jyzb-biz/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/jyzb-boot/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/jyzb-boot/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/jyzb-common/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/jyzb-common/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/jyzb-process/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/jyzb-process/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
</component>
</project>
\ No newline at end of file
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="DuplicatedCode" enabled="true" level="WEAK WARNING" enabled_by_default="true">
<Languages>
<language minSize="196" name="Java" />
</Languages>
</inspection_tool>
</profile>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="aliyun" />
<option name="name" value="aliyun" />
<option name="url" value="http://maven.aliyun.com/nexus/content/groups/public/" />
</remote-repository>
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Central Repository" />
<option name="url" value="https://repo.maven.apache.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="junmp-public" />
<option name="name" value="junmp-public" />
<option name="url" value="http://maven.sothing.top/repository/junmp-public/" />
</remote-repository>
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
<remote-repository>
<option name="id" value="oss" />
<option name="name" value="oss" />
<option name="url" value="https://oss.sonatype.org/content/groups/public" />
</remote-repository>
<remote-repository>
<option name="id" value="spring-milestones" />
<option name="name" value="Spring Milestones" />
<option name="url" value="https://repo.spring.io/libs-milestone" />
</remote-repository>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4" />
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Palette2">
<group name="Swing">
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
</item>
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
</item>
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.svg" removable="false" auto-create-binding="false" can-attach-label="true">
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
</item>
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
<initial-values>
<property name="text" value="Button" />
</initial-values>
</item>
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="RadioButton" />
</initial-values>
</item>
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="CheckBox" />
</initial-values>
</item>
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
<initial-values>
<property name="text" value="Label" />
</initial-values>
</item>
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
</item>
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
</item>
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
<preferred-size width="-1" height="20" />
</default-constraints>
</item>
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
</item>
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
</item>
</group>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>
\ No newline at end of file
2023-05-29 10:13:15.461 ERROR 17468 --- [main] o.s.boot.SpringApplication : Application run failed
com.junmp.v2.config.api.exception.ConfigException: 获取不到application.yml中的数据库配置,无法从数据库加载系统配置表
at com.junmp.v2.config.listener.ConfigInitListener.eventCallback(ConfigInitListener.java:73)
at com.junmp.v2.common.listener.ContextInitializedListener.onApplicationEvent(ContextInitializedListener.java:30)
at com.junmp.v2.common.listener.ContextInitializedListener.onApplicationEvent(ContextInitializedListener.java:20)
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:176)
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:169)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:143)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:131)
at org.springframework.boot.context.event.EventPublishingRunListener.contextPrepared(EventPublishingRunListener.java:89)
at org.springframework.boot.SpringApplicationRunListeners.lambda$contextPrepared$3(SpringApplicationRunListeners.java:67)
at java.util.ArrayList.forEach(ArrayList.java:1259)
at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:117)
at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:111)
at org.springframework.boot.SpringApplicationRunListeners.contextPrepared(SpringApplicationRunListeners.java:67)
at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:391)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:325)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1313)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1302)
at com.junmp.jyzb.boot.JyzbBootApplication.main(JyzbBootApplication.java:33)
2023-05-29 10:13:34.808 ERROR 21460 --- [main] o.s.boot.SpringApplication : Application run failed
com.junmp.v2.config.api.exception.ConfigException: 获取不到application.yml中的数据库配置,无法从数据库加载系统配置表
at com.junmp.v2.config.listener.ConfigInitListener.eventCallback(ConfigInitListener.java:73)
at com.junmp.v2.common.listener.ContextInitializedListener.onApplicationEvent(ContextInitializedListener.java:30)
at com.junmp.v2.common.listener.ContextInitializedListener.onApplicationEvent(ContextInitializedListener.java:20)
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:176)
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:169)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:143)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:131)
at org.springframework.boot.context.event.EventPublishingRunListener.contextPrepared(EventPublishingRunListener.java:89)
at org.springframework.boot.SpringApplicationRunListeners.lambda$contextPrepared$3(SpringApplicationRunListeners.java:67)
at java.util.ArrayList.forEach(ArrayList.java:1259)
at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:117)
at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:111)
at org.springframework.boot.SpringApplicationRunListeners.contextPrepared(SpringApplicationRunListeners.java:67)
at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:391)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:325)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1313)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1302)
at com.junmp.jyzb.boot.JyzbBootApplication.main(JyzbBootApplication.java:33)
2023-05-29 10:13:15.062 INFO 17468 --- [main] c.j.v.c.listener.ConfigInitListener : 当前数据库驱动类>>>null
2023-05-29 10:13:15.069 WARN 17468 --- [main] o.s.b.c.config.ConfigDataEnvironment : Property 'spring.profiles' imported from location 'class path resource [application.yml]' is invalid and should be replaced with 'spring.config.activate.on-profile' [origin: class path resource [application.yml] - 10:12]
2023-05-29 10:13:15.461 ERROR 17468 --- [main] o.s.boot.SpringApplication : Application run failed
com.junmp.v2.config.api.exception.ConfigException: 获取不到application.yml中的数据库配置,无法从数据库加载系统配置表
at com.junmp.v2.config.listener.ConfigInitListener.eventCallback(ConfigInitListener.java:73)
at com.junmp.v2.common.listener.ContextInitializedListener.onApplicationEvent(ContextInitializedListener.java:30)
at com.junmp.v2.common.listener.ContextInitializedListener.onApplicationEvent(ContextInitializedListener.java:20)
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:176)
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:169)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:143)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:131)
at org.springframework.boot.context.event.EventPublishingRunListener.contextPrepared(EventPublishingRunListener.java:89)
at org.springframework.boot.SpringApplicationRunListeners.lambda$contextPrepared$3(SpringApplicationRunListeners.java:67)
at java.util.ArrayList.forEach(ArrayList.java:1259)
at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:117)
at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:111)
at org.springframework.boot.SpringApplicationRunListeners.contextPrepared(SpringApplicationRunListeners.java:67)
at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:391)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:325)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1313)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1302)
at com.junmp.jyzb.boot.JyzbBootApplication.main(JyzbBootApplication.java:33)
2023-05-29 10:13:34.432 INFO 21460 --- [main] c.j.v.c.listener.ConfigInitListener : 当前数据库驱动类>>>null
2023-05-29 10:13:34.808 ERROR 21460 --- [main] o.s.boot.SpringApplication : Application run failed
com.junmp.v2.config.api.exception.ConfigException: 获取不到application.yml中的数据库配置,无法从数据库加载系统配置表
at com.junmp.v2.config.listener.ConfigInitListener.eventCallback(ConfigInitListener.java:73)
at com.junmp.v2.common.listener.ContextInitializedListener.onApplicationEvent(ContextInitializedListener.java:30)
at com.junmp.v2.common.listener.ContextInitializedListener.onApplicationEvent(ContextInitializedListener.java:20)
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:176)
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:169)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:143)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:131)
at org.springframework.boot.context.event.EventPublishingRunListener.contextPrepared(EventPublishingRunListener.java:89)
at org.springframework.boot.SpringApplicationRunListeners.lambda$contextPrepared$3(SpringApplicationRunListeners.java:67)
at java.util.ArrayList.forEach(ArrayList.java:1259)
at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:117)
at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:111)
at org.springframework.boot.SpringApplicationRunListeners.contextPrepared(SpringApplicationRunListeners.java:67)
at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:391)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:325)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1313)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1302)
at com.junmp.jyzb.boot.JyzbBootApplication.main(JyzbBootApplication.java:33)
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>junmp-jyzb-app</artifactId>
<groupId>com.junmp.jyzb</groupId>
<version>1.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>jyzb-api</artifactId>
<version>1.0.0</version>
<name>jyzb-api</name>
<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>com.junmp.v2</groupId>
<artifactId>junmp-v2-common</artifactId>
</dependency>
<dependency>
<groupId>com.junmp.v2</groupId>
<artifactId>v2-validator-api</artifactId>
</dependency>
<!-- jwt -->
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>0.9.1</version>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>1.5.22</version>
</dependency>
<dependency>
<groupId>jakarta.validation</groupId>
<artifactId>jakarta.validation-api</artifactId>
</dependency>
</dependencies>
</project>
package com.junmp.jyzb.api.bean.dto;
import lombok.Data;
import java.io.Serializable;
/**
* <pre>
*
* 描述:
* 版本:1.0.0
* 日期:2022/8/3 13:21
* 作者:ningzp@junmp.com.cn
* <br>修改记录
* <br>修改日期 修改人 修改内容
*
* </pre>
*/
@Data
public class ProductBatchDto implements Serializable {
/**
* 批次编号
*/
private Long batchId;
/**
* 批次号
*/
private String batchNo;
/**
* 产品编号
*/
private Long productId;
/**
* 产品名称
*/
private String productName;
/**
* 广告语
*/
private String adInfo;
/**
* 号型编号
*/
private Long specId;
/**
* 号型
*/
private String spec;
/**
* 重量
*/
private String weight;
/**
* 材质
*/
private String material;
/**
* 计划生产数
*/
private Integer total;
/**
* 是否复检完成
*/
private Boolean hasFinish;
/**
* 是否初始化完成
*/
private Boolean hasInit;
/**
* 已生产数量
*/
private Integer doneNum;
/**
* 初始化数量
*/
private Integer initNum;
}
package com.junmp.jyzb.api.bean.dto;
import lombok.Data;
import java.io.Serializable;
/**
* <pre>
*
* 描述:
* 版本:1.0.0
* 日期:2022/8/3 13:21
* 作者:ningzp@junmp.com.cn
* <br>修改记录
* <br>修改日期 修改人 修改内容
*
* </pre>
*/
@Data
public class ProductProcessDto implements Serializable {
/**
* 批次编号
*/
private Long batchId;
/**
* 批次号
*/
private String batchNo;
/**
* 产品编号
*/
private Long productId;
/**
* 产品名称
*/
private String productName;
/**
* 广告语
*/
private String adInfo ;
/**
* 号型编号
*/
private Long specId;
/**
* 号型
*/
private String spec;
/**
* 重量
*/
private String weight;
/**
* 材质
*/
private String material;
/**
* 计划生产数
*/
private Integer total;
/**
* 是否复检完成
*/
private Boolean hasFinish;
/**
* 是否初始化完成
*/
private Boolean hasInit;
/**
* 已自检数量
*/
private Integer checkedNum;
/**
* 待自检数量
*/
private Integer waitingNum;
}
package com.junmp.jyzb.api.bean.dto;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* <pre>
*
* 描述:
* 版本:1.0.0
* 日期:2022/8/5 15:32
* 作者:ningzp@junmp.com.cn
* <br>修改记录
* <br>修改日期 修改人 修改内容
*
* </pre>
*/
@Data
public class ProductTagDto implements Serializable {
private Long tagId ;
private String productCode ;
private String password;
private String ciphertext ;
private String productName ;
private Date produceTime ;
private String spec ;
private String material ;
private String weight ;
private String companyName ;
private String adInfo ;
}
package com.junmp.jyzb.api.bean.dto;
import lombok.Data;
import java.io.Serializable;
/**
* <pre>
*
* 描述:
* 版本:1.0.0
* 日期:2022/8/5 15:56
* 作者:ningzp@junmp.com.cn
* <br>修改记录
* <br>修改日期 修改人 修改内容
*
* </pre>
*/
@Data
public class SimpleTagDto implements Serializable {
private Long tagId ;
private String productCode ;
}
package com.junmp.jyzb.api.bean.req;
import com.junmp.v2.common.bean.request.BaseRequest;
import com.junmp.v2.validator.api.validators.unique.TableUniqueValue;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
/**
* <pre>
*
* 描述:
* 版本:1.0.0
* 日期:2022/8/1 10:56
* 作者:ningzp@junmp.com.cn
* <br>修改记录
* <br>修改日期 修改人 修改内容
*
* </pre>
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class CompanyReq extends BaseRequest {
@NotNull(message = "企业编号不能为空", groups = {edit.class, delete.class, detail.class})
private Long bizId;
@NotBlank(message = "企业编码不能为空", groups = {edit.class})
@TableUniqueValue(
message = "编码重复",
groups = {edit.class},
tableName = "biz_company",
columnName = "biz_code",
idFieldName = "biz_id")
private String bizCode;
/**
* 单位类型
*/
private String bizType;
/**
* 名称
*/
private String name;
/**
* 简称
*/
private String shortName;
/**
* 备注
*/
private String remark;
}
package com.junmp.jyzb.api.bean.req;
import lombok.Data;
import java.io.Serializable;
/**
* <pre>
*
* 描述:
* 版本:1.0.0
* 日期:2022/8/30 16:25
* 作者:ningzp@junmp.com.cn
* <br>修改记录
* <br>修改日期 修改人 修改内容
*
* </pre>
*/
@Data
public class DbAccessReq implements Serializable {
private String host ;
private Integer port ;
private String dbName ;
private String username ;
private String password ;
}
package com.junmp.jyzb.api.bean.req;
import com.junmp.v2.common.bean.request.BaseRequest;
import com.junmp.v2.validator.api.validators.unique.TableUniqueValue;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
/**
* <pre>
*
* 描述:
* 版本:1.0.0
* 日期:2022/8/2 10:11
* 作者:ningzp@junmp.com.cn
* <br>修改记录
* <br>修改日期 修改人 修改内容
*
* </pre>
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class ProductBatchReq extends BaseRequest {
/**
* 批次主键
*/
@NotNull(message = "批次主键不能为空", groups = {edit.class, delete.class, detail.class})
private Long batchId;
/**
* 批次编号
*/
@NotBlank(message = "批次号不能为空", groups = {edit.class})
@TableUniqueValue(
message = "批次号重复",
groups = {edit.class},
tableName = "biz_product_batch",
columnName = "batch_no",
idFieldName = "batch_id")
private String batchNo;
/**
* 产品编号
*/
@NotNull(message = "批次主键不能为空", groups = {edit.class, add.class})
private Long productId;
/**
* 关联号型
*/
private Long specId;
/**
* 生产总量
*/
@NotNull(message = "批次主键不能为空", groups = {edit.class, add.class})
private Integer total;
/**
* 序号前缀
*/
private String prefix;
}
package com.junmp.jyzb.api.bean.req;
import com.junmp.v2.common.bean.request.BaseRequest;
import com.junmp.v2.validator.api.validators.unique.TableUniqueValue;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
/**
* <pre>
*
* 描述:
* 版本:1.0.0
* 日期:2022/8/1 16:29
* 作者:ningzp@junmp.com.cn
* <br>修改记录
* <br>修改日期 修改人 修改内容
*
* </pre>
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class ProductReq extends BaseRequest {
@NotNull(message = "产品主键不能为空", groups = {edit.class, delete.class, detail.class})
private Long productId;
/**
* 产品代码
*/
@NotBlank(message = "产品编码不能为空", groups = {edit.class})
@TableUniqueValue(
message = "编码重复",
groups = {edit.class},
tableName = "biz_product",
columnName = "product_code",
idFieldName = "product_id")
private String productCode;
/**
* 产品当前序号
*/
private Integer sn;
/**
* 产品名称
*/
private String name;
/**
* 条码信息
*/
private String barcode;
/**
* 重量
*/
private String weight;
/**
* 规格尺寸
*/
private String spec;
/**
* 材质
*/
private String material;
/**
* 计量单位
*/
private String unit;
/**
* 广告信息
*/
private String adInfo;
/**
* 图片地址
*/
private String imageUrl;
/**
* 生产厂家编号
*/
private Long mfBizId;
/**
* 生产厂家名称
*/
private String mfBizName;
}
package com.junmp.jyzb.api.bean.req;
import com.junmp.v2.common.bean.request.BaseRequest;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotNull;
/**
* <pre>
*
* 描述:
* 版本:1.0.0
* 日期:2022/8/1 18:28
* 作者:ningzp@junmp.com.cn
* <br>修改记录
* <br>修改日期 修改人 修改内容
*
* </pre>
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class ProductSkuReq extends BaseRequest {
@NotNull(message = "号型主键不能为空", groups = {edit.class, delete.class, detail.class})
private Long specId;
private String skuCode ;
/**
* 号型
*/
private String spec;
/**
* 重量
*/
private String weight;
/**
* 材质
*/
private String material;
/**
* 关联产品
*/
private Long productId;
/**
* 预览属性1
*/
private String attr1;
/**
* 预览属性2
*/
private String attr2;
/**
* 预览属性3
*/
private String attr3;
}
package com.junmp.jyzb.api.bean.req;
import com.junmp.v2.common.bean.request.BaseRequest;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotNull;
/**
* <pre>
*
* 描述:
* 版本:1.0.0
* 日期:2022/8/2 14:36
* 作者:ningzp@junmp.com.cn
* <br>修改记录
* <br>修改日期 修改人 修改内容
*
* </pre>
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class ProductTagReq extends BaseRequest {
/**
* 标签编号
*/
@NotNull(message = "标签编号不能为空", groups = {edit.class, delete.class, detail.class})
private Long tagId;
private String tagUid;
/**
* 成品码(批次+序号)
*/
private String productCode;
/**
* 关联生成批次编号
*/
@NotNull(message = "批次不能为空", groups = {add.class})
private Long batchId;
/**
* 关联生成产品主键
*/
@NotNull(message = "产品不能为空", groups = {add.class})
private Long productId;
/**
* 关联生成号型主键
*/
@NotNull(message = "号型不能为空", groups = {add.class})
private Long specId;
/**
* 产品序号
*/
private Integer serialId;
/**
* 版本编号
*/
private String versionNo;
/**
* 密码
*/
private String password;
/**
* 密文内容
*/
private String ciphertext;
}
package com.junmp.jyzb.api.bean.vo;
import lombok.AllArgsConstructor;
import lombok.Data;
import java.io.Serializable;
/**
* <pre>
*
* 描述:
* 版本:1.0.0
* 日期:2022/8/30 16:27
* 作者:ningzp@junmp.com.cn
* <br>修改记录
* <br>修改日期 修改人 修改内容
*
* </pre>
*/
@Data
@AllArgsConstructor
public class AuthAccessVo implements Serializable {
/**
* 访问的秘钥
*/
private String accessKey ;
private String url;
private String username;
private String password;
}
package com.junmp.jyzb.api.bean.vo;
import lombok.Data;
import java.io.Serializable;
/**
* <pre>
*
* 描述:NFC NDef的文本内容
* 版本:1.0.0
* 日期:2022/8/3 18:36
* 作者:ningzp@junmp.com.cn
* <br>修改记录
* <br>修改日期 修改人 修改内容
*
* </pre>
*/
@Data
public class NDefContentVo implements Serializable {
/**
* 产品编号
*/
private String productNo;
/**
* 名称
*/
private String name;
/**
* 号型
*/
private String spec;
/**
* 重量
*/
private String weight;
/**
* 生产厂家
*/
private String company;
/**
* 生产时间
*/
private String produceTime;
/**
* 密文内容
*/
private String ciphertext;
}
package com.junmp.jyzb.api.bean.vo;
import lombok.Data;
import java.io.Serializable;
/**
* <pre>
*
* 描述:
* 版本:1.0.0
* 日期:2022/8/2 16:13
* 作者:ningzp@junmp.com.cn
* <br>修改记录
* <br>修改日期 修改人 修改内容
*
* </pre>
*/
@Data
public class ProductSkuVo implements Serializable {
/**
* 号型编号
*/
private Long specId;
/**
* 号型代码
*/
private String skuCode;
/**
* 号型名称
*/
private String spec;
/**
* 重量
*/
private String weight ;
}
package com.junmp.jyzb.api.bean.vo;
import lombok.Builder;
import lombok.Data;
import java.io.Serializable;
/**
* <pre>
*
* 描述:
* 版本:1.0.0
* 日期:2022/8/5 16:33
* 作者:ningzp@junmp.com.cn
* <br>修改记录
* <br>修改日期 修改人 修改内容
*
* </pre>
*/
@Builder
@Data
public class TagInfoVo implements Serializable {
private Long tagId ;
private String content ;
private String productCode;
}
package com.junmp.jyzb.api.constant;
/**
* <pre>
*
* 描述:
* 版本:1.0.0
* 日期:2022/8/1 13:03
* 作者:ningzp@junmp.com.cn
* <br>修改记录
* <br>修改日期 修改人 修改内容
*
* </pre>
*/
public interface JYZBConstant {
/**
* 系统管理模块的名称
*/
String JYZB_MODULE_NAME = "junmp-jyzb-app";
/**
* 异常枚举的步进值
*/
int JYZB_EXCEPTION_STEP_CODE = 400;
/**
* 缓存前缀
*/
String JYZB_CACHE_PREFIX = "gold:";
String JYZB_JWT_KEY = "JWT";
}
package com.junmp.jyzb.api.exception;
import cn.hutool.core.util.StrUtil;
import com.junmp.jyzb.api.constant.JYZBConstant;
import com.junmp.v2.common.exception.IExceptionEnum;
import com.junmp.v2.common.exception.base.ServiceException;
/**
* <pre>
*
* 描述:
* 版本:1.0.0
* 日期:2022/8/1 13:02
* 作者:ningzp@junmp.com.cn
* <br>修改记录
* <br>修改日期 修改人 修改内容
*
* </pre>
*/
public class JYZBAppException extends ServiceException {
public JYZBAppException(IExceptionEnum exception, Object... params) {
super(JYZBConstant.JYZB_MODULE_NAME, exception.getCode(), StrUtil.format(exception.getMessage(), params));
}
public JYZBAppException(IExceptionEnum exception) {
super(JYZBConstant.JYZB_MODULE_NAME, exception);
}
}
package com.junmp.jyzb.api.exception.enums;
import com.junmp.jyzb.api.constant.JYZBConstant;
import com.junmp.v2.common.constant.CommonConstant;
import com.junmp.v2.common.exception.IExceptionEnum;
import lombok.Getter;
/**
* <pre>
*
* 描述:
* 版本:1.0.0
* 日期:2022/8/1 13:08
* 作者:ningzp@junmp.com.cn
* <br>修改记录
* <br>修改日期 修改人 修改内容
*
* </pre>
*/
@Getter
public enum CompanyExceptionEnum implements IExceptionEnum {
/**
* 应用不存在
*/
COMPANY_NOT_EXIST(CommonConstant.DEFAULT_USER_ERROR_CODE + JYZBConstant.JYZB_EXCEPTION_STEP_CODE + 12, "企业不存在"),;
/**
* 错误编码
*/
private final Integer code;
/**
* 提示用户信息
*/
private final String message;
CompanyExceptionEnum(Integer code, String message) {
this.code = code;
this.message = message;
}
}
package com.junmp.jyzb.api.exception.enums;
import com.junmp.jyzb.api.constant.JYZBConstant;
import com.junmp.v2.common.constant.CommonConstant;
import com.junmp.v2.common.exception.IExceptionEnum;
import lombok.Getter;
/**
* <pre>
*
* 描述:
* 版本:1.0.0
* 日期:2022/8/1 13:08
* 作者:ningzp@junmp.com.cn
* <br>修改记录
* <br>修改日期 修改人 修改内容
*
* </pre>
*/
@Getter
public enum ProductExceptionEnum implements IExceptionEnum {
/**
* 产品信息不存在
*/
PRODUCT_NOT_EXIST(CommonConstant.DEFAULT_USER_ERROR_CODE + JYZBConstant.JYZB_EXCEPTION_STEP_CODE + 12, "产品信息不存在"),
/**
* 产品信息不存在
*/
PRODUCT_SKU_NOT_EXIST(CommonConstant.DEFAULT_USER_ERROR_CODE + JYZBConstant.JYZB_EXCEPTION_STEP_CODE + 13, "号型不存在"),
/**
* 批次信息不存在
*/
BATCH_NOT_EXIST(CommonConstant.DEFAULT_USER_ERROR_CODE + JYZBConstant.JYZB_EXCEPTION_STEP_CODE + 14, "批次不存在"),
/**
* 批次信息不存在
*/
BATCH_PROCESSED(CommonConstant.DEFAULT_USER_ERROR_CODE + JYZBConstant.JYZB_EXCEPTION_STEP_CODE + 15, "批次已生产"),
/**
* 批次生产已完成
*/
BATCH_PROCESSED_DONE(CommonConstant.DEFAULT_USER_ERROR_CODE + JYZBConstant.JYZB_EXCEPTION_STEP_CODE + 16, "批次生产已完成"),
/**
* 批次生产已完成
*/
MODIFY_NUM_ERROR(CommonConstant.DEFAULT_USER_ERROR_CODE + JYZBConstant.JYZB_EXCEPTION_STEP_CODE + 17, "批次生产已完成,数量不能小于原数量"),
/**
* 标签信息不存在
*/
TAG_INFO_NOT_EXISTS(CommonConstant.DEFAULT_USER_ERROR_CODE + JYZBConstant.JYZB_EXCEPTION_STEP_CODE + 19, "标签信息不存在"),
/**
* 标签信息初始化完成
*/
TAG_INFO_INIT_DONE(CommonConstant.DEFAULT_USER_ERROR_CODE + JYZBConstant.JYZB_EXCEPTION_STEP_CODE + 20, "检查标签信息是否绑定完成"),
/**
* 标签已绑定
*/
TAG_INFO_HAD_BINDING(CommonConstant.DEFAULT_USER_ERROR_CODE + JYZBConstant.JYZB_EXCEPTION_STEP_CODE + 21, "标签已绑定"),
/**
* 确认绑定是否已完成
*/
TAG_UID_BINDING_ERROR(CommonConstant.DEFAULT_USER_ERROR_CODE + JYZBConstant.JYZB_EXCEPTION_STEP_CODE + 22, "确认绑定是否已完成"),
/**
* 标签重复
*/
TAG_INFO_REPEAT_ERROR(CommonConstant.DEFAULT_USER_ERROR_CODE + JYZBConstant.JYZB_EXCEPTION_STEP_CODE + 23, "标签重复"),
;
/**
* 错误编码
*/
private final Integer code;
/**
* 提示用户信息
*/
private final String message;
ProductExceptionEnum(Integer code, String message) {
this.code = code;
this.message = message;
}
}
/**
* <pre>
*
* 描述:
* 版本:1.0.0
* 日期:2022/8/1 13:08
* 作者:ningzp@junmp.com.cn
* <br>修改记录
* <br>修改日期 修改人 修改内容
*
* </pre>
*/
package com.junmp.jyzb.api.exception.enums;
package com.junmp.jyzb.api.util;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import java.util.Date;
/**
* <pre>
*
* 描述:
* 版本:1.0.0
* 日期:2022/8/1 13:36
* 作者:ningzp@junmp.com.cn
* <br>修改记录
* <br>修改日期 修改人 修改内容
*
* </pre>
*/
public class GenCodeUtil {
private static final String QY_PREFIX = "11";
private static final String PRODUCT_PREFIX = "99";
private static final String HX_PREFIX = "1";
/**
* 字符串前面补零操作
*
* @param str 字符串本体
* @param len 需要的字符串总长度
* @return
*/
public static String splicingZero(String str, int len) {
int strLen = str.length();
String strReturn = str;
for (int i = 0; i < len - strLen; i++) {
strReturn = "0" + strReturn;
}
return strReturn.toUpperCase();
}
/**
* 生成企业代码
*
* @param sn 当前序号(11)
*/
public static String genBizCode(Integer sn) {
StringBuilder sb = new StringBuilder();
sb.append(QY_PREFIX);
sb.append(splicingZero(String.valueOf(sn), 4));
return sb.toString();
}
/**
* 生成产品代码
*
* @param sn 当前序号(11)
*/
public static String genProductCode(Integer sn) {
StringBuilder sb = new StringBuilder();
sb.append(PRODUCT_PREFIX).append(splicingZero(String.valueOf(sn), 4));
return sb.toString();
}
/**
* 生成号型代码
*
* @param sn 当前序号(11)
*/
public static String genSpecCode(Integer sn) {
StringBuilder sb = new StringBuilder();
sb.append(HX_PREFIX).append(splicingZero(String.valueOf(sn), 3));
return sb.toString();
}
/**
* 生产批次号
*/
public static String genBatchNo(Integer sn) {
StringBuilder sb = new StringBuilder();
sb.append(DateUtil.format(new Date(), DatePattern.PURE_DATE_PATTERN))
.append(splicingZero(String.valueOf(sn), 4));
return sb.toString();
}
/**
* 生产SKU
*
* @param productCode
* @param hxCode
*/
public static String genSkuCode(String productCode, String hxCode) {
StringBuilder sb = new StringBuilder();
sb.append(productCode).append(hxCode);
return sb.toString();
}
}
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>junmp-jyzb-app</artifactId>
<groupId>com.junmp.jyzb</groupId>
<version>1.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>jyzb-biz</artifactId>
<version>1.0.0</version>
<name>jyzb-biz</name>
<dependencies>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>1.5.22</version>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.junmp.v2</groupId>
<artifactId>v2-db-api</artifactId>
</dependency>
<dependency>
<groupId>com.junmp.jyzb</groupId>
<artifactId>jyzb-api</artifactId>
</dependency>
<dependency>
<groupId>com.junmp.v2</groupId>
<artifactId>auth-sdk</artifactId>
</dependency>
<dependency>
<groupId>com.junmp.jyzb</groupId>
<artifactId>jyzb-common</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.junmp.v2</groupId>
<artifactId>v2-log-api</artifactId>
</dependency>
<dependency>
<groupId>com.junmp.v2</groupId>
<artifactId>v2-job-api</artifactId>
</dependency>
</dependencies>
</project>
package com.junmp.jyzb.cache;
import com.junmp.jyzb.api.constant.JYZBConstant;
import com.junmp.v2.cache.AbstractRedisCache;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
/**
* <pre>
*
* 描述:
* 版本:1.0.0
* 日期:2022/8/1 16:51
* 作者:ningzp@junmp.com.cn
* <br>修改记录
* <br>修改日期 修改人 修改内容
*
* </pre>
*/
@Component
public class GoldRedisCache extends AbstractRedisCache<String> {
public GoldRedisCache(RedisTemplate<String, String> redisTemplate) {
super(redisTemplate);
}
@Override
public String getCommonKeyPrefix() {
return JYZBConstant.JYZB_CACHE_PREFIX;
}
}
package com.junmp.jyzb.config;
import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class MybatisPlusConfig {
@Bean
public MybatisPlusInterceptor mybatisPlusInterceptor() {
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
// 添加分页插件
interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
return interceptor;
}
}
\ No newline at end of file
package com.junmp.jyzb.controller;
import com.junmp.jyzb.service.CabinetBoxService;
import com.junmp.jyzb.service.CabinetService;
import com.junmp.jyzb.service.PoliceFingerService;
import com.junmp.jyzb.utils.HttpStatus;
import com.junmp.jyzb.utils.ResponseResult;
import com.junmp.jyzb.utils.ReturnData;
import com.junmp.jyzb.utils.ReturnMsg;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
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 java.util.ArrayList;
import java.util.List;
import java.util.Map;
@RestController
@Slf4j
@RequestMapping("/Cabinet")
@Api(tags = "单警柜基础信息模块")
public class CabinetController {
@Resource
public CabinetService cabinetService;
@Resource
private CabinetBoxService cabinetBoxService;
@PostMapping("/AddCabinet")
@ApiOperation("添加单警柜")
public ResponseResult addCabinet(@RequestBody Map<String,Object> msg) {
ResponseResult returnMsg = cabinetService.addCabinet(msg);
return returnMsg;
}
@PostMapping("/DeleteCabinet")
@ApiOperation("删除单警柜信息")
public ResponseResult deleteCabinet(@RequestBody Map<String,Object> msg) {
ResponseResult returnMsg = cabinetService.deleteCabinet(msg);
return returnMsg;
}
@PostMapping("/ShowCabinet")
@ApiOperation("查询单警柜列表")
public ResponseResult showCabinet(@RequestBody Map<String, Object> msg){
ResponseResult returnMsg = cabinetService.getAllCabinet(msg);
return returnMsg;
}
@PostMapping("/UpdateCabinet")
@ApiOperation("修改单警柜信息")
public ResponseResult updateCabinet(@RequestBody Map<String,Object> msg) {
ResponseResult returnMsg =cabinetService.updateCabinet(msg);
return returnMsg;
}
@PostMapping("/ErrorState")
@ApiOperation("单警柜状态变更")
public ResponseResult changeCabinetState(@RequestBody Map<String,Object> msg) {
ResponseResult returnMsg = cabinetService.changeCabinetState(msg);
return returnMsg;
}
@PostMapping("/GetCabinetDetail")
@ApiOperation("查询单警柜及其箱号信息")
public ResponseResult getCabinetDetail(@RequestBody Map<String, Object> msg){
ResponseResult returnMsg = cabinetService.getCabinetDetail(msg);
return returnMsg;
}
}
\ No newline at end of file
package com.junmp.jyzb.controller;
import cn.hutool.core.util.StrUtil;
import com.junmp.jyzb.api.bean.req.CompanyReq;
import com.junmp.jyzb.doc.CompanyDoc;
import com.junmp.jyzb.entity.Company;
import com.junmp.jyzb.service.CompanyService;
import com.junmp.v2.common.bean.request.ValidationApi;
import com.junmp.v2.common.bean.response.ApiRes;
import com.junmp.v2.common.exception.base.ServiceException;
import com.junmp.v2.common.exception.enums.DefaultBizExceptionEnum;
import com.junmp.v2.db.api.page.PageResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* <pre>
*
* 描述:
* 版本:1.0.0
* 日期:2022/8/1 10:24
* 作者:ningzp@junmp.com.cn
* <br>修改记录
* <br>修改日期 修改人 修改内容
*
* </pre>
*/
@RestController
@Slf4j
@RequestMapping("/api")
public class CompanyController implements CompanyDoc {
@Resource
private CompanyService companyService;
@PostMapping(path = "/company", name = "新增企业")
@Override
public ApiRes<Boolean> addBiz(@RequestBody @Validated(CompanyReq.add.class) CompanyReq req) {
try {
companyService.addBiz(req);
return ApiRes.success();
} catch (ServiceException ex) {
log.error("企业新增异常>>" + ex.getMessage());
return ApiRes.failure(DefaultBizExceptionEnum.SYS_RUNTIME_ERROR);
}
}
@PutMapping(path = "/company", name = "编辑企业")
@Override
public ApiRes<Boolean> editBiz(@RequestBody @Validated(ValidationApi.edit.class) CompanyReq req) {
boolean flag = companyService.editBiz(req);
if (flag) {
return ApiRes.success();
} else {
return ApiRes.failure(StrUtil.format("单位编码:{},更新失败", req.getBizCode()));
}
}
@GetMapping(path = "/company", name = "企业列表")
@Override
public ApiRes<List<Company>> list(CompanyReq req) {
List<Company> list = companyService.findList(req);
return ApiRes.success(list);
}
@DeleteMapping(path = "/company", name = "删除企业")
@Override
public ApiRes<Boolean> delBiz(@RequestBody @Validated(ValidationApi.delete.class) CompanyReq req) {
boolean flag = companyService.del(req);
if (flag) {
return ApiRes.success();
} else {
return ApiRes.failure(StrUtil.format("单位编码:{},删除失败", req.getBizCode()));
}
}
@GetMapping(path = "/company/page", name = "分页企业信息")
@Override
public ApiRes<PageResult<Company>> page(CompanyReq req) {
return ApiRes.success(companyService.findPage(req));
}
}
package com.junmp.jyzb.controller;
import com.junmp.jyzb.service.EquipmentSizeService;
import com.junmp.jyzb.service.WarehouseService;
import com.junmp.jyzb.utils.HttpStatus;
import com.junmp.jyzb.utils.ResponseResult;
import com.junmp.jyzb.utils.ReturnMsg;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
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 java.util.ArrayList;
import java.util.List;
import java.util.Map;
@RestController
@Slf4j
@RequestMapping("/Size")
@Api(tags = "号型基础信息模块")
public class EquipmentSizeController {
@Resource
public EquipmentSizeService equipmentSizeService;
@PostMapping("/AddSize")
@ApiOperation("添加号型信息")
public ResponseResult addSize(@RequestBody Map<String,Object> msg) {
ResponseResult returnMsg = equipmentSizeService.addSize(msg);
return returnMsg;
}
@PostMapping("/DeleteSize")
@ApiOperation("删除号型信息")
public ResponseResult deleteSize(@RequestBody Map<String,Object> msg) {
ResponseResult returnMsg = equipmentSizeService.deleteSize(msg);
return returnMsg;
}
@PostMapping("/GetOneSize")
@ApiOperation("查询单个号型信息")
public ResponseResult getOneSize(@RequestBody Map<String, Object> msg) {
ResponseResult returnMsg = equipmentSizeService.getOneSize(msg);
return returnMsg;
}
@PostMapping("/ShowSize")
@ApiOperation("查询号型列表") //根据组织机构id查询
public ResponseResult getAllSize(@RequestBody Map<String, Object> msg){
ResponseResult returnMsg = equipmentSizeService.getAllSize(msg);
return returnMsg;
}
@PostMapping("/UpdateSize")
@ApiOperation("修改号型信息")
public ResponseResult updateSize(@RequestBody Map<String,Object> msg) {
ResponseResult returnMsg = equipmentSizeService.updateSize(msg);
return returnMsg;
}
@PostMapping("/ChangeSizeState")
@ApiOperation("禁用/启用装备号型")
public ResponseResult changeSizeState(@RequestBody Map<String,Object> msg) {
ResponseResult returnMsg = equipmentSizeService.changeSizeState(msg);
return returnMsg;
}
}
package com.junmp.jyzb.controller;
import com.junmp.jyzb.service.EquipmentTypeService;
import com.junmp.jyzb.utils.HttpStatus;
import com.junmp.jyzb.utils.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
@RestController
@Slf4j
@RequestMapping("/Equipment")
@Api(tags = "物资基础信息模块")
public class EquipmentTypeController {
@Resource
public EquipmentTypeService equipmentTypeService;
@PostMapping("/AddEquipment")
@ApiOperation("添加物资")
public ResponseResult addEquipment(@RequestBody Map<String,Object> msg) {
ResponseResult returnMsg = equipmentTypeService.addEquipment(msg);
return returnMsg;
}
//添加装备时计算id
@PostMapping("/CalculationEquipmentId")
public ResponseResult calculationEquipmentId() {
ResponseResult returnMsg = equipmentTypeService.calculationEquipmentId();
return returnMsg;
}
@PostMapping("/DeleteEquipment")
@ApiOperation("删除仓库信息")
public ResponseResult deleteEquipment(@RequestBody Map<String,Object> msg) {
ResponseResult returnMsg = equipmentTypeService.deleteEquipment(msg);
return returnMsg;
}
@PostMapping("/ChangeEquipmentState")
@ApiOperation("禁用/启用装备类型")
public ResponseResult changeEquipmentState(@RequestBody Map<String,Object> msg) {
ResponseResult returnMsg = equipmentTypeService.changeEquipmentState(msg);
return returnMsg;
}
@PostMapping("/ShowEquipmentList")
@ApiOperation("查询物资列表")
public ResponseResult ShowEquipmentList() {
List<Map<String, Object>> equipmentList = equipmentTypeService.getEquipmentList();
return new ResponseResult(HttpStatus.SUCCESS,"操作成功",equipmentList);
}
@PostMapping("/GetEquipmentDetail")
@ApiOperation("查询单个物资信息")
public ResponseResult getOneEquipment(@RequestBody Map<String, Object> msg) {
//String warehouseId = msg.get("").toString();
ResponseResult returnMsg = equipmentTypeService.getOneEquipment(msg);
return returnMsg;
}
@PostMapping("/UpdateEquipment")
@ApiOperation("修改物资信息")
public ResponseResult updateEquipment(@RequestBody Map<String,Object> msg) {
ResponseResult responseMsg = equipmentTypeService.updateEquipment(msg);
return responseMsg;
}
}
package com.junmp.jyzb.controller;
import cn.hutool.core.util.StrUtil;
import com.junmp.jyzb.api.constant.JYZBConstant;
import com.junmp.jyzb.cache.GoldRedisCache;
import com.junmp.jyzb.doc.LoginDoc;
import com.junmp.v2.auth.api.bean.auth.LoginReq;
import com.junmp.v2.auth.api.bean.auth.LoginRes;
import com.junmp.v2.auth.sign.AuthContainer;
import com.junmp.v2.common.bean.response.ApiRes;
import lombok.extern.slf4j.Slf4j;
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;
/**
* <pre>
*
* 描述:登录服务
* 版本:1.0.0
* 日期:2022/6/7 13:47
* 作者:ningzp@junmp.com.cn
* <br>修改记录
* <br>修改日期 修改人 修改内容
*
* </pre>
*/
@Slf4j
@RestController
@RequestMapping("/api")
public class LoginController implements LoginDoc {
@Resource
private AuthContainer authContainer;
@Resource
private GoldRedisCache goldRedisCache ;
@PostMapping(name = "用户登录", path = "/auth/login")
public ApiRes<LoginRes> login(@RequestBody LoginReq req) {
LoginRes res = authContainer.login(req);
if (null != res) {
//配置扩展信息
String jwt = goldRedisCache.get(JYZBConstant.JYZB_JWT_KEY);
if(StrUtil.isEmpty(jwt)){
goldRedisCache.put(JYZBConstant.JYZB_JWT_KEY,res.getToken());
}
return ApiRes.success(res);
} else {
return ApiRes.failure("登录失败");
}
}
@PostMapping(name = "用户登出", path = "/auth/logout")
public ApiRes<Boolean> logout(){
authContainer.logout();
log.info("登出成功");
return ApiRes.success();
}
}
package com.junmp.jyzb.controller;
import com.junmp.jyzb.domain.Policeman;
import com.junmp.jyzb.service.PoliceFingerService;
import com.junmp.jyzb.service.PolicemanService;
import com.junmp.jyzb.utils.HttpStatus;
import com.junmp.jyzb.utils.ResponseResult;
import com.junmp.jyzb.utils.ReturnData;
import com.junmp.jyzb.utils.ReturnMsg;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@RestController
@Slf4j
@RequestMapping("/Police")
@Api(tags = "警员基础信息模块")
public class PoliceController {
@Resource
public PolicemanService policemanService;
@PostMapping("/AddPoliceman")
@ApiOperation("添加警员信息")
public ResponseResult addPoliceman(@RequestBody Map<String,Object> msg) {
ResponseResult returnMsg = policemanService.addPoliceman(msg);
return returnMsg;
}
@PostMapping("/AddFingerInfo")
@ApiOperation("添加指纹信息")
public ResponseResult addFingerInfo(@RequestBody Map<String,Object> msg) {
ResponseResult returnMsg = policemanService.addFingerInfo(msg);
return returnMsg;
}
@PostMapping("/AddFaceInfo")
@ApiOperation("添加警员面部信息")
public ResponseResult addFaceInfo(@RequestBody Map<String,Object> msg) {
ResponseResult returnMsg = policemanService.addFaceInfo(msg);
return returnMsg;
}
@PostMapping("/DeletePolice")
@ApiOperation("删除警员信息")
public ResponseResult deletePolice(@RequestBody Map<String,Object> msg) {
ResponseResult returnMsg = policemanService.deletePolice(msg);
return returnMsg;
}
@PostMapping("/ChangePoliceState")
@ApiOperation("修改警员状态")
public ResponseResult ChangePoliceState(@RequestBody Map<String,Object> msg) {
ResponseResult returnMsg = policemanService.changePoliceState(msg);
return returnMsg;
}
@PostMapping("/ShowPolice")
@ApiOperation("查询警员列表") //根据组织机构id查询
public ResponseResult getAllPoliceman(@RequestBody Map<String, Object> orgId){
ResponseResult returnMsg = policemanService.getAllPoliceman(orgId);
return returnMsg;
}
@PostMapping("/GetPoliceDetail")
@ApiOperation("查询单个警员信息")
public ResponseResult getOnePolice(@RequestBody Map<String, Object> msg) {
ResponseResult returnMsg = policemanService.getOnePolice(msg);
return returnMsg;
}
@PostMapping("/UpdatePolice")
@ApiOperation("修改警员信息")
public ResponseResult updatePolice(@RequestBody Map<String,Object> msg) {
ResponseResult returnMsg = policemanService.updatePolice(msg);
return returnMsg;
}
@PostMapping("/DeleteFingerInfo")
@ApiOperation("删除警员指纹信息")
public ResponseResult deletePoliceFinger(@RequestBody Map<String,Object> msg) {
ResponseResult returnMsg= policemanService.deleteFinger(msg);
return returnMsg;
}
//todo 更新查询所有
@PostMapping("/GetPoliceData")
@ApiOperation("查询与单警柜绑定的警员信息") //根据单警柜id查询
public ResponseResult getPoliceData(@RequestBody Map<String, Object> cabinetId){
//获取该组织机构下所有警员的id
ResponseResult returnMsg =policemanService.getPoliceData(cabinetId);
return returnMsg;
}
@PostMapping("/ChangePoliceOrg")
@ApiOperation("警员调岗")
public ResponseResult changePoliceOrg(@RequestBody Map<String, Object> cabinetId){
//获取该组织机构下所有警员的id
//ResponseResult returnMsg =policemanService.getPoliceData(cabinetId);
return null;
}
}
package com.junmp.jyzb.controller;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.junmp.jyzb.api.bean.dto.ProductBatchDto;
import com.junmp.jyzb.api.bean.dto.ProductProcessDto;
import com.junmp.jyzb.api.bean.req.ProductBatchReq;
import com.junmp.jyzb.api.exception.enums.ProductExceptionEnum;
import com.junmp.jyzb.api.util.GenCodeUtil;
import com.junmp.jyzb.doc.ProductBatchDoc;
import com.junmp.jyzb.entity.ProductBatch;
import com.junmp.jyzb.entity.ProductTag;
import com.junmp.jyzb.service.ProductBatchService;
import com.junmp.jyzb.service.ProductTagService;
import com.junmp.v2.common.bean.request.ValidationApi;
import com.junmp.v2.common.bean.response.ApiRes;
import com.junmp.v2.common.exception.base.ServiceException;
import com.junmp.v2.common.exception.enums.DefaultBizExceptionEnum;
import com.junmp.v2.db.api.page.PageResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* <pre>
*
* 描述:
* 版本:1.0.0
* 日期:2022/8/1 17:59
* 作者:ningzp@junmp.com.cn
* <br>修改记录
* <br>修改日期 修改人 修改内容
* 20221109 ning 修改初始化重复成品码严重的BUG.
* </pre>
*/
@RestController
@Slf4j
@RequestMapping("/api")
public class ProductBatchController implements ProductBatchDoc {
@Resource
private ProductBatchService productBatchService;
@Resource
private ProductTagService productTagService;
@PostMapping(path = "/batch/produce", name = "生产产品批次")
public ApiRes<Boolean> makeProduct(@RequestBody @Validated(ValidationApi.detail.class) ProductBatchReq req) {
if (ObjectUtil.isNotNull(req) && ObjectUtil.isNotNull(req.getBatchId())) {
ProductBatchDto dto = productBatchService.getBatchDetail(req.getBatchId());
List<ProductTag> list = batchTagInfo(dto);
if (null != list && list.size() > 0) {
productTagService.saveBatch(list);
//更新已完成
ProductBatch pb = new ProductBatch();
pb.setBatchId(req.getBatchId());
pb.setHasInit(true);
productBatchService.updateById(pb);
return ApiRes.success();
} else {
return ApiRes.failure("没有可生产数据");
}
} else {
return ApiRes.failure(DefaultBizExceptionEnum.VALID_PARAMS_ERROR);
}
}
@PostMapping(path = "/batch", name = "新增产品批次")
@Override
public ApiRes<Boolean> addProductBatch(@RequestBody @Validated(ValidationApi.add.class) ProductBatchReq req) {
boolean flag = productBatchService.addProductBatch(req);
if (flag) {
return ApiRes.success();
} else {
log.warn(StrUtil.format("请求的参数:{}", JSONUtil.toJsonStr(req)));
return ApiRes.failure(StrUtil.format("保存失败"));
}
}
@PutMapping(path = "/batch", name = "更新产品批次")
@Override
public ApiRes<Boolean> editProductBatch(@RequestBody @Validated(ValidationApi.edit.class) ProductBatchReq req) {
boolean flag = productBatchService.editProductBatch(req);
if (flag) {
return ApiRes.success();
} else {
log.warn(StrUtil.format("请求的参数:{}", JSONUtil.toJsonStr(req)));
return ApiRes.failure(StrUtil.format("更新失败"));
}
}
@DeleteMapping(path = "/batch", name = "删除产品批次")
@Override
public ApiRes<Boolean> delBatch(@RequestBody @Validated(ValidationApi.delete.class) ProductBatchReq req) {
try {
boolean flag = productBatchService.del(req);
if (flag) {
return ApiRes.success();
} else {
return ApiRes.failure("删除失败");
}
} catch (ServiceException ex) {
return ApiRes.failure(ex.getMessage());
}
}
@GetMapping(path = "/batch/page", name = "分页批次数据")
@Override
public ApiRes<PageResult<ProductBatchDto>> getPage(ProductBatchReq req) {
return ApiRes.success(productBatchService.findPage(req));
}
@GetMapping(path = "/batch/process/page", name = "分页批次数据")
@Override
public ApiRes<PageResult<ProductProcessDto>> getProcessPage(ProductBatchReq req) {
return ApiRes.success(productBatchService.findProcessPage(req));
}
/**
* 批次信息
*
*
*/
private List<ProductTag> batchTagInfo(ProductBatchDto batch) {
if (batch.getHasInit()) {
throw new ServiceException(ProductExceptionEnum.BATCH_PROCESSED_DONE);
} else {
List<ProductTag> list = new ArrayList<>();
Integer total = batch.getTotal();
//修改已知的BUG 。重复成品码的根源
Integer initVal = batch.getInitNum() > 0 ? batch.getInitNum() + 1 : 1;
for (; initVal <= total; initVal++) {
ProductTag tag = new ProductTag();
tag.setBatchId(batch.getBatchId());
tag.setProductId(batch.getProductId());
tag.setSpecId(batch.getSpecId());
tag.setProduceTime(new Date());
tag.setSerialId(initVal);
//成品码
StringBuilder sb = new StringBuilder();
String serialNo = GenCodeUtil.splicingZero(String.valueOf(initVal), 4);
sb.append(batch.getBatchNo())
.append(serialNo);
tag.setProductCode(sb.toString());
tag.setHasInit(false);
tag.setHasChecked(false);
list.add(tag);
}
return list;
}
}
}
package com.junmp.jyzb.controller;
import com.junmp.jyzb.api.bean.req.ProductReq;
import com.junmp.jyzb.doc.ProductDoc;
import com.junmp.jyzb.entity.Product;
import com.junmp.jyzb.service.ProductService;
import com.junmp.v2.common.bean.response.ApiRes;
import com.junmp.v2.db.api.page.PageResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* <pre>
*
* 描述:
* 版本:1.0.0
* 日期:2022/8/1 16:25
* 作者:ningzp@junmp.com.cn
* <br>修改记录
* <br>修改日期 修改人 修改内容
*
* </pre>
*/
@RestController
@Slf4j
@RequestMapping("/api")
public class ProductController implements ProductDoc {
@Resource
private ProductService productService;
@PostMapping(path = "/product", name = "新增产品")
@Override
public ApiRes<Boolean> addProduct(@RequestBody @Validated(ProductReq.add.class) ProductReq req) {
return ApiRes.success(productService.addProduct(req));
}
@PutMapping(path = "/product", name = "编辑产品")
@Override
public ApiRes<Boolean> editProduct(@RequestBody @Validated(ProductReq.edit.class) ProductReq req) {
return ApiRes.success(productService.editProduct(req));
}
@GetMapping(path = "/product", name = "产品列表")
@Override
public ApiRes<List<Product>> list(ProductReq req) {
return ApiRes.success(productService.findList(req));
}
@DeleteMapping(path = "/product", name = "删除产品")
@Override
public ApiRes<Boolean> delProduct(@RequestBody @Validated(ProductReq.delete.class)ProductReq req) {
return ApiRes.success(productService.del(req));
}
@GetMapping(path = "/product/page", name = "产品分页")
@Override
public ApiRes<PageResult<Product>> page(ProductReq req) {
return ApiRes.success(productService.findPage(req));
}
}
package com.junmp.jyzb.controller;
import cn.hutool.core.util.ObjectUtil;
import com.junmp.jyzb.api.bean.req.ProductSkuReq;
import com.junmp.jyzb.api.bean.vo.ProductSkuVo;
import com.junmp.jyzb.doc.ProductSkuDoc;
import com.junmp.jyzb.entity.ProductSku;
import com.junmp.jyzb.service.ProductSkuService;
import com.junmp.v2.common.bean.request.ValidationApi;
import com.junmp.v2.common.bean.response.ApiRes;
import com.junmp.v2.common.exception.base.ServiceException;
import com.junmp.v2.common.exception.enums.DefaultBizExceptionEnum;
import com.junmp.v2.common.util.BeanPlusUtil;
import com.junmp.v2.db.api.page.PageResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* <pre>
*
* 描述:
* 版本:1.0.0
* 日期:2022/8/1 17:59
* 作者:ningzp@junmp.com.cn
* <br>修改记录
* <br>修改日期 修改人 修改内容
*
* </pre>
*/
@RestController
@Slf4j
@RequestMapping("/api")
public class ProductSkuController implements ProductSkuDoc {
@Resource
private ProductSkuService productSkuService;
@PostMapping(path = "/spec", name = "新增号型")
@Override
public ApiRes<Boolean> addProductSku(@RequestBody @Validated(ProductSkuReq.add.class) ProductSkuReq req) {
try {
productSkuService.addProductSku(req);
return ApiRes.success();
} catch (ServiceException ex) {
log.error("新增号型异常>>" + ex.getMessage());
return ApiRes.failure(DefaultBizExceptionEnum.SYS_RUNTIME_ERROR);
}
}
@PutMapping(path = "/spec", name = "编辑号型")
@Override
public ApiRes<Boolean> editProductSku(@RequestBody @Validated(ProductSkuReq.edit.class)ProductSkuReq req) {
return ApiRes.success(productSkuService.editProductSku(req));
}
@DeleteMapping(path = "/spec", name = "删除号型")
@Override
public ApiRes<Boolean> del(@RequestBody @Validated(ValidationApi.delete.class)ProductSkuReq req) {
return ApiRes.success(productSkuService.del(req));
}
@GetMapping(path = "/spec/page", name = "分页号型")
@Override
public ApiRes<PageResult<ProductSku>> page(ProductSkuReq req) {
return ApiRes.success(productSkuService.findPage(req));
}
@GetMapping(path = "/spec/getByProduct", name = "获取指定产品号型列表")
@Override
public ApiRes<List<ProductSkuVo>> listByProduct(ProductSkuReq req) {
if (ObjectUtil.isNotNull(req) && ObjectUtil.isNotNull(req.getProductId())) {
List<ProductSku> list = productSkuService.findList(req);
return ApiRes.success(BeanPlusUtil.toBeanList(list, ProductSkuVo.class));
} else {
return ApiRes.failure("产品编号不能为空");
}
}
}
package com.junmp.jyzb.controller;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.HexUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.junmp.jyzb.api.bean.dto.ProductTagDto;
import com.junmp.jyzb.api.bean.req.ProductTagReq;
import com.junmp.jyzb.api.bean.vo.TagInfoVo;
import com.junmp.jyzb.api.exception.enums.ProductExceptionEnum;
import com.junmp.jyzb.doc.ProductTagDoc;
import com.junmp.jyzb.entity.ProductTag;
import com.junmp.jyzb.service.ProductTagService;
import com.junmp.v2.common.bean.response.ApiRes;
import com.junmp.v2.common.exception.enums.DefaultBizExceptionEnum;
import com.junmp.v2.db.api.page.PageResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.Date;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
/**
* <pre>
*
* 描述:
* 版本:1.0.0
* 日期:2022/8/1 17:59
* 作者:ningzp@junmp.com.cn
* <br>修改记录
* <br>修改日期 修改人 修改内容
*
* </pre>
*/
@RestController
@Slf4j
@RequestMapping("/api")
public class ProductTagController implements ProductTagDoc {
@Resource
private ProductTagService productTagService;
/**
* 前端参数包括:batchId 和 tagUid
*/
@PostMapping(path = "/tag/updateUid", name = "更新标签UID")
@Override
public ApiRes<TagInfoVo> updateUid(@RequestBody ProductTagReq req) {
ProductTag info = productTagService.checkTagUid(req);
info.setTagUid(req.getTagUid());
info.setHasInit(true);
boolean flag = productTagService.updateById(info);
if (flag) {
String hexStr = HexUtil.encodeHexStr(info.getProductCode());
return ApiRes.success(TagInfoVo.builder().tagId(info.getTagId()).content(hexStr).build());
} else {
return ApiRes.failure("UID数据更新失败");
}
}
/**
* 前端参数包括:tagId,password,ciphertext
*/
@PostMapping(path = "/tag/updateContent", name = "更新内容")
@Override
public ApiRes<TagInfoVo> updateContent(@RequestBody ProductTagReq req) {
if (ObjectUtil.isNotNull(req) && ObjectUtil.isNotNull(req.getTagId())) {
ProductTag info = productTagService.getById(req.getTagId());
if (null != info) {
info.setPassword(req.getPassword());
info.setCiphertext(req.getCiphertext());
boolean flag = productTagService.updateById(info);
if (flag) {
//查询视图获取数据
ProductTagDto dto = productTagService.getTagInfo(req.getTagId());
StringBuilder tmp = new StringBuilder();
Set<String> params = new LinkedHashSet<>();
if (StrUtil.isNotBlank(dto.getCompanyName())) {
tmp.append("厂家:{}\n");
params.add(dto.getCompanyName());
}
if (StrUtil.isNotBlank(dto.getProductName())) {
tmp.append("名称:{}\n");
params.add(dto.getProductName());
}
if (StrUtil.isNotBlank(dto.getSpec())) {
tmp.append("规格:{}\n");
params.add(dto.getSpec());
}
if (StrUtil.isNotBlank(dto.getMaterial())) {
tmp.append("材质:{}\n");
params.add(dto.getMaterial());
}
if (StrUtil.isNotBlank(dto.getWeight())) {
tmp.append("重量:{}\n");
params.add(dto.getWeight());
}
//厂家:{}\n日期:{}
tmp.append("编号:{}\n");
params.add(dto.getProductCode());
//写入广告语
if (StrUtil.isNotBlank(dto.getAdInfo())) {
tmp.append("{}\n");
params.add(dto.getAdInfo());
}
log.info(StrUtil.format("待写入的模板:{}", tmp.toString()));
//String abc = "名称:{}\n规格:{}\n重量:{}\n厂家:{}\n日期:{}\n编号:{}\n";
String content = StrUtil.format(tmp.toString(), params.toArray());
log.info(StrUtil.format("写入的内容:{}", content));
TagInfoVo infoVo = TagInfoVo.builder()
.tagId(req.getTagId())
.productCode(dto.getCiphertext())
.content(content).build();
log.info(StrUtil.format("写入芯片的内容>>", JSONUtil.toJsonStr(info)));
return ApiRes.success(infoVo);
} else {
return ApiRes.failure("UID数据更新失败");
}
} else {
return ApiRes.failure(ProductExceptionEnum.TAG_INFO_NOT_EXISTS);
}
} else {
return ApiRes.failure(DefaultBizExceptionEnum.VALID_PARAMS_ERROR);
}
}
/**
* 前端参数:tagUid,productCode
*/
@PostMapping(path = "/tag/check", name = "复检接口")
public ApiRes<Boolean> checkTag(@RequestBody ProductTagReq req) {
if (ObjectUtil.isNotNull(req) &&
ObjectUtil.isNotNull(req.getTagUid()) &&
ObjectUtil.isNotNull(req.getProductCode())) {
String code = HexUtil.decodeHexStr(req.getProductCode());
req.setProductCode(code);
List<ProductTag> list = productTagService.findList(req);
if (CollectionUtil.isNotEmpty(list) && list.size() == 1) {
ProductTag tag = list.get(0);
log.info(StrUtil.format("复检结果为:{}", JSONUtil.toJsonStr(tag)));
if (tag.getHasChecked()) {
log.warn("该产品已完成自检,编号为:{}", req.getTagUid());
return ApiRes.success();
}
if (ObjectUtil.isNotNull(tag)) {
//更新为已经复检
tag.setHasChecked(true);
tag.setCheckTime(new Date());
productTagService.updateById(tag);
return ApiRes.success();
} else {
return ApiRes.failure(ProductExceptionEnum.TAG_INFO_NOT_EXISTS);
}
} else {
return ApiRes.failure(ProductExceptionEnum.TAG_INFO_REPEAT_ERROR);
}
} else {
return ApiRes.failure(DefaultBizExceptionEnum.VALID_PARAMS_ERROR);
}
}
@GetMapping(path = "/tag/page", name = "分页标签")
public ApiRes<PageResult<ProductTag>> getPage(ProductTagReq req) {
return ApiRes.success(productTagService.findPage(req));
}
}
package com.junmp.jyzb.controller;
import com.junmp.jyzb.service.PubOrgService;
import com.junmp.jyzb.utils.HttpStatus;
import com.junmp.jyzb.utils.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
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 java.util.List;
import java.util.Map;
@RestController
@Slf4j
@RequestMapping("/PubOrg")
@Api(tags = "组织机构模块")
public class PubOrgController {
@Resource
public PubOrgService equipmentTypeService;
@PostMapping("/ShowPubOrgList")
@ApiOperation("查询物资列表_简化版")
public ResponseResult ShowEquipmentList(@RequestBody Map<String, Object> orgId) {
//传入当前的组织机构id,展示所有本级及下级的
ResponseResult returnMsg = equipmentTypeService.showPubOrgList(orgId);
return returnMsg;
}
@PostMapping("/ShowPubOrgListOld")
@ApiOperation("查询物资列表_完整版")
public ResponseResult showPubOrgListOld(@RequestBody Map<String, Object> orgId) {
//传入当前的组织机构id,展示所有本级及下级的
ResponseResult returnMsg = equipmentTypeService.showPubOrgListOld(orgId);
return returnMsg;
}
}
package com.junmp.jyzb.controller;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.toolkit.AES;
import com.junmp.jyzb.api.bean.req.DbAccessReq;
import com.junmp.jyzb.api.bean.vo.AuthAccessVo;
import com.junmp.v2.common.bean.response.ApiRes;
import com.junmp.v2.common.exception.enums.DefaultBizExceptionEnum;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <pre>
*
* 描述:
* 版本:1.0.0
* 日期:2022/8/30 16:24
* 作者:ningzp@junmp.com.cn
* <br>修改记录
* <br>修改日期 修改人 修改内容
*
* </pre>
*/
@Slf4j
@RestController
@RequestMapping("/api")
public class PublicController {
private final static String DB_URL_TEMPLATE = "jdbc:mysql://{}:{}/{}?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=CTT&nullCatalogMeansCurrent=true";
@GetMapping(path = "/pub/authInfo", name = "生成数据库认证信息")
public ApiRes<AuthAccessVo> genAccessInfo(DbAccessReq req) {
if (null != req && StrUtil.isNotEmpty(req.getDbName())
&& StrUtil.isNotEmpty(req.getHost())
&& ObjectUtil.isNotNull(req.getPort())
&& StrUtil.isNotEmpty(req.getUsername())
&& StrUtil.isNotEmpty(req.getPassword())) {
String rmdKey = AES.generateRandomKey();
String dbUrl = StrUtil.format(DB_URL_TEMPLATE, req.getHost(), req.getPort(), req.getDbName());
String enDbUrl = AES.encrypt(dbUrl, rmdKey);
String enUserName = AES.encrypt(req.getUsername(), rmdKey);
String enPassword = AES.encrypt(req.getPassword(), rmdKey);
return ApiRes.success(new AuthAccessVo(rmdKey, enDbUrl, enUserName, enPassword));
} else {
return ApiRes.failure(DefaultBizExceptionEnum.VALID_PARAMS_ERROR);
}
}
}
package com.junmp.jyzb.controller;
import com.junmp.jyzb.service.SupplierService;
import com.junmp.jyzb.service.WarehouseService;
import com.junmp.jyzb.utils.HttpStatus;
import com.junmp.jyzb.utils.RequestParam;
import com.junmp.jyzb.utils.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
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 java.util.ArrayList;
import java.util.List;
import java.util.Map;
@RestController
@Slf4j
@RequestMapping("/Supplier")
@Api(tags = "供应商基础信息模块")
public class SupplierController {
@Resource
public SupplierService supplierService;
@PostMapping("/AddSupplier")
@ApiOperation("添加供应商")
public ResponseResult addSupplier(@RequestBody Map<String,Object> msg) {
ResponseResult returnMsg = supplierService.addSupplier(msg);
return returnMsg;
}
@PostMapping("/DeleteSupplier")
@ApiOperation("删除供应商信息")
public ResponseResult deleteSupplier(@RequestBody Map<String,Object> msg) {
ResponseResult returnMsg = supplierService.deleteSupplier(msg);
return returnMsg;
}
@PostMapping("/ShowSupplier")
@ApiOperation("查询供应商列表")
public ResponseResult getAllSupplier(@RequestBody Map<String,Object> msg){
ResponseResult returnMsg = supplierService.getAllSupplier(msg);
return returnMsg;
}
// @PostMapping("/GetOneSupplier")
// @ApiOperation("查询单个供应商信息")
// public ResponseResult getOneSupplier(@RequestBody Map<String, Object> msg) {
// String supplierId = msg.get("supplierId").toString();
// Map<String, Object> supplierMsg = supplierService.getOneSupplier(supplierId);
// return new ResponseResult(HttpStatus.SUCCESS,"操作成功",supplierMsg);
// }
@PostMapping("/UpdateSupplier")
@ApiOperation("修改供应商信息")
public ResponseResult updateSupplier(@RequestBody Map<String,Object> msg) {
ResponseResult returnMsg = supplierService.updateSupplier(msg);
return returnMsg;
}
@PostMapping("/ChangeSupplierState")
@ApiOperation("修改警员状态")
public ResponseResult changeSupplierState(@RequestBody Map<String,Object> msg) {
ResponseResult returnMsg = supplierService.changeSupplierState(msg);
return returnMsg;
}
}
package com.junmp.jyzb.controller;
import com.junmp.jyzb.utils.ResponseResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@Slf4j
@RequestMapping("/api")
public class TestController {
@RequestMapping("/hello")
public ResponseResult Hello(){
return new ResponseResult(10000,"操作成功","hello");
}
}
package com.junmp.jyzb.controller;
import com.junmp.jyzb.service.PoliceFingerService;
import com.junmp.jyzb.service.PolicemanService;
import com.junmp.jyzb.service.WarehouseService;
import com.junmp.jyzb.utils.HttpStatus;
import com.junmp.jyzb.utils.ResponseResult;
import com.junmp.jyzb.utils.ReturnData;
import com.junmp.jyzb.utils.ReturnMsg;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
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 java.util.ArrayList;
import java.util.List;
import java.util.Map;
@RestController
@Slf4j
@RequestMapping("/Warehouse")
@Api(tags = "仓库基础信息模块")
public class WarehouseController {
@Resource
public WarehouseService warehouseService;
@PostMapping("/AddWarehouse")
@ApiOperation("添加仓库")
public ResponseResult addWarehouse(@RequestBody Map<String,Object> msg) {
ResponseResult returnMsg = warehouseService.addWarehouse(msg);
return returnMsg;
}
@PostMapping("/DeleteWarehouse")
@ApiOperation("删除仓库信息")
public ResponseResult deleteWarehouse(@RequestBody Map<String,Object> msg) {
ResponseResult returnMsg = warehouseService.deleteWarehouse(msg);
return returnMsg;
}
@PostMapping("/ChangeWarehouseState")
@ApiOperation("禁用/启用仓库")
public ResponseResult changeWarehouseState(@RequestBody Map<String,Object> msg) {
ResponseResult returnMsg = warehouseService.changeWarehouseState(msg);
return returnMsg;
}
@PostMapping("/ShowWarehouse")
@ApiOperation("查询仓库列表")
public ResponseResult getAllWarehouse(@RequestBody Map<String, Object> orgId){
ResponseResult returnMsg = warehouseService.getAllWarehouse(orgId);
return returnMsg;
// //获取该组织机构下所有警员的id
// List<Map<String, Object>> allWarehouse=new ArrayList<>();
// List<String> allWarehouseId =warehouseService.getAllWarehouseId(orgId);
// for (String warehouseId :allWarehouseId){
// Map<String, Object> warehouseMsg = warehouseService.getOneWarehouse(warehouseId);
// allWarehouse.add(warehouseMsg);
// }
// return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS,allWarehouse);
}
@PostMapping("/GetWarehouseDetail")
@ApiOperation("查询单个仓库信息")
public ResponseResult getOneWarehouse(@RequestBody Map<String, Object> msg) {
ResponseResult returnMsg = warehouseService.getOneWarehouse(msg);
return returnMsg;
}
@PostMapping("/UpdateWarehouse")
@ApiOperation("修改仓库信息")
public ResponseResult updateWarehouse(@RequestBody Map<String,Object> msg) {
ResponseResult returnMsg = warehouseService.updateWarehouse(msg);
return returnMsg;
}
@PostMapping("/AddArea")
@ApiOperation("添加区域")
public ResponseResult addArea(@RequestBody Map<String,Object> msg) {
ResponseResult returnMsg = warehouseService.addArea(msg);
return returnMsg;
}
@PostMapping("/UpdateArea")
@ApiOperation("修改区域")
public ResponseResult updateArea(@RequestBody Map<String,Object> msg) {
ResponseResult returnMsg = warehouseService.updateArea(msg);
return returnMsg;
}
@PostMapping("/DeleteArea")
@ApiOperation("删除区域")
public ResponseResult deleteArea(@RequestBody Map<String,Object> msg) {
ResponseResult returnMsg = warehouseService.deleteArea(msg);
return returnMsg;
}
@PostMapping("/GetAreaList")
@ApiOperation("查询区域信息")
public ResponseResult getAreaList(@RequestBody Map<String, Object> msg){
ResponseResult returnMsg = warehouseService.getAreaList(msg);
return returnMsg;
}
@PostMapping("/AddShelf")
@ApiOperation("添加货架")
public ResponseResult addShelf(@RequestBody Map<String,Object> msg) {
ResponseResult returnMsg = warehouseService.addShelf(msg);
return returnMsg;
}
@PostMapping("/UpdateShelf")
@ApiOperation("修改货架")
public ResponseResult updateShelf(@RequestBody Map<String,Object> msg) {
ResponseResult returnMsg = warehouseService.updateShelf(msg);
return returnMsg;
}
@PostMapping("/DeleteShelf")
@ApiOperation("删除货架")
public ResponseResult deleteShelf(@RequestBody Map<String,Object> msg) {
ResponseResult returnMsg = warehouseService.deleteShelf(msg);
return returnMsg;
}
@PostMapping("/GetShelfList")
@ApiOperation("查询区域信息")
public ResponseResult getShelfList(@RequestBody Map<String, Object> msg){
ResponseResult returnMsg = warehouseService.getShelfList(msg);
return returnMsg;
}
}
package com.junmp.jyzb.doc;
import com.junmp.jyzb.api.bean.req.CompanyReq;
import com.junmp.jyzb.entity.Company;
import com.junmp.v2.common.bean.response.ApiRes;
import com.junmp.v2.db.api.page.PageResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.util.List;
/**
* <pre>
*
* 描述:
* 版本:1.0.0
* 日期:2022/8/1 10:47
* 作者:ningzp@junmp.com.cn
* <br>修改记录
* <br>修改日期 修改人 修改内容
*
* </pre>
*/
@Api(value = "企业管理", tags = "企业管理接口")
public interface CompanyDoc {
/**
* 新增企业
*/
@ApiOperation(value = "新增企业", tags = "企业管理接口")
ApiRes<Boolean> addBiz(CompanyReq req);
/**
* 更新企业
*/
@ApiOperation(value = "更新企业", tags = "企业管理接口")
ApiRes<Boolean> editBiz(CompanyReq req);
/**
* 获取所有企业
*/
@ApiOperation(value = "获取所有企业", tags = "企业管理接口")
ApiRes<List<Company>> list(CompanyReq req);
/**
* 删除企业
*/
@ApiOperation(value = "删除企业",tags = "企业管理接口")
ApiRes<Boolean> delBiz(CompanyReq req);
/**
* 企业信息分页
*/
@ApiOperation(value = "分页企业信息", tags = "企业管理接口")
ApiRes<PageResult<Company>> page(CompanyReq req);
}
package com.junmp.jyzb.doc;
import com.junmp.v2.auth.api.bean.auth.LoginReq;
import com.junmp.v2.auth.api.bean.auth.LoginRes;
import com.junmp.v2.common.bean.response.ApiRes;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
/**
* <pre>
*
* 描述:
* 版本:1.0.0
* 日期:2022/8/1 17:05
* 作者:ningzp@junmp.com.cn
* <br>修改记录
* <br>修改日期 修改人 修改内容
*
* </pre>
*/
@Api(value = "登录登出管理", tags = "登录管理接口")
public interface LoginDoc {
/**
* 登录
*
* @param req
*/
@ApiOperation(value = "用户登录", tags = "登录管理接口")
ApiRes<LoginRes> login(LoginReq req);
/**
* 登出
*/
@ApiOperation(value = "用户退出", tags = "登录管理接口")
ApiRes<Boolean> logout();
}
package com.junmp.jyzb.doc;
import com.junmp.jyzb.api.bean.dto.ProductBatchDto;
import com.junmp.jyzb.api.bean.dto.ProductProcessDto;
import com.junmp.jyzb.api.bean.req.ProductBatchReq;
import com.junmp.v2.common.bean.response.ApiRes;
import com.junmp.v2.db.api.page.PageResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
/**
* <pre>
*
* 描述:
* 版本:1.0.0
* 日期:2022/8/1 18:12
* 作者:ningzp@junmp.com.cn
* <br>修改记录
* <br>修改日期 修改人 修改内容
*
* </pre>
*/
@Api(value = "生产管理", tags = "生产管理接口")
public interface ProductBatchDoc {
/**
* 生产标签
*
* @param req
*/
@ApiOperation(value = "生产初始化", tags = "生产管理接口")
ApiRes<Boolean> makeProduct(ProductBatchReq req);
/**
* 新增批次信息
*/
@ApiOperation(value = "新增批次信息", tags = "生产管理接口")
ApiRes<Boolean> addProductBatch(ProductBatchReq req);
/**
* 更新批次信息
*/
@ApiOperation(value = "更新批次信息", tags = "生产管理接口")
ApiRes<Boolean> editProductBatch(ProductBatchReq req);
/**
* 删除批次信息
*/
@ApiOperation(value = "删除批次信息", tags = "生产管理接口")
ApiRes<Boolean> delBatch(ProductBatchReq req);
/**
* 分页批次信息
*/
@ApiOperation(value = "分页批次信息", tags = "生产管理接口")
ApiRes<PageResult<ProductBatchDto>> getPage(ProductBatchReq req);
/**
* 分页批次信息
*/
@ApiOperation(value = "分页批次进度信息", tags = "生产管理接口")
ApiRes<PageResult<ProductProcessDto>> getProcessPage(ProductBatchReq req);
}
package com.junmp.jyzb.doc;
import com.junmp.jyzb.api.bean.req.ProductReq;
import com.junmp.jyzb.entity.Product;
import com.junmp.v2.common.bean.response.ApiRes;
import com.junmp.v2.db.api.page.PageResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.util.List;
/**
* <pre>
*
* 描述:
* 版本:1.0.0
* 日期:2022/8/1 16:25
* 作者:ningzp@junmp.com.cn
* <br>修改记录
* <br>修改日期 修改人 修改内容
*
* </pre>
*/
@Api(value = "产品管理", tags = "产品管理接口")
public interface ProductDoc {
/**
* 新增产品
*/
@ApiOperation(value = "新增产品", tags = "产品管理接口")
ApiRes<Boolean> addProduct(ProductReq req);
/**
* 更新产品
*/
@ApiOperation(value = "更新产品", tags = "产品管理接口")
ApiRes<Boolean> editProduct(ProductReq req);
/**
* 获取所有产品
*/
@ApiOperation(value = "获取所有产品", tags = "产品管理接口")
ApiRes<List<Product>> list(ProductReq req);
/**
* 删除产品
*/
@ApiOperation(value = "删除产品",tags = "产品管理接口")
ApiRes<Boolean> delProduct(ProductReq req);
/**
* 分页产品信息
*/
@ApiOperation(value = "分页产品信息", tags = "产品管理接口")
ApiRes<PageResult<Product>> page(ProductReq req);
}
package com.junmp.jyzb.doc;
import com.junmp.jyzb.api.bean.req.ProductSkuReq;
import com.junmp.jyzb.api.bean.vo.ProductSkuVo;
import com.junmp.jyzb.entity.ProductSku;
import com.junmp.v2.common.bean.response.ApiRes;
import com.junmp.v2.db.api.page.PageResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.util.List;
/**
* <pre>
*
* 描述:
* 版本:1.0.0
* 日期:2022/8/1 18:00
* 作者:ningzp@junmp.com.cn
* <br>修改记录
* <br>修改日期 修改人 修改内容
*
* </pre>
*/
@Api(value = "号型管理", tags = "产品号型接口")
public interface ProductSkuDoc {
/**
* 新增产品号型
*
* @param req
*/
@ApiOperation(value = "新增产品号型", tags = "产品号型接口")
ApiRes<Boolean> addProductSku(ProductSkuReq req);
/**
* 新增产品号型
*
* @param req
*/
@ApiOperation(value = "编辑号型", tags = "产品号型接口")
ApiRes<Boolean> editProductSku(ProductSkuReq req);
/**
* 新增产品号型
*
* @param req
*/
@ApiOperation(value = "删除号型", tags = "产品号型接口")
ApiRes<Boolean> del(ProductSkuReq req);
/**
* 新增产品号型
*
* @param req
*/
@ApiOperation(value = "分页产品信息", tags = "产品号型接口")
ApiRes<PageResult<ProductSku>> page(ProductSkuReq req);
/**
* 获取指定产品号型列表
*/
@ApiOperation(value = "获取指定产品号型列表", tags = "产品号型接口")
ApiRes<List<ProductSkuVo>> listByProduct(ProductSkuReq req);
}
package com.junmp.jyzb.doc;
import com.junmp.jyzb.api.bean.req.ProductTagReq;
import com.junmp.jyzb.api.bean.vo.TagInfoVo;
import com.junmp.jyzb.entity.ProductTag;
import com.junmp.v2.common.bean.response.ApiRes;
import com.junmp.v2.db.api.page.PageResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
/**
* <pre>
*
* 描述:
* 版本:1.0.0
* 日期:2022/8/1 18:10
* 作者:ningzp@junmp.com.cn
* <br>修改记录
* <br>修改日期 修改人 修改内容
*
* </pre>
*/
@Api(value = "生产管理", tags = "生产管理接口")
public interface ProductTagDoc {
@ApiOperation(value = "更新产品UID", tags = "生产管理接口")
ApiRes<TagInfoVo> updateUid(ProductTagReq req);
@ApiOperation(value = "更新产品内容", tags = "生产管理接口")
ApiRes<TagInfoVo> updateContent(ProductTagReq req);
@ApiOperation(value = "产品复检", tags = "生产管理接口")
ApiRes<Boolean> checkTag(ProductTagReq req);
@ApiOperation(value = "分页接口", tags = "生产管理接口")
ApiRes<PageResult<ProductTag>> getPage(ProductTagReq req);
}
package com.junmp.jyzb.domain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@ApiModel(value = "com-junmp-jyzb-domain-Cabinet")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Cabinet implements Serializable {
/**
* 单警柜ID
*/
@ApiModelProperty(value = "单警柜ID")
private String id;
/**
* 单警柜编号
*/
@ApiModelProperty(value = "单警柜编号")
private String cabinetNum;
/**
* 箱数
*/
@ApiModelProperty(value = "箱数")
private Integer num;
/**
* 单警柜名称
*/
@ApiModelProperty(value = "单警柜名称")
private String name;
/**
* 组织机构号
*/
@ApiModelProperty(value = "组织机构号")
private String orgId;
/**
* 位置信息
*/
@ApiModelProperty(value = "位置信息")
private String location;
/**
* 单警柜当前状态,0正常,1异常
*/
@ApiModelProperty(value = "单警柜当前状态,0正常,1异常")
private Integer state;
/**
* 创建时间
*/
@ApiModelProperty(value = "创建时间")
private Date createTime;
/**
* 更新时间
*/
@ApiModelProperty(value = "更新时间")
private Date updateTime;
/**
* 更新人员
*/
@ApiModelProperty(value = "更新人员")
private String updateUser;
/**
* 箱数
*/
// @ApiModelProperty(value = "箱数")
// private Integer num;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.junmp.jyzb.domain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@ApiModel(value = "com-junmp-jyzb-domain-CabinetBox")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class CabinetBox implements Serializable {
/**
* 主键ID
*/
@ApiModelProperty(value = "主键ID")
private String id;
/**
* 主柜ID
*/
@ApiModelProperty(value = "主柜ID")
private String cabinetId;
/**
* 警员ID
*/
@ApiModelProperty(value = "警员ID")
private String policeId;
/**
* 警员姓名
*/
@ApiModelProperty(value = "警员姓名")
private String policeName;
/**
* 异常状态:1正常/0异常
*/
@ApiModelProperty(value = "异常状态:1正常/0异常")
private Integer state;
/**
* 异常原因
*/
@ApiModelProperty(value = "异常原因")
private String errorMsg;
/**
* 使用日志存储位置信息
*/
@ApiModelProperty(value = "使用日志存储位置信息")
private String logMap;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.junmp.jyzb.domain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@ApiModel(value = "com-junmp-jyzb-domain-EquipmentSize")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class EquipmentSize implements Serializable {
/**
* 装备号型ID
*/
@ApiModelProperty(value = "装备号型ID")
private String id;
/**
* 装备类型ID
*/
@ApiModelProperty(value = "装备类型ID")
private String typeId;
/**
* 信息关联ID
*/
@ApiModelProperty(value = "信息关联ID")
private String detailId;
/**
* 号型码
*/
@ApiModelProperty(value = "号型码")
private String code;
/**
* 号型名称
*/
@ApiModelProperty(value = "号型名称")
private String name;
/**
* 创建时间
*/
@ApiModelProperty(value = "创建时间")
private Date createTime;
/**
* 更新时间
*/
@ApiModelProperty(value = "更新时间")
private Date updateTime;
/**
* 备注
*/
@ApiModelProperty(value = "备注")
private String note;
/**
* 价格
*/
@ApiModelProperty(value = "价格")
private Double price;
/**
* 当前状态:0关闭/1启用
*/
@ApiModelProperty(value = "当前状态:0关闭/1启用")
private Integer state;
/**
* EPC类型
*/
@ApiModelProperty(value = "EPC类型")
private Integer epcType;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.junmp.jyzb.domain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@ApiModel(value = "com-junmp-jyzb-domain-EquipmentType")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class EquipmentType implements Serializable {
/**
* 装备类型ID
*/
@ApiModelProperty(value = "装备类型ID")
private String id;
/**
* 类型名称
*/
@ApiModelProperty(value = "类型名称")
private String name;
/**
* 单位
*/
@ApiModelProperty(value = "单位")
private String unit;
/**
* 单位类型
*/
@ApiModelProperty(value = "单位类型")
private String unitType;
/**
* 装备Code码
*/
@ApiModelProperty(value = "装备Code码")
private String code;
/**
* 上级id
*/
@ApiModelProperty(value = "上级id")
private String parentId;
/**
* 上级ids
*/
@ApiModelProperty(value = "上级id")
private String parentIds;
/**
* 创建时间
*/
@ApiModelProperty(value = "创建时间")
private Date createTime;
/**
* 最后更新时间
*/
@ApiModelProperty(value = "最后更新时间")
private Date updateTime;
/**
* 当前状态:0关闭/1启用
*/
@ApiModelProperty(value = "当前状态:0关闭/1启用")
private Integer state;
/**
* 备注
*/
@ApiModelProperty(value = "备注")
private String note;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.junmp.jyzb.domain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@ApiModel(value = "com-junmp-jyzb-domain-History")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class History implements Serializable {
/**
* 历史记录id
*/
@ApiModelProperty(value = "历史记录id")
private String id;
/**
* 装备类型id
*/
@ApiModelProperty(value = "装备类型id")
private String equipmentId;
/**
* 组织机构id
*/
@ApiModelProperty(value = "组织机构id")
private String organizationId;
/**
* 要查询的时间
*/
@ApiModelProperty(value = "要查询的时间")
private Date searchDate;
/**
* 当月使用次数
*/
@ApiModelProperty(value = "当月使用次数")
private Integer useMonth;
/**
* 当月维修次数
*/
@ApiModelProperty(value = "当月维修次数")
private Integer fixMonth;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.junmp.jyzb.domain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@ApiModel(value = "com-junmp-jyzb-domain-Inventory")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Inventory implements Serializable {
/**
* 装备ID
*/
@ApiModelProperty(value = "装备ID")
private String id;
/**
* 装备包ID
*/
@ApiModelProperty(value = "装备包ID")
private String packageId;
/**
* 装备类型ID
*/
@ApiModelProperty(value = "装备类型ID")
private String typeId;
/**
* 装备类型名称
*/
@ApiModelProperty(value = "装备类型名称")
private String typeName;
/**
* 号型ID
*/
@ApiModelProperty(value = "号型ID")
private String sizeId;
/**
* 供应商ID
*/
@ApiModelProperty(value = "供应商ID")
private String supplierId;
/**
* 供应商名称
*/
@ApiModelProperty(value = "供应商名称")
private String supplierName;
/**
* 货架ID
*/
@ApiModelProperty(value = "货架ID")
private String shelfId;
/**
* 区域信息
*/
@ApiModelProperty(value = "区域信息")
private String locationArea;
/**
* 位置信息
*/
@ApiModelProperty(value = "位置信息")
private String positionMsg;
/**
* EPC信息
*/
@ApiModelProperty(value = "EPC信息")
private String epc;
/**
* 组织机构ID
*/
@ApiModelProperty(value = "组织机构ID")
private String orgId;
/**
* 组织机构名称
*/
@ApiModelProperty(value = "组织机构名称")
private String orgName;
/**
* 状态:0正常/1损坏/2报废/3销毁
*/
@ApiModelProperty(value = "状态:0正常/1损坏/2报废/3销毁")
private Integer state;
/**
* 业务状态:0无业务,1调拨/借用/领用
*/
@ApiModelProperty(value = "业务状态:0无业务,1调拨/借用/领用")
private Integer bussinessState;
/**
* 在库状态:0在库,1出库
*/
@ApiModelProperty(value = "在库状态:0在库,1出库")
private Integer locationState;
/**
* 生产日期
*/
@ApiModelProperty(value = "生产日期")
private Date productionDate;
/**
* 质保期
*/
@ApiModelProperty(value = "质保期")
private Integer warrantyPeriod;
/**
* 维保期
*/
@ApiModelProperty(value = "维保期")
private Integer maintenancePeriod;
/**
* 维修次数
*/
@ApiModelProperty(value = "维修次数")
private Integer fixCount;
/**
* 价格
*/
@ApiModelProperty(value = "价格")
private String price;
/**
* 创建时间
*/
@ApiModelProperty(value = "创建时间")
private Date createTime;
/**
* 更新时间
*/
@ApiModelProperty(value = "更新时间")
private Date updateTime;
/**
* 备注
*/
@ApiModelProperty(value = "备注")
private String note;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.junmp.jyzb.domain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@ApiModel(value = "com-junmp-jyzb-domain-InventorySummary")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class InventorySummary implements Serializable {
/**
* 装备汇总id
*/
@ApiModelProperty(value = "装备汇总id")
private String id;
/**
* 组织机构id
*/
@ApiModelProperty(value = "组织机构id")
private String orgId;
/**
* 组织机构名称
*/
@ApiModelProperty(value = "组织机构名称")
private String orgName;
/**
* 装备类型id
*/
@ApiModelProperty(value = "装备类型id")
private String typeId;
/**
* 类型名称
*/
@ApiModelProperty(value = "类型名称")
private String typeName;
/**
* 装备号型id
*/
@ApiModelProperty(value = "装备号型id")
private String sizeId;
/**
* 号型名称
*/
@ApiModelProperty(value = "号型名称")
private String sizeName;
/**
* 位置类型,0代表仓库,1代表单警柜
*/
@ApiModelProperty(value = "位置类型,0代表仓库,1代表单警柜")
private String locationType;
/**
* 位置信息id
*/
@ApiModelProperty(value = "位置信息id")
private String locationId;
/**
* 位置名称
*/
@ApiModelProperty(value = "位置名称")
private String locationName;
/**
* 区域id
*/
@ApiModelProperty(value = "区域id")
private String locationAreaId;
/**
* 区域信息
*/
@ApiModelProperty(value = "区域信息")
private String locationArea;
/**
* 库存数量
*/
@ApiModelProperty(value = "库存数量")
private Integer number;
/**
* 总价
*/
@ApiModelProperty(value = "总价")
private BigDecimal price;
/**
* 在库数
*/
@ApiModelProperty(value = "在库数")
private Integer stockNumber;
/**
* 出库数量
*/
@ApiModelProperty(value = "出库数量")
private Integer outboundNumber;
/**
* 销毁数量
*/
@ApiModelProperty(value = "销毁数量")
private Integer destructionNumber;
/**
* 过质保数量
*/
@ApiModelProperty(value = "过质保数量")
private Integer expireNumber;
/**
* 创建时间
*/
@ApiModelProperty(value = "创建时间")
private Date createTime;
/**
* 更新时间
*/
@ApiModelProperty(value = "更新时间")
private Date updateTime;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.junmp.jyzb.domain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@ApiModel(value = "com-junmp-jyzb-domain-LogDetail")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class LogDetail implements Serializable {
/**
* 出入库明细ID
*/
@ApiModelProperty(value = "出入库明细ID")
private Integer id;
/**
* 出入库汇总ID
*/
@ApiModelProperty(value = "出入库汇总ID")
private Integer summaryId;
/**
* 单据ID
*/
@ApiModelProperty(value = "单据ID")
private String orderId;
/**
* EPC信息
*/
@ApiModelProperty(value = "EPC信息")
private String epc;
/**
* 装备名称
*/
@ApiModelProperty(value = "装备名称")
private String equipmentName;
/**
* 装备号型
*/
@ApiModelProperty(value = "装备号型")
private String equipmentSize;
/**
* 供应商
*/
@ApiModelProperty(value = "供应商")
private String equipmentSupplier;
/**
* 装备类型:0单件/1装备包
*/
@ApiModelProperty(value = "装备类型:0单件/1装备包")
private Integer equipmentType;
/**
* 状态,0正常/1异常
*/
@ApiModelProperty(value = "状态,0正常/1异常")
private Integer errorState;
/**
* 备注信息
*/
@ApiModelProperty(value = "备注信息")
private String note;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.junmp.jyzb.domain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@ApiModel(value = "com-junmp-jyzb-domain-LogSummary")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class LogSummary implements Serializable {
/**
* 出入库汇总ID
*/
@ApiModelProperty(value = "出入库汇总ID")
private Integer id;
/**
* 组织机构ID
*/
@ApiModelProperty(value = "组织机构ID")
private String orgId;
/**
* 组织机构名称
*/
@ApiModelProperty(value = "组织机构名称")
private String orgName;
/**
* 仓库ID
*/
@ApiModelProperty(value = "仓库ID")
private String warehouseId;
/**
* 仓库名称
*/
@ApiModelProperty(value = "仓库名称")
private String warehouseName;
/**
* 设备标识
*/
@ApiModelProperty(value = "设备标识")
private String device;
/**
* 出入设备:0手持机/1单警柜/2通道
*/
@ApiModelProperty(value = "出入设备:0手持机/1单警柜/2通道")
private Integer deviceType;
/**
* 操作时间
*/
@ApiModelProperty(value = "操作时间")
private Date useTime;
/**
* 操作人员姓名
*/
@ApiModelProperty(value = "操作人员姓名")
private String userName;
/**
* 出入库类型:0出库/1入库
*/
@ApiModelProperty(value = "出入库类型:0出库/1入库")
private Integer outInState;
/**
* 照片信息
*/
@ApiModelProperty(value = "照片信息")
private String picture;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.junmp.jyzb.domain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@ApiModel(value = "com-junmp-jyzb-domain-Package")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Package implements Serializable {
/**
* 装备包ID
*/
@ApiModelProperty(value = "装备包ID")
private String id;
/**
* 包内物资总数
*/
@ApiModelProperty(value = "包内物资总数")
private Integer count;
/**
* 组织机构ID
*/
@ApiModelProperty(value = "组织机构ID")
private String orgId;
/**
* 具体位置ID(仓库/单警柜)
*/
@ApiModelProperty(value = "具体位置ID(仓库/单警柜)")
private String location;
/**
* 货架ID
*/
@ApiModelProperty(value = "货架ID")
private String shelfId;
/**
* 货架名称
*/
@ApiModelProperty(value = "货架名称")
private String shelfName;
/**
* 货架编号
*/
@ApiModelProperty(value = "货架编号")
private String shelfCode;
/**
* 解包状态:0未解包/1已解包
*/
@ApiModelProperty(value = "解包状态:0未解包/1已解包")
private Integer state;
/**
* 是否销毁:0否/1是
*/
@ApiModelProperty(value = "是否销毁:0否/1是")
private Integer isDestroy;
/**
* EPC信息
*/
@ApiModelProperty(value = "EPC信息")
private String epc;
/**
* 标签打印状态:0否/1是
*/
@ApiModelProperty(value = "标签打印状态:0否/1是")
private Integer printState;
/**
* 创建时间
*/
@ApiModelProperty(value = "创建时间")
private Date createTime;
/**
* 更新时间
*/
@ApiModelProperty(value = "更新时间")
private Date updateTime;
/**
* 备注
*/
@ApiModelProperty(value = "备注")
private String note;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.junmp.jyzb.domain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@ApiModel(value = "com-junmp-jyzb-domain-PackageInformation")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class PackageInformation implements Serializable {
/**
* 装备包详细信息id
*/
@ApiModelProperty(value = "装备包详细信息id")
private String id;
/**
* 装备包id
*/
@ApiModelProperty(value = "装备包id")
private String packageId;
/**
* 装备类型id
*/
@ApiModelProperty(value = "装备类型id")
private String typeId;
/**
* 装备类型名称
*/
@ApiModelProperty(value = "装备类型名称")
private String typeName;
/**
* 装备号型id
*/
@ApiModelProperty(value = "装备号型id")
private String sizeId;
/**
* 装备号型名称
*/
@ApiModelProperty(value = "装备号型名称")
private String sizeName;
/**
* 装备数量
*/
@ApiModelProperty(value = "装备数量")
private Integer number;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.junmp.jyzb.domain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@ApiModel(value = "com-junmp-jyzb-domain-PoliceFinger")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class PoliceFinger implements Serializable {
/**
* 指纹id
*/
@ApiModelProperty(value = "指纹id")
private Integer id;
/**
* 警员id
*/
@ApiModelProperty(value = "警员id")
private String policeId;
/**
* 指纹名称
*/
@ApiModelProperty(value = "警员id")
private String name;
/**
* 指纹信息
*/
@ApiModelProperty(value = "指纹信息")
private String fingerInfo;
/**
* 创建时间
*/
@ApiModelProperty(value = "创建时间")
private Date createTime;
/**
* 更新时间
*/
@ApiModelProperty(value = "更新时间")
private Date updateTime;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.junmp.jyzb.domain;
import com.alibaba.druid.sql.dialect.oracle.ast.stmt.OracleCreateTableStatement;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import java.util.Map;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@ApiModel(value="com-junmp-jyzb-domain-Policeman")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Policeman implements Serializable {
/**
* 警员id
*/
@ApiModelProperty(value="警员id")
private String id;
/**
* 警员名称
*/
@ApiModelProperty(value="警员名称")
private String name;
/**
* 单警柜关联id
*/
@ApiModelProperty(value="单警柜关联id")
private String cabinetId;
/**
* 组织机构名称
*/
@ApiModelProperty(value="组织机构名称")
private Cabinet cabinetName;
/**
* 机构代码,一个警员只属于一个机构
*/
@ApiModelProperty(value="机构代码,一个警员只属于一个机构")
private String orgId;
/**
* 机构名称
*/
@ApiModelProperty(value="机构名称")
private PubOrg orgName;
/**
* 警员编号
*/
@ApiModelProperty(value="警员编号")
private String policeCode;
/**
* 警员性别
*/
@ApiModelProperty(value="警员性别")
private String sex;
/**
* 人脸信息
*/
@ApiModelProperty(value="人脸信息")
private String faceInfo;
/**
* 是否已生成对应账号,1表生成,0表未生成
*/
@ApiModelProperty(value="是否已生成对应账号,1表生成,0表未生成")
private Integer isCreatedAccount;
/**
* 门禁编码
*/
@ApiModelProperty(value="门禁编码")
private String doorCode;
/**
* 密码
*/
@ApiModelProperty(value="密码")
private String password;
/**
* 警员照片
*/
@ApiModelProperty(value="警员照片")
private String photo;
/**
* 联系方式
*/
@ApiModelProperty(value="联系方式")
private String phone;
/**
* 创建时间
*/
@ApiModelProperty(value="创建时间")
private Date createTime;
/**
* 最后更新时间
*/
@ApiModelProperty(value="最后更新时间")
private Date updateTime;
/**
* 身份证信息
*/
@ApiModelProperty(value="身份证信息")
private String idCard;
/**
* 更新人员
*/
@ApiModelProperty(value="更新人员")
private String updateUser;
/**
* 警员状态
*/
@ApiModelProperty(value="警员状态")
private Integer state;
/**
* 指纹信息
* */
private List<Map<String, Object>> fingerMsg;
/**
* 警员状态
*/
@ApiModelProperty(value="指纹id")
private Integer fingerId;
/**
* 指纹名称
*/
@ApiModelProperty(value="指纹名称")
private String fingerName;
/**
* 指纹信息
*/
@ApiModelProperty(value="指纹信息")
private String fingerInfo;
/**
* 单警柜关联箱号id
* */
private String cabinetBoxId;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.junmp.jyzb.domain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 组织机构信息
*/
@ApiModel(value="com-junmp-jyzb-domain-PubOrg")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class PubOrg implements Serializable {
/**
* 主键
*/
@ApiModelProperty(value="主键")
private Long orgId;
/**
* 父id,一级节点父id是0
*/
@ApiModelProperty(value="父id,一级节点父id是0")
private Long orgParentId;
/**
* 父ids
*/
@ApiModelProperty(value="父ids")
private String orgParentIds;
/**
* 组织编码
*/
@ApiModelProperty(value="组织编码")
private String orgCode;
/**
* 组织名称
*/
@ApiModelProperty(value="组织名称")
private String orgName;
/**
* 机构类型100企业,101:机构
*/
@ApiModelProperty(value="机构类型100企业,101:机构")
private Short orgType;
/**
* 排序
*/
@ApiModelProperty(value="排序")
private Byte sortVal;
/**
* 状态:1-启用,2-禁用
*/
@ApiModelProperty(value="状态:1-启用,2-禁用")
private Byte statusFlag;
/**
* 描述
*/
@ApiModelProperty(value="描述")
private String remark;
/**
* 删除标记:Y-已删除,N-未删除
*/
@ApiModelProperty(value="删除标记:Y-已删除,N-未删除")
private Short delFlag;
/**
* 机构全称
*/
@ApiModelProperty(value="机构全称")
private String orgFullName;
/**
* 地址
*/
@ApiModelProperty(value="地址")
private String address;
/**
* 联系人
*/
@ApiModelProperty(value="联系人")
private String contact;
/**
* 电话
*/
@ApiModelProperty(value="电话")
private String phone;
/**
* 创建时间
*/
@ApiModelProperty(value="创建时间")
private Date createTime;
/**
* 创建人
*/
@ApiModelProperty(value="创建人")
private Long createUser;
/**
* 更新时间
*/
@ApiModelProperty(value="更新时间")
private Date updateTime;
/**
* 更新人
*/
@ApiModelProperty(value="更新人")
private Long updateUser;
@ApiModelProperty(value="")
private String guid;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.junmp.jyzb.domain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@ApiModel(value="com-junmp-jyzb-domain-Shelf")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Shelf implements Serializable {
/**
* 货架id
*/
@ApiModelProperty(value="货架id")
private String shelfId;
/**
* 货架名称
*/
@ApiModelProperty(value="货架名称")
private String shelfName;
/**
* 编码
*/
@ApiModelProperty(value="编码")
private String code;
/**
* 货架类型Normal:普通货架Smart:智能货架
*/
@ApiModelProperty(value="货架类型Normal:普通货架Smart:智能货架")
private String type;
/**
* 仓库
*/
@ApiModelProperty(value="仓库")
private String warehouseId;
/**
* 货架层数
*/
@ApiModelProperty(value="货架层数")
private Integer shelfRows;
/**
* 单层货架列数
*/
@ApiModelProperty(value="单层货架列数")
private Integer shelfColumns;
/**
* 货架排数(智能货架多货架拼接)
*/
@ApiModelProperty(value="货架排数(智能货架多货架拼接)")
private Integer shelfRanges;
/**
* 智能货架地址
*/
@ApiModelProperty(value="智能货架地址")
private String url;
/**
* 型号
*/
@ApiModelProperty(value="型号")
private String sizeInfo;
@ApiModelProperty(value="")
private Date createTime;
@ApiModelProperty(value="")
private Date updateTime;
@ApiModelProperty(value="")
private String createUser;
@ApiModelProperty(value="")
private String updateUser;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.junmp.jyzb.domain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@ApiModel(value = "com-junmp-jyzb-domain-Supplier")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Supplier implements Serializable {
/**
* 供应商ID
*/
@ApiModelProperty(value = "供应商ID")
private String id;
/**
* 装备类型ID
*/
@ApiModelProperty(value = "装备类型ID")
private String equipmentId;
/**
* 供应商名称
*/
@ApiModelProperty(value = "供应商名称")
private String name;
/**
* 供应商短码
*/
@ApiModelProperty(value = "供应商短码")
private String code;
/**
* 简称
*/
@ApiModelProperty(value = "简称")
private String shortName;
/**
* 联系方式
*/
@ApiModelProperty(value = "联系方式")
private String contacts;
/**
* 创建时间
*/
@ApiModelProperty(value = "创建时间")
private Date createTime;
/**
* 创建人员
*/
@ApiModelProperty(value = "创建人员")
private String createUser;
/**
* 最后更新时间
*/
@ApiModelProperty(value = "最后更新时间")
private Date updateTime;
/**
* 更新人ID
*/
@ApiModelProperty(value = "更新人ID")
private String updateUser;
/**
* 联系方式
*/
@ApiModelProperty(value = "联系方式")
private String phone;
/**
* 状态码
*/
@ApiModelProperty(value = "状态码")
private Integer state;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.junmp.jyzb.domain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@ApiModel(value = "com-junmp-jyzb-domain-SupplierEquipment")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class SupplierEquipment implements Serializable {
/**
* 供应商产品ID
*/
@ApiModelProperty(value = "供应商产品ID")
private String id;
/**
* 供应商代码
*/
@ApiModelProperty(value = "供应商代码")
private String supplierId;
/**
* 产品代码
*/
@ApiModelProperty(value = "产品代码")
private String typeId;
/**
* 状态,0:启用,1:停用
*/
@ApiModelProperty(value = "状态,0:启用,1:停用")
private Integer state;
/**
* 创建时间
*/
@ApiModelProperty(value = "创建时间")
private Date createTime;
/**
* 最后更新时间
*/
@ApiModelProperty(value = "最后更新时间")
private Date updateTime;
/**
* 更新人ID
*/
@ApiModelProperty(value = "更新人ID")
private String updateUser;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.junmp.jyzb.domain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@ApiModel(value="com-junmp-jyzb-domain-SupplierType")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class SupplierType implements Serializable {
/**
* 供应商产品ID
*/
@ApiModelProperty(value="供应商产品ID")
private String id;
/**
* 供应商代码
*/
@ApiModelProperty(value="供应商代码")
private String supplierId;
/**
* 产品代码
*/
@ApiModelProperty(value="产品代码")
private String typeId;
/**
* 状态,0:停用,1:启用
*/
@ApiModelProperty(value="状态,0:停用,1:启用")
private Integer state;
/**
* 创建时间
*/
@ApiModelProperty(value="创建时间")
private Date createTime;
/**
* 最后更新时间
*/
@ApiModelProperty(value="最后更新时间")
private Date updateTime;
/**
* 更新人ID
*/
@ApiModelProperty(value="更新人ID")
private String updateUser;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.junmp.jyzb.domain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@ApiModel(value = "com-junmp-jyzb-domain-Warehouse")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Warehouse implements Serializable {
/**
* 仓库信息表
*/
@ApiModelProperty(value = "仓库信息表")
private String id;
/**
* 仓库名称
*/
@ApiModelProperty(value = "仓库名称")
private String name;
/**
* 仓库地点
*/
@ApiModelProperty(value = "仓库地点")
private String location;
/**
* 联系方式
*/
@ApiModelProperty(value = "联系方式")
private String phone;
/**
* 视屏地址
*/
@ApiModelProperty(value = "视屏地址")
private String video;
/**
* 创建时间
*/
@ApiModelProperty(value = "创建时间")
private Date createTime;
/**
* 修改时间
*/
@ApiModelProperty(value = "修改时间")
private Date updateTime;
/**
* 更新人员
*/
@ApiModelProperty(value = "更新人员")
private String updateUser;
/**
* 新版本组织机构外键
*/
@ApiModelProperty(value = "新版本组织机构外键")
private Integer orgIdInt;
/**
* 是否锁库,1锁库,0未锁库
*/
@ApiModelProperty(value = "是否锁库")
private Integer isLocked;
/**
* 组织机构表id
*/
@ApiModelProperty(value = "组织机构表id")
private String orgId;
/**
* 当前仓库下装备总数
*/
@ApiModelProperty(value = "当前仓库下装备总数")
private Integer sum;
/**
* 出库装备总数
*/
@ApiModelProperty(value = "当前仓库下装备总数")
private Integer outSum;
/**
* 出库装备总数
*/
@ApiModelProperty(value = "当前仓库下装备总数")
private Integer inSum;
/**
* 1表启用,0表禁用
*/
@ApiModelProperty(value = "状态")
private Integer state;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.junmp.jyzb.domain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@ApiModel(value="com-junmp-jyzb-domain-WarehouseArea")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class WarehouseArea implements Serializable {
/**
* 区域主键
*/
@ApiModelProperty(value="区域主键")
private String areaId;
/**
* 区域名称
*/
@ApiModelProperty(value="区域名称")
private String areaName;
/**
* 所属组织机构
*/
@ApiModelProperty(value="所属组织机构")
private Long orgIdInt;
/**
* 所属仓库id
*/
@ApiModelProperty(value="所属仓库id")
private String warehouseId;
/**
* 区域照片
*/
@ApiModelProperty(value="区域照片")
private String photo;
@ApiModelProperty(value="")
private Date createTime;
@ApiModelProperty(value="")
private Date updateTime;
@ApiModelProperty(value="")
private String createUser;
@ApiModelProperty(value="")
private String updateUser;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.junmp.jyzb.domain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@ApiModel(value = "com-junmp-jyzb-domain-YearReport")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class YearReport implements Serializable {
/**
* 年度报表id
*/
@ApiModelProperty(value = "年度报表id")
private String id;
/**
* 组织机构id
*/
@ApiModelProperty(value = "组织机构id")
private String organizationId;
/**
* 年初数量
*/
@ApiModelProperty(value = "年初数量")
private Integer startNum;
/**
* 年末数量
*/
@ApiModelProperty(value = "年末数量")
private Integer endNum;
/**
* 年初金额
*/
@ApiModelProperty(value = "年初金额")
private Integer startMoney;
/**
* 年末金额
*/
@ApiModelProperty(value = "年末金额")
private Integer endMoney;
/**
* 年度销毁数量
*/
@ApiModelProperty(value = "年度销毁数量")
private Integer destructionNum;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.junmp.jyzb.entity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* <pre>
*
* 描述:业务单位信息
* 版本:1.0.0
* 日期:2022/7/29 16:42
* 作者:ningzp@junmp.com.cn
* <br>修改记录
* <br>修改日期 修改人 修改内容
*
* </pre>
*/
@Data
@TableName("biz_company")
public class Company implements Serializable {
/**
* 企业编号
*/
@TableId(value = "biz_id", type = IdType.AUTO)
private Long bizId;
/**
* 当前序号
*/
private Integer sn;
/**
* 企业编码
*/
@TableField("biz_code")
private String bizCode;
/**
* 企业类型
*/
@TableField("biz_type")
private String bizType;
/**
* 简称
*/
@TableField("short_name")
private String shortName;
/**
* 名称
*/
private String name;
private String remark;
@TableField(fill = FieldFill.INSERT, value = "create_time")
private Date createTime;
@TableField(fill = FieldFill.UPDATE, value = "update_time")
private Date updateTime;
}
package com.junmp.jyzb.entity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* <pre>
*
* 描述:
* 版本:1.0.0
* 日期:2022/7/29 16:54
* 作者:ningzp@junmp.com.cn
* <br>修改记录
* <br>修改日期 修改人 修改内容
*
* </pre>
*/
@Data
@TableName("biz_product")
public class Product implements Serializable {
@TableId(value = "product_id", type = IdType.AUTO)
private Long productId;
/**
* 产品代码
*/
@TableField("product_code")
private String productCode;
/**
* 产品当前序号
*/
private Integer sn;
/**
* 产品名称
*/
private String name;
/**
* 条码信息
*/
private String barcode;
/**
* 计量单位
*/
private String unit;
/**
* 重量
*/
private String weight;
/**
* 规格尺寸
*/
private String spec;
/**
* 材质
*/
private String material;
/**
* 图片地址
*/
@TableField("image_url")
private String imageUrl;
/**
* 生产厂家编号
*/
@TableField("mf_biz_id")
private Long mfBizId;
/**
* 生产厂家名称
*/
@TableField(value = "mf_biz_name")
private String mfBizName;
/**
* 广告信息
*/
@TableField(value = "ad_info")
private String adInfo ;
/**
* 创建时间
*/
@TableField(value = "create_time", fill = FieldFill.INSERT)
private Date createTime;
/**
* 更新时间
*/
@TableField(value = "update_time", fill = FieldFill.UPDATE)
private Date updateTime;
}
package com.junmp.jyzb.entity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* <pre>
*
* 描述:产品批次
* 版本:1.0.0
* 日期:2022/7/29 17:10
* 作者:ningzp@junmp.com.cn
* <br>修改记录
* <br>修改日期 修改人 修改内容
*
* </pre>
*/
@Data
@TableName("biz_product_batch")
public class ProductBatch implements Serializable {
/**
* 批次主键
*/
@TableId(value = "batch_id", type = IdType.AUTO)
private Long batchId;
/**
* 批次编号
*/
@TableField(value = "batch_no")
private String batchNo;
private Integer sn;
/**
* 产品编号
*/
@TableField(value = "product_id")
private Long productId;
/**
* 关联号型
*/
@TableField(value = "spec_id")
private Long specId;
/**
* 生产总量
*/
private Integer total;
/**
* 序号前缀
*/
private String prefix;
/**
* 复检是否完成
*/
@TableField(value = "has_finish")
private Boolean hasFinish;
/**
* 生产是否完成
*/
@TableField(value = "has_init")
private Boolean hasInit;
/**
* 创建时间
*/
@TableField(value = "create_time", fill = FieldFill.INSERT)
private Date createTime;
/**
* 更新时间
*/
@TableField(value = "update_time", fill = FieldFill.UPDATE)
private Date updateTime;
}
package com.junmp.jyzb.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
/**
* <pre>
*
* 描述:产品SKU
* 版本:1.0.0
* 日期:2022/7/29 16:19
* 作者:ningzp@junmp.com.cn
* <br>修改记录
* <br>修改日期 修改人 修改内容
*
* </pre>
*/
@Data
@TableName("biz_product_sku")
public class ProductSku implements Serializable {
@TableId(type = IdType.AUTO, value = "spec_id")
private Long specId;
/**
* 号型代码
*/
@TableField(value = "spec_code")
private String specCode;
/**
* SKU编码
*/
@TableField(value = "sku_code")
private String skuCode;
/**
* 序号
*/
private Integer sn;
/**
* 号型
*/
private String spec;
/**
* 重量
*/
private String weight;
/**
* 材质
*/
private String material;
/**
* 关联产品
*/
@TableField(value = "product_id")
private Long productId;
/**
* 预览属性1
*/
private String attr1;
/**
* 预览属性2
*/
private String attr2;
/**
* 预览属性3
*/
private String attr3;
}
package com.junmp.jyzb.entity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* <pre>
*
* 描述:
* 版本:1.0.0
* 日期:2022/7/29 16:16
* 作者:ningzp@junmp.com.cn
* <br>修改记录
* <br>修改日期 修改人 修改内容
*
* </pre>
*/
@Data
@TableName("biz_product_tag")
public class ProductTag implements Serializable {
/**
* 标签编号
*/
@TableId(value = "tag_id", type = IdType.AUTO)
private Long tagId;
/**
* RFID uid
*/
@TableField(value = "tag_uid")
private String tagUid;
/**
* 成品码
*/
@TableField(value = "product_code")
private String productCode;
/**
* 关联生成批次编号
*/
@TableField(value = "batch_id")
private Long batchId;
/**
* 关联生成产品主键
*/
@TableField(value = "product_id")
private Long productId;
/**
* 关联生成号型主键
*/
@TableField(value = "spec_id")
private Long specId;
/**
* 产品序号
*/
@TableField(value = "serial_id")
private Integer serialId;
/**
* 版本编号
*/
@TableField(value = "version_no")
private String versionNo;
/**
* 密文内容
*/
private String ciphertext;
/**
* 生产日期
*/
@TableField(value = "produce_time")
private Date produceTime;
/**
* 复检时间
*/
@TableField(value = "check_time")
private Date checkTime ;
/**
* 密码
*/
private String password;
/**
* 是否初始化
*/
@TableField(value = "has_init")
private Boolean hasInit ;
/**
* 是否复检
*/
@TableField(value = "has_checked")
private Boolean hasChecked;
/**
* 创建时间
*/
@TableField(value = "create_time", fill = FieldFill.INSERT)
private Date createTime;
/**
* 更新时间
*/
@TableField(value = "update_time", fill = FieldFill.UPDATE)
private Date updateTime;
}
package com.junmp.jyzb.mapper;
import com.junmp.jyzb.domain.CabinetBox;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
import java.util.Map;
@Mapper
public interface CabinetBoxMapper {
List<Map<String, Object>> getBoxMsg(String id);
void changeCabinetState(CabinetBox cabinetBox);
String getOneCabinetBox(String cabinetBoxId);
}
\ No newline at end of file
package com.junmp.jyzb.mapper;
import com.junmp.jyzb.domain.Cabinet;
import com.junmp.jyzb.domain.Policeman;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
import java.util.Map;
@Mapper
public interface CabinetMapper {
public int addCabinet(Cabinet cabinet);
public List<Map<String, Object>> getAllCabinet();
Map<String, Object> getOneCabinet(String id);
void deleteCabinet(String id);
void updateCabinet(Cabinet cabinet);
List<String> getAllCabinetId(String orgId);
void changeCabinetState(Cabinet cabinet);
List<String> getAllCabinetBoxId(String id);
Map<String, Object> getCabinetByCabinetNum(String cabinetNum);
List<String> getAllCabinetIdByHighest();
String getCabinetNumById(String id);
}
\ No newline at end of file
package com.junmp.jyzb.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.junmp.jyzb.entity.Company;
import org.apache.ibatis.annotations.Mapper;
/**
* <pre>
*
* 描述:
* 版本:1.0.0
* 日期:2022/7/30 13:45
* 作者:ningzp@junmp.com.cn
* <br>修改记录
* <br>修改日期 修改人 修改内容
*
* </pre>
*/
@Mapper
public interface CompanyMapper extends BaseMapper<Company> {
/**
* 获取当前最大序号
*/
Integer getMaxSn();
/**
* 获取当前最大序号
*/
Integer getMaxSn1();
}
package com.junmp.jyzb.mapper;
import com.junmp.jyzb.domain.EquipmentSize;
import com.junmp.jyzb.domain.Warehouse;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
import java.util.Map;
@Mapper
public interface EquipmentSizeMapper {
public int addSize(EquipmentSize size);
Map<String, Object> getOneSize(String id);
void deleteSize(String id);
void updateSize(EquipmentSize size);
List<String> getAllSizeId(String orgId);
void changeSizeState(EquipmentSize size);
List<String> getSizeByCode(String code);
String getCodeById(String id);
}
\ No newline at end of file
package com.junmp.jyzb.mapper;
import com.junmp.jyzb.domain.EquipmentType;
import com.junmp.jyzb.domain.Warehouse;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
@Mapper
public interface EquipmentTypeMapper {
void addEquipment(EquipmentType equipmentType);
//Map<String, Object> getOneEquipment(String id);
void deleteEquipment(String id);
void updateEquipment(EquipmentType msg);
List<String> getAllEquipmentId(String orgId);
void changeEquipmentState(EquipmentType msg);
List<EquipmentType> selectAllEquipment();
List<Map<String,Object>> getAll();
void addData(List<Map<String, Object>> resultList);
String getIdByParentId(String parentId);
//添加商品的供应商
void addSupplier(@Param("uuid") String uuid,@Param("equipmentType") EquipmentType equipmentType, @Param("supplierList") List<String> supplierList);
void setCalculationId(@Param("numStr") String numStr,@Param("parentId") String parentId);
String getOneEquipmentId(String numStr);
void deleteSupplier(String id);
Map<String,Object> getOneEquipment(EquipmentType equipment);
List<Map<String, Object>> getSupplierByTypeId(EquipmentType equipment);
List<String> getLowestTypeId();
}
\ No newline at end of file
package com.junmp.jyzb.mapper;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface HistoryMapper {
}
\ No newline at end of file
package com.junmp.jyzb.mapper;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface InventoryMapper {
}
\ No newline at end of file
package com.junmp.jyzb.mapper;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface InventorySummaryMapper {
}
\ No newline at end of file
package com.junmp.jyzb.mapper;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface LogDetailMapper {
}
\ No newline at end of file
package com.junmp.jyzb.mapper;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface LogSummaryMapper {
}
\ No newline at end of file
package com.junmp.jyzb.mapper;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface PackageInformationMapper {
}
\ No newline at end of file
package com.junmp.jyzb.mapper;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface PackageMapper {
}
\ No newline at end of file
package com.junmp.jyzb.mapper;
import com.junmp.jyzb.domain.PoliceFinger;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import java.util.List;
import java.util.Map;
@Mapper
public interface PoliceFingerMapper {
List<Map<String, Object>> getFingersByUserId(String userId);
void addFingers(PoliceFinger fingers);
void updateFingers(PoliceFinger finger);
}
\ No newline at end of file
package com.junmp.jyzb.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.junmp.jyzb.domain.Policeman;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
import java.util.Map;
@Mapper
public interface PolicemanMapper extends BaseMapper<Policeman> {
void addPoliceman(Policeman policeman);
Map<String, Object> getOnePolice(String id);
void deletePolice(String id);
void updatePolice(Policeman police);
List<String> getAllPoliceId(String orgId);
void deleteFinger(String fingerId);
List<String> getAllPoliceIdByBoxId(String boxId);
void addFaceInfo(Policeman police);
void changePoliceState(Policeman police);
List<String> getChildren(String id);
List<String> getAllBoxIdByCabinet(String cabinetId);
List<String> getPoliceByPoliceCode(String policeCode);
List<Map<String,Object>> getAllPolice();
List<String> getAllPoliceIdByHighest();
String getPoliceCodeById(String id);
}
\ No newline at end of file
package com.junmp.jyzb.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.junmp.jyzb.api.bean.dto.ProductBatchDto;
import com.junmp.jyzb.api.bean.dto.ProductProcessDto;
import com.junmp.jyzb.api.bean.req.ProductBatchReq;
import com.junmp.jyzb.entity.ProductBatch;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* <pre>
*
* 描述:
* 版本:1.0.0
* 日期:2022/7/30 13:43
* 作者:ningzp@junmp.com.cn
* <br>修改记录
* <br>修改日期 修改人 修改内容
*
* </pre>
*/
@Mapper
public interface ProductBatchMapper extends BaseMapper<ProductBatch> {
/**
* 获取当前最大序号
*/
Integer getMaxSn();
/**
* 指定批次的生成进度
*
* @param batchId 批次号
*/
ProductBatchDto getBatchProcess(@Param("batchId") Long batchId);
/**
* 分页
*
* @param page
* @param req
*/
Page<ProductBatchDto> getBatchPage(@Param("page") Page<ProductBatchDto> page, @Param("batch") ProductBatchReq req);
/**
* 分页
*
* @param page
* @param req
*/
Page<ProductProcessDto> getBatchProcessPage(@Param("page") Page<ProductProcessDto> page, @Param("batch") ProductBatchReq req);
}
package com.junmp.jyzb.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.junmp.jyzb.entity.Product;
import org.apache.ibatis.annotations.Mapper;
/**
* <pre>
*
* 描述:
* 版本:1.0.0
* 日期:2022/7/30 13:44
* 作者:ningzp@junmp.com.cn
* <br>修改记录
* <br>修改日期 修改人 修改内容
*
* </pre>
*/
@Mapper
public interface ProductMapper extends BaseMapper<Product> {
/**
* 获取当前最大序号
*/
Integer getMaxSn();
}
package com.junmp.jyzb.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.junmp.jyzb.entity.ProductSku;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* <pre>
*
* 描述:
* 版本:1.0.0
* 日期:2022/7/29 16:25
* 作者:ningzp@junmp.com.cn
* <br>修改记录
* <br>修改日期 修改人 修改内容
*
* </pre>
*/
@Mapper
public interface ProductSkuMapper extends BaseMapper<ProductSku> {
/**
* 获取当前产品最大序号
*
* @param productId 产品编号
*/
Integer getMaxSn(@Param("productId") Long productId);
/**
* 删除产品对应的号型
*
* @param productId 产品编号
*/
boolean delByProductId(@Param("productId") Long productId);
}
package com.junmp.jyzb.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.junmp.jyzb.api.bean.dto.ProductTagDto;
import com.junmp.jyzb.api.bean.dto.SimpleTagDto;
import com.junmp.jyzb.entity.ProductTag;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* <pre>
*
* 描述:
* 版本:1.0.0
* 日期:2022/7/30 13:45
* 作者:ningzp@junmp.com.cn
* <br>修改记录
* <br>修改日期 修改人 修改内容
*
* </pre>
*/
@Mapper
public interface ProductTagMapper extends BaseMapper<ProductTag> {
/**
* 从指定批次取一条未生成的标签数据
*
* @param batchId 批次号
*/
SimpleTagDto getInitTagInfo(@Param("batchId") Long batchId);
/**
* 获取TAG
*/
ProductTagDto getTagInfoByTagId(@Param("tagId") Long tagId);
}
package com.junmp.jyzb.mapper;
import com.junmp.jyzb.domain.PubOrg;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface PubOrgMapper {
List<PubOrg> selectAllOrg();
Long getOnePubOrg(String orgId);
}
\ No newline at end of file
package com.junmp.jyzb.mapper;
import com.junmp.jyzb.domain.Shelf;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
import java.util.Map;
@Mapper
public interface ShelfMapper {
void addShelf(Shelf shelf);
void updateShelf(Shelf shelf);
void deleteShelf(String shelfId);
List<Map<String, Object>> getShelfList(Shelf shelf);
}
\ No newline at end of file
package com.junmp.jyzb.mapper;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface SupplierEquipmentMapper {
}
\ No newline at end of file
package com.junmp.jyzb.mapper;
import com.junmp.jyzb.domain.Supplier;
import com.junmp.jyzb.domain.Warehouse;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
@Mapper
public interface SupplierMapper {
public int addSupplier(Supplier supplier);
// Map<String, Object> getOneSupplier(String id,Object SelectName,Object SelectCode);
Map<String, Object> getOneSupplier(@Param("id") String id, @Param("SelectName") Object SelectName, @Param("SelectCode") Object SelectCode);
//Map<String, Object> getOneSupplier(@Param("id") String id);
void deleteSupplier(String id);
void updateSupplier(Supplier supplier);
List<String> getAllSupplierId();
void changeSupplierState(Supplier supplier);
List<Map<String, Object>> getAllSupplier();
}
\ No newline at end of file
package com.junmp.jyzb.mapper;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface SupplierTypeMapper {
}
\ No newline at end of file
package com.junmp.jyzb.mapper;
import com.junmp.jyzb.domain.Shelf;
import com.junmp.jyzb.domain.WarehouseArea;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
import java.util.Map;
@Mapper
public interface WarehouseAreaMapper {
void addArea(WarehouseArea warehouseArea);
void updateArea(WarehouseArea warehouseArea);
void deleteArea(String areaId);
List<Map<String, Object>> getAreaList(Shelf shelf);
}
\ No newline at end of file
package com.junmp.jyzb.mapper;
import com.junmp.jyzb.domain.Policeman;
import com.junmp.jyzb.domain.Warehouse;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
import java.util.Map;
@Mapper
public interface WarehouseMapper {
public int addWarehouse(Warehouse warehouse);
Map<String, Object> getOneWarehouse(String id);
void deleteWarehouse(String id);
void updateWarehouse(Warehouse warehouse);
List<String> getAllWarehouseId(String orgId);
void changeWarehouseState(Warehouse warehouse);
List<String> getAllWarehouseIdByHighest();
List<Map<String, Object>> getAllWarehouse();
}
\ No newline at end of file
package com.junmp.jyzb.mapper;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface YearReportMapper {
}
\ No newline at end of file
package com.junmp.jyzb.service;
import java.util.List;
import java.util.Map;
public interface CabinetBoxService{
List<Map<String, Object>> getAllBoxMsg(String id);
}
package com.junmp.jyzb.service;
import com.junmp.jyzb.utils.ResponseResult;
import java.util.List;
import java.util.Map;
public interface CabinetService{
ResponseResult addCabinet(Map<String, Object> msg);
ResponseResult deleteCabinet(Map<String, Object> msg);
List<String> getAllCabinetId(Map<String, Object> orgId);
Map<String, Object> getOneCabinet(String cabinetId);
ResponseResult updateCabinet(Map<String, Object> msg);
ResponseResult changeCabinetState(Map<String, Object> msg);
List<String> getAllCabinetBoxId(String id);
ResponseResult getAllCabinet(Map<String, Object> msg);
ResponseResult getCabinetDetail(Map<String, Object> msg);
}
package com.junmp.jyzb.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.junmp.jyzb.api.bean.req.CompanyReq;
import com.junmp.jyzb.entity.Company;
import com.junmp.v2.db.api.page.PageResult;
import java.util.List;
/**
* <pre>
*
* 描述:
* 版本:1.0.0
* 日期:2022/8/1 09:35
* 作者:ningzp@junmp.com.cn
* <br>修改记录
* <br>修改日期 修改人 修改内容
*
* </pre>
*/
public interface CompanyService extends IService<Company> {
/**
* 新增
*
* @param req
*/
boolean addBiz(CompanyReq req);
/**
* 编辑
*
* @param req
*/
boolean editBiz(CompanyReq req);
/**
* 删除
*
* @param req
*/
boolean del(CompanyReq req);
/**
* 列表信息
*
* @param req
*/
List<Company> findList(CompanyReq req);
/**
* 分页信息
*
* @param req
*/
PageResult<Company> findPage(CompanyReq req);
}
package com.junmp.jyzb.service;
import com.junmp.jyzb.utils.ResponseResult;
import java.util.List;
import java.util.Map;
public interface EquipmentSizeService{
ResponseResult addSize(Map<String, Object> msg);
ResponseResult getOneSize(Map<String,Object> id);
ResponseResult deleteSize(Map<String, Object> msg);
ResponseResult updateSize(Map<String, Object> msg);
List<String> getAllSizeId(Map<String, Object> orgId);
ResponseResult changeSizeState(Map<String, Object> msg);
ResponseResult getAllSize(Map<String, Object> msg);
}
package com.junmp.jyzb.service;
import com.junmp.jyzb.utils.ResponseResult;
import java.util.List;
import java.util.Map;
public interface EquipmentTypeService{
ResponseResult addEquipment(Map<String, Object> msg);
ResponseResult calculationEquipmentId();
ResponseResult deleteEquipment(Map<String, Object> msg);
ResponseResult updateEquipment(Map<String, Object> msg);
ResponseResult changeEquipmentState(Map<String, Object> msg);
List<Map<String, Object>> getEquipmentList();
ResponseResult getOneEquipment(Map<String, Object> msg);
}
package com.junmp.jyzb.service;
public interface HistoryService{
}
package com.junmp.jyzb.service;
public interface InventoryService{
}
package com.junmp.jyzb.service;
public interface InventorySummaryService{
}
package com.junmp.jyzb.service;
public interface LogDetailService{
}
package com.junmp.jyzb.service;
public interface LogSummaryService{
}
package com.junmp.jyzb.service;
public interface PackageInformationService{
}
package com.junmp.jyzb.service;
public interface PackageService{
}
package com.junmp.jyzb.service;
import com.junmp.jyzb.domain.PoliceFinger;
import java.util.List;
import java.util.Map;
public interface PoliceFingerService{
List<Map<String, Object>> getFingersByUserId(String userId);
}
package com.junmp.jyzb.service;
import com.junmp.jyzb.domain.Policeman;
import com.junmp.jyzb.utils.ResponseResult;
import javax.naming.spi.ResolveResult;
import java.util.List;
import java.util.Map;
public interface PolicemanService{
ResponseResult addPoliceman(Map<String, Object> msg);
ResponseResult getOnePolice(Map<String, Object> id);
ResponseResult deletePolice(Map<String, Object> msg);
ResponseResult updatePolice(Map<String, Object> msg);
List<String> getAllPoliceId(Map<String, Object> orgId);
ResponseResult deleteFinger(Map<String, Object> msg);
List<String> getAllPoliceIdByCabinet(Map<String, Object> cabinetId);
ResponseResult addFingerInfo(Map<String, Object> msg);
ResponseResult addFaceInfo(Map<String, Object> msg);
ResponseResult changePoliceState(Map<String, Object> msg);
//List<Map<String, Object>> getAllPoliceman(List<String> allPoliceId);
ResponseResult getAllPoliceman(Map<String, Object> orgId);
ResponseResult getPoliceData(Map<String, Object> cabinetId);
}
package com.junmp.jyzb.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.junmp.jyzb.api.bean.dto.ProductBatchDto;
import com.junmp.jyzb.api.bean.dto.ProductProcessDto;
import com.junmp.jyzb.api.bean.req.ProductBatchReq;
import com.junmp.jyzb.entity.ProductBatch;
import com.junmp.v2.db.api.page.PageResult;
import java.util.List;
/**
* <pre>
*
* 描述:
* 版本:1.0.0
* 日期:2022/7/30 13:47
* 作者:ningzp@junmp.com.cn
* <br>修改记录
* <br>修改日期 修改人 修改内容
*
* </pre>
*/
public interface ProductBatchService extends IService<ProductBatch> {
/**
* 新增
*
* @param req
*/
boolean addProductBatch(ProductBatchReq req);
/**
* 编辑
*
* @param req
*/
boolean editProductBatch(ProductBatchReq req);
/**
* 删除
*
* @param req
*/
boolean del(ProductBatchReq req);
/**
* 列表信息
*
* @param req
*/
List<ProductBatch> findList(ProductBatchReq req);
/**
* 分页信息
*
* @param req
*/
PageResult<ProductBatchDto> findPage(ProductBatchReq req);
/**
* 分页信息
*
* @param req
*/
PageResult<ProductProcessDto> findProcessPage(ProductBatchReq req);
/**
* 获取批次详细信息
*
* @param batchId
*/
ProductBatchDto getBatchDetail(Long batchId);
}
package com.junmp.jyzb.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.junmp.jyzb.api.bean.req.ProductReq;
import com.junmp.jyzb.entity.Product;
import com.junmp.v2.db.api.page.PageResult;
import java.util.List;
/**
* <pre>
*
* 描述:
* 版本:1.0.0
* 日期:2022/7/30 13:46
* 作者:ningzp@junmp.com.cn
* <br>修改记录
* <br>修改日期 修改人 修改内容
*
* </pre>
*/
public interface ProductService extends IService<Product> {
/**
* 新增
*
* @param req
*/
boolean addProduct(ProductReq req);
/**
* 编辑
*
* @param req
*/
boolean editProduct(ProductReq req);
/**
* 删除
*
* @param req
*/
boolean del(ProductReq req);
/**
* 列表信息
*
* @param req
*/
List<Product> findList(ProductReq req);
/**
* 分页信息
*
* @param req
*/
PageResult<Product> findPage(ProductReq req);
}
package com.junmp.jyzb.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.junmp.jyzb.api.bean.req.ProductSkuReq;
import com.junmp.jyzb.entity.ProductSku;
import com.junmp.v2.db.api.page.PageResult;
import java.util.List;
/**
* <pre>
*
* 描述:
* 版本:1.0.0
* 日期:2022/7/29 16:25
* 作者:ningzp@junmp.com.cn
* <br>修改记录
* <br>修改日期 修改人 修改内容
*
* </pre>
*/
public interface ProductSkuService extends IService<ProductSku> {
/**
* 新增
*
* @param req
*/
boolean addProductSku(ProductSkuReq req);
/**
* 编辑
*
* @param req
*/
boolean editProductSku(ProductSkuReq req);
/**
* 删除
*
* @param req
*/
boolean del(ProductSkuReq req);
/**
* 删除产品关联的号型
*
* @param productId
*/
boolean delByProductId(Long productId);
/**
* 列表信息
*
* @param req
*/
List<ProductSku> findList(ProductSkuReq req);
/**
* 分页信息
*
* @param req
*/
PageResult<ProductSku> findPage(ProductSkuReq req);
}
package com.junmp.jyzb.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.junmp.jyzb.api.bean.dto.ProductTagDto;
import com.junmp.jyzb.api.bean.req.ProductTagReq;
import com.junmp.jyzb.entity.ProductTag;
import com.junmp.v2.db.api.page.PageResult;
import java.util.List;
/**
* <pre>
*
* 描述:
* 版本:1.0.0
* 日期:2022/8/1 09:36
* 作者:ningzp@junmp.com.cn
* <br>修改记录
* <br>修改日期 修改人 修改内容
*
* </pre>
*/
public interface ProductTagService extends IService<ProductTag> {
/**
* 新增
*
* @param req
*/
boolean addTagInfo(ProductTagReq req);
/**
* 编辑
*
* @param req
*/
boolean editTagInfo(ProductTagReq req);
/**
* 删除
*
* @param req
*/
boolean del(ProductTagReq req);
/**
* 去一条未生产的标签数据
*/
ProductTag checkTagUid(ProductTagReq req);
/**
*
*/
ProductTag findByUid(String tagUid);
/**
* 获取标签信息
*/
ProductTagDto getTagInfo(Long tagId);
/**
* 列表信息
*
* @param req
*/
List<ProductTag> findList(ProductTagReq req);
/**
* 分页信息
*
* @param req
*/
PageResult<ProductTag> findPage(ProductTagReq req);
}
package com.junmp.jyzb.service;
import com.junmp.jyzb.utils.ResponseResult;
import java.util.List;
import java.util.Map;
public interface PubOrgService{
ResponseResult showPubOrgList(Map<String, Object> orgId);
ResponseResult showPubOrgListOld(Map<String, Object> orgId);
}
package com.junmp.jyzb.service;
public interface ShelfService{
}
package com.junmp.jyzb.service;
public interface SupplierEquipmentService{
}
package com.junmp.jyzb.service;
import com.junmp.jyzb.utils.ResponseResult;
import java.util.List;
import java.util.Map;
public interface SupplierService{
ResponseResult addSupplier(Map<String, Object> msg);
Map<String,Object> getOneSupplier(String id,Object name,Object code);
ResponseResult deleteSupplier(Map<String, Object> msg);
ResponseResult updateSupplier(Map<String, Object> msg);
List<String> getAllSupplierId();
ResponseResult getAllSupplier(Map<String, Object> msg);
ResponseResult changeSupplierState(Map<String, Object> msg);
}
package com.junmp.jyzb.service;
public interface SupplierTypeService{
}
package com.junmp.jyzb.service;
public interface WarehouseAreaService{
}
package com.junmp.jyzb.service;
import com.junmp.jyzb.utils.ResponseResult;
import java.util.List;
import java.util.Map;
public interface WarehouseService{
ResponseResult addWarehouse(Map<String, Object> msg);
ResponseResult getOneWarehouse(Map<String, Object> id);
ResponseResult deleteWarehouse(Map<String, Object> msg);
ResponseResult updateWarehouse(Map<String, Object> msg);
List<String> getAllWarehouseId(Map<String, Object> orgId);
ResponseResult changeWarehouseState(Map<String, Object> msg);
ResponseResult getAllWarehouse(Map<String, Object> orgId);
/**
* 新增8接口
* */
ResponseResult addArea(Map<String, Object> msg);
ResponseResult updateArea(Map<String, Object> msg);
ResponseResult deleteArea(Map<String, Object> msg);
ResponseResult getAreaList(Map<String, Object> msg);
ResponseResult addShelf(Map<String, Object> msg);
ResponseResult updateShelf(Map<String, Object> msg);
ResponseResult deleteShelf(Map<String, Object> msg);
ResponseResult getShelfList(Map<String, Object> msg);
}
package com.junmp.jyzb.service;
public interface YearReportService{
}
package com.junmp.jyzb.service.impl;
import com.junmp.jyzb.mapper.CabinetBoxMapper;
import com.junmp.jyzb.mapper.PoliceFingerMapper;
import com.junmp.jyzb.service.CabinetBoxService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
@Service
public class CabinetBoxServiceImpl implements CabinetBoxService {
@Resource
private CabinetBoxMapper cabinetBoxMapper;
@Override
public List<Map<String, Object>> getAllBoxMsg(String id) {
return cabinetBoxMapper.getBoxMsg(id);
}
}
package com.junmp.jyzb.service.impl;
import com.junmp.jyzb.domain.Cabinet;
import com.junmp.jyzb.domain.CabinetBox;
import com.junmp.jyzb.mapper.CabinetBoxMapper;
import com.junmp.jyzb.mapper.PolicemanMapper;
import com.junmp.jyzb.mapper.PubOrgMapper;
import com.junmp.jyzb.service.CabinetService;
import com.junmp.jyzb.utils.*;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import com.junmp.jyzb.mapper.CabinetMapper;
import java.util.*;
import static com.junmp.jyzb.utils.CheckBlank.checkNotBlank;
@Service
public class CabinetServiceImpl implements CabinetService {
@Resource
private RedisUtils redisUtils;
@Resource
private CabinetMapper cabinetMapper;
@Resource
private CabinetBoxMapper cabinetBoxMapper;
@Resource
private PolicemanMapper policemanMapper;
@Resource
private PubOrgMapper pubOrgMapper;
private static final String REDIS_CABINET = "Cabinet_";
@Override
public ResponseResult addCabinet(Map<String, Object> msg) {
// 进行参数校验
try {
checkNotBlank(msg.get("orgId"), "orgId不能为空");
checkNotBlank(msg.get("name"), "name不能为空");
//checkNotBlank(msg.get("location"), "location不能为空");
checkNotBlank(msg.get("num"), "num不能为空");
checkNotBlank(msg.get("cabinetNum"), "cabinetNum不能为空");
} catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage());
}
String cabinetNum = msg.get("cabinetNum").toString();
//查询传入的组织机构id是否存在
Long onePubOrg = pubOrgMapper.getOnePubOrg(msg.get("orgId").toString());
if (onePubOrg == null || onePubOrg.equals("")){
return new ResponseResult(HttpStatus.ERROR,ReturnMsg.ERROR,"该组织机构不存在");
}
//查询是否有重复的cabinetNum
Map<String, Object> hashCabinetNum = cabinetMapper.getCabinetByCabinetNum(cabinetNum);
if (hashCabinetNum!=null){
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,"主柜编号重复");
}
Cabinet cabinet =new Cabinet();
//将警员相关信息添加到警员表
//生成一个uuid
String uuid = UUID.randomUUID().toString().replaceAll("-", "");
//生成当前时间
Date currentDate = DateTimeUtil.getCurrentDateTime();
cabinet.setId(uuid);
cabinet.setCreateTime(currentDate);
cabinet.setUpdateTime(currentDate);
cabinet.setOrgId((String) msg.get("orgId"));
cabinet.setName((String) msg.get("name"));
//cabinet.setUpdateUser((String) msg.get("updateUser"));
cabinet.setLocation((String) msg.get("location"));
cabinet.setNum((Integer) msg.get("num"));
cabinet.setCabinetNum(cabinetNum);
cabinetMapper.addCabinet(cabinet);
/**
* 更新缓存
* */
//构建Redis缓存键
String redisKey = REDIS_CABINET + "true" +'_'+ msg.get("orgId").toString();
// 从 Redis 中获取数据
List<Map<String, Object>> cachedDataTrue = redisUtils.findCachedData(redisKey);
if (cachedDataTrue != null) {
cachedDataTrue.add(0,msg);
//将查询结果存入 Redis 中
redisUtils.set(redisKey, cachedDataTrue);
}
//构建Redis缓存键
redisKey = REDIS_CABINET + "false" +'_'+ msg.get("orgId").toString();
// 从 Redis 中获取数据
List<Map<String, Object>> cachedDataFalse = redisUtils.findCachedData(redisKey);
if (cachedDataFalse != null) {
cachedDataFalse.add(0,msg);
//将查询结果存入 Redis 中
redisUtils.set(redisKey, cachedDataFalse);
}
return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS,uuid);
}
@Override
public Map<String,Object> getOneCabinet(String id) {
return cabinetMapper.getOneCabinet(id);
}
@Override
public ResponseResult deleteCabinet(Map<String, Object> msg) {
// 进行参数校验
try {
checkNotBlank(msg.get("cabinetList"), "cabinetList不能为空");
} catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage());
}
//批量删除操作
List<Object> cabinetList = (List<Object>) msg.get("cabinetList");
for (Object cabinetId:cabinetList){
cabinetMapper.deleteCabinet(cabinetId.toString());
}
return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS);
}
//查询某组织机构的所有子机构
public List<String> getSubIds(String id) {
List<String> subIds = new ArrayList<>();
subIds.add(id);//先往List中放入父级id
List<String> subMenus = policemanMapper.getChildren(id);//查询该id的子类id
if (subMenus != null) {
for (String subMenu : subMenus) {
subIds.addAll(getSubIds(subMenu));
}
}
return subIds;
}
@Override
public ResponseResult updateCabinet(Map<String, Object> msg) {
// 进行参数校验
try {
checkNotBlank(msg.get("id"), "id不能为空");
checkNotBlank(msg.get("cabinetNum"), "cabinetNum不能为空");
checkNotBlank(msg.get("name"), "name不能为空");
checkNotBlank(msg.get("orgId"), "orgId不能为空");
} catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage());
}
String cabinetNum = msg.get("cabinetNum").toString();
//查询传入的组织机构id是否存在
Long onePubOrg = pubOrgMapper.getOnePubOrg(msg.get("orgId").toString());
if (onePubOrg == null || onePubOrg.equals("")){
return new ResponseResult(HttpStatus.ERROR,ReturnMsg.ERROR,"该组织机构不存在");
}
//查询是否有重复的cabinetNum
Map<String, Object> hashCabinetNum = cabinetMapper.getCabinetByCabinetNum(cabinetNum);
//判断policeCode是否有变动
String oldCabinetNum = cabinetMapper.getCabinetNumById(msg.get("id").toString());
if (oldCabinetNum!=null && !oldCabinetNum.equals(cabinetNum)){
if (hashCabinetNum!=null){
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,"主柜编号重复");
}
}
Cabinet cabinet =new Cabinet();
//生成当前时间
Date currentDate = DateTimeUtil.getCurrentDateTime();
cabinet.setUpdateTime(currentDate);
cabinet.setId((String) msg.get("id"));
cabinet.setCabinetNum((String) msg.get("cabinetNum"));
cabinet.setName((String) msg.get("name"));
cabinet.setOrgId((String) msg.get("orgId"));
cabinet.setLocation((String) msg.get("location"));
//cabinet.setUpdateUser((String) msg.get("updateUser"));
//cabinet.setState((Integer) msg.get("errorState"));
cabinetMapper.updateCabinet(cabinet);
return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS);
}
@Override
public ResponseResult changeCabinetState(Map<String, Object> msg) {
// 进行参数校验
try {
checkNotBlank(msg.get("cabinetId"), "cabinetId不能为空");
checkNotBlank(msg.get("cabinetBoxList"), "cabinetBoxList不能为空");
List<Map<String,Object>> boxMsg = (List<Map<String,Object>>)msg.get("cabinetBoxList");
for (Map<String,Object> box:boxMsg){
checkNotBlank(box.get("cabinetBoxId"), "cabinetBoxId不能为空");
checkNotBlank(box.get("state"), "state不能为空");
}
} catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage());
}
//判断组织机构id是否正确
CabinetBox cabinetBox =new CabinetBox();
//读取单警柜id
cabinetBox.setCabinetId(msg.get("cabinetId").toString());
//获取cabinetBoxList
List<Map<String,Object>> boxMsg = (List<Map<String,Object>>)msg.get("cabinetBoxList");
for (Map<String,Object> box:boxMsg){
cabinetBox.setId((String) box.get("cabinetBoxId"));
cabinetBox.setState((Integer) box.get("state"));
cabinetBox.setErrorMsg((String) box.get("errorMsg"));
cabinetBoxMapper.changeCabinetState(cabinetBox);
}
return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS);
}
@Override
public List<String> getAllCabinetBoxId(String id) {
List<String> msg = cabinetMapper.getAllCabinetBoxId(id);
return msg;
}
@Override
public ResponseResult getAllCabinet(Map<String, Object> msg) {
try {
checkNotBlank(msg.get("orgId"), "orgId不能为空");
checkNotBlank(msg.get("IncludeLowerLevel"), "IncludeLowerLevel不能为空");
} catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage());
}
List<Map<String, Object>> allCabinet=new ArrayList<>();
// 构建 Redis 缓存键
String redisKey = REDIS_CABINET + msg.get("IncludeLowerLevel").toString() +'_'+ msg.get("orgId").toString();
// 从 Redis 中获取数据
List<Map<String, Object>> cachedData = redisUtils.findCachedData(redisKey);
if (cachedData != null) {
//将Long类型的数据转化为Date
// for (Map<String,Object> one:cachedData){
// Long dataMsg = (Long) one.get("updateTime");
// one.put("updateTime", redisUtils.getDate(dataMsg));
// allCabinet.add(one);
// }
return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS,cachedData);
}
//如果组织机构是浙江省公安厅
if (msg.get("orgId").toString().equals("1369509498032808905") && msg.get("IncludeLowerLevel").toString().equals("true")){
allCabinet = cabinetMapper.getAllCabinet();
//将查询结果存入 Redis 中
redisUtils.set(redisKey, allCabinet);
return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS,allCabinet);
}
//获取该组织机构下所有仓库的id
//String orgId = msg.get("orgId").toString();
List<String> allCabinetId =getAllCabinetId(msg);
for (String cabinetId :allCabinetId){
Map<String, Object> cabinetMsg = cabinetMapper.getOneCabinet(cabinetId);
if (!cabinetMsg.isEmpty()){
allCabinet.add(cabinetMsg);
}
}
//将查询结果存入 Redis 中
redisUtils.set(redisKey, allCabinet);
return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS,allCabinet);
}
@Override
public List<String> getAllCabinetId(Map<String, Object> msg) {
//如果组织机构是最高级的,获取所有id
if (msg.get("orgId").toString().equals("1369509498032808905")){
//构建 Redis 缓存键
String redisKey = "getAllCabinetId_"+msg.get("IncludeLowerLevel")+'_'+msg.get("orgId");
// 从 Redis 中获取数据
List<String> cachedData = redisUtils.findCachedData(redisKey);
if (cachedData!=null){
return cachedData;
}
List<String> allCabinetId = cabinetMapper.getAllCabinetIdByHighest();
//将查询结果存入 Redis 中
redisUtils.set(redisKey, allCabinetId);
return allCabinetId;
}
//构建 Redis 缓存键
String redisKey = "getAllCabinetId_"+msg.get("IncludeLowerLevel")+'_'+msg.get("orgId");
// 从 Redis 中获取数据
List<String> cachedData = redisUtils.findCachedData(redisKey);
if (cachedData!=null){
return cachedData;
}
List<String> cabinetId = new ArrayList<>();
if (msg.get("IncludeLowerLevel").equals("false")){
cabinetId = cabinetMapper.getAllCabinetId(msg.get("orgId").toString());
}else{
List<String> orgIds = getSubIds(msg.get("orgId").toString()); //调用本级及下级的所有组织机构的id
for (String orgId:orgIds){
List<String> allPoliceId = cabinetMapper.getAllCabinetId(orgId);
cabinetId.addAll(allPoliceId);
}
}
//将查询结果存入 Redis 中
redisUtils.set(redisKey, cabinetId);
return cabinetId;
}
@Override
public ResponseResult getCabinetDetail(Map<String, Object> msg) {
// 进行参数校验
try {
checkNotBlank(msg.get("id"), "id不能为空");
} catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage());
}
String idMsg = msg.get("id").toString();
Map<String, Object> cabinetMsg = getOneCabinet(idMsg);
if (cabinetMsg==null){
return new ResponseResult(HttpStatus.NO_DATA,ReturnMsg.NO_DATA, ReturnData.NO_DATA);
}
List<Map<String, Object>> allBoxMsg = cabinetBoxMapper.getBoxMsg(idMsg);
cabinetMsg.put("cabinetBoxList",allBoxMsg);
return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS,cabinetMsg);
}
}
package com.junmp.jyzb.service.impl;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.junmp.jyzb.api.bean.req.CompanyReq;
import com.junmp.jyzb.api.exception.enums.CompanyExceptionEnum;
import com.junmp.jyzb.api.util.GenCodeUtil;
import com.junmp.jyzb.entity.Company;
import com.junmp.jyzb.mapper.CompanyMapper;
import com.junmp.jyzb.service.CompanyService;
import com.junmp.v2.common.exception.base.ServiceException;
import com.junmp.v2.common.util.BeanPlusUtil;
import com.junmp.v2.db.api.factory.PageFactory;
import com.junmp.v2.db.api.factory.PageResultFactory;
import com.junmp.v2.db.api.page.PageResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* <pre>
*
* 描述:
* 版本:1.0.0
* 日期:2022/8/1 09:35
* 作者:ningzp@junmp.com.cn
* <br>修改记录
* <br>修改日期 修改人 修改内容
*
* </pre>
*/
@Slf4j
@Service
public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> implements CompanyService {
@Override
public boolean addBiz(CompanyReq req) {
Company company = new Company();
BeanPlusUtil.copyProperties(req, company);
Integer maxSn = baseMapper.getMaxSn();
//1-获取当前序号
Integer sn = maxSn + 1;
company.setSn(sn);
//2-获取当前编码
String bizCode = GenCodeUtil.genBizCode(sn);
company.setBizCode(bizCode);
return this.save(company);
}
@Override
public boolean editBiz(CompanyReq req) {
Company company = queryCompany(req);
BeanPlusUtil.copyProperties(req, company);
return this.updateById(company);
}
@Override
public boolean del(CompanyReq req) {
Company entity = queryCompany(req);
if (ObjectUtil.isNull(entity)) {
log.warn(StrUtil.format("企业信息不存在,企业编号为:{}", req.getBizId()));
return false;
} else {
return this.removeById(entity.getBizId());
}
}
@Override
public List<Company> findList(CompanyReq req) {
LambdaQueryWrapper<Company> wrapper = createWrapper(req);
return this.list(wrapper);
}
@Override
public PageResult<Company> findPage(CompanyReq req) {
LambdaQueryWrapper<Company> wrapper = createWrapper(req);
Page<Company> page = this.page(PageFactory.getDefaultPage(), wrapper);
return PageResultFactory.createPageResult(page);
}
private Company queryCompany(CompanyReq req) {
Company app = this.getById(req.getBizId());
if (ObjectUtil.isNull(app)) {
throw new ServiceException(CompanyExceptionEnum.COMPANY_NOT_EXIST);
}
return app;
}
private LambdaQueryWrapper<Company> createWrapper(CompanyReq req) {
LambdaQueryWrapper<Company> wrapper = new LambdaQueryWrapper<>();
if (ObjectUtil.isEmpty(req)) {
return wrapper;
}
//根据业务编码查询
wrapper.like(ObjectUtil.isNotEmpty(req.getBizCode()), Company::getBizCode, req.getBizCode());
//根据企业名称模糊查询
wrapper.like(ObjectUtil.isNotEmpty(req.getName()), Company::getName, req.getName());
wrapper.orderByDesc(Company::getCreateTime);
return wrapper;
}
}
package com.junmp.jyzb.service.impl;
import com.junmp.jyzb.domain.EquipmentSize;
import com.junmp.jyzb.domain.EquipmentType;
import com.junmp.jyzb.mapper.EquipmentTypeMapper;
import com.junmp.jyzb.service.EquipmentSizeService;
import com.junmp.jyzb.utils.DateTimeUtil;
import com.junmp.jyzb.utils.HttpStatus;
import com.junmp.jyzb.utils.ResponseResult;
import com.junmp.jyzb.utils.ReturnMsg;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import com.junmp.jyzb.mapper.EquipmentSizeMapper;
import java.util.*;
import static com.junmp.jyzb.utils.CheckBlank.checkNotBlank;
@Service
public class EquipmentSizeServiceImpl implements EquipmentSizeService {
@Resource
private EquipmentSizeMapper equipmentSizeMapper;
@Resource
private EquipmentTypeMapper equipmentTypeMapper;
private static final String REDIS_SIZE = "Size_";
@Override
public ResponseResult addSize(Map<String, Object> msg) {
try {
checkNotBlank(msg.get("typeId"), "typeId不能为空");
checkNotBlank(msg.get("code"), "code不能为空");
checkNotBlank(msg.get("name"), "name不能为空");
//checkNotBlank((String) msg.get("note"), "note不能为空");
//Objects.requireNonNull(msg.get("price"), "price不能为空");
Objects.requireNonNull(msg.get("epcType"), "epcType不能为空");
} catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage());
}
//TODO 查询是否有重复的code
// List<String> sizeCodeFlag = equipmentSizeMapper.getSizeByCode((String) msg.get("code"));
// if (!sizeCodeFlag.isEmpty()){
// return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,"装备号型码已存在");
// }
//todo typeId只能是最下级的
// List<String> resultId = equipmentTypeMapper.getLowestTypeId();
// if (!resultId.contains(msg.get("typeId"))){
// return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,"typeId只能是最下一级");
// }
EquipmentSize size =new EquipmentSize();
//生成一个uuid
String uuid = UUID.randomUUID().toString().replaceAll("-", "");
//生成当前时间
Date currentDate = DateTimeUtil.getCurrentDateTime();
size.setId(uuid);
size.setCreateTime(currentDate);
size.setUpdateTime(currentDate);
size.setTypeId((String) msg.get("typeId"));
size.setCode((String) msg.get("code"));
size.setName((String) msg.get("name"));
size.setNote((String) msg.get("note"));
size.setPrice((Double) msg.get("price"));
size.setEpcType((Integer) msg.get("epcType"));
equipmentSizeMapper.addSize(size);
return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS,uuid);
}
@Override
public ResponseResult getOneSize(Map<String,Object> msg) {
try {
checkNotBlank(msg.get("id"), "id不能为空");
} catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage());
}
String sizeId = msg.get("id").toString();
Map<String, Object> oneSize = equipmentSizeMapper.getOneSize(sizeId);
return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS,oneSize);
}
@Override
public ResponseResult deleteSize(Map<String, Object> msg) {
// 进行参数校验
try {
checkNotBlank(msg.get("sizeList"), "sizeList不能为空");
} catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage());
}
List<Object> sizeList = (List<Object>) msg.get("sizeList");
for (Object sizeId:sizeList){
equipmentSizeMapper.deleteSize(sizeId.toString());
}
return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS);
}
@Override
public ResponseResult updateSize(Map<String, Object> msg) {
try {
checkNotBlank(msg.get("id"), "id不能为空");
checkNotBlank(msg.get("typeId"), "typeId不能为空");
checkNotBlank(msg.get("code"), "code不能为空");
checkNotBlank(msg.get("name"), "name不能为空");
Objects.requireNonNull(msg.get("epcType"), "epcType不能为空");
} catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage());
}
//todo 判断code是否重复
// //查询是否有重复的code
// List<String> sizeCodeFlag = equipmentSizeMapper.getSizeByCode((String) msg.get("code"));
// //判断code是否有变动
// String oldCode = equipmentSizeMapper.getCodeById(msg.get("id").toString());
// if ()
// if (!sizeCodeFlag.isEmpty()){
// return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,"装备号型码已存在");
// }
EquipmentSize size =new EquipmentSize();
Date currentDate = DateTimeUtil.getCurrentDateTime();
//police.setId(uuid);
size.setId((String) msg.get("id"));
size.setTypeId((String) msg.get("typeId"));
size.setCode((String) msg.get("code"));
size.setName((String) msg.get("name"));
size.setNote((String) msg.get("note"));
size.setUpdateTime(currentDate);
size.setPrice((Double) msg.get("price"));
//size.setState((Integer) msg.get("state"));
size.setEpcType((Integer) msg.get("epcType"));
equipmentSizeMapper.updateSize(size);
return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS);
}
@Override
public List<String> getAllSizeId(Map<String, Object> typeId) {
List<String> msg = equipmentSizeMapper.getAllSizeId(typeId.get("typeId").toString());
return msg;
}
@Override
public ResponseResult changeSizeState(Map<String, Object> msg) {
try {
checkNotBlank(msg.get("id"), "id不能为空");
checkNotBlank(msg.get("state"), "state不能为空");
} catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage());
}
EquipmentSize size =new EquipmentSize();
size.setId(msg.get("id").toString());
size.setState((Integer) msg.get("state"));
equipmentSizeMapper.changeSizeState(size);
return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS);
}
@Override
public ResponseResult getAllSize(Map<String, Object> msg) {
List<Map<String, Object>> allSize=new ArrayList<>();
List<String> allSizeId =getAllSizeId(msg);
for (String sizeId :allSizeId){
Map<String, Object> sizeMsg = equipmentSizeMapper.getOneSize(sizeId);
allSize.add(sizeMsg);
}
return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS,allSize);
}
}
package com.junmp.jyzb.service.impl;
import com.junmp.jyzb.domain.EquipmentType;
import com.junmp.jyzb.mapper.SupplierMapper;
import com.junmp.jyzb.service.EquipmentTypeService;
import com.junmp.jyzb.utils.*;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import com.junmp.jyzb.mapper.EquipmentTypeMapper;
import java.util.*;
import static com.junmp.jyzb.utils.CheckBlank.checkNotBlank;
@Service
public class EquipmentTypeServiceImpl implements EquipmentTypeService {
@Resource
private RedisUtils redisUtils;
@Resource
private EquipmentTypeMapper equipmentTypeMapper;
@Resource
private SupplierMapper supplierMapper;
private static final String REDIS_TYPE = "Type_";
@Override
public List<Map<String, Object>> getEquipmentList() {
/*
// 构建 Redis 缓存键
String redisKey = REDIS_TYPE;
// 从 Redis 中获取数据
List<Map<String, Object>> cachedData = redisUtils.findCachedData(redisKey);
if (cachedData != null) {
//将Long类型的数据转化为Date
// for (Map<String,Object> one:cachedData){
// Long dataMsg = (Long) one.get("updateTime");
// one.put("updateTime", redisUtils.getDate(dataMsg));
// dataMsg = (Long) one.get("createTime");
// one.put("createTime", redisUtils.getDate(dataMsg));
// cachedData.add(one);
// }
return cachedData;
}
*/
List<EquipmentType> menuList = equipmentTypeMapper.selectAllEquipment();
List<Map<String, Object>> resultList = new ArrayList<>();
for (EquipmentType menu : menuList) {
//System.out.println(menu.getIdByParentId()+" "+menu.getName()+" "+menu.getParentId());
//00000000-0000-0000-0000-000000000000
if (!menu.getName().equals("超级根") && menu.getParentId().equals("00000000-0000-0000-0000-000000000000")) {
Map<String, Object> map = new HashMap<>();
map.put("id", menu.getId());
map.put("name", menu.getName());
map.put("unit", menu.getUnit());
map.put("unitType", menu.getUnitType());
map.put("code", menu.getCode());
map.put("parentId", menu.getParentId());
map.put("state", menu.getState());
map.put("note", menu.getNote());
map.put("createTime", menu.getCreateTime());
map.put("updateTime", menu.getUpdateTime());
map.put("children", getChildMenus(menu.getId(),menuList));
resultList.add(map);
}
}
/*
//将查询结果存入 Redis 中
redisUtils.set(redisKey, resultList);
*/
return resultList;
}
private List<Map<String, Object>> getChildMenus(String parentId, List<EquipmentType> menuList) {
List<Map<String, Object>> childList = new ArrayList<>();
for (EquipmentType menu : menuList) {
//if (menu.getParentId() != null && menu.getParentId().equals(parentId)) {
if (menu.getParentId().equals(parentId)) {
Map<String, Object> map = new HashMap<>();
map.put("id", menu.getId());
map.put("name", menu.getName());
map.put("unit", menu.getUnit());
map.put("unitType", menu.getUnitType());
map.put("code", menu.getCode());
map.put("parentId", menu.getParentId());
map.put("state", menu.getState());
map.put("note", menu.getNote());
map.put("createTime", menu.getCreateTime());
map.put("updateTime", menu.getUpdateTime());
List<Map<String, Object>> children = getChildMenus(menu.getId(), menuList);
if (!children.isEmpty()) {
map.put("children", children);
}
childList.add(map);
}
}
return childList;
}
@Override
public ResponseResult addEquipment(Map<String, Object> msg) {
try {
checkNotBlank(msg.get("name"), "name不能为空");
checkNotBlank(msg.get("parentId"), "parentId不能为空");
checkNotBlank(msg.get("supplierList"), "supplierList不能为空");
} catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage());
}
//parentId只能是倒数第二级,因为插入的装备只能是最后一级
String resultId = equipmentTypeMapper.getIdByParentId((String) msg.get("parentId"));
if (resultId == null || resultId.equals("")){
return new ResponseResult(HttpStatus.ERROR,ReturnMsg.ERROR,"传入的parentId有误,新的装备类型只能加在最后一级");
}
//判断传入的组织机构是否存在
List<String> supplierFlag = new ArrayList<>();
List<String> supplierList = (List<String>) msg.get("supplierList");
for(String supplierId:supplierList){
Map<String, Object> oneSupplier = supplierMapper.getOneSupplier(supplierId,null,null);
if (oneSupplier==null || oneSupplier.isEmpty()){
supplierFlag.add(supplierId);
}
}
if (!supplierFlag.isEmpty()){
return new ResponseResult(HttpStatus.ERROR,ReturnMsg.ERROR,"传入的部分供应商不存在:"+supplierFlag);
}
EquipmentType equipmentType =new EquipmentType();
//生成加入supplier-type表的uuid
String uuid = UUID.randomUUID().toString().replaceAll("-", "");
//生成时间
Date currentDate = DateTimeUtil.getCurrentDateTime();
equipmentType.setCreateTime(currentDate);
equipmentType.setUpdateTime(currentDate);
//计算出新的装备类型id,在原来的基础上+1
int num = Integer.parseInt(resultId);
String numStr = String.valueOf(num + 1);
//读取json中的相关数据
equipmentType.setId(numStr);
equipmentType.setName((String) msg.get("name"));
equipmentType.setUnitType((String) msg.get("unitType"));
equipmentType.setCode(numStr);
equipmentType.setParentId((String) msg.get("parentId"));
equipmentType.setNote((String) msg.get("note"));
//计算出id后,判断数据库中是否已存在该id
String oneEquipment = equipmentTypeMapper.getOneEquipmentId(numStr);
if (!(oneEquipment == null)){
return new ResponseResult(HttpStatus.ERROR,ReturnMsg.ERROR,"添加异常,装备id已存在");
}
//读取装备的供应商列表,将相关数据加入到supplier_type表
equipmentTypeMapper.addSupplier(uuid,equipmentType,supplierList);
//更新base_equipment_id表
equipmentTypeMapper.setCalculationId(numStr,(String) msg.get("parentId"));
equipmentTypeMapper.addEquipment(equipmentType);
// // 将uuid、创建时间、更新时间加入到msg中
// msg.put("id",numStr);
// long timestamp = currentDate.getTime(); // 将Date对象转换为long类型的时间戳
// msg.put("updateTime",timestamp);
//
// /**
// * 更新缓存
// * */
// //构建Redis缓存键
// String redisKey = REDIS_TYPE;
// // 从 Redis 中获取数据
// List<Map<String, Object>> cachedData = redisUtils.findCachedData(redisKey);
// if (cachedData != null) {
// cachedData.add(0,msg);
// //将查询结果存入 Redis 中
// redisUtils.set(redisKey, cachedData);
//
// }
return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS,numStr);
}
@Override
public ResponseResult calculationEquipmentId() {
List<Map<String,Object>> inputList = equipmentTypeMapper.getAll();
// 假设您已经有了填充数据的inputList
List<Map<String, Object>> resultList = new ArrayList<>();
for (int i = 0; i < inputList.size() - 1; i++) {
Map<String, Object> currentMap = inputList.get(i);
Map<String, Object> nextMap = inputList.get(i + 1);
int currentId = (int) currentMap.get("id");
int nextId = (int) nextMap.get("id");
if (currentId + 1 != nextId) {
resultList.add(currentMap);
}
}
equipmentTypeMapper.addData(resultList);
return new ResponseResult(99200,ReturnMsg.PASS,resultList);
}
@Override
public ResponseResult deleteEquipment(Map<String, Object> msg) {
// 进行参数校验
try {
checkNotBlank(msg.get("equipmentList"), "equipmentList不能为空");
} catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage());
}
List<Object> equipmentList = (List<Object>) msg.get("equipmentList");
for (Object equipmentId:equipmentList){
//判断装备id在数据库中是否存在
equipmentTypeMapper.deleteEquipment(equipmentId.toString());
}
return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS);
}
@Override
public ResponseResult updateEquipment(Map<String, Object> msg) {
try {
checkNotBlank(msg.get("id"), "id不能为空");
checkNotBlank(msg.get("name"), "name不能为空");
checkNotBlank(msg.get("parentId"), "parentId不能为空");
checkNotBlank(msg.get("supplierList"), "supplierList不能为空");
} catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage());
}
// //parentId只能是倒数第二级,因为插入的装备只能是最后一级
// String resultId = equipmentTypeMapper.getIdByParentId((String) msg.get("parentId"));
// if (resultId == null || resultId.equals("")){
// return new ResponseResult(HttpStatus.ERROR,ReturnMsg.ERROR,"传入的parentId有误,新的装备类型只能加在最后一级");
// }
//判断传入的供应商是否存在
List<String> supplierFlag = new ArrayList<>();
List<String> supplierList = (List<String>) msg.get("supplierList");
for(String supplierId:supplierList){
Map<String, Object> oneSupplier = supplierMapper.getOneSupplier(supplierId,null,null);
if (oneSupplier==null || oneSupplier.isEmpty()){
supplierFlag.add(supplierId);
}
}
if (!supplierFlag.isEmpty()){
return new ResponseResult(HttpStatus.ERROR,ReturnMsg.ERROR,"传入的部分供应商不存在:"+supplierFlag);
}
//计算出id后,判断数据库中是否已存在该id
String oneEquipment = equipmentTypeMapper.getOneEquipmentId(msg.get("id").toString());
if (oneEquipment == null || oneEquipment.equals("")){
return new ResponseResult(HttpStatus.ERROR,ReturnMsg.ERROR,"未查询到相应的装备类型");
}
EquipmentType equipmentType =new EquipmentType();
//生成加入supplier-type表的uuid
String uuid = UUID.randomUUID().toString().replaceAll("-", "");
//修改警员相关信息
//生成当前时间
Date currentDate = DateTimeUtil.getCurrentDateTime();
equipmentType.setCreateTime(currentDate);
equipmentType.setUpdateTime(currentDate);
//police.setId(uuid);
equipmentType.setId((String) msg.get("id"));
equipmentType.setName((String) msg.get("name"));
equipmentType.setUnitType((String) msg.get("unitType"));
//equipmentType.setCode((String) msg.get("code"));
equipmentType.setParentId((String) msg.get("parentId"));
equipmentType.setNote((String) msg.get("note"));
// equipmentType.set((String) msg.get("updateUser"));
// equipmentType.setLocation((String) msg.get("location"));
// equipmentType.setPhone((String) msg.get("phone"));
// equipmentType.setUpdateTime(currentDate);
// equipmentType.setOrgId((String) msg.get("orgId"));
//删除装备的所有供应商信息,在将相关数据加入到supplier_type表
equipmentTypeMapper.deleteSupplier(equipmentType.getId());
//读取装备的供应商列表,将相关数据加入到supplier_type表
equipmentTypeMapper.addSupplier(uuid,equipmentType,supplierList);
equipmentTypeMapper.updateEquipment(equipmentType);
return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS);
}
@Override
public ResponseResult changeEquipmentState(Map<String, Object> msg) {
try {
checkNotBlank(msg.get("id"), "id不能为空");
Objects.requireNonNull(msg.get("state"), "state不能为空");
} catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage());
}
EquipmentType equipment =new EquipmentType();
equipment.setId(msg.get("id").toString());
equipment.setState((Integer) msg.get("state"));
equipmentTypeMapper.changeEquipmentState(equipment);
return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS);
}
@Override
public ResponseResult getOneEquipment(Map<String, Object> msg) {
try {
checkNotBlank(msg.get("typeId"), "typeId不能为空");
} catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage());
}
EquipmentType equipment =new EquipmentType();
equipment.setId(msg.get("typeId").toString());
Map<String, Object> oneEquipment = equipmentTypeMapper.getOneEquipment(equipment);
//返回对应的供应商信息
List<Map<String, Object>> supplierMsg = equipmentTypeMapper.getSupplierByTypeId(equipment);
oneEquipment.put("supplierList",supplierMsg);
return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS,oneEquipment);
}
}
package com.junmp.jyzb.service.impl;
import com.junmp.jyzb.service.HistoryService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import com.junmp.jyzb.mapper.HistoryMapper;
@Service
public class HistoryServiceImpl implements HistoryService {
@Resource
private HistoryMapper historyMapper;
}
package com.junmp.jyzb.service.impl;
import com.junmp.jyzb.service.InventoryService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import com.junmp.jyzb.mapper.InventoryMapper;
@Service
public class InventoryServiceImpl implements InventoryService {
@Resource
private InventoryMapper inventoryMapper;
}
package com.junmp.jyzb.service.impl;
import com.junmp.jyzb.service.InventorySummaryService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import com.junmp.jyzb.mapper.InventorySummaryMapper;
@Service
public class InventorySummaryServiceImpl implements InventorySummaryService {
@Resource
private InventorySummaryMapper inventorySummaryMapper;
}
package com.junmp.jyzb.service.impl;
import com.junmp.jyzb.service.LogDetailService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import com.junmp.jyzb.mapper.LogDetailMapper;
@Service
public class LogDetailServiceImpl implements LogDetailService {
@Resource
private LogDetailMapper logDetailMapper;
}
package com.junmp.jyzb.service.impl;
import com.junmp.jyzb.service.LogSummaryService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import com.junmp.jyzb.mapper.LogSummaryMapper;
@Service
public class LogSummaryServiceImpl implements LogSummaryService {
@Resource
private LogSummaryMapper logSummaryMapper;
}
package com.junmp.jyzb.service.impl;
import com.junmp.jyzb.service.PackageInformationService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import com.junmp.jyzb.mapper.PackageInformationMapper;
@Service
public class PackageInformationServiceImpl implements PackageInformationService {
@Resource
private PackageInformationMapper packageInformationMapper;
}
package com.junmp.jyzb.service.impl;
import com.junmp.jyzb.service.PackageService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import com.junmp.jyzb.mapper.PackageMapper;
@Service
public class PackageServiceImpl implements PackageService {
@Resource
private PackageMapper packageMapper;
}
package com.junmp.jyzb.service.impl;
import com.junmp.jyzb.domain.PoliceFinger;
import com.junmp.jyzb.service.PoliceFingerService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import com.junmp.jyzb.mapper.PoliceFingerMapper;
import java.util.List;
import java.util.Map;
@Service
public class PoliceFingerServiceImpl implements PoliceFingerService {
@Resource
private PoliceFingerMapper policeFingerMapper;
@Override
public List<Map<String, Object>> getFingersByUserId(String userId) {
return policeFingerMapper.getFingersByUserId(userId);
}
}
package com.junmp.jyzb.service.impl;
import com.junmp.jyzb.domain.PoliceFinger;
import com.junmp.jyzb.domain.PubOrg;
import com.junmp.jyzb.mapper.*;
import com.junmp.jyzb.service.PolicemanService;
import com.junmp.jyzb.utils.*;
import org.apache.tomcat.util.buf.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import com.junmp.jyzb.domain.Policeman;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import static com.junmp.jyzb.utils.CheckBlank.checkNotBlank;
@Service
public class PolicemanServiceImpl implements PolicemanService {
@Resource
private RedisUtils redisUtils;
@Resource
private PolicemanMapper policemanMapper;
@Resource
private PoliceFingerMapper policeFingerMapper;
@Resource
private CabinetBoxMapper cabinetBoxMapper;
@Resource
private CabinetMapper cabinetMapper;
@Resource
private PubOrgMapper pubOrgMapper;
private static final String REDIS_POLICE = "Policeman_";
private static final String REDIS_ORG = "Organization_";
@Override
public ResponseResult addPoliceman(Map<String, Object> policeman) {
// 进行参数校验
try {
checkNotBlank(policeman.get("orgId"), "orgId不能为空");
checkNotBlank(policeman.get("name"), "name不能为空");
checkNotBlank(policeman.get("policeCode"), "policeCode不能为空");
checkNotBlank(policeman.get("sex"),"sex不能为空");
//checkNotBlank((String) policeman.get("cabinetBoxId"), "cabinetBoxId不能为空");
checkNotBlank(policeman.get("phone"), "phone不能为空");
checkNotBlank(policeman.get("idCard"), "idCard不能为空");
//checkNotBlank((String) policeman.get("photo"), "photo不能为空");
} catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage());
}
//查询传入的组织机构id是否存在
Long onePubOrg = pubOrgMapper.getOnePubOrg(policeman.get("orgId").toString());
if (onePubOrg == null || onePubOrg.equals("")){
return new ResponseResult(HttpStatus.ERROR,ReturnMsg.ERROR,"该组织机构不存在");
}
//查询是否有重复的policeCode
List<String> policeCodeFlag = policemanMapper.getPoliceByPoliceCode((String) policeman.get("policeCode"));
if (!policeCodeFlag.isEmpty()){
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,"警员编号已存在");
}
//todo cabinetBoxId能否重复
//查询单警柜箱号是否存在
if (policeman.get("cabinetBoxId").toString()!=null){
String oneCabinetBox = cabinetBoxMapper.getOneCabinetBox(policeman.get("cabinetBoxId").toString());
if (oneCabinetBox == null || oneCabinetBox.equals("")){
return new ResponseResult(HttpStatus.ERROR,ReturnMsg.ERROR,"该单警柜箱号不存在");
}
}
Policeman police =new Policeman();
//将警员相关信息添加到警员表
//生成一个uuid
String uuid = UUID.randomUUID().toString().replaceAll("-", "");
//生成当前时间
Date currentDate = DateTimeUtil.getCurrentDateTime();
police.setCreateTime(currentDate);
police.setUpdateTime(currentDate);
police.setId(uuid);
police.setOrgId((String) policeman.get("orgId"));
police.setName((String) policeman.get("name"));
police.setPoliceCode((String) policeman.get("policeCode"));
police.setSex((String) policeman.get("sex"));
police.setCabinetBoxId((String) policeman.get("cabinetBoxId"));
police.setPhone((String) policeman.get("phone"));
police.setIdCard((String) policeman.get("idCard"));
police.setPhoto((String) policeman.get("photo"));
policemanMapper.addPoliceman(police);
// 将uuid、创建时间、更新时间加入到policeman中
policeman.put("id",uuid);
long timestamp = currentDate.getTime(); // 将Date对象转换为long类型的时间戳
policeman.put("updateTime",timestamp);
/**
* 更新缓存
* */
//构建Redis缓存键
String redisKey = REDIS_ORG + "true" +'_'+ policeman.get("orgId").toString();
// 从 Redis 中获取数据
List<Map<String, Object>> cachedDataTrue = redisUtils.findCachedData(redisKey);
if (cachedDataTrue != null) {
cachedDataTrue.add(0,policeman);
//将查询结果存入 Redis 中
redisUtils.set(redisKey, cachedDataTrue);
}
//构建Redis缓存键
redisKey = REDIS_ORG + "false" +'_'+ policeman.get("orgId").toString();
// 从 Redis 中获取数据
List<Map<String, Object>> cachedDataFalse = redisUtils.findCachedData(redisKey);
if (cachedDataFalse != null) {
cachedDataFalse.add(0,policeman);
//将查询结果存入 Redis 中
redisUtils.set(redisKey, cachedDataFalse);
}
return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS,uuid);
}
// 更新缓存的方法,新增警员信息时调用
private void updatePoliceIdCache(String orgId, String newPoliceId) {
// 构建 Redis 缓存键
String redisKeyFalse = "getAllPoliceId_false_" + orgId;
String redisKeyTrue = "getAllPoliceId_true_" + orgId;
// 从 Redis 中获取旧的缓存数据
List<String> cachedDataFalse = redisUtils.findCachedData(redisKeyFalse);
List<String> cachedDataTrue = redisUtils.findCachedData(redisKeyTrue);
//如果缓存中没有数据,则直接查询数据库并更新Redis缓存
//如果缓存中有数据,就更新数据
if (cachedDataFalse == null && cachedDataTrue == null) {
//getAllPoliceId(Map.of("IncludeLowerLevel", false, "orgId", orgId));
return;
}else if(cachedDataFalse!=null){
cachedDataFalse.add(newPoliceId);
redisUtils.set(redisKeyFalse, cachedDataFalse);
}else if(cachedDataTrue!=null){
cachedDataTrue.add(newPoliceId);
redisUtils.set(redisKeyTrue, cachedDataTrue);
}
}
//删除缓存的方法
private void deletePoliceIdCache(String orgId){
//构建 Redis 缓存键
String redisKey = "getAllPoliceId_false_" + orgId;
redisUtils.delete(redisKey);
//构建 Redis 缓存键
redisKey = "getAllPoliceId_true_" + orgId;
redisUtils.delete(redisKey);
}
@Override
public ResponseResult getOnePolice(Map<String, Object> msg){
// 进行参数校验
try {
checkNotBlank(msg.get("policeId"), "policeId不能为空");
} catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage());
}
String userId = msg.get("policeId").toString();
Map<String, Object> policeMsg = policemanMapper.getOnePolice(userId);
//如果没有查找到信息,返回相关提示
if (policeMsg == null){
return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.NO_DATA, ReturnData.NO_DATA);
}
return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS,policeMsg);
}
@Override
public ResponseResult deletePolice(Map<String, Object> msg) {
// 进行参数校验
try {
checkNotBlank(msg.get("policeList"), "policeList不能为空");
} catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage());
}
//遍历要删除的警员id
List<Object> policeList = (List<Object>) msg.get("policeList");
for (Object policeId:policeList){
policemanMapper.deletePolice(policeId.toString());
}
//todo 删除缓存中的警员信息
return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS);
}
@Override
public ResponseResult updatePolice(Map<String, Object> policeman) {
// 进行参数校验
try {
checkNotBlank(policeman.get("id"), "id不能为空");
checkNotBlank(policeman.get("orgId"), "orgId不能为空");
checkNotBlank(policeman.get("name"), "name不能为空");
checkNotBlank(policeman.get("policeCode"), "policeCode不能为空");
checkNotBlank(policeman.get("sex"), "sex不能为空");
//checkNotBlank((String) policeman.get("cabinetBoxId"), "cabinetBoxId不能为空");
checkNotBlank(policeman.get("phone"), "phone不能为空");
checkNotBlank(policeman.get("idCard"), "idCard不能为空");
//checkNotBlank((String) policeman.get("photo"), "photo不能为空");
} catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage());
}
//查询传入的组织机构id是否存在
Long onePubOrg = pubOrgMapper.getOnePubOrg(policeman.get("orgId").toString());
if (onePubOrg == null || onePubOrg.equals("")){
return new ResponseResult(HttpStatus.ERROR,ReturnMsg.ERROR,"该组织机构不存在");
}
//获取map中的policeCode
String policeCode = policeman.get("policeCode").toString();
//查询是否有重复的policeCode
List<String> policeCodeFlag = policemanMapper.getPoliceByPoliceCode(policeCode);
//判断policeCode是否有变动
String oldPoliceCode = policemanMapper.getPoliceCodeById(policeman.get("id").toString());
if (!oldPoliceCode.equals(policeCode)){
if (!policeCodeFlag.isEmpty()){
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,"警员编号已存在");
}
}
//查询单警柜箱号是否存在
if (policeman.containsKey("cabinetBoxId")){
String oneCabinetBox = cabinetBoxMapper.getOneCabinetBox(policeman.get("cabinetBoxId").toString());
if (oneCabinetBox == null || oneCabinetBox.equals("")){
return new ResponseResult(HttpStatus.ERROR,ReturnMsg.ERROR,"该单警柜箱号不存在");
}
}
Policeman police =new Policeman();
//修改警员相关信息
//生成当前时间
Date currentDate = DateTimeUtil.getCurrentDateTime();
//police.setId(uuid);
String id = policeman.get("id").toString();
police.setId(id);
police.setOrgId((String) policeman.get("orgId"));
police.setName((String) policeman.get("name"));
police.setPoliceCode((String) policeman.get("policeCode"));
police.setSex((String) policeman.get("sex"));
//police.setIsCreatedAccount((Integer) policeman.get("isCreatedAccount"));
police.setCabinetBoxId((String) policeman.get("cabinetBoxId"));
police.setPhone((String) policeman.get("phone"));
police.setIdCard((String) policeman.get("idCard"));
police.setPhoto((String) policeman.get("photo"));
//police.setUpdateUser((String) policeman.get("updateUser"));
police.setUpdateTime(currentDate);
policemanMapper.updatePolice(police);
// //更新缓存中的信息
// long timestamp = currentDate.getTime(); // 将Date对象转换为long类型的时间戳
// policeman.put("updateTime",timestamp);
//
// /**
// * 更新缓存
// * */
// //构建Redis缓存键
// String redisKey = REDIS_ORG + "true" +'_'+ policeman.get("orgId").toString();
// // 从 Redis 中获取数据
// List<Map<String, Object>> cachedDataTrue = redisUtils.findCachedData(redisKey);
// if (cachedDataTrue != null) {
// //删除之前的缓存信息
// Iterator<Map<String, Object>> iterator = cachedDataTrue.iterator();
// while (iterator.hasNext()) {
// Map<String, Object> oneData = iterator.next();
// String redisId = oneData.get("id").toString();
// if (id.equals(redisId)) {
// iterator.remove(); // 删除当前循环中的元素
// break;
// }
// }
// //将最新的信息加入
// cachedDataTrue.add(0,policeman);
// //将查询结果存入 Redis 中
// redisUtils.set(redisKey, cachedDataTrue);
// }
//
//
// //构建Redis缓存键
// redisKey = REDIS_ORG + "false" +'_'+ policeman.get("orgId").toString();
// // 从 Redis 中获取数据
// List<Map<String, Object>> cachedDataFalse = redisUtils.findCachedData(redisKey);
// if (cachedDataFalse != null) {
// //删除之前的缓存信息
// Iterator<Map<String, Object>> iterator = cachedDataTrue.iterator();
// while (iterator.hasNext()) {
// Map<String, Object> oneData = iterator.next();
// String redisId = oneData.get("id").toString();
// if (id.equals(redisId)) {
// iterator.remove(); // 删除当前循环中的元素
// break;
// }
// }
// //将最新的信息加入
// cachedDataFalse.add(0,policeman);
// //将查询结果存入 Redis 中
// redisUtils.set(redisKey, cachedDataFalse);
// }
return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS);
}
@Override
public List<String> getAllPoliceId(Map<String, Object> msg) {
//如果组织机构是最高级的,获取所有id
// if (msg.get("orgId").toString().equals("1369509498032808905")){
// //构建 Redis 缓存键
// String redisKey = "getAllPoliceId_"+msg.get("orgId");
// // 从 Redis 中获取数据
// List<String> cachedData = redisUtils.findCachedData(redisKey);
// if (cachedData!=null){
// return cachedData;
// }
// List<String> allPoliceId = policemanMapper.getAllPoliceIdByHighest();
// //将查询结果存入 Redis 中
// redisUtils.set(redisKey, allPoliceId);
// return allPoliceId;
// }
//构建 Redis 缓存键
String redisKey = "getAllPoliceId_"+msg.get("IncludeLowerLevel")+'_'+msg.get("orgId");
// 从 Redis 中获取数据
List<String> cachedData = redisUtils.findCachedData(redisKey);
if (cachedData!=null){
return cachedData;
}
List<String> policeId = new ArrayList<>();
if (msg.get("IncludeLowerLevel").equals("false")){
policeId = policemanMapper.getAllPoliceId(msg.get("orgId").toString());
}else if(msg.get("IncludeLowerLevel").equals("true")){
//查询某组织机构的本级及下级
List<String> orgIds = getSubIds(msg.get("orgId").toString()); //调用本级及下级的所有组织机构的id
for (String orgId:orgIds){
//String redisKey = REDIS_ORG + orgId;
List<String> allPoliceId = policemanMapper.getAllPoliceId(orgId);
policeId.addAll(allPoliceId);
}
}else {
//填入的IncludeLowerLevel不正确
return null;
}
//将查询结果存入 Redis 中
redisUtils.set(redisKey, policeId);
return policeId;
}
//查询某组织机构的所有子机构
public List<String> getSubIds(String id) {
List<String> subIds = new ArrayList<>();
subIds.add(id);//先往List中放入父级id
List<String> subMenus = policemanMapper.getChildren(id);//查询该id的子类id
if (subMenus != null) {
for (String subMenu : subMenus) {
subIds.addAll(getSubIds(subMenu));
}
}
return subIds;
}
@Override
public ResponseResult deleteFinger(Map<String, Object> msg) {
try {
checkNotBlank(msg.get("fingerId"), "fingerId不能为空");
} catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage());
}
String fingerId = msg.get("fingerId").toString();
policemanMapper.deleteFinger(fingerId);
return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS);
}
@Override
public List<String> getAllPoliceIdByCabinet(Map<String, Object> cabinetId) {
//根据单警柜id找到所有的箱号id
List<String> msg = policemanMapper.getAllBoxIdByCabinet(cabinetId.get("cabinetId").toString());
//遍历所有的箱号id,根据箱号id查询所有的警员信息
List<String> boxId = new ArrayList<>();
for (String id:msg){
policemanMapper.getAllPoliceIdByBoxId(id);
}
return boxId;
}
@Override
public ResponseResult addFingerInfo(Map<String, Object> msg) {
try {
checkNotBlank(msg.get("policeId"), "policeId不能为空");
checkNotBlank(msg.get("name"), "name不能为空");
checkNotBlank(msg.get("fingerInfo"), "fingerInfo不能为空");
} catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage());
}
//指纹id是自增
Date currentDate = DateTimeUtil.getCurrentDateTime();
PoliceFinger finger =new PoliceFinger();
finger.setPoliceId(msg.get("policeId").toString());
finger.setName(msg.get("name").toString());
finger.setFingerInfo(msg.get("fingerInfo").toString());
finger.setCreateTime(currentDate);
finger.setUpdateTime(currentDate);
policeFingerMapper.addFingers(finger);
return new ResponseResult(HttpStatus.SUCCESS,"操作成功");
}
@Override
public ResponseResult addFaceInfo(Map<String, Object> msg) {
try {
checkNotBlank(msg.get("policeId"), "policeId不能为空");
checkNotBlank(msg.get("faceInfo"), "faceInfo不能为空");
} catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage());
}
Date currentDate = DateTimeUtil.getCurrentDateTime();
Policeman police =new Policeman();
police.setId(msg.get("policeId").toString());
police.setFaceInfo(msg.get("faceInfo").toString());
police.setUpdateTime(currentDate);
policemanMapper.addFaceInfo(police);
return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS);
}
@Override
public ResponseResult changePoliceState(Map<String, Object> msg) {
Policeman police =new Policeman();
try {
checkNotBlank(msg.get("policeId"), "policeId不能为空");
checkNotBlank(msg.get("state"), "state不能为空");
} catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage());
}
police.setId(msg.get("policeId").toString());
police.setState((Integer) msg.get("state"));
policemanMapper.changePoliceState(police);
return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS);
}
public List<Map<String, Object>> getAllPolicemanMsg(Map<String, Object> msg,List<String> allPoliceId) {
List<Map<String, Object>> allPoliceman = new ArrayList<>();
// 构建 Redis 缓存键
String redisKey = REDIS_ORG + msg.get("IncludeLowerLevel").toString() +'_'+ msg.get("orgId").toString();
// 从 Redis 中获取数据
List<Map<String, Object>> cachedData = redisUtils.findCachedData(redisKey);
if (cachedData != null) {
//将Long类型的数据转化为Date
for (Map<String,Object> one:cachedData){
Long dataMsg = (Long) one.get("updateTime");
one.put("updateTime", redisUtils.getDate(dataMsg));
allPoliceman.add(one);
}
return cachedData;
}
for (String policeId : allPoliceId) {
Map<String, Object> policeMsg = policemanMapper.getOnePolice(policeId);
allPoliceman.add(policeMsg);
}
//按照updateTime降序排序
DateTimeUtil.timeSort(allPoliceman);
//将查询结果存入 Redis 中
redisUtils.set(redisKey, allPoliceman);
return allPoliceman;
}
@Override
public ResponseResult getAllPoliceman(Map<String, Object> msg) {
try {
checkNotBlank(msg.get("orgId"), "orgId不能为空");
} catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage());
}
List<Map<String, Object>> allPoliceman = new ArrayList<>();
// 构建 Redis 缓存键
String redisKey = REDIS_ORG + msg.get("IncludeLowerLevel").toString() +'_'+ msg.get("orgId").toString();
// 从 Redis 中获取数据
List<Map<String, Object>> cachedData = redisUtils.findCachedData(redisKey);
if (cachedData != null) {
//将Long类型的数据转化为Date
for (Map<String,Object> one:cachedData){
//如果updateTime的类型为Long
Long dataMsg = (Long) one.get("updateTime");
one.put("updateTime", redisUtils.getDate(dataMsg));
allPoliceman.add(one);
}
//按照updateTime降序排序
//DateTimeUtil.timeSort(allPoliceman);
return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS,allPoliceman);
}
//如果组织机构是浙江省公安厅
if (msg.get("orgId").toString().equals("1369509498032808905") && msg.get("IncludeLowerLevel").toString().equals("true")){
allPoliceman = policemanMapper.getAllPolice();
//将查询结果存入 Redis 中
redisUtils.set(redisKey, allPoliceman);
return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS,allPoliceman);
}
//获取该组织机构下所有警员的id
List<String> allPoliceId =getAllPoliceId(msg);
if (allPoliceId==null){
return new ResponseResult(HttpStatus.ERROR,ReturnMsg.ERROR,"未查询到相关数据或IncludeLowerLevel有误");
}
//根据获取的警员id查询相关信息
allPoliceman = getAllPolicemanMsg(msg,allPoliceId);
// for (String policeId :allPoliceId){
// Map<String, Object> policeMsg = policemanService.getOnePolice(policeId);
// List<Map<String, Object>> fingerprints= fingerService.getFingersByUserId(policeId);
// policeMsg.put("fingerMsg",fingerprints);
// allPoliceman.add(policeMsg);
// }
return new ResponseResult(HttpStatus.SUCCESS,"操作成功",allPoliceman);
}
@Override
public ResponseResult getPoliceData(Map<String, Object> cabinetId) {
try {
checkNotBlank(cabinetId.get("cabinetId"), "cabinetId不能为空");
} catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage());
}
//如果没有找到该单警柜,返回对应信息
String cabinetMsg = cabinetId.get("cabinetId").toString();
Map<String, Object> oneCabinet = cabinetMapper.getOneCabinet(cabinetMsg);
if (oneCabinet.isEmpty()){
return new ResponseResult(HttpStatus.ERROR,ReturnMsg.NO_DATA,ReturnData.NO_DATA);
}
// 构建 Redis 缓存键
String redisKey = "getPoliceData" + cabinetId.get("cabinetId").toString();
// 从 Redis 中获取数据
Map<String, Object> cachedData = redisUtils.findCachedData(redisKey);
if (cachedData != null) {
//将Long类型的数据转化为Date
// for (Map<String,Object> one:cachedData){
// Long dataMsg = (Long) one.get("updateTime");
// one.put("updateTime", redisUtils.getDate(dataMsg));
// allPoliceman.add(one);
// }
return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS,cachedData);
}
Map<String, Object> allMsg = new HashMap<>();
allMsg.put("cabinetName",oneCabinet.get("name"));
List<Map<String, Object>> allBoxMsg = cabinetBoxMapper.getBoxMsg(cabinetMsg);
List<Map<String, Object>> policeMsg = new ArrayList<>();
for (Map<String, Object> boxMsg:allBoxMsg){
String cabinetBoxId = boxMsg.get("cabinetBoxId").toString();
List<String> allPoliceIdByBoxId = policemanMapper.getAllPoliceIdByBoxId(cabinetBoxId);
for(String policeId:allPoliceIdByBoxId){
Map<String, Object> onePolice = policemanMapper.getOnePolice(policeId);
List<Map<String, Object>> fingerprints= policeFingerMapper.getFingersByUserId(policeId);
onePolice.put("fingerMsg",fingerprints);
policeMsg.add(onePolice);
}
}
allMsg.put("policeList",policeMsg);
//将查询结果存入 Redis 中
redisUtils.set(redisKey, allMsg);
return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS,allMsg);
}
}
package com.junmp.jyzb.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.junmp.jyzb.api.bean.dto.ProductBatchDto;
import com.junmp.jyzb.api.bean.dto.ProductProcessDto;
import com.junmp.jyzb.api.bean.req.ProductBatchReq;
import com.junmp.jyzb.api.exception.enums.ProductExceptionEnum;
import com.junmp.jyzb.api.util.GenCodeUtil;
import com.junmp.jyzb.entity.ProductBatch;
import com.junmp.jyzb.mapper.ProductBatchMapper;
import com.junmp.jyzb.service.ProductBatchService;
import com.junmp.v2.common.exception.base.ServiceException;
import com.junmp.v2.common.exception.enums.DefaultBizExceptionEnum;
import com.junmp.v2.common.util.BeanPlusUtil;
import com.junmp.v2.db.api.factory.PageFactory;
import com.junmp.v2.db.api.factory.PageResultFactory;
import com.junmp.v2.db.api.page.PageResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* <pre>
*
* 描述:
* 版本:1.0.0
* 日期:2022/7/30 13:47
* 作者:ningzp@junmp.com.cn
* <br>修改记录
* <br>修改日期 修改人 修改内容
*
* </pre>
*/
@Service
@Slf4j
public class ProductBatchServiceImpl extends ServiceImpl<ProductBatchMapper, ProductBatch> implements ProductBatchService {
@Override
public boolean addProductBatch(ProductBatchReq req) {
ProductBatch batch = new ProductBatch();
BeanPlusUtil.copyProperties(req, batch);
batch.setHasFinish(false);
batch.setHasInit(false);
Integer maxSn = baseMapper.getMaxSn();
Integer sn = maxSn + 1;
batch.setSn(sn);
String batchNo = GenCodeUtil.genBatchNo(sn);
batch.setBatchNo(batchNo);
return this.save(batch);
}
@Override
public boolean editProductBatch(ProductBatchReq req) {
ProductBatch batch = queryBatch(req);
//如果修改了生产数量大于开始的数量
if(batch.getHasInit() && (req.getTotal() < batch.getTotal())){
throw new ServiceException(ProductExceptionEnum.MODIFY_NUM_ERROR);
}
if (req.getTotal() > batch.getTotal()) {
batch.setHasInit(false);
}
BeanPlusUtil.copyProperties(req, batch);
return this.updateById(batch);
}
@Override
public boolean del(ProductBatchReq req) {
if (null != req && ObjectUtil.isNotNull(req.getBatchId())) {
ProductBatchDto batch = baseMapper.getBatchProcess(req.getBatchId());
if (ObjectUtil.isNull(batch)) {
//批次不存在
throw new ServiceException(ProductExceptionEnum.BATCH_NOT_EXIST);
} else {
if (!batch.getHasFinish() && (batch.getDoneNum() < 1)) {
return this.removeById(req.getBatchId());
} else {
throw new ServiceException(ProductExceptionEnum.BATCH_PROCESSED);
//生产中不能删除
}
}
} else {
//参数错误
throw new ServiceException(DefaultBizExceptionEnum.VALID_PARAMS_ERROR);
}
}
@Override
public List<ProductBatch> findList(ProductBatchReq req) {
return this.list(createWrapper(req));
}
@Override
public PageResult<ProductBatchDto> findPage(ProductBatchReq req) {
Page<ProductBatchDto> page = baseMapper.getBatchPage(PageFactory.getDefaultPage(req), req);
return PageResultFactory.createPageResult(page);
}
@Override
public PageResult<ProductProcessDto> findProcessPage(ProductBatchReq req) {
Page<ProductProcessDto> page = baseMapper.getBatchProcessPage(PageFactory.getDefaultPage(req), req);
return PageResultFactory.createPageResult(page);
}
@Override
public ProductBatchDto getBatchDetail(Long batchId) {
ProductBatchDto dto = baseMapper.getBatchProcess(batchId);
if (ObjectUtil.isNull(dto)) {
throw new ServiceException(ProductExceptionEnum.BATCH_NOT_EXIST);
}
return dto;
}
private ProductBatch queryBatch(ProductBatchReq req) {
ProductBatch app = this.getById(req.getBatchId());
if (ObjectUtil.isNull(app)) {
throw new ServiceException(ProductExceptionEnum.BATCH_NOT_EXIST);
}
return app;
}
private LambdaQueryWrapper<ProductBatch> createWrapper(ProductBatchReq req) {
LambdaQueryWrapper<ProductBatch> wrapper = new LambdaQueryWrapper<>();
if (ObjectUtil.isEmpty(req)) {
return wrapper;
}
//根据业务编码查询
wrapper.like(ObjectUtil.isNotEmpty(req.getBatchNo()), ProductBatch::getBatchNo, req.getBatchNo());
//根据企业名称模糊查询
wrapper.eq(ObjectUtil.isNotEmpty(req.getProductId()), ProductBatch::getProductId, req.getProductId());
wrapper.eq(ObjectUtil.isNotEmpty(req.getSpecId()), ProductBatch::getSpecId, req.getSpecId());
wrapper.orderByDesc(ProductBatch::getCreateTime);
return wrapper;
}
}
package com.junmp.jyzb.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.junmp.jyzb.api.bean.req.ProductReq;
import com.junmp.jyzb.api.exception.enums.ProductExceptionEnum;
import com.junmp.jyzb.api.util.GenCodeUtil;
import com.junmp.jyzb.entity.Product;
import com.junmp.jyzb.mapper.ProductMapper;
import com.junmp.jyzb.service.ProductService;
import com.junmp.jyzb.service.ProductSkuService;
import com.junmp.v2.common.exception.base.ServiceException;
import com.junmp.v2.common.util.BeanPlusUtil;
import com.junmp.v2.db.api.factory.PageFactory;
import com.junmp.v2.db.api.factory.PageResultFactory;
import com.junmp.v2.db.api.page.PageResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
/**
* <pre>
*
* 描述:
* 版本:1.0.0
* 日期:2022/7/30 13:46
* 作者:ningzp@junmp.com.cn
* <br>修改记录
* <br>修改日期 修改人 修改内容
*
* </pre>
*/
@Service
@Slf4j
public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> implements ProductService {
@Resource
private ProductSkuService productSkuService;
@Override
public boolean addProduct(ProductReq req) {
Product product = new Product();
BeanPlusUtil.copyProperties(req, product);
Integer maxSn = baseMapper.getMaxSn();
//1-获取当前序号
Integer sn = maxSn + 1;
product.setSn(sn);
//2-获取当前编码
String code = GenCodeUtil.genProductCode(sn);
product.setProductCode(code);
return this.save(product);
}
@Override
public boolean editProduct(ProductReq req) {
Product product = this.queryProduct(req);
BeanPlusUtil.copyProperties(req, product);
return this.updateById(product);
}
@Override
@Transactional
public boolean del(ProductReq req) {
Product product = queryProduct(req);
this.removeById(req.getProductId());
productSkuService.delByProductId(product.getProductId());
return true;
}
@Override
public List<Product> findList(ProductReq req) {
LambdaQueryWrapper<Product> wrapper = createWrapper(req);
return this.list(wrapper);
}
@Override
public PageResult<Product> findPage(ProductReq req) {
LambdaQueryWrapper<Product> wrapper = createWrapper(req);
Page<Product> page = this.page(PageFactory.getDefaultPage(), wrapper);
return PageResultFactory.createPageResult(page);
}
private Product queryProduct(ProductReq req) {
Product app = this.getById(req.getProductId());
if (ObjectUtil.isNull(app)) {
throw new ServiceException(ProductExceptionEnum.PRODUCT_NOT_EXIST);
}
return app;
}
private LambdaQueryWrapper<Product> createWrapper(ProductReq req) {
LambdaQueryWrapper<Product> wrapper = new LambdaQueryWrapper<>();
if (ObjectUtil.isEmpty(req)) {
return wrapper;
}
//根据业务编码查询
wrapper.like(ObjectUtil.isNotEmpty(req.getProductCode()), Product::getProductCode, req.getProductCode());
//根据企业名称模糊查询
wrapper.like(ObjectUtil.isNotEmpty(req.getName()), Product::getName, req.getName());
wrapper.orderByDesc(Product::getCreateTime);
return wrapper;
}
}
package com.junmp.jyzb.service.impl;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.junmp.jyzb.api.bean.req.ProductSkuReq;
import com.junmp.jyzb.api.exception.JYZBAppException;
import com.junmp.jyzb.api.exception.enums.ProductExceptionEnum;
import com.junmp.jyzb.api.util.GenCodeUtil;
import com.junmp.jyzb.entity.Product;
import com.junmp.jyzb.entity.ProductSku;
import com.junmp.jyzb.mapper.ProductSkuMapper;
import com.junmp.jyzb.service.ProductService;
import com.junmp.jyzb.service.ProductSkuService;
import com.junmp.v2.common.exception.base.ServiceException;
import com.junmp.v2.common.util.BeanPlusUtil;
import com.junmp.v2.db.api.factory.PageFactory;
import com.junmp.v2.db.api.factory.PageResultFactory;
import com.junmp.v2.db.api.page.PageResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* <pre>
*
* 描述:
* 版本:1.0.0
* 日期:2022/7/29 16:26
* 作者:ningzp@junmp.com.cn
* <br>修改记录
* <br>修改日期 修改人 修改内容
*
* </pre>
*/
@Slf4j
@Service
public class ProductSkuServiceImpl extends ServiceImpl<ProductSkuMapper, ProductSku> implements ProductSkuService {
@Resource
private ProductService productService;
@Override
public boolean addProductSku(ProductSkuReq req) {
ProductSku entity = new ProductSku();
BeanPlusUtil.copyProperties(req, entity);
Integer maxSn = baseMapper.getMaxSn(req.getProductId());
//1-获取当前序号
Integer sn = maxSn + 1;
entity.setSn(sn);
//2- 设置号型编号
String hxCode = GenCodeUtil.genSpecCode(sn);
entity.setSpecCode(hxCode);
//3-设置SKU代码
Product product = productService.getById(req.getProductId());
if (ObjectUtil.isNotNull(product)) {
entity.setSkuCode(GenCodeUtil.genSkuCode(product.getProductCode(), hxCode));
return this.save(entity);
} else {
log.warn(StrUtil.format("该产品不存在,编号为:{}", req.getProductId()));
throw new JYZBAppException(ProductExceptionEnum.PRODUCT_NOT_EXIST);
}
}
@Override
public boolean editProductSku(ProductSkuReq req) {
ProductSku entity = queryProductSku(req);
BeanPlusUtil.copyProperties(req, entity);
return this.updateById(entity);
}
@Override
public boolean del(ProductSkuReq req) {
ProductSku sku = queryProductSku(req);
return removeById(sku.getSpecId());
}
@Override
public boolean delByProductId(Long productId) {
return baseMapper.delByProductId(productId);
}
@Override
public List<ProductSku> findList(ProductSkuReq req) {
LambdaQueryWrapper<ProductSku> wp = createWrapper(req);
return this.list(wp);
}
@Override
public PageResult<ProductSku> findPage(ProductSkuReq req) {
LambdaQueryWrapper<ProductSku> wrapper = createWrapper(req);
Page<ProductSku> page = this.page(PageFactory.getDefaultPage(), wrapper);
return PageResultFactory.createPageResult(page);
}
private ProductSku queryProductSku(ProductSkuReq req) {
ProductSku app = this.getById(req.getSpecId());
if (ObjectUtil.isNull(app)) {
throw new ServiceException(ProductExceptionEnum.PRODUCT_SKU_NOT_EXIST);
}
return app;
}
private LambdaQueryWrapper<ProductSku> createWrapper(ProductSkuReq req) {
LambdaQueryWrapper<ProductSku> wrapper = new LambdaQueryWrapper<>();
if (ObjectUtil.isEmpty(req)) {
return wrapper;
}
//根据业务编码查询
wrapper.like(ObjectUtil.isNotEmpty(req.getSkuCode()), ProductSku::getSkuCode, req.getSkuCode());
//根据企业名称模糊查询
wrapper.eq(ObjectUtil.isNotEmpty(req.getProductId()), ProductSku::getProductId, req.getProductId());
wrapper.orderByDesc(ProductSku::getSn);
return wrapper;
}
}
package com.junmp.jyzb.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.junmp.jyzb.api.bean.dto.ProductTagDto;
import com.junmp.jyzb.api.bean.dto.SimpleTagDto;
import com.junmp.jyzb.api.bean.req.ProductTagReq;
import com.junmp.jyzb.api.exception.enums.ProductExceptionEnum;
import com.junmp.jyzb.entity.ProductTag;
import com.junmp.jyzb.mapper.ProductTagMapper;
import com.junmp.jyzb.service.ProductTagService;
import com.junmp.v2.common.exception.base.ServiceException;
import com.junmp.v2.common.util.BeanPlusUtil;
import com.junmp.v2.db.api.factory.PageFactory;
import com.junmp.v2.db.api.factory.PageResultFactory;
import com.junmp.v2.db.api.page.PageResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
* <pre>
*
* 描述:
* 版本:1.0.0
* 日期:2022/8/1 09:36
* 作者:ningzp@junmp.com.cn
* <br>修改记录
* <br>修改日期 修改人 修改内容
*
* </pre>
*/
@Service
@Slf4j
public class ProductTagServiceImpl extends ServiceImpl<ProductTagMapper, ProductTag> implements ProductTagService {
@Override
public boolean addTagInfo(ProductTagReq req) {
ProductTag tag = new ProductTag();
BeanPlusUtil.copyProperties(req, tag);
tag.setProduceTime(new Date());
tag.setHasChecked(false);
return this.save(tag);
}
@Override
public boolean editTagInfo(ProductTagReq req) {
return false;
}
@Override
public boolean del(ProductTagReq req) {
return false;
}
@Override
public ProductTag checkTagUid(ProductTagReq req) {
//1-查找TagUid是否绑定
ProductTag tag = findByUid(req.getTagUid());
if (ObjectUtil.isNull(tag)) {
//未绑定
SimpleTagDto dto = baseMapper.getInitTagInfo(req.getBatchId());
if (ObjectUtil.isNull(dto)) {
throw new ServiceException(ProductExceptionEnum.TAG_INFO_INIT_DONE);
}
tag = new ProductTag();
tag.setTagId(dto.getTagId());
tag.setProductCode(dto.getProductCode());
return tag;
} else {
//已绑定
//2-验证批次是否一致
if (StrUtil.equalsIgnoreCase(String.valueOf(req.getBatchId()),
String.valueOf(tag.getBatchId()))) {
return tag;
} else {
//抛出异常,标签已经绑定了
throw new ServiceException(ProductExceptionEnum.TAG_INFO_HAD_BINDING);
}
}
}
@Override
public ProductTag findByUid(String tagUid) {
ProductTagReq tmp = new ProductTagReq();
tmp.setTagUid(tagUid);
LambdaQueryWrapper<ProductTag> wp = createWrapper(tmp);
List<ProductTag> list = list(wp);
if (CollectionUtil.isNotEmpty(list)) {
return list.get(0);
} else {
return null;
}
}
@Override
public ProductTagDto getTagInfo(Long tagId) {
ProductTagDto dto = baseMapper.getTagInfoByTagId(tagId);
if (ObjectUtil.isNull(dto)) {
throw new ServiceException(ProductExceptionEnum.TAG_INFO_NOT_EXISTS);
}
return dto;
}
@Override
public List<ProductTag> findList(ProductTagReq req) {
LambdaQueryWrapper<ProductTag> wp = createWrapper(req);
return this.list(wp);
}
@Override
public PageResult<ProductTag> findPage(ProductTagReq req) {
LambdaQueryWrapper<ProductTag> wrapper = createWrapper(req);
Page<ProductTag> page = this.page(PageFactory.getDefaultPage(), wrapper);
return PageResultFactory.createPageResult(page);
}
private LambdaQueryWrapper<ProductTag> createWrapper(ProductTagReq req) {
LambdaQueryWrapper<ProductTag> wrapper = new LambdaQueryWrapper<>();
if (ObjectUtil.isEmpty(req)) {
return wrapper;
}
//根据业务编码查询
wrapper.eq(ObjectUtil.isNotEmpty(req.getProductCode()), ProductTag::getProductCode, req.getProductCode());
wrapper.eq(ObjectUtil.isNotEmpty(req.getTagUid()), ProductTag::getTagUid, req.getTagUid());
wrapper.eq(ObjectUtil.isNotEmpty(req.getBatchId()), ProductTag::getBatchId, req.getBatchId());
wrapper.eq(ObjectUtil.isNotEmpty(req.getTagId()), ProductTag::getTagId, req.getTagId());
wrapper.eq(ProductTag::getHasInit, true);
wrapper.orderByDesc(ProductTag::getCheckTime);
return wrapper;
}
}
package com.junmp.jyzb.service.impl;
import com.junmp.jyzb.domain.EquipmentType;
import com.junmp.jyzb.domain.PubOrg;
import com.junmp.jyzb.utils.HttpStatus;
import com.junmp.jyzb.utils.RedisUtils;
import com.junmp.jyzb.utils.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import com.junmp.jyzb.mapper.PubOrgMapper;
import com.junmp.jyzb.service.PubOrgService;
import java.util.*;
@Service
public class PubOrgServiceImpl implements PubOrgService{
@Resource
private PubOrgMapper pubOrgMapper;
@Autowired
private RedisUtils redisUtils;
//todo 当orgId不传入-1会出现bug
@Override
public ResponseResult showPubOrgList(Map<String, Object> orgId) {
//构建 Redis 缓存键
String redisKey = "showPubOrgList_"+orgId;
// 从 Redis 中获取数据
List<Map<String, Object>> cachedData = redisUtils.findCachedData(redisKey);
if (cachedData!=null){
return new ResponseResult(HttpStatus.SUCCESS,"操作成功",cachedData);
}
List<PubOrg> menuList = pubOrgMapper.selectAllOrg();
List<Map<String, Object>> resultList = new ArrayList<>();
for (PubOrg menu : menuList) {
//System.out.println(menu.getIdByParentId()+" "+menu.getName()+" "+menu.getParentId());
if (menu.getOrgParentId().toString().equals((orgId.get("orgId")))) {
Map<String, Object> map = new HashMap<>();
map.put("id", menu.getOrgId());
map.put("parentId", menu.getOrgParentId());
//去掉前缀
String name1 = menu.getOrgName(); //name1 ,获得“浙江省公安厅”
//List<String> name2 = null;
List<String> name2 = new ArrayList<>();
//name3为固定字段
List<String> name3 = new ArrayList<>();
name3.add("公安局");
name3.add("公安");
name3.add("分局");
if (menu.getOrgName().length()>3 && name2.size() <2 && (menu.getOrgName().charAt(2)=='省' ||menu.getOrgName().charAt(2)=='市')){
String nameHistory = menu.getOrgName().substring(0,3); //name2 ,获得“浙江省”
name2.add(nameHistory);
name2.add(" ");
name2.add(" ");
}
if (menu.getOrgName().length()>3 && (menu.getOrgName().charAt(2)=='区')){
name2.remove(2);
String nameHistory = menu.getOrgName().substring(0,3);
name2.add(2,nameHistory);
}
map.put("orgName", name1);
List<Map<String, Object>> children = getChildMenus(menu.getOrgId(),menuList,name1,name2,name3);//name为要删掉的前缀
if (!children.isEmpty()) {
map.put("children", children);
}
//map.put("children", getChildMenus(menu.getOrgId(),menuList,name1,name2,name3));
resultList.add(map);
}
}
redisUtils.set(redisKey, resultList);
return new ResponseResult(HttpStatus.SUCCESS,"操作成功",resultList);
}
private List<Map<String, Object>> getChildMenus(Long parentId, List<PubOrg> menuList,String deleteName1,List<String> deleteName2,List<String> deleteName3) {
List<Map<String, Object>> childList = new ArrayList<>();
for (PubOrg menu : menuList) {
//if (menu.getParentId() != null && menu.getParentId().equals(parentId)) {
if (menu.getOrgParentId().toString().equals(parentId.toString())) {
Map<String, Object> map = new HashMap<>();
map.put("id", menu.getOrgId());
map.put("parentId", menu.getOrgParentId());
//去掉前缀
String name1 = menu.getOrgName();
List<String> name2 = new ArrayList<>();
name2 = deleteName2;
String result = removePrefix(name1, deleteName1);
//遍历name2删掉前缀
for (String nameMsg:name2){
result = removePrefix(result, nameMsg);
for (String name3:deleteName3){
result = removePrefix(result, name3);
}
}
map.put("orgName", result);
if (result.length()>3 && (result.charAt(2)=='省' ||result.charAt(2)=='市')){
name2.remove(1);
String nameHistory = result.substring(0,3); //获得“绍兴市”
name2.add(1,nameHistory);
}
if (result.length()>3 && (result.charAt(2)=='区' ||result.charAt(2)=='县')){
name2.remove(2);
String nameHistory = result.substring(0,3);
name2.add(2,nameHistory);
}
List<Map<String, Object>> children = getChildMenus(menu.getOrgId(), menuList,name1,name2,deleteName3);
if (!children.isEmpty()) {
map.put("children", children);
}
childList.add(map);
}
}
return childList;
}
//例:传入abc,a ==>bc 删掉开头的字符串,不是就不删除
public static String removePrefix(String name, String deleteName) {
if (name.startsWith(deleteName)) {
return name.substring(deleteName.length());
} else {
return name;
}
}
/**
* 组织机构名称不进行删减的代码
* */
@Override
public ResponseResult showPubOrgListOld(Map<String, Object> orgId) {
//构建 Redis 缓存键
String redisKey = "showPubOrgListOld_"+orgId;
// 从 Redis 中获取数据
List<Map<String, Object>> cachedData = redisUtils.findCachedData(redisKey);
if (cachedData!=null){
return new ResponseResult(HttpStatus.SUCCESS,"操作成功",cachedData);
}
List<PubOrg> menuList = pubOrgMapper.selectAllOrg();
List<Map<String, Object>> resultList = new ArrayList<>();
for (PubOrg menu : menuList) {
if (menu.getOrgParentId().toString().equals((orgId.get("orgId")))) {
Map<String, Object> map = new HashMap<>();
map.put("id", menu.getOrgId());
map.put("parentId", menu.getOrgParentId());
map.put("orgName", menu.getOrgName());
List<Map<String, Object>> children = getChildMenusOld(menu.getOrgId(), menuList);
if (!children.isEmpty()) {
map.put("children", children);
}
resultList.add(map);
}
}
redisUtils.set(redisKey, resultList);
return new ResponseResult(HttpStatus.SUCCESS,"操作成功",resultList);
}
private List<Map<String, Object>> getChildMenusOld(Long parentId, List<PubOrg> menuList) {
List<Map<String, Object>> childList = new ArrayList<>();
for (PubOrg menu : menuList) {
if (menu.getOrgParentId().toString().equals(parentId.toString())) {
Map<String, Object> map = new HashMap<>();
map.put("id", menu.getOrgId());
map.put("parentId", menu.getOrgParentId());
map.put("orgName", menu.getOrgName());
List<Map<String, Object>> children = getChildMenusOld(menu.getOrgId(), menuList);
if (!children.isEmpty()) {
map.put("children", children);
}
childList.add(map);
}
}
return childList;
}
}
package com.junmp.jyzb.service.impl;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import com.junmp.jyzb.mapper.ShelfMapper;
import com.junmp.jyzb.service.ShelfService;
@Service
public class ShelfServiceImpl implements ShelfService{
@Resource
private ShelfMapper shelfMapper;
}
package com.junmp.jyzb.service.impl;
import com.junmp.jyzb.service.SupplierEquipmentService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import com.junmp.jyzb.mapper.SupplierEquipmentMapper;
@Service
public class SupplierEquipmentServiceImpl implements SupplierEquipmentService {
@Resource
private SupplierEquipmentMapper supplierEquipmentMapper;
}
package com.junmp.jyzb.service.impl;
import com.junmp.jyzb.domain.Policeman;
import com.junmp.jyzb.domain.Supplier;
import com.junmp.jyzb.service.SupplierService;
import com.junmp.jyzb.utils.*;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import com.junmp.jyzb.mapper.SupplierMapper;
import java.util.*;
import static com.junmp.jyzb.utils.CheckBlank.checkNotBlank;
@Service
public class SupplierServiceImpl implements SupplierService {
@Resource
private SupplierMapper supplierMapper;
@Resource
private RedisUtils redisUtils;
private static final String REDIS_SUPPLIER = "Supplier_";
@Override
public ResponseResult addSupplier(Map<String, Object> msg) {
try {
checkNotBlank(msg.get("name"), "name不能为空");
//checkNotBlank((String) msg.get("shortName"), "shortName不能为空");
checkNotBlank(msg.get("name"), "name不能为空");
checkNotBlank(msg.get("code"), "code不能为空");
checkNotBlank(msg.get("contacts"), "contacts不能为空");
checkNotBlank(msg.get("phone"), "phone不能为空");
} catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage());
}
Supplier supplier =new Supplier();
//将警员相关信息添加到警员表
//生成一个uuid
String uuid = UUID.randomUUID().toString().replaceAll("-", "");
//生成当前时间
Date currentDate = DateTimeUtil.getCurrentDateTime();
supplier.setId(uuid);
supplier.setCreateTime(currentDate);
supplier.setUpdateTime(currentDate);
supplier.setName((String) msg.get("name"));
supplier.setShortName((String) msg.get("shortName"));
supplier.setCode((String) msg.get("code"));
supplier.setContacts((String) msg.get("contacts"));
supplier.setPhone((String) msg.get("phone"));
//supplier.setCreateUser((String) msg.get("createUser"));
supplierMapper.addSupplier(supplier);
// 将uuid、创建时间、更新时间加入到policeman中
msg.put("id",uuid);
long timestamp = currentDate.getTime(); // 将Date对象转换为long类型的时间戳
//policeman.put("createTime",timestamp);
msg.put("updateTime",timestamp);
/**
* 更新缓存
* */
//构建Redis缓存键
String redisKey = REDIS_SUPPLIER;
// 从 Redis 中获取数据
List<Map<String, Object>> cachedData = redisUtils.findCachedData(redisKey);
if (cachedData != null) {
cachedData.add(0,msg);
//将查询结果存入 Redis 中
redisUtils.set(redisKey, cachedData);
}
return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS,uuid);
}
@Override
public Map<String,Object> getOneSupplier(String id,Object name,Object code) {
//读取msg中的检索信息
return supplierMapper.getOneSupplier(id,name,code);
}
@Override
public ResponseResult deleteSupplier(Map<String, Object> msg) {
try {
checkNotBlank(msg.get("supplierList"), "supplierList不能为空");
} catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage());
}
List<Object> supplierList = (List<Object>) msg.get("supplierList");
for (Object supplierId:supplierList){
supplierMapper.deleteSupplier(supplierId.toString());
}
return new ResponseResult(HttpStatus.SUCCESS,"操作成功");
}
@Override
public ResponseResult updateSupplier(Map<String, Object> msg) {
try {
checkNotBlank(msg.get("id"), "id不能为空");
//checkNotBlank((String) msg.get("shortName"), "shortName不能为空");
checkNotBlank(msg.get("name"), "name不能为空");
checkNotBlank(msg.get("code"), "code不能为空");
checkNotBlank(msg.get("contacts"), "contacts不能为空");
checkNotBlank(msg.get("phone"), "phone不能为空");
} catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage());
}
Supplier supplier =new Supplier();
Date currentDate = DateTimeUtil.getCurrentDateTime();
supplier.setUpdateTime(currentDate);
supplier.setId((String) msg.get("id"));
supplier.setName((String) msg.get("name"));
supplier.setShortName((String) msg.get("shortName"));
supplier.setCode((String) msg.get("code"));
supplier.setContacts((String) msg.get("contacts"));
supplier.setPhone((String) msg.get("phone"));
//supplier.setUpdateUser((String) msg.get("updateUser"));
supplierMapper.updateSupplier(supplier);
return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS);
}
@Override
public List<String> getAllSupplierId() {
List<String> msg = supplierMapper.getAllSupplierId();
return msg;
}
@Override
public ResponseResult getAllSupplier(Map<String, Object> msg) {
// Object name = msg.get("name");
// Object code = msg.get("code");
// List<Map<String, Object>> allSupplier=new ArrayList<>();
// // 构建 Redis 缓存键
// String redisKey = REDIS_SUPPLIER;
// // 从 Redis 中获取数据
// List<Map<String, Object>> cachedData = redisUtils.findCachedData(redisKey);
// if (cachedData != null) {
// //将Long类型的数据转化为Date
// for (Map<String,Object> one:cachedData){
// Long dataMsg = (Long) one.get("updateTime");
// one.put("updateTime", redisUtils.getDate(dataMsg));
// allSupplier.add(one);
// }
// return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS,allSupplier);
// }
//
// List<String> allSupplierId =getAllSupplierId();
// for (String supplierId :allSupplierId){
// Map<String, Object> supplierMsg = getOneSupplier(supplierId,null,null); //入参设置为null,关闭模糊查询
// if (supplierMsg!=null){
// allSupplier.add(supplierMsg);
// }
// }
// //将查询结果存入Redis中, 不设置过期时间 , 默认为永久
// redisUtils.set(redisKey, allSupplier);
// return new ResponseResult(HttpStatus.SUCCESS,"操作成功",allSupplier);
List<Map<String, Object>> allSupplier=new ArrayList<>();
//构建 Redis 缓存键
String redisKey = REDIS_SUPPLIER;
// 从 Redis 中获取数据
List<Map<String, Object>> cachedData = redisUtils.findCachedData(redisKey);
if (cachedData != null) {
//将Long类型的数据转化为Date
for (Map<String,Object> one:cachedData){
Long dataMsg = (Long) one.get("updateTime");
one.put("updateTime", redisUtils.getDate(dataMsg));
allSupplier.add(one);
}
return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS,allSupplier);
}
//将查询结果存入Redis中, 不设置过期时间 , 默认为永久
allSupplier = supplierMapper.getAllSupplier();
redisUtils.set(redisKey, allSupplier);
return new ResponseResult(HttpStatus.SUCCESS,"操作成功",allSupplier);
}
@Override
public ResponseResult changeSupplierState(Map<String, Object> msg) {
try {
checkNotBlank(msg.get("supplierId"), "supplierId不能为空");
checkNotBlank(msg.get("state"), "state不能为空");
} catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage());
}
Supplier supplier =new Supplier();
supplier.setId(msg.get("supplierId").toString());
supplier.setState((Integer) msg.get("state"));
supplierMapper.changeSupplierState(supplier);
return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS);
}
}
package com.junmp.jyzb.service.impl;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import com.junmp.jyzb.mapper.SupplierTypeMapper;
import com.junmp.jyzb.service.SupplierTypeService;
@Service
public class SupplierTypeServiceImpl implements SupplierTypeService{
@Resource
private SupplierTypeMapper supplierTypeMapper;
}
package com.junmp.jyzb.service.impl;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import com.junmp.jyzb.mapper.WarehouseAreaMapper;
import com.junmp.jyzb.service.WarehouseAreaService;
@Service
public class WarehouseAreaServiceImpl implements WarehouseAreaService{
@Resource
private WarehouseAreaMapper warehouseAreaMapper;
}
package com.junmp.jyzb.service.impl;
import com.junmp.jyzb.domain.*;
import com.junmp.jyzb.mapper.*;
import com.junmp.jyzb.service.PolicemanService;
import com.junmp.jyzb.service.WarehouseService;
import com.junmp.jyzb.utils.*;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.*;
import static com.junmp.jyzb.utils.CheckBlank.checkNotBlank;
@Service
public class WarehouseServiceImpl implements WarehouseService {
@Resource
private RedisUtils redisUtils;
@Resource
private WarehouseMapper warehouseMapper;
@Resource
private PolicemanMapper policemanMapper;
@Resource
private PubOrgMapper pubOrgMapper;
@Resource
private ShelfMapper shelfMapper;
@Resource
private WarehouseAreaMapper areaMapper;
private static final String REDIS_WAREHOUSE = "Warehouse_";
@Override
public ResponseResult addWarehouse(Map<String, Object> msg) {
try {
checkNotBlank(msg.get("name"), "name不能为空");
checkNotBlank(msg.get("orgId"), "orgId不能为空");
} catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage());
}
//查询传入的组织机构id是否存在
Long onePubOrg = pubOrgMapper.getOnePubOrg(msg.get("orgId").toString());
if (onePubOrg == null || onePubOrg.equals("")){
return new ResponseResult(HttpStatus.ERROR,ReturnMsg.ERROR,"该组织机构不存在");
}
Warehouse warehouse =new Warehouse();
//将警员相关信息添加到警员表
//生成一个uuid
String uuid = UUID.randomUUID().toString().replaceAll("-", "");
//生成当前时间
Date currentDate = DateTimeUtil.getCurrentDateTime();
warehouse.setId(uuid);
warehouse.setCreateTime(currentDate);
warehouse.setUpdateTime(currentDate);
warehouse.setName((String) msg.get("name"));
//warehouse.setUpdateUser((String) msg.get("updateUser"));
warehouse.setLocation((String) msg.get("location"));
warehouse.setPhone((String) msg.get("phone"));
warehouse.setOrgId((String) msg.get("orgId"));
warehouse.setVideo((String) msg.get("video"));
warehouseMapper.addWarehouse(warehouse);
// 将uuid、创建时间、更新时间加入到policeman中
msg.put("id",uuid);
long timestamp = currentDate.getTime(); // 将Date对象转换为long类型的时间戳
msg.put("updateTime",timestamp);
/**
* 更新缓存
* */
//构建Redis缓存键
String redisKey = REDIS_WAREHOUSE + "true" +'_'+ msg.get("orgId").toString();
// 从 Redis 中获取数据
List<Map<String, Object>> cachedDataTrue = redisUtils.findCachedData(redisKey);
if (cachedDataTrue != null) {
cachedDataTrue.add(0,msg);
//将查询结果存入 Redis 中
redisUtils.set(redisKey, cachedDataTrue);
}
//构建Redis缓存键
redisKey = REDIS_WAREHOUSE + "false" +'_'+ msg.get("orgId").toString();
// 从 Redis 中获取数据
List<Map<String, Object>> cachedDataFalse = redisUtils.findCachedData(redisKey);
if (cachedDataFalse != null) {
cachedDataFalse.add(0,msg);
//将查询结果存入 Redis 中
redisUtils.set(redisKey, cachedDataFalse);
}
return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS,uuid);
}
@Override
public ResponseResult getOneWarehouse(Map<String, Object> id) {
try {
checkNotBlank(id.get("warehouseId"), "warehouseId不能为空");
} catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage());
}
String warehouseId = id.get("warehouseId").toString();
Map<String, Object> warehouse = warehouseMapper.getOneWarehouse(warehouseId);
return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS,warehouse);
}
@Override
public ResponseResult deleteWarehouse(Map<String, Object> msg) {
// 进行参数校验
try {
checkNotBlank(msg.get("warehouseList"), "warehouseList不能为空");
} catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage());
}
List<Object> warehouseList = (List<Object>) msg.get("warehouseList");
for (Object warehouseId:warehouseList){
warehouseMapper.deleteWarehouse(warehouseId.toString());
}
return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS);
}
@Override
public ResponseResult updateWarehouse(Map<String, Object> msg) {
try {
checkNotBlank(msg.get("warehouseId"), "warehouseId不能为空");
checkNotBlank(msg.get("name"), "name不能为空");
checkNotBlank(msg.get("orgId"), "orgId不能为空");
} catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage());
}
//查询传入的组织机构id是否存在
Long onePubOrg = pubOrgMapper.getOnePubOrg(msg.get("orgId").toString());
if (onePubOrg == null || onePubOrg.equals("")){
return new ResponseResult(HttpStatus.ERROR,ReturnMsg.ERROR,"该组织机构不存在");
}
Warehouse warehouse =new Warehouse();
//修改警员相关信息
//生成当前时间
Date currentDate = DateTimeUtil.getCurrentDateTime();
warehouse.setUpdateTime(currentDate);
//police.setId(uuid);
warehouse.setId((String) msg.get("warehouseId"));
warehouse.setName((String) msg.get("name"));
//warehouse.setUpdateUser((String) msg.get("updateUser"));
warehouse.setLocation((String) msg.get("location"));
warehouse.setPhone((String) msg.get("phone"));
warehouse.setOrgId((String) msg.get("orgId"));
warehouseMapper.updateWarehouse(warehouse);
return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS);
}
public List<String> getSubIds(String id) {
List<String> subIds = new ArrayList<>();
subIds.add(id);
List<String> subMenus = policemanMapper.getChildren(id);//查询该id的子类id
if (subMenus != null) {
for (String subMenu : subMenus) {
subIds.addAll(getSubIds(subMenu));
}
}
return subIds;
}
@Override
public ResponseResult changeWarehouseState(Map<String, Object> msg) {
try {
checkNotBlank(msg.get("warehouseId"), "warehouseId不能为空");
Objects.requireNonNull(msg.get("state"), "state不能为空");
} catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage());
}
Warehouse warehouse =new Warehouse();
warehouse.setId(msg.get("warehouseId").toString());
warehouse.setState((Integer) msg.get("state"));
warehouseMapper.changeWarehouseState(warehouse);
return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS);
}
@Override
public ResponseResult getAllWarehouse(Map<String, Object> msg) {
try {
checkNotBlank(msg.get("orgId"), "orgId不能为空");
checkNotBlank(msg.get("IncludeLowerLevel"), "IncludeLowerLevel不能为空");
} catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage());
}
List<Map<String, Object>> allWarehouse=new ArrayList<>();
// 构建 Redis 缓存键
String redisKey = REDIS_WAREHOUSE + msg.get("IncludeLowerLevel").toString() + "_" + msg.get("orgId").toString();
// 从 Redis 中获取数据
List<Map<String, Object>> cachedData = redisUtils.findCachedData(redisKey);
if (cachedData != null) {
//将Long类型的数据转化为Date
for (Map<String,Object> one:cachedData){
Long dataMsg = (Long) one.get("updateTime");
one.put("updateTime", redisUtils.getDate(dataMsg));
allWarehouse.add(one);
}
return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS,allWarehouse);
}
//如果组织机构是浙江省公安厅
if (msg.get("orgId").toString().equals("1369509498032808905") && msg.get("IncludeLowerLevel").toString().equals("true")){
allWarehouse = warehouseMapper.getAllWarehouse();
//将查询结果存入 Redis 中
redisUtils.set(redisKey, allWarehouse);
return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS,allWarehouse);
}
//获取该组织机构下所有仓库的id
//String orgId = msg.get("orgId").toString();
List<String> allWarehouseId =getAllWarehouseId(msg);
for (String warehouseId :allWarehouseId){
Map<String, Object> warehouseMsg = warehouseMapper.getOneWarehouse(warehouseId);
allWarehouse.add(warehouseMsg);
}
//将查询结果存入 Redis 中
redisUtils.set(redisKey, allWarehouse);
return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS,allWarehouse);
}
@Override
public ResponseResult addArea(Map<String, Object> msg) {
try {
checkNotBlank(msg.get("name"), "name不能为空");
checkNotBlank(msg.get("warehouseId"), "warehouseId不能为空");
} catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage());
}
//查询传入的warehouseId是否存在
Map<String,Object> oneWarehouse = warehouseMapper.getOneWarehouse(msg.get("warehouseId").toString());
if (oneWarehouse == null || oneWarehouse.equals("")){
return new ResponseResult(HttpStatus.ERROR,ReturnMsg.ERROR,"该仓库不存在");
}
WarehouseArea warehouseArea =new WarehouseArea();
//生成一个uuid
String uuid = UUID.randomUUID().toString().replaceAll("-", "");
//生成当前时间
Date currentDate = DateTimeUtil.getCurrentDateTime();
warehouseArea.setAreaId(uuid);
warehouseArea.setCreateTime(currentDate);
warehouseArea.setUpdateTime(currentDate);
warehouseArea.setAreaName((String) msg.get("name"));
warehouseArea.setWarehouseId((String) msg.get("warehouseId"));
warehouseArea.setPhoto((String) msg.get("photo"));
areaMapper.addArea(warehouseArea);
return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS,uuid);
}
@Override
public ResponseResult updateArea(Map<String, Object> msg) {
try {
checkNotBlank(msg.get("areaId"), "areaId不能为空");
checkNotBlank(msg.get("name"), "name不能为空");
checkNotBlank(msg.get("warehouseId"), "warehouseId不能为空");
} catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage());
}
//查询传入的warehouseId是否存在
Map<String,Object> oneWarehouse = warehouseMapper.getOneWarehouse(msg.get("warehouseId").toString());
if (oneWarehouse == null || oneWarehouse.equals("")){
return new ResponseResult(HttpStatus.ERROR,ReturnMsg.ERROR,"该仓库不存在");
}
WarehouseArea warehouseArea =new WarehouseArea();
//生成当前时间
Date currentDate = DateTimeUtil.getCurrentDateTime();
warehouseArea.setUpdateTime(currentDate);
warehouseArea.setAreaId((String) msg.get("areaId"));
warehouseArea.setAreaName((String) msg.get("name"));
warehouseArea.setWarehouseId((String) msg.get("warehouseId"));
warehouseArea.setPhoto((String) msg.get("photo"));
areaMapper.updateArea(warehouseArea);
return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS);
}
@Override
public ResponseResult deleteArea(Map<String, Object> msg) {
// 进行参数校验
try {
checkNotBlank(msg.get("areaId"), "areaId不能为空");
} catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage());
}
String areaId = msg.get("areaId").toString();
areaMapper.deleteArea(areaId);
return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS);
}
@Override
public ResponseResult getAreaList(Map<String, Object> msg) {
try {
checkNotBlank(msg.get("warehouseId"), "warehouseId不能为空");
} catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage());
}
Shelf shelf =new Shelf();
shelf.setWarehouseId((String) msg.get("warehouseId"));
List<Map<String,Object>> areaList = areaMapper.getAreaList(shelf);
return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS,areaList);
}
@Override
public ResponseResult addShelf(Map<String, Object> msg) {
try {
checkNotBlank(msg.get("shelfName"), "shelfName不能为空");
checkNotBlank(msg.get("code"), "code不能为空");
checkNotBlank(msg.get("type"), "type不能为空");
checkNotBlank(msg.get("warehouseId"), "warehouseId不能为空");
checkNotBlank(msg.get("shelfRows"), "shelfRows不能为空");
checkNotBlank(msg.get("shelfColumns"), "shelfColumns不能为空");
checkNotBlank(msg.get("shelfRanges"), "shelfRanges不能为空");
} catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage());
}
//查询传入的warehouseId是否存在
Map<String,Object> oneWarehouse = warehouseMapper.getOneWarehouse(msg.get("warehouseId").toString());
if (oneWarehouse == null || oneWarehouse.equals("")){
return new ResponseResult(HttpStatus.ERROR,ReturnMsg.ERROR,"该仓库不存在");
}
Shelf shelf =new Shelf();
//生成一个uuid
String uuid = UUID.randomUUID().toString().replaceAll("-", "");
//生成当前时间
Date currentDate = DateTimeUtil.getCurrentDateTime();
shelf.setShelfId(uuid);
shelf.setCreateTime(currentDate);
shelf.setUpdateTime(currentDate);
shelf.setShelfName((String) msg.get("shelfName"));
shelf.setCode((String) msg.get("code"));
shelf.setType((String) msg.get("type"));
shelf.setWarehouseId((String) msg.get("warehouseId"));
shelf.setShelfRows((Integer) msg.get("shelfRows"));
shelf.setShelfColumns((Integer) msg.get("shelfColumns"));
shelf.setShelfRanges((Integer) msg.get("shelfRanges"));
shelf.setUrl((String) msg.get("url"));
shelf.setSizeInfo((String) msg.get("sizeInfo"));
shelfMapper.addShelf(shelf);
return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS,uuid);
}
@Override
public ResponseResult updateShelf(Map<String, Object> msg) {
try {
checkNotBlank(msg.get("shelfId"), "shelfId不能为空");
checkNotBlank(msg.get("shelfName"), "shelfName不能为空");
checkNotBlank(msg.get("code"), "code不能为空");
checkNotBlank(msg.get("type"), "type不能为空");
checkNotBlank(msg.get("shelfRows"), "shelfRows不能为空");
checkNotBlank(msg.get("shelfColumns"), "shelfColumns不能为空");
checkNotBlank(msg.get("shelfRanges"), "shelfRanges不能为空");
} catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage());
}
Shelf shelf =new Shelf();
//生成一个uuid
//生成当前时间
Date currentDate = DateTimeUtil.getCurrentDateTime();
shelf.setUpdateTime(currentDate);
shelf.setShelfId((String) msg.get("shelfId"));
shelf.setShelfName((String) msg.get("shelfName"));
shelf.setCode((String) msg.get("code"));
shelf.setType((String) msg.get("type"));
shelf.setShelfRows((Integer) msg.get("shelfRows"));
shelf.setShelfColumns((Integer) msg.get("shelfColumns"));
shelf.setShelfRanges((Integer) msg.get("shelfRanges"));
shelf.setUrl((String) msg.get("url"));
shelf.setSizeInfo((String) msg.get("sizeInfo"));
shelfMapper.updateShelf(shelf);
return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS);
}
@Override
public ResponseResult deleteShelf(Map<String, Object> msg) {
// 进行参数校验
try {
checkNotBlank(msg.get("shelfId"), "shelfId不能为空");
} catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage());
}
String shelfId = msg.get("shelfId").toString();
shelfMapper.deleteShelf(shelfId);
return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS);
}
@Override
public ResponseResult getShelfList(Map<String, Object> msg) {
try {
checkNotBlank(msg.get("warehouseId"), "warehouseId不能为空");
} catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage());
}
Shelf shelf =new Shelf();
shelf.setWarehouseId((String) msg.get("warehouseId"));
List<Map<String,Object>> areaList = shelfMapper.getShelfList(shelf);
return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS,areaList);
}
@Override
public List<String> getAllWarehouseId(Map<String, Object> msg) {
//如果组织机构是最高级的,获取所有id
if (msg.get("orgId").toString().equals("1369509498032808905")){
//构建 Redis 缓存键
String redisKey = "getAllWarehouseId_"+msg.get("orgId");
// 从 Redis 中获取数据
List<String> cachedData = redisUtils.findCachedData(redisKey);
if (cachedData!=null){
return cachedData;
}
List<String> allWarehouseId = warehouseMapper.getAllWarehouseIdByHighest();
//将查询结果存入 Redis 中
redisUtils.set(redisKey, allWarehouseId);
return allWarehouseId;
}
//构建 Redis 缓存键
String redisKey = "getAllWarehouseId_"+msg.get("IncludeLowerLevel")+'_'+msg.get("orgId");
// 从 Redis 中获取数据
List<String> cachedData = redisUtils.findCachedData(redisKey);
if (cachedData!=null){
return cachedData;
}
List<String> warehouseId =new ArrayList<>();
if (!msg.containsKey("IncludeLowerLevel")){
warehouseId = warehouseMapper.getAllWarehouseId(msg.get("orgId").toString());
}
else if(msg.get("IncludeLowerLevel").equals("false")){
warehouseId = warehouseMapper.getAllWarehouseId(msg.get("orgId").toString());
}else {
//warehouseId = warehouseMapper.getAllWarehouseId(msg.get("orgId").toString());
List<String> orgIds = getSubIds(msg.get("orgId").toString()); //调用本级及下级的所有组织机构的id
for (String orgId:orgIds){
List<String> allPoliceId = warehouseMapper.getAllWarehouseId(orgId);
warehouseId.addAll(allPoliceId);
}
}
//将查询结果存入 Redis 中
redisUtils.set(redisKey, warehouseId);
return warehouseId;
}
}
package com.junmp.jyzb.service.impl;
import com.junmp.jyzb.service.YearReportService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import com.junmp.jyzb.mapper.YearReportMapper;
@Service
public class YearReportServiceImpl implements YearReportService {
@Resource
private YearReportMapper yearReportMapper;
}
package com.junmp.jyzb.task;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.junmp.v2.job.api.JobAction;
import com.junmp.v2.log.api.LogManagerApi;
import com.junmp.v2.log.api.bean.req.LogRequest;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Date;
/**
* <pre>
*
* 描述:清理日志信息
* 版本:1.0.0
* 日期:2022/9/14 13:12
* 作者:ningzp@junmp.com.cn
* <br>修改记录
* <br>修改日期 修改人 修改内容
*
* </pre>
*/
@Slf4j
@Component
public class ClearLogAction implements JobAction {
@Override
public void action() {
}
}
package com.junmp.jyzb.utils;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import java.util.List;
/**
* 接口参数校验
* */
public class CheckBlank {
public static <T> void checkNotBlank(T value, String errorMsg) {
// 如果value为null
if (value == null) {
throw new IllegalArgumentException(errorMsg);
}
// 如果value为字符串类型
if (value instanceof String) {
String strValue = (String) value;
if (StringUtils.isBlank(strValue)) {
throw new IllegalArgumentException(errorMsg);
}
}
// 如果value为List类型
if (value instanceof List) {
List<?> listValue = (List<?>) value;
if (listValue.isEmpty()) {
throw new IllegalArgumentException(errorMsg);
}
}
}
}
package com.junmp.jyzb.utils;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
public class DateTimeUtil {
private static final DateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
public static Date getCurrentDateTime() {
Date currentDate = new Date();
String dateString = DATE_FORMAT.format(currentDate);
try {
return DATE_FORMAT.parse(dateString);
} catch (ParseException e) {
e.printStackTrace();
return null;
}
}
public static List<Map<String,Object>> timeSort(List<Map<String,Object>> allPoliceman) {
Collections.sort(allPoliceman, new Comparator<Map<String, Object>>() {
@Override
public int compare(Map<String, Object> o1, Map<String, Object> o2) {
Date updateTime1 = (Date) o1.get("updateTime");
Date updateTime2 = (Date) o2.get("updateTime");
return updateTime2.compareTo(updateTime1);
}
});
return allPoliceman;
}
}
\ No newline at end of file
package com.junmp.jyzb.utils;
import org.omg.CORBA.NO_PERMISSION;
/**
* 返回状态码
*
* @author ruoyi
*/
public class HttpStatus
{
/**
* 操作成功
*/
public static final int SUCCESS = 99200;
/**
* 操作失败
*/
public static final int ERROR = 99500;
/**
* 没有操作权限
*/
public static final int NO_PERMISSION = 100001;
/**
* 没有该账户信息
*/
public static final int No_INFORMATION = 100002;
/**
* 找不到页面
*/
public static final int PAGE_NOTFOUND = 100003;
/**
* 流程启动失败
*/
public static final int PROCESS_START_ERROR = 100004;
/**
* 流程已经结束
*/
public static final int PROCESS_WAS_END = 100005;
/**
*没有运行时的任务实例,请确认!
*/
public static final int NO_SUCH_PROCESS = 100006;
/**
* 请求数据超时
*/
public static final int TIMEOUT = 19996;
/**
* 请求数据不合法
*/
public static final int DATA_ILLEGAL = 19997;
/**
* 操作频率过快
*/
public static final int FREQUENCY_FAST = 19998;
/**
* 操作失败
*/
public static final int OPERATION_FAILED = 19999;
/**
* 非常抱歉,服务器平台正在定期维护,预计两小时后恢复
*/
public static final int SERVER_MAINTENANCE = 49997;
/**
* 数据不存在
*/
public static final int NO_DATA = 49998;
/**
* 数据异常
*/
public static final int NOT_FOUND = 49999;
/**
* 服务器异常
*/
public static final int SERVER_ERROR = 50000;
}
package com.junmp.jyzb.utils;
import com.junmp.jyzb.domain.Policeman;
import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.Map;
public class ObjectToMap {
public static Map<String, Object> toMap(Object obj) {
Map<String, Object> map = new HashMap<>();
Class<?> cls = obj.getClass();
// 获取对象的所有属性
Field[] fields = cls.getDeclaredFields();
for (Field field : fields) {
try {
// 设置字段可访问,以便获取其值
field.setAccessible(true);
// 将字段名和字段值添加到Map中
map.put(field.getName(), field.get(obj));
} catch (IllegalAccessException e) {
// 处理异常
e.printStackTrace();
}
}
return map;
}
}
package com.junmp.jyzb.utils;
import org.omg.CORBA.OBJ_ADAPTER;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
@Service
public class RedisUtils {
private static final long REDIS_EXPIRE_TIME = 60*60*2; // 缓存过期时间(单位:秒)默认为两个小时
@Autowired
private RedisTemplate<String, Object> redisTemplate;
/**
* 从 Redis 中获取指定键的缓存数据
*/
public <T> T get(String key) {
return (T) redisTemplate.opsForValue().get(key);
}
/**
* 向 Redis 中设置指定键和值的缓存数据,并设置过期时间
*/
public void set(String key, Object value) {
if (value != null && !Objects.isNull(value)) {
// 将查询结果存入 Redis 中
redisTemplate.opsForValue().set(key, value);
//redisUtils.set(redisKey, allPoliceman);
}
}
// 从缓存中获取Date类型的数据
public Date getDate(Long msg) {
Date date = new Date(msg);
return date;
// Long timestamp = (Long) redisTemplate.opsForValue().get(key);
// return timestamp != null ? new Date(timestamp) : null;
}
/**
* 重载set方法,可以传入自定义的 缓存过期时间
*/
public void set(String key, Object value,Long time) {
if (value != null && !Objects.isNull(value)) {
// 将查询结果存入 Redis 中
redisTemplate.opsForValue().set(key, value, time, TimeUnit.SECONDS);
}
}
/**
* 查找是否有缓存数据
*/
public <T> T findCachedData(String redisKey){
// 从 Redis 中获取数据
Object cachedData = get(redisKey);
if (cachedData != null) {
// 如果缓存命中,则直接返回缓存数据
return (T) cachedData;
}else {
return null;
}
}
/**
* 删除 Redis 中指定键的缓存数据
*/
public void delete(String key) {
redisTemplate.delete(key);
}
}
\ No newline at end of file
package com.junmp.jyzb.utils;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 分页
* */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class RequestParam {
public Integer page; //页码
public Integer size; //每一页的大小
public String keyword; //模糊查询
}
\ No newline at end of file
package com.junmp.jyzb.utils;
import com.fasterxml.jackson.annotation.JsonInclude;
/**
* 定义统一的返回类
* */
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ResponseResult<T> {
/**
* 状态码
*/
private Integer code;
/**
* 提示信息,如果有错误时,前端可以获取该字段进行提示
*/
private String msg;
/**
* 查询到的结果数据,
*/
private T data;
public ResponseResult(Integer code, String msg) {
this.code = code;
this.msg = msg;
}
public ResponseResult(Integer code, T data) {
this.code = code;
this.data = data;
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public T getData() {
return data;
}
public void setData(T data) {
this.data = data;
}
public ResponseResult(Integer code, String msg, T data) {
this.code = code;
this.msg = msg;
this.data = data;
}
}
package com.junmp.jyzb.utils;
/**
* 返回数据
*
* @author ruoyi
*/
public class ReturnData {
/**
* 没有查询到相关数据
*/
public static final String NO_DATA = "没有查询到相关数据";
}
package com.junmp.jyzb.utils;
/**
* 返回信息
*
* @author ruoyi
*/
public class ReturnMsg {
/**
* 操作成功
*/
public static final String PASS = "操作成功";
/**
* 操作成功
*/
public static final String NO_SUCH_PROCESS = "没有运行时的任务实例";
/**
* 操作失败
*/
public static final String ERROR = "操作失败";
/**
* 操作失败
*/
public static final String PROCESS_WAS_END = "当前任务已经结束";
/**
* 未查询到相关数据
*/
public static final String NO_DATA = "未查询到相关数据";
/**
* 未查询到相关数据
*/
public static final String PROCESS_START_ERROR = "启动流程失败";
/**
* 请求数据不合法
*/
public static final String DATA_ILLEGAL = "请求数据不合法";
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.junmp.jyzb.mapper.CabinetBoxMapper">
<resultMap id="BaseResultMap" type="com.junmp.jyzb.domain.CabinetBox">
<!--@mbg.generated-->
<!--@Table base_cabinet_box-->
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="cabinet_id" jdbcType="VARCHAR" property="cabinetId" />
<result column="police_id" jdbcType="VARCHAR" property="policeId" />
<result column="police_name" jdbcType="VARCHAR" property="policeName" />
<result column="error_state" jdbcType="INTEGER" property="errorState" />
<result column="error_msg" jdbcType="VARCHAR" property="errorMsg" />
<result column="log_map" jdbcType="VARCHAR" property="logMap" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, cabinet_id, police_id, police_name, error_state, error_msg, log_map
</sql>
<select id="getBoxMsg" resultType="java.util.Map">
SELECT f.id as cabinetBoxId,num,state,error_msg as errorMsg
FROM base_cabinet_box f
WHERE f.cabinet_id = #{id};
</select>
<update id="changeCabinetState">
update base_cabinet_box f
set state = #{state},error_msg=#{errorMsg}
where f.id =#{id}
</update>
<select id="getOneCabinetBox" resultType="String">
select id
from base_cabinet_box b
where b.id =#{cabinetBoxId}
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.junmp.jyzb.mapper.CabinetMapper">
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, cabinet_num, `name`, org_id, `location`, error_state, create_time, update_time,
create_user, update_user
</sql>
<insert id="addCabinet" parameterType="com.junmp.jyzb.domain.Warehouse">
insert into base_cabinet
(id,cabinet_num,name,org_id,location,state,num,create_time,update_time)
values
(#{id},#{cabinetNum},#{name},#{orgId},#{location},1,#{num},#{createTime},#{updateTime})
</insert>
<select id="getOneCabinet" resultType="Map">
select
c.id,
c.cabinet_num as cabinetNum,
c.name,
o.org_id as orgId,
o.org_name as orgName,
c.location,
c.state,
c.update_time as updateTime
from base_cabinet c,pub_org o
where c.id=#{id} and c.org_id_int =o.org_id
</select>
<delete id="deleteCabinet">
delete from base_cabinet w
where w.id =#{id}
</delete>
<update id="updateCabinet">
update base_cabinet p
set cabinet_num = #{cabinetNum},name=#{name},location=#{location},update_time=#{updateTime},org_id_int=#{orgId}
where p.id =#{id}
</update>
<select id="getAllCabinet" resultType="Map">
select
c.id,
c.cabinet_num as cabinetNum,
c.name,
o.org_id as orgId,
o.org_name as orgName,
c.location,
c.state,
c.update_time as updateTime
from pub_org o
right join base_cabinet c on c.org_id_int =o.org_id
</select>
<select id="getAllCabinetId" resultType="String">
select id
from base_cabinet w
where org_id=#{orgId};
</select>
<update id="changeCabinetState">
update base_cabinet c
set state = #{state}
where c.id =#{id}
</update>
<select id="getAllCabinetBoxId" resultType="String">
select id
from base_cabinet_box b
where cabinet_id=#{id}
</select>
<select id="getCabinetByCabinetNum" resultType="Map">
select id
from base_cabinet w
where cabinet_num=#{cabinetNum};
</select>
<select id="getAllCabinetIdByHighest" resultType="String">
select id
from base_cabinet w
</select>
<select id="getCabinetNumById" resultType="java.lang.String">
select cabinet_num from base_cabinet where id =#{id}
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.junmp.jyzb.mapper.CompanyMapper">
<select id="getMaxSn" resultType="java.lang.Integer">
select ifnull(max(s1.sn), 0) as sn
from biz_company s1
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.junmp.jyzb.mapper.EquipmentSizeMapper">
<resultMap id="BaseResultMap" type="com.junmp.jyzb.domain.EquipmentSize">
<!--@mbg.generated-->
<!--@Table base_equipment_size-->
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="type_id" jdbcType="VARCHAR" property="typeId" />
<result column="detail_id" jdbcType="VARCHAR" property="detailId" />
<result column="code" jdbcType="INTEGER" property="code" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="note" jdbcType="VARCHAR" property="note" />
<result column="epc_type" jdbcType="INTEGER" property="epcType" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, type_id, detail_id, code, `name`, create_time, update_time, note, epc_type
</sql>
<insert id="addSize" parameterType="com.junmp.jyzb.domain.EquipmentSize">
insert into base_equipment_size
(id,type_id,code,name,create_time,update_time,note,price,state,epc_type)
values
(#{id},#{typeId},#{code},#{name},#{createTime},#{updateTime},#{note},#{price},#{state},#{epcType})
</insert>
<select id="getOneSize" resultType="Map">
select id,code,name,note,price,state,epc_type as epcType from base_equipment_size p
where p.id=#{id}
</select>
<update id="deleteSize">
update base_equipment_size w
set state = #{state}
where w.id =#{id}
</update>
<update id="updateSize">
update base_equipment_size p
set type_id = #{typeId},code=#{code},name=#{name},update_time=#{updateTime},note=#{note},price=#{price},state=#{state},epc_type=#{epcType}
where p.id =#{id}
</update>
<select id="getAllSizeId" resultType="String">
select id
from base_equipment_size w
where type_id=#{typeId}
</select>
<update id="changeSizeState">
update base_equipment_size w
set state = #{state}
where w.id =#{id}
</update>
<select id="getSizeByCode" resultType="String">
select code
from base_equipment_size s
where code=#{code}
</select>
<!-- <select id="getCodeById" resultType="java.lang.String">-->
<!-- select from where id =#{id}-->
<!-- </select>-->
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.junmp.jyzb.mapper.EquipmentTypeMapper">
<resultMap id="BaseResultMap" type="com.junmp.jyzb.domain.EquipmentType">
<!--@mbg.generated-->
<!--@Table base_equipment_type-->
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="code" jdbcType="VARCHAR" property="code" />
<result column="parent_id" jdbcType="VARCHAR" property="parentId" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="state" jdbcType="INTEGER" property="state" />
<result column="note" jdbcType="VARCHAR" property="note" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, `name`, code, parent_id, create_time, update_time, `state`, note
</sql>
<select id="selectAllEquipment" resultType="com.junmp.jyzb.domain.EquipmentType">
SELECT id,name,unit,unit_type,code,parent_id,state,note,code,create_time,update_time
FROM base_equipment_type
</select>
<!-- <where>-->
<!-- <if test="SelectTypeId != null">-->
<!-- AND id LIKE CONCAT(#{SelectTypeId})-->
<!-- </if>-->
<!-- <if test="SelectState != null">-->
<!-- AND state LIKE CONCAT(#{SelectState})-->
<!-- </if>-->
<!-- </where>-->
<!-- <if test="SelectTypeId != null and SelectTypeId != ''">-->
<!-- AND id LIKE CONCAT(#{SelectTypeId})-->
<!-- </if>-->
<!-- <if test="SelectState != null and SelectState != ''">-->
<!-- AND state LIKE CONCAT(#{SelectState})-->
<!-- </if>-->
<!--SELECT id,name,unit,unit_type,code,parent_id,state,note,-->
<!-- CASE-->
<!-- WHEN update_time IS NULL THEN create_time-->
<!-- ELSE update_time-->
<!-- END AS update_time-->
<!-- FROM base_equipment_type-->
<insert id="addEquipment" parameterType="com.junmp.jyzb.domain.EquipmentType">
insert into base_equipment_type
(id,name,unit_type,code,parent_id,create_time,update_time,state,note)
values
(#{id},#{name},#{unitType},#{id},#{parentId},#{createTime},#{updateTime},1,#{note})
</insert>
<update id="changeEquipmentState">
update base_equipment_type w
set w.state = #{state}
where w.id = #{id}
</update>
<!--<update id="changeEquipmentState">-->
<!-- update base_equipment_type w,base_supplier_id i-->
<!-- set w.state = #{state},i.state = #{state}-->
<!-- where w.id =#{id} and i.type_id = #{id}-->
<!-- </update>-->
<delete id="deleteEquipment">
delete from base_equipment_type w
where id =#{id}
</delete>
<update id="updateEquipment">
update base_equipment_type p
set name = #{name},unit_type=#{unitType},code=#{id},update_time=#{updateTime},parent_id=#{parentId},note=#{note}
where p.id =#{id}
</update>
<select id="getAllEquipmentId" resultType="String">
select id
from base_equipment_type w
</select>
<select id="getAll" resultType="Map">
select id,parent_id as parentId from base_equipment_type
</select>
<insert id="addData" parameterType="java.util.List">
INSERT INTO base_equipment_id (id, parent_id)
VALUES
<foreach collection="list" item="item" index="index" separator=",">
(#{item.id}, #{item.parentId})
</foreach>
</insert>
<select id="getIdByParentId" resultType="String">
select id
from base_equipment_id i
where parent_id = #{parentId}
</select>
<insert id="addSupplier" parameterType="com.junmp.jyzb.domain.EquipmentType">
INSERT INTO base_supplier_type (id,supplier_id,type_id,state,create_time,update_time)
VALUES
<foreach collection="supplierList" item="supplier" separator=",">
(#{uuid}, #{supplier},#{equipmentType.id},1,#{equipmentType.createTime},#{equipmentType.updateTime})
</foreach>
</insert>
<update id="setCalculationId">
update base_equipment_id i
set id = #{numStr}
where i.parent_id =#{parentId}
</update>
<select id="getOneEquipmentId" resultType="String">
select id
from base_equipment_type t
where t.id =#{numStr}
</select>
<delete id="deleteSupplier">
delete from base_supplier_type w
where type_id =#{id}
</delete>
<select id="getOneEquipment" resultType="Map">
select id,parent_id as parentId,name,unit_type as unitType,code,create_time as createTime,update_time as updateTime,state from base_equipment_type
</select>
<select id="getSupplierByTypeId" resultType="java.util.Map">
SELECT s.name
FROM base_supplier_type t
left join base_supplier s on t.supplier_id = s.id
WHERE type_id = #{id}
</select>
<select id="getLowestTypeId" resultType="String">
select id
from base_equipment_type w
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.junmp.jyzb.mapper.HistoryMapper">
<resultMap id="BaseResultMap" type="com.junmp.jyzb.domain.History">
<!--@mbg.generated-->
<!--@Table base_history-->
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="equipment_id" jdbcType="VARCHAR" property="equipmentId" />
<result column="organization_id" jdbcType="VARCHAR" property="organizationId" />
<result column="search_date" jdbcType="TIMESTAMP" property="searchDate" />
<result column="use_month" jdbcType="INTEGER" property="useMonth" />
<result column="fix_month" jdbcType="INTEGER" property="fixMonth" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, equipment_id, organization_id, search_date, use_month, fix_month
</sql>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.junmp.jyzb.mapper.InventoryMapper">
<resultMap id="BaseResultMap" type="com.junmp.jyzb.domain.Inventory">
<!--@mbg.generated-->
<!--@Table base_inventory-->
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="package_id" jdbcType="VARCHAR" property="packageId" />
<result column="type_id" jdbcType="VARCHAR" property="typeId" />
<result column="type_name" jdbcType="VARCHAR" property="typeName" />
<result column="size_id" jdbcType="VARCHAR" property="sizeId" />
<result column="supplier_id" jdbcType="VARCHAR" property="supplierId" />
<result column="supplier_name" jdbcType="VARCHAR" property="supplierName" />
<result column="shelf_id" jdbcType="VARCHAR" property="shelfId" />
<result column="location_area" jdbcType="VARCHAR" property="locationArea" />
<result column="position_msg" jdbcType="VARCHAR" property="positionMsg" />
<result column="epc" jdbcType="VARCHAR" property="epc" />
<result column="org_id" jdbcType="VARCHAR" property="orgId" />
<result column="org_name" jdbcType="VARCHAR" property="orgName" />
<result column="state" jdbcType="INTEGER" property="state" />
<result column="bussiness_state" jdbcType="INTEGER" property="bussinessState" />
<result column="location_state" jdbcType="INTEGER" property="locationState" />
<result column="production_date" jdbcType="TIMESTAMP" property="productionDate" />
<result column="warranty_period" jdbcType="INTEGER" property="warrantyPeriod" />
<result column="maintenance_period" jdbcType="INTEGER" property="maintenancePeriod" />
<result column="fix_count" jdbcType="INTEGER" property="fixCount" />
<result column="price" jdbcType="VARCHAR" property="price" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="note" jdbcType="VARCHAR" property="note" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, package_id, type_id, type_name, size_id, supplier_id, supplier_name, shelf_id,
location_area, position_msg, epc, org_id, org_name, `state`, bussiness_state, location_state,
production_date, warranty_period, maintenance_period, fix_count, price, create_time,
update_time, note
</sql>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.junmp.jyzb.mapper.InventorySummaryMapper">
<resultMap id="BaseResultMap" type="com.junmp.jyzb.domain.InventorySummary">
<!--@mbg.generated-->
<!--@Table base_inventory_summary-->
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="org_id" jdbcType="VARCHAR" property="orgId" />
<result column="org_name" jdbcType="VARCHAR" property="orgName" />
<result column="type_id" jdbcType="VARCHAR" property="typeId" />
<result column="type_name" jdbcType="VARCHAR" property="typeName" />
<result column="size_id" jdbcType="VARCHAR" property="sizeId" />
<result column="size_name" jdbcType="VARCHAR" property="sizeName" />
<result column="location_type" jdbcType="VARCHAR" property="locationType" />
<result column="location_id" jdbcType="VARCHAR" property="locationId" />
<result column="location_name" jdbcType="VARCHAR" property="locationName" />
<result column="location_area_id" jdbcType="VARCHAR" property="locationAreaId" />
<result column="location_area" jdbcType="VARCHAR" property="locationArea" />
<result column="number" jdbcType="INTEGER" property="number" />
<result column="price" jdbcType="DECIMAL" property="price" />
<result column="stock_number" jdbcType="INTEGER" property="stockNumber" />
<result column="outbound_number" jdbcType="INTEGER" property="outboundNumber" />
<result column="destruction_number" jdbcType="INTEGER" property="destructionNumber" />
<result column="expire_number" jdbcType="INTEGER" property="expireNumber" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, org_id, org_name, type_id, type_name, size_id, size_name, location_type, location_id,
location_name, location_area_id, location_area, `number`, price, stock_number, outbound_number,
destruction_number, expire_number, create_time, update_time
</sql>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.junmp.jyzb.mapper.LogDetailMapper">
<resultMap id="BaseResultMap" type="com.junmp.jyzb.domain.LogDetail">
<!--@mbg.generated-->
<!--@Table base_log_detail-->
<id column="id" jdbcType="INTEGER" property="id" />
<result column="summary_id" jdbcType="INTEGER" property="summaryId" />
<result column="order_id" jdbcType="VARCHAR" property="orderId" />
<result column="epc" jdbcType="VARCHAR" property="epc" />
<result column="equipment_name" jdbcType="VARCHAR" property="equipmentName" />
<result column="equipment_size" jdbcType="VARCHAR" property="equipmentSize" />
<result column="equipment_supplier" jdbcType="VARCHAR" property="equipmentSupplier" />
<result column="equipment_type" jdbcType="INTEGER" property="equipmentType" />
<result column="error_state" jdbcType="INTEGER" property="errorState" />
<result column="note" jdbcType="VARCHAR" property="note" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, summary_id, order_id, epc, equipment_name, equipment_size, equipment_supplier,
equipment_type, error_state, note
</sql>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.junmp.jyzb.mapper.LogSummaryMapper">
<resultMap id="BaseResultMap" type="com.junmp.jyzb.domain.LogSummary">
<!--@mbg.generated-->
<!--@Table base_log_summary-->
<id column="id" jdbcType="INTEGER" property="id" />
<result column="org_id" jdbcType="VARCHAR" property="orgId" />
<result column="org_name" jdbcType="VARCHAR" property="orgName" />
<result column="warehouse_id" jdbcType="VARCHAR" property="warehouseId" />
<result column="warehouse_name" jdbcType="VARCHAR" property="warehouseName" />
<result column="device" jdbcType="VARCHAR" property="device" />
<result column="device_type" jdbcType="INTEGER" property="deviceType" />
<result column="use_time" jdbcType="TIMESTAMP" property="useTime" />
<result column="user_name" jdbcType="VARCHAR" property="userName" />
<result column="out_in_state" jdbcType="INTEGER" property="outInState" />
<result column="picture" jdbcType="VARCHAR" property="picture" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, org_id, org_name, warehouse_id, warehouse_name, device, device_type, use_time,
user_name, out_in_state, picture
</sql>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.junmp.jyzb.mapper.PackageInformationMapper">
<resultMap id="BaseResultMap" type="com.junmp.jyzb.domain.PackageInformation">
<!--@mbg.generated-->
<!--@Table base_package_information-->
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="package_id" jdbcType="VARCHAR" property="packageId" />
<result column="type_id" jdbcType="VARCHAR" property="typeId" />
<result column="type_name" jdbcType="VARCHAR" property="typeName" />
<result column="size_id" jdbcType="VARCHAR" property="sizeId" />
<result column="size_name" jdbcType="VARCHAR" property="sizeName" />
<result column="number" jdbcType="INTEGER" property="number" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, package_id, type_id, type_name, size_id, size_name, `number`
</sql>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.junmp.jyzb.mapper.PackageMapper">
<resultMap id="BaseResultMap" type="com.junmp.jyzb.domain.Package">
<!--@mbg.generated-->
<!--@Table base_package-->
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="count" jdbcType="INTEGER" property="count" />
<result column="org_id" jdbcType="VARCHAR" property="orgId" />
<result column="location" jdbcType="VARCHAR" property="location" />
<result column="shelf_id" jdbcType="VARCHAR" property="shelfId" />
<result column="shelf_name" jdbcType="VARCHAR" property="shelfName" />
<result column="shelf_code" jdbcType="VARCHAR" property="shelfCode" />
<result column="state" jdbcType="INTEGER" property="state" />
<result column="is_destroy" jdbcType="INTEGER" property="isDestroy" />
<result column="epc" jdbcType="VARCHAR" property="epc" />
<result column="print_state" jdbcType="INTEGER" property="printState" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="note" jdbcType="VARCHAR" property="note" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, `count`, org_id, `location`, shelf_id, shelf_name, shelf_code, `state`, is_destroy,
epc, print_state, create_time, update_time, note
</sql>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.junmp.jyzb.mapper.PoliceFingerMapper">
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, police_id, finger_info, create_time, update_time
</sql>
<select id="getFingersByUserId" parameterType="String" resultType="java.util.Map">
SELECT f.id as fingerId,f.name,f.finger_info as fingerInfo
FROM base_police_finger f
WHERE f.police_id = #{userId}
</select>
<insert id="addFingers">
insert into base_police_finger
(police_id,name,finger_info,create_time,update_time)
VALUES
(#{policeId},#{name},#{fingerInfo},#{createTime},update_time)
</insert>
<update id="updateFingers">
update base_police_finger p
set name = #{name},finger_info=#{fingerInfo},update_time=#{updateTime}
where p.id =#{id}
</update>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.junmp.jyzb.mapper.PolicemanMapper">
<!--<resultMap id="PolicemanMap" type="Map">-->
<!-- <id property="id" column="id"/>-->
<!-- <result property="orgId" column="orgId"/>-->
<!-- <result property="orgName" column="orgName"/>-->
<!-- <result property="name" column="name"/>-->
<!-- <result property="sex" column="sex"/>-->
<!-- <result property="phone" column="phone"/>-->
<!-- <result property="photo" column="photo"/>-->
<!-- <result property="policeCode" column="policeCode"/>-->
<!-- <result property="cabinetId" column="cabinetId"/>-->
<!-- <result property="cabinetName" column="cabinetName"/>-->
<!-- <result property="updateTime" column="updateTime"/>-->
<!-- <collection property="fingerMsg" ofType="java.util.Map">-->
<!-- <id property="fingerId" column="fingerId"/>-->
<!-- <result property="fingerName" column="fingerName"/>-->
<!-- <result property="fingerInfo" column="fingerInfo"/>-->
<!-- </collection>-->
<!--</resultMap>-->
<insert id="addPoliceman" parameterType="com.junmp.jyzb.domain.Policeman">
insert into base_policeman
(id,org_id_int,name,police_code,sex,
cabinet_box_id,phone,id_card,photo,create_time,update_time)
values
(#{id},#{orgId},#{name},#{policeCode},#{sex},
#{cabinetBoxId},#{phone},#{idCard},#{photo},#{createTime},#{updateTime})
</insert>
<select id="getOnePolice" resultType="Map">
SELECT
p.id AS id,
o.org_id AS orgId,
o.org_name AS orgName,
p.name AS name,
p.sex,
p.phone,
p.photo,
p.police_code AS policeCode,
c.id AS cabinetId,
c.name AS cabinetName,
p.update_time AS updateTime
FROM base_policeman p
LEFT JOIN pub_org o ON p.org_id = o.org_id
LEFT JOIN base_cabinet c ON p.cabinet_box_id = c.id
WHERE p.id = #{id};
</select>
<select id="getAllPolice" resultType="Map">
SELECT
p.id AS id,
o.org_id AS orgId,
o.org_name AS orgName,
p.name AS name,
p.sex,
p.phone,
p.photo,
p.police_code AS policeCode,
c.id AS cabinetId,
c.name AS cabinetName,
p.update_time AS updateTime
<!-- GROUP_CONCAT(JSON_OBJECT('fingerId', f.id, 'fingerName', f.name,'fingerInfo', f.finger_info)) AS fingerMsg-->
<!-- GROUP_CONCAT(JSON_OBJECT('fingerId', f.id, 'fingerName', f.name,'fingerInfo', f.finger_info)) AS fingerMsg-->
FROM pub_org o
right JOIN base_policeman p ON p.org_id = o.org_id
right JOIN base_cabinet c ON p.cabinet_box_id = c.id
<!-- LEFT JOIN base_police_finger f ON f.police_id = p.id-->
<!-- GROUP BY p.id, o.org_id, o.org_name, p.name, p.sex, p.phone, p.photo, p.police_code, c.id, c.name, p.update_time-->
</select>
<!--<select id="getAllPolice" resultType="java.util.Map">-->
<!-- SELECT-->
<!-- p.id AS id,-->
<!-- o.org_id AS orgId,-->
<!-- o.org_name AS orgName,-->
<!-- p.name AS name,-->
<!-- p.sex,-->
<!-- p.phone,-->
<!-- p.photo,-->
<!-- p.police_code AS policeCode,-->
<!-- c.id AS cabinetId,-->
<!-- c.name AS cabinetName,-->
<!-- p.update_time AS updateTime,-->
<!-- FROM base_policeman p-->
<!-- LEFT JOIN pub_org o ON p.org_id = o.org_id-->
<!-- LEFT JOIN base_cabinet c ON p.cabinet_box_id = c.id-->
<!--</select>-->
<delete id="deletePolice">
DELETE FROM base_policeman p WHERE p.id =#{id};
</delete>
<update id="updatePolice">
update base_policeman p
set
org_id=#{orgId},
name = #{name},
police_code=#{policeCode},
sex=#{sex},
isCreatedAccount=#{isCreatedAccount},
cabinet_box_id=#{cabinetBoxId},
phone=#{phone},
id_card=#{idCard},
update_user=#{updateUser},
photo=#{photo},
update_time=#{updateTime}
where p.id =#{id}
</update>
<!-- <select id="getAllPoliceman" resultType="Map">-->
<!-- select p.id,p.name as police_name,cabinet_id,org_id,police_code,sex,face_info,photo ,f.name as finger_name,finger_info-->
<!-- from base_policeman p,base_police_finger f-->
<!-- where p.id=f.police_id-->
<!-- and p.org_id=#{orgId}-->
<!-- and delete_flag=0-->
<!-- </select>-->
<select id="getAllPoliceId" resultType="String">
select id
from base_policeman p
where org_id_int=#{orgId}
</select>
<select id="getAllPoliceIdByHighest" resultType="String">
select id
from base_policeman p
</select>
<delete id="deleteFinger">
delete from base_police_finger
where id =#{fingerId}
</delete>
<select id="getAllPoliceIdByBoxId" resultType="String">
select id
from base_policeman p
where cabinet_box_id=#{boxId}
</select>
<update id="addFaceInfo" parameterType="com.junmp.jyzb.domain.Policeman">
update base_policeman p
set face_info=#{faceInfo},update_time=#{updateTime}
where p.id=#{id}
</update>
<update id="changePoliceState">
update base_policeman p
set state = #{state}
where p.id =#{id}
</update>
<select id="getChildren" resultType="String">
select org_id from pub_org where org_parent_id = #{id}
</select>
<select id="getAllBoxIdByCabinet" resultType="String">
select id
from base_cabinet_box b
where cabinet_id=#{cabinetId}
</select>
<select id="getPoliceByPoliceCode" resultType="java.lang.String">
select police_code from base_policeman where police_code =#{policeCode}
</select>
<select id="getPoliceCodeById" resultType="java.lang.String">
select police_code from base_policeman where id =#{id}
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.junmp.jyzb.mapper.ProductBatchMapper">
<select id="getMaxSn" resultType="java.lang.Integer">
select ifnull(max(s1.sn), 0) as sn
from biz_product_batch s1
</select>
<select id="getBatchProcess" resultType="com.junmp.jyzb.api.bean.dto.ProductBatchDto">
select *
from v_product_batch_process
where batchId = #{batchId}
</select>
<select id="getBatchPage" resultType="com.junmp.jyzb.api.bean.dto.ProductBatchDto">
select * from v_product_batch_process s1 where 1=1
<if test="null != batch">
<if test="null != batch.batchId">
and s1.batchId = #{batch.batchId}
</if>
<if test="null != batch.productId">
and s1.productId = #{batch.productId}
</if>
<if test="null != batch.specId">
and s1.specId = #{batch.specId}
</if>
<if test="null != batch.batchNo">
and s1.batchNo like concat('%',#{batch.batchNo},'%')
</if>
</if>
order by s1.createTime desc
</select>
<select id="getBatchProcessPage" resultType="com.junmp.jyzb.api.bean.dto.ProductProcessDto">
select * from v_product_batch_check s1 where 1=1
<if test="null != batch">
<if test="null != batch.batchId">
and s1.batchId = #{batch.batchId}
</if>
<if test="null != batch.productId">
and s1.productId = #{batch.productId}
</if>
<if test="null != batch.specId">
and s1.specId = #{batch.specId}
</if>
<if test="null != batch.batchNo">
and s1.batchNo like concat('%',#{batch.batchNo},'%')
</if>
</if>
order by s1.createTime desc
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.junmp.jyzb.mapper.ProductMapper">
<select id="getMaxSn" resultType="java.lang.Integer">
select ifnull(max(s1.sn), 0) as sn
from biz_product s1
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.junmp.jyzb.mapper.ProductSkuMapper">
<!-- 获取当前产品最大序号 -->
<select id="getMaxSn" resultType="java.lang.Integer">
select ifnull(max(s1.sn), 0) as sn
from biz_product_sku s1
where s1.product_id = #{productId}
</select>
<!-- 删除产品对应的号型 -->
<delete id="delByProductId">
delete
from biz_product_sku
where product_id = #{productId}
</delete>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.junmp.jyzb.mapper.ProductTagMapper">
<!-- limit 0,1-->
<select id="getInitTagInfo" resultType="com.junmp.jyzb.api.bean.dto.SimpleTagDto">
select s1.tag_id as tagId,s1.product_code as productCode
from biz_product_tag s1
where s1.batch_id = #{batchId}
and s1.has_init = 0
order by s1.serial_id asc limit 0,1
</select>
<select id="getTagInfoByTagId" resultType="com.junmp.jyzb.api.bean.dto.ProductTagDto">
SELECT s1.tagId,
s1.productCode,
s1.produceTime,
s1.productName,
s1.spec,
s1.material,
s1.weight,
s1.companyName,
s1.password,
s1.ciphertext,
s1.adInfo
FROM v_product_tag_info s1
WHERE s1.tagId = #{tagId}
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.junmp.jyzb.mapper.PubOrgMapper">
<resultMap id="BaseResultMap" type="com.junmp.jyzb.domain.PubOrg">
<!--@mbg.generated-->
<!--@Table pub_org-->
<id column="org_id" jdbcType="BIGINT" property="orgId" />
<result column="org_parent_id" jdbcType="BIGINT" property="orgParentId" />
<result column="org_parent_ids" jdbcType="VARCHAR" property="orgParentIds" />
<result column="org_code" jdbcType="VARCHAR" property="orgCode" />
<result column="org_name" jdbcType="VARCHAR" property="orgName" />
<result column="org_type" jdbcType="SMALLINT" property="orgType" />
<result column="sort_val" jdbcType="TINYINT" property="sortVal" />
<result column="status_flag" jdbcType="TINYINT" property="statusFlag" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
<result column="del_flag" jdbcType="SMALLINT" property="delFlag" />
<result column="org_full_name" jdbcType="VARCHAR" property="orgFullName" />
<result column="address" jdbcType="VARCHAR" property="address" />
<result column="contact" jdbcType="VARCHAR" property="contact" />
<result column="phone" jdbcType="VARCHAR" property="phone" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="create_user" jdbcType="BIGINT" property="createUser" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="update_user" jdbcType="BIGINT" property="updateUser" />
<result column="guid" jdbcType="VARCHAR" property="guid" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
org_id, org_parent_id, org_parent_ids, org_code, org_name, org_type, sort_val, status_flag,
remark, del_flag, org_full_name, address, contact, phone, create_time, create_user,
update_time, update_user, guid
</sql>
<select id="selectAllOrg" resultType="com.junmp.jyzb.domain.PubOrg">
SELECT org_id,org_parent_id,org_name
FROM pub_org
</select>
<select id="getOnePubOrg" resultType="Long">
select org_id
from pub_org t
where t.org_id =#{orgId}
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.junmp.jyzb.mapper.ShelfMapper">
<resultMap id="BaseResultMap" type="com.junmp.jyzb.domain.Shelf">
<!--@mbg.generated-->
<!--@Table base_shelf-->
<id column="shelf_id" jdbcType="VARCHAR" property="shelfId" />
<result column="shelf_name" jdbcType="VARCHAR" property="shelfName" />
<result column="code" jdbcType="VARCHAR" property="code" />
<result column="type" jdbcType="VARCHAR" property="type" />
<result column="warehouseId" jdbcType="VARCHAR" property="warehouseId" />
<result column="shelf_rows" jdbcType="INTEGER" property="shelfRows" />
<result column="shelf_columns" jdbcType="INTEGER" property="shelfColumns" />
<result column="shelf_ranges" jdbcType="INTEGER" property="shelfRanges" />
<result column="url" jdbcType="VARCHAR" property="url" />
<result column="size_info" jdbcType="VARCHAR" property="sizeInfo" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="create_user" jdbcType="VARCHAR" property="createUser" />
<result column="update_user" jdbcType="VARCHAR" property="updateUser" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
shelf_id, shelf_name, code, `type`, warehouseId, shelf_rows, shelf_columns, shelf_ranges,
url, size_info, create_time, update_time, create_user, update_user
</sql>
<insert id="addShelf" parameterType="com.junmp.jyzb.domain.Shelf">
insert into base_shelf
(shelf_id,shelf_name,code,type,warehouse_id,shelf_rows,shelf_columns,shelf_ranges,url,size_info,create_time,update_time)
values
(#{shelfId},#{shelfName},#{code},#{type},#{warehouseId},#{shelfRows},#{shelfColumns},#{shelfRanges},#{url},#{sizeInfo},#{createTime},#{updateTime})
</insert>
<delete id="deleteShelf">
delete from base_shelf s
where shelf_id =#{shelfId}
</delete>
<update id="updateShelf">
update base_shelf s
set shelf_id = #{shelfId},
code=#{code},
type=#{type},
warehouse_id=#{warehouseId},
shelf_rows=#{shelfRows},
shelf_columns=#{shelfColumns},
shelf_ranges=#{shelfRanges},
url=#{url},
size_info=#{sizeInfo},
update_time=#{updateTime}
where shelf_id =#{shelfId}
</update>
<select id="getShelfList" resultType="Map">
select
shelf_id as shelfId,
shelf_name as shelfName,
code,
type,
shelf_rows as shelfRows,
shelf_columns as shelfColumns,
shelf_id as shelfRanges,
url,
size_info as sizeInfo
from base_shelf s
where s.warehouse_id = #{warehouseId}
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.junmp.jyzb.mapper.SupplierEquipmentMapper">
<resultMap id="BaseResultMap" type="com.junmp.jyzb.domain.SupplierEquipment">
<!--@mbg.generated-->
<!--@Table base_supplier_equipment-->
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="supplier_id" jdbcType="VARCHAR" property="supplierId" />
<result column="type_id" jdbcType="VARCHAR" property="typeId" />
<result column="state" jdbcType="INTEGER" property="state" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="update_user" jdbcType="VARCHAR" property="updateUser" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, supplier_id, type_id, `state`, create_time, update_time, update_user
</sql>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.junmp.jyzb.mapper.SupplierMapper">
<resultMap id="BaseResultMap" type="com.junmp.jyzb.domain.Supplier">
<!--@mbg.generated-->
<!--@Table base_supplier-->
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="equipment_id" jdbcType="VARCHAR" property="equipmentId" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="supplier_code" jdbcType="VARCHAR" property="supplierCode" />
<result column="short_name" jdbcType="VARCHAR" property="shortName" />
<result column="contacts" jdbcType="VARCHAR" property="contacts" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="create_user" jdbcType="VARCHAR" property="createUser" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="update_user" jdbcType="VARCHAR" property="updateUser" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, equipment_id, `name`, supplier_code, short_name, contacts, create_time, create_user,
update_time, update_user
</sql>
<insert id="addSupplier" parameterType="com.junmp.jyzb.domain.Supplier">
insert into base_supplier
(id,name,code,short_name,contacts,phone,create_time,update_time,create_user,state)
values
(#{id},#{name},#{code},#{shortName},#{contacts},#{phone},#{createTime},#{updateTime},#{createUser},1)
</insert>
<!-- <select id="getOneSupplier" resultType="Map">-->
<!-- SELECT id, name, code, short_name AS shortName, contacts, phone, update_user,-->
<!-- CASE-->
<!-- WHEN update_time IS NULL THEN create_time-->
<!-- ELSE update_time-->
<!-- END AS updateTime-->
<!-- FROM base_supplier-->
<!-- WHERE id = #{id}-->
<!-- </select>-->
<!--CASE-->
<!-- WHEN update_time IS NULL THEN create_time-->
<!-- ELSE update_time-->
<!-- END AS updateTime-->
<select id="getOneSupplier" resultType="Map">
SELECT id, name, code, short_name AS shortName, contacts, phone, update_user,state
FROM base_supplier
WHERE id = #{id}
<if test="SelectName != null and SelectName != ''">
AND name LIKE CONCAT('%', #{SelectName}, '%')
</if>
<if test="SelectCode != null and SelectCode != ''">
AND code LIKE CONCAT('%', #{SelectCode}, '%')
</if>
</select>
<update id="deleteSupplier">
update base_supplier w
set delete_flag = 1
where w.id =#{id}
</update>
<update id="updateSupplier">
update base_supplier p
set name=#{name},code=#{code},short_name=#{shortName},contacts=#{contacts},phone=#{phone},
update_time=#{updateTime},update_user=#{updateUser}
where p.id =#{id}
</update>
<select id="getAllSupplierId" resultType="String">
select id
from base_supplier w
</select>
<update id="changeSupplierState">
update base_supplier p
set state = #{state}
where p.id =#{id}
</update>
<select id="getAllSupplier" resultType="Map">
SELECT id, name, code, short_name AS shortName, contacts, phone, update_time as updateTime,state
FROM base_supplier
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.junmp.jyzb.mapper.SupplierTypeMapper">
<resultMap id="BaseResultMap" type="com.junmp.jyzb.domain.SupplierType">
<!--@mbg.generated-->
<!--@Table base_supplier_type-->
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="supplier_id" jdbcType="VARCHAR" property="supplierId" />
<result column="type_id" jdbcType="VARCHAR" property="typeId" />
<result column="state" jdbcType="INTEGER" property="state" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="update_user" jdbcType="VARCHAR" property="updateUser" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, supplier_id, type_id, `state`, create_time, update_time, update_user
</sql>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.junmp.jyzb.mapper.WarehouseAreaMapper">
<resultMap id="BaseResultMap" type="com.junmp.jyzb.domain.WarehouseArea">
<!--@mbg.generated-->
<!--@Table base_warehouse_area-->
<id column="area_id" jdbcType="BIGINT" property="areaId" />
<result column="area_name" jdbcType="VARCHAR" property="areaName" />
<result column="org_id_int" jdbcType="BIGINT" property="orgIdInt" />
<result column="warehouse_id" jdbcType="VARCHAR" property="warehouseId" />
<result column="photo" jdbcType="VARCHAR" property="photo" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="create_user" jdbcType="VARCHAR" property="createUser" />
<result column="update_user" jdbcType="VARCHAR" property="updateUser" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
area_id, area_name, org_id_int, warehouse_id, photo, create_time, update_time, create_user,
update_user
</sql>
<insert id="addArea" parameterType="com.junmp.jyzb.domain.WarehouseArea">
insert into base_warehouse_area
(area_id,area_name,photo,create_time,update_time)
values
(#{areaId},#{areaName},#{photo},#{createTime},#{updateTime})
</insert>
<delete id="deleteArea">
delete from base_warehouse_area a
where area_id =#{areaId}
</delete>
<update id="updateArea">
update base_warehouse_area a
set area_name = #{areaName},warehouse_id = #{warehouseId},photo=#{photo},update_time=#{updateTime}
where a.area_id =#{areaId}
</update>
<select id="getAreaList" resultType="Map">
select
area_id as areaId,
area_name as areaName,
photo as photo
from base_warehouse_area s
where s.warehouse_id = #{warehouseId}
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.junmp.jyzb.mapper.WarehouseMapper">
<resultMap id="BaseResultMap" type="com.junmp.jyzb.domain.Warehouse">
<!--@mbg.generated-->
<!--@Table base_warehouse-->
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="location" jdbcType="VARCHAR" property="location" />
<result column="phone" jdbcType="VARCHAR" property="phone" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="update_user" jdbcType="VARCHAR" property="updateUser" />
<result column="org_id" jdbcType="VARCHAR" property="orgId" />
<result column="sum" jdbcType="INTEGER" property="sum" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, `name`, `location`, phone, create_time, update_time, update_user, org_id, `sum`
</sql>
<insert id="addWarehouse" parameterType="com.junmp.jyzb.domain.Warehouse">
insert into base_warehouse
(id,name,location,phone,create_time,update_time,update_user,org_id_int,video,state)
values
(#{id},#{name},#{location},#{phone},#{createTime},#{updateTime},#{updateUser},#{orgId},#{video},1)
</insert>
<select id="getOneWarehouse" resultType="Map">
select
w.id as warehouseId,
o.org_name as orgName,
w.name as name,
w.state,
location,
w.phone,
is_locked as isLocked,
sum,
in_sum as inSum,
out_sum as outSum,
w.update_time as updateTime
from base_warehouse w LEFT JOIN pub_org o on w.org_id=o.org_id
where w.id=#{id}
</select>
<update id="changeWarehouseState">
update base_warehouse w
set state = #{state}
where w.id =#{id}
</update>
<delete id="deleteWarehouse">
delete from base_warehouse w
where id =#{id}
</delete>
<update id="updateWarehouse">
update base_warehouse p
set name = #{name},location=#{location},phone=#{phone},update_time=#{updateTime},update_user=#{updateUser},org_id=#{orgId}
where p.id =#{id}
</update>
<select id="getAllWarehouseId" resultType="String">
select id
from base_warehouse w
where org_id_int=#{orgId}
</select>
<select id="getAllWarehouseIdByHighest" resultType="String">
select id
from base_warehouse w
</select>
<select id="getAllWarehouse" resultType="Map">
select
w.id as warehouseId,
o.org_name as orgName,
w.name as name,
w.state,
location,
w.phone,
is_locked as isLocked,
sum,
in_sum as inSum,
out_sum as outSum,
w.update_time as updateTime
from base_warehouse w LEFT JOIN pub_org o on w.org_id=o.org_id
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.junmp.jyzb.mapper.YearReportMapper">
<resultMap id="BaseResultMap" type="com.junmp.jyzb.domain.YearReport">
<!--@mbg.generated-->
<!--@Table base_year_report-->
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="organization_id" jdbcType="VARCHAR" property="organizationId" />
<result column="start_num" jdbcType="INTEGER" property="startNum" />
<result column="end_num" jdbcType="INTEGER" property="endNum" />
<result column="start_money" jdbcType="INTEGER" property="startMoney" />
<result column="end_money" jdbcType="INTEGER" property="endMoney" />
<result column="destruction_num" jdbcType="INTEGER" property="destructionNum" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, organization_id, start_num, end_num, start_money, end_money, destruction_num
</sql>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>junmp-jyzb-app</artifactId>
<groupId>com.junmp.jyzb</groupId>
<version>1.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>jyzb-boot</artifactId>
<version>1.0.0</version>
<name>jyzb-boot</name>
<dependencies>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
</dependency>
<dependency>
<groupId>p6spy</groupId>
<artifactId>p6spy</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<dependency>
<groupId>com.junmp.v2</groupId>
<artifactId>v2-security-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.junmp.v2</groupId>
<artifactId>v2-config-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.junmp.v2</groupId>
<artifactId>v2-db-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.junmp.v2</groupId>
<artifactId>v2-log-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.junmp.v2</groupId>
<artifactId>swagger2-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.junmp.v2</groupId>
<artifactId>v2-redis-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.junmp.v2</groupId>
<artifactId>file-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.junmp.v2</groupId>
<artifactId>system-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.junmp.v2</groupId>
<artifactId>auth-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.junmp.v2</groupId>
<artifactId>validator-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.junmp.v2</groupId>
<artifactId>job-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.junmp.jyzb</groupId>
<artifactId>jyzb-biz</artifactId>
</dependency>
<dependency>
<groupId>com.junmp.jyzb</groupId>
<artifactId>jyzb-process</artifactId>
</dependency>
</dependencies>
<build>
<finalName>jyzb-boot</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
<configuration>
<!-- 如果没有该项配置,则devtools不会起作用,即应用不会restart -->
<mainClass>com.junmp.jyzb.boot.JyzbBootApplication</mainClass>
<fork>true</fork>
</configuration>
</plugin>
</plugins>
</build>
</project>
package com.junmp.jyzb.boot;
import com.junmp.v2.db.starter.JpDataSourceAutoConfiguration;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
/**
* <pre>
*
* 描述:
* 版本:1.0.0
* 日期:2022/7/29 15:39
* 作者:ningzp@junmp.com.cn
* <br>修改记录
* <br>修改日期 修改人 修改内容
*
* </pre>
*/
@EnableScheduling
@EnableTransactionManagement
@EnableSwagger2
@SpringBootApplication(scanBasePackages = {"com.junmp"}, exclude = {FlywayAutoConfiguration.class,
JpDataSourceAutoConfiguration.class})
public class JyzbBootApplication extends SpringBootServletInitializer {
public static void main(String[] args) {
SpringApplication.run(JyzbBootApplication.class, args);
}
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
return builder.sources(JyzbBootApplication.class);
}
}
package com.junmp.jyzb.boot.config;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
import org.springframework.web.filter.CorsFilter;
@Slf4j
@Configuration
public class GlobalCorsConfig {
@Bean
public CorsFilter corsFilter() {
//1.添加CORS配置信息
CorsConfiguration config = new CorsConfiguration();
//放行哪些原始域
config.addAllowedOrigin("*");
//是否发送Cookie信息
config.setAllowCredentials(false);
//放行哪些原始域(请求方式)
config.addAllowedMethod("*");
//放行哪些原始域(头部信息)
// config.addAllowedHeader("Accept,Origin,X-Request-With,Content-Type,Last-Modified,Access-Control-Request-Method,Access-Control-Request-Headers");
config.addAllowedHeader("*");
//暴露哪些头部信息(因为跨域访问默认不能获取全部头部信息)
config.addExposedHeader("Set-Cookie");
//2.添加映射路径
UrlBasedCorsConfigurationSource configSource = new UrlBasedCorsConfigurationSource();
configSource.registerCorsConfiguration("/**", config);
log.debug("GlobalCorsConfig valid");
//3.返回新的CorsFilter.
return new CorsFilter(configSource);
}
}
package com.junmp.jyzb.boot.config;
import cn.hutool.core.date.DatePattern;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.junmp.jyzb.boot.module.JpJacksonModule;
import org.springframework.boot.jackson.JsonComponent;
import org.springframework.context.annotation.Bean;
import org.springframework.http.MediaType;
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import java.text.SimpleDateFormat;
import java.time.ZoneId;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.TimeZone;
/**
* <pre>
*
* 描述:
* 版本:1.0.0
* 日期:2021/12/29 9:00 上午
* 作者:ningzp@junmp.com.cn
* <br>修改记录
* <br>修改日期 修改人 修改内容
*
* </pre>
*/
@JsonComponent
public class JsonSerializerConfig {
@Bean
public MappingJackson2HttpMessageConverter getMappingJackson2HttpMessageConverter() {
MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter();
//设置中文编码格式
List<MediaType> list = new ArrayList<>();
list.add(MediaType.APPLICATION_JSON);
converter.setSupportedMediaTypes(list);
converter.setObjectMapper(jacksonObjectMapper(new Jackson2ObjectMapperBuilder()));
return converter;
}
private ObjectMapper jacksonObjectMapper(Jackson2ObjectMapperBuilder builder) {
ObjectMapper objectMapper = builder.createXmlMapper(false).build();
//返回JSON的配置
objectMapper.setLocale(Locale.CHINA)
.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false)
//忽略未知字段
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
.setTimeZone(TimeZone.getTimeZone(ZoneId.systemDefault()))
.setDateFormat(new SimpleDateFormat(DatePattern.NORM_DATETIME_PATTERN, Locale.CHINA));
//注册需要自动转换的类型
objectMapper.registerModule(new JpJacksonModule());
return objectMapper;
}
}
package com.junmp.jyzb.boot.config;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Configuration;
/**
* <pre>
*
* 描述:
* 版本:1.0.0
* 日期:2021/6/18 1:33 下午
* 作者:ningzp@junmp.com.cn
* <br>修改记录
* <br>修改日期 修改人 修改内容
*
* </pre>
*/
@Configuration
@MapperScan(basePackages = {"com.junmp.**.mapper"})
public class MapperScanConfiguration {
}
package com.junmp.jyzb.boot.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
//@Configuration
//@EnableSwagger2
public class Swagger2Config {
// @Bean
// public Docket api() {
// return new Docket(DocumentationType.SWAGGER_2)
// .select()
// //.apis(RequestHandlerSelectors.basePackage("com.junmp.junmpProcess.controller"))
// .paths(PathSelectors.any())
// .build()
// .apiInfo(apiInfo());
// }
//
// private ApiInfo apiInfo() {
// return new ApiInfoBuilder()
// .title("API文档")
// .description("API文档")
// .version("1.0")
// .build();
// }
}
package com.junmp.jyzb.boot.core.handle;
import cn.hutool.core.util.StrUtil;
import com.junmp.v2.auth.api.exception.AuthException;
import com.junmp.v2.common.bean.response.ApiRes;
import com.junmp.v2.common.constant.SymbolConstant;
import com.junmp.v2.common.exception.base.ServiceException;
import com.junmp.v2.validator.api.exception.ParamValidateException;
import com.junmp.v2.validator.api.exception.ValidatorExceptionEnum;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.http.converter.HttpMessageNotReadableException;
import org.springframework.validation.BindException;
import org.springframework.validation.BindingResult;
import org.springframework.validation.ObjectError;
import org.springframework.web.HttpMediaTypeNotSupportedException;
import org.springframework.web.HttpRequestMethodNotSupportedException;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.MissingServletRequestParameterException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.servlet.NoHandlerFoundException;
import javax.servlet.http.HttpServletRequest;
import javax.validation.ValidationException;
import java.util.List;
/**
* <pre>
* TODO: 未实现
* 描述:全局异常处理器
* 版本:1.0.0
* 日期:2021/6/21 3:29 下午
* 作者:ningzp@junmp.com.cn
* <br>修改记录
* <br>修改日期 修改人 修改内容
*
* </pre>
*/
@Slf4j
@ControllerAdvice
public class GlobalExceptionHandler {
/**
* 请求参数缺失异常
*/
@ExceptionHandler(MissingServletRequestParameterException.class)
@ResponseBody
@ResponseStatus(value = HttpStatus.INTERNAL_SERVER_ERROR)
public ApiRes missingParam(MissingServletRequestParameterException e) {
String parameterName = e.getParameterName();
String parameterType = e.getParameterType();
log.error("请求参数异常>>[" + parameterName + "][" + parameterType + "]");
return ApiRes.failure(ValidatorExceptionEnum.MISSING_SERVLET_REQUEST_PARAMETER_EXCEPTION);
}
/**
* HttpMessageConverter转化异常,一般为json解析异常
*/
@ExceptionHandler(HttpMessageNotReadableException.class)
@ResponseBody
@ResponseStatus(value = HttpStatus.INTERNAL_SERVER_ERROR)
public ApiRes httpMessageNotReadable(HttpMessageNotReadableException httpMessageNotReadableException) {
log.error("参数格式传递异常,错误信息为:{}", httpMessageNotReadableException.getMessage());
return ApiRes.failure(ValidatorExceptionEnum.HTTP_MESSAGE_CONVERTER_ERROR);
}
/**
* 拦截不支持媒体类型异常
*/
@ExceptionHandler(HttpMediaTypeNotSupportedException.class)
@ResponseBody
@ResponseStatus(value = HttpStatus.INTERNAL_SERVER_ERROR)
public ApiRes httpMediaTypeNotSupport(HttpMediaTypeNotSupportedException httpMediaTypeNotSupportedException) {
log.error("参数格式传递异常,错误信息为:{}", httpMediaTypeNotSupportedException.getMessage());
return ApiRes.failure(ValidatorExceptionEnum.HTTP_MEDIA_TYPE_NOT_SUPPORT);
}
/**
* 不受支持的http method
*/
@ExceptionHandler(HttpRequestMethodNotSupportedException.class)
@ResponseBody
@ResponseStatus(value = HttpStatus.INTERNAL_SERVER_ERROR)
public ApiRes methodNotSupport(HttpServletRequest request) {
String httpMethod = request.getMethod().toUpperCase();
log.error("不支持的http请求方法>>" + httpMethod);
return ApiRes.failure(ValidatorExceptionEnum.HTTP_METHOD_NOT_SUPPORT);
}
/**
* 404找不到资源
*/
@ExceptionHandler(NoHandlerFoundException.class)
@ResponseBody
@ResponseStatus(value = HttpStatus.INTERNAL_SERVER_ERROR)
public ApiRes notFound(NoHandlerFoundException e) {
return ApiRes.failure(ValidatorExceptionEnum.NOT_FOUND);
}
/**
* 请求参数校验失败,拦截 @Valid 校验失败的情况
*/
@ExceptionHandler(MethodArgumentNotValidException.class)
@ResponseBody
@ResponseStatus(value = HttpStatus.INTERNAL_SERVER_ERROR)
public ApiRes methodArgumentNotValidException(MethodArgumentNotValidException e) {
String bindingResult = getArgNotValidMessage(e.getBindingResult());
log.error("绑定异常>>" + bindingResult);
return ApiRes.failure(ValidatorExceptionEnum.VALIDATED_RESULT_ERROR.getCode(),
StrUtil.format(ValidatorExceptionEnum.VALIDATED_RESULT_ERROR.getMessage(),bindingResult));
}
/**
* 请求参数校验失败,拦截 @Validated 校验失败的情况
* <p>
* 两个注解 @Valid 和 @Validated 区别是后者可以加分组校验,前者没有分组校验
*/
@ExceptionHandler(BindException.class)
@ResponseBody
@ResponseStatus(value = HttpStatus.INTERNAL_SERVER_ERROR)
public ApiRes bindException(BindException e) {
String bindingResult = getArgNotValidMessage(e.getBindingResult());
log.error("绑定异常>>" + bindingResult);
return ApiRes.failure(ValidatorExceptionEnum.VALIDATED_RESULT_ERROR);
}
/**
* 拦截 @TableUniqueValue 里抛出的异常
*/
@ExceptionHandler(ValidationException.class)
@ResponseBody
@ResponseStatus(value = HttpStatus.INTERNAL_SERVER_ERROR)
public ApiRes bindException(ValidationException e) {
if (e.getCause() instanceof ParamValidateException) {
ParamValidateException paramValidateException = (ParamValidateException) e.getCause();
return ApiRes.failure(paramValidateException.getCode(), paramValidateException.getMessage());
}
return ApiRes.failure(e.getMessage());
}
/**
* 拦截全校校验一类的异常
*/
@ExceptionHandler(AuthException.class)
//@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
@ResponseBody
public ApiRes authError(AuthException authException) {
log.error(">授权异常>>" + authException.getMessage());
if (null != authException) {
// 默认响应前端json
return ApiRes.failure(authException.getCode(), authException.getMessage());
} else {
return ApiRes.failure("");
}
}
/**
* 拦截业务代码抛出的异常
*/
@ExceptionHandler(ServiceException.class)
//@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
@ResponseBody
public ApiRes businessError(ServiceException e) {
log.error("业务异常,错误信息为:{}", e.getMessage());
return ApiRes.failure(e.getCode(), e.getMessage());
}
/**
* 拦截未知的运行时异常
*/
@ExceptionHandler(Throwable.class)
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
@ResponseBody
public ApiRes serverError(Throwable e) {
log.error("服务器运行异常", e);
return ApiRes.failure(e.getMessage());
}
/**
* 获取请求参数不正确的提示信息
* <p>
* 多个信息,拼接成用逗号分隔的形式
*/
private String getArgNotValidMessage(BindingResult bindingResult) {
if (bindingResult == null) {
return "";
}
StringBuilder stringBuilder = new StringBuilder();
//多个错误用逗号分隔
List<ObjectError> allErrorInfos = bindingResult.getAllErrors();
for (ObjectError error : allErrorInfos) {
stringBuilder.append(SymbolConstant.COMMA).append(error.getDefaultMessage());
}
//最终把首部的逗号去掉
return StrUtil.removePrefix(stringBuilder.toString(), SymbolConstant.COMMA);
}
}
package com.junmp.jyzb.boot.module;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import com.fasterxml.jackson.core.json.PackageVersion;
import com.fasterxml.jackson.databind.deser.std.DateDeserializers;
import com.fasterxml.jackson.databind.module.SimpleModule;
import com.fasterxml.jackson.databind.ser.std.DateSerializer;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalTimeSerializer;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;
/**
* <pre>
*
* 描述:配置JSON序列化和反序列化特殊类型
* 版本:1.0.0
* 日期:2022/5/27 10:32
* 作者:ningzp@junmp.com.cn
* <br>修改记录
* <br>修改日期 修改人 修改内容
*
* </pre>
*/
public class JpJacksonModule extends SimpleModule {
public JpJacksonModule() {
super(PackageVersion.VERSION);
this.addSerializer(LocalDateTime.class, new LocalDateTimeSerializer(DatePattern.NORM_DATETIME_FORMATTER));
this.addSerializer(LocalDate.class, new LocalDateSerializer(DatePattern.NORM_DATE_FORMATTER));
this.addSerializer(LocalTime.class, new LocalTimeSerializer(DateTimeFormatter.ofPattern(DatePattern.NORM_TIME_PATTERN)));
this.addDeserializer(LocalDateTime.class, new LocalDateTimeDeserializer(DatePattern.NORM_DATETIME_FORMATTER));
this.addDeserializer(LocalDate.class, new LocalDateDeserializer(DatePattern.NORM_DATE_FORMATTER));
this.addDeserializer(LocalTime.class, new LocalTimeDeserializer(DateTimeFormatter.ofPattern(DatePattern.NORM_TIME_PATTERN)));
this.addSerializer(Date.class, new DateSerializer(false, DateUtil.newSimpleFormat(DatePattern.NORM_DATETIME_PATTERN)));
this.addDeserializer(Date.class, new DateDeserializers.DateDeserializer());
this.addSerializer(Long.class, ToStringSerializer.instance);
this.addSerializer(Long.TYPE, ToStringSerializer.instance);
this.addSerializer(BigInteger.class, ToStringSerializer.instance);
this.addSerializer(BigDecimal.class, ToStringSerializer.instance);
}
}
scanner:
open: false
# 配置第三方请求
junmp:
swagger:
base-package: com.junmp
id:
worker-id: 1
data-center-id: 1
epoch: 1656036996843
max: 9999
log:
type: db
ds: true #是否多数据源
knife4j:
enable: true
setting:
enableDebug: false
# basic:
# enable: true
# username: ning
# password: ning
spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://192.168.3.128:3306/db_jyzb?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=CTT&nullCatalogMeansCurrent=true
username: junmp
password: 123456
redis:
#host: 192.168.3.188
host: 192.168.3.188
port: 6379
database: 1
password:
flowable:
dmn:
enabled: false
cmmn:
enabled: false
idm:
enabled: false
async-history-executor-activate: false
async-executor-activate: false
check-process-definitions: false
content:
enabled: false
app:
enabled: false
eventregistry:
enabled: false
#mybatis plus 设置
mybatis-plus:
configuration:
cache-enabled: true
lazy-loading-enabled: true
multiple-result-sets-enabled: true
map-underscore-to-camel-case: true #开启驼峰命名
global-config:
banner: false
enable-sql-runner: true
db-config:
id-type: assign_id
table-underline: true
# mapper-locations: classpath*:com/junmp/junmpProcess/mapper/**/xml/*Mapper.xml
mapper-locations: classpath*:/mapper/**/*Mapper.xml
flowable:
dmn:
enabled: false
cmmn:
enabled: false
idm:
enabled: false
async-history-executor-activate: false
async-executor-activate: false
check-process-definitions: false
content:
enabled: false
app:
enabled: false
eventregistry:
enabled: false
scanner:
open: false
junmp:
swagger:
base-package: com.junmp
log:
type: db
bz:
config-storage:
knife4j:
enable: true
setting:
enableDebug: false
basic:
enable: true
username: ning
password: ning
spring:
datasource:
driver-class-name: org.postgresql.Driver
url: jdbc:postgresql://localhost:5432/chirpstack_as
username: junmp
password: junmp.com.cn
server:
port: 10030
spring:
main:
#bea同名类进行注册时,准许覆盖注册
allow-bean-definition-overriding: true
application:
name: jyzb-app
profiles:
#@spring.active@
active: local
servlet:
multipart:
max-request-size: 200MB
max-file-size: 200MB
jackson:
time-zone: GMT+8
date-format: yyyy-MM-dd HH:mm:ss
locale: zh_CN
serialization:
indent_output: false
property-naming-strategy: com.fasterxml.jackson.databind.PropertyNamingStrategy$PascalCaseStrategy
flyway:
enable: ture
locations: classpath:db/migration
# 当迁移时发现目标schema非空,而且带有没有元数据的表时,是否自动执行基准迁移
baseline-on-migrate: true
# 是否允许无序的迁移 开发环境最好开启, 生产环境关闭
out-of-order: true
# 关闭占位符替换,因为插入的sql里边可能包含${}关键字
placeholder-replacement: false
mybatis-plus:
configuration:
cache-enabled: true
lazy-loading-enabled: true
multiple-result-sets-enabled: true
map-underscore-to-camel-case: true #开启驼峰命名
global-config:
banner: false
enable-sql-runner: true
db-config:
id-type: assign_id
table-underline: true
mapper-locations: classpath*:/mapper/**/*Mapper.xml
${AnsiColor.BRIGHT_YELLOW}
___ _____ _
|_ | |_ _| | |
| |_ _ _ __ _ __ ___ _ __ | | ___ ___| |__
| | | | | '_ \| '_ ` _ \| '_ \| |/ _ \/ __| '_ \
/\__/ / |_| | | | | | | | | | |_) | | __/ (__| | | |
\____/ \__,_|_| |_|_| |_| |_| .__/\_/\___|\___|_| |_|
| |
|_| 钧普科技,万物互联
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<!--日志格式应用spring boot默认的格式,也可以自己更改-->
<include resource="org/springframework/boot/logging/logback/defaults.xml"/>
<!--定义日志存放的位置,默认存放在项目启动的相对路径的目录-->
<springProperty scope="context" name="LOG_PATH" source="log.path" defaultValue="app-log"/>
<!-- ****************************************************************************************** -->
<!-- ****************************** 本地开发只在控制台打印日志 ************************************ -->
<!-- ****************************************************************************************** -->
<springProfile name="local">
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
<charset>utf-8</charset>
</encoder>
</appender>
<!--默认所有的包以info-->
<root level="info">
<appender-ref ref="STDOUT"/>
</root>
<!--本项目的日志级别
<logger name="org.springframework" level="ERROR"/>
<logger name="com.junmp" level="info" additivity="false">
<appender-ref ref="STDOUT"/>
</logger>
-->
</springProfile>
<!-- ********************************************************************************************** -->
<!-- **** 放到服务器上不管在什么环境都只在文件记录日志,控制台(catalina.out)打印logback捕获不到的日志 **** -->
<!-- ********************************************************************************************** -->
<springProfile name="!local">
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
<charset>utf-8</charset>
</encoder>
</appender>
<!-- 日志记录器,日期滚动记录 -->
<appender name="FILE_ERROR" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- 正在记录的日志文件的路径及文件名 -->
<file>${LOG_PATH}/log_error.log</file>
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 归档的日志文件的路径,%d{yyyy-MM-dd}指定日期格式,%i指定索引 -->
<fileNamePattern>${LOG_PATH}/error/log-error-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<!-- 除按日志记录之外,还配置了日志文件不能超过2M,若超过2M,日志文件会以索引0开始,
命名日志文件,例如log-error-2013-12-21.0.log -->
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>10MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<!-- 追加方式记录日志 -->
<append>true</append>
<!-- 日志文件的格式 -->
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${FILE_LOG_PATTERN}</pattern>
<charset>utf-8</charset>
</encoder>
<!-- 此日志文件只记录error级别的 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>error</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 日志记录器,日期滚动记录 -->
<appender name="FILE_ALL" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- 正在记录的日志文件的路径及文件名 -->
<file>${LOG_PATH}/log_total.log</file>
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 归档的日志文件的路径,%d{yyyy-MM-dd}指定日期格式,%i指定索引 -->
<fileNamePattern>${LOG_PATH}/total/log-total-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<!-- 除按日志记录之外,还配置了日志文件不能超过2M,若超过2M,日志文件会以索引0开始,
命名日志文件,例如log-error-2013-12-21.0.log -->
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>10MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<!-- 追加方式记录日志 -->
<append>true</append>
<!-- 日志文件的格式 -->
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${FILE_LOG_PATTERN}</pattern>
<charset>utf-8</charset>
</encoder>
</appender>
<!--记录到文件时,记录两类一类是error日志,一个是所有日志-->
<root level="info">
<appender-ref ref="STDOUT"/>
<appender-ref ref="FILE_ERROR"/>
<appender-ref ref="FILE_ALL"/>
</root>
</springProfile>
</configuration>
module.log=com.p6spy.engine.logging.P6LogFactory,com.p6spy.engine.outage.P6OutageFactory
# \u81EA\u5B9A\u4E49\u65E5\u5FD7\u6253\u5370
logMessageFormat=com.baomidou.mybatisplus.extension.p6spy.P6SpyLogger
#\u65E5\u5FD7\u8F93\u51FA\u5230\u63A7\u5236\u53F0
appender=com.baomidou.mybatisplus.extension.p6spy.StdoutLogger
# \u4F7F\u7528\u65E5\u5FD7\u7CFB\u7EDF\u8BB0\u5F55 sql
#appender=com.p6spy.engine.spy.appender.Slf4JLogger
# \u8BBE\u7F6E p6spy driver \u4EE3\u7406
deregisterdrivers=true
# \u53D6\u6D88JDBC URL\u524D\u7F00
useprefix=true
# \u914D\u7F6E\u8BB0\u5F55 Log \u4F8B\u5916,\u53EF\u53BB\u6389\u7684\u7ED3\u679C\u96C6\u6709error,info,batch,debug,statement,commit,rollback,result,resultset.
excludecategories=info,debug,result,commit,resultset
# \u65E5\u671F\u683C\u5F0F
dateformat=yyyy-MM-dd HH:mm:ss
# \u5B9E\u9645\u9A71\u52A8\u53EF\u591A\u4E2A
driverlist=com.mysql.cj.jdbc.Driver
# \u662F\u5426\u5F00\u542F\u6162SQL\u8BB0\u5F55
outagedetection=true
# \u6162SQL\u8BB0\u5F55\u6807\u51C6 2 \u79D2
outagedetectioninterval=2
#
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>junmp-jyzb-app</artifactId>
<groupId>com.junmp.jyzb</groupId>
<version>1.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>jyzb-common</artifactId>
<dependencies>
<!--fastJson-->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.83</version>
</dependency>
<!-- jwt -->
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>0.9.1</version>
</dependency>
<!-- &lt;!&ndash; SpringBoot 测试 &ndash;&gt;-->
<!-- <dependency>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-starter-test</artifactId>-->
<!-- <scope>test</scope>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>io.swagger</groupId>-->
<!-- <artifactId>swagger-annotations</artifactId>-->
<!-- <version>1.5.22</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-starter-web</artifactId>-->
<!-- </dependency>-->
<!-- &lt;!&ndash; SpringBoot集成mybatis框架 &ndash;&gt;-->
<!-- <dependency>-->
<!-- <groupId>com.baomidou</groupId>-->
<!-- <artifactId>mybatis-plus-boot-starter</artifactId>-->
<!-- <version>3.5.2</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>com.junmp.jyzb</groupId>-->
<!-- <artifactId>jyzb-boot</artifactId>-->
<!-- <version>1.0.0</version>-->
<!-- </dependency>-->
</dependencies>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>junmp-jyzb-app</artifactId>
<groupId>com.junmp.jyzb</groupId>
<version>1.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>com.junmp.jyzb</groupId>
<artifactId>jyzb-process</artifactId>
<version>1.0.0</version>
<properties>
<mysql.version>8.0.21</mysql.version>
<flowable.version>6.7.2</flowable.version>
<hutool-all.version>5.8.0</hutool-all.version>
<mybatis-plus.vesion>3.5.1</mybatis-plus.vesion>
<mybatis-plus.generator.vesion>3.4.1</mybatis-plus.generator.vesion>
<mybatis-plus.dynamic.vesion>3.5.1</mybatis-plus.dynamic.vesion>
<guava.version>31.1-jre</guava.version>
<fastjson.version>1.2.83</fastjson.version>
<lombok.version>1.18.20</lombok.version>
<jackson.version>2.13.2</jackson.version>
<dynamic-datasource-spring-boot-starter.version>3.2.0</dynamic-datasource-spring-boot-starter.version>
<mysql-connector-java.version>8.0.27</mysql-connector-java.version>
</properties>
<dependencies>
<!-- rabbitmq依赖 -->
<dependency>
<groupId>com.rabbitmq</groupId>
<artifactId>amqp-client</artifactId>
<version>5.9.0</version>
</dependency>
<!--引入rabbitmq的相关依赖-->
<!-- <dependency>-->
<!-- <groupId>com.rabbitmq</groupId>-->
<!-- <artifactId>amqp-client</artifactId>-->
<!-- <version>5.7.2</version>-->
<!-- </dependency>-->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.3.2</version>
</dependency>
<!-- &lt;!&ndash; 整合到spring项目需要导入此依赖 &ndash;&gt;-->
<!-- <dependency>-->
<!-- <groupId>org.springframework.amqp</groupId>-->
<!-- <artifactId>spring-rabbit</artifactId>-->
<!-- <version>2.3.10</version>-->
<!-- </dependency>-->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-jaxb-annotations</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.springframework.amqp</groupId>-->
<!-- <artifactId>spring-rabbit-test</artifactId>-->
<!-- <scope>test</scope>-->
<!-- </dependency>-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<!-- mysql -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql.version}</version>
</dependency>
<!-- JSON 解析器和生成器 -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>${fastjson.version}</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${guava.version}</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>${mybatis-plus.vesion}</version>
</dependency>
<!-- 代码生成 -->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-generator</artifactId>
<version>${mybatis-plus.generator.vesion}</version>
<exclusions>
<exclusion>
<artifactId>mybatis-plus-extension</artifactId>
<groupId>com.baomidou</groupId>
</exclusion>
</exclusions>
</dependency>
<!--
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>dynamic-datasource-spring-boot-starter</artifactId>
<version>${mybatis-plus.dynamic.vesion}</version>
</dependency>
-->
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>${hutool-all.version}</version>
</dependency>
<!-- flowable -->
<dependency>
<groupId>org.flowable</groupId>
<artifactId>flowable-spring-boot-starter</artifactId>
<version>${flowable.version}</version>
<exclusions>
<exclusion>
<groupId>org.flowable</groupId>
<artifactId>flowable-spring-boot-starter-app</artifactId>
</exclusion>
<exclusion>
<groupId>org.flowable</groupId>
<artifactId>flowable-form-spring-configurator</artifactId>
</exclusion>
<exclusion>
<groupId>org.flowable</groupId>
<artifactId>flowable-idm-spring-configurator</artifactId>
</exclusion>
<exclusion>
<artifactId>mybatis</artifactId>
<groupId>org.mybatis</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.flowable</groupId>
<artifactId>flowable-bpmn-model</artifactId>
<version>${flowable.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.flowable</groupId>
<artifactId>flowable-json-converter</artifactId>
<version>${flowable.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.flowable</groupId>
<artifactId>flowable-bpmn-converter</artifactId>
<version>${flowable.version}</version>
<scope>compile</scope>
</dependency>
<!--activiti modeler 5.22 end-->
<!-- 自动布局jar 包-->
<dependency>
<groupId>org.flowable</groupId>
<artifactId>flowable-bpmn-layout</artifactId>
<version>${flowable.version}</version>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>1.5.22</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.1</version> <!--加入版本信息-->
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
<version>2.3.0.1</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.3.0.1</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-core</artifactId>
<version>3.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-spring-web</artifactId>
<version>3.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>5.3.19</version>
</dependency>
<dependency>
<groupId>com.junmp.v2</groupId>
<artifactId>junmp-v2-common</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>1.2.4</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>xpp3</groupId>
<artifactId>xpp3</artifactId>
<version>1.1.4c</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-annotations</artifactId>
<version>3.0.3</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.junmp.v2</groupId>
<artifactId>system-api</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-spring-webmvc</artifactId>
<version>3.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.junmp.jyzb</groupId>
<artifactId>jyzb-biz</artifactId>
</dependency>
<dependency>
<groupId>com.junmp.jyzb</groupId>
<artifactId>jyzb-biz</artifactId>
</dependency>
<dependency>
<groupId>com.junmp.jyzb</groupId>
<artifactId>jyzb-biz</artifactId>
</dependency>
<!-- <dependency>-->
<!-- <groupId>io.springfox</groupId>-->
<!-- <artifactId>springfox-swagger-ui</artifactId>-->
<!-- <version>2.9.2</version>-->
<!-- </dependency>-->
</dependencies>
<!-- <name>jyzb-process</name>-->
<!-- <build>-->
<!-- <finalName>jyzb-process</finalName>-->
<!-- <plugins>-->
<!-- <plugin>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-maven-plugin</artifactId>-->
<!-- <executions>-->
<!-- <execution>-->
<!-- <goals>-->
<!-- <goal>repackage</goal>-->
<!-- </goals>-->
<!-- </execution>-->
<!-- </executions>-->
<!-- <configuration>-->
<!-- &lt;!&ndash; 如果没有该项配置,则devtools不会起作用,即应用不会restart &ndash;&gt;-->
<!-- <mainClass>com.junmp.jyzb.boot.JyzbBootApplication</mainClass>-->
<!-- <fork>true</fork>-->
<!-- </configuration>-->
<!-- </plugin>-->
<!-- </plugins>-->
<!-- </build>-->
</project>
package com.junmp.junmpProcess.common;
/**
*
*/
public interface CommonConstants {
/** {@code 500 Server Error} (HTTP/1.0 - RFC 1945) */
Integer SC_INTERNAL_SERVER_ERROR_500 = 500;
/** {@code 200 OK} (HTTP/1.0 - RFC 1945) */
Integer SC_OK_200 = 200;
String FORM_VAR="formData";
String PROCESS_STATUS="processStatus";
String START_USER_INFO="startUser";
String BUSINESS_STATUS_1="1"; //正在处理
String BUSINESS_STATUS_2="2";//撤销
String BUSINESS_STATUS_3="3";//驳回
String BUSINESS_STATUS_4="4";//已结束
}
package com.junmp.junmpProcess.common;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
/**
* @author : willian fu
* @version : 1.0
*/
public class R {
public static Object badRequest(Object msg) {
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(msg);
}
public static Object notFound(Object msg) {
return ResponseEntity.status(HttpStatus.NOT_FOUND).body(msg);
}
public static Object serverError(Object msg) {
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(msg);
}
public static Object noContent(Object msg) {
return ResponseEntity.status(HttpStatus.NO_CONTENT).body(msg);
}
public static Object ok(Object msg) {
return ResponseEntity.ok(msg);
}
public static Object created(Object msg) {
return ResponseEntity.status(HttpStatus.CREATED).body(msg);
}
}
package com.junmp.junmpProcess.common;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
@Transactional
public class RabbitMqProducer {
// @Autowired
// RabbitTemplate rabbitTemplate;
}
package com.junmp.junmpProcess.common;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
@Data
@ApiModel(value = "接口返回对象", description = "接口返回对象")
public class Result<T> implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 成功标志
*/
@ApiModelProperty(value = "成功标志")
private boolean success = true;
/**
* 返回处理消息
*/
@ApiModelProperty(value = "返回处理消息")
private String message = "操作成功!";
/**
* 返回代码
*/
@ApiModelProperty(value = "返回代码")
private Integer code = 0;
/**
* 返回数据对象 data
*/
@ApiModelProperty(value = "返回数据对象")
private T result;
/**
* 返回数据对象 data
*/
@ApiModelProperty(value = "返回数据对象")
private T data;
/**
* 时间戳
*/
@ApiModelProperty(value = "时间戳")
private long timestamp = System.currentTimeMillis();
public Result() {
}
public Result<T> success(String message) {
this.message = message;
this.code = CommonConstants.SC_OK_200;
this.success = true;
return this;
}
@Deprecated
public static Result<Object> ok() {
Result<Object> r = new Result<Object>();
r.setSuccess(true);
r.setCode(CommonConstants.SC_OK_200);
r.setMessage("成功");
return r;
}
@Deprecated
public static Result<Object> ok(String msg) {
Result<Object> r = new Result<Object>();
r.setSuccess(true);
r.setCode(CommonConstants.SC_OK_200);
r.setMessage(msg);
return r;
}
@Deprecated
public static Result<Object> ok(Object data) {
Result<Object> r = new Result<Object>();
r.setSuccess(true);
r.setCode(CommonConstants.SC_OK_200);
r.setResult(data);
return r;
}
public static <T> Result<T> OK() {
Result<T> r = new Result<T>();
r.setSuccess(true);
r.setCode(CommonConstants.SC_OK_200);
r.setMessage("成功");
return r;
}
public static <T> Result<T> OK(T data) {
Result<T> r = new Result<T>();
r.setSuccess(true);
r.setCode(CommonConstants.SC_OK_200);
r.setResult(data);
return r;
}
public static <T> Result<T> OK_data(T data) {
Result<T> r = new Result<T>();
r.setSuccess(true);
r.setCode(CommonConstants.SC_OK_200);
// r.setResult(data);
r.setData(data);
return r;
}
public static <T> Result<T> OK(String msg, T data) {
Result<T> r = new Result<T>();
r.setSuccess(true);
r.setCode(CommonConstants.SC_OK_200);
r.setMessage(msg);
r.setResult(data);
return r;
}
public static Result<Object> error(String msg) {
return error(CommonConstants.SC_INTERNAL_SERVER_ERROR_500, msg);
}
public static Result<Object> error(int code, String msg) {
Result<Object> r = new Result<Object>();
r.setCode(code);
r.setMessage(msg);
r.setSuccess(false);
return r;
}
public Result<T> error500(String message) {
this.message = message;
this.code = CommonConstants.SC_INTERNAL_SERVER_ERROR_500;
this.success = false;
return this;
}
@JsonIgnore
private String onlTable;
}
package com.junmp.junmpProcess.common;
/**
* @author LoveMyOrange
* @create 2022-10-10 17:40
*/
public interface WorkFlowConstants {
String PROCESS_PREFIX = "Flowable";
String START_EVENT_ID = "startEventNode";
String END_EVENT_ID = "endEventNode";
String EXPRESSION_CLASS = "exUtils.";
}
package com.junmp.junmpProcess.config;
import org.flowable.engine.ProcessEngineConfiguration;
import org.flowable.engine.cfg.HttpClientConfig;
import org.flowable.engine.impl.cfg.DelegateExpressionFieldInjectionMode;
import org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl;
import org.flowable.job.service.JobHandler;
import org.flowable.spring.SpringProcessEngineConfiguration;
import com.junmp.junmpProcess.job.CustomJobHandler;
import com.junmp.junmpProcess.job.IdWorkerIdGenerator;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.core.task.TaskExecutor;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.transaction.PlatformTransactionManager;
import javax.annotation.Resource;
import javax.sql.DataSource;
import java.util.ArrayList;
import java.util.List;
/**
* @author
* @date
* @desc
*/
@Configuration
public class ActivitiConfig {
@Resource
private DataSource dataSource;
@Resource
private PlatformTransactionManager transactionManager;
@Resource
private IdWorkerIdGenerator idWorkerIdGenerator;
@Bean
public SpringProcessEngineConfiguration getSpringProcessEngineConfiguration() {
SpringProcessEngineConfiguration config = new SpringProcessEngineConfiguration();
config.setActivityFontName("宋体");
config.setAnnotationFontName("宋体");
config.setLabelFontName("黑体");
config.setDataSource(dataSource);
config.setTransactionManager(transactionManager);
config.setDisableIdmEngine(true);
config.setDatabaseType(ProcessEngineConfigurationImpl.DATABASE_TYPE_MYSQL);
config.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_FALSE);
config.setDelegateExpressionFieldInjectionMode(DelegateExpressionFieldInjectionMode.MIXED);
config.setIdGenerator(idWorkerIdGenerator);
config.setAsyncExecutorActivate(Boolean.TRUE);
HttpClientConfig httpClientConfig = new HttpClientConfig();
//连接超时
httpClientConfig.setConnectTimeout(10000);
//连接请求超时
httpClientConfig.setConnectionRequestTimeout(10000);
//双端建立socket连接
httpClientConfig.setSocketTimeout(10000);
//请求失败之后重试次数
httpClientConfig.setRequestRetryLimit(3);
config.setHttpClientConfig(httpClientConfig);
config.setKnowledgeBaseCacheLimit(200);
config.setProcessDefinitionCacheLimit(200);
// List<JobHandler> customJobHandlers = new ArrayList<>();
// customJobHandlers.add(new CustomJobHandler());
// config.setCustomJobHandlers(customJobHandlers);
return config;
}
@Bean
@Primary
public TaskExecutor primaryTaskExecutor() {
return new ThreadPoolTaskExecutor();
}
}
package com.junmp.junmpProcess.config;
import com.junmp.junmpProcess.listener.GlobalEndListener;
import org.flowable.common.engine.api.delegate.event.FlowableEngineEventType;
import org.flowable.common.engine.api.delegate.event.FlowableEventDispatcher;
import org.flowable.spring.SpringProcessEngineConfiguration;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.event.ContextRefreshedEvent;
@Configuration
public class FlowableGlobListenerConfig implements ApplicationListener<ContextRefreshedEvent> {
@Autowired
private SpringProcessEngineConfiguration configuration;
@Autowired
private GlobalEndListener endListener;
@Override
public void onApplicationEvent(ContextRefreshedEvent event) {
FlowableEventDispatcher dispatcher = configuration.getEventDispatcher();
//任务创建全局监听
// dispatcher.addEventListener(endListener, FlowableEngineEventType.TASK_COMPLETED);
// dispatcher.addEventListener(endListener, FlowableEngineEventType.TASK_CREATED);
dispatcher.addEventListener(endListener, FlowableEngineEventType.PROCESS_COMPLETED);
}
}
package com.junmp.junmpProcess.config;
import com.junmp.junmpProcess.utils.IdWorker;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* @author LoveMyOrange
* @create 2021-09-21 14:59
*/
@Configuration
public class IdWorkerConfig {
@Bean
public IdWorker idWorker() {
return new IdWorker();
}
}
package com.junmp.junmpProcess.config.minio;//package org.jeecg.junmpProcess.config.minio;
//
//import org.springframework.boot.context.properties.ConfigurationProperties;
//
///**
// */
//@ConfigurationProperties(prefix = "config.minio")
//public class MinioConfigurationProperties {
// /**
// * 服务端地址
// */
// private String endpoint;
// /**
// * 账号
// */
// private String accessKey;
// /**
// * 密码
// */
// private String secretKey;
// /**
// * 地址
// */
// private String fileHost;
// public String getEndpoint() {
// return endpoint;
// }
//
// public void setEndpoint(String endpoint) {
// this.endpoint = endpoint;
// }
//
// public String getAccessKey() {
// return accessKey;
// }
//
// public void setAccessKey(String accessKey) {
// this.accessKey = accessKey;
// }
//
// public String getSecretKey() {
// return secretKey;
// }
//
// public void setSecretKey(String secretKey) {
// this.secretKey = secretKey;
// }
//
// public String getFileHost() {
// return fileHost;
// }
//
// public void setFileHost(String fileHost) {
// this.fileHost = fileHost;
// }
//}
package com.junmp.junmpProcess.config.minio;//package org.jeecg.junmpProcess.config.minio;
//
//import io.minio.MinioClient;
//import org.apache.commons.lang3.StringUtils;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.support.DefaultListableBeanFactory;
//import org.springframework.boot.context.properties.EnableConfigurationProperties;
//import org.springframework.context.annotation.Bean;
//import org.springframework.stereotype.Component;
//
///**
// * Minio客户端
// */
//@EnableConfigurationProperties(MinioConfigurationProperties.class)
//@Component
//public class MyMinioClient {
// @Autowired
// private MinioConfigurationProperties minioConfigurationProperties;
// @Autowired
// private DefaultListableBeanFactory defaultListableBeanFactory;
//
// @Bean
// public void minioClient(){
//// MinioClient minioClient = null;
//// if (StringUtils.isNotEmpty(minioConfigurationProperties.getAccessKey())){
//// minioClient = MinioClient.builder().endpoint(minioConfigurationProperties.getEndpoint()).credentials(minioConfigurationProperties.getAccessKey(),minioConfigurationProperties.getSecretKey()).build();
//// //将OSS对象手动注入到容器中
//// defaultListableBeanFactory.registerSingleton("minioClient",minioClient);
//// }else {
//// minioClient = MinioClient.builder().endpoint("yourEndpoint").credentials("yourAccessKey","yourSecretKey").build();
//// defaultListableBeanFactory.registerSingleton("minioClient",minioClient);
//// }
// }
//
//}
package com.junmp.junmpProcess.controller;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.map.MapUtil;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.junmp.junmpProcess.common.R;
import com.junmp.junmpProcess.common.Result;
import com.junmp.junmpProcess.dto.ApplyDTO;
import com.junmp.junmpProcess.dto.HandleDataDTO;
import com.junmp.junmpProcess.dto.StartProcessInstanceDTO;
import com.junmp.junmpProcess.dto.TaskDTO;
import com.junmp.junmpProcess.dto.json.JunmpUserInfo;
import com.junmp.junmpProcess.dto.json.UserInfo;
import com.junmp.junmpProcess.entity.ProcessTemplates;
import com.junmp.junmpProcess.exception.WorkFlowException;
import com.junmp.junmpProcess.service.Repository.ProcessTemplateService;
import com.junmp.junmpProcess.utils.BpmnConvert;
import com.junmp.junmpProcess.vo.*;
import com.junmp.jyzb.utils.HttpStatus;
import com.junmp.jyzb.utils.ResponseResult;
import com.junmp.jyzb.utils.ReturnMsg;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import com.junmp.junmpProcess.service.Bussiness.WorkProcessService;
import org.flowable.bpmn.model.BpmnModel;
import org.flowable.bpmn.model.FlowElement;
import org.flowable.common.engine.impl.identity.Authentication;
import org.flowable.engine.*;
import org.flowable.engine.repository.Deployment;
import org.flowable.engine.repository.ProcessDefinition;
import org.flowable.engine.runtime.ActivityInstance;
import org.flowable.engine.runtime.ProcessInstance;
import org.flowable.engine.runtime.ProcessInstanceBuilder;
import org.flowable.task.api.DelegationState;
import org.flowable.task.api.Task;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.sql.DataSource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Slf4j
@RestController
@RequestMapping("/Process")
@Api(tags = "流程表单方法")
public class BpmnController {
@Autowired
private ProcessTemplateService processTemplateService;
@Autowired
private WorkProcessService WorkProcessService;
@ApiOperation("创建流程和表单")
@PostMapping(value = "create")
public ResponseResult create(@RequestBody ProcessVO processVO) throws JsonProcessingException {
return WorkProcessService.createBpmn(processVO);
}
/**
* 编辑表单
*/
@ApiOperation("修改表单")
@PutMapping("updateForm")
public ResponseResult updateForm(@RequestBody UpdateProcessVO process) throws JsonProcessingException {
return WorkProcessService.updateForm(process);
}
/**
* 编辑表单
*/
@ApiOperation("轉交")
@PutMapping("turn")
public ResponseResult turn(@RequestBody TurnVo turns) {
return WorkProcessService.turn(turns);
}
@ApiOperation("通过流程定义id启动流程")
@PostMapping("start")
public ResponseResult start(@RequestBody StartProcessInstanceDTO startProcessInstanceDTO) {
return WorkProcessService.start(startProcessInstanceDTO);
}
@ApiOperation("查看我发起的流程")
@PostMapping("applyList")
public ResponseResult applyList(@RequestBody ApplyDTO ApplyDTO) {
return WorkProcessService.applyList(ApplyDTO);
}
@ApiOperation("查看我的待办")
@PostMapping("toDoList")
public ResponseResult toDoList(@RequestBody TaskDTO taskDTO){
return WorkProcessService.toDoList(taskDTO);
}
@ApiOperation("同意按钮")
@PostMapping("agree")
public ResponseResult agree(@RequestBody HandleDataDTO handleDataDTO){
return WorkProcessService.agree(handleDataDTO);
}
@ApiOperation("拒绝按钮")
@PostMapping("refuse")
public ResponseResult refuse(@RequestBody HandleDataDTO handleDataDTO){
return WorkProcessService.refuse(handleDataDTO);
}
/**
* 查询表单模板数据
*
* @param templateId 模板id
* @return 模板详情数据
*/
@ApiOperation("根据ID获取表单信息")
@PostMapping(value = "getFormTemplateById")
public ResponseResult getFormTemplateById(String templateId) {
ProcessTemplates processTemplates = processTemplateService.getById(templateId);
processTemplates.setFormId(processTemplates.getTemplateId());
return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS,processTemplates);
}
/**
* 查询表单模板数据
*
* @return 模板详情数据
*/
@ApiOperation("获取全部可用的表单和审核流")
@GetMapping(value = "getFormList")
public ResponseResult getFormList( ) {
return WorkProcessService.getFormList();
}
/**
* 查询表单模板数据
*
* @param templateId 模板id
* @return 模板详情数据
*/
@ApiOperation("通过模板id查看流程信息")
@GetMapping("getFormDetail")
public ResponseResult getFormDetail(@RequestParam("templateId") String templateId){
return WorkProcessService.getFormDetail(templateId);
}
}
//package com.junmp.junmpProcess.controller;
//
//import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
//import com.junmp.jyzb.utils.ResponseResult;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import lombok.extern.slf4j.Slf4j;
//import com.junmp.junmpProcess.common.Result;
//import com.junmp.junmpProcess.dto.ApplyDTO;
//import com.junmp.junmpProcess.dto.HandleDataDTO;
//import com.junmp.junmpProcess.dto.StartProcessInstanceDTO;
//import com.junmp.junmpProcess.dto.TaskDTO;
//import com.junmp.junmpProcess.entity.ProcessTemplates;
//import com.junmp.junmpProcess.service.Bussiness.WorkProcessService;
//import com.junmp.junmpProcess.vo.HandleDataVO;
//import com.junmp.junmpProcess.vo.HistoryProcessInstanceVO;
//import com.junmp.junmpProcess.vo.MultiVO;
//import com.junmp.junmpProcess.vo.TaskVO;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.*;
//
//import java.util.List;
//import java.util.Map;
//
//@Slf4j
//@RestController
//@RequestMapping("/MainProcess")
//@Api(tags = "和Flowable有关的接口")
//public class MainProcessController {
//
// @Autowired
// private WorkProcessService ProcessService;
//
//
// @ApiOperation(value = "通过模板id查看流程信息 会附带流程定义id", notes = "获取所有Demo数据列表")
// @GetMapping(value = "process/detail")
// public Result<ProcessTemplates> detail(@RequestParam("templateId") String templateId) {
// return ProcessService.detail(templateId);
// }
//
// @ApiOperation("新建流程")
// @PostMapping("process/create")
// public Result<Object> create(@RequestBody StartProcessInstanceDTO startProcessInstanceDTO) {
// return ProcessService.start(startProcessInstanceDTO);
// }
//
// @ApiOperation("通过流程定义id启动流程")
// @PostMapping("process/start")
// public Result<Object> start(@RequestBody StartProcessInstanceDTO startProcessInstanceDTO) {
// return ProcessService.start(startProcessInstanceDTO);
// }
//
// @ApiOperation("查看我发起的流程")
// @PostMapping("process/applyList")
// public Result<Page<HistoryProcessInstanceVO>> applyList(@RequestBody ApplyDTO applyDTO) {
// return ProcessService.applyList(applyDTO);
// }
//
// @ApiOperation("查看我的待办")
// @PostMapping("process/toDoList")
// public Result<Page<TaskVO>> toDoList(@RequestBody TaskDTO taskDTO) {
// return ProcessService.toDoList(taskDTO);
// }
//
// @ApiOperation("查看我的已办")
// @PostMapping("process/doneList")
// public Result<Page<TaskVO>> doneList(@RequestBody TaskDTO taskDTO) {
// return ProcessService.doneList(taskDTO);
// }
//
// @ApiOperation("同意按钮")
// @PostMapping("/agree")
// public Result agree(@RequestBody HandleDataDTO handleDataDTO) {
// return ProcessService.agree(handleDataDTO);
// }
//
// @ApiOperation("委派按钮")
// @PostMapping("/delegateTask")
// public Result delegateTask(@RequestBody HandleDataDTO handleDataDTO) {
// return ProcessService.delegateTask(handleDataDTO);
//
// }
//
// @ApiOperation("委派人完成的按钮")
// @PostMapping("/resolveTask")
// public Result resolveTask(@RequestBody HandleDataDTO handleDataDTO) {
// return ProcessService.resolveTask(handleDataDTO);
// }
//
//
// @ApiOperation("拒绝按钮")
// @PostMapping("/refuse")
// public ResponseResult refuse(@RequestBody HandleDataDTO handleDataDTO) {
// return ProcessService.refuse(handleDataDTO);
// }
//
// @ApiOperation("撤销按钮")
// @PostMapping("/revoke")
// public Result revoke(@RequestBody HandleDataDTO handleDataDTO) {
// return ProcessService.revoke(handleDataDTO);
// }
//
//
// @ApiOperation("转办按钮")
// @PostMapping("/assignee")
// public Result assignee(@RequestBody HandleDataDTO handleDataDTO) {
// return ProcessService.assignee(handleDataDTO);
// }
//
//
// @ApiOperation("退回按钮")
// @PostMapping("/rollback")
// public Result rollback(@RequestBody HandleDataDTO handleDataDTO) {
// return ProcessService.rollback(handleDataDTO);
// }
//
//
// @ApiOperation("加签按钮")
// @PostMapping("/addMulti")
// public Result addMulti(@RequestBody HandleDataDTO handleDataDTO) {
// return ProcessService.addMulti(handleDataDTO);
// }
//
//
// @ApiOperation("查到签上的人")
// @PostMapping("/queryMultiUsersInfo")
// public Result<List<MultiVO>> queryMultiUsersInfo(@RequestBody Map<String, Object> map) {
// return ProcessService.queryMultiUsersInfo(map);
// }
//
// @ApiOperation("减签按钮")
// @PostMapping("/deleteMulti")
// public Result deleteMulti(@RequestBody List<String> executionIds) {
// return ProcessService.deleteMulti(executionIds);
// }
//
//
// @ApiOperation("评论按钮")
// @PostMapping("/comments")
// public Result comments(@RequestBody HandleDataDTO handleDataDTO) {
// return ProcessService.comments(handleDataDTO);
// }
//
// @ApiOperation("通过流程实例id查看详情")
// @PostMapping("process/instanceInfo")
// public Result<HandleDataVO> instanceInfo(@RequestBody HandleDataDTO HandleDataDTO) {
// return ProcessService.instanceInfo(HandleDataDTO);
// }
//// @ApiOperation("上传文件")
//// @PostMapping("upLoadFile")
//// public Result<AttachmentVO> upLoadFile(@RequestParam("file") MultipartFile file, HttpServletRequest request){
//// return ProcessService.upLoadFile(file,request);
//// }
//// @ApiOperation("下载文件")
//// @PostMapping("downLoadFile")
//// public void downLoadFile(@RequestParam("name") String name){
//// ProcessService.downLoadFile(name);
//// }
//}
//
package com.junmp.junmpProcess.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import com.junmp.junmpProcess.service.Bussiness.OrgUserAndDeptService;
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;
/**
* @author : willian fu
* @version : 1.0
*/
@RestController
@RequestMapping("/OrgUserAndDept")
@Api(tags = "和用户组织机构有关的接口")
public class OrgUserAndDeptController {
@Resource
private OrgUserAndDeptService orgService;
/**
* 查询组织架构树
*
* @param deptId 部门id
* @return 组织架构树数据
*/
@ApiOperation("查询组织架构树")
@GetMapping("tree")
// @PermissionData(pageComponent = "jeecg/JeecgDemoList")
public Object getOrgTreeData(@RequestParam(defaultValue = "0") Integer deptId,
@RequestParam(defaultValue = "user") String type
) {
return orgService.getOrgTreeData(deptId, type);
}
/**
* 模糊搜索用户
*
* @param userName 用户名/拼音/首字母
* @return 匹配到的用户
*/
@ApiOperation("模糊搜索用户")
@GetMapping("tree/search")
public Object getOrgTreeUser(@RequestParam String userName) {
return orgService.getOrgTreeUser(userName.trim());
}
}
//package com.junmp.junmpProcess.controller;
//
//import io.swagger.annotations.Api;
//import lombok.extern.slf4j.Slf4j;
//import com.junmp.junmpProcess.common.R;
//import com.junmp.junmpProcess.dto.FlowEngineDTO;
//import com.junmp.junmpProcess.entity.ProcessTemplates;
//import com.junmp.junmpProcess.service.Bussiness.SettingService;
//import com.junmp.junmpProcess.vo.TemplateGroupVo;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.*;
//
//import java.lang.reflect.InvocationTargetException;
//import java.util.List;
//
///**
// * @author : willian fu
// * @date : 2020/9/17
// */
//@Slf4j
//@RestController
//@RequestMapping("/Setting")
//@Api(tags = "和表单有关的接口")
//
//
//public class SettingController {
//
// @Autowired
// private SettingService settingService;
//
// /**
// * 1>
// *
// * @param flowEngineDTO
// * @return
// * @throws InvocationTargetException
// * @throws IllegalAccessException
// */
// @PostMapping("/form")
// public Object saveForm(@RequestBody FlowEngineDTO flowEngineDTO) throws InvocationTargetException, IllegalAccessException {
// settingService.jsonToBpmn(flowEngineDTO);
// return R.ok("保存成功");
// }
//
// /**
// * 查询所有表单分组
// *
// * @return
// */
// @GetMapping("form/group")
// public Object getFormGroups() {
// return settingService.getFormGroups(null, null);
// }
//
// /**
// * 表单分组排序
// *
// * @param groups 分组数据
// * @return 排序结果
// */
// @PutMapping("form/group/sort")
// public Object formGroupsSort(@RequestBody List<TemplateGroupVo> groups) {
// return settingService.formGroupsSort(groups);
// }
//
// /**
// * 修改分组
// *
// * @param id 分组ID
// * @param name 分组名
// * @return 修改结果
// */
// @PutMapping("form/group")
// public Object updateFormGroupName(@RequestParam Integer id,
// @RequestParam String name) {
// return settingService.updateFormGroupName(id, name);
// }
//
// /**
// * 新增表单分组
// *
// * @param name 分组名
// * @return 添加结果
// */
// @PostMapping("form/group")
// public Object createFormGroup(@RequestParam String name) {
// return settingService.createFormGroup(name);
// }
//
// /**
// * 删除分组
// *
// * @param id 分组ID
// * @return 删除结果
// */
// @DeleteMapping("form/group")
// public Object deleteFormGroup(@RequestParam Integer id) {
// return settingService.deleteFormGroup(id);
// }
//
// /**
// * 查询表单模板数据
// *
// * @param templateId 模板id
// * @return 模板详情数据
// */
// @GetMapping("form/detail/{formId}")
// public Object getFormTemplateById(@PathVariable("formId") String templateId) {
// return settingService.getFormTemplateById(templateId);
// }
//
// /**
// * 编辑表单
// *
// * @param templateId 摸板ID
// * @param type 类型 stop using delete
// * @return 操作结果
// */
// @PutMapping("form")
// public Object updateForm(@RequestParam String templateId,
// @RequestParam String type,
// @RequestParam(required = false) Integer groupId) {
// return settingService.updateForm(templateId, type, groupId);
// }
//
// /**
// * 编辑表单详情
// *
// * @param template 表单模板信息
// * @return 修改结果
// */
// @PutMapping("form/detail")
// public Object updateFormDetail(@RequestBody ProcessTemplates template) {
// return settingService.updateFormDetail(template);
// }
//}
//package com.junmp.junmpProcess.controller;
//
//import cn.hutool.core.collection.CollUtil;
//import cn.hutool.core.map.MapUtil;
//import com.alibaba.fastjson.JSONObject;
//import com.alibaba.fastjson.TypeReference;
//import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
//import com.fasterxml.jackson.databind.ObjectMapper;
//import com.fasterxml.jackson.databind.node.ObjectNode;
//import com.junmp.junmpProcess.dto.*;
//import com.junmp.junmpProcess.dto.json.*;
//import com.junmp.junmpProcess.exception.WorkFlowException;
//import com.junmp.junmpProcess.vo.*;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import org.apache.commons.lang3.StringUtils;
//import org.flowable.bpmn.model.BpmnModel;
//import org.flowable.bpmn.model.FlowElement;
//import org.flowable.bpmn.model.Process;
//import org.flowable.common.engine.impl.identity.Authentication;
//import org.flowable.engine.HistoryService;
//import org.flowable.engine.RepositoryService;
//import org.flowable.engine.RuntimeService;
//import org.flowable.engine.TaskService;
//import org.flowable.engine.history.HistoricActivityInstance;
//import org.flowable.engine.history.HistoricProcessInstance;
//import org.flowable.engine.impl.persistence.entity.ExecutionEntity;
//import org.flowable.engine.repository.Model;
//import org.flowable.engine.repository.ProcessDefinition;
//import org.flowable.engine.runtime.Execution;
//import org.flowable.engine.runtime.ProcessInstance;
//import org.flowable.engine.runtime.ProcessInstanceBuilder;
//import org.flowable.engine.task.Attachment;
//import org.flowable.engine.task.Comment;
//import org.flowable.task.api.DelegationState;
//import org.flowable.task.api.Task;
//import org.flowable.task.api.history.HistoricTaskInstance;
//import com.junmp.junmpProcess.common.Result;
//import com.junmp.junmpProcess.entity.ProcessTemplates;
//import com.junmp.junmpProcess.service.Repository.ProcessTemplateService;
//import com.junmp.junmpProcess.service.Repository.UserService;
//import org.springframework.web.bind.annotation.*;
//
//import javax.annotation.Resource;
//import java.io.UnsupportedEncodingException;
//import java.util.*;
//import java.util.stream.Collectors;
//
//import static com.junmp.junmpProcess.common.CommonConstants.*;
//import static com.junmp.junmpProcess.common.WorkFlowConstants.PROCESS_PREFIX;
//import static com.junmp.junmpProcess.utils.BpmnModelUtils.getChildNode;
//
///**
// * @author : willian fu
// * @version : 1.0
// */
//@RestController
//@RequestMapping("/workspace")
//@Api(tags = "原版flowable")
//public class WorkspaceProcessController {
//
// @Resource
// private ProcessTemplateService processTemplateService;
// @Resource
// private RepositoryService repositoryService;
// @Resource
// private RuntimeService runtimeService;
// @Resource
// private HistoryService historyService;
// @Resource
// private TaskService taskService;
// @Resource
// private UserService userService;
//
// @ApiOperation("通过模板id查看流程信息 会附带流程定义id")
// @GetMapping("process/detail")
// public Result<ProcessTemplates> detail(@RequestParam("templateId") String templateId) {
// ProcessTemplates processTemplates = processTemplateService.getById(templateId);
// processTemplates.setLogo(processTemplates.getIcon());
// processTemplates.setFormId(processTemplates.getTemplateId());
// processTemplates.setFormName(processTemplates.getTemplateName());
// ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionKey(PROCESS_PREFIX + templateId).latestVersion().singleResult();
// if (processDefinition == null) {
// throw new WorkFlowException("该流程暂未接入Flowable,请重试");
// }
// processTemplates.setProcessDefinitionId(processDefinition.getId());
// return Result.OK(processTemplates);
// }
//
// @ApiOperation("通过流程定义id启动流程")
// @PostMapping("process/start")
// public Result<Object> start(@RequestBody StartProcessInstanceDTO startProcessInstanceDTO) {
// try {
// JSONObject formData = startProcessInstanceDTO.getFormData();
// JunmpUserInfo startUserInfo = startProcessInstanceDTO.getStartUserInfo();
// Authentication.setAuthenticatedUserId(startUserInfo.getUserId());
// Map<String, Object> processVariables = new HashMap<>();
// processVariables.put(FORM_VAR, formData);
// processVariables.put(PROCESS_STATUS, BUSINESS_STATUS_1);
// processVariables.put(START_USER_INFO, JSONObject.toJSONString(startUserInfo));
// ArrayList<JunmpUserInfo> userInfos = CollUtil.newArrayList(startUserInfo);
// processVariables.put("root", JSONObject.toJSONString(userInfos));
// Map formValue = JSONObject.parseObject(formData.toJSONString(), new TypeReference<Map>() {
// });
// processVariables.putAll(formValue);
// ProcessInstanceBuilder processInstanceBuilder = runtimeService.createProcessInstanceBuilder();
// ProcessInstance processInstance = processInstanceBuilder
// .processDefinitionId(startProcessInstanceDTO.getProcessDefinitionId())
// .variables(processVariables)
// .businessStatus(BUSINESS_STATUS_1)
// .start();
// return Result.OK(processInstance.getId());
// } catch (Exception e) {
// Throwable cause = e.getCause();
// if (cause instanceof WorkFlowException) {
// WorkFlowException workFlowException = (WorkFlowException) cause;
// return Result.error(workFlowException.getMessage());
// }
// e.printStackTrace();
// return Result.error("启动流程失败");
// }
// }
//
//
// @ApiOperation("查看我发起的流程")
// @PostMapping("process/applyList")
// public Result<Page<HistoryProcessInstanceVO>> applyList(@RequestBody ApplyDTO applyDTO) {
// List<HistoricProcessInstance> historicProcessInstances =
// historyService.createHistoricProcessInstanceQuery()
// .includeProcessVariables()
// .startedBy(applyDTO.getCurrentUserInfo().getId())
// .orderByProcessInstanceStartTime().desc()
// .listPage((applyDTO.getPageNo() - 1) * applyDTO.getPageSize(), applyDTO.getPageSize());
// long count = historyService.createHistoricProcessInstanceQuery()
// .startedBy(applyDTO.getCurrentUserInfo().getId()).count();
// List<HistoryProcessInstanceVO> historyProcessInstanceVOS = new ArrayList<>();
// Page<HistoryProcessInstanceVO> page = new Page<>();
// for (HistoricProcessInstance historicProcessInstance : historicProcessInstances) {
// Map<String, Object> processVariables = historicProcessInstance.getProcessVariables();
// HistoryProcessInstanceVO historyProcessInstanceVO = new HistoryProcessInstanceVO();
// historyProcessInstanceVO.setProcessInstanceId(historicProcessInstance.getId());
// historyProcessInstanceVO.setProcessDefinitionName(historicProcessInstance.getProcessDefinitionName());
// historyProcessInstanceVO.setStartUser(JSONObject.parseObject(MapUtil.getStr(processVariables, START_USER_INFO), new TypeReference<UserInfo>() {
// }));
// historyProcessInstanceVO.setStartTime(historicProcessInstance.getStartTime());
// historyProcessInstanceVO.setEndTime(historicProcessInstance.getEndTime());
// Boolean flag = historicProcessInstance.getEndTime() == null ? false : true;
// historyProcessInstanceVO.setCurrentActivityName(getCurrentName(historicProcessInstance.getId(), flag, historicProcessInstance.getProcessDefinitionId()));
// historyProcessInstanceVO.setBusinessStatus(MapUtil.getStr(processVariables, PROCESS_STATUS));
//
//
// long totalTimes = historicProcessInstance.getEndTime() == null ?
// (Calendar.getInstance().getTimeInMillis() - historicProcessInstance.getStartTime().getTime()) :
// (historicProcessInstance.getEndTime().getTime() - historicProcessInstance.getStartTime().getTime());
// long dayCount = totalTimes / (1000 * 60 * 60 * 24);//计算天
// long restTimes = totalTimes % (1000 * 60 * 60 * 24);//剩下的时间用于计于小时
// long hourCount = restTimes / (1000 * 60 * 60);//小时
// restTimes = restTimes % (1000 * 60 * 60);
// long minuteCount = restTimes / (1000 * 60);
//
// String spendTimes = dayCount + "天" + hourCount + "小时" + minuteCount + "分";
// historyProcessInstanceVO.setDuration(spendTimes);
// historyProcessInstanceVOS.add(historyProcessInstanceVO);
// }
// page.setRecords(historyProcessInstanceVOS);
// page.setCurrent(applyDTO.getPageNo());
// page.setSize(applyDTO.getPageSize());
// page.setTotal(count);
// return Result.OK(page);
// }
//
//
// private String getCurrentName(String processInstanceId, Boolean flag, String processDefinitionId) {
// if (flag) {
// return "流程已结束";
// }
// Execution execution = runtimeService.createExecutionQuery().executionId(processInstanceId).singleResult();
// String activityId = execution.getActivityId();
// if (StringUtils.isBlank(activityId)) {
// return "";
// } else {
// BpmnModel bpmnModel = repositoryService.getBpmnModel(processDefinitionId);
// FlowElement flowElement = bpmnModel.getMainProcess().getFlowElement(activityId);
// return flowElement.getName();
// }
//
// }
//
// @ApiOperation("查看我的待办")
// @PostMapping("process/toDoList")
// public Result<Page<TaskVO>> toDoList(@RequestBody TaskDTO taskDTO) {
// List<Task> tasks = taskService.createTaskQuery().taskAssignee(taskDTO.getCurrentUserInfo().getId())
// .includeProcessVariables()
// .orderByTaskCreateTime().desc()
// .listPage((taskDTO.getPageNo() - 1) * taskDTO.getPageSize(), taskDTO.getPageSize());
// long count = taskService.createTaskQuery().taskAssignee(taskDTO.getCurrentUserInfo().getId()).count();
// List<TaskVO> taskVOS = new ArrayList<>();
// Page<TaskVO> page = new Page<>();
// for (Task task : tasks) {
// HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery().processInstanceId(task.getProcessInstanceId()).singleResult();
// BpmnModel bpmnModel = repositoryService.getBpmnModel(task.getProcessDefinitionId());
// Map<String, Object> processVariables = task.getProcessVariables();
// TaskVO taskVO = new TaskVO();
// taskVO.setTaskId(task.getId());
// taskVO.setProcessInstanceId(task.getProcessInstanceId());
// taskVO.setProcessDefinitionName(bpmnModel.getMainProcess().getName());
// taskVO.setStartUser(JSONObject.parseObject(MapUtil.getStr(processVariables, START_USER_INFO), new TypeReference<UserInfo>() {
// }));
// taskVO.setStartTime(historicProcessInstance.getStartTime());
// Execution execution = runtimeService.createExecutionQuery().executionId(task.getProcessInstanceId()).singleResult();
// String activityId = execution.getActivityId();
// if (StringUtils.isBlank(activityId)) {
// taskVO.setCurrentActivityName("");
// } else {
// FlowElement flowElement = bpmnModel.getMainProcess().getFlowElement(activityId);
// taskVO.setCurrentActivityName(flowElement.getName());
// }
//
// taskVO.setBusinessStatus(MapUtil.getStr(processVariables, PROCESS_STATUS));
// taskVO.setTaskCreatedTime(task.getCreateTime());
// DelegationState delegationState = task.getDelegationState();
// if (delegationState != null) {
// taskVO.setDelegationState(delegationState);
// }
// taskVOS.add(taskVO);
//
// }
// page.setRecords(taskVOS);
// page.setCurrent(taskDTO.getPageNo());
// page.setSize(taskDTO.getPageSize());
// page.setTotal(count);
// return Result.OK(page);
// }
//
// @ApiOperation("查看我的已办")
// @PostMapping("process/doneList")
// public Result<Page<TaskVO>> doneList(@RequestBody TaskDTO taskDTO) {
// List<HistoricTaskInstance> tasks = historyService.createHistoricTaskInstanceQuery()
// .taskAssignee(taskDTO.getCurrentUserInfo().getId())
// .finished()
// .includeProcessVariables()
// .orderByTaskCreateTime().desc()
// .listPage((taskDTO.getPageNo() - 1) * taskDTO.getPageSize(), taskDTO.getPageSize());
// long count = historyService.createHistoricTaskInstanceQuery()
// .taskAssignee(taskDTO.getCurrentUserInfo().getId()).count();
// List<TaskVO> taskVOS = new ArrayList<>();
// Page<TaskVO> page = new Page<>();
// for (HistoricTaskInstance task : tasks) {
// HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery().processInstanceId(task.getProcessInstanceId()).singleResult();
// Boolean flag = historicProcessInstance.getEndTime() == null ? false : true;
// BpmnModel bpmnModel = repositoryService.getBpmnModel(task.getProcessDefinitionId());
// Map<String, Object> processVariables = task.getProcessVariables();
// TaskVO taskVO = new TaskVO();
// taskVO.setTaskId(task.getId());
// taskVO.setProcessInstanceId(task.getProcessInstanceId());
// taskVO.setProcessDefinitionName(bpmnModel.getMainProcess().getName());
// taskVO.setStartUser(JSONObject.parseObject(MapUtil.getStr(processVariables, START_USER_INFO), new TypeReference<UserInfo>() {
// }));
// taskVO.setStartTime(historicProcessInstance.getStartTime());
// taskVO.setCurrentActivityName(getCurrentName(task.getProcessInstanceId(), flag, task.getProcessDefinitionId()));
// taskVO.setBusinessStatus(MapUtil.getStr(processVariables, PROCESS_STATUS));
// taskVO.setEndTime(task.getEndTime());
//
// long totalTimes = task.getEndTime() == null ?
// (Calendar.getInstance().getTimeInMillis() - task.getStartTime().getTime()) :
// (task.getEndTime().getTime() - task.getStartTime().getTime());
// long dayCount = totalTimes / (1000 * 60 * 60 * 24);//计算天
// long restTimes = totalTimes % (1000 * 60 * 60 * 24);//剩下的时间用于计于小时
// long hourCount = restTimes / (1000 * 60 * 60);//小时
// restTimes = restTimes % (1000 * 60 * 60);
// long minuteCount = restTimes / (1000 * 60);
// String spendTimes = dayCount + "天" + hourCount + "小时" + minuteCount + "分";
// taskVO.setDuration(spendTimes);
// taskVOS.add(taskVO);
// }
//
// page.setRecords(taskVOS);
// page.setCurrent(taskDTO.getPageNo());
// page.setSize(taskDTO.getPageSize());
// page.setTotal(count);
// return Result.OK(page);
// }
//
// @ApiOperation("同意按钮")
// @PostMapping("/agree")
// public Result agree(@RequestBody HandleDataDTO handleDataDTO) {
// UserInfo currentUserInfo = handleDataDTO.getCurrentUserInfo();
// List<AttachmentDTO> attachments = handleDataDTO.getAttachments();
// String comments = handleDataDTO.getComments();
// JSONObject formData = handleDataDTO.getFormData();
// String taskId = handleDataDTO.getTaskId();
// Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
// Map<String, Object> map = new HashMap<>();
// if (formData != null && formData.size() > 0) {
// Map formValue = JSONObject.parseObject(formData.toJSONString(), new TypeReference<Map>() {
// });
// map.putAll(formValue);
// map.put(FORM_VAR, formData);
// }
//
// runtimeService.setVariables(task.getProcessInstanceId(), map);//设置进入当前流程
// Authentication.setAuthenticatedUserId(currentUserInfo.getId());
// if (StringUtils.isNotBlank(comments)) {
// taskService.addComment(task.getId(), task.getProcessInstanceId(), "opinion", comments);
// }
// if (attachments != null && attachments.size() > 0) {
// for (AttachmentDTO attachment : attachments) {
// taskService.createAttachment("option", taskId, task.getProcessInstanceId(), attachment.getName(), attachment.getName(), attachment.getUrl());
// }
// }
//
// if (StringUtils.isNotBlank(handleDataDTO.getSignInfo())) {
// taskService.addComment(task.getId(), task.getProcessInstanceId(), "sign", handleDataDTO.getSignInfo());
// }
//
//
// taskService.complete(task.getId());
// return Result.OK();
// }
//
// @ApiOperation("委派按钮")
// @PostMapping("/delegateTask")
// public Result delegateTask(@RequestBody HandleDataDTO handleDataDTO) {
// UserInfo currentUserInfo = handleDataDTO.getCurrentUserInfo();
// List<AttachmentDTO> attachments = handleDataDTO.getAttachments();
// String comments = handleDataDTO.getComments();
// JSONObject formData = handleDataDTO.getFormData();
// String taskId = handleDataDTO.getTaskId();
// Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
// Map<String, Object> map = new HashMap<>();
// if (formData != null && formData.size() > 0) {
// Map formValue = JSONObject.parseObject(formData.toJSONString(), new TypeReference<Map>() {
// });
// map.putAll(formValue);
// map.put(FORM_VAR, formData);
// }
//
// runtimeService.setVariables(task.getProcessInstanceId(), map);
// Authentication.setAuthenticatedUserId(currentUserInfo.getId());
// if (StringUtils.isNotBlank(comments)) {
// taskService.addComment(task.getId(), task.getProcessInstanceId(), "opinion", comments);
// }
// if (attachments != null && attachments.size() > 0) {
// for (AttachmentDTO attachment : attachments) {
// taskService.createAttachment("option", taskId, task.getProcessInstanceId(), attachment.getName(), attachment.getName(), attachment.getUrl());
// }
// }
//
// if (StringUtils.isNotBlank(handleDataDTO.getSignInfo())) {
// taskService.addComment(task.getId(), task.getProcessInstanceId(), "sign", handleDataDTO.getSignInfo());
// }
//
// UserInfo delegateUserInfo = handleDataDTO.getDelegateUserInfo();
// taskService.delegateTask(task.getId(), delegateUserInfo.getId());
// return Result.OK();
// }
//
// @ApiOperation("委派人完成的按钮")
// @PostMapping("/resolveTask")
// public Result resolveTask(@RequestBody HandleDataDTO handleDataDTO) {
// UserInfo currentUserInfo = handleDataDTO.getCurrentUserInfo();
// List<AttachmentDTO> attachments = handleDataDTO.getAttachments();
// String comments = handleDataDTO.getComments();
// JSONObject formData = handleDataDTO.getFormData();
// String taskId = handleDataDTO.getTaskId();
// Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
// Map<String, Object> map = new HashMap<>();
// if (formData != null && formData.size() > 0) {
// Map formValue = JSONObject.parseObject(formData.toJSONString(), new TypeReference<Map>() {
// });
// map.putAll(formValue);
// map.put(FORM_VAR, formData);
// }
//
// runtimeService.setVariables(task.getProcessInstanceId(), map);
// Authentication.setAuthenticatedUserId(currentUserInfo.getId());
// if (StringUtils.isNotBlank(comments)) {
// taskService.addComment(task.getId(), task.getProcessInstanceId(), "opinion", comments);
// }
// if (attachments != null && attachments.size() > 0) {
// for (AttachmentDTO attachment : attachments) {
// taskService.createAttachment("option", taskId, task.getProcessInstanceId(), attachment.getName(), attachment.getName(), attachment.getUrl());
// }
// }
//
// if (StringUtils.isNotBlank(handleDataDTO.getSignInfo())) {
// taskService.addComment(task.getId(), task.getProcessInstanceId(), "sign", handleDataDTO.getSignInfo());
// }
//
// taskService.resolveTask(taskId);
// return Result.OK();
// }
//
//
// @ApiOperation("拒绝按钮")
// @PostMapping("/refuse")
// public Result refuse(@RequestBody HandleDataDTO handleDataDTO) {
// UserInfo currentUserInfo = handleDataDTO.getCurrentUserInfo();
// Authentication.setAuthenticatedUserId(currentUserInfo.getId());
// List<AttachmentDTO> attachments = handleDataDTO.getAttachments();
// String comments = handleDataDTO.getComments();
// JSONObject formData = handleDataDTO.getFormData();
// String taskId = handleDataDTO.getTaskId();
// Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
// Map<String, Object> map = new HashMap<>();
// if (formData != null && formData.size() > 0) {
// Map formValue = JSONObject.parseObject(formData.toJSONString(), new TypeReference<Map>() {
// });
// map.putAll(formValue);
// map.put(FORM_VAR, formData);
// }
// map.put(PROCESS_STATUS, BUSINESS_STATUS_3);
// runtimeService.setVariables(task.getProcessInstanceId(), map);
// if (StringUtils.isNotBlank(comments)) {
// taskService.addComment(task.getId(), task.getProcessInstanceId(), "opinion", comments);
// }
// if (attachments != null && attachments.size() > 0) {
// for (AttachmentDTO attachment : attachments) {
// taskService.createAttachment("option", taskId, task.getProcessInstanceId(), attachment.getName(), attachment.getName(), attachment.getUrl());
// }
// }
//
// if (StringUtils.isNotBlank(handleDataDTO.getSignInfo())) {
// taskService.addComment(task.getId(), task.getProcessInstanceId(), "sign", handleDataDTO.getSignInfo());
// }
// runtimeService.deleteProcessInstance(task.getProcessInstanceId(), "拒绝");
// return Result.OK();
// }
//
// @ApiOperation("撤销按钮")
// @PostMapping("/revoke")
// public Result revoke(@RequestBody HandleDataDTO handleDataDTO) {
// UserInfo currentUserInfo = handleDataDTO.getCurrentUserInfo();
// Authentication.setAuthenticatedUserId(currentUserInfo.getId());
// List<AttachmentDTO> attachments = handleDataDTO.getAttachments();
// String comments = handleDataDTO.getComments();
// JSONObject formData = handleDataDTO.getFormData();
// String taskId = handleDataDTO.getTaskId();
// HistoricTaskInstance task = historyService.createHistoricTaskInstanceQuery().taskId(taskId).singleResult();
// Map<String, Object> map = new HashMap<>();
// if (formData != null && formData.size() > 0) {
// Map formValue = JSONObject.parseObject(formData.toJSONString(), new TypeReference<Map>() {
// });
// map.putAll(formValue);
// map.put(FORM_VAR, formData);
// }
// map.put(PROCESS_STATUS, BUSINESS_STATUS_2);
// runtimeService.setVariables(task.getProcessInstanceId(), map);
// if (StringUtils.isNotBlank(comments)) {
// taskService.addComment(task.getId(), task.getProcessInstanceId(), "opinion", comments);
// }
// if (attachments != null && attachments.size() > 0) {
// for (AttachmentDTO attachment : attachments) {
// taskService.createAttachment("option", taskId, task.getProcessInstanceId(), attachment.getName(), attachment.getName(), attachment.getUrl());
// }
// }
//
// if (StringUtils.isNotBlank(handleDataDTO.getSignInfo())) {
// taskService.addComment(task.getId(), task.getProcessInstanceId(), "sign", handleDataDTO.getSignInfo());
// }
// runtimeService.deleteProcessInstance(task.getProcessInstanceId(), "撤销");
// return Result.OK();
// }
//
//
// @ApiOperation("转办按钮")
// @PostMapping("/assignee")
// public Result assignee(@RequestBody HandleDataDTO handleDataDTO) {
// UserInfo currentUserInfo = handleDataDTO.getCurrentUserInfo();
// Authentication.setAuthenticatedUserId(currentUserInfo.getId());
// List<AttachmentDTO> attachments = handleDataDTO.getAttachments();
// String comments = handleDataDTO.getComments();
// JSONObject formData = handleDataDTO.getFormData();
// String taskId = handleDataDTO.getTaskId();
// Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
// Map<String, Object> map = new HashMap<>();
// if (formData != null && formData.size() > 0) {
// Map formValue = JSONObject.parseObject(formData.toJSONString(), new TypeReference<Map>() {
// });
// map.putAll(formValue);
// map.put(FORM_VAR, formData);
// }
// map.put(PROCESS_STATUS, BUSINESS_STATUS_1);
// runtimeService.setVariables(task.getProcessInstanceId(), map);
// if (StringUtils.isNotBlank(comments)) {
// taskService.addComment(task.getId(), task.getProcessInstanceId(), "opinion", comments);
// }
// if (attachments != null && attachments.size() > 0) {
// for (AttachmentDTO attachment : attachments) {
// taskService.createAttachment("option", taskId, task.getProcessInstanceId(), attachment.getName(), attachment.getName(), attachment.getUrl());
// }
// }
//
// if (StringUtils.isNotBlank(handleDataDTO.getSignInfo())) {
// taskService.addComment(task.getId(), task.getProcessInstanceId(), "sign", handleDataDTO.getSignInfo());
// }
// taskService.setAssignee(taskId, handleDataDTO.getTransferUserInfo().getId());
// return Result.OK();
// }
//
//
// @ApiOperation("退回按钮")
// @PostMapping("/rollback")
// public Result rollback(@RequestBody HandleDataDTO handleDataDTO) {
// UserInfo currentUserInfo = handleDataDTO.getCurrentUserInfo();
// Authentication.setAuthenticatedUserId(currentUserInfo.getId());
// List<AttachmentDTO> attachments = handleDataDTO.getAttachments();
// String comments = handleDataDTO.getComments();
// JSONObject formData = handleDataDTO.getFormData();
// String taskId = handleDataDTO.getTaskId();
// String processInstanceId = handleDataDTO.getProcessInstanceId();
// List<Task> list = taskService.createTaskQuery().processInstanceId(processInstanceId).list();
// Task task = null;
// List<String> taskIds = new ArrayList<>();
//
// for (Task task1 : list) {
// if (task1.getId().equals(taskId)) {
// task = task1;
// }
// taskIds.add(task1.getTaskDefinitionKey());
// }
//
//
// Map<String, Object> map = new HashMap<>();
// if (formData != null && formData.size() > 0) {
// Map formValue = JSONObject.parseObject(formData.toJSONString(), new TypeReference<Map>() {
// });
// map.putAll(formValue);
// map.put(FORM_VAR, formData);
// }
// map.put(PROCESS_STATUS, BUSINESS_STATUS_3);
// runtimeService.setVariables(task.getProcessInstanceId(), map);
// if (StringUtils.isNotBlank(comments)) {
// taskService.addComment(task.getId(), task.getProcessInstanceId(), "opinion", comments);
// }
// if (attachments != null && attachments.size() > 0) {
// for (AttachmentDTO attachment : attachments) {
// taskService.createAttachment("option", taskId, task.getProcessInstanceId(), attachment.getName(), attachment.getName(), attachment.getUrl());
// }
// }
//
// if (StringUtils.isNotBlank(handleDataDTO.getSignInfo())) {
// taskService.addComment(task.getId(), task.getProcessInstanceId(), "sign", handleDataDTO.getSignInfo());
// }
//
//
// runtimeService.createChangeActivityStateBuilder()
// .processInstanceId(task.getProcessInstanceId())
// .moveActivityIdsToSingleActivityId(taskIds, handleDataDTO.getRollbackId())
// .changeState();
// return Result.OK();
// }
//
//
// @ApiOperation("加签按钮")
// @PostMapping("/addMulti")
// public Result addMulti(@RequestBody HandleDataDTO handleDataDTO) {
// UserInfo currentUserInfo = handleDataDTO.getCurrentUserInfo();
// Authentication.setAuthenticatedUserId(currentUserInfo.getId());
// List<AttachmentDTO> attachments = handleDataDTO.getAttachments();
// String comments = handleDataDTO.getComments();
// JSONObject formData = handleDataDTO.getFormData();
// String taskId = handleDataDTO.getTaskId();
// Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
// Map<String, Object> map = new HashMap<>();
// if (formData != null && formData.size() > 0) {
// Map formValue = JSONObject.parseObject(formData.toJSONString(), new TypeReference<Map>() {
// });
// map.putAll(formValue);
// map.put(FORM_VAR, formData);
// }
// map.put(PROCESS_STATUS, BUSINESS_STATUS_1);
// runtimeService.setVariables(task.getProcessInstanceId(), map);
// if (StringUtils.isNotBlank(comments)) {
// taskService.addComment(task.getId(), task.getProcessInstanceId(), "opinion", comments);
// }
// if (attachments != null && attachments.size() > 0) {
// for (AttachmentDTO attachment : attachments) {
// taskService.createAttachment("option", taskId, task.getProcessInstanceId(), attachment.getName(), attachment.getName(), attachment.getUrl());
// }
// }
//
// if (StringUtils.isNotBlank(handleDataDTO.getSignInfo())) {
// taskService.addComment(task.getId(), task.getProcessInstanceId(), "sign", handleDataDTO.getSignInfo());
// }
//
// Map<String, Object> variableMap = new HashMap<>();
// variableMap.put("assigneeName", handleDataDTO.getMultiAddUserInfo().getId());
// ExecutionEntity execution = (ExecutionEntity) runtimeService.addMultiInstanceExecution(task.getTaskDefinitionKey(), task.getProcessInstanceId(), variableMap);
// return Result.OK();
// }
//
//
// @ApiOperation("查到签上的人")
// @PostMapping("/queryMultiUsersInfo")
// public Result<List<MultiVO>> queryMultiUsersInfo(@RequestBody Map<String, Object> map) {
// String taskId = MapUtil.getStr(map, "taskId");
// Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
// List<Task> list = taskService.createTaskQuery()
// .processInstanceId(task.getProcessInstanceId())
// .taskDefinitionKey(task.getTaskDefinitionKey()).list();
// Iterator<Task> iterator = list.iterator();
// List<MultiVO> multiVOList = new ArrayList<>();
// while (iterator.hasNext()) {
// Task next = iterator.next();
// if (!taskId.equals(next.getId())) {
// MultiVO multiVO = new MultiVO();
// multiVO.setTaskId(next.getId());
// multiVO.setProcessInstanceId(next.getProcessInstanceId());
// multiVO.setExecutionId(next.getExecutionId());
// multiVO.setUserId(next.getAssignee());
// multiVOList.add(multiVO);
// }
//
// }
// return Result.OK(multiVOList);
// }
//
// @ApiOperation("减签按钮")
// @PostMapping("/deleteMulti")
// public Result deleteMulti(@RequestBody List<String> executionIds) {
// for (String executionId : executionIds) {
// runtimeService.deleteMultiInstanceExecution(executionId, true);
// }
// return Result.OK();
// }
//
// /**
// * 添加流程模型并返回modelId
// *
// * @param processId 流程唯一标识key
// * @param processAuthor 流程作者
// * @param name 流程名称
// * @param modelname 模型名称
// * @param description 模型描述
// * @param category 模型分类
// * @return
// * @throws UnsupportedEncodingException
// */
// protected String createModel(String processId, String processAuthor, String name, String modelname, String description, String category) throws UnsupportedEncodingException {
//
// ObjectMapper objectMapper = new ObjectMapper();
// ObjectNode editorNode = objectMapper.createObjectNode();
// editorNode.put("id", "canvs");
// editorNode.put("resourceId", "canvs");
// ObjectNode stencilSetNode = objectMapper.createObjectNode();
//
// //命名空间(禁止修改)
// stencilSetNode.put("namespace", "http://b3mn.org/stencilset/bpmn2.0#");
//
// //流程节点作者
// stencilSetNode.put("author", "");
// editorNode.set("stencilset", stencilSetNode);
// ObjectNode propertiesNode = objectMapper.createObjectNode();
//
// //流程唯一标识
// propertiesNode.put("process_id", processId);
//
// //流程作者
// propertiesNode.put("process_author", processAuthor);
//
// //流程名称
// propertiesNode.put("name", name);
// editorNode.set("properties", propertiesNode);
//
// ObjectNode modelObjectNode = objectMapper.createObjectNode();
//
// //模型名称
// modelObjectNode.put("name", modelname);
//
// //模型版本
// modelObjectNode.put("revision", 1);
//
// //模型描述
// modelObjectNode.put("description", description);
// Model modelData = repositoryService.newModel();
//
// //模型分类
// modelData.setCategory(category);
// modelData.setDeploymentId(null);
// modelData.setKey(null);
// modelData.setMetaInfo(modelObjectNode.toString());
//
// //模型名称
// modelData.setName(modelname);
// modelData.setTenantId("");
// modelData.setVersion(1);
//
// //保存模型,存储数据到表:act_re_model 流程设计模型部署表
// repositoryService.saveModel(modelData);
//
// //保存资源,存储数据到表:act_ge_bytearray 二进制数据表
// repositoryService.addModelEditorSource(modelData.getId(), editorNode.toString().getBytes("utf-8"));
//
// return modelData.getId();
// }
//
//
// @ApiOperation("评论按钮")
// @PostMapping("/comments")
// public Result comments(@RequestBody HandleDataDTO handleDataDTO) {
// UserInfo currentUserInfo = handleDataDTO.getCurrentUserInfo();
// Authentication.setAuthenticatedUserId(currentUserInfo.getId());
// List<AttachmentDTO> attachments = handleDataDTO.getAttachments();
// String comments = handleDataDTO.getComments();
// JSONObject formData = handleDataDTO.getFormData();
// String taskId = handleDataDTO.getTaskId();
// Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
// Map<String, Object> map = new HashMap<>();
// if (formData != null && formData.size() > 0) {
// Map formValue = JSONObject.parseObject(formData.toJSONString(), new TypeReference<Map>() {
// });
// map.putAll(formValue);
// map.put(FORM_VAR, formData);
// }
// map.put(PROCESS_STATUS, BUSINESS_STATUS_1);
// runtimeService.setVariables(task.getProcessInstanceId(), map);
// if (StringUtils.isNotBlank(comments)) {
// taskService.addComment(task.getId(), task.getProcessInstanceId(), "comments", comments);
// }
// if (attachments != null && attachments.size() > 0) {
// for (AttachmentDTO attachment : attachments) {
// taskService.createAttachment("option", taskId, task.getProcessInstanceId(), attachment.getName(), attachment.getName(), attachment.getUrl());
// }
// }
//
// if (StringUtils.isNotBlank(handleDataDTO.getSignInfo())) {
// taskService.addComment(task.getId(), task.getProcessInstanceId(), "sign", handleDataDTO.getSignInfo());
// }
// return Result.OK();
// }
//
// @ApiOperation("通过流程实例id查看详情")
// @PostMapping("process/instanceInfo")
// public Result<HandleDataVO> instanceInfo(@RequestBody HandleDataDTO HandleDataDTO) {
// String processInstanceId = HandleDataDTO.getProcessInstanceId();
// HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstanceId)
// .includeProcessVariables().singleResult();
// String processDefinitionKey = historicProcessInstance.getProcessDefinitionKey();
// ProcessTemplates processTemplates = processTemplateService.getById(processDefinitionKey.replace(PROCESS_PREFIX, ""));
// processTemplates.setLogo(processTemplates.getIcon());
// processTemplates.setFormId(processTemplates.getTemplateId());
// processTemplates.setFormName(processTemplates.getTemplateName());
// processTemplates.setProcessDefinitionId(historicProcessInstance.getProcessDefinitionId());
//
// HandleDataVO handleDataVO = new HandleDataVO();
// Map<String, Object> processVariables = historicProcessInstance.getProcessVariables();
//
// handleDataVO.setProcessInstanceId(historicProcessInstance.getId());
// JSONObject jsonObject = (JSONObject) processVariables.get(FORM_VAR);
// handleDataVO.setFormData(jsonObject);
// String process = processTemplates.getProcessJson();
// ChildNode childNode = JSONObject.parseObject(process, new TypeReference<ChildNode>() {
// });
// SettingsInfo settingsInfo = JSONObject.parseObject(processTemplates.getSettings(), new TypeReference<SettingsInfo>() {
// });
// Boolean sign = settingsInfo.getSign();
// ChildNode currentNode = null;
// if (StringUtils.isNotBlank(HandleDataDTO.getTaskId())) {
// HistoricTaskInstance historicTaskInstance = historyService.createHistoricTaskInstanceQuery().taskId(HandleDataDTO.getTaskId()).singleResult();
// currentNode = getChildNode(childNode, historicTaskInstance.getTaskDefinitionKey());
// List<FormOperates> formPerms = currentNode.getProps().getFormPerms();
// if (CollUtil.isNotEmpty(formPerms)) {
// Iterator<FormOperates> iterator = formPerms.iterator();
// while (iterator.hasNext()) {
// FormOperates next = iterator.next();
// if ("H".equals(next.getPerm())) {
// iterator.remove();
// if (jsonObject != null) {
// jsonObject.remove(next.getId());
// }
// }
// }
// }
// handleDataVO.setCurrentNode(currentNode);
// handleDataVO.setTaskId(HandleDataDTO.getTaskId());
// }
//
// if (sign) {
// handleDataVO.setSignFlag(true);
// }
// if (StringUtils.isNotBlank(HandleDataDTO.getTaskId())) {
// if (currentNode != null) {
// if (currentNode.getProps().getSign()) {
// handleDataVO.setSignFlag(true);
// } else {
// handleDataVO.setSignFlag(false);
// }
// }
// }
//
//
// List<HistoricActivityInstance> list = historyService.createHistoricActivityInstanceQuery().processInstanceId(historicProcessInstance.getId()).list();
// Map<String, List<HistoricActivityInstance>> historicActivityInstanceMap = new HashMap<>();
// for (HistoricActivityInstance historicActivityInstance : list) {
// List<HistoricActivityInstance> historicActivityInstances = historicActivityInstanceMap.get(historicActivityInstance.getActivityId());
// if (historicActivityInstances == null) {
// historicActivityInstances = new ArrayList<>();
// historicActivityInstances.add(historicActivityInstance);
// historicActivityInstanceMap.put(historicActivityInstance.getActivityId(), historicActivityInstances);
// } else {
// historicActivityInstances.add(historicActivityInstance);
// historicActivityInstanceMap.put(historicActivityInstance.getActivityId(), historicActivityInstances);
// }
// }
//
// Process mainProcess = repositoryService.getBpmnModel(historicProcessInstance.getProcessDefinitionId()).getMainProcess();
// Collection<FlowElement> flowElements = mainProcess.getFlowElements();
//
// List<String> runningList = new ArrayList<>();
// handleDataVO.setRunningList(runningList);
// List<String> endList = new ArrayList<>();
// handleDataVO.setEndList(endList);
// List<String> noTakeList = new ArrayList<>();
// handleDataVO.setNoTakeList(noTakeList);
// Map<String, List<TaskDetailVO>> deatailMap = new HashMap<>();
// List<Comment> processInstanceComments = taskService.getProcessInstanceComments(historicProcessInstance.getId());
// List<Attachment> processInstanceAttachments = taskService.getProcessInstanceAttachments(historicProcessInstance.getId());
// for (FlowElement flowElement : flowElements) {
// List<TaskDetailVO> detailVOList = new ArrayList<>();
// List<HistoricActivityInstance> historicActivityInstanceList = historicActivityInstanceMap.get(flowElement.getId());
// if (CollUtil.isNotEmpty(historicActivityInstanceList)) {
// for (HistoricActivityInstance historicActivityInstance : historicActivityInstanceList) {
// if (historicActivityInstance.getEndTime() != null) {
// if ("startEvent".equalsIgnoreCase(historicActivityInstance.getActivityType()) || "endEvent".equalsIgnoreCase(historicActivityInstance.getActivityType())) {
// TaskDetailVO taskDetailVO = new TaskDetailVO();
// taskDetailVO.setActivityId(historicActivityInstance.getActivityId());
// taskDetailVO.setName(historicActivityInstance.getActivityName());
// taskDetailVO.setCreateTime(historicActivityInstance.getStartTime());
// taskDetailVO.setEndTime(historicActivityInstance.getEndTime());
// detailVOList.add(taskDetailVO);
// deatailMap.put(historicActivityInstance.getActivityId(), detailVOList);
// endList.add(historicActivityInstance.getActivityId());
// } else if ("userTask".equalsIgnoreCase(historicActivityInstance.getActivityType())) {
// List<TaskDetailVO> voList = deatailMap.get(historicActivityInstance.getActivityId());
// List<HistoricActivityInstance> activityInstanceList = list.stream().filter(h -> h.getActivityId().equals(historicActivityInstance.getActivityId()) && h.getEndTime() != null).collect(Collectors.toList());
// if (voList != null) {
// collectUserTaskInfo(processInstanceComments, processInstanceAttachments, historicActivityInstance, voList, activityInstanceList);
// } else {
// voList = new ArrayList<>();
// collectUserTaskInfo(processInstanceComments, processInstanceAttachments, historicActivityInstance, voList, activityInstanceList);
// }
// deatailMap.put(historicActivityInstance.getActivityId(), voList);
// endList.add(historicActivityInstance.getActivityId());
// } else if ("serviceTask".equalsIgnoreCase(historicActivityInstance.getActivityType())) {
//
// }
// } else {
// if ("userTask".equalsIgnoreCase(historicActivityInstance.getActivityType())) {
// List<TaskDetailVO> voList = deatailMap.get(historicActivityInstance.getActivityId());
// List<HistoricActivityInstance> activityInstanceList = list.stream().filter(h -> h.getActivityId().equals(historicActivityInstance.getActivityId()) && h.getEndTime() == null).collect(Collectors.toList());
// if (voList != null) {
// collectUserTaskInfo(processInstanceComments, processInstanceAttachments, historicActivityInstance, voList, activityInstanceList);
// } else {
// voList = new ArrayList<>();
// collectUserTaskInfo(processInstanceComments, processInstanceAttachments, historicActivityInstance, voList, activityInstanceList);
// }
// deatailMap.put(historicActivityInstance.getActivityId(), voList);
// if (endList.contains(historicActivityInstance.getActivityId())) {
// endList.remove(historicActivityInstance.getActivityId());
// runningList.add(historicActivityInstance.getActivityId());
// } else {
// runningList.add(historicActivityInstance.getActivityId());
// }
// } else if ("serviceTask".equalsIgnoreCase(historicActivityInstance.getActivityType())) {
//
// }
// }
// }
// } else {
// noTakeList.add(flowElement.getId());
// }
// }
// handleDataVO.setProcessTemplates(processTemplates);
// handleDataVO.setDetailVOList(deatailMap);
// return Result.OK(handleDataVO);
// }
//
// private void collectUserTaskInfo(List<Comment> processInstanceComments,
// List<Attachment> processInstanceAttachments,
// HistoricActivityInstance historicActivityInstance,
// List<TaskDetailVO> voList,
// List<HistoricActivityInstance> activityInstanceList) {
// for (HistoricActivityInstance activityInstance : activityInstanceList) {
// TaskDetailVO taskDetailVO = new TaskDetailVO();
// taskDetailVO.setTaskId(activityInstance.getTaskId());
// taskDetailVO.setActivityId(activityInstance.getActivityId());
// taskDetailVO.setName(activityInstance.getActivityName());
// taskDetailVO.setCreateTime(activityInstance.getStartTime());
// taskDetailVO.setEndTime(activityInstance.getEndTime());
// Comment signComment = processInstanceComments.stream().filter(h -> h.getTaskId().equals(historicActivityInstance.getTaskId()) && h.getType().equals("sign")).findFirst().orElse(null);
// if (signComment != null) {
// taskDetailVO.setSignImage(signComment.getFullMessage());
// }
// List<Attachment> attachments = processInstanceAttachments.stream().filter(h -> h.getTaskId().equals(historicActivityInstance.getTaskId())).collect(Collectors.toList());
// if (CollUtil.isNotEmpty(attachments)) {
// List<AttachmentVO> attachmentVOList = new ArrayList<>();
// for (Attachment attachment : attachments) {
// AttachmentVO attachmentVO = new AttachmentVO();
// attachmentVO.setId(attachment.getId());
// attachmentVO.setName(attachment.getName());
// attachmentVO.setUrl(attachment.getUrl());
// attachmentVOList.add(attachmentVO);
// }
// taskDetailVO.setAttachmentVOList(attachmentVOList);
// }
//
// List<Comment> options = processInstanceComments.stream().filter(h -> h.getTaskId().equals(historicActivityInstance.getTaskId()) && h.getType().equals("opinion")).collect(Collectors.toList());
// if (CollUtil.isNotEmpty(options)) {
// List<OptionVO> optionVOList = new ArrayList<>();
// for (Comment option : options) {
// OptionVO optionVO = new OptionVO();
// optionVO.setComments(option.getFullMessage());
// optionVO.setUserId(option.getUserId());
//// optionVO.setUserName();
// optionVO.setCreateTime(option.getTime());
// optionVOList.add(optionVO);
// }
// taskDetailVO.setOptionVOList(optionVOList);
// }
//
// List<Comment> comments = processInstanceComments.stream().filter(h -> h.getTaskId().equals(historicActivityInstance.getTaskId()) && h.getType().equals("comments")).collect(Collectors.toList());
// if (CollUtil.isNotEmpty(comments)) {
// List<CommentVO> commentsVOList = new ArrayList<>();
// for (Comment comment : comments) {
// CommentVO commentVO = new CommentVO();
// commentVO.setComments(comment.getFullMessage());
// commentVO.setUserId(comment.getUserId());
//// commentVO.setUserName();
// commentVO.setCreateTime(comment.getTime());
// commentsVOList.add(commentVO);
// }
// taskDetailVO.setCommentVOList(commentsVOList);
// }
//
// voList.add(taskDetailVO);
//
//
// }
// }
//
//
//// @ApiOperation("上传文件")
//// @PostMapping("upLoadFile")
//// public Result<AttachmentVO> upLoadFile(@RequestParam("file") MultipartFile file, HttpServletRequest request){
//// MinioUploadUtil minioUploadUtil = SpringContextHolder.getBean(MinioUploadUtil.class);
//// MinioClient minioClient = SpringContextHolder.getBean(MinioClient.class);
//// AttachmentVO attachmentVO= new AttachmentVO();
//// attachmentVO.setName(file.getOriginalFilename());
//// minioUploadUtil.uploadFile(file, "java", file.getOriginalFilename());
//// try {
//// String url = minioClient.getPresignedObjectUrl(
//// GetPresignedObjectUrlArgs.builder()
//// .bucket("java")
//// .object(file.getOriginalFilename())
//// .expiry(7, TimeUnit.DAYS) // 设置5秒的超时时间。
//// .method(Method.GET)
//// .build());
//// attachmentVO.setUrl(url);
//// } catch (ErrorResponseException e) {
//// e.printStackTrace();
//// } catch (InsufficientDataException e) {
//// e.printStackTrace();
//// } catch (InternalException e) {
//// e.printStackTrace();
//// } catch (InvalidKeyException e) {
//// e.printStackTrace();
//// } catch (InvalidResponseException e) {
//// e.printStackTrace();
//// } catch (IOException e) {
//// e.printStackTrace();
//// } catch (NoSuchAlgorithmException e) {
//// e.printStackTrace();
//// } catch (XmlParserException e) {
//// e.printStackTrace();
//// } catch (ServerException e) {
//// e.printStackTrace();
//// }
//// return Result.OK(attachmentVO);
//// }
//// @ApiOperation("下载文件")
//// @PostMapping("downLoadFile")
//// public void downLoadFile(@RequestParam("name") String name){
//// MinioUploadUtil minioUploadUtil = SpringContextHolder.getBean(MinioUploadUtil.class);
//// minioUploadUtil.downFile(name,"java",name);
//// }
//
//}
package com.junmp.junmpProcess.dto;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import com.junmp.junmpProcess.dto.json.UserInfo;
/**
* @author LoveMyOrange
* @create 2022-10-14 23:47
*/
@Data
@ApiModel("我发起流程 需要返回给前端的DTO")
public class ApplyDTO extends PageDTO {
private UserInfo currentUserInfo;
}
package com.junmp.junmpProcess.dto;
import lombok.Data;
/**
* @author LoveMyOrange
* @create 2022-10-15 17:04
*/
@Data
public class AttachmentDTO {
private String id;
private String name;
private String url;
}
package com.junmp.junmpProcess.dto;
import lombok.Data;
/**
* 流程DTO
*/
@Data
public class FlowDTO {
//表单分类id
private String process;
private Integer groupId;
}
package com.junmp.junmpProcess.dto;
import lombok.Data;
/**
* @Author:LoveMyOrange
* @Description:
* @Date:Created in 2022/10/9 15:51
*/
@Data
public class FlowEngineDTO {
private String formId;
private String formItems;
private String formName;
//表单分类id
private Integer groupId;
private String logo;
private String process;
private String remark;
private String settings;
}
package com.junmp.junmpProcess.dto;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import com.junmp.junmpProcess.dto.json.UserInfo;
import java.util.List;
/**
* @author LoveMyOrange
* @create 2022-10-15 16:27
*/
@Data
@ApiModel("各个按钮 处理数据需要传递的参数")
public class HandleDataDTO {
@ApiModelProperty("任务id")
private String taskId;
@ApiModelProperty("流程实例id")
private String processInstanceId;
@ApiModelProperty("表单数据")
private JSONObject formData;
@ApiModelProperty("附件")
private List attachments;
@ApiModelProperty("意见")
private String comments;
@ApiModelProperty("签名信息")
private String signInfo;
@ApiModelProperty("转办用户信息")
private UserInfo transferUserInfo;
@ApiModelProperty("加签用户信息")
private UserInfo multiAddUserInfo;
@ApiModelProperty("退回节点id")
private String rollbackId;
@ApiModelProperty("当前用户信息")
private UserInfo currentUserInfo;
@ApiModelProperty("委派的人")
private UserInfo delegateUserInfo;
}
package com.junmp.junmpProcess.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author LoveMyOrange
* @create 2022-10-15 10:33
*/
@Data
@ApiModel("分页DTO")
public class PageDTO {
@ApiModelProperty(value = "第几页", required = true)
private Integer pageNo;
@ApiModelProperty(value = "多少条", required = true)
private Integer pageSize;
}
package com.junmp.junmpProcess.dto;
import com.alibaba.fastjson.JSONObject;
import com.junmp.junmpProcess.dto.json.JunmpUserInfo;
import lombok.Data;
import com.junmp.junmpProcess.dto.json.UserInfo;
import java.util.List;
import java.util.Map;
/**
* @author LoveMyOrange
* @create 2022-10-14 23:27
*/
@Data
public class StartProcessInstanceDTO {
private String processDefinitionId;
private JSONObject formData;
private Map<String, List<JunmpUserInfo>> processUsers;
private JunmpUserInfo startUserInfo;
}
package com.junmp.junmpProcess.dto;
import com.junmp.junmpProcess.dto.json.JunmpUserInfo;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import com.junmp.junmpProcess.dto.json.UserInfo;
/**
* @author LoveMyOrange
* @create 2022-10-14 23:47
*/
@Data
@ApiModel("待办 需要返回给前端的VO")
public class TaskDTO extends PageDTO {
private JunmpUserInfo currentUserInfo;
}
package com.junmp.junmpProcess.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
@Data
public class UserListDTO implements Serializable {
@ApiModelProperty(value = "用户ID")
private String userID;
@ApiModelProperty
private String realName;
}
package com.junmp.junmpProcess.dto.json;
import lombok.Data;
import java.util.List;
@Data
public class ApproverGroups {
private String id;
private String approverType;
private String levelMode;
private List<String> approverIds;
private List<String> approverNames;
private List<String> orgIds;
}
package com.junmp.junmpProcess.dto.json;
import com.alibaba.fastjson.JSONObject;
import lombok.Data;
import java.util.List;
/**
* @Author:LoveMyOrange
* @Description:
* @Date:Created in 2022/10/9 16:20
* <p>
* process: "
* {\"id\":\"root\",\
* "parentId\":null,\
* "type\":\"ROOT\",\
* "name\":\"发起人\",\
* "desc\":\"任何人\",\
* "props\":{\
* "assignedUser\":
* <p>
* <p>
* [{\"id\":1486186,\"name\":\"xx科技有限公司\",\"type\":\"dept\",\"sex\":null,\"selected\":false}],\
* "formPerms\":[{\"id\":\"field6131501574832\",\"title\":\"单行文本输入\",\"required\":true,\"perm\":\"E\"}]},\
* "children\":{\"id\":\"node_040730749764\",\"parentId\":\"root\",\"props\":{\"assignedType\":\"ASSIGN_USER\",\"mode\":\"AND\",\"sign\":true,\"nobody\":{\"handler\":\"TO_PASS\",\"assignedUser\":[]},\"timeLimit\":{\"timeout\":{\"unit\":\"H\",\"value\":\"1\"},\"handler\":{\"type\":\"REFUSE\",\"notify\":{\"once\":true,\"hour\":1}}},\"assignedUser\":[{\"id\":381496,\"name\":\"旅人\",\"type\":\"user\",\"sex\":false,\"selected\":false}],\"formPerms\":[{\"id\":\"field6131501574832\",\"title\":\"单行文本输入\",\"required\":true,\"perm\":\"R\"}],\"selfSelect\":{\"multiple\":false},\"leaderTop\":{\"endCondition\":\"TOP\",\"endLevel\":1},\"leader\":{\"level\":1},\"role\":[],\"refuse\":{\"type\":\"TO_END\",\"target\":\"\"},\"formUser\":\"\"},\"type\":\"APPROVAL\",\"name\":\"审批人\",\"children\":{}}}"
*/
@Data
public class ChildNode {
private String id;
private String parentId;
private String type;
private String states;
private String name;
private String desc;
private Properties props;
private ChildNode childNode;
private List<ChildNode> conditionNodes;
private List<ApproverGroups> approverGroups;
private String parallelStr;
private JSONObject incoming = new JSONObject();
private Boolean typeElse;
}
package com.junmp.junmpProcess.dto.json;
import lombok.Data;
import java.util.List;
/**
* @Author:LoveMyOrange
* @Description:
* @Date:Created in 2022/10/9 18:57
*/
@Data
public class ConditionInfo {
private String id;
private String title;
private String valueType;
private String compare;
private List<Object> value;
}
package com.junmp.junmpProcess.dto.json;
import lombok.Data;
import java.util.List;
/**
* @Author:LoveMyOrange
* @Description:
* @Date:Created in 2022/10/9 20:08
*/
@Data
public class EmailInfo {
private String subject;
private List<String> to;
private String content;
}
package com.junmp.junmpProcess.dto.json;
import lombok.Data;
/**
* @Author:LoveMyOrange
* @Description:
* @Date:Created in 2022/10/9 15:55
*/
@Data
public class FormItem {
private String title;
private String name;
private String icon;
private String value;
private String valueType;
private String id;
private FormItemProps props;
}
package com.junmp.junmpProcess.dto.json;
import lombok.Data;
/**
* @Author:LoveMyOrange
* @Description:
* @Date:Created in 2022/10/9 15:57
*/
@Data
public class FormItemProps {
private Boolean required;
private Boolean enablePrint;
private String placeHolder;
}
package com.junmp.junmpProcess.dto.json;
import lombok.Data;
/**
* @Author:LoveMyOrange
* @Description:
* @Date:Created in 2022/10/9 16:26
*/
@Data
public class FormOperates {
private String id;
private String title;
private Boolean required;
private String perm;
}
package com.junmp.junmpProcess.dto.json;
import lombok.Data;
import java.util.List;
/**
* @Author:LoveMyOrange
* @Description:
* @Date:Created in 2022/10/9 18:57
*/
@Data
public class GroupsInfo {
private String groupType;
private List<ConditionInfo> conditions;
private List<String> cids;
}
package com.junmp.junmpProcess.dto.json;
import lombok.Data;
import java.util.List;
import java.util.Map;
/**
* @Author:LoveMyOrange
* @Description:
* @Date:Created in 2022/10/9 20:04
*/
@Data
public class HttpInfo {
private String method;
private String url;
private List<Map<String, Object>> headers;
private String contentType;
private List<Map<String, Object>> params;
private Integer retry;
private Boolean handlerByScript;
private String success;
private String fail;
}
package com.junmp.junmpProcess.dto.json;
import lombok.Data;
@Data
public class JunmpUserInfo {
private String userId;
private String sex;
private String name;
}
package com.junmp.junmpProcess.dto.json;
import lombok.Data;
/**
* @Author:LoveMyOrange
* @Description:
* @Date:Created in 2022/10/9 16:05
*/
@Data
public class LogoInfo {
private String icon;
private String background;
}
package com.junmp.junmpProcess.dto.json;
import lombok.Data;
/**
* @Author:LoveMyOrange
* @Description:
* @Date:Created in 2022/10/9 16:15
*/
@Data
public class NotifyType {
private String type;
private String name;
}
package com.junmp.junmpProcess.dto.json;
import com.alibaba.fastjson.JSONObject;
import lombok.Data;
/**
* @Author:LoveMyOrange
* @Description:
* @Date:Created in 2022/10/9 16:15
*/
@Data
public class NotifyTypeInfo {
private String title;
private JSONObject types;
}
package com.junmp.junmpProcess.dto.json;
import com.alibaba.fastjson.JSONObject;
import lombok.Data;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Author:LoveMyOrange
* @Description:
* @Date:Created in 2022/10/9 16:30
* <p>
* \"assignedType\":\"ASSIGN_USER\",\"mode\":\"AND\",\"sign\":true,\
* "nobody\":{\"handler\":\"TO_PASS\",\"assignedUser\":[]},\
* "timeLimit\":{\"timeout\":{\"unit\":\"H\",\"value\":\"1\"},\
* "handler\":{\"type\":\"REFUSE\",\"notify\":{\"once\":true,\"hour\":1}}},\
* "assignedUser\":[{\"id\":381496,\"name\":\"旅人\",\"type\":\"user\",\"sex\":false,\"selected\":false}],\
* "formPerms\":[{\"id\":\"field6131501574832\",\"title\":\"单行文本输入\",\"required\":true,\"perm\":\"R\"}],\
* "selfSelect\":{\"multiple\":false},\
* "leaderTop\":{\"endCondition\":\"TOP\",\"endLevel\":1},\
* "leader\":{\"level\":1},\"role\":[],\
* "refuse\":{\"type\":\"TO_END\",\"target\":\"\"},\"formUser\":\"\"},\"type\":\"APPROVAL\",\"name\":\"审批人\",\"children\":{}}}"
*/
@Data
public class Properties {
private String assignedType;
private List<UserInfo> assignedUser;
//发起人自旋 multiple true false
private Map<String, Object> selfSelect;
//连续主管 endCondition TOP LEAVE endLevel level
private Map<String, Object> leaderTop = new HashMap<>();
//指定主管审批
private Map<String, Object> leader = new HashMap<>();
//系统角色
private List<Map<String, Object>> role;
//表单人员
private String formUser;
//审批人为空的规则 hander 和 assignedUser
private Map<String, Object> nobody;
private String mode;
private Boolean sign;
//审批超时
private JSONObject timeLimit;
private Map<String, Object> refuse;
private List<FormOperates> formPerms;
//------------------------------------->
private String groupsType;
private String expression;
private List<GroupsInfo> groups;
//
private Boolean shouldAdd;
//
private String type;
private Long time;
private String unit;
private String dateTime;
//
private HttpInfo http;
private EmailInfo email;
}
package com.junmp.junmpProcess.dto.json;
import com.alibaba.fastjson.JSONObject;
import lombok.Data;
import java.util.List;
/**
* @Author:LoveMyOrange
* @Description:
* @Date:Created in 2022/10/9 16:06
*/
@Data
public class SettingsInfo {
private List<String> commiter;
private List<UserInfo> admin;
private Boolean sign;
private JSONObject notify;
}
package com.junmp.junmpProcess.dto.json;
import lombok.Data;
/**
* @Author:LoveMyOrange
* @Description:
* @Date:Created in 2022/10/9 16:10
*/
@Data
public class UserInfo {
private String id;
private String name;
private String type;
private String sex;
private Boolean selected;
}
package com.junmp.junmpProcess.dto.json.flowJson;
import lombok.Data;
import java.util.List;
@Data
public class FlowApproverGroups {
private String id;
private int approverType;
private int levelMode;
private List<String> approverIds;
private List<String> approverNames;
}
\ No newline at end of file
package com.junmp.junmpProcess.dto.json.flowJson;
import lombok.Data;
import java.util.List;
import java.util.Map;
@Data
public class FlowChildNode {
private String id;
private String name;
private int type;
private int status;
private boolean error;
private FlowChildNode childNode;
private boolean addable;
private List<FlowChildNode> conditionNodes;
private String pid;
private Map<String, Object> attr;
private List<FlowApproverGroups> approverGroups;
//不确定什么类型
private List<String> privileges;
private Map<String, Object> configure;
private List<FlowConditionNodes> FlowConditionNodes;
private boolean deletable;
private String content;
}
package com.junmp.junmpProcess.dto.json.flowJson;
import lombok.Data;
@Data
public class FlowConditionGroup {
private String id;
private String condition;
private String name;
private int type;
private int status;
private boolean error;
private FlowChildNode childNode;
private FlowChildNode addable;
private FlowChildNode deletable;
private int conditionGroup;
private int attr;
private boolean content;
}
package com.junmp.junmpProcess.dto.json.flowJson;
import lombok.Data;
import java.util.List;
@Data
public class FlowConditionNodes {
private String id;
private String pid;
private String name;
private int type;
private int status;
private boolean error;
private FlowChildNode childNode;
private FlowChildNode addable;
private FlowChildNode deletable;
private List<FlowConditionGroup> conditionGroup;
private int attr;
private boolean content;
}
package com.junmp.junmpProcess.dto.json.flowJson;
import com.alibaba.fastjson.JSONObject;
import com.junmp.junmpProcess.dto.json.ChildNode;
import com.junmp.junmpProcess.dto.json.Properties;
import lombok.Data;
import java.util.List;
@Data
public class FlowNode {
private String id;
private String name;
private int type;
private int status;
private boolean error;
private ChildNode childNode;
private boolean addable;
private String desc;
private Properties props;
private List<ChildNode> branchs;
private String parallelStr;
private JSONObject incoming = new JSONObject();
private Boolean typeElse;
}
\ No newline at end of file
package com.junmp.junmpProcess.dto.json.flowJson;
import lombok.AllArgsConstructor;
import lombok.Data;
@Data
@AllArgsConstructor
public class Inout {
private String in;
private String out;
}
package com.junmp.junmpProcess.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.Date;
/**
* (Departments)实体类
*
* @author makejava
* @since 2020-09-17 14:21:25
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName("departments")
public class Departments implements Serializable {
private static final long serialVersionUID = -53409297247748263L;
/**
* 部门id
*/
@TableId(value = "dept_id", type = IdType.ASSIGN_ID)
private Long deptId;
/**
* 部门名
*/
private String deptName;
/**
* 部门主管
*/
private String leader;
/**
* 父部门id
*/
private Integer parentId;
/**
* 创建时间
*/
private Date created;
/**
* 更新时间
*/
private Date updated;
}
package com.junmp.junmpProcess.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.Date;
/**
* (FormGroups)实体类
*
* @author makejava
* @since 2020-09-21 22:49:33
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "form_groups")
public class FormGroups implements Serializable {
private static final long serialVersionUID = -50696449296875480L;
@TableId(value = "group_id", type = IdType.AUTO)
/**
* id
*/
private Integer groupId;
/**
* 组名
*/
private String groupName;
/**
* 排序号
*/
private Integer sortNum;
/**
* 创建时间
*/
private Date created;
/**
* 更新时间
*/
private Date updated;
}
package com.junmp.junmpProcess.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.Date;
/**
* (ProcessTemplates)实体类
*
* @author makejava
* @since 2020-09-21 22:50:29
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "process_templates")
@Builder
public class Process implements Serializable {
private static final long serialVersionUID = -95829441258242072L;
@TableId
/**
* 审批摸板ID
*/
private String templateId;
@TableField(exist = false)
private String formId;
@TableField(exist = false)
private String formName;
/**
* 摸板名称
*/
private String templateName;
private Integer groupId;
/**
* 摸板表单
*/
private String formItems;
private String settings;
private String process;
/**
* 图标
*/
private String icon;
/**
* 图标背景色
*/
private String background;
private String notify;
/**
* 谁能提交
*/
private String whoCommit;
/**
* 谁能编辑
*/
private String whoEdit;
/**
* 谁能导出数据
*/
private String whoExport;
private String remark;
/**
* 是否已停用
*/
private Boolean isStop;
/**
* 创建时间
*/
private Date created;
/**
* 更新时间
*/
private Date updated;
@TableField(exist = false)
private String logo;
@TableField(exist = false)
private String processDefinitionId;
}
\ No newline at end of file
package com.junmp.junmpProcess.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.Date;
/**
* (ProcessTemplates)实体类
*
* @author makejava
* @since 2020-09-21 22:50:29
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "process_templates")
@Builder
public class ProcessTemplates implements Serializable {
private static final long serialVersionUID = -95829441258242072L;
@TableId
/**
* 审批摸板ID
*/
private String templateId;
@TableField(exist = false)
private String formId;
private String formName;
private Integer groupId;
/**
* 摸板表单
*/
private String formJson;
private String settings;
private String processJson;
/**
* 图标
*/
private String icon;
/**
* 图标背景色
*/
private String background;
private String notify;
/**
* 谁能提交
*/
private String whoCommit;
/**
* 谁能编辑
*/
private String whoEdit;
/**
* 谁能导出数据
*/
private String whoExport;
private String remark;
/**
* 是否已停用
*/
private Boolean isStop;
/**
* 创建时间
*/
private Date created;
/**
* 更新时间
*/
private Date updated;
@TableField(exist = false)
private String logo;
@TableField(exist = false)
private String processDefinitionId;
}
package com.junmp.junmpProcess.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.Date;
/**
* (TemplateGroup)实体类
*
* @author makejava
* @since 2020-09-21 22:50:41
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "template_group")
public class TemplateGroup implements Serializable {
private static final long serialVersionUID = 296474043591142508L;
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
private String templateId;
private Integer groupId;
private Integer sortNum;
private Date created;
}
package com.junmp.junmpProcess.entity;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* @author : willian fu
* @date : 2020/9/21
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class TemplateGroupBo {
private Integer id;
private Integer groupId;
private String groupName;
private String templateId;
private String formName;
private String icon;
private Boolean isStop;
private String remark;
private Date updated;
private String background;
}
package com.junmp.junmpProcess.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.Date;
/**
* (Users)实体类
*
* @author makejava
* @since 2020-09-17 14:18:47
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName(value = "users")
public class Users implements Serializable {
private static final long serialVersionUID = 147397842421109939L;
/**
* 用户id
*/
@TableId
private Long userId;
/**
* 用户名
*/
private String userName;
//拼音
private String pingyin;
/**
* 昵称
*/
private String alisa;
/**
* 头像
*/
private String avatar;
/**
* 性别
*/
private Boolean sex;
/**
* 部门id,分隔
*/
private String departmentIds;
/**
* 入职日期
*/
private Date entryDate;
/**
* 离职日期
*/
private Date leaveDate;
/**
* 管理级别 0=主管理员 1=子管理员 2=普通员工
*/
private Integer admin;
/**
* 创建时间
*/
private Date created;
/**
* 更新时间
*/
private Date updated;
}
package com.junmp.junmpProcess.enums;
/**
* @Author:LoveMyOrange
* @Description:
* @Date:Created in 2022/10/9 18:15
*/
public enum AssigneeTypeEnums {
ASSIGN_USER("ASSIGN_USER"),
SELF_SELECT("SELF_SELECT"),
LEADER_TOP("LEADER_TOP"),
LEADER("LEADER"),
ROLE("ROLE"),
SELF("SELF"),
FORM_USER("FORM_USER");
private String typeName;
AssigneeTypeEnums(String typeName) {
this.typeName = typeName;
}
public String getTypeName() {
return typeName;
}
public void setTypeName(String typeName) {
this.typeName = typeName;
}
}
package com.junmp.junmpProcess.enums;
/**
* @Author:LoveMyOrange
* @Description:
* @Date:Created in 2022/10/9 18:15
*/
public enum ModeEnums {
AND("AND"),
OR("OR"),
NEXT("NEXT");
private String typeName;
ModeEnums(String typeName) {
this.typeName = typeName;
}
public String getTypeName() {
return typeName;
}
public void setTypeName(String typeName) {
this.typeName = typeName;
}
}
package com.junmp.junmpProcess.exception;
import lombok.extern.slf4j.Slf4j;
import com.junmp.junmpProcess.common.R;
import org.springframework.http.HttpStatus;
import org.springframework.validation.BindException;
import org.springframework.validation.FieldError;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import java.util.List;
/**
* @date 2018/8/30
* 全局异常处理器
*/
@Slf4j
@RestControllerAdvice
public class GlobalExceptionHandlerResolver {
/**
* 全局异常.
*
* @param e the e
* @return R
*/
@ExceptionHandler(Exception.class)
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
public Object handleGlobalException(Exception e) {
log.error("全局异常信息 ex={}", e.getMessage(), e);
return R.badRequest(e.getLocalizedMessage());
}
/**
* validation Exception
*
* @param exception
* @return R
*/
@ExceptionHandler({MethodArgumentNotValidException.class, BindException.class})
@ResponseStatus(HttpStatus.BAD_REQUEST)
public Object handleBodyValidException(MethodArgumentNotValidException exception) {
List<FieldError> fieldErrors = exception.getBindingResult().getFieldErrors();
log.error("参数绑定异常,ex = {}", fieldErrors.get(0).getDefaultMessage());
return R.badRequest(fieldErrors.get(0).getDefaultMessage());
}
}
package com.junmp.junmpProcess.exception;
/**
* 流程异常封装
*/
public class WorkFlowException extends RuntimeException {
public WorkFlowException(String message) {
super(message);
}
}
package com.junmp.junmpProcess.job;
import com.alibaba.fastjson.JSONObject;
import org.flowable.common.engine.impl.interceptor.Command;
import org.flowable.common.engine.impl.interceptor.CommandContext;
import org.flowable.engine.impl.util.CommandContextUtil;
import org.flowable.job.api.Job;
import org.flowable.job.service.TimerJobService;
import org.flowable.job.service.impl.persistence.entity.TimerJobEntity;
import java.io.Serializable;
import java.util.Date;
/**
* @author LoveMyOrange
* @create 2022-10-15 21:51
*/
public class CustomJobCmd implements Command<Void>, Serializable {
protected String processInstanceId;
protected String taskId;
protected String executionId;
protected Date dueDate;
protected String type;
protected String comment;
public CustomJobCmd(String processInstanceId, String comment, String taskId, String executionId, Date dueDate, String type) {
this.processInstanceId = processInstanceId;
this.comment = comment;
this.taskId = taskId;
this.executionId = executionId;
this.dueDate = dueDate;
this.type = type;
}
@Override
public Void execute(CommandContext commandContext) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("comment", this.comment);
jsonObject.put("task_id", this.taskId);
TimerJobService timerJobService = CommandContextUtil.getTimerJobService(commandContext);
TimerJobEntity job = timerJobService.createTimerJob();
job.setJobType(Job.JOB_TYPE_TIMER);
job.setExclusive(true);
// 作业处理器类型
job.setJobHandlerType(CustomJobHandler.TYPE);
// 处理时间
job.setDuedate(this.dueDate);
job.setExecutionId(null);
job.setProcessInstanceId(this.processInstanceId);
job.setJobHandlerConfiguration(jsonObject.toJSONString());
timerJobService.scheduleTimerJob(job);
return null;
}
}
package com.junmp.junmpProcess.job;
import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j;
import org.flowable.common.engine.impl.interceptor.CommandContext;
import org.flowable.job.service.JobHandler;
import org.flowable.job.service.impl.persistence.entity.JobEntity;
import org.flowable.variable.api.delegate.VariableScope;
/**
* @author LoveMyOrange
* @create 2022-10-15 21:42
*/
@Slf4j
public class CustomJobHandler implements JobHandler {
public static final String TYPE = "custom-handler";
@Override
public String getType() {
return "custom-handler";
}
@Override
public void execute(JobEntity jobEntity, String s, VariableScope variableScope, CommandContext commandContext) {
log.info("============执行自定义定时任务============");
log.info("定时任务详情={}", JSON.toJSONString(jobEntity));
}
}
package com.junmp.junmpProcess.job;
import com.junmp.junmpProcess.utils.IdWorker;
import com.junmp.junmpProcess.utils.SpringContextHolder;
import org.flowable.common.engine.impl.cfg.IdGenerator;
import org.springframework.stereotype.Component;
/**
* @Author:LoveMyOrange
* @Description:
* @Date:Created in 2022/10/17 13:01
*/
@Component
public class IdWorkerIdGenerator implements IdGenerator {
@Override
public String getNextId() {
return SpringContextHolder.getBean(IdWorker.class).nextId() + "";
}
}
package com.junmp.junmpProcess.listener;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.map.MapUtil;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.junmp.junmpProcess.dto.UserListDTO;
import com.junmp.junmpProcess.dto.json.*;
import com.junmp.junmpProcess.exception.WorkFlowException;
import com.junmp.junmpProcess.mapper.OrgUserMapper;
import com.junmp.junmpProcess.service.Repository.ProcessTemplateService;
import com.junmp.v2.sys.api.UserServiceApi;
import com.junmp.v2.sys.api.bean.user.dto.RoleUserDto;
import com.junmp.v2.sys.api.bean.user.vo.QueryUserInfoVo;
import org.flowable.bpmn.model.Process;
import org.flowable.bpmn.model.UserTask;
import org.flowable.engine.RepositoryService;
import org.flowable.engine.delegate.DelegateExecution;
import org.flowable.engine.delegate.ExecutionListener;
import com.junmp.junmpProcess.enums.AssigneeTypeEnums;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.junmp.junmpProcess.utils.BpmnModelUtils.getChildNode;
/**
* @author LoveMyOrange
* @create 2022-10-15 13:35
*/
@Component
public class CounterSignListener implements ExecutionListener {
@Resource
private RepositoryService repositoryService;
@Resource
private OrgUserMapper orgUserMapper;
@Override
public void notify(DelegateExecution execution) {
String currentActivityId = execution.getCurrentActivityId();
Process mainProcess = repositoryService.getBpmnModel(execution.getProcessDefinitionId()).getMainProcess();
UserTask userTask = (UserTask) mainProcess.getFlowElement(currentActivityId);
String flowJson = mainProcess.getAttributeValue("http://flowable.org/bpmn", "Junmp");
JSONObject jsonObject = JSONObject.parseObject(flowJson, new TypeReference<JSONObject>() {
});
String processJson = jsonObject.getString("processJson");
ChildNode childNode = JSONObject.parseObject(processJson, new TypeReference<ChildNode>() {
});
List<String> assigneeList = new ArrayList<>();
String variable = currentActivityId + "assigneeList";
List usersValue = (List) execution.getVariable(variable);
if (usersValue == null) {
ChildNode currentNode = getChildNode(childNode, currentActivityId);
if (currentNode == null) {
throw new WorkFlowException("查找审批人失败,请联系管理员重试");
}
ApproverGroups group=currentNode.getApproverGroups().get(0);
String Type=group.getApproverType();
if (Type.equals("1"))//指定人员,不处理
{
List<String> assignedUser = group.getApproverIds();
for (String userInfo : assignedUser) {
assigneeList.add(userInfo);
}
}
else if (Type.equals("2"))//指定角色
{
List<String> Roles=group.getApproverIds();
if (Roles.size()>0)//角色不为空
{
//开始拼接传入的多角色
String roleList="(";
for (String role :Roles)
{
roleList+=role+",";
}
roleList = roleList.substring(0, roleList.length() - 1);
roleList+=")";//至此拼接完成
List<UserListDTO> userList=orgUserMapper.QueryUserByRoleId(roleList);
for (UserListDTO userId :userList)
{
assigneeList.add(userId.getUserID());
}
}
}
else if (Type.equals("3"))//指定组织机构中的角色
{
// List<UserListDTO> userList=orgUserMapper.QueryUserByRoleIdAndOrg(role);
List<String> Roles=group.getApproverIds();
List<String> Orgs=group.getOrgIds();
if (Roles.size()>0&&Orgs.size()>0)//角色不为空,组织机构不为空
{
//开始拼接传入的多角色
String roleList="(";
for (String role :Roles)
{
roleList+=role+",";
}
roleList = roleList.substring(0, roleList.length() - 1);
roleList+=")";//至此拼接完成
//开始拼接传入的多组织机构
String orgList="(";
for (String org :Orgs)
{
orgList+=org+",";
}
orgList = orgList.substring(0, orgList.length() - 1);
orgList+=")";//至此拼接完成
List<UserListDTO> userList=orgUserMapper.QueryUserByRoleIdAndOrg(roleList,orgList);
for (UserListDTO userId :userList)
{
assigneeList.add(userId.getUserID());
}
}
}
if (assigneeList.size()!=0)
{execution.setVariable(variable, assigneeList);}
} else {
}
}
}
package com.junmp.junmpProcess.listener;
import com.junmp.junmpProcess.utils.RabbitMQUtils2;
//import com.rabbitmq.client.Channel;
//import com.rabbitmq.client.Connection;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.MessageProperties;
import lombok.SneakyThrows;
import org.flowable.common.engine.api.delegate.event.FlowableEngineEntityEvent;
import org.flowable.common.engine.api.delegate.event.FlowableEngineEventType;
import org.flowable.common.engine.impl.event.FlowableEntityEventImpl;
import org.flowable.engine.delegate.event.AbstractFlowableEngineEventListener;
import org.flowable.task.service.impl.persistence.entity.TaskEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@Component
public class GlobalEndListener extends AbstractFlowableEngineEventListener {
protected Logger logger = LoggerFactory.getLogger(this.getClass());
/**
* @Author: Zhaojw
* @Description: 流程结束监听
* @DateTime: 2023/6/27 13:21
* @Params:
* @Return
*/
@SneakyThrows
@Override
protected void processCompleted(FlowableEngineEntityEvent event) {
//流程结束后工作在这里写
//得到流程定义id
String processDefinitionId = event.getProcessDefinitionId();
//得到流程实例id
String processInstanceId = event.getProcessInstanceId();
/**
* 生产者不需要绑定队列和交换机,只有生产者才需要
*
* 建立连接
* 建立通道
* 推送消息
*/
Connection connection = RabbitMQUtils2.getConnection();
Channel channel = connection.createChannel();
channel.queueDeclare("info",false,false,false,null);
channel.basicPublish("", "info", MessageProperties.PERSISTENT_TEXT_PLAIN,("publish").getBytes());
RabbitMQUtils2.closeChannelAndConnection(connection,channel);
}
}
package com.junmp.junmpProcess.listener;
import org.flowable.engine.RepositoryService;
import org.flowable.engine.delegate.DelegateExecution;
import org.flowable.engine.delegate.ExecutionListener;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import static com.junmp.junmpProcess.common.CommonConstants.BUSINESS_STATUS_4;
import static com.junmp.junmpProcess.common.CommonConstants.PROCESS_STATUS;
/**
* @author LoveMyOrange
* @create 2022-10-15 19:47
*/
@Component
public class ProcessListener implements ExecutionListener {
@Resource
private RepositoryService repositoryService;
@Override
public void notify(DelegateExecution execution) {
execution.setVariable(PROCESS_STATUS, BUSINESS_STATUS_4);
}
}
package com.junmp.junmpProcess.listener;
import org.flowable.engine.RepositoryService;
import org.flowable.engine.delegate.DelegateExecution;
import org.flowable.engine.delegate.ExecutionListener;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
/**
* @author LoveMyOrange
* @create 2022-10-15 19:47
*/
@Component
public class ServiceListener implements ExecutionListener {
@Resource
private RepositoryService repositoryService;
@Override
public void notify(DelegateExecution execution) {
}
}
//package com.junmp.junmpProcess.listener;
//
//import org.flowable.engine.RepositoryService;
//import org.flowable.engine.RuntimeService;
//import org.flowable.engine.TaskService;
//import org.flowable.engine.delegate.TaskListener;
//import org.flowable.task.service.delegate.DelegateTask;
//import com.junmp.junmpProcess.utils.SpringContextHolder;
//import org.springframework.stereotype.Component;
//
//import javax.annotation.Resource;
//
///**
// * @author LoveMyOrange
// * @create 2022-10-15 14:51
// */
//@Component
//public class TaskCreatedListener implements TaskListener {
// @Resource
// private TaskService taskService;
// @Resource
// private RepositoryService repositoryService;
//
// @Override
// public void notify(DelegateTask delegateTask) {
// String taskDefinitionKey = delegateTask.getTaskDefinitionKey();
// if ("root".equalsIgnoreCase(taskDefinitionKey)) {
// taskService.complete(delegateTask.getId());
// } else {
// if ("100000".equals(delegateTask.getAssignee())) {
// Object autoRefuse = delegateTask.getVariable("autoRefuse");
// if (autoRefuse == null) {
// taskService.addComment(delegateTask.getId(), delegateTask.getProcessInstanceId(), "opinion", "审批人为空,自动通过");
// taskService.complete(delegateTask.getId());
// } else {
// taskService.addComment(delegateTask.getId(), delegateTask.getProcessInstanceId(), "opinion", "审批人为空,自动驳回");
// RuntimeService runtimeService = SpringContextHolder.getBean(RuntimeService.class);
// runtimeService.deleteProcessInstance(delegateTask.getProcessInstanceId(), "审批人为空,自动驳回");
// }
// }
// }
// }
//}
package com.junmp.junmpProcess.listener;
import lombok.extern.slf4j.Slf4j;
import org.flowable.engine.RepositoryService;
import org.flowable.engine.delegate.DelegateExecution;
import org.flowable.engine.delegate.ExecutionListener;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
/**
* @author LoveMyOrange
* @create 2022-10-15 19:47
*/
@Component
@Slf4j
public class TimerListener implements ExecutionListener {
@Resource
private RepositoryService repositoryService;
@Override
public void notify(DelegateExecution execution) {
log.info("========");
System.err.println("exection触发了");
}
}
package com.junmp.junmpProcess.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import com.junmp.junmpProcess.entity.Departments;
/**
* @author : willian fu
* @version : 1.0
*/
@Mapper
public interface DepartmentsMapper extends BaseMapper<Departments> {
}
package com.junmp.junmpProcess.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import com.junmp.junmpProcess.entity.FormGroups;
/**
* @author : willian fu
* @date : 2020/9/21
*/
@Mapper
public interface FormGroupsMapper extends BaseMapper<FormGroups> {
}
package com.junmp.junmpProcess.mapper;
import com.junmp.junmpProcess.dto.UserListDTO;
import com.junmp.junmpProcess.entity.TemplateGroupBo;
import com.junmp.v2.sys.api.UserServiceApi;
import com.junmp.v2.sys.api.bean.user.dto.RoleUserDto;
import com.junmp.v2.sys.api.bean.user.vo.QueryUserInfoVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import java.util.List;
@Mapper
public interface OrgUserMapper {
/**
* 查询所有表单及组
*
* @return
*/
public List<UserListDTO> QueryUserByRoleId(String roleId);
/**
* @Author: Zhaojw
* @Description:根据组织机构和角色查找所有相关用户
* @DateTime: 2023/6/27 13:50
* @Params:
* @Return
*/
public List<UserListDTO> QueryUserByRoleIdAndOrg(String roleId,String orgId);
}
package com.junmp.junmpProcess.mapper;//package org.jeecg.junmpProcess.mapper;
//
//
//import com.baomidou.mybatisplus.core.mapper.BaseMapper;
//import org.apache.ibatis.annotations.Mapper;
//
//@Mapper
//public interface ProcessMapper extends BaseMapper<Process> {
//}
package com.junmp.junmpProcess.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import com.junmp.junmpProcess.entity.ProcessTemplates;
/**
* @author : willian fu
* @date : 2020/9/21
*/
@Mapper
public interface ProcessTemplatesMapper extends BaseMapper<ProcessTemplates> {
}
package com.junmp.junmpProcess.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import com.junmp.junmpProcess.entity.TemplateGroup;
import com.junmp.junmpProcess.entity.TemplateGroupBo;
import java.util.List;
/**
* @author : willian fu
* @date : 2020/9/21
*/
@Mapper
public interface TemplateGroupMapper extends BaseMapper<TemplateGroup> {
/**
* 查询所有表单及组
*
* @return
*/
@Select("SELECT pt.template_id, pt.remark, pt.is_stop, pt.updated, pt.form_name, \n" +
" pt.icon, pt.background FROM process_templates pt ORDER BY updated desc")
List<TemplateGroupBo> getAllFormAndGroups();
}
package com.junmp.junmpProcess.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import com.junmp.junmpProcess.entity.Users;
/**
* @author : willian fu
* @version : 1.0
*/
@Mapper
public interface UsersMapper extends BaseMapper<Users> {
}
package com.junmp.junmpProcess.service.Bussiness;
/**
* @author : willian fu
* @version : 1.0
*/
public interface OrgUserAndDeptService {
/**
* 查询组织架构树
*
* @param deptId 部门id
* @return 组织架构树数据
*/
Object getOrgTreeData(Integer deptId, String type);
/**
* 模糊搜索用户
*
* @param userName 用户名/拼音/首字母
* @return 匹配到的用户
*/
Object getOrgTreeUser(String userName);
}
//package com.junmp.junmpProcess.service.Bussiness;
//
//import com.junmp.junmpProcess.dto.FlowEngineDTO;
//import com.junmp.junmpProcess.entity.ProcessTemplates;
//import com.junmp.junmpProcess.vo.TemplateGroupVo;
//
//import java.lang.reflect.InvocationTargetException;
//import java.util.List;
//
///**
// * @author : willian fu
// * @date : 2020/9/21
// */
//public interface SettingService {
//
// /**
// * 查询表单组
// *
// * @return 表单组数据
// */
// Object getFormGroups(String token, String name);
//
// /**
// * 表单及分组排序
// *
// * @param groups 分组数据
// * @return 排序结果
// */
// Object formGroupsSort(List<TemplateGroupVo> groups);
//
// /**
// * 查询表单模板数据
// *
// * @param templateId 模板id
// * @return 模板详情数据
// */
// Object getFormTemplateById(String templateId);
//
// /**
// * 修改分组
// *
// * @param id 分组ID
// * @param name 分组名
// * @return 修改结果
// */
// Object updateFormGroupName(Integer id, String name);
//
// /**
// * 新增表单分组
// *
// * @param name 分组名
// * @return 添加结果
// */
// Object createFormGroup(String name);
//
// /**
// * 删除分组
// *
// * @param id 分组ID
// * @return 删除结果
// */
// Object deleteFormGroup(Integer id);
//
// /**
// * 编辑表单
// *
// * @param templateId 摸板ID
// * @param type 类型 stop using delete
// * @return 操作结果
// */
// Object updateForm(String templateId, String type, Integer groupId);
//
// /**
// * 编辑表单详情
// *
// * @param template 表单模板信息
// * @return 修改结果
// */
// Object updateFormDetail(ProcessTemplates template);
//
//
// /**
// * 保存表单
// *
// * @param
// * @throws InvocationTargetException
// * @throws IllegalAccessException
// */
// void jsonToBpmn(FlowEngineDTO flowEngineDTO) throws InvocationTargetException, IllegalAccessException;
//}
package com.junmp.junmpProcess.service.Bussiness;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.junmp.junmpProcess.common.Result;
import com.junmp.junmpProcess.dto.ApplyDTO;
import com.junmp.junmpProcess.dto.HandleDataDTO;
import com.junmp.junmpProcess.dto.StartProcessInstanceDTO;
import com.junmp.junmpProcess.dto.TaskDTO;
import com.junmp.junmpProcess.entity.ProcessTemplates;
import com.junmp.junmpProcess.vo.*;
import com.junmp.jyzb.utils.ResponseResult;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.List;
import java.util.Map;
public interface WorkProcessService {
/**
* 创建表单
*
* @return
*/
ResponseResult createBpmn(ProcessVO processVO) throws JsonProcessingException;
/**
* 编辑表单
*
* @return
*/
ResponseResult updateForm(UpdateProcessVO process) throws JsonProcessingException;
ResponseResult turn(TurnVo turns);
/**
* @Author: Zhaojw
* @Description:
* @DateTime: 2023/6/26 13:05
* @Params:
* @Return
*/
ResponseResult getFormDetail(String templateId);
/**
* 获取用户可见表单
*
* @return
*/
ResponseResult getFormList();
/**
* 通过模板id查看流程信息 会附带流程定义id
*
* @return
*/
Result<ProcessTemplates> detail(String templateId);
/**
* 通过流程定义id启动流程
*
* @return
*/
ResponseResult start(StartProcessInstanceDTO startProcessInstanceDTO);
/**
* 查看我发起的流程
*
* @return
*/
ResponseResult applyList(ApplyDTO applyDTO);
/**
* 查看我的待办
*
* @return
*/
ResponseResult toDoList(TaskDTO taskDTO);
/**
* 查看我的已办
*
* @return
*/
Result<Page<TaskVO>> doneList(@RequestBody TaskDTO taskDTO);
/**
* 同意
*
* @return
*/
ResponseResult agree(HandleDataDTO handleDataDTO);
/**
* 委派
*
* @return
*/
Result delegateTask(HandleDataDTO handleDataDTO);
/**
* 委派人完成的按钮
*
* @return
*/
Result resolveTask(@RequestBody HandleDataDTO handleDataDTO);
/**
* 拒绝
*
* @return
*/
ResponseResult refuse(HandleDataDTO handleDataDTO);
/**
* 撤销按钮
*
* @return
*/
Result revoke(HandleDataDTO handleDataDTO);
/**
* 转办按钮
*
* @return
*/
Result assignee(HandleDataDTO handleDataDTO);
/**
* 退回按钮
*
* @return
*/
Result rollback(HandleDataDTO handleDataDTO);
/**
* 加签按钮
*
* @return
*/
Result addMulti(HandleDataDTO handleDataDTO);
/**
* 查到签上的人
*
* @return
*/
Result<List<MultiVO>> queryMultiUsersInfo(Map<String, Object> map);
/**
* 减签按钮
*
* @return
*/
Result deleteMulti(List<String> executionIds);
/**
* 评论按钮
*
* @return
*/
Result comments(HandleDataDTO handleDataDTO);
/**
* 通过流程实例id查看详情
*
* @return
*/
Result<HandleDataVO> instanceInfo(HandleDataDTO HandleDataDTO);
// /**
// * 上传文件
// * @return
// */
// Result<AttachmentVO> upLoadFile(MultipartFile file, HttpServletRequest request);
// /**
// * 下载文件
// * @return
// */
// void downLoadFile( String name);
}
package com.junmp.junmpProcess.service.Bussiness.impl;
import cn.hutool.core.lang.Validator;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.junmp.junmpProcess.service.Bussiness.OrgUserAndDeptService;
import com.junmp.junmpProcess.service.Repository.DepartmentsService;
import com.junmp.junmpProcess.service.Repository.UserService;
import com.junmp.junmpProcess.common.R;
import com.junmp.junmpProcess.entity.Departments;
import com.junmp.junmpProcess.entity.Users;
import com.junmp.junmpProcess.vo.OrgTreeVo;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import javax.annotation.Resource;
import java.util.*;
/**
* @author : willian fu
* @version : 1.0
*/
@Service
public class OrgUserAndDeptServiceImpl implements OrgUserAndDeptService {
@Resource
private DepartmentsService departmentsService;
@Resource
private UserService userService;
/**
* 查询组织架构树
*
* @param deptId 部门id
* @return 组织架构树数据
*/
@Override
public Object getOrgTreeData(Integer deptId, String type) {
LambdaQueryWrapper<Users> lambdaQueryWrapper = new LambdaQueryWrapper<>();
if (!ObjectUtils.isEmpty(deptId)) {
LambdaQueryWrapper<Departments> departmentsLambdaQueryWrapper = new LambdaQueryWrapper<>();
departmentsLambdaQueryWrapper.eq(Departments::getParentId, deptId);
lambdaQueryWrapper.like(Users::getDepartmentIds, "%" + deptId + "%")
.or()
.like(Users::getDepartmentIds, "%" + deptId + ",%")
.like(Users::getDepartmentIds, "%," + deptId + "%");
List<OrgTreeVo> orgTreeVos = new LinkedList<>();
departmentsService.list(departmentsLambdaQueryWrapper).forEach(dept -> {
orgTreeVos.add(OrgTreeVo.builder()
.id(dept.getDeptId())
.name(dept.getDeptName())
.selected(false)
.type("dept")
.build());
});
userService.list(lambdaQueryWrapper).forEach(user -> {
orgTreeVos.add(OrgTreeVo.builder()
.id(user.getUserId())
.name(user.getUserName())
.avatar(user.getAvatar())
.sex(user.getSex())
.type("user")
.selected(false)
.build());
});
return R.ok(orgTreeVos);
}
List<Users> users = userService.list();
List<Departments> departments = departmentsService.list();
//将人员按部门归类分组
Map<Long, List<Users>> deptUsers = new HashMap<>();
users.forEach(user -> {
for (String did : user.getDepartmentIds().split(",")) {
List<Users> usersList = deptUsers.get(Long.parseLong(did));
if (null == usersList) {
List<Users> list = new ArrayList<>();
list.add(user);
} else {
usersList.add(user);
}
}
});
//将部门及员工进行转换嵌套树形结构
departments.forEach(dept -> {
});
return R.ok(Collections.EMPTY_LIST);
}
/**
* 模糊搜索用户
*
* @param userName 用户名/拼音/首字母
* @return 匹配到的用户
*/
@Override
public Object getOrgTreeUser(String userName) {
LambdaQueryWrapper<Users> lambdaQueryWrapper = new LambdaQueryWrapper<>();
if (Validator.isChinese(userName)) {
lambdaQueryWrapper.like(Users::getUserName, "%" + userName + "%");
} else {
lambdaQueryWrapper.like(Users::getPingyin, "%" + userName + "%");
}
List<OrgTreeVo> list = new LinkedList<>();
userService.list(lambdaQueryWrapper).forEach(user -> {
list.add(OrgTreeVo.builder().type("user")
.sex(user.getSex())
.avatar(user.getAvatar())
.name(user.getUserName())
.id(user.getUserId())
.selected(false).build());
});
return R.ok(list);
}
}
package com.junmp.junmpProcess.service.Bussiness.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.junmp.v2.sys.api.UserServiceApi;
import com.junmp.v2.sys.api.bean.user.OnlineUserDto;
import com.junmp.v2.sys.api.bean.user.SysUserDto;
import com.junmp.v2.sys.api.bean.user.UserLoginInfoDto;
import com.junmp.v2.sys.api.bean.user.dto.RoleUserDto;
import com.junmp.v2.sys.api.bean.user.req.OnlineUserReq;
import com.junmp.v2.sys.api.bean.user.req.SysUserReq;
import com.junmp.v2.sys.api.bean.user.vo.QueryUserInfoVo;
import java.util.Date;
import java.util.List;
import java.util.Set;
public class OrgUserServicelmpl implements UserServiceApi {
@Override
public UserLoginInfoDto getUserLoginInfo(String account) {
return null;
}
@Override
public void updateUserLoginInfo(Long userId, Date date, String ip) {
}
@Override
public Boolean userExist(Long userId) {
return null;
}
@Override
public List<Long> getUserRoleIdList(Long userId) {
return null;
}
@Override
public void deleteUserDataScopeListByOrgIdList(Set<Long> organizationIds) {
}
@Override
public void deleteUserRoleListByRoleId(Long roleId) {
}
@Override
public List<Long> getUserBindDataScope(Long userId) {
return null;
}
@Override
public List<OnlineUserDto> onlineUserList(OnlineUserReq req) {
return null;
}
@Override
public SysUserDto getUserInfoByUserId(Long userId) {
return null;
}
@Override
public List<Long> queryAllUserIdList(SysUserReq req) {
return null;
}
@Override
public List<String> queryAppByUserId(Long userId) {
return null;
}
@Override
public RoleUserDto queryUserByRoleId(Long roleId) {
return null;
}
@Override
public List<QueryUserInfoVo> queryUserByRoleAndOrg(Long roleId, Long orgId) {
return null;
}
}
//package com.junmp.junmpProcess.service.Bussiness.impl;
//
//import cn.hutool.core.collection.CollectionUtil;
//import cn.hutool.core.util.ObjectUtil;
//import com.alibaba.fastjson.JSONObject;
//import com.alibaba.fastjson.TypeReference;
//import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
//import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
//import com.google.common.collect.Lists;
//import com.junmp.junmpProcess.exception.WorkFlowException;
//import com.junmp.junmpProcess.mapper.TemplateGroupMapper;
//import com.junmp.junmpProcess.service.Bussiness.SettingService;
//import com.junmp.junmpProcess.service.Repository.FormGroupService;
//import com.junmp.junmpProcess.service.Repository.ProcessTemplateService;
//import com.junmp.junmpProcess.service.Repository.TemplateGroupService;
//import org.apache.commons.lang3.time.DateFormatUtils;
//import org.flowable.bpmn.BpmnAutoLayout;
//import org.flowable.bpmn.model.*;
//import org.flowable.bpmn.model.Process;
//import org.flowable.engine.RepositoryService;
//import org.flowable.engine.delegate.ExecutionListener;
//import com.junmp.junmpProcess.common.R;
//import com.junmp.junmpProcess.common.WorkFlowConstants;
//import com.junmp.junmpProcess.dto.FlowEngineDTO;
//import com.junmp.junmpProcess.dto.json.ChildNode;
//import com.junmp.junmpProcess.dto.json.SettingsInfo;
//import com.junmp.junmpProcess.entity.FormGroups;
//import com.junmp.junmpProcess.entity.ProcessTemplates;
//import com.junmp.junmpProcess.entity.TemplateGroup;
//import com.junmp.junmpProcess.entity.TemplateGroupBo;
//import com.junmp.junmpProcess.utils.IdWorker;
//import com.junmp.junmpProcess.utils.SpringContextHolder;
//import com.junmp.junmpProcess.vo.TemplateGroupVo;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//import org.springframework.transaction.annotation.Transactional;
//import org.springframework.transaction.interceptor.TransactionAspectSupport;
//
//import javax.annotation.Resource;
//import java.lang.reflect.InvocationTargetException;
//import java.util.*;
//
//import static com.junmp.junmpProcess.utils.BpmnModelUtils.*;
//
///**
// * @author : willian fu
// * @date : 2020/9/21
// */
//@Service
//public class SettingServiceImpl implements SettingService {
//
// @Autowired
// private ProcessTemplateService processTemplateService;
//
// @Autowired
// private TemplateGroupService templateGroupService;
//
// @Autowired
// private FormGroupService formGroupService;
// @Resource
// private IdWorker idWorker;
// @Resource
// private RepositoryService repositoryService;
//
// /**
// * 查询表单组
// *
// * @return 表单组数据
// */
// @Override
// public Object getFormGroups(String token, String name) {
// TemplateGroupMapper templateGroupMapper = SpringContextHolder.getBean(TemplateGroupMapper.class);
// List<TemplateGroupBo> allformAndGroups = templateGroupMapper.getAllFormAndGroups();
// Map<Integer, List<TemplateGroupBo>> coverMap = new LinkedHashMap<>();
// allformAndGroups.forEach(fg -> {
// List<TemplateGroupBo> bos = coverMap.get(fg.getGroupId());
// if (CollectionUtil.isEmpty(bos)) {
// List<TemplateGroupBo> list = new ArrayList<>();
// list.add(fg);
// coverMap.put(fg.getGroupId(), list);
// } else {
// bos.add(fg);
// }
// });
// List<TemplateGroupVo> results = new ArrayList<>();
// coverMap.forEach((key, val) -> {
// List<TemplateGroupVo.Template> templates = new ArrayList<>();
// val.forEach(v -> {
// if (ObjectUtil.isNotNull(v.getTemplateId())) {
// templates.add(TemplateGroupVo.Template.builder()
// .formId(v.getTemplateId())
// .tgId(v.getId())
// .remark(v.getRemark())
// .formName(v.getTemplateName())
// .icon(v.getIcon())
// .isStop(v.getIsStop())
// .updated(DateFormatUtils.format(v.getUpdated(), "yyyy年MM月dd日 HH时:mm分:ss秒"))
// .background(v.getBackground())
// .templateId(v.getTemplateId())
// .logo(JSONObject.parseObject(v.getBackground(), new TypeReference<JSONObject>() {
// }))
// .build());
// }
// });
// results.add(TemplateGroupVo.builder().id(key).name(val.get(0).getGroupName()).items(templates).build());
// });
// return R.ok(results);
// }
//
// /**
// * 表单及分组排序
// *
// * @param groups 分组数据
// * @return 排序结果
// */
// @Override
// @Transactional
// public Object formGroupsSort(List<TemplateGroupVo> groups) {
// int i = 0, j = 0;
// try {
// for (TemplateGroupVo group : groups) {
// formGroupService.updateById(FormGroups.builder()
// .groupId(group.getId())
// .sortNum(group.getId().equals(0) ? 999999 : i + 2)
// .build());
// for (TemplateGroupVo.Template item : group.getItems()) {
// templateGroupService.updateById(
// TemplateGroup.builder()
// .id(item.getTgId())
// .groupId(group.getId())
// .templateId(item.getFormId())
// .sortNum(j + 1).build());
// j++;
// }
// i++;
// j = 0;
// }
// } catch (Exception e) {
// TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
// return R.badRequest("排序异常 " + e.getMessage());
// }
// return R.ok("排序成功");
// }
//
// /**
// * 查询表单模板数据
// *
// * @param templateId 模板id
// * @return 模板详情数据
// */
// @Override
// public Object getFormTemplateById(String templateId) {
// ProcessTemplates processTemplates = processTemplateService.getById(templateId);
// processTemplates.setLogo(processTemplates.getIcon());
// processTemplates.setFormId(processTemplates.getTemplateId());
// processTemplates.setFormName(processTemplates.getTemplateName());
// return R.ok(processTemplates);
// }
//
// /**
// * 修改分组
// *
// * @param id 分组ID
// * @param name 分组名
// * @return 修改结果
// */
// @Override
// public Object updateFormGroupName(Integer id, String name) {
// if (id < 2) {
// return R.badRequest("基础分组不允许修改");
// }
// formGroupService.updateById(FormGroups.builder()
// .groupId(id).groupName(name.trim()).build());
// return R.ok("修改成功");
// }
//
// /**
// * 新增表单分组
// *
// * @param name 分组名
// * @return 添加结果
// */
// @Override
// public Object createFormGroup(String name) {
// LambdaQueryWrapper<FormGroups> lambdaQueryWrapper = new LambdaQueryWrapper<>();
// lambdaQueryWrapper.eq(FormGroups::getGroupName, name);
// if (formGroupService.count(lambdaQueryWrapper) > 0) {
// return R.badRequest("分组名称 [" + name + "] 已存在");
// }
// Date date = new Date();
// FormGroups formGroups = FormGroups.builder().groupName(name)
// .sortNum(1).created(date)
// .updated(date).build();
// formGroupService.save(
// formGroups);
// return R.ok("添加分组 " + name + " 成功");
// }
//
// /**
// * 删除分组
// *
// * @param id 分组ID
// * @return 删除结果
// */
// @Override
// @Transactional
// public Object deleteFormGroup(Integer id) {
// if (id < 2) {
// return R.badRequest("基础分组不允许删除");
// }
// LambdaUpdateWrapper<TemplateGroup> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
// lambdaUpdateWrapper.set(TemplateGroup::getGroupId, 1);
// lambdaUpdateWrapper.eq(TemplateGroup::getGroupId, id);
// templateGroupService.update(lambdaUpdateWrapper);
// formGroupService.removeById(id);
// return R.ok("删除分组成功");
// }
//
// /**
// * 编辑表单
// *
// * @param templateId 摸板ID
// * @param type 类型 stop using delete
// * @return 操作结果
// */
// @Override
// @Transactional
// public Object updateForm(String templateId, String type, Integer groupId) {
// boolean isStop = "stop".equals(type);
//
//
// ProcessTemplates build = ProcessTemplates.builder().templateId(templateId).isStop(isStop)
// .build();
// if ("using".equals(type) || isStop) {
// processTemplateService.updateById(
// ProcessTemplates.builder().templateId(templateId).isStop(isStop).build());
// LambdaUpdateWrapper<TemplateGroup> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
// lambdaUpdateWrapper.eq(TemplateGroup::getTemplateId, templateId);
// lambdaUpdateWrapper.set(TemplateGroup::getGroupId, isStop ? 0 : 1);
// templateGroupService
// .update(lambdaUpdateWrapper);
// } else if ("delete".equals(type)) {
// processTemplateService.removeById(templateId);
// LambdaQueryWrapper<TemplateGroup> lambdaQueryWrapper = new LambdaQueryWrapper<>();
// lambdaQueryWrapper.eq(TemplateGroup::getTemplateId, templateId);
// templateGroupService.remove(lambdaQueryWrapper);
// } else if ("move".equals(type)) {
// if (ObjectUtil.isNull(groupId)) {
// return R.badRequest("分组ID必传");
// }
//
// LambdaUpdateWrapper<TemplateGroup> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
// lambdaUpdateWrapper.eq(TemplateGroup::getTemplateId, templateId);
// lambdaUpdateWrapper.set(TemplateGroup::getGroupId, groupId);
// templateGroupService.update(lambdaUpdateWrapper);
// } else {
// return R.badRequest("不支持的操作");
// }
// return R.ok("操作成功");
// }
//
// /**
// * 编辑表单详情
// *
// * @param template 表单模板信息
// * @return 修改结果
// */
// @Override
// @Transactional(rollbackFor = Exception.class)
// public Object updateFormDetail(ProcessTemplates template) {
// SettingsInfo settingsInfo = JSONObject.parseObject(template.getSettings(), new TypeReference<SettingsInfo>() {
// });
// ProcessTemplates processTemplates = processTemplateService.getById(template.getFormId());
// processTemplates.setTemplateName(template.getFormName());
// processTemplates.setGroupId(template.getGroupId());
// processTemplates.setFormItems(template.getFormItems());
// processTemplates.setSettings(template.getSettings());
// processTemplates.setProcess(template.getProcess());
// processTemplates.setIcon(template.getIcon());
// processTemplates.setBackground(template.getBackground());
// processTemplates.setNotify(settingsInfo.getNotify().toJSONString());
// String adminInfo = JSONObject.toJSONString(settingsInfo.getAdmin());
// processTemplates.setWhoCommit(adminInfo);
//
// processTemplates.setWhoEdit(adminInfo);
// processTemplates.setWhoExport(adminInfo);
// processTemplates.setRemark(template.getRemark());
// processTemplates.setUpdated(new Date());
// processTemplateService.updateById(processTemplates);
// ChildNode childNode = JSONObject.parseObject(template.getProcess(), new TypeReference<ChildNode>() {
// });
// JSONObject jsonObject = new JSONObject();
// jsonObject.put("processJson", template.getProcess());
// jsonObject.put("formJson", template.getFormItems());
// BpmnModel bpmnModel = assemBpmnModel(jsonObject, childNode, template.getRemark(),
// template.getFormName(), template.getGroupId(), template.getFormId());
// repositoryService.createDeployment()
// .addBpmnModel(template.getFormName() + ".bpmn", bpmnModel)
// .name(template.getFormName())
// .category(template.getGroupId() + "")
// .deploy();
// return R.ok("发布更新后的表单成功");
// }
//
// @Transactional(rollbackFor = Exception.class)
// @Override
// public void jsonToBpmn(FlowEngineDTO flowEngineDTO) throws InvocationTargetException, IllegalAccessException {
// String processJson = flowEngineDTO.getProcess();
// ChildNode childNode = JSONObject.parseObject(processJson, new TypeReference<ChildNode>() {
// });
// String settingsJson = flowEngineDTO.getSettings();
// SettingsInfo settingsInfo = JSONObject.parseObject(settingsJson, new TypeReference<SettingsInfo>() {
// });
// String remark = flowEngineDTO.getRemark();
// String formItems = flowEngineDTO.getFormItems();
// String formName = flowEngineDTO.getFormName();
// String logo = flowEngineDTO.getLogo();
// Integer groupId = flowEngineDTO.getGroupId();
// String templateId = idWorker.nextId() + "";
//
// ProcessTemplates processTemplates = ProcessTemplates.builder().build();
// processTemplates.setTemplateId(templateId);
// processTemplates.setTemplateName(formName);
// processTemplates.setGroupId(groupId);
// processTemplates.setFormItems(formItems);
// processTemplates.setProcess(processJson);
// processTemplates.setIcon(logo);
// processTemplates.setBackground(logo);
// processTemplates.setNotify(settingsInfo.getNotify().toJSONString());
// String adminInfo = JSONObject.toJSONString(settingsInfo.getAdmin());
// processTemplates.setSettings(settingsJson);
// processTemplates.setWhoCommit(adminInfo);
// processTemplates.setWhoEdit(adminInfo);
// processTemplates.setWhoExport(adminInfo);
// processTemplates.setRemark(flowEngineDTO.getRemark());
// processTemplates.setIsStop(false);
// Date date = new Date();
// processTemplates.setCreated(date);
// processTemplates.setUpdated(date);
// processTemplateService.save(processTemplates);
// TemplateGroup templateGroup = new TemplateGroup();
// templateGroup.setTemplateId(processTemplates.getTemplateId());
// templateGroup.setGroupId(groupId);
// templateGroup.setSortNum(0);
// templateGroup.setCreated(date);
// templateGroupService.save(templateGroup);
//
// JSONObject jsonObject = new JSONObject();
// jsonObject.put("processJson", processJson);
// jsonObject.put("formJson", formItems);
// BpmnModel bpmnModel = assemBpmnModel(jsonObject, childNode, remark, formName, groupId,
// templateId);
// repositoryService.createDeployment()
// .addBpmnModel(formName + ".bpmn", bpmnModel)
// .name(formName)
// .category(groupId + "")
// .deploy();
//
//
// }
//
// private BpmnModel assemBpmnModel(JSONObject jsonObject, ChildNode childNode, String remark,
// String formName, Integer groupId, String templateId) {
// BpmnModel bpmnModel = new BpmnModel();
// List<SequenceFlow> sequenceFlows = Lists.newArrayList();
// Map<String, ChildNode> childNodeMap = new HashMap<>();
// bpmnModel.setTargetNamespace(groupId + "");
// ExtensionAttribute extensionAttribute = new ExtensionAttribute();
// extensionAttribute.setName("DingDing");
// extensionAttribute.setNamespace("http://flowable.org/bpmn");
// extensionAttribute.setValue(jsonObject.toJSONString());
// Process process = new Process();
// process.setId(WorkFlowConstants.PROCESS_PREFIX + templateId);
// process.setName(formName);
// process.setDocumentation(remark);
// process.addAttribute(extensionAttribute);
// bpmnModel.addProcess(process);
//
// StartEvent startEvent = createStartEvent();
// process.addFlowElement(startEvent);
// String lastNode = null;
// try {
// lastNode = create(startEvent.getId(), childNode, process, bpmnModel, sequenceFlows, childNodeMap);
// } catch (InvocationTargetException e) {
// e.printStackTrace();
// throw new WorkFlowException("操作失败");
// } catch (IllegalAccessException e) {
// e.printStackTrace();
// throw new WorkFlowException("操作失败");
// }
// EndEvent endEvent = createEndEvent();
// process.addFlowElement(endEvent);
// process.addFlowElement(connect(lastNode, endEvent.getId(), sequenceFlows, childNodeMap, process));
// List<FlowableListener> executionListeners = new ArrayList<>();
// FlowableListener flowableListener = new FlowableListener();
// flowableListener.setEvent(ExecutionListener.EVENTNAME_END);
// flowableListener.setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_DELEGATEEXPRESSION);
// flowableListener.setImplementation("${processListener}");
// executionListeners.add(flowableListener);
// process.setExecutionListeners(executionListeners);
// new BpmnAutoLayout(bpmnModel).execute();
// return bpmnModel;
// }
//}
package com.junmp.junmpProcess.service.Bussiness.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.collect.Lists;
import com.junmp.junmpProcess.common.R;
import com.junmp.junmpProcess.dto.*;
import com.junmp.junmpProcess.dto.json.*;
import com.junmp.junmpProcess.entity.TemplateGroupBo;
import com.junmp.junmpProcess.exception.WorkFlowException;
import com.junmp.junmpProcess.mapper.TemplateGroupMapper;
import com.junmp.junmpProcess.service.Bussiness.WorkProcessService;
import com.junmp.junmpProcess.service.Repository.ProcessTemplateService;
import com.junmp.junmpProcess.utils.IdWorker;
import com.junmp.junmpProcess.utils.SpringContextHolder;
import com.junmp.junmpProcess.vo.*;
import com.junmp.jyzb.utils.HttpStatus;
import com.junmp.jyzb.utils.ResponseResult;
import com.junmp.jyzb.utils.ReturnMsg;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.flowable.bpmn.BpmnAutoLayout;
import org.flowable.bpmn.converter.BpmnXMLConverter;
import org.flowable.bpmn.model.*;
import org.flowable.bpmn.model.Process;
import org.flowable.common.engine.impl.identity.Authentication;
import org.flowable.engine.HistoryService;
import org.flowable.engine.RepositoryService;
import org.flowable.engine.RuntimeService;
import org.flowable.engine.TaskService;
import org.flowable.engine.delegate.ExecutionListener;
import org.flowable.engine.history.HistoricActivityInstance;
import org.flowable.engine.history.HistoricProcessInstance;
import org.flowable.engine.impl.persistence.entity.ExecutionEntity;
import org.flowable.engine.repository.Deployment;
import org.flowable.engine.repository.ProcessDefinition;
import org.flowable.engine.runtime.Execution;
import org.flowable.engine.runtime.ProcessInstance;
import org.flowable.engine.runtime.ProcessInstanceBuilder;
import org.flowable.engine.task.Attachment;
import org.flowable.engine.task.Comment;
import org.flowable.task.api.DelegationState;
import org.flowable.task.api.Task;
import org.flowable.task.api.history.HistoricTaskInstance;
import com.junmp.junmpProcess.common.Result;
import com.junmp.junmpProcess.common.WorkFlowConstants;
import com.junmp.junmpProcess.dto.json.flowJson.FlowChildNode;
import com.junmp.junmpProcess.dto.json.flowJson.Inout;
import com.junmp.junmpProcess.entity.ProcessTemplates;
import org.flowable.task.service.impl.persistence.entity.TaskEntity;
import org.flowable.task.service.impl.persistence.entity.TaskEntityImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.junmp.junmpProcess.utils.BpmnConvert;
import javax.annotation.Resource;
import java.util.*;
import java.util.stream.Collectors;
import static com.junmp.junmpProcess.common.CommonConstants.*;
import static com.junmp.junmpProcess.common.WorkFlowConstants.PROCESS_PREFIX;
import static com.junmp.junmpProcess.utils.BpmnConvert.toBpmn;
import static com.junmp.junmpProcess.utils.BpmnModelUtils.*;
@Service
public class WorkProcessServiceImpl implements WorkProcessService {
@Autowired
private ProcessTemplateService processTemplateService;
@Resource
private RepositoryService repositoryService;
@Resource
private RuntimeService runtimeService;
@Resource
private HistoryService historyService;
@Resource
private TaskService taskService;
@Resource
private IdWorker idWorker;
/**
* 创建子任务
*
* @param ptask 创建子任务
* @param assignee 子任务的执行人
* @return
*/
protected TaskEntity createSubTask(TaskEntity ptask, String ptaskId, String assignee) {
TaskEntity task = null;
if (ptask != null) {
//1.生成子任务
task = (TaskEntity) taskService.newTask(UUID.randomUUID().toString());
task.setCategory(ptask.getCategory());
task.setDescription(ptask.getDescription());
task.setTenantId(ptask.getTenantId());
task.setAssignee(assignee);
task.setName(ptask.getName());
task.setParentTaskId(ptaskId);
task.setProcessDefinitionId(ptask.getProcessDefinitionId());
task.setProcessInstanceId(ptask.getProcessInstanceId());
task.setTaskDefinitionKey(ptask.getTaskDefinitionKey());
task.setTaskDefinitionId(ptask.getTaskDefinitionId());
task.setPriority(ptask.getPriority());
task.setCreateTime(new Date());
taskService.saveTask(task);
}
return task;
}
public ResponseResult turn(TurnVo turns)
{
TaskEntityImpl currTask = (TaskEntityImpl) taskService.createTaskQuery().taskId(turns.getTaskId()).singleResult();
if (currTask != null) {
//1.生成历史记录
TaskEntity task =this.createSubTask(currTask,currTask.getId(),turns.getUserId());
//2.添加审批意见
// this.addComment(task.getId(), turnTaskVo.getUserCode(), turnTaskVo.getProcessInstanceId(), CommentTypeEnum.ZB.toString(), turnTaskVo.getMessage());
taskService.saveTask(task);
taskService.complete(task.getId());
//3.转办
taskService.setAssignee(turns.getTaskId(), turns.getUserId());
String[] assigneeList=turns.getAssigneeList();
for (String owner :assigneeList
) {
taskService.setOwner(turns.getTaskId(), owner);
}
return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS,"转办成功");
} else {
return new ResponseResult(HttpStatus.NO_SUCH_PROCESS,ReturnMsg.PASS,"没有运行时的任务实例,请确认!");
}
}
public ResponseResult getFormList()
{
TemplateGroupMapper templateGroupMapper = SpringContextHolder.getBean(TemplateGroupMapper.class);
List<TemplateGroupBo> allformAndGroups = templateGroupMapper.getAllFormAndGroups();
Map<Integer, List<TemplateGroupBo>> coverMap = new LinkedHashMap<>();
allformAndGroups.forEach(fg -> {
List<TemplateGroupBo> bos = coverMap.get(fg.getGroupId());
if (CollectionUtil.isEmpty(bos)) {
List<TemplateGroupBo> list = new ArrayList<>();
list.add(fg);
coverMap.put(fg.getGroupId(), list);
} else {
bos.add(fg);
}
});
List<TemplateGroupVo> results = new ArrayList<>();
coverMap.forEach((key, val) -> {
List<TemplateGroupVo.Template> templates = new ArrayList<>();
val.forEach(v -> {
if (ObjectUtil.isNotNull(v.getTemplateId())) {
String defId="";
ProcessDefinition ProDef=repositoryService.createProcessDefinitionQuery()
.processDefinitionKey("Process_"+v.getTemplateId())
.latestVersion()
.singleResult();
if(ProDef!=null)
{
defId=ProDef.getId();
}
templates.add(TemplateGroupVo.Template.builder()
.formId(v.getTemplateId())
.remark(v.getRemark())
.formName(v.getFormName())
.isStop(v.getIsStop())
.updated(DateFormatUtils.format(v.getUpdated(),"yyyy年MM月dd日 HH时:mm分:ss秒"))
.templateId(v.getTemplateId())
.processDefinitionId(defId)
.build());
}
});
results.add(TemplateGroupVo.builder().items(templates).build());
});
return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS,results.get(0));
}
public ResponseResult createBpmn(ProcessVO processVO) throws JsonProcessingException {
//流程定义
ObjectMapper objectMapper = new ObjectMapper();
JsonNode processJsonNode = objectMapper.readTree(processVO.getProcessJson());
JsonNode formJsonNode = objectMapper.readTree(processVO.getFormJson());
String formName=processVO.getFormName().toString();
ProcessTemplates processTemplates = ProcessTemplates.builder().build();
String templateId = idWorker.nextId()+"";
processTemplates.setTemplateId(templateId);
processTemplates.setFormJson(formJsonNode.toString());
processTemplates.setProcessJson(processJsonNode.toString());
processTemplates.setFormName(processVO.getFormName());
processTemplates.setIsStop(false);
Date date= new Date();
processTemplates.setCreated(date);
processTemplates.setUpdated(date);
processTemplateService.save(processTemplates);
//将json转换为bpmn
BpmnModel bpmnModel = toBpmn(processJsonNode,formJsonNode,formName,templateId);
Deployment deploy = repositoryService.createDeployment()
.addBpmnModel(processVO.getFormName()+".bpmn20.xml", bpmnModel)
.name(processVO.getFormName())
.deploy();
return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS,deploy.getId());
}
/**
* 编辑表单详情
*
* @return 修改结果
*/
@Transactional
public ResponseResult updateForm(UpdateProcessVO process) throws JsonProcessingException {
ObjectMapper objectMapper = new ObjectMapper();
JsonNode processJsonNode = objectMapper.readTree(process.getProcessJson());
JsonNode formJsonNode = objectMapper.readTree(process.getFormJson());
String formName=process.getFormName().toString();
String templateId = idWorker.nextId()+"";
ProcessTemplates processTemplates = processTemplateService.getById(process.getFormId());
processTemplates.setFormName(process.getFormName());
processTemplates.setFormJson(process.getFormJson());
processTemplates.setProcessJson(process.getProcessJson());
processTemplates.setUpdated(new Date());
processTemplateService.updateById(processTemplates);//更新表单明细表信息
BpmnModel bpmnModel = toBpmn(processJsonNode,formJsonNode,formName,templateId);
Deployment deploy = repositoryService.createDeployment()
.addBpmnModel(process.getFormName()+".bpmn20.xml", bpmnModel)
.name(process.getFormName())
.deploy();
return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS,"");
}
@Override
public ResponseResult getFormDetail(String templateId) {
ProcessTemplates processTemplates = processTemplateService.getById(templateId);
processTemplates.setLogo(processTemplates.getIcon());
processTemplates.setFormId(processTemplates.getTemplateId());
processTemplates.setFormName(processTemplates.getFormName());
Object aa= repositoryService.createProcessDefinitionQuery();
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionKey("Process_"+templateId).latestVersion().singleResult();
if(processDefinition==null){
throw new WorkFlowException("该流程暂未接入Flowable,请重试");
}
processTemplates.setProcessDefinitionId(processDefinition.getId());
return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS,processTemplates);
}
/**
* 绘制节点
*
* @param process bpmn process 图纸
* @param node json的节点
* @param preId 上一节点id
* @param endId 结束节点
* @param preExpression 上一节点表达式
*/
public void drawNode(Process process, JsonNode node, String preId, String endId, String preExpression) {
// 根据type绘制不同种类的节点
Inout inout = drawNodeByType(process, node);
// 绘制前一根线
process.addFlowElement(createSequenceFlow(preId, inout.getIn(), preExpression));
if (node.get("childNode").toString().equals("null")) {
// 没有下一步, 绘制指向结束的线
process.addFlowElement(createSequenceFlow(inout.getOut(), endId, null));
} else {
// 有下一步, 递归绘制下一个节点
drawNode(process, node.get("childNode"), inout.getOut(), endId, null);
}
}
/**
* 绘制不同种类节点
*
* @param process
* @param node
* @return
*/
private Inout drawNodeByType(Process process, JsonNode node) {
if (node.get("type").toString().equals("0")) {//根节点或起始节点
return drawRootNode(process, node);
} else if (node.get("type").toString().equals("1")) {//审核节点
return drawAuditNode(process, node);
} else if (node.get("type").toString().equals("3")) {//分支节点
return drawExclusiveNode(process, node);
} else if (node.get("type").toString().equals("4")) {//分支节点
return drawExclusiveNode(process, node);
} else {
throw new IllegalArgumentException();
}
}
/**
* 绘制分支节点
*
* @param process
* @param node
* @return
*/
private Inout drawExclusiveNode(Process process, JsonNode node) {
// 开始网关
String startId = "Exclusive_" + UUID.randomUUID();
ExclusiveGateway startGateway = new ExclusiveGateway();
startGateway.setId(startId);
process.addFlowElement(startGateway);
// 结束网关
String endId = "Exclusive_" + UUID.randomUUID();
ExclusiveGateway endGateway = new ExclusiveGateway();
endGateway.setId(endId);
process.addFlowElement(endGateway);
// int和out不一样
return new Inout(startId, endId);
}
/**
* 创建连线
*
* @param from
* @param to
* @return
*/
public SequenceFlow createSequenceFlow(String from, String to, String conditionExpression) {
SequenceFlow flow = new SequenceFlow();
flow.setId(from + "-" + to);
flow.setSourceRef(from);
flow.setTargetRef(to);
if (conditionExpression != null) {
flow.setConditionExpression(conditionExpression);
}
return flow;
}
/**
* 绘制根节点
*
* @param process
* @param node
* @return
*/
private Inout drawRootNode(Process process, JsonNode node) {
String id = "Node_" + UUID.randomUUID();
// 如果当前任务还有后续任务,则遍历创建后续任务
JsonNode nextNode = node.get("childNode");
UserTask userTask = new UserTask();
userTask.setName(node.get("name").toString());
userTask.setId(id);
process.addFlowElement(userTask);
return new Inout(id, id);
}
private static String createSimpleUserTask(JSONObject flowNode, Process process, List<SequenceFlow> sequenceFlows) {
List<String> incoming = flowNode.getJSONArray("incoming").toJavaList(String.class);
// 自动生成id
String id = id("userTask");
if (incoming != null && !incoming.isEmpty()) {
UserTask userTask = new UserTask();
userTask.setName(flowNode.getString("name"));
userTask.setId(id);
process.addFlowElement(userTask);
process.addFlowElement(connect(incoming.get(0), id, sequenceFlows));
}
return id;
}
/**
* 连线
*
* @param from
* @param to
* @param sequenceFlows
* @return
*/
protected static SequenceFlow connect(String from, String to, List<SequenceFlow> sequenceFlows) {
SequenceFlow flow = new SequenceFlow();
flow.setId(id("sequenceFlow"));
flow.setSourceRef(from);
flow.setTargetRef(to);
sequenceFlows.add(flow);
return flow;
}
private static String id(String prefix) {
return prefix + "_" + UUID.randomUUID().toString().replace("-", "").toLowerCase();
}
/**
* 绘制审核节点
*
* @param process
* @param node
* @return
*/
private Inout drawAuditNode(Process process, JsonNode node) {
// 绘制节点
String id = "Node_" + UUID.randomUUID();
UserTask userTask = new UserTask();
userTask.setId(id);
userTask.setName(node.get("name").toString());
// 设置多实例
// userTask.setAssignee("${user}");
MultiInstanceLoopCharacteristics multiInstanceLoopCharacteristics = new MultiInstanceLoopCharacteristics();
// if (node.getAssignee().getMultiMode().equals("顺序审批")) {
// multiInstanceLoopCharacteristics.setSequential(true);
// }
multiInstanceLoopCharacteristics.setElementVariable("user");
// 完成条件
multiInstanceLoopCharacteristics.setCompletionCondition("${nrOfInstances == nrOfCompletedInstances}");
multiInstanceLoopCharacteristics.setInputDataItem("${users}");
userTask.setLoopCharacteristics(multiInstanceLoopCharacteristics);
// 保存json节点配置到扩展属性
Map<String, Object> extensions = new HashMap<>();
extensions.put("node", node);
process.addFlowElement(userTask);
;
return new Inout(id, id);
}
private BpmnModel assemBpmnModel(FlowChildNode childNode,
Integer groupId) {
BpmnModel bpmnModel = new BpmnModel();
List<SequenceFlow> sequenceFlows = Lists.newArrayList();
Map<String, ChildNode> childNodeMap = new HashMap<>();
bpmnModel.setTargetNamespace(groupId + "");
Process process = new Process();
process.setId(WorkFlowConstants.PROCESS_PREFIX);
bpmnModel.addProcess(process);
StartEvent startEvent = createStartEvent();
process.addFlowElement(startEvent);
String lastNode = null;
EndEvent endEvent = createEndEvent();
process.addFlowElement(endEvent);
List<FlowableListener> executionListeners = new ArrayList<>();
FlowableListener flowableListener = new FlowableListener();
flowableListener.setEvent(ExecutionListener.EVENTNAME_END);
flowableListener.setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_DELEGATEEXPRESSION);
flowableListener.setImplementation("${processListener}");
executionListeners.add(flowableListener);
process.setExecutionListeners(executionListeners);
new BpmnAutoLayout(bpmnModel).execute();
return bpmnModel;
}
/**
* 通过模板id查看流程信息 会附带流程定义id
*
* @return
*/
@Override
public Result<ProcessTemplates> detail(String templateId) {
ProcessTemplates processTemplates = processTemplateService.getById(templateId);
processTemplates.setFormId(processTemplates.getTemplateId());
processTemplates.setFormName(processTemplates.getFormName());
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionKey(PROCESS_PREFIX + templateId).latestVersion().singleResult();
if (processDefinition == null) {
throw new WorkFlowException("该流程暂未接入Flowable,请重试");
}
return Result.OK(processTemplates);
}
/**
* 通过流程定义id启动流程
*
* @return
*/
@Override
public ResponseResult start(StartProcessInstanceDTO processInstanceDto) {
try {
JSONObject formData = processInstanceDto.getFormData();
JunmpUserInfo startUserInfo = processInstanceDto.getStartUserInfo();
Map<String,Object> processVariables= new HashMap<>();
processVariables.put(FORM_VAR,formData);
processVariables.put(START_USER_INFO,JSONObject.toJSONString(startUserInfo));
ArrayList<JunmpUserInfo> userInfos = CollUtil.newArrayList(startUserInfo);
Map formValue = JSONObject.parseObject(formData.toJSONString(), new TypeReference<Map>() {
});
processVariables.putAll(formValue);
ProcessInstanceBuilder processInstanceBuilder = runtimeService.createProcessInstanceBuilder();
ProcessInstance processInstance = processInstanceBuilder
.processDefinitionId(processInstanceDto.getProcessDefinitionId())
.variable("initiator",startUserInfo.getUserId())
.variables(processVariables)
.businessStatus(BUSINESS_STATUS_1)
.start();
//手动完成第一个任务
Task task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();
Object ts=new Object();
if(task!=null){
taskService.complete(task.getId());
}
return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS,processInstance.getId());
}
catch (Exception e){
Throwable cause = e.getCause();
if(cause instanceof WorkFlowException){
WorkFlowException workFlowException=(WorkFlowException)cause;
return new ResponseResult(HttpStatus.PROCESS_START_ERROR,ReturnMsg.PROCESS_START_ERROR,workFlowException.getMessage());
}
e.printStackTrace();
return new ResponseResult(HttpStatus.PROCESS_START_ERROR,ReturnMsg.PROCESS_START_ERROR,"");
}
}
/**
* 查看我发起的流程
*
* @return
*/
@Override
public ResponseResult applyList(ApplyDTO applyDTO) {
List<HistoricProcessInstance> historicProcessInstances =
historyService.createHistoricProcessInstanceQuery()
.includeProcessVariables()
.startedBy(applyDTO.getCurrentUserInfo().getId())
.orderByProcessInstanceStartTime().desc()
.listPage((applyDTO.getPageNo() - 1) * applyDTO.getPageSize(), applyDTO.getPageSize());
long count = historyService.createHistoricProcessInstanceQuery()
.startedBy(applyDTO.getCurrentUserInfo().getId()).count();
List<HistoryProcessInstanceVO> historyProcessInstanceVOS = new ArrayList<>();
Page<HistoryProcessInstanceVO> page = new Page<>();
for (HistoricProcessInstance historicProcessInstance : historicProcessInstances) {
Map<String, Object> processVariables = historicProcessInstance.getProcessVariables();
HistoryProcessInstanceVO historyProcessInstanceVO = new HistoryProcessInstanceVO();
historyProcessInstanceVO.setProcessInstanceId(historicProcessInstance.getId());
historyProcessInstanceVO.setProcessDefinitionName(historicProcessInstance.getProcessDefinitionName());
historyProcessInstanceVO.setStartUser(JSONObject.parseObject(MapUtil.getStr(processVariables, START_USER_INFO), new TypeReference<UserInfo>() {
}));
historyProcessInstanceVO.setStartTime(historicProcessInstance.getStartTime());
historyProcessInstanceVO.setEndTime(historicProcessInstance.getEndTime());
Boolean flag = historicProcessInstance.getEndTime() == null ? false : true;
historyProcessInstanceVO.setCurrentActivityName(getCurrentName(historicProcessInstance.getId(), flag, historicProcessInstance.getProcessDefinitionId()));
historyProcessInstanceVO.setBusinessStatus(MapUtil.getStr(processVariables, PROCESS_STATUS));
long totalTimes = historicProcessInstance.getEndTime() == null ?
(Calendar.getInstance().getTimeInMillis() - historicProcessInstance.getStartTime().getTime()) :
(historicProcessInstance.getEndTime().getTime() - historicProcessInstance.getStartTime().getTime());
long dayCount = totalTimes / (1000 * 60 * 60 * 24);//计算天
long restTimes = totalTimes % (1000 * 60 * 60 * 24);//剩下的时间用于计于小时
long hourCount = restTimes / (1000 * 60 * 60);//小时
restTimes = restTimes % (1000 * 60 * 60);
long minuteCount = restTimes / (1000 * 60);
String spendTimes = dayCount + "天" + hourCount + "小时" + minuteCount + "分";
historyProcessInstanceVO.setDuration(spendTimes);
historyProcessInstanceVOS.add(historyProcessInstanceVO);
}
page.setRecords(historyProcessInstanceVOS);
page.setCurrent(applyDTO.getPageNo());
page.setSize(applyDTO.getPageSize());
page.setTotal(count);
return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS,page);
}
/**
* 查看我的待办
*
* @return
*/
@Override
public ResponseResult toDoList(TaskDTO taskDTO) {
List<Task> tasks = taskService.createTaskQuery().taskAssignee(taskDTO.getCurrentUserInfo().getUserId())
.includeProcessVariables()
.orderByTaskCreateTime().desc()
.listPage((taskDTO.getPageNo() - 1) * taskDTO.getPageSize(), taskDTO.getPageSize());
long count = taskService.createTaskQuery().taskAssignee(taskDTO.getCurrentUserInfo().getUserId()).count();
List<TaskVO> taskVOS= new ArrayList<>();
Page<TaskVO> page =new Page<>();
// List<String> taskIds= new ArrayList<>();
// for (Task task : tasks) {
// Map<String, Object> processVariables = task.getProcessVariables();
// }
// Map<Long, JunmpUserInfo> collect=new HashMap<>();
for (Task task : tasks) {
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(task.getProcessInstanceId()).singleResult();
BpmnModel bpmnModel = repositoryService.getBpmnModel(task.getProcessDefinitionId());
Map<String, Object> processVariables = task.getProcessVariables();
TaskVO taskVO=new TaskVO();
taskVO.setTaskId(task.getId());
taskVO.setProcessInstanceId(task.getProcessInstanceId());
taskVO.setProcessDefinitionName(bpmnModel.getMainProcess().getName());
taskVO.setStartUser(JSONObject.parseObject(MapUtil.getStr(processVariables,START_USER_INFO),new TypeReference<UserInfo>(){}));
taskVO.setStartTime(processInstance.getStartTime());
taskVO.setCurrentActivityName(getCurrentName(processInstance.getId(),false,processInstance.getProcessDefinitionId()));
taskVO.setBusinessStatus(MapUtil.getStr(processVariables,PROCESS_STATUS));
taskVO.setTaskCreatedTime(task.getCreateTime());
DelegationState delegationState = task.getDelegationState();
if(delegationState!=null){
taskVO.setDelegationState(delegationState);
}
taskVOS.add(taskVO);
}
page.setRecords(taskVOS);
page.setCurrent(taskDTO.getPageNo());
page.setSize(taskDTO.getPageSize());
page.setTotal(count);
return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS,page);
}
/**
* 查看我的已办
*
* @return
*/
@Override
public Result<Page<TaskVO>> doneList(TaskDTO taskDTO) {
List<HistoricTaskInstance> tasks = historyService.createHistoricTaskInstanceQuery()
.taskAssignee(taskDTO.getCurrentUserInfo().getUserId())
.finished()
.includeProcessVariables()
.orderByTaskCreateTime().desc()
.listPage((taskDTO.getPageNo() - 1) * taskDTO.getPageSize(), taskDTO.getPageSize());
long count = historyService.createHistoricTaskInstanceQuery()
.taskAssignee(taskDTO.getCurrentUserInfo().getUserId()).count();
List<TaskVO> taskVOS = new ArrayList<>();
Page<TaskVO> page = new Page<>();
for (HistoricTaskInstance task : tasks) {
HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery().processInstanceId(task.getProcessInstanceId()).singleResult();
Boolean flag = historicProcessInstance.getEndTime() == null ? false : true;
BpmnModel bpmnModel = repositoryService.getBpmnModel(task.getProcessDefinitionId());
Map<String, Object> processVariables = task.getProcessVariables();
TaskVO taskVO = new TaskVO();
taskVO.setTaskId(task.getId());
taskVO.setProcessInstanceId(task.getProcessInstanceId());
taskVO.setProcessDefinitionName(bpmnModel.getMainProcess().getName());
taskVO.setStartUser(JSONObject.parseObject(MapUtil.getStr(processVariables, START_USER_INFO), new TypeReference<UserInfo>() {
}));
taskVO.setStartTime(historicProcessInstance.getStartTime());
taskVO.setCurrentActivityName(getCurrentName(task.getProcessInstanceId(), flag, task.getProcessDefinitionId()));
taskVO.setBusinessStatus(MapUtil.getStr(processVariables, PROCESS_STATUS));
taskVO.setEndTime(task.getEndTime());
long totalTimes = task.getEndTime() == null ?
(Calendar.getInstance().getTimeInMillis() - task.getStartTime().getTime()) :
(task.getEndTime().getTime() - task.getStartTime().getTime());
long dayCount = totalTimes / (1000 * 60 * 60 * 24);//计算天
long restTimes = totalTimes % (1000 * 60 * 60 * 24);//剩下的时间用于计于小时
long hourCount = restTimes / (1000 * 60 * 60);//小时
restTimes = restTimes % (1000 * 60 * 60);
long minuteCount = restTimes / (1000 * 60);
String spendTimes = dayCount + "天" + hourCount + "小时" + minuteCount + "分";
taskVO.setDuration(spendTimes);
taskVOS.add(taskVO);
}
page.setRecords(taskVOS);
page.setCurrent(taskDTO.getPageNo());
page.setSize(taskDTO.getPageSize());
page.setTotal(count);
return Result.OK(page);
}
@Override
public ResponseResult agree(HandleDataDTO handleDataDTO) {
UserInfo currentUserInfo = handleDataDTO.getCurrentUserInfo();
List<AttachmentDTO> attachments = handleDataDTO.getAttachments();
String comments = handleDataDTO.getComments();
JSONObject formData = handleDataDTO.getFormData();
String taskId = handleDataDTO.getTaskId();
String processInstanceId=handleDataDTO.getProcessInstanceId();
Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
if (task!=null)//task为空则说明当前任务可能已结束
{
Map<String, Object> map = new HashMap<>();
if (formData != null && formData.size() > 0) {
Map formValue = JSONObject.parseObject(formData.toJSONString(), new TypeReference<Map>() {
});
map.putAll(formValue);
map.put(FORM_VAR, formData);
}
runtimeService.setVariables(task.getProcessInstanceId(), map);//设置进入当前流程
Authentication.setAuthenticatedUserId(currentUserInfo.getId());
if (StringUtils.isNotBlank(comments)) {
taskService.addComment(task.getId(), task.getProcessInstanceId(), "opinion", comments);
}
if (attachments != null && attachments.size() > 0) {
for (AttachmentDTO attachment : attachments) {
taskService.createAttachment("option", taskId, task.getProcessInstanceId(), attachment.getName(), attachment.getName(), attachment.getUrl());
}
}
if (StringUtils.isNotBlank(handleDataDTO.getSignInfo())) {
taskService.addComment(task.getId(), task.getProcessInstanceId(), "sign", handleDataDTO.getSignInfo());
}
taskService.complete(task.getId());
HistoricTaskInstance historicTask = historyService
.createHistoricTaskInstanceQuery()
.taskId(taskId)
.singleResult();
if (historicTask.getEndTime()!=null)//EndTime为空,说明任务已结束,需要往消息队列中进行消息传递
{
HistoricProcessInstance historicProcessInstance= historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstanceId)
.includeProcessVariables().singleResult();//拿到历史中的表单信息
Map<String, Object> processVariables = historicProcessInstance.getProcessVariables();
JSONObject jsonObject = (JSONObject) processVariables.get(FORM_VAR);
}
return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS,"");
}
else {
return new ResponseResult(HttpStatus.PROCESS_WAS_END,ReturnMsg.PROCESS_WAS_END,"");
}
}
@Override
public Result delegateTask(HandleDataDTO handleDataDTO) {
UserInfo currentUserInfo = handleDataDTO.getCurrentUserInfo();
List<AttachmentDTO> attachments = handleDataDTO.getAttachments();
String comments = handleDataDTO.getComments();
JSONObject formData = handleDataDTO.getFormData();
String taskId = handleDataDTO.getTaskId();
Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
Map<String, Object> map = new HashMap<>();
if (formData != null && formData.size() > 0) {
Map formValue = JSONObject.parseObject(formData.toJSONString(), new TypeReference<Map>() {
});
map.putAll(formValue);
map.put(FORM_VAR, formData);
}
runtimeService.setVariables(task.getProcessInstanceId(), map);
Authentication.setAuthenticatedUserId(currentUserInfo.getId());
if (StringUtils.isNotBlank(comments)) {
taskService.addComment(task.getId(), task.getProcessInstanceId(), "opinion", comments);
}
if (attachments != null && attachments.size() > 0) {
for (AttachmentDTO attachment : attachments) {
taskService.createAttachment("option", taskId, task.getProcessInstanceId(), attachment.getName(), attachment.getName(), attachment.getUrl());
}
}
if (StringUtils.isNotBlank(handleDataDTO.getSignInfo())) {
taskService.addComment(task.getId(), task.getProcessInstanceId(), "sign", handleDataDTO.getSignInfo());
}
UserInfo delegateUserInfo = handleDataDTO.getDelegateUserInfo();
taskService.delegateTask(task.getId(), delegateUserInfo.getId());
return Result.OK();
}
@Override
public Result resolveTask(HandleDataDTO handleDataDTO) {
UserInfo currentUserInfo = handleDataDTO.getCurrentUserInfo();
List<AttachmentDTO> attachments = handleDataDTO.getAttachments();
String comments = handleDataDTO.getComments();
JSONObject formData = handleDataDTO.getFormData();
String taskId = handleDataDTO.getTaskId();
Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
Map<String, Object> map = new HashMap<>();
if (formData != null && formData.size() > 0) {
Map formValue = JSONObject.parseObject(formData.toJSONString(), new TypeReference<Map>() {
});
map.putAll(formValue);
map.put(FORM_VAR, formData);
}
runtimeService.setVariables(task.getProcessInstanceId(), map);
Authentication.setAuthenticatedUserId(currentUserInfo.getId());
if (StringUtils.isNotBlank(comments)) {
taskService.addComment(task.getId(), task.getProcessInstanceId(), "opinion", comments);
}
if (attachments != null && attachments.size() > 0) {
for (AttachmentDTO attachment : attachments) {
taskService.createAttachment("option", taskId, task.getProcessInstanceId(), attachment.getName(), attachment.getName(), attachment.getUrl());
}
}
if (StringUtils.isNotBlank(handleDataDTO.getSignInfo())) {
taskService.addComment(task.getId(), task.getProcessInstanceId(), "sign", handleDataDTO.getSignInfo());
}
taskService.resolveTask(taskId);
return Result.OK();
}
@Override
public ResponseResult refuse(HandleDataDTO handleDataDTO) {
UserInfo currentUserInfo = handleDataDTO.getCurrentUserInfo();
Authentication.setAuthenticatedUserId(currentUserInfo.getId());
List<AttachmentDTO> attachments = handleDataDTO.getAttachments();
String comments = handleDataDTO.getComments();
JSONObject formData = handleDataDTO.getFormData();
String taskId = handleDataDTO.getTaskId();
Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
Map<String, Object> map = new HashMap<>();
if (formData != null && formData.size() > 0) {
Map formValue = JSONObject.parseObject(formData.toJSONString(), new TypeReference<Map>() {
});
map.putAll(formValue);
map.put(FORM_VAR, formData);
}
map.put(PROCESS_STATUS, BUSINESS_STATUS_3);
runtimeService.setVariables(task.getProcessInstanceId(), map);
if (StringUtils.isNotBlank(comments)) {
taskService.addComment(task.getId(), task.getProcessInstanceId(), "opinion", comments);
}
if (attachments != null && attachments.size() > 0) {
for (AttachmentDTO attachment : attachments) {
taskService.createAttachment("option", taskId, task.getProcessInstanceId(), attachment.getName(), attachment.getName(), attachment.getUrl());
}
}
if (StringUtils.isNotBlank(handleDataDTO.getSignInfo())) {
taskService.addComment(task.getId(), task.getProcessInstanceId(), "sign", handleDataDTO.getSignInfo());
}
runtimeService.deleteProcessInstance(task.getProcessInstanceId(), "拒绝");
return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS,"");
}
@Override
public Result revoke(HandleDataDTO handleDataDTO) {
UserInfo currentUserInfo = handleDataDTO.getCurrentUserInfo();
Authentication.setAuthenticatedUserId(currentUserInfo.getId());
List<AttachmentDTO> attachments = handleDataDTO.getAttachments();
String comments = handleDataDTO.getComments();
JSONObject formData = handleDataDTO.getFormData();
String taskId = handleDataDTO.getTaskId();
HistoricTaskInstance task = historyService.createHistoricTaskInstanceQuery().taskId(taskId).singleResult();
Map<String, Object> map = new HashMap<>();
if (formData != null && formData.size() > 0) {
Map formValue = JSONObject.parseObject(formData.toJSONString(), new TypeReference<Map>() {
});
map.putAll(formValue);
map.put(FORM_VAR, formData);
}
map.put(PROCESS_STATUS, BUSINESS_STATUS_2);
runtimeService.setVariables(task.getProcessInstanceId(), map);
if (StringUtils.isNotBlank(comments)) {
taskService.addComment(task.getId(), task.getProcessInstanceId(), "opinion", comments);
}
if (attachments != null && attachments.size() > 0) {
for (AttachmentDTO attachment : attachments) {
taskService.createAttachment("option", taskId, task.getProcessInstanceId(), attachment.getName(), attachment.getName(), attachment.getUrl());
}
}
if (StringUtils.isNotBlank(handleDataDTO.getSignInfo())) {
taskService.addComment(task.getId(), task.getProcessInstanceId(), "sign", handleDataDTO.getSignInfo());
}
runtimeService.deleteProcessInstance(task.getProcessInstanceId(), "撤销");
return Result.OK();
}
@Override
public Result assignee(HandleDataDTO handleDataDTO) {
UserInfo currentUserInfo = handleDataDTO.getCurrentUserInfo();
Authentication.setAuthenticatedUserId(currentUserInfo.getId());
List<AttachmentDTO> attachments = handleDataDTO.getAttachments();
String comments = handleDataDTO.getComments();
JSONObject formData = handleDataDTO.getFormData();
String taskId = handleDataDTO.getTaskId();
Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
Map<String, Object> map = new HashMap<>();
if (formData != null && formData.size() > 0) {
Map formValue = JSONObject.parseObject(formData.toJSONString(), new TypeReference<Map>() {
});
map.putAll(formValue);
map.put(FORM_VAR, formData);
}
map.put(PROCESS_STATUS, BUSINESS_STATUS_1);
runtimeService.setVariables(task.getProcessInstanceId(), map);
if (StringUtils.isNotBlank(comments)) {
taskService.addComment(task.getId(), task.getProcessInstanceId(), "opinion", comments);
}
if (attachments != null && attachments.size() > 0) {
for (AttachmentDTO attachment : attachments) {
taskService.createAttachment("option", taskId, task.getProcessInstanceId(), attachment.getName(), attachment.getName(), attachment.getUrl());
}
}
if (StringUtils.isNotBlank(handleDataDTO.getSignInfo())) {
taskService.addComment(task.getId(), task.getProcessInstanceId(), "sign", handleDataDTO.getSignInfo());
}
taskService.setAssignee(taskId, handleDataDTO.getTransferUserInfo().getId());
return Result.OK();
}
@Override
public Result rollback(HandleDataDTO handleDataDTO) {
UserInfo currentUserInfo = handleDataDTO.getCurrentUserInfo();
Authentication.setAuthenticatedUserId(currentUserInfo.getId());
List<AttachmentDTO> attachments = handleDataDTO.getAttachments();
String comments = handleDataDTO.getComments();
JSONObject formData = handleDataDTO.getFormData();
String taskId = handleDataDTO.getTaskId();
String processInstanceId = handleDataDTO.getProcessInstanceId();
List<Task> list = taskService.createTaskQuery().processInstanceId(processInstanceId).list();
Task task = null;
List<String> taskIds = new ArrayList<>();
for (Task task1 : list) {
if (task1.getId().equals(taskId)) {
task = task1;
}
taskIds.add(task1.getTaskDefinitionKey());
}
Map<String, Object> map = new HashMap<>();
if (formData != null && formData.size() > 0) {
Map formValue = JSONObject.parseObject(formData.toJSONString(), new TypeReference<Map>() {
});
map.putAll(formValue);
map.put(FORM_VAR, formData);
}
map.put(PROCESS_STATUS, BUSINESS_STATUS_3);
runtimeService.setVariables(task.getProcessInstanceId(), map);
if (StringUtils.isNotBlank(comments)) {
taskService.addComment(task.getId(), task.getProcessInstanceId(), "opinion", comments);
}
if (attachments != null && attachments.size() > 0) {
for (AttachmentDTO attachment : attachments) {
taskService.createAttachment("option", taskId, task.getProcessInstanceId(), attachment.getName(), attachment.getName(), attachment.getUrl());
}
}
if (StringUtils.isNotBlank(handleDataDTO.getSignInfo())) {
taskService.addComment(task.getId(), task.getProcessInstanceId(), "sign", handleDataDTO.getSignInfo());
}
runtimeService.createChangeActivityStateBuilder()
.processInstanceId(task.getProcessInstanceId())
.moveActivityIdsToSingleActivityId(taskIds, handleDataDTO.getRollbackId())
.changeState();
return Result.OK();
}
@Override
public Result addMulti(HandleDataDTO handleDataDTO) {
UserInfo currentUserInfo = handleDataDTO.getCurrentUserInfo();
Authentication.setAuthenticatedUserId(currentUserInfo.getId());
List<AttachmentDTO> attachments = handleDataDTO.getAttachments();
String comments = handleDataDTO.getComments();
JSONObject formData = handleDataDTO.getFormData();
String taskId = handleDataDTO.getTaskId();
Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
Map<String, Object> map = new HashMap<>();
if (formData != null && formData.size() > 0) {
Map formValue = JSONObject.parseObject(formData.toJSONString(), new TypeReference<Map>() {
});
map.putAll(formValue);
map.put(FORM_VAR, formData);
}
map.put(PROCESS_STATUS, BUSINESS_STATUS_1);
runtimeService.setVariables(task.getProcessInstanceId(), map);
if (StringUtils.isNotBlank(comments)) {
taskService.addComment(task.getId(), task.getProcessInstanceId(), "opinion", comments);
}
if (attachments != null && attachments.size() > 0) {
for (AttachmentDTO attachment : attachments) {
taskService.createAttachment("option", taskId, task.getProcessInstanceId(), attachment.getName(), attachment.getName(), attachment.getUrl());
}
}
if (StringUtils.isNotBlank(handleDataDTO.getSignInfo())) {
taskService.addComment(task.getId(), task.getProcessInstanceId(), "sign", handleDataDTO.getSignInfo());
}
Map<String, Object> variableMap = new HashMap<>();
variableMap.put("assigneeName", handleDataDTO.getMultiAddUserInfo().getId());
ExecutionEntity execution = (ExecutionEntity) runtimeService.addMultiInstanceExecution(task.getTaskDefinitionKey(), task.getProcessInstanceId(), variableMap);
return Result.OK();
}
@Override
public Result<List<MultiVO>> queryMultiUsersInfo(Map<String, Object> map) {
String taskId = MapUtil.getStr(map, "taskId");
Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
List<Task> list = taskService.createTaskQuery()
.processInstanceId(task.getProcessInstanceId())
.taskDefinitionKey(task.getTaskDefinitionKey()).list();
Iterator<Task> iterator = list.iterator();
List<MultiVO> multiVOList = new ArrayList<>();
while (iterator.hasNext()) {
Task next = iterator.next();
if (!taskId.equals(next.getId())) {
MultiVO multiVO = new MultiVO();
multiVO.setTaskId(next.getId());
multiVO.setProcessInstanceId(next.getProcessInstanceId());
multiVO.setExecutionId(next.getExecutionId());
multiVO.setUserId(next.getAssignee());
multiVOList.add(multiVO);
}
}
return Result.OK(multiVOList);
}
@Override
public Result deleteMulti(List<String> executionIds) {
for (String executionId : executionIds) {
runtimeService.deleteMultiInstanceExecution(executionId, true);
}
return Result.OK();
}
@Override
public Result comments(HandleDataDTO handleDataDTO) {
UserInfo currentUserInfo = handleDataDTO.getCurrentUserInfo();
Authentication.setAuthenticatedUserId(currentUserInfo.getId());
List<AttachmentDTO> attachments = handleDataDTO.getAttachments();
String comments = handleDataDTO.getComments();
JSONObject formData = handleDataDTO.getFormData();
String taskId = handleDataDTO.getTaskId();
Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
Map<String, Object> map = new HashMap<>();
if (formData != null && formData.size() > 0) {
Map formValue = JSONObject.parseObject(formData.toJSONString(), new TypeReference<Map>() {
});
map.putAll(formValue);
map.put(FORM_VAR, formData);
}
map.put(PROCESS_STATUS, BUSINESS_STATUS_1);
runtimeService.setVariables(task.getProcessInstanceId(), map);
if (StringUtils.isNotBlank(comments)) {
taskService.addComment(task.getId(), task.getProcessInstanceId(), "comments", comments);
}
if (attachments != null && attachments.size() > 0) {
for (AttachmentDTO attachment : attachments) {
taskService.createAttachment("option", taskId, task.getProcessInstanceId(), attachment.getName(), attachment.getName(), attachment.getUrl());
}
}
if (StringUtils.isNotBlank(handleDataDTO.getSignInfo())) {
taskService.addComment(task.getId(), task.getProcessInstanceId(), "sign", handleDataDTO.getSignInfo());
}
return Result.OK();
}
@Override
public Result<HandleDataVO> instanceInfo(HandleDataDTO HandleDataDTO) {
String processInstanceId = HandleDataDTO.getProcessInstanceId();
HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstanceId)
.includeProcessVariables().singleResult();
String processDefinitionKey = historicProcessInstance.getProcessDefinitionKey();
ProcessTemplates processTemplates = processTemplateService.getById(processDefinitionKey.replace(PROCESS_PREFIX, ""));
// processTemplates.setLogo(processTemplates.getIcon());
processTemplates.setFormId(processTemplates.getTemplateId());
processTemplates.setFormName(processTemplates.getFormName());
// processTemplates.setProcessDefinitionId(historicProcessInstance.getProcessDefinitionId());
HandleDataVO handleDataVO = new HandleDataVO();
Map<String, Object> processVariables = historicProcessInstance.getProcessVariables();
handleDataVO.setProcessInstanceId(historicProcessInstance.getId());
JSONObject jsonObject = (JSONObject) processVariables.get(FORM_VAR);
handleDataVO.setFormData(jsonObject);
String process = processTemplates.getProcessJson();
ChildNode childNode = JSONObject.parseObject(process, new TypeReference<ChildNode>() {
});
SettingsInfo settingsInfo = JSONObject.parseObject(processTemplates.getSettings(), new TypeReference<SettingsInfo>() {
});
Boolean sign = settingsInfo.getSign();
ChildNode currentNode = null;
if (StringUtils.isNotBlank(HandleDataDTO.getTaskId())) {
HistoricTaskInstance historicTaskInstance = historyService.createHistoricTaskInstanceQuery().taskId(HandleDataDTO.getTaskId()).singleResult();
currentNode = getChildNode(childNode, historicTaskInstance.getTaskDefinitionKey());
List<FormOperates> formPerms = currentNode.getProps().getFormPerms();
if (CollUtil.isNotEmpty(formPerms)) {
Iterator<FormOperates> iterator = formPerms.iterator();
while (iterator.hasNext()) {
FormOperates next = iterator.next();
if ("H".equals(next.getPerm())) {
iterator.remove();
if (jsonObject != null) {
jsonObject.remove(next.getId());
}
}
}
}
handleDataVO.setCurrentNode(currentNode);
handleDataVO.setTaskId(HandleDataDTO.getTaskId());
}
if (sign) {
handleDataVO.setSignFlag(true);
}
if (StringUtils.isNotBlank(HandleDataDTO.getTaskId())) {
if (currentNode != null) {
if (currentNode.getProps().getSign()) {
handleDataVO.setSignFlag(true);
} else {
handleDataVO.setSignFlag(false);
}
}
}
List<HistoricActivityInstance> list = historyService.createHistoricActivityInstanceQuery().processInstanceId(historicProcessInstance.getId()).list();
Map<String, List<HistoricActivityInstance>> historicActivityInstanceMap = new HashMap<>();
for (HistoricActivityInstance historicActivityInstance : list) {
List<HistoricActivityInstance> historicActivityInstances = historicActivityInstanceMap.get(historicActivityInstance.getActivityId());
if (historicActivityInstances == null) {
historicActivityInstances = new ArrayList<>();
historicActivityInstances.add(historicActivityInstance);
historicActivityInstanceMap.put(historicActivityInstance.getActivityId(), historicActivityInstances);
} else {
historicActivityInstances.add(historicActivityInstance);
historicActivityInstanceMap.put(historicActivityInstance.getActivityId(), historicActivityInstances);
}
}
Process mainProcess = repositoryService.getBpmnModel(historicProcessInstance.getProcessDefinitionId()).getMainProcess();
Collection<FlowElement> flowElements = mainProcess.getFlowElements();
List<String> runningList = new ArrayList<>();
handleDataVO.setRunningList(runningList);
List<String> endList = new ArrayList<>();
handleDataVO.setEndList(endList);
List<String> noTakeList = new ArrayList<>();
handleDataVO.setNoTakeList(noTakeList);
Map<String, List<TaskDetailVO>> deatailMap = new HashMap<>();
List<Comment> processInstanceComments = taskService.getProcessInstanceComments(historicProcessInstance.getId());
List<Attachment> processInstanceAttachments = taskService.getProcessInstanceAttachments(historicProcessInstance.getId());
for (FlowElement flowElement : flowElements) {
List<TaskDetailVO> detailVOList = new ArrayList<>();
List<HistoricActivityInstance> historicActivityInstanceList = historicActivityInstanceMap.get(flowElement.getId());
if (CollUtil.isNotEmpty(historicActivityInstanceList)) {
for (HistoricActivityInstance historicActivityInstance : historicActivityInstanceList) {
if (historicActivityInstance.getEndTime() != null) {
if ("startEvent".equalsIgnoreCase(historicActivityInstance.getActivityType()) || "endEvent".equalsIgnoreCase(historicActivityInstance.getActivityType())) {
TaskDetailVO taskDetailVO = new TaskDetailVO();
taskDetailVO.setActivityId(historicActivityInstance.getActivityId());
taskDetailVO.setName(historicActivityInstance.getActivityName());
taskDetailVO.setCreateTime(historicActivityInstance.getStartTime());
taskDetailVO.setEndTime(historicActivityInstance.getEndTime());
detailVOList.add(taskDetailVO);
deatailMap.put(historicActivityInstance.getActivityId(), detailVOList);
endList.add(historicActivityInstance.getActivityId());
} else if ("userTask".equalsIgnoreCase(historicActivityInstance.getActivityType())) {
List<TaskDetailVO> voList = deatailMap.get(historicActivityInstance.getActivityId());
List<HistoricActivityInstance> activityInstanceList = list.stream().filter(h -> h.getActivityId().equals(historicActivityInstance.getActivityId()) && h.getEndTime() != null).collect(Collectors.toList());
if (voList != null) {
collectUserTaskInfo(processInstanceComments, processInstanceAttachments, historicActivityInstance, voList, activityInstanceList);
} else {
voList = new ArrayList<>();
collectUserTaskInfo(processInstanceComments, processInstanceAttachments, historicActivityInstance, voList, activityInstanceList);
}
deatailMap.put(historicActivityInstance.getActivityId(), voList);
endList.add(historicActivityInstance.getActivityId());
} else if ("serviceTask".equalsIgnoreCase(historicActivityInstance.getActivityType())) {
}
} else {
if ("userTask".equalsIgnoreCase(historicActivityInstance.getActivityType())) {
List<TaskDetailVO> voList = deatailMap.get(historicActivityInstance.getActivityId());
List<HistoricActivityInstance> activityInstanceList = list.stream().filter(h -> h.getActivityId().equals(historicActivityInstance.getActivityId()) && h.getEndTime() == null).collect(Collectors.toList());
if (voList != null) {
collectUserTaskInfo(processInstanceComments, processInstanceAttachments, historicActivityInstance, voList, activityInstanceList);
} else {
voList = new ArrayList<>();
collectUserTaskInfo(processInstanceComments, processInstanceAttachments, historicActivityInstance, voList, activityInstanceList);
}
deatailMap.put(historicActivityInstance.getActivityId(), voList);
if (endList.contains(historicActivityInstance.getActivityId())) {
endList.remove(historicActivityInstance.getActivityId());
runningList.add(historicActivityInstance.getActivityId());
} else {
runningList.add(historicActivityInstance.getActivityId());
}
} else if ("serviceTask".equalsIgnoreCase(historicActivityInstance.getActivityType())) {
}
}
}
} else {
noTakeList.add(flowElement.getId());
}
}
handleDataVO.setProcessTemplates(processTemplates);
handleDataVO.setDetailVOList(deatailMap);
return Result.OK(handleDataVO);
}
private void collectUserTaskInfo(List<Comment> processInstanceComments,
List<Attachment> processInstanceAttachments,
HistoricActivityInstance historicActivityInstance,
List<TaskDetailVO> voList,
List<HistoricActivityInstance> activityInstanceList) {
for (HistoricActivityInstance activityInstance : activityInstanceList) {
TaskDetailVO taskDetailVO = new TaskDetailVO();
taskDetailVO.setTaskId(activityInstance.getTaskId());
taskDetailVO.setActivityId(activityInstance.getActivityId());
taskDetailVO.setName(activityInstance.getActivityName());
taskDetailVO.setCreateTime(activityInstance.getStartTime());
taskDetailVO.setEndTime(activityInstance.getEndTime());
Comment signComment = processInstanceComments.stream().filter(h -> h.getTaskId().equals(historicActivityInstance.getTaskId()) && h.getType().equals("sign")).findFirst().orElse(null);
if (signComment != null) {
taskDetailVO.setSignImage(signComment.getFullMessage());
}
List<Attachment> attachments = processInstanceAttachments.stream().filter(h -> h.getTaskId().equals(historicActivityInstance.getTaskId())).collect(Collectors.toList());
if (CollUtil.isNotEmpty(attachments)) {
List<AttachmentVO> attachmentVOList = new ArrayList<>();
for (Attachment attachment : attachments) {
AttachmentVO attachmentVO = new AttachmentVO();
attachmentVO.setId(attachment.getId());
attachmentVO.setName(attachment.getName());
attachmentVO.setUrl(attachment.getUrl());
attachmentVOList.add(attachmentVO);
}
taskDetailVO.setAttachmentVOList(attachmentVOList);
}
List<Comment> options = processInstanceComments.stream().filter(h -> h.getTaskId().equals(historicActivityInstance.getTaskId()) && h.getType().equals("opinion")).collect(Collectors.toList());
if (CollUtil.isNotEmpty(options)) {
List<OptionVO> optionVOList = new ArrayList<>();
for (Comment option : options) {
OptionVO optionVO = new OptionVO();
optionVO.setComments(option.getFullMessage());
optionVO.setUserId(option.getUserId());
// optionVO.setUserName();
optionVO.setCreateTime(option.getTime());
optionVOList.add(optionVO);
}
taskDetailVO.setOptionVOList(optionVOList);
}
List<Comment> comments = processInstanceComments.stream().filter(h -> h.getTaskId().equals(historicActivityInstance.getTaskId()) && h.getType().equals("comments")).collect(Collectors.toList());
if (CollUtil.isNotEmpty(comments)) {
List<CommentVO> commentsVOList = new ArrayList<>();
for (Comment comment : comments) {
CommentVO commentVO = new CommentVO();
commentVO.setComments(comment.getFullMessage());
commentVO.setUserId(comment.getUserId());
// commentVO.setUserName();
commentVO.setCreateTime(comment.getTime());
commentsVOList.add(commentVO);
}
taskDetailVO.setCommentVOList(commentsVOList);
}
voList.add(taskDetailVO);
}
}
private String getCurrentName(String processInstanceId, Boolean flag, String processDefinitionId) {
if (flag) {
return "流程已结束";
}
Execution execution = runtimeService.createExecutionQuery().executionId(processInstanceId).singleResult();
String activityId = execution.getActivityId();
if (StringUtils.isBlank(activityId)) {
return "";
} else {
BpmnModel bpmnModel = repositoryService.getBpmnModel(processDefinitionId);
FlowElement flowElement = bpmnModel.getMainProcess().getFlowElement(activityId);
return flowElement.getName();
}
}
}
package com.junmp.junmpProcess.service.Repository;
import com.baomidou.mybatisplus.extension.service.IService;
import com.junmp.junmpProcess.entity.Departments;
/**
* @author : willian fu
* @version : 1.0
*/
public interface DepartmentsService extends IService<Departments> {
}
package com.junmp.junmpProcess.service.Repository;
import com.baomidou.mybatisplus.extension.service.IService;
import com.junmp.junmpProcess.entity.FormGroups;
/**
* @author : willian fu
* @version : 1.0
*/
public interface FormGroupService extends IService<FormGroups> {
}
package com.junmp.junmpProcess.service.Repository;
import com.baomidou.mybatisplus.extension.service.IService;
import com.fasterxml.jackson.databind.JsonNode;
import com.junmp.junmpProcess.entity.ProcessTemplates;
import org.flowable.bpmn.model.BpmnModel;
/**
* @author : willian fu
* @version : 1.0
*/
public interface ProcessTemplateService extends IService<ProcessTemplates> {
}
package com.junmp.junmpProcess.service.Repository;
import com.baomidou.mybatisplus.extension.service.IService;
import com.junmp.junmpProcess.entity.TemplateGroup;
/**
* @author : willian fu
* @version : 1.0
*/
public interface TemplateGroupService extends IService<TemplateGroup> {
}
package com.junmp.junmpProcess.service.Repository;
import com.baomidou.mybatisplus.extension.service.IService;
import com.junmp.junmpProcess.entity.Users;
/**
* @author : willian fu
* @version : 1.0
*/
public interface UserService extends IService<Users> {
}
package com.junmp.junmpProcess.service.Repository;
/**
* @author : willian fu
* @version : 1.0
*/
public interface WorkspaceProcessService {
/**
* 获取用户可见表单
*
* @return
*/
Object getFormGroups(String name);
}
package com.junmp.junmpProcess.service.Repository.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.junmp.junmpProcess.service.Repository.DepartmentsService;
import com.junmp.junmpProcess.entity.Departments;
import com.junmp.junmpProcess.mapper.DepartmentsMapper;
import org.springframework.stereotype.Service;
/**
* @author : willian fu
* @version : 1.0
*/
@Service
class DepartmentsServiceImpl extends ServiceImpl<DepartmentsMapper, Departments> implements
DepartmentsService {
}
//package com.junmp.junmpProcess.service.Repository.impl;
//
//
//import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
//import com.junmp.junmpProcess.service.Repository.FormGroupService;
//import com.junmp.junmpProcess.entity.FormGroups;
//import com.junmp.junmpProcess.mapper.FormGroupsMapper;
//import org.springframework.stereotype.Service;
//
///**
// * @author : willian fu
// * @version : 1.0
// */
//@Service
//public class FormGroupServiceImpl extends ServiceImpl<FormGroupsMapper, FormGroups> implements
// FormGroupService {
//
//
//}
package com.junmp.junmpProcess.service.Repository.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.junmp.junmpProcess.common.WorkFlowConstants;
import com.junmp.junmpProcess.dto.json.flowJson.Inout;
import com.junmp.junmpProcess.entity.ProcessTemplates;
import com.junmp.junmpProcess.mapper.ProcessTemplatesMapper;
import com.junmp.junmpProcess.service.Repository.ProcessTemplateService;
import com.junmp.junmpProcess.utils.IdWorker;
import com.junmp.junmpProcess.utils.JsonToELConverter;
import org.flowable.bpmn.BpmnAutoLayout;
import org.flowable.bpmn.model.*;
import org.flowable.bpmn.model.Process;
import org.flowable.engine.delegate.ExecutionListener;
import org.flowable.engine.delegate.TaskListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.UUID;
import static com.junmp.junmpProcess.common.WorkFlowConstants.START_EVENT_ID;
import static com.junmp.junmpProcess.utils.BpmnModelUtils.createEndEvent;
import static com.junmp.junmpProcess.utils.BpmnModelUtils.createStartEvent;
import static org.flowable.bpmn.model.ImplementationType.IMPLEMENTATION_TYPE_DELEGATEEXPRESSION;
/**
* @author : willian fu
* @version : 1.0
*/
@Service
public class ProcessTemplateServiceImpl extends ServiceImpl<ProcessTemplatesMapper, ProcessTemplates> implements
ProcessTemplateService {
}
package com.junmp.junmpProcess.service.Repository.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.junmp.junmpProcess.entity.TemplateGroup;
import com.junmp.junmpProcess.mapper.TemplateGroupMapper;
import com.junmp.junmpProcess.service.Repository.TemplateGroupService;
import org.springframework.stereotype.Service;
/**
* @author : willian fu
* @version : 1.0
*/
@Service
public class TemplateGroupServiceImpl extends ServiceImpl<TemplateGroupMapper, TemplateGroup> implements
TemplateGroupService {
}
package com.junmp.junmpProcess.service.Repository.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.junmp.junmpProcess.service.Repository.UserService;
import com.junmp.junmpProcess.entity.Users;
import com.junmp.junmpProcess.mapper.UsersMapper;
import org.springframework.stereotype.Service;
/**
* @author : willian fu
* @version : 1.0
*/
@Service
public class UserServiceImpl extends ServiceImpl<UsersMapper, Users> implements UserService {
}
package com.junmp.junmpProcess.service.Repository.impl;
import com.junmp.junmpProcess.service.Repository.WorkspaceProcessService;
//import com.junmp.junmpProcess.service.Bussiness.SettingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
/**
* @author : willian fu
* @version : 1.0
*/
@Service
public class WorkspaceProcessServiceImpl implements WorkspaceProcessService {
// @Autowired
// private SettingService settingService;
/**
* 获取用户可见表单
*
* @return
*/
@Override
public Object getFormGroups(String name) {
ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) RequestContextHolder
.getRequestAttributes();
// String token = CookieUtil.getCookieValue(servletRequestAttributes.getRequest(), "token");
return null;
}
}
package com.junmp.junmpProcess.utils;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.junmp.junmpProcess.dto.json.flowJson.Inout;
import com.junmp.junmpProcess.entity.ProcessTemplates;
import com.junmp.junmpProcess.service.Repository.ProcessTemplateService;
import org.flowable.bpmn.BpmnAutoLayout;
import org.flowable.bpmn.converter.BpmnXMLConverter;
import org.flowable.bpmn.model.*;
import org.flowable.bpmn.model.Process;
import org.flowable.engine.TaskService;
import org.flowable.engine.delegate.ExecutionListener;
import org.flowable.task.service.impl.persistence.entity.TaskEntity;
import org.springframework.beans.factory.annotation.Autowired;
import javax.annotation.Resource;
import java.util.*;
import static org.flowable.bpmn.model.ImplementationType.IMPLEMENTATION_TYPE_DELEGATEEXPRESSION;
public class BpmnConvert {
@Resource
private IdWorker idWorker;
public static BpmnModel toBpmn(JsonNode processNode, JsonNode formNode,String formName,String templateId) {
//表单存储
JSONObject jsonObject=new JSONObject();
jsonObject.put("processJson", processNode.toString());
jsonObject.put("formJson", formNode.toString());
// 一.准备工作
BpmnModel bpmnModel = new BpmnModel();
String id=""+ UUID.randomUUID();
bpmnModel.setTargetNamespace(id+"");
ExtensionAttribute extensionAttribute=new ExtensionAttribute();
extensionAttribute.setName("Junmp");
extensionAttribute.setNamespace("http://flowable.org/bpmn");
extensionAttribute.setValue(jsonObject.toJSONString());
Process process = new Process(); // 相当于图纸
process.setName(formName);
process.setId("Process_"+templateId);
process.setExecutable(true);
process.addAttribute(extensionAttribute);
bpmnModel.addProcess(process);
// 二.开始结束节点
// 二.开始结束节点
StartEvent startEvent = new StartEvent();// 新建开始节点
startEvent.setId("_start");
startEvent.setInitiator("initiator");
process.addFlowElement(startEvent);// 绘制到图纸
EndEvent endEvent = new EndEvent(); // 新建结束节点
endEvent.setId("_end");// 绘制到图纸
process.addFlowElement(endEvent);
// 三.递归绘制节点
drawNode("root",process, processNode,formNode, "_start", "_end", null);
// 四.自动布局
new BpmnAutoLayout(bpmnModel).execute();
// 五.转xml
return bpmnModel;
}
/**
* 绘制节点
* @param process bpmn process 图纸
* @param node json的节点
* @param preId 上一节点id
* @param endId 结束节点
* @param preExpression 上一节点表达式
*/
public static void drawNode(String typeNode,Process process, JsonNode node,JsonNode formJson, String preId, String endId, String preExpression) {
// 根据type绘制不同种类的节点
Inout inout = drawNodeByType(process, node,formJson,typeNode);
// 绘制前一根线
process.addFlowElement(createSequenceFlow(preId, inout.getIn(), preExpression));
if (node.get("childNode").toString().equals("null")) {
// 没有下一步, 绘制指向结束的线
process.addFlowElement(createSequenceFlow(inout.getOut(), endId, null));
} else {
// 有下一步, 递归绘制下一个节点
drawNode("",process, node.get("childNode"),formJson, inout.getOut(), endId, null);
}
}
/**
* 绘制不同种类节点
* @param process
* @param node
* @return Inout
*/
private static Inout drawNodeByType(Process process, JsonNode node,JsonNode formJson,String typeNode) {
if (node.get("type").toString().equals("0")) { //标准节点
return drawBzNode(process, node,formJson,typeNode);
} else if (node.get("type").toString().equals("1")) {//审核节点
return drawAuditNode(process, node);
} else if (node.get("type").toString().equals("4")) {//路由
return drawExclusiveNode(process, node);
}
else {
throw new IllegalArgumentException();
}
}
/**
* 绘制标准节点
* @param process
* @param node
* @return Inout
*/
private static Inout drawBzNode(Process process, JsonNode node,JsonNode formJson,String typeNode) {
// String id= "Node_"+UUID.randomUUID();
String id="Node_"+ node.get("id").asText();
//创建发起人结点
UserTask task = new UserTask();
//设置结点ID
task.setId(id);
//设置结点名称
task.setName(node.get("name").asText());
//通过将 ${initiator} 作为指派人的值,可以将用户任务分配给流程的发起人。当流程实例启动时,${initiator} 会被替换为实际的发起人信息。
//需要注意的是,在使用表达式时,需要确保流程引擎的配置中启用了表达式语言(例如使用 Flowable 的默认配置,会启用表达式语言)。
task.setAssignee("${initiator}");
List<FormProperty> formProperties = formJsonToFormProperty(formJson);
task.setFormProperties(formProperties);
//添加连线
process.addFlowElement(task);
return new Inout(id, id);
}
private static List<FormProperty> formJsonToFormProperty(JsonNode formJson){
List<FormProperty> formList=new ArrayList<>();
for (JsonNode listInfo : formJson.get("list")) {
FormProperty form=new FormProperty();
JsonNode key=listInfo.get("key");
form.setId(key.asText());
form.setName(key.asText());
formList.add(form);
}
return formList;
}
/**
* 绘制审核节点
* @param process
* @param node
* @return Inout
*/
private static Inout drawAuditNode(Process process, JsonNode node) {
// 绘制节点
// String id = "Node_"+UUID.randomUUID();
String id ="Node_"+ node.get("id").asText();
UserTask userTask = new UserTask();
userTask.setId(id);
//写入节点名称
userTask.setName(node.get("name").asText());
ObjectMapper objectMapper = new ObjectMapper();
JsonNode[] approverGroups = objectMapper.convertValue(node.get("approverGroups"), JsonNode[].class);
userTask.setExecutionListeners(getTaskListeners());//角色监听
MultiInstanceLoopCharacteristics multiInstanceLoopCharacteristics = new MultiInstanceLoopCharacteristics();
// 审批人集合参数
multiInstanceLoopCharacteristics.setInputDataItem(userTask.getId()+"assigneeList");
// 迭代集合
multiInstanceLoopCharacteristics.setElementVariable("assigneeName");
// 并行
multiInstanceLoopCharacteristics.setSequential(false);
multiInstanceLoopCharacteristics.setCompletionCondition("${nrOfCompletedInstances/nrOfInstances > 0}");
userTask.setAssignee("${assigneeName}");
// 设置多实例属性
userTask.setLoopCharacteristics(multiInstanceLoopCharacteristics);
process.addFlowElement(userTask);
return new Inout(id, id);
}
/**
* 监听任务启动后角色分配事件
*
* @return 监听节点列表
*/
private static List<FlowableListener> getTaskListeners() {
ArrayList<FlowableListener> taskListeners = new ArrayList<>();
//监听器开始class
FlowableListener listener = new FlowableListener();
listener.setEvent(ExecutionListener.EVENTNAME_START);//监听任务启动
listener.setImplementationType(IMPLEMENTATION_TYPE_DELEGATEEXPRESSION);
listener.setImplementation("${counterSignListener}");//启动角色分配监听事件
taskListeners.add(listener);
return taskListeners;
}
/**
* 绘制分支节点
* @param process 绘图对象
* @param node 当前节点信息
* @return Inout
*/
private static Inout drawExclusiveNode(Process process, JsonNode node) {
// 开始网关
String startId = "Exclusive_"+UUID.randomUUID();
ExclusiveGateway startGateway = new ExclusiveGateway();
startGateway.setId(startId);
process.addFlowElement(startGateway);
// 结束网关
String endId = "Exclusive_"+UUID.randomUUID();
ExclusiveGateway endGateway = new ExclusiveGateway();
endGateway.setId(endId);
process.addFlowElement(endGateway);
// 绘制分支
JsonNode branches = node.get("conditionNodes");
for (JsonNode branch : branches) {
if (branch.get("childNode").toString().equals("null")) {
// 没有子流程,直接绘制结束 内容为EL表达式
//解释JSON数据,转换为EL表达式
JsonNode conditionGroup=branch.get("conditionGroup");
String condition = JsonToELConverter.convertToEL(conditionGroup);
//条件线路 根前端数据对接 内容为EL表达式
process.addFlowElement(createSequenceFlow(startId, endId, condition));
} else {
// 有子流程,递归绘制子流程
//解释JSON数据,转换为EL表达式
JsonNode conditionGroup=branch.get("conditionGroup");
//把JSOn转换为EL表达式
String condition = JsonToELConverter.convertToEL(conditionGroup);
//条件线路 根前端数据对接 内容为EL表达式
drawNode("",process, branch.get("childNode"),null, startId, endId, condition);
}
}
// int和out不一样
return new Inout(startId, endId);
}
/**
* 创建连线
* @param from 起点
* @param to 终点
* @return SequenceFlow
*/
public static SequenceFlow createSequenceFlow(String from, String to, String conditionExpression) {
SequenceFlow flow = new SequenceFlow();
flow.setId("Node_"+UUID.randomUUID());
flow.setSourceRef(from);
flow.setTargetRef(to);
if (conditionExpression != null) {
flow.setConditionExpression(conditionExpression);
}
return flow;
}
}
\ No newline at end of file
package com.junmp.junmpProcess.utils;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.junmp.junmpProcess.common.WorkFlowConstants;
import com.junmp.junmpProcess.exception.WorkFlowException;
import org.apache.commons.lang3.StringUtils;
import org.flowable.bpmn.model.*;
import org.flowable.bpmn.model.Process;
import org.flowable.engine.delegate.ExecutionListener;
import org.flowable.engine.delegate.TaskListener;
import com.junmp.junmpProcess.dto.json.ChildNode;
import com.junmp.junmpProcess.dto.json.ConditionInfo;
import com.junmp.junmpProcess.dto.json.GroupsInfo;
import com.junmp.junmpProcess.dto.json.Properties;
import com.junmp.junmpProcess.enums.ModeEnums;
import org.springframework.util.CollectionUtils;
import java.lang.reflect.InvocationTargetException;
import java.util.*;
import java.util.stream.Collectors;
import static org.flowable.bpmn.model.ImplementationType.IMPLEMENTATION_TYPE_CLASS;
import static org.flowable.bpmn.model.ImplementationType.IMPLEMENTATION_TYPE_DELEGATEEXPRESSION;
/**
* @author LoveMyOrange
* @create 2022-10-10 17:47
*/
public class BpmnModelUtils {
private static String id(String prefix) {
return prefix + "_" + UUID.randomUUID().toString().replace("-", "").toLowerCase();
}
private static ServiceTask serviceTask(String name) {
ServiceTask serviceTask = new ServiceTask();
serviceTask.setName(name);
return serviceTask;
}
public static SequenceFlow connect(String from, String to, List<SequenceFlow> sequenceFlows, Map<String, ChildNode> childNodeMap, Process process) {
SequenceFlow flow = new SequenceFlow();
String sequenceFlowId = id("sequenceFlow");
if (process.getFlowElement(from) != null && process.getFlowElement(from) instanceof ExclusiveGateway) {
ChildNode childNode = childNodeMap.get(to);
if (childNode != null) {
String parentId = childNode.getParentId();
if (StringUtils.isNotBlank(parentId)) {
ChildNode parentNode = childNodeMap.get(parentId);
if (parentNode != null) {
if (Type.CONDITION.type.equals(parentNode.getType())) {
sequenceFlowId = parentNode.getId();
flow.setName(parentNode.getName());
if (Boolean.FALSE.equals(parentNode.getTypeElse())) {
//解析条件表达式
Properties props = parentNode.getProps();
String expression = props.getExpression();
List<GroupsInfo> groups = props.getGroups();
String groupsType = props.getGroupsType();
if (StringUtils.isNotBlank(expression)) {
flow.setConditionExpression("${" + expression + "}");
} else {
StringBuffer conditionExpression = new StringBuffer();
conditionExpression.append("${ ");
for (int i = 0; i < groups.size(); i++) {
conditionExpression.append(" ( ");
GroupsInfo group = groups.get(i);
List<String> cids = group.getCids();
String groupType = group.getGroupType();
List<ConditionInfo> conditions = group.getConditions();
for (int j = 0; j < conditions.size(); j++) {
conditionExpression.append(" ");
ConditionInfo condition = conditions.get(j);
String compare = condition.getCompare();
String id = condition.getId();
String title = condition.getTitle();
List<Object> value = condition.getValue();
String valueType = condition.getValueType();
if ("String".equals(valueType)) {
if ("=".equals(compare)) {
String str = StringUtils.join(value, ",");
str = "'" + str + "'";
conditionExpression.append(" " + WorkFlowConstants.EXPRESSION_CLASS + "strEqualsMethod(" + id + "," + str + ") ");
} else {
List<String> tempList = new ArrayList<>();
for (Object o : value) {
String s = o.toString();
s = "'" + s + "'";
tempList.add(s);
}
String str = StringUtils.join(tempList, ",");
// String str = StringUtils.join(value, ",");
conditionExpression.append(" " + WorkFlowConstants.EXPRESSION_CLASS + "strContainsMethod(" + id + "," + str + ") ");
}
} else if ("Number".equals(valueType)) {
String str = StringUtils.join(value, ",");
if ("=".equals(compare)) {
conditionExpression.append(" " + WorkFlowConstants.EXPRESSION_CLASS + "numberEquals(" + id + "," + str + ") ");
} else if (">".equals(compare)) {
conditionExpression.append(" " + WorkFlowConstants.EXPRESSION_CLASS + "numberGt(" + id + "," + str + ") ");
} else if (">=".equals(compare)) {
conditionExpression.append(" " + WorkFlowConstants.EXPRESSION_CLASS + "numberGtEquals(" + id + "," + str + ") ");
} else if ("<".equals(compare)) {
conditionExpression.append(" " + WorkFlowConstants.EXPRESSION_CLASS + "numberLt(" + id + "," + str + ") ");
} else if ("<=".equals(compare)) {
conditionExpression.append(" " + WorkFlowConstants.EXPRESSION_CLASS + "numberLtEquals(" + id + "," + str + ") ");
} else if ("IN".equals(compare)) {
conditionExpression.append(" " + WorkFlowConstants.EXPRESSION_CLASS + "numberContains(" + id + "," + str + ") ");
} else if ("B".equals(compare)) {
conditionExpression.append(" " + WorkFlowConstants.EXPRESSION_CLASS + "b(" + id + "," + str + ") ");
} else if ("AB".equals(compare)) {
conditionExpression.append(" " + WorkFlowConstants.EXPRESSION_CLASS + "ab(" + id + "," + str + ") ");
} else if ("BA".equals(compare)) {
conditionExpression.append(" " + WorkFlowConstants.EXPRESSION_CLASS + "ba(" + id + "," + str + ") ");
} else if ("ABA".equals(compare)) {
conditionExpression.append(" " + WorkFlowConstants.EXPRESSION_CLASS + "aba(" + id + "," + str + ") ");
}
} else if ("User".equals(valueType)) {
List<String> userIds = new ArrayList<>();
for (Object o : value) {
JSONObject obj = (JSONObject) o;
userIds.add(obj.getString("id"));
}
String str = StringUtils.join(userIds, ",");
conditionExpression.append(" " + WorkFlowConstants.EXPRESSION_CLASS + "userStrContainsMethod(" + id + "," + str + ") ");
} else if ("Dept".equals(valueType)) {
List<String> userIds = new ArrayList<>();
for (Object o : value) {
JSONObject obj = (JSONObject) o;
userIds.add(obj.getString("id"));
}
String str = StringUtils.join(userIds, ",");
conditionExpression.append(" " + WorkFlowConstants.EXPRESSION_CLASS + "deptStrContainsMethod(" + id + "," + str + ") ");
} else {
continue;
}
if (conditions.size() > 1 && j != (conditions.size() - 1)) {
if ("OR".equals(groupType)) {
conditionExpression.append(" || ");
} else {
conditionExpression.append(" && ");
}
}
if (i == (conditions.size() - 1)) {
conditionExpression.append(" ");
}
}
conditionExpression.append(" ) ");
if (groups.size() > 1 && i != (groups.size() - 1)) {
if ("OR".equals(groupsType)) {
conditionExpression.append(" || ");
} else {
conditionExpression.append(" && ");
}
}
}
conditionExpression.append("} ");
flow.setConditionExpression(conditionExpression.toString());
}
}
}
}
}
}
}
flow.setId(sequenceFlowId);
flow.setSourceRef(from);
flow.setTargetRef(to);
sequenceFlows.add(flow);
return flow;
}
private static String stringEquals(ConditionInfo condition) {
return null;
}
public static StartEvent createStartEvent() {
StartEvent startEvent = new StartEvent();
startEvent.setId(WorkFlowConstants.START_EVENT_ID);
startEvent.setInitiator("applyUserId");
return startEvent;
}
public static EndEvent createEndEvent() {
EndEvent endEvent = new EndEvent();
endEvent.setId(WorkFlowConstants.END_EVENT_ID);
return endEvent;
}
// public static String FlowCreate(String fromId, FlowChildNode flowNode, Process process, BpmnModel bpmnModel, List<SequenceFlow> sequenceFlows, Map<String,ChildNode> childNodeMap) throws InvocationTargetException, IllegalAccessException {
// Integer nodeType = flowNode.getType();
// if (FlowType.CONCURRENTS.isEqual(nodeType)) {
// return createParallelGatewayBuilder(fromId, flowNode,process,bpmnModel,sequenceFlows,childNodeMap);
// } else if (FlowType.CONDITIONS.isEqual(nodeType)) {
// return createExclusiveGatewayBuilder(fromId, flowNode,process,bpmnModel,sequenceFlows,childNodeMap);
// } else if (FlowType.USER_TASK.isEqual(nodeType)) {
// childNodeMap.put(flowNode.getId(),flowNode);
// JSONObject incoming = flowNode.getIncoming();
// incoming.put("incoming", Collections.singletonList(fromId));
// String id = createTask(process,flowNode,sequenceFlows,childNodeMap);
// // 如果当前任务还有后续任务,则遍历创建后续任务
// ChildNode children = flowNode.getChildren();
// if (Objects.nonNull(children) &&StringUtils.isNotBlank(children.getId())) {
// return create(id, children,process,bpmnModel,sequenceFlows,childNodeMap);
// } else {
// return id;
// }
// }
// else if(Type.ROOT.isEqual(nodeType)){
// childNodeMap.put(flowNode.getId(),flowNode);
// JSONObject incoming = flowNode.getIncoming();
// incoming.put("incoming", Collections.singletonList(fromId));
// String id = createTask(process,flowNode,sequenceFlows,childNodeMap);
// // 如果当前任务还有后续任务,则遍历创建后续任务
// ChildNode children = flowNode.getChildren();
// if (Objects.nonNull(children) &&StringUtils.isNotBlank(children.getId())) {
// return create(id, children,process,bpmnModel,sequenceFlows,childNodeMap);
// } else {
// return id;
// }
// }
// else if(Type.DELAY.isEqual(nodeType)){
// throw new WorkFlowException("还不想写这个功能");
//// childNodeMap.put(flowNode.getId(),flowNode);
//// JSONObject incoming = flowNode.getIncoming();
//// incoming.put("incoming", Collections.singletonList(fromId));
//// String id = createTask(process,flowNode,sequenceFlows,childNodeMap);
//// // 如果当前任务还有后续任务,则遍历创建后续任务
//// ChildNode children = flowNode.getChildren();
//// if (Objects.nonNull(children) &&StringUtils.isNotBlank(children.getId())) {
//// return create(id, children,process,bpmnModel,sequenceFlows,childNodeMap);
//// } else {
//// return id;
//// }
// }
// else if(Type.TRIGGER.isEqual(nodeType)){
// throw new WorkFlowException("还不想写这个功能");
// }
// else if(Type.CC.isEqual(nodeType)){
// throw new WorkFlowException("代码呗回滚了 丢了,暂时先不做");
//// childNodeMap.put(flowNode.getId(),flowNode);
//// JSONObject incoming = flowNode.getIncoming();
//// incoming.put("incoming", Collections.singletonList(fromId));
//// String id = createServiceTask(process,flowNode,sequenceFlows,childNodeMap);
//// // 如果当前任务还有后续任务,则遍历创建后续任务
//// ChildNode children = flowNode.getChildren();
//// if (Objects.nonNull(children) &&StringUtils.isNotBlank(children.getId())) {
//// return create(id, children,process,bpmnModel,sequenceFlows,childNodeMap);
//// } else {
//// return id;
//// }
// }
// else {
// throw new RuntimeException("未知节点类型: nodeType=" + nodeType);
// }
// }
public static String create(String fromId, ChildNode flowNode, Process process, BpmnModel bpmnModel, List<SequenceFlow> sequenceFlows, Map<String, ChildNode> childNodeMap) throws InvocationTargetException, IllegalAccessException {
String nodeType = flowNode.getType();
if (Type.CONCURRENTS.isEqual(nodeType)) {
return createParallelGatewayBuilder(fromId, flowNode, process, bpmnModel, sequenceFlows, childNodeMap);
} else if (Type.CONDITIONS.isEqual(nodeType)) {
return createExclusiveGatewayBuilder(fromId, flowNode, process, bpmnModel, sequenceFlows, childNodeMap);
} else if (Type.USER_TASK.isEqual(nodeType)) {
childNodeMap.put(flowNode.getId(), flowNode);
JSONObject incoming = flowNode.getIncoming();
incoming.put("incoming", Collections.singletonList(fromId));
String id = createTask(process, flowNode, sequenceFlows, childNodeMap);
// 如果当前任务还有后续任务,则遍历创建后续任务
ChildNode children = flowNode.getChildNode();
if (Objects.nonNull(children) && StringUtils.isNotBlank(children.getId())) {
return create(id, children, process, bpmnModel, sequenceFlows, childNodeMap);
} else {
return id;
}
} else if (Type.ROOT.isEqual(nodeType)) {
childNodeMap.put(flowNode.getId(), flowNode);
JSONObject incoming = flowNode.getIncoming();
incoming.put("incoming", Collections.singletonList(fromId));
String id = createTask(process, flowNode, sequenceFlows, childNodeMap);
// 如果当前任务还有后续任务,则遍历创建后续任务
ChildNode children = flowNode.getChildNode();
if (Objects.nonNull(children) && StringUtils.isNotBlank(children.getId())) {
return create(id, children, process, bpmnModel, sequenceFlows, childNodeMap);
} else {
return id;
}
} else if (Type.DELAY.isEqual(nodeType)) {
throw new WorkFlowException("还不想写这个功能");
// childNodeMap.put(flowNode.getId(),flowNode);
// JSONObject incoming = flowNode.getIncoming();
// incoming.put("incoming", Collections.singletonList(fromId));
// String id = createTask(process,flowNode,sequenceFlows,childNodeMap);
// // 如果当前任务还有后续任务,则遍历创建后续任务
// ChildNode children = flowNode.getChildren();
// if (Objects.nonNull(children) &&StringUtils.isNotBlank(children.getId())) {
// return create(id, children,process,bpmnModel,sequenceFlows,childNodeMap);
// } else {
// return id;
// }
} else if (Type.TRIGGER.isEqual(nodeType)) {
throw new WorkFlowException("还不想写这个功能");
} else if (Type.CC.isEqual(nodeType)) {
throw new WorkFlowException("代码呗回滚了 丢了,暂时先不做");
// childNodeMap.put(flowNode.getId(),flowNode);
// JSONObject incoming = flowNode.getIncoming();
// incoming.put("incoming", Collections.singletonList(fromId));
// String id = createServiceTask(process,flowNode,sequenceFlows,childNodeMap);
// // 如果当前任务还有后续任务,则遍历创建后续任务
// ChildNode children = flowNode.getChildren();
// if (Objects.nonNull(children) &&StringUtils.isNotBlank(children.getId())) {
// return create(id, children,process,bpmnModel,sequenceFlows,childNodeMap);
// } else {
// return id;
// }
} else {
throw new RuntimeException("未知节点类型: nodeType=" + nodeType);
}
}
private static String createExclusiveGatewayBuilder(String formId, ChildNode flowNode, Process process, BpmnModel bpmnModel, List<SequenceFlow> sequenceFlows, Map<String, ChildNode> childNodeMap) throws InvocationTargetException, IllegalAccessException {
childNodeMap.put(flowNode.getId(), flowNode);
String name = flowNode.getName();
String exclusiveGatewayId = flowNode.getId();
ExclusiveGateway exclusiveGateway = new ExclusiveGateway();
exclusiveGateway.setId(exclusiveGatewayId);
exclusiveGateway.setName(name);
process.addFlowElement(exclusiveGateway);
process.addFlowElement(connect(formId, exclusiveGatewayId, sequenceFlows, childNodeMap, process));
if (Objects.isNull(flowNode.getConditionNodes()) && Objects.isNull(flowNode.getChildNode())) {
return exclusiveGatewayId;
}
List<ChildNode> flowNodes = flowNode.getConditionNodes();
List<String> incoming = Lists.newArrayListWithCapacity(flowNodes.size());
List<JSONObject> conditions = Lists.newCopyOnWriteArrayList();
for (ChildNode element : flowNodes) {
Boolean typeElse = element.getTypeElse();
if (Boolean.TRUE.equals(typeElse)) {
exclusiveGateway.setDefaultFlow(element.getId());
}
childNodeMap.put(element.getId(), element);
ChildNode childNode = element.getChildNode();
String nodeName = element.getName();
Properties props = element.getProps();
String expression = props.getExpression();
if (Objects.isNull(childNode) || StringUtils.isBlank(childNode.getId())) {
incoming.add(exclusiveGatewayId);
JSONObject condition = new JSONObject();
condition.fluentPut("nodeName", nodeName)
.fluentPut("expression", expression)
.fluentPut("groups", props.getGroups())
.fluentPut("groupsType", props.getGroupsType()
)
.fluentPut("elseSequenceFlowId", element.getId());
conditions.add(condition);
continue;
}
// 只生成一个任务,同时设置当前任务的条件
JSONObject incomingObj = childNode.getIncoming();
incomingObj.put("incoming", Collections.singletonList(exclusiveGatewayId));
String identifier = create(exclusiveGatewayId, childNode, process, bpmnModel, sequenceFlows, childNodeMap);
List<SequenceFlow> flows = sequenceFlows.stream().filter(flow -> StringUtils.equals(exclusiveGatewayId, flow.getSourceRef()))
.collect(Collectors.toList());
flows.stream().forEach(
e -> {
if (StringUtils.isBlank(e.getName()) && StringUtils.isNotBlank(nodeName)) {
e.setName(nodeName);
}
// 设置条件表达式
if (Objects.isNull(e.getConditionExpression()) && StringUtils.isNotBlank(expression)) {
e.setConditionExpression(expression);
}
}
);
if (Objects.nonNull(identifier)) {
incoming.add(identifier);
}
}
ChildNode childNode = flowNode.getChildNode();
if (Objects.nonNull(childNode) && StringUtils.isNotBlank(childNode.getId())) {
String parentId = childNode.getParentId();
ChildNode parentChildNode = childNodeMap.get(parentId);
boolean conFlag = Type.CONCURRENTS.type
.equals(parentChildNode.getType());
if (!conFlag) {
String type = childNode.getType();
if (!Type.EMPTY.type.equals(type)) {
} else {
if (Type.CONDITIONS.type.equals(parentChildNode.getType())) {
String endExId = parentChildNode.getId() + "end";
process.addFlowElement(createExclusiveGateWayEnd(endExId));
if (incoming == null || incoming.isEmpty()) {
return create(exclusiveGatewayId, childNode, process, bpmnModel, sequenceFlows,
childNodeMap);
} else {
JSONObject incomingObj = childNode.getIncoming();
// 所有 service task 连接 end exclusive gateway
incomingObj.put("incoming", incoming);
FlowElement flowElement = bpmnModel.getFlowElement(incoming.get(0));
// 1.0 先进行边连接, 暂存 nextNode
ChildNode nextNode = childNode.getChildNode();
childNode.setChildNode(null);
String identifier = endExId;
for (int i = 0; i < incoming.size(); i++) {
process.addFlowElement(connect(incoming.get(i), identifier, sequenceFlows, childNodeMap, process));
}
// 针对 gateway 空任务分支 添加条件表达式
if (!conditions.isEmpty()) {
FlowElement flowElement1 = bpmnModel.getFlowElement(identifier);
// 获取从 gateway 到目标节点 未设置条件表达式的节点
List<SequenceFlow> flows = sequenceFlows.stream().filter(
flow -> StringUtils.equals(flowElement1.getId(), flow.getTargetRef()))
.filter(
flow -> StringUtils.equals(flow.getSourceRef(), exclusiveGatewayId))
.collect(Collectors.toList());
flows.stream().forEach(sequenceFlow -> {
if (!conditions.isEmpty()) {
JSONObject condition = conditions.get(0);
String nodeName = condition.getString("nodeName");
String expression = condition.getString("expression");
if (StringUtils.isBlank(sequenceFlow.getName()) && StringUtils
.isNotBlank(nodeName)) {
sequenceFlow.setName(nodeName);
}
// 设置条件表达式
if (Objects.isNull(sequenceFlow.getConditionExpression())
&& StringUtils.isNotBlank(expression)) {
sequenceFlow.setConditionExpression(expression);
}
FlowElement flowElement2 = process.getFlowElement(sequenceFlow.getId());
if (flowElement2 != null) {
flowElement2.setId(condition.getString("elseSequenceFlowId"));
exclusiveGateway.setDefaultFlow(flowElement2.getId());
;
}
conditions.remove(0);
}
});
}
// 1.1 边连接完成后,在进行 nextNode 创建
if (Objects.nonNull(nextNode) && StringUtils.isNotBlank(nextNode.getId())) {
return create(identifier, nextNode, process, bpmnModel, sequenceFlows,
childNodeMap);
} else {
return identifier;
}
}
}
}
} else {
System.err.println("-");
}
}
return exclusiveGatewayId;
}
public static ExclusiveGateway createExclusiveGateWayEnd(String id) {
ExclusiveGateway exclusiveGateway = new ExclusiveGateway();
exclusiveGateway.setId(id);
return exclusiveGateway;
}
private static ParallelGateway createParallelGateWayEnd(String id) {
ParallelGateway parallelGateway = new ParallelGateway();
parallelGateway.setId(id);
return parallelGateway;
}
private static String createParallelGatewayBuilder(String formId, ChildNode flowNode, Process process, BpmnModel bpmnModel, List<SequenceFlow> sequenceFlows, Map<String, ChildNode> childNodeMap) throws InvocationTargetException, IllegalAccessException {
childNodeMap.put(flowNode.getId(), flowNode);
String name = flowNode.getName();
ParallelGateway parallelGateway = new ParallelGateway();
String parallelGatewayId = flowNode.getId();
parallelGateway.setId(parallelGatewayId);
parallelGateway.setName(name);
process.addFlowElement(parallelGateway);
process.addFlowElement(connect(formId, parallelGatewayId, sequenceFlows, childNodeMap, process));
if (Objects.isNull(flowNode.getConditionNodes()) && Objects.isNull(flowNode.getChildNode())) {
return parallelGatewayId;
}
List<ChildNode> flowNodes = flowNode.getConditionNodes();
List<String> incoming = Lists.newArrayListWithCapacity(flowNodes.size());
for (ChildNode element : flowNodes) {
childNodeMap.put(element.getId(), element);
ChildNode childNode = element.getChildNode();
if (Objects.isNull(childNode) || StringUtils.isBlank(childNode.getId())) {
incoming.add(parallelGatewayId);
continue;
}
String identifier = create(parallelGatewayId, childNode, process, bpmnModel, sequenceFlows, childNodeMap);
if (Objects.nonNull(identifier)) {
incoming.add(identifier);
}
}
ChildNode childNode = flowNode.getChildNode();
if (Objects.nonNull(childNode) && StringUtils.isNotBlank(childNode.getId())) {
String parentId = childNode.getParentId();
ChildNode parentChildNode = childNodeMap.get(parentId);
boolean conFlag = Type.CONCURRENTS.type
.equals(parentChildNode.getType());
if (!conFlag) {
String type = childNode.getType();
if (!Type.EMPTY.type.equals(type)) {
} else {
if (Type.CONCURRENTS.type.equals(parentChildNode.getType())) {
String endExId = parentChildNode.getId() + "end";
process.addFlowElement(createParallelGateWayEnd(endExId));
// 普通结束网关
if (CollectionUtils.isEmpty(incoming)) {
return create(parallelGatewayId, childNode, process, bpmnModel, sequenceFlows, childNodeMap);
} else {
JSONObject incomingObj = childNode.getIncoming();
// 所有 service task 连接 end parallel gateway
incomingObj.put("incoming", incoming);
FlowElement flowElement = bpmnModel.getFlowElement(incoming.get(0));
// 1.0 先进行边连接, 暂存 nextNode
ChildNode nextNode = childNode.getChildNode();
childNode.setChildNode(null);
String identifier = endExId;
for (int i = 0; i < incoming.size(); i++) {
FlowElement flowElement1 = bpmnModel.getFlowElement(incoming.get(i));
process.addFlowElement(connect(flowElement1.getId(), identifier, sequenceFlows, childNodeMap, process));
}
// 1.1 边连接完成后,在进行 nextNode 创建
if (Objects.nonNull(nextNode) && StringUtils.isNotBlank(nextNode.getId())) {
return create(identifier, nextNode, process, bpmnModel, sequenceFlows, childNodeMap);
} else {
return identifier;
}
}
}
}
} else {
String type = childNode.getType();
if (!Type.EMPTY.type.equals(type)) {
} else {
if (Type.CONCURRENTS.type.equals(parentChildNode.getType())) {
String endExId = parentChildNode.getId() + "end";
process.addFlowElement(createParallelGateWayEnd(endExId));
// 普通结束网关
if (CollectionUtils.isEmpty(incoming)) {
return create(parallelGatewayId, childNode, process, bpmnModel, sequenceFlows, childNodeMap);
} else {
JSONObject incomingObj = childNode.getIncoming();
// 所有 service task 连接 end parallel gateway
incomingObj.put("incoming", incoming);
FlowElement flowElement = bpmnModel.getFlowElement(incoming.get(0));
// 1.0 先进行边连接, 暂存 nextNode
ChildNode nextNode = childNode.getChildNode();
childNode.setChildNode(null);
String identifier = endExId;
for (int i = 0; i < incoming.size(); i++) {
FlowElement flowElement1 = bpmnModel.getFlowElement(incoming.get(i));
process.addFlowElement(connect(flowElement1.getId(), identifier, sequenceFlows, childNodeMap, process));
}
// 1.1 边连接完成后,在进行 nextNode 创建
if (Objects.nonNull(nextNode) && StringUtils.isNotBlank(nextNode.getId())) {
return create(identifier, nextNode, process, bpmnModel, sequenceFlows, childNodeMap);
} else {
return identifier;
}
}
}
}
}
}
return parallelGatewayId;
}
private static String createTask(Process process, ChildNode flowNode, List<SequenceFlow> sequenceFlows, Map<String, ChildNode> childNodeMap) {
JSONObject incomingJson = flowNode.getIncoming();
List<String> incoming = incomingJson.getJSONArray("incoming").toJavaList(String.class);
// 自动生成id
// String id = id("serviceTask");
String id = flowNode.getId();
if (incoming != null && !incoming.isEmpty()) {
UserTask userTask = new UserTask();
userTask.setName(flowNode.getName());
userTask.setId(id);
process.addFlowElement(userTask);
process.addFlowElement(connect(incoming.get(0), id, sequenceFlows, childNodeMap, process));
ArrayList<FlowableListener> taskListeners = new ArrayList<>();
FlowableListener taskListener = new FlowableListener();
// 事件类型,
taskListener.setEvent(TaskListener.EVENTNAME_CREATE);
// 监听器类型
taskListener.setImplementationType(IMPLEMENTATION_TYPE_DELEGATEEXPRESSION);
// 设置实现了,这里设置监听器的类型是delegateExpression,这样可以在实现类注入Spring bean.
taskListener.setImplementation("${taskCreatedListener}");
taskListeners.add(taskListener);
userTask.setTaskListeners(taskListeners);
if ("root".equalsIgnoreCase(id)) {
} else {
ArrayList<FlowableListener> listeners = new ArrayList<>();
FlowableListener activitiListener = new FlowableListener();
// 事件类型,
activitiListener.setEvent(ExecutionListener.EVENTNAME_START);
// 监听器类型
activitiListener.setImplementationType(IMPLEMENTATION_TYPE_DELEGATEEXPRESSION);
// 设置实现了,这里设置监听器的类型是delegateExpression,这样可以在实现类注入Spring bean.
activitiListener.setImplementation("${counterSignListener}");
listeners.add(activitiListener);
userTask.setExecutionListeners(listeners);
Properties props = flowNode.getProps();
String mode = props.getMode();
MultiInstanceLoopCharacteristics multiInstanceLoopCharacteristics = new MultiInstanceLoopCharacteristics();
// 审批人集合参数
multiInstanceLoopCharacteristics.setInputDataItem(userTask.getId() + "assigneeList");
// 迭代集合
multiInstanceLoopCharacteristics.setElementVariable("assigneeName");
// 并行
multiInstanceLoopCharacteristics.setSequential(false);
userTask.setAssignee("${assigneeName}");
// 设置多实例属性
userTask.setLoopCharacteristics(multiInstanceLoopCharacteristics);
if (ModeEnums.OR.getTypeName().equals(mode)) {
multiInstanceLoopCharacteristics.setCompletionCondition("${nrOfCompletedInstances/nrOfInstances > 0}");
} else if (ModeEnums.NEXT.getTypeName().equals(mode)) {
multiInstanceLoopCharacteristics.setSequential(true);
}
JSONObject timeLimit = props.getTimeLimit();
if (timeLimit != null && !timeLimit.isEmpty()) {
JSONObject timeout = timeLimit.getJSONObject("timeout");
if (timeout != null && !timeout.isEmpty()) {
String unit = timeout.getString("unit");
Integer value = timeout.getInteger("value");
if (value > 0) {
List<BoundaryEvent> boundaryEvents = new ArrayList<>();
BoundaryEvent boundaryEvent = new BoundaryEvent();
boundaryEvent.setId(id("boundaryEvent"));
boundaryEvent.setAttachedToRefId(id);
boundaryEvent.setAttachedToRef(userTask);
boundaryEvent.setCancelActivity(Boolean.TRUE);
TimerEventDefinition timerEventDefinition = new TimerEventDefinition();
timerEventDefinition.setTimeDuration("PT" + 1 + "M");
timerEventDefinition.setId(id("timerEventDefinition"));
boundaryEvent.addEventDefinition(timerEventDefinition);
FlowableListener flowableListener = new FlowableListener();
flowableListener.setEvent(ExecutionListener.EVENTNAME_END);
flowableListener.setImplementationType(IMPLEMENTATION_TYPE_CLASS);
flowableListener.setImplementation("com.dingding.mid.listener.TimerListener");
List<FlowableListener> listenerList = new ArrayList<>();
listenerList.add(flowableListener);
boundaryEvent.setExecutionListeners(listenerList);
process.addFlowElement(boundaryEvent);
boundaryEvents.add(boundaryEvent);
userTask.setBoundaryEvents(boundaryEvents);
}
}
}
}
}
return id;
}
private static String createServiceTask(Process process, ChildNode flowNode, List<SequenceFlow> sequenceFlows, Map<String, ChildNode> childNodeMap) {
JSONObject incomingJson = flowNode.getIncoming();
List<String> incoming = incomingJson.getJSONArray("incoming").toJavaList(String.class);
String id = flowNode.getId();
if (incoming != null && !incoming.isEmpty()) {
}
return id;
}
private enum Type {
/**
* 并行事件
*/
CONCURRENTS("CONCURRENTS", ParallelGateway.class),
CONCURRENT("CONCURRENT", SequenceFlow.class),
/**
* 排他事件
*/
CONDITION("CONDITION", ExclusiveGateway.class),
CONDITIONS("CONDITIONS", ExclusiveGateway.class),
/**
* 任务
*/
USER_TASK("APPROVAL", UserTask.class),
EMPTY("EMPTY", Object.class),
ROOT("ROOT", UserTask.class),
CC("CC", ServiceTask.class),
TRIGGER("TRIGGER", ServiceTask.class),
DELAY("DELAY", IntermediateCatchEvent.class);
private String type;
private Class<?> typeClass;
Type(String type, Class<?> typeClass) {
this.type = type;
this.typeClass = typeClass;
}
public final static Map<String, Class<?>> TYPE_MAP = Maps.newHashMap();
static {
for (Type element : Type.values()) {
TYPE_MAP.put(element.type, element.typeClass);
}
}
public boolean isEqual(String type) {
return this.type.equals(type);
}
}
private enum FlowType {
/**
* 并行事件
*/
CONCURRENTS(0, ParallelGateway.class),
CONCURRENT(1, SequenceFlow.class),
/**
* 排他事件
*/
CONDITION(2, ExclusiveGateway.class),
CONDITIONS(3, ExclusiveGateway.class),
/**
* 任务
*/
USER_TASK(4, UserTask.class),
EMPTY(5, Object.class),
ROOT(6, UserTask.class),
CC(7, ServiceTask.class),
TRIGGER(8, ServiceTask.class),
DELAY(9, IntermediateCatchEvent.class);
private int type;
private Class<?> typeClass;
FlowType(int type, Class<?> typeClass) {
this.type = type;
this.typeClass = typeClass;
}
public final static Map<String, Class<?>> TYPE_MAP = Maps.newHashMap();
static {
for (Type element : Type.values()) {
TYPE_MAP.put(element.type, element.typeClass);
}
}
public boolean isEqual(int type) {
return this.type == (type);
}
}
public static ChildNode getChildNode(ChildNode childNode, String nodeId) {
Map<String, ChildNode> childNodeMap = new HashMap<>();
if (StringUtils.isNotBlank(childNode.getId())) {
getChildNode(childNode, childNodeMap);
}
Set<String> set = childNodeMap.keySet();
for (String s : set) {
if (StringUtils.isNotBlank(s)) {
if (("Node_"+s).equals(nodeId)) {
return childNodeMap.get(s);
}
}
}
return null;
}
private static void getChildNode(ChildNode childNode, Map<String, ChildNode> childNodeMap) {
childNodeMap.put(childNode.getId(), childNode);
List<ChildNode> branchs = childNode.getConditionNodes();
ChildNode children = childNode.getChildNode();
if (branchs != null && branchs.size() > 0) {
for (ChildNode branch : branchs) {
if (StringUtils.isNotBlank(branch.getId())) {
childNodeMap.put(branch.getId(), branch);
getChildNode(branch, childNodeMap);
}
}
}
if (children != null) {
childNodeMap.put(children.getId(), children);
getChildNode(children, childNodeMap);
}
}
}
package com.junmp.junmpProcess.utils;
import org.springframework.util.StringUtils;
import java.beans.PropertyEditorSupport;
import java.sql.Timestamp;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
/**
* 类描述:时间操作定义类
*
* @Author: 张代浩
* @Date:2012-12-8 12:15:03
* @Version 1.0
*/
public class DateUtils extends PropertyEditorSupport {
public static ThreadLocal<SimpleDateFormat> date_sdf = new ThreadLocal<SimpleDateFormat>() {
@Override
protected SimpleDateFormat initialValue() {
return new SimpleDateFormat("yyyy-MM-dd");
}
};
public static ThreadLocal<SimpleDateFormat> yyyyMMdd = new ThreadLocal<SimpleDateFormat>() {
@Override
protected SimpleDateFormat initialValue() {
return new SimpleDateFormat("yyyyMMdd");
}
};
public static ThreadLocal<SimpleDateFormat> date_sdf_wz = new ThreadLocal<SimpleDateFormat>() {
@Override
protected SimpleDateFormat initialValue() {
return new SimpleDateFormat("yyyy年MM月dd日");
}
};
public static ThreadLocal<SimpleDateFormat> time_sdf = new ThreadLocal<SimpleDateFormat>() {
@Override
protected SimpleDateFormat initialValue() {
return new SimpleDateFormat("yyyy-MM-dd HH:mm");
}
};
public static ThreadLocal<SimpleDateFormat> yyyymmddhhmmss = new ThreadLocal<SimpleDateFormat>() {
@Override
protected SimpleDateFormat initialValue() {
return new SimpleDateFormat("yyyyMMddHHmmss");
}
};
public static ThreadLocal<SimpleDateFormat> short_time_sdf = new ThreadLocal<SimpleDateFormat>() {
@Override
protected SimpleDateFormat initialValue() {
return new SimpleDateFormat("HH:mm");
}
};
public static ThreadLocal<SimpleDateFormat> datetimeFormat = new ThreadLocal<SimpleDateFormat>() {
@Override
protected SimpleDateFormat initialValue() {
return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
}
};
// 以毫秒表示的时间
private static final long DAY_IN_MILLIS = 24 * 3600 * 1000;
private static final long HOUR_IN_MILLIS = 3600 * 1000;
private static final long MINUTE_IN_MILLIS = 60 * 1000;
private static final long SECOND_IN_MILLIS = 1000;
// 指定模式的时间格式
private static SimpleDateFormat getSDFormat(String pattern) {
return new SimpleDateFormat(pattern);
}
/**
* 当前日历,这里用中国时间表示
*
* @return 以当地时区表示的系统当前日历
*/
public static Calendar getCalendar() {
return Calendar.getInstance();
}
/**
* 指定毫秒数表示的日历
*
* @param millis 毫秒数
* @return 指定毫秒数表示的日历
*/
public static Calendar getCalendar(long millis) {
Calendar cal = Calendar.getInstance();
// --------------------cal.setTimeInMillis(millis);
cal.setTime(new Date(millis));
return cal;
}
// ////////////////////////////////////////////////////////////////////////////
// getDate
// 各种方式获取的Date
// ////////////////////////////////////////////////////////////////////////////
/**
* 当前日期
*
* @return 系统当前时间
*/
public static Date getDate() {
return new Date();
}
/**
* 指定毫秒数表示的日期
*
* @param millis 毫秒数
* @return 指定毫秒数表示的日期
*/
public static Date getDate(long millis) {
return new Date(millis);
}
/**
* 时间戳转换为字符串
*
* @param time
* @return
*/
public static String timestamptoStr(Timestamp time) {
Date date = null;
if (null != time) {
date = new Date(time.getTime());
}
return date2Str(date_sdf.get());
}
/**
* 字符串转换时间戳
*
* @param str
* @return
*/
public static Timestamp str2Timestamp(String str) {
Date date = str2Date(str, date_sdf.get());
return new Timestamp(date.getTime());
}
/**
* 字符串转换成日期
*
* @param str
* @param sdf
* @return
*/
public static Date str2Date(String str, SimpleDateFormat sdf) {
if (null == str || "".equals(str)) {
return null;
}
Date date = null;
try {
date = sdf.parse(str);
return date;
} catch (ParseException e) {
e.printStackTrace();
}
return null;
}
/**
* 日期转换为字符串
*
* @param date_sdf 日期格式
* @return 字符串
*/
public static String date2Str(SimpleDateFormat date_sdf) {
Date date = getDate();
if (null == date) {
return null;
}
return date_sdf.format(date);
}
/**
* 格式化时间
*
* @param date
* @param format
* @return
*/
public static String dateformat(String date, String format) {
SimpleDateFormat sformat = new SimpleDateFormat(format);
Date _date = null;
try {
_date = sformat.parse(date);
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return sformat.format(_date);
}
/**
* 日期转换为字符串
*
* @param date 日期
* @param date_sdf 日期格式
* @return 字符串
*/
public static String date2Str(Date date, SimpleDateFormat date_sdf) {
if (null == date) {
return null;
}
return date_sdf.format(date);
}
/**
* 日期转换为字符串
*
* @param format 日期格式
* @return 字符串
*/
public static String getDate(String format) {
Date date = new Date();
if (null == date) {
return null;
}
SimpleDateFormat sdf = new SimpleDateFormat(format);
return sdf.format(date);
}
/**
* 指定毫秒数的时间戳
*
* @param millis 毫秒数
* @return 指定毫秒数的时间戳
*/
public static Timestamp getTimestamp(long millis) {
return new Timestamp(millis);
}
/**
* 以字符形式表示的时间戳
*
* @param time 毫秒数
* @return 以字符形式表示的时间戳
*/
public static Timestamp getTimestamp(String time) {
return new Timestamp(Long.parseLong(time));
}
/**
* 系统当前的时间戳
*
* @return 系统当前的时间戳
*/
public static Timestamp getTimestamp() {
return new Timestamp(System.currentTimeMillis());
}
/**
* 当前时间,格式 yyyy-MM-dd HH:mm:ss
*
* @return 当前时间的标准形式字符串
*/
public static String now() {
return datetimeFormat.get().format(getCalendar().getTime());
}
/**
* 指定日期的时间戳
*
* @param date 指定日期
* @return 指定日期的时间戳
*/
public static Timestamp getTimestamp(Date date) {
return new Timestamp(date.getTime());
}
/**
* 指定日历的时间戳
*
* @param cal 指定日历
* @return 指定日历的时间戳
*/
public static Timestamp getCalendarTimestamp(Calendar cal) {
// ---------------------return new Timestamp(cal.getTimeInMillis());
return new Timestamp(cal.getTime().getTime());
}
public static Timestamp gettimestamp() {
Date dt = new Date();
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String nowTime = df.format(dt);
Timestamp buydate = Timestamp.valueOf(nowTime);
return buydate;
}
// ////////////////////////////////////////////////////////////////////////////
// getMillis
// 各种方式获取的Millis
// ////////////////////////////////////////////////////////////////////////////
/**
* 系统时间的毫秒数
*
* @return 系统时间的毫秒数
*/
public static long getMillis() {
return System.currentTimeMillis();
}
/**
* 指定日历的毫秒数
*
* @param cal 指定日历
* @return 指定日历的毫秒数
*/
public static long getMillis(Calendar cal) {
// --------------------return cal.getTimeInMillis();
return cal.getTime().getTime();
}
/**
* 指定日期的毫秒数
*
* @param date 指定日期
* @return 指定日期的毫秒数
*/
public static long getMillis(Date date) {
return date.getTime();
}
/**
* 指定时间戳的毫秒数
*
* @param ts 指定时间戳
* @return 指定时间戳的毫秒数
*/
public static long getMillis(Timestamp ts) {
return ts.getTime();
}
// ////////////////////////////////////////////////////////////////////////////
// formatDate
// 将日期按照一定的格式转化为字符串
// ////////////////////////////////////////////////////////////////////////////
/**
* 默认方式表示的系统当前日期,具体格式:年-月-日
*
* @return 默认日期按“年-月-日“格式显示
*/
public static String formatDate() {
return date_sdf.get().format(getCalendar().getTime());
}
/**
* 默认方式表示的系统当前日期,具体格式:yyyy-MM-dd HH:mm:ss
*
* @return 默认日期按“yyyy-MM-dd HH:mm:ss“格式显示
*/
public static String formatDateTime() {
return datetimeFormat.get().format(getCalendar().getTime());
}
/**
* 获取时间字符串
*/
public static String getDataString(SimpleDateFormat formatstr) {
return formatstr.format(getCalendar().getTime());
}
/**
* 指定日期的默认显示,具体格式:年-月-日
*
* @param cal 指定的日期
* @return 指定日期按“年-月-日“格式显示
*/
public static String formatDate(Calendar cal) {
return date_sdf.get().format(cal.getTime());
}
/**
* 指定日期的默认显示,具体格式:年-月-日
*
* @param date 指定的日期
* @return 指定日期按“年-月-日“格式显示
*/
public static String formatDate(Date date) {
return date_sdf.get().format(date);
}
/**
* 指定毫秒数表示日期的默认显示,具体格式:年-月-日
*
* @param millis 指定的毫秒数
* @return 指定毫秒数表示日期按“年-月-日“格式显示
*/
public static String formatDate(long millis) {
return date_sdf.get().format(new Date(millis));
}
/**
* 默认日期按指定格式显示
*
* @param pattern 指定的格式
* @return 默认日期按指定格式显示
*/
public static String formatDate(String pattern) {
return getSDFormat(pattern).format(getCalendar().getTime());
}
/**
* 指定日期按指定格式显示
*
* @param cal 指定的日期
* @param pattern 指定的格式
* @return 指定日期按指定格式显示
*/
public static String formatDate(Calendar cal, String pattern) {
return getSDFormat(pattern).format(cal.getTime());
}
/**
* 指定日期按指定格式显示
*
* @param date 指定的日期
* @param pattern 指定的格式
* @return 指定日期按指定格式显示
*/
public static String formatDate(Date date, String pattern) {
return getSDFormat(pattern).format(date);
}
// ////////////////////////////////////////////////////////////////////////////
// formatTime
// 将日期按照一定的格式转化为字符串
// ////////////////////////////////////////////////////////////////////////////
/**
* 默认方式表示的系统当前日期,具体格式:年-月-日 时:分
*
* @return 默认日期按“年-月-日 时:分“格式显示
*/
public static String formatTime() {
return time_sdf.get().format(getCalendar().getTime());
}
/**
* 指定毫秒数表示日期的默认显示,具体格式:年-月-日 时:分
*
* @param millis 指定的毫秒数
* @return 指定毫秒数表示日期按“年-月-日 时:分“格式显示
*/
public static String formatTime(long millis) {
return time_sdf.get().format(new Date(millis));
}
/**
* 指定日期的默认显示,具体格式:年-月-日 时:分
*
* @param cal 指定的日期
* @return 指定日期按“年-月-日 时:分“格式显示
*/
public static String formatTime(Calendar cal) {
return time_sdf.get().format(cal.getTime());
}
/**
* 指定日期的默认显示,具体格式:年-月-日 时:分
*
* @param date 指定的日期
* @return 指定日期按“年-月-日 时:分“格式显示
*/
public static String formatTime(Date date) {
return time_sdf.get().format(date);
}
// ////////////////////////////////////////////////////////////////////////////
// formatShortTime
// 将日期按照一定的格式转化为字符串
// ////////////////////////////////////////////////////////////////////////////
/**
* 默认方式表示的系统当前日期,具体格式:时:分
*
* @return 默认日期按“时:分“格式显示
*/
public static String formatShortTime() {
return short_time_sdf.get().format(getCalendar().getTime());
}
/**
* 指定毫秒数表示日期的默认显示,具体格式:时:分
*
* @param millis 指定的毫秒数
* @return 指定毫秒数表示日期按“时:分“格式显示
*/
public static String formatShortTime(long millis) {
return short_time_sdf.get().format(new Date(millis));
}
/**
* 指定日期的默认显示,具体格式:时:分
*
* @param cal 指定的日期
* @return 指定日期按“时:分“格式显示
*/
public static String formatShortTime(Calendar cal) {
return short_time_sdf.get().format(cal.getTime());
}
/**
* 指定日期的默认显示,具体格式:时:分
*
* @param date 指定的日期
* @return 指定日期按“时:分“格式显示
*/
public static String formatShortTime(Date date) {
return short_time_sdf.get().format(date);
}
// ////////////////////////////////////////////////////////////////////////////
// parseDate
// parseCalendar
// parseTimestamp
// 将字符串按照一定的格式转化为日期或时间
// ////////////////////////////////////////////////////////////////////////////
/**
* 根据指定的格式将字符串转换成Date 如输入:2003-11-19 11:20:20将按照这个转成时间
*
* @param src 将要转换的原始字符窜
* @param pattern 转换的匹配格式
* @return 如果转换成功则返回转换后的日期
* @throws ParseException
*/
public static Date parseDate(String src, String pattern) throws ParseException {
return getSDFormat(pattern).parse(src);
}
/**
* 根据指定的格式将字符串转换成Date 如输入:2003-11-19 11:20:20将按照这个转成时间
*
* @param src 将要转换的原始字符窜
* @param pattern 转换的匹配格式
* @return 如果转换成功则返回转换后的日期
* @throws ParseException
*/
public static Calendar parseCalendar(String src, String pattern) throws ParseException {
Date date = parseDate(src, pattern);
Calendar cal = Calendar.getInstance();
cal.setTime(date);
return cal;
}
public static String formatAddDate(String src, String pattern, int amount) throws ParseException {
Calendar cal;
cal = parseCalendar(src, pattern);
cal.add(Calendar.DATE, amount);
return formatDate(cal);
}
/**
* 根据指定的格式将字符串转换成Date 如输入:2003-11-19 11:20:20将按照这个转成时间
*
* @param src 将要转换的原始字符窜
* @param pattern 转换的匹配格式
* @return 如果转换成功则返回转换后的时间戳
* @throws ParseException
*/
public static Timestamp parseTimestamp(String src, String pattern) throws ParseException {
Date date = parseDate(src, pattern);
return new Timestamp(date.getTime());
}
// ////////////////////////////////////////////////////////////////////////////
// dateDiff
// 计算两个日期之间的差值
// ////////////////////////////////////////////////////////////////////////////
/**
* 计算两个时间之间的差值,根据标志的不同而不同
*
* @param flag 计算标志,表示按照年/月/日/时/分/秒等计算
* @param calSrc 减数
* @param calDes 被减数
* @return 两个日期之间的差值
*/
public static int dateDiff(char flag, Calendar calSrc, Calendar calDes) {
long millisDiff = getMillis(calSrc) - getMillis(calDes);
if (flag == 'y') {
return (calSrc.get(Calendar.YEAR) - calDes.get(Calendar.YEAR));
}
if (flag == 'd') {
return (int) (millisDiff / DAY_IN_MILLIS);
}
if (flag == 'h') {
return (int) (millisDiff / HOUR_IN_MILLIS);
}
if (flag == 'm') {
return (int) (millisDiff / MINUTE_IN_MILLIS);
}
if (flag == 's') {
return (int) (millisDiff / SECOND_IN_MILLIS);
}
return 0;
}
/**
* String类型 转换为Date, 如果参数长度为10 转换格式”yyyy-MM-dd“ 如果参数长度为19 转换格式”yyyy-MM-dd
* HH:mm:ss“ * @param text String类型的时间值
*/
@Override
public void setAsText(String text) throws IllegalArgumentException {
if (StringUtils.hasText(text)) {
try {
if (text.indexOf(":") == -1 && text.length() == 10) {
setValue(DateUtils.date_sdf.get().parse(text));
} else if (text.indexOf(":") > 0 && text.length() == 19) {
setValue(DateUtils.datetimeFormat.get().parse(text));
} else {
throw new IllegalArgumentException("Could not parse date, date format is error ");
}
} catch (ParseException ex) {
IllegalArgumentException iae = new IllegalArgumentException("Could not parse date: " + ex.getMessage());
iae.initCause(ex);
throw iae;
}
} else {
setValue(null);
}
}
public static int getYear() {
GregorianCalendar calendar = new GregorianCalendar();
calendar.setTime(getDate());
return calendar.get(Calendar.YEAR);
}
}
package com.junmp.junmpProcess.utils;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.NumberUtil;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.junmp.junmpProcess.dto.json.UserInfo;
import org.springframework.stereotype.Component;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
/**
* @author LoveMyOrange
* @create 2022-10-16 22:13
*/
@Component
public class ExUtils {
public Boolean strEqualsMethod(String controlId, String value) {
List<String> list = Arrays.asList(value);
String s = list.get(0);
return s.equals(controlId);
}
public Boolean strEqualsMethod(String controlId, String... values) {
List<String> list = Arrays.asList(values);
if (list.size() > 1) {
return Boolean.FALSE;
} else {
String s = list.get(0);
return s.equals(controlId);
}
}
public Boolean strContains(String controlId, String... values) {
List<String> list = Arrays.asList(values);
return list.contains(controlId);
}
public Boolean strContains(String controlId, Number... values) {
Long aLong = Long.valueOf(controlId);
List<Number> numbers = Arrays.asList(values);
return numbers.contains(aLong);
}
public Boolean strContainsMethod(String controlId, String... values) {
List<String> strings = Arrays.asList(values);
return strings.contains(controlId);
}
public Boolean userStrContainsMethod(String controlId, String... values) {
List<String> strings = Arrays.asList(values);
List<UserInfo> userInfos = JSONObject.parseObject(controlId, new TypeReference<List<UserInfo>>() {
});
List<String> idsList = new ArrayList<>();
for (UserInfo userInfo : userInfos) {
idsList.add(userInfo.getId());
}
Collection<String> intersection = CollUtil.intersection(strings, idsList);
if (CollUtil.isEmpty(intersection)) {
return Boolean.FALSE;
}
return Boolean.TRUE;
}
public Boolean deptStrContainsMethod(String controlId, String... values) {
List<String> strings = Arrays.asList(values);
List<UserInfo> userInfos = JSONObject.parseObject(controlId, new TypeReference<List<UserInfo>>() {
});
List<String> idsList = new ArrayList<>();
for (UserInfo userInfo : userInfos) {
idsList.add(userInfo.getId());
}
Collection<String> intersection = CollUtil.intersection(strings, idsList);
if (CollUtil.isEmpty(intersection)) {
return Boolean.FALSE;
}
return Boolean.TRUE;
}
public Boolean numberContains(Number controlId, Number... values) {
List<Number> list = Arrays.asList(values);
return list.contains(controlId);
}
public Boolean b(String controlId, Number... values) {
List<Number> numbers = Arrays.asList(values);
Long aLong = Long.valueOf(controlId);
if (aLong > numbers.get(0).longValue() && aLong < numbers.get(1).longValue()) {
return Boolean.TRUE;
}
return Boolean.FALSE;
}
public Boolean ab(String controlId, Number... values) {
List<Number> numbers = Arrays.asList(values);
Long aLong = Long.valueOf(controlId);
if (aLong >= numbers.get(0).longValue() && aLong < numbers.get(1).longValue()) {
return Boolean.TRUE;
}
return Boolean.FALSE;
}
public Boolean ba(String controlId, Number... values) {
List<Number> numbers = Arrays.asList(values);
Long aLong = Long.valueOf(controlId);
if (aLong > numbers.get(0).longValue() && aLong <= numbers.get(1).longValue()) {
return Boolean.TRUE;
}
return Boolean.FALSE;
}
public Boolean aba(String controlId, Number... values) {
List<Number> numbers = Arrays.asList(values);
Long aLong = Long.valueOf(controlId);
if (aLong >= numbers.get(0).longValue() && aLong <= numbers.get(1).longValue()) {
return Boolean.TRUE;
}
return Boolean.FALSE;
}
/**
* conditionExpression.append(" "+ EXPRESSION_CLASS+"numberEquals("+id+","+str+") " );
* conditionExpression.append(" "+ EXPRESSION_CLASS+"numberGt("+id+","+str+") " );
* conditionExpression.append(" "+ EXPRESSION_CLASS+"numberGtEquals("+id+","+str+") " );
* conditionExpression.append(" "+ EXPRESSION_CLASS+"numberLt("+id+","+str+") " );
* conditionExpression.append(" "+ EXPRESSION_CLASS+"numberLtEquals("+id+","+str+") " );
*/
public Boolean numberEquals(String controlId, String value) {
Double a = Double.valueOf(controlId);
Double b = Double.valueOf(value);
boolean equals = a.equals(b);
return equals;
}
public Boolean numberGt(String controlId, String value) {
Double a = Double.valueOf(controlId);
BigDecimal a1 = BigDecimal.valueOf(a);
Double b = Double.valueOf(value);
BigDecimal a2 = BigDecimal.valueOf(b);
boolean greater = NumberUtil.isGreater(a1, a2);
return greater;
}
public Boolean numberGtEquals(String controlId, String value) {
Double a = Double.valueOf(controlId);
BigDecimal a1 = BigDecimal.valueOf(a);
Double b = Double.valueOf(value);
BigDecimal a2 = BigDecimal.valueOf(b);
boolean greater = NumberUtil.isGreaterOrEqual(a1, a2);
return greater;
}
public Boolean numberLt(String controlId, String value) {
Double a = Double.valueOf(controlId);
BigDecimal a1 = BigDecimal.valueOf(a);
Double b = Double.valueOf(value);
BigDecimal a2 = BigDecimal.valueOf(b);
boolean greater = NumberUtil.isLess(a1, a2);
return greater;
}
public Boolean numberLtEquals(String controlId, String value) {
Double a = Double.valueOf(controlId);
BigDecimal a1 = BigDecimal.valueOf(a);
Double b = Double.valueOf(value);
BigDecimal a2 = BigDecimal.valueOf(b);
boolean greater = NumberUtil.isLessOrEqual(a1, a2);
return greater;
}
}
//package org.modules.junmpProcess.utils;
//
//import lombok.Cleanup;
//import lombok.extern.slf4j.Slf4j;
//import org.apache.commons.fileupload.FileItem;
//import org.apache.commons.fileupload.FileItemFactory;
//import org.apache.commons.fileupload.disk.DiskFileItem;
//import org.apache.commons.fileupload.disk.DiskFileItemFactory;
//import org.apache.commons.lang3.StringUtils;
//import org.springframework.web.multipart.MultipartFile;
//import org.springframework.web.multipart.commons.CommonsMultipartFile;
//
//import java.io.*;
//import java.text.DateFormat;
//import java.text.DecimalFormat;
//import java.text.SimpleDateFormat;
//import java.util.ArrayList;
//import java.util.Arrays;
//import java.util.Date;
//import java.util.List;
//import java.util.zip.ZipEntry;
//import java.util.zip.ZipOutputStream;
//
///**
// *
// */
//@Slf4j
//@SuppressWarnings("all")
//public class FileUtil {
//
// /**
// * 判断文件夹是否存在
// *
// * @param filePath 文件地址
// * @return
// */
// public static boolean fileIsExists(String filePath) {
// File f = new File(XSSEscape.escapePath(filePath));
// if (!f.exists()) {
// return false;
// }
// return true;
// }
//
// /**
// * 判断文件是否存在
// *
// * @param filePath
// * @return
// */
// public static boolean fileIsFile(String filePath) {
// File f = new File(XSSEscape.escapePath(filePath));
// if (!f.isFile()) {
// return false;
// }
// return true;
// }
//
// /**
// * 创建文件
// *
// * @param filePath 文件地址
// * @param fileName 文件名
// * @return
// */
// public static boolean createFile(String filePath, String fileName) {
// String strFilePath = XSSEscape.escapePath(filePath + fileName);
// ;
// File file = new File(XSSEscape.escapePath(filePath));
// if (!file.exists()) {
// /** 注意这里是 mkdirs()方法 可以创建多个文件夹 */
// file.mkdirs();
// }
// File subfile = new File(strFilePath);
// if (!subfile.exists()) {
// try {
// boolean b = subfile.createNewFile();
// return b;
// } catch (IOException e) {
// e.printStackTrace();
// }
// } else {
// return true;
// }
// return false;
// }
//
// /**
// * 创建文件夹
// *
// * @param filePath 文件夹地址
// * @return
// */
// public static void createDirs(String filePath) {
// File file = new File(XSSEscape.escapePath(filePath));
// if (!file.exists()) {
// /** 注意这里是 mkdirs()方法 可以创建多个文件夹 */
// file.mkdirs();
// }
// }
//
// /**
// * 遍历文件夹下当前文件
// *
// * @param file 地址
// */
// public static List<File> getFile(File file) {
// List<File> list = new ArrayList<>();
// File[] fileArray = file.listFiles();
// if (fileArray == null) {
// return list;
// } else {
// for (File f : fileArray) {
// if (f.isFile()) {
// list.add(0, f);
// }
// }
// }
// return list;
// }
//
// /**
// * 遍历文件夹下所有文件
// *
// * @param file 地址
// */
// public static List<File> getFile(File file, List<File> list) {
// File[] fileArray = file.listFiles();
// if (fileArray == null) {
// return list;
// } else {
// for (File f : fileArray) {
// if (f.isFile()) {
// list.add(0, f);
// } else {
// getFile(f, list);
// }
// }
// }
// return list;
// }
//
// /**
// * 删除文件或文件夹以及子文件夹和子文件等 【注意】请谨慎调用该方法,避免删除重要文件
// *
// * @param file
// */
// public static void deleteFileAll(File file) {
// if (file.exists()) {
// if (file.isFile()) {
// // 文件
// log.info(file.getAbsolutePath() + " 删除中...");
// file.delete();
// log.info("删除成功!");
// return;
// } else {
// // 文件夹
// File[] files = file.listFiles();
// for (int i = 0; i < files.length; i++) {
// deleteFileAll(files[i]);
// }
// file.delete();
// }
// } else {
// log.info(file.getAbsolutePath() + " 文件不存在!");
// }
// }
//
// /**
// * 删除单个文件
// *
// * @param filePath 文件路径
// */
// public static void deleteFile(String filePath) {
// File file = new File(XSSEscape.escapePath(filePath));
// if (file.exists() && file.isFile()) {
// file.delete();
// }
// }
//
// /**
// * 删除空文件夹、空的子文件夹
// *
// * @param file
// * @author cielo
// */
// public static void deleteEmptyDirectory(File file) {
// if (file != null && file.exists() && file.isDirectory()) {
// File[] files = file.listFiles();
// if (files != null && files.length > 0) {
// for (int i = 0; i < files.length; i++) {
// deleteEmptyDirectory(files[i]);
// }
// // 子文件夹里的删除完后,重新获取。判断空的子文件删除后,该文件夹是否为空
// files = file.listFiles();
// }
// if (files == null || files.length == 0) {
// String absolutePath = file.getAbsolutePath();
// file.delete();
// log.info("删除空文件夹!路径:" + absolutePath);
// }
// }
// }
//
// /**
// * 删除tmp文件
// *
// * @param multipartFile
// * @return
// */
// public static boolean deleteTmp(MultipartFile multipartFile) {
// try {
// CommonsMultipartFile commonsMultipartFile = (CommonsMultipartFile) multipartFile;
// DiskFileItem diskFileItem = (DiskFileItem) commonsMultipartFile.getFileItem();
// File storeLocation = diskFileItem.getStoreLocation();
// FileUtil.deleteEmptyDirectory(storeLocation);
// return true;
// } catch (Exception e) {
// log.error("删除tmp文件失败,错误:" + e.getMessage());
// return false;
// }
// }
//
// /**
// * 打开目录
// *
// * @param path
// */
// public static void open(String path) {
// // 打开输出目录
// try {
// String osName = System.getProperty("os.name");
// if (osName != null) {
// if (osName.contains("Mac")) {
// Runtime.getRuntime().exec("open " + path);
// } else if (osName.contains("Windows")) {
// Runtime.getRuntime().exec("cmd /c start " + path);
// } else {
// log.debug("文件输出目录:" + path);
// }
// }
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
//
// /**
// * 向文件中添加内容
// *
// * @param strcontent 内容
// * @param filePath 地址
// * @param fileName 文件名
// */
// public static void writeToFile(String strcontent, String filePath, String fileName) {
// //生成文件夹之后,再生成文件,不然会出错
// String strFilePath = filePath + fileName;
// // 每次写入时,都换行写
// File subfile = new File(XSSEscape.escapePath(strFilePath));
// RandomAccessFile raf = null;
// try {
// /** 构造函数 第二个是读写方式 */
// raf = new RandomAccessFile(subfile, "rw");
// /** 将记录指针移动到该文件的最后 */
// raf.seek(subfile.length());
// /** 向文件末尾追加内容 */
// raf.write(strcontent.getBytes());
// raf.close();
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
//
// /**
// * 修改文件内容(覆盖或者添加)
// *
// * @param path 文件地址
// * @param content 覆盖内容
// * @param append 指定了写入的方式,是覆盖写还是追加写(true=追加)(false=覆盖)
// */
// public static void modifyFile(String path, String content, boolean append) {
// try {
// @Cleanup FileWriter fileWriter = new FileWriter(path, append);
// @Cleanup BufferedWriter writer = new BufferedWriter(fileWriter);
// writer.append(content);
// writer.flush();
// writer.close();
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
//
// /**
// * 读取文件内容
// *
// * @param filePath 地址
// * @param filename 名称
// * @return 返回内容
// */
// public static String getString(String filePath, String filename) {
// StringBuffer sb = new StringBuffer("");
// String line;
// try {
// @Cleanup FileInputStream inputStream = new FileInputStream(new File(XSSEscape.escapePath(filePath + filename)));
// @Cleanup InputStreamReader inputStreamReader = new InputStreamReader(inputStream, "UTF-8");
// @Cleanup BufferedReader reader = new BufferedReader(inputStreamReader);
// while ((line = reader.readLine()) != null) {
// sb.append(line);
// sb.append("\n");
// }
// } catch (Exception e) {
// e.printStackTrace();
// }
// return sb.toString();
// }
//
// /**
// * 重命名文件
// *
// * @param oldPath 原来的文件地址
// * @param newPath 新的文件地址
// */
// public static void renameFile(String oldPath, String newPath) {
// File oleFile = new File(oldPath);
// File newFile = new File(newPath);
// //执行重命名
// oleFile.renameTo(newFile);
// }
//
// /**
// * 复制文件
// *
// * @param fromFile 要复制的文件目录
// * @param toFile 要粘贴的文件目录
// * @return 是否复制成功
// */
// public static boolean copy(String fromFile, String toFile) {
// //要复制的文件目录
// File[] currentFiles;
// File root = new File(fromFile);
// //如同判断SD卡是否存在或者文件是否存在
// //如果不存在则 return出去
// if (!root.exists()) {
// return false;
// }
// //如果存在则获取当前目录下的全部文件 填充数组
// currentFiles = root.listFiles();
// //目标目录
// File targetDir = new File(toFile);
// //创建目录
// if (!targetDir.exists()) {
// targetDir.mkdirs();
// }
// //遍历要复制该目录下的全部文件
// for (int i = 0; i < currentFiles.length; i++) {
// if (currentFiles[i].isDirectory()) {
// //如果当前项为子目录 进行递归
// copy(currentFiles[i].getPath() + "/", toFile + currentFiles[i].getName() + "/");
// } else {
// //如果当前项为文件则进行文件拷贝
// copyFile(currentFiles[i].getPath(), toFile + currentFiles[i].getName());
// }
// }
// return true;
// }
//
// /**
// * 文件拷贝
// * 要复制的目录下的所有非子目录(文件夹)文件拷贝
// *
// * @param fromFile
// * @param toFile
// * @return
// */
// public static boolean copyFile(String fromFile, String toFile) {
// try {
// @Cleanup InputStream fosfrom = new FileInputStream(XSSEscape.escapePath(fromFile));
// @Cleanup OutputStream fosto = new FileOutputStream(XSSEscape.escapePath(toFile));
// byte[] bt = new byte[1024];
// int c;
// while ((c = fosfrom.read(bt)) > 0) {
// fosto.write(bt, 0, c);
// }
// fosfrom.close();
// fosto.close();
// return true;
// } catch (Exception ex) {
// return false;
// }
// }
//
// /**
// * 文件拷贝
// *
// * @param fromFile
// * @param toFile
// * @param fileName
// * @return
// */
// public static boolean copyFile(String fromFile, String toFile, String fileName) {
// try {
// //目标目录
// File targetDir = new File(toFile);
// //创建目录
// if (!targetDir.exists()) {
// targetDir.mkdirs();
// }
// @Cleanup InputStream fosfrom = new FileInputStream(fromFile);
// @Cleanup OutputStream fosto = new FileOutputStream(toFile + fileName);
// byte[] bt = new byte[1024];
// int c;
// while ((c = fosfrom.read(bt)) > 0) {
// fosto.write(bt, 0, c);
// }
// fosfrom.close();
// fosto.close();
// return true;
// } catch (Exception ex) {
// return false;
// }
// }
//
// /**
// * 保存文件
// *
// * @param inputStream
// * @param path
// * @param fileName
// */
// public static void write(InputStream inputStream, String path, String fileName) {
// OutputStream os = null;
// long dateStr = System.currentTimeMillis();
// try {
// // 1K的数据缓冲
// byte[] bs = new byte[1024];
// // 读取到的数据长度
// int len;
// // 输出的文件流保存到本地文件
// File tempFile = new File(XSSEscape.escapePath(path));
// if (!tempFile.exists()) {
// tempFile.mkdirs();
// }
// String newFileName = tempFile.getPath() + File.separator + fileName;
// log.info("保存文件:" + newFileName);
// os = new FileOutputStream(XSSEscape.escapePath(newFileName));
// // 开始读取
// while ((len = inputStream.read(bs)) != -1) {
// os.write(bs, 0, len);
// }
// } catch (IOException e) {
// log.error("生成excel失败");
// } catch (Exception e) {
// log.error("生成excel失败");
// } finally {
// // 完毕,关闭所有链接
// try {
// if (os != null) {
// os.close();
// }
// inputStream.close();
// } catch (IOException e) {
// log.error("关闭链接失败" + e.getMessage());
// }
// }
// }
//
// /**
// * 写入文件
// *
// * @param inputStream
// * @param path
// * @param fileName
// */
// public static void writeFile(InputStream inputStream, String path, String fileName) {
// OutputStream os = null;
// try {
// // 1K的数据缓冲
// byte[] bs = new byte[1024];
// // 读取到的数据长度
// int len;
// // 输出的文件流保存到本地文件
// File tempFile = new File(XSSEscape.escapePath(path));
// if (!tempFile.exists()) {
// tempFile.mkdirs();
// }
// String newFileName = tempFile.getPath() + File.separator + fileName;
// log.info("保存文件:" + newFileName);
// os = new FileOutputStream(XSSEscape.escapePath(newFileName));
// // 开始读取
// while ((len = inputStream.read(bs)) != -1) {
// os.write(bs, 0, len);
// }
// } catch (IOException e) {
// log.error("生成excel失败");
// } catch (Exception e) {
// log.error("生成excel失败");
// } finally {
// // 完毕,关闭所有链接
// try {
// if (os != null) {
// os.close();
// }
// inputStream.close();
// } catch (IOException e) {
// log.error("关闭链接失败" + e.getMessage());
// }
// }
// }
//
// /**
// * 上传文件
// *
// * @param file 文件
// * @param filePath 保存路径
// * @param fileName 保存名称
// */
// public static void upFile(MultipartFile file, String filePath, String fileName) {
// try {
// String escapeFilePath = XSSEscape.escape(filePath);
// String escapeFileName = XSSEscape.escape(fileName);
// // 输出的文件流保存到本地文件
// File tempFile = new File(escapeFilePath);
// if (!tempFile.exists()) {
// tempFile.mkdirs();
// }
// File f = new File(escapeFilePath, escapeFileName);
// //将上传的文件存储到指定位置
// file.transferTo(f);
// } catch (Exception e) {
// log.error(e.getMessage());
// }
// }
//
// /**
// * 读取文件修改时间
// */
// public static String getCreateTime(String filePath) {
// DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// File file = new File(XSSEscape.escapePath(filePath));
// // 毫秒数
// long modifiedTime = file.lastModified();
// // 通过毫秒数构造日期 即可将毫秒数转换为日期
// Date date = new Date(modifiedTime);
// String dateString = format.format(date);
// return dateString;
// }
//
// /**
// * 获取文件类型
// */
// public static String getFileType(File file) {
// if (file.isFile()) {
// String fileName = file.getName();
// String fileTyle = fileName.substring(fileName.lastIndexOf(".") + 1, fileName.length());
// return fileTyle;
// }
// return null;
// }
//
// /**
// * 获取文件类型
// */
// public static String getFileType(String fileName) {
// int lastIndexOf = fileName.lastIndexOf(".") + 1;
// //获取文件的后缀名 jpg
// String suffix = fileName.substring(lastIndexOf);
// return suffix;
// }
//
// /**
// * 获取文件大小
// *
// * @param data
// * @return
// */
// public static String getSize(String data) {
// String size = "";
// if (data != null && !StringUtils.isEmpty(data)) {
// long fileS = Long.parseLong(data);
// DecimalFormat df = new DecimalFormat("#.00");
// if (fileS < 1024) {
// size = df.format((double) fileS) + "BT";
// } else if (fileS < 1048576) {
// size = df.format((double) fileS / 1024) + "KB";
// } else if (fileS < 1073741824) {
// size = df.format((double) fileS / 1048576) + "MB";
// } else {
// size = df.format((double) fileS / 1073741824) + "GB";
// }
// } else {
// size = "0BT";
// }
// return size;
// }
//
// private static final int BUFFER_SIZE = 2 * 1024;
//
// /**
// * 压缩文件夹
// *
// * @param srcDir 压缩文件夹路径
// * @param outDir 压缩文件路径
// * @param keepDirStructure 是否保留原来的目录结构,
// * true:保留目录结构;
// * false:所有文件跑到压缩包根目录下(注意:不保留目录结构可能会出现同名文件,会压缩失败)
// * @throws RuntimeException 压缩失败会抛出运行时异常
// */
// public static void toZip(String outDir, boolean keepDirStructure, String... srcDir) {
// try {
// @Cleanup OutputStream out = new FileOutputStream(new File(XSSEscape.escapePath(outDir)));
// @Cleanup ZipOutputStream zos = null;
// try {
// zos = new ZipOutputStream(out);
// List<File> sourceFileList = new ArrayList<File>();
// for (String dir : srcDir) {
// File sourceFile = new File(XSSEscape.escapePath(dir));
// sourceFileList.add(sourceFile);
// }
// compress(sourceFileList, zos, keepDirStructure);
// } catch (Exception e) {
// throw new RuntimeException("zip error from ZipUtils", e);
// } finally {
// if (zos != null) {
// try {
// zos.close();
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
// }
// } catch (Exception e) {
// log.error("压缩失败:{}", e.getMessage());
// }
// }
//
// /**
// * 递归压缩方法
// *
// * @param sourceFile 源文件
// * @param zos zip输出流
// * @param name 压缩后的名称
// * @param keepDirStructure 是否保留原来的目录结构,
// * true:保留目录结构;
// * false:所有文件跑到压缩包根目录下(注意:不保留目录结构可能会出现同名文件,会压缩失败)
// * @throws Exception
// */
// private static void compress(File sourceFile, ZipOutputStream zos, String name, boolean keepDirStructure) throws Exception {
// byte[] buf = new byte[BUFFER_SIZE];
// if (sourceFile.isFile()) {
// zos.putNextEntry(new ZipEntry(name));
// int len;
// @Cleanup FileInputStream in = new FileInputStream(sourceFile);
// while ((len = in.read(buf)) != -1) {
// zos.write(buf, 0, len);
// }
// zos.closeEntry();
// in.close();
// } else {
// File[] listFiles = sourceFile.listFiles();
// if (listFiles == null || listFiles.length == 0) {
// if (keepDirStructure) {
// zos.putNextEntry(new ZipEntry(name + "/"));
// zos.closeEntry();
// }
// } else {
// for (File file : listFiles) {
// if (keepDirStructure) {
// compress(file, zos, name + "/" + file.getName(),
// keepDirStructure);
// } else {
// compress(file, zos, file.getName(), keepDirStructure);
// }
// }
// }
// }
// }
//
// private static void compress(List<File> sourceFileList, ZipOutputStream zos, boolean keepDirStructure) throws Exception {
// byte[] buf = new byte[BUFFER_SIZE];
// for (File sourceFile : sourceFileList) {
// String name = sourceFile.getName();
// if (sourceFile.isFile()) {
// zos.putNextEntry(new ZipEntry(name));
// int len;
// @Cleanup FileInputStream in = new FileInputStream(sourceFile);
// while ((len = in.read(buf)) != -1) {
// zos.write(buf, 0, len);
// }
// zos.closeEntry();
// in.close();
// } else {
// File[] listFiles = sourceFile.listFiles();
// if (listFiles == null || listFiles.length == 0) {
// if (keepDirStructure) {
// zos.putNextEntry(new ZipEntry(name + "/"));
// zos.closeEntry();
// }
// } else {
// for (File file : listFiles) {
// if (keepDirStructure) {
// compress(file, zos, name + "/" + file.getName(),
// keepDirStructure);
// } else {
// compress(file, zos, file.getName(),
// keepDirStructure);
// }
//
// }
// }
// }
// }
// }
//
// //=================================判断文件后缀==========================
//
// /**
// * 允许文件类型
// *
// * @param fileType 文件所有类型
// * @param fileExtension 当前文件类型
// * @return
// */
// public static boolean fileType(String fileType, String fileExtension) {
// String[] allowExtension = fileType.split(",");
// return Arrays.asList(allowExtension).contains(fileExtension.toLowerCase());
// }
//
// /**
// * 允许图片类型
// *
// * @param imageType 图片所有类型
// * @param fileExtension 当前图片类型
// * @return
// */
// public static boolean imageType(String imageType, String fileExtension) {
// String[] allowExtension = imageType.split(",");
// return Arrays.asList(allowExtension).contains(fileExtension.toLowerCase());
// }
//
// /**
// * 允许上传大小
// *
// * @param fileSize 文件大小
// * @param maxSize 最大的文件
// * @return
// */
// public static boolean fileSize(Long fileSize, int maxSize) {
// if (fileSize > maxSize) {
// return true;
// }
// return false;
// }
//
// /**
// * 导入生成临时文件后,获取文件内容
// *
// * @param multipartFile 文件
// * @param filePath 路径
// * @return
// */
// public static String getFileContent(MultipartFile multipartFile, String filePath) {
// //文件名
// String fileName = multipartFile.getName();
// //上传到项目文件路径中
// FileUtil.upFile(multipartFile, filePath, fileName);
// //读取文件文件内容
// String fileContent = FileUtil.getString(filePath, fileName);
// return fileContent;
// }
//
// /**
// * 判断是否为json格式且不为空
// *
// * @param multipartFile
// * @param type 类型
// * @return
// */
// public static boolean existsSuffix(MultipartFile multipartFile, String type) {
// if (!multipartFile.getOriginalFilename().endsWith("." + type) || multipartFile.getSize() < 1) {
// return true;
// }
// return false;
// }
//
// /**
// * File转MultipartFile
// *
// * @param file
// * @return
// */
// public static MultipartFile createFileItem(File file) {
// FileItemFactory factory = new DiskFileItemFactory(16, null);
// FileItem item = factory.createItem("textField", "text/plain", true, file.getName());
// int bytesRead = 0;
// byte[] buffer = new byte[8192];
// try {
// @Cleanup FileInputStream fis = new FileInputStream(file);
// OutputStream os = item.getOutputStream();
// while ((bytesRead = fis.read(buffer, 0, 8192)) != -1) {
// os.write(buffer, 0, bytesRead);
// }
// os.close();
// fis.close();
// } catch (IOException e) {
// e.printStackTrace();
// }
// MultipartFile multipartFile = new CommonsMultipartFile(item);
// return multipartFile;
// }
//
//}
package com.junmp.junmpProcess.utils;
import java.lang.management.ManagementFactory;
import java.net.InetAddress;
import java.net.NetworkInterface;
/**
* <p>名称:IdWorker.java</p>
* <p>描述:分布式自增长ID</p>
* <pre>
* Twitter的 Snowflake JAVA实现方案
* </pre>
* 核心代码为其IdWorker这个类实现,其原理结构如下,我分别用一个0表示一位,用—分割开部分的作用:
* 1||0---0000000000 0000000000 0000000000 0000000000 0 --- 00000 ---00000 ---000000000000
* 在上面的字符串中,第一位为未使用(实际上也可作为long的符号位),接下来的41位为毫秒级时间,
* 然后5位datacenter标识位,5位机器ID(并不算标识符,实际是为线程标识),
* 然后12位该毫秒内的当前毫秒内的计数,加起来刚好64位,为一个Long型。
* 这样的好处是,整体上按照时间自增排序,并且整个分布式系统内不会产生ID碰撞(由datacenter和机器ID作区分),
* 并且效率较高,经测试,snowflake每秒能够产生26万ID左右,完全满足需要。
* <p>
* 64位ID (42(毫秒)+5(机器ID)+5(业务编码)+12(重复累加))
*
* @author Polim
*/
public class IdWorker {
// 时间起始标记点,作为基准,一般取系统的最近时间(一旦确定不能变动)
private final static long twepoch = 1288834974657L;
// 机器标识位数
private final static long workerIdBits = 5L;
// 数据中心标识位数
private final static long datacenterIdBits = 5L;
// 机器ID最大值
private final static long maxWorkerId = -1L ^ (-1L << workerIdBits);
// 数据中心ID最大值
private final static long maxDatacenterId = -1L ^ (-1L << datacenterIdBits);
// 毫秒内自增位
private final static long sequenceBits = 12L;
// 机器ID偏左移12位
private final static long workerIdShift = sequenceBits;
// 数据中心ID左移17位
private final static long datacenterIdShift = sequenceBits + workerIdBits;
// 时间毫秒左移22位
private final static long timestampLeftShift = sequenceBits + workerIdBits + datacenterIdBits;
private final static long sequenceMask = -1L ^ (-1L << sequenceBits);
/* 上次生产id时间戳 */
private static long lastTimestamp = -1L;
// 0,并发控制
private long sequence = 0L;
private final long workerId;
// 数据标识id部分
private final long datacenterId;
public IdWorker() {
this.datacenterId = getDatacenterId(maxDatacenterId);
this.workerId = getMaxWorkerId(datacenterId, maxWorkerId);
}
/**
* @param workerId 工作机器ID
* @param datacenterId 序列号
*/
public IdWorker(long workerId, long datacenterId) {
if (workerId > maxWorkerId || workerId < 0) {
throw new IllegalArgumentException(String.format("worker Id can't be greater than %d or less than 0", maxWorkerId));
}
if (datacenterId > maxDatacenterId || datacenterId < 0) {
throw new IllegalArgumentException(String.format("datacenter Id can't be greater than %d or less than 0", maxDatacenterId));
}
this.workerId = workerId;
this.datacenterId = datacenterId;
}
/**
* 获取下一个ID
*
* @return
*/
public synchronized long nextId() {
long timestamp = timeGen();
if (timestamp < lastTimestamp) {
throw new RuntimeException(String.format("Clock moved backwards. Refusing to generate id for %d milliseconds", lastTimestamp - timestamp));
}
if (lastTimestamp == timestamp) {
// 当前毫秒内,则+1
sequence = (sequence + 1) & sequenceMask;
if (sequence == 0) {
// 当前毫秒内计数满了,则等待下一秒
timestamp = tilNextMillis(lastTimestamp);
}
} else {
sequence = 0L;
}
lastTimestamp = timestamp;
// ID偏移组合生成最终的ID,并返回ID
long nextId = ((timestamp - twepoch) << timestampLeftShift)
| (datacenterId << datacenterIdShift)
| (workerId << workerIdShift) | sequence;
return nextId;
}
private long tilNextMillis(final long lastTimestamp) {
long timestamp = this.timeGen();
while (timestamp <= lastTimestamp) {
timestamp = this.timeGen();
}
return timestamp;
}
private long timeGen() {
return System.currentTimeMillis();
}
/**
* <p>
* 获取 maxWorkerId
* </p>
*/
protected static long getMaxWorkerId(long datacenterId, long maxWorkerId) {
StringBuffer mpid = new StringBuffer();
mpid.append(datacenterId);
String name = ManagementFactory.getRuntimeMXBean().getName();
if (!name.isEmpty()) {
/*
* GET jvmPid
*/
mpid.append(name.split("@")[0]);
}
/*
* MAC + PID 的 hashcode 获取16个低位
*/
return (mpid.toString().hashCode() & 0xffff) % (maxWorkerId + 1);
}
/**
* <p>
* 数据标识id部分
* </p>
*/
protected static long getDatacenterId(long maxDatacenterId) {
long id = 0L;
try {
InetAddress ip = InetAddress.getLocalHost();
NetworkInterface network = NetworkInterface.getByInetAddress(ip);
if (network == null) {
id = 1L;
} else {
byte[] mac = network.getHardwareAddress();
id = ((0x000000FF & (long) mac[mac.length - 1])
| (0x0000FF00 & (((long) mac[mac.length - 2]) << 8))) >> 6;
id = id % (maxDatacenterId + 1);
}
} catch (Exception e) {
System.out.println(" getDatacenterId: " + e.getMessage());
}
return id;
}
}
package com.junmp.junmpProcess.utils;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
public class JsonToELConverter {
private static final ObjectMapper objectMapper = new ObjectMapper();
public static String convertToEL(JsonNode jsonNode) {
StringBuilder expressionBuilder = new StringBuilder();
JsonNode[] jsonArray = objectMapper.convertValue(jsonNode, JsonNode[].class);
// 递归构建EL表达式
buildExpression(expressionBuilder, jsonArray);
return expressionBuilder.toString();
}
private static void buildExpression(StringBuilder expressionBuilder, JsonNode[] jsonArray) {
for (int i = 0; i < jsonArray.length; i++) {
JsonNode element = jsonArray[i];
JsonNode conditionNode = element.get("condition");
JsonNode conditionsNode = element.get("conditions");
if (conditionNode != null && conditionNode.isTextual() && conditionsNode != null && conditionsNode.isArray()) {
String condition = conditionNode.asText();
JsonNode[] conditions = objectMapper.convertValue(conditionsNode, JsonNode[].class);
if (i > 0) {
expressionBuilder.append(" ");
expressionBuilder.append("||");
expressionBuilder.append(" ");
}
// expressionBuilder.append("(");
for (int j = 0; j < conditions.length; j++) {
JsonNode conditionObject = conditions[j];
JsonNode columnValueNode = conditionObject.get("columnValue");
JsonNode optTypeNode = conditionObject.get("optType");
JsonNode conditionValueNode = conditionObject.get("conditionValue");
if ( columnValueNode != null && columnValueNode.isTextual()
&& optTypeNode != null && optTypeNode.isTextual()
&& conditionValueNode != null && conditionValueNode.isArray()) {
String columnValue = columnValueNode.asText();
String optType = optTypeNode.asText();
JsonNode[] conditionValues = objectMapper.convertValue(conditionValueNode, JsonNode[].class);
if (j > 0) {
expressionBuilder.append(" ");
expressionBuilder.append("&&");
expressionBuilder.append(" ");
}
expressionBuilder.append("${");
expressionBuilder.append(columnValue);
expressionBuilder.append(" ");
expressionBuilder.append(optType);
expressionBuilder.append(" ");
expressionBuilder.append(conditionValues[0].asText());
expressionBuilder.append("}");
}
}
// expressionBuilder.append(")");
}
}
}
}
\ No newline at end of file
package com.junmp.junmpProcess.utils;//package org.jeecg.junmpProcess.utils;
//
//import io.minio.*;
//import io.minio.http.Method;
//import io.minio.messages.Bucket;
//import lombok.Cleanup;
//import lombok.extern.slf4j.Slf4j;
//import org.apache.commons.lang3.StringUtils;
//import org.springframework.stereotype.Component;
//import org.springframework.web.multipart.MultipartFile;
//
//import javax.annotation.Resource;
//import javax.servlet.ServletOutputStream;
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import java.io.*;
//import java.net.URLEncoder;
//import java.util.List;
//import java.util.stream.Collectors;
//
///**
// * minio文件上传工具类
// */
//@Component
//@Slf4j
//public class MinioUploadUtil {
// @Resource(name = "minioClient")
// private MinioClient minioClient;
//
// /**
// * 上传文件
// *
// * @param file
// * @param bucketName
// * @param fileName
// * @return
// */
// public void uploadFile(MultipartFile file, String bucketName, String fileName) {
// //判断文件是否为空
// if (null == file || 0 == file.getSize()) {
// log.error("文件不能为空");
// }
// //判断存储桶是否存在
// bucketExists(bucketName);
// //文件名
// if(file != null){
// String originalFilename = file.getOriginalFilename();
// //新的文件名 = 存储桶文件名_时间戳.后缀名
// assert originalFilename != null;
// //开始上传
// try {
// @Cleanup InputStream inputStream = file.getInputStream();
// minioClient.putObject(
// PutObjectArgs.builder().bucket(bucketName).object(fileName).stream(
// inputStream, file.getSize(), -1)
// .contentType(file.getContentType())
// .build());
// } catch (Exception e) {
// log.error(e.getMessage());
// }
// }
// }
//
// /**
// * 上传文件(可以传空) 数据备份使用
// * @param filePath
// * @param bucketName
// * @param fileName
// * @throws IOException
// */
// public void uploadFiles(String filePath, String bucketName, String fileName) throws IOException {
// MultipartFile file = FileUtil.createFileItem(new File(XSSEscape.escapePath(filePath)));
// //开始上传
// try {
// @Cleanup InputStream inputStream = file.getInputStream();
// minioClient.putObject(
// PutObjectArgs.builder().bucket(bucketName).object(fileName).stream(
// inputStream, file.getSize(), -1)
// .contentType(file.getContentType())
// .build());
// } catch (Exception e) {
// log.error(e.getMessage());
// }
// }
//
// /**
// * 下载文件
// *
// * @param fileName 文件名
// * @param bucketName 桶名(文件夹)
// * @return
// */
// public void downFile(String fileName, String bucketName, String downName) {
// InputStream inputStream = null;
// try {
// inputStream = minioClient.getObject(
// GetObjectArgs.builder()
// .bucket(bucketName)
// .object(fileName)
// .build());
// //下载文件
// HttpServletResponse response = ServletUtil.getResponse();
// HttpServletRequest request = ServletUtil.getRequest();
// try {
// @Cleanup BufferedInputStream bis = new BufferedInputStream(inputStream);
// if (StringUtils.isNotEmpty(downName)) {
// fileName = downName;
// }
// response.setCharacterEncoding("UTF-8");
// response.setContentType("text/plain");
// if(fileName.contains(".svg")){
// response.setContentType("image/svg+xml");
// }
// //编码的文件名字,关于中文乱码的改造
// String codeFileName = "";
// String agent = request.getHeader("USER-AGENT").toLowerCase();
// if (-1 != agent.indexOf("msie") || -1 != agent.indexOf("trident")) {
// //IE
// codeFileName = URLEncoder.encode(fileName, "UTF-8");
// } else if (-1 != agent.indexOf("mozilla")) {
// //火狐,谷歌
// codeFileName = new String(fileName.getBytes("UTF-8"), "iso-8859-1");
// } else {
// codeFileName = URLEncoder.encode(fileName, "UTF-8");
// }
// response.setHeader("Content-Disposition", "attachment;filename=" + XSSEscape.escape(new String(codeFileName.getBytes(), "utf-8")));
// @Cleanup OutputStream os = response.getOutputStream();
// int i;
// byte[] buff = new byte[1024 * 8];
// while ((i = bis.read(buff)) != -1) {
// os.write(buff, 0, i);
// }
// os.flush();
// } catch (Exception e) {
// e.printStackTrace();
// } finally {
// try {
// inputStream.close();
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
// } catch (Exception e) {
// log.error(e.getMessage());
// } finally {
// if (inputStream!=null){
// try {
// inputStream.close();
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
// }
// }
//
// /**
// * 返回图片
// *
// * @param fileName 文件名
// * @param bucketName 桶名(文件夹)
// * @return
// */
// public void dowloadMinioFile(String fileName, String bucketName) {
// try {
// @Cleanup InputStream inputStream = minioClient.getObject(
// GetObjectArgs.builder()
// .bucket(bucketName)
// .object(fileName)
// .build());
// @Cleanup ServletOutputStream outputStream1 = ServletUtil.getResponse().getOutputStream();
// //读取指定路径下面的文件
// @Cleanup OutputStream outputStream = new BufferedOutputStream(outputStream1);
// //创建存放文件内容的数组
// byte[] buff = new byte[1024];
// //所读取的内容使用n来接收
// int n;
// //当没有读取完时,继续读取,循环
// while ((n = inputStream.read(buff)) != -1) {
// //将字节数组的数据全部写入到输出流中
// outputStream.write(buff, 0, n);
// }
// //强制将缓存区的数据进行输出
// outputStream.flush();
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
//
//
// /**
// * 获取資源
// *
// * @param fileName
// * @param bucketName
// */
// public String getFile(String fileName, String bucketName) {
// String objectUrl = null;
// try {
// objectUrl = minioClient.getPresignedObjectUrl(
// GetPresignedObjectUrlArgs.builder()
// .method(Method.GET)
// .bucket(bucketName)
// .object(fileName)
// .build());
// } catch (Exception e) {
// log.error(e.getMessage());
// }
// return objectUrl;
// }
//
// /**
// * 下载文件
// *
// * @param fileName 文件名称
// * @param bucketName 存储桶名称
// * @return
// */
// public InputStream downloadMinio(String fileName, String bucketName) {
// try {
// @Cleanup InputStream stream =
// minioClient.getObject(
// GetObjectArgs.builder().bucket(bucketName).object(fileName).build());
// return stream;
// } catch (Exception e) {
// e.printStackTrace();
// log.info(e.getMessage());
// return null;
// }
// }
//
// /**
// * 获取全部bucket
// *
// * @return
// */
// public List<String> getAllBuckets() throws Exception {
// return minioClient.listBuckets().stream().map(Bucket::name).collect(Collectors.toList());
// }
//
// /**
// * 根据bucketName删除信息
// *
// * @param bucketName bucket名称
// */
// public void removeBucket(String bucketName) throws Exception {
// minioClient.removeBucket(RemoveBucketArgs.builder().bucket(bucketName).build());
// }
//
// /**
// * 删除一个对象
// *
// * @param name
// * @return
// */
// public boolean removeFile(String bucketName, String name) {
// boolean isOK = true;
// try {
// minioClient.removeObject(RemoveObjectArgs.builder().bucket(bucketName).object(name).build());
// } catch (Exception e) {
// e.printStackTrace();
// isOK = false;
// }
// return isOK;
// }
//
// /**
// * 检查存储桶是否已经存在(不存在不创建)
// *
// * @param name
// * @return
// */
// public boolean bucketExists(String name) {
// boolean isExist = false;
// try {
// isExist = minioClient.bucketExists(getBucketExistsArgs(name));
// } catch (Exception e) {
// e.printStackTrace();
// }
// return isExist;
// }
//
// /**
// * 检查存储桶是否已经存在(不存在则创建)
// *
// * @param name
// * @return
// */
// public void bucketExistsCreate(String name) {
// try {
// minioClient.bucketExists(getBucketExistsArgs(name));
// minioClient.makeBucket(getMakeBucketArgs(name));
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
//
//
//
//
//
//
// /**
// * String转MakeBucketArgs
// *
// * @param name
// * @return
// */
// public static MakeBucketArgs getMakeBucketArgs(String name) {
// return MakeBucketArgs.builder().bucket(name).build();
// }
//
// /**
// * String转BucketExistsArgs
// *
// * @param name
// * @return
// */
// public static BucketExistsArgs getBucketExistsArgs(String name) {
// return BucketExistsArgs.builder().bucket(name).build();
// }
//
//
//
//
//}
package com.junmp.junmpProcess.utils;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;
import java.util.Properties;
public class RabbitMQUtils {
private static ConnectionFactory connectionFactory;
private static Properties properties;
static{
//重量级资源 类加载执行之执行一次
connectionFactory = new ConnectionFactory();
connectionFactory.setHost("192.168.3.188");
connectionFactory.setPort(5672);
connectionFactory.setVirtualHost("/");
connectionFactory.setUsername("root");
connectionFactory.setPassword("123456");
}
//定义提供连接对象的方法
public static Connection getConnection() {
try {
return connectionFactory.newConnection();
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
//关闭通道和关闭连接工具方法
public static void closeConnectionAndChanel(Channel channel, Connection conn) {
try {
if(channel!=null) {
channel.close();
}
if(conn!=null) {
conn.close();
}
} catch (Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
System.out.println("RabbitMQUtils.getConnection() = " + RabbitMQUtils.getConnection());
}
}
package com.junmp.junmpProcess.utils;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;
import org.springframework.stereotype.Component;
import java.io.IOException;
import java.util.concurrent.TimeoutException;
@Component
public class RabbitMQUtils2 {
private static final String host = "192.168.3.188";
private static final int port = 5672;
private static final String username = "root";
private static final String password = "123456";
public static void closeChannelAndConnection(Connection connection, Channel channel){
try {
channel.close();
connection.close();
} catch (IOException | TimeoutException e) {
e.printStackTrace();
}
}
public static Connection getConnection() throws IOException, TimeoutException {
ConnectionFactory connectionFactory = new ConnectionFactory();
connectionFactory.setHost(host);
connectionFactory.setPort(port);
connectionFactory.setUsername(username);
connectionFactory.setPassword(password);
return connectionFactory.newConnection();
}
}
//package com.junmp.junmpProcess.utils;
//
//import com.alibaba.fastjson.JSONObject;
//import com.baomidou.mybatisplus.core.toolkit.Constants;
//import lombok.Cleanup;
//import org.springframework.web.context.request.RequestAttributes;
//import org.springframework.web.context.request.RequestContextHolder;
//import org.springframework.web.context.request.ServletRequestAttributes;
//
//import javax.servlet.ServletInputStream;
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import javax.servlet.http.HttpSession;
//import java.io.IOException;
//
///**
// *
// */
//public class ServletUtil {
//
// /**
// * 获取ServletPath
// */
// public static String getServletPath() {
// return ServletUtil.getRequest().getServletPath();
// }
//
//
// /**
// * 获取Request Payload
// */
// public static String getPayload() {
// try {
// @Cleanup ServletInputStream is = ServletUtil.getRequest().getInputStream();
// int nRead = 1;
// int nTotalRead = 0;
// byte[] bytes = new byte[10240 * 20];
// while (nRead > 0) {
// nRead = is.read(bytes, nTotalRead, bytes.length - nTotalRead);
// if (nRead > 0) {
// nTotalRead = nTotalRead + nRead;
// }
// }
// String str = new String(bytes, 0, nTotalRead, Constants.UTF_8);
// return str;
// } catch (IOException e) {
// e.printStackTrace();
// return "";
// }
// }
//
//
// /**
// * 获取User-Agent
// */
// public static String getUserAgent() {
// return ServletUtil.getHeader("User-Agent");
// }
//
// /**
// * 判断是否是手机端登陆
// */
// public static boolean getIsMobileDevice() {
// return isMobileDevice(ServletUtil.getUserAgent());
// }
//
// /**
// * 获取HTTP头信息
// */
// public static String getHeader(String name) {
// if (getRequest() != null) {
// return getRequest().getHeader(name);
// }
// return null;
// }
//
// /**
// * 获取表单参数
// */
// public static String getParameter(String name) {
// return getRequest().getParameter(name);
// }
//
//
// /**
// * 获取request
// */
// public static HttpServletRequest getRequest() {
// if (getRequestAttributes() != null) {
// return getRequestAttributes().getRequest();
// }
// return null;
// }
//
// /**
// * 获取response
// */
// public static HttpServletResponse getResponse() {
// return getRequestAttributes().getResponse();
// }
//
// /**
// * 获取session
// */
// public static HttpSession getSession() {
// return getRequest().getSession();
// }
//
// public static ServletRequestAttributes getRequestAttributes() {
// RequestAttributes attributes = RequestContextHolder.getRequestAttributes();
// return (ServletRequestAttributes) attributes;
// }
//
// /**
// * 将字符串渲染到客户端
// *
// * @param response 渲染对象
// * @param string 待渲染的字符串
// * @return null
// */
// public static String renderString(HttpServletResponse response, String string) {
// try {
// response.setHeader("Access-Control-Allow-Origin", "*");
// response.setHeader("Cache-Control", "no-cache");
// response.setContentType("application/json");
// response.setCharacterEncoding(Constants.UTF_8);
// response.getWriter().print(string);
// } catch (IOException e) {
// e.printStackTrace();
// }
// return null;
// }
//
// /**
// * 是否是Ajax异步请求
// *
// * @param request
// */
// public static boolean isAjaxRequest(HttpServletRequest request) {
// String accept = request.getHeader("accept");
// if (accept != null && accept.indexOf("application/json") != -1) {
// return true;
// }
// String xRequestedWith = request.getHeader("X-Requested-With");
// if (xRequestedWith != null && xRequestedWith.indexOf("XMLHttpRequest") != -1) {
// return true;
// }
// String uri = request.getRequestURI();
// if (inStringIgnoreCase(uri, ".json", ".xml")) {
// return true;
// }
// String ajax = request.getParameter("__ajax");
// if (inStringIgnoreCase(ajax, "json", "xml")) {
// return true;
// }
// return false;
// }
//
// /**
// * 是否包含字符串
// *
// * @param str 验证字符串
// * @param strs 字符串组
// * @return 包含返回true
// */
// public static boolean inStringIgnoreCase(String str, String... strs) {
// if (str != null && strs != null) {
// for (String s : strs) {
// if (str.equalsIgnoreCase((s.trim()))) {
// return true;
// }
// }
// }
// return false;
// }
//
// /**
// * 返回JSONObject对象
// */
// public static JSONObject getJsonObject() throws Exception {
// String builder = ServletUtil.getPayload();
// return JSONObject.parseObject(builder);
// }
//
// /**
// * 判断是否是移动设备
// *
// * @param requestHeader
// * @return
// */
// public static boolean isMobileDevice(String requestHeader) {
// String[] deviceArray = new String[]{"android", "windows phone", "iphone", "ios", "ipad", "mqqbrowser"};
// if (requestHeader == null) {
// return false;
// }
// requestHeader = requestHeader.toLowerCase();
// for (int i = 0; i < deviceArray.length; i++) {
// if (requestHeader.indexOf(deviceArray[i]) > 0) {
// return true;
// }
// }
// return false;
// }
//}
/*
*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the pig4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*
*/
package com.junmp.junmpProcess.utils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.ApplicationEvent;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
/**
*
*/
@Slf4j
@Service
@Lazy(false)
public class SpringContextHolder implements ApplicationContextAware, DisposableBean {
private static ApplicationContext applicationContext = null;
/**
* 取得存储在静态变量中的ApplicationContext.
*/
public static ApplicationContext getApplicationContext() {
return applicationContext;
}
/**
* 实现ApplicationContextAware接口, 注入Context到静态变量中.
*/
@Override
public void setApplicationContext(ApplicationContext applicationContext) {
SpringContextHolder.applicationContext = applicationContext;
}
/**
* 从静态变量applicationContext中取得Bean, 自动转型为所赋值对象的类型.
*/
@SuppressWarnings("unchecked")
public static <T> T getBean(String name) {
return (T) applicationContext.getBean(name);
}
/**
* 从静态变量applicationContext中取得Bean, 自动转型为所赋值对象的类型.
*/
public static <T> T getBean(Class<T> requiredType) {
return applicationContext.getBean(requiredType);
}
/**
* 清除SpringContextHolder中的ApplicationContext为Null.
*/
public static void clearHolder() {
if (log.isDebugEnabled()) {
log.debug("清除SpringContextHolder中的ApplicationContext:" + applicationContext);
}
applicationContext = null;
}
/**
* 发布事件
*
* @param event
*/
public static void publishEvent(ApplicationEvent event) {
if (applicationContext == null) {
return;
}
applicationContext.publishEvent(event);
}
/**
* 实现DisposableBean接口, 在Context关闭时清理静态变量.
*/
@Override
public void destroy() {
SpringContextHolder.clearHolder();
}
/**
* SpringMvc下获取request
*
* @return
*/
public static HttpServletRequest getRequest() {
ServletRequestAttributes ra = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
if (null == ra) {
return null;
}
HttpServletRequest request = ra.getRequest();
return request;
}
}
//package org.modules.junmpProcess.utils;
//
//import lombok.extern.slf4j.Slf4j;
//import org.owasp.validator.html.AntiSamy;
//import org.owasp.validator.html.CleanResults;
//import org.owasp.validator.html.Policy;
//
//import java.io.InputStream;
//import java.util.regex.Matcher;
//import java.util.regex.Pattern;
//
///**
// * 防止XSS注入
// */
//@Slf4j
//public class XSSEscape {
//
//
// /**
// * 非法路径符号
// */
// private static final Pattern PATH_PATTERN = Pattern.compile("\\.\\.\\|\\.\\./|~/|~\\|[<]|>|\"|[*]|[|]|[?]", Pattern.CASE_INSENSITIVE);
//
// private static InputStream inputStream;
// private static Policy policy;
// private static Policy emptyPolicy;
//
// static {
// try {
// inputStream = XSSEscape.class.getClassLoader().getResourceAsStream("antisamy-ebay.xml");
// policy = Policy.getInstance(inputStream);
// inputStream.close();
// inputStream = XSSEscape.class.getClassLoader().getResourceAsStream("antisamy-empty.xml");
// emptyPolicy = Policy.getInstance(inputStream);
// inputStream.close();
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
//
// /**
// * 跨站式脚本攻击字符串过滤
// *
// * @param character 需要转义的字符串
// */
// public static String escape(String character) {
// try {
// AntiSamy antiSamy = new AntiSamy();
// CleanResults scan = antiSamy.scan(character, policy);
// String str = scan.getCleanHTML();
// str = str.replaceAll("&quot;", "\"");
// str = str.replaceAll("&amp;", "&");
// str = str.replaceAll("&lt;", "<");
// str = str.replaceAll("&gt;", ">");
// return str;
// } catch (Exception e) {
// log.error("转换错误:" + e.getMessage());
// }
// return null;
// }
//
//
// /**
// * 此方法伪过滤
// *
// * @param character 需要转义的字符串
// */
// public static String escapeEmpty(String character) {
// try {
// AntiSamy antiSamy = new AntiSamy();
// CleanResults scan = antiSamy.scan(character, emptyPolicy);
// return scan.getCleanHTML();
// } catch (Exception e) {
// }
// return character;
// }
//
// /**
// * 过滤非法路径
// *
// * @param path
// * @return
// */
// public static String escapePath(String path) {
// Matcher matcher = PATH_PATTERN.matcher(path);
// return escapeEmpty(matcher.replaceAll("").replaceAll("\\.\\.", "."));
// }
//
//
//}
package com.junmp.junmpProcess.vo;
import lombok.Data;
/**
* @author LoveMyOrange
* @create 2022-10-15 17:04
*/
@Data
public class AttachmentVO {
private String id;
private String name;
private String url;
}
package com.junmp.junmpProcess.vo;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import java.util.Date;
/**
* @author LoveMyOrange
* @create 2022-10-16 9:42
*/
@ApiModel("评论的VO")
@Data
public class CommentVO {
private String comments;
private String userId;
private String userName;
private Date createTime;
}
package com.junmp.junmpProcess.vo;
import com.alibaba.fastjson.JSONObject;
import com.junmp.junmpProcess.dto.json.ChildNode;
import com.junmp.junmpProcess.entity.ProcessTemplates;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
import java.util.Map;
/**
* @author LoveMyOrange
* @create 2022-10-15 16:27
*/
@Data
@ApiModel("详情VO")
public class HandleDataVO {
@ApiModelProperty("任务id")
private String taskId;
@ApiModelProperty("流程实例id")
private String processInstanceId;
@ApiModelProperty("表单数据")
private JSONObject formData;
@ApiModelProperty("前端是否打开 签名板")
private Boolean signFlag;
@ApiModelProperty("流程模板")
private ProcessTemplates processTemplates;
@ApiModelProperty("当前节点json数据 如果有taskId的话才返回")
private ChildNode currentNode;
@ApiModelProperty("任务详情")
private Map<String, List<TaskDetailVO>> detailVOList;
@ApiModelProperty("已经结束的节点")
List<String> endList;
@ApiModelProperty("正在运行的节点")
List<String> runningList;
@ApiModelProperty("还没运行的节点")
List<String> noTakeList;
}
package com.junmp.junmpProcess.vo;
import com.junmp.junmpProcess.dto.json.UserInfo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* @author LoveMyOrange
* @create 2022-10-14 23:47
*/
@Data
@ApiModel("我发起页面 需要返回给前端的VO")
public class HistoryProcessInstanceVO {
@ApiModelProperty("流程实例id")
private String processInstanceId;
@ApiModelProperty("审批类型")
private String processDefinitionName;
@ApiModelProperty("发起人")
private UserInfo startUser;
@ApiModelProperty("提交时间")
private Date startTime;
@ApiModelProperty("结束时间")
private Date endTime;
@ApiModelProperty("当前节点")
private String currentActivityName;
@ApiModelProperty("审批状态")
private String businessStatus;
@ApiModelProperty("耗时")
private String duration;
}
package com.junmp.junmpProcess.vo;
import io.swagger.annotations.ApiModel;
import lombok.Data;
/**
* @Author:LoveMyOrange
* @Description:
* @Date:Created in 2022/10/22 15:33
*/
@ApiModel("减签前一步操作")
@Data
public class MultiVO {
private String taskId;
private String processInstanceId;
private String executionId;
private String userId;
private String userName;
}
package com.junmp.junmpProcess.vo;
import lombok.Data;
import java.util.Date;
/**
* @author LoveMyOrange
* @create 2022-10-16 9:42
*/
@Data
public class OptionVO {
private String comments;
private String userId;
private String userName;
private Date createTime;
}
package com.junmp.junmpProcess.vo;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author : willian fu
* @version : 1.0
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class OrgTreeVo {
private Long id;
private String name;
private String type;
private String avatar;
private Boolean sex;
private Boolean selected;
}
package com.junmp.junmpProcess.vo;
import com.junmp.junmpProcess.entity.ProcessTemplates;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import java.util.List;
/**
* @author LoveMyOrange
* @create 2022-10-15 16:09
*/
@Data
@ApiModel("查看详情 需要返回给前端的VO")
public class ProcessInstanceDetailVO {
private ProcessTemplates processTemplates;
private String formData;
private String processInstanceId;
private List<String> completeIdList;
private List<String> finishIdList;
private List<String> noneList;
private Boolean signFlag;
}
package com.junmp.junmpProcess.vo;
import lombok.Data;
@Data
public class ProcessVO {
private String formJson;
private String formName;
private String processJson;
}
package com.junmp.junmpProcess.vo;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* @author LoveMyOrange
* @create 2022-10-16 9:38
*/
@Data
public class TaskDetailVO {
private String taskId;
private String activityId;
private String name;
private Date createTime;
private Date endTime;
private String signImage;
private List<AttachmentVO> attachmentVOList;
private List<OptionVO> optionVOList;
private List<CommentVO> commentVOList;
}
package com.junmp.junmpProcess.vo;
import com.junmp.junmpProcess.dto.json.UserInfo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.flowable.task.api.DelegationState;
import java.util.Date;
/**
* @author LoveMyOrange
* @create 2022-10-14 23:47
*/
@Data
@ApiModel("待办 需要返回给前端的VO")
public class TaskVO {
@ApiModelProperty("任务id")
private String taskId;
@ApiModelProperty("任务id")
private String processInstanceId;
@ApiModelProperty("审批类型")
private String processDefinitionName;
@ApiModelProperty("发起人")
private UserInfo startUser;
@ApiModelProperty("提交时间")
private Date startTime;
@ApiModelProperty("任务到达时间")
private Date taskCreatedTime;
@ApiModelProperty("当前节点")
private String currentActivityName;
@ApiModelProperty("审批状态")
private String businessStatus;
@ApiModelProperty("结束时间")
private Date endTime;
@ApiModelProperty("耗时")
private String duration;
@ApiModelProperty("委派状态")
private DelegationState delegationState;
}
package com.junmp.junmpProcess.vo;
import com.alibaba.fastjson.JSONObject;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* @author : willian fu
* @date : 2020/9/21
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class TemplateGroupVo {
private List<Template> items;
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public static class Template {
private String formId;
private String processDefinitionId;
private String formName;
private Boolean isStop;
private String remark;
private String updated;
private String templateId;
}
}
package com.junmp.junmpProcess.vo;
import lombok.Data;
@Data
public class TurnVo {
private String taskId;
private String userId;
private String[] assigneeList;
}
package com.junmp.junmpProcess.vo;
import lombok.Data;
@Data
public class UpdateProcessVO {
private String formId;
private String formJson;
private String formName;
private String processJson;
}
package springfox.documentation.spring.web;
import com.fasterxml.classmate.ResolvedType;
import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.mvc.condition.*;
import org.springframework.web.servlet.mvc.method.RequestMappingInfo;
import springfox.documentation.RequestHandler;
import springfox.documentation.RequestHandlerKey;
import springfox.documentation.service.ResolvedMethodParameter;
import springfox.documentation.spring.web.readers.operation.HandlerMethodResolver;
import springfox.documentation.spring.wrapper.NameValueExpression;
import springfox.documentation.spring.wrapper.PatternsRequestCondition;
import java.lang.annotation.Annotation;
import java.util.List;
import java.util.Optional;
import java.util.Set;
import java.util.StringJoiner;
import java.util.stream.Collectors;
import static java.util.Optional.ofNullable;
/**
* SpringBoot 2.6 Swagger无法使用
* 方法1:重写此类, 不影响SpringBoot匹配方式
* 方法2:改匹配方式为ANT
* spring:
* mvc:
* pathmatch:
* matching-strategy: ANT_PATH_MATCHER
*/
public class WebMvcRequestHandler implements RequestHandler {
private final String contextPath;
private final HandlerMethodResolver methodResolver;
private final RequestMappingInfo requestMapping;
private final HandlerMethod handlerMethod;
private static final org.springframework.web.servlet.mvc.condition.PatternsRequestCondition EMPTY_PATTERNS = new org.springframework.web.servlet.mvc.condition.PatternsRequestCondition();
private static final ParamsRequestCondition EMPTY_PARAMS = new ParamsRequestCondition();
private static final HeadersRequestCondition EMPTY_HEADERS = new HeadersRequestCondition();
private static final ConsumesRequestCondition EMPTY_CONSUMES = new ConsumesRequestCondition();
private static final ProducesRequestCondition EMPTY_PRODUCES = new ProducesRequestCondition();
public WebMvcRequestHandler(
String contextPath,
HandlerMethodResolver methodResolver,
RequestMappingInfo requestMapping,
HandlerMethod handlerMethod) {
this.contextPath = contextPath;
this.methodResolver = methodResolver;
this.requestMapping = requestMapping;
this.handlerMethod = handlerMethod;
}
@Override
public HandlerMethod getHandlerMethod() {
return handlerMethod;
}
@Override
public RequestHandler combine(RequestHandler other) {
return this;
}
@Override
public Class<?> declaringClass() {
return handlerMethod.getBeanType();
}
@Override
public boolean isAnnotatedWith(Class<? extends Annotation> annotation) {
return null != AnnotationUtils.findAnnotation(handlerMethod.getMethod(), annotation);
}
@Override
public PatternsRequestCondition getPatternsCondition() {
AbstractRequestCondition contition = requestMapping.getPatternsCondition();
if (contition == null) {
contition = new org.springframework.web.servlet.mvc.condition.PatternsRequestCondition(requestMapping.getPathPatternsCondition().getPatterns().stream().map(p -> p.getPatternString()).collect(Collectors.toList()).toArray(new String[]{}));
}
return new WebMvcPatternsRequestConditionWrapper(
contextPath,
(org.springframework.web.servlet.mvc.condition.PatternsRequestCondition) contition);
}
@Override
public String groupName() {
return ControllerNamingUtils.controllerNameAsGroup(handlerMethod);
}
@Override
public String getName() {
return handlerMethod.getMethod().getName();
}
@Override
public Set<RequestMethod> supportedMethods() {
return requestMapping.getMethodsCondition().getMethods();
}
@Override
public Set<MediaType> produces() {
return Optional.ofNullable(requestMapping.getProducesCondition()).orElseGet(() -> EMPTY_PRODUCES).getProducibleMediaTypes();
}
@Override
public Set<MediaType> consumes() {
return Optional.ofNullable(requestMapping.getConsumesCondition()).orElseGet(() -> EMPTY_CONSUMES).getConsumableMediaTypes();
}
@Override
public Set<NameValueExpression<String>> headers() {
return WebMvcNameValueExpressionWrapper.from(Optional.ofNullable(requestMapping.getHeadersCondition()).orElseGet(() -> EMPTY_HEADERS).getExpressions());
}
@Override
public Set<NameValueExpression<String>> params() {
return WebMvcNameValueExpressionWrapper.from(Optional.ofNullable(requestMapping.getParamsCondition()).orElseGet(() -> EMPTY_PARAMS).getExpressions());
}
@Override
public <T extends Annotation> Optional<T> findAnnotation(Class<T> annotation) {
return ofNullable(AnnotationUtils.findAnnotation(handlerMethod.getMethod(), annotation));
}
@Override
public RequestHandlerKey key() {
return new RequestHandlerKey(
Optional.ofNullable(requestMapping.getPatternsCondition()).orElseGet(() -> EMPTY_PATTERNS).getPatterns(),
requestMapping.getMethodsCondition().getMethods(),
Optional.ofNullable(requestMapping.getConsumesCondition()).orElseGet(() -> EMPTY_CONSUMES).getConsumableMediaTypes(),
Optional.ofNullable(requestMapping.getProducesCondition()).orElseGet(() -> EMPTY_PRODUCES).getProducibleMediaTypes());
}
@Override
public springfox.documentation.spring.wrapper.RequestMappingInfo<?> getRequestMapping() {
return new WebMvcRequestMappingInfoWrapper(requestMapping);
}
@Override
public List<ResolvedMethodParameter> getParameters() {
return methodResolver.methodParameters(handlerMethod);
}
@Override
public ResolvedType getReturnType() {
return methodResolver.methodReturnType(handlerMethod);
}
@Override
public <T extends Annotation> Optional<T> findControllerAnnotation(Class<T> annotation) {
return ofNullable(AnnotationUtils.findAnnotation(handlerMethod.getBeanType(), annotation));
}
@Override
public String toString() {
return new StringJoiner(", ", WebMvcRequestHandler.class.getSimpleName() + "{", "}")
.add("requestMapping=" + requestMapping)
.add("handlerMethod=" + handlerMethod)
.add("key=" + key())
.toString();
}
}
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!--
W3C rules retrieved from:
http://www.w3.org/TR/html401/struct/global.html
-->
<anti-samy-rules xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="antisamy.xsd">
<directives>
<directive name="omitXmlDeclaration" value="true"/>
<directive name="omitDoctypeDeclaration" value="true"/>
<directive name="maxInputSize" value="20000"/>
<directive name="useXHTML" value="true"/>
<directive name="formatOutput" value="true"/>
<!--
remember, this won't work for relative URIs - AntiSamy doesn't
know anything about the URL or your web structure
-->
<directive name="embedStyleSheets" value="false"/>
</directives>
<common-regexps>
<!--
From W3C:
This attribute assigns a class name or set of class names to an
element. Any number of elements may be assigned the same class
name or names. Multiple class names must be separated by white
space characters.
-->
<!-- The 16 colors defined by the HTML Spec (also used by the CSS Spec) -->
<regexp name="colorName"
value="(aqua|black|blue|fuchsia|gray|grey|green|lime|maroon|navy|olive|purple|red|silver|teal|white|yellow)"/>
<!-- HTML/CSS Spec allows 3 or 6 digit hex to specify color -->
<regexp name="colorCode" value="(#([0-9a-fA-F]{6}|[0-9a-fA-F]{3}))"/>
<regexp name="anything" value=".*"/>
<regexp name="numberOrPercent" value="(\d)+(%{0,1})"/>
<regexp name="paragraph" value="([\p{L}\p{N},'\.\s\-_\(\)]|&amp;[0-9]{2};)*"/>
<regexp name="htmlId" value="[a-zA-Z0-9\:\-_\.]+"/>
<regexp name="htmlTitle"
value="[\p{L}\p{N}\s\-_',:\[\]!\./\\\(\)&amp;]*"/> <!-- force non-empty with a '+' at the end instead of '*' -->
<regexp name="htmlClass" value="[a-zA-Z0-9\s,\-_]+"/>
<regexp name="onsiteURL"
value="^(?!//)(?![\p{L}\p{N}\\\.\#@\$%\+&amp;;\-_~,\?=/!]*(&amp;colon))[\p{L}\p{N}\\\.\#@\$%\+&amp;;\-_~,\?=/!]*"/>
<regexp name="offsiteURL"
value="(\s)*((ht|f)tp(s?)://|mailto:)[\p{L}\p{N}]+[\p{L}\p{N}\p{Zs}\.\#@\$%\+&amp;;:\-_~,\?=/!\(\)]*(\s)*"/>
<regexp name="boolean" value="(true|false)"/>
<regexp name="singlePrintable" value="[a-zA-Z0-9]{1}"/> <!-- \w allows the '_' character -->
<!-- This is for elements (ex: elemName { ... }) -->
<regexp name="cssElementSelector" value="[a-zA-Z0-9\-_]+|\*"/>
<!-- This is to list out any element names that are *not* valid -->
<regexp name="cssElementExclusion" value=""/>
<!-- This if for classes (ex: .className { ... }) -->
<regexp name="cssClassSelector" value="\.[a-zA-Z0-9\-_]+"/>
<!-- This is to list out any class names that are *not* valid -->
<regexp name="cssClassExclusion" value=""/>
<!-- This is for ID selectors (ex: #myId { ... } -->
<regexp name="cssIDSelector" value="#[a-zA-Z0-9\-_]+"/>
<!-- This is to list out any IDs that are *not* valid - FIXME: What should the default be to avoid div hijacking? *? -->
<regexp name="cssIDExclusion" value=""/>
<!-- This is for pseudo-element selector (ex. foo:pseudo-element { ... } -->
<regexp name="cssPseudoElementSelector" value=":[a-zA-Z0-9\-_]+"/>
<!-- This is to list out any psuedo-element names that are *not* valid -->
<regexp name="cssPsuedoElementExclusion" value=""/>
<!-- This is for attribute selectors (ex. foo[attr=value] { ... } -->
<regexp name="cssAttributeSelector" value="\[[a-zA-Z0-9\-_]+((=|~=|\|=){1}[a-zA-Z0-9\-_]+){1}\]"/>
<!-- This is to list out any attribute names that are *not* valid -->
<regexp name="cssAttributeExclusion" value=""/>
<!-- This is for resources referenced from CSS (such as background images and other imported stylesheets) -->
<regexp name="cssOnsiteUri" value="url\(([\p{L}\p{N}\\/\.\?=\#&amp;;\-_~]+|\#(\w)+)\)"/>
<regexp name="cssOffsiteUri"
value="url\((\s)*((ht|f)tp(s?)://)[\p{L}\p{N}]+[~\p{L}\p{N}\p{Zs}\-_\.@#$%&amp;;:,\?=/\+!]*(\s)*\)"/>
<!-- This if for CSS Identifiers -->
<regexp name="cssIdentifier" value="[a-zA-Z0-9\-_]+"/>
<!-- This is for comments within CSS (ex. /* comment */) -->
<regexp name="cssCommentText" value="[\p{L}\p{N}\-_,\/\\\.\s\(\)!\?\=\$#%\^&amp;:&quot;']+"/>
<regexp name="integer" value="(-|\+)?[0-9]+"/>
<regexp name="positiveInteger" value="(\+)?[0-9]+"/>
<regexp name="number" value="(-|\+)?([0-9]+(\.[0-9]+)?)"/>
<regexp name="angle" value="(-|\+)?([0-9]+(\.[0-9]+)?)(deg|grads|rad)"/>
<regexp name="time" value="([0-9]+(\.[0-9]+)?)(ms|s)"/>
<regexp name="frequency" value="([0-9]+(\.[0-9]+)?)(hz|khz)"/>
<regexp name="length" value="((-|\+)?0|(-|\+)?([0-9]+(\.[0-9]+)?)(em|ex|px|in|cm|mm|pt|pc))"/>
<regexp name="positiveLength" value="((\+)?0|(\+)?([0-9]+(\.[0-9]+)?)(em|ex|px|in|cm|mm|pt|pc))"/>
<regexp name="percentage" value="(-|\+)?([0-9]+(\.[0-9]+)?)%"/>
<regexp name="positivePercentage" value="(\+)?([0-9]+(\.[0-9]+)?)%"/>
<regexp name="absolute-size" value="(xx-small|x-small|small|medium|large|x-large|xx-large)"/>
<regexp name="relative-size" value="(larger|smaller)"/>
<!-- Used for CSS Color specifications (complex regexp expresses integer values of 0-255) -->
<regexp name="rgbCode"
value="rgb\(([1]?[0-9]{1,2}|2[0-4][0-9]|25[0-5]),([1]?[0-9]{1,2}|2[0-4][0-9]|25[0-5]),([1]?[0-9]{1,2}|2[0-4][0-9]|25[0-5])\)"/>
<!-- CSS2 Allowed System Color Values -->
<regexp name="systemColor"
value="(activeborder|activecaption|appworkspace|background|buttonface|buttonhighlight|buttonshadow|buttontext|captiontext|graytext|highlight|highlighttext|inactiveborder|inactivecaption|inactivecaptiontext|infobackground|infotext|menu|menutext|scrollbar|threeddarkshadow|threedface|threedhighlight|threedlightshadow|threedshadow|window|windowframe|windowtext)"/>
</common-regexps>
<!--
Tag.name = a, b, div, body, etc.
Tag.action = filter: remove tags, but keep content, validate: keep content as long as it passes rules, remove: remove tag and contents
Attribute.name = id, class, href, align, width, etc.
Attribute.onInvalid = what to do when the attribute is invalid, e.g., remove the tag (removeTag), remove the attribute (removeAttribute), filter the tag (filterTag)
Attribute.description = What rules in English you want to tell the users they can have for this attribute. Include helpful things so they'll be able to tune their HTML
-->
<!--
Some attributes are common to all (or most) HTML tags. There aren't many that qualify for this. You have to make sure there's no
collisions between any of these attribute names with attribute names of other tags that are for different purposes.
-->
<common-attributes>
<!-- Common to all HTML tags -->
<attribute name="id"
description="The 'id' of any HTML attribute should not contain anything besides letters and numbers">
<regexp-list>
<regexp name="htmlId"/>
</regexp-list>
</attribute>
<attribute name="class"
description="The 'class' of any HTML attribute is usually a single word, but it can also be a list of class names separated by spaces">
<regexp-list>
<regexp name="htmlClass"/>
</regexp-list>
</attribute>
<attribute name="lang"
description="The 'lang' attribute tells the browser what language the element's attribute values and content are written in">
<regexp-list>
<regexp value="[a-zA-Z]{2,20}"/>
</regexp-list>
</attribute>
<attribute name="title"
description="The 'title' attribute provides text that shows up in a 'tooltip' when a user hovers their mouse over the element">
<regexp-list>
<regexp name="htmlTitle"/>
</regexp-list>
</attribute>
<attribute name="alt"
description="The 'alt' attribute provides alternative text to users when its visual representation is not available">
<regexp-list>
<regexp name="paragraph"/>
</regexp-list>
</attribute>
<!-- the "style" attribute will be validated by an inline stylesheet scanner, so no need to define anything here - i hate having to special case this but no other choice -->
<attribute name="style"
description="The 'style' attribute provides the ability for users to change many attributes of the tag's contents using a strict syntax"/>
<attribute name="media">
<regexp-list>
<regexp value="[a-zA-Z0-9,\-\s]+"/>
</regexp-list>
<literal-list>
<literal value="screen"/>
<literal value="tty"/>
<literal value="tv"/>
<literal value="projection"/>
<literal value="handheld"/>
<literal value="print"/>
<literal value="braille"/>
<literal value="aural"/>
<literal value="all"/>
</literal-list>
</attribute>
<!-- Anchor related -->
<!-- onInvalid="filterTag" has been removed as per suggestion at OWASP SJ 2007 - just "name" is valid -->
<attribute name="href">
<regexp-list>
<regexp name="onsiteURL"/>
<regexp name="offsiteURL"/>
</regexp-list>
</attribute>
<attribute name="name">
<regexp-list>
<regexp value="[a-zA-Z0-9\-_\$]+"/>
<!--
have to allow the $ for .NET controls - although,
will users be supplying input that has server-generated
.NET control names? methinks not, but i want to pass my
test cases
-->
</regexp-list>
</attribute>
<attribute name="shape" description="The 'shape' attribute defines the shape of the selectable area">
<literal-list>
<literal value="default"/>
<literal value="rect"/>
<literal value="circle"/>
<literal value="poly"/>
</literal-list>
</attribute>
<!-- Table attributes -->
<attribute name="border">
<regexp-list>
<regexp name="number"/>
</regexp-list>
</attribute>
<attribute name="cellpadding">
<regexp-list>
<regexp name="number"/>
</regexp-list>
</attribute>
<attribute name="cellspacing">
<regexp-list>
<regexp name="number"/>
</regexp-list>
</attribute>
<attribute name="colspan">
<regexp-list>
<regexp name="number"/>
</regexp-list>
</attribute>
<attribute name="rowspan">
<regexp-list>
<regexp name="number"/>
</regexp-list>
</attribute>
<attribute name="background">
<regexp-list>
<regexp name="onsiteURL"/>
</regexp-list>
</attribute>
<attribute name="bgcolor">
<regexp-list>
<regexp name="colorName"/>
<regexp name="colorCode"/>
</regexp-list>
</attribute>
<attribute name="abbr">
<regexp-list>
<regexp name="paragraph"/>
</regexp-list>
</attribute>
<attribute name="headers" description="The 'headers' attribute is a space-separated list of cell IDs">
<regexp-list>
<regexp value="[a-zA-Z0-9\s*]*"/>
</regexp-list>
</attribute>
<attribute name="charoff">
<regexp-list>
<regexp value="numberOrPercent"/>
</regexp-list>
</attribute>
<attribute name="char">
<regexp-list>
<regexp value=".{0,1}"/>
</regexp-list>
</attribute>
<attribute name="axis" description="The 'headers' attribute is a comma-separated list of related header cells">
<regexp-list>
<regexp value="[a-zA-Z0-9\s*,]*"/>
</regexp-list>
</attribute>
<attribute name="nowrap"
description="The 'nowrap' attribute tells the browser not to wrap text that goes over one line">
<regexp-list>
<regexp name="anything"/>
<!-- <regexp value="(nowrap){0,1}"/> -->
</regexp-list>
</attribute>
<!-- Common positioning attributes -->
<attribute name="width">
<regexp-list>
<regexp name="numberOrPercent"/>
</regexp-list>
</attribute>
<attribute name="height">
<regexp-list>
<regexp name="numberOrPercent"/>
</regexp-list>
</attribute>
<attribute name="align"
description="The 'align' attribute of an HTML element is a direction word, like 'left', 'right' or 'center'">
<literal-list>
<literal value="center"/>
<literal value="middle"/>
<literal value="left"/>
<literal value="right"/>
<literal value="justify"/>
<literal value="char"/>
</literal-list>
</attribute>
<attribute name="valign"
description="The 'valign' attribute of an HTML attribute is a direction word, like 'baseline','bottom','middle' or 'top'">
<literal-list>
<literal value="baseline"/>
<literal value="bottom"/>
<literal value="middle"/>
<literal value="top"/>
</literal-list>
</attribute>
<!-- Intrinsic JavaScript Events -->
<attribute name="onFocus"
description="The 'onFocus' event is executed when the control associated with the tag gains focus">
<literal-list>
<literal value="javascript:void(0)"/>
<literal value="javascript:history.go(-1)"/>
</literal-list>
</attribute>
<attribute name="onBlur"
description="The 'onBlur' event is executed when the control associated with the tag loses focus">
<literal-list>
<literal value="javascript:void(0)"/>
<literal value="javascript:history.go(-1)"/>
</literal-list>
</attribute>
<attribute name="onClick"
description="The 'onClick' event is executed when the control associated with the tag is clicked">
<literal-list>
<literal value="javascript:void(0)"/>
<literal value="javascript:history.go(-1)"/>
</literal-list>
</attribute>
<attribute name="onDblClick"
description="The 'onDblClick' event is executed when the control associated with the tag is clicked twice immediately">
<literal-list>
<literal value="javascript:void(0)"/>
<literal value="javascript:history.go(-1)"/>
</literal-list>
</attribute>
<attribute name="onMouseDown"
description="The 'onMouseDown' event is executed when the control associated with the tag is clicked but not yet released">
<literal-list>
<literal value="javascript:void(0)"/>
<literal value="javascript:history.go(-1)"/>
</literal-list>
</attribute>
<attribute name="onMouseUp"
description="The 'onMouseUp' event is executed when the control associated with the tag is clicked after the button is released">
<literal-list>
<literal value="javascript:void(0)"/>
<literal value="javascript:history.go(-1)"/>
</literal-list>
</attribute>
<attribute name="onMouseOver"
description="The 'onMouseOver' event is executed when the user's mouse hovers over the control associated with the tag">
<literal-list>
<literal value="javascript:void(0)"/>
<literal value="javascript:history.go(-1)"/>
</literal-list>
</attribute>
<attribute name="scope" description="The 'scope' attribute defines what's covered by the header cells">
<literal-list>
<literal value="row"/>
<literal value="col"/>
<literal value="rowgroup"/>
<literal value="colgroup"/>
</literal-list>
</attribute>
<!-- If you want users to be able to mess with tabindex, uncomment this -->
<!--
<attribute name="tabindex" description="...">
<regexp-list>
<regexp name="number"/>
</regexp-list>
</attribute>
-->
<!-- Input/form related common attributes -->
<attribute name="disabled">
<regexp-list>
<regexp name="anything"/>
</regexp-list>
</attribute>
<attribute name="readonly">
<regexp-list>
<regexp name="anything"/>
</regexp-list>
</attribute>
<attribute name="accesskey">
<regexp-list>
<regexp name="anything"/>
</regexp-list>
</attribute>
<attribute name="size">
<regexp-list>
<regexp name="number"/>
</regexp-list>
</attribute>
<attribute name="autocomplete">
<literal-list>
<literal value="on"/>
<literal value="off"/>
</literal-list>
</attribute>
<attribute name="rows">
<regexp-list>
<regexp name="number"/>
</regexp-list>
</attribute>
<attribute name="cols">
<regexp-list>
<regexp name="number"/>
</regexp-list>
</attribute>
</common-attributes>
<!--
This requires normal updates as browsers continue to diverge from the W3C and each other. As long as the browser wars continue
this is going to continue. I'm not sure war is the right word for what's going on. Doesn't somebody have to win a war after
a while? Even wars of attrition, surely?
-->
<global-tag-attributes>
<!-- Not valid in base, head, html, meta, param, script, style, and title elements. -->
<attribute name="id"/>
<attribute name="style"/>
<attribute name="title"/>
<attribute name="class"/>
<!-- Not valid in base, br, frame, frameset, hr, iframe, param, and script elements. -->
<attribute name="lang"/>
</global-tag-attributes>
<tags-to-encode>
<tag>g</tag>
<tag>grin</tag>
</tags-to-encode>
<tag-rules>
<!-- Tags related to JavaScript -->
<tag name="script" action="remove"/>
<tag name="noscript"
action="validate"/> <!-- although no javascript can fire inside a noscript tag, css is still a viable attack vector -->
<!-- Frame & related tags -->
<tag name="iframe" action="remove"/>
<tag name="frameset" action="remove"/>
<tag name="frame" action="remove"/>
<!-- Form related tags -->
<tag name="label" action="validate">
<attribute name="for">
<regexp-list>
<regexp name="htmlId"/>
</regexp-list>
</attribute>
</tag>
<!-- All formatting tags -->
<tag name="h1" action="validate"/>
<tag name="h2" action="validate"/>
<tag name="h3" action="validate"/>
<tag name="h4" action="validate"/>
<tag name="h5" action="validate"/>
<tag name="h6" action="validate"/>
<tag name="p" action="validate">
<attribute name="align"/>
</tag>
<tag name="i" action="validate"/>
<tag name="b" action="validate"/>
<tag name="u" action="validate"/>
<tag name="strong" action="validate"/>
<tag name="em" action="validate"/>
<tag name="small" action="validate"/>
<tag name="big" action="validate"/>
<tag name="pre" action="validate"/>
<tag name="code" action="validate"/>
<tag name="cite" action="validate"/>
<tag name="samp" action="validate"/>
<tag name="sub" action="validate"/>
<tag name="sup" action="validate"/>
<tag name="strike" action="validate"/>
<tag name="center" action="validate"/>
<tag name="blockquote" action="validate"/>
<tag name="hr" action="validate"/>
<tag name="br" action="validate"/>
<tag name="font" action="validate">
<attribute name="color">
<regexp-list>
<regexp name="colorName"/>
<regexp name="colorCode"/>
</regexp-list>
</attribute>
<attribute name="face">
<regexp-list>
<regexp value="[\w;, \-]+"/>
</regexp-list>
</attribute>
<attribute name="size">
<regexp-list>
<regexp value="(\+|-){0,1}(\d)+"/>
</regexp-list>
</attribute>
</tag>
<!-- Anchor and anchor related tags -->
<tag name="a" action="validate">
<!-- onInvalid="filterTag" has been removed as per suggestion at OWASP SJ 2007 - just "name" is valid -->
<attribute name="href"/>
<attribute name="onFocus"/>
<attribute name="onBlur"/>
<attribute name="nohref">
<regexp-list>
<regexp name="anything"/>
</regexp-list>
</attribute>
<attribute name="rel">
<literal-list>
<literal value="nofollow"/>
</literal-list>
</attribute>
<attribute name="name"/>
</tag>
<tag name="map" action="validate"/>
<!-- base tag removed per demo - this could be enabled with literal-list values you allow -->
<!--
<tag name="base" action="validate">
<attribute name="href"/>
</tag>
-->
<!-- Stylesheet Tags -->
<tag name="style" action="validate">
<attribute name="type">
<literal-list>
<literal value="text/css"/>
</literal-list>
</attribute>
<attribute name="media"/>
</tag>
<tag name="span" action="validate"/>
<tag name="div" action="validate">
<attribute name="align"/>
</tag>
<!-- <attribute name="id"/> what could an attacker do if they could overwrite an existing div definition? prolly something bad -->
<!-- <attribute name="class"/> what could an attacker do if they could specify any class in the namespace? prolly something bad -->
<!-- Image & image related tags -->
<tag name="img" action="validate">
<attribute name="src" onInvalid="removeTag">
<regexp-list>
<regexp name="onsiteURL"/>
<regexp name="offsiteURL"/>
</regexp-list>
</attribute>
<attribute name="name"/>
<attribute name="alt"/>
<attribute name="height"/>
<attribute name="width"/>
<attribute name="border"/>
<attribute name="align"/>
<attribute name="hspace">
<regexp-list>
<regexp name="number"/>
</regexp-list>
</attribute>
<attribute name="vspace">
<regexp-list>
<regexp name="number"/>
</regexp-list>
</attribute>
</tag>
<!-- no way to do this safely without hooking up the same code to @import to embed the remote stylesheet (malicious user could change offsite resource to be malicious after validation -->
<!-- <attribute name="href" onInvalid="removeTag"/> -->
<tag name="link" action="validate">
<!-- <attribute name="href" onInvalid="removeTag"/> -->
<attribute name="media"/>
<attribute name="type" onInvalid="removeTag">
<literal-list>
<literal value="text/css"/>
<literal value="application/rss+xml"/>
<literal value="image/x-icon"/>
</literal-list>
</attribute>
<attribute name="rel">
<literal-list>
<literal value="stylesheet"/>
<literal value="shortcut icon"/>
<literal value="search"/>
<literal value="copyright"/>
<literal value="top"/>
<literal value="alternate"/>
</literal-list>
</attribute>
</tag>
<!-- List tags -->
<tag name="ul" action="validate"/>
<tag name="ol" action="validate"/>
<tag name="li" action="validate"/>
<!-- Dictionary tags -->
<tag name="dd" action="truncate"/>
<tag name="dl" action="truncate"/>
<tag name="dt" action="truncate"/>
<!-- Table tags (tbody, thead, tfoot)-->
<tag name="thead" action="validate">
<attribute name="align"/>
<attribute name="char"/>
<attribute name="charoff"/>
<attribute name="valign"/>
</tag>
<tag name="tbody" action="validate">
<attribute name="align"/>
<attribute name="char"/>
<attribute name="charoff"/>
<attribute name="valign"/>
</tag>
<tag name="tfoot" action="validate">
<attribute name="align"/>
<attribute name="char"/>
<attribute name="charoff"/>
<attribute name="valign"/>
</tag>
<tag name="table" action="validate">
<attribute name="height"/>
<attribute name="width"/>
<attribute name="border"/>
<attribute name="bgcolor"/>
<attribute name="cellpadding"/>
<attribute name="cellspacing"/>
<attribute name="background"/>
<attribute name="align"/>
<attribute name="noresize">
<literal-list>
<literal value="noresize"/>
<literal value=""/>
</literal-list>
</attribute>
</tag>
<tag name="td" action="validate">
<attribute name="background"/>
<attribute name="bgcolor"/>
<attribute name="abbr"/>
<attribute name="axis"/>
<attribute name="headers"/>
<attribute name="scope"/>
<attribute name="nowrap"/>
<attribute name="height"/>
<attribute name="width"/>
<attribute name="align"/>
<attribute name="char"/>
<attribute name="charoff"/>
<attribute name="valign"/>
<attribute name="colspan"/>
<attribute name="rowspan"/>
</tag>
<tag name="th" action="validate">
<attribute name="abbr"/>
<attribute name="axis"/>
<attribute name="headers"/>
<attribute name="scope"/>
<attribute name="nowrap"/>
<attribute name="bgcolor"/>
<attribute name="height"/>
<attribute name="width"/>
<attribute name="align"/>
<attribute name="char"/>
<attribute name="charoff"/>
<attribute name="valign"/>
<attribute name="colspan"/>
<attribute name="rowspan"/>
</tag>
<tag name="tr" action="validate">
<attribute name="height"/>
<attribute name="width"/>
<attribute name="align"/>
<attribute name="valign"/>
<attribute name="char"/>
<attribute name="charoff"/>
<attribute name="background"/>
</tag>
<tag name="colgroup" action="validate">
<attribute name="span">
<regexp-list>
<regexp name="number"/>
</regexp-list>
</attribute>
<attribute name="width"/>
<attribute name="align"/>
<attribute name="char"/>
<attribute name="charoff"/>
<attribute name="valign"/>
</tag>
<tag name="col" action="validate">
<attribute name="align"/>
<attribute name="char"/>
<attribute name="charoff"/>
<attribute name="valign"/>
<attribute name="span">
<regexp-list>
<regexp name="number"/>
</regexp-list>
</attribute>
<attribute name="width"/>
</tag>
<tag name="fieldset" action="validate"/>
<tag name="legend" action="validate"/>
</tag-rules>
<!-- CSS validation processing rules -->
<css-rules>
<property name="azimuth"
description="This property is most likely to be implemented by mixing the same signal into different channels at differing volumes.">
<literal-list>
<literal value="left-side"/>
<literal value="far-left"/>
<literal value="left"/>
<literal value="center-left"/>
<literal value="center"/>
<literal value="center-right"/>
<literal value="right"/>
<literal value="far-right"/>
<literal value="right-side"/>
<literal value="behind"/>
<literal value="leftwards"/>
<literal value="rightwards"/>
<literal value="inherit"/>
</literal-list>
<regexp-list>
<regexp name="angle"/>
</regexp-list>
</property>
<property name="background"
description="The 'background' property is a shorthand property for setting the individual background properties (i.e., 'background-color', 'background-image', 'background-repeat', 'background-attachment' and 'background-position') at the same place in the style sheet.">
<literal-list>
<literal value="inherit"/>
</literal-list>
<shorthand-list>
<shorthand name="background-color"/>
<shorthand name="background-image"/>
<shorthand name="background-repeat"/>
<shorthand name="background-attachment"/>
<shorthand name="background-position"/>
</shorthand-list>
</property>
<property name="background-attachment"
description="If a background image is specified, this property specifies whether it is fixed with regard to the viewport ('fixed') or scrolls along with the document ('scroll').">
<literal-list>
<literal value="scroll"/>
<literal value="fixed"/>
<literal value="inherit"/>
</literal-list>
</property>
<property name="background-color"
description="This property sets the background color of an element, either a &lt;color&gt; value or the keyword 'transparent', to make the underlying colors shine through.">
<literal-list>
<literal value="transparent"/>
<literal value="inherit"/>
</literal-list>
<regexp-list>
<regexp name="colorName"/>
<regexp name="colorCode"/>
<regexp name="rgbCode"/>
<regexp name="systemColor"/>
</regexp-list>
</property>
<property name="background-image" description="This property sets the background image of an element.">
<literal-list>
<literal value="none"/>
<literal value="inherit"/>
</literal-list>
<regexp-list>
<regexp name="cssOffsiteUri"/>
<regexp name="cssOnsiteUri"/>
</regexp-list>
</property>
<property name="background-position"
description="If a background image has been specified, this property specifies its initial position.">
<literal-list>
<literal value="top"/>
<literal value="center"/>
<literal value="bottom"/>
<literal value="left"/>
<literal value="center"/>
<literal value="right"/>
<literal value="inherit"/>
</literal-list>
<regexp-list>
<regexp name="percentage"/>
<regexp name="length"/>
</regexp-list>
</property>
<property name="background-repeat"
description="If a background image is specified, this property specifies whether the image is repeated (tiled), and how.">
<literal-list>
<literal value="repeat"/>
<literal value="repeat-x"/>
<literal value="repeat-y"/>
<literal value="no-repeat"/>
<literal value="inherit"/>
</literal-list>
</property>
<!-- Begin simple properties -->
<property name="border-collapse" default="collapse" description="">
<category-list>
<category value="visual"/>
</category-list>
<literal-list>
<literal value="collapse"/>
<literal value="separate"/>
<literal value="inherit"/>
</literal-list>
</property>
<property name="border-color" description="">
<category-list>
<category value="visual"/>
</category-list>
<literal-list>
<literal value="transparent"/>
<literal value="inherit"/>
</literal-list>
<regexp-list>
<regexp name="colorName"/>
<regexp name="colorCode"/>
<regexp name="rgbCode"/>
<regexp name="systemColor"/>
</regexp-list>
</property>
<property name="border-top-color" description="">
<category-list>
<category value="visual"/>
</category-list>
<literal-list>
<literal value="inherit"/>
</literal-list>
<regexp-list>
<regexp name="colorName"/>
<regexp name="colorCode"/>
<regexp name="rgbCode"/>
<regexp name="systemColor"/>
</regexp-list>
</property>
<property name="border-right-color" description="">
<category-list>
<category value="visual"/>
</category-list>
<literal-list>
<literal value="inherit"/>
</literal-list>
<regexp-list>
<regexp name="colorName"/>
<regexp name="colorCode"/>
<regexp name="rgbCode"/>
<regexp name="systemColor"/>
</regexp-list>
</property>
<property name="border-bottom-color" description="">
<category-list>
<category value="visual"/>
</category-list>
<literal-list>
<literal value="inherit"/>
</literal-list>
<regexp-list>
<regexp name="colorName"/>
<regexp name="colorCode"/>
<regexp name="rgbCode"/>
<regexp name="systemColor"/>
</regexp-list>
</property>
<property name="border-left-color" description="">
<category-list>
<category value="visual"/>
</category-list>
<literal-list>
<literal value="inherit"/>
</literal-list>
<regexp-list>
<regexp name="colorName"/>
<regexp name="colorCode"/>
<regexp name="rgbCode"/>
<regexp name="systemColor"/>
</regexp-list>
</property>
<property name="bottom" default="auto" description="">
<category-list>
<category value="visual"/>
</category-list>
<literal-list>
<literal value="auto"/>
<literal value="inherit"/>
</literal-list>
<regexp-list>
<regexp name="length"/>
<regexp name="percentage"/>
</regexp-list>
</property>
<property name="caption-side" default="top" description="">
<category-list>
<category value="visual"/>
</category-list>
<literal-list>
<literal value="top"/>
<literal value="bottom"/>
<literal value="left"/>
<literal value="right"/>
<literal value="inherit"/>
</literal-list>
</property>
<property name="clear" default="none" description="">
<category-list>
<category value="visual"/>
</category-list>
<literal-list>
<literal value="none"/>
<literal value="left"/>
<literal value="right"/>
<literal value="both"/>
<literal value="inherit"/>
</literal-list>
</property>
<property name="color" description="">
<category-list>
<category value="visual"/>
</category-list>
<literal-list>
<literal value="inherit"/>
</literal-list>
<regexp-list>
<regexp name="colorName"/>
<regexp name="colorCode"/>
<regexp name="rgbCode"/>
<regexp name="systemColor"/>
</regexp-list>
</property>
<property name="cue-after" default="none" description="">
<category-list>
<category value="aural"/>
</category-list>
<literal-list>
<literal value="none"/>
<literal value="inherit"/>
</literal-list>
<regexp-list>
<regexp name="cssOffsiteUri"/>
<regexp name="cssOnsiteUri"/>
</regexp-list>
</property>
<property name="cue-before" default="none" description="">
<category-list>
<category value="aural"/>
</category-list>
<literal-list>
<literal value="none"/>
<literal value="inherit"/>
</literal-list>
<regexp-list>
<regexp name="cssOffsiteUri"/>
<regexp name="cssOnsiteUri"/>
</regexp-list>
</property>
<property name="direction" default="ltr" description="">
<category-list>
<category value="visual"/>
</category-list>
<literal-list>
<literal value="ltr"/>
<literal value="rtl"/>
<literal value="inherit"/>
</literal-list>
</property>
<property name="display" default="inline" description="">
<category-list>
<category value="all"/>
</category-list>
<literal-list>
<literal value="inline"/>
<literal value="block"/>
<literal value="list-item"/>
<literal value="run-in"/>
<literal value="compact"/>
<literal value="marker"/>
<literal value="table"/>
<literal value="inline-table"/>
<literal value="table-row-group"/>
<literal value="table-header-group"/>
<literal value="table-footer-group"/>
<literal value="table-row"/>
<literal value="table-column-group"/>
<literal value="table-column"/>
<literal value="table-cell"/>
<literal value="table-caption"/>
<literal value="none"/>
<literal value="inherit"/>
</literal-list>
</property>
<property name="elevation" default="level" description="">
<category-list>
<category value="aural"/>
</category-list>
<literal-list>
<literal value="below"/>
<literal value="level"/>
<literal value="above"/>
<literal value="higher"/>
<literal value="lower"/>
<literal value="inherit"/>
</literal-list>
<regexp-list>
<regexp name="angle"/>
</regexp-list>
</property>
<property name="empty-cells" default="show" description="">
<category-list>
<category value="visual"/>
</category-list>
<literal-list>
<literal value="show"/>
<literal value="hide"/>
<literal value="inherit"/>
</literal-list>
</property>
<property name="float" default="none" description="">
<category-list>
<category value="visual"/>
</category-list>
<literal-list>
<literal value="left"/>
<literal value="right"/>
<literal value="none"/>
<literal value="inherit"/>
</literal-list>
</property>
<property name="font-size" default="medium" description="">
<category-list>
<category value="visual"/>
</category-list>
<literal-list>
<literal value="inherit"/>
</literal-list>
<regexp-list>
<regexp name="absolute-size"/>
<regexp name="relative-size"/>
<regexp name="length"/>
<regexp name="percentage"/>
</regexp-list>
</property>
<property name="font-size-adjust" default="none" description="">
<category-list>
<category value="visual"/>
</category-list>
<literal-list>
<literal value="none"/>
<literal value="inherit"/>
</literal-list>
<regexp-list>
<regexp name="number"/>
</regexp-list>
</property>
<property name="font-stretch" default="normal" description="">
<category-list>
<category value="visual"/>
</category-list>
<literal-list>
<literal value="normal"/>
<literal value="wider"/>
<literal value="narrower"/>
<literal value="ultra-condensed"/>
<literal value="extra-condensed"/>
<literal value="condensed"/>
<literal value="semi-condensed"/>
<literal value="semi-expanded"/>
<literal value="expanded"/>
<literal value="extra-expanded"/>
<literal value="ultra-expanded"/>
<literal value="inherit"/>
</literal-list>
</property>
<property name="font-style" default="normal" description="">
<category-list>
<category value="visual"/>
</category-list>
<literal-list>
<literal value="normal"/>
<literal value="italic"/>
<literal value="oblique"/>
<literal value="inherit"/>
</literal-list>
</property>
<property name="font-variant" default="normal" description="">
<category-list>
<category value="visual"/>
</category-list>
<literal-list>
<literal value="normal"/>
<literal value="small-caps"/>
<literal value="inherit"/>
</literal-list>
</property>
<property name="font-weight" default="normal" description="">
<category-list>
<category value="visual"/>
</category-list>
<literal-list>
<literal value="normal"/>
<literal value="bold"/>
<literal value="bolder"/>
<literal value="lighter"/>
<literal value="100"/>
<literal value="200"/>
<literal value="300"/>
<literal value="400"/>
<literal value="500"/>
<literal value="600"/>
<literal value="700"/>
<literal value="800"/>
<literal value="900"/>
<literal value="inherit"/>
</literal-list>
</property>
<property name="height" default="auto" description="">
<category-list>
<category value="visual"/>
</category-list>
<literal-list>
<literal value="auto"/>
<literal value="inherit"/>
</literal-list>
<regexp-list>
<regexp name="length"/>
<regexp name="percentage"/>
</regexp-list>
</property>
<property name="left" default="auto" description="">
<category-list>
<category value="visual"/>
</category-list>
<literal-list>
<literal value="auto"/>
<literal value="inherit"/>
</literal-list>
<regexp-list>
<regexp name="length"/>
<regexp name="percentage"/>
</regexp-list>
</property>
<property name="letter-spacing" default="normal" description="">
<category-list>
<category value="visual"/>
</category-list>
<literal-list>
<literal value="normal"/>
<literal value="inherit"/>
</literal-list>
<regexp-list>
<regexp name="length"/>
</regexp-list>
</property>
<property name="line-height" default="normal" description="">
<category-list>
<category value="visual"/>
</category-list>
<literal-list>
<literal value="normal"/>
<literal value="inherit"/>
</literal-list>
<regexp-list>
<regexp name="number"/>
<regexp name="length"/>
<regexp name="percentage"/>
</regexp-list>
</property>
<property name="list-style-image" default="none" description="">
<category-list>
<category value="visual"/>
</category-list>
<literal-list>
<literal value="none"/>
<literal value="inherit"/>
</literal-list>
<regexp-list>
<regexp name="cssOffsiteUri"/>
<regexp name="cssOnsiteUri"/>
</regexp-list>
</property>
<property name="list-style-position" default="outside" description="">
<category-list>
<category value="visual"/>
</category-list>
<literal-list>
<literal value="inside"/>
<literal value="outside"/>
<literal value="inherit"/>
</literal-list>
</property>
<property name="list-style-type" default="disc" description="">
<category-list>
<category value="visual"/>
</category-list>
<literal-list>
<literal value="disc"/>
<literal value="circle"/>
<literal value="square"/>
<literal value="decimal"/>
<literal value="decimal-leading-zero"/>
<literal value="lower-roman"/>
<literal value="upper-roman"/>
<literal value="lower-greek"/>
<literal value="lower-alpha"/>
<literal value="lower-latin"/>
<literal value="upper-alpha"/>
<literal value="upper-latin"/>
<literal value="hebrew"/>
<literal value="armenian"/>
<literal value="georgian"/>
<literal value="cjk-ideographic"/>
<literal value="hiragana"/>
<literal value="katakana"/>
<literal value="hiragana-iroha"/>
<literal value="katakana-iroha"/>
<literal value="none"/>
<literal value="inherit"/>
</literal-list>
</property>
<property name="marker-offset" default="auto" description="">
<category-list>
<category value="visual"/>
</category-list>
<literal-list>
<literal value="auto"/>
<literal value="inherit"/>
</literal-list>
<regexp-list>
<regexp name="length"/>
</regexp-list>
</property>
<property name="max-height" default="none" description="">
<category-list>
<category value="visual"/>
</category-list>
<literal-list>
<literal value="none"/>
<literal value="inherit"/>
</literal-list>
<regexp-list>
<regexp name="length"/>
<regexp name="percentage"/>
</regexp-list>
</property>
<property name="max-width" default="none" description="">
<category-list>
<category value="visual"/>
</category-list>
<literal-list>
<literal value="none"/>
<literal value="inherit"/>
</literal-list>
<regexp-list>
<regexp name="length"/>
<regexp name="percentage"/>
</regexp-list>
</property>
<property name="min-height" default="0" description="">
<category-list>
<category value="visual"/>
</category-list>
<literal-list>
<literal value="inherit"/>
</literal-list>
<regexp-list>
<regexp name="length"/>
<regexp name="percentage"/>
</regexp-list>
</property>
<property name="min-width" description="">
<category-list>
<category value="visual"/>
</category-list>
<literal-list>
<literal value="inherit"/>
</literal-list>
<regexp-list>
<regexp name="length"/>
<regexp name="percentage"/>
</regexp-list>
</property>
<property name="orphans" default="2" description="">
<category-list>
<category value="visual"/>
<category value="paged"/>
</category-list>
<literal-list>
<literal value="inherit"/>
</literal-list>
<regexp-list>
<regexp name="integer"/>
</regexp-list>
</property>
<property name="outline-color" default="invert" description="">
<category-list>
<category value="visual"/>
<category value="interactive"/>
</category-list>
<literal-list>
<literal value="invert"/>
<literal value="inherit"/>
</literal-list>
<regexp-list>
<regexp name="colorName"/>
<regexp name="colorCode"/>
<regexp name="rgbCode"/>
<regexp name="systemColor"/>
</regexp-list>
</property>
<property name="overflow" default="visible" description="">
<category-list>
<category value="visual"/>
</category-list>
<literal-list>
<literal value="visible"/>
<literal value="hidden"/>
<literal value="scroll"/>
<literal value="auto"/>
<literal value="inherit"/>
</literal-list>
</property>
<property name="page-break-after" default="auto" description="">
<category-list>
<category value="visual"/>
<category value="paged"/>
</category-list>
<literal-list>
<literal value="auto"/>
<literal value="always"/>
<literal value="avoid"/>
<literal value="left"/>
<literal value="right"/>
<literal value="inherit"/>
</literal-list>
</property>
<property name="page-break-before" default="auto" description="">
<category-list>
<category value="visual"/>
<category value="paged"/>
</category-list>
<literal-list>
<literal value="auto"/>
<literal value="always"/>
<literal value="avoid"/>
<literal value="left"/>
<literal value="right"/>
<literal value="inherit"/>
</literal-list>
</property>
<property name="page-break-inside" default="auto" description="">
<category-list>
<category value="visual"/>
<category value="paged"/>
</category-list>
<literal-list>
<literal value="avoid"/>
<literal value="auto"/>
<literal value="inherit"/>
</literal-list>
</property>
<property name="pause-after" description="">
<category-list>
<category value="aural"/>
</category-list>
<literal-list>
<literal value="inherit"/>
</literal-list>
<regexp-list>
<regexp name="time"/>
<regexp name="percentage"/>
</regexp-list>
</property>
<property name="pause-before" description="">
<category-list>
<category value="aural"/>
</category-list>
<literal-list>
<literal value="inherit"/>
</literal-list>
<regexp-list>
<regexp name="time"/>
<regexp name="percentage"/>
</regexp-list>
</property>
<property name="pitch" default="medium" description="">
<category-list>
<category value="aural"/>
</category-list>
<literal-list>
<literal value="x-low"/>
<literal value="low"/>
<literal value="medium"/>
<literal value="high"/>
<literal value="x-high"/>
<literal value="inherit"/>
</literal-list>
<regexp-list>
<regexp name="frequency"/>
</regexp-list>
</property>
<property name="pitch-range" default="50" description="">
<category-list>
<category value="aural"/>
</category-list>
<literal-list>
<literal value="inherit"/>
</literal-list>
<regexp-list>
<regexp name="number"/>
</regexp-list>
</property>
<property name="position" default="static" description="">
<category-list>
<category value="visual"/>
</category-list>
<literal-list>
<literal value="static"/>
<!-- possible to perform phishing attacks with the following -->
<!--
<literal value="relative"/>
<literal value="absolute"/>
<literal value="fixed"/>
-->
<literal value="inherit"/>
</literal-list>
</property>
<property name="richness" default="50" description="">
<category-list>
<category value="aural"/>
</category-list>
<literal-list>
<literal value="inherit"/>
</literal-list>
<regexp-list>
<regexp name="number"/>
</regexp-list>
</property>
<property name="right" default="auto" description="">
<category-list>
<category value="visual"/>
</category-list>
<literal-list>
<literal value="auto"/>
<literal value="inherit"/>
</literal-list>
<regexp-list>
<regexp name="length"/>
<regexp name="percentage"/>
</regexp-list>
</property>
<property name="size" default="auto" description="">
<category-list>
<category value="visual"/>
<category value="paged"/>
</category-list>
<literal-list>
<literal value="auto"/>
<literal value="portrait"/>
<literal value="landscape"/>
<literal value="inherit"/>
</literal-list>
<regexp-list>
<regexp name="length"/>
</regexp-list>
</property>
<property name="speak" default="normal" description="">
<category-list>
<category value="aural"/>
</category-list>
<literal-list>
<literal value="normal"/>
<literal value="none"/>
<literal value="spell-out"/>
<literal value="inherit"/>
</literal-list>
</property>
<property name="speak-header" default="once" description="">
<category-list>
<category value="aural"/>
</category-list>
<literal-list>
<literal value="once"/>
<literal value="always"/>
<literal value="inherit"/>
</literal-list>
</property>
<property name="speak-numeral" default="continuous" description="">
<category-list>
<category value="aural"/>
</category-list>
<literal-list>
<literal value="digits"/>
<literal value="continuous"/>
<literal value="inherit"/>
</literal-list>
</property>
<property name="speak-punctuation" default="none" description="">
<category-list>
<category value="aural"/>
</category-list>
<literal-list>
<literal value="code"/>
<literal value="none"/>
<literal value="inherit"/>
</literal-list>
</property>
<property name="speech-rate" default="medium" description="">
<category-list>
<category value="aural"/>
</category-list>
<literal-list>
<literal value="x-slow"/>
<literal value="slow"/>
<literal value="medium"/>
<literal value="fast"/>
<literal value="x-fast"/>
<literal value="faster"/>
<literal value="slower"/>
<literal value="inherit"/>
</literal-list>
<regexp-list>
<regexp name="number"/>
</regexp-list>
</property>
<property name="stress" default="50" description="">
<category-list>
<category value="aural"/>
</category-list>
<literal-list>
<literal value="inherit"/>
</literal-list>
<regexp-list>
<regexp name="number"/>
</regexp-list>
</property>
<property name="table-layout" default="auto" description="">
<category-list>
<category value="visual"/>
</category-list>
<literal-list>
<literal value="auto"/>
<literal value="fixed"/>
<literal value="inherit"/>
</literal-list>
</property>
<property name="text-indent" default="0" description="">
<category-list>
<category value="visual"/>
</category-list>
<literal-list>
<literal value="inherit"/>
</literal-list>
<regexp-list>
<regexp name="length"/>
<regexp name="percentage"/>
</regexp-list>
</property>
<property name="text-transform" default="none" description="">
<category-list>
<category value="visual"/>
</category-list>
<literal-list>
<literal value="capitalize"/>
<literal value="uppercase"/>
<literal value="lowercase"/>
<literal value="none"/>
<literal value="inherit"/>
</literal-list>
</property>
<property name="top" default="auto" description="">
<category-list>
<category value="visual"/>
</category-list>
<literal-list>
<literal value="auto"/>
<literal value="inherit"/>
</literal-list>
<regexp-list>
<regexp name="length"/>
<regexp name="percentage"/>
</regexp-list>
</property>
<property name="unicode-bidi" default="normal" description="">
<category-list>
<category value="visual"/>
</category-list>
<literal-list>
<literal value="normal"/>
<literal value="embed"/>
<literal value="bidi-override"/>
<literal value="inherit"/>
</literal-list>
</property>
<property name="vertical-align" default="baseline" description="">
<category-list>
<category value="visual"/>
</category-list>
<literal-list>
<literal value="baseline"/>
<literal value="sub"/>
<literal value="super"/>
<literal value="top"/>
<literal value="text-top"/>
<literal value="middle"/>
<literal value="bottom"/>
<literal value="text-bottom"/>
<literal value="inherit"/>
</literal-list>
<regexp-list>
<regexp name="percentage"/>
<regexp name="length"/>
</regexp-list>
</property>
<property name="visibility" default="inherit" description="">
<category-list>
<category value="visual"/>
</category-list>
<literal-list>
<literal value="visible"/>
<literal value="hidden"/>
<literal value="collapse"/>
<literal value="inherit"/>
</literal-list>
</property>
<property name="volume" default="medium" description="">
<category-list>
<category value="aural"/>
</category-list>
<literal-list>
<literal value="silent"/>
<literal value="x-soft"/>
<literal value="soft"/>
<literal value="medium"/>
<literal value="loud"/>
<literal value="x-loud"/>
<literal value="inherit"/>
</literal-list>
<regexp-list>
<regexp name="number"/>
<regexp name="percentage"/>
</regexp-list>
</property>
<property name="white-space" default="normal" description="">
<category-list>
<category value="visual"/>
</category-list>
<literal-list>
<literal value="normal"/>
<literal value="pre"/>
<literal value="nowrap"/>
<literal value="inherit"/>
</literal-list>
</property>
<property name="widows" default="2" description="">
<category-list>
<category value="visual"/>
<category value="paged"/>
</category-list>
<literal-list>
<literal value="inherit"/>
</literal-list>
<regexp-list>
<regexp name="integer"/>
</regexp-list>
</property>
<property name="width" default="auto" description="">
<category-list>
<category value="visual"/>
</category-list>
<literal-list>
<literal value="auto"/>
<literal value="inherit"/>
</literal-list>
<regexp-list>
<regexp name="length"/>
<regexp name="percentage"/>
</regexp-list>
</property>
<property name="word-spacing" default="normal" description="">
<category-list>
<category value="visual"/>
</category-list>
<literal-list>
<literal value="normal"/>
<literal value="inherit"/>
</literal-list>
<regexp-list>
<regexp name="length"/>
</regexp-list>
</property>
<!-- end simple properties -->
<!-- begin medium properties -->
<property name="border-style" description="">
<category-list>
<category value="visual"/>
</category-list>
<literal-list>
<literal value="inherit"/>
<literal value="none"/>
<literal value="hidden"/>
<literal value="dotted"/>
<literal value="dashed"/>
<literal value="solid"/>
<literal value="double"/>
<literal value="groove"/>
<literal value="ridge"/>
<literal value="inset"/>
<literal value="outset"/>
</literal-list>
</property>
<property name="border-top-style" default="none" description="">
<category-list>
<category value="visual"/>
</category-list>
<literal-list>
<literal value="inherit"/>
</literal-list>
</property>
<property name="border-right-style" default="none" description="">
<category-list>
<category value="visual"/>
</category-list>
<literal-list>
<literal value="inherit"/>
</literal-list>
<shorthand-list>
<shorthand name="border-style"/>
</shorthand-list>
</property>
<property name="border-bottom-style" default="none" description="">
<category-list>
<category value="visual"/>
</category-list>
<literal-list>
<literal value="inherit"/>
</literal-list>
<shorthand-list>
<shorthand name="border-style"/>
</shorthand-list>
</property>
<property name="border-left-style" default="none" description="">
<category-list>
<category value="visual"/>
</category-list>
<literal-list>
<literal value="inherit"/>
</literal-list>
<shorthand-list>
<shorthand name="border-style"/>
</shorthand-list>
</property>
<property name="border-top-width" default="medium" description="">
<category-list>
<category value="visual"/>
</category-list>
<literal-list>
<literal value="inherit"/>
</literal-list>
<shorthand-list>
<shorthand name="border-width"/>
</shorthand-list>
</property>
<property name="border-right-width" default="medium" description="">
<category-list>
<category value="visual"/>
</category-list>
<literal-list>
<literal value="inherit"/>
</literal-list>
<shorthand-list>
<shorthand name="border-width"/>
</shorthand-list>
</property>
<property name="border-bottom-width" default="medium" description="">
<category-list>
<category value="visual"/>
</category-list>
<literal-list>
<literal value="inherit"/>
</literal-list>
<shorthand-list>
<shorthand name="border-width"/>
</shorthand-list>
</property>
<property name="border-left-width" default="medium" description="">
<category-list>
<category value="visual"/>
</category-list>
<literal-list>
<literal value="inherit"/>
</literal-list>
<shorthand-list>
<shorthand name="border-width"/>
</shorthand-list>
</property>
<property name="border-width" description="">
<category-list>
<category value="visual"/>
</category-list>
<literal-list>
<literal value="inherit"/>
<literal value="thin"/>
<literal value="medium"/>
<literal value="thick"/>
</literal-list>
<regexp-list>
<regexp name="length"/>
</regexp-list>
</property>
<property name="margin" description="">
<category-list>
<category value="visual"/>
</category-list>
<literal-list>
<literal value="inherit"/>
<literal value="auto"/>
</literal-list>
<regexp-list>
<regexp name="positiveLength"/>
<regexp name="positivePercentage"/>
</regexp-list>
</property>
<property name="margin-top" default="0" description="">
<category-list>
<category value="visual"/>
</category-list>
<literal-list>
<literal value="inherit"/>
</literal-list>
<shorthand-list>
<shorthand name="margin"/>
</shorthand-list>
</property>
<property name="margin-right" default="0" description="">
<category-list>
<category value="visual"/>
</category-list>
<literal-list>
<literal value="inherit"/>
</literal-list>
<shorthand-list>
<shorthand name="margin"/>
</shorthand-list>
</property>
<property name="margin-bottom" default="0" description="">
<category-list>
<category value="visual"/>
</category-list>
<literal-list>
<literal value="inherit"/>
</literal-list>
<shorthand-list>
<shorthand name="margin"/>
</shorthand-list>
</property>
<property name="margin-left" default="0" description="">
<category-list>
<category value="visual"/>
</category-list>
<literal-list>
<literal value="inherit"/>
</literal-list>
<shorthand-list>
<shorthand name="margin"/>
</shorthand-list>
</property>
<property name="outline-style" default="none" description="">
<category-list>
<category value="visual"/>
<category value="interactive"/>
</category-list>
<literal-list>
<literal value="inherit"/>
</literal-list>
<shorthand-list>
<shorthand name="border-style"/>
</shorthand-list>
</property>
<property name="outline-width" default="medium" description="">
<category-list>
<category value="visual"/>
<category value="interactive"/>
</category-list>
<literal-list>
<literal value="inherit"/>
</literal-list>
<shorthand-list>
<shorthand name="border-width"/>
</shorthand-list>
</property>
<property name="padding" description="">
<category-list>
<category value="visual"/>
</category-list>
<literal-list>
<literal value="inherit"/>
</literal-list>
<regexp-list>
<regexp name="length"/>
<regexp name="percentage"/>
</regexp-list>
</property>
<property name="padding-top" default="0" description="">
<category-list>
<category value="visual"/>
</category-list>
<literal-list>
<literal value="inherit"/>
</literal-list>
<shorthand-list>
<shorthand name="padding"/>
</shorthand-list>
</property>
<property name="padding-right" default="0" description="">
<category-list>
<category value="visual"/>
</category-list>
<literal-list>
<literal value="inherit"/>
</literal-list>
<shorthand-list>
<shorthand name="padding"/>
</shorthand-list>
</property>
<property name="padding-bottom" default="0" description="">
<category-list>
<category value="visual"/>
</category-list>
<literal-list>
<literal value="inherit"/>
</literal-list>
<shorthand-list>
<shorthand name="padding"/>
</shorthand-list>
</property>
<property name="padding-left" default="0" description="">
<category-list>
<category value="visual"/>
</category-list>
<literal-list>
<literal value="inherit"/>
</literal-list>
<shorthand-list>
<shorthand name="padding"/>
</shorthand-list>
</property>
<!-- end medium properties -->
<!-- begin hard properties -->
<property name="border" description="">
<category-list>
<category value="visual"/>
</category-list>
<literal-list>
<literal value="inherit"/>
</literal-list>
<regexp-list>
<regexp name="colorName"/>
<regexp name="colorCode"/>
<regexp name="rgbCode"/>
<regexp name="systemColor"/>
</regexp-list>
<shorthand-list>
<shorthand name="border-width"/>
<shorthand name="border-style"/>
</shorthand-list>
</property>
<property name="border-top" description="">
<category-list>
<category value="visual"/>
</category-list>
<literal-list>
<literal value="inherit"/>
</literal-list>
<regexp-list>
<regexp name="colorName"/>
<regexp name="colorCode"/>
<regexp name="rgbCode"/>
<regexp name="systemColor"/>
</regexp-list>
<shorthand-list>
<shorthand name="border-top-width"/>
<shorthand name="border-style"/>
</shorthand-list>
</property>
<property name="border-right" description="">
<category-list>
<category value="visual"/>
</category-list>
<literal-list>
<literal value="inherit"/>
</literal-list>
<regexp-list>
<regexp name="colorName"/>
<regexp name="colorCode"/>
<regexp name="rgbCode"/>
<regexp name="systemColor"/>
</regexp-list>
<shorthand-list>
<shorthand name="border-top-width"/>
<shorthand name="border-style"/>
</shorthand-list>
</property>
<property name="border-bottom" description="">
<category-list>
<category value="visual"/>
</category-list>
<literal-list>
<literal value="inherit"/>
</literal-list>
<regexp-list>
<regexp name="colorName"/>
<regexp name="colorCode"/>
<regexp name="rgbCode"/>
<regexp name="systemColor"/>
</regexp-list>
<shorthand-list>
<shorthand name="border-top-width"/>
<shorthand name="border-style"/>
</shorthand-list>
</property>
<property name="border-left" description="">
<category-list>
<category value="visual"/>
</category-list>
<literal-list>
<literal value="inherit"/>
</literal-list>
<regexp-list>
<regexp name="colorName"/>
<regexp name="colorCode"/>
<regexp name="rgbCode"/>
<regexp name="systemColor"/>
</regexp-list>
<shorthand-list>
<shorthand name="border-top-width"/>
<shorthand name="border-style"/>
</shorthand-list>
</property>
<property name="cue" description="">
<category-list>
<category value="aural"/>
</category-list>
<literal-list>
<literal value="inherit"/>
</literal-list>
<shorthand-list>
<shorthand name="cue-before"/>
<shorthand name="cue-after"/>
</shorthand-list>
</property>
<property name="list-style" description="">
<category-list>
<category value="visual"/>
</category-list>
<literal-list>
<literal value="inherit"/>
</literal-list>
<shorthand-list>
<shorthand name="list-style-type"/>
<shorthand name="list-style-position"/>
<shorthand name="list-style-image"/>
</shorthand-list>
</property>
<property name="marks" default="none" description="">
<category-list>
<category value="visual"/>
<category value="paged"/>
</category-list>
<literal-list>
<literal value="crop"/>
<literal value="cross"/>
<literal value="none"/>
<literal value="inherit"/>
</literal-list>
</property>
<property name="outline" description="">
<category-list>
<category value="visual"/>
<category value="interactive"/>
</category-list>
<literal-list>
<literal value="inherit"/>
</literal-list>
<shorthand-list>
<shorthand name="outline-color"/>
<shorthand name="outline-style"/>
<shorthand name="outline-width"/>
</shorthand-list>
</property>
<property name="pause" description="">
<category-list>
<category value="aural"/>
</category-list>
<literal-list>
<literal value="inherit"/>
</literal-list>
<regexp-list>
<regexp name="time"/>
<regexp name="percentage"/>
</regexp-list>
</property>
<property name="text-decoration" default="none" description="">
<category-list>
<category value="visual"/>
</category-list>
<literal-list>
<literal value="none"/>
<literal value="underline"/>
<literal value="overline"/>
<literal value="line-through"/>
<literal value="blink"/>
<literal value="inherit"/>
</literal-list>
</property>
<!-- end hard properties -->
<!-- begin manual properties -->
<property name="border-spacing" default="0"
description="The lengths specify the distance that separates adjacent cell borders. If one length is specified, it gives both the horizontal and vertical spacing. If two are specified, the first gives the horizontal spacing and the second the vertical spacing. Lengths may not be negative.">
<category-list>
<category value="visual"/>
</category-list>
<literal-list>
<literal value="inherit"/>
</literal-list>
<regexp-list>
<regexp name="length"/>
</regexp-list>
</property>
<property name="clip" default="auto"
description="The 'clip' property applies to elements that have a 'overflow' property with a value other than 'visible'.">
<category-list>
<category value="visual"/>
</category-list>
<literal-list>
<literal value="auto"/>
<literal value="inherit"/>
</literal-list>
<regexp-list>
<regexp name="length"/>
</regexp-list>
</property>
<property name="counter-increment" default="none"
description="The 'counter-increment' property accepts one or more names of counters (identifiers), each one optionally followed by an integer.">
<category-list>
<category value="all"/>
</category-list>
<literal-list>
<literal value="none"/>
<literal value="inherit"/>
</literal-list>
<regexp-list>
<regexp name="cssIdentifier"/>
<regexp name="integer"/>
</regexp-list>
</property>
<property name="cursor" default="auto"
description="This property specifies the type of cursor to be displayed for the pointing device.">
<category-list>
<category value="visual"/>
<category value="interactive"/>
</category-list>
<literal-list>
<literal value="auto"/>
<literal value="inherit"/>
<literal value="crosshair"/>
<literal value="default"/>
<literal value="pointer"/>
<literal value="move"/>
<literal value="e-resize"/>
<literal value="ne-resize"/>
<literal value="nw-resize"/>
<literal value="n-resize"/>
<literal value="se-resize"/>
<literal value="sw-resize"/>
<literal value="s-resize"/>
<literal value="w-resize| text"/>
<literal value="wait"/>
<literal value="help"/>
</literal-list>
<regexp-list>
<regexp name="cssOffsiteUri"/>
<regexp name="cssOnsiteUri"/>
</regexp-list>
</property>
<property name="text-shadow" default="none"
description="This property accepts a comma-separated list of shadow effects to be applied to the text of the element.">
<category-list>
<category value="visual"/>
</category-list>
<literal-list>
<literal value="none"/>
<literal value="inherit"/>
</literal-list>
<regexp-list>
<regexp name="colorName"/>
<regexp name="colorCode"/>
<regexp name="rgbCode"/>
<regexp name="systemColor"/>
<regexp name="length"/>
</regexp-list>
</property>
<property name="font"
description="The 'font' property is, except as described below, a shorthand property for setting 'font-style', 'font-variant', 'font-weight', 'font-size', 'line-height', and 'font-family', at the same place in the style sheet.">
<category-list>
<category value="visual"/>
</category-list>
<literal-list>
<literal value="/"/>
<literal value="caption"/>
<literal value="icon"/>
<literal value="menu"/>
<literal value="message-box"/>
<literal value="small-caption"/>
<literal value="status-bar"/>
<literal value="inherit"/>
</literal-list>
<shorthand-list>
<shorthand name="font-style"/>
<shorthand name="font-variant"/>
<shorthand name="font-weight"/>
<shorthand name="font-size"/>
<shorthand name="line-height"/>
<shorthand name="font-family"/>
</shorthand-list>
</property>
<property name="font-family"
description="This property specifies a prioritized list of font family names and/or generic family names.">
<category-list>
<category value="visual"/>
</category-list>
<!-- allowing only generic font families -->
<literal-list>
<literal value="serif"/>
<literal value="arial"/>
<literal value="lucida console"/>
<literal value="sans-serif"/>
<literal value="cursive"/>
<literal value="verdana"/>
<literal value="fantasy"/>
<literal value="monospace"/>
</literal-list>
<regexp-list>
<regexp value="[\w,\-&apos;&quot; ]+"/>
</regexp-list>
</property>
<property name="page"
description="The 'page' property can be used to specify a particular type of page where an element should be displayed.">
<category-list>
<category value="visual"/>
<category value="paged"/>
</category-list>
<literal-list>
<literal value="auto"/>
</literal-list>
<regexp-list>
<regexp name="cssIdentifier"/>
</regexp-list>
</property>
<property name="play-during" default="auto"
description="Similar to the 'cue-before' and 'cue-after' properties, this property specifies a sound to be played as a background while an element's content is spoken.">
<category-list>
<category value="aural"/>
</category-list>
<literal-list>
<literal value="mix"/>
<literal value="repeat"/>
<literal value="none"/>
<literal value="auto"/>
<literal value="inherit"/>
</literal-list>
<regexp-list>
<regexp name="cssOffsiteUri"/>
<regexp name="cssOnsiteUri"/>
</regexp-list>
</property>
<property name="text-align" description="This property describes how inline content of a block is aligned.">
<category-list>
<category value="visual"/>
</category-list>
<!-- For safety, ignoring string alignment which can be used to line table cells on characters -->
<literal-list>
<literal value="left"/>
<literal value="right"/>
<literal value="center"/>
<literal value="justify"/>
<literal value="inherit"/>
</literal-list>
</property>
<property name="voice-family"
description="The value is a comma-separated, prioritized list of voice family names (compare with 'font-family').">
<category-list>
<category value="aural"/>
</category-list>
<!-- Allowing only generic voice family -->
<literal-list>
<literal value="male"/>
<literal value="female"/>
<literal value="child"/>
<literal value="inherit"/>
</literal-list>
</property>
<!-- end manual properties -->
</css-rules>
<allowed-empty-tags>
<literal-list>
<literal value="br"/>
<literal value="hr"/>
<literal value="a"/>
<literal value="img"/>
<literal value="link"/>
<literal value="iframe"/>
<literal value="script"/>
<literal value="object"/>
<literal value="applet"/>
<literal value="frame"/>
<literal value="base"/>
<literal value="param"/>
<literal value="meta"/>
<literal value="input"/>
<literal value="textarea"/>
<literal value="embed"/>
<literal value="basefont"/>
<literal value="col"/>
<literal value="div"/>
</literal-list>
</allowed-empty-tags>
</anti-samy-rules>
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!--
W3C rules retrieved from:
http://www.w3.org/TR/html401/struct/global.html
-->
<anti-samy-rules xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="antisamy.xsd">
<directives>
<directive name="omitXmlDeclaration" value="true"/>
<directive name="omitDoctypeDeclaration" value="true"/>
<directive name="maxInputSize" value="0"/>
<directive name="useXHTML" value="true"/>
<directive name="formatOutput" value="false"/>
<!--
remember, this won't work for relative URIs - AntiSamy doesn't
know anything about the URL or your web structure
-->
<directive name="embedStyleSheets" value="false"/>
</directives>
<common-regexps>
</common-regexps>
<!--
Tag.name = a, b, div, body, etc.
Tag.action = filter: remove tags, but keep content, validate: keep content as long as it passes rules, remove: remove tag and contents
Attribute.name = id, class, href, align, width, etc.
Attribute.onInvalid = what to do when the attribute is invalid, e.g., remove the tag (removeTag), remove the attribute (removeAttribute), filter the tag (filterTag)
Attribute.description = What rules in English you want to tell the users they can have for this attribute. Include helpful things so they'll be able to tune their HTML
-->
<!--
Some attributes are common to all (or most) HTML tags. There aren't many that qualify for this. You have to make sure there's no
collisions between any of these attribute names with attribute names of other tags that are for different purposes.
-->
<common-attributes>
</common-attributes>
<!--
This requires normal updates as browsers continue to diverge from the W3C and each other. As long as the browser wars continue
this is going to continue. I'm not sure war is the right word for what's going on. Doesn't somebody have to win a war after
a while? Even wars of attrition, surely?
-->
<global-tag-attributes>
</global-tag-attributes>
<tags-to-encode>
</tags-to-encode>
<tag-rules>
</tag-rules>
<!-- CSS validation processing rules -->
<css-rules>
<!-- end manual properties -->
</css-rules>
<allowed-empty-tags>
</allowed-empty-tags>
</anti-samy-rules>
# 应用服务器
server:
tomcat:
uri-encoding: UTF-8 #tomcat编码
port: 8999 #tomcat端口
#===================== 数据源配置 =====================
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
username: ${MYSQL_USER:root} #junmp
password: ${MYSQL_PWD:root} #123456
url: jdbc:mysql://${MYSQL_HOST:127.0.0.1}:${MYSQL_PORT:3306}/${MYSQL_DB:jyzb03}?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&allowPublicKeyRetrieval=true&queryTimeout=2400&nullCatalogMeansCurrent=true
#===================== Redis配置 =====================
redis:
database: 1 #缓存库编号
host: 127.0.0.1
port: 6379
password:
timeout: 3000 #超时时间(单位:秒)
lettuce: #Lettuce为Redis的Java驱动包
pool:
max-active: 8 # 连接池最大连接数
max-wait: -1ms # 连接池最大阻塞等待时间(使用负值表示没有限制)
min-idle: 0 # 连接池中的最小空闲连接
max-idle: 8 # 连接池中的最大空闲连接
mail:
host: smtp.qq.com #邮件服务器的host
password: sb #邮件服务器的发件人密码
username: 6666@qq.com #邮件服务器的发件人
port: 25 #smtp默认端口
protocol: smtp #使用smtp协议
default-encoding: UTF-8 #邮件使用的字符集
properties:
mail:
debug: true #启调试模式(发送邮件的细节都能看出来) 默认值为fasle
debug.auth: true
smtp:
auth: true #如果为true ,则尝试使用auth命令对用户进行身份验证 默认为false
connectiontimeout: 20000 #套接字连接超时值(毫秒)。默认值为无限超时。
sendpartial: true #如果为true 并且邮件有一些有效和无效的地址 并使用SendFailException 报告部分失败, 如果设置为false(默认值) 如果存在无效的收件人地址, 则不会将邮件发送给任何收件人
starttls:
#如果为true,则在发出任何登录命令之前,启用starttl命令(如果服务器支持) 将连接切换到受TLS保护的连接,请注意,必须配置适当的信任存储,以便客户端信任服务器的证书,默认为false
enable: true
# 如果为true,则需要使用 starttl命令,如果服务器不支持此命令,或者该命令失败,connect()将失败,默认为false 如果此设置为true james邮件服务器会报错 STARTTLS is required but host does not support STARTTLS
required: false
timeout: 20000 #I/O超时值(ms) 默认为无限超时
userset: true #如果设置为true,则在isConnected()中使用RSET命令而不是NOOP命令 在某些情况下,sendmail在执行许多NOOP命令后响应缓存,使用RSET可以避免这个sendMail问题,默认为false
flowable:
dmn:
enabled: false
cmmn:
enabled: false
idm:
enabled: false
async-history-executor-activate: false
async-executor-activate: false
check-process-definitions: false
content:
enabled: false
app:
enabled: false
eventregistry:
enabled: false
config:
minio:
endpoint: http://192.168.0.147:9000/ #服务端地址
accessKey: admin #账号
secretKey: test. #密码
fileHost: http://192.168.0.147:9000/ #地址
spring: #环境 dev|test|pro|preview
profiles:
active: dev
servlet:
multipart: #文件传输配置
max-file-size: 100MB #单个数据大小限制
max-request-size: 100MB #请求总数据大小限制
enabled: true #是否启用分段上传支持
mvc:
hiddenmethod: #隐式方法过滤器
filter:
enabled: true #默认关闭。开启以支持:PUT,DELETE表单提交方法
jackson: #序列化和反序列化json框架
serialization:
write-dates-as-timestamps: true #是否写入日期时间时间戳格式
time-zone: GMT+8 #指定日期格式化时区
main:
allow-bean-definition-overriding: true #允许同名bean后者覆盖,默认:true
allow-circular-references: true #允许Bean相互引用,默认:false
server:
error:
whitelabel:
enabled: false
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<!--日志格式应用spring boot默认的格式,也可以自己更改-->
<include resource="org/springframework/boot/logging/logback/defaults.xml"/>
<!--定义日志存放的位置,默认存放在项目启动的相对路径的目录-->
<springProperty scope="context" name="LOG_PATH" source="log.path" defaultValue="log/systemLog"/>
<!-- ****************************************************************************************** -->
<!-- ****************************** 本地开发只在控制台打印日志 ************************************ -->
<!-- ****************************************************************************************** -->
<springProfile name="dev">
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
<charset>utf-8</charset>
</encoder>
</appender>
<!--默认所有的包以info-->
<root level="info">
<appender-ref ref="STDOUT"/>
</root>
<!--各个服务的包在本地执行的时候,打开debug模式-->
<logger name="com" level="debug" additivity="false">
<appender-ref ref="STDOUT"/>
</logger>
</springProfile>
<!-- ********************************************************************************************** -->
<!-- **** 放到服务器上不管在什么环境都只在文件记录日志,控制台(catalina.out)打印logback捕获不到的日志 **** -->
<!-- ********************************************************************************************** -->
<springProfile name="test,pro,me,preview">
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
<charset>utf-8</charset>
</encoder>
</appender>
<!-- 日志记录器,日期滚动记录,level为 ERROR 日志 -->
<appender name="FILE_ERROR" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- 正在记录的日志文件的路径及文件名 -->
<file>${LOG_PATH}/log_error.log</file>
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 归档的日志文件的路径,%d{yyyy-MM-dd}指定日期格式,%i指定索引 -->
<fileNamePattern>${LOG_PATH}/error/%d{yyyy-MM-dd,aux}/log-error-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<!--日志最大的历史7天-->
<maxHistory>7</maxHistory>
<!-- 除按日志记录之外,还配置了日志文件不能超过2M,若超过2M,日志文件会以索引0开始,
命名日志文件,例如log-error-2013-12-21.0.log -->
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>10MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<!-- 追加方式记录日志 -->
<append>true</append>
<!-- 日志文件的格式 -->
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${FILE_LOG_PATTERN}</pattern>
<charset>utf-8</charset>
</encoder>
<!-- 此日志文件只记录error级别的 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>error</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 日志记录器,日期滚动记录,level为 INFO 日志 -->
<appender name="FILE_INFO" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- 正在记录的日志文件的路径及文件名 -->
<file>${LOG_PATH}/log_info.log</file>
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 归档的日志文件的路径,%d{yyyy-MM-dd}指定日期格式,%i指定索引 -->
<fileNamePattern>${LOG_PATH}/info/%d{yyyy-MM-dd,aux}/log-info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<!--日志最大的历史7天-->
<maxHistory>7</maxHistory>
<!-- 除按日志记录之外,还配置了日志文件不能超过2M,若超过2M,日志文件会以索引0开始,
命名日志文件,例如log-error-2013-12-21.0.log -->
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>10MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<!-- 追加方式记录日志 -->
<append>true</append>
<!-- 日志文件的格式 -->
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${FILE_LOG_PATTERN}</pattern>
<charset>utf-8</charset>
</encoder>
<!-- 此日志文件只记录info级别的 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>info</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 日志记录器,日期滚动记录,level为 WARN 日志 -->
<appender name="FILE_WARN" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- 正在记录的日志文件的路径及文件名 -->
<file>${LOG_PATH}/log_warn.log</file>
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 归档的日志文件的路径,%d{yyyy-MM-dd}指定日期格式,%i指定索引 -->
<fileNamePattern>${LOG_PATH}/warn/%d{yyyy-MM-dd,aux}/log-warn-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<!--日志最大的历史7天-->
<maxHistory>7</maxHistory>
<!-- 除按日志记录之外,还配置了日志文件不能超过2M,若超过2M,日志文件会以索引0开始,
命名日志文件,例如log-error-2013-12-21.0.log -->
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>10MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<!-- 追加方式记录日志 -->
<append>true</append>
<!-- 日志文件的格式 -->
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${FILE_LOG_PATTERN}</pattern>
<charset>utf-8</charset>
</encoder>
<!-- 此日志文件只记录warn级别的 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>warn</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 日志记录器,日期滚动记录,level为 DEBUG 日志 -->
<appender name="FILE_DEBUG" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- 正在记录的日志文件的路径及文件名 -->
<file>${LOG_PATH}/log_debug.log</file>
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 归档的日志文件的路径,%d{yyyy-MM-dd}指定日期格式,%i指定索引 -->
<fileNamePattern>${LOG_PATH}/debug/%d{yyyy-MM-dd,aux}/log-debug-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<!--日志最大的历史7天-->
<maxHistory>7</maxHistory>
<!-- 除按日志记录之外,还配置了日志文件不能超过2M,若超过2M,日志文件会以索引0开始,
命名日志文件,例如log-error-2013-12-21.0.log -->
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>10MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<!-- 追加方式记录日志 -->
<append>true</append>
<!-- 日志文件的格式 -->
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${FILE_LOG_PATTERN}</pattern>
<charset>utf-8</charset>
</encoder>
<!-- 此日志文件只记录debug级别的 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>debug</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 日志记录器,日期滚动记录,level为 ALL 日志 -->
<appender name="FILE_ALL" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- 正在记录的日志文件的路径及文件名 -->
<file>${LOG_PATH}/log_total.log</file>
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 归档的日志文件的路径,%d{yyyy-MM-dd}指定日期格式,%i指定索引 -->
<fileNamePattern>${LOG_PATH}/total/%d{yyyy-MM-dd,aux}/log-total-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<!--日志最大的历史7天-->
<maxHistory>7</maxHistory>
<!-- 除按日志记录之外,还配置了日志文件不能超过2M,若超过2M,日志文件会以索引0开始,
命名日志文件,例如log-error-2013-12-21.0.log -->
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>10MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<!-- 追加方式记录日志 -->
<append>true</append>
<!-- 日志文件的格式 -->
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${FILE_LOG_PATTERN}</pattern>
<charset>utf-8</charset>
</encoder>
</appender>
<!--记录到文件时-->
<root level="info">
<appender-ref ref="STDOUT"/>
<appender-ref ref="FILE_ERROR"/>
<appender-ref ref="FILE_INFO"/>
<appender-ref ref="FILE_WARN"/>
<appender-ref ref="FILE_DEBUG"/>
<appender-ref ref="FILE_ALL"/>
</root>
</springProfile>
</configuration>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.junmp.junmpProcess.mapper.OrgUserMapper">
<resultMap id="UserListDTO" type="com.junmp.junmpProcess.dto.UserListDTO">
<!--@mbg.generated-->
<!--@Table base_cabinet-->
<result column="user_id" jdbcType="VARCHAR" property="userID" />
<result column="real_name" jdbcType="VARCHAR" property="realName" />
</resultMap>
<select id="QueryUserByRoleId" resultMap="UserListDTO">
SELECT su.user_id,su.real_name FROM `sys_role` sr join sys_user_role sur on sr.role_id=sur.role_id JOIN sys_user su on sur.user_id=su.user_id
where sr.role_id in ${roleId}
GROUP BY su.user_id,su.real_name
</select>
<select id="QueryUserByRoleIdAndOrg" resultMap="UserListDTO">
SELECT su.user_id,su.real_name FROM `sys_role` sr join sys_user_role sur on sr.role_id=sur.role_id JOIN sys_user su on sur.user_id=su.user_id
join sys_user_org suo on suo.user_id=su.user_id join pub_org po on po.org_id=suo.org_id
where sr.role_id in ${roleId} and po.org_id in ${orgId}
GROUP BY su.user_id,su.real_name
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.junmp.jyzb</groupId>
<artifactId>junmp-jyzb-app</artifactId>
<version>1.0.0</version>
<name>junmp-jyzb-app</name>
<packaging>pom</packaging>
<description>警用装备平台</description>
<modules>
<module>jyzb-api</module>
<module>jyzb-boot</module>
<module>jyzb-biz</module>
<module>jyzb-process</module>
<module>jyzb-common</module>
</modules>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.4</version>
</parent>
<repositories>
<repository>
<id>junmp-public</id>
<name>junmp-public</name>
<url>http://maven.sothing.top/repository/junmp-public/</url>
</repository>
<repository>
<id>aliyun</id>
<name>aliyun</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
</repository>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/libs-milestone</url>
</repository>
<repository>
<id>oss</id>
<name>oss</name>
<url>https://oss.sonatype.org/content/groups/public</url>
</repository>
</repositories>
<distributionManagement>
<repository>
<id>junmp-release</id>
<name>junmp-release</name>
<url>http://maven.sothing.top/repository/junmp-release/</url>
</repository>
</distributionManagement>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<spring-boot-maven-plugin.version>2.5.0</spring-boot-maven-plugin.version>
<java.version>1.8</java.version>
<mysql-connector-java.version>8.0.21</mysql-connector-java.version>
<mybatis-plus-boot-starter>3.5.1</mybatis-plus-boot-starter>
<junmp.v2.version>1.0.0</junmp.v2.version>
<spring.ds.version>3.5.1</spring.ds.version>
<poi.version>3.14</poi.version>
<itext.version>5.2.0</itext.version>
<itextpdf.version>5.2.0</itextpdf.version>
<common.codec.version>1.14</common.codec.version>
<netty.version>4.1.73.Final</netty.version>
<slf4j.version>1.7.36</slf4j.version>
<swagger2.version>1.5.22</swagger2.version>
<p6spy.version>3.9.1</p6spy.version>
<fastjson.version>1.2.83</fastjson.version>
<lombok.version>1.18.20</lombok.version>
<hutool.version>5.6.3</hutool.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>${hutool.version}</version>
</dependency>
<dependency>
<groupId>p6spy</groupId>
<artifactId>p6spy</artifactId>
<version>${p6spy.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql-connector-java.version}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
</dependency>
<dependency>
<groupId>com.junmp.v2</groupId>
<artifactId>v2-config-api</artifactId>
<version>${junmp.v2.version}</version>
</dependency>
<dependency>
<groupId>com.junmp.v2</groupId>
<artifactId>v2-config-boot-starter</artifactId>
<version>${junmp.v2.version}</version>
</dependency>
<dependency>
<groupId>com.junmp.v2</groupId>
<artifactId>v2-db-boot-starter</artifactId>
<version>${junmp.v2.version}</version>
</dependency>
<dependency>
<groupId>com.junmp.v2</groupId>
<artifactId>v2-log-boot-starter</artifactId>
<version>${junmp.v2.version}</version>
</dependency>
<!-- &lt;!&ndash;引入rabbitmq的相关依赖&ndash;&gt;-->
<!-- <dependency>-->
<!-- <groupId>com.rabbitmq</groupId>-->
<!-- <artifactId>amqp-client</artifactId>-->
<!-- <version>5.7.2</version>-->
<!-- </dependency>-->
<dependency>
<groupId>com.junmp.v2</groupId>
<artifactId>auth-boot-starter</artifactId>
<version>${junmp.v2.version}</version>
</dependency>
<dependency>
<groupId>com.junmp.v2</groupId>
<artifactId>v2-redis-boot-starter</artifactId>
<version>${junmp.v2.version}</version>
</dependency>
<dependency>
<groupId>com.junmp.v2</groupId>
<artifactId>swagger2-api</artifactId>
<version>${junmp.v2.version}</version>
</dependency>
<dependency>
<groupId>com.junmp.v2</groupId>
<artifactId>swagger2-boot-starter</artifactId>
<version>${junmp.v2.version}</version>
</dependency>
<dependency>
<groupId>com.junmp.v2</groupId>
<artifactId>v2-db-api</artifactId>
<version>${junmp.v2.version}</version>
</dependency>
<dependency>
<groupId>com.junmp.v2</groupId>
<artifactId>junmp-v2-common</artifactId>
<version>${junmp.v2.version}</version>
</dependency>
<dependency>
<groupId>com.junmp.v2</groupId>
<artifactId>validator-boot-starter</artifactId>
<version>${junmp.v2.version}</version>
</dependency>
<dependency>
<groupId>com.junmp.v2</groupId>
<artifactId>file-boot-starter</artifactId>
<version>${junmp.v2.version}</version>
</dependency>
<dependency>
<groupId>com.junmp.v2</groupId>
<artifactId>v2-validator-api</artifactId>
<version>${junmp.v2.version}</version>
</dependency>
<dependency>
<groupId>com.junmp.v2</groupId>
<artifactId>v2-security-boot-starter</artifactId>
<version>${junmp.v2.version}</version>
</dependency>
<dependency>
<groupId>com.junmp.v2</groupId>
<artifactId>system-boot-starter</artifactId>
<version>${junmp.v2.version}</version>
</dependency>
<dependency>
<groupId>com.junmp.v2</groupId>
<artifactId>v2-log-api</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.junmp.v2</groupId>
<artifactId>v2-job-api</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.junmp.v2</groupId>
<artifactId>job-boot-starter</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.junmp.v2</groupId>
<artifactId>auth-sdk</artifactId>
<version>${junmp.v2.version}</version>
</dependency>
<dependency>
<groupId>com.junmp.jyzb</groupId>
<artifactId>jyzb-api</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.junmp.jyzb</groupId>
<artifactId>jyzb-biz</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.junmp.jyzb</groupId>
<artifactId>jyzb-process</artifactId>
<version>1.0.0</version>
</dependency>
<!-- JSON 解析器和生成器 -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>${fastjson.version}</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>javax.servlet</groupId>-->
<!-- <artifactId>javax.servlet-api</artifactId>-->
<!-- </dependency>-->
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
</dependency>
<!--swagger-->
<!-- <dependency>-->
<!-- <groupId>io.springfox</groupId>-->
<!-- <artifactId>springfox-swagger-ui</artifactId>-->
<!-- <version>2.9.2</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>io.springfox</groupId>-->
<!-- <artifactId>springfox-swagger2</artifactId>-->
<!-- <version>2.9.2</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>io.swagger</groupId>-->
<!-- <artifactId>swagger-annotations</artifactId>-->
<!-- <version>${swagger2.version}</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>io.swagger</groupId>-->
<!-- <artifactId>swagger-models</artifactId>-->
<!-- <version>1.5.22</version>-->
<!-- </dependency>-->
<!--swagger新ui界面-->
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-spring-boot-starter</artifactId>
<version>3.0.3</version>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<finalName>jyzb-app</finalName>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring-boot-maven-plugin.version}</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<encoding>utf-8</encoding>
<useDefaultDelimiters>true</useDefaultDelimiters>
<nonFilteredFileExtensions>
<nonFilteredFileExtension>woff</nonFilteredFileExtension>
<nonFilteredFileExtension>woff2</nonFilteredFileExtension>
<nonFilteredFileExtension>eot</nonFilteredFileExtension>
<nonFilteredFileExtension>ttf</nonFilteredFileExtension>
<nonFilteredFileExtension>svg</nonFilteredFileExtension>
</nonFilteredFileExtensions>
</configuration>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
</resources>
</build>
<profiles>
<profile>
<id>local</id>
<properties>
<spring.active>local</spring.active>
</properties>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
<profile>
<id>dev</id>
<properties>
<spring.active>dev</spring.active>
<flowable.version>6.7.2</flowable.version>
</properties>
</profile>
<profile>
<id>prod</id>
<properties>
<spring.active>prod</spring.active>
</properties>
</profile>
</profiles>
</project>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论