-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
55 changed files
with
1,071 additions
and
1,636 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 42 additions & 1 deletion
43
auth-center/src/main/java/com/jmsoftware/maf/authcenter/role/controller/RoleController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,57 @@ | ||
package com.jmsoftware.maf.authcenter.role.controller; | ||
|
||
import com.jmsoftware.maf.authcenter.role.entity.RoleExcelBean; | ||
import com.jmsoftware.maf.authcenter.role.service.RoleService; | ||
import com.jmsoftware.maf.springcloudstarter.controller.AbstractExcelDataController; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import java.time.Instant; | ||
import java.util.List; | ||
|
||
/** | ||
* Description: RoleController, change description here. | ||
* | ||
* @author 钟俊(zhongjun), email: zhongjun@toguide.cn, date: 12/17/2020 4:44 PM | ||
**/ | ||
@Slf4j | ||
@RestController | ||
@RequiredArgsConstructor | ||
public class RoleController { | ||
@RequestMapping("/roles") | ||
public class RoleController extends AbstractExcelDataController<RoleExcelBean> { | ||
private final RoleService roleService; | ||
|
||
@Override | ||
public void onExceptionOccurred() { | ||
log.error("Exception occurred when uploading excel for role."); | ||
this.fileName.set("role-stat" + Instant.now() + ".xlsx"); | ||
} | ||
|
||
@Override | ||
protected void beforeDatabaseOperation(List<RoleExcelBean> beanList) { | ||
log.info("BeforeDatabaseOperation: {}", beanList); | ||
} | ||
|
||
@Override | ||
protected void executeDatabaseOperation(List<RoleExcelBean> beanList) throws Exception { | ||
log.info("ExecuteDatabaseOperation: {}", beanList); | ||
this.roleService.save(beanList); | ||
} | ||
|
||
@Override | ||
protected String getTemplateFileName() { | ||
return RoleService.ROLE_TEMPLATE_EXCEL; | ||
} | ||
|
||
@Override | ||
protected List<RoleExcelBean> getListForExporting() { | ||
return this.roleService.getListForExporting(); | ||
} | ||
|
||
@Override | ||
protected void validateBeforeAddToBeanList(List<RoleExcelBean> beanList, RoleExcelBean bean, int index) throws IllegalArgumentException { | ||
this.roleService.validateBeforeAddToBeanList(beanList, bean, index); | ||
} | ||
} |
Oops, something went wrong.