java110
2023-02-16 4617a8abcf4a278ea182720aa8c6121a5236e829
service-acct/src/main/java/com/java110/acct/cmd/payment/UnifiedPaymentCmd.java
@@ -12,6 +12,7 @@
import com.java110.dto.payment.PaymentOrderDto;
import com.java110.utils.cache.CommonCache;
import com.java110.utils.cache.MappingCache;
import com.java110.utils.constant.MappingConstant;
import com.java110.utils.constant.WechatConstant;
import com.java110.utils.exception.CmdException;
import com.java110.utils.factory.ApplicationContextFactory;
@@ -87,6 +88,9 @@
    public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException, ParseException {
        logger.debug(">>>>>>>>>>>>>>>>支付参数报文,{}",reqJson.toJSONString());
        String appId = context.getReqHeaders().get("app-id");
        String userId = context.getReqHeaders().get("user-id");
        //1.0 查询当前支付的业务
@@ -98,14 +102,26 @@
        //2.0 相应业务 下单 返回 单号 ,金额,
        PaymentOrderDto paymentOrderDto =  paymentBusiness.unified(context,reqJson);
        paymentOrderDto.setAppId(appId);
        paymentOrderDto.setUserId(userId);
        logger.debug(">>>>>>>>>>>>>>>>支付业务下单返回,{}",JSONObject.toJSONString(paymentOrderDto));
        String env = MappingCache.getValue("HC_ENV");
        String env = MappingCache.getValue(MappingConstant.ENV_DOMAIN,"HC_ENV");
        // 这里 演示环境不向微信下单
        if ("DEV".equals(env) || "TEST".equals(env)) {
            paymentBusiness.notifyPayment(paymentOrderDto,reqJson);
            JSONObject param = new JSONObject();
            param.put("code", "100");
            param.put("msg", "演示环境不触发支付");
            context.setResponseEntity(new ResponseEntity(JSONObject.toJSONString(param), HttpStatus.OK));
            return ;
        }
        // 3.0 如果支付金额为0 直接调用 支付完通知接口
        // 这里 演示环境不向微信下单
        if (paymentOrderDto.getMoney() <= 0 || "DEV".equals(env) || "TEST".equals(env)) {
        if (paymentOrderDto.getMoney() <= 0) {
            paymentBusiness.notifyPayment(paymentOrderDto,reqJson);
            JSONObject param = new JSONObject();
            param.put("code", "100");