Subversion Repositories SmartDukaan

Rev

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

Rev 25093 Rev 25250
Line 9... Line 9...
9
import java.util.stream.Collectors;
9
import java.util.stream.Collectors;
10
 
10
 
11
import javax.mail.internet.InternetAddress;
11
import javax.mail.internet.InternetAddress;
12
import javax.mail.internet.MimeMessage;
12
import javax.mail.internet.MimeMessage;
13
import javax.servlet.http.HttpServletRequest;
13
import javax.servlet.http.HttpServletRequest;
-
 
14
import javax.transaction.Transactional;
14
 
15
 
15
import org.apache.logging.log4j.LogManager;
16
import org.apache.logging.log4j.LogManager;
16
import org.apache.logging.log4j.Logger;
17
import org.apache.logging.log4j.Logger;
17
import org.json.JSONObject;
18
import org.json.JSONObject;
18
import org.springframework.beans.factory.annotation.Autowired;
19
import org.springframework.beans.factory.annotation.Autowired;
19
import org.springframework.mail.javamail.JavaMailSender;
20
import org.springframework.mail.javamail.JavaMailSender;
20
import org.springframework.mail.javamail.MimeMessageHelper;
21
import org.springframework.mail.javamail.MimeMessageHelper;
21
import org.springframework.stereotype.Controller;
22
import org.springframework.stereotype.Controller;
22
import org.springframework.transaction.annotation.Transactional;
-
 
23
import org.springframework.ui.Model;
23
import org.springframework.ui.Model;
24
import org.springframework.web.bind.annotation.RequestBody;
24
import org.springframework.web.bind.annotation.RequestBody;
25
import org.springframework.web.bind.annotation.RequestMapping;
25
import org.springframework.web.bind.annotation.RequestMapping;
26
import org.springframework.web.bind.annotation.RequestMethod;
26
import org.springframework.web.bind.annotation.RequestMethod;
27
import org.springframework.web.bind.annotation.RequestParam;
27
import org.springframework.web.bind.annotation.RequestParam;
Line 118... Line 118...
118
		 * ProfitMandiBusinessException("Wallet", "Wallet",
118
		 * ProfitMandiBusinessException("Wallet", "Wallet",
119
		 * "Wallet is under Maintenance"); }
119
		 * "Wallet is under Maintenance"); }
120
		 */
120
		 */
121
		LoginDetails fofoDetails = cookiesProcessor.getCookiesObject(request);
121
		LoginDetails fofoDetails = cookiesProcessor.getCookiesObject(request);
122
		boolean isAdmin = roleManager.isAdmin(fofoDetails.getRoleIds());
122
		boolean isAdmin = roleManager.isAdmin(fofoDetails.getRoleIds());
123
		UserWallet userWallet = null;
-
 
124
		try {
-
 
125
			userWallet = userWalletRepository.selectByRetailerId(fofoDetails.getFofoId());
123
		UserWallet userWallet = walletService.getUserWallet(fofoDetails.getFofoId());
126
		} catch (ProfitMandiBusinessException profitMandiBusinessException) {
-
 
127
			LOGGER.error("UserWallet not found : ", profitMandiBusinessException);
-
 
128
			// return "error";
-
 
129
		}
-
 
130
 
124
 
131
		LocalDateTime startDateTime = StringUtils.toDateTime(startTimeString);
125
		LocalDateTime startDateTime = StringUtils.toDateTime(startTimeString);
132
		LocalDateTime endDateTime = StringUtils.toDateTime(endTimeString);
126
		LocalDateTime endDateTime = StringUtils.toDateTime(endTimeString);
133
 
127
 
134
		List<UserWalletHistory> userWalletHistories = new ArrayList<>();
128
		List<UserWalletHistory> userWalletHistories = new ArrayList<>();
Line 649... Line 643...
649
 
643
 
650
		if (!userWalletHistory.isEmpty()) {
644
		if (!userWalletHistory.isEmpty()) {
651
			int WalletId = userWalletHistory.get(0).getWalletId();
645
			int WalletId = userWalletHistory.get(0).getWalletId();
652
			UserWallet user = userWalletRepository.selectById(WalletId);
646
			UserWallet user = userWalletRepository.selectById(WalletId);
653
			if (retailerId != user.getUserId()) {
647
			if (retailerId != user.getUserId()) {
654
				throw new ProfitMandiBusinessException("RefrenceId", reference, "Reference Id assign to Other  partner");
648
				throw new ProfitMandiBusinessException("RefrenceId", reference,
-
 
649
						"Reference Id assign to Other  partner");
655
			}
650
			}
656
			UserWalletHistory history = new UserWalletHistory();
651
			UserWalletHistory history = new UserWalletHistory();
657
			if (TransactionType.CREDIT.equals(transactiontype)) {
652
			if (TransactionType.CREDIT.equals(transactiontype)) {
658
				userWallet.setAmount(userWallet.getAmount() + amount);
653
				userWallet.setAmount(userWallet.getAmount() + amount);
659
				history.setAmount(amount);
654
				history.setAmount(amount);