mirror of
https://github.com/dqjdda/Aurora.git
synced 2018-11-06 05:33:29 +00:00
图标选择器插件更新,代码优化
This commit is contained in:
@@ -30,6 +30,10 @@ public class AlipayServiceImpl implements AlipayService {
|
||||
|
||||
@Override
|
||||
public String toPayAsPC(AlipayConfig alipay, TradeVo trade) throws Exception {
|
||||
|
||||
if(alipay == null){
|
||||
throw new AuroraException(HttpStatus.HTTP_NOT_FOUND,"请先添加相应配置,再操作");
|
||||
}
|
||||
AlipayClient alipayClient = new DefaultAlipayClient(alipay.getGatewayUrl(), alipay.getAppID(), alipay.getPrivateKey(), alipay.getFormat(), alipay.getCharset(), alipay.getPublicKey(), alipay.getSignType());
|
||||
|
||||
double money = Double.parseDouble(trade.getTotalAmount());
|
||||
@@ -70,6 +74,9 @@ public class AlipayServiceImpl implements AlipayService {
|
||||
|
||||
@Override
|
||||
public String toPayAsWeb(AlipayConfig alipay, TradeVo trade) throws Exception {
|
||||
if(alipay == null){
|
||||
throw new AuroraException(HttpStatus.HTTP_NOT_FOUND,"请先添加相应配置,再操作");
|
||||
}
|
||||
AlipayClient alipayClient = new DefaultAlipayClient(alipay.getGatewayUrl(), alipay.getAppID(), alipay.getPrivateKey(), alipay.getFormat(), alipay.getCharset(), alipay.getPublicKey(), alipay.getSignType());
|
||||
|
||||
double money = Double.parseDouble(trade.getTotalAmount());
|
||||
|
||||
@@ -53,6 +53,9 @@ public class EmailServiceImpl implements EmailService {
|
||||
@Override
|
||||
public void send(EmailVo emailVo, EmailConfig emailConfig) throws Exception {
|
||||
|
||||
if(emailConfig == null){
|
||||
throw new AuroraException(HttpStatus.HTTP_NOT_FOUND,"请先添加相应配置,再操作");
|
||||
}
|
||||
/**
|
||||
* 封装
|
||||
*/
|
||||
|
||||
@@ -115,16 +115,18 @@ public class MenuServiceImpl implements MenuService {
|
||||
}
|
||||
if(menu.getLevelNum() == 0){
|
||||
try {
|
||||
Optional<Menu> optionalMenu = menuRepo.findById(menu.getPid().longValue());
|
||||
ValidationUtil.isNull(optionalMenu,"pid:"+menu.getPid().longValue()+"is not find");
|
||||
Menu pMenu = optionalMenu.get();
|
||||
pMenu.setLevelNum(pMenu.getLevelNum()-1);
|
||||
if(menu.getPid() != 0){
|
||||
Optional<Menu> optionalMenu = menuRepo.findById(menu.getPid().longValue());
|
||||
Menu pMenu = optionalMenu.get();
|
||||
pMenu.setLevelNum(pMenu.getLevelNum()-1);
|
||||
}
|
||||
}catch (Exception e){
|
||||
throw new AuroraException(HttpStatus.HTTP_INTERNAL_ERROR,e.toString());
|
||||
}
|
||||
menuRepo.delete(menu);
|
||||
} else {
|
||||
Set<Menu> menus = menuRepo.findByPid(menu.getPid()).stream().collect(Collectors.toSet());
|
||||
Set<Menu> menus = menuRepo.findByPid(Integer.parseInt(menu.getId()+"")).stream().collect(Collectors.toSet());
|
||||
menus.add(menu);
|
||||
if(menus !=null && menus.size()!=0){
|
||||
menuRepo.deleteAll(menus);
|
||||
}
|
||||
|
||||
@@ -76,6 +76,9 @@ public class QiNiuServiceImpl implements QiNiuService {
|
||||
@Override
|
||||
public void upload(MultipartFile file,QiniuConfig qiniuConfig) {
|
||||
|
||||
if(qiniuConfig == null){
|
||||
throw new AuroraException(HttpStatus.HTTP_NOT_FOUND,"请先添加相应配置,再操作");
|
||||
}
|
||||
/**
|
||||
* 构造一个带指定Zone对象的配置类
|
||||
*/
|
||||
@@ -140,6 +143,9 @@ public class QiNiuServiceImpl implements QiNiuService {
|
||||
|
||||
@Override
|
||||
public void synchronize(QiniuConfig config) {
|
||||
if(config == null){
|
||||
throw new AuroraException(HttpStatus.HTTP_NOT_FOUND,"请先添加相应配置,再操作");
|
||||
}
|
||||
//构造一个带指定Zone对象的配置类
|
||||
Configuration cfg = QiNiuUtil.getConfiguration(config.getZone());
|
||||
Auth auth = Auth.create(config.getAccessKey(), config.getSecretKey());
|
||||
|
||||
Reference in New Issue
Block a user