Subversion Repositories SmartDukaan

Rev

Rev 27221 | Rev 27280 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 27221 Rev 27277
Line 12... Line 12...
12
import java.util.HashSet;
12
import java.util.HashSet;
13
import java.util.List;
13
import java.util.List;
14
import java.util.Map;
14
import java.util.Map;
15
import java.util.Set;
15
import java.util.Set;
16
import java.util.concurrent.TimeUnit;
16
import java.util.concurrent.TimeUnit;
17
import java.util.function.Function;
-
 
18
import java.util.stream.Collectors;
17
import java.util.stream.Collectors;
19
 
18
 
20
import org.apache.commons.io.output.ByteArrayOutputStream;
19
import org.apache.commons.io.output.ByteArrayOutputStream;
21
import org.apache.commons.lang.StringUtils;
20
import org.apache.commons.lang.StringUtils;
22
import org.apache.logging.log4j.LogManager;
21
import org.apache.logging.log4j.LogManager;
Line 127... Line 126...
127
	@Autowired
126
	@Autowired
128
	private LineItemRepository lineItemRepository;
127
	private LineItemRepository lineItemRepository;
129
 
128
 
130
	@Autowired
129
	@Autowired
131
	private LeadRepository leadRepository;
130
	private LeadRepository leadRepository;
132
	
131
 
133
	@Autowired
132
	@Autowired
134
	private PurchaseReturnItemRepository purchaseReturnItemRepository;
133
	private PurchaseReturnItemRepository purchaseReturnItemRepository;
135
 
134
 
136
	@Autowired
135
	@Autowired
137
	private SaholicInventorySnapshotRepository saholicInventorySnapshotRepository;
136
	private SaholicInventorySnapshotRepository saholicInventorySnapshotRepository;
Line 958... Line 957...
958
		}
957
		}
959
 
958
 
960
	}
959
	}
961
 
960
 
962
	public void printPendingLeads() {
961
	public void printPendingLeads() {
-
 
962
		LOGGER.info("PENDING LEADES {}", leadRepository
963
		LOGGER.info("PENDING LEADES {}", leadRepository.selectLeadsScheduledBetweenDate(LocalDateTime.now().minusDays(15),
963
				.selectLeadsScheduledBetweenDate(LocalDateTime.now().minusDays(15), LocalDateTime.now().plusHours(4)));
-
 
964
	}
-
 
965
 
-
 
966
	public void removeDuplicateOrders() {
-
 
967
		List<String> invoiceNumbers = Arrays.asList("DLWE066/1108", "DLWE066/299", "DLWE066/348", "HRFB004/242",
-
 
968
				"HRFB004/243", "HRFB004/514", "HRFTB155/29", "HRJND076/1146", "HRJND076/966", "HRKA134/295",
-
 
969
				"HRKA134/421", "HRKK091/381", "HRMGH106/576", "HRSP056/139", "HRYN030/103", "UPGZ019/395",
-
 
970
				"UPHRD130/1299", "UPHRD130/456", "UPHRD130/634", "UPLKO063/897", "UPMRT149/54", "UPSJP119/748",
-
 
971
				"UPSJP119/980", "UPSTP065/1218", "UPSTP065/2039", "UPSTP090/437", "UPSTP120/164");
-
 
972
		
-
 
973
		for(String invoiceNumber : invoiceNumbers) {
-
 
974
			List<Order> orders = orderRepository.selectByInvoiceNumber(invoiceNumber);
-
 
975
			orders.stream().forEach(x->{
-
 
976
				List<UserWalletHistory> userWalletHistory = userWalletHistoryRepository.selectAllByreferenceIdandreferenceType(x.getId(), WalletReferenceType.SCHEME_OUT);
-
 
977
				int totalAmount = userWalletHistory.stream().collect(Collectors.summingInt(y->y.getAmount()));
-
 
978
				LOGGER.info("Order id {}, Amount {}", x.getId(), totalAmount);
964
				LocalDateTime.now().plusHours(4)));
979
				//Rollback entry with reversal reason
-
 
980
				//Remove order id
-
 
981
				//Remove order item Id
-
 
982
				//Remove lineitem id
-
 
983
			});
-
 
984
		}
965
	}
985
	}
966
}
986
}
967
 
987
 
968
//7015845171
988
//7015845171
969
989