Browse Source

客户费用恢复

xyy@163.com 3 months ago
parent
commit
743da384c7

+ 19 - 8
sr-smp-admin/sr-smp-dao/src/main/java/com/sr/smp/nosql/dao/tools/SynDataDtoImpl.java

@@ -4,6 +4,7 @@ import com.sr.smp.contract.dto.bill.FinancialBillDetailDto;
 import com.sr.smp.contract.dto.customer.CustomerFeeSetDto;
 import com.sr.smp.contract.dto.customer.CustomerGroupDto;
 import com.sr.smp.contract.dto.dictionary.CustomerDto;
+import com.sr.smp.contract.dto.feecommon.FeeItemResultDto;
 import com.sr.smp.contract.dto.feecommon.WeightRateModel;
 import com.sr.smp.contract.dto.money.UserMoneyDetailDto;
 import com.sr.smp.contract.dto.period.CustomerBillDto;
@@ -398,14 +399,24 @@ public class SynDataDtoImpl implements SynDataDto {
 
     @Override
     public void recoverCustomerFromHistory() {
-//        CustomerFeeSetHistory customerFeeSetHistory =  proMongoTemplate.findById("1814a6089bcd49fe99ce5e2708eee793", CustomerFeeSetHistory.class);
-//
-//        CustomerFeeSet entity = new CustomerFeeSet();
-//        BeanCopyUtil.copyProperties(customerFeeSetHistory, entity);
-//        if (null != entity) {
-//            entity.setId(customerFeeSetHistory.getFeeSetId());
-//            proMongoTemplate.save(entity);
-//        }
+
+//        Criteria criteria = new Criteria();
+////        //设置查询时间范围
+//        criteria.and("productId").is("JSEUB");
+//        Query query = new Query(criteria);
+//        List<CustomerFeeSetHistory> list = proMongoTemplate.find(query, CustomerFeeSetHistory.class);
+//        Map<String, List<CustomerFeeSetHistory>> customerFeeSetHistoryMap = list.stream().filter(item->null != item.getActiveFlag() && item.getActiveFlag() && StringUtils.isNotEmpty( item.getOperateGroup())).collect(Collectors.groupingBy(p -> p.getOperateGroup()));
+//        customerFeeSetHistoryMap.forEach((key, value) -> {
+//            List<CustomerFeeSetHistory> orderCustomerFeeSetHistory = value.stream().sorted(Comparator.comparing(CustomerFeeSetHistory::getOperateDate, Comparator.reverseOrder())).collect(Collectors.toList());
+//            CustomerFeeSet entity = new CustomerFeeSet();
+//            BeanCopyUtil.copyProperties(orderCustomerFeeSetHistory.get(0), entity);
+//            entity.setId(orderCustomerFeeSetHistory.get(0).getFeeSetId());
+//            CustomerFeeSet dbCustomerFeeSet = proMongoTemplate.findById(entity.getId(),CustomerFeeSet.class);
+//            if(null == dbCustomerFeeSet)
+//            {
+//                proMongoTemplate.save(entity);
+//            }
+//        });
     }
 
 

+ 1 - 0
sr-smp-admin/sr-smp-fee/src/test/java/com/sr/smp/SrSmpFeeApplicationTests.java

@@ -131,6 +131,7 @@ class SrSmpFeeApplicationTests {
 
     @Test
     void recoverCustomerFromHistory() {
+
         synDataDto.recoverCustomerFromHistory();
     }