diff --git a/src/main/java/au/com/royalpay/payment/manage/dev/core/impl/HfUpdateImpl.java b/src/main/java/au/com/royalpay/payment/manage/dev/core/impl/HfUpdateImpl.java index 67c1a0bfa..4d10674de 100644 --- a/src/main/java/au/com/royalpay/payment/manage/dev/core/impl/HfUpdateImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/dev/core/impl/HfUpdateImpl.java @@ -1,30 +1,28 @@ package au.com.royalpay.payment.manage.dev.core.impl; -import au.com.royalpay.payment.manage.dev.core.HfClearAmountService; import au.com.royalpay.payment.manage.dev.core.HfUpdateService; -import au.com.royalpay.payment.manage.mappers.payment.TransactionMapper; +import au.com.royalpay.payment.manage.mappers.system.ClientConfigMapper; import au.com.royalpay.payment.manage.mappers.system.ClientMapper; import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApi; import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApiProvider; import au.com.royalpay.payment.tools.env.PlatformEnvironment; -import au.com.royalpay.payment.tools.exceptions.ServerErrorException; -import com.alibaba.fastjson.JSONArray; + import com.alibaba.fastjson.JSONObject; -import com.google.gson.JsonArray; -import org.apache.commons.lang3.time.DateUtils; + import org.springframework.stereotype.Service; -import javax.annotation.Resource; -import java.math.BigDecimal; -import java.text.ParseException; import java.util.List; +import javax.annotation.Resource; + @Service public class HfUpdateImpl implements HfUpdateService { @Resource private ClientMapper clientMapper; @Resource private MpWechatApiProvider mpWechatApiProvider; + @Resource + private ClientConfigMapper clientConfigMapper; @Override public String updateStatus() { @@ -32,8 +30,14 @@ public class HfUpdateImpl implements HfUpdateService { clientIds.forEach(dbResult -> { String longUrl = PlatformEnvironment.getEnv().concatUrl("/api/v1.0/hf_gateway/partners/" + dbResult.getString("client_moniker") + "/jump/pc"); MpWechatApi api = mpWechatApiProvider.getNewPaymentApi(); - dbResult.put("hf_pay_url", api.registerShortUrl(longUrl)); + String url = api.registerShortUrl(longUrl); + dbResult.put("hf_pay_url", url); + JSONObject config = new JSONObject(); + config.put("client_id",dbResult.getString("client_id")); + config.put("hf_pay_url", url); + clientConfigMapper.update(config); clientMapper.update(dbResult); + }); return "ok"; }