|
@@ -21,6 +21,7 @@ import com.ym.mec.common.service.impl.BaseServiceImpl;
|
|
|
import com.ym.mec.common.tenant.TenantContextHolder;
|
|
|
import com.ym.mec.util.collection.MapUtil;
|
|
|
import com.ym.mec.util.date.DateUtil;
|
|
|
+import com.ym.mec.util.web.EParallelStream;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -402,67 +403,109 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
|
|
|
public void syncOperation(String startDate1,String endDate1,List<Integer> arrayList,Integer tenantId,List<IndexBaseDto> indexBaseDtoList,Map<IndexDataType, List<IndexBaseMonthData>> typeDateMap){
|
|
|
// System.out.println(System.currentTimeMillis());
|
|
|
List<Organization> organs = organizationService.findOrgans(arrayList, tenantId);
|
|
|
- CompletableFuture future1 = this.async(() -> {
|
|
|
-// long l = System.currentTimeMillis();
|
|
|
- List<IndexBaseMonthData> renew = indexBaseMonthDataDao.getOrganTotalAmountDataWithTimelyDetails(startDate1, endDate1, arrayList, "RENEW", null, tenantId);
|
|
|
- indexBaseDtoList.add(this.getIndexBaseDto(ORGAN_RENEW_AMOUNT,renew,organs));
|
|
|
- List<IndexBaseMonthData> details = indexBaseMonthDataDao.getOrganVipAmountDataWithTimelyDetails(startDate1, endDate1, arrayList, tenantId);
|
|
|
- indexBaseDtoList.add(this.getIndexBaseDto(ORGAN_VIP_AMOUNT,details,organs));
|
|
|
-// System.out.println("Thread.currentThread :" + Thread.currentThread() + "---" + (System.currentTimeMillis() - l));
|
|
|
- });
|
|
|
- CompletableFuture future2 = this.async(() -> {
|
|
|
-// long l = System.currentTimeMillis();
|
|
|
- List<IndexBaseMonthData> data = indexBaseMonthDataDao.getOrganTotalAmountDataWithTimelyDetails(startDate1, endDate1, arrayList, "PRACTICE_GROUP_BUY,PRACTICE_GROUP_RENEW", null, tenantId);
|
|
|
- indexBaseDtoList.add(this.getIndexBaseDto(ORGAN_PRACTICE_AMOUNT,data,organs));
|
|
|
- List<IndexBaseMonthData> details = indexBaseMonthDataDao.getOrganOtherAmountDataWithTimelyDetails(startDate1, endDate1, arrayList, tenantId);
|
|
|
- indexBaseDtoList.add(this.getIndexBaseDto(ORGAN_OTHER_AMOUNT,details,organs));
|
|
|
-// System.out.println("Thread.currentThread :" + Thread.currentThread() + "---" + (System.currentTimeMillis() - l));
|
|
|
- });
|
|
|
- CompletableFuture future6 = this.async(()->{
|
|
|
-// long l = System.currentTimeMillis();
|
|
|
- List<IndexBaseMonthData> renewAmount = indexBaseMonthDataDao.getTotalAmountDataWithTimelyDetails(startDate1, endDate1, arrayList,"RENEW",null,tenantId);
|
|
|
- typeDateMap.put(RENEW_AMOUNT,renewAmount);
|
|
|
- List<IndexBaseMonthData> vipAmount = indexBaseMonthDataDao.getVipAmountDataWithTimelyDetails(startDate1, endDate1, arrayList,tenantId);
|
|
|
- typeDateMap.put(VIP_AMOUNT,vipAmount);
|
|
|
-// System.out.println("Thread.currentThread :" + Thread.currentThread() + "---" + (System.currentTimeMillis() - l));
|
|
|
- });
|
|
|
- CompletableFuture future8 = this.async(()->{
|
|
|
-// long l = System.currentTimeMillis();
|
|
|
- typeDateMap.put(PRACTICE_AMOUNT,indexBaseMonthDataDao.getTotalAmountDataWithTimelyDetails(startDate1, endDate1, arrayList,"PRACTICE_GROUP_BUY,PRACTICE_GROUP_RENEW",null,tenantId));
|
|
|
- typeDateMap.put(OTHER_AMOUNT,indexBaseMonthDataDao.getOtherAmountDataWithTimelyDetails(startDate1, endDate1, arrayList,tenantId));
|
|
|
-// System.out.println("Thread.currentThread :" + Thread.currentThread() + "---" + (System.currentTimeMillis() - l));
|
|
|
- });
|
|
|
- CompletableFuture future3 = this.async(() -> {
|
|
|
-// long l = System.currentTimeMillis();
|
|
|
- List<IndexBaseMonthData> details = indexBaseMonthDataDao.getOrganTotalAmountDataWithTimely(startDate1, endDate1, arrayList, tenantId);
|
|
|
- indexBaseDtoList.add(this.getIndexBaseDto(IndexDataType.ORGAN_TOTAL_AMOUNT,details,organs));
|
|
|
- List<IndexBaseMonthData> apply = indexBaseMonthDataDao.getOrganTotalAmountDataWithTimelyDetails(startDate1, endDate1, arrayList, "APPLY,ADD_STUDENT", null, tenantId);
|
|
|
- indexBaseDtoList.add(this.getIndexBaseDto(ORGAN_APPLY_AMOUNT,apply,organs));
|
|
|
-// System.out.println("Thread.currentThread :" + Thread.currentThread() + "---" + (System.currentTimeMillis() - l));
|
|
|
- });
|
|
|
- CompletableFuture future4 = this.async(() -> {
|
|
|
-// long l = System.currentTimeMillis();
|
|
|
- indexBaseDtoList.add(this.getIndexBaseDto(IndexDataType.ORGAN_FINANCE_BALANCE_AMOUNT,indexBaseMonthDataDao.getOrganFinanceBalanceDataWithTimely(startDate1, endDate1, arrayList,tenantId),organs));
|
|
|
- indexBaseDtoList.add(this.getIndexBaseDto(ORGAN_FINANCE_AMOUNT,indexBaseMonthDataDao.getOrganFinanceActualDataWithTimely(startDate1, endDate1, arrayList,tenantId),organs));
|
|
|
-// System.out.println("Thread.currentThread :" + Thread.currentThread() + "---" + (System.currentTimeMillis() - l));
|
|
|
+ EParallelStream.getParallelStream().forEach(data->{
|
|
|
+ switch (data) {
|
|
|
+ case P1:
|
|
|
+ {
|
|
|
+ List<IndexBaseMonthData> renew = indexBaseMonthDataDao.getOrganTotalAmountDataWithTimelyDetails(startDate1, endDate1, arrayList, "RENEW", null, tenantId);
|
|
|
+ indexBaseDtoList.add(this.getIndexBaseDto(ORGAN_RENEW_AMOUNT,renew,organs));
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case P2:
|
|
|
+ {
|
|
|
+ List<IndexBaseMonthData> details = indexBaseMonthDataDao.getOrganVipAmountDataWithTimelyDetails(startDate1, endDate1, arrayList, tenantId);
|
|
|
+ indexBaseDtoList.add(this.getIndexBaseDto(ORGAN_VIP_AMOUNT,details,organs));
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case P3:
|
|
|
+ {
|
|
|
+ List<IndexBaseMonthData> details = indexBaseMonthDataDao.getOrganTotalAmountDataWithTimelyDetails(startDate1, endDate1, arrayList, "PRACTICE_GROUP_BUY,PRACTICE_GROUP_RENEW", null, tenantId);
|
|
|
+ indexBaseDtoList.add(this.getIndexBaseDto(ORGAN_PRACTICE_AMOUNT,details,organs));
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case P4:
|
|
|
+ {
|
|
|
+ List<IndexBaseMonthData> details = indexBaseMonthDataDao.getOrganOtherAmountDataWithTimelyDetails(startDate1, endDate1, arrayList, tenantId);
|
|
|
+ indexBaseDtoList.add(this.getIndexBaseDto(ORGAN_OTHER_AMOUNT,details,organs));
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case P5:
|
|
|
+ {
|
|
|
+ List<IndexBaseMonthData> renewAmount = indexBaseMonthDataDao.getTotalAmountDataWithTimelyDetails(startDate1, endDate1, arrayList,"RENEW",null,tenantId);
|
|
|
+ typeDateMap.put(RENEW_AMOUNT,renewAmount);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case P6:
|
|
|
+ {
|
|
|
+ List<IndexBaseMonthData> vipAmount = indexBaseMonthDataDao.getVipAmountDataWithTimelyDetails(startDate1, endDate1, arrayList,tenantId);
|
|
|
+ typeDateMap.put(VIP_AMOUNT,vipAmount);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case P7:
|
|
|
+ {
|
|
|
+ typeDateMap.put(PRACTICE_AMOUNT,indexBaseMonthDataDao.getTotalAmountDataWithTimelyDetails(startDate1, endDate1, arrayList,"PRACTICE_GROUP_BUY,PRACTICE_GROUP_RENEW",null,tenantId));
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case P8:
|
|
|
+ {
|
|
|
+ typeDateMap.put(OTHER_AMOUNT,indexBaseMonthDataDao.getOtherAmountDataWithTimelyDetails(startDate1, endDate1, arrayList,tenantId));
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case P9:
|
|
|
+ {
|
|
|
+ List<IndexBaseMonthData> details = indexBaseMonthDataDao.getOrganTotalAmountDataWithTimely(startDate1, endDate1, arrayList, tenantId);
|
|
|
+ indexBaseDtoList.add(this.getIndexBaseDto(IndexDataType.ORGAN_TOTAL_AMOUNT,details,organs));
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case P10:
|
|
|
+ {
|
|
|
+ List<IndexBaseMonthData> apply = indexBaseMonthDataDao.getOrganTotalAmountDataWithTimelyDetails(startDate1, endDate1, arrayList, "APPLY,ADD_STUDENT", null, tenantId);
|
|
|
+ indexBaseDtoList.add(this.getIndexBaseDto(ORGAN_APPLY_AMOUNT,apply,organs));
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case P11:
|
|
|
+ {
|
|
|
+ indexBaseDtoList.add(this.getIndexBaseDto(IndexDataType.ORGAN_FINANCE_BALANCE_AMOUNT,indexBaseMonthDataDao.getOrganFinanceBalanceDataWithTimely(startDate1, endDate1, arrayList,tenantId),organs));
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case P12:
|
|
|
+ {
|
|
|
+ indexBaseDtoList.add(this.getIndexBaseDto(ORGAN_FINANCE_AMOUNT,indexBaseMonthDataDao.getOrganFinanceActualDataWithTimely(startDate1, endDate1, arrayList,tenantId),organs));
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case P13:
|
|
|
+ {
|
|
|
+ typeDateMap.put(IndexDataType.FINANCE_BALANCE_AMOUNT,indexBaseMonthDataDao.getFinanceBalanceDataWithTimely(startDate1, endDate1, arrayList,tenantId));
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case P14:
|
|
|
+ {
|
|
|
+ typeDateMap.put(FINANCE_AMOUNT,indexBaseMonthDataDao.getFinanceActualDataWithTimely(startDate1, endDate1, arrayList,tenantId));
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case P15:
|
|
|
+ {
|
|
|
+ typeDateMap.put(APPLY_AMOUNT,indexBaseMonthDataDao.getTotalAmountDataWithTimelyDetails(startDate1, endDate1, arrayList,"APPLY,ADD_STUDENT",null,tenantId));
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case P16:
|
|
|
+ {
|
|
|
+ typeDateMap.put(IndexDataType.TOTAL_AMOUNT,indexBaseMonthDataDao.getTotalAmountDataWithTimely(startDate1, endDate1, arrayList,tenantId));
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
});
|
|
|
|
|
|
- CompletableFuture future5 = this.async(()->{
|
|
|
-// long l = System.currentTimeMillis();
|
|
|
- typeDateMap.put(IndexDataType.FINANCE_BALANCE_AMOUNT,indexBaseMonthDataDao.getFinanceBalanceDataWithTimely(startDate1, endDate1, arrayList,tenantId));
|
|
|
- typeDateMap.put(FINANCE_AMOUNT,indexBaseMonthDataDao.getFinanceActualDataWithTimely(startDate1, endDate1, arrayList,tenantId));
|
|
|
-// System.out.println("Thread.currentThread :" + Thread.currentThread() + "---" + (System.currentTimeMillis() - l));
|
|
|
- });
|
|
|
- CompletableFuture future7 = this.async(()->{
|
|
|
-// long l = System.currentTimeMillis();
|
|
|
+/* CompletableFuture future7 = this.async(()->{
|
|
|
+ long l = System.currentTimeMillis();
|
|
|
typeDateMap.put(IndexDataType.TOTAL_AMOUNT,indexBaseMonthDataDao.getTotalAmountDataWithTimely(startDate1, endDate1, arrayList,tenantId));
|
|
|
typeDateMap.put(APPLY_AMOUNT,indexBaseMonthDataDao.getTotalAmountDataWithTimelyDetails(startDate1, endDate1, arrayList,"APPLY,ADD_STUDENT",null,tenantId));
|
|
|
-// System.out.println("Thread.currentThread :" + Thread.currentThread() + "---" + (System.currentTimeMillis() - l));
|
|
|
+ System.out.println("Thread.currentThread :" + Thread.currentThread() + "---" + (System.currentTimeMillis() - l));
|
|
|
});
|
|
|
-// System.out.println(System.currentTimeMillis());
|
|
|
+ System.out.println(System.currentTimeMillis());
|
|
|
CompletableFuture<Void> allFutures = CompletableFuture.allOf(future1, future2, future3, future4, future5, future6, future7, future8);
|
|
|
allFutures.join();
|
|
|
-// System.out.println(System.currentTimeMillis());
|
|
|
+ System.out.println(System.currentTimeMillis());*/
|
|
|
}
|
|
|
|
|
|
@Override
|