Skip to content
Merged

Dev #124

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions admin-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"@ant-design/icons": "^5.4.0",
"@ant-design/pro-components": "^2.8.7",
"@babel/standalone": "^7.25.6",
"@codingapi/flow-pc": "^0.0.41",
"@codingapi/form-pc": "^0.0.41",
"@codingapi/ui-framework": "^0.0.41",
"@codingapi/flow-pc": "^0.0.42",
"@codingapi/form-pc": "^0.0.42",
"@codingapi/ui-framework": "^0.0.42",
"@dnd-kit/core": "^6.2.0",
"@dnd-kit/sortable": "^9.0.0",
"@handsontable/react-wrapper": "^15.0.0",
Expand Down
8 changes: 8 additions & 0 deletions admin-ui/src/api/flow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,14 @@ export async function urge(body:any) {
return httpClient.post('/api/cmd/flowRecord/urge', body);
}

export async function back(body:any) {
return httpClient.post('/api/cmd/flowRecord/back', body);
}

export async function voided(body:any) {
return httpClient.post('/api/cmd/flowRecord/voided', body);
}


// 待办中心控制

Expand Down
16 changes: 16 additions & 0 deletions admin-ui/src/components/flow/register.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,22 @@ class DefaultFlowApiImpl implements FlowApi{
return flowApi.detail(null,workCode);
}

backFlow(body: any): Promise<any> {
return flowApi.back(body);
}

voidedFlow(body: any): Promise<any> {
return flowApi.voided(body);
}

getFlowStep(recordId?: number, workCode?: string): Promise<any> {
const body = {
recordId,
workCode
}
return flowApi.getFlowStep(body);
}

}

FlowApiContent.getInstance().registerFlowApi(new DefaultFlowApiImpl());
Expand Down
2 changes: 1 addition & 1 deletion example/example-app/example-app-cmd-domain/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.codingapi.springboot</groupId>
<artifactId>example-app</artifactId>
<version>3.4.7</version>
<version>3.4.8</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion example/example-app/example-app-cmd-meta/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.codingapi.springboot</groupId>
<artifactId>example-app</artifactId>
<version>3.4.7</version>
<version>3.4.8</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,29 @@ public String getUserName() {
}


@Setter
@Getter
public static class BackFlow {

private String processId;
private String backNodeCode;

public String getUserName() {
return TokenContext.current().getUsername();
}
}

@Setter
@Getter
public static class VoidedFlow {

private String processId;

public String getUserName() {
return TokenContext.current().getUsername();
}
}

@Setter
@Getter
public static class PostponedFlow {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,14 @@ public void remove(FlowCmd.RemoveFlow request) {
IFlowOperator current = flowUserRepository.getUserByUsername(request.getUserName());
flowService.remove(request.getRecordId(), current);
}

public void back(FlowCmd.BackFlow request) {
IFlowOperator current = flowUserRepository.getUserByUsername(request.getUserName());
flowService.back(request.getProcessId(),request.getBackNodeCode(), current);
}

public void voided(FlowCmd.VoidedFlow request) {
IFlowOperator current = flowUserRepository.getUserByUsername(request.getUserName());
flowService.voided(request.getProcessId(), current);
}
}
2 changes: 1 addition & 1 deletion example/example-app/example-app-query/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.codingapi.springboot</groupId>
<artifactId>example-app</artifactId>
<version>3.4.7</version>
<version>3.4.8</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion example/example-app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.codingapi.springboot</groupId>
<artifactId>springboot-example</artifactId>
<version>3.4.7</version>
<version>3.4.8</version>
<relativePath>../pom.xml</relativePath>
</parent>
<packaging>pom</packaging>
Expand Down
2 changes: 1 addition & 1 deletion example/example-domain/example-domain-leave/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.codingapi.springboot</groupId>
<artifactId>example-domain</artifactId>
<version>3.4.7</version>
<version>3.4.8</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion example/example-domain/example-domain-user/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.codingapi.springboot</groupId>
<artifactId>example-domain</artifactId>
<version>3.4.7</version>
<version>3.4.8</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion example/example-domain/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.codingapi.springboot</groupId>
<artifactId>springboot-example</artifactId>
<version>3.4.7</version>
<version>3.4.8</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion example/example-infra/example-infra-flow/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.codingapi.springboot</groupId>
<artifactId>example-infra</artifactId>
<version>3.4.7</version>
<version>3.4.8</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public static FlowProcess convert(FlowProcessEntity entity){
return null;
}
return new FlowProcess(entity.getProcessId(),
entity.getCreateTime(),entity.getBackupId(),entity.getCreateOperatorId());
entity.getCreateTime(),entity.getBackupId(),entity.getCreateOperatorId(), entity.getVoided());
}


