diff --git a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/EstimateAnalysisServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/EstimateAnalysisServiceImpl.java index 9521c1680..c12c98bcb 100644 --- a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/EstimateAnalysisServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/EstimateAnalysisServiceImpl.java @@ -167,42 +167,6 @@ public class EstimateAnalysisServiceImpl implements EstimateAnalysisService { dayInfo.put("t1", 0); } - List hfSettle = platformSettlementMapper.findBySettleDate(new Date(estimateAnalysisMapper.findLastCleanDays(end_date, 1).getDate("date_str").getTime()), "hf"); - if (hfSettle !=null && hfSettle.size()>0) { - for (JSONObject logs : hfSettle) { - dayInfo.put("hfSettleFee_" + logs.getString("merchants"), logs.getBigDecimal("settlement_fee")); - dayInfo.put("platformGetSettleFee",dayInfo.getBigDecimal("hfSettleFee_" + logs.getString("merchants"))); - } - }else { - dayInfo.put("platformGetSettleFee",BigDecimal.ZERO); - } - - List alipaySettleLogs = platformSettlementMapper.findBySettleDate(new Date(estimateAnalysisMapper.findLastCleanDays(end_date, 1).getDate("date_str").getTime()), "Alipay"); - for (JSONObject logs : alipaySettleLogs) { - dayInfo.put("aliSettleFee_" + logs.getString("merchants"), logs.getBigDecimal("settlement_fee")); - dayInfo.put("platformGetSettleFee",dayInfo.getBigDecimal("platformGetSettleFee").add(dayInfo.getBigDecimal("aliSettleFee_" + logs.getString("merchants")))); - } - - List alipayOnlineSettleLogs = platformSettlementMapper.findBySettleDate(new Date(estimateAnalysisMapper.findLastCleanDays(end_date, 1).getDate("date_str").getTime()), "AlipayOnline"); - logger.info(" Estimate alipayOnlineSettleLogs is :{}", alipayOnlineSettleLogs.toString()); - for (JSONObject logs : alipayOnlineSettleLogs) { - dayInfo.put("aliOnlineSettleFee_" + logs.getString("merchants"), logs.getBigDecimal("settlement_fee")); - dayInfo.put("platformGetSettleFee", dayInfo.getBigDecimal("platformGetSettleFee").add(dayInfo.getBigDecimal("aliOnlineSettleFee_" + logs.getString("merchants")))); - } - cleanDays.clear(); - - //T2 - maxDays = estimateAnalysisMapper.findLastCleanDays(end_date, 1); - end_date = maxDays.getString("date_str"); - cleanDays = estimateAnalysisMapper.findLastCleanDays(start_date, 1); - start_date = cleanDays.getString("date_str"); - JSONObject totalAmountT2 = estimateAnalysisMapper.findAllTransactionByDate(start_date, end_date, t2client); - if (totalAmountT2 != null) { - dayInfo.put("t2", totalAmountT2.getBigDecimal("total_amount")); - } else { - dayInfo.put("t2", 0); - } - List tencentSettle = platformSettlementMapper.findBySettleDate(new Date(maxDays.getDate("date_str").getTime() - 86400000L), "Wechat"); if (tencentSettle != null && tencentSettle.size()>0) { for (JSONObject logs : tencentSettle) { @@ -239,6 +203,42 @@ public class EstimateAnalysisServiceImpl implements EstimateAnalysisService { } + List hfSettle = platformSettlementMapper.findBySettleDate(new Date(estimateAnalysisMapper.findLastCleanDays(end_date, 1).getDate("date_str").getTime()), "hf"); + if (hfSettle !=null && hfSettle.size()>0) { + for (JSONObject logs : hfSettle) { + dayInfo.put("hfSettleFee_" + logs.getString("merchants"), logs.getBigDecimal("settlement_fee")); + dayInfo.put("platformGetSettleFee",dayInfo.getBigDecimal("hfSettleFee_" + logs.getString("merchants"))); + } + }else { + dayInfo.put("platformGetSettleFee",BigDecimal.ZERO); + } + + List alipaySettleLogs = platformSettlementMapper.findBySettleDate(new Date(estimateAnalysisMapper.findLastCleanDays(end_date, 1).getDate("date_str").getTime()), "Alipay"); + for (JSONObject logs : alipaySettleLogs) { + dayInfo.put("aliSettleFee_" + logs.getString("merchants"), logs.getBigDecimal("settlement_fee")); + dayInfo.put("platformGetSettleFee",dayInfo.getBigDecimal("platformGetSettleFee").add(dayInfo.getBigDecimal("aliSettleFee_" + logs.getString("merchants")))); + } + + List alipayOnlineSettleLogs = platformSettlementMapper.findBySettleDate(new Date(estimateAnalysisMapper.findLastCleanDays(end_date, 1).getDate("date_str").getTime()), "AlipayOnline"); + logger.info(" Estimate alipayOnlineSettleLogs is :{}", alipayOnlineSettleLogs.toString()); + for (JSONObject logs : alipayOnlineSettleLogs) { + dayInfo.put("aliOnlineSettleFee_" + logs.getString("merchants"), logs.getBigDecimal("settlement_fee")); + dayInfo.put("platformGetSettleFee", dayInfo.getBigDecimal("platformGetSettleFee").add(dayInfo.getBigDecimal("aliOnlineSettleFee_" + logs.getString("merchants")))); + } + cleanDays.clear(); + + //T2 + maxDays = estimateAnalysisMapper.findLastCleanDays(end_date, 1); + end_date = maxDays.getString("date_str"); + cleanDays = estimateAnalysisMapper.findLastCleanDays(start_date, 1); + start_date = cleanDays.getString("date_str"); + JSONObject totalAmountT2 = estimateAnalysisMapper.findAllTransactionByDate(start_date, end_date, t2client); + if (totalAmountT2 != null) { + dayInfo.put("t2", totalAmountT2.getBigDecimal("total_amount")); + } else { + dayInfo.put("t2", 0); + } + //T3 maxDays = estimateAnalysisMapper.findLastCleanDays(end_date, 1); end_date = maxDays.getString("date_str"); diff --git a/src/main/java/au/com/royalpay/payment/manage/customers/core/CouponValidateService.java b/src/main/java/au/com/royalpay/payment/manage/customers/core/CouponValidateService.java index 12daea020..5756026df 100644 --- a/src/main/java/au/com/royalpay/payment/manage/customers/core/CouponValidateService.java +++ b/src/main/java/au/com/royalpay/payment/manage/customers/core/CouponValidateService.java @@ -2,6 +2,8 @@ package au.com.royalpay.payment.manage.customers.core; import com.alibaba.fastjson.JSONObject; +import java.util.List; + /** * Created by yuan on 2017/10/10. */ @@ -21,4 +23,6 @@ public interface CouponValidateService { JSONObject ctripCouponInfo(String coupon_log_id,int client_id,boolean is_expiry); JSONObject ctripCouponLogNotice(String coupon_log_id,String order_id,String open_id,String status); + + JSONObject getHalloweenOrderInfo(String customerId, String transactionDate); } diff --git a/src/main/java/au/com/royalpay/payment/manage/customers/core/impls/CouponValidateServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/customers/core/impls/CouponValidateServiceImpl.java index 4de0054a5..9cc652ff0 100644 --- a/src/main/java/au/com/royalpay/payment/manage/customers/core/impls/CouponValidateServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/customers/core/impls/CouponValidateServiceImpl.java @@ -2,6 +2,8 @@ package au.com.royalpay.payment.manage.customers.core.impls; import au.com.royalpay.payment.manage.customers.core.CouponValidateService; import au.com.royalpay.payment.manage.mappers.customers.CustomerMembershipMapper; +import au.com.royalpay.payment.manage.mappers.payment.OrderMapper; +import au.com.royalpay.payment.manage.mappers.system.CustomerMapper; import au.com.royalpay.payment.manage.merchants.core.ClientManager; import au.com.royalpay.payment.tools.exceptions.BadRequestException; import au.com.royalpay.payment.tools.exceptions.NotFoundException; @@ -51,6 +53,12 @@ public class CouponValidateServiceImpl implements CouponValidateService { @Resource private ClientManager clientManager; + @Resource + private OrderMapper orderMapper; + + @Resource + private CustomerMapper customerMapper; + @Override public JSONObject getCoupon(JSONObject partner,int page,int limit) { String timestamp = System.currentTimeMillis() + ""; @@ -217,6 +225,65 @@ public class CouponValidateServiceImpl implements CouponValidateService { return null; } + @Override + public JSONObject getHalloweenOrderInfo(String customerId, String transactionDate) { + List orderList = new ArrayList<>(); + JSONObject relation = customerMapper.findCustomerBykangaId(customerId); + if (relation.containsKey("wechat_openid")) { + JSONObject param = new JSONObject(); + param.put("customer_id", relation.getString("wechat_openid")); + param.put("transaction_date", transactionDate); + param.put("status", 5); + List orderListWechat = orderMapper.listHalloweenActOrder(param); + if(orderListWechat!=null){ + orderList.addAll(orderListWechat); + } + } + if (relation.containsKey("globalpay_openid")) { + JSONObject param = new JSONObject(); + param.put("customer_id", relation.getString("globalpay_openid")); + param.put("transaction_date", transactionDate); + param.put("status", 5); + List orderListGlobal = orderMapper.listHalloweenActOrder(param); + if(orderListGlobal!=null){ + orderList.addAll(orderListGlobal); + } + } + // 获取万圣节活动当天支付成功的订单 + JSONObject result = null; + if (orderList != null && orderList.size() > 0) { + result = new JSONObject(); + result.put("orderList", orderList); + for (JSONObject order : orderList) { + String redpackOpenId = getRedpackId(order); + if (redpackOpenId != null) { + result.put("redpackOpenId", redpackOpenId); + break; + } + } + } + return result; + } + + // 获取该笔订单的redpackOpenId + // TODO: 2018/10/28 有待商榷 + private String getRedpackId(JSONObject order) { + String redpackOpenId = null; + String channel = order.getString("channel"); + if ("Wechat".equals(channel)) { + JSONObject customerRelation = customerMapper.findCustomerByOpenId(order.getString("customer_id")); + if (customerRelation == null) { + customerRelation = customerMapper.findCustomerGlobalpayByOpenId(order.getString("customer_id")); + } else { + redpackOpenId = customerRelation.getString("redpack_openid"); + if (customerRelation.getString("kanga_openid") == null) { + redpackOpenId = null; + } + } + } + return redpackOpenId; + } + private String signUrl(UriComponentsBuilder uriComponentsBuilder) { String timestamp = System.currentTimeMillis() + ""; String base = CUSTOMER_APP_ID + timestamp + CUSTOMER_AUTH_CODE; diff --git a/src/main/java/au/com/royalpay/payment/manage/customers/core/impls/CustomerHalloweenCountServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/customers/core/impls/CustomerHalloweenCountServiceImpl.java new file mode 100644 index 000000000..00c44643a --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/customers/core/impls/CustomerHalloweenCountServiceImpl.java @@ -0,0 +1,105 @@ +package au.com.royalpay.payment.manage.customers.core.impls; + +import au.com.royalpay.payment.core.events.AfterPaymentFinishEvent; +import au.com.royalpay.payment.manage.mappers.system.CustomerMapper; +import cn.yixblog.platform.http.HttpRequestGenerator; +import cn.yixblog.platform.http.HttpRequestResult; +import com.alibaba.fastjson.JSONObject; +import org.apache.commons.codec.digest.DigestUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.ApplicationListener; +import org.springframework.stereotype.Service; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.util.UriComponentsBuilder; + +import javax.annotation.Resource; +import java.math.BigDecimal; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; + +@Service +public class CustomerHalloweenCountServiceImpl implements ApplicationListener { + private Logger logger = LoggerFactory.getLogger(getClass()); + + @Value("${app.customer.host}") + private String CUSTOMER_HOST; + + @Value("${customer.app.appid}") + private String CUSTOMER_APP_ID; + + @Value("${customer.app.auth-code}") + private String CUSTOMER_AUTH_CODE; + + @Resource + private CustomerMapper customerMapper; + + @Override + public void onApplicationEvent(AfterPaymentFinishEvent event) { + final JSONObject order = event.getFinishedEvent().getOrder(); + //判断是否是pine测试商户,若不是则判断是否在活动时间 + if (order.getIntValue("client_id") != 9) { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); + Date newDay = new Date(); + try { + if (newDay.compareTo(sdf.parse("2018-10-31 00:00:00")) < 0) { + return; + } + if (newDay.compareTo(sdf.parse("2018-11-02 00:00:00")) > 0) { + return; + } + } catch (ParseException e) { + + } + } + BigDecimal clearAmount = event.getFinishedEvent().getAudFee(); + String channel = order.getString("channel"); + if ("Wechat".equals(channel)) { + JSONObject customerRelation = customerMapper.findCustomerByOpenId(order.getString("customer_id")); + if (customerRelation == null) { + customerRelation = customerMapper.findCustomerGlobalpayByOpenId(order.getString("customer_id")); + } + if (customerRelation.getString("kanga_openid") == null) { + return; + } + afterPaymentAddHalloweenCount(customerRelation.getString("kanga_openid"), order.getString("order_id"), customerRelation.getString("redpack_openid"),channel, clearAmount); + } + if ("Alipay".equals(channel)) { + afterPaymentAddHalloweenCount(order.getString("customer_id"), order.getString("order_id"), "alipay",channel, clearAmount); + } + } + + private void afterPaymentAddHalloweenCount(String id, String orderId,String redPackId, String channel, BigDecimal clearAmount) { + String timestamp = System.currentTimeMillis() + ""; + String base = CUSTOMER_APP_ID + timestamp + CUSTOMER_AUTH_CODE; + String sign = DigestUtils.sha256Hex(base).toLowerCase(); + String uri = UriComponentsBuilder.fromHttpUrl(CUSTOMER_HOST + "activity/halloween/payment/orders") + .queryParam("appid", CUSTOMER_APP_ID) + .queryParam("timestamp", timestamp) + .queryParam("sign", sign) + .queryParam("id", id) + .queryParam("orderId", orderId) + .queryParam("channel", channel) + .queryParam("amount", clearAmount) + .queryParam("redpackId", redPackId) + .toUriString(); + if(clearAmount.compareTo(new BigDecimal("1.99"))<0){ + return; + } + HttpRequestGenerator gen = new HttpRequestGenerator(uri, RequestMethod.POST); + try { + HttpRequestResult result = gen.execute(); + if (result.isSuccess()) { + int statusCode = result.getStatusCode(); + if (statusCode == 200) { + logger.info("万圣节活动次数添加成功"); + } + } + + } catch (Exception ignored) { + ignored.printStackTrace(); + } + } +} diff --git a/src/main/java/au/com/royalpay/payment/manage/customers/web/CouponValidateController.java b/src/main/java/au/com/royalpay/payment/manage/customers/web/CouponValidateController.java index d4eeece61..5c46782d9 100644 --- a/src/main/java/au/com/royalpay/payment/manage/customers/web/CouponValidateController.java +++ b/src/main/java/au/com/royalpay/payment/manage/customers/web/CouponValidateController.java @@ -10,6 +10,7 @@ import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; +import java.util.List; /** * Created by yuan on 2017/10/10. @@ -40,4 +41,17 @@ public class CouponValidateController { throw new BadRequestException("卡券核销失败"); } } + + /** + * 万圣节活动当天订单信息 + * @param customerId + * @param actDate + * @return + */ + @GetMapping(value = "/payment/halloween") + @ResponseBody + public JSONObject getHalloweenActOrderInfo(@RequestParam("customer_id") String customerId, + @RequestParam("act_date") String actDate) { + return couponVerificationService.getHalloweenOrderInfo(customerId, actDate); + } } diff --git a/src/main/java/au/com/royalpay/payment/manage/dev/core/impl/ManualServiceimpl.java b/src/main/java/au/com/royalpay/payment/manage/dev/core/impl/ManualServiceimpl.java index f40ad5a7e..c5f08f985 100644 --- a/src/main/java/au/com/royalpay/payment/manage/dev/core/impl/ManualServiceimpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/dev/core/impl/ManualServiceimpl.java @@ -103,9 +103,9 @@ public class ManualServiceimpl implements ManualService { record.put("manager_name", "System"); record.put("remark", "费率到期系统自动延期1年"); clientRateMapper.saveRate(record); -// if ("Rpay".equals(o.getString("rate_name"))) { -// rpayApi.modifySurchargeConfig(clientMapper.findClient(client_id)); -// } + if ("Rpay".equals(o.getString("rate_name"))) { + rpayApi.modifySurchargeConfig(clientMapper.findClient(client_id)); + } }); clientModifySupport.processClientConfigModify(new SwitchPermissionModify(null, client_moniker, "tax_in_surcharge", false)); diff --git a/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/impl/CleanServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/impl/CleanServiceImpl.java index 5c3cbaea3..e4e9e4e11 100644 --- a/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/impl/CleanServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/impl/CleanServiceImpl.java @@ -515,7 +515,7 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider if (settle.getBigDecimal("clearing_amount").compareTo(BigDecimal.ZERO) == 0) { continue; } - aba.addSettleMerchant(settle.getString("bsb_no"), settle.getString("account_no"), settle.getString("account_name"), + aba.addSettleMerchant(settle.getString("client_moniker"), settle.getString("bsb_no"), settle.getString("account_no"), settle.getString("account_name"), settle.getBigDecimal("clearing_amount")); } return aba; @@ -1016,7 +1016,7 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider // String mailId = mailService.sendEmail(title, "164851225@qq.com", "1029811920@qq.com", content, // attachList); JSONObject config = sysConfigManager.getSysConfig(); - String mailId = mailService.sendEmail(title, config.getString("settle_mail_to"),config.getString("settle_mail_cc"), content, attachList); + String mailId = mailService.sendEmail(title, config.getString("settle_mail_to"), config.getString("settle_mail_cc"), content, attachList); if (settleMail == null) { JSONObject settleMailRecord = new JSONObject(); diff --git a/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/beans/FuncInfo.java b/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/beans/FuncInfo.java index 29c221991..63d881c92 100644 --- a/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/beans/FuncInfo.java +++ b/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/beans/FuncInfo.java @@ -1,5 +1,7 @@ package au.com.royalpay.payment.manage.management.sysconfig.beans; +import au.com.royalpay.payment.tools.permission.enums.ManagerRole; +import com.alibaba.fastjson.JSONObject; import org.apache.commons.lang3.StringUtils; /** @@ -8,6 +10,21 @@ import org.apache.commons.lang3.StringUtils; public class FuncInfo { private String name; private String remark; + private boolean admin; + private boolean operator; + private boolean bd; + private boolean finacial; + private boolean servant; + private boolean accountmanager; + private boolean director; + private boolean sitemanager; + private boolean developer; + private boolean bdleader; + private boolean riskmanager; + private boolean guest; + private boolean orgmanager; + private boolean salesmanager; + private boolean datacontent; public String getName() { return StringUtils.isEmpty(name) ? null : name; @@ -24,4 +41,179 @@ public class FuncInfo { public void setRemark(String remark) { this.remark = remark; } + + public void setSalesmanager(boolean salesmanager) { + this.salesmanager = salesmanager; + } + + public boolean isAdmin() { + return admin; + } + + public boolean isBd() { + return bd; + } + + public boolean isFinacial() { + return finacial; + } + + public boolean isAccountmanager() { + return accountmanager; + } + + public boolean isOperator() { + return operator; + } + + public boolean isDeveloper() { + return developer; + } + + public boolean isDirector() { + return director; + } + + public boolean isServant() { + return servant; + } + + public void setAccountmanager(boolean accountmanager) { + this.accountmanager = accountmanager; + } + + public boolean isBdleader() { + return bdleader; + } + + public boolean isSitemanager() { + return sitemanager; + } + + public void setAdmin(boolean admin) { + this.admin = admin; + } + + public void setBd(boolean bd) { + this.bd = bd; + } + + public boolean isGuest() { + return guest; + } + + public void setDeveloper(boolean developer) { + this.developer = developer; + } + + public boolean isRiskmanager() { + return riskmanager; + } + + public void setDirector(boolean director) { + this.director = director; + } + + public void setBdleader(boolean bdleader) { + this.bdleader = bdleader; + } + + public void setFinacial(boolean finacial) { + this.finacial = finacial; + } + + public void setOperator(boolean operator) { + this.operator = operator; + } + + public void setServant(boolean servant) { + this.servant = servant; + } + + public void setGuest(boolean guest) { + this.guest = guest; + } + + public void setRiskmanager(boolean riskmanager) { + this.riskmanager = riskmanager; + } + + public void setSitemanager(boolean sitemanager) { + this.sitemanager = sitemanager; + } + + public void setDatacontent(boolean datacontent) { + this.datacontent = datacontent; + } + + public boolean isSalesmanager() { + return salesmanager; + } + + public boolean isOrgmanager() { + return orgmanager; + } + + public boolean isDatacontent() { + return datacontent; + } + + public void setOrgmanager(boolean orgmanager) { + this.orgmanager = orgmanager; + } + + + public JSONObject initObject(JSONObject mod) { + mod.put("name", getName()); + mod.put("remark", getRemark()); + int role = 0; + if (admin) { + role |= ManagerRole.ADMIN.getMask(); + } + if (operator) { + role |= ManagerRole.OPERATOR.getMask(); + } + if (sitemanager) { + role |= ManagerRole.SITE_MANAGER.getMask(); + } + if (bd) { + role |= ManagerRole.BD_USER.getMask(); + } + if (finacial) { + role |= ManagerRole.FINANCIAL_STAFF.getMask(); + } + if (servant) { + role |= ManagerRole.SERVANT.getMask(); + } + if (accountmanager) { + role |= ManagerRole.ACCOUNT_MANAGER.getMask(); + } + if (director) { + role |= ManagerRole.DIRECTOR.getMask(); + } + if (developer) { + role |= ManagerRole.DEVELOPER.getMask(); + } + if (bdleader){ + role |= ManagerRole.BD_LEADER.getMask(); + } + if (riskmanager){ + role |= ManagerRole.RISK_MANAGER.getMask(); + } + if (guest){ + role |= ManagerRole.GUEST.getMask(); + } + if (orgmanager){ + role |= ManagerRole.ORG_MANAGER.getMask(); + } + if (salesmanager) { + role |= ManagerRole.SALES_MANAGER.getMask(); + } + if (datacontent) { + role |= ManagerRole.DATA_CONTENT.getMask(); + } + mod.put("role", role); + return mod; + } + } diff --git a/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/core/impls/PermissionManagerImpl.java b/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/core/impls/PermissionManagerImpl.java index 2b2710c5d..821f9f5e9 100644 --- a/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/core/impls/PermissionManagerImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/core/impls/PermissionManagerImpl.java @@ -68,6 +68,23 @@ public class PermissionManagerImpl implements PermissionManager { Map> moduleMap = new TreeMap<>(); List noModule = new ArrayList<>(); for (JSONObject func : funcs) { + int role = func.getIntValue("role"); + func.put("admin", ManagerRole.ADMIN.hasRole(role)); + func.put("operator", ManagerRole.OPERATOR.hasRole(role)); + func.put("bd", ManagerRole.BD_USER.hasRole(role)); + func.put("finacial", ManagerRole.FINANCIAL_STAFF.hasRole(role)); + func.put("servant", ManagerRole.SERVANT.hasRole(role)); +// func.put("accountmanager", ManagerRole.ACCOUNT_MANAGER.hasRole(role)); + func.put("director", ManagerRole.DIRECTOR.hasRole(role)); + func.put("sitemanager", ManagerRole.SITE_MANAGER.hasRole(role)); + func.put("developer", ManagerRole.DEVELOPER.hasRole(role)); + func.put("bdleader", ManagerRole.BD_LEADER.hasRole(role)); + func.put("riskmanager", ManagerRole.RISK_MANAGER.hasRole(role)); + func.put("guest", ManagerRole.GUEST.hasRole(role)); +// manager.put("orgmanager", ManagerRole.ORG_MANAGER.hasRole(role)); + func.put("salesmanager", ManagerRole.SALES_MANAGER.hasRole(role)); +// manager.put("datacontent", ManagerRole.DATA_CONTENT.hasRole(role)); + String module = func.getString("module"); if (module == null) { noModule.add(func); @@ -128,9 +145,7 @@ public class PermissionManagerImpl implements PermissionManager { public void updateFuncInfo(String funcId, FuncInfo funcInfo) { JSONObject update = new JSONObject(); update.put("func_id", funcId); - update.put("name", funcInfo.getName()); - update.put("remark", funcInfo.getRemark()); - permissionFunctionMapper.update(update); + permissionFunctionMapper.update(funcInfo.initObject(update)); } @Override 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 7c351ef10..cb0a76396 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 @@ -79,4 +79,8 @@ public interface OrderMapper { List listAnalysisClientCustomer(JSONObject params); PageList listTransactionsForApp(JSONObject params, PageBounds pageBounds); + + JSONObject findOrderById(@Param("order_id") String orderId); + + List listHalloweenActOrder(JSONObject param); } 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 a1b6d4cb9..4ade2bd6a 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 @@ -38,6 +38,8 @@ public interface ClientMapper { PageList listPartners(JSONObject params, PageBounds pagination); + PageList comListPartners(JSONObject params, PageBounds pagination); + List listClientsIdAndMoniker(); diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientRateMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientRateMapper.java index b9e5ed634..3f245f99a 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientRateMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientRateMapper.java @@ -46,6 +46,10 @@ public interface ClientRateMapper { List getAllExpiry(@Param("expiry_date")Date expiry_date); + List getAllClientRateExpiryMerchants(); + + void postponeMerchantRateByClientId(int clientId); + JSONObject latestChannelCleanDays(@Param("rate_name")String rate_name, @Param("client_id")int client_id); JSONObject latestExpiryConfig(@Param("client_id")int client_id,@Param("rate_name") String rate_name); diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/system/CustomerMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/system/CustomerMapper.java index cfcc331b0..de8658aaf 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/system/CustomerMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/system/CustomerMapper.java @@ -28,4 +28,7 @@ public interface CustomerMapper { @AutoSql(type = SqlType.SELECT) @AdvanceSelect(addonWhereClause = "wechat_openid like 'o32%'") JSONObject findCustomerBykangaOpenid(@Param("kanga_openid") String openId); + + @AutoSql(type = SqlType.SELECT) + JSONObject findCustomerBykangaId(@Param("kanga_openid") String openId); } diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java index 8bcca2a11..f19d10018 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/ClientManager.java @@ -342,4 +342,13 @@ public interface ClientManager { void updateAllPartnerPassword(String clientMoniker, List emails); void postponeClientRate(Date now, Date yearTomorrow, String expireDate, JSONObject client); + + /** + * 根据商户之前的费率自动延期一年 + * + * @param clientId + */ + boolean postponeClientRate(int clientId, String clientMoniker,String nextYearExipryDate); + + JSONObject comListPartnerSelection(JSONObject manager, PartnerQuery query); } 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 120dc8340..0520f541e 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 @@ -387,7 +387,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid client.put("contact_email", "******"); } } else { - client.put("rate_editable", ManagerRole.ADMIN.hasRole(role) || ManagerRole.OPERATOR.hasRole(role)); + client.put("rate_editable",ManagerRole.OPERATOR.hasRole(role)); } } List children = clientMapper.listChildClients(client.getIntValue("client_id")); @@ -1600,7 +1600,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid configNewClientRate(config, clientId, "hf", "hf_rate_value", org, "min_hf_rate"); configNewClientRate(config, clientId, "Rpay", "Rpay_rate_value", org, "min_Rpay_rate"); //todo 暂不更新Rpay+ 费率信息 -// rpayApi.modifySurchargeConfig(client); + rpayApi.modifySurchargeConfig(client); } @@ -1644,9 +1644,9 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid configJson.put("manager_name", manager.getString("username")); configJson.put("update_time", new Date()); clientRateMapper.updateConfig(configJson); -// if ("Rpay".equals(configJson.getString("rate_name"))) { -// rpayApi.modifySurchargeConfig(client); -// } + if ("Rpay".equals(configJson.getString("rate_name"))) { + rpayApi.modifySurchargeConfig(client); + } int clientId = client.getIntValue("client_id"); JSONObject changeRate = merchantInfoProvider.clientCurrentRate(clientId, new Date(), "Wechat"); int cleanDays = changeRate.getIntValue("clean_days"); @@ -3193,7 +3193,9 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } clientModifySupport.processClientConfigModify(new SwitchPermissionModify(account, clientMoniker, "skip_clearing", skip_clearing)); client.put("skip_clearing", skip_clearing); - rpayApi.switchMerchantSettle(client); + if (client.getString("rpay_enterprise_id") != null) { + rpayApi.switchMerchantSettle(client); + } } @Override @@ -4018,7 +4020,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid record.put("remark", "费率到期系统自动延期1年"); clientRateMapper.saveRate(record); if ("Rpay".equals(o.getString("rate_name"))) { - //rpayApi.modifySurchargeConfig(clientMapper.findClient(client_id)); + rpayApi.modifySurchargeConfig(clientMapper.findClient(client_id)); } } clientModifySupport.processClientConfigModify(new SwitchPermissionModify(null, client.getString("client_moniker"), "tax_in_surcharge", false)); @@ -4027,6 +4029,50 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid }); } + @Override + @Transactional + public boolean postponeClientRate(int clientId, String clientMoniker, String nextYearExipryDate) { + try { + clientRateMapper.postponeMerchantRateByClientId(clientId); + clientModifySupport.processClientConfigModify(new SwitchPermissionModify(null, clientMoniker, "tax_in_surcharge", false)); + List adminAccounts = clientAccountMapper.listAdminAccounts(clientId); + adminAccounts.forEach(o -> { + sendClientPostponeNotify(o, nextYearExipryDate); + }); + logger.error("[{}]费率自动延期成功", clientMoniker); + return true; + } catch (Exception e) { + logger.error("[{}]费率自动延期失败", clientMoniker); + return false; + } + } + + @Override + public JSONObject comListPartnerSelection(JSONObject manager, PartnerQuery query) { + JSONObject params = query.toJsonParam(); + String tempSubMchId = sysConfigManager.getSysConfig().getString("temp_sub_mch_id"); + String tempSubMchSource = sysConfigManager.getSysConfig().getString("temp_sub_mch_id_source"); + tempSubMchSource = tempSubMchSource == null ? "" : tempSubMchSource; + if (query.isTempMchId()) { + params.put("temp_mch_id", tempSubMchId); + params.put("temp_mch_id_source", tempSubMchSource); + } + PageList partners = clientMapper.comListPartners(params, + new PageBounds(query.getPage(), query.getLimit(), Order.formString("is_valid.desc,-approve_time.asc,create_time.desc"))); + int authDays = PlatformEnvironment.getEnv().authDays();// 快速自助开通申请有效期 + for (JSONObject partner : partners) { + String subMerchantId = partner.getString("sub_merchant_id"); + if (subMerchantId != null && tempSubMchId != null && tempSubMchId.contains(subMerchantId) + && !tempSubMchSource.contains(partner.getString("client_moniker"))) { + partner.put("temp_sub_merchant", true); + } + if (partner.getIntValue("approve_result") == 2) { + partner.put("expiry_time", DateUtils.addDays(partner.getDate("approve_time"), authDays)); + partner.put("pass_timeout", DateUtils.addDays(partner.getDate("approve_time"), authDays).compareTo(new Date()) < 0); + } + } + return PageListUtils.buildPageListResult(partners); + } private TemplateMessage initClientMessage(JSONObject client, String newExpiryDate, String wechatOpenid, String templateId) { diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java b/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java index 76edb9f5c..52d4c1681 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/web/PartnerManageController.java @@ -585,4 +585,10 @@ public class PartnerManageController { clientManager.subRpayMerchantApplication(clientMoniker, merchantInfo,manager); } + @RequestMapping(value = "/compliance", method = RequestMethod.GET) + @RequireManager(role = { ManagerRole.OPERATOR}) + public JSONObject lisPartnersByCompliance(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, PartnerQuery query) { + return clientManager.comListPartnerSelection(manager, query); + } + } diff --git a/src/main/java/au/com/royalpay/payment/manage/signin/beans/ManagerInfo.java b/src/main/java/au/com/royalpay/payment/manage/signin/beans/ManagerInfo.java index 752a8aedc..fafd02ee3 100644 --- a/src/main/java/au/com/royalpay/payment/manage/signin/beans/ManagerInfo.java +++ b/src/main/java/au/com/royalpay/payment/manage/signin/beans/ManagerInfo.java @@ -38,6 +38,8 @@ public class ManagerInfo { private boolean riskmanager; private boolean guest; private boolean orgmanager; + private boolean salesmanager; + private boolean datacontent; @JSONField(name = "org_id") private Integer orgId; @@ -105,6 +107,12 @@ public class ManagerInfo { if (orgmanager){ role |= ManagerRole.ORG_MANAGER.getMask(); } + if (salesmanager) { + role |= ManagerRole.SALES_MANAGER.getMask(); + } + if (datacontent) { + role |= ManagerRole.DATA_CONTENT.getMask(); + } account.put("role", role); if (insert) { account.put("username", getUsername()); @@ -273,4 +281,19 @@ public class ManagerInfo { this.orgmanager = orgmanager; } + public boolean isDatacontent() { + return datacontent; + } + + public boolean isSalesmanager() { + return salesmanager; + } + + public void setDatacontent(boolean datacontent) { + this.datacontent = datacontent; + } + + public void setSalesmanager(boolean salesmanager) { + this.salesmanager = salesmanager; + } } diff --git a/src/main/java/au/com/royalpay/payment/manage/signin/beans/QueryManagerBean.java b/src/main/java/au/com/royalpay/payment/manage/signin/beans/QueryManagerBean.java index da4529722..c9132aca2 100644 --- a/src/main/java/au/com/royalpay/payment/manage/signin/beans/QueryManagerBean.java +++ b/src/main/java/au/com/royalpay/payment/manage/signin/beans/QueryManagerBean.java @@ -41,9 +41,9 @@ public class QueryManagerBean { if(role.equals("10000")){ mask = ManagerRole.SERVANT.getMask(); } - if(role.equals("100000")){ - mask = ManagerRole.ACCOUNT_MANAGER.getMask(); - } +// if(role.equals("100000")){ +// mask = ManagerRole.ACCOUNT_MANAGER.getMask(); +// } if(role.equals("1000000")){ mask = ManagerRole.DIRECTOR.getMask(); } @@ -62,9 +62,15 @@ public class QueryManagerBean { if(role.equals("100000000000")){ mask = ManagerRole.GUEST.getMask(); } - if(role.equals("1000000000000")){ - mask = ManagerRole.ORG_MANAGER.getMask(); +// if(role.equals("1000000000000")){ +// mask = ManagerRole.ORG_MANAGER.getMask(); +// } + if(role.equals("10000000000000")){ + mask = ManagerRole.SALES_MANAGER.getMask(); } +// if(role.equals("100000000000000")){ +// mask = ManagerRole.DATA_CONTENT.getMask(); +// } if(mask != 0){ params.put("mask",mask); } diff --git a/src/main/java/au/com/royalpay/payment/manage/signin/core/SignInAccountService.java b/src/main/java/au/com/royalpay/payment/manage/signin/core/SignInAccountService.java index 0cdaa4683..e9b82b21e 100644 --- a/src/main/java/au/com/royalpay/payment/manage/signin/core/SignInAccountService.java +++ b/src/main/java/au/com/royalpay/payment/manage/signin/core/SignInAccountService.java @@ -11,6 +11,8 @@ public interface SignInAccountService { JSONObject getManager(String accountId); + void clearManager(String accountId); + JSONObject getClient(String accountId); void clearAccountCache(String accountId); diff --git a/src/main/java/au/com/royalpay/payment/manage/signin/core/impls/ManagerAccountServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/signin/core/impls/ManagerAccountServiceImpl.java index 0d58548cc..078087413 100644 --- a/src/main/java/au/com/royalpay/payment/manage/signin/core/impls/ManagerAccountServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/signin/core/impls/ManagerAccountServiceImpl.java @@ -6,6 +6,7 @@ import au.com.royalpay.payment.manage.mappers.system.OrgMapper; import au.com.royalpay.payment.manage.organizations.core.OrgManager; import au.com.royalpay.payment.manage.signin.beans.ManagerInfo; import au.com.royalpay.payment.manage.signin.core.ManagerAccountsService; +import au.com.royalpay.payment.manage.signin.core.SignInAccountService; import au.com.royalpay.payment.tools.exceptions.BadRequestException; import au.com.royalpay.payment.tools.exceptions.NotFoundException; import au.com.royalpay.payment.tools.permission.enums.ManagerRole; @@ -37,6 +38,8 @@ public class ManagerAccountServiceImpl implements ManagerAccountsService { @Resource private OrgManager orgManager; + @Resource + private SignInAccountService signInAccountService; @Override public PageList listManagers(JSONObject loginManager,JSONObject params) { @@ -52,14 +55,17 @@ public class ManagerAccountServiceImpl implements ManagerAccountsService { manager.put("bd", ManagerRole.BD_USER.hasRole(role)); manager.put("finacial", ManagerRole.FINANCIAL_STAFF.hasRole(role)); manager.put("servant", ManagerRole.SERVANT.hasRole(role)); - manager.put("accountmanager", ManagerRole.ACCOUNT_MANAGER.hasRole(role)); +// manager.put("accountmanager", ManagerRole.ACCOUNT_MANAGER.hasRole(role)); manager.put("director", ManagerRole.DIRECTOR.hasRole(role)); manager.put("sitemanager", ManagerRole.SITE_MANAGER.hasRole(role)); manager.put("developer", ManagerRole.DEVELOPER.hasRole(role)); manager.put("bdleader", ManagerRole.BD_LEADER.hasRole(role)); manager.put("riskmanager", ManagerRole.RISK_MANAGER.hasRole(role)); manager.put("guest", ManagerRole.GUEST.hasRole(role)); - manager.put("orgmanager", ManagerRole.ORG_MANAGER.hasRole(role)); +// manager.put("orgmanager", ManagerRole.ORG_MANAGER.hasRole(role)); + manager.put("salesmanager", ManagerRole.SALES_MANAGER.hasRole(role)); +// manager.put("datacontent", ManagerRole.DATA_CONTENT.hasRole(role)); + } return managers; } @@ -102,6 +108,7 @@ public class ManagerAccountServiceImpl implements ManagerAccountsService { } obj.put("manager_id", userId); managerMapper.update(obj); + signInAccountService.clearManager(userId); } @Override diff --git a/src/main/java/au/com/royalpay/payment/manage/signin/core/impls/SignInAccountServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/signin/core/impls/SignInAccountServiceImpl.java index 661e0b650..5b790db1c 100644 --- a/src/main/java/au/com/royalpay/payment/manage/signin/core/impls/SignInAccountServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/signin/core/impls/SignInAccountServiceImpl.java @@ -120,11 +120,21 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati manager.put("module_names", modules.keySet()); if((manager.getIntValue("role")& ManagerRole.SERVANT.getMask())>0){ JSONObject cs = sysCustomerServiceMapper.findByManagerId(accountId); - manager.put("onoff",cs.getBoolean("onoff")); + if (cs != null) { + manager.put("onoff", cs.getBoolean("onoff")); + } else { + manager.put("onoff", false); + } } return manager; } + @Override + @CacheEvict(value = ":login:managers:", key = "''+#accountId") + public void clearManager(String accountId) { + + } + @Override @Cacheable(value = ":login:clients:", key = "''+#accountId") public JSONObject getClient(String accountId) { diff --git a/src/main/java/au/com/royalpay/payment/manage/support/abafile/ABAFile.java b/src/main/java/au/com/royalpay/payment/manage/support/abafile/ABAFile.java index 24ccab615..5e893936b 100644 --- a/src/main/java/au/com/royalpay/payment/manage/support/abafile/ABAFile.java +++ b/src/main/java/au/com/royalpay/payment/manage/support/abafile/ABAFile.java @@ -29,8 +29,8 @@ public class ABAFile { totalSettleAmount = BigDecimal.ZERO; } - public void addSettleMerchant(String bsbNo, String accountNo, String accountName, BigDecimal settleAmount) { - settlements.add(new SettleMerchantInfo(bsbNo, accountNo, accountName, settleAmount)); + public void addSettleMerchant(String clientMoniker, String bsbNo, String accountNo, String accountName, BigDecimal settleAmount) { + settlements.add(new SettleMerchantInfo(clientMoniker, bsbNo, accountNo, accountName, settleAmount)); totalSettleAmount = totalSettleAmount.add(settleAmount); } @@ -129,12 +129,14 @@ public class ABAFile { } private class SettleMerchantInfo { + private final String clientMoniker; private final String bsbNo; private final String accountNo; private final String accountName; private final BigDecimal settleAmount; - public SettleMerchantInfo(String bsbNo, String accountNo, String accountName, BigDecimal settleAmount) { + public SettleMerchantInfo(String clientMoniker, String bsbNo, String accountNo, String accountName, BigDecimal settleAmount) { + this.clientMoniker = clientMoniker; this.bsbNo = bsbNo; this.accountNo = accountNo.replaceAll("\\D", ""); this.accountName = accountName; @@ -149,7 +151,7 @@ public class ABAFile { lineBuilder.replace(18, 20, "50"); lineBuilder.replace(20, 30, getSettleAmount()); lineBuilder.replace(30, 62, getAccountName()); - lineBuilder.replace(62, 80, StringUtils.rightPad("RoyalPay" + DateFormatUtils.format(settleDate, "yyyyMMdd"), 18)); + lineBuilder.replace(62, 80, StringUtils.rightPad("RoyalPay" + DateFormatUtils.format(settleDate, "MMdd") + clientMoniker, 18)); lineBuilder.replace(80, 87, bsbNo(base.getBsb())); lineBuilder.replace(87, 96, StringUtils.leftPad(base.getAccountNo(), 9)); lineBuilder.replace(96, 112, StringUtils.left(StringUtils.rightPad(base.getAccountName(), 16), 16)); diff --git a/src/main/java/au/com/royalpay/payment/manage/task/PostponeClientTask.java b/src/main/java/au/com/royalpay/payment/manage/task/PostponeClientTask.java index c03a84d31..78bf834d3 100644 --- a/src/main/java/au/com/royalpay/payment/manage/task/PostponeClientTask.java +++ b/src/main/java/au/com/royalpay/payment/manage/task/PostponeClientTask.java @@ -69,6 +69,23 @@ public class PostponeClientTask { }); } + @Scheduled(cron = "0 30 6 * * ?") + private void postponeMerchantRate() { + synchronizedScheduler.executeProcess("manage_task:postponeMerchantRate", 120_000, () -> { + String nextYearExipryDate = DateFormatUtils.format(DateUtils.addYears(new Date(), 1), "yyyy-MM-dd"); + List expiryRateMerchants = clientRateMapper.getAllClientRateExpiryMerchants(); + StringBuilder merchantStrBuilder = new StringBuilder(); + expiryRateMerchants.forEach(merchant -> { + if (clientManager.postponeClientRate(merchant.getIntValue("client_id"), merchant.getString("client_moniker"),nextYearExipryDate)) { + merchantStrBuilder.append(merchant.getString("client_moniker")).append("、"); + } + }); + merchantStrBuilder.deleteCharAt(merchantStrBuilder.length() - 1); + sendComplianceNotify(merchantStrBuilder, nextYearExipryDate); + }); + } + + private void sendComplianceNotify(StringBuilder sb, String newExpireDate) { List compliance = managerMapper.listOpenIdsOfCompliances(); compliance.forEach(p -> { @@ -76,8 +93,8 @@ public class PostponeClientTask { TemplateMessage notice = initComplianceMessage(sb.toString(), newExpireDate, p, api.getTemplateId("client-postpone")); api.sendTemplateMessage(notice); }); - } + private TemplateMessage initComplianceMessage(String clients, String newExpiryDate, String wechatOpenid, String templateId) { TemplateMessage notice = new TemplateMessage(wechatOpenid, templateId, null); notice.put("first", "以下商户据合同费率已经自动延期1年", "#ff0000"); 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 aa9b9984c..6e57d28d5 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 @@ -483,7 +483,9 @@ public class TradeLogServiceImpl implements TradeLogService { logs.stream().forEach(p -> { String login_id = p.getString("login_id"); if (StringUtils.isNotEmpty(login_id)) { - p.put("order_detail", (StringUtils.isEmpty(p.getString("order_detail")) ? "" : p.getString("order_detail")) + "(alipay_id:" + login_id + ")"); + p.put("order_detail", (StringUtils.isEmpty(p.getString("order_detail")) ? "" : login_id+":"+p.getString("order_detail"))); + }else{ + p.put("order_detail", (StringUtils.isEmpty(p.getString("order_detail")) ? "" : p.getString("order_detail"))); } }); } 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 2b0482c19..de0da503a 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 @@ -698,9 +698,9 @@ o.refund_amount refund_fee, o.customer_id, o.order_detail, - CASE o.channel WHEN 'Rpay' THEN o.customer_payment_amount ELSE t.clearing_amount END clearing_amount, + t.clearing_amount, t.refund_id, - CASE o.channel WHEN 'Rpay' THEN t.create_time ELSE t.transaction_time END transaction_time, + IFNULL(t.create_time,t.transaction_time) transaction_time, t.transaction_type, t.transaction_id, t.exchange_rate, @@ -738,5 +738,24 @@ and t.clearing_status=#{clearing_status} - - \ No newline at end of file + + 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 7886a2c6a..055d985b9 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 @@ -64,6 +64,36 @@ WHEN 2 THEN 'Preauthorised' END) clear_status, o.order_detail,o.display_amount,o.channel,o.currency,o.pre_authorization, + 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 'WeChat HTML5' + 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, CASE o.channel WHEN 'Alipay' THEN ra.login_id WHEN 'AlipayOnline' THEN ra.login_email @@ -926,4 +956,4 @@ select sum(if(temp.transaction_type='Credit',temp.clearing_amount*d.proportion, order by period_start - \ 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 815348b9d..f6e605d94 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 @@ -101,6 +101,75 @@ and c.suburb like #{suburb_pattern} + + + and c.state=#{state} + + + and c.merchant_id=#{merchant_id} + + + and locate(c.sub_merchant_id,#{temp_mch_id})>0 and cc.skip_clearing=0 and + locate(c.client_moniker,#{temp_mch_id_source})<=0 + + + + + and ((c.source=1 or c.source=2) and c.approve_result=2 and (c.open_status is null or c.open_status=3)) + + + + + + + + and (c.client_moniker=#{search_text} or c.short_name like #{name_pattern} or c.company_name like + #{name_pattern} or c.business_name like #{name_pattern} or c.remark like + #{name_pattern} or c.contact_email=#{search_text}) + + + and c.client_moniker=#{search_text} + + + and c.short_name like #{name_pattern} + + + and c.company_name like #{name_pattern} + + + and c.business_name like #{name_pattern} + + + and c.contact_email = #{search_text} + + + and c.remark like #{name_pattern} + + + and c.org_id=#{org_id} + and c.org_id in + #{org_id} + + and c.referrer_id=#{referrer_id} + and c.is_valid=1 + + + + + + + INSERT sys_client_rates (manager_id, client_id, rate_name, rate_value, transaction_fee, active_time, expiry_time, create_time, update_time, manager_name, clean_days, remark) + SELECT CONCAT('System-', CURRENT_DATE()),r.client_id,r.rate_name,r.rate_value,r.transaction_fee,DATE_ADD(r.expiry_time, INTERVAL 1 day),DATE_ADD(r.expiry_time, INTERVAL 1 year),NOW(), NOW(), + CONCAT('System-', CURRENT_DATE()),r.clean_days,'费率自动延期一年' + FROM sys_clients c + LEFT JOIN sys_client_rates r ON r.client_id = c.client_id + WHERE c.client_id = #{clientId} AND c.skip_clearing = 0 AND (c.approve_result = 1 OR (c.approve_result = 2 AND (c.source = 1 OR c.source = 2))) + AND c.is_valid = 1 AND (r.expiry_time = (SELECT MAX(expiry_time)FROM sys_client_rates r3 + WHERE r3.client_id = c.client_id + AND r3.rate_name = r.rate_name) + AND CURRENT_DATE() >= r.expiry_time + OR r.client_rate_id IS NULL) + + + @@ -222,79 +276,336 @@ margin-bottom: 10%;"/>