From ff46264284692f1bb53676011186c57bcfe1e9d2 Mon Sep 17 00:00:00 2001 From: cuibaocheng Date: Mon, 6 Sep 2021 16:12:44 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=96=87=E5=AD=97=E9=95=BF?= =?UTF-8?q?=E5=BA=A6=E8=87=AA=E5=8A=A8=E8=AE=BE=E7=BD=AE/=E6=A0=8F?= =?UTF-8?q?=E7=9B=AE=E5=A2=9E=E5=8A=A0=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../systemcard/enums/AccountTypeEnum.java | 5 +- .../cardchargerole/CardChargeRoleDTO.java | 20 +++++ .../pojo/vos/cardcharge/CardChargeVO.java | 6 +- .../vos/cardchargerole/CardChargeRoleVO.java | 20 +++++ .../impl/CardChargeServiceImpl.java | 87 ++++++++++++++----- .../card-charge-role-mapper.xml | 28 +++++- .../templates/cardchargerole/list.html | 21 ++++- .../templates/cardchargerole/save.html | 24 ++++- .../templates/cardchargerole/update.html | 27 +++++- 9 files changed, 200 insertions(+), 38 deletions(-) diff --git a/src/main/java/cn/com/tenlion/systemcard/enums/AccountTypeEnum.java b/src/main/java/cn/com/tenlion/systemcard/enums/AccountTypeEnum.java index 365be33..0c13394 100644 --- a/src/main/java/cn/com/tenlion/systemcard/enums/AccountTypeEnum.java +++ b/src/main/java/cn/com/tenlion/systemcard/enums/AccountTypeEnum.java @@ -2,8 +2,9 @@ package cn.com.tenlion.systemcard.enums; public enum AccountTypeEnum { - TIXIAN("TIXIAN", "提现"), - TICHENG("TICHENG", "邀请收益"); + TIXIAN("TIXIAN", "账户提现"), + TICHENG("TICHENG", "邀请使用名片服务收益"), + XUFEITICHENG("XUFEITICHENG", "邀请续费名片服务收益"); private String type; diff --git a/src/main/java/cn/com/tenlion/systemcard/pojo/dtos/cardchargerole/CardChargeRoleDTO.java b/src/main/java/cn/com/tenlion/systemcard/pojo/dtos/cardchargerole/CardChargeRoleDTO.java index 6cc403d..18f3c1b 100644 --- a/src/main/java/cn/com/tenlion/systemcard/pojo/dtos/cardchargerole/CardChargeRoleDTO.java +++ b/src/main/java/cn/com/tenlion/systemcard/pojo/dtos/cardchargerole/CardChargeRoleDTO.java @@ -26,6 +26,10 @@ public class CardChargeRoleDTO { private Double cardChargeRoleDispatchProp; @ApiModelProperty(name = "cardChargeRoleInvitationProp", value = "邀请码邀请的提成比例") private Double cardChargeRoleInvitationProp; + @ApiModelProperty(name = "cardChargeRoleDispatchRenewProp", value = "转发邀请的提成比例(续费)") + private Double cardChargeRoleDispatchRenewProp; + @ApiModelProperty(name = "cardChargeRoleInvitationRenewProp", value = "邀请码邀请的提成比例(续费)") + private Double cardChargeRoleInvitationRenewProp; @ApiModelProperty(name = "cardChargeRoleType", value = "角色类型.1:个人普通版,2:企业普通版,3:企业高级版") private String cardChargeRoleType; @ApiModelProperty(name = "cardChargeRolePersonNumber", value = "企业版支持人数") @@ -47,6 +51,22 @@ public class CardChargeRoleDTO { @ApiModelProperty(name = "isDelete", value = "") private Integer isDelete; + public Double getCardChargeRoleDispatchRenewProp() { + return cardChargeRoleDispatchRenewProp; + } + + public void setCardChargeRoleDispatchRenewProp(Double cardChargeRoleDispatchRenewProp) { + this.cardChargeRoleDispatchRenewProp = cardChargeRoleDispatchRenewProp; + } + + public Double getCardChargeRoleInvitationRenewProp() { + return cardChargeRoleInvitationRenewProp; + } + + public void setCardChargeRoleInvitationRenewProp(Double cardChargeRoleInvitationRenewProp) { + this.cardChargeRoleInvitationRenewProp = cardChargeRoleInvitationRenewProp; + } + public Integer getCardChargeRoleOrder() { return cardChargeRoleOrder; } diff --git a/src/main/java/cn/com/tenlion/systemcard/pojo/vos/cardcharge/CardChargeVO.java b/src/main/java/cn/com/tenlion/systemcard/pojo/vos/cardcharge/CardChargeVO.java index 7e7f208..ee125cb 100644 --- a/src/main/java/cn/com/tenlion/systemcard/pojo/vos/cardcharge/CardChargeVO.java +++ b/src/main/java/cn/com/tenlion/systemcard/pojo/vos/cardcharge/CardChargeVO.java @@ -39,8 +39,8 @@ public class CardChargeVO { private String cardChargeUserId; @ApiModelProperty(name = "cardChargeInvitationUserId", value = "邀请人ID") private String cardChargeInvitationUserId; - @ApiModelProperty(name = "cardChargeInvitationNumber", value = "邀请码") - private String cardChargeInvitationNumber; +/* @ApiModelProperty(name = "cardChargeInvitationNumber", value = "邀请码") + private String cardChargeInvitationNumber;*/ @ApiModelProperty(name = "cardChargeOrderNumber", value = "交易订单号") private String cardChargeOrderNumber; @ApiModelProperty(name = "cardTemplateId", value = "模板购买") @@ -108,6 +108,7 @@ public class CardChargeVO { this.cardChargeOrderNumber = cardChargeOrderNumber; } +/* public String getCardChargeInvitationNumber() { return cardChargeInvitationNumber == null ? "" : cardChargeInvitationNumber; } @@ -115,6 +116,7 @@ public class CardChargeVO { public void setCardChargeInvitationNumber(String cardChargeInvitationNumber) { this.cardChargeInvitationNumber = cardChargeInvitationNumber; } +*/ public String getCardChargeInvitationUserId() { return cardChargeInvitationUserId == null ? "" : cardChargeInvitationUserId; diff --git a/src/main/java/cn/com/tenlion/systemcard/pojo/vos/cardchargerole/CardChargeRoleVO.java b/src/main/java/cn/com/tenlion/systemcard/pojo/vos/cardchargerole/CardChargeRoleVO.java index 1defdb1..717889a 100644 --- a/src/main/java/cn/com/tenlion/systemcard/pojo/vos/cardchargerole/CardChargeRoleVO.java +++ b/src/main/java/cn/com/tenlion/systemcard/pojo/vos/cardchargerole/CardChargeRoleVO.java @@ -31,6 +31,10 @@ public class CardChargeRoleVO { @ApiModelProperty(name = "cardChargeRoleInvitationProp", value = "邀请码邀请的提成比例") @CheckNumberAnnotation(name = "邀请码邀请的提成比例") private Double cardChargeRoleInvitationProp; + @ApiModelProperty(name = "cardChargeRoleDispatchRenewProp", value = "转发邀请的提成比例(续费)") + private Double cardChargeRoleDispatchRenewProp; + @ApiModelProperty(name = "cardChargeRoleInvitationRenewProp", value = "邀请码邀请的提成比例(续费)") + private Double cardChargeRoleInvitationRenewProp; @ApiModelProperty(name = "cardChargeRoleType", value = "角色类型.1:个人普通版,2:企业普通版,3:企业高级版") private String cardChargeRoleType; @ApiModelProperty(name = "cardChargeRolePersonNumber", value = "企业版支持人数") @@ -43,6 +47,22 @@ public class CardChargeRoleVO { @ApiModelProperty(name = "cardChargeRoleOrder", value = "排序") private Integer cardChargeRoleOrder; + public Double getCardChargeRoleDispatchRenewProp() { + return cardChargeRoleDispatchRenewProp; + } + + public void setCardChargeRoleDispatchRenewProp(Double cardChargeRoleDispatchRenewProp) { + this.cardChargeRoleDispatchRenewProp = cardChargeRoleDispatchRenewProp; + } + + public Double getCardChargeRoleInvitationRenewProp() { + return cardChargeRoleInvitationRenewProp; + } + + public void setCardChargeRoleInvitationRenewProp(Double cardChargeRoleInvitationRenewProp) { + this.cardChargeRoleInvitationRenewProp = cardChargeRoleInvitationRenewProp; + } + public Integer getCardChargeRoleOrder() { return cardChargeRoleOrder; } diff --git a/src/main/java/cn/com/tenlion/systemcard/service/cardcharge/impl/CardChargeServiceImpl.java b/src/main/java/cn/com/tenlion/systemcard/service/cardcharge/impl/CardChargeServiceImpl.java index cddca1a..35c0579 100644 --- a/src/main/java/cn/com/tenlion/systemcard/service/cardcharge/impl/CardChargeServiceImpl.java +++ b/src/main/java/cn/com/tenlion/systemcard/service/cardcharge/impl/CardChargeServiceImpl.java @@ -115,19 +115,6 @@ public class CardChargeServiceImpl extends DefaultBaseService implements ICardCh * @param cardChargeDTO */ private void accountItemAdd(CardChargeDTO cardChargeDTO) { - /** - * 查询我的缴费记录列表 , 判断是否存在缴费 , 存在则为续费 , 不存在则为缴费 - */ - Map query = getHashMap(2); - query.put("cardChargeUserId" , cardChargeDTO.getCardChargeUserId()); - List list = list(query); - for(CardChargeDTO dTO : list) { - // 说明在本次缴费之前 , 已经有过缴费记录 , 本次属于续费 , 没有提成 - if ("2".equals(dTO.getCardChargeOrderStatus()) && !cardChargeDTO.getCardChargeId().equals(dTO.getCardChargeId())) { - return; - } - } - /** * 缴费成功到账到公司账户后 , 给予邀请人账户提成 */ @@ -137,6 +124,20 @@ public class CardChargeServiceImpl extends DefaultBaseService implements ICardCh * 找出邀请人(邀请人ID会以 邀请码 || 邀请人用户ID的形式传入 ) */ String userIdOrUserCode = cardChargeDTO.getCardChargeInvitationUserId(); + /** + * 查询我的缴费记录列表 , 判断这个角色续费 , 我是第一次(首次) , 还是第N次(续费) + */ + String cardChargeMode = cardChargeDTO.getCardChargeMode(); + Map query = getHashMap(2); + query.put("cardChargeUserId" , cardChargeDTO.getCardChargeUserId()); + List list = list(query); + Boolean isRenew = false; // 是否为续费. + for(CardChargeDTO dTO : list) { + // 相同模式的, 缴费成功的, 不是本次缴费的 . 如果有,则是续费, 如果没有则是新用户 + if (cardChargeMode.equals(roleDTO.getCardChargeRoleType()) && "2".equals(dTO.getCardChargeOrderStatus()) && !cardChargeDTO.getCardChargeId().equals(dTO.getCardChargeId())) { + isRenew = true; + } + } // 邀请人的用户ID String invitationUserId = ""; String invitationType = ""; @@ -145,15 +146,37 @@ public class CardChargeServiceImpl extends DefaultBaseService implements ICardCh // 判断是否为邀请码 MiniappUserPO miniappUserPO = iMiniappUserService.getPOByUserCode(userIdOrUserCode); if(miniappUserPO != null) { - invitationUserId = miniappUserPO.getUserId(); - invitationType = "邀请码.邀请" + userPO.getNickName() + "使用名片服务"; - invitationProp = roleDTO.getCardChargeRoleInvitationProp().intValue();// 邀请码邀请的提成比例 - // 判断是否为userId + // 填写自己的邀请码, 没有提成 + if(miniappUserPO.getUserId().equals(cardChargeDTO.getCardChargeUserId())) { + return; + } + // 是否为续费 + if(isRenew) { + invitationUserId = miniappUserPO.getUserId(); + invitationType = "邀请码.邀请" + userPO.getNickName() + "续费名片服务"; + invitationProp = roleDTO.getCardChargeRoleInvitationRenewProp().intValue();// 邀请码邀请的提成比例(续费) + }else{ + invitationUserId = miniappUserPO.getUserId(); + invitationType = "邀请码.邀请" + userPO.getNickName() + "使用名片服务"; + invitationProp = roleDTO.getCardChargeRoleInvitationProp().intValue();// 邀请码邀请的提成比例(首次) + } + // 判断是否为userId }else { MiniappUserPO miniappUser = iMiniappUserService.getPO(userIdOrUserCode); - invitationUserId = miniappUser.getUserId(); - invitationType = "转发.邀请" + userPO.getNickName() + "使用名片服务"; - invitationProp = roleDTO.getCardChargeRoleDispatchProp().intValue(); // 转发邀请的提成比例 + // 自己的转发, 没有提成 + if(miniappUser.getUserId().equals(cardChargeDTO.getCardChargeUserId())) { + return; + } + // 是否为续费 + if(isRenew) { + invitationUserId = miniappUser.getUserId(); + invitationType = "转发.邀请" + userPO.getNickName() + "续费名片服务"; + invitationProp = roleDTO.getCardChargeRoleDispatchRenewProp().intValue(); // 转发邀请的提成比例(续费) + }else{ + invitationUserId = miniappUser.getUserId(); + invitationType = "转发.邀请" + userPO.getNickName() + "使用名片服务"; + invitationProp = roleDTO.getCardChargeRoleDispatchProp().intValue(); // 转发邀请的提成比例(首次) + } } } /** @@ -161,16 +184,23 @@ public class CardChargeServiceImpl extends DefaultBaseService implements ICardCh * 邀请人的 账号流水 增加特定比例的提成 */ if(!StringUtils.isEmpty(invitationUserId)) { + int cardChargePrice = PayUtil.buiderMoney(cardChargeDTO.getCardChargePrice());// 本次缴费金额 /** * 计算提成 */ - int cardChargePrice = PayUtil.buiderMoney(cardChargeDTO.getCardChargePrice());// 本次缴费金额 // 大于等于10分钱, 走提成 if(cardChargePrice >= 10) { int tiCheng = cardChargePrice * invitationProp / 100; if(tiCheng > 0) { - // 邀请人的账户增加一条流水 - iAccountItemPayService.addInAccount(cardChargeDTO.getCardChargeOrderNumber(), invitationUserId, tiCheng, invitationType, AccountTypeEnum.TICHENG); + + // 续费提成 + if(isRenew){ + // 邀请人的账户增加一条流水 + iAccountItemPayService.addInAccount(cardChargeDTO.getCardChargeOrderNumber(), invitationUserId, tiCheng, invitationType, AccountTypeEnum.XUFEITICHENG); + }else{ + // 邀请人的账户增加一条流水 + iAccountItemPayService.addInAccount(cardChargeDTO.getCardChargeOrderNumber(), invitationUserId, tiCheng, invitationType, AccountTypeEnum.TICHENG); + } } } } @@ -276,6 +306,17 @@ public class CardChargeServiceImpl extends DefaultBaseService implements ICardCh if(!priceDTO.getCardCharge()) { throw new SaveException("无需缴费"); }*/ + String userIdOrUserCode = cardChargeAppVO.getCardChargeInvitationUserId(); + if (!StringUtils.isEmpty(cardChargeAppVO.getCardChargeInvitationUserId())) { + // 判断是否为邀请码 + MiniappUserPO miniappUserPO = iMiniappUserService.getPOByUserCode(userIdOrUserCode); + if(miniappUserPO != null) { + // 填写自己的邀请码, 没有提成 + if(miniappUserPO.getUserId().equals(userId)) { + throw new SaveException("不能填写自己的邀请码"); + } + } + } /** * 查找出当前选择的 缴费配置 */ diff --git a/src/main/resources/mybatis/mapper/cardchargerole/card-charge-role-mapper.xml b/src/main/resources/mybatis/mapper/cardchargerole/card-charge-role-mapper.xml index f82d874..78e64b6 100644 --- a/src/main/resources/mybatis/mapper/cardchargerole/card-charge-role-mapper.xml +++ b/src/main/resources/mybatis/mapper/cardchargerole/card-charge-role-mapper.xml @@ -9,6 +9,8 @@ + + @@ -66,6 +68,8 @@ card_charge_role_price, card_charge_role_dispatch_prop, card_charge_role_invitation_prop, + card_charge_role_dispatch_renew_prop, + card_charge_role_invitation_renew_prop, card_charge_role_type, card_charge_role_person_number, card_charge_role_time, @@ -83,6 +87,8 @@ #{cardChargeRolePrice}, #{cardChargeRoleDispatchProp}, #{cardChargeRoleInvitationProp}, + #{cardChargeRoleDispatchRenewProp}, + #{cardChargeRoleInvitationRenewProp}, #{cardChargeRoleType}, #{cardChargeRolePersonNumber}, #{cardChargeRoleTime}, @@ -142,6 +148,12 @@ card_charge_role_invitation_prop = #{cardChargeRoleInvitationProp}, + + card_charge_role_dispatch_renew_prop = #{cardChargeRoleDispatchRenewProp}, + + + card_charge_role_invitation_renew_prop = #{cardChargeRoleInvitationRenewProp}, + card_charge_role_person_number = #{cardChargeRolePersonNumber}, @@ -175,7 +187,9 @@ t1.card_charge_role_time, t1.card_charge_role_remark, t1.card_charge_role_id, - t1.card_charge_role_order + t1.card_charge_role_order, + t1.card_charge_role_dispatch_renew_prop, + t1.card_charge_role_invitation_renew_prop FROM e_card_charge_role t1 WHERE @@ -203,7 +217,9 @@ t1.gmt_create, t1.modifier, t1.gmt_modified, - t1.is_delete + t1.is_delete, + t1.card_charge_role_dispatch_renew_prop, + t1.card_charge_role_invitation_renew_prop FROM e_card_charge_role t1 WHERE @@ -231,7 +247,9 @@ t1.gmt_create, t1.modifier, t1.gmt_modified, - t1.is_delete + t1.is_delete, + t1.card_charge_role_dispatch_renew_prop, + t1.card_charge_role_invitation_renew_prop FROM e_card_charge_role t1 WHERE @@ -260,7 +278,9 @@ t1.modifier, t1.gmt_modified, t1.is_delete, - t1.card_charge_role_order + t1.card_charge_role_order, + t1.card_charge_role_dispatch_renew_prop, + t1.card_charge_role_invitation_renew_prop FROM e_card_charge_role t1 WHERE diff --git a/src/main/resources/templates/cardchargerole/list.html b/src/main/resources/templates/cardchargerole/list.html index c989c0e..95c5d6a 100644 --- a/src/main/resources/templates/cardchargerole/list.html +++ b/src/main/resources/templates/cardchargerole/list.html @@ -155,7 +155,7 @@ return rowData + ' RMB'; } }, - {field: 'cardChargeRoleDispatchProp', width: 180, title: '转发邀请提成比例', align:'center', + {field: 'cardChargeRoleDispatchProp', width: 120, title: '转发(首次)', align:'center', templet: function(row) { var rowData = row[this.field]; if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { @@ -164,7 +164,24 @@ return rowData + "%"; } }, - {field: 'cardChargeRoleInvitationProp', width: 180, title: '邀请码邀请提成比例', align:'center', + {field: 'cardChargeRoleInvitationProp', width: 120, title: '邀请码(首次)', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData + "%"; + } + },{field: 'cardChargeRoleDispatchRenewProp', width: 120, title: '转发(续费)', align:'center', + templet: function(row) { + var rowData = row[this.field]; + if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { + return '-'; + } + return rowData + "%"; + } + }, + {field: 'cardChargeRoleInvitationRenewProp', width: 120, title: '邀请码(续费)', align:'center', templet: function(row) { var rowData = row[this.field]; if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { diff --git a/src/main/resources/templates/cardchargerole/save.html b/src/main/resources/templates/cardchargerole/save.html index c6738a6..615f914 100644 --- a/src/main/resources/templates/cardchargerole/save.html +++ b/src/main/resources/templates/cardchargerole/save.html @@ -73,7 +73,7 @@
- +
@@ -82,7 +82,7 @@
- +
@@ -91,6 +91,26 @@
+
+
+ +
+ +
+  转发提成比例 +
+
+
+
+ +
+ +
+  邀请码提成比例 +
+
+
+
diff --git a/src/main/resources/templates/cardchargerole/update.html b/src/main/resources/templates/cardchargerole/update.html index e46aead..677c119 100644 --- a/src/main/resources/templates/cardchargerole/update.html +++ b/src/main/resources/templates/cardchargerole/update.html @@ -73,7 +73,7 @@
- +
@@ -82,7 +82,7 @@
- +
@@ -91,6 +91,26 @@
+
+
+ +
+ +
+  转发提成比例 +
+
+
+
+ +
+ +
+  邀请码提成比例 +
+
+
+
@@ -228,8 +248,9 @@ // 提交表单 form.on('submit(submitForm)', function(formData) { top.dialog.confirm(top.dataMessage.commit, function(index) { - top.dialog.close(index); + top.layer.close(index); var loadLayerIndex; + return; formData.field['cardChargeRoleStatus'] = formData.field['cardChargeRoleStatus'] == "1" ? "1" : "0"; top.restAjax.put(top.restAjax.path('api/cardchargerole/update/{cardChargeRoleId}', [cardChargeRoleId]), formData.field, null, function(code, data) { var layerIndex = top.dialog.msg(top.dataMessage.updateSuccess, {