Commit 201c4e3a by guojuxing

Merge remote-tracking branch 'origin/developer' into developer

parents 3d4f8891 8779ff55
......@@ -126,8 +126,8 @@ public class BillingPayInfoApiServiceImpl implements BillingPayInfoApiService {
@Override
public ServiceResponse<Void> offlineCallBack(String resDataStr) {
logger.info("财务审批回调");
JSONObject jsonObject = JSON.parseObject(resDataStr);
logger.info("财务审批回调:{}", resDataStr);
ApprovalCallBackDTO approvalCallBackDTO = new ApprovalCallBackDTO();
approvalCallBackDTO.setOrderSerialNumber(jsonObject.getString("orderNumber"));
approvalCallBackDTO.setEnterpriseId(jsonObject.getInteger("enterpriseId"));
......
package com.gic.enterprise.service.outer.impl;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.enterprise.constant.BuyTypeEnum;
......@@ -21,10 +12,16 @@ import com.gic.enterprise.error.ErrorCode;
import com.gic.enterprise.service.BillingPayInfoApiService;
import com.gic.enterprise.service.BillingRechargeApiService;
import com.gic.enterprise.service.BillingRechargeRecordService;
import com.gic.enterprise.service.EnterpriseService;
import com.gic.enterprise.utils.CreateRandomUtils;
import com.gic.finance.service.TransferAccountsApprovalApiService;
import com.gic.redis.data.util.RedisUtil;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Map;
/**
*
......@@ -40,10 +37,6 @@ public class BillingRechargeApiServiceImpl implements BillingRechargeApiService
private BillingRechargeRecordService billingRechargeRecordService;
@Autowired
private BillingPayInfoApiService billingPayInfoApiService;
@Autowired
private TransferAccountsApprovalApiService transferAccountsApprovalApiService;
@Autowired
private EnterpriseService enterpriseService;
@Override
@Transactional
......
package com.gic.enterprise.service.outer.impl.pay;
import java.util.Date;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import com.alibaba.fastjson.JSON;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.auth.dto.UserDTO;
import com.gic.auth.service.UserApiService;
import com.gic.commons.util.DateUtil;
import com.gic.commons.util.EntityUtil;
import com.gic.commons.util.GlobalInfo;
import com.gic.enterprise.constant.BillingPayResultEnum;
import com.gic.enterprise.constant.BuyTypeEnum;
import com.gic.enterprise.constant.PayTypeEnum;
import com.gic.enterprise.constant.*;
import com.gic.enterprise.dto.ApprovalCallBackDTO;
import com.gic.enterprise.dto.BillingPayInfoDTO;
import com.gic.enterprise.dto.EnterpriseDTO;
import com.gic.enterprise.dto.OutPayDTO;
import com.gic.enterprise.entity.TabBillingPayInfo;
import com.gic.enterprise.entity.TabBillingRechargeRecord;
import com.gic.enterprise.entity.TabEnterprise;
import com.gic.enterprise.error.ErrorCode;
import com.gic.enterprise.service.BillingOrderService;
import com.gic.enterprise.service.BillingPayInfoService;
import com.gic.enterprise.service.BillingRechargeRecordService;
import com.gic.enterprise.service.EnterpriseService;
import com.gic.enterprise.service.*;
import com.gic.enterprise.utils.CreateRandomUtils;
import com.gic.finance.constant.InitiatorTypeEnum;
import com.gic.finance.dto.TransferAccountsApprovalDTO;
import com.gic.finance.service.TransferAccountsApprovalApiService;
import com.gic.marketing.process.api.service.sms.SmsSendApiService;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import java.util.Date;
/**
*
......@@ -52,6 +51,12 @@ public class OfflineStrategy implements PayStrategy {
private EnterpriseService enterpriseService;
@Autowired
private TransferAccountsApprovalApiService transferAccountsApprovalApiService;
@Autowired
private SmsSendApiService smsSendApiService;
@Autowired
private UserApiService userApiService;
@Autowired
private EnterpriseApiService enterpriseApiService;
@Override
public ServiceResponse<BillingPayInfoDTO> savePrePayInfo(OutPayDTO outPayDTO) {
......@@ -139,6 +144,8 @@ public class OfflineStrategy implements PayStrategy {
public ServiceResponse<Void> callBack(ApprovalCallBackDTO resData) {
logger.info("银行线下支付回调结果:{}", JSON.toJSONString(resData));
sendApprovalSms(resData);
String orderSerialNumber = resData.getOrderSerialNumber();
TabBillingPayInfo billingPayInfo = billingPayInfoService.getByOrderSerialNumber(orderSerialNumber, PayTypeEnum.OFFLINE_PAY.getCode());
resData.setPaySerialNumber(billingPayInfo.getSerialNumber());
......@@ -147,8 +154,10 @@ public class OfflineStrategy implements PayStrategy {
Integer i = billingPayInfoService.updatePayInfoBySerialNumber(resData);
switch (resData.getBuyType()) {
case 1:
billingRechargeRecordService.updateBySerialNumber(billingPayInfo.getEnterpriseId(), resData.getOrderSerialNumber(), resData.getTotalFee(), resData.getTotalFeePaid(), resData.getAuditStatus(), resData.getTimeEnd());
// 商户余额充值
billingRechargeRecordService.updateBySerialNumber(billingPayInfo.getEnterpriseId(), resData.getOrderSerialNumber(), resData.getTotalFee(), resData.getTotalFeePaid(), resData.getAuditStatus(), resData.getTimeEnd());
sendRechargeSuccessSms(resData, billingPayInfo.getEnterpriseId());
break;
case 2:
// 短信套餐包购买
......@@ -163,6 +172,35 @@ public class OfflineStrategy implements PayStrategy {
return ServiceResponse.success();
}
private void sendRechargeSuccessSms(ApprovalCallBackDTO resData, Integer enterpriseId) {
UserDTO userDTO = userApiService.getUserByEnterpriseId(enterpriseId).getResult();
sendSms(resData, userDTO, "GICJFZX005");
}
private void sendApprovalSms(ApprovalCallBackDTO resData) {
TabBillingRechargeRecord rechargeRecord = billingRechargeRecordService.getRechargeRecordBySerialNumber(resData.getOrderSerialNumber());
Integer initiator = rechargeRecord.getInitiator();
UserDTO userDTO = userApiService.getUserById(initiator).getResult();
sendSms(resData, userDTO, "GICJFZX008");
}
private void sendSms(ApprovalCallBackDTO resData, UserDTO userDTO, String code) {
try {
if (StringUtils.isBlank(userDTO.getPhoneAreaCode())) {
userDTO.setPhoneAreaCode("+86");
}
EnterpriseDTO enterpriseDTO = enterpriseApiService.getEnterpriseById(userDTO.getEnterpriseId()).getResult();
String[] smsArr = new String[]{enterpriseDTO.getEnterpriseName(), resData.getOrderSerialNumber(), BillingAuditStatusEnum.PASS.getCode().equals(resData.getAuditStatus()) ? "成功" : "失败"};
ServiceResponse<Void> smsSendResult = smsSendApiService.sendPlatformSms(code,
userDTO.getEnterpriseId(), userDTO.getPhoneAreaCode(), userDTO.getPhoneNumber(), smsArr);
if (!smsSendResult.isSuccess()) {
logger.warn(smsSendResult.getMessage());
}
} catch (Exception e) {
logger.info("发送短信失败", e);
}
}
private void initiateApproval(OutPayDTO outPayDTO) {
TransferAccountsApprovalDTO approvalDTO = new TransferAccountsApprovalDTO();
......@@ -183,7 +221,7 @@ public class OfflineStrategy implements PayStrategy {
//com.gic.enterprise.service.BillingPayInfoApiService.offlineCallBack()
logger.info("调用财务模块接口:{}", JSON.toJSONString(approvalDTO));
ServiceResponse<Void> serviceResponse = null;
ServiceResponse<Void> serviceResponse = new ServiceResponse<>();
if (approvalDTO.getOrderType() == BuyTypeEnum.BALANCE_RECHARGE.getCode()) {
serviceResponse = transferAccountsApprovalApiService.rechargeInitiateApproval(approvalDTO);
} else if (approvalDTO.getOrderType() == BuyTypeEnum.BUY_SHORT_MESSAGE_PACKAGE.getCode()) {
......
package com.gic.enterprise.service.outer.impl.pay;
import java.math.BigDecimal;
import java.util.Date;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.alibaba.fastjson.JSON;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.auth.dto.UserDTO;
import com.gic.auth.service.UserApiService;
import com.gic.commons.util.DateUtil;
import com.gic.commons.util.EntityUtil;
import com.gic.commons.util.GlobalInfo;
......@@ -18,16 +11,23 @@ import com.gic.enterprise.constant.BillingAuditStatusEnum;
import com.gic.enterprise.constant.PayTypeEnum;
import com.gic.enterprise.dto.ApprovalCallBackDTO;
import com.gic.enterprise.dto.BillingPayInfoDTO;
import com.gic.enterprise.dto.EnterpriseDTO;
import com.gic.enterprise.dto.OutPayDTO;
import com.gic.enterprise.entity.TabBillingPayInfo;
import com.gic.enterprise.error.ErrorCode;
import com.gic.enterprise.service.BillingOrderService;
import com.gic.enterprise.service.BillingPayInfoService;
import com.gic.enterprise.service.BillingRechargeRecordService;
import com.gic.enterprise.service.PushMessageApiService;
import com.gic.enterprise.service.*;
import com.gic.enterprise.utils.CreateRandomUtils;
import com.gic.marketing.process.api.service.sms.SmsSendApiService;
import com.gic.thirdparty.api.dto.ScanPayReqDataDTO;
import com.gic.thirdparty.api.service.Pay4WXService;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.math.BigDecimal;
import java.util.Date;
/**
*
......@@ -49,6 +49,12 @@ public class WxPayStrategy implements PayStrategy {
private BillingOrderService billingOrderService;
@Autowired
private PushMessageApiService pushMessageApiService;
@Autowired
private UserApiService userApiService;
@Autowired
private EnterpriseApiService enterpriseApiService;
@Autowired
SmsSendApiService smsSendApiService;
@Override
public ServiceResponse<BillingPayInfoDTO> savePrePayInfo(OutPayDTO outPayDTO) {
......@@ -114,6 +120,7 @@ public class WxPayStrategy implements PayStrategy {
// 商户余额充值
billingRechargeRecordService.updateBySerialNumber(resData.getEnterpriseId(), billingPayInfo.getOrderSerialNumber(), resData.getTotalFeePaid(), resData.getTotalFeePaid(), BillingAuditStatusEnum.PASS.getCode(), resData.getTimeEnd());
this.pushMessageApiService.pushMessage(resData.getEnterpriseId(), "系统通知", "余额充值", "您的商户成功充值"+resData.getTotalFeePaid()+"元!感谢您的支持和使用!");
sendRechargeSuccessSms(resData, billingPayInfo.getEnterpriseId());
break;
case 2:
// 短信套餐包购买
......@@ -168,4 +175,27 @@ public class WxPayStrategy implements PayStrategy {
}
}
private void sendRechargeSuccessSms(ApprovalCallBackDTO resData, Integer enterpriseId) {
UserDTO userDTO = userApiService.getUserByEnterpriseId(enterpriseId).getResult();
sendSms(resData, userDTO, "GICJFZX005");
}
private void sendSms(ApprovalCallBackDTO resData, UserDTO userDTO, String code) {
try {
if (StringUtils.isBlank(userDTO.getPhoneAreaCode())) {
userDTO.setPhoneAreaCode("+86");
}
EnterpriseDTO enterpriseDTO = enterpriseApiService.getEnterpriseById(userDTO.getEnterpriseId()).getResult();
String[] smsArr = new String[]{enterpriseDTO.getEnterpriseName(), resData.getOrderSerialNumber(), BillingAuditStatusEnum.PASS.getCode().equals(resData.getAuditStatus()) ? "成功" : "失败"};
ServiceResponse<Void> smsSendResult = smsSendApiService.sendPlatformSms(code,
userDTO.getEnterpriseId(), userDTO.getPhoneAreaCode(), userDTO.getPhoneNumber(), smsArr);
if (!smsSendResult.isSuccess()) {
logger.warn(smsSendResult.getMessage());
}
} catch (Exception e) {
logger.info("发送短信失败", e);
}
}
}
......@@ -136,4 +136,5 @@
<dubbo:reference interface="com.gic.member.api.service.MemberUserApiService" id="memberUserApiService" timeout="60000" />
<dubbo:reference interface="com.gic.store.service.StoreApiService" id="storeApiService" timeout="60000" />
<dubbo:reference interface="com.gic.member.api.service.UserOwnerApiService" id="userOwnerApiService" timeout="60000" />
<dubbo:reference interface="com.gic.marketing.process.api.service.sms.SmsSendApiService" id="smsSendApiService" timeout="60000" />
</beans>
......@@ -62,7 +62,7 @@ public class BillingRecordController {
if (applicationDTO != null) {
return applicationDTO.getApplicationId();
} else {
return null;
return 0L;
}
}
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment