developrelease_toaliyun_real
| @@ -0,0 +1,24 @@ | |||||
| DROP TABLE IF EXISTS `mall_sale_type` ; | |||||
| CREATE TABLE `mall_sale_type` ( | |||||
| `id` bigint(64) NOT NULL, | |||||
| `name` varchar(32) DEFAULT NULL COMMENT '销售类型', | |||||
| `type` tinyint(2) DEFAULT NULL COMMENT '资源类型1:尊享全能版 2:尊享营销版 3.速享版', | |||||
| `period` tinyint(2) DEFAULT NULL COMMENT '有效期(单位月)', | |||||
| `menus` json DEFAULT NULL COMMENT '菜单列表', | |||||
| PRIMARY KEY (`id`), | |||||
| UNIQUE `id_UNIQUE` USING BTREE (`id`) comment '' | |||||
| ) ENGINE=`InnoDB` ROW_FORMAT=DYNAMIC COMMENT='系统销售表' CHECKSUM=0 DELAY_KEY_WRITE=0; | |||||
| INSERT INTO `mall_sale_type` | |||||
| (`id`,`name`, `type`, `period`, `menus`) | |||||
| VALUES | |||||
| (1, '尊享全能版', 1, 12, | |||||
| '[1,2,3,4,5,6,7,8,9,10,50,101,102,103,104,105,106,107,108,201,202,203,204,205,206,211,212,221,222,251,299,300,301,302,303,304,305,306,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,501,502,503,504,505,506,507,508,509,511,512,513,521,522,523,531,532,533,591,595,601,602,603,604,605,606,607,608,609,610,611,612,621,622,623,624,625,626,627,641,642,643,644,645,651,661,662,663,671,672,673,674,681,682,683,684,685,691,692,693,694,695,701,702,711,712,713,901,902,903,931,932,951,952,961,962,965,966,967,968]' | |||||
| ), | |||||
| (2, '尊享营销版', 2, 12, | |||||
| '[1,2,4,5,6,7,8,9,10,50,101,102,103,104,105,106,107,201,202,203,204,205,211,212,221,222,251,409,410,411,416,501,502,503,504,505,506,507,508,509,511,512,513,521,522,523,531,532,533,591,592,595,601,602,603,604,605,606,607,608,609,610,611,612,621,622,623,624,625,626,627,641,642,643,644,645,651,661,662,663,671,672,673,674,681,682,683,684,685,691,692,693,694,695,701,702,711,712,713,901,902,903,931,932,951,961]' | |||||
| ), | |||||
| (3, '速享版', 3, 1, | |||||
| '[2,4,5,6,7,10,50,201,202,205,211,212,221,222,251,409,410,411,416,501,502,503,504,505,506,507,508,511,512,513,521,522,523,531,532,533,591,592,601,602,603,604,605,606,607,608,609,610,611,612,621,622,623,624,625,626,641,642,643,644,645,651,661,662,663,671,672,673,674,681,682,683,684,685,691,692,693,694,695,701,702,711,712,713,901,902,903,931,932]' | |||||
| ) | |||||
| ; | |||||
| @@ -2,8 +2,10 @@ package com.iformall.domain.vo; | |||||
| import com.iformall.domain.po.BaseEntity; | import com.iformall.domain.po.BaseEntity; | ||||
| import lombok.Data; | import lombok.Data; | ||||
| import lombok.EqualsAndHashCode; | |||||
| @Data | @Data | ||||
| @EqualsAndHashCode(callSuper = true) | |||||
| public class PromotionCalc extends BaseEntity { | public class PromotionCalc extends BaseEntity { | ||||
| @io.swagger.annotations.ApiModelProperty(value="订单总金额",name="orderAmount") | @io.swagger.annotations.ApiModelProperty(value="订单总金额",name="orderAmount") | ||||
| Integer orderAmount; | Integer orderAmount; | ||||
| @@ -447,36 +447,41 @@ public class WxBillSettleServiceImpl implements WxBillSettleService { | |||||
| final IdWorker idWorker = IdWorker.get(); | final IdWorker idWorker = IdWorker.get(); | ||||
| //检查账单是否存在其他结算单中 | //检查账单是否存在其他结算单中 | ||||
| WxBillSettle query = new WxBillSettle(); | |||||
| query.setId(record.getId()); | |||||
| List<WxBillSettleBill> list = new ArrayList<>(); | |||||
| list.addAll(record.getReceiveBillIds()); | |||||
| list.addAll(record.getPayBillIds()); | |||||
| query.setReceiveBillIds(list); | |||||
| List<WxBillSettleBill> existList = wxBillSettleBillMapper.findExist(query); | |||||
| Set<Long> idSet = new HashSet(); | |||||
| if(CollectionUtils.isNotEmpty(existList)){ | |||||
| for (WxBillSettleBill b:existList) { | |||||
| idSet.add(b.getBillId()); | |||||
| } | |||||
| String ids = ""; | |||||
| for (Long id:idSet) { | |||||
| WxBillSettleBill queryBill = new WxBillSettleBill(); | |||||
| queryBill.setBillId(id); | |||||
| queryBill.setType(getType(id,record)); | |||||
| WxBillSettleBill db = wxBillSettleBillMapper.findByBillId(queryBill).get(0); | |||||
| BigDecimal r = new BigDecimal(db.getReceivePay()).divide(new BigDecimal(100),2,BigDecimal.ROUND_HALF_UP); | |||||
| ids += db.getBillName()+r.toString()+"元,"; | |||||
| } | |||||
| return new ResultData(ErrorCode.DB_FAIL.getCode(), ids.substring(0,ids.length()-1)+"已经在其他结算单中,请移除!"); | |||||
| } | |||||
| // WxBillSettle query = new WxBillSettle(); | |||||
| // query.setId(record.getId()); | |||||
| // List<WxBillSettleBill> list = new ArrayList<>(); | |||||
| // list.addAll(record.getReceiveBillIds()); | |||||
| // list.addAll(record.getPayBillIds()); | |||||
| // query.setReceiveBillIds(list); | |||||
| // List<WxBillSettleBill> existList = wxBillSettleBillMapper.findExist(query); | |||||
| // Set<Long> idSet = new HashSet(); | |||||
| // if(CollectionUtils.isNotEmpty(existList)){ | |||||
| // for (WxBillSettleBill b:existList) { | |||||
| // idSet.add(b.getBillId()); | |||||
| // } | |||||
| // String ids = ""; | |||||
| // for (Long id:idSet) { | |||||
| // WxBillSettleBill queryBill = new WxBillSettleBill(); | |||||
| // queryBill.setBillId(id); | |||||
| // queryBill.setType(getType(id,record)); | |||||
| // WxBillSettleBill db = wxBillSettleBillMapper.findByBillId(queryBill).get(0); | |||||
| // BigDecimal r = new BigDecimal(db.getReceivePay()).divide(new BigDecimal(100),2,BigDecimal.ROUND_HALF_UP); | |||||
| // ids += db.getBillName()+r.toString()+"元,"; | |||||
| // } | |||||
| // | |||||
| // return new ResultData(ErrorCode.DB_FAIL.getCode(), ids.substring(0,ids.length()-1)+"已经在其他结算单中,请移除!"); | |||||
| // } | |||||
| if (record.getFlowParams() == null || record.getFlowParams().size() == 0) { | if (record.getFlowParams() == null || record.getFlowParams().size() == 0) { | ||||
| record.setStatus(EnumSettleStatus.NOT_FINISH.getCode()); | record.setStatus(EnumSettleStatus.NOT_FINISH.getCode()); | ||||
| //选择的账单改为已结清 | //选择的账单改为已结清 | ||||
| updateFreezeOrStatus(record.getReceiveBillIds(), null,EnumBillRentStatus.PAID.getCode()); | updateFreezeOrStatus(record.getReceiveBillIds(), null,EnumBillRentStatus.PAID.getCode()); | ||||
| updateFreezeOrStatus(record.getPayBillIds(), null,EnumBillRentStatus.PAID.getCode()); | updateFreezeOrStatus(record.getPayBillIds(), null,EnumBillRentStatus.PAID.getCode()); | ||||
| //刚好结清 | |||||
| if(record.getReceiveMoney().equals(record.getPayMoney())){ | |||||
| record.setStatus(EnumSettleStatus.FINISH.getCode()); | |||||
| } | |||||
| } | } | ||||
| if (record.getId() == null) { | if (record.getId() == null) { | ||||
| record.setId(idWorker.nextId()); | record.setId(idWorker.nextId()); | ||||
| @@ -543,3 +548,4 @@ public class WxBillSettleServiceImpl implements WxBillSettleService { | |||||
| } | } | ||||
| } | } | ||||
| @@ -125,7 +125,7 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { | |||||
| // 4. 扣减计算 | // 4. 扣减计算 | ||||
| Double paymentD = 1.0 * cardInfo.getSaleAmount() * record.getDeductionAmount() / cardInfo.getAmount(); | Double paymentD = 1.0 * cardInfo.getSaleAmount() * record.getDeductionAmount() / cardInfo.getAmount(); | ||||
| Integer payment = paymentD.intValue(); | Integer payment = paymentD.intValue(); | ||||
| int iChargeFee = PayUtils.getPayRate(payment, payAccount.getRate()); | |||||
| int iChargeFee = PayUtils.getPayRate(payment, payAccount.getRate(), false); | |||||
| Integer real_payment = payment - iChargeFee; | Integer real_payment = payment - iChargeFee; | ||||
| Integer remain_real_pament = cardInfo.getRemainingShareFeeAmount() - real_payment; | Integer remain_real_pament = cardInfo.getRemainingShareFeeAmount() - real_payment; | ||||
| Integer remaingAmount = cardInfo.getRemainingAmount()-record.getDeductionAmount(); | Integer remaingAmount = cardInfo.getRemainingAmount()-record.getDeductionAmount(); | ||||
| @@ -200,7 +200,7 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { | |||||
| logger.info("补贴额: " + subsidyFee); | logger.info("补贴额: " + subsidyFee); | ||||
| if(subsidyFee > 0) { | if(subsidyFee > 0) { | ||||
| // 有补贴时入库 | // 有补贴时入库 | ||||
| int iSubChargeFee = PayUtils.getPayRate(subsidyFee, payAccount.getRate()); | |||||
| int iSubChargeFee = PayUtils.getPayRate(subsidyFee, payAccount.getRate(), false); | |||||
| Integer realSubsidyFee = subsidyFee - iSubChargeFee; | Integer realSubsidyFee = subsidyFee - iSubChargeFee; | ||||
| WxMerchantSubsidy merchantSubsidy = new WxMerchantSubsidy(); | WxMerchantSubsidy merchantSubsidy = new WxMerchantSubsidy(); | ||||
| merchantSubsidy.setId(idWorker.nextId()); | merchantSubsidy.setId(idWorker.nextId()); | ||||
| @@ -599,7 +599,7 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { | |||||
| // 4. 扣减计算 | // 4. 扣减计算 | ||||
| Double paymentD = 1.0 * cardInfo.getSaleAmount() * record.getDeductionAmount() / cardInfo.getAmount(); | Double paymentD = 1.0 * cardInfo.getSaleAmount() * record.getDeductionAmount() / cardInfo.getAmount(); | ||||
| Integer payment = paymentD.intValue(); | Integer payment = paymentD.intValue(); | ||||
| int iChargeFee = PayUtils.getPayRate(payment, payAccount.getRate()); | |||||
| int iChargeFee = PayUtils.getPayRate(payment, payAccount.getRate(), false); | |||||
| Integer real_payment = payment - iChargeFee; | Integer real_payment = payment - iChargeFee; | ||||
| Integer remain_real_pament = cardInfo.getRemainingShareFeeAmount() - real_payment; | Integer remain_real_pament = cardInfo.getRemainingShareFeeAmount() - real_payment; | ||||
| Integer remaingAmount = cardInfo.getRemainingAmount()-record.getDeductionAmount(); | Integer remaingAmount = cardInfo.getRemainingAmount()-record.getDeductionAmount(); | ||||
| @@ -680,7 +680,7 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { | |||||
| // 4. 增加计算 | // 4. 增加计算 | ||||
| Double paymentD = 1.0 * cardInfo.getSaleAmount() * record.getDeductionAmount() / cardInfo.getAmount(); | Double paymentD = 1.0 * cardInfo.getSaleAmount() * record.getDeductionAmount() / cardInfo.getAmount(); | ||||
| Integer payment = paymentD.intValue(); | Integer payment = paymentD.intValue(); | ||||
| int iChargeFee = PayUtils.getPayRate(payment, payAccount.getRate()); | |||||
| int iChargeFee = PayUtils.getPayRate(payment, payAccount.getRate(), false); | |||||
| Integer real_payment = payment - iChargeFee; | Integer real_payment = payment - iChargeFee; | ||||
| Integer remain_real_pament = cardInfo.getRemainingShareFeeAmount() + real_payment; | Integer remain_real_pament = cardInfo.getRemainingShareFeeAmount() + real_payment; | ||||
| Integer remaingAmount = cardInfo.getRemainingAmount()+record.getDeductionAmount(); | Integer remaingAmount = cardInfo.getRemainingAmount()+record.getDeductionAmount(); | ||||
| @@ -772,7 +772,7 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { | |||||
| logger.info("补贴额: " + subsidyFee); | logger.info("补贴额: " + subsidyFee); | ||||
| if(subsidyFee > 0) { | if(subsidyFee > 0) { | ||||
| // 有补贴时入库 | // 有补贴时入库 | ||||
| int iSubChargeFee = PayUtils.getPayRate(subsidyFee, payAccount.getRate()); | |||||
| int iSubChargeFee = PayUtils.getPayRate(subsidyFee, payAccount.getRate(), false); | |||||
| Integer realSubsidyFee = subsidyFee - iSubChargeFee; | Integer realSubsidyFee = subsidyFee - iSubChargeFee; | ||||
| WxMerchantSubsidy merchantSubsidy = new WxMerchantSubsidy(); | WxMerchantSubsidy merchantSubsidy = new WxMerchantSubsidy(); | ||||
| merchantSubsidy.setId(idWorker.nextId()); | merchantSubsidy.setId(idWorker.nextId()); | ||||
| @@ -509,10 +509,10 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||||
| } | } | ||||
| if (subsidyNum != null && subsidyNum.intValue() > 0) { | if (subsidyNum != null && subsidyNum.intValue() > 0) { | ||||
| // 有补贴时入库 | // 有补贴时入库 | ||||
| int iSubChargeFee = PayUtils.getPayRate(subsidyNum, payAccount.getRate()); | |||||
| int iSubChargeFee = PayUtils.getPayRate(subsidyNum, payAccount.getRate(), false); | |||||
| Integer realSubsidyFee = subsidyNum - iSubChargeFee; | Integer realSubsidyFee = subsidyNum - iSubChargeFee; | ||||
| int iPriceChargeFee = PayUtils.getPayRate(coupon.getSalePrice(), payAccount.getRate()); | |||||
| int iPriceChargeFee = PayUtils.getPayRate(coupon.getSalePrice(), payAccount.getRate(), false); | |||||
| Integer realPayment = coupon.getSalePrice() - iPriceChargeFee; | Integer realPayment = coupon.getSalePrice() - iPriceChargeFee; | ||||
| WxMerchantSubsidy merchantSubsidy = new WxMerchantSubsidy(); | WxMerchantSubsidy merchantSubsidy = new WxMerchantSubsidy(); | ||||
| @@ -309,11 +309,17 @@ public class WxFlowServiceImpl implements WxFlowService { | |||||
| wxBillSettle.setStatus(EnumSettleStatus.NOT_FINISH.getCode()); | wxBillSettle.setStatus(EnumSettleStatus.NOT_FINISH.getCode()); | ||||
| wxBillSettleService.updateFreezeOrStatus(settle.getReceiveBillIds(), EnumFreezeType.DEF.getCode(),EnumBillRentStatus.PAID.getCode()); | wxBillSettleService.updateFreezeOrStatus(settle.getReceiveBillIds(), EnumFreezeType.DEF.getCode(),EnumBillRentStatus.PAID.getCode()); | ||||
| wxBillSettleService.updateFreezeOrStatus(settle.getPayBillIds(),EnumFreezeType.DEF.getCode(),EnumBillRentStatus.PAID.getCode()); | wxBillSettleService.updateFreezeOrStatus(settle.getPayBillIds(),EnumFreezeType.DEF.getCode(),EnumBillRentStatus.PAID.getCode()); | ||||
| //刚好结清 | |||||
| if(settle.getReceiveMoney().equals(settle.getPayMoney())){ | |||||
| wxBillSettle.setStatus(EnumSettleStatus.FINISH.getCode()); | |||||
| } | |||||
| }else if(EnumRentContractAppStatus.SETBACK.getCode().intValue() == applyStatus.intValue() || EnumRentContractAppStatus.REJECT.getCode().intValue() == applyStatus.intValue()) { | }else if(EnumRentContractAppStatus.SETBACK.getCode().intValue() == applyStatus.intValue() || EnumRentContractAppStatus.REJECT.getCode().intValue() == applyStatus.intValue()) { | ||||
| //解冻 | //解冻 | ||||
| wxBillSettleService.updateFreezeOrStatus(settle.getReceiveBillIds(), EnumFreezeType.DEF.getCode(),null); | wxBillSettleService.updateFreezeOrStatus(settle.getReceiveBillIds(), EnumFreezeType.DEF.getCode(),null); | ||||
| wxBillSettleService.updateFreezeOrStatus(settle.getPayBillIds(),EnumFreezeType.DEF.getCode(),null); | wxBillSettleService.updateFreezeOrStatus(settle.getPayBillIds(),EnumFreezeType.DEF.getCode(),null); | ||||
| } | } | ||||
| wxBillSettleMapper.updateByPrimaryKeySelective(wxBillSettle); | wxBillSettleMapper.updateByPrimaryKeySelective(wxBillSettle); | ||||
| } | } | ||||
| } | } | ||||
| @@ -549,7 +555,7 @@ public class WxFlowServiceImpl implements WxFlowService { | |||||
| public boolean isBill(Integer flowType){ | public boolean isBill(Integer flowType){ | ||||
| if(EnumFlowKey.BILL.getCode().equals(flowType) | if(EnumFlowKey.BILL.getCode().equals(flowType) | ||||
| ||EnumFlowKey.NEW_BILL_CHANGE.getCode().equals(flowType)){ | ||EnumFlowKey.NEW_BILL_CHANGE.getCode().equals(flowType)){ | ||||
| return true; | |||||
| return true; | |||||
| } | } | ||||
| return false; | return false; | ||||
| } | } | ||||
| @@ -1516,4 +1522,10 @@ public class WxFlowServiceImpl implements WxFlowService { | |||||
| public List<WxFlowModel> getModelBybusiness(WxFlowModel wxFlowModel) { | public List<WxFlowModel> getModelBybusiness(WxFlowModel wxFlowModel) { | ||||
| return wxFlowModelMapper.getModelBybusiness(wxFlowModel); | return wxFlowModelMapper.getModelBybusiness(wxFlowModel); | ||||
| } | } | ||||
| public static void main(String[] args) { | |||||
| new Thread(() -> System.out.println(1 + "hello world")).start(); | |||||
| } | |||||
| } | } | ||||
| @@ -228,11 +228,11 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||||
| record.setShare(isShare.getCode()); | record.setShare(isShare.getCode()); | ||||
| if (isShare == EnumPayShare.YES) { | if (isShare == EnumPayShare.YES) { | ||||
| // 分账金额 | // 分账金额 | ||||
| int iChargeFee = PayUtils.getPayRate(record.getPayAmount(), payAccount.getRate()); | |||||
| int iChargeFee = PayUtils.getPayRate(record.getPayAmount(), payAccount.getRate(), false); | |||||
| Integer share_amount = record.getPayAmount() - iChargeFee; | Integer share_amount = record.getPayAmount() - iChargeFee; | ||||
| record.setShareAmount(share_amount); | record.setShareAmount(share_amount); | ||||
| if(payAccount.getRealRate() != null) { | if(payAccount.getRealRate() != null) { | ||||
| int iRealChargeFee = PayUtils.getPayRate(record.getPayAmount(), payAccount.getRealRate()); | |||||
| int iRealChargeFee = PayUtils.getPayRate(record.getPayAmount(), payAccount.getRealRate(), true); | |||||
| if(iChargeFee > iRealChargeFee) { | if(iChargeFee > iRealChargeFee) { | ||||
| record.setRateAmount(iChargeFee - iRealChargeFee); | record.setRateAmount(iChargeFee - iRealChargeFee); | ||||
| } | } | ||||
| @@ -459,11 +459,11 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||||
| record.setShare(isShare.getCode()); | record.setShare(isShare.getCode()); | ||||
| if (isShare == EnumPayShare.YES) { | if (isShare == EnumPayShare.YES) { | ||||
| // 分账金额 | // 分账金额 | ||||
| int iChargeFee = PayUtils.getPayRate(record.getPayAmount(), payAccount.getRate()); | |||||
| int iChargeFee = PayUtils.getPayRate(record.getPayAmount(), payAccount.getRate(), false); | |||||
| Integer share_amount = record.getPayAmount() - iChargeFee; | Integer share_amount = record.getPayAmount() - iChargeFee; | ||||
| record.setShareAmount(share_amount); | record.setShareAmount(share_amount); | ||||
| if(payAccount.getRealRate() != null) { | if(payAccount.getRealRate() != null) { | ||||
| int iRealChargeFee = PayUtils.getPayRate(record.getPayAmount(), payAccount.getRealRate()); | |||||
| int iRealChargeFee = PayUtils.getPayRate(record.getPayAmount(), payAccount.getRealRate(), true); | |||||
| record.setRateAmount(iRealChargeFee); | record.setRateAmount(iRealChargeFee); | ||||
| } | } | ||||
| if (share_amount <= 0) { | if (share_amount <= 0) { | ||||
| @@ -114,7 +114,7 @@ public class WxSubsidyServiceImpl implements WxSubsidyService { | |||||
| record.setPayTimeEnd(curDate); | record.setPayTimeEnd(curDate); | ||||
| record.setAmount(totalFee); | record.setAmount(totalFee); | ||||
| // 分账金额 | // 分账金额 | ||||
| int iChargeFee = PayUtils.getPayRate(record.getAmount(), payAccount.getRate()); | |||||
| int iChargeFee = PayUtils.getPayRate(record.getAmount(), payAccount.getRate(), false); | |||||
| Integer share_amount = record.getAmount() - iChargeFee; | Integer share_amount = record.getAmount() - iChargeFee; | ||||
| record.setShareAmount(share_amount); | record.setShareAmount(share_amount); | ||||
| record.setShareRemainAmount(share_amount); | record.setShareRemainAmount(share_amount); | ||||
| @@ -15,10 +15,16 @@ public class PayUtils { | |||||
| * @param rate 万分之几 | * @param rate 万分之几 | ||||
| * @return | * @return | ||||
| */ | */ | ||||
| public static int getPayRate(int payAmount, int rate) { | |||||
| public static int getPayRate(int payAmount, int rate, boolean isReal) { | |||||
| Double dBaseAmount = 5.0D * 1000 / rate; | Double dBaseAmount = 5.0D * 1000 / rate; | ||||
| // 基础分 千分之6 83分 | // 基础分 千分之6 83分 | ||||
| if(payAmount > dBaseAmount.intValue()) { | |||||
| if (isReal) { | |||||
| // 小于基础分,四舍五入 | |||||
| Double dPayRate = 1.0D * payAmount * rate / 10000; | |||||
| long dChargeFee = Math.round(dPayRate); | |||||
| return Long.valueOf(dChargeFee).intValue(); | |||||
| } | |||||
| else if(payAmount > dBaseAmount.intValue()) { | |||||
| // 大于基础分,不小于他的最小整数 | // 大于基础分,不小于他的最小整数 | ||||
| Double dChargeFee = Math.ceil(payAmount * 1.0D * rate / 10000); | Double dChargeFee = Math.ceil(payAmount * 1.0D * rate / 10000); | ||||
| return dChargeFee.intValue(); | return dChargeFee.intValue(); | ||||
| @@ -30,21 +36,14 @@ public class PayUtils { | |||||
| } | } | ||||
| } | } | ||||
| /* | |||||
| public static void main(String[] args) { | public static void main(String[] args) { | ||||
| int iValue = getPayRate(100, 60); | |||||
| System.out.println(iValue); | |||||
| iValue = getPayRate(200, 60); | |||||
| System.out.println(iValue); | |||||
| iValue = getPayRate(82, 60); | |||||
| System.out.println(iValue); | |||||
| iValue = getPayRate(83, 60); | |||||
| int iValue = getPayRate(600, 60, false); | |||||
| System.out.println(iValue); | System.out.println(iValue); | ||||
| iValue = getPayRate(84, 60); | |||||
| iValue = getPayRate(600, 20, true); | |||||
| System.out.println(iValue); | System.out.println(iValue); | ||||
| } | } | ||||
| */ | |||||
| } | } | ||||
| @@ -55,14 +55,14 @@ public class DataInitController { | |||||
| */ | */ | ||||
| @Transactional(rollbackFor = Exception.class) | @Transactional(rollbackFor = Exception.class) | ||||
| public void addBirthDayMsgModel() { | public void addBirthDayMsgModel() { | ||||
| List<WxMsgSignature> list = signatureMapper.selectAll(); | |||||
| Map<String, String> tenantOfSignature = list.stream().collect(Collectors.toMap(WxMsgSignature::getTenantId, WxMsgSignature::getName)); | |||||
| //List<WxMsgSignature> list = signatureMapper.selectAll(); | |||||
| //Map<String, String> tenantOfSignature = list.stream().collect(Collectors.toMap(WxMsgSignature::getTenantId, WxMsgSignature::getName)); | |||||
| IdWorker idWorker = IdWorker.get(); | IdWorker idWorker = IdWorker.get(); | ||||
| addBirthDayMsgModelToMall(tenantOfSignature, EnumMsgModel.COUPON_BIRTHDAY_OPENED, idWorker, "亲到的{userName},在您的生日到来之际,我们精心的为您准备了一份生日礼物,并在生日当天消费领取{creditScale}倍积分,赶快打开{mallName}微信小程序领取您的专属生日礼物吧!"); | |||||
| addBirthDayMsgModelToMall(tenantOfSignature, EnumMsgModel.COUPON_BIRTHDAY_OPENED_NO, idWorker, "亲到的{userName},在您的生日到来之际,我们精心的为您准备了一份生日礼物,赶快打开{mallName}微信小程序领取您的专属生日礼物吧!"); | |||||
| addBirthDayMsgModelToMall(EnumMsgModel.COUPON_BIRTHDAY_OPENED, idWorker, "亲到的{userName},在您的生日到来之际,我们精心的为您准备了一份生日礼物,并在生日当天消费领取{creditScale}倍积分,赶快打开{mallName}微信小程序领取您的专属生日礼物吧!"); | |||||
| addBirthDayMsgModelToMall(EnumMsgModel.COUPON_BIRTHDAY_OPENED_NO, idWorker, "亲到的{userName},在您的生日到来之际,我们精心的为您准备了一份生日礼物,赶快打开{mallName}微信小程序领取您的专属生日礼物吧!"); | |||||
| } | } | ||||
| private void addBirthDayMsgModelToMall(Map<String, String> tenantOfSignature, EnumMsgModel type, IdWorker idWorker, String content) { | |||||
| private void addBirthDayMsgModelToMall(EnumMsgModel type, IdWorker idWorker, String content) { | |||||
| //查找已经添加过的接口列表 | //查找已经添加过的接口列表 | ||||
| WxMsgValidationcodeModel query = new WxMsgValidationcodeModel(); | WxMsgValidationcodeModel query = new WxMsgValidationcodeModel(); | ||||
| query.setMsgType(1); | query.setMsgType(1); | ||||
| @@ -70,19 +70,19 @@ public class DataInitController { | |||||
| List<WxMsgValidationcodeModel> dbModelList = modelMapper.select(query); | List<WxMsgValidationcodeModel> dbModelList = modelMapper.select(query); | ||||
| Map<String, String> dbModelMap = dbModelList.stream().collect(Collectors.toMap(WxMsgValidationcodeModel::getTenantId, WxMsgValidationcodeModel::getName)); | Map<String, String> dbModelMap = dbModelList.stream().collect(Collectors.toMap(WxMsgValidationcodeModel::getTenantId, WxMsgValidationcodeModel::getName)); | ||||
| List<WxMall> malls = mallMapper.selectAll(); | |||||
| List<WxMall> malls = mallMapper.findList(new WxMall()); | |||||
| malls.stream().filter(wxMall -> !dbModelMap.containsKey(wxMall.getTenantId())).forEach(wxMall -> { | malls.stream().filter(wxMall -> !dbModelMap.containsKey(wxMall.getTenantId())).forEach(wxMall -> { | ||||
| addBirthDayMsgModelItem(tenantOfSignature, idWorker, wxMall, type, content); | |||||
| addBirthDayMsgModelItem(idWorker, wxMall, type, content); | |||||
| }); | }); | ||||
| } | } | ||||
| private void addBirthDayMsgModelItem(Map<String, String> tenantOfSignature, IdWorker idWorker, WxMall wxMall, EnumMsgModel msgModel, String content) { | |||||
| private void addBirthDayMsgModelItem(IdWorker idWorker, WxMall wxMall, EnumMsgModel msgModel, String content) { | |||||
| WxMsgValidationcodeModel model = new WxMsgValidationcodeModel(); | WxMsgValidationcodeModel model = new WxMsgValidationcodeModel(); | ||||
| model.setTenantId(wxMall.getTenantId()); | model.setTenantId(wxMall.getTenantId()); | ||||
| model.setId(idWorker.nextId()); | model.setId(idWorker.nextId()); | ||||
| model.setType(msgModel.getCode()); | model.setType(msgModel.getCode()); | ||||
| model.setName(msgModel.getMessage()); | model.setName(msgModel.getMessage()); | ||||
| model.setSignature(tenantOfSignature.get(wxMall.getTenantId())); | |||||
| model.setSignature(wxMall.getName()); | |||||
| model.setContent(content); | model.setContent(content); | ||||
| model.setCreatetime(new Date()); | model.setCreatetime(new Date()); | ||||
| model.setStatus(1); | model.setStatus(1); | ||||