|
|
@@ -1,5 +1,6 @@
|
|
|
package com.ydtech.modules.inv.controller;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.ydtech.core.page.HttpResult;
|
|
|
import com.ydtech.modules.inv.model.InvAccount;
|
|
|
@@ -11,9 +12,10 @@ import io.swagger.annotations.ApiOperation;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
+import java.sql.Wrapper;
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
- *
|
|
|
* @author jianlong
|
|
|
* @date 2024-01-05 09:31
|
|
|
*/
|
|
|
@@ -29,14 +31,14 @@ public class InvAccountController {
|
|
|
|
|
|
@ApiOperation("获取账户列表")
|
|
|
@PostMapping("getAccount")
|
|
|
- public HttpResult<IPage<InvAccount>> getInsAccountList(@RequestBody InvAccount insAccount){
|
|
|
+ public HttpResult<IPage<InvAccount>> getInsAccountList(@RequestBody InvAccount insAccount) {
|
|
|
return HttpResult.ok("", invAccountService.selectAccountsListPage(insAccount));
|
|
|
}
|
|
|
|
|
|
@ApiOperation("获取账户详细信息")
|
|
|
@GetMapping("getAccountById")
|
|
|
- public HttpResult getInsAccountById(@RequestParam("accountId") String accountId){
|
|
|
- if (accountId == null){
|
|
|
+ public HttpResult getInsAccountById(@RequestParam("accountId") String accountId) {
|
|
|
+ if (accountId == null) {
|
|
|
throw new RuntimeException("id不能为空");
|
|
|
}
|
|
|
InvAccount invAccount = new InvAccount();
|
|
|
@@ -45,78 +47,108 @@ public class InvAccountController {
|
|
|
return HttpResult.ok("", invAccountService.selectAccounts(invAccount));
|
|
|
}
|
|
|
|
|
|
+ @ApiOperation("查询账户卡列表")
|
|
|
+ @PostMapping("getAccountCardList")
|
|
|
+ public HttpResult getInsAccountCardList(@RequestBody InvAccountCard invAccountCard) {
|
|
|
+
|
|
|
+
|
|
|
+ LambdaQueryWrapper<InvAccountCard> objectLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ objectLambdaQueryWrapper.eq(InvAccountCard::getAccountId, invAccountCard.getAccountId());
|
|
|
+ if (invAccountCard.getBankCardNum() != null) {
|
|
|
+ objectLambdaQueryWrapper.eq(InvAccountCard::getBankCardNum, invAccountCard.getBankCardNum());
|
|
|
+ } else if (invAccountCard.getBank() != null) {
|
|
|
+ objectLambdaQueryWrapper.eq(InvAccountCard::getBank, invAccountCard.getBank());
|
|
|
+ }
|
|
|
+ return HttpResult.ok("", invAccountCardService.list(objectLambdaQueryWrapper));
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
@ApiOperation("删除账户(只传一个id就行)")
|
|
|
@DeleteMapping("{accountId}")
|
|
|
- public HttpResult deleteInsAccount(@PathVariable("accountId") String accountId){
|
|
|
- if (accountId!= null){
|
|
|
+ public HttpResult deleteInsAccount(@PathVariable("accountId") String accountId) {
|
|
|
+ if (accountId != null) {
|
|
|
InvAccount invAccount = invAccountService.getById(accountId);
|
|
|
invAccount.setDelFlag("1");
|
|
|
- if (invAccountService.updateById(invAccount)){
|
|
|
+ if (invAccountService.updateById(invAccount)) {
|
|
|
return HttpResult.ok("删除成功");
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
return HttpResult.error();
|
|
|
}
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
return HttpResult.error("id不能为空");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @ApiOperation("删除账户卡")
|
|
|
+ @DeleteMapping("{bankCardNum}")
|
|
|
+ public HttpResult deleteInsAccountCard(@PathVariable("bankCardNum") String bankCardNum) {
|
|
|
+ if (bankCardNum == null) {
|
|
|
+ throw new RuntimeException("卡号为空");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (invAccountCardService.removeById(bankCardNum)){
|
|
|
+ return HttpResult.ok("删除成功");
|
|
|
+ }else {
|
|
|
+ return HttpResult.error("删除失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@ApiOperation("插入账户信息")
|
|
|
@PostMapping("insertAccount")
|
|
|
- public HttpResult insertInsAccount(@RequestBody InvAccount invAccount){
|
|
|
- if (invAccountService.save(invAccount)){
|
|
|
+ public HttpResult insertInsAccount(@RequestBody InvAccount invAccount) {
|
|
|
+ if (invAccountService.save(invAccount)) {
|
|
|
return HttpResult.ok();
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
return HttpResult.error();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@ApiOperation("插入账户卡信息")
|
|
|
@PostMapping("insertAccountCard")
|
|
|
- public HttpResult insertInsAccountCard(@RequestBody InvAccountCard invAccountCard){
|
|
|
+ public HttpResult insertInsAccountCard(@RequestBody InvAccountCard invAccountCard) {
|
|
|
|
|
|
- if (invAccountCard.getAccountId() == null){
|
|
|
+ if (invAccountCard.getAccountId() == null) {
|
|
|
throw new RuntimeException("账户id为空");
|
|
|
}
|
|
|
InvAccount byId = invAccountService.getById(invAccountCard.getAccountId());
|
|
|
- if (byId.getOuterFlag().equals("1")){
|
|
|
+ if (byId.getOuterFlag().equals("1")) {
|
|
|
throw new RuntimeException("外部账户不允许插入账户卡信息");
|
|
|
}
|
|
|
|
|
|
- if (invAccountCardService.insertInsAccountCard(invAccountCard) > 0){
|
|
|
+ if (invAccountCardService.insertInsAccountCard(invAccountCard) > 0) {
|
|
|
return HttpResult.ok();
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
return HttpResult.error();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@ApiOperation("修改账户信息")
|
|
|
@PostMapping("updateAccount")
|
|
|
- public HttpResult updateInsAccount(@RequestBody InvAccount invAccount){
|
|
|
- if (invAccountService.updateById(invAccount)){
|
|
|
+ public HttpResult updateInsAccount(@RequestBody InvAccount invAccount) {
|
|
|
+ if (invAccountService.updateById(invAccount)) {
|
|
|
return HttpResult.ok();
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
return HttpResult.error();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@ApiOperation("修改账户卡信息")
|
|
|
@PostMapping("updateAccountCard")
|
|
|
- public HttpResult updateInsAccountCard(@RequestBody InvAccountCard invAccountCard){
|
|
|
- if (invAccountCard.getBankCardNum() == null){
|
|
|
+ public HttpResult updateInsAccountCard(@RequestBody InvAccountCard invAccountCard) {
|
|
|
+ if (invAccountCard.getBankCardNum() == null) {
|
|
|
throw new RuntimeException("卡号不能为空");
|
|
|
}
|
|
|
|
|
|
- if (invAccountCardService.updateInsAccountCard(invAccountCard) > 0){
|
|
|
+ if (invAccountCardService.updateInsAccountCard(invAccountCard) > 0) {
|
|
|
return HttpResult.ok();
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
return HttpResult.error();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@ApiOperation("根据户名分类")
|
|
|
@GetMapping("getAccountByAccountName")
|
|
|
- public HttpResult selectByAccountName(){
|
|
|
+ public HttpResult selectByAccountName() {
|
|
|
return invAccountService.selectByAccountName();
|
|
|
}
|
|
|
}
|