提交 606c7270 编写于 作者: ibizdev's avatar ibizdev

ibiz4j 部署微服务接口

上级 9f6d69fe
......@@ -37,11 +37,11 @@
git clone -b master $para2 ibzwf/
export NODE_OPTIONS=--max-old-space-size=4096
cd ibzwf/
mvn clean package -Pweb
cd ibzwf-app/ibzwf-app-web
mvn -Pweb docker:build
mvn -Pweb docker:push
docker -H $para1 stack deploy --compose-file=src/main/docker/ibzwf-app-web.yaml ibzlab-rt --with-registry-auth
mvn clean package -Papi
cd ibzwf-provider/ibzwf-provider-api
mvn -Papi docker:build
mvn -Papi docker:push
docker -H $para1 stack deploy --compose-file=src/main/docker/ibzwf-provider-api.yaml ibzlab-rt --with-registry-auth
</command>
</hudson.tasks.Shell>
</builders>
......
......@@ -9,6 +9,6 @@ CMD echo "The application will start in ${IBZ_SLEEP}s..." && \
sleep ${IBZ_SLEEP} && \
java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar /ibzwf-app-web.jar
EXPOSE 30003
EXPOSE 8080
ADD ibzwf-app-web.jar /ibzwf-app-web.jar
......@@ -3,21 +3,9 @@ services:
ibzwf-app-web:
image: registry.cn-shanghai.aliyuncs.com/ibizsys/ibzwf-app-web:latest
ports:
- "30003:30003"
- "8080:8080"
networks:
- agent_network
environment:
- SPRING_CLOUD_NACOS_DISCOVERY_IP=172.16.180.237
- SERVER_PORT=30003
- SPRING_CLOUD_NACOS_DISCOVERY_SERVER-ADDR=172.16.102.211:8848
- SPRING_REDIS_HOST=172.16.100.243
- SPRING_REDIS_PORT=6379
- SPRING_REDIS_DATABASE=0
- SPRING_DATASOURCE_USERNAME=a_A_5d9d78509
- SPRING_DATASOURCE_PASSWORD=@6dEfb3@
- SPRING_DATASOURCE_URL=jdbc:mysql://172.16.180.232:3306/a_A_5d9d78509?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&useOldAliasMetadataBehavior=true
- SPRING_DATASOURCE_DRIVER-CLASS-NAME=com.mysql.jdbc.Driver
- SPRING_DATASOURCE_DEFAULTSCHEMA=a_A_5d9d78509
deploy:
mode: replicated
replicas: 1
......
......@@ -70,6 +70,12 @@ public class WFGroupServiceImpl extends ServiceImpl<WFGroupMapper, WFGroup> impl
}
}
@Override
public boolean saveBatch(Collection<WFGroup> list) {
saveOrUpdateBatch(list,batchSize);
return true;
}
@Override
public void saveBatch(List<WFGroup> list) {
saveOrUpdateBatch(list,batchSize);
......
......@@ -112,6 +112,13 @@ public class WFMemberServiceImpl extends ServiceImpl<WFMemberMapper, WFMember> i
}
}
@Override
public boolean saveBatch(Collection<WFMember> list) {
list.forEach(item->fillParentData(item));
saveOrUpdateBatch(list,batchSize);
return true;
}
@Override
public void saveBatch(List<WFMember> list) {
list.forEach(item->fillParentData(item));
......
......@@ -67,6 +67,12 @@ public class WFProcessDefinitionServiceImpl extends ServiceImpl<WFProcessDefinit
}
}
@Override
public boolean saveBatch(Collection<WFProcessDefinition> list) {
saveOrUpdateBatch(list,batchSize);
return true;
}
@Override
public void saveBatch(List<WFProcessDefinition> list) {
saveOrUpdateBatch(list,batchSize);
......
......@@ -98,6 +98,12 @@ public class WFSystemServiceImpl extends ServiceImpl<WFSystemMapper, WFSystem> i
}
}
@Override
public boolean saveBatch(Collection<WFSystem> list) {
saveOrUpdateBatch(list,batchSize);
return true;
}
@Override
public void saveBatch(List<WFSystem> list) {
saveOrUpdateBatch(list,batchSize);
......
......@@ -87,6 +87,12 @@ public class WFUserServiceImpl extends ServiceImpl<WFUserMapper, WFUser> impleme
}
}
@Override
public boolean saveBatch(Collection<WFUser> list) {
saveOrUpdateBatch(list,batchSize);
return true;
}
@Override
public void saveBatch(List<WFUser> list) {
saveOrUpdateBatch(list,batchSize);
......
!!!!模版产生代码错误:----
FTL stack trace ("~" means nesting-related):
- Failed at: #if de.getAllPSDEDBConfigs()?? && de... [in template "CODETEMPL_zh_CN" at line 14, column 5]
----
\ No newline at end of file
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd">
<!--输出实体[WF_PSSYSTEM]数据结构 -->
<!--输出实体[WF_GROUP]数据结构 -->
<changeSet author="a_A_5d9d78509" id="tab-wf_group-24-2">
<createTable tableName="IBZWFGROUP">
<column name="GROUPID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_WF_GROUP_GROUPID"/>
</column>
<column name="GROUPNAME" remarks="" type="VARCHAR(100)">
</column>
<column name="GROUPSCOPE" remarks="" type="VARCHAR(100)">
</column>
</createTable>
</changeSet>
<!--输出实体[WF_DEFINITION]数据结构 -->
<changeSet author="a_A_5d9d78509" id="tab-wf_definition-51-3">
<createTable tableName="IBZWFDEFINITION">
<column name="DEFINITIONKEY" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_WF_DEFINITION_DEFINITIONKEY"/>
</column>
<column name="DEFINITIONNAME" remarks="" type="VARCHAR(100)">
</column>
<column name="MODELVERSION" remarks="" type="INT">
</column>
<column name="MODELENABLE" remarks="" type="INT">
</column>
<column name="PSSYSTEMID" remarks="" type="VARCHAR(100)">
</column>
<column name="TASKDEFINITIONKEY" remarks="" type="VARCHAR(100)">
</column>
<column name="MD5CHECK" remarks="" type="VARCHAR(100)">
</column>
<column name="BPMNFILE" remarks="" type="VARCHAR(1000)">
</column>
<column name="DEPLOYKEY" remarks="" type="VARCHAR(100)">
</column>
</createTable>
</changeSet>
<!--输出实体[WF_GROUP_MEMBER]数据结构 -->
<changeSet author="a_A_5d9d78509" id="tab-wf_group_member-40-4">
<createTable tableName="IBZWFMEMBER">
<column name="MEMBERID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_WF_GROUP_MEMBER_MEMBERID"/>
</column>
<column name="MEMBERNAME" remarks="" type="VARCHAR(100)">
</column>
<column name="GROUPID" remarks="" type="VARCHAR(100)">
</column>
<column name="USERID" remarks="" type="VARCHAR(100)">
</column>
</createTable>
</changeSet>
<!--输出实体[WF_PSSYSTEM]外键关系 -->
<!--输出实体[WF_GROUP]外键关系 -->
<!--输出实体[WF_DEFINITION]外键关系 -->
<!--输出实体[WF_GROUP_MEMBER]外键关系 -->
<changeSet author="a_A_5d9d78509" id="fk-wf_group_member-40-5">
<addForeignKeyConstraint baseColumnNames="GROUPID" baseTableName="IBZWFMEMBER" constraintName="DER1N_WF_GROUP_MEMBER_WF_GROUP" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="GROUPID" referencedTableName="IBZWFGROUP" validate="true"/>
</changeSet>
</databaseChangeLog>
......@@ -9,6 +9,6 @@ CMD echo "The application will start in ${IBZ_SLEEP}s..." && \
sleep ${IBZ_SLEEP} && \
java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar /ibzwf-provider-api.jar
EXPOSE 8081
EXPOSE 40003
ADD ibzwf-provider-api.jar /ibzwf-provider-api.jar
......@@ -3,9 +3,21 @@ services:
ibzwf-provider-api:
image: registry.cn-shanghai.aliyuncs.com/ibizsys/ibzwf-provider-api:latest
ports:
- "8081:8081"
- "40003:40003"
networks:
- agent_network
environment:
- SPRING_CLOUD_NACOS_DISCOVERY_IP=172.16.180.237
- SERVER_PORT=40003
- SPRING_CLOUD_NACOS_DISCOVERY_SERVER-ADDR=172.16.102.211:8848
- SPRING_REDIS_HOST=172.16.100.243
- SPRING_REDIS_PORT=6379
- SPRING_REDIS_DATABASE=0
- SPRING_DATASOURCE_USERNAME=a_A_5d9d78509
- SPRING_DATASOURCE_PASSWORD=@6dEfb3@
- SPRING_DATASOURCE_URL=jdbc:mysql://172.16.180.232:3306/a_A_5d9d78509?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&useOldAliasMetadataBehavior=true
- SPRING_DATASOURCE_DRIVER-CLASS-NAME=com.mysql.jdbc.Driver
- SPRING_DATASOURCE_DEFAULTSCHEMA=a_A_5d9d78509
deploy:
mode: replicated
replicas: 1
......
......@@ -6,10 +6,8 @@ import java.util.List;
import java.util.Map;
import java.math.BigInteger;
import java.util.HashMap;
import lombok.extern.slf4j.Slf4j;
import com.alibaba.fastjson.JSONObject;
import javax.servlet.ServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cglib.beans.BeanCopier;
......@@ -24,21 +22,16 @@ import org.springframework.data.domain.Pageable;
import org.springframework.util.StringUtils;
import org.springframework.context.annotation.Lazy;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import cn.ibizlab.api.dto.*;
import cn.ibizlab.api.mapping.*;
import cn.ibizlab.core.workflow.domain.WFGroup;
import cn.ibizlab.core.workflow.service.IWFGroupService;
import cn.ibizlab.core.workflow.filter.WFGroupSearchContext;
@Slf4j
@Api(tags = {"WFGroup" })
@RestController("api-wfgroup")
......@@ -61,7 +54,7 @@ public class WFGroupResource {
return ResponseEntity.status(HttpStatus.OK).body(wfgroupService.save(wfgroupMapping.toDomain(wfgroupdto)));
}
@PreAuthorize("hasPermission('Save',{'Sql',this.humanMapping,#humandtos})")
@PreAuthorize("hasPermission('Save',{'Sql',this.wfgroupMapping,#wfgroupdtos})")
@ApiOperation(value = "SaveBatch", tags = {"WFGroup" }, notes = "SaveBatch")
@RequestMapping(method = RequestMethod.POST, value = "/wfgroups/savebatch")
public ResponseEntity<Boolean> saveBatch(@RequestBody List<WFGroupDTO> wfgroupdtos) {
......@@ -81,7 +74,7 @@ public class WFGroupResource {
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasPermission('Update',{'Sql',this.humanMapping,#humandtos})")
@PreAuthorize("hasPermission('Update',{'Sql',this.wfgroupMapping,#wfgroupdtos})")
@ApiOperation(value = "UpdateBatch", tags = {"WFGroup" }, notes = "UpdateBatch")
@RequestMapping(method = RequestMethod.PUT, value = "/wfgroups/batch")
public ResponseEntity<Boolean> updateBatch(@RequestBody List<WFGroupDTO> wfgroupdtos) {
......@@ -114,7 +107,7 @@ public class WFGroupResource {
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasPermission('Create',{'Sql',this.humanMapping,#humandtos})")
@PreAuthorize("hasPermission('Create',{'Sql',this.wfgroupMapping,#wfgroupdtos})")
@ApiOperation(value = "createBatch", tags = {"WFGroup" }, notes = "createBatch")
@RequestMapping(method = RequestMethod.POST, value = "/wfgroups/batch")
public ResponseEntity<Boolean> createBatch(@RequestBody List<WFGroupDTO> wfgroupdtos) {
......@@ -130,7 +123,7 @@ public class WFGroupResource {
return ResponseEntity.status(HttpStatus.OK).body(wfgroupService.remove(wfgroup_id));
}
@PreAuthorize("hasPermission('Remove',{'Sql',this.humanMapping,this.permissionDTO,#ids})")
@PreAuthorize("hasPermission('Remove',{'Sql',this.wfgroupMapping,this.permissionDTO,#ids})")
@ApiOperation(value = "RemoveBatch", tags = {"WFGroup" }, notes = "RemoveBatch")
@RequestMapping(method = RequestMethod.DELETE, value = "/wfgroups/batch")
public ResponseEntity<Boolean> removeBatch(@RequestBody List<String> ids) {
......
......@@ -6,10 +6,8 @@ import java.util.List;
import java.util.Map;
import java.math.BigInteger;
import java.util.HashMap;
import lombok.extern.slf4j.Slf4j;
import com.alibaba.fastjson.JSONObject;
import javax.servlet.ServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cglib.beans.BeanCopier;
......@@ -24,21 +22,16 @@ import org.springframework.data.domain.Pageable;
import org.springframework.util.StringUtils;
import org.springframework.context.annotation.Lazy;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import cn.ibizlab.api.dto.*;
import cn.ibizlab.api.mapping.*;
import cn.ibizlab.core.workflow.domain.WFMember;
import cn.ibizlab.core.workflow.service.IWFMemberService;
import cn.ibizlab.core.workflow.filter.WFMemberSearchContext;
@Slf4j
@Api(tags = {"WFMember" })
@RestController("api-wfmember")
......@@ -79,7 +72,7 @@ public class WFMemberResource {
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasPermission('Create',{'Sql',this.humanMapping,#humandtos})")
@PreAuthorize("hasPermission('Create',{'Sql',this.wfmemberMapping,#wfmemberdtos})")
@ApiOperation(value = "createBatch", tags = {"WFMember" }, notes = "createBatch")
@RequestMapping(method = RequestMethod.POST, value = "/wfmembers/batch")
public ResponseEntity<Boolean> createBatch(@RequestBody List<WFMemberDTO> wfmemberdtos) {
......@@ -95,7 +88,7 @@ public class WFMemberResource {
return ResponseEntity.status(HttpStatus.OK).body(wfmemberService.remove(wfmember_id));
}
@PreAuthorize("hasPermission('Remove',{'Sql',this.humanMapping,this.permissionDTO,#ids})")
@PreAuthorize("hasPermission('Remove',{'Sql',this.wfmemberMapping,this.permissionDTO,#ids})")
@ApiOperation(value = "RemoveBatch", tags = {"WFMember" }, notes = "RemoveBatch")
@RequestMapping(method = RequestMethod.DELETE, value = "/wfmembers/batch")
public ResponseEntity<Boolean> removeBatch(@RequestBody List<String> ids) {
......@@ -110,7 +103,7 @@ public class WFMemberResource {
return ResponseEntity.status(HttpStatus.OK).body(wfmemberService.save(wfmemberMapping.toDomain(wfmemberdto)));
}
@PreAuthorize("hasPermission('Save',{'Sql',this.humanMapping,#humandtos})")
@PreAuthorize("hasPermission('Save',{'Sql',this.wfmemberMapping,#wfmemberdtos})")
@ApiOperation(value = "SaveBatch", tags = {"WFMember" }, notes = "SaveBatch")
@RequestMapping(method = RequestMethod.POST, value = "/wfmembers/savebatch")
public ResponseEntity<Boolean> saveBatch(@RequestBody List<WFMemberDTO> wfmemberdtos) {
......@@ -130,7 +123,7 @@ public class WFMemberResource {
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasPermission('Update',{'Sql',this.humanMapping,#humandtos})")
@PreAuthorize("hasPermission('Update',{'Sql',this.wfmemberMapping,#wfmemberdtos})")
@ApiOperation(value = "UpdateBatch", tags = {"WFMember" }, notes = "UpdateBatch")
@RequestMapping(method = RequestMethod.PUT, value = "/wfmembers/batch")
public ResponseEntity<Boolean> updateBatch(@RequestBody List<WFMemberDTO> wfmemberdtos) {
......@@ -196,7 +189,7 @@ public class WFMemberResource {
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasPermission('Create',{'Sql',this.humanMapping,#humandtos})")
@PreAuthorize("hasPermission('Create',{'Sql',this.wfmemberMapping,#wfmemberdtos})")
@ApiOperation(value = "createBatchByWFGroup", tags = {"WFMember" }, notes = "createBatchByWFGroup")
@RequestMapping(method = RequestMethod.POST, value = "/wfgroups/{wfgroup_id}/wfmembers/batch")
public ResponseEntity<Boolean> createBatchByWFGroup(@PathVariable("wfgroup_id") String wfgroup_id, @RequestBody List<WFMemberDTO> wfmemberdtos) {
......@@ -216,7 +209,7 @@ public class WFMemberResource {
return ResponseEntity.status(HttpStatus.OK).body(wfmemberService.remove(wfmember_id));
}
@PreAuthorize("hasPermission('Remove',{'Sql',this.humanMapping,this.permissionDTO,#ids})")
@PreAuthorize("hasPermission('Remove',{'Sql',this.wfmemberMapping,this.permissionDTO,#ids})")
@ApiOperation(value = "RemoveBatchByWFGroup", tags = {"WFMember" }, notes = "RemoveBatchByWFGroup")
@RequestMapping(method = RequestMethod.DELETE, value = "/wfgroups/{wfgroup_id}/wfmembers/batch")
public ResponseEntity<Boolean> removeBatchByWFGroup(@RequestBody List<String> ids) {
......@@ -233,7 +226,7 @@ public class WFMemberResource {
return ResponseEntity.status(HttpStatus.OK).body(wfmemberService.save(domain));
}
@PreAuthorize("hasPermission('Save',{'Sql',this.humanMapping,#humandtos})")
@PreAuthorize("hasPermission('Save',{'Sql',this.wfmemberMapping,#wfmemberdtos})")
@ApiOperation(value = "SaveBatchByWFGroup", tags = {"WFMember" }, notes = "SaveBatchByWFGroup")
@RequestMapping(method = RequestMethod.POST, value = "/wfgroups/{wfgroup_id}/wfmembers/savebatch")
public ResponseEntity<Boolean> saveBatchByWFGroup(@PathVariable("wfgroup_id") String wfgroup_id, @RequestBody List<WFMemberDTO> wfmemberdtos) {
......@@ -258,7 +251,7 @@ public class WFMemberResource {
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasPermission('Update',{'Sql',this.humanMapping,#humandtos})")
@PreAuthorize("hasPermission('Update',{'Sql',this.wfmemberMapping,#wfmemberdtos})")
@ApiOperation(value = "UpdateBatchByWFGroup", tags = {"WFMember" }, notes = "UpdateBatchByWFGroup")
@RequestMapping(method = RequestMethod.PUT, value = "/wfgroups/{wfgroup_id}/wfmembers/batch")
public ResponseEntity<Boolean> updateBatchByWFGroup(@PathVariable("wfgroup_id") String wfgroup_id, @RequestBody List<WFMemberDTO> wfmemberdtos) {
......@@ -330,7 +323,7 @@ public class WFMemberResource {
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasPermission('Create',{'Sql',this.humanMapping,#humandtos})")
@PreAuthorize("hasPermission('Create',{'Sql',this.wfmemberMapping,#wfmemberdtos})")
@ApiOperation(value = "createBatchByWFUser", tags = {"WFMember" }, notes = "createBatchByWFUser")
@RequestMapping(method = RequestMethod.POST, value = "/wfusers/{wfuser_id}/wfmembers/batch")
public ResponseEntity<Boolean> createBatchByWFUser(@PathVariable("wfuser_id") String wfuser_id, @RequestBody List<WFMemberDTO> wfmemberdtos) {
......@@ -350,7 +343,7 @@ public class WFMemberResource {
return ResponseEntity.status(HttpStatus.OK).body(wfmemberService.remove(wfmember_id));
}
@PreAuthorize("hasPermission('Remove',{'Sql',this.humanMapping,this.permissionDTO,#ids})")
@PreAuthorize("hasPermission('Remove',{'Sql',this.wfmemberMapping,this.permissionDTO,#ids})")
@ApiOperation(value = "RemoveBatchByWFUser", tags = {"WFMember" }, notes = "RemoveBatchByWFUser")
@RequestMapping(method = RequestMethod.DELETE, value = "/wfusers/{wfuser_id}/wfmembers/batch")
public ResponseEntity<Boolean> removeBatchByWFUser(@RequestBody List<String> ids) {
......@@ -367,7 +360,7 @@ public class WFMemberResource {
return ResponseEntity.status(HttpStatus.OK).body(wfmemberService.save(domain));
}
@PreAuthorize("hasPermission('Save',{'Sql',this.humanMapping,#humandtos})")
@PreAuthorize("hasPermission('Save',{'Sql',this.wfmemberMapping,#wfmemberdtos})")
@ApiOperation(value = "SaveBatchByWFUser", tags = {"WFMember" }, notes = "SaveBatchByWFUser")
@RequestMapping(method = RequestMethod.POST, value = "/wfusers/{wfuser_id}/wfmembers/savebatch")
public ResponseEntity<Boolean> saveBatchByWFUser(@PathVariable("wfuser_id") String wfuser_id, @RequestBody List<WFMemberDTO> wfmemberdtos) {
......@@ -392,7 +385,7 @@ public class WFMemberResource {
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasPermission('Update',{'Sql',this.humanMapping,#humandtos})")
@PreAuthorize("hasPermission('Update',{'Sql',this.wfmemberMapping,#wfmemberdtos})")
@ApiOperation(value = "UpdateBatchByWFUser", tags = {"WFMember" }, notes = "UpdateBatchByWFUser")
@RequestMapping(method = RequestMethod.PUT, value = "/wfusers/{wfuser_id}/wfmembers/batch")
public ResponseEntity<Boolean> updateBatchByWFUser(@PathVariable("wfuser_id") String wfuser_id, @RequestBody List<WFMemberDTO> wfmemberdtos) {
......
......@@ -6,10 +6,8 @@ import java.util.List;
import java.util.Map;
import java.math.BigInteger;
import java.util.HashMap;
import lombok.extern.slf4j.Slf4j;
import com.alibaba.fastjson.JSONObject;
import javax.servlet.ServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cglib.beans.BeanCopier;
......@@ -24,21 +22,16 @@ import org.springframework.data.domain.Pageable;
import org.springframework.util.StringUtils;
import org.springframework.context.annotation.Lazy;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import cn.ibizlab.api.dto.*;
import cn.ibizlab.api.mapping.*;
import cn.ibizlab.core.workflow.domain.WFProcessDefinition;
import cn.ibizlab.core.workflow.service.IWFProcessDefinitionService;
import cn.ibizlab.core.workflow.filter.WFProcessDefinitionSearchContext;
@Slf4j
@Api(tags = {"WFProcessDefinition" })
@RestController("api-wfprocessdefinition")
......@@ -61,7 +54,7 @@ public class WFProcessDefinitionResource {
return ResponseEntity.status(HttpStatus.OK).body(wfprocessdefinitionService.save(wfprocessdefinitionMapping.toDomain(wfprocessdefinitiondto)));
}
@PreAuthorize("hasPermission('Save',{'Sql',this.humanMapping,#humandtos})")
@PreAuthorize("hasPermission('Save',{'Sql',this.wfprocessdefinitionMapping,#wfprocessdefinitiondtos})")
@ApiOperation(value = "SaveBatch", tags = {"WFProcessDefinition" }, notes = "SaveBatch")
@RequestMapping(method = RequestMethod.POST, value = "/wfprocessdefinitions/savebatch")
public ResponseEntity<Boolean> saveBatch(@RequestBody List<WFProcessDefinitionDTO> wfprocessdefinitiondtos) {
......@@ -81,7 +74,7 @@ public class WFProcessDefinitionResource {
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasPermission('Update',{'Sql',this.humanMapping,#humandtos})")
@PreAuthorize("hasPermission('Update',{'Sql',this.wfprocessdefinitionMapping,#wfprocessdefinitiondtos})")
@ApiOperation(value = "UpdateBatch", tags = {"WFProcessDefinition" }, notes = "UpdateBatch")
@RequestMapping(method = RequestMethod.PUT, value = "/wfprocessdefinitions/batch")
public ResponseEntity<Boolean> updateBatch(@RequestBody List<WFProcessDefinitionDTO> wfprocessdefinitiondtos) {
......@@ -123,7 +116,7 @@ public class WFProcessDefinitionResource {
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasPermission('Create',{'Sql',this.humanMapping,#humandtos})")
@PreAuthorize("hasPermission('Create',{'Sql',this.wfprocessdefinitionMapping,#wfprocessdefinitiondtos})")
@ApiOperation(value = "createBatch", tags = {"WFProcessDefinition" }, notes = "createBatch")
@RequestMapping(method = RequestMethod.POST, value = "/wfprocessdefinitions/batch")
public ResponseEntity<Boolean> createBatch(@RequestBody List<WFProcessDefinitionDTO> wfprocessdefinitiondtos) {
......@@ -139,7 +132,7 @@ public class WFProcessDefinitionResource {
return ResponseEntity.status(HttpStatus.OK).body(wfprocessdefinitionService.remove(wfprocessdefinition_id));
}
@PreAuthorize("hasPermission('Remove',{'Sql',this.humanMapping,this.permissionDTO,#ids})")
@PreAuthorize("hasPermission('Remove',{'Sql',this.wfprocessdefinitionMapping,this.permissionDTO,#ids})")
@ApiOperation(value = "RemoveBatch", tags = {"WFProcessDefinition" }, notes = "RemoveBatch")
@RequestMapping(method = RequestMethod.DELETE, value = "/wfprocessdefinitions/batch")
public ResponseEntity<Boolean> removeBatch(@RequestBody List<String> ids) {
......
......@@ -6,10 +6,8 @@ import java.util.List;
import java.util.Map;
import java.math.BigInteger;
import java.util.HashMap;
import lombok.extern.slf4j.Slf4j;
import com.alibaba.fastjson.JSONObject;
import javax.servlet.ServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cglib.beans.BeanCopier;
......@@ -24,21 +22,16 @@ import org.springframework.data.domain.Pageable;
import org.springframework.util.StringUtils;
import org.springframework.context.annotation.Lazy;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import cn.ibizlab.api.dto.*;
import cn.ibizlab.api.mapping.*;
import cn.ibizlab.core.workflow.domain.WFREModel;
import cn.ibizlab.core.workflow.service.IWFREModelService;
import cn.ibizlab.core.workflow.filter.WFREModelSearchContext;
@Slf4j
@Api(tags = {"WFREModel" })
@RestController("api-wfremodel")
......@@ -66,7 +59,7 @@ public class WFREModelResource {
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasPermission('Update',{'None',this.humanMapping,#humandtos})")
@PreAuthorize("hasPermission('Update',{'None',this.wfremodelMapping,#wfremodeldtos})")
@ApiOperation(value = "UpdateBatch", tags = {"WFREModel" }, notes = "UpdateBatch")
@RequestMapping(method = RequestMethod.PUT, value = "/wfremodels/batch")
public ResponseEntity<Boolean> updateBatch(@RequestBody List<WFREModelDTO> wfremodeldtos) {
......@@ -81,7 +74,7 @@ public class WFREModelResource {
return ResponseEntity.status(HttpStatus.OK).body(wfremodelService.save(wfremodelMapping.toDomain(wfremodeldto)));
}
@PreAuthorize("hasPermission('Save',{'None',this.humanMapping,#humandtos})")
@PreAuthorize("hasPermission('Save',{'None',this.wfremodelMapping,#wfremodeldtos})")
@ApiOperation(value = "SaveBatch", tags = {"WFREModel" }, notes = "SaveBatch")
@RequestMapping(method = RequestMethod.POST, value = "/wfremodels/savebatch")
public ResponseEntity<Boolean> saveBatch(@RequestBody List<WFREModelDTO> wfremodeldtos) {
......@@ -109,7 +102,7 @@ public class WFREModelResource {
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasPermission('Create',{'None',this.humanMapping,#humandtos})")
@PreAuthorize("hasPermission('Create',{'None',this.wfremodelMapping,#wfremodeldtos})")
@ApiOperation(value = "createBatch", tags = {"WFREModel" }, notes = "createBatch")
@RequestMapping(method = RequestMethod.POST, value = "/wfremodels/batch")
public ResponseEntity<Boolean> createBatch(@RequestBody List<WFREModelDTO> wfremodeldtos) {
......@@ -132,7 +125,7 @@ public class WFREModelResource {
return ResponseEntity.status(HttpStatus.OK).body(wfremodelService.remove(wfremodel_id));
}
@PreAuthorize("hasPermission('Remove',{'None',this.humanMapping,this.permissionDTO,#ids})")
@PreAuthorize("hasPermission('Remove',{'None',this.wfremodelMapping,this.permissionDTO,#ids})")
@ApiOperation(value = "RemoveBatch", tags = {"WFREModel" }, notes = "RemoveBatch")
@RequestMapping(method = RequestMethod.DELETE, value = "/wfremodels/batch")
public ResponseEntity<Boolean> removeBatch(@RequestBody List<String> ids) {
......
......@@ -6,10 +6,8 @@ import java.util.List;
import java.util.Map;
import java.math.BigInteger;
import java.util.HashMap;
import lombok.extern.slf4j.Slf4j;
import com.alibaba.fastjson.JSONObject;
import javax.servlet.ServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cglib.beans.BeanCopier;
......@@ -24,21 +22,16 @@ import org.springframework.data.domain.Pageable;
import org.springframework.util.StringUtils;
import org.springframework.context.annotation.Lazy;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import cn.ibizlab.api.dto.*;
import cn.ibizlab.api.mapping.*;
import cn.ibizlab.core.workflow.domain.WFSystem;
import cn.ibizlab.core.workflow.service.IWFSystemService;
import cn.ibizlab.core.workflow.filter.WFSystemSearchContext;
@Slf4j
@Api(tags = {"WFSystem" })
@RestController("api-wfsystem")
......@@ -62,7 +55,7 @@ public class WFSystemResource {
return ResponseEntity.status(HttpStatus.OK).body(wfsystemService.remove(wfsystem_id));
}
@PreAuthorize("hasPermission('Remove',{'Sql',this.humanMapping,this.permissionDTO,#ids})")
@PreAuthorize("hasPermission('Remove',{'Sql',this.wfsystemMapping,this.permissionDTO,#ids})")
@ApiOperation(value = "RemoveBatch", tags = {"WFSystem" }, notes = "RemoveBatch")
@RequestMapping(method = RequestMethod.DELETE, value = "/wfsystems/batch")
public ResponseEntity<Boolean> removeBatch(@RequestBody List<String> ids) {
......@@ -82,7 +75,7 @@ public class WFSystemResource {
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasPermission('Update',{'Sql',this.humanMapping,#humandtos})")
@PreAuthorize("hasPermission('Update',{'Sql',this.wfsystemMapping,#wfsystemdtos})")
@ApiOperation(value = "UpdateBatch", tags = {"WFSystem" }, notes = "UpdateBatch")
@RequestMapping(method = RequestMethod.PUT, value = "/wfsystems/batch")
public ResponseEntity<Boolean> updateBatch(@RequestBody List<WFSystemDTO> wfsystemdtos) {
......@@ -104,7 +97,7 @@ public class WFSystemResource {
return ResponseEntity.status(HttpStatus.OK).body(wfsystemService.save(wfsystemMapping.toDomain(wfsystemdto)));
}
@PreAuthorize("hasPermission('Save',{'Sql',this.humanMapping,#humandtos})")
@PreAuthorize("hasPermission('Save',{'Sql',this.wfsystemMapping,#wfsystemdtos})")
@ApiOperation(value = "SaveBatch", tags = {"WFSystem" }, notes = "SaveBatch")
@RequestMapping(method = RequestMethod.POST, value = "/wfsystems/savebatch")
public ResponseEntity<Boolean> saveBatch(@RequestBody List<WFSystemDTO> wfsystemdtos) {
......@@ -123,7 +116,7 @@ public class WFSystemResource {
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasPermission('Create',{'Sql',this.humanMapping,#humandtos})")
@PreAuthorize("hasPermission('Create',{'Sql',this.wfsystemMapping,#wfsystemdtos})")
@ApiOperation(value = "createBatch", tags = {"WFSystem" }, notes = "createBatch")
@RequestMapping(method = RequestMethod.POST, value = "/wfsystems/batch")
public ResponseEntity<Boolean> createBatch(@RequestBody List<WFSystemDTO> wfsystemdtos) {
......
......@@ -6,10 +6,8 @@ import java.util.List;
import java.util.Map;
import java.math.BigInteger;
import java.util.HashMap;
import lombok.extern.slf4j.Slf4j;
import com.alibaba.fastjson.JSONObject;
import javax.servlet.ServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cglib.beans.BeanCopier;
......@@ -24,21 +22,16 @@ import org.springframework.data.domain.Pageable;
import org.springframework.util.StringUtils;
import org.springframework.context.annotation.Lazy;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import cn.ibizlab.api.dto.*;
import cn.ibizlab.api.mapping.*;
import cn.ibizlab.core.workflow.domain.WFUser;
import cn.ibizlab.core.workflow.service.IWFUserService;
import cn.ibizlab.core.workflow.filter.WFUserSearchContext;
@Slf4j
@Api(tags = {"WFUser" })
@RestController("api-wfuser")
......@@ -62,7 +55,7 @@ public class WFUserResource {
return ResponseEntity.status(HttpStatus.OK).body(wfuserService.remove(wfuser_id));
}
@PreAuthorize("hasPermission('Remove',{'Sql',this.humanMapping,this.permissionDTO,#ids})")
@PreAuthorize("hasPermission('Remove',{'Sql',this.wfuserMapping,this.permissionDTO,#ids})")
@ApiOperation(value = "RemoveBatch", tags = {"WFUser" }, notes = "RemoveBatch")
@RequestMapping(method = RequestMethod.DELETE, value = "/wfusers/batch")
public ResponseEntity<Boolean> removeBatch(@RequestBody List<String> ids) {
......@@ -84,7 +77,7 @@ public class WFUserResource {
return ResponseEntity.status(HttpStatus.OK).body(wfuserService.save(wfuserMapping.toDomain(wfuserdto)));
}
@PreAuthorize("hasPermission('Save',{'Sql',this.humanMapping,#humandtos})")
@PreAuthorize("hasPermission('Save',{'Sql',this.wfuserMapping,#wfuserdtos})")
@ApiOperation(value = "SaveBatch", tags = {"WFUser" }, notes = "SaveBatch")
@RequestMapping(method = RequestMethod.POST, value = "/wfusers/savebatch")
public ResponseEntity<Boolean> saveBatch(@RequestBody List<WFUserDTO> wfuserdtos) {
......@@ -104,7 +97,7 @@ public class WFUserResource {
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasPermission('Update',{'Sql',this.humanMapping,#humandtos})")
@PreAuthorize("hasPermission('Update',{'Sql',this.wfuserMapping,#wfuserdtos})")
@ApiOperation(value = "UpdateBatch", tags = {"WFUser" }, notes = "UpdateBatch")
@RequestMapping(method = RequestMethod.PUT, value = "/wfusers/batch")
public ResponseEntity<Boolean> updateBatch(@RequestBody List<WFUserDTO> wfuserdtos) {
......@@ -132,7 +125,7 @@ public class WFUserResource {
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasPermission('Create',{'Sql',this.humanMapping,#humandtos})")
@PreAuthorize("hasPermission('Create',{'Sql',this.wfuserMapping,#wfuserdtos})")
@ApiOperation(value = "createBatch", tags = {"WFUser" }, notes = "createBatch")
@RequestMapping(method = RequestMethod.POST, value = "/wfusers/batch")
public ResponseEntity<Boolean> createBatch(@RequestBody List<WFUserDTO> wfuserdtos) {
......
......@@ -4,14 +4,13 @@ import cn.ibizlab.util.security.AuthenticationUser;
import cn.ibizlab.util.security.AuthorizationLogin;
import org.springframework.stereotype.Component;
import com.alibaba.fastjson.JSONObject;
import java.util.Map;
@Component
public class IBZUAAFallback implements IBZUAAFeignClient {
@Override
public JSONObject pushSystemPermissionData(Map<String, Object> systemPermissionData, String systemId) {
return null;
public boolean pushSystemPermissionData(String systemid,JSONObject systemPermissionData) {
return false;
}
@Override
......
......@@ -5,19 +5,18 @@ import cn.ibizlab.util.security.AuthorizationLogin;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import com.alibaba.fastjson.JSONObject;
import java.util.Map;
@FeignClient(value = "ibzuaa-api",fallback = IBZUAAFallback.class)
public interface IBZUAAFeignClient
{
/**
* 推送系统权限数据到uaa
* @param systemid
* @param systemPermissionData
* @param systemId
* @return
*/
@PostMapping("/uaa/permission/save")
JSONObject pushSystemPermissionData(@RequestBody Map<String, Object> systemPermissionData, @RequestParam("systemid") String systemId);
@PostMapping("/syspssystems/{systemid}/permissiondata")
boolean pushSystemPermissionData(@PathVariable("systemid") String systemid,@RequestBody JSONObject systemPermissionData);
/**
* 用户登录
......
......@@ -183,7 +183,7 @@ public class DEFieldCacheMap {
Field field = DEFieldCacheMap.getField(clazz,fieldname);
if(field!=null) {
DEField deField=field.getAnnotation(DEField.class);
if(deField!=null&&deField.name()!=null)
if(deField!=null&& !StringUtils.isEmpty(deField.name()))
return deField.name();
}
return fieldname;
......
package cn.ibizlab.util.job;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import cn.ibizlab.util.client.IBZUAAFeignClient;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.IOUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
import java.util.List;
import java.util.ArrayList;
import java.io.IOException;
/**
* 权限:向uaa同步当前系统菜单、权限资源任务类
*/
//@Component //开启此类需要保证Main中开启了feign :EnableFeignClients
@Slf4j
@Component
@ConditionalOnProperty( name = "ibiz.enablePermissionValid", havingValue = "true")
public class PermissionSyncJob implements ApplicationRunner {
private Log log = LogFactory.getLog(PermissionSyncJob.class);
@Autowired
@Lazy
private IBZUAAFeignClient client;
@Value("${ibiz.enablePermissionValid:false}")
boolean enablePermissionValid; //是否开启权限校验
@Value("${ibiz.systemid:ibzwf}")
private String systemId;
@Override
public void run(ApplicationArguments args) {
if(enablePermissionValid){
try {
InputStream permission= this.getClass().getResourceAsStream("/permission/systemResource.json"); //获取当前系统所有实体资源能力
String permissionResult = IOUtils.toString(permission,"UTF-8");
JSONObject jsonNodePermission = JSONObject.parseObject(permissionResult);
Map<String,Object> map=new HashMap<>();
map.put("permission",jsonNodePermission);
JSONObject syncResult=client.pushSystemPermissionData(map,systemId);
if(syncResult.getInteger("code")==1){
log.info("向[UAA]同步系统资源成功");
}else{
log.info(String.format("向[UAA]同步系统资源失败,失败原因为[%s]",syncResult.getString("msg")));
}
}
catch (Exception ex) {
log.error(String.format("向[UAA]同步系统资源失败,请检查[UAA]服务是否正常! [%s]",ex));
try {
Thread.sleep(10000);
InputStream permission= this.getClass().getResourceAsStream("/permission/systemResource.json"); //获取当前系统所有实体资源能力
String permissionResult = IOUtils.toString(permission,"UTF-8");
if(client.pushSystemPermissionData(systemId,JSONObject.parseObject(permissionResult))){
log.info("向[UAA]同步系统资源成功");
}else{
log.info(String.format("向[UAA]同步系统资源失败"));
}
}
catch (Exception ex) {
log.error(String.format("向[UAA]同步系统资源失败,请检查[UAA]服务是否正常! [%s]",ex));
}
}
}
\ No newline at end of file
......@@ -117,43 +117,6 @@ public class AuthPermissionEvaluator implements PermissionEvaluator {
}
}
/**
* 批save校验
* @param deStorageMode
* @param entityList
* @param dataRangeList
* @return
*/
private boolean saveBatchActionPermissionValid(String deStorageMode, List<EntityBase> entityList, JSONArray dataRangeList) {
if(entityList==null || entityList.size()==0)
return false;
EntityBase tempEntity=entityList.get(0);
Map<String,String> permissionField=getPermissionField(tempEntity);
String keyFieldName=permissionField.get(keyFieldTag);
List createList=new ArrayList();
List<String> updateList =new ArrayList();
for(EntityBase entity : entityList){
Object id = entity.get(keyFieldName);
if(ObjectUtils.isEmpty(id))
createList.add(entity);
else
updateList.add(String.valueOf(id));
}
if(updateList.size()>0){
boolean isUpdate = otherBatchActionPermissionValidRouter(deStorageMode, tempEntity ,updateList, dataRangeList);
if(!isUpdate)
return false;
}
if(createList.size()>0){
boolean isCreate=createBatchActionPermissionValid(entityList,dataRangeList);
if(!isCreate)
return false;
}
return true;
}
/**
* 实体行为权限检查 :用于检查当前用户是否拥有实体的新建、编辑、删除权限
*
......@@ -214,6 +177,43 @@ public class AuthPermissionEvaluator implements PermissionEvaluator {
}
}
/**
* 批save校验
* @param deStorageMode
* @param entityList
* @param dataRangeList
* @return
*/
private boolean saveBatchActionPermissionValid(String deStorageMode, List<EntityBase> entityList, JSONArray dataRangeList) {
if(entityList==null || entityList.size()==0)
return false;
EntityBase tempEntity=entityList.get(0);
Map<String,String> permissionField=getPermissionField(tempEntity);
String keyFieldName=permissionField.get(keyFieldTag);
List createList=new ArrayList();
List<String> updateList =new ArrayList();
for(EntityBase entity : entityList){
Object id = entity.get(keyFieldName);
if(ObjectUtils.isEmpty(id))
createList.add(entity);
else
updateList.add(String.valueOf(id));
}
if(updateList.size()>0){
boolean isUpdate = otherBatchActionPermissionValidRouter(deStorageMode, tempEntity ,updateList, dataRangeList);
if(!isUpdate)
return false;
}
if(createList.size()>0){
boolean isCreate=createBatchActionPermissionValid(entityList,dataRangeList);
if(!isCreate)
return false;
}
return true;
}
/**
* 批处理新建权限校验
* @param entityList
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册