Expand All @@ -23,6 +23,7 @@ public static FlowProcessEntity convert(FlowProcess flowProcess){
entity.setCreateTime(flowProcess.getCreateTime());
entity.setBackupId(flowProcess.getBackupId());
entity.setCreateOperatorId(flowProcess.getCreateOperatorId());
entity.setVoided(flowProcess.isVoided());
return entity;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,9 @@ public class FlowProcessEntity {
*/
private Long createOperatorId;

/**
* 是否作废
*/
private Boolean voided;

}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ public interface FlowProcessEntityRepository extends FastRepository<FlowProcessE

FlowProcessEntity getFlowProcessEntityByProcessId(String processId);


void deleteByProcessId(String processId);

}
Original file line number Diff line number Diff line change
Expand Up @@ -10,68 +10,68 @@

public interface FlowRecordEntityRepository extends FastRepository<FlowRecordEntity, Long> {


@Query(value = "select r from FlowRecordEntity r where r.flowType!='DELETE' and r.id = ?1")
FlowRecordEntity getFlowRecordEntityById(long id);

void deleteByProcessId(String processId);


@Query(value = "select r from FlowRecordEntity r where r.flowType!='DELETE' and r.preId = ?1")
List<FlowRecordEntity> findFlowRecordEntityByPreId(long preId);

@Query(value = "select r from FlowRecordEntity r where r.flowType!='DELETE' and r.processId = ?1")
List<FlowRecordEntity> findFlowRecordEntityByProcessId(String processId);

@Query(value = "select r from FlowRecordEntity r where r.flowType = 'TODO' and r.flowStatus = 'RUNNING' and r.processId = ?1")
@Query(value = "select r from FlowRecordEntity r where r.flowType!='DELETE' and r.flowType = 'TODO' and r.flowStatus = 'RUNNING' and r.processId = ?1")
List<FlowRecordEntity> findTodoFlowRecordByProcessId(String processId);

@Query(value = "select r from FlowRecordEntity r" +
" LEFT JOIN (select min(m.id) as id from FlowRecordEntity m where m.currentOperatorId = ?1 and m.flowType = 'TODO' and m.flowStatus = 'RUNNING' and m.mergeable = true ) debup " +
"on r.id = debup.id" +
" where r.currentOperatorId = ?1 and r.flowType = 'TODO' and r.flowStatus = 'RUNNING'" +
" where r.flowType!='DELETE' and r.currentOperatorId = ?1 and r.flowType = 'TODO' and r.flowStatus = 'RUNNING'" +
" and (r.mergeable !=true or debup.id is NOT null ) order by r.id desc")
Page<FlowRecordEntity> findTodoByOperatorId(long operatorId, PageRequest pageRequest);

@Query(value = "select r from FlowRecordEntity r where r.currentOperatorId = ?1 and r.workCode = ?2 and r.nodeCode = ?3" +
@Query(value = "select r from FlowRecordEntity r where r.flowType!='DELETE'and r.currentOperatorId = ?1 and r.workCode = ?2 and r.nodeCode = ?3" +
" and r.mergeable = true and r.flowType = 'TODO' and r.flowStatus = 'RUNNING' order by r.id desc")
List<FlowRecordEntity> findMergeFlowRecordById(long currentOperatorId,String workCode, String nodeCode);

@Query(value = "select r from FlowRecordEntity r where r.currentOperatorId = ?1 and r.workCode = ?2 and r.flowType = 'TODO' and r.flowStatus = 'RUNNING' order by r.id desc")
@Query(value = "select r from FlowRecordEntity r where r.flowType!='DELETE'and r.currentOperatorId = ?1 and r.workCode = ?2 and r.flowType = 'TODO' and r.flowStatus = 'RUNNING' order by r.id desc")
Page<FlowRecordEntity> findTodoByOperatorIdAndWorkCode(long operatorId, String workCode, PageRequest pageRequest);

@Query(value = "select r from FlowRecordEntity r where r.currentOperatorId = ?1 and r.read = false and r.flowStatus = 'RUNNING' order by r.id desc")
@Query(value = "select r from FlowRecordEntity r where r.flowType!='DELETE'and r.currentOperatorId = ?1 and r.read = false and r.flowStatus = 'RUNNING' order by r.id desc")
Page<FlowRecordEntity> findUnReadByOperatorId(long operatorId, PageRequest pageRequest);

@Query(value = "select r from FlowRecordEntity r where r.currentOperatorId = ?1 and r.workCode = ?2 and r.read = false and r.flowStatus = 'RUNNING' order by r.id desc")
@Query(value = "select r from FlowRecordEntity r where r.flowType!='DELETE'and r.currentOperatorId = ?1 and r.workCode = ?2 and r.read = false and r.flowStatus = 'RUNNING' order by r.id desc")
Page<FlowRecordEntity> findUnReadByOperatorIdAndWorkCode(long operatorId, String workCode, PageRequest pageRequest);

@Query(value = "select d from FlowRecordEntity d where d.id in (select max(r.id) from FlowRecordEntity r where r.currentOperatorId = ?1 and r.flowType = 'DONE' group by r.processId ) order by d.id desc")
@Query(value = "select d from FlowRecordEntity d where d.flowType!='DELETE'and d.id in (select max(r.id) from FlowRecordEntity r where r.currentOperatorId = ?1 and r.flowType = 'DONE' group by r.processId ) order by d.id desc")
Page<FlowRecordEntity> findDoneByOperatorId(long operatorId, PageRequest pageRequest);

@Query(value = "select d from FlowRecordEntity d where d.id in (select max(r.id) from FlowRecordEntity r where r.currentOperatorId = ?1 and r.workCode = ?2 and r.flowType = 'DONE' group by r.processId) order by d.id desc")
@Query(value = "select d from FlowRecordEntity d where d.flowType!='DELETE'and d.id in (select max(r.id) from FlowRecordEntity r where r.currentOperatorId = ?1 and r.workCode = ?2 and r.flowType = 'DONE' group by r.processId) order by d.id desc")
Page<FlowRecordEntity> findDoneByOperatorIdAndworkCode(long operatorId, String workCode, PageRequest pageRequest);

@Query(value = "select d from FlowRecordEntity d where d.id in (select max(r.id) from FlowRecordEntity r where r.currentOperatorId = ?1 and r.preId = 0 and r.nodeCode = 'start' group by r.processId) order by d.id desc")
@Query(value = "select d from FlowRecordEntity d where d.flowType!='DELETE'and d.id in (select max(r.id) from FlowRecordEntity r where r.currentOperatorId = ?1 and r.preId = 0 and r.nodeCode = 'start' group by r.processId) order by d.id desc")
Page<FlowRecordEntity> findInitiatedByOperatorId(long operatorId, PageRequest pageRequest);

@Query(value = "select d from FlowRecordEntity d where d.id in (select max(r.id) from FlowRecordEntity r where r.currentOperatorId = ?1 group by r.processId) order by d.id desc")
@Query(value = "select d from FlowRecordEntity d where d.flowType!='DELETE' and d.id in (select max(r.id) from FlowRecordEntity r where r.currentOperatorId = ?1 group by r.processId) order by d.id desc")
Page<FlowRecordEntity> findAllByOperatorId(long operatorId, PageRequest pageRequest);

@Query(value = "select d from FlowRecordEntity d where d.id in (select max(r.id) from FlowRecordEntity r where r.currentOperatorId = ?1 and r.workCode = ?2 and r.preId = 0 and r.nodeCode = 'start' group by r.processId) order by d.id desc")
@Query(value = "select d from FlowRecordEntity d where d.flowType!='DELETE' and d.id in (select max(r.id) from FlowRecordEntity r where r.currentOperatorId = ?1 and r.workCode = ?2 and r.preId = 0 and r.nodeCode = 'start' group by r.processId) order by d.id desc")
Page<FlowRecordEntity> findInitiatedByOperatorIdAndWorkCode(long operatorId, String workCode, PageRequest pageRequest);

@Query(value = "select r from FlowRecordEntity r where r.currentOperatorId = ?1 and r.flowType = 'TODO' and r.flowStatus = 'RUNNING' and r.timeoutTime >0 and r.timeoutTime < ?2 order by r.id desc")
@Query(value = "select r from FlowRecordEntity r where r.flowType!='DELETE' and r.currentOperatorId = ?1 and r.flowType = 'TODO' and r.flowStatus = 'RUNNING' and r.timeoutTime >0 and r.timeoutTime < ?2 order by r.id desc")
Page<FlowRecordEntity> findTimeoutTodoByOperatorId(long operatorId, long currentTime, PageRequest pageRequest);

@Query(value = "select r from FlowRecordEntity r where r.currentOperatorId = ?1 and r.workCode = ?2 and r.flowType = 'TODO' and r.flowStatus = 'RUNNING' and r.timeoutTime >0 and r.timeoutTime < ?3 order by r.id desc")
@Query(value = "select r from FlowRecordEntity r where r.flowType!='DELETE' and r.currentOperatorId = ?1 and r.workCode = ?2 and r.flowType = 'TODO' and r.flowStatus = 'RUNNING' and r.timeoutTime >0 and r.timeoutTime < ?3 order by r.id desc")
Page<FlowRecordEntity> findTimeoutTodoByOperatorIdAndWorkCode(long operatorId, String workCode, long currentTime, PageRequest pageRequest);

@Query(value = "select r from FlowRecordEntity r where r.currentOperatorId = ?1 and r.flowType = 'TODO' and r.flowStatus = 'RUNNING' and r.postponedCount > 0 order by r.id desc")
@Query(value = "select r from FlowRecordEntity r where r.flowType!='DELETE' and r.currentOperatorId = ?1 and r.flowType = 'TODO' and r.flowStatus = 'RUNNING' and r.postponedCount > 0 order by r.id desc")
Page<FlowRecordEntity> findPostponedTodoByOperatorId(long operatorId, PageRequest pageRequest);

@Query(value = "select r from FlowRecordEntity r where r.currentOperatorId = ?1 and r.workCode =?2 and r.flowType = 'TODO' and r.flowStatus = 'RUNNING' and r.postponedCount > 0 order by r.id desc")
@Query(value = "select r from FlowRecordEntity r where r.flowType!='DELETE' and r.currentOperatorId = ?1 and r.workCode =?2 and r.flowType = 'TODO' and r.flowStatus = 'RUNNING' and r.postponedCount > 0 order by r.id desc")
Page<FlowRecordEntity> findPostponedTodoByOperatorIdAndWorkCode(long operatorId, String workCode, PageRequest pageRequest);


@Query(value = "select d from FlowRecordEntity d where d.id in (select max(r.id) from FlowRecordEntity r group by r.processId ) order by d.id desc")
@Query(value = "select d from FlowRecordEntity d where d.flowType!='DELETE' and d.id in (select max(r.id) from FlowRecordEntity r group by r.processId ) order by d.id desc")
Page<FlowRecordEntity> findAllFlowRecords(PageRequest pageRequest);

}
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,21 @@ public void save(FlowProcess flowProcess) {
flowProcessEntityRepository.save( FlowProcessConvertor.convert(flowProcess));
}

@Override
public FlowProcess getFlowProcessByProcessId(String processId) {
return FlowProcessConvertor.convert(flowProcessEntityRepository.getFlowProcessEntityByProcessId(processId));
}

@Override
public FlowWork getFlowWorkByProcessId(String processId) {
FlowProcess flowProcess = FlowProcessConvertor.convert(flowProcessEntityRepository.getFlowProcessEntityByProcessId(processId));
if(flowProcess==null){
return null;
}
if(flowProcess.isVoided()){
return null;
}

FlowBackup flowBackup = flowBackupRepository.getFlowBackupById(flowProcess.getBackupId());
if (flowBackup != null) {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ public FlowRecord getFlowRecordById(long id) {

@Override
public List<FlowRecord> findFlowRecordByPreId(long preId) {
return flowRecordEntityRepository.findFlowRecordEntityByPreId(preId).stream().map(item->FlowRecordConvertor.convert(item,flowOperatorRepository)).toList();
return flowRecordEntityRepository.findFlowRecordEntityByPreId(preId).stream()
.map(item->FlowRecordConvertor.convert(item,flowOperatorRepository))
.filter(flowRecord -> !flowRecord.isDelete())
.toList();
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion example/example-infra/example-infra-jpa/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.codingapi.springboot</groupId>
<artifactId>example-infra</artifactId>
<version>3.4.7</version>
<version>3.4.8</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion example/example-infra/example-infra-security/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.codingapi.springboot</groupId>
<artifactId>example-infra</artifactId>
<version>3.4.7</version>
<version>3.4.8</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion example/example-infra/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.codingapi.springboot</groupId>
<artifactId>springboot-example</artifactId>
<version>3.4.7</version>
<version>3.4.8</version>
<relativePath>../pom.xml</relativePath>
</parent>
<packaging>pom</packaging>
Expand Down
2 changes: 1 addition & 1 deletion example/example-interface/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.codingapi.springboot</groupId>
<artifactId>springboot-example</artifactId>
<version>3.4.7</version>
<version>3.4.8</version>
</parent>

<artifactId>example-interface</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,17 @@ public Response remove(@RequestBody FlowCmd.RemoveFlow request) {
return Response.buildSuccess();
}


@PostMapping("/back")
public Response back(@RequestBody FlowCmd.BackFlow request) {
flowRecordRouter.back(request);
return Response.buildSuccess();
}


@PostMapping("/voided")
public Response voided(@RequestBody FlowCmd.VoidedFlow request) {
flowRecordRouter.voided(request);
return Response.buildSuccess();
}
}
2 changes: 1 addition & 1 deletion example/example-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>springboot-example</artifactId>
<groupId>com.codingapi.springboot</groupId>
<version>3.4.7</version>
<version>3.4.8</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
</parent>

<artifactId>springboot-example</artifactId>
<version>3.4.7</version>
<version>3.4.8</version>

<name>springboot-example</name>
<description>springboot-example project for Spring Boot</description>
Expand Down
Loading