mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-07-23 23:51:18 +08:00
Compare commits
2 Commits
feature-in
...
345a6efb37
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
345a6efb37 | ||
|
|
b4731d3e85 |
@@ -237,9 +237,12 @@ public class AdapayMemberController extends BaseController {
|
||||
try {
|
||||
adapayService.updateSettleAccountConfig(dto);
|
||||
result = AjaxResult.success();
|
||||
} catch (BusinessException e) {
|
||||
logger.warn("修改汇付结算配置warn", e);
|
||||
result = AjaxResult.error(e.getMessage());
|
||||
} catch (BaseAdaPayException e) {
|
||||
logger.error("查询汇付账户余额error", e);
|
||||
result = AjaxResult.error();
|
||||
logger.error("修改汇付结算配置error", e);
|
||||
result = AjaxResult.error("修改汇付结算配置异常");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -254,9 +257,12 @@ public class AdapayMemberController extends BaseController {
|
||||
try {
|
||||
adapayService.changeBankCard(dto);
|
||||
result = AjaxResult.success();
|
||||
} catch (BusinessException e) {
|
||||
logger.warn("换绑银行卡warn", e);
|
||||
result = AjaxResult.error(e.getMessage());
|
||||
} catch (BaseAdaPayException e) {
|
||||
logger.error("换绑银行卡error", e);
|
||||
result = AjaxResult.error();
|
||||
result = AjaxResult.error("换绑银行卡异常");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -292,12 +298,14 @@ public class AdapayMemberController extends BaseController {
|
||||
public AjaxResult deleteSettleAccount(@RequestBody AdapayMemberInfoDTO dto) {
|
||||
AjaxResult result = null;
|
||||
try {
|
||||
// 新写删除方法
|
||||
adapayService.deleteSettleAccount(dto);
|
||||
result = AjaxResult.success();
|
||||
} catch (BusinessException e) {
|
||||
logger.warn("删除结算账户warn", e);
|
||||
result = AjaxResult.error(e.getMessage());
|
||||
} catch (Exception e) {
|
||||
logger.error("删除结算账户 error,", e);
|
||||
result = AjaxResult.error();
|
||||
result = AjaxResult.error("删除结算账户异常");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -314,9 +322,13 @@ public class AdapayMemberController extends BaseController {
|
||||
AjaxResult result = null;
|
||||
try {
|
||||
adapayService.createBankAccount(dto);
|
||||
result = AjaxResult.success();
|
||||
} catch (BusinessException e) {
|
||||
logger.warn("重新创建结算账户warn", e);
|
||||
result = AjaxResult.error(e.getMessage());
|
||||
} catch (Exception e) {
|
||||
logger.error("重新创建结算账户 error, ", e);
|
||||
result = AjaxResult.error();
|
||||
result = AjaxResult.error("重新创建结算账户异常");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ import com.jsowell.pile.domain.OrderInvoiceRecord;
|
||||
import com.jsowell.pile.dto.GetInvoiceInfoDTO;
|
||||
import com.jsowell.pile.service.OrderInvoiceRecordService;
|
||||
import com.jsowell.pile.service.PileMerchantInfoService;
|
||||
import com.jsowell.pile.vo.web.OrderInvoiceExportVO;
|
||||
import com.jsowell.pile.vo.web.OrderInvoiceRecordVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
@@ -19,7 +18,6 @@ import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
@@ -66,18 +64,6 @@ public class OrderInvoiceRecordController extends BaseController {
|
||||
util.exportExcel(response, list, "申请开票数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出所选申请开票详情
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('order:invoice:export')")
|
||||
@Log(title = "申请开票", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export/selected")
|
||||
public void exportSelected(HttpServletResponse response, @RequestParam("ids") Integer[] ids) {
|
||||
List<OrderInvoiceExportVO> list = orderInvoiceRecordService.selectInvoiceExportList(ids);
|
||||
ExcelUtil<OrderInvoiceExportVO> util = new ExcelUtil<OrderInvoiceExportVO>(OrderInvoiceExportVO.class);
|
||||
util.exportExcel(response, list, "所选申请开票详情数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取申请开票详细信息
|
||||
*/
|
||||
|
||||
@@ -14,8 +14,9 @@ public enum AdapayOpenActionEnum {
|
||||
UPDATE_CORP_MEMBER("UPDATE_CORP_MEMBER", "更新企业资料"),
|
||||
RESUBMIT_CORP_MEMBER("RESUBMIT_CORP_MEMBER", "重新提交企业开户"),
|
||||
CREATE_SETTLE_ACCOUNT("CREATE_SETTLE_ACCOUNT", "创建结算账户"),
|
||||
UPDATE_SETTLE_ACCOUNT_CONFIG("UPDATE_SETTLE_ACCOUNT_CONFIG", "修改结算配置"),
|
||||
DELETE_SETTLE_ACCOUNT("DELETE_SETTLE_ACCOUNT", "删除结算账户"),
|
||||
DELETE_MEMBER("DELETE_MEMBER", "删除汇付用户");
|
||||
DELETE_MEMBER("DELETE_MEMBER", "删除账户(本地解绑)");
|
||||
|
||||
private final String value;
|
||||
private final String label;
|
||||
|
||||
@@ -59,5 +59,8 @@ public class QueryMemberResponse extends AdapayBaseResponse{
|
||||
private String bank_acct_type;
|
||||
private String prov_code;
|
||||
private String card_id;
|
||||
private String min_amt;
|
||||
private String remained_amt;
|
||||
private String channel_remark;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,6 +83,9 @@ public class AdapayService {
|
||||
@Autowired
|
||||
private PileMerchantInfoService pileMerchantInfoService;
|
||||
|
||||
@Autowired
|
||||
private StationSplitConfigService stationSplitConfigService;
|
||||
|
||||
@Autowired
|
||||
private MemberBasicInfoService memberBasicInfoService;
|
||||
|
||||
@@ -324,8 +327,11 @@ public class AdapayService {
|
||||
String wechatAppId = pileMerchantInfoService.queryAppIdByMerchantId(dto.getMerchantId());
|
||||
SettleAccountDTO request = buildSettleAccountDTO(dto);
|
||||
Map<String, Object> settleCount = createSettleAccountRequest(request, adapayMemberAccount.getAdapayMemberId(), wechatAppId);
|
||||
if (settleCount == null || StringUtils.equals((String) settleCount.get("status"), "failed")) {
|
||||
String errorMsg = settleCount == null ? "创建汇付结算账户失败" : (String) settleCount.get("error_msg");
|
||||
if (settleCount == null
|
||||
|| !AdapayStatusEnum.SUCCEEDED.getValue().equals(settleCount.get("status"))
|
||||
|| StringUtils.isBlank((String) settleCount.get("id"))) {
|
||||
String errorMsg = settleCount == null ? null : (String) settleCount.get("error_msg");
|
||||
errorMsg = StringUtils.isNotBlank(errorMsg) ? errorMsg : "创建汇付结算账户失败";
|
||||
throw new BusinessException("00500001", errorMsg);
|
||||
}
|
||||
|
||||
@@ -345,13 +351,7 @@ public class AdapayService {
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
String wechatAppId = pileMerchantInfoService.queryAppIdByMerchantId(merchantId);
|
||||
String settleAccountId = adapayMemberAccount.getSettleAccountId();
|
||||
if (StringUtils.isBlank(settleAccountId) && isCorpMember(adapayMemberAccount.getAdapayMemberId())) {
|
||||
AdapayCorpMemberVO corpMemberVO = queryCorpAdapayMemberInfo(adapayMemberAccount.getAdapayMemberId(), wechatAppId);
|
||||
if (corpMemberVO != null) {
|
||||
settleAccountId = corpMemberVO.getSettleAccountId();
|
||||
}
|
||||
}
|
||||
String settleAccountId = resolveSettleAccountId(adapayMemberAccount, wechatAppId);
|
||||
AdapaySettleAccountVO adapaySettleAccountVO = queryAdapaySettleAccount(adapayMemberAccount.getAdapayMemberId(), settleAccountId, wechatAppId);
|
||||
if (adapaySettleAccountVO == null) {
|
||||
return Lists.newArrayList();
|
||||
@@ -360,6 +360,35 @@ public class AdapayService {
|
||||
return Lists.newArrayList(adapaySettleAccountVO);
|
||||
}
|
||||
|
||||
private String resolveSettleAccountId(AdapayMemberAccount account, String wechatAppId) throws BaseAdaPayException {
|
||||
if (StringUtils.isNotBlank(account.getSettleAccountId())) {
|
||||
return account.getSettleAccountId();
|
||||
}
|
||||
|
||||
String settleAccountId = null;
|
||||
if (isPersonalMember(account.getAdapayMemberId())) {
|
||||
AdapayMemberInfoVO memberInfo = queryAdapayMemberInfo(account.getAdapayMemberId(), wechatAppId);
|
||||
if (memberInfo != null) {
|
||||
settleAccountId = memberInfo.getSettleAccountId();
|
||||
}
|
||||
} else {
|
||||
AdapayCorpMemberVO corpMember = queryCorpAdapayMemberInfo(account.getAdapayMemberId(), wechatAppId);
|
||||
if (corpMember != null) {
|
||||
settleAccountId = corpMember.getSettleAccountId();
|
||||
}
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(settleAccountId)) {
|
||||
AdapayMemberAccount updateRecord = new AdapayMemberAccount();
|
||||
updateRecord.setMerchantId(account.getMerchantId());
|
||||
updateRecord.setAdapayMemberId(account.getAdapayMemberId());
|
||||
updateRecord.setSettleAccountId(settleAccountId);
|
||||
adapayMemberAccountService.updateAdapayMemberAccountByMemberId(updateRecord);
|
||||
account.setSettleAccountId(settleAccountId);
|
||||
}
|
||||
return settleAccountId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建汇付会员
|
||||
*
|
||||
@@ -498,12 +527,21 @@ public class AdapayService {
|
||||
}
|
||||
|
||||
QueryMemberResponse queryMemberResponse = JSON.parseObject(JSON.toJSONString(member), QueryMemberResponse.class);
|
||||
String settleAccountId = null;
|
||||
if (CollectionUtils.isNotEmpty(queryMemberResponse.getSettle_accounts())) {
|
||||
settleAccountId = queryMemberResponse.getSettle_accounts().stream()
|
||||
.map(QueryMemberResponse.SettleAccount::getId)
|
||||
.filter(StringUtils::isNotBlank)
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
}
|
||||
AdapayMemberInfoVO resultVO = AdapayMemberInfoVO.builder()
|
||||
.memberId(adapayMemberId)
|
||||
.nickname(queryMemberResponse.getNickname())
|
||||
.gender(queryMemberResponse.getGender())
|
||||
.email(queryMemberResponse.getEmail())
|
||||
.location(queryMemberResponse.getLocation())
|
||||
.settleAccountId(settleAccountId)
|
||||
.build();
|
||||
return resultVO;
|
||||
}
|
||||
@@ -635,6 +673,11 @@ public class AdapayService {
|
||||
settleCountParams.put("app_id", config.getAdapayAppId());
|
||||
Map<String, Object> settleCount = SettleAccount.delete(settleCountParams, wechatAppId);
|
||||
log.info("创建删除结算账户请求param:{}, result:{}", JSON.toJSONString(settleCountParams), JSON.toJSONString(settleCount));
|
||||
if (settleCount == null
|
||||
|| !AdapayStatusEnum.SUCCEEDED.getValue().equals(settleCount.get("status"))) {
|
||||
String errorMsg = settleCount == null ? null : (String) settleCount.get("error_msg");
|
||||
throw new BusinessException("", StringUtils.isNotBlank(errorMsg) ? errorMsg : "删除汇付结算账户失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -678,6 +721,9 @@ public class AdapayService {
|
||||
.bankAcctType(accountInfo.getBank_acct_type())
|
||||
.provCode(accountInfo.getProv_code())
|
||||
.areaCode(accountInfo.getArea_code())
|
||||
.minAmt(accountInfo.getMin_amt())
|
||||
.remainedAmt(accountInfo.getRemained_amt())
|
||||
.channelRemark(accountInfo.getChannel_remark())
|
||||
.build();
|
||||
return resultVO;
|
||||
}
|
||||
@@ -768,6 +814,7 @@ public class AdapayService {
|
||||
* @throws BaseAdaPayException
|
||||
*/
|
||||
public void updateSettleAccountConfig(UpdateAccountConfigDTO dto) throws BaseAdaPayException {
|
||||
assertActionAllowed(dto.getMerchantId(), AdapayOpenActionEnum.UPDATE_SETTLE_ACCOUNT_CONFIG);
|
||||
String wechatAppId = pileMerchantInfoService.queryAppIdByMerchantId(dto.getMerchantId());
|
||||
// 获取汇付支付配置
|
||||
AbstractAdapayConfig config = AdapayConfigFactory.getConfig(wechatAppId);
|
||||
@@ -776,16 +823,19 @@ public class AdapayService {
|
||||
}
|
||||
|
||||
// 通过merchantId 查询出汇付会员id 和 结算账户id,用来查询余额
|
||||
AdapayMemberAccount adapayMemberAccount = adapayMemberAccountService.selectByMerchantId(dto.getMerchantId());
|
||||
if (adapayMemberAccount == null) {
|
||||
log.error("通过merchantId:{}, 没有查询到结算账户配置", dto.getMerchantId());
|
||||
return;
|
||||
AdapayMemberAccount adapayMemberAccount = requireCurrentMemberAccount(dto.getMerchantId());
|
||||
String settleAccountId = resolveSettleAccountId(adapayMemberAccount, wechatAppId);
|
||||
if (StringUtils.isBlank(settleAccountId)) {
|
||||
throw new BusinessException("", "未查询到结算账户");
|
||||
}
|
||||
if (StringUtils.isAllBlank(dto.getMinAmt(), dto.getRemainedAmt(), dto.getChannelRemark())) {
|
||||
throw new BusinessException("", "结算起始金额、结算留存金额和结算摘要至少填写一项");
|
||||
}
|
||||
// 修改账户配置
|
||||
Map<String, Object> params = Maps.newHashMap();
|
||||
params.put("app_id", config.getAdapayAppId());
|
||||
params.put("member_id", adapayMemberAccount.getAdapayMemberId());
|
||||
params.put("settle_account_id", adapayMemberAccount.getSettleAccountId());
|
||||
params.put("settle_account_id", settleAccountId);
|
||||
if (StringUtils.isNotBlank(dto.getMinAmt())) {
|
||||
params.put("min_amt", dto.getMinAmt());
|
||||
}
|
||||
@@ -795,8 +845,13 @@ public class AdapayService {
|
||||
if (StringUtils.isNotBlank(dto.getChannelRemark())) {
|
||||
params.put("channel_remark", dto.getChannelRemark());
|
||||
}
|
||||
Map<String, Object> settleCount = SettleAccount.update(params);
|
||||
Map<String, Object> settleCount = SettleAccount.modify(params, config.getWechatAppId());
|
||||
log.info("更新结算账户设置 param:{}, result:{}", JSON.toJSONString(params), JSON.toJSONString(settleCount));
|
||||
if (settleCount == null
|
||||
|| !AdapayStatusEnum.SUCCEEDED.getValue().equals(settleCount.get("status"))) {
|
||||
String errorMsg = settleCount == null ? null : (String) settleCount.get("error_msg");
|
||||
throw new BusinessException("", StringUtils.isNotBlank(errorMsg) ? errorMsg : "修改汇付结算配置失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1675,38 +1730,20 @@ public class AdapayService {
|
||||
* 用户需要换绑银行卡 1-删除结算账户信息,2-使用新账户信息创建结算账户】
|
||||
*/
|
||||
public void changeBankCard(ChangeBankCardDTO dto) throws BaseAdaPayException {
|
||||
String wechatAppId = pileMerchantInfoService.queryAppIdByMerchantId(dto.getMerchantId());
|
||||
// 获取汇付支会员信息
|
||||
AdapayMemberAccount account = adapayMemberAccountService.selectByMerchantId(dto.getMerchantId());
|
||||
if (account == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 1-删除结算账户信息
|
||||
String adapayMemberId = account.getAdapayMemberId();
|
||||
String settleAccountId = null;
|
||||
AdapayCorpMemberVO adapayCorpMemberVO = this.queryCorpAdapayMemberInfo(adapayMemberId, wechatAppId);
|
||||
if (adapayCorpMemberVO != null) {
|
||||
settleAccountId = adapayCorpMemberVO.getSettleAccountId();
|
||||
}
|
||||
this.createDeleteSettleAccountRequest(adapayMemberId, settleAccountId, wechatAppId);
|
||||
// 2-使用新账户信息创建结算账户
|
||||
SettleAccountDTO settleAccountDTO = new SettleAccountDTO();
|
||||
settleAccountDTO.setCardId(dto.getCardId());
|
||||
settleAccountDTO.setCardName(dto.getCardName());
|
||||
settleAccountDTO.setTelNo(dto.getTelNo());
|
||||
settleAccountDTO.setBankCode(dto.getBankCode());
|
||||
settleAccountDTO.setBankAcctType(dto.getBankAcctType());
|
||||
settleAccountDTO.setProvCode(dto.getProvCode());
|
||||
settleAccountDTO.setAreaCode(dto.getAreaCode());
|
||||
Map<String, Object> settleAccount = this.createSettleAccountRequest(settleAccountDTO, adapayMemberId, wechatAppId);
|
||||
if (settleAccount != null && !StringUtils.equals((String) settleAccount.get("status"), "failed")) {
|
||||
AdapayMemberAccount updateRecord = new AdapayMemberAccount();
|
||||
updateRecord.setAdapayMemberId(adapayMemberId);
|
||||
updateRecord.setMerchantId(dto.getMerchantId());
|
||||
updateRecord.setSettleAccountId((String) settleAccount.get("id"));
|
||||
adapayMemberAccountService.updateAdapayMemberAccountByMemberId(updateRecord);
|
||||
}
|
||||
deleteSettleAccount(AdapayMemberInfoDTO.builder().merchantId(dto.getMerchantId()).build());
|
||||
CreateSettleAccountDTO createRequest = CreateSettleAccountDTO.builder()
|
||||
.merchantId(dto.getMerchantId())
|
||||
.bankAcctType(dto.getBankAcctType())
|
||||
.cardId(dto.getCardId())
|
||||
.cardName(dto.getCardName())
|
||||
.certId(dto.getCertId())
|
||||
.certType(dto.getCertType())
|
||||
.telNo(dto.getTelNo())
|
||||
.bankCode(dto.getBankCode())
|
||||
.provCode(dto.getProvCode())
|
||||
.areaCode(dto.getAreaCode())
|
||||
.build();
|
||||
createSettleAccount(createRequest);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1797,21 +1834,27 @@ public class AdapayService {
|
||||
assertActionAllowed(dto.getMerchantId(), AdapayOpenActionEnum.DELETE_SETTLE_ACCOUNT);
|
||||
AdapayMemberAccount adapayMemberAccount = requireCurrentMemberAccount(dto.getMerchantId());
|
||||
String wechatAppId = pileMerchantInfoService.queryAppIdByMerchantId(dto.getMerchantId());
|
||||
String adapayMemberId = StringUtils.isNotBlank(dto.getAdapayMemberId()) ? dto.getAdapayMemberId() : adapayMemberAccount.getAdapayMemberId();
|
||||
String settleAccountId = StringUtils.isNotBlank(dto.getSettleAccountId()) ? dto.getSettleAccountId() : adapayMemberAccount.getSettleAccountId();
|
||||
if (StringUtils.isBlank(settleAccountId) && isCorpMember(adapayMemberId)) {
|
||||
AdapayCorpMemberVO corpMemberVO = queryCorpAdapayMemberInfo(adapayMemberId, wechatAppId);
|
||||
if (corpMemberVO != null) {
|
||||
settleAccountId = corpMemberVO.getSettleAccountId();
|
||||
}
|
||||
String adapayMemberId = adapayMemberAccount.getAdapayMemberId();
|
||||
if (StringUtils.isNotBlank(dto.getAdapayMemberId())
|
||||
&& !StringUtils.equals(dto.getAdapayMemberId(), adapayMemberId)) {
|
||||
throw new BusinessException("", "汇付用户信息不匹配");
|
||||
}
|
||||
String settleAccountId = resolveSettleAccountId(adapayMemberAccount, wechatAppId);
|
||||
if (StringUtils.isBlank(settleAccountId)) {
|
||||
throw new BusinessException("", "未查询到结算账户");
|
||||
}
|
||||
if (StringUtils.isNotBlank(dto.getSettleAccountId())
|
||||
&& !StringUtils.equals(dto.getSettleAccountId(), settleAccountId)) {
|
||||
throw new BusinessException("", "结算账户信息不匹配");
|
||||
}
|
||||
|
||||
assertSettleAccountCanDelete(dto.getMerchantId());
|
||||
this.createDeleteSettleAccountRequest(adapayMemberId, settleAccountId, wechatAppId);
|
||||
adapayMemberAccountService.clearSettleAccountByMerchantId(dto.getMerchantId());
|
||||
int cleared = adapayMemberAccountService.clearCurrentSettleAccount(
|
||||
adapayMemberAccount.getId(), dto.getMerchantId(), adapayMemberId, settleAccountId);
|
||||
if (cleared != 1) {
|
||||
throw new BusinessException("", "汇付结算账户已删除,但本地账户状态更新失败,请联系管理员处理");
|
||||
}
|
||||
}
|
||||
|
||||
public void deleteAdapayMember(DeleteAdapayMemberDTO dto) throws BaseAdaPayException {
|
||||
@@ -1825,7 +1868,16 @@ public class AdapayService {
|
||||
if (CollectionUtils.isNotEmpty(selectSettleAccount(dto.getMerchantId()))) {
|
||||
throw new BusinessException("", "请先删除结算账户");
|
||||
}
|
||||
adapayMemberAccountService.deleteAccountByMerchantId(dto.getMerchantId());
|
||||
assertSettleAccountCanDelete(dto.getMerchantId());
|
||||
int splitStationCount = stationSplitConfigService.countActiveByAdapayMemberId(adapayMemberAccount.getAdapayMemberId());
|
||||
if (splitStationCount > 0) {
|
||||
throw new BusinessException("", String.format("当前账户仍被%d个站点的分账配置引用,请先调整分账配置", splitStationCount));
|
||||
}
|
||||
int deleted = adapayMemberAccountService.deleteCurrentAccount(
|
||||
adapayMemberAccount.getId(), dto.getMerchantId(), adapayMemberAccount.getAdapayMemberId());
|
||||
if (deleted != 1) {
|
||||
throw new BusinessException("", "账户状态已变化,请刷新后重试");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2001,6 +2053,7 @@ public class AdapayService {
|
||||
break;
|
||||
case PERSONAL_COMPLETED:
|
||||
actions.add(AdapayOpenActionEnum.UPDATE_PERSONAL_MEMBER.getValue());
|
||||
actions.add(AdapayOpenActionEnum.UPDATE_SETTLE_ACCOUNT_CONFIG.getValue());
|
||||
actions.add(AdapayOpenActionEnum.DELETE_SETTLE_ACCOUNT.getValue());
|
||||
break;
|
||||
case CORP_AUDITING:
|
||||
@@ -2014,9 +2067,11 @@ public class AdapayService {
|
||||
case CORP_OPENED_NO_SETTLE:
|
||||
actions.add(AdapayOpenActionEnum.CREATE_SETTLE_ACCOUNT.getValue());
|
||||
actions.add(AdapayOpenActionEnum.UPDATE_CORP_MEMBER.getValue());
|
||||
actions.add(AdapayOpenActionEnum.DELETE_MEMBER.getValue());
|
||||
break;
|
||||
case CORP_COMPLETED:
|
||||
actions.add(AdapayOpenActionEnum.UPDATE_CORP_MEMBER.getValue());
|
||||
actions.add(AdapayOpenActionEnum.UPDATE_SETTLE_ACCOUNT_CONFIG.getValue());
|
||||
actions.add(AdapayOpenActionEnum.DELETE_SETTLE_ACCOUNT.getValue());
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -20,4 +20,6 @@ public class AdapayMemberInfoVO {
|
||||
private String gender;
|
||||
// 昵称
|
||||
private String nickname;
|
||||
// 结算账户id
|
||||
private String settleAccountId;
|
||||
}
|
||||
|
||||
@@ -73,4 +73,10 @@ public class AdapaySettleAccountVO {
|
||||
* 银行账户开户银行所在地区编码(省市编码),银行账户类型为对公时,必填
|
||||
*/
|
||||
private String areaCode;
|
||||
|
||||
private String minAmt;
|
||||
|
||||
private String remainedAmt;
|
||||
|
||||
private String channelRemark;
|
||||
}
|
||||
|
||||
@@ -120,13 +120,14 @@ public interface AdapayMemberAccountMapper {
|
||||
|
||||
AdapayMemberAccount selectByMemberId(String memberId);
|
||||
|
||||
/**
|
||||
* 通过运营商id删除账户信息
|
||||
* @param merchantId
|
||||
*/
|
||||
void deleteAccountByMerchantId(String merchantId);
|
||||
int deleteCurrentAccount(@Param("id") Integer id,
|
||||
@Param("merchantId") String merchantId,
|
||||
@Param("adapayMemberId") String adapayMemberId);
|
||||
|
||||
void clearSettleAccountByMerchantId(String merchantId);
|
||||
int clearCurrentSettleAccount(@Param("id") Integer id,
|
||||
@Param("merchantId") String merchantId,
|
||||
@Param("adapayMemberId") String adapayMemberId,
|
||||
@Param("settleAccountId") String settleAccountId);
|
||||
|
||||
/**
|
||||
* 根据运营商id查询最近一条的信息
|
||||
|
||||
@@ -35,4 +35,6 @@ public interface StationSplitConfigMapper {
|
||||
* @return
|
||||
*/
|
||||
List<SplitConfigStationVO> queryStationList(String adapayMemberId);
|
||||
|
||||
int countActiveByAdapayMemberId(String adapayMemberId);
|
||||
}
|
||||
|
||||
@@ -111,12 +111,11 @@ public interface AdapayMemberAccountService {
|
||||
String selectMerchantNameByAdapayMemberId(String adapayMemberId);
|
||||
|
||||
/**
|
||||
* 根据运营商id删除记录
|
||||
* @param merchantId
|
||||
* 精确逻辑删除当前有效账户,避免并发开户时误删新记录。
|
||||
*/
|
||||
void deleteAccountByMerchantId(String merchantId);
|
||||
int deleteCurrentAccount(Integer id, String merchantId, String adapayMemberId);
|
||||
|
||||
void clearSettleAccountByMerchantId(String merchantId);
|
||||
int clearCurrentSettleAccount(Integer id, String merchantId, String adapayMemberId, String settleAccountId);
|
||||
|
||||
/**
|
||||
* 根据运营商Id查询最近一条的信息
|
||||
|
||||
@@ -4,7 +4,6 @@ import com.jsowell.pile.domain.OrderInvoiceRecord;
|
||||
import com.jsowell.pile.dto.GetInvoiceInfoDTO;
|
||||
import com.jsowell.pile.dto.QueryInvoiceRecordDTO;
|
||||
import com.jsowell.pile.vo.web.InvoiceRecordVO;
|
||||
import com.jsowell.pile.vo.web.OrderInvoiceExportVO;
|
||||
import com.jsowell.pile.vo.web.OrderInvoiceRecordVO;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
@@ -27,8 +26,6 @@ public interface OrderInvoiceRecordService {
|
||||
|
||||
InvoiceRecordVO selectInvoiceTitleVO(Integer id);
|
||||
|
||||
List<OrderInvoiceExportVO> selectInvoiceExportList(Integer[] ids);
|
||||
|
||||
/**
|
||||
* 查询申请开票列表
|
||||
*
|
||||
|
||||
@@ -59,4 +59,6 @@ public interface StationSplitConfigService {
|
||||
* @return
|
||||
*/
|
||||
Map<String,List<SplitConfigStationVO>> queryStationList(SplitConfigStationDTO splitConfigStationDTO);
|
||||
|
||||
int countActiveByAdapayMemberId(String adapayMemberId);
|
||||
}
|
||||
|
||||
@@ -270,15 +270,21 @@ public class AdapayMemberAccountServiceImpl implements AdapayMemberAccountServic
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAccountByMerchantId(String merchantId) {
|
||||
adapayMemberAccountMapper.deleteAccountByMerchantId(merchantId);
|
||||
redisCache.deleteObject(CacheConstants.ADAPAY_MEMBER_ACCOUNT + merchantId);
|
||||
public int deleteCurrentAccount(Integer id, String merchantId, String adapayMemberId) {
|
||||
int result = adapayMemberAccountMapper.deleteCurrentAccount(id, merchantId, adapayMemberId);
|
||||
if (result > 0) {
|
||||
redisCache.deleteObject(CacheConstants.ADAPAY_MEMBER_ACCOUNT + merchantId);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearSettleAccountByMerchantId(String merchantId) {
|
||||
adapayMemberAccountMapper.clearSettleAccountByMerchantId(merchantId);
|
||||
redisCache.deleteObject(CacheConstants.ADAPAY_MEMBER_ACCOUNT + merchantId);
|
||||
public int clearCurrentSettleAccount(Integer id, String merchantId, String adapayMemberId, String settleAccountId) {
|
||||
int result = adapayMemberAccountMapper.clearCurrentSettleAccount(id, merchantId, adapayMemberId, settleAccountId);
|
||||
if (result > 0) {
|
||||
redisCache.deleteObject(CacheConstants.ADAPAY_MEMBER_ACCOUNT + merchantId);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -13,8 +13,6 @@ import com.jsowell.pile.util.UserUtils;
|
||||
import com.jsowell.pile.vo.base.OrderAmountDetailVO;
|
||||
import com.jsowell.pile.vo.uniapp.customer.InvoiceTitleVO;
|
||||
import com.jsowell.pile.vo.web.InvoiceRecordVO;
|
||||
import com.jsowell.pile.vo.web.OrderInvoiceExportVO;
|
||||
import com.jsowell.pile.vo.web.OrderInvoiceOrderExportVO;
|
||||
import com.jsowell.pile.vo.web.OrderInvoiceRecordVO;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -22,11 +20,7 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 申请开票Service业务层处理
|
||||
@@ -82,82 +76,6 @@ public class OrderInvoiceRecordServiceImpl implements OrderInvoiceRecordService
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrderInvoiceExportVO> selectInvoiceExportList(Integer[] ids) {
|
||||
if (ids == null || ids.length == 0) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return Arrays.stream(ids)
|
||||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.map(this::selectInvoiceTitleVO)
|
||||
.filter(Objects::nonNull)
|
||||
.map(this::buildOrderInvoiceExportVO)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private OrderInvoiceExportVO buildOrderInvoiceExportVO(InvoiceRecordVO invoiceRecordVO) {
|
||||
InvoiceTitleVO invoiceTitle = invoiceRecordVO.getInvoiceTitle();
|
||||
return OrderInvoiceExportVO.builder()
|
||||
.id(invoiceRecordVO.getId())
|
||||
.memberId(invoiceRecordVO.getMemberId())
|
||||
.phoneNumber(invoiceRecordVO.getPhoneNumber())
|
||||
.status(invoiceRecordVO.getStatus())
|
||||
.createTime(invoiceRecordVO.getCreateTime())
|
||||
.updateTime(invoiceRecordVO.getUpdateTime())
|
||||
.titleId(invoiceTitle == null ? null : invoiceTitle.getTitleId())
|
||||
.titleName(invoiceTitle == null ? null : invoiceTitle.getTitleName())
|
||||
.titleType(invoiceTitle == null ? null : invoiceTitle.getTitleType())
|
||||
.taxId(invoiceTitle == null ? null : invoiceTitle.getTaxId())
|
||||
.unitAddress(invoiceTitle == null ? null : invoiceTitle.getUnitAddress())
|
||||
.email(invoiceTitle == null ? null : invoiceTitle.getEmail())
|
||||
.reception(invoiceTitle == null ? null : invoiceTitle.getReception())
|
||||
.titlePhoneNumber(invoiceTitle == null ? null : invoiceTitle.getPhoneNumber())
|
||||
.bankName(invoiceTitle == null ? null : invoiceTitle.getBankName())
|
||||
.bankAccountNumber(invoiceTitle == null ? null : invoiceTitle.getBankAccountNumber())
|
||||
.defaultFlag(invoiceTitle == null ? null : invoiceTitle.getDefaultFlag())
|
||||
.orderList(buildOrderExportList(invoiceRecordVO.getOrderList()))
|
||||
.build();
|
||||
}
|
||||
|
||||
private List<OrderInvoiceOrderExportVO> buildOrderExportList(List<OrderAmountDetailVO> orderList) {
|
||||
if (CollectionUtils.isEmpty(orderList)) {
|
||||
List<OrderInvoiceOrderExportVO> emptyOrderList = new ArrayList<>();
|
||||
emptyOrderList.add(new OrderInvoiceOrderExportVO());
|
||||
return emptyOrderList;
|
||||
}
|
||||
List<OrderInvoiceOrderExportVO> exportList = orderList.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.map(this::buildOrderInvoiceOrderExportVO)
|
||||
.collect(Collectors.toList());
|
||||
if (CollectionUtils.isEmpty(exportList)) {
|
||||
exportList.add(new OrderInvoiceOrderExportVO());
|
||||
}
|
||||
return exportList;
|
||||
}
|
||||
|
||||
private OrderInvoiceOrderExportVO buildOrderInvoiceOrderExportVO(OrderAmountDetailVO orderAmountDetailVO) {
|
||||
return OrderInvoiceOrderExportVO.builder()
|
||||
.orderCode(orderAmountDetailVO.getOrderCode())
|
||||
.totalUsedElectricity(orderAmountDetailVO.getTotalUsedElectricity())
|
||||
.totalOrderAmount(orderAmountDetailVO.getTotalOrderAmount())
|
||||
.totalElectricityAmount(orderAmountDetailVO.getTotalElectricityAmount())
|
||||
.totalServiceAmount(orderAmountDetailVO.getTotalServiceAmount())
|
||||
.sharpUsedElectricity(orderAmountDetailVO.getSharpUsedElectricity())
|
||||
.sharpElectricityPrice(orderAmountDetailVO.getSharpElectricityPrice())
|
||||
.sharpServicePrice(orderAmountDetailVO.getSharpServicePrice())
|
||||
.peakUsedElectricity(orderAmountDetailVO.getPeakUsedElectricity())
|
||||
.peakElectricityPrice(orderAmountDetailVO.getPeakElectricityPrice())
|
||||
.peakServicePrice(orderAmountDetailVO.getPeakServicePrice())
|
||||
.flatUsedElectricity(orderAmountDetailVO.getFlatUsedElectricity())
|
||||
.flatElectricityPrice(orderAmountDetailVO.getFlatElectricityPrice())
|
||||
.flatServicePrice(orderAmountDetailVO.getFlatServicePrice())
|
||||
.valleyUsedElectricity(orderAmountDetailVO.getValleyUsedElectricity())
|
||||
.valleyElectricityPrice(orderAmountDetailVO.getValleyElectricityPrice())
|
||||
.valleyServicePrice(orderAmountDetailVO.getValleyServicePrice())
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询申请开票列表
|
||||
*
|
||||
|
||||
@@ -316,4 +316,9 @@ public class StationSplitConfigServiceImpl implements StationSplitConfigService{
|
||||
return stationMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int countActiveByAdapayMemberId(String adapayMemberId) {
|
||||
return stationSplitConfigMapper.countActiveByAdapayMemberId(adapayMemberId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,72 +0,0 @@
|
||||
package com.jsowell.pile.vo.web;
|
||||
|
||||
import com.jsowell.common.annotation.Excel;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 发票详情导出数据
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class OrderInvoiceExportVO {
|
||||
@Excel(name = "申请记录ID", sort = 1, needMerge = true)
|
||||
private String id;
|
||||
|
||||
@Excel(name = "会员ID", sort = 2, needMerge = true, width = 20)
|
||||
private String memberId;
|
||||
|
||||
@Excel(name = "申请人电话", sort = 3, needMerge = true, width = 18)
|
||||
private String phoneNumber;
|
||||
|
||||
@Excel(name = "状态", sort = 4, needMerge = true, readConverterExp = "0=未开票,1=已开票")
|
||||
private String status;
|
||||
|
||||
@Excel(name = "申请时间", sort = 5, needMerge = true, width = 20)
|
||||
private String createTime;
|
||||
|
||||
@Excel(name = "开票时间", sort = 6, needMerge = true, width = 20)
|
||||
private String updateTime;
|
||||
|
||||
@Excel(name = "抬头ID", sort = 7, needMerge = true)
|
||||
private String titleId;
|
||||
|
||||
@Excel(name = "抬头名称", sort = 8, needMerge = true, width = 30)
|
||||
private String titleName;
|
||||
|
||||
@Excel(name = "抬头类型", sort = 9, needMerge = true)
|
||||
private String titleType;
|
||||
|
||||
@Excel(name = "税号", sort = 10, needMerge = true, width = 24)
|
||||
private String taxId;
|
||||
|
||||
@Excel(name = "单位地址", sort = 11, needMerge = true, width = 30)
|
||||
private String unitAddress;
|
||||
|
||||
@Excel(name = "抬头邮箱", sort = 12, needMerge = true, width = 24)
|
||||
private String email;
|
||||
|
||||
@Excel(name = "接收方式", sort = 13, needMerge = true)
|
||||
private String reception;
|
||||
|
||||
@Excel(name = "抬头电话", sort = 14, needMerge = true, width = 18)
|
||||
private String titlePhoneNumber;
|
||||
|
||||
@Excel(name = "开户银行", sort = 15, needMerge = true, width = 24)
|
||||
private String bankName;
|
||||
|
||||
@Excel(name = "银行账户", sort = 16, needMerge = true, width = 24)
|
||||
private String bankAccountNumber;
|
||||
|
||||
@Excel(name = "默认抬头", sort = 17, needMerge = true, readConverterExp = "0=否,1=是")
|
||||
private String defaultFlag;
|
||||
|
||||
@Excel(name = "订单明细", sort = 18)
|
||||
private List<OrderInvoiceOrderExportVO> orderList;
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
package com.jsowell.pile.vo.web;
|
||||
|
||||
import com.jsowell.common.annotation.Excel;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 发票关联订单导出明细
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class OrderInvoiceOrderExportVO {
|
||||
@Excel(name = "订单号", sort = 1, width = 24)
|
||||
private String orderCode;
|
||||
|
||||
@Excel(name = "总用电量", sort = 2)
|
||||
private BigDecimal totalUsedElectricity;
|
||||
|
||||
@Excel(name = "订单总金额", sort = 3)
|
||||
private BigDecimal totalOrderAmount;
|
||||
|
||||
@Excel(name = "电费总金额", sort = 4)
|
||||
private BigDecimal totalElectricityAmount;
|
||||
|
||||
@Excel(name = "服务费总金额", sort = 5)
|
||||
private BigDecimal totalServiceAmount;
|
||||
|
||||
@Excel(name = "尖时段用电量", sort = 6)
|
||||
private BigDecimal sharpUsedElectricity;
|
||||
|
||||
@Excel(name = "尖时段电费单价", sort = 7)
|
||||
private BigDecimal sharpElectricityPrice;
|
||||
|
||||
@Excel(name = "尖时段服务费单价", sort = 8)
|
||||
private BigDecimal sharpServicePrice;
|
||||
|
||||
@Excel(name = "峰时段用电量", sort = 9)
|
||||
private BigDecimal peakUsedElectricity;
|
||||
|
||||
@Excel(name = "峰时段电费单价", sort = 10)
|
||||
private BigDecimal peakElectricityPrice;
|
||||
|
||||
@Excel(name = "峰时段服务费单价", sort = 11)
|
||||
private BigDecimal peakServicePrice;
|
||||
|
||||
@Excel(name = "平时段用电量", sort = 12)
|
||||
private BigDecimal flatUsedElectricity;
|
||||
|
||||
@Excel(name = "平时段电费单价", sort = 13)
|
||||
private BigDecimal flatElectricityPrice;
|
||||
|
||||
@Excel(name = "平时段服务费单价", sort = 14)
|
||||
private BigDecimal flatServicePrice;
|
||||
|
||||
@Excel(name = "谷时段用电量", sort = 15)
|
||||
private BigDecimal valleyUsedElectricity;
|
||||
|
||||
@Excel(name = "谷时段电费单价", sort = 16)
|
||||
private BigDecimal valleyElectricityPrice;
|
||||
|
||||
@Excel(name = "谷时段服务费单价", sort = 17)
|
||||
private BigDecimal valleyServicePrice;
|
||||
}
|
||||
@@ -572,20 +572,26 @@
|
||||
and adapay_member_id = #{memberId,jdbcType=VARCHAR}
|
||||
</select>
|
||||
|
||||
<update id="deleteAccountByMerchantId">
|
||||
<update id="deleteCurrentAccount">
|
||||
update
|
||||
adapay_member_account
|
||||
set del_flag = '1'
|
||||
where merchant_id = #{merchantId,jdbcType=VARCHAR}
|
||||
set del_flag = '1',
|
||||
update_time = now()
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
and merchant_id = #{merchantId,jdbcType=VARCHAR}
|
||||
and adapay_member_id = #{adapayMemberId,jdbcType=VARCHAR}
|
||||
and del_flag = '0'
|
||||
</update>
|
||||
|
||||
<update id="clearSettleAccountByMerchantId">
|
||||
<update id="clearCurrentSettleAccount">
|
||||
update
|
||||
adapay_member_account
|
||||
set settle_account_id = null,
|
||||
update_time = now()
|
||||
where merchant_id = #{merchantId,jdbcType=VARCHAR}
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
and merchant_id = #{merchantId,jdbcType=VARCHAR}
|
||||
and adapay_member_id = #{adapayMemberId,jdbcType=VARCHAR}
|
||||
and settle_account_id = #{settleAccountId,jdbcType=VARCHAR}
|
||||
and del_flag = '0'
|
||||
</update>
|
||||
|
||||
|
||||
@@ -41,6 +41,13 @@
|
||||
where t1.adapay_member_id = #{adapayMemberId}
|
||||
</select>
|
||||
|
||||
<select id="countActiveByAdapayMemberId" resultType="int">
|
||||
select count(distinct station_id)
|
||||
from station_split_config
|
||||
where adapay_member_id = #{adapayMemberId}
|
||||
and del_flag = '0'
|
||||
</select>
|
||||
|
||||
<insert id="batchInsert" parameterType="map">
|
||||
<!--@mbg.generated-->
|
||||
insert into station_split_config
|
||||
|
||||
Reference in New Issue
Block a user