修改上传银行卡返回值
parent
1228cceba1
commit
8532c09b1b
|
@ -1,6 +1,8 @@
|
||||||
package com.health.system.server.controller;
|
package com.health.system.server.controller;
|
||||||
|
|
||||||
import com.health.common.core.domain.Result;
|
import com.health.common.core.domain.Result;
|
||||||
|
import com.health.common.core.utils.StringUtils;
|
||||||
|
import com.health.system.common.domain.BankCard;
|
||||||
import com.health.system.server.config.ForestClientInterface;
|
import com.health.system.server.config.ForestClientInterface;
|
||||||
import com.health.system.server.service.SysBankCardService;
|
import com.health.system.server.service.SysBankCardService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -37,7 +39,7 @@ public class SysBankCardController {
|
||||||
public Result bindUserBank(@RequestParam("bankImage") MultipartFile bankImage) throws IOException {
|
public Result bindUserBank(@RequestParam("bankImage") MultipartFile bankImage) throws IOException {
|
||||||
//获取银行卡照片的字节流
|
//获取银行卡照片的字节流
|
||||||
|
|
||||||
Boolean flag = sysBankCardService.bindUserBank(bankImage);
|
BankCard bankCard = sysBankCardService.bindUserBank(bankImage);
|
||||||
return flag == true ? Result.success("", "银行卡绑定成功") : Result.error("", "银行卡绑定失败");
|
return StringUtils.isNotNull(bankCard) ? Result.success(bankCard, "银行卡绑定成功") : Result.error("", "银行卡绑定失败");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.health.system.server.service;
|
package com.health.system.server.service;
|
||||||
|
|
||||||
|
import com.health.system.common.domain.BankCard;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -11,5 +12,5 @@ import java.io.IOException;
|
||||||
* @date 2023/10/28 15:11
|
* @date 2023/10/28 15:11
|
||||||
*/
|
*/
|
||||||
public interface SysBankCardService {
|
public interface SysBankCardService {
|
||||||
Boolean bindUserBank(MultipartFile bankImage) throws IOException;
|
BankCard bindUserBank(MultipartFile bankImage) throws IOException;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ public class SysBankCardServiceImpl implements SysBankCardService {
|
||||||
private SysBankCardMapper sysBankCardMapper;
|
private SysBankCardMapper sysBankCardMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean bindUserBank(MultipartFile bankImage) throws IOException {
|
public BankCard bindUserBank(MultipartFile bankImage) throws IOException {
|
||||||
Long userId = SecurityUtils.getUserId();
|
Long userId = SecurityUtils.getUserId();
|
||||||
byte[] bytes = bankImage.getBytes();
|
byte[] bytes = bankImage.getBytes();
|
||||||
String bank = Base64.getEncoder().encodeToString(bytes);
|
String bank = Base64.getEncoder().encodeToString(bytes);
|
||||||
|
@ -50,6 +50,6 @@ public class SysBankCardServiceImpl implements SysBankCardService {
|
||||||
bankCard.setBankType(cardType);
|
bankCard.setBankType(cardType);
|
||||||
bankCard.setCardName(cardName);
|
bankCard.setCardName(cardName);
|
||||||
System.out.println(bankCard);
|
System.out.println(bankCard);
|
||||||
return sysBankCardMapper.insertBankCard(bankCard)>0;
|
return sysBankCardMapper.insertBankCard(bankCard)>0?bankCard:null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue