From 5f9b173fe6e59df3c4882e67796397c4c10428cd Mon Sep 17 00:00:00 2001 From: "eason.qian" Date: Wed, 25 Apr 2018 18:48:05 +0800 Subject: [PATCH 01/11] add ip location --- .../payment/manage/dev/web/IPController.java | 24 +++++++++++++++++++ .../static/commons/services/orderService.js | 7 +++++- .../commons/templates/order_detail.html | 10 +++++++- 3 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 src/main/java/au/com/royalpay/payment/manage/dev/web/IPController.java diff --git a/src/main/java/au/com/royalpay/payment/manage/dev/web/IPController.java b/src/main/java/au/com/royalpay/payment/manage/dev/web/IPController.java new file mode 100644 index 000000000..fb3c75895 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/dev/web/IPController.java @@ -0,0 +1,24 @@ +package au.com.royalpay.payment.manage.dev.web; + +import com.alibaba.fastjson.JSONObject; +import com.maxmind.geoip.LookupService; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; + +@RestController +@RequestMapping(value = "/dev/ip") + +public class IPController { + @Resource + private LookupService lookupService; + + @RequestMapping(value = "/{ipAddr}", method = RequestMethod.GET) + public String getIpInfo(@PathVariable String ipAddr) { + String city = lookupService.getLocation(ipAddr).city; + return city; + } +} diff --git a/src/main/ui/static/commons/services/orderService.js b/src/main/ui/static/commons/services/orderService.js index b6fb25d7e..1c628772a 100644 --- a/src/main/ui/static/commons/services/orderService.js +++ b/src/main/ui/static/commons/services/orderService.js @@ -36,8 +36,13 @@ define(['../app'], function (app) { } } }]); - app.controller('orderDetailDialogCtrl', ['$scope', 'order', function ($scope, order) { + app.controller('orderDetailDialogCtrl', ['$scope', 'order','$http', function ($scope, order,$http) { $scope.order = order.data; + $scope.getPayLocation=function (ip) { + $http.get('/dev/ip/'+ip).then(function (res) { + $scope.pay_location = res.data; + }) + } }]); app.controller('orderDetailEditCtrl', ['$scope', '$http', 'commonDialog', 'order', function ($scope, $http, commonDialog,order) { $scope.order = order.data; diff --git a/src/main/ui/static/commons/templates/order_detail.html b/src/main/ui/static/commons/templates/order_detail.html index ae0bd21de..f077f56d2 100644 --- a/src/main/ui/static/commons/templates/order_detail.html +++ b/src/main/ui/static/commons/templates/order_detail.html @@ -75,7 +75,9 @@
-

+

+ {{order.customer_ip}}  查询地区 : {{pay_location}} +

@@ -128,6 +130,12 @@

+
+ +
+

+
+
From 227b712f8fca001cb948ddb06e6eeddfc71df43a Mon Sep 17 00:00:00 2001 From: "eason.qian" Date: Wed, 25 Apr 2018 18:55:48 +0800 Subject: [PATCH 02/11] fix --- src/main/ui/static/commons/templates/order_detail.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/ui/static/commons/templates/order_detail.html b/src/main/ui/static/commons/templates/order_detail.html index f077f56d2..f0e33415e 100644 --- a/src/main/ui/static/commons/templates/order_detail.html +++ b/src/main/ui/static/commons/templates/order_detail.html @@ -76,7 +76,7 @@

- {{order.customer_ip}}  查询地区 : {{pay_location}} + {{order.customer_ip}}  查询地区 : {{pay_location}}

From 417ce0a2618a9cdc439fabf780dc63632d83205c Mon Sep 17 00:00:00 2001 From: yuan <1551130722@qq.com> Date: Thu, 26 Apr 2018 16:04:37 +0800 Subject: [PATCH 03/11] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=95=86=E6=88=B7?= =?UTF-8?q?=E5=8F=B7=E7=AE=A1=E7=90=86=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mappers/ClientAnalysisMapper.java | 5 + .../dev/core/CommonSubMerchantIdService.java | 13 -- .../impl/CommonSubMerchantIdServiceImpl.java | 45 ------ .../manage/dev/web/TestController.java | 27 +--- .../client/ClientSubMerchantIdMapper.java | 25 ++++ .../payment/CommonSubMerchantIdMapper.java | 4 +- .../manage/mappers/system/ClientMapper.java | 4 + .../core/MerchantIdManageService.java | 25 ++++ .../impl/MerchantIdManageServiceImpl.java | 137 ++++++++++++++++++ .../web/MerchantIdManageController.java | 80 ++++++++++ .../manage/task/SubMerchantIdTaskManager.java | 19 +++ .../analysis/mappers/ClientAnalysisMapper.xml | 29 ++++ .../manage/mappers/system/ClientMapper.xml | 21 +++ src/main/ui/manage.html | 6 + .../ui/static/config/devtools/devtools.js | 53 +------ .../templates/common_sub_merchant_id.html | 88 ----------- .../config/devtools/templates/root.html | 4 - .../payment/merchantid/merchant_id_manager.js | 125 ++++++++++++++++ .../templates/client_sub_merchant_id.html | 11 ++ .../templates/merchant_id_manage.html | 114 +++++++++++++++ .../templates/new_common_sub_merchant_id.html | 0 21 files changed, 606 insertions(+), 229 deletions(-) delete mode 100644 src/main/java/au/com/royalpay/payment/manage/dev/core/CommonSubMerchantIdService.java delete mode 100644 src/main/java/au/com/royalpay/payment/manage/dev/core/impl/CommonSubMerchantIdServiceImpl.java create mode 100644 src/main/java/au/com/royalpay/payment/manage/mappers/client/ClientSubMerchantIdMapper.java create mode 100644 src/main/java/au/com/royalpay/payment/manage/merchantid/core/MerchantIdManageService.java create mode 100644 src/main/java/au/com/royalpay/payment/manage/merchantid/core/impl/MerchantIdManageServiceImpl.java create mode 100644 src/main/java/au/com/royalpay/payment/manage/merchantid/web/MerchantIdManageController.java create mode 100644 src/main/java/au/com/royalpay/payment/manage/task/SubMerchantIdTaskManager.java delete mode 100644 src/main/ui/static/config/devtools/templates/common_sub_merchant_id.html create mode 100644 src/main/ui/static/payment/merchantid/merchant_id_manager.js create mode 100644 src/main/ui/static/payment/merchantid/templates/client_sub_merchant_id.html create mode 100644 src/main/ui/static/payment/merchantid/templates/merchant_id_manage.html rename src/main/ui/static/{config/devtools => payment/merchantid}/templates/new_common_sub_merchant_id.html (100%) diff --git a/src/main/java/au/com/royalpay/payment/manage/analysis/mappers/ClientAnalysisMapper.java b/src/main/java/au/com/royalpay/payment/manage/analysis/mappers/ClientAnalysisMapper.java index 3ffc50578..b95c323d8 100644 --- a/src/main/java/au/com/royalpay/payment/manage/analysis/mappers/ClientAnalysisMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/analysis/mappers/ClientAnalysisMapper.java @@ -6,6 +6,7 @@ import cn.yixblog.support.mybatis.autosql.annotations.AutoSql; import cn.yixblog.support.mybatis.autosql.annotations.SqlType; import com.alibaba.fastjson.JSONObject; import com.github.miemiedev.mybatis.paginator.domain.PageBounds; +import org.apache.ibatis.annotations.Param; import java.util.List; @@ -32,4 +33,8 @@ public interface ClientAnalysisMapper { List listPartnersTradeAmount(JSONObject params, PageBounds pageBounds); List countClientsTypes(JSONObject params); + + List notTradeSubMerchantId(); + + List listNotTradeClients(@Param("sub_merchant_id") String sub_merchant_id); } diff --git a/src/main/java/au/com/royalpay/payment/manage/dev/core/CommonSubMerchantIdService.java b/src/main/java/au/com/royalpay/payment/manage/dev/core/CommonSubMerchantIdService.java deleted file mode 100644 index ad10d7707..000000000 --- a/src/main/java/au/com/royalpay/payment/manage/dev/core/CommonSubMerchantIdService.java +++ /dev/null @@ -1,13 +0,0 @@ -package au.com.royalpay.payment.manage.dev.core; - -import com.alibaba.fastjson.JSONObject; - -/** - * Created by yuan on 2017/9/18. - */ -public interface CommonSubMerchantIdService { - - void save(JSONObject record); - - void disable(String sub_merchant_id); -} diff --git a/src/main/java/au/com/royalpay/payment/manage/dev/core/impl/CommonSubMerchantIdServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/dev/core/impl/CommonSubMerchantIdServiceImpl.java deleted file mode 100644 index 3ec59a5bd..000000000 --- a/src/main/java/au/com/royalpay/payment/manage/dev/core/impl/CommonSubMerchantIdServiceImpl.java +++ /dev/null @@ -1,45 +0,0 @@ -package au.com.royalpay.payment.manage.dev.core.impl; - -import au.com.royalpay.payment.channels.wechat.config.WeChatPayConfig; -import au.com.royalpay.payment.channels.wechat.runtime.MpPaymentApi; -import au.com.royalpay.payment.manage.dev.core.CommonSubMerchantIdService; -import au.com.royalpay.payment.manage.mappers.payment.CommonSubMerchantIdMapper; -import au.com.royalpay.payment.tools.exceptions.BadRequestException; - -import com.alibaba.fastjson.JSONObject; - -import org.springframework.stereotype.Service; - -import javax.annotation.Resource; - -@Service -public class CommonSubMerchantIdServiceImpl implements CommonSubMerchantIdService { - - @Resource - private CommonSubMerchantIdMapper commonSubMerchantIdMapper; - - @Resource - private MpPaymentApi mpPaymentApi; - @Override - public void save(JSONObject record) { - JSONObject sub_merchant_id = commonSubMerchantIdMapper.find(record.getString("sub_merchant_id")); - if(sub_merchant_id!=null){ - throw new BadRequestException("当前商户号已经添加,请重新输入"); - } - WeChatPayConfig.Merchant availableMerchant = mpPaymentApi.determineMerchant(record.getString("sub_merchant_id")); - if(availableMerchant == null){ - throw new BadRequestException("未检索到对应的商户号,请验证子商户号是否正确"); - } - record.put("merchant_id",availableMerchant.getMerchantId()); - commonSubMerchantIdMapper.save(record); - - } - - @Override - public void disable(String sub_merchant_id) { - JSONObject record = new JSONObject(); - record.put("sub_merchant_id",sub_merchant_id); - record.put("is_valid",false); - commonSubMerchantIdMapper.update(record); - } -} diff --git a/src/main/java/au/com/royalpay/payment/manage/dev/web/TestController.java b/src/main/java/au/com/royalpay/payment/manage/dev/web/TestController.java index a1bf5ee10..d0d88930c 100644 --- a/src/main/java/au/com/royalpay/payment/manage/dev/web/TestController.java +++ b/src/main/java/au/com/royalpay/payment/manage/dev/web/TestController.java @@ -11,11 +11,9 @@ import au.com.royalpay.payment.manage.analysis.core.PlatformClearService; import au.com.royalpay.payment.manage.appclient.core.RetailAppService; 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.CommonSubMerchantIdService; import au.com.royalpay.payment.manage.dev.core.WechatMessageService; 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.CommonSubMerchantIdMapper; import au.com.royalpay.payment.manage.mappers.payment.OrderMapper; import au.com.royalpay.payment.manage.mappers.payment.RefundMapper; import au.com.royalpay.payment.manage.mappers.system.ClientBankAccountMapper; @@ -28,7 +26,6 @@ import au.com.royalpay.payment.tools.exceptions.BadRequestException; import au.com.royalpay.payment.tools.http.HttpUtils; import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider; import au.com.royalpay.payment.tools.permission.enums.ManagerRole; -import au.com.royalpay.payment.tools.utils.PageListUtils; import au.com.royalpay.payment.tools.utils.PdfUtils; import au.com.royalpay.payment.tools.utils.TimeZoneUtils; import au.com.royalpay.payment.tools.utils.XmlFormatUtils; @@ -36,7 +33,6 @@ import au.com.royalpay.payment.tools.utils.XmlFormatUtils; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.serializer.SerializerFeature; -import com.github.miemiedev.mybatis.paginator.domain.PageBounds; import org.apache.commons.lang3.time.DateFormatUtils; import org.dom4j.Element; @@ -112,10 +108,7 @@ public class TestController implements ApplicationEventPublisherAware { private ApplicationEventPublisher publisher; @Resource private WechatMessageService wechatMessageService; - @Resource - private CommonSubMerchantIdMapper commonSubMerchantIdMapper; - @Resource - private CommonSubMerchantIdService commonSubMerchantIdService; + @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 { httpResponse.setContentType("application/pdf"); @@ -386,22 +379,4 @@ public class TestController implements ApplicationEventPublisherAware { wechatMessageService.sendMessageByOpenId(sendWechatMessage); } - - @RequestMapping(value = "/common_sub_merchant_id", method = RequestMethod.GET) - public JSONObject listCommonSubMerchantId(@RequestParam(required = false) String sub_merchant_id,@RequestParam(defaultValue = "true") boolean is_valid, @RequestParam(defaultValue = "1") int page, - @RequestParam(defaultValue = "10") int limit) { - return PageListUtils.buildPageListResult(commonSubMerchantIdMapper.list(is_valid,sub_merchant_id,new PageBounds(page,limit))); - } - - @RequestMapping(value = "/common_sub_merchant_id/{sub_merchant_id}", method = RequestMethod.POST) - public void addCommonSubMerchantId(@PathVariable String sub_merchant_id) { - JSONObject record = new JSONObject(); - record.put("sub_merchant_id",sub_merchant_id); - commonSubMerchantIdService.save(record); - } - - @RequestMapping(value = "/common_sub_merchant_id/{sub_merchant_id}", method = RequestMethod.PUT) - public void disableCommonSubMerchantId(@PathVariable String sub_merchant_id) { - commonSubMerchantIdService.disable(sub_merchant_id); - } } diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/client/ClientSubMerchantIdMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/client/ClientSubMerchantIdMapper.java new file mode 100644 index 000000000..d351576f0 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/client/ClientSubMerchantIdMapper.java @@ -0,0 +1,25 @@ +package au.com.royalpay.payment.manage.mappers.client; + +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.JSONObject; +import com.github.miemiedev.mybatis.paginator.domain.PageBounds; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +@AutoMapper(tablename = "cli_sub_merchant_id", pkName = "sub_merchant_id") +public interface ClientSubMerchantIdMapper { + @AutoSql(type = SqlType.SELECT) + List listSubMerchantId(PageBounds pageBounds); + + @AutoSql(type = SqlType.INSERT) + void save(JSONObject subMerchantId); + + @AutoSql(type = SqlType.UPDATE) + void update(JSONObject subMerchantId); + + @AutoSql(type = SqlType.DELETE) + void delete(@Param("sub_merchant_id") String sub_merchant_id); +} diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/payment/CommonSubMerchantIdMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/payment/CommonSubMerchantIdMapper.java index 278c22569..0e98c9127 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/payment/CommonSubMerchantIdMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/payment/CommonSubMerchantIdMapper.java @@ -10,13 +10,15 @@ 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 java.util.List; + /** * Create by yixian at 2017-12-05 23:13 */ @AutoMapper(tablename = "pmt_sub_merchant_id", pkName = "sub_merchant_id") public interface CommonSubMerchantIdMapper { @AutoSql(type = SqlType.SELECT) - PageList list(@Param("is_valid") boolean is_valid, @Param("sub_merchant_id") String sub_merchant_id, PageBounds pagination); + List list(@Param("is_valid") boolean is_valid, @Param("sub_merchant_id") String sub_merchant_id,PageBounds pageBounds); @AutoSql(type = SqlType.INSERT) void save(JSONObject record); diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientMapper.java index 3be51a159..52e96614a 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientMapper.java @@ -72,4 +72,8 @@ public interface ClientMapper { List listCityClientIds(@Param("city") String city, @Param("date") Date date); List listClientByCleanDays(@Param("clean_days") int clean_days); + + List listSubMerchantId(); + + List listBySubMerchantId(@Param("sub_merchant_id") String sub_merchant_id); } diff --git a/src/main/java/au/com/royalpay/payment/manage/merchantid/core/MerchantIdManageService.java b/src/main/java/au/com/royalpay/payment/manage/merchantid/core/MerchantIdManageService.java new file mode 100644 index 000000000..81a3b6bf9 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/merchantid/core/MerchantIdManageService.java @@ -0,0 +1,25 @@ +package au.com.royalpay.payment.manage.merchantid.core; + +import com.alibaba.fastjson.JSONObject; + +import java.util.List; +import java.util.Map; + +/** + * Created by yuan on 2018/4/24. + */ +public interface MerchantIdManageService { + Map> listSubMerchantId(JSONObject manager); + + void generateClientsSunMerchantId(); + + JSONObject listNotTradeSubMerchantId(JSONObject manager); + + List showClientMoniker(JSONObject manager,String sub_merchant_id); + + List showNotTradeClientMoniker(JSONObject manager,String sub_merchant_id); + + void save(JSONObject record); + + void disable(String sub_merchant_id); +} diff --git a/src/main/java/au/com/royalpay/payment/manage/merchantid/core/impl/MerchantIdManageServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/merchantid/core/impl/MerchantIdManageServiceImpl.java new file mode 100644 index 000000000..e21e043bb --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/merchantid/core/impl/MerchantIdManageServiceImpl.java @@ -0,0 +1,137 @@ +package au.com.royalpay.payment.manage.merchantid.core.impl; + +import au.com.royalpay.payment.channels.wechat.config.WeChatPayConfig; +import au.com.royalpay.payment.channels.wechat.runtime.MpPaymentApi; +import au.com.royalpay.payment.manage.analysis.mappers.ClientAnalysisMapper; +import au.com.royalpay.payment.manage.mappers.client.ClientSubMerchantIdMapper; +import au.com.royalpay.payment.manage.mappers.payment.CommonSubMerchantIdMapper; +import au.com.royalpay.payment.manage.mappers.system.ClientMapper; +import au.com.royalpay.payment.manage.merchantid.core.MerchantIdManageService; +import au.com.royalpay.payment.tools.env.PlatformEnvironment; +import au.com.royalpay.payment.tools.env.SysConfigManager; +import au.com.royalpay.payment.tools.exceptions.BadRequestException; +import com.alibaba.fastjson.JSONObject; +import com.github.miemiedev.mybatis.paginator.domain.Order; +import com.github.miemiedev.mybatis.paginator.domain.PageBounds; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * Created by yuan on 2018/4/24. + */ +@Service +public class MerchantIdManageServiceImpl implements MerchantIdManageService { + @Autowired + private ClientMapper clientMapper; + + @Autowired + private SysConfigManager sysConfigManager; + + @Autowired + private ClientAnalysisMapper clientAnalysisMapper; + + @Autowired + private ClientSubMerchantIdMapper clientSubMerchantIdMapper; + + @Resource + private CommonSubMerchantIdMapper commonSubMerchantIdMapper; + + @Resource + private MpPaymentApi mpPaymentApi; + + + @Override + public Map> listSubMerchantId(JSONObject manager) { + List clients = clientMapper.listSubMerchantId(); + return getClientMap(clients); + } + @Override + public JSONObject listNotTradeSubMerchantId(JSONObject manager) { + List clients = clientSubMerchantIdMapper.listSubMerchantId(new PageBounds(Order.formString("create_time.desc"))); + Map> merchantIdMap = clients.stream().filter(t->t.containsKey("merchant_id")).filter(t->t.containsKey("sub_merchant_id")).collect(Collectors.groupingBy(t->t.getString("merchant_id"))); + JSONObject returnJason = new JSONObject(); + returnJason.put("merchant_id_map",merchantIdMap); + returnJason.put("refresh_time",clients.size()>0?clients.get(0).getDate("create_time"):""); + return returnJason; + } + @Override + public void generateClientsSunMerchantId() { + String tempSubMerchantIds = sysConfigManager.getSysConfig().getString("temp_sub_mch_id"); + List clients = clientAnalysisMapper.notTradeSubMerchantId(); + List clientSubMerchantId = clientSubMerchantIdMapper.listSubMerchantId(new PageBounds(Order.formString("create_time.desc"))); + Map subMerchantIdMapFromDB = new HashMap<>(); + for (JSONObject id : clientSubMerchantId) { + subMerchantIdMapFromDB.put(id.getString("sub_merchant_id"), id); + } + for (JSONObject client: clients) { + String subMerchantId = client.getString("sub_merchant_id"); + if (subMerchantId != null && tempSubMerchantIds != null && tempSubMerchantIds.contains(subMerchantId)) { + client.put("temp_sub_merchant", true); + } + String id = client.getString("sub_merchant_id"); + client.put("create_time",new Date()); + if (subMerchantIdMapFromDB.containsKey(id)) { + subMerchantIdMapFromDB.remove(id); + clientSubMerchantIdMapper.update(client); + } else { + clientSubMerchantIdMapper.save(client); + } + } + for (String id : subMerchantIdMapFromDB.keySet()) { + clientSubMerchantIdMapper.delete(id); + } + } + + @Override + public List showClientMoniker(JSONObject manager,String sub_merchant_id) { + return clientMapper.listBySubMerchantId(sub_merchant_id); + } + + @Override + public List showNotTradeClientMoniker(JSONObject manager, String sub_merchant_id) { + return clientAnalysisMapper.listNotTradeClients(sub_merchant_id); + } + + @Override + public void save(JSONObject record) { + JSONObject sub_merchant_id = commonSubMerchantIdMapper.find(record.getString("sub_merchant_id")); + if(sub_merchant_id!=null){ + throw new BadRequestException("当前商户号已经添加,请重新输入"); + } + WeChatPayConfig.Merchant availableMerchant = mpPaymentApi.determineMerchant(record.getString("sub_merchant_id")); + if(availableMerchant == null){ + throw new BadRequestException("未检索到对应的商户号,请验证子商户号是否正确"); + } + record.put("merchant_id",availableMerchant.getMerchantId()); + commonSubMerchantIdMapper.save(record); + + } + + @Override + public void disable(String sub_merchant_id) { + JSONObject record = new JSONObject(); + record.put("sub_merchant_id",sub_merchant_id); + record.put("is_valid",false); + commonSubMerchantIdMapper.update(record); + } + + private Map> getClientMap(List clients){ + String tempSubMerchantIds = sysConfigManager.getSysConfig().getString("temp_sub_mch_id"); + for (JSONObject client: clients) { + String subMerchantId = client.getString("sub_merchant_id"); + if (subMerchantId != null && tempSubMerchantIds != null && tempSubMerchantIds.contains(subMerchantId)) { + client.put("temp_sub_merchant", true); + } + } + Map> clientsMap = clients.stream().filter(t->t.containsKey("merchant_id")).filter(t->t.containsKey("sub_merchant_id")).collect(Collectors.groupingBy(t->t.getString("merchant_id"))); + return clientsMap; + } +} diff --git a/src/main/java/au/com/royalpay/payment/manage/merchantid/web/MerchantIdManageController.java b/src/main/java/au/com/royalpay/payment/manage/merchantid/web/MerchantIdManageController.java new file mode 100644 index 000000000..c09090f21 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/merchantid/web/MerchantIdManageController.java @@ -0,0 +1,80 @@ +package au.com.royalpay.payment.manage.merchantid.web; + +import au.com.royalpay.payment.manage.mappers.payment.CommonSubMerchantIdMapper; +import au.com.royalpay.payment.manage.merchantid.core.MerchantIdManageService; + +import au.com.royalpay.payment.manage.permission.manager.RequireManager; +import au.com.royalpay.payment.tools.CommonConsts; +import au.com.royalpay.payment.tools.permission.enums.ManagerRole; +import com.alibaba.fastjson.JSONObject; +import com.github.miemiedev.mybatis.paginator.domain.Order; +import com.github.miemiedev.mybatis.paginator.domain.PageBounds; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.Date; +import java.util.List; +import java.util.Map; + +@RestController +@RequestMapping("/sys/merchant_id") +public class MerchantIdManageController { + + @Resource + private MerchantIdManageService merchantIdManageService; + + @Resource + private CommonSubMerchantIdMapper commonSubMerchantIdMapper; + + @RequestMapping(method = RequestMethod.GET) + @RequireManager(role = {ManagerRole.OPERATOR}) + public Map> listSubMerchantId(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { + return merchantIdManageService.listSubMerchantId(manager); + } + + @RequestMapping(method = RequestMethod.GET,value = "/trade") + @RequireManager(role = {ManagerRole.OPERATOR}) + public JSONObject listNotTradeSubMerchantId(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { + return merchantIdManageService.listNotTradeSubMerchantId(manager); + } + + @RequestMapping(method = RequestMethod.POST,value = "/refresh") + @RequireManager(role = {ManagerRole.OPERATOR}) + public void refreshClientsByTraded(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { + merchantIdManageService.generateClientsSunMerchantId(); + } + + @RequestMapping(method = RequestMethod.GET,value = "/{sub_merchant_id}") + @RequireManager(role = {ManagerRole.OPERATOR}) + public List showClientMoniker(@PathVariable() String sub_merchant_id,@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { + return merchantIdManageService.showClientMoniker(manager,sub_merchant_id); + } + + @RequestMapping(method = RequestMethod.GET,value = "/not_trade/{sub_merchant_id}") + @RequireManager(role = {ManagerRole.OPERATOR}) + public List showNotTradeClientMoniker(@PathVariable() String sub_merchant_id,@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { + return merchantIdManageService.showNotTradeClientMoniker(manager,sub_merchant_id); + } + + @RequestMapping(value = "/common_sub_merchant_id", method = RequestMethod.GET) + @RequireManager(role = {ManagerRole.OPERATOR}) + public List listCommonSubMerchantId(@RequestParam(required = false) String sub_merchant_id, @RequestParam(defaultValue = "true") boolean is_valid) { + return commonSubMerchantIdMapper.list(is_valid,sub_merchant_id,new PageBounds(Order.formString("create_time.desc"))); + } + + @RequestMapping(value = "/common_sub_merchant_id/{sub_merchant_id}", method = RequestMethod.POST) + @RequireManager(role = {ManagerRole.OPERATOR}) + public void addCommonSubMerchantId(@PathVariable String sub_merchant_id,@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { + JSONObject record = new JSONObject(); + record.put("sub_merchant_id",sub_merchant_id); + record.put("operator",manager.getString("display_name")); + record.put("create_time",new Date()); + merchantIdManageService.save(record); + } + + @RequestMapping(value = "/common_sub_merchant_id/{sub_merchant_id}", method = RequestMethod.PUT) + @RequireManager(role = {ManagerRole.OPERATOR}) + public void disableCommonSubMerchantId(@PathVariable String sub_merchant_id) { + merchantIdManageService.disable(sub_merchant_id); + } +} diff --git a/src/main/java/au/com/royalpay/payment/manage/task/SubMerchantIdTaskManager.java b/src/main/java/au/com/royalpay/payment/manage/task/SubMerchantIdTaskManager.java new file mode 100644 index 000000000..ef2d50b53 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/task/SubMerchantIdTaskManager.java @@ -0,0 +1,19 @@ +package au.com.royalpay.payment.manage.task; + +import au.com.royalpay.payment.manage.merchantid.core.MerchantIdManageService; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; + +@Component +@ConditionalOnProperty(value = "app.run-tasks", havingValue = "true") +public class SubMerchantIdTaskManager { + @Resource + private MerchantIdManageService merchantIdManageService; + @Scheduled(cron = "0 0 4 * * ?") + public void analysisDashboard(){ + merchantIdManageService.generateClientsSunMerchantId(); + } +} diff --git a/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/ClientAnalysisMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/ClientAnalysisMapper.xml index 99601e10b..966c238fb 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/ClientAnalysisMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/ClientAnalysisMapper.xml @@ -134,4 +134,33 @@ GROUP BY c.royalpayindustry order by partner_counts desc + + + + \ No newline at end of file diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientMapper.xml index 9fdde49bc..865e95925 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientMapper.xml @@ -286,4 +286,25 @@ + + + + \ No newline at end of file diff --git a/src/main/ui/manage.html b/src/main/ui/manage.html index d8751f45c..03e51ab7c 100644 --- a/src/main/ui/manage.html +++ b/src/main/ui/manage.html @@ -234,6 +234,12 @@ margin-bottom: 10%;"/> 商户管理|Partner Manage + +
  • + + 商户号管理 + +
  • diff --git a/src/main/ui/static/config/devtools/devtools.js b/src/main/ui/static/config/devtools/devtools.js index 835080ed5..c410bba37 100644 --- a/src/main/ui/static/config/devtools/devtools.js +++ b/src/main/ui/static/config/devtools/devtools.js @@ -51,11 +51,7 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) { url: '/phone_top_up', templateUrl: '/static/config/devtools/templates/phone_top_up.html', controller: 'phonetopupCtrl' - }).state('devtools.common_sub_merchant_id', { - url: '/common_sub_merchant_id', - templateUrl: '/static/config/devtools/templates/common_sub_merchant_id.html', - controller: 'commonSubMerchantIdCtrl' - }); + }) }]); app.controller('devManualRefundCtrl', ['$scope', '$http', 'commonDialog', function ($scope, $http, commonDialog) { $scope.sendRefund = function () { @@ -307,52 +303,5 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) { } }]); - app.controller('commonSubMerchantIdCtrl', ['$scope', '$http', '$uibModal', function ($scope, $http, $uibModal) { - $scope.pagination = {}; - $scope.params = {}; - $scope.loadSubMerchantId = function (page) { - var params = angular.copy($scope.params); - params.page = page || $scope.pagination.page || 1; - if(!params.sub_merchant_id){ - delete params.sub_merchant_id; - } - $http.get('/dev/common_sub_merchant_id',{params: params}).then(function (resp) { - $scope.subMerchantIdList= resp.data.data; - $scope.pagination = resp.data.pagination; - }); - }; - - $scope.loadSubMerchantId(1); - $scope.save = function () { - $uibModal.open({ - templateUrl: '/static/config/devtools/templates/new_common_sub_merchant_id.html', - controller: 'newCommonSubMerchantIdCtrl' - }).result.then(function () { - }) - } - $scope.disable = function (sub_merchant_id) { - $http.put('/dev/common_sub_merchant_id/'+sub_merchant_id).then(function (resp) { - alert("success"); - $scope.loadSubMerchantId(1); - },function (resp) { - alert(resp.data.message); - }); - } - - }]); - - app.controller('newCommonSubMerchantIdCtrl', ['$scope', '$http', function ($scope, $http) { - $scope.params = {}; - $scope.saveSubMerchantId = function () { - var params = angular.copy($scope.params); - $http.post('/dev/common_sub_merchant_id/'+params.sub_merchant_id).then(function (resp) { - alert("保存成功"); - },function (resp) { - alert(resp.data.message); - }); - }; - }]); - - return app; }); \ No newline at end of file diff --git a/src/main/ui/static/config/devtools/templates/common_sub_merchant_id.html b/src/main/ui/static/config/devtools/templates/common_sub_merchant_id.html deleted file mode 100644 index 75bda0f08..000000000 --- a/src/main/ui/static/config/devtools/templates/common_sub_merchant_id.html +++ /dev/null @@ -1,88 +0,0 @@ -
    -

    Sub Merchant ID

    -
    -
    - -
    -
    -
    -
    -
    -
    -
    -
    - - -
    -
    - -
    - -
    -
    - -
    - - -
    -
    -

    Common Sub Merchant ID List

    -
    - -
    - - - - - - - - - - - - - - -
    Sub Merchat IDMerchat IDOperation
    - -
    -
    - -
    - - -
    - -
    -
    -
    diff --git a/src/main/ui/static/config/devtools/templates/root.html b/src/main/ui/static/config/devtools/templates/root.html index b5f72da42..6e18a1a0d 100644 --- a/src/main/ui/static/config/devtools/templates/root.html +++ b/src/main/ui/static/config/devtools/templates/root.html @@ -67,10 +67,6 @@ Phone Top Up - - - Common Sub Merchant ID -
  • diff --git a/src/main/ui/static/payment/merchantid/merchant_id_manager.js b/src/main/ui/static/payment/merchantid/merchant_id_manager.js new file mode 100644 index 000000000..5ea83d503 --- /dev/null +++ b/src/main/ui/static/payment/merchantid/merchant_id_manager.js @@ -0,0 +1,125 @@ +define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootSwitch', 'ngFileUpload', 'uiSelect'], function (angular) { + 'use strict'; + var app = angular.module('merchantIdManage', ['ui.bootstrap', 'ui.router', 'frapontillo.bootstrap-switch', 'ngFileUpload', 'ui.select']); + app.config(['$stateProvider', function ($stateProvider) { + $stateProvider.state('merchant_id_manage', { + url: '/merchant_id/manage', + templateUrl: '/static/payment/merchantid/templates/merchant_id_manage.html', + controller: 'merchantIdManageCtrl', + data: {label: '商户号列表'} + }) + }]); + app.controller('merchantIdManageCtrl', ['$scope', '$state', '$http', '$uibModal', 'commonDialog', function ($scope, $state, $http,$uibModal,commonDialog) { + $scope.pagination = {}; + $scope.params = {}; + + $scope.loadClient = function () { + $http.get('/sys/merchant_id').then(function (resp) { + $scope.clientsMap = resp.data + }); + }; + $scope.loadClient(); + $scope.loadNotTradeClient = function () { + $http.get('/sys/merchant_id/trade').then(function (resp) { + $scope.notTradeClientsMap = resp.data.merchant_id_map; + $scope.refresh_time = resp.data.refresh_time + }); + }; + $scope.loadNotTradeClient(); + + $scope.loadTempSubMerchantId = function () { + var params = angular.copy($scope.params); + if(!params.sub_merchant_id){ + delete params.sub_merchant_id; + } + $http.get('/sys/merchant_id/common_sub_merchant_id',{params: params}).then(function (resp) { + $scope.subMerchantIdList= resp.data; + }); + }; + $scope.loadTempSubMerchantId(); + $scope.showClient = function (sub_merchant_id) { + $uibModal.open({ + templateUrl: '/static/payment/merchantid/templates/client_sub_merchant_id.html', + controller: 'showClientsCtrl', + resolve: { + clients: ['$http', function ($http) { + return $http.get('/sys/merchant_id/'+sub_merchant_id); + }] + }, + size: 'sm' + }) + }; + + $scope.showNotTradeClient = function (sub_merchant_id) { + $uibModal.open({ + templateUrl: '/static/payment/merchantid/templates/client_sub_merchant_id.html', + controller: 'showNotTradeClientsCtrl', + resolve: { + clients: ['$http', function ($http) { + return $http.get('/sys/merchant_id/not_trade/'+sub_merchant_id); + }] + }, + size: 'sm' + }) + }; + $scope.refresh = function () { + $http.post('/sys/merchant_id/refresh').then(function (resp) { + $scope.loadNotTradeClient(); + }); + }; + + $scope.save = function () { + $uibModal.open({ + templateUrl: '/static/payment/merchantid/templates/new_common_sub_merchant_id.html', + controller: 'newCommonSubMerchantIdCtrl' + }).result.then(function () { + $scope.loadTempSubMerchantId() + }) + } + $scope.disable = function (sub_merchant_id) { + $http.put('/sys/merchant_id/common_sub_merchant_id/'+sub_merchant_id).then(function (resp) { + commonDialog.alert({title: 'Success', content: 'Success', type: 'success'}); + $scope.loadTempSubMerchantId(); + },function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); + }); + } + + + }]); + + app.controller('showClientsCtrl', ['$scope', '$http','clients', function ($scope, $http,clients) { + $scope.clients = clients.data; + }]); + app.controller('showNotTradeClientsCtrl', ['$scope', '$http','clients', function ($scope, $http,clients) { + $scope.clients = clients.data; + }]); + app.controller('newCommonSubMerchantIdCtrl', ['$scope', '$http','commonDialog','$state', function ($scope, $http,commonDialog,$state) { + $scope.params = {}; + $scope.saveSubMerchantId = function () { + var params = angular.copy($scope.params); + $http.post('/sys/merchant_id/common_sub_merchant_id/'+params.sub_merchant_id).then(function () { + $scope.$close(); + commonDialog.alert({title: 'Success', content: '保存成功', type: 'success'}); + },function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}); + }); + }; + }]); + + app.filter('choose_merchant_id', function () { + return function (value) { + switch (value + '') { + case '1307485301': + return '1307485301(Tunnel Show1)'; + case '1431999902': + return '1431999902(Tunnel Show2)'; + case '1487387142': + return '1487387142(NAP)'; + case '': + return '' + } + } + }); + return app; +}); \ No newline at end of file diff --git a/src/main/ui/static/payment/merchantid/templates/client_sub_merchant_id.html b/src/main/ui/static/payment/merchantid/templates/client_sub_merchant_id.html new file mode 100644 index 000000000..cb03f3f6e --- /dev/null +++ b/src/main/ui/static/payment/merchantid/templates/client_sub_merchant_id.html @@ -0,0 +1,11 @@ + + diff --git a/src/main/ui/static/payment/merchantid/templates/merchant_id_manage.html b/src/main/ui/static/payment/merchantid/templates/merchant_id_manage.html new file mode 100644 index 000000000..c09f8a6ed --- /dev/null +++ b/src/main/ui/static/payment/merchantid/templates/merchant_id_manage.html @@ -0,0 +1,114 @@ + +
    +
    +

    Merchant Id Manage

    + +
    + +
    +
    +
    + + + + + +
    +
    +
    + + 上次刷新时间:{{refresh_time}} +    + + + +
    +
    + +
    +
    + +
    + + + + + + + + + + + + + + + + + + + + +
    Merchant IdSub Merchant IdOperatorCreate TimeOperation
    + {{client.sub_merchant_id}} + + + Disable +
    +
    +
    +
    +
    +
    +
    +
    \ No newline at end of file diff --git a/src/main/ui/static/config/devtools/templates/new_common_sub_merchant_id.html b/src/main/ui/static/payment/merchantid/templates/new_common_sub_merchant_id.html similarity index 100% rename from src/main/ui/static/config/devtools/templates/new_common_sub_merchant_id.html rename to src/main/ui/static/payment/merchantid/templates/new_common_sub_merchant_id.html From 03477c83f023095c3155944e639070d0bcd6d2fb Mon Sep 17 00:00:00 2001 From: yuan <1551130722@qq.com> Date: Thu, 26 Apr 2018 16:35:49 +0800 Subject: [PATCH 04/11] fix~ --- .../ui/static/payment/tradelog/templates/balance_report.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/ui/static/payment/tradelog/templates/balance_report.html b/src/main/ui/static/payment/tradelog/templates/balance_report.html index eeb71a0a7..8ad21e1a6 100644 --- a/src/main/ui/static/payment/tradelog/templates/balance_report.html +++ b/src/main/ui/static/payment/tradelog/templates/balance_report.html @@ -277,7 +277,7 @@ - + Date: Thu, 26 Apr 2018 16:43:43 +0800 Subject: [PATCH 05/11] fix~ --- src/main/ui/manage.html | 10 +++++----- .../merchantid/templates/merchant_id_manage.html | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/main/ui/manage.html b/src/main/ui/manage.html index 03e51ab7c..3ff5ae275 100644 --- a/src/main/ui/manage.html +++ b/src/main/ui/manage.html @@ -235,11 +235,6 @@ margin-bottom: 10%;"/> -
  • - - 商户号管理 - -
  • @@ -399,6 +394,11 @@ margin-bottom: 10%;"/>
  • +
  • + + 商户号管理 + +
  • 组织管理|Organizations diff --git a/src/main/ui/static/payment/merchantid/templates/merchant_id_manage.html b/src/main/ui/static/payment/merchantid/templates/merchant_id_manage.html index c09f8a6ed..182febf89 100644 --- a/src/main/ui/static/payment/merchantid/templates/merchant_id_manage.html +++ b/src/main/ui/static/payment/merchantid/templates/merchant_id_manage.html @@ -21,11 +21,11 @@
    -
    +
    -
    {{key|choose_merchant_id}} - {{client.sub_merchant_id}}  Date: Thu, 26 Apr 2018 17:35:26 +0800 Subject: [PATCH 06/11] fix~ --- .../manage/merchantid/core/impl/MerchantIdManageServiceImpl.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/au/com/royalpay/payment/manage/merchantid/core/impl/MerchantIdManageServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/merchantid/core/impl/MerchantIdManageServiceImpl.java index e21e043bb..e8c4d2c9b 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchantid/core/impl/MerchantIdManageServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchantid/core/impl/MerchantIdManageServiceImpl.java @@ -120,6 +120,7 @@ public class MerchantIdManageServiceImpl implements MerchantIdManageService { JSONObject record = new JSONObject(); record.put("sub_merchant_id",sub_merchant_id); record.put("is_valid",false); + record.put("update_time",new Date()); commonSubMerchantIdMapper.update(record); } From 6fae98440a77c9d85ebae3853ff6f636785d6224 Mon Sep 17 00:00:00 2001 From: yuan <1551130722@qq.com> Date: Thu, 26 Apr 2018 18:52:29 +0800 Subject: [PATCH 07/11] fix~ --- .../payment/merchantid/merchant_id_manager.js | 9 ++++++-- .../templates/merchant_id_manage.html | 21 +++++++++++++++++-- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/src/main/ui/static/payment/merchantid/merchant_id_manager.js b/src/main/ui/static/payment/merchantid/merchant_id_manager.js index 5ea83d503..af5d7935f 100644 --- a/src/main/ui/static/payment/merchantid/merchant_id_manager.js +++ b/src/main/ui/static/payment/merchantid/merchant_id_manager.js @@ -12,17 +12,21 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS app.controller('merchantIdManageCtrl', ['$scope', '$state', '$http', '$uibModal', 'commonDialog', function ($scope, $state, $http,$uibModal,commonDialog) { $scope.pagination = {}; $scope.params = {}; + $scope.isCollapsed = true; $scope.loadClient = function () { + $scope.client_loading = true; $http.get('/sys/merchant_id').then(function (resp) { - $scope.clientsMap = resp.data + $scope.clientsMap = resp.data; + $scope.client_loading = false; }); }; $scope.loadClient(); $scope.loadNotTradeClient = function () { $http.get('/sys/merchant_id/trade').then(function (resp) { $scope.notTradeClientsMap = resp.data.merchant_id_map; - $scope.refresh_time = resp.data.refresh_time + $scope.refresh_time = resp.data.refresh_time; + $scope.disable_button = false; }); }; $scope.loadNotTradeClient(); @@ -63,6 +67,7 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS }) }; $scope.refresh = function () { + $scope.disable_button = true; $http.post('/sys/merchant_id/refresh').then(function (resp) { $scope.loadNotTradeClient(); }); diff --git a/src/main/ui/static/payment/merchantid/templates/merchant_id_manage.html b/src/main/ui/static/payment/merchantid/templates/merchant_id_manage.html index 182febf89..fe2c3c998 100644 --- a/src/main/ui/static/payment/merchantid/templates/merchant_id_manage.html +++ b/src/main/ui/static/payment/merchantid/templates/merchant_id_manage.html @@ -2,6 +2,10 @@ .cursor { cursor: pointer; } + .div-display{ + display: none; + } +
    @@ -19,15 +23,27 @@
    +
    +
    From f1c2894897932b232496c84b69528a8060e60dd1 Mon Sep 17 00:00:00 2001 From: "eason.qian" Date: Thu, 26 Apr 2018 18:54:15 +0800 Subject: [PATCH 08/11] fix --- src/db/modify.sql | 25 ++++++++++++++++++- .../manage/appclient/beans/AppQueryBean.java | 12 +++++++++ .../core/impls/RetailAppServiceImp.java | 3 ++- .../manage/mappers/payment/OrderMapper.xml | 4 ++- 4 files changed, 41 insertions(+), 3 deletions(-) diff --git a/src/db/modify.sql b/src/db/modify.sql index 8b4a19fcf..6aa30dce1 100644 --- a/src/db/modify.sql +++ b/src/db/modify.sql @@ -370,4 +370,27 @@ CREATE TABLE `log_client_sub_merchant_id` ( `create_time` datetime NOT NULL COMMENT '创建时间', `client_id` int(11) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; \ No newline at end of file +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +CREATE TABLE `pmt_sub_merchant_id` ( + `sub_merchant_id` varchar(30) NOT NULL, + `merchant_id` varchar(30) NOT NULL, + `is_valid` tinyint(1) DEFAULT 1, + `operator` varchar(30) DEFAULT '', + `create_time` datetime DEFAULT NULL, + `update_time` datetime DEFAULT NULL, + PRIMARY KEY (`sub_merchant_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + + +alter table sys_clients add column common_sub_merchant_id tinyint(1) default 0 comment '是否使用通用子商户号'; + + +CREATE TABLE `cli_sub_merchant_id` ( + `sub_merchant_id` varchar(30) NOT NULL, + `merchant_id` varchar(30) DEFAULT NULL, + `client_count` int(8) DEFAULT NULL, + `temp_sub_merchant` tinyint(1) DEFAULT 0, + `create_time` datetime DEFAULT NULL, + PRIMARY KEY (`sub_merchant_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; diff --git a/src/main/java/au/com/royalpay/payment/manage/appclient/beans/AppQueryBean.java b/src/main/java/au/com/royalpay/payment/manage/appclient/beans/AppQueryBean.java index 2514700bb..03e0ec9cb 100644 --- a/src/main/java/au/com/royalpay/payment/manage/appclient/beans/AppQueryBean.java +++ b/src/main/java/au/com/royalpay/payment/manage/appclient/beans/AppQueryBean.java @@ -26,6 +26,7 @@ public class AppQueryBean { private OrderStatus status = OrderStatus.ALL; private PayChannel channel = PayChannel.ALL; private int[] gateway; + private int clearing_status; private String gateway_app; private int page = 1; private int limit = 20; @@ -86,6 +87,9 @@ public class AppQueryBean { if (app_client_ids != null && !app_client_ids.isEmpty()) { params.put("client_ids", app_client_ids.split(",")); } + if (clearing_status != -1) { + params.put("clearing_status", clearing_status); + } return params; } @@ -169,4 +173,12 @@ public class AppQueryBean { public void setChannel(PayChannel channel) { this.channel = channel; } + + public int getClearing_status() { + return clearing_status; + } + + public void setClearing_status(int clearing_status) { + this.clearing_status = clearing_status; + } } diff --git a/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java b/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java index 65552ea80..c9d3fe984 100644 --- a/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java +++ b/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java @@ -284,7 +284,8 @@ public class RetailAppServiceImp implements RetailAppService { String clientType = device.getString("client_type"); deviceSupport.findRegister(clientType); int client_id = device.getIntValue("client_id") ; - //JSONObject client = clientManager.getClientInfo(client_id); + JSONObject client = clientManager.getClientInfo(client_id); + device.put("client_moniker",client.getString("client_moniker")); TradeLogQuery tradeLogQuery = new TradeLogQuery(); tradeLogQuery.setDatefrom(appQueryBean.getBegin()); tradeLogQuery.setDateto(appQueryBean.getEnd()); diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/OrderMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/OrderMapper.xml index d538acf9d..d2ffdcf7b 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/OrderMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/OrderMapper.xml @@ -658,7 +658,8 @@ t.transaction_id, t.exchange_rate, t.clearing_status, - t.settle_amount + t.settle_amount, + t.clearing_status = 2 pre_auth from pmt_orders o left join pmt_transactions t on t.order_id=o.order_id and t.channel!='Settlement' and t.system_generate=0 @@ -687,6 +688,7 @@ o.channel=#{chan} + and t.clearing_status=#{clearing_status} From 86e1b7b03c348facfa76024168a2172f587b993f Mon Sep 17 00:00:00 2001 From: "eason.qian" Date: Thu, 26 Apr 2018 19:37:01 +0800 Subject: [PATCH 09/11] fix --- .../royalpay/payment/manage/appclient/beans/AppQueryBean.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/appclient/beans/AppQueryBean.java b/src/main/java/au/com/royalpay/payment/manage/appclient/beans/AppQueryBean.java index 03e0ec9cb..74fe9b474 100644 --- a/src/main/java/au/com/royalpay/payment/manage/appclient/beans/AppQueryBean.java +++ b/src/main/java/au/com/royalpay/payment/manage/appclient/beans/AppQueryBean.java @@ -26,7 +26,7 @@ public class AppQueryBean { private OrderStatus status = OrderStatus.ALL; private PayChannel channel = PayChannel.ALL; private int[] gateway; - private int clearing_status; + private int clearing_status=-1; private String gateway_app; private int page = 1; private int limit = 20; From fc65cfea0ee0ddcfca18385489d2917e02b5fd65 Mon Sep 17 00:00:00 2001 From: yuan <1551130722@qq.com> Date: Thu, 26 Apr 2018 19:50:57 +0800 Subject: [PATCH 10/11] fix~ --- .../mappers/ClientAnalysisMapper.java | 2 -- .../core/MerchantIdManageService.java | 2 -- .../impl/MerchantIdManageServiceImpl.java | 5 --- .../web/MerchantIdManageController.java | 5 --- .../analysis/mappers/ClientAnalysisMapper.xml | 17 +--------- .../payment/merchantid/merchant_id_manager.js | 15 --------- .../templates/merchant_id_manage.html | 31 +++++++++++++++++-- 7 files changed, 29 insertions(+), 48 deletions(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/analysis/mappers/ClientAnalysisMapper.java b/src/main/java/au/com/royalpay/payment/manage/analysis/mappers/ClientAnalysisMapper.java index b95c323d8..a84810107 100644 --- a/src/main/java/au/com/royalpay/payment/manage/analysis/mappers/ClientAnalysisMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/analysis/mappers/ClientAnalysisMapper.java @@ -35,6 +35,4 @@ public interface ClientAnalysisMapper { List countClientsTypes(JSONObject params); List notTradeSubMerchantId(); - - List listNotTradeClients(@Param("sub_merchant_id") String sub_merchant_id); } diff --git a/src/main/java/au/com/royalpay/payment/manage/merchantid/core/MerchantIdManageService.java b/src/main/java/au/com/royalpay/payment/manage/merchantid/core/MerchantIdManageService.java index 81a3b6bf9..ec5912ba7 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchantid/core/MerchantIdManageService.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchantid/core/MerchantIdManageService.java @@ -17,8 +17,6 @@ public interface MerchantIdManageService { List showClientMoniker(JSONObject manager,String sub_merchant_id); - List showNotTradeClientMoniker(JSONObject manager,String sub_merchant_id); - void save(JSONObject record); void disable(String sub_merchant_id); diff --git a/src/main/java/au/com/royalpay/payment/manage/merchantid/core/impl/MerchantIdManageServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/merchantid/core/impl/MerchantIdManageServiceImpl.java index e8c4d2c9b..c1fe7f0f1 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchantid/core/impl/MerchantIdManageServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchantid/core/impl/MerchantIdManageServiceImpl.java @@ -95,11 +95,6 @@ public class MerchantIdManageServiceImpl implements MerchantIdManageService { return clientMapper.listBySubMerchantId(sub_merchant_id); } - @Override - public List showNotTradeClientMoniker(JSONObject manager, String sub_merchant_id) { - return clientAnalysisMapper.listNotTradeClients(sub_merchant_id); - } - @Override public void save(JSONObject record) { JSONObject sub_merchant_id = commonSubMerchantIdMapper.find(record.getString("sub_merchant_id")); diff --git a/src/main/java/au/com/royalpay/payment/manage/merchantid/web/MerchantIdManageController.java b/src/main/java/au/com/royalpay/payment/manage/merchantid/web/MerchantIdManageController.java index c09090f21..ea706e83b 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchantid/web/MerchantIdManageController.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchantid/web/MerchantIdManageController.java @@ -50,11 +50,6 @@ public class MerchantIdManageController { return merchantIdManageService.showClientMoniker(manager,sub_merchant_id); } - @RequestMapping(method = RequestMethod.GET,value = "/not_trade/{sub_merchant_id}") - @RequireManager(role = {ManagerRole.OPERATOR}) - public List showNotTradeClientMoniker(@PathVariable() String sub_merchant_id,@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { - return merchantIdManageService.showNotTradeClientMoniker(manager,sub_merchant_id); - } @RequestMapping(value = "/common_sub_merchant_id", method = RequestMethod.GET) @RequireManager(role = {ManagerRole.OPERATOR}) diff --git a/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/ClientAnalysisMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/ClientAnalysisMapper.xml index 966c238fb..007950b60 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/ClientAnalysisMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/ClientAnalysisMapper.xml @@ -142,25 +142,10 @@ FROM sys_clients c WHERE c.sub_merchant_id not in (SELECT p.sub_merchant_id FROM sys_clients p INNER JOIN pmt_orders o ON o.client_id = p.client_id AND o.status >4 AND o.confirm_time IS NOT NULL - WHERE datediff(now(), o.create_time) <= 30 AND p.sub_merchant_id is not null GROUP BY p.sub_merchant_id) AND c.sub_merchant_id IS not null AND c.merchant_id IS NOT NULL + WHERE datediff(now(), o.create_time) <= 25 AND p.sub_merchant_id is not null GROUP BY p.sub_merchant_id) AND c.sub_merchant_id IS not null AND c.merchant_id IS NOT NULL AND (c.approve_result = 1 OR c.approve_result= 2) AND c.is_valid = 1 ]]> GROUP by c.sub_merchant_id - - \ No newline at end of file diff --git a/src/main/ui/static/payment/merchantid/merchant_id_manager.js b/src/main/ui/static/payment/merchantid/merchant_id_manager.js index af5d7935f..87dbcbe51 100644 --- a/src/main/ui/static/payment/merchantid/merchant_id_manager.js +++ b/src/main/ui/static/payment/merchantid/merchant_id_manager.js @@ -54,18 +54,6 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS }) }; - $scope.showNotTradeClient = function (sub_merchant_id) { - $uibModal.open({ - templateUrl: '/static/payment/merchantid/templates/client_sub_merchant_id.html', - controller: 'showNotTradeClientsCtrl', - resolve: { - clients: ['$http', function ($http) { - return $http.get('/sys/merchant_id/not_trade/'+sub_merchant_id); - }] - }, - size: 'sm' - }) - }; $scope.refresh = function () { $scope.disable_button = true; $http.post('/sys/merchant_id/refresh').then(function (resp) { @@ -96,9 +84,6 @@ define(['angular', 'static/commons/commons', 'uiBootstrap', 'uiRouter', 'ngBootS app.controller('showClientsCtrl', ['$scope', '$http','clients', function ($scope, $http,clients) { $scope.clients = clients.data; }]); - app.controller('showNotTradeClientsCtrl', ['$scope', '$http','clients', function ($scope, $http,clients) { - $scope.clients = clients.data; - }]); app.controller('newCommonSubMerchantIdCtrl', ['$scope', '$http','commonDialog','$state', function ($scope, $http,commonDialog,$state) { $scope.params = {}; $scope.saveSubMerchantId = function () { diff --git a/src/main/ui/static/payment/merchantid/templates/merchant_id_manage.html b/src/main/ui/static/payment/merchantid/templates/merchant_id_manage.html index fe2c3c998..6863a3ff5 100644 --- a/src/main/ui/static/payment/merchantid/templates/merchant_id_manage.html +++ b/src/main/ui/static/payment/merchantid/templates/merchant_id_manage.html @@ -6,6 +6,22 @@ display: none; } + .i-rotate_90{ + animation:rotate_90 1s forwards; + -webkit-animation:rotate_90 1s forwards; /* Safari and Chrome */ + } + + @keyframes rotate_90 + { + from {transform:rotate(0deg);} + to {transform:rotate(90deg);} + } + + @-webkit-keyframes rotate_90 /* Safari and Chrome */ + { + from {-webkit-transform:rotate(0deg);} + to {-webkit-transform:rotate(90deg);} + }
    @@ -29,7 +45,7 @@ - +