diff --git a/extra/apiclient_cert.p12 b/extra/apiclient_cert.p12 deleted file mode 100644 index 96de2220f..000000000 Binary files a/extra/apiclient_cert.p12 and /dev/null differ diff --git a/extra/apiclient_new_cert.p12 b/extra/apiclient_new_cert.p12 deleted file mode 100644 index 9c26f0bb5..000000000 Binary files a/extra/apiclient_new_cert.p12 and /dev/null differ diff --git a/extra/apple_message_cert_product_20190415.p12 b/extra/apple_message_cert_product_20190415.p12 deleted file mode 100644 index 03d23a263..000000000 Binary files a/extra/apple_message_cert_product_20190415.p12 and /dev/null differ diff --git a/extra/apple_message_cert_product_20200506.p12 b/extra/apple_message_cert_product_20200506.p12 deleted file mode 100644 index 4bd03a9d7..000000000 Binary files a/extra/apple_message_cert_product_20200506.p12 and /dev/null differ diff --git a/extra/apple_message_cert_product_20210509.p12 b/extra/apple_message_cert_product_20210509.p12 deleted file mode 100644 index 3449e888b..000000000 Binary files a/extra/apple_message_cert_product_20210509.p12 and /dev/null differ diff --git a/extra/napclient_cert.p12 b/extra/napclient_cert.p12 deleted file mode 100644 index 2c9e2f5cc..000000000 Binary files a/extra/napclient_cert.p12 and /dev/null differ diff --git a/extra/redpack_cert.p12 b/extra/redpack_cert.p12 deleted file mode 100644 index f0d785a2f..000000000 Binary files a/extra/redpack_cert.p12 and /dev/null differ diff --git a/pom.xml b/pom.xml index 8682c5ddc..3f63dc425 100644 --- a/pom.xml +++ b/pom.xml @@ -5,16 +5,17 @@ au.com.royalpay.payment payment-parent - 2.3.2 + 2.3.4 4.0.0 manage - 2.4.1 + 2.4.5 UTF-8 2.4.0 1.0.12 8.0.20 + ${project.version} @@ -299,41 +300,6 @@ - - dev - - - - com.google.cloud.tools - jib-maven-plugin - ${jib-maven-plugin.version} - - - 192.168.0.84:5000/royalpay/openjdk:11.0.8 - - - hkccr.ccs.tencentyun.com/cross-payment-dev/manage-dev:${project.version} - - - - - extra/ - - - true - - - - package - - build - - - - - - - prod @@ -347,7 +313,7 @@ 192.168.0.84:5000/royalpay/openjdk:11.0.8 - hkccr.ccs.tencentyun.com/rpay/manage:${project.version} + hkccr.ccs.tencentyun.com/rpay/manage:${image.version} diff --git a/src/document/openapi/cn/document.yml b/src/document/openapi/cn/document.yml index ae0fb5768..b37985abd 100644 --- a/src/document/openapi/cn/document.yml +++ b/src/document/openapi/cn/document.yml @@ -152,11 +152,23 @@ tags: description: | 用于移动端APP调用微信/支付宝SDK支付,调用API创建订单,得到微信SDK调用参数,将参数传递给SDK拉起微信/支付宝支付,并由客户端直接返回支付结果。 强烈建议获得支付结果后再调用RoyalPay订单查询API确认完成支付后再进行后续流程,避免因超时自动撤单导致资金损失 - 关于客户端和支付宝整和的更多信息:[支付宝SDK文档](https://global.alipay.com/doc/app_cn/about) - 关于客户端和微信整合的更多信息:[微信SDK文档](https://pay.weixin.qq.com/wiki/doc/api/app/app.php?chapter=11_1) - [Alipay SDK for Android](resources/api/alipaySdk-20160825.jar) - [Alipay SDK for iOS](resources/api/AlipaySDKForiOS.zip) + + 关于客户端和支付宝整和的更多信息: + + [支付宝SDK文档](https://global.alipay.com/doc/app_cn/about) + + [Alipay+接入文档](/resources/api/AlipayPlusAppIntegrationGuide.pdf) + + 关于客户端和微信整合的更多信息: + + [微信SDK文档](https://pay.weixin.qq.com/wiki/doc/api/app/app.php?chapter=11_1) + + [Alipay SDK for Android](/resources/api/alipaySdk-20160825.jar) + + [Alipay SDK for iOS](/resources/api/AlipaySDKForiOS.zip) + [Wechat SDK for Android](https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=open1419319167&token=&lang=zh_CN) + [Wechat SDK for iOS](https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=open1419319164&lang=zh_CN) - name: Custom diff --git a/src/document/openapi/en/document.yml b/src/document/openapi/en/document.yml index a2f08b276..ce45d3310 100644 --- a/src/document/openapi/en/document.yml +++ b/src/document/openapi/en/document.yml @@ -160,11 +160,22 @@ tags: Used for mobile Apps calling Wechat payment with Wechat/Alipay SDK. Call this api to create order and get param string for SDK calling. Call SDK api with the param to start payment and get payment result from Wechat app *It is strongly advised to request RoyalPay order query Api to confirm that the order has been paid in order to cancelling order by system at the same time.* - More information for integration with Alipay: [Alipay SDK Document](https://global.alipay.com/doc/app/intro) - More information for integration with Wechat: [Wechat SDK Document](https://pay.weixin.qq.com/wiki/doc/api/app/app.php?chapter=11_1) - [Alipay SDK for Android](resources/api/alipaySdk-20160825.jar) - [Alipay SDK for iOS](resources/api/AlipaySDKForiOS.zip) + More information for integration with Alipay: + + [Alipay SDK Document](https://global.alipay.com/doc/app/intro) + + [Alipay+ SDK Document](/resources/api/AlipayPlusAppIntegrationGuide.pdf) + + More information for integration with Wechat: + + [Wechat SDK Document](https://pay.weixin.qq.com/wiki/doc/api/app/app.php?chapter=11_1) + + [Alipay SDK for Android](/resources/api/alipaySdk-20160825.jar) + + [Alipay SDK for iOS](/resources/api/AlipaySDKForiOS.zip) + [Wechat SDK for Android](https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=open1419319167&token=&lang=zh_CN) + [Wechat SDK for iOS](https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=open1419319164&lang=zh_CN) - name: Custom diff --git a/src/document/openapi/resources/api/AlipayPlusAppIntegrationGuide.pdf b/src/document/openapi/resources/api/AlipayPlusAppIntegrationGuide.pdf new file mode 100644 index 000000000..3f5b73f91 Binary files /dev/null and b/src/document/openapi/resources/api/AlipayPlusAppIntegrationGuide.pdf differ diff --git a/src/main/java/au/com/royalpay/payment/manage/apsKYC/domain/repository/ApsNoticeClientRepository.java b/src/main/java/au/com/royalpay/payment/manage/apsKYC/domain/repository/ApsNoticeClientRepository.java index cb604586e..6e10f4f1e 100644 --- a/src/main/java/au/com/royalpay/payment/manage/apsKYC/domain/repository/ApsNoticeClientRepository.java +++ b/src/main/java/au/com/royalpay/payment/manage/apsKYC/domain/repository/ApsNoticeClientRepository.java @@ -6,15 +6,18 @@ import com.github.miemiedev.mybatis.paginator.domain.PageBounds; import com.github.miemiedev.mybatis.paginator.domain.PageList; import java.util.Date; +import java.util.List; public interface ApsNoticeClientRepository { void saveApsNoticeClient(ApsNoticeClient apsNoticeClient); void updateApsNoticeClient(ApsNoticeClient apsNoticeClient); - PageList getApsNoticeClients(String id, PageBounds pageBounds); + PageList getApsNoticeClients(String id, String clientStatus, PageBounds pageBounds); void updateApsNoticeClientByPartnerCode(Date modifyTime, String modifier, String partnerCode); ApsNoticeClient getApsNoticeClientById(String id); + + List apsNoticeClients(String id, String clientStatus); } diff --git a/src/main/java/au/com/royalpay/payment/manage/apsKYC/domain/service/ApsNoticeClientsService.java b/src/main/java/au/com/royalpay/payment/manage/apsKYC/domain/service/ApsNoticeClientsService.java index e33df75a7..09ac8ef61 100644 --- a/src/main/java/au/com/royalpay/payment/manage/apsKYC/domain/service/ApsNoticeClientsService.java +++ b/src/main/java/au/com/royalpay/payment/manage/apsKYC/domain/service/ApsNoticeClientsService.java @@ -4,6 +4,11 @@ import com.alibaba.fastjson.JSONObject; import com.github.miemiedev.mybatis.paginator.domain.PageBounds; import com.github.miemiedev.mybatis.paginator.domain.PageList; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + public interface ApsNoticeClientsService { - PageList getApsNoticeClients(String id, PageBounds pageBounds); + PageList getApsNoticeClients(String id, String clientStatus, PageBounds pageBounds); + + void exportApsNoticeClients(String id, String clientStatus, HttpServletRequest request, HttpServletResponse response); } diff --git a/src/main/java/au/com/royalpay/payment/manage/apsKYC/domain/service/Impl/ApsNoticeClientsServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/apsKYC/domain/service/Impl/ApsNoticeClientsServiceImpl.java index b2199054e..6c922510c 100644 --- a/src/main/java/au/com/royalpay/payment/manage/apsKYC/domain/service/Impl/ApsNoticeClientsServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/apsKYC/domain/service/Impl/ApsNoticeClientsServiceImpl.java @@ -1,16 +1,36 @@ package au.com.royalpay.payment.manage.apsKYC.domain.service.Impl; +import au.com.royalpay.payment.manage.apsKYC.domain.entity.ApsNotice; +import au.com.royalpay.payment.manage.apsKYC.domain.entity.ApsNoticeClient; import au.com.royalpay.payment.manage.apsKYC.domain.repository.ApsNoticeClientRepository; import au.com.royalpay.payment.manage.apsKYC.domain.service.ApsNoticeClientsService; +import au.com.royalpay.payment.manage.mappers.apskyc.ApsNoticeMapper; import au.com.royalpay.payment.manage.mappers.system.ClientAccountMapper; +import au.com.royalpay.payment.manage.mappers.system.ClientMapper; import au.com.royalpay.payment.manage.mappers.system.ManagerMapper; +import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.github.miemiedev.mybatis.paginator.domain.PageBounds; import com.github.miemiedev.mybatis.paginator.domain.PageList; import org.apache.commons.lang3.StringUtils; +import org.apache.poi.hssf.usermodel.HSSFRow; +import org.apache.poi.hssf.usermodel.HSSFSheet; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.ss.usermodel.CellStyle; +import org.apache.poi.ss.usermodel.Font; +import org.apache.poi.xssf.usermodel.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.OutputStream; +import java.net.URLEncoder; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + @Service public class ApsNoticeClientsServiceImpl implements ApsNoticeClientsService { @@ -20,12 +40,18 @@ public class ApsNoticeClientsServiceImpl implements ApsNoticeClientsService { @Autowired private ManagerMapper managerMapper; + @Autowired + private ClientMapper clientMapper; + @Autowired private ClientAccountMapper clientAccountMapper; + @Autowired + private ApsNoticeMapper apsNoticeMapper; + @Override - public PageList getApsNoticeClients(String id, PageBounds pageBounds) { - PageList apsNoticeClients = apsNoticeClientRepository.getApsNoticeClients(id, pageBounds); + public PageList getApsNoticeClients(String id, String clientStatus, PageBounds pageBounds) { + PageList apsNoticeClients = apsNoticeClientRepository.getApsNoticeClients(id, clientStatus, pageBounds); for (JSONObject apsNoticeClient : apsNoticeClients) { if (apsNoticeClient.containsKey("modifier") && StringUtils.isNotBlank(apsNoticeClient.getString("modifier"))) { JSONObject modifier = managerMapper.findDetail(apsNoticeClient.getString("modifier")); @@ -43,7 +69,181 @@ public class ApsNoticeClientsServiceImpl implements ApsNoticeClientsService { } } } + JSONObject clinet = clientMapper.findClientByMoniker(apsNoticeClient.getString("partner_code")); + if (clinet != null && clinet.containsKey("bd_user_name") && StringUtils.isNotBlank(clinet.getString("bd_user_name"))) { + apsNoticeClient.put("bd_name", clinet.getString("bd_user_name")); + } } return apsNoticeClients; } + + @Override + public void exportApsNoticeClients(String id, String clientStatus, HttpServletRequest request, HttpServletResponse response) { + List apsNoticeClients = apsNoticeClientRepository.apsNoticeClients(id, clientStatus); + + SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); + OutputStream os = null; + XSSFWorkbook xWorkbook = null; + + try { + ApsNotice apsNotice = apsNoticeMapper.getApsNoticesById(id); + + + String fileName = apsNotice.getTitle() + "(" + df.format(new Date()) + ").xlsx"; + fileName = new String(fileName.getBytes("gbk"), "iso8859-1"); + os = response.getOutputStream(); + response.reset(); + response.setHeader("Content-disposition", "attachment; filename = " + fileName); + response.setContentType("application/octet-streem"); + + //创建表格工作空间 + xWorkbook = new XSSFWorkbook(); + //创建一个新表格 + XSSFSheet xSheet = xWorkbook.createSheet("商户列表"); + //set Sheet页头部 + setSheetHeader(xWorkbook, xSheet); + //set Sheet页内容 + setSheetContent(xWorkbook, xSheet, apsNoticeClients); + xWorkbook.write(os); + } catch (Exception e) { + e.printStackTrace(); + } finally { + if (null != os) { + try { + os.close(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + if (null != xWorkbook) { + try { + xWorkbook.close(); + } catch (Exception e) { + e.printStackTrace(); + } + } + } + } + + private void setSheetContent(XSSFWorkbook xWorkbook, XSSFSheet xSheet, List apsNoticeClients) { + SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + //创建内容样式(头部以下的样式) + CellStyle cs = xWorkbook.createCellStyle(); + cs.setWrapText(true); + + //设置水平垂直居中 + cs.setAlignment(CellStyle.ALIGN_CENTER); + cs.setVerticalAlignment(CellStyle.VERTICAL_CENTER); + + if (null != apsNoticeClients && apsNoticeClients.size() > 0) { + for (int i = 0; i < apsNoticeClients.size(); i++) { + XSSFRow xRow = xSheet.createRow(i + 1); + //设置第一列 + XSSFCell xCell0 = xRow.createCell(0); + xCell0.setCellStyle(cs); + xCell0.setCellValue(apsNoticeClients.get(i).getPartnerCode()); + //设置第二列 + XSSFCell xCell1 = xRow.createCell(1); + xCell1.setCellStyle(cs); + JSONObject clinet = clientMapper.findClientByMoniker(apsNoticeClients.get(i).getPartnerCode()); + if (clinet != null && clinet.containsKey("bd_user_name") && StringUtils.isNotBlank(clinet.getString("bd_user_name"))) { + xCell1.setCellValue(clinet.getString("bd_user_name")); + } else { + xCell1.setCellValue("未配置BD"); + } + //设置第三列 + XSSFCell xCell2 = xRow.createCell(2); + xCell2.setCellStyle(cs); + xCell2.setCellValue(apsNoticeClients.get(i).getStatus()); + String userName = "未知"; + if (StringUtils.isNotBlank(apsNoticeClients.get(i).getUserId())) { + if (!apsNoticeClients.get(i).getUserId().equals("0")) { + JSONObject user = clientAccountMapper.findDetail(apsNoticeClients.get(i).getUserId()); + if (user != null) { + userName = user.getString("username"); + } + } + } + switch (apsNoticeClients.get(i).getStatus()) { + case 0: { + xCell2.setCellValue("未读"); + break; + } + case 1: { + xCell2.setCellValue("已读(" + userName + ":" + df.format(apsNoticeClients.get(i).getReadTime()) + ")"); + break; + } + case 2: { + xCell2.setCellValue("同意(" + userName + ":" + df.format(apsNoticeClients.get(i).getStatusTime()) + ")"); + break; + } + case 3: { + xCell2.setCellValue("拒绝(" + userName + ":" + df.format(apsNoticeClients.get(i).getStatusTime()) + ")"); + break; + } + } + //设置第四列 + XSSFCell xCell3 = xRow.createCell(3); + xCell3.setCellStyle(cs); + switch (apsNoticeClients.get(i).getHandle()) { + case 0: { + xCell3.setCellValue("未处理"); + break; + } + case 1: { + if (StringUtils.isNotBlank(apsNoticeClients.get(i).getModifier())) { + JSONObject modifier = managerMapper.findDetail(apsNoticeClients.get(i).getModifier()); + if (modifier != null) { + xCell3.setCellValue("已处理(" + modifier.getString("username") + ":" + df.format(apsNoticeClients.get(i).getModifyTime()) + ")"); + } else { + xCell3.setCellValue("已处理(未知用户:" + df.format(apsNoticeClients.get(i).getModifyTime()) + ")"); + } + } + break; + } + } + } + } + } + + private void setSheetHeader(XSSFWorkbook xWorkbook, XSSFSheet xSheet) { + //设置表格的宽度 xSheet.setColumnWidth(0, 20 * 256); 中的数字 20 自行设置为自己适用的 + xSheet.setColumnWidth(0, 10 * 256); + xSheet.setColumnWidth(1, 25 * 256); + xSheet.setColumnWidth(2, 40 * 256); + xSheet.setColumnWidth(3, 40 * 256); + //创建表格的样式 + CellStyle cs = xWorkbook.createCellStyle(); + //设置水平、垂直居中 + cs.setAlignment(CellStyle.ALIGN_CENTER); + cs.setVerticalAlignment(CellStyle.VERTICAL_CENTER); + //设置字体 + Font headerFont = xWorkbook.createFont(); + headerFont.setFontHeightInPoints((short) 12); + /*headerFont.setBoldweight(XSSFFont.BOLDWEIGHT_BOLD);*/ + headerFont.setBoldweight(XSSFFont.BOLDWEIGHT_BOLD); + headerFont.setFontName("宋体"); + cs.setFont(headerFont); + cs.setWrapText(true);//是否自动换行 + + //创建一行 + XSSFRow xRow0 = xSheet.createRow(0); + //设置每一列 + XSSFCell xCell0 = xRow0.createCell(0); + xCell0.setCellStyle(cs); + xCell0.setCellValue("商户名称"); + + XSSFCell xCell1 = xRow0.createCell(1); + xCell1.setCellStyle(cs); + xCell1.setCellValue("所属BD"); + + XSSFCell xCell2 = xRow0.createCell(2); + xCell2.setCellStyle(cs); + xCell2.setCellValue("商户操作状态"); + + XSSFCell xCell3 = xRow0.createCell(3); + xCell3.setCellStyle(cs); + xCell3.setCellValue("运营操作状态"); + } } diff --git a/src/main/java/au/com/royalpay/payment/manage/apsKYC/infrastructure/repository/ApsNoticeClientRepositoryImpl.java b/src/main/java/au/com/royalpay/payment/manage/apsKYC/infrastructure/repository/ApsNoticeClientRepositoryImpl.java index d88d3cf13..6205defaf 100644 --- a/src/main/java/au/com/royalpay/payment/manage/apsKYC/infrastructure/repository/ApsNoticeClientRepositoryImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/apsKYC/infrastructure/repository/ApsNoticeClientRepositoryImpl.java @@ -10,6 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; import java.util.Date; +import java.util.List; @Repository public class ApsNoticeClientRepositoryImpl implements ApsNoticeClientRepository { @@ -28,8 +29,8 @@ public class ApsNoticeClientRepositoryImpl implements ApsNoticeClientRepository } @Override - public PageList getApsNoticeClients(String id, PageBounds pageBounds) { - return mapper.getApsNoticeClients(id, pageBounds); + public PageList getApsNoticeClients(String id, String clientStatus, PageBounds pageBounds) { + return mapper.getApsNoticeClients(id, clientStatus, pageBounds); } @Override @@ -41,4 +42,9 @@ public class ApsNoticeClientRepositoryImpl implements ApsNoticeClientRepository public ApsNoticeClient getApsNoticeClientById(String id) { return mapper.getApsNoticeClientById(id); } + + @Override + public List apsNoticeClients(String id, String clientStatus) { + return mapper.apsNoticeClients(id, clientStatus); + } } diff --git a/src/main/java/au/com/royalpay/payment/manage/apsKYC/web/RestApsKYCController.java b/src/main/java/au/com/royalpay/payment/manage/apsKYC/web/RestApsKYCController.java index c9ceab6e5..e471002e4 100644 --- a/src/main/java/au/com/royalpay/payment/manage/apsKYC/web/RestApsKYCController.java +++ b/src/main/java/au/com/royalpay/payment/manage/apsKYC/web/RestApsKYCController.java @@ -15,6 +15,8 @@ import com.github.miemiedev.mybatis.paginator.domain.PageList; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; @RestController @RequestMapping(value = "/aps/kyc") @@ -74,9 +76,9 @@ public class RestApsKYCController { @ManagerMapping(value = "/notice/clients", method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.SALES_MANAGER}) public JSONObject getApsNoticeClients(@RequestParam(value = "page", defaultValue = "1") int page, @RequestParam(value = "pageSize", defaultValue = "20") int pageSize, - @RequestParam String id) { + @RequestParam String id, @RequestParam(required = false) String clientStatus) { PageBounds pageBounds = new PageBounds(page, pageSize); - PageList apply = apsNoticeClientsService.getApsNoticeClients(id, pageBounds); + PageList apply = apsNoticeClientsService.getApsNoticeClients(id, clientStatus, pageBounds); return PageListUtils.buildPageListResult(apply); } @@ -101,4 +103,15 @@ public class RestApsKYCController { public void updateApsNoticeClient(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, @RequestBody ApsNoticeClient apsNoticeClient) { apsNoticeService.updateApsNoticeClient(manager, apsNoticeClient); } + + /** + * 导出商户名单 + * + * @param id + * @param clientStatus + */ + @ManagerMapping(value = "/notice/clients/excel", method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.SALES_MANAGER}) + public void exportApsNoticeClients(@RequestParam String id, @RequestParam(required = false) String clientStatus, HttpServletRequest request, HttpServletResponse response) throws Exception { + apsNoticeClientsService.exportApsNoticeClients(id, clientStatus, request, response); + } } diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/apskyc/ApsNoticeClientMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/apskyc/ApsNoticeClientMapper.java index fe0e7fd68..026ac85b6 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/apskyc/ApsNoticeClientMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/apskyc/ApsNoticeClientMapper.java @@ -10,6 +10,7 @@ import com.yixsoft.support.mybatis.autosql.annotations.SqlType; import org.apache.ibatis.annotations.Param; import java.util.Date; +import java.util.List; @AutoMapper(tablename = "sys_aps_notice_clients", pkName = "id") public interface ApsNoticeClientMapper { @@ -20,7 +21,7 @@ public interface ApsNoticeClientMapper { @AutoSql(SqlType.UPDATE) void updateApsNoticeClient(ApsNoticeClient apsNoticeClient); - PageList getApsNoticeClients(String id, PageBounds pageBounds); + PageList getApsNoticeClients(String id,String clientStatus, PageBounds pageBounds); void updateApsNoticeClientByPartnerCode(@Param("modify_time") Date modifyTime, @Param("modifier") String modifier, @Param("partner_code") String partnerCode); @@ -31,4 +32,6 @@ public interface ApsNoticeClientMapper { @AutoSql(SqlType.UPDATE) void toUpdateApsKycClient(JSONObject updateReadTime); + + List apsNoticeClients(String id, String clientStatus); } diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/payment/OrderMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/payment/OrderMapper.java index 90d33bf7f..de3a5fee2 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/payment/OrderMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/payment/OrderMapper.java @@ -32,6 +32,8 @@ public interface OrderMapper { PageList listIncrementalOrders(JSONObject params, PageBounds pagination); + PageList listIncrementalOrdersNew(JSONObject params, PageBounds pagination); + List listOrdersNoPage(JSONObject params); PageList listOrdersByClients(JSONObject params, PageBounds pagination); diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java index 34945de53..01f19c7d3 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java @@ -32,6 +32,8 @@ import au.com.royalpay.payment.core.beans.MerchantApplicationResult; import au.com.royalpay.payment.core.exceptions.EmailException; import au.com.royalpay.payment.core.exceptions.InvalidShortIdException; import au.com.royalpay.payment.core.impls.MerchantChannelApplicationManager; +import au.com.royalpay.payment.core.mappers.MchChannelContractDAO; +import au.com.royalpay.payment.core.mappers.MchChannelContractMapper; import au.com.royalpay.payment.core.mappers.SysClientMapper; import au.com.royalpay.payment.core.utils.OrderExpiryRuleResolver; import au.com.royalpay.payment.manage.analysis.mappers.TransactionAnalysisMapper; @@ -87,6 +89,7 @@ import au.com.royalpay.payment.tools.connections.mpsupport.beans.TemplateMessage import au.com.royalpay.payment.tools.connections.mpsupport.exceptions.WechatException; import au.com.royalpay.payment.tools.defines.IncrementalChannel; import au.com.royalpay.payment.tools.defines.PayChannel; +import au.com.royalpay.payment.tools.defines.TradeType; import au.com.royalpay.payment.tools.env.PlatformEnvironment; import au.com.royalpay.payment.tools.env.SysConfigManager; import au.com.royalpay.payment.tools.exceptions.BadRequestException; @@ -331,7 +334,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid private ApsNoticeClientMapper apsNoticeClientMapper; DateTimeFormatter formatter = DateTimeFormat.forPattern("dd MMM yyyy"); - + @Resource + private MchChannelContractMapper mchChannelContractMapper; @Resource private SmsSender smsSender; @@ -555,6 +559,29 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid client.put("enable_alipayplus", true); } client.put("enable_alipayaps", false); + Map channelPermissions = new HashMap<>(); + for (PaymentChannelApi channelApi : paymentApi.channels()) { + try { + MchChannelContract contract = channelApi.initContractSource(). + findMchContract(client.getIntValue("client_id"), TradeType.CLIENT_CODE, PlatformEnvironment.getEnv().getForeignCurrencyEnum().toCurrencyInfo()); + JSONObject config = new JSONObject(); + config.put("channel", channelApi.channel()); + if (contract != null) { + config.put("enable", contract.isValid()); + config.put("pid", contract.getPid()); + config.put("mid", contract.getMid()); + config.put("mcc", contract.getMccCode()); + } else { + config.put("enable", false); + //aps渠道的默认值展示 + config.put("mid", client.getString("client_moniker")); + } + channelPermissions.put(channelApi.channel().toLowerCase(), config); + } catch (Exception e) { + logger.error(e.getMessage(), e); + } + } + client.put("available_channels", channelPermissions); MerchantChannelPermissionResolver resolverApsInStore = this.paymentApi.channelApi(PayChannel.ALIPAY_APS_IN_STORE.getChannelCode()).getChannelPermissionResolver(); MerchantChannelPermissionResolver resolverApsCashier = this.paymentApi.channelApi(PayChannel.ALIPAY_APS_CASHIER.getChannelCode()).getChannelPermissionResolver(); if (!Objects.isNull(resolverApsInStore) && !Objects.isNull(resolverApsCashier) && @@ -6141,7 +6168,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid JSONObject result = null; JSONObject expireInfo = clientContractService.getClientContractExpire(client_id, channel); JSONObject account = clientAccountMapper.findById(account_id); - if (PartnerRole.getRole(account.getIntValue("role")) == PartnerRole.CASHIER) { + if (account == null || PartnerRole.getRole(account.getIntValue("role")) == PartnerRole.CASHIER) { return result; } else { if (expireInfo.getBooleanValue("alert")) { @@ -7150,13 +7177,22 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid client.put("isRetail", isRetail); String pid = ""; if (isRetail) { - //todo 测试需要 先都改成线上,上线此处需要改成线下 pid = AlipayEnvironment.getEnv().getAlipayPlusApsRetailConfig().getPid(); } else { pid = AlipayEnvironment.getEnv().getAlipayPlusApsOnlineConfig().getPid(); } client.put("pid", pid); + List channelContractDAOS = mchChannelContractMapper.listByPidClientId(isRetail ? PayChannel.ALIPAY_APS_IN_STORE.getChannelCode() : PayChannel.ALIPAY_APS_CASHIER.getChannelCode(), pid, client.getInteger("client_id")); + MchChannelContractDAO mchChannelContractDAO = channelContractDAOS.stream().max(Comparator.comparing(MchChannelContractDAO::getCreateTime)).orElse(null); + String mid = client.getString("client_moniker"); + //数据库有数据 + if (mchChannelContractDAO != null && StringUtils.isNotEmpty(mchChannelContractDAO.getMid())) { + mid = mchChannelContractDAO.getMid(); + } else { + mid = client.getString("client_moniker"); + } + client.put("mid", mid); AlipayApsMerchantRegister alipayApsMerchantRegister = Optional.ofNullable(merchantChannelApplicationManager.getRegister(AlipayApsMerchantRegister.class)).orElseThrow(() -> new ServerErrorException("No AlipayAps registry found")); AlipayPlusRegisterResult alipayPlusRegisterResult = alipayApsMerchantRegister.findMerchant(client); return alipayPlusRegisterResult.getRawResponse(); diff --git a/src/main/java/au/com/royalpay/payment/manage/tradelog/core/impls/TradeLogServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/tradelog/core/impls/TradeLogServiceImpl.java index ae51cf0cb..79fa5cc5f 100644 --- a/src/main/java/au/com/royalpay/payment/manage/tradelog/core/impls/TradeLogServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/tradelog/core/impls/TradeLogServiceImpl.java @@ -33,6 +33,7 @@ import au.com.royalpay.payment.tools.utils.CurrencyAmountUtils; import au.com.royalpay.payment.tools.utils.PageListUtils; import au.com.royalpay.payment.tools.utils.TimeZoneUtils; import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.github.miemiedev.mybatis.paginator.domain.Order; import com.github.miemiedev.mybatis.paginator.domain.PageBounds; @@ -211,6 +212,12 @@ public class TradeLogServiceImpl implements TradeLogService { add(query.getGatewayChild()); }}); } + JSONArray clientIds = clientManager.getAllClientIds(client.getIntValue("client_id")); + logger.info("====>clientIds:{}",clientIds.size()); + if (clientIds.size() > 1) { + String[] arr = new String[clientIds.size()]; + params.put("client_ids", clientIds.toArray(arr)); + } PageList logs = orderMapper.listIncrementalOrdersByClients(params, new PageBounds(query.getPage(), query.getLimit(), Order.formString("create_time.desc"))); if (timezone != null) { diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 056979324..6f3e95999 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -2,7 +2,7 @@ server: port: 5555 spring: profiles: - active: dev,alipay,bestpay,jd,wechat,rpay,yeepay,rppaysvc,common,alipayplusaps + active: dev,alipay,bestpay,jd,wechat,rpay,yeepay,rppaysvc,common,alipayplusaps,apsinstore,apscashier mail: host: '' port: '' @@ -73,6 +73,7 @@ app: control: aes-key: Aa+MtthC4Ztq4Kfa9aL+UA== run-tasks: false + aps-online-prefix: '00-' server: ip: 127.0.0.1 settle: diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/apskyc/ApsNoticeClientMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/apskyc/ApsNoticeClientMapper.xml index 49e4e245d..2bbbbd0f5 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/mappers/apskyc/ApsNoticeClientMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/apskyc/ApsNoticeClientMapper.xml @@ -14,6 +14,10 @@ SELECT * FROM sys_aps_notice_clients where notice_id = #{id} + + and `status` = #{clientStatus} + + ORDER BY status_time DESC + 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 0dc653a3a..3b8b093d4 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 @@ -38,6 +38,41 @@ t.tax_amount, t.surcharge_rate + + SELECT + o.order_id, + o.client_id, + o.total_amount, + o.display_amount, + o.customer_payment_amount, + o.coupon_payment_amount, + o.currency, + o.create_time, + o.confirm_time, + o.status, + o.order_description, + o.order_detail, + o.client_order_id, + o.gateway, + o.channel, + o.pay_type, + o.pre_authorization, + o.refund_amount refund_fee, + o.customer_id, + o.source, + sum(t.clearing_amount) clearing_amount, + t.refund_id, + t.transaction_time, + t.transaction_type, + t.transaction_id, + t.exchange_rate, + t.clearing_status, + t.settle_amount, + t.incremental_surcharge, + t.total_surcharge, + t.tax_amount, + t.surcharge_rate + SELECT o.order_id order_id, @@ -107,6 +142,73 @@ t.settle_amount, t.transaction_time + + SELECT + o.order_id order_id, + format(o.total_amount * 100, 0) total_fee, + format(o.customer_payment_amount * 100, 0) real_fee, + o.currency, + o.channel, + o.create_time, + o.confirm_time pay_time, + o.pre_authorization, + o.source, + o.pay_type, + CASE o.status + WHEN 0 + THEN 'SUBMITTING' + WHEN 1 + THEN 'SUBMIT_FAIL' + WHEN 2 + THEN 'WAITING_PAYMENT' + WHEN 3 + THEN 'CLOSED' + WHEN 4 + THEN 'PAYMENT_FAIL' + WHEN 5 + THEN 'SUCCESS' + WHEN 6 + THEN 'PARTIAL_REFUND' + WHEN 7 + THEN 'FULL_REFUND' + END AS `status`, + o.order_description order_body, + o.client_order_id partner_order_id, + CASE o.gateway + WHEN 0 + THEN 'Retail In-Store' + WHEN 1 + THEN 'Retail In-Store' + WHEN 2 + THEN 'QR Code' + WHEN 3 + THEN 'Online API' + WHEN 4 + THEN 'In-APP H5' + WHEN 5 + THEN 'Retail API' + WHEN 6 + THEN 'Retail API' + WHEN 7 + THEN 'QR Code' + WHEN 8 + THEN 'Mobile H5' + WHEN 9 + THEN 'Third Party Gateway' + WHEN 10 + THEN 'APP' + WHEN 12 + THEN 'MICROAPP' + WHEN 13 + THEN 'Native QR Code' + WHEN 14 + THEN 'Share Link' + END AS gateway, + format(o.refund_amount * 100, 0) refund_fee, + t.clearing_status, + t.settle_amount, + t.transaction_time + + - + ,ifnull(i.incremental_rate,0.00) as rate_value FROM pmt_orders o - INNER JOIN sys_clients p ON p.client_id=o.client_id and p.is_valid=1 - - AND p.client_id IN - - #{client_id} - - - - and (p.client_id=#{client_id} or p.parent_client_id=#{client_id}) - + LEFT JOIN pmt_transactions t on t.order_id=o.order_id and t.refund_id is null and t.transaction_type='Credit' + LEFT JOIN pmt_incremental_detail i on i.transaction_id = t.transaction_id + and o.create_time >= #{from} and o.create_time < #{to} @@ -583,6 +768,15 @@ AND o.source = #{source} + + AND o.client_id IN + + #{client_id} + + + + and o.client_id=#{client_id} + GROUP BY o.order_id diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.xml index 478df93b9..69d08bdf0 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.xml @@ -1252,7 +1252,7 @@ FROM pmt_transactions t LEFT JOIN pmt_orders o ON o.order_id = t.order_id LEFT JOIN pmt_refunds r ON r.refund_id = t.refund_id - LEFT JOIN sys_client_incremental sci on sci.client_id = t.client_id + LEFT JOIN sys_client_incremental sci on sci.client_id = t.client_id and sci.channel=o.source and sci.is_valid=1 INNER JOIN log_clearing_detail lcd ON t.clearing_order = lcd.clear_detail_id WHERE t.channel != 'Settlement' AND t.clearing_order = #{clearing_order} diff --git a/src/main/ui/static/apsKYC/aps_kyc.js b/src/main/ui/static/apsKYC/aps_kyc.js index 9f32a5102..103897614 100644 --- a/src/main/ui/static/apsKYC/aps_kyc.js +++ b/src/main/ui/static/apsKYC/aps_kyc.js @@ -14,10 +14,18 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) { app.controller('ApsKYCCtrl', ['$scope', '$http', '$uibModal', 'commonDialog', function ($scope, $http, $uibModal, commonDialog) { var that = $scope + that.status = [ + {id: -1, label: '所有'}, + {id: 0, label: '未读'}, + {id: 1, label: '已读'}, + {id: 2, label: '同意'}, + {id: 3, label: '拒绝'} + ] that.params = {}; that.noticeClients = {}; that.showClients = false that.selectIndex = -1; + that.clientStatus = -1; that.loadApsNotice = function (page) { var params = angular.copy(that.params); params.page = page || that.pagination.page || 1; @@ -40,6 +48,19 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) { }); }) }; + that.changeClientStatus = function (clientStatus, page) { + that.clientStatus = clientStatus + if (that.showClients) { + that.loadApsNoticeClients(page); + } + }; + that.download = function () { + var url = "/aps/kyc/notice/clients/excel?id=" + that.clientId + if (that.clientStatus != -1) { + url = url + "&clientStatus=" + that.clientStatus + } + return url; + } that.getNoticeClients = function (title, id, page, index) { that.selectIndex = index that.showClients = true @@ -53,6 +74,9 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) { var params = angular.copy(that.params); params.page = page || that.clientPagination.page || 1; params.id = that.clientId; + if (that.clientStatus != -1) { + params.clientStatus = that.clientStatus; + } $http.get('/aps/kyc/notice/clients', {params: params}).then(function (resp) { that.noticeClients = resp.data.data; that.clientPagination = resp.data.pagination; diff --git a/src/main/ui/static/apsKYC/templates/aps_kyc.html b/src/main/ui/static/apsKYC/templates/aps_kyc.html index f12378304..1f139cfdf 100644 --- a/src/main/ui/static/apsKYC/templates/aps_kyc.html +++ b/src/main/ui/static/apsKYC/templates/aps_kyc.html @@ -91,11 +91,23 @@