Commit 4bc2f1ca by guojuxing

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

parents a0d6e3a1 fb407040
package com.gic.enterprise.constant; package com.gic.enterprise.constant;
import org.apache.commons.lang3.StringUtils;
/** /**
* @author zhiwj * @author zhiwj
* @Description: 短信消费应用场景 * @Description: 短信消费应用场景
...@@ -46,7 +44,7 @@ public enum SmsAppEnum { ...@@ -46,7 +44,7 @@ public enum SmsAppEnum {
} }
public static String getNameByCode(String code) { public static String getNameByCode(String code) {
if (StringUtils.isNotBlank(code)) { if (code != null) {
for (SmsAppEnum smsApp : values()) { for (SmsAppEnum smsApp : values()) {
if (smsApp.code.equals(code)) { if (smsApp.code.equals(code)) {
return smsApp.name; return smsApp.name;
......
package com.gic.enterprise.service; package com.gic.enterprise.service;
import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.ServiceResponse; import com.gic.api.base.commons.ServiceResponse;
import com.gic.enterprise.dto.BillingRechargeDTO; import com.gic.enterprise.dto.BillingRechargeDTO;
import java.util.HashMap;
import java.util.Map;
/** /**
* 充值 * 充值
* @ClassName: BillingRechargeApiService * @ClassName: BillingRechargeApiService
...@@ -22,7 +24,7 @@ public interface BillingRechargeApiService { ...@@ -22,7 +24,7 @@ public interface BillingRechargeApiService {
* @return com.gic.api.base.commons.ServiceResponse<java.lang.Integer> * @return com.gic.api.base.commons.ServiceResponse<java.lang.Integer>
* @throws * @throws
*/ */
ServiceResponse<JSONObject> saveAndSelectPaymentMethod(BillingRechargeDTO billingRechargeDTO); ServiceResponse<Map<String, Object>> saveAndSelectPaymentMethod(BillingRechargeDTO billingRechargeDTO);
/** /**
* 确认支付 * 确认支付
......
package com.gic.enterprise.utils;
import com.gic.commons.util.MD5Utils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanWrapper;
import org.springframework.beans.BeanWrapperImpl;
import java.beans.PropertyDescriptor;
import java.util.Map;
import java.util.TreeMap;
/**
*
* @Description:
* @author zhiwj
* @date 2019/8/30 17:42
*/
public class SignUtils {
public static String getSign(Object source) {
final BeanWrapper src = new BeanWrapperImpl(source);
PropertyDescriptor[] pds = src.getPropertyDescriptors();
TreeMap<String, Object> propertys = new TreeMap<>();
for (PropertyDescriptor pd : pds) {
String name = pd.getName();
Object propertyValue = src.getPropertyValue(name);
if (propertyValue != null && !"sign".equals(name) && !"class".equals(name) && !"payType".equals(name)) {
propertys.put(name, propertyValue);
}
}
StringBuilder sb = new StringBuilder();
for (Map.Entry<String, Object> entry : propertys.entrySet()) {
sb.append(entry.getKey()).append("=").append(entry.getValue()).append("&");
}
if (sb.length() > 0) {
sb.deleteCharAt(sb.length() - 1);
}
return MD5Utils.ToMD5(sb.toString());
}
public static boolean validSign(Object source, String sign) {
return StringUtils.equals(SignUtils.getSign(source), sign);
}
}
...@@ -23,6 +23,8 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -23,6 +23,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.Map;
/** /**
* *
* @ClassName: BillingRechargeApiServiceImpl * @ClassName: BillingRechargeApiServiceImpl
...@@ -44,7 +46,7 @@ public class BillingRechargeApiServiceImpl implements BillingRechargeApiService ...@@ -44,7 +46,7 @@ public class BillingRechargeApiServiceImpl implements BillingRechargeApiService
@Override @Override
@Transactional @Transactional
public ServiceResponse<JSONObject> saveAndSelectPaymentMethod(BillingRechargeDTO billingRechargeDTO) { public ServiceResponse<Map<String, Object>> saveAndSelectPaymentMethod(BillingRechargeDTO billingRechargeDTO) {
String serialNumber = StringUtils.isNotBlank(billingRechargeDTO.getSerialNumber())?billingRechargeDTO.getSerialNumber(): CreateSerialNumberUtils.createSerialNumber(); String serialNumber = StringUtils.isNotBlank(billingRechargeDTO.getSerialNumber())?billingRechargeDTO.getSerialNumber(): CreateSerialNumberUtils.createSerialNumber();
ServiceResponse<BillingPayInfoDTO> serviceResponse = billingPayInfoApiService.savePrePayInfo(billingRechargeDTO.getEnterpriseId(), billingRechargeDTO.getTotalFee(), billingRechargeDTO.getPayType(), BuyTypeEnum.BALANCE_RECHARGE.getCode(), serialNumber); ServiceResponse<BillingPayInfoDTO> serviceResponse = billingPayInfoApiService.savePrePayInfo(billingRechargeDTO.getEnterpriseId(), billingRechargeDTO.getTotalFee(), billingRechargeDTO.getPayType(), BuyTypeEnum.BALANCE_RECHARGE.getCode(), serialNumber);
if (!serviceResponse.isSuccess()) { if (!serviceResponse.isSuccess()) {
......
package com.gic.enterprise.web.controller; package com.gic.enterprise.web.controller;
import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.Page; import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse; import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.util.EntityUtil; import com.gic.commons.util.EntityUtil;
...@@ -27,6 +26,8 @@ import org.springframework.validation.annotation.Validated; ...@@ -27,6 +26,8 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
/** /**
* *
* @Description: * @Description:
...@@ -54,7 +55,7 @@ public class BillingRechargeController { ...@@ -54,7 +55,7 @@ public class BillingRechargeController {
billingRechargeDTO.setInitiator(BillingInitiatorTypeEnum.ENTERPRISE.getCode()); billingRechargeDTO.setInitiator(BillingInitiatorTypeEnum.ENTERPRISE.getCode());
billingRechargeDTO.setInitiatorUser(userDetail.getUserId()); billingRechargeDTO.setInitiatorUser(userDetail.getUserId());
billingRechargeDTO.setInitiatorName(userDetail.getUserInfo().getUserName()); billingRechargeDTO.setInitiatorName(userDetail.getUserInfo().getUserName());
ServiceResponse<JSONObject> serviceResponse = billingRechargeApiService.saveAndSelectPaymentMethod(billingRechargeDTO); ServiceResponse<Map<String, Object>> serviceResponse = billingRechargeApiService.saveAndSelectPaymentMethod(billingRechargeDTO);
if (serviceResponse.isSuccess()) { if (serviceResponse.isSuccess()) {
LogUtils.createLog("预支付金额:" + billingRechargeQO.getTotalFee(), PayTypeEnum.getMessageByCode(billingRechargeQO.getPayType())); LogUtils.createLog("预支付金额:" + billingRechargeQO.getTotalFee(), PayTypeEnum.getMessageByCode(billingRechargeQO.getPayType()));
} }
......
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