|
@@ -1,6 +1,7 @@
|
|
|
package com.uas.platform.b2c.fa.payment.service.impl;
|
|
package com.uas.platform.b2c.fa.payment.service.impl;
|
|
|
|
|
|
|
|
import com.uas.platform.b2c.common.account.model.Enterprise;
|
|
import com.uas.platform.b2c.common.account.model.Enterprise;
|
|
|
|
|
+import com.uas.platform.b2c.common.account.model.User;
|
|
|
import com.uas.platform.b2c.common.base.model.FileUpload;
|
|
import com.uas.platform.b2c.common.base.model.FileUpload;
|
|
|
import com.uas.platform.b2c.common.base.service.FileService;
|
|
import com.uas.platform.b2c.common.base.service.FileService;
|
|
|
import com.uas.platform.b2c.core.config.SysConf;
|
|
import com.uas.platform.b2c.core.config.SysConf;
|
|
@@ -31,6 +32,7 @@ import javax.persistence.criteria.CriteriaBuilder;
|
|
|
import javax.persistence.criteria.CriteriaQuery;
|
|
import javax.persistence.criteria.CriteriaQuery;
|
|
|
import javax.persistence.criteria.Predicate;
|
|
import javax.persistence.criteria.Predicate;
|
|
|
import javax.persistence.criteria.Root;
|
|
import javax.persistence.criteria.Root;
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
import java.util.Arrays;
|
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
@@ -66,18 +68,21 @@ public class BankInfoServiceImpl implements BankInfoService {
|
|
|
bankInfo.setCreateTime(new Date());
|
|
bankInfo.setCreateTime(new Date());
|
|
|
type = Type.SUP.value();
|
|
type = Type.SUP.value();
|
|
|
bankInfo.setStatus(Status.ALLOW.value());
|
|
bankInfo.setStatus(Status.ALLOW.value());
|
|
|
- if(SystemSession.getUser().getEnterprise() == null) {
|
|
|
|
|
|
|
+ User user = SystemSession.getUser();
|
|
|
|
|
+ if(user.getEnterprise() == null) {
|
|
|
if(bankInfo.getId() == null) {
|
|
if(bankInfo.getId() == null) {
|
|
|
- int num = bankInfoDao.getCountByUseruuAndStatusAndDissociativeAndAccountType(SystemSession.getUser().getUserUU(), Type.PERSONAL.value(), bankInfo.getOpraterUserType(), Status.ALLOW.value(), bankInfo.getAccountType()) + 1;
|
|
|
|
|
|
|
+ List<Integer> list = new ArrayList<>();
|
|
|
|
|
+ list.add(Status.ALLOW.value());
|
|
|
|
|
+ int num = bankInfoDao.getCountByUseruuAndStatusAndDissociativeAndAccountType(user.getUserUU(), list, Type.PERSONAL.value(), bankInfo.getAccountType()) + 1;
|
|
|
bankInfo.setNum(num);
|
|
bankInfo.setNum(num);
|
|
|
}
|
|
}
|
|
|
- bankInfo.setUseruu(SystemSession.getUser().getUserUU());
|
|
|
|
|
|
|
+ bankInfo.setUseruu(user.getUserUU());
|
|
|
bankInfo.setDissociative(Type.PERSONAL.value());
|
|
bankInfo.setDissociative(Type.PERSONAL.value());
|
|
|
}else {
|
|
}else {
|
|
|
- bankInfo.setEnuu(SystemSession.getUser().getEnterprise().getUu());
|
|
|
|
|
|
|
+ bankInfo.setEnuu(user.getEnterprise().getUu());
|
|
|
bankInfo.setDissociative(Type.ENTERPRISING.value());
|
|
bankInfo.setDissociative(Type.ENTERPRISING.value());
|
|
|
if(bankInfo.getId() == null) {
|
|
if(bankInfo.getId() == null) {
|
|
|
- int count = bankInfoDao.getCountByEnuuAndStatusAndAccountType(SystemSession.getUser().getEnterprise().getUu(), bankInfo.getOpraterUserType(), statusList, bankInfo.getAccountType());
|
|
|
|
|
|
|
+ int count = bankInfoDao.getCountByEnuuAndStatusAndDissociativeAndAccountType(user.getEnterprise().getUu(), statusList, Type.ENTERPRISING.value(), bankInfo.getAccountType());
|
|
|
bankInfo.setNum(count + 1);
|
|
bankInfo.setNum(count + 1);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -188,16 +193,17 @@ public class BankInfoServiceImpl implements BankInfoService {
|
|
|
@Override
|
|
@Override
|
|
|
public List<BankInfo> getEnterpriseBankInfoContainsStatus(Integer operatorUserType, Integer status, Long... params) {
|
|
public List<BankInfo> getEnterpriseBankInfoContainsStatus(Integer operatorUserType, Integer status, Long... params) {
|
|
|
Long enuu = null;
|
|
Long enuu = null;
|
|
|
|
|
+ User user = SystemSession.getUser();
|
|
|
if(params.length == 0) {
|
|
if(params.length == 0) {
|
|
|
- enuu = SystemSession.getUser().getEnterprise() != null ? SystemSession.getUser().getEnterprise().getUu() : null;
|
|
|
|
|
|
|
+ enuu = user.getEnterprise() != null ? user.getEnterprise().getUu() : null;
|
|
|
}else {
|
|
}else {
|
|
|
enuu = params[0];
|
|
enuu = params[0];
|
|
|
}
|
|
}
|
|
|
//如果是个人用户登录
|
|
//如果是个人用户登录
|
|
|
- if(SystemSession.getUser().getEnterprise() == null && enuu == null) {
|
|
|
|
|
- return bankInfoDao.findByUseruuAndDissociativeAndOpraterUserTypeAndStatusAndAccountTypeOrderByNumAsc(SystemSession.getUser().getUserUU(), Type.PERSONAL.value(), operatorUserType, AccountType.RECEIVE_TYPE, status);
|
|
|
|
|
|
|
+ if(user.getEnterprise() == null && enuu == null) {
|
|
|
|
|
+ return bankInfoDao.findByUseruuAndAccountTypeAndDissociativeAndStatusOrderByNumAsc(user.getUserUU(), AccountType.RECEIVE_TYPE, Type.PERSONAL.value(), status);
|
|
|
} else {
|
|
} else {
|
|
|
- return bankInfoDao.findByEnuuAndStatusAndOpraterUserTypeAndAccountTypeOrderByNumAsc(enuu, status, operatorUserType, AccountType.RECEIVE_TYPE);
|
|
|
|
|
|
|
+ return bankInfoDao.findByEnuuAndStatusAndAccountTypeAndDissociativeOrderByNumAsc(enuu, status, AccountType.RECEIVE_TYPE, Type.ENTERPRISING.value());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -206,28 +212,10 @@ public class BankInfoServiceImpl implements BankInfoService {
|
|
|
return bankInfoDao.findOne(id);
|
|
return bankInfoDao.findOne(id);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- @Override
|
|
|
|
|
- public List<BankInfo> findBankInfoByUseruu(Long useruu, Long enuu, Integer opraterUserType) {
|
|
|
|
|
- return bankInfoDao.findByUseruuAndEnuuAndOpraterUserTypeAndStatusOrderByNumAsc(useruu, enuu, opraterUserType, Status.ALLOW.value());
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public BankInfo update(BankInfo bankInfo) {
|
|
public BankInfo update(BankInfo bankInfo) {
|
|
|
return bankInfoDao.save(bankInfo);
|
|
return bankInfoDao.save(bankInfo);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- @Override
|
|
|
|
|
- @Transactional
|
|
|
|
|
- public BankInfo saveB2cAccount(BankInfo bankInfo, Integer operatorType, boolean isPersonal) {
|
|
|
|
|
- int size = 0;
|
|
|
|
|
- bankInfo.setOpraterUserType(Type.MALL.value());
|
|
|
|
|
- bankInfo.setEnuu(sysConf.getEnUU());
|
|
|
|
|
- bankInfo.setCreateTime(new Date());
|
|
|
|
|
- size = bankInfoDao.getMallCountByEnuuAndStatus(bankInfo.getEnuu(),Type.MALL.value(), Status.ALLOW.value());
|
|
|
|
|
- bankInfo.setNum(++size);
|
|
|
|
|
- bankInfo.setStatus(Status.ALLOW.value());
|
|
|
|
|
- return bankInfoDao.save(bankInfo);
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public void save(List<BankInfo> list) {
|
|
public void save(List<BankInfo> list) {
|
|
@@ -270,22 +258,22 @@ public class BankInfoServiceImpl implements BankInfoService {
|
|
|
bankInfoDao.save(bankInfos);
|
|
bankInfoDao.save(bankInfos);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
- * 返回的账户信息
|
|
|
|
|
|
|
+ * 获取制定账户的类型
|
|
|
*
|
|
*
|
|
|
- * @param operatorUserType 要获取的买家、卖家、平台账户
|
|
|
|
|
- * @param params 传入的企业uu,可能为空
|
|
|
|
|
|
|
+ * @param uu
|
|
|
|
|
+ * @param dissociative
|
|
|
|
|
+ * @param accountType
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
- public List<BankInfo> getEnterpriseBankInfo(Integer operatorUserType, Long... params) {
|
|
|
|
|
- Long enuu = null;
|
|
|
|
|
- if(params.length == 0) {
|
|
|
|
|
- enuu = SystemSession.getUser().getEnterprise().getUu();
|
|
|
|
|
- }else {
|
|
|
|
|
- enuu = params[0];
|
|
|
|
|
|
|
+ public List<BankInfo> getEnterpriseBankInfo(Long uu, Integer dissociative, String accountType) {
|
|
|
|
|
+ if (dissociative == Type.ENTERPRISING.value()) {
|
|
|
|
|
+ return bankInfoDao.findByEnuuAndAccountTypeAndDissociativeOrderByNumAsc(uu, accountType, dissociative);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return bankInfoDao.findByUseruuAndAccountTypeAndDissociativeOrderByNumAsc(uu, accountType, dissociative);
|
|
|
}
|
|
}
|
|
|
- return bankInfoDao.findByEnuuAndOpraterUserTypeOrderByNumAsc(enuu, operatorUserType);
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -374,22 +362,33 @@ public class BankInfoServiceImpl implements BankInfoService {
|
|
|
if (type != Type.MALL.value() && type != Type.BUYER.value() && type != Type.SUP.value()){
|
|
if (type != Type.MALL.value() && type != Type.BUYER.value() && type != Type.SUP.value()){
|
|
|
return new ResultMap(CodeType.ERROR_STATE, "类型不存在,确认要查找账户的类型");
|
|
return new ResultMap(CodeType.ERROR_STATE, "类型不存在,确认要查找账户的类型");
|
|
|
}
|
|
}
|
|
|
- if (StringUtils.isEmpty(number)){
|
|
|
|
|
|
|
+ if (StringUtils.isEmpty(number)) {
|
|
|
return new ResultMap(CodeType.NO_INFO, "银行账号丢失或为空,请确认银行账号");
|
|
return new ResultMap(CodeType.NO_INFO, "银行账号丢失或为空,请确认银行账号");
|
|
|
}
|
|
}
|
|
|
Integer count = null;
|
|
Integer count = null;
|
|
|
- if (type == Type.BUYER.value()){
|
|
|
|
|
- Enterprise enterprise = SystemSession.getUser().getEnterprise();
|
|
|
|
|
- if (enterprise != null){
|
|
|
|
|
- count = bankInfoDao.getBuyerCountByNumberAndEnuu(SystemSession.getUser().getUserUU(), enterprise.getUu(),
|
|
|
|
|
- Type.BUYER.value(), Status.ALLOW.value(), number);
|
|
|
|
|
- }else {
|
|
|
|
|
- count = bankInfoDao.getBuyerCountByNumberAndDissociative(SystemSession.getUser().getUserUU(), Type.PERSONAL.value(),
|
|
|
|
|
- Type.BUYER.value(), Status.ALLOW.value(), number);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ User user = SystemSession.getUser();
|
|
|
|
|
+ if (user.getEnterprise() != null) {
|
|
|
|
|
+ count = bankInfoDao.getSupCountByNumberAndDissociative(user.getEnterprise().getUu(), Type.ENTERPRISING.value(), Status.ALLOW.value(), number);
|
|
|
}else {
|
|
}else {
|
|
|
- count = bankInfoDao.getEnterpriseCountByNumberAndEnuu(SystemSession.getUser().getEnterprise().getUu(), type, statusList, number);
|
|
|
|
|
|
|
+ count = bankInfoDao.getBuyerCountByNumberAndDissociative(user.getUserUU(), Type.PERSONAL.value(), Status.ALLOW.value(), number);
|
|
|
}
|
|
}
|
|
|
return ResultMap.success(count);
|
|
return ResultMap.success(count);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 获取
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param useruu
|
|
|
|
|
+ * @param enuu
|
|
|
|
|
+ * @param status
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public List<BankInfo> getDefaultBankInfoByuuAndStatusAndAccountType(Long useruu, Long enuu, Integer status, String accountType) {
|
|
|
|
|
+ if (enuu == null) {
|
|
|
|
|
+ return bankInfoDao.findByUseruuAndAccountTypeAndDissociativeAndStatusOrderByNumAsc(useruu, accountType, Type.PERSONAL.value(), status);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return bankInfoDao.findByEnuuAndStatusAndAccountTypeAndDissociativeOrderByNumAsc(enuu, status, accountType, Type.ENTERPRISING.value());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|