add Hf shortURL update

master
luoyang 6 years ago
parent bd5b1541af
commit a4a16fbaba

@ -0,0 +1,9 @@
package au.com.royalpay.payment.manage.dev.core;
import com.alibaba.fastjson.JSONObject;
public interface HfUpdateService {
String updateStatus();
}

@ -0,0 +1,40 @@
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.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;
@Service
public class HfUpdateImpl implements HfUpdateService {
@Resource
private ClientMapper clientMapper;
@Resource
private MpWechatApiProvider mpWechatApiProvider;
@Override
public String updateStatus() {
List<JSONObject> clientIds = clientMapper.findByhfPayUrlNotNull();
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));
clientMapper.update(dbResult);
});
return "ok";
}
}

@ -13,10 +13,7 @@ import au.com.royalpay.payment.manage.appclient.core.RetailAppService;
import au.com.royalpay.payment.manage.dev.bean.AliExcel;
import au.com.royalpay.payment.manage.dev.bean.Message;
import au.com.royalpay.payment.manage.dev.bean.SendWechatMessage;
import au.com.royalpay.payment.manage.dev.core.AliforexcelService;
import au.com.royalpay.payment.manage.dev.core.HfClearAmountService;
import au.com.royalpay.payment.manage.dev.core.NewpartnerService;
import au.com.royalpay.payment.manage.dev.core.WechatMessageService;
import au.com.royalpay.payment.manage.dev.core.*;
import au.com.royalpay.payment.manage.mappers.customers.CustomerEncourageMoneyUseLogMapper;
import au.com.royalpay.payment.manage.mappers.log.NotifyErrorLogMapper;
import au.com.royalpay.payment.manage.mappers.payment.OrderMapper;
@ -110,6 +107,8 @@ public class TestController implements ApplicationEventPublisherAware {
private AliforexcelService aliforexcelService;
@Resource
private HfClearAmountService hfClearAmountService;
@Resource
private HfUpdateService hfUpdateService;
@ManagerMapping(value = "/{clientMoniker}/export/agreepdf", method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.DIRECTOR, ManagerRole.OPERATOR})
public void exportAgreeFile(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, HttpServletResponse httpResponse) throws Exception {
@ -394,7 +393,12 @@ public class TestController implements ApplicationEventPublisherAware {
}
@ManagerMapping(value = "/hfClearAmount", method = RequestMethod.GET, role = ManagerRole.DEVELOPER)
public JSONObject hfClearAmount(@RequestParam String datefrom, @RequestParam String dateto) {
public JSONObject hfUpdate(@RequestParam String datefrom, @RequestParam String dateto) {
return hfClearAmountService.hfjsonobject(dateto,datefrom);
}
@ManagerMapping(value = "/hfUpdate", method = RequestMethod.GET, role = ManagerRole.DEVELOPER)
public String hfClearAmount() {
return hfUpdateService.updateStatus();
}
}

@ -4,6 +4,7 @@ import cn.yixblog.support.mybatis.autosql.annotations.AdvanceSelect;
import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper;
import cn.yixblog.support.mybatis.autosql.annotations.AutoSql;
import cn.yixblog.support.mybatis.autosql.annotations.SqlType;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
@ -94,4 +95,6 @@ public interface ClientMapper {
@AutoSql(type = SqlType.SELECT)
JSONObject findByWechatInstitutionMerchantId(@Param("wechat_institution_merchant_id") String wechat_institution_merchant_id);
List<JSONObject> findByhfPayUrlNotNull();
}

@ -6,23 +6,24 @@
WHERE is_valid=1 and (approve_result = 1 or approve_result = 2)
</select>
<select id="listGreenChannel" resultType="com.alibaba.fastjson.JSONObject">
select m.manager_id manager_id,m.display_name display_name, m.wx_openid wx_openid , c.client_moniker client_moniker
select m.manager_id manager_id,m.display_name display_name, m.wx_openid wx_openid , c.client_moniker
client_moniker
from sys_clients c
left join sys_client_bd cb on cb.client_id = c.client_id
left join sys_managers m on m.manager_id = cb.bd_id
where approve_result = 2 and (source = 1 or source = 2)
<if test="approve_time != null and interval_begin_day != null">
and TIMESTAMPDIFF(DAY,c.approve_time,#{approve_time})&gt;#{interval_begin_day}
</if>
<if test="approve_time != null and interval_begin_day != null">
and TIMESTAMPDIFF(DAY,c.approve_time,#{approve_time})&gt;#{interval_begin_day}
</if>
<if test="approve_time != null and interval_end_day != null">
and TIMESTAMPDIFF(DAY,c.approve_time,#{approve_time})&lt;#{interval_end_day}
</if>
<if test="open_status != null">
and c.open_status = #{open_status}
</if>
<if test="managerId!=null">
and m.manager_id = #{managerId}
</if>
<if test="open_status != null">
and c.open_status = #{open_status}
</if>
<if test="managerId!=null">
and m.manager_id = #{managerId}
</if>
order by display_name
</select>
<select id="listPartners" resultType="com.alibaba.fastjson.JSONObject">
@ -101,7 +102,8 @@
and c.suburb like #{suburb_pattern}
</if>
<if test="approving">
and ((c.approve_result=4 and c.open_status is null) or (c.approve_result=3 and c.open_status is null) or c.open_status=1 or c.open_status=2 or c.open_status=4)
and ((c.approve_result=4 and c.open_status is null) or (c.approve_result=3 and c.open_status is null) or
c.open_status=1 or c.open_status=2 or c.open_status=4)
</if>
<if test="state!=null">
and c.state=#{state}
@ -137,7 +139,8 @@
<if test="search_text!=null">
<bind name="name_pattern" value="'%'+search_text+'%'"/>
<if test="text_type=='all'">
and (c.client_moniker=#{search_text} or c.short_name like #{name_pattern} or c.company_name like #{name_pattern} or c.business_name like #{name_pattern} or c.remark like
and (c.client_moniker=#{search_text} or c.short_name like #{name_pattern} or c.company_name like
#{name_pattern} or c.business_name like #{name_pattern} or c.remark like
#{name_pattern} or c.contact_email=#{search_text})
</if>
<if test="text_type=='client_moniker'">
@ -161,7 +164,8 @@
</if>
<if test="org_id!=null and org_ids==null">and c.org_id=#{org_id}</if>
<if test="org_ids!=null">and c.org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if>
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach>
</if>
<if test="referrer_id!=null">and c.referrer_id=#{referrer_id}</if>
<if test="is_valid">and c.is_valid=1</if>
</where>
@ -222,7 +226,8 @@
</if>
<if test="org_id!=null and org_ids==null">and c.org_id=#{org_id}</if>
<if test="org_ids!=null">and c.org_id in
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if>
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach>
</if>
and c.is_valid=1
</where>
GROUP BY c.contact_email
@ -267,21 +272,25 @@
<select id="listUnAuthPartners" resultType="com.alibaba.fastjson.JSONObject">
<![CDATA[
SELECT
client_id,
client_moniker,
approve_time
FROM sys_clients
WHERE is_valid = 1 AND approve_result = 2 AND source = 4 AND datediff(now(), approve_time) <= #{auth_days}
]]>
</select>
<select id="analysisClients" resultType="com.alibaba.fastjson.JSONObject">
SELECT
sum(if(((c.approve_result=4 and c.open_status is null) or (c.approve_result=3 and c.open_status is null) or c.open_status=1 or c.open_status=2 or c.open_status=4),1,0)) wp,
sum(if(((c.approve_result=4 and c.open_status is null) or (c.approve_result=3 and c.open_status is null) or
c.open_status=1 or c.open_status=2 or c.open_status=4),1,0)) wp,
sum(if(c.approve_result is null and c.source= 4,1,0)) a_unagree,
sum(if(((c.approve_result=4 and c.open_status is null) or (c.approve_result=3 and c.open_status is null) or c.open_status=1 or c.open_status=2 or c.open_status=4) and c.source = 4,1,0)) a_wp,
sum(if(((c.approve_result=4 and c.open_status is null) or (c.approve_result=3 and c.open_status is null) or
c.open_status=1 or c.open_status=2 or c.open_status=4) and c.source = 4,1,0)) a_wp,
sum(if(c.approve_result=2 and c.source = 4,1,0)) wa,
sum(if(c.approve_result=1,1,0)) pass,
sum(if(c.approve_result=1 and c.source=2,1,0)) z_pass,
@ -340,7 +349,7 @@
)
</if>
<if test="source!=null">
and source = #{source}
and source = #{source}
</if>
<if test="approve_result!=null">
and approve_result = #{approve_result}
@ -349,4 +358,8 @@
and contact_email = #{contact_email}
</if>
</select>
<select id="findByhfPayUrlNotNull" resultType="com.alibaba.fastjson.JSONObject">
select client_id,client_moniker FROM sys_clients WHERE hf_pay_url != ''
</select>
</mapper>

@ -59,7 +59,11 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
url: '/hfClearAmount',
templateUrl: '/static/config/devtools/templates/hfClearAmount.html',
controller: 'hfClearAmountCtrl'
})
}).state('devtools.hfupdate', {
url: '/hfupdate',
templateUrl: '/static/config/devtools/templates/hfupdate.html',
controller: 'hfupdateCtrl'
})
}]);
app.controller('devManualRefundCtrl', ['$scope', '$http', 'commonDialog', function ($scope, $http, commonDialog) {
$scope.sendRefund = function () {
@ -363,6 +367,23 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
}]);
app.controller('hfupdateCtrl', ['$scope', '$http','$filter', function ($scope, $http,$filter) {
$scope.selecttotal = true;
$scope.select = function () {
$scope.totalhide = true;
$scope.selecttotal = false;
$http.get('/dev/hfUpdate').then(function (resp) {
alert(resp.data);
$scope.totalhide = false;
$scope.selecttotal = true;
}, function (resp) {
alert(resp.data.message);
})
}
}]);
return app;
});

@ -0,0 +1,15 @@
<section class="content-header">
<h1>更新HF短链接</h1>
<ol class="breadcrumb">
<li>
<i class="fa fa-cog"></i> Basic Config
</li>
<li><a ui-sref="^">Dev Tools</a></li>
<li class="active">hfupdate</li>
</ol>
</section>
<section class="content">
<div class="box">
<button class="btn btn-primary" ng-click="select()">Update</button> <label ng-hide="selecttotal" style="padding-left: 30px">请稍后</label>
</div>
</section>

@ -79,6 +79,10 @@
<i class="fa fa-credit-card-alt"></i>
HF清算金额统计
</a>
<a class="btn btn-app" role="button" ui-sref=".hfupdate">
<i class="fa fa-credit-card-alt"></i>
更新HF短连接
</a>
</div>
</div>
</section>

Loading…
Cancel
Save