提交 5a358fd7 编写于 作者: xignzi006's avatar xignzi006

init

上级 15efb948
javaee
\ No newline at end of file
# **iBiz4j Spring R7 Template ChangeLog**
## [v2021.01.05]
- 修复:mybatis游标异常
- 修复:liquibase内网环境启动错误
- 修复:save带id时保存时,无法填充createDate的问题
- 修复:service中ProxyService无法注入子服务对象
- 优化:实体数据同步(RocketMQ)消息发送与接收逻辑
- 优化:logback 日志文件到达上限后重新生成新日志文件
- 优化:补充 docker 故障重启次数
- 优化:资源同步服务(PermissionSyncJob)逻辑优化
- 优化:服务接口补充空的返回值类型
- 优化:服务接口补充实体行为批处理,用于界面行为多项数据
## [v2020.12.13]
- 支持工作流操作视图、操作表单配置
- 支持实体数据同步(RocketMQ)
- 支持工作流流程中状态值配置
- 支持父关系等价
- 支持属性值规则
- 支持界面行为多项数据主键
- 支持token续期
- 优化:补充接口实体服务接口鉴权
- 优化:动态数据源数据连接配置优化
- 优化:数据查询支持请求方式配置(默认为get,如:改为post)
- 优化:实体搜索项是否为空配置(搭配是否逻辑代码表使用)
- 优化:微服务部署中支持配置portmap将容器端口映射到主机端口(用于定时服务回调)
- 修复:服务接口返回状态码 response code
- 修复:实体行为、逻辑支持行为所有者配置
## [v2020.11.09]
- 支持属性重复值检查
- 支持引用组件包配置
- 支持定时任务中调用实体行为
- 修复serviceApi实体update脏检查处理
- 添加全局异常处理,数据库级异常补充errorKey
- 补充appData user扩展
- 系统预定义代码表推送RT
## [v2020.10.28]
- 修复虚拟联合主键模板错误
- 修复serviceApi实体数据导入外键值检查报错问题
- 补充静态代码表
- 支持实体关系中主实体删除(同步删除、限制删除、置空)等操作
## [v2020.10.17]
- 支持es查询加速:开启查询加速的实体,在完成标准实体存储之外,还会将一份数据存入es中,用于后续在es中进行检索。
- 兼容虚拟主键、多个联合键值属性类型不统一的问题。
- 补充联合主键中出现时间类型属性处理(时间类型属性默认按照yyyyMMddHHmmss格式处理)。
- 修复程序异常时,L1缓存值为空的问题。
## [v2020.09.22]
- 处理逻辑:支持处理逻辑中启动工作流
- **实体属性:模板全局属性javaType调整(请用户自行确认并同步调整USR代码)**
- 虚拟主键:支持虚拟主键,虚拟主键由联合键值构成,新建、更新、删除等操作均通过联合键值实现
- 值规则:支持非空、长度属性值规则校验(只在“新建”时校验)
- 实体对象:支持实体对象拷贝, entity.copyTo(entity2,true); 将entity对象值拷贝到entity2对象中,支持空值不拷贝(true/false)
- RT:补充支付、通知、Lite 客户端配置
- 附加逻辑:支持实体行为附加实体行为配置
- 修复service填充父数据时,由于无法获取父数据而把父数据置空问题
## [v2020.09.06]
- 修复oracle数据库时间精度为毫秒导致版本检查异常问题
- 调整ou feign, 由ibz** 调整sys**
- 为AuthenticationUser添加相关注释
## [v2020.08.31]
- 消息集成:适配RT消息接口,通过钉钉、微信消息及短信等方式发送工作流待办消息
- 数据导入:批量数据采用异步方式进行导入,避免因数据量过大导致前端请求超时问题
## [v2020.08.18]
- 实体数据查询支持配置服务插件
- 工作流usertaskid与processkey不区分大小写
- 优化流程处理角色相关配置
- 标记工作流所在应用
## [v2020.08.10]
增强:
- 支持seata分布式事务
- 支持文件上传大小设置
- 支持动态代码表
- 支持表格无分页配置
优化:
- 修复子系统服务接口中台模式update空值问题
- 开启mysql批量更新设置
## [v2020.07.21]
增强:
- 数据查询:支持上下文的in查询
- 数据查询:支持无值忽略条件
- 支持实体数据导入
修复:
- 补充mapping别名,解决实体在多服务接口中,boot启动mapping重名问题
- 修复服务接口嵌套版本检查bug
- 附加逻辑添加逻辑所有者判断
## [v2020.07.14]
- 支持nacos.eureka服务注册中心,通过配置进行切换
- 支持serviceId动态化配置
- 支持mybatis-plus动态数据源
- 支持数据审计
## [v2020.07.02]
- 支持测试行为模式
- 数据保存时增加版本检查
- 调整Service扩展目录
- 补充数据查询上下级权限控制
- 关闭mybatis-plus分页数量大小限制
\ No newline at end of file
<#ibiztemplate>
TARGET=PSSYSAPP
</#ibiztemplate>
<?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>
<parent>
<artifactId>${pub.getCodeName()?lower_case}-app</artifactId>
<groupId>${pub.getPKGCodeName()?lower_case}</groupId>
<version>${pub.getVersionString()?default("V0.0.1_alpha")}</version>
</parent>
<artifactId>${pub.getCodeName()?lower_case}-app-${app.getPKGCodeName()?lower_case}</artifactId>
<name>${pub.getCodeName()?lower_case?cap_first} Gateway ${app.getPKGCodeName()}</name>
<description>${pub.getCodeName()?lower_case?cap_first} ${app.getPKGCodeName()}</description>
<dependencies>
<dependency>
<groupId>${pub.getPKGCodeName()?lower_case}</groupId>
<artifactId>${pub.getCodeName()?lower_case}-util</artifactId>
<version>${r'${project.version}'}</version>
</dependency>
<#if app.getAppMode()?? && app.getAppMode() == "WFAPP">
<dependency>
<groupId>${pub.getPKGCodeName()?lower_case}</groupId>
<artifactId>${pub.getCodeName()?lower_case}-workflow</artifactId>
<version>${r'${project.version}'}</version>
</dependency>
</#if>
</dependencies>
<#if pub.getPSDeployCenter()?? && pub.getPSDeployCenter().getPSRegistryRepo()??>
<properties>
<docker.image.prefix>${pub.getPSDeployCenter().getPSRegistryRepo().getConnStr()}</docker.image.prefix>
</properties>
</#if>
<profiles>
<profile>
<id>${app.getPKGCodeName()?lower_case}</id>
<build>
<resources>
<resource>
<directory>${r'${basedir}'}/src/main/webapp</directory>
<!--注意此次必须要放在此目录下才能被访问到 -->
<targetPath>META-INF/resources</targetPath>
<includes>
<include>**/**</include>
</includes>
</resource>
<resource>
<directory>${r'${basedir}'}/src/main/resources</directory>
<includes>
<include>**/**</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<id>exec-yarn-run-install</id>
<phase>prepare-package</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>yarn</executable>
<workingDirectory>../../app_${app.getPKGCodeName()}</workingDirectory>
</configuration>
</execution>
<execution>
<id>exec-yarn-run-build</id>
<phase>prepare-package</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>yarn</executable>
<arguments>
<argument>build</argument>
</arguments>
<workingDirectory>../../app_${app.getPKGCodeName()}</workingDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<finalName>${pub.getCodeName()?lower_case}-app-${app.getPKGCodeName()?lower_case}</finalName>
<jvmArguments>-Dfile.encoding=UTF-8</jvmArguments>
<mainClass>${pub.getPKGCodeName()}.${app.getPKGCodeName()?lower_case}.${app.getPKGCodeName()}Application</mainClass>
<outputDirectory>../../</outputDirectory>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<#if pub.getPSDeployCenter()?? && pub.getPSDeployCenter().getPSRegistryRepo()??>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.4.13</version>
<configuration>
<serverId>ibiz-dev</serverId>
<imageName>${r'${docker.image.prefix}/${project.artifactId}'}:latest</imageName>
<dockerDirectory>${r'${project.basedir}'}/src/main/docker</dockerDirectory>
<resources>
<resource>
<targetPath>/</targetPath>
<directory>../../</directory>
<include>${r'${project.artifactId}'}.jar</include>
</resource>
</resources>
</configuration>
</plugin>
</#if>
</plugins>
</build>
</profile>
</profiles>
</project>
<#ibiztemplate>
TARGET=PSSYSAPP
</#ibiztemplate>
<#assign httpPort = "8080">
<#assign nacosUrl = "127.0.0.1:8848" >
<#assign redisHost = "127.0.0.1" >
<#assign redisPort = "6379" >
<#assign redisDataBase = "0" >
<#assign dbUserName="root">
<#assign dbPassWord="123456">
<#assign dbUrl="jdbc:mysql://127.0.0.1:3306/"+sys.name+"?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&useOldAliasMetadataBehavior=true&allowMultiQueries=true">
<#assign dbDriver="com.mysql.jdbc.Driver">
<#if sysrun?? && sysrun.getPSDevSlnMSDepApp()??>
<#assign depApp=sysrun.getPSDevSlnMSDepApp()>
<#if depApp.getHttpPort()??>
<#assign httpPort = sysrun.getPSDevSlnMSDepApp().getHttpPort()?c>
</#if>
<#if depApp.getPSDCMSPlatformNode()??>
<#assign appPlatformNode=depApp.getPSDCMSPlatformNode()>
<#assign appPlatform=depApp.getPSDCMSPlatform()>
<#if appPlatform.getUserParam("nacos","127.0.0.1:8848")??>
<#assign nacosUrl = appPlatform.getUserParam("nacos","127.0.0.1:8848")>
</#if>
<#if depApp.getUserParam("spring.redis.host","")?? && depApp.getUserParam("spring.redis.host","")!="">
<#assign redisHost = depApp.getUserParam("spring.redis.host","")>
<#elseif appPlatform.getUserParam("spring.redis.host","")?? && appPlatform.getUserParam("spring.redis.host","")!="">
<#assign redisHost = appPlatform.getUserParam("spring.redis.host","")>
</#if>
<#if depApp.getUserParam("spring.redis.port","")?? && depApp.getUserParam("spring.redis.port","")!="">
<#assign redisPort = depApp.getUserParam("spring.redis.port","")>
<#elseif appPlatform.getUserParam("spring.redis.port","")?? && appPlatform.getUserParam("spring.redis.port","")!="">
<#assign redisPort = appPlatform.getUserParam("spring.redis.port","")>
</#if>
<#if depApp.getUserParam("spring.redis.database","")?? && depApp.getUserParam("spring.redis.database","")!="">
<#assign redisDataBase = depApp.getUserParam("spring.redis.database","")>
<#elseif appPlatform.getUserParam("spring.redis.database","")?? && appPlatform.getUserParam("spring.redis.database","")!="">
<#assign redisDataBase = appPlatform.getUserParam("spring.redis.database","")>
</#if>
</#if>
</#if>
<#comment>数据库配置</#comment>
<#if sysrun.getPSDBDevInst()??>
<#assign sysRunDBInst = sysrun.getPSDBDevInst()>
<#assign dbUserName=sysRunDBInst.getUserName()>
<#assign dbPassWord=sysRunDBInst.getPassword()>
<#assign dbUrl=sysRunDBInst.getConnUrl()>
<#if (sysRunDBInst.getDBType()=='MYSQL5')>
<#assign dbDriver="com.mysql.jdbc.Driver">
<#assign dbUrl=dbUrl+"&allowMultiQueries=true">
<#elseif (sysRunDBInst.getDBType()=='DB2')>
<#assign dbDriver="com.ibm.db2.jcc.DB2Driver">
<#elseif (sysRunDBInst.getDBType()=='ORACLE')>
<#assign dbDriver="oracle.jdbc.driver.OracleDriver">
<#elseif (sysRunDBInst.getDBType()=='SQLSERVER')>
<#assign dbDriver="com.microsoft.sqlserver.jdbc.SQLServerDriver">
<#elseif (sysRunDBInst.getDBType()=='POSTGRESQL')>
<#assign dbDriver="org.postgresql.Driver">
<#elseif (sysRunDBInst.getDBType()=='PPAS')>
<#assign dbDriver="com.edb.Driver">
</#if>
</#if>
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: ${pub.getCodeName()?lower_case}-app-${app.getPKGCodeName()?lower_case}
labels:
app: ${pub.getCodeName()?lower_case}-app-${app.getPKGCodeName()?lower_case}
spec:
replicas: 1
selector:
matchLabels:
app: ${pub.getCodeName()?lower_case}-app-${app.getPKGCodeName()?lower_case}
template:
metadata:
labels:
app: ${pub.getCodeName()?lower_case}-app-${app.getPKGCodeName()?lower_case}
spec:
imagePullSecrets:
- name: aly-shanghai
containers:
- name: ${pub.getCodeName()?lower_case}-app-${app.getPKGCodeName()?lower_case}
image: registry.cn-shanghai.aliyuncs.com/ibizsys/${pub.getCodeName()?lower_case}-app-${app.getPKGCodeName()?lower_case}:latest
imagePullPolicy: Always
ports:
- containerPort: ${httpPort}
<#if sysrun?? && sysrun.getPSDevSlnMSDepApp()?? && sysrun.getPSDevSlnMSDepApp().getPSDCMSPlatformNode()??>
<#assign depApp=sysrun.getPSDevSlnMSDepApp()>
<#assign appPlatformNode=sysrun.getPSDevSlnMSDepApp().getPSDCMSPlatformNode()>
<#assign appPlatform=sysrun.getPSDevSlnMSDepApp().getPSDCMSPlatform()>
env:
<#if appPlatformNode.getSSHIPAddr()??>
- name: SPRING_CLOUD_NACOS_DISCOVERY_IP
value: "${appPlatformNode.getSSHIPAddr()}"
</#if>
<#comment>系统运行参数设置,从SysRun中获取到当前部署相关信息</#comment>
- name: SERVER_PORT
value: "${httpPort}"
- name: SPRING_CLOUD_NACOS_DISCOVERY_SERVER-ADDR
value: "${nacosUrl}"
- name: SPRING_REDIS_HOST
value: "${redisHost}"
- name: SPRING_REDIS_PORT
value: "${redisPort}"
- name: SPRING_REDIS_DATABASE
value: "${redisDataBase}"
- name: SPRING_DATASOURCE_USERNAME
value: "${dbUserName}"
- name: SPRING_DATASOURCE_PASSWORD
value: "${dbPassWord}"
- name: SPRING_DATASOURCE_URL
value: "${dbUrl}"
- name: SPRING_DATASOURCE_DRIVER-CLASS-NAME
value: "${dbDriver}"
- name: SPRING_DATASOURCE_DEFAULTSCHEMA
value: "${dbUserName}"
<#comment>输出前端应用自定义参数替换标准参数</#comment>
<#if depApp.getUserParamNames()??>
<@outputUserParam depApp depApp.getUserParamNames()/>
</#if>
<#comment>输出微服务平台自定义参数替换标准参数</#comment>
<#if appPlatform.getUserParamNames()??>
<@outputUserParam appPlatform appPlatform.getUserParamNames()/>
</#if>
</#if>
volumeMounts:
- name: data
mountPath: /app/file
volumes:
- name: data
persistentVolumeClaim:
claimName: demo-date-pvc-nfs
---
apiVersion: v1
kind: Service
metadata:
name: ${pub.getCodeName()?lower_case}-app-${app.getPKGCodeName()?lower_case}
labels:
app: ${pub.getCodeName()?lower_case}-app-${app.getPKGCodeName()?lower_case}
spec:
type: NodePort
ports:
- name: http
port: ${httpPort}
targetPort: ${httpPort}
nodePort: ${httpPort}
protocol: TCP
selector:
app: ${pub.getCodeName()?lower_case}-app-${app.getPKGCodeName()?lower_case}
<#comment>输出用户自定义参数</#comment>
<#macro outputUserParam paramObj paramList>
<#list paramList as param>
<#assign userParamkey=param?upper_case?replace(".","_")>
<#comment>nacos、数据库连接等信息从sysRun中获取</#comment>
<#if userParamkey!="SPRING_CLOUD_NACOS_DISCOVERY_SERVER-ADDR" && userParamkey!="SPRING_REDIS_HOST" &&
userParamkey!="SERVER_PORT" &&userParamkey!="SPRING_REDIS_PORT" &&userParamkey!="SPRING_REDIS_DATABASE"
&&userParamkey!="SPRING_DATASOURCE_USERNAME" &&userParamkey!="SPRING_DATASOURCE_PASSWORD"
&&userParamkey!="SPRING_DATASOURCE_URL" &&userParamkey!="SPRING_DATASOURCE_DRIVER-CLASS-NAME" &&userParamkey!="SPRING_DATASOURCE_DEFAULTSCHEMA">
<#comment>扩展标准配置:用户配置参数替换标准配置(application-sys.yml)</#comment>
<#if !P.exists('AppDeployUserParam',param)>
- name: ${userParamkey}
value: "${paramObj.getUserParam(param,"")}"
</#if>
</#if>
</#list>
</#macro>
\ No newline at end of file
<#ibiztemplate>
TARGET=PSSYSAPP
</#ibiztemplate>
<#assign httpPort = "8080">
<#assign nacosUrl = "127.0.0.1:8848" >
<#assign redisHost = "127.0.0.1" >
<#assign redisPort = "6379" >
<#assign redisDataBase = "0" >
<#assign dbUserName="root">
<#assign dbPassWord="123456">
<#assign dbUrl="jdbc:mysql://127.0.0.1:3306/"+sys.name+"?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&useOldAliasMetadataBehavior=true&allowMultiQueries=true">
<#assign dbDriver="com.mysql.jdbc.Driver">
<#assign dockerPortMap="">
<#if sysrun?? && sysrun.getPSDevSlnMSDepApp()??>
<#assign depApp=sysrun.getPSDevSlnMSDepApp()>
<#if depApp.getHttpPort()??>
<#assign httpPort = sysrun.getPSDevSlnMSDepApp().getHttpPort()?c>
</#if>
<#if depApp.getPSDCMSPlatformNode()??>
<#assign appPlatformNode=depApp.getPSDCMSPlatformNode()>
<#assign appPlatform=depApp.getPSDCMSPlatform()>
<#if appPlatform.getUserParam("nacos","127.0.0.1:8848")??>
<#assign nacosUrl = appPlatform.getUserParam("nacos","127.0.0.1:8848")>
</#if>
<#if depApp.getUserParam("spring.redis.host","")?? && depApp.getUserParam("spring.redis.host","")!="">
<#assign redisHost = depApp.getUserParam("spring.redis.host","")>
<#elseif appPlatform.getUserParam("spring.redis.host","")?? && appPlatform.getUserParam("spring.redis.host","")!="">
<#assign redisHost = appPlatform.getUserParam("spring.redis.host","")>
</#if>
<#if depApp.getUserParam("spring.redis.port","")?? && depApp.getUserParam("spring.redis.port","")!="">
<#assign redisPort = depApp.getUserParam("spring.redis.port","")>
<#elseif appPlatform.getUserParam("spring.redis.port","")?? && appPlatform.getUserParam("spring.redis.port","")!="">
<#assign redisPort = appPlatform.getUserParam("spring.redis.port","")>
</#if>
<#if depApp.getUserParam("spring.redis.database","")?? && depApp.getUserParam("spring.redis.database","")!="">
<#assign redisDataBase = depApp.getUserParam("spring.redis.database","")>
<#elseif appPlatform.getUserParam("spring.redis.database","")?? && appPlatform.getUserParam("spring.redis.database","")!="">
<#assign redisDataBase = appPlatform.getUserParam("spring.redis.database","")>
</#if>
<#if depApp.getUserParam("portmap","")?? && depApp.getUserParam("portmap","")!="">
<#assign dockerPortMap = depApp.getUserParam("portmap","")>
<#elseif appPlatform.getUserParam("portmap","")?? && appPlatform.getUserParam("portmap","")!="">
<#assign dockerPortMap = appPlatform.getUserParam("portmap","")>
</#if>
</#if>
</#if>
<#comment>数据库配置</#comment>
<#if sysrun.getPSDBDevInst()??>
<#assign sysRunDBInst = sysrun.getPSDBDevInst()>
<#assign dbUserName=sysRunDBInst.getUserName()>
<#assign dbPassWord=sysRunDBInst.getPassword()>
<#assign dbUrl=sysRunDBInst.getConnUrl()>
<#if (sysRunDBInst.getDBType()=='MYSQL5')>
<#assign dbDriver="com.mysql.jdbc.Driver">
<#assign dbUrl=dbUrl+"&allowMultiQueries=true">
<#elseif (sysRunDBInst.getDBType()=='DB2')>
<#assign dbDriver="com.ibm.db2.jcc.DB2Driver">
<#elseif (sysRunDBInst.getDBType()=='ORACLE')>
<#assign dbDriver="oracle.jdbc.driver.OracleDriver">
<#elseif (sysRunDBInst.getDBType()=='SQLSERVER')>
<#assign dbDriver="com.microsoft.sqlserver.jdbc.SQLServerDriver">
<#elseif (sysRunDBInst.getDBType()=='POSTGRESQL')>
<#assign dbDriver="org.postgresql.Driver">
<#elseif (sysRunDBInst.getDBType()=='PPAS')>
<#assign dbDriver="com.edb.Driver">
</#if>
</#if>
version: "3.2"
services:
${pub.getCodeName()?lower_case}-app-${app.getPKGCodeName()?lower_case}:
image: registry.cn-shanghai.aliyuncs.com/ibizsys/${pub.getCodeName()?lower_case}-app-${app.getPKGCodeName()?lower_case}:latest
ports:
- "${httpPort}:${httpPort}"
<#if dockerPortMap!=''>
- "${dockerPortMap}"
</#if>
networks:
- agent_network
<#if sysrun?? && sysrun.getPSDevSlnMSDepApp()?? && sysrun.getPSDevSlnMSDepApp().getPSDCMSPlatformNode()??>
<#assign depApp=sysrun.getPSDevSlnMSDepApp()>
<#assign appPlatformNode=sysrun.getPSDevSlnMSDepApp().getPSDCMSPlatformNode()>
<#assign appPlatform=sysrun.getPSDevSlnMSDepApp().getPSDCMSPlatform()>
environment:
<#if appPlatformNode.getSSHIPAddr()??>
- SPRING_CLOUD_NACOS_DISCOVERY_IP=${appPlatformNode.getSSHIPAddr()}
</#if>
<#comment>系统运行参数设置,从SysRun中获取到当前部署相关信息</#comment>
- SERVER_PORT=${httpPort}
- SPRING_CLOUD_NACOS_DISCOVERY_SERVER-ADDR=${nacosUrl}
- SPRING_REDIS_HOST=${redisHost}
- SPRING_REDIS_PORT=${redisPort}
- SPRING_REDIS_DATABASE=${redisDataBase}
- SPRING_DATASOURCE_USERNAME=${dbUserName}
- SPRING_DATASOURCE_PASSWORD=${dbPassWord}
- SPRING_DATASOURCE_URL=${dbUrl}
- SPRING_DATASOURCE_DRIVER-CLASS-NAME=${dbDriver}
- SPRING_DATASOURCE_DEFAULTSCHEMA=${dbUserName}
<#comment>输出前端应用自定义参数替换标准参数</#comment>
<#if depApp.getUserParamNames()??>
<@outputUserParam depApp depApp.getUserParamNames()/>
</#if>
<#comment>输出微服务平台自定义参数替换标准参数</#comment>
<#if appPlatform.getUserParamNames()??>
<@outputUserParam appPlatform appPlatform.getUserParamNames()/>
</#if>
</#if>
deploy:
resources:
limits:
memory: 800M
reservations:
memory: 400M
mode: replicated
replicas: 1
restart_policy:
condition: on-failure
max_attempts: 3
window: 120s
volumes:
- "nfs:/app/file"
volumes:
nfs:
driver: local
driver_opts:
type: "nfs"
o: "addr=172.16.240.109,rw"
device: ":/nfs"
networks:
agent_network:
driver: overlay
attachable: true
<#comment>输出用户自定义参数</#comment>
<#macro outputUserParam paramObj paramList>
<#list paramList as param>
<#assign userParamkey=param?upper_case?replace(".","_")>
<#comment>nacos、数据库连接等信息从sysRun中获取</#comment>
<#if userParamkey!="SPRING_CLOUD_NACOS_DISCOVERY_SERVER-ADDR" && userParamkey!="SPRING_REDIS_HOST" &&
userParamkey!="SERVER_PORT" &&userParamkey!="SPRING_REDIS_PORT" &&userParamkey!="SPRING_REDIS_DATABASE"
&&userParamkey!="SPRING_DATASOURCE_USERNAME" &&userParamkey!="SPRING_DATASOURCE_PASSWORD"
&&userParamkey!="SPRING_DATASOURCE_URL" &&userParamkey!="SPRING_DATASOURCE_DRIVER-CLASS-NAME" &&userParamkey!="SPRING_DATASOURCE_DEFAULTSCHEMA">
<#comment>扩展标准配置:用户配置参数替换标准配置(application-sys.yml)</#comment>
<#if !P.exists('AppDeployUserParam',param)>
- ${userParamkey}=${paramObj.getUserParam(param,"")}
</#if>
</#if>
</#list>
</#macro>
\ No newline at end of file
<#ibiztemplate>
TARGET=PSSYSAPP
</#ibiztemplate>
<#assign httpPort = "8080">
<#assign timezone = "Asia/Shanghai">
<#if sysrun?? >
<#if sysrun.getPSDevSlnMSDepApp()??>
<#if sysrun.getPSDevSlnMSDepApp().getHttpPort()??>
<#assign httpPort = sysrun.getPSDevSlnMSDepApp().getHttpPort()?c>
</#if>
<#if sysrun.getPSDevSlnMSDepApp().getUserParam("timezone","")?? && sysrun.getPSDevSlnMSDepApp().getUserParam("timezone","")!="">
<#assign timezone = sysrun.getPSDevSlnMSDepApp().getUserParam("timezone","")>
<#elseif sysrun.getPSDevSlnMSDepApp().getPSDCMSPlatform().getUserParam("timezone","")?? && sysrun.getPSDevSlnMSDepApp().getPSDCMSPlatform().getUserParam("timezone","")!="">
<#assign timezone = sysrun.getPSDevSlnMSDepApp().getPSDCMSPlatform().getUserParam("timezone","")>
</#if>
</#if>
</#if>
FROM openjdk:8-jre-alpine
ENV TZ=${timezone} \
SPRING_OUTPUT_ANSI_ENABLED=ALWAYS \
IBIZ_SLEEP=0 \
JAVA_OPTS=""
CMD echo "The application will start in ${r'${IBIZ_SLEEP}'}s..." && \
sleep ${r'${IBIZ_SLEEP}'} && \
java ${r'${JAVA_OPTS}'} -Duser.timezone=$TZ -Djava.security.egd=file:/dev/./urandom -jar /${pub.getCodeName()?lower_case}-app-${app.getPKGCodeName()?lower_case}.jar
EXPOSE ${httpPort}
ADD ${pub.getCodeName()?lower_case}-app-${app.getPKGCodeName()?lower_case}.jar /${pub.getCodeName()?lower_case}-app-${app.getPKGCodeName()?lower_case}.jar
<#ibiztemplate>
TARGET=PSSYSAPP
</#ibiztemplate>
<#assign bDynamicDS=false>
<#list sys.getAllPSDataEntities() as entity>
<#if (entity.getStorageMode()==1 || entity.getStorageMode()==2) && entity.getDSLink()!='DEFAULT'>
<#assign bDynamicDS=true>
<#break>
</#if>
</#list>
package ${pub.getPKGCodeName()}.${app.getPKGCodeName()?lower_case};
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.cloud.openfeign.FeignClientsConfiguration;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import ${pub.getPKGCodeName()}.util.web.SearchContextHandlerMethodArgumentResolver;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
@Slf4j
@Import({
FeignClientsConfiguration.class
})
@EnableDiscoveryClient
@Configuration
@EnableFeignClients(basePackages = {"${pub.getPKGCodeName()}" })
@EnableZuulProxy
@ComponentScan(basePackages = {"${pub.getPKGCodeName()}.${app.getPKGCodeName()?lower_case}","${pub.getPKGCodeName()}.util"})
@MapperScan("${pub.getPKGCodeName()}.*.mapper")
@SpringBootApplication(exclude = {
org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class,
<#--<#assign bmogo=false>-->
<#--<#if app.getAllPSAppDataEntities()??>-->
<#--<#list app.getAllPSAppDataEntities() as appde>-->
<#--<#if appde.getStorageMode()?? && appde.getStorageMode()==2>-->
<#--<#assign bmogo=true>-->
<#--<#break >-->
<#--</#if>-->
<#--</#list>-->
<#--</#if>-->
<#--<#if bmogo==false>-->
<#--org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration.class,-->
<#--</#if>-->
<#if bDynamicDS>
com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure.class
</#if>
})
public class ${app.getPKGCodeName()}Application extends WebMvcConfigurerAdapter {
@Autowired
SearchContextHandlerMethodArgumentResolver resolver;
public static void main(String[] args) {
SpringApplication.run(${app.getPKGCodeName()}Application.class, args);
}
@Override
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
super.addArgumentResolvers(argumentResolvers);
argumentResolvers.add(resolver);
}
}
<#ibiztemplate>
TARGET=PSSYSAPP
</#ibiztemplate>
<#if sys.getSaaSMode()==4>
package ${pub.getPKGCodeName()}.${app.getPKGCodeName()?lower_case}.config;
import com.netflix.zuul.ZuulFilter;
import com.netflix.zuul.context.RequestContext;
import com.netflix.zuul.exception.ZuulException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
@Component
@Slf4j
public class ${app.getPKGCodeName()}HeaderFilter extends ZuulFilter {
@Override
public String filterType() {
return "pre";
}
@Override
public int filterOrder() {
return 0;
}
@Override
public boolean shouldFilter() {
return true;
}
@Override
public Object run() throws ZuulException {
RequestContext ctx = RequestContext.getCurrentContext();
ctx.addZuulRequestHeader("srfsystem", "${sys.getCodeName()}");
return null;
}
}
</#if>
\ No newline at end of file
<#ibiztemplate>
TARGET=PSSYSAPP
</#ibiztemplate>
package ${pub.getPKGCodeName()}.${app.getPKGCodeName()?lower_case}.config;
import ${pub.getPKGCodeName()}.util.security.AuthenticationEntryPoint;
import ${pub.getPKGCodeName()}.util.security.AuthorizationTokenFilter;
import ${pub.getPKGCodeName()}.util.service.AuthenticationUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpMethod;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.config.core.GrantedAuthorityDefaults;
import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
import org.springframework.context.annotation.Profile;
import org.springframework.beans.factory.annotation.Qualifier;
@Profile("${app.getPKGCodeName()?lower_case}-prod")
@Configuration
@EnableWebSecurity
public class ${app.getPKGCodeName()}SecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
private AuthenticationEntryPoint unauthorizedHandler;
@Autowired
private AuthenticationUserService userDetailsService;
/**
* 自定义基于JWT的安全过滤器
*/
@Autowired
AuthorizationTokenFilter authenticationTokenFilter;
@Value("${r'${ibiz.auth.path:v7/login}"'})
private String loginPath;
@Value("${r'${ibiz.auth.logoutpath:v7/logout}"'})
private String logoutPath;
@Value("${r'${ibiz.file.uploadpath:ibizutil/upload}"'})
private String uploadpath;
@Value("${r'${ibiz.file.downloadpath:ibizutil/download}"'})
private String downloadpath;
@Value("${r'${ibiz.file.previewpath:ibizutil/preview}"'})
private String previewpath;
@Value("${r'${ibiz.auth.excludesPattern:}"'})
private String[] excludesPattern;
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
auth
.userDetailsService(userDetailsService)
.passwordEncoder(passwordEncoderBean());
}
@Bean
GrantedAuthorityDefaults grantedAuthorityDefaults() {
// Remove the ROLE_ prefix
return new GrantedAuthorityDefaults("");
}
@Bean
public PasswordEncoder passwordEncoderBean() {
return new BCryptPasswordEncoder();
}
@Bean
@Override
public AuthenticationManager authenticationManagerBean() throws Exception {
return super.authenticationManagerBean();
}
@Override
protected void configure(HttpSecurity httpSecurity) throws Exception {
httpSecurity
// 禁用 CSRF
.csrf().disable()
// 授权异常
.exceptionHandling().authenticationEntryPoint(unauthorizedHandler).and()
// 不创建会话
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and()
// 过滤请求
.authorizeRequests()
.antMatchers(
HttpMethod.GET,
"/*.html",
"/**/*.html",
"/**/*.css",
"/**/*.js",
"/**/*.ico",
"/**/assets/**",
"/**/css/**",
"/**/fonts/**",
"/**/js/**",
"/**/img/**",
"/**/svg/**",
"/"
).permitAll()
// 放行登录请求
.antMatchers( HttpMethod.POST, "/"+loginPath).permitAll()
// 放行注销请求
.antMatchers( HttpMethod.GET, "/"+logoutPath).permitAll()
// 文件操作
.antMatchers("/"+downloadpath+"/**").permitAll()
.antMatchers("/"+uploadpath).permitAll()
.antMatchers("/"+previewpath+"/**");
for (String excludePattern : excludesPattern) {
authenticationTokenFilter.addExcludePattern(excludePattern);
httpSecurity.authorizeRequests().antMatchers(excludePattern).permitAll();
}
// 所有请求都需要认证
httpSecurity.authorizeRequests().anyRequest().authenticated()
// 防止iframe 造成跨域
.and().headers().frameOptions().disable();
httpSecurity
.addFilterBefore(authenticationTokenFilter, UsernamePasswordAuthenticationFilter.class);
}
}
<#ibiztemplate>
TARGET=PSSYSAPP
</#ibiztemplate>
server:
port: 8080
\ No newline at end of file
<#ibiztemplate>
TARGET=PSSYSAPP
</#ibiztemplate>
<#assign httpPort = "8080">
<#if sys.getAllPSDevSlnMSDepApps()??>
<#list sys.getAllPSDevSlnMSDepApps() as depApp>
<#if depApp.getPSApplication()?? && depApp.getPSApplication().codeName==item.codeName>
<#assign httpPort = depApp.getHttpPort()?c>
<#break>
</#if>
</#list>
</#if>
<#assign haswfentity=false>
<#list item.getAllPSAppDataEntities() as appDataEntity>
<#assign psDataEntity=appDataEntity.getPSDataEntity()>
<#if psDataEntity.hasPSDEWF()?? && psDataEntity.hasPSDEWF()==true>
<#assign haswfentity=true>
<#break>
</#if>
</#list>
server:
port: ${httpPort}
#Log配置
logging:
level:
${pub.getPKGCodeName()}: info
<#if item.getAllPSAppDataEntities?? && app.getAllPSAppDataEntities()??>
#zuul网关路由设置
zuul:
routes:
<#if haswfentity==true>
wfcore:
path: /wfcore/**
serviceId: ${r'${ibiz.ref.service.wf:ibzwf-api}'}
stripPrefix: true
</#if>
<#if sys.getPSSystemSetting()?? && sys.getPSSystemSetting().getDataAccCtrlArch()?? && sys.getPSSystemSetting().getDataAccCtrlArch()==1>
loginv7:
path: /v7/login
serviceId: ${r'${ibiz.ref.service.uaa:ibzuaa-api}'}
stripPrefix: false
changepwd:
path: /v7/changepwd
serviceId: ${r'${ibiz.ref.service.uaa:ibzuaa-api}'}
stripPrefix: false
uaa:
path: /uaa/**
serviceId: ${r'${ibiz.ref.service.uaa:ibzuaa-api}'}
stripPrefix: false
config:
path: /configs/**
serviceId: ${r'${ibiz.ref.service.uaa:ibzuaa-api}'}
stripPrefix: false
<#if sys.getCodeName()!='ibzou' && sys.getCodeName()!='ibzrt'>
oucore:
path: /ibzorganizations/**
serviceId: ${r'${ibiz.ref.service.ou:ibzou-api}'}
stripPrefix: false
oudict:
path: /dictionarys/**/Ibzou**
serviceId: ${r'${ibiz.ref.service.ou:ibzou-api}'}
stripPrefix: false
ou:
path: /ibzdepartments/**
serviceId: ${r'${ibiz.ref.service.ou:ibzou-api}'}
stripPrefix: false
uaadict:
path: /dictionarys/**/SysOperator
serviceId: ${r'${ibiz.ref.service.uaa:ibzuaa-api}'}
stripPrefix: false
dict:
path: /dictionarys/**
serviceId: ${r'${ibiz.ref.service.dict:ibzdict-api}'}
stripPrefix: false
disk:
path: /net-disk/**
serviceId: ${r'${ibiz.ref.service.disk:ibzdisk-api}'}
stripPrefix: false
ou_sys_org:
path: /sysorganizations/**
serviceId: ${r'${ibiz.ref.service.ou:ibzou-api}'}
stripPrefix: false
ou_sys_dept:
path: /sysdepartments/**
serviceId: ${r'${ibiz.ref.service.ou:ibzou-api}'}
stripPrefix: false
lite-core:
path: /lite/**
serviceId: ${r'${ibiz.ref.service.lite:ibzlite-api}'}
stripPrefix: false
sysauthlog:
path: /sysauthlogs
serviceId: ${r'${ibiz.ref.service.uaa:ibzuaa-api}'}
stripPrefix: false
</#if>
</#if>
<#list item.getAllPSAppDataEntities() as appDataEntity>
<#assign serviceId="">
<#assign serviceUrl=srfpluralize(appDataEntity.codeName?lower_case)>
<#assign appEntity=appDataEntity.name?lower_case>
<#assign psDataEntity=appDataEntity.getPSDataEntity()>
<#assign systemName=sys.getCodeName()?lower_case>
<#assign sybSysServiceType=(psDataEntity.getPSSubSysServiceAPI().getServiceType())!''>
<#comment>服务类型为中台和MASA走自身处理</#comment>
<#if psDataEntity.getStorageMode()==4 && (sybSysServiceType!='MIDDLEPLATFORM' && sybSysServiceType!='MASA')>
<#comment>serviceApi模式</#comment>
<#assign serviceId=(psDataEntity.getPSSubSysServiceAPI().getServiceCodeName())!''>
<#assign serviceUrl=srfpluralize(appDataEntity.codeName?lower_case)>
<#else>
<#assign sysApi=appDataEntity.getPSDEServiceAPI().getPSSysServiceAPI().codeName?lower_case>
<#assign deApi=appDataEntity.getPSDEServiceAPI().codeName?lower_case>
<#assign serviceId=systemName+"-"+sysApi>
</#if>
<#if serviceId!="">
<#assign serviceId="$"+"{ibiz.ref.service."+serviceId?lower_case+":"+serviceId+"}">
${appEntity}:
path: /${serviceUrl}/**
serviceId: ${serviceId}
stripPrefix: false
</#if>
</#list>
<#comment>通过设置该参数,避免Zuul转发请求时丢失Authorization请求头信息</#comment>
sensitive-headers:
- Cookie,Set-Cookie,Authorization
</#if>
<#ibiztemplate>
TARGET=PSSYSAPP
</#ibiztemplate>
spring:
profiles:
include: sys ,nacos, ${app.getPKGCodeName()?lower_case}-prod
application:
name: ${sys.getCodeName()?lower_case}-${app.getPKGCodeName()?lower_case}
<#ibiztemplate>
TARGET=PSSYSAPP
</#ibiztemplate>
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false">
<property name="LOG_PATH" value="logs" />
<property name="LOG_PATTERN" value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%-5level] %-40.40logger{39} : %msg%n" />
<!-- 彩色日志 -->
<!-- 彩色日志依赖的渲染类 -->
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter" />
<conversionRule conversionWord="wex" converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter" />
<conversionRule conversionWord="wEx" converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter" />
<!-- 彩色日志格式 -->
<property name="LOG_PATTERN2" value="${r'${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr([${LOG_LEVEL_PATTERN:-%5p}]) %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}'}" />
<!-- 控制台输出 -->
<appender name="Console" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${r'${LOG_PATTERN}'}</pattern>
</encoder>
</appender>
<#--<!-- LOGSTASH &ndash;&gt;-->
<#--<appender name="LOGSTASH"-->
<#-- class="net.logstash.logback.appender.LogstashTcpSocketAppender">-->
<#-- <destination>172.16.102.211:9601</destination>-->
<#-- <encoder charset="UTF-8" class="net.logstash.logback.encoder.LogstashEncoder">-->
<#-- <customFields>{"appname":"${app.getPKGCodeName()?lower_case}"}</customFields>-->
<#-- </encoder>-->
<#--</appender>-->
<!-- 按照每天生成日志文件 -->
<appender name="file" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!--日志文件输出的文件名-->
<FileNamePattern>${r'${LOG_PATH}'}/${sys.getCodeName()?lower_case}-${app.getPKGCodeName()?lower_case}.%d{yyyy-MM-dd}.log</FileNamePattern>
<!--日志文件保留天数-->
<MaxHistory>30</MaxHistory>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${r'${LOG_PATTERN}'}</pattern>
</encoder>
<!--日志文件最大的大小-->
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
<MaxFileSize>100MB</MaxFileSize>
</triggeringPolicy>
</appender>
<!-- 日志输出级别 -->
<root level="INFO">
<appender-ref ref="Console" />
<appender-ref ref="file" />
<#-- <appender-ref ref="LOGSTASH" />-->
</root>
</configuration>
<#ibiztemplate>
TARGET=PSSYSTEM
</#ibiztemplate>
<?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>
<parent>
<artifactId>${pub.getCodeName()?lower_case}</artifactId>
<groupId>${pub.getPKGCodeName()?lower_case}</groupId>
<version>${pub.getVersionString()?default("V0.0.1_alpha")}</version>
</parent>
<artifactId>${pub.getCodeName()?lower_case}-app</artifactId>
<name>${pub.getCodeName()?lower_case?cap_first} Application</name>
<description>${pub.getCodeName()?lower_case?cap_first} Application</description>
<packaging>pom</packaging>
<#-- modules -->
<#if sys.getAllPSApps()??>
<modules>
<#list sys.getAllPSApps() as app>
<module>${pub.getCodeName()?lower_case}-app-${app.getPKGCodeName()?lower_case}</module>
</#list>
</modules>
</#if>
<dependencies>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-commons</artifactId>
</dependency>
<#--<dependency>-->
<#--<groupId>org.springframework.cloud</groupId>-->
<#--<artifactId>spring-cloud-starter-security</artifactId>-->
<#--<version>2.1.1.RELEASE</version>-->
<#--</dependency>-->
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>0.9.1</version>
</dependency>
<#--<dependency>-->
<#--<groupId>org.springframework.security</groupId>-->
<#--<artifactId>spring-security-cas</artifactId>-->
<#--</dependency>-->
<#--<dependency>-->
<#--<groupId>${pub.getPKGCodeName()?lower_case}</groupId>-->
<#--<artifactId>${pub.getCodeName()?lower_case}-util</artifactId>-->
<#--<version>${r'${project.version}'}</version>-->
<#--</dependency>-->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-zuul</artifactId>
</dependency>
</dependencies>
</project>
<#ibiztemplate>
TARGET=PSSYSTEM
</#ibiztemplate>
<?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>
<parent>
<artifactId>${pub.getCodeName()?lower_case}</artifactId>
<groupId>${pub.getPKGCodeName()?lower_case}</groupId>
<version>${pub.getVersionString()?default("V0.0.1_alpha")}</version>
</parent>
<artifactId>${pub.getCodeName()?lower_case}-boot</artifactId>
<name>${pub.getCodeName()?lower_case?cap_first} Dev Monolithic Boot</name>
<description>${pub.getCodeName()?lower_case?cap_first} Boot</description>
<dependencies>
<dependency>
<groupId>${pub.getPKGCodeName()?lower_case}</groupId>
<artifactId>${pub.getCodeName()?lower_case}-core</artifactId>
<version>${r'${project.version}'}</version>
</dependency>
<#comment>引入后台服务接口</#comment>
<#if sys.getAllPSSysServiceAPIs()??>
<#list sys.getAllPSSysServiceAPIs() as sysapi>
<dependency>
<groupId>${pub.getPKGCodeName()?lower_case}</groupId>
<artifactId>${pub.getCodeName()?lower_case}-provider-${sysapi.getCodeName()?lower_case}</artifactId>
<version>${r'${project.version}'}</version>
</dependency>
</#list>
</#if>
<#comment>引入前端应用</#comment>
<#if sys.getAllPSApps()??>
<#list sys.getAllPSApps() as sysApp>
<dependency>
<groupId>${pub.getPKGCodeName()?lower_case}</groupId>
<artifactId>${pub.getCodeName()?lower_case}-app-${sysApp.getPKGCodeName()?lower_case}</artifactId>
<version>${r'${project.version}'}</version>
</dependency>
</#list>
</#if>
</dependencies>
<!--由于boot是通过dependency来关联所有子项目,页面和配置等信息都存在与子项目中,
所以您在对boot进行打包前,需要先将子项目install到maven仓库,以确保boot可以正常引用所有完整的子项目-->
<profiles>
<profile>
<id>boot</id>
<build>
<resources>
<resource>
<directory>${r'${basedir}'}/src/main/resources</directory>
<includes>
<include>**/**</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<finalName>${pub.codeName?lower_case}</finalName>
<jvmArguments>-Dfile.encoding=UTF-8</jvmArguments>
<mainClass>${pub.getPKGCodeName()}.DevBootApplication</mainClass>
<outputDirectory>../</outputDirectory>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
<#ibiztemplate>
TARGET=PSSYSTEM
</#ibiztemplate>
<#assign bmogo=false>
<#if sys.getAllPSDataEntities()??>
<#list sys.getAllPSDataEntities() as de>
<#if de.getStorageMode()?? && de.getStorageMode()==2>
<#assign bmogo=true>
<#break >
</#if>
</#list>
</#if>
<#if bmogo==true>
version: "3.2"
services:
${sys.name}-mongodb:
image: mongo:4.2.3
ports:
- 27017:27017
volumes:
- $PWD/../../../../volumes/mongodb/:/data/db/
networks:
- agent_network
networks:
agent_network:
attachable: true
</#if>
\ No newline at end of file
<#ibiztemplate>
TARGET=PSSYSTEM
</#ibiztemplate>
<#assign dbUserName="root">
<#assign bflag=false>
<#if sys.getAllPSDevSlnMSDepAPIs()??>
<#list sys.getAllPSDevSlnMSDepAPIs() as depSysApi>
<#if depSysApi.getPSDBDevInst()??>
<#assign sysApiDBInst=depSysApi.getPSDBDevInst()>
<#assign dbUserName=sysApiDBInst.getUserName()>
<#if (sysApiDBInst.getDBType()=='MYSQL5')>
<#assign bflag=true>
</#if>
<#break>
</#if>
</#list>
</#if>
<#if bflag==true>
version: "3.2"
services:
${sys.name}-mysql:
image: mysql:5.7.20
volumes:
- $PWD/../../../../volumes/mysql/:/var/lib/mysql/
networks:
- agent_network
environment:
- TZ=Asia/Shanghai
- MYSQL_ALLOW_EMPTY_PASSWORD=yes
- MYSQL_ROOT_PASSWORD=root
- MYSQL_DATABASE=${dbUserName}
ports:
- 3306:3306
command: mysqld --lower_case_table_names=1 --skip-ssl --character_set_server=utf8 --explicit_defaults_for_timestamp
networks:
agent_network:
attachable: true
</#if>
\ No newline at end of file
<#ibiztemplate>
TARGET=PSSYSTEM
</#ibiztemplate>
version: "3.2"
services:
${sys.name}-nacos:
image: nacos/nacos-server:latest
container_name: nacos-standalone
environment:
- PREFER_HOST_MODE=hostname
- MODE=standalone
ports:
- "8848:8848"
networks:
- agent_network
networks:
agent_network:
attachable: true
<#ibiztemplate>
TARGET=PSSYSTEM
</#ibiztemplate>
<#assign bflag=false>
<#if sys.getAllPSDevSlnMSDepAPIs()??>
<#list sys.getAllPSDevSlnMSDepAPIs() as depSysApi>
<#if depSysApi.getPSDBDevInst()??>
<#assign sysApiDBInst=depSysApi.getPSDBDevInst()>
<#if (sysApiDBInst.getDBType()=='ORACLE')>
<#assign bflag=true>
</#if>
<#break>
</#if>
</#list>
</#if>
<#if bflag==true>
version: "3.2"
services:
${sys.name}-orcl:
image: liumiaocn/oracle:11.2.0
ports:
- "38080:8080"
- "1521:1521"
environment:
- DEFAULT_SYS_PASS=root
- processes=500
- sessions=555
- transactions=611
volumes:
- $PWD/../../../../volumes/orcl/:/u01/app/oracle/
networks:
- agent_network
networks:
agent_network:
attachable: true
</#if>
\ No newline at end of file
<#ibiztemplate>
TARGET=PSSYSTEM
</#ibiztemplate>
<#assign dbUserName="root">
<#assign bflag=false>
<#if sys.getAllPSDevSlnMSDepAPIs()??>
<#list sys.getAllPSDevSlnMSDepAPIs() as depSysApi>
<#if depSysApi.getPSDBDevInst()??>
<#assign sysApiDBInst=depSysApi.getPSDBDevInst()>
<#assign dbUserName=sysApiDBInst.getUserName()>
<#if (sysApiDBInst.getDBType()=='POSTGRESQL')>
<#assign bflag=true>
</#if>
<#break>
</#if>
</#list>
</#if>
<#if bflag==true>
version: "3.2"
services:
${sys.name}-postgresql:
container_name: postgres
image: postgres
restart: always
environment:
POSTGRES_DB: ${dbUserName}
POSTGRES_USER: ${dbUserName}
POSTGRES_PASSWORD: root
ports:
- 5432:5432
volumes:
- $PWD/../../../../volumes/postgresql/:/var/lib/postgresql/data
networks:
- agent_network
networks:
agent_network:
attachable: true
</#if>
\ No newline at end of file
<#ibiztemplate>
TARGET=PSSYSTEM
</#ibiztemplate>
version: "3.2"
services:
${sys.name}-redis:
image: redis
ports:
- 6379:6379
environment:
- TZ=Asia/Shanghai
logging:
driver: "json-file"
command: redis-server
networks:
- agent_network
networks:
agent_network:
attachable: true
<#ibiztemplate>
TARGET=PSSYSTEM
</#ibiztemplate>
<#assign bDynamicDS=false>
<#list sys.getAllPSDataEntities() as entity>
<#if (entity.getStorageMode()==1 || entity.getStorageMode()==2) && entity.getDSLink()!='DEFAULT'>
<#assign bDynamicDS=true>
<#break>
</#if>
</#list>
package ${pub.getPKGCodeName()};
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.boot.SpringApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import java.util.List;
import ${pub.getPKGCodeName()}.util.web.SearchContextHandlerMethodArgumentResolver;
import org.springframework.beans.factory.annotation.Autowired;
@Slf4j
@EnableDiscoveryClient
@Configuration
@EnableTransactionManagement
@EnableFeignClients(basePackages = {"${pub.getPKGCodeName()}" })
@SpringBootApplication(exclude = {
<#--<#assign bmogo=false>-->
<#--<#if sys.getAllPSDataEntities()??>-->
<#--<#list sys.getAllPSDataEntities() as de>-->
<#--<#if de.getStorageMode()?? && de.getStorageMode()==2>-->
<#--<#assign bmogo=true>-->
<#--<#break >-->
<#--</#if>-->
<#--</#list>-->
<#--</#if>-->
<#--<#if bmogo==false>-->
<#--org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration.class,-->
<#--</#if>-->
<#if bDynamicDS>
com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure.class
</#if>
})
@ComponentScan(basePackages = {"${pub.getPKGCodeName()}"}
// ,excludeFilters = {
// @ComponentScan.Filter(type= org.springframework.context.annotation.FilterType.REGEX, pattern="${pub.getPKGCodeName()}.xxx.rest.xxx"),
// }
)
@Import({
org.springframework.cloud.openfeign.FeignClientsConfiguration.class
})
@EnableAsync
@EnableScheduling
public class DevBootApplication extends WebMvcConfigurerAdapter {
@Autowired
SearchContextHandlerMethodArgumentResolver resolver;
public static void main(String[] args) {
SpringApplication.run(DevBootApplication.class, args);
}
@Override
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
super.addArgumentResolvers(argumentResolvers);
argumentResolvers.add(resolver);
}
}
<#ibiztemplate>
TARGET=PSSYSTEM
</#ibiztemplate>
package ${pub.getPKGCodeName()}.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
@Configuration
<#if pub.isEnableGlobalTransaction?? && pub.isEnableGlobalTransaction()?? && pub.isEnableGlobalTransaction()==true>
@Import({com.alibaba.cloud.seata.feign.SeataFeignClientAutoConfiguration.class})
</#if>
public class DevBootAutoConfiguration {
}
<#ibiztemplate>
TARGET=PSSYSTEM
</#ibiztemplate>
<#if sys.getSaaSMode()==4>
package ${pub.getPKGCodeName()}.config;
import com.netflix.zuul.ZuulFilter;
import com.netflix.zuul.context.RequestContext;
import com.netflix.zuul.exception.ZuulException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
@Component
@Slf4j
public class DevBootHeaderFilter extends ZuulFilter {
@Override
public String filterType() {
return "pre";
}
@Override
public int filterOrder() {
return 0;
}
@Override
public boolean shouldFilter() {
return true;
}
@Override
public Object run() throws ZuulException {
RequestContext ctx = RequestContext.getCurrentContext();
ctx.addZuulRequestHeader("srfsystem", "${sys.getCodeName()}");
return null;
}
}
</#if>
\ No newline at end of file
<#ibiztemplate>
TARGET=PSSYSTEM
</#ibiztemplate>
package ${pub.getPKGCodeName()}.config;
import ${pub.getPKGCodeName()}.util.security.AuthenticationEntryPoint;
import ${pub.getPKGCodeName()}.util.security.AuthorizationTokenFilter;
import ${pub.getPKGCodeName()}.util.service.AuthenticationUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpMethod;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.config.core.GrantedAuthorityDefaults;
import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
import org.springframework.beans.factory.annotation.Qualifier;
@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled = true)
public class DevBootSecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
private AuthenticationEntryPoint unauthorizedHandler;
@Autowired
private AuthenticationUserService userDetailsService;
/**
* 自定义基于JWT的安全过滤器
*/
@Autowired
AuthorizationTokenFilter authenticationTokenFilter;
@Value("${r'${ibiz.auth.path:v7/login}"'})
private String loginPath;
@Value("${r'${ibiz.auth.logoutpath:v7/logout}"'})
private String logoutPath;
@Value("${r'${ibiz.file.uploadpath:ibizutil/upload}"'})
private String uploadpath;
@Value("${r'${ibiz.file.downloadpath:ibizutil/download}"'})
private String downloadpath;
@Value("${r'${ibiz.file.previewpath:ibizutil/preview}"'})
private String previewpath;
@Value("${r'${ibiz.auth.excludesPattern:}"'})
private String[] excludesPattern;
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
auth
.userDetailsService(userDetailsService)
.passwordEncoder(passwordEncoderBean());
}
@Bean
GrantedAuthorityDefaults grantedAuthorityDefaults() {
// Remove the ROLE_ prefix
return new GrantedAuthorityDefaults("");
}
@Bean
public PasswordEncoder passwordEncoderBean() {
return new BCryptPasswordEncoder();
}
@Bean
@Override
public AuthenticationManager authenticationManagerBean() throws Exception {
return super.authenticationManagerBean();
}
@Override
protected void configure(HttpSecurity httpSecurity) throws Exception {
httpSecurity
// 禁用 CSRF
.csrf().disable()
// 授权异常
.exceptionHandling().authenticationEntryPoint(unauthorizedHandler).and()
// 不创建会话
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and()
// 过滤请求
.authorizeRequests()
.antMatchers(
HttpMethod.GET,
"/*.html",
"/**/*.html",
"/**/*.css",
"/**/*.js",
"/**/*.ico",
"/**/assets/**",
"/**/css/**",
"/**/fonts/**",
"/**/js/**",
"/**/img/**",
"/",
"webjars/**",
"/swagger-resources/**",
"/v2/**"
).permitAll()
//放行登录请求
.antMatchers( HttpMethod.POST, "/"+loginPath).permitAll()
//放行注销请求
.antMatchers( HttpMethod.GET, "/"+logoutPath).permitAll()
// 文件操作
.antMatchers("/"+downloadpath+"/**").permitAll()
.antMatchers("/"+uploadpath).permitAll()
.antMatchers("/"+previewpath+"/**").permitAll();
for (String excludePattern : excludesPattern) {
authenticationTokenFilter.addExcludePattern(excludePattern);
httpSecurity.authorizeRequests().antMatchers(excludePattern).permitAll();
}
httpSecurity.authorizeRequests().anyRequest().authenticated()
// 防止iframe 造成跨域
.and().headers().frameOptions().disable();
httpSecurity
.addFilterBefore(authenticationTokenFilter, UsernamePasswordAuthenticationFilter.class);
}
}
<#ibiztemplate>
TARGET=PSSYSTEM
</#ibiztemplate>
server:
port: 8080
<#assign zuul=false>
<#if item.getAllPSDataEntities?? && item.getAllPSDataEntities()??>
<#assign haswfentity=false>
<#list item.getAllPSDataEntities() as appDataEntity>
<#assign serviceId="">
<#assign serviceUrl=srfpluralize(appDataEntity.codeName?lower_case)>
<#assign appEntity=appDataEntity.name?lower_case>
<#assign psDataEntity=appDataEntity>
<#assign systemName=sys.getCodeName()?lower_case>
<#if psDataEntity.hasPSDEWF()?? && psDataEntity.hasPSDEWF()==true>
<#assign haswfentity=true>
</#if>
<#if psDataEntity.getStorageMode()==4>
<#comment>serviceApi模式</#comment>
<#assign serviceId=(psDataEntity.getPSSubSysServiceAPI().getServiceCodeName())!''>
<#assign serviceUrl=srfpluralize(appDataEntity.codeName?lower_case)>
<#if serviceId!="">
<#assign zuul=true>
</#if>
</#if>
</#list>
<#if haswfentity==true>
<#assign zuul=true>
</#if>
<#if sys.getPSSystemSetting()?? && sys.getPSSystemSetting().getDataAccCtrlArch()?? && sys.getPSSystemSetting().getDataAccCtrlArch()==1>
<#assign zuul=true>
</#if>
</#if>
<#if zuul==true && item.getAllPSDataEntities?? && item.getAllPSDataEntities()??>
#zuul网关路由设置
zuul:
routes:
<#assign haswfentity=false>
<#list item.getAllPSDataEntities() as appDataEntity>
<#assign serviceId="">
<#assign serviceUrl=srfpluralize(appDataEntity.codeName?lower_case)>
<#assign appEntity=appDataEntity.name?lower_case>
<#assign psDataEntity=appDataEntity>
<#assign systemName=sys.getCodeName()?lower_case>
<#if psDataEntity.hasPSDEWF()?? && psDataEntity.hasPSDEWF()==true>
<#assign haswfentity=true>
</#if>
<#if psDataEntity.getStorageMode()==4>
<#comment>serviceApi模式</#comment>
<#assign serviceId=(psDataEntity.getPSSubSysServiceAPI().getServiceCodeName())!''>
<#assign serviceUrl=srfpluralize(appDataEntity.name?lower_case)>
<#if serviceId!="">
<#assign serviceId="$"+"{ibiz.ref.service."+serviceId?lower_case+":"+serviceId+"}">
${appEntity}:
path: /${serviceUrl}/**
serviceId: ${serviceId}
stripPrefix: false
</#if>
</#if>
</#list>
<#if haswfentity==true>
wfcore:
path: /wfcore/**
serviceId: ${r'${ibiz.ref.service.wf:ibzwf-api}'}
stripPrefix: true
</#if>
<#if sys.getPSSystemSetting()?? && sys.getPSSystemSetting().getDataAccCtrlArch()?? && sys.getPSSystemSetting().getDataAccCtrlArch()==1>
loginv7:
path: /v7/login
serviceId: ${r'${ibiz.ref.service.uaa:ibzuaa-api}'}
stripPrefix: false
changepwd:
path: /v7/changepwd
serviceId: ${r'${ibiz.ref.service.uaa:ibzuaa-api}'}
stripPrefix: false
uaa:
path: /uaa/**
serviceId: ${r'${ibiz.ref.service.uaa:ibzuaa-api}'}
stripPrefix: false
config:
path: /configs/**
serviceId: ${r'${ibiz.ref.service.uaa:ibzuaa-api}'}
stripPrefix: false
<#if sys.getCodeName()!='ibzou' && sys.getCodeName()!='ibzrt'>
oucore:
path: /ibzorganizations/**
serviceId: ${r'${ibiz.ref.service.ou:ibzou-api}'}
stripPrefix: false
oudict:
path: /dictionarys/**/Ibzou**
serviceId: ${r'${ibiz.ref.service.ou:ibzou-api}'}
stripPrefix: false
ou:
path: /ibzdepartments/**
serviceId: ${r'${ibiz.ref.service.ou:ibzou-api}'}
stripPrefix: false
uaadict:
path: /dictionarys/**/SysOperator
serviceId: ${r'${ibiz.ref.service.uaa:ibzuaa-api}'}
stripPrefix: false
dict:
path: /dictionarys/**
serviceId: ${r'${ibiz.ref.service.dict:ibzdict-api}'}
stripPrefix: false
disk:
path: /net-disk/**
serviceId: ${r'${ibiz.ref.service.disk:ibzdisk-api}'}
stripPrefix: false
ou_sys_org:
path: /sysorganizations/**
serviceId: ${r'${ibiz.ref.service.ou:ibzou-api}'}
stripPrefix: false
ou_sys_dept:
path: /sysdepartments/**
serviceId: ${r'${ibiz.ref.service.ou:ibzou-api}'}
stripPrefix: false
lite-core:
path: /lite/**
serviceId: ${r'${ibiz.ref.service.lite:ibzlite-api}'}
stripPrefix: false
sysauthlog:
path: /sysauthlogs
serviceId: ${r'${ibiz.ref.service.uaa:ibzuaa-api}'}
stripPrefix: false
</#if>
</#if>
<#comment>通过设置该参数,避免Zuul转发请求时丢失Authorization请求头信息</#comment>
sensitive-headers:
- Cookie,Set-Cookie,Authorization
</#if>
\ No newline at end of file
<#ibiztemplate>
TARGET=PSSYSTEM
</#ibiztemplate>
<#comment>引入前端应用</#comment>
<#assign refAppYaml="">
<#if sys.getAllPSApps()??>
<#list sys.getAllPSApps() as sysApp>
<#assign refAppYaml=refAppYaml+sysApp.getPKGCodeName()?lower_case+"-dev">
<#assign refAppYaml=refAppYaml+",">
</#list>
</#if>
<#comment>引入后台服务接口</#comment>
<#assign refProviderYaml="">
<#if sys.getAllPSSysServiceAPIs()??>
<#list sys.getAllPSSysServiceAPIs() as sysapi>
<#assign refProviderYaml=refProviderYaml+sysapi.getCodeName()?lower_case+"-dev">
<#assign refProviderYaml=refProviderYaml+",">
</#list>
</#if>
spring:
profiles:
include: sys ,nacos, <#if refAppYaml!=''>${refAppYaml}</#if> <#if refProviderYaml!=''> ${refProviderYaml} </#if> dev
application:
name: ${item.getCodeName()?lower_case}
main:
allow-bean-definition-overriding: true
\ No newline at end of file
<#ibiztemplate>
TARGET=PSSYSTEM
</#ibiztemplate>
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false">
<property name="LOG_PATH" value="logs" />
<property name="LOG_PATTERN" value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%-5level] %-40.40logger{39} : %msg%n" />
<!-- 彩色日志 -->
<!-- 彩色日志依赖的渲染类 -->
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter" />
<conversionRule conversionWord="wex" converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter" />
<conversionRule conversionWord="wEx" converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter" />
<!-- 彩色日志格式 -->
<property name="LOG_PATTERN2" value="${r'${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr([${LOG_LEVEL_PATTERN:-%5p}]) %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}'}" />
<!-- 控制台输出 -->
<appender name="Console" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${r'${LOG_PATTERN}'}</pattern>
</encoder>
</appender>
<#--<!-- LOGSTASH &ndash;&gt;-->
<#--<appender name="LOGSTASH"-->
<#-- class="net.logstash.logback.appender.LogstashTcpSocketAppender">-->
<#-- <destination>172.16.102.211:9601</destination>-->
<#-- <encoder charset="UTF-8" class="net.logstash.logback.encoder.LogstashEncoder">-->
<#-- <customFields>{"appname":"${app.getPKGCodeName()?lower_case}"}</customFields>-->
<#-- </encoder>-->
<#--</appender>-->
<!-- 按照每天生成日志文件 -->
<appender name="file" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!--日志文件输出的文件名-->
<FileNamePattern>${r'${LOG_PATH}'}/${sys.getCodeName()?lower_case}.%d{yyyy-MM-dd}.%i.log</FileNamePattern>
<!--日志文件最大的大小-->
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!--日志文件保留天数-->
<MaxHistory>30</MaxHistory>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${r'${LOG_PATTERN}'}</pattern>
</encoder>
</appender>
<!-- 日志输出级别 -->
<root level="INFO">
<appender-ref ref="Console" />
<appender-ref ref="file" />
<#-- <appender-ref ref="LOGSTASH" />-->
</root>
</configuration>
<#ibiztemplate>
TARGET=PSSYSTEM
</#ibiztemplate>
<?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>
<parent>
<artifactId>${pub.getCodeName()?lower_case}</artifactId>
<groupId>${pub.getPKGCodeName()?lower_case}</groupId>
<version>${pub.getVersionString()?default("V0.0.1_alpha")}</version>
</parent>
<artifactId>${pub.getCodeName()?lower_case}-core</artifactId>
<name>${pub.getCodeName()?lower_case?cap_first} Core</name>
<description>${pub.getCodeName()?lower_case?cap_first} Core</description>
<dependencies>
<dependency>
<groupId>${pub.getPKGCodeName()?lower_case}</groupId>
<artifactId>${pub.getCodeName()?lower_case}-util</artifactId>
<version>${r'${project.version}'}</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-commons</artifactId>
</dependency>
<!-- JBPM -->
<dependency>
<groupId>org.jbpm</groupId>
<artifactId>jbpm-flow-builder</artifactId>
</dependency>
<dependency>
<groupId>org.jbpm</groupId>
<artifactId>jbpm-bpmn2</artifactId>
</dependency>
<!-- Drools -->
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-compiler</artifactId>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-core</artifactId>
</dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-spring</artifactId>
</dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-api</artifactId>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
</dependency>
<!-- MySQL数据库 -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<!-- Druid阿里连接池 -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
</dependency>
<!--MapStruct高性能属性映射工具-->
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-jdk8</artifactId>
</dependency>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
</dependency>
<!--MongoDB-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
</dependency>
<!--Liquibase数据库版本更新工具-->
<dependency>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
</dependency>
<!--baomidou-jobs定时服务 -->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>jobs-spring-boot-starter</artifactId>
</dependency>
<#if pub.isEnableGlobalTransaction?? && pub.isEnableGlobalTransaction()?? && pub.isEnableGlobalTransaction()==true>
<!-- 阿里seata分布式事务 -->
<dependency>
<groupId>io.seata</groupId>
<artifactId>seata-spring-boot-starter</artifactId>
<exclusions>
<exclusion>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-seata</artifactId>
<exclusions>
<exclusion>
<groupId>io.seata</groupId>
<artifactId>seata-spring-boot-starter</artifactId>
</exclusion>
</exclusions>
</dependency>
</#if>
</dependencies>
<properties>
<maven.build.timestamp.format>yyyyMMddHHmmss</maven.build.timestamp.format>
</properties>
<profiles>
<profile>
<id>diff</id>
<build>
<plugins>
<plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<version>${r'${liquibase.version}'}</version>
<executions>
<execution>
<id>prepare-newdb</id>
<configuration>
<changeLogFile>${r'${project.basedir}'}/src/main/resources/liquibase/h2_table.xml</changeLogFile>
<driver>org.h2.Driver</driver>
<url>jdbc:h2:file:${r'${project.build.directory}'}/db/new;MODE=mysql</url>
<username>root</username>
<dropFirst>true</dropFirst>
</configuration>
<phase>process-resources</phase>
<goals>
<goal>update</goal>
</goals>
</execution>
<execution>
<id>prepare-olddb</id>
<configuration>
<changeLogFile>${r'${project.basedir}'}/src/main/resources/liquibase/master_table.xml</changeLogFile>
<driver>org.h2.Driver</driver>
<url>jdbc:h2:file:${r'${project.build.directory}'}/db/last;MODE=mysql</url>
<username>root</username>
<dropFirst>true</dropFirst>
</configuration>
<phase>process-resources</phase>
<goals>
<goal>update</goal>
</goals>
</execution>
<execution>
<id>make-diff</id>
<configuration>
<changeLogFile>${r'${project.basedir}'}/src/main/resources/liquibase/empty.xml</changeLogFile>
<diffChangeLogFile>${r'${project.basedir}'}/src/main/resources/liquibase/changelog/${r'${maven.build.timestamp}'}_changelog.xml</diffChangeLogFile>
<driver>org.h2.Driver</driver>
<url>jdbc:h2:file:${r'${project.build.directory}'}/db/last;MODE=mysql</url>
<username>root</username>
<password></password>
<referenceUrl>jdbc:h2:file:${r'${project.build.directory}'}/db/new;MODE=mysql</referenceUrl>
<referenceDriver>org.h2.Driver</referenceDriver>
<referenceUsername>root</referenceUsername>
<verbose>true</verbose>
<logging>debug</logging>
<contexts>!test</contexts>
<diffExcludeObjects>Index:.*,table:ibzfile,ibzuser,ibzdataaudit,ibzcfg,IBZFILE,IBZUSER,IBZDATAAUDIT,IBZCFG</diffExcludeObjects>
</configuration>
<phase>process-resources</phase>
<goals>
<goal>diff</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
<#ibiztemplate>
TARGET=PSSUBSYSSERVICEAPIDE
</#ibiztemplate>
<#assign refDE=sys.getPSDataEntity(item.name)>
<#if refDE??>
package ${pub.getPKGCodeName()}.core.${refDE.getPSSystemModule().getCodeName()?lower_case}.client;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.web.bind.annotation.*;
import ${pub.getPKGCodeName()}.core.${refDE.getPSSystemModule().getCodeName()?lower_case}.domain.${refDE.getCodeName()};
import ${pub.getPKGCodeName()}.core.${refDE.getPSSystemModule().getCodeName()?lower_case}.filter.${refDE.getCodeName()}SearchContext;
import org.springframework.stereotype.Component;
<#if item.getPSSubSysServiceAPI().getServicePath()??>
<#if item.getPSSubSysServiceAPI().getServicePath() != '' >
<#assign fullpath= item.getPSSubSysServiceAPI().getServicePath() + "/" + srfpluralize(item.getCodeName()?lower_case) >
<#else>
<#assign fullpath="/" + item.getPSSubSysServiceAPI().getCodeName()?lower_case + "/" + srfpluralize(item.getCodeName()?lower_case) >
</#if>
<#else>
<#assign fullpath="/" + item.getPSSubSysServiceAPI().getCodeName()?lower_case + "/" + srfpluralize(item.getCodeName()?lower_case) >
</#if>
/**
* 实体[${item.codeName}] 服务对象接口
*/
@Component
public class ${item.codeName}Fallback implements ${item.codeName}FeignClient {
<#if item.getPSSubSysServiceAPIDEMethods()??>
<#list item.getPSSubSysServiceAPIDEMethods() as apiMethod>
<#assign req_param_type=(apiMethod.getRequestParamType()!'')>
<#assign req_param=(apiMethod.getRequestField()!'')>
<#assign retval_type=(apiMethod.getRetvalType())!''>
<#assign return_type='void'>
<#if return_type?? && return_type!='' && retval_type !='VOID' && retval_type='ENTITY' ><#comment>由于无法获取到返回值类型,暂时通过请求参数类型确定返回值类型</#comment>
<#assign return_type=item.codeName>
</#if>
<#if apiMethod.getActionType()=='DEACTION'><#comment>实体行为</#comment>
<#-- ${return_type} ${srfmethodname(apiMethod.getCodeName())}(<#if req_param_type?? && req_param_type=='ENTITY'><#if apiMethod.getPSDEName()??>${apiMethod.getPSDEName()} entity</#if></#if>); -->
<#if apiMethod.getCodeName()?lower_case == 'get'>
<#--@RequestMapping(method = RequestMethod.<#if apiMethod.getRequestMethod()??>${apiMethod.getRequestMethod()}<#else>POST</#if>, value = "${fullpath}/{${item.getKeyDEField().getCodeName()?lower_case}}")-->
public ${refDE.codeName} get(${srfr7javatype(refDE.getKeyDEField().stdDataType)} ${refDE.getKeyDEField().getCodeName()?lower_case}) {
return null;
}
<#elseif apiMethod.getCodeName()?lower_case == 'remove'>
<#--@RequestMapping(method = RequestMethod.<#if apiMethod.getRequestMethod()??>${apiMethod.getRequestMethod()}<#else>POST</#if>, value = "${fullpath}/{${item.getKeyDEField().getCodeName()?lower_case}}")-->
public Boolean remove(${srfr7javatype(refDE.getKeyDEField().stdDataType)} ${refDE.getKeyDEField().getCodeName()?lower_case}) {
return false;
}
<#--@RequestMapping(method = RequestMethod.<#if apiMethod.getRequestMethod()??>${apiMethod.getRequestMethod()}<#else>POST</#if>, value = "${fullpath}/${apiMethod.getCodeName()?lower_case}")-->
public Boolean removeBatch(Collection<${srfr7javatype(refDE.getKeyDEField().stdDataType)}> idList) {
return false;
}
<#elseif apiMethod.getCodeName()?lower_case == 'create'>
<#--@RequestMapping(method = RequestMethod.<#if apiMethod.getRequestMethod()??>${apiMethod.getRequestMethod()}<#else>POST</#if>, value = "${fullpath}")-->
public ${refDE.codeName} create(${refDE.codeName} ${refDE.codeName?lower_case}) {
return null;
}
<#--@RequestMapping(method = RequestMethod.<#if apiMethod.getRequestMethod()??>${apiMethod.getRequestMethod()}<#else>POST</#if>, value = "${fullpath}/${apiMethod.getCodeName()?lower_case}")-->
public Boolean createBatch(List<${refDE.codeName}> ${srfpluralize(refDE.getCodeName()?lower_case)}) {
return false;
}
<#elseif apiMethod.getCodeName()?lower_case == 'save'>
<#--@RequestMapping(method = RequestMethod.<#if apiMethod.getRequestMethod()??>${apiMethod.getRequestMethod()}<#else>POST</#if>, value = "${fullpath}")-->
public Object saveEntity(${refDE.codeName} ${refDE.codeName?lower_case}) {
return null;
}
public Boolean save(${refDE.codeName} ${refDE.codeName?lower_case}) {
return false;
}
<#--@RequestMapping(method = RequestMethod.<#if apiMethod.getRequestMethod()??>${apiMethod.getRequestMethod()}<#else>POST</#if>, value = "${fullpath}/${apiMethod.getCodeName()?lower_case}")-->
public Boolean saveBatch(List<${refDE.codeName}> ${srfpluralize(refDE.getCodeName()?lower_case)}) {
return false;
}
<#elseif apiMethod.getCodeName()?lower_case == 'update'>
<#--@RequestMapping(method = RequestMethod.<#if apiMethod.getRequestMethod()??>${apiMethod.getRequestMethod()}<#else>POST</#if>, value = "${fullpath}/{${item.getKeyDEField().getCodeName()?lower_case}}")-->
public ${refDE.codeName} update(${srfr7javatype(refDE.getKeyDEField().stdDataType)} ${refDE.getKeyDEField().getCodeName()?lower_case}, ${refDE.codeName} ${refDE.codeName?lower_case}) {
return null;
}
<#--@RequestMapping(method = RequestMethod.<#if apiMethod.getRequestMethod()??>${apiMethod.getRequestMethod()}<#else>POST</#if>, value = "${fullpath}/${apiMethod.getCodeName()?lower_case}")-->
public Boolean updateBatch(List<${refDE.codeName}> ${srfpluralize(refDE.getCodeName()?lower_case)}) {
return false;
}
<#elseif apiMethod.getCodeName()?lower_case == 'getdraft'>
public ${refDE.codeName} getDraft(${refDE.codeName} entity){
return null;
}
<#elseif apiMethod.getCodeName()?lower_case == 'checkkey'>
public Boolean checkKey(${refDE.codeName} ${refDE.codeName?lower_case}) {
return false;
}
<#elseif apiMethod.getCodeName()?lower_case == 'createbatch'>
<#elseif apiMethod.getCodeName()?lower_case == 'updatebatch'>
<#elseif apiMethod.getCodeName()?lower_case == 'removebatch'>
<#elseif apiMethod.getCodeName()?lower_case == 'savebatch'>
<#else>
<#--@RequestMapping(method = RequestMethod.<#if apiMethod.getRequestMethod()??>${apiMethod.getRequestMethod()}<#else>POST</#if>, value = "${fullpath}/{${item.getKeyDEField().getCodeName()?lower_case}}/${apiMethod.getCodeName()?lower_case}")-->
public ${refDE.codeName} ${apiMethod.getCodeName()?uncap_first}( ${srfr7javatype(refDE.getKeyDEField().stdDataType)} ${refDE.getKeyDEField().getCodeName()?lower_case}, ${refDE.codeName} ${refDE.codeName?lower_case}) {
return null;
}
</#if>
<#elseif apiMethod.getActionType()=='SELECT'><#comment>简单查询</#comment>
<#-- List<${item.codeName}> ${srfmethodname(apiMethod.getCodeName())}(<#if req_param_type?? && req_param_type=='ENTITY'><#if apiMethod.getPSDEName()??>${apiMethod.getPSDEName()} entity</#if></#if>); -->
<#--@RequestMapping(method = RequestMethod.<#if apiMethod.getRequestMethod()??>${apiMethod.getRequestMethod()}<#else>POST</#if>, value = "${fullpath}/${apiMethod.getCodeName()?lower_case}")-->
public Page<${refDE.codeName}> ${apiMethod.getCodeName()?uncap_first}() {
return null;
}
<#elseif apiMethod.getActionType()=='FETCH'><#comment>数据集合</#comment>
<#--@RequestMapping(method = RequestMethod.<#if apiMethod.getRequestMethod()??>${apiMethod.getRequestMethod()}<#else>POST</#if>, value = "${fullpath}/${apiMethod.getCodeName()?lower_case}")-->
public Page<${refDE.codeName}> ${apiMethod.getCodeName()?uncap_first?replace("fetch","search")}(${refDE.getCodeName()}SearchContext context) {
return null;
}
<#elseif apiMethod.getActionType()=='USER'><#comment>用户自定义</#comment>
public void ${apiMethod.getCodeName()?uncap_first}() {
return null;
}
</#if>
</#list>
</#if>
}
</#if>
<#ibiztemplate>
TARGET=PSSUBSYSSERVICEAPIDE
</#ibiztemplate>
<#assign refDE=sys.getPSDataEntity(item.name)>
<#if refDE??>
package ${pub.getPKGCodeName()}.core.${refDE.getPSSystemModule().getCodeName()?lower_case}.client;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.web.bind.annotation.*;
import ${pub.getPKGCodeName()}.core.${refDE.getPSSystemModule().getCodeName()?lower_case}.domain.${refDE.getCodeName()};
import ${pub.getPKGCodeName()}.core.${refDE.getPSSystemModule().getCodeName()?lower_case}.filter.${refDE.getCodeName()}SearchContext;
import org.springframework.cloud.openfeign.FeignClient;
<#if item.getPSSubSysServiceAPI().getServicePath()?? && item.getPSSubSysServiceAPI().getServicePath() != ''>
<#assign fullpath= item.getPSSubSysServiceAPI().getServicePath() + "/" + srfpluralize(item.getCodeName()?lower_case) >
<#else>
<#assign fullpath="/" + srfpluralize(item.getCodeName()?lower_case) >
</#if>
<#comment>contextId存在下划线时,项目运行报错,模板中转中划线处理</#comment>
<#assign contextId=item.codeName?replace("_","-")>
<#if ((item.getPSSubSysServiceAPI().getServiceCodeName())!'')!=''>
<#assign serviceId="$"+"{ibiz.ref.service."+item.getPSSubSysServiceAPI().getServiceCodeName()?lower_case+":"+item.getPSSubSysServiceAPI().getServiceCodeName()+"}">
<#else>
<#assign serviceId="$"+"{ibiz.ref.service."+item.getPSSubSysServiceAPI().codeName?lower_case+":}">
</#if>
/**
* 实体[${item.codeName}] 服务对象接口
*/
@FeignClient(value = "${serviceId}", contextId = "${contextId}", fallback = ${item.codeName}Fallback.class)
public interface ${item.codeName}FeignClient {
<#if item.getPSSubSysServiceAPIDEMethods()??>
<#list item.getPSSubSysServiceAPIDEMethods() as apiMethod>
<#assign req_param_type=(apiMethod.getRequestParamType()!'')>
<#assign req_param=(apiMethod.getRequestField()!'')>
<#assign retval_type=(apiMethod.getRetvalType())!''>
<#assign return_type='void'>
<#if return_type?? && return_type!='' && retval_type !='VOID' && retval_type='ENTITY' ><#comment>由于无法获取到返回值类型,暂时通过请求参数类型确定返回值类型</#comment>
<#assign return_type=item.codeName>
</#if>
<#if apiMethod.getActionType()=='DEACTION'><#comment>实体行为</#comment>
<#-- ${return_type} ${srfmethodname(apiMethod.getCodeName())}(<#if req_param_type?? && req_param_type=='ENTITY'><#if apiMethod.getPSDEName()??>${apiMethod.getPSDEName()} entity</#if></#if>); -->
<#if apiMethod.getCodeName()?lower_case == 'get'>
@RequestMapping(method = RequestMethod.<#if apiMethod.getRequestMethod()??>${apiMethod.getRequestMethod()}<#else>POST</#if>, value = "${fullpath}/{${refDE.getKeyDEField().getCodeName()?lower_case}}")
${refDE.codeName} get(@PathVariable("${refDE.getKeyDEField().getCodeName()?lower_case}") ${srfr7javatype(refDE.getKeyDEField().stdDataType)} ${refDE.getKeyDEField().getCodeName()?lower_case});
<#elseif apiMethod.getCodeName()?lower_case == 'remove'>
@RequestMapping(method = RequestMethod.<#if apiMethod.getRequestMethod()??>${apiMethod.getRequestMethod()}<#else>POST</#if>, value = "${fullpath}/{${refDE.getKeyDEField().getCodeName()?lower_case}}")
Boolean remove(@PathVariable("${refDE.getKeyDEField().getCodeName()?lower_case}") ${srfr7javatype(refDE.getKeyDEField().stdDataType)} ${refDE.getKeyDEField().getCodeName()?lower_case});
@RequestMapping(method = RequestMethod.DELETE, value = "${fullpath}/batch}")
Boolean removeBatch(@RequestBody Collection<${srfr7javatype(refDE.getKeyDEField().stdDataType)}> idList);
<#elseif apiMethod.getCodeName()?lower_case == 'create'>
@RequestMapping(method = RequestMethod.<#if apiMethod.getRequestMethod()??>${apiMethod.getRequestMethod()}<#else>POST</#if>, value = "${fullpath}")
${refDE.codeName} create(@RequestBody ${refDE.codeName} ${refDE.codeName?lower_case});
@RequestMapping(method = RequestMethod.POST, value = "${fullpath}/batch")
Boolean createBatch(@RequestBody List<${refDE.codeName}> ${srfpluralize(refDE.getCodeName()?lower_case)});
<#elseif apiMethod.getCodeName()?lower_case == 'save'>
@RequestMapping(method = RequestMethod.<#if apiMethod.getRequestMethod()??>${apiMethod.getRequestMethod()}<#else>POST</#if>, value = "${fullpath}/save")
Object saveEntity(@RequestBody ${refDE.codeName} ${refDE.codeName?lower_case});
default Boolean save(@RequestBody ${refDE.codeName} ${refDE.codeName?lower_case}) { return saveEntity(${refDE.codeName?lower_case})!=null; }
@RequestMapping(method = RequestMethod.<#if apiMethod.getRequestMethod()??>${apiMethod.getRequestMethod()}<#else>POST</#if>, value = "${fullpath}/savebatch")
Boolean saveBatch(@RequestBody List<${refDE.codeName}> ${srfpluralize(refDE.getCodeName()?lower_case)});
<#elseif apiMethod.getCodeName()?lower_case == 'getdraft'>
@RequestMapping(method = RequestMethod.GET, value = "${fullpath}/getdraft")
${refDE.codeName} getDraft(${refDE.codeName} entity);
<#elseif apiMethod.getCodeName()?lower_case == 'checkkey'>
@RequestMapping(method = RequestMethod.POST, value = "${fullpath}/checkkey")
Boolean checkKey(@RequestBody ${refDE.codeName} ${refDE.codeName?lower_case});
<#elseif apiMethod.getCodeName()?lower_case == 'update'>
@RequestMapping(method = RequestMethod.<#if apiMethod.getRequestMethod()??>${apiMethod.getRequestMethod()}<#else>POST</#if>, value = "${fullpath}/{${refDE.getKeyDEField().getCodeName()?lower_case}}")
${refDE.codeName} update(@PathVariable("${refDE.getKeyDEField().getCodeName()?lower_case}") ${srfr7javatype(refDE.getKeyDEField().stdDataType)} ${refDE.getKeyDEField().getCodeName()?lower_case},@RequestBody ${refDE.codeName} ${refDE.codeName?lower_case});
@RequestMapping(method = RequestMethod.PUT, value = "${fullpath}/batch")
Boolean updateBatch(@RequestBody List<${refDE.codeName}> ${srfpluralize(refDE.getCodeName()?lower_case)});
<#elseif apiMethod.getCodeName()?lower_case == 'createbatch'>
<#elseif apiMethod.getCodeName()?lower_case == 'updatebatch'>
<#elseif apiMethod.getCodeName()?lower_case == 'removebatch'>
<#elseif apiMethod.getCodeName()?lower_case == 'savebatch'>
<#else>
@RequestMapping(method = RequestMethod.<#if apiMethod.getRequestMethod()??>${apiMethod.getRequestMethod()}<#else>POST</#if>, value = "${fullpath}/{${refDE.getKeyDEField().getCodeName()?lower_case}}/${apiMethod.getCodeName()?lower_case}")
${refDE.codeName} ${apiMethod.getCodeName()?uncap_first}(@PathVariable("${refDE.getKeyDEField().getCodeName()?lower_case}") ${srfr7javatype(refDE.getKeyDEField().stdDataType)} ${refDE.getKeyDEField().getCodeName()?lower_case},@RequestBody ${refDE.codeName} ${refDE.codeName?lower_case});
</#if>
<#elseif apiMethod.getActionType()=='SELECT'><#comment>简单查询</#comment>
<#-- List<${item.codeName}> ${srfmethodname(apiMethod.getCodeName())}(<#if req_param_type?? && req_param_type=='ENTITY'><#if apiMethod.getPSDEName()??>${apiMethod.getPSDEName()} entity</#if></#if>); -->
@RequestMapping(method = RequestMethod.<#if apiMethod.getRequestMethod()??>${apiMethod.getRequestMethod()}<#else>POST</#if>, value = "${fullpath}/${apiMethod.getCodeName()?lower_case}")
Page<${refDE.codeName}> ${apiMethod.getCodeName()?uncap_first}();
<#elseif apiMethod.getActionType()=='FETCH'><#comment>数据集合</#comment>
@RequestMapping(method = RequestMethod.POST, value = "${fullpath}/${apiMethod.getCodeName()?lower_case?replace("fetch","search")}")
Page<${refDE.codeName}> ${apiMethod.getCodeName()?uncap_first?replace("fetch","search")}(@RequestBody ${refDE.getCodeName()}SearchContext context);
<#elseif apiMethod.getActionType()=='USER'><#comment>用户自定义</#comment>
void ${apiMethod.getCodeName()?uncap_first}();
</#if>
</#list>
</#if>
}
</#if>
<#ibiztemplate>
TARGET=PSDATAENTITY
</#ibiztemplate>
<#assign needconv = false>
<#if de.getStorageMode()==0>
<#comment>判断无存储实体中的外键是否有物理化bson主表字段,有则需要输出类型转换器</#comment>
<#if item.getMinorPSDERs?? && item.getMinorPSDERs()??>
<#list item.getMinorPSDERs() as MinorPSDER>
<#if MinorPSDER?? && MinorPSDER.getDERType()=='DER1N'>
<#if MinorPSDER.getMajorPSDataEntity?? && MinorPSDER.getMajorPSDataEntity()?? && MinorPSDER.getCodeName?? && MinorPSDER.getCodeName()??>
<#assign MajorEntity = MinorPSDER.getMajorPSDataEntity()>
<#if MajorEntity.getCodeName?? && MinorPSDER.getCodeName()?? && MajorEntity.getStorageMode()==1>
<#if MinorPSDER.getPSOne2ManyDataDEField()?? && MinorPSDER.getPSOne2ManyDataDEField().isPhisicalDEField()==true>
<#assign needconv=true>
</#if>
</#if>
</#if>
</#if>
</#list>
</#if>
</#if>
<#if needconv==true>
package ${pub.getPKGCodeName()}.core.${item.getPSSystemModule().getCodeName()?lower_case}.domain.handlers;
import ${pub.getPKGCodeName()}.core.${item.getPSSystemModule().getCodeName()?lower_case}.domain.${item.getCodeName()};
import com.baomidou.mybatisplus.extension.handlers.AbstractJsonTypeHandler;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.type.JdbcType;
import org.apache.ibatis.type.MappedJdbcTypes;
import org.apache.ibatis.type.MappedTypes;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
@Slf4j
@MappedTypes({List.class})
@MappedJdbcTypes(JdbcType.VARCHAR)
public class ${item.getCodeName()}TypeHandler extends AbstractJsonTypeHandler<List>
{
private static ObjectMapper objectMapper = new ObjectMapper();
private JavaType type;
public ${item.getCodeName()}TypeHandler(Class<List> type) {
this.type = objectMapper.getTypeFactory().constructParametricType(ArrayList.class, ${item.getCodeName()}.class);
}
@Override
protected List parse(String json) {
try {
return objectMapper.readValue(json, type);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
@Override
protected String toJson(List obj) {
try {
return objectMapper.writeValueAsString(obj);
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
}
public static void setObjectMapper(ObjectMapper objectMapper) {
${item.getCodeName()}TypeHandler.objectMapper = objectMapper;
}
}
</#if>
<#ibiztemplate>
TARGET=PSDATAENTITY
</#ibiztemplate>
<#if de.getStorageMode()==1>
<#comment>引入驼峰配置</#comment>
<#ibizinclude>/SLN/globalfunc.cfg</#ibizinclude>
package ${pub.getPKGCodeName()}.core.${item.getPSSystemModule().codeName?lower_case}.mapper;
import java.util.List;
import org.apache.ibatis.annotations.*;
import java.util.Map;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import java.util.Map;
import org.apache.ibatis.annotations.Select;
import ${pub.getPKGCodeName()}.core.${item.getPSSystemModule().codeName?lower_case}.domain.${item.getCodeName()};
import ${pub.getPKGCodeName()}.core.${de.getPSSystemModule().getCodeName()?lower_case}.filter.${de.codeName}SearchContext;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import java.io.Serializable;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.alibaba.fastjson.JSONObject;
<#if item.getDSLink?? && item.getDSLink()??>
<#if item.getDSLink()!='DEFAULT'>
@com.baomidou.dynamic.datasource.annotation.DS("${item.getDSLink()?lower_case}")
</#if>
</#if>
public interface ${item.getCodeName()}Mapper extends BaseMapper<${item.getCodeName()}> {
<#if item.getAllPSDEDataSets()??>
<#list item.getAllPSDEDataSets() as dedataset>
Page<<#if dedataset.isEnableGroup()>Map<#else>${item.getCodeName()}</#if>> search${dedataset.getCodeName()}(IPage page, @Param("srf") ${de.codeName}SearchContext context, @Param("ew") Wrapper<${item.getCodeName()}> wrapper);
</#list>
</#if>
<#assign keyfieldCodeName=srfr7templcaseformat(item.getKeyPSDEField().codeName)>
@Override
<#if item.isEnableEntityCache()==true>
@Cacheable(value ="${item.codeName?lower_case}", key = "'row:'+#p0")
</#if>
${item.getCodeName()} selectById(Serializable id);
@Override
<#if item.isEnableEntityCache()==true>
@CacheEvict(value ="${item.codeName?lower_case}", key = "'row:'+#p0.${keyfieldCodeName}")
</#if>
int insert(${item.getCodeName()} entity);
@Override
<#if item.isEnableEntityCache()==true>
@CacheEvict(value ="${item.codeName?lower_case}", key = "'row:'+#p0.${keyfieldCodeName}")
</#if>
int updateById(@Param(Constants.ENTITY) ${item.getCodeName()} entity);
@Override
<#if item.isEnableEntityCache()==true>
@CacheEvict(value ="${item.codeName?lower_case}", key = "'row:'+#p0.${keyfieldCodeName}")
</#if>
int update(@Param(Constants.ENTITY) ${item.getCodeName()} entity, @Param("ew") Wrapper<${item.codeName}> updateWrapper);
@Override
<#if item.isEnableEntityCache()==true>
@CacheEvict(value ="${item.codeName?lower_case}", key = "'row:'+#p0")
</#if>
int deleteById(Serializable id);
/**
* 自定义查询SQL
* @param sql
* @return
*/
@Select("${r'${sql}'}")
List<JSONObject> selectBySQL(@Param("sql") String sql, @Param("et")Map param);
/**
* 自定义更新SQL
* @param sql
* @return
*/
@Update("${r'${sql}'}")
boolean updateBySQL(@Param("sql") String sql, @Param("et")Map param);
/**
* 自定义插入SQL
* @param sql
* @return
*/
@Insert("${r'${sql}'}")
boolean insertBySQL(@Param("sql") String sql, @Param("et")Map param);
/**
* 自定义删除SQL
* @param sql
* @return
*/
@Delete("${r'${sql}'}")
boolean deleteBySQL(@Param("sql") String sql, @Param("et")Map param);
<#comment>1N关系中,在子实体中创建父实体的实例对象</#comment>
<#if de.getMinorPSDERs?? && de.getMinorPSDERs()??>
<#list de.getMinorPSDERs() as MinorPSDER>
<#if MinorPSDER?? && MinorPSDER.getDERType()=='DER1N'>
<#if MinorPSDER.getMajorPSDataEntity?? && MinorPSDER.getMajorPSDataEntity()??>
<#assign MajorEntity = MinorPSDER.getMajorPSDataEntity()>
<#if MajorEntity.name?? && MinorPSDER.getCodeName()?? >
<#if MinorPSDER.getPSPickupDEField?? && MinorPSDER.getPSPickupDEField()??>
<#assign MajorkeyField = MajorEntity.getKeyPSDEField()>
<#assign MajorField = MinorPSDER.getPSPickupDEField()>
<#if de.getDefaultPSDEDataSet()??>
<#assign deDefaultDataSet=de.getDefaultPSDEDataSet()>
<#if deDefaultDataSet.getPSDEDataQueries()??>
List<${item.getCodeName()}> selectBy${srfr7templcaseformat(MajorField.codeName)?cap_first}(@Param("${MajorkeyField.codeName?lower_case}") Serializable ${MajorkeyField.codeName?lower_case});
</#if>
</#if>
</#if>
</#if>
</#if>
</#if>
</#list>
</#if>
}
</#if>
\ No newline at end of file
<#ibiztemplate>
TARGET=PSDEDATAIMP
</#ibiztemplate>
<#comment>引入驼峰配置</#comment>
<#ibizinclude>/SLN/globalfunc.cfg</#ibizinclude>
package ${pub.getPKGCodeName()}.core.${de.getPSSystemModule().codeName?lower_case}.mapping;
import ${pub.getPKGCodeName()}.core.${de.getPSSystemModule().codeName?lower_case}.domain.${de.codeName};
import org.mapstruct.*;
import java.util.List;
@Mapper(componentModel = "spring", uses = {})
public interface ${de.codeName}${item.codeName} {
<#assign keyFieldName=srfr7templcaseformat(de.getKeyPSDEField().getCodeName())>
<#if item.getPSDEDataImportItems?? && item.getPSDEDataImportItems()??>
@Mappings({
@Mapping(target = "${keyFieldName}", source = "${keyFieldName}"),
<#list item.getPSDEDataImportItems() as importItem>
<#if importItem.getPSDEField()?? && importItem.getPSDEField().isKeyDEField()==false>
<#assign deFieldName = srfr7templcaseformat(importItem.getPSDEField().getCodeName())>
@Mapping(target = "${deFieldName}", source = "${deFieldName}"),
</#if>
</#list>
})
@BeanMapping(ignoreByDefault = true)
</#if>
${de.codeName} toDomain(${de.codeName} entity);
List<${de.codeName}> toDomain(List<${de.codeName}> entities);
}
\ No newline at end of file
<#ibiztemplate>
TARGET=PSDATAENTITY
</#ibiztemplate>
<#if de.getUserTag()?? && de.getUserTag()=='elasticsearch'>
package ${pub.getPKGCodeName()}.core.${de.getPSSystemModule().codeName?lower_case}.mapping;
import ${pub.getPKGCodeName()}.core.${de.getPSSystemModule().codeName?lower_case}.domain.${item.codeName};
import org.mapstruct.Mapper;
import org.mapstruct.NullValueCheckStrategy;
import org.mapstruct.NullValuePropertyMappingStrategy;
import java.util.List;
@Mapper(componentModel = "spring", uses = {},
nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE,
nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS)
public interface ${item.codeName}ESMapping{
${item.codeName} toDomain(${pub.getPKGCodeName()}.core.es.domain.${item.codeName} esEntity);
${pub.getPKGCodeName()}.core.es.domain.${item.codeName} toESDomain(${item.codeName} entity);
List<${item.codeName}> toDomain(List<${pub.getPKGCodeName()}.core.es.domain.${item.codeName}> esEntityList);
List<${pub.getPKGCodeName()}.core.es.domain.${item.codeName}> toESDomain(List<${item.codeName}> entityList);
}
</#if>
<#ibiztemplate>
TARGET=PSDATAENTITY
</#ibiztemplate>
<#comment>引入驼峰配置</#comment>
<#ibizinclude>/SLN/globalfunc.cfg</#ibizinclude>
<#comment>索引从实体</#comment>
<#assign isIndexSubDE=false>
<#if de.getMinorPSDERs()??>
<#comment>判断当前实体是否为索引子实体或继承子实体</#comment>
<#assign isIndexSubDE=false>
<#if de.getMinorPSDERs()??>
<#list de.getMinorPSDERs() as MinorPSDER>
<#if MinorPSDER.getDERType()?? && MinorPSDER.getMajorPSDataEntity()??>
<#comment>继承关系、索引关系 (包含分组属性)</#comment>
<#if MinorPSDER.getDERType()=="DERINHERIT" || (MinorPSDER.getDERType()=="DERINDEX" ) && MinorPSDER.getMajorPSDataEntity().getIndexTypePSDEField()??>
<#assign isIndexSubDE=true>
<#assign indexPSDER=MinorPSDER>
<#break>
</#if>
</#if>
</#list>
</#if>
<#if isIndexSubDE && indexPSDER??>
<#comment>索引主实体</#comment>
<#assign majorIndexDE=indexPSDER.getMajorPSDataEntity()>
<#assign majorIndexDECodeName=indexPSDER.getMajorPSDataEntity().codeName>
<#assign majorIndexDECodeNameCamel = srfr7templcaseformat(majorIndexDECodeName)?cap_first>
<#assign majorIndexDEKeyFieldCodeName=srfr7templcaseformat(majorIndexDE.getKeyPSDEField().codeName)>
<#assign majorIndexDEMajorTextFieldCodeName=srfr7templcaseformat(majorIndexDE.getMajorPSDEField().codeName)>
<#assign MinorIndexDECodeName=de.codeName>
<#assign MinorIndexDECodeNameCamel = srfr7templcaseformat(MinorIndexDECodeName)?cap_first>
<#assign MinorIndexDEKeyFieldCodeName=srfr7templcaseformat(de.getKeyPSDEField().codeName)>
<#assign MinorIndexDEMajorTextFieldCodeName=srfr7templcaseformat(de.getMajorPSDEField().codeName)>
package ${pub.getPKGCodeName()}.core.${de.getPSSystemModule().codeName?lower_case}.mapping;
import org.mapstruct.*;
import ${pub.getPKGCodeName()}.core.${de.getPSSystemModule().getCodeName()?lower_case}.domain.${de.codeName};
import ${pub.getPKGCodeName()}.core.${majorIndexDE.getPSSystemModule().getCodeName()?lower_case}.domain.${majorIndexDE.codeName};
import java.util.List;
@Mapper(componentModel = "spring", uses = {})
public interface ${de.codeName}InheritMapping {
@Mappings({
@Mapping(source ="${MinorIndexDEKeyFieldCodeName}",target = "${majorIndexDEKeyFieldCodeName}"),
@Mapping(source ="${MinorIndexDEMajorTextFieldCodeName}",target = "${majorIndexDEMajorTextFieldCodeName}"),
@Mapping(target ="focusNull",ignore = true),
<#if indexPSDER.getPSDERIndexDEFieldMaps?? && indexPSDER.getPSDERIndexDEFieldMaps()??>
<#list indexPSDER.getPSDERIndexDEFieldMaps() as indexFieldmapping>
<#comment>排除主键及主文本属性</#comment>
<#if indexFieldmapping.getMajorPSDEField()?? && indexFieldmapping.getMinorPSDEField()??>
<#assign majorDEField=indexFieldmapping.getMajorPSDEField()>
<#assign MinorDEField=indexFieldmapping.getMinorPSDEField()>
<#if majorDEField.isKeyDEField()==false && MinorDEField.isKeyDEField()==false && majorDEField.isMajorDEField()==false && MinorDEField.isMajorDEField()==false>
<#if !P.exists(MinorDEField.codeName,majorDEField.codeName)>
@Mapping(source ="${srfr7templcaseformat(MinorDEField.codeName)}",target = "${srfr7templcaseformat(majorDEField.codeName)}"),
</#if>
</#if>
</#if>
</#list>
</#if>
})
${majorIndexDECodeName} to${majorIndexDECodeNameCamel}(${MinorIndexDECodeName} minorEntity);
@Mappings({
@Mapping(source ="${majorIndexDEKeyFieldCodeName}" ,target = "${MinorIndexDEKeyFieldCodeName}"),
@Mapping(source ="${majorIndexDEMajorTextFieldCodeName}" ,target = "${MinorIndexDEMajorTextFieldCodeName}"),
@Mapping(target ="focusNull",ignore = true),
<#if indexPSDER.getPSDERIndexDEFieldMaps()??>
<#list indexPSDER.getPSDERIndexDEFieldMaps() as indexFieldmapping>
<#comment>排除主键及主文本属性</#comment>
<#if indexFieldmapping.getMajorPSDEField()?? && indexFieldmapping.getMinorPSDEField()??>
<#assign majorDEField=indexFieldmapping.getMajorPSDEField()>
<#assign MinorDEField=indexFieldmapping.getMinorPSDEField()>
<#if majorDEField.isKeyDEField()==false && MinorDEField.isKeyDEField()==false && majorDEField.isMajorDEField()==false && MinorDEField.isMajorDEField()==false>
<#if !P.exists(majorDEField.codeName,MinorDEField.codeName)>
@Mapping(source ="${srfr7templcaseformat(majorDEField.codeName)}",target = "${srfr7templcaseformat(MinorDEField.codeName)}"),
</#if>
</#if>
</#if>
</#list>
</#if>
})
${MinorIndexDECodeName} to${MinorIndexDECodeNameCamel}(${majorIndexDECodeName} majorEntity);
List<${majorIndexDECodeName}> to${majorIndexDECodeNameCamel}(List<${MinorIndexDECodeName}> minorEntities);
List<${MinorIndexDECodeName}> to${MinorIndexDECodeNameCamel}(List<${majorIndexDECodeName}> majorEntities);
}
</#if>
</#if>
\ No newline at end of file
<#ibiztemplate>
TARGET=PSDATAENTITY
</#ibiztemplate>
<#comment>数据存储为NoSQL</#comment>
<#if de.getStorageMode()==2>
package ${pub.getPKGCodeName()}.core.${item.getPSSystemModule().codeName?lower_case}.repository;
import org.springframework.data.mongodb.repository.MongoRepository;
import ${pub.getPKGCodeName()}.core.${item.getPSSystemModule().getCodeName()?lower_case}.domain.${item.getCodeName()};
import org.springframework.stereotype.Repository;
@Repository
public interface ${de.codeName}Repository extends MongoRepository<${de.codeName}, String>{
}
</#if>
<#ibiztemplate>
TARGET=PSDELOGIC
</#ibiztemplate>
<#if item.isEnableBackend()>
package ${pub.getPKGCodeName()}.core.${item.getPSDataEntity().getPSSystemModule().getCodeName()?lower_case}.service.logic;
<#--import java.sql.Timestamp;-->
<#--import java.util.ArrayList;-->
<#--import java.util.List;-->
<#--import java.util.Map;-->
<#--import java.util.HashMap;-->
<#--import ${pub.getPKGCodeName()}.core.${de.getPSSystemModule().getCodeName()?lower_case}.domain.${de.getCodeName()};-->
<#--/**-->
<#--* 关系型数据实体[${item.codeName}] 对象-->
<#--*/-->
@Deprecated
public interface I${de.codeName}${item.codeName}Logic {
<#--void execute(${de.codeName} et) ;-->
}
</#if>
\ No newline at end of file
<#ibiztemplate>
TARGET=PSDELOGIC
</#ibiztemplate>
<#if item.isEnableBackend()>
<#assign startWF=false>
package ${pub.getPKGCodeName()}.core.${item.getPSDataEntity().getPSSystemModule().getCodeName()?lower_case}.service.logic.impl;
<#--import java.util.Map;-->
<#--import java.util.HashMap;-->
<#--import lombok.extern.slf4j.Slf4j;-->
<#--import org.springframework.beans.factory.annotation.Autowired;-->
<#--import org.springframework.stereotype.Service;-->
<#--import org.kie.api.runtime.KieSession;-->
<#--import org.kie.api.runtime.KieContainer;-->
<#--import ${pub.getPKGCodeName()}.core.${item.getPSDataEntity().getPSSystemModule().getCodeName()?lower_case}.service.logic.I${de.codeName}${item.codeName}Logic;-->
<#--import ${pub.getPKGCodeName()}.core.${de.getPSSystemModule().getCodeName()?lower_case}.domain.${de.getCodeName()};-->
<#--/**-->
<#--* 关系型数据实体[${item.codeName}] 对象-->
<#--*/-->
<#--@Slf4j-->
<#--@Service-->
@Deprecated
public class ${de.codeName}${item.codeName}LogicImpl{
<#--@Autowired-->
<#--private KieContainer kieContainer;-->
<#--<#comment>注入处理逻辑中所用到的service对象</#comment>-->
<#--<#if item.getPSDELogicNodes?? && item.getPSDELogicNodes()??>-->
<#--<#list item.getPSDELogicNodes() as deLogicNode>-->
<#--<#if deLogicNode.getDstPSDataEntity?? && deLogicNode.getDstPSDataEntity()??>-->
<#--<#assign nodePSDataEntity=deLogicNode.getDstPSDataEntity()>-->
<#--<#if !P.exists("Autowired",nodePSDataEntity.getCodeName(),"service")>-->
<#--@Autowired-->
<#--private ${pub.getPKGCodeName()}.core.${nodePSDataEntity.getPSSystemModule().codeName?lower_case}.service.I${nodePSDataEntity.codeName}Service ${deLogicNode.getDstPSDataEntity().getCodeName()?lower_case}service;-->
<#--public ${pub.getPKGCodeName()}.core.${nodePSDataEntity.getPSSystemModule().codeName?lower_case}.service.I${nodePSDataEntity.codeName}Service get${deLogicNode.getDstPSDataEntity().getCodeName()?lower_case?cap_first}Service() {-->
<#--return this.${deLogicNode.getDstPSDataEntity().getCodeName()?lower_case}service;-->
<#--}-->
<#--</#if>-->
<#--</#if>-->
<#--<#comment>启动工作流</#comment>-->
<#--<#if deLogicNode.getLogicNodeType()=='STARTWF'>-->
<#--<#assign startWF=true>-->
<#--<#if !P.exists("delogic","wfclient")>-->
<#--@Autowired-->
<#--${pub.getPKGCodeName()}.util.client.IBZWFFeignClient wfClient;-->
<#--</#if>-->
<#--</#if>-->
<#--</#list>-->
<#--</#if>-->
<#--<#comment>注入当前实体的service对象,供自定义查询使用</#comment>-->
<#--@Autowired-->
<#--private ${pub.getPKGCodeName()}.core.${de.getPSSystemModule().codeName?lower_case}.service.I${de.codeName}Service iBzSysDefaultService;-->
<#--public ${pub.getPKGCodeName()}.core.${de.getPSSystemModule().codeName?lower_case}.service.I${de.codeName}Service getIBzSysDefaultService() {-->
<#--return this.iBzSysDefaultService;-->
<#--}-->
<#--@Override-->
<#--public void execute(${de.codeName} et) {-->
<#--KieSession kieSession = null;-->
<#--try {-->
<#--kieSession = kieContainer.newKieSession();-->
<#--<#comment>插入逻辑参数</#comment>-->
<#--<#if item.getPSDELogicParams?? && item.getPSDELogicParams()??>-->
<#--<#assign logicName=(de.codeName+item.codeName)?lower_case>-->
<#--<#list item.getPSDELogicParams() as logicParam>-->
<#--<#assign paramObj=(logicName+logicParam.codeName)?lower_case>-->
<#--<#assign paramObjValue=(logicName+logicParam.codeName)?lower_case>-->
<#--<#if logicParam.isDefault()==true><#comment>默认变量</#comment>-->
<#--<#assign paramObjValue="et">-->
<#--<#elseif logicParam.getParamPSDataEntity?? && logicParam.getParamPSDataEntity()??>-->
<#--<#assign ParamPSDataEntity=logicParam.getParamPSDataEntity()>-->
<#--${pub.getPKGCodeName()}.core.${ParamPSDataEntity.getPSSystemModule().codeName?lower_case}.domain.${ParamPSDataEntity.codeName} ${(logicName+logicParam.codeName)?lower_case} = new ${pub.getPKGCodeName()}.core.${ParamPSDataEntity.getPSSystemModule().codeName?lower_case}.domain.${ParamPSDataEntity.codeName}();-->
<#--<#else>-->
<#--Map ${(logicName+logicParam.codeName)?lower_case} = new HashMap();-->
<#--</#if>-->
<#--kieSession.insert(${paramObjValue}); <#comment>将逻辑参数存储到fact</#comment>-->
<#--kieSession.setGlobal("${paramObj}", ${paramObjValue});<#comment>将逻辑参数存储到global</#comment>-->
<#--</#list>-->
<#--</#if>-->
<#--<#comment>插入处理逻辑中所用到的service对象</#comment>-->
<#--<#if item.getPSDELogicNodes?? && item.getPSDELogicNodes()??>-->
<#--<#list item.getPSDELogicNodes() as deLogicNode>-->
<#--<#if deLogicNode.getDstPSDataEntity?? && deLogicNode.getDstPSDataEntity()??>-->
<#--<#if !P.exists(item.codeName,"kieSessionGlobalService",deLogicNode.getDstPSDataEntity().getCodeName()?lower_case)>-->
<#--kieSession.setGlobal("${deLogicNode.getDstPSDataEntity().getCodeName()?lower_case}service", ${deLogicNode.getDstPSDataEntity().getCodeName()?lower_case}service);<#comment>将逻辑中引用到的service存储到global</#comment>-->
<#--</#if>-->
<#--</#if>-->
<#--</#list>-->
<#--</#if>-->
<#--<#comment>插入当前实体的defaultService对象,供自定义查询使用</#comment>-->
<#--kieSession.setGlobal("iBzSys${de.codeName?lower_case?cap_first}DefaultService", iBzSysDefaultService);<#comment>将逻辑中引用到的service存储到global</#comment>-->
<#--kieSession.setGlobal("curuser", ${pub.getPKGCodeName()}.util.security.AuthenticationUser.getAuthenticationUser());-->
<#--<#comment>插入wfclient</#comment>-->
<#--<#if startWF>-->
<#--kieSession.setGlobal("wfClient", wfClient);-->
<#--</#if>-->
<#--kieSession.startProcess("${pub.getPKGCodeName()}.core.${de.getPSSystemModule().codeName?lower_case}.service.logic.${de.codeName?lower_case}${item.getCodeName()?lower_case}");<#comment>执行所要执行的流程</#comment>-->
<#--} catch (Exception e) {-->
<#--throw new RuntimeException("执行[${item.getName()}]处理逻辑发生异常" + e);-->
<#--&lt;#&ndash;throw new BadRequestAlertException(""+e,"","");&ndash;&gt;-->
<#--} finally {-->
<#--if(kieSession != null) {-->
<#--kieSession.destroy();-->
<#--}-->
<#--}-->
<#--}-->
}
</#if>
\ No newline at end of file
<#ibiztemplate>
TARGET=PSDATAENTITY
</#ibiztemplate>
<#if de.getUserTag()?? && de.getUserTag()=='elasticsearch'>
package ${pub.getPKGCodeName()}.core.es.dao;
import ${pub.getPKGCodeName()}.core.es.domain.${item.getCodeName()};
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
import org.springframework.stereotype.Repository;
/**
* 实体[${item.getLogicName()}]
*/
@Repository
public interface ${item.getCodeName()}ESRepository extends ElasticsearchRepository<${item.getCodeName()}, String>{
}
</#if>
<#ibiztemplate>
TARGET=PSDATAENTITY
</#ibiztemplate>
<#comment>引入驼峰配置</#comment>
<#ibizinclude>/SLN/globalfunc.cfg</#ibizinclude>
<#if de.getUserTag()?? && de.getUserTag()=='elasticsearch'>
package ${pub.getPKGCodeName()}.core.es.domain;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
import org.springframework.data.annotation.Id;
import java.io.Serializable;
import java.math.BigDecimal;
import java.sql.Timestamp;
import lombok.Data;
@Data
@Document(indexName = "${sys.codeName?lower_case}", type = "${item.codeName?lower_case}", shards = 5, replicas = 1)
public class ${item.codeName} implements Serializable {
private static final long serialVersionUID = 1L;
<#if de.getPSDEFields()??>
<#comment>输出实体属性</#comment>
<#list de.getPSDEFields() as defield>
<#if defield.isPhisicalDEField()==true>
<#assign privateCodeName = srfr7templcaseformat(defield.getCodeName()) >
<#assign javaType=srfr7javatype(defield.getStdDataType())>
<#assign esType="FieldType.Text">
<#if javaType=='Long'>
<#assign esType="FieldType.Long">
<#elseif javaType=='Integer'>
<#assign esType="FieldType.Integer">
<#elseif javaType=='Double'|| javaType=='BigDecimal'>
<#assign esType="FieldType.Double">
<#elseif javaType=='Timestamp'>
<#assign esType="FieldType.Date">
</#if>
<#if defield.isKeyDEField()==true>
@Id
<#else>
@Field(type = ${esType})
</#if>
private ${javaType} ${privateCodeName};
</#if>
</#list>
</#if>
}
</#if>
\ No newline at end of file
<#ibiztemplate>
TARGET=PSDATAENTITY
</#ibiztemplate>
<#if de.getUserTag()?? && de.getUserTag()=='elasticsearch'>
package ${pub.getPKGCodeName()}.core.es.service;
import ${pub.getPKGCodeName()}.core.es.domain.${item.codeName};
import ${pub.getPKGCodeName()}.core.${de.getPSSystemModule().getCodeName()?lower_case}.filter.${item.codeName}SearchContext;
import org.springframework.data.domain.Page;
import java.util.Collection;
import java.util.List;
/**
* 实体[${item.codeName}] 服务对象接口
*/
public interface I${item.codeName}ESService{
<@addIDESerivceBody />
}
<#macro addIDESerivceBody >
<#comment>实体接口主体内容</#comment>
<#assign keyfield=item.getKeyPSDEField()>
<#if item.getAllPSDEActions()??>
<#list item.getAllPSDEActions() as deaction>
<#if deaction.isEnableBackend()>
<#if deaction.codeName?lower_case == 'get'>
${item.codeName} get(${srfr7javatype(keyfield.stdDataType)} key) ;
<#elseif deaction.codeName?lower_case == "create">
boolean create(${item.codeName} et) ;
void createBatch(List<${item.codeName}> list) ;
<#elseif deaction.codeName?lower_case == "update">
boolean update(${item.codeName} et) ;
void updateBatch(List<${item.codeName}> list) ;
<#elseif deaction.codeName?lower_case == "remove">
boolean remove(${srfr7javatype(keyfield.stdDataType)} key) ;
void removeBatch(Collection<${srfr7javatype(keyfield.stdDataType)}> idList) ;
<#elseif deaction.codeName?lower_case == "save">
boolean save(${item.codeName} et) ;
void saveBatch(List<${item.codeName}> list) ;
</#if>
</#if>
</#list>
</#if>
<#if item.getAllPSDEDataSets()??>
<#list item.getAllPSDEDataSets() as dedataset>
Page<${item.getCodeName()}> search${dedataset.getCodeName()}(${item.codeName}SearchContext context) ;
</#list>
</#if>
</#macro>
</#if>
\ No newline at end of file
<#ibiztemplate>
TARGET=PSDATAENTITY
</#ibiztemplate>
<#comment>引入驼峰配置</#comment>
<#ibizinclude>/SLN/globalfunc.cfg</#ibizinclude>
<#if de.getUserTag()?? && de.getUserTag()=='elasticsearch'>
package ${pub.getPKGCodeName()}.core.es.service.impl;
import com.google.common.collect.Lists;
import ${pub.getPKGCodeName()}.core.es.dao.${item.getCodeName()}ESRepository;
import ${pub.getPKGCodeName()}.core.es.domain.${item.getCodeName()};
import ${pub.getPKGCodeName()}.core.es.service.I${item.getCodeName()}ESService;
import ${pub.getPKGCodeName()}.core.${item.getPSSystemModule().getCodeName()?lower_case}.filter.${item.getCodeName()}SearchContext;
import ${pub.getPKGCodeName()}.util.helper.CachedBeanCopier;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import java.util.List;
import java.util.Optional;
import org.springframework.stereotype.Service;
import java.util.Collection;
/**
* 实体[${item.getLogicName()}] 服务对象接口实现
*/
@Service
public class ${item.getCodeName()}ESServiceImpl implements I${de.getCodeName()}ESService {
@Autowired
@Lazy
${item.getCodeName()}ESRepository repository;
<#assign keyfield=de.getKeyPSDEField()>
<#comment>输出实体行为</#comment>
<#if item.getAllPSDEActions()??>
<#list item.getAllPSDEActions() as deaction>
<#if deaction.getCodeName()?lower_case == 'get'>
@Override
public ${item.getCodeName()} get(${srfr7javatype(keyfield.stdDataType)} key) {
Optional<${item.getCodeName()}> result = repository.findById(key);
if(!result.isPresent()){
${item.getCodeName()} et=new ${item.getCodeName()}();
et.set${srfr7templcaseformat(keyfield.codeName)?cap_first}(key);
return et;
}
else{
${item.getCodeName()} et=result.get();
return et;
}
}
<#elseif deaction.getCodeName()?lower_case == "create">
@Override
public boolean create(${item.getCodeName()} et) {
repository.save(et);
CachedBeanCopier.copy(get(et.get${srfr7templcaseformat(keyfield.codeName)?cap_first}()),et);
return true;
}
@Override
public void createBatch(List<${item.getCodeName()}> list) {
}
<#elseif deaction.getCodeName()?lower_case == "update">
@Override
public boolean update(${item.getCodeName()} et) {
repository.save(et);
CachedBeanCopier.copy(get(et.get${srfr7templcaseformat(keyfield.codeName)?cap_first}()),et);
return true;
}
@Override
public void updateBatch(List<${item.getCodeName()}> list) {
}
<#elseif deaction.getCodeName()?lower_case == "save">
@Override
public boolean save(${item.getCodeName()} et) {
repository.save(et);
CachedBeanCopier.copy(get(et.get${srfr7templcaseformat(keyfield.codeName)?cap_first}()),et);
return true;
}
@Override
public void saveBatch(List<${item.getCodeName()}> list) {
}
<#elseif deaction.getCodeName()?lower_case == "remove">
@Override
public boolean remove(${srfr7javatype(keyfield.stdDataType)} key) {
repository.deleteById(key);
return true;
}
@Override
public void removeBatch(Collection<${srfr7javatype(keyfield.stdDataType)}> idList) {
}
</#if>
</#list>
</#if>
<#comment>输出实体数据集</#comment>
<#if item.getAllPSDEDataSets()??>
<#list item.getAllPSDEDataSets() as dedataset>
public Page<${item.getCodeName()}> search${dedataset.getCodeName()}(${item.codeName}SearchContext context){
Iterable<${item.getCodeName()}> list= repository.search(context.getEsCond());
List<${item.getCodeName()}> entities = Lists.newArrayList(list);
return new PageImpl<${item.getCodeName()}>(entities,context.getPageable(),entities.size());
}
</#list>
</#if>
}
</#if>
\ No newline at end of file
<#ibiztemplate>
TARGET=PSDATAENTITY
</#ibiztemplate>
<#comment>判断当前实体是否包含自定义行为</#comment>
<#assign hasServiceEx=false>
<#if item.getAllPSDEActions()??>
<#list item.getAllPSDEActions() as deaction>
<#if deaction.isEnableBackend() && deaction.getActionType()=='USERCUSTOM'>
<#assign hasServiceEx=true>
<#break>
<#elseif deaction.isEnableBackend() && deaction.getTestActionMode?? && deaction.getTestActionMode()?? && (deaction.getTestActionMode() ==1 || deaction.getTestActionMode() ==3)>
<#assign hasServiceEx=true>
<#break>
</#if>
</#list>
</#if>
<#if hasServiceEx && (de.getStorageMode()==1 || de.getStorageMode()==2 ||de.getStorageMode()==4||de.getStorageMode()==0 ) >
package ${pub.getPKGCodeName()}.core.extensions.service;
import ${pub.getPKGCodeName()}.core.${item.getPSSystemModule().getCodeName()?lower_case}.service.impl.${item.codeName}ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import ${pub.getPKGCodeName()}.core.${item.getPSSystemModule().getCodeName()?lower_case}.domain.${item.codeName};
import org.springframework.stereotype.Service;
<#if pub.isEnableGlobalTransaction?? && pub.isEnableGlobalTransaction()?? && pub.isEnableGlobalTransaction()==true>
import io.seata.spring.annotation.GlobalTransactional;
</#if>
import org.springframework.transaction.annotation.Transactional;
import org.springframework.context.annotation.Primary;
import java.util.*;
/**
* 实体[${item.getLogicName()}] 自定义服务对象
*/
@Slf4j
@Primary
@Service("${item.codeName}ExService")
public class ${item.codeName}ExService extends ${item.codeName}ServiceImpl {
<#assign keyfield=de.getKeyPSDEField()>
<#comment>SQL存储:解决mybatis继承service批操作报错</#comment>
<#if de.getStorageMode()==1>
@Override
protected Class currentModelClass() {
return com.baomidou.mybatisplus.core.toolkit.ReflectionKit.getSuperClassGenericType(this.getClass().getSuperclass(), 1);
}
</#if>
<#comment>输出实体行为</#comment>
<#if item.getAllPSDEActions()??>
<#list item.getAllPSDEActions() as deaction>
<#if deaction.isEnableBackend()>
<#if deaction.getActionType()=='USERCUSTOM'>
<#assign actionAnno="["+deaction.getCodeName()+"] 行为扩展">
<#if ((deaction.getLogicName())!'')!=''>
<#assign actionAnno="["+deaction.getCodeName()+":"+deaction.getLogicName()+"] 行为扩展">
</#if>
<#if ((deaction.getMemo())!'')!=''>
<#assign actionAnno=actionAnno+":"+deaction.getMemo()>
</#if>
/**
* ${actionAnno}
* @param et
* @return
*/
@Override
<@transactionalAnno deaction/>
public ${item.getCodeName()} ${srfmethodname(deaction.getCodeName())}(${item.getCodeName()} et) {
return super.${srfmethodname(deaction.getCodeName())}(et);
}
</#if>
<#comment>输出测试行为</#comment>
<@outputTestActionDetail deaction />
</#if>
</#list>
</#if>
}
</#if>
<#comment>输出测试行为</#comment>
<#macro outputTestActionDetail deaction>
<#if deaction.isEnableBackend() && deaction.getTestActionMode?? && deaction.getTestActionMode()??>
<#if deaction.getTestActionMode() ==1 || deaction.getTestActionMode() ==3>
<#if (deaction.getActionType()=='USERCUSTOM')>
@Override
public boolean test${srfmethodname(deaction.getCodeName())?cap_first}(${item.getCodeName()} et) {
return super.test${srfmethodname(deaction.getCodeName())?cap_first}(et);
}
<#elseif deaction.getActionType()=='DELOGIC'>
@Override
public boolean test${srfmethodname(deaction.getCodeName())?cap_first}(${item.getCodeName()} et) {
return super.test${srfmethodname(deaction.getCodeName())?cap_first}(et);
}
<#elseif deaction.getCodeName()?lower_case == 'get'>
@Override
public boolean testGet(${srfr7javatype(keyfield.stdDataType)} key) {
return super.testGet(key);
}
<#elseif deaction.getCodeName()?lower_case == "createbatch">
<#elseif deaction.getCodeName()?lower_case == "updatebatch">
<#elseif deaction.getCodeName()?lower_case == "removebatch">
<#elseif deaction.getCodeName()?lower_case == "savebatch">
<#elseif deaction.getCodeName()?lower_case == "create">
@Override
public boolean testCreate(${item.getCodeName()} et) {
return super.testCreate(et);
}
@Override
public boolean testCreateBatch(List<${item.getCodeName()}> list) {
return super.testCreateBatch(list);
}
<#elseif deaction.getCodeName()?lower_case == "update">
@Override
public boolean testUpdate(${item.getCodeName()} et) {
return super.testUpdate(et);
}
@Override
public boolean testUpdateBatch(List<${item.getCodeName()}> list) {
return super.testUpdateBatch(list);
}
<#elseif deaction.getCodeName()?lower_case == "save">
@Override
public boolean testSave(${item.getCodeName()} et) {
return super.testSave(et);
}
@Override
public boolean testSaveOrUpdate(${item.getCodeName()} et) {
return super.testSaveOrUpdate(et);
}
@Override
public boolean testSaveBatch(Collection<${item.getCodeName()}> list) {
return super.testSaveBatch(list);
}
@Override
public boolean testSaveBatch(List<${item.getCodeName()}> list) {
return super.testSaveBatch(list);
}
<#elseif deaction.getCodeName()?lower_case == "remove">
@Override
public boolean testRemove(${srfr7javatype(keyfield.stdDataType)} key) {
return super.testRemove(key);
}
@Override
public boolean testRemoveBatch(Collection<${srfr7javatype(keyfield.stdDataType)}> idList) {
return super.testRemoveBatch(idList);
}
<#elseif deaction.getCodeName()?lower_case == "getdraft">
@Override
public boolean testGetDraft(${item.getCodeName()} et) {
return super.testGetDraft(et);
}
<#elseif deaction.getCodeName()?lower_case == "checkkey">
@Override
public boolean testCheckKey(${item.getCodeName()} et) {
return super.testCheckKey(et);
}
<#else>
@Override
public boolean test${srfmethodname(deaction.getCodeName())?cap_first}(${item.getCodeName()} et) {
return super.test${srfmethodname(deaction.getCodeName())?cap_first}(et);
}
</#if>
</#if>
</#if>
</#macro>
<#comment>事务注解</#comment>
<#macro transactionalAnno deaction>
<#if deaction.getTransactionMode?? && deaction.getTransactionMode()??>
<#if deaction.getTransactionMode()=='GLOBAL'>
@GlobalTransactional
<#elseif deaction.getTransactionMode()=='DEFAULT'>
@Transactional
</#if>
</#if>
</#macro>
<#ibiztemplate>
TARGET=PSSYSTEM
</#ibiztemplate>
package ${pub.getPKGCodeName()}.core.util.config;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.context.annotation.Configuration;
/**
* mybatis自动配置
*/
@Configuration
@ConditionalOnClass(MybatisConfiguration.class)
@ConditionalOnWebApplication
public class MybatisAutoConfiguration {
}
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册