phi_platform_user/src/main/java/com/hx/phip/controller/userompleteInfo/UserCompleteInfoController.java
@@ -177,12 +177,14 @@ userInfoMap.put("isExitsChannel", 0); } //20231207 mot扫码判断用户是否有渠道,有渠道或有来源名称则不修改 if(StringUtils.isEmpty(user.getChannelType()) && StringUtils.isEmpty(user.getChannelType2()) && StringUtils.isEmpty(sourceName)){ userInfoMap.put("isShowChannel", 0); }else { userInfoMap.put("isShowChannel", 1); if(StringUtils.isEmpty(sourceName)){ userInfoMap.put("souceOther", user.getChannelType()+"-"+user.getChannelType2()); userInfoMap.put("sourceName", "其他"); } } JSONObject data = new JSONObject(); phi_platform_user/src/main/java/com/hx/phip/service/impl/UserIntegralRecordServiceImpl.java
@@ -177,12 +177,12 @@ // 判断使用的数量是否大于记录可以使用积分数量 if (opNumber.compareTo(userIntegralRecord.getNotUsedQuantity()) >= 0) { // 操作减扣积分数量 operatorUserIntegralRecord(userIntegralRecord, userIntegralRecord.getNotUsedQuantity().negate(), userMoneyUnclaimed); operatorUserIntegralRecord(userIntegralRecord, userIntegralRecord.getNotUsedQuantity().negate(), userMoneyUnclaimed, BaseEntity.NO); // 操作使用积分 opNumber = opNumber.subtract(userIntegralRecord.getNotUsedQuantity()); } else { // 操作减扣积分数量 operatorUserIntegralRecord(userIntegralRecord, opNumber.negate(), userMoneyUnclaimed); operatorUserIntegralRecord(userIntegralRecord, opNumber.negate(), userMoneyUnclaimed, BaseEntity.NO); // 操作使用积分 opNumber = BigDecimal.ZERO; } @@ -275,14 +275,14 @@ // 判断在有效期的操作逻辑 if (userIntegralRecord.getLimitStartTime().getTime() <= nowDate.getTime() && userIntegralRecord.getLimitEndTime().getTime() > nowDate.getTime()) { // 操作回退积分数量 在有效期不用增加新的积分记录 operatorUserIntegralRecord(userIntegralRecord, residueNumber, userMoneyUnclaimed); operatorUserIntegralRecord(userIntegralRecord, residueNumber, userMoneyUnclaimed, BaseEntity.NO); // 数量累计 不需要再添加记录的 noRecordNumber = noRecordNumber.add(residueNumber); } // 不在有效期的回退逻辑 if (userIntegralRecord.getLimitEndTime().getTime() <= nowDate.getTime()) { else if (userIntegralRecord.getLimitEndTime().getTime() <= nowDate.getTime()) { // 操作回退积分数量 不在有效期不用增加新的积分记录 直接让积分过期了 operatorUserIntegralRecord(userIntegralRecord, residueNumber, userMoneyUnclaimed); operatorUserIntegralRecord(userIntegralRecord, residueNumber, userMoneyUnclaimed, BaseEntity.YES); // 数量累计 过期积分直接清除的 noBackNumber = noBackNumber.add(residueNumber); } @@ -351,8 +351,9 @@ * @param userIntegralRecord 用户积分记录 * @param opNumber 操作金额 * @param userMoneyUnclaimed 待领取资产列表 * @param isExpire 是否过期 0 否 1 是 */ private void operatorUserIntegralRecord(UserIntegralRecord userIntegralRecord, BigDecimal opNumber, UserMoneyUnclaimed userMoneyUnclaimed) { private void operatorUserIntegralRecord(UserIntegralRecord userIntegralRecord, BigDecimal opNumber, UserMoneyUnclaimed userMoneyUnclaimed, int isExpire) { SqlSentence sqlSentence = new SqlSentence(); Map<String, Object> sqlValue = new HashMap<>(); sqlValue.put("isDel", BaseEntity.NO); @@ -364,7 +365,11 @@ BigDecimal opAfterNumber = userIntegralRecord.getNotUsedQuantity().subtract(opNumber.negate()); // 判断是减扣还是回退 正数是回退 负数是使用 sql.append(" notUsedQuantity=notUsedQuantity+#{m.opNumber},usedQuantity = usedQuantity-#{m.opNumber} "); sql.append(" WHERE id = #{m.id} AND userId = #{m.userId} AND isDel = #{m.isDel}"); // 过期处理下过期时间 if (BaseEntity.YES.equals(isExpire)){ sql.append(" ,expirationTime = NOW() "); } sql.append(" WHERE id = #{m.id} AND userId = #{m.userId} AND isDel = #{m.isDel} "); sqlSentence.sqlSentence(sql.toString(), sqlValue); int count = commonService.updateWhere(UserIntegralRecordMapper.class, sqlSentence); if (count != 1) { phi_platform_user/src/main/java/com/hx/phip/service/impl/UserServiceImpl.java
@@ -3828,7 +3828,7 @@ //生育 growthType.setTypeNo("LT20230921QnaLns"); if(userInfoCompleteDto.getGrowthTypeName().equals("已育")){ if(!StringUtils.isEmpty(userInfoCompleteDto.getGrowthTypeName()) && userInfoCompleteDto.getGrowthTypeName().equals("已育")){ growthType.setTagNo("LA20230921TgcoAc"); }else { growthType.setTagNo("LA20230921HWZNLS"); phi_platform_user/src/main/java/com/hx/phip/service/impl/UserValueAddedFundRecordServiceImpl.java
@@ -206,12 +206,12 @@ // 判断使用的金额是否大于记录可以使用增值金金额 if (opNumber.compareTo(userValueAddedFundRecord.getNotUsedAmount()) >= 0) { // 操作减扣增值金数量 operatorUserValueAddedFundRecord(userValueAddedFundRecord, userValueAddedFundRecord.getNotUsedAmount().negate(), userMoneyUnclaimed); operatorUserValueAddedFundRecord(userValueAddedFundRecord, userValueAddedFundRecord.getNotUsedAmount().negate(), userMoneyUnclaimed, BaseEntity.NO); // 操作使用增值金 opNumber = opNumber.subtract(userValueAddedFundRecord.getNotUsedAmount()); } else { // 操作减扣增值金数量 operatorUserValueAddedFundRecord(userValueAddedFundRecord, opNumber.negate(), userMoneyUnclaimed); operatorUserValueAddedFundRecord(userValueAddedFundRecord, opNumber.negate(), userMoneyUnclaimed, BaseEntity.NO); // 操作使用增值金 opNumber = BigDecimal.ZERO; } @@ -305,14 +305,14 @@ // 判断在有效期的操作逻辑 在有效期不用增加新的增值金记录 if (userValueAddedFundRecord.getLimitStartTime().getTime() <= nowDate.getTime() && userValueAddedFundRecord.getLimitEndTime().getTime() > nowDate.getTime()) { // 操作回退增值金数量 不需要再添加记录的 operatorUserValueAddedFundRecord(userValueAddedFundRecord, residueNumber, userMoneyUnclaimed); operatorUserValueAddedFundRecord(userValueAddedFundRecord, residueNumber, userMoneyUnclaimed, BaseEntity.NO); // 数量累计 不需要再添加记录的 noRecordNumber = noRecordNumber.add(residueNumber); } // 不在有效期的回退逻辑 else if (userValueAddedFundRecord.getLimitEndTime().getTime() <= nowDate.getTime()) { // 操作回退增值金数量 不在有效期不用增加新的增值金记录 直接让增值金过期了 operatorUserValueAddedFundRecord(userValueAddedFundRecord, residueNumber, userMoneyUnclaimed); operatorUserValueAddedFundRecord(userValueAddedFundRecord, residueNumber, userMoneyUnclaimed, BaseEntity.YES); // 数量累计 过期增值金直接清除的 noBackNumber = noBackNumber.add(residueNumber); } @@ -381,8 +381,9 @@ * @param userValueAddedFundRecord 用户增值金记录 * @param opNumber 操作金额 * @param userMoneyUnclaimed 待领取资产列表 * @param isExpire 是否过期 0 否 1 是 */ private void operatorUserValueAddedFundRecord(UserValueAddedFundRecord userValueAddedFundRecord, BigDecimal opNumber, UserMoneyUnclaimed userMoneyUnclaimed) { private void operatorUserValueAddedFundRecord(UserValueAddedFundRecord userValueAddedFundRecord, BigDecimal opNumber, UserMoneyUnclaimed userMoneyUnclaimed, int isExpire) { SqlSentence sqlSentence = new SqlSentence(); Map<String, Object> sqlValue = new HashMap<>(); sqlValue.put("isDel", BaseEntity.NO); @@ -394,6 +395,10 @@ BigDecimal opAfterNumber = userValueAddedFundRecord.getNotUsedAmount().subtract(opNumber.negate()); // 判断是减扣还是回退 正数是回退 负数是使用 sql.append(" notUsedAmount=notUsedAmount+#{m.opNumber},usedAmount = usedAmount-#{m.opNumber} "); // 过期处理下过期时间 if (BaseEntity.YES.equals(isExpire)){ sql.append(" ,expirationTime = NOW() "); } sql.append(" WHERE isDel = #{m.isDel} AND id = #{m.id} AND userId = #{m.userId}"); sqlSentence.sqlSentence(sql.toString(), sqlValue); int count = commonService.updateWhere(UserValueAddedFundRecordMapper.class, sqlSentence); phi_platform_user/src/main/java/com/hx/phip/service/order/impl/OrderRefundServiceImpl.java
@@ -413,6 +413,10 @@ DistributionRedundVo distributionRedundVo; OrderItem orderItem; //子单的支付方式 List<OrderPayMethodDto> refundPayMethodItemList; OrderPayMethodDto refundPayMethodItem; //计算每个条目需要退多少钱 for (OrderItemRefundDto orderItemRefundDto : refundList) { if(StringUtils.isEmpty(orderItemRefundDto.getOrderItemId())){ @@ -425,6 +429,7 @@ if(!orderItem.getOrderId().equals(ordersTotal.getId())){ throw new PlatTipsException(PlatformCode.ERROR_TIPS,"未找到退款项[012]"); } refundPayMethodItemList = new ArrayList<>(); //判断这个项目能不能显示处理 switch (orderItem.getType()) { @@ -470,7 +475,12 @@ orderPayMethodDto = orderPayMethodDtoMap.computeIfAbsent(refundPaymentMethodVo.getNumberNo(), k->new OrderPayMethodDto(refundPaymentMethodVo.getNumberNo(),refundPaymentMethodVo.getName(),BigDecimal.ZERO,refundPaymentMethodVo.getIsMoneyPay(),refundPaymentMethodVo.getIsExecute())); orderPayMethodDto.setPayTotal(orderPayMethodDto.getPayTotal().add(refundPaymentMethodVo.getRefundTotal()).setScale(2,RoundingMode.HALF_UP)); //子单的支付方式 refundPayMethodItem = new OrderPayMethodDto(refundPaymentMethodVo.getNumberNo(),refundPaymentMethodVo.getName(),refundPaymentMethodVo.getRefundTotal(),refundPaymentMethodVo.getIsMoneyPay(),refundPaymentMethodVo.getIsExecute()); refundPayMethodItemList.add(refundPayMethodItem); } orderItemRefundDto.setRefundPayMethodList(refundPayMethodItemList); } for(Map.Entry<String, OrderPayMethodDto> entry : orderPayMethodDtoMap.entrySet()) { @@ -701,6 +711,10 @@ Map<String,DistributionRedundMethodVo> refundPaymentMethodVoMap = new HashMap<>(); DistributionRedundMethodVo refundPaymentMethodVo; //子单的支付方式 List<OrderPayMethodDto> refundPayMethodItemList; OrderPayMethodDto refundPayMethodItem; DistributionRedundVo distributionRedundVoSon; for (OrderItemSourceRefundDto orderItemSourceRefundDto : orderItemSourceRefundDtos) { if(StringUtils.isEmpty(orderItemSourceRefundDto.getOrderItemSonId())){ @@ -715,6 +729,8 @@ if (!orderItemSon.getOrderItemId().equals(orderItem.getId())) { throw new PlatTipsException(PlatformCode.ERROR_TIPS,"未找到退款项[54]"); } refundPayMethodItemList = new ArrayList<>(); switch (orderItemSon.getType()) { case OrderGoodsConstants.TYPE_PROJECT: @@ -748,8 +764,12 @@ refundPaymentMethodVo = refundPaymentMethodVoMap.computeIfAbsent(paymentMethodVo.getNumberNo() ,k-> new DistributionRedundMethodVo(paymentMethodVo.getNumberNo(),paymentMethodVo.getName(),BigDecimal.ZERO,paymentMethodVo.getIsMoneyPay(),paymentMethodVo.getIsExecute())); refundPaymentMethodVo.setRefundTotal(refundPaymentMethodVo.getRefundTotal().add(paymentMethodVo.getRefundTotal()).setScale(2,RoundingMode.HALF_UP)); } //子单的支付方式 refundPayMethodItem = new OrderPayMethodDto(paymentMethodVo.getNumberNo(),paymentMethodVo.getName(),paymentMethodVo.getRefundTotal(),paymentMethodVo.getIsMoneyPay(),paymentMethodVo.getIsExecute()); refundPayMethodItemList.add(refundPayMethodItem); } orderItemSourceRefundDto.setRefundPayMethodList(refundPayMethodItemList); } //返回结构数据填充 @@ -1501,6 +1521,19 @@ throw new TipsException("退款积分分配错误[01]!"); } //客户退款的支付方式,后面的校验会用到的 Set<String> payMonthNoSet = new HashSet<>(); for(OrderPayMethodDto orderPayMethodDto:orderRefundDto.getRefundPayMethod()){ if(orderPayMethodDto.getMoney().compareTo(BigDecimal.ZERO) < 1){ continue; } //积分的也跳出 if(PayMethodTypeConstants.PAY_INTEGRAL.equals(orderPayMethodDto.getPayMethodNo())){ continue; } payMonthNoSet.add(orderPayMethodDto.getPayMethodNo()); } //-----退款金额处理 //计算金额占比,客户选择退款总金额和可退总金额占比 if(orderRefundDto.getTotalAmount().compareTo(BigDecimal.ZERO) < 1){ @@ -1515,6 +1548,7 @@ /////引用参数 RefundRecordItem refundRecordItem; OrderItem orderItem; BigDecimal payMonthTotal; for(int i = 0;i < refundList.size();i++){ orderItemRefundDto = refundList.get(i); @@ -1563,6 +1597,16 @@ if(refundRecordItem.getRefundMoney().compareTo(refundTotal) > 0){ refundRecordItem.setRefundMoney(refundTotal); } //重点,这里还是要校验一下和支付总额是否对得上 payMonthTotal = BigDecimal.ZERO; for(OrderPayMethodDto orderPayMethodDto:orderItemRefundDto.getRefundPayMethodList()){ if(payMonthNoSet.contains(orderPayMethodDto.getPayMethodNo())){ payMonthTotal = payMonthTotal.add(orderPayMethodDto.getPayTotal()); } } if(refundRecordItem.getRefundMoney().compareTo(payMonthTotal) > 0){ refundRecordItem.setRefundMoney(payMonthTotal); } refundRecordItem.setRealRefundNum(refundRecordItem.getRefundNum()); refundRecordItem.setRealRefundTotal(refundRecordItem.getRefundMoney()); @@ -1579,7 +1623,7 @@ if(PartialRefundUtil.CONTAIN_SON_TYPE_SET.contains(orderItem.getType())){ //子单子项处理 insertRefundRecordItemTwo(refundRecordItem,refundRecord,orderItemRefundDto.getOrderItemSourceRefundDtos()); insertRefundRecordItemTwo(refundRecordItem,refundRecord,orderItemRefundDto.getOrderItemSourceRefundDtos(),payMonthNoSet); } //虚拟商品退款时需校验一下,对应关联的优惠券码有没有被使用或 if(OrderItemConstants.TYPE_COUPON.equals(orderItem.getType())){ @@ -1595,7 +1639,7 @@ } /**二级子单处理*/ public void insertRefundRecordItemTwo(RefundRecordItem recordItem,RefundRecord refundRecord,List<OrderItemSourceRefundDto> orderItemSourceRefundDtos){ public void insertRefundRecordItemTwo(RefundRecordItem recordItem,RefundRecord refundRecord,List<OrderItemSourceRefundDto> orderItemSourceRefundDtos,Set<String> payMonthNoSet){ if(orderItemSourceRefundDtos == null || orderItemSourceRefundDtos.size() == 0){ return; } @@ -1649,6 +1693,7 @@ BigDecimal refundTotal = recordItem.getRefundMoney(); OrderItemSon orderItemSon; RefundRecordItemSource refundRecordItemSource; BigDecimal payMonthTotal; for(int i = 0;i<orderItemSourceRefundDtos.size();i++){ orderItemSourceRefundDto = orderItemSourceRefundDtos.get(i); @@ -1693,6 +1738,16 @@ if(refundRecordItemSource.getRefundMoney().compareTo(refundTotal) > 0){ refundRecordItemSource.setRefundMoney(refundTotal); } //重点,这里还是要校验一下和支付总额是否对得上 payMonthTotal = BigDecimal.ZERO; for(OrderPayMethodDto orderPayMethodDto:orderItemSourceRefundDto.getRefundPayMethodList()){ if(payMonthNoSet.contains(orderPayMethodDto.getPayMethodNo())){ payMonthTotal = payMonthTotal.add(orderPayMethodDto.getPayTotal()); } } if(refundRecordItemSource.getRefundMoney().compareTo(payMonthTotal) > 0){ refundRecordItemSource.setRefundMoney(payMonthTotal); } refundRecordItemSource.setRealRefundNum(refundRecordItemSource.getRefundNum()); refundRecordItemSource.setRealRefundTotal(refundRecordItemSource.getRefundMoney());