| 21615 |
kshitij.so |
1 |
package com.spice.profitmandi.web.controller;
|
|
|
2 |
|
| 23568 |
govind |
3 |
import java.io.IOException;
|
|
|
4 |
import java.net.URISyntaxException;
|
| 24288 |
amit.gupta |
5 |
import java.time.DayOfWeek;
|
|
|
6 |
import java.time.LocalDate;
|
| 24276 |
amit.gupta |
7 |
import java.time.LocalDateTime;
|
| 24288 |
amit.gupta |
8 |
import java.time.temporal.TemporalAdjusters;
|
| 24339 |
amit.gupta |
9 |
import java.util.ArrayList;
|
| 23884 |
amit.gupta |
10 |
import java.util.List;
|
| 23568 |
govind |
11 |
|
| 22086 |
amit.gupta |
12 |
import javax.servlet.http.HttpServletRequest;
|
|
|
13 |
|
| 23786 |
amit.gupta |
14 |
import org.apache.logging.log4j.LogManager;
|
| 23568 |
govind |
15 |
import org.apache.logging.log4j.Logger;
|
| 24321 |
amit.gupta |
16 |
import org.json.JSONArray;
|
|
|
17 |
import org.json.JSONObject;
|
| 22481 |
ashik.ali |
18 |
import org.springframework.beans.factory.annotation.Autowired;
|
| 23379 |
ashik.ali |
19 |
import org.springframework.beans.factory.annotation.Value;
|
| 21615 |
kshitij.so |
20 |
import org.springframework.stereotype.Controller;
|
| 22481 |
ashik.ali |
21 |
import org.springframework.transaction.annotation.Transactional;
|
| 22073 |
ashik.ali |
22 |
import org.springframework.ui.Model;
|
| 21615 |
kshitij.so |
23 |
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
24 |
import org.springframework.web.bind.annotation.RequestMethod;
|
| 24098 |
tejbeer |
25 |
import org.springframework.web.bind.annotation.RequestParam;
|
| 21615 |
kshitij.so |
26 |
|
| 22481 |
ashik.ali |
27 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 24203 |
amit.gupta |
28 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
| 24098 |
tejbeer |
29 |
import com.spice.profitmandi.dao.entity.dtr.NotificationData;
|
| 22654 |
ashik.ali |
30 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
| 24288 |
amit.gupta |
31 |
import com.spice.profitmandi.dao.entity.fofo.PartnerDailyInvestment;
|
| 22481 |
ashik.ali |
32 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
| 24098 |
tejbeer |
33 |
import com.spice.profitmandi.dao.repository.dtr.NotificationPanelRepository;
|
| 24203 |
amit.gupta |
34 |
import com.spice.profitmandi.dao.repository.fofo.CurrentInventorySnapshotRepository;
|
| 24288 |
amit.gupta |
35 |
import com.spice.profitmandi.dao.repository.fofo.PartnerDailyInvestmentRepository;
|
| 23884 |
amit.gupta |
36 |
import com.spice.profitmandi.dao.repository.transaction.OrderRepository;
|
| 24336 |
amit.gupta |
37 |
import com.spice.profitmandi.service.PartnerInvestmentService;
|
| 23844 |
amit.gupta |
38 |
import com.spice.profitmandi.service.authentication.RoleManager;
|
| 23884 |
amit.gupta |
39 |
import com.spice.profitmandi.service.inventory.InventoryService;
|
|
|
40 |
import com.spice.profitmandi.service.transaction.TransactionService;
|
|
|
41 |
import com.spice.profitmandi.service.wallet.WalletService;
|
| 22481 |
ashik.ali |
42 |
import com.spice.profitmandi.web.model.LoginDetails;
|
|
|
43 |
import com.spice.profitmandi.web.util.CookiesProcessor;
|
| 24263 |
tejbeer |
44 |
import com.spice.profitmandi.web.util.MVCResponseSender;
|
| 22481 |
ashik.ali |
45 |
|
| 21615 |
kshitij.so |
46 |
@Controller
|
| 22481 |
ashik.ali |
47 |
@Transactional(rollbackFor = Throwable.class)
|
| 21615 |
kshitij.so |
48 |
public class DashboardController {
|
| 23923 |
amit.gupta |
49 |
|
| 23379 |
ashik.ali |
50 |
@Value("${web.api.host}")
|
|
|
51 |
private String webApiHost;
|
| 23923 |
amit.gupta |
52 |
|
| 24072 |
amit.gupta |
53 |
@Value("${web.api.scheme}")
|
|
|
54 |
private String webApiScheme;
|
| 24288 |
amit.gupta |
55 |
|
| 24078 |
amit.gupta |
56 |
@Value("${web.api.root}")
|
|
|
57 |
private String webApiRoot;
|
|
|
58 |
|
| 23379 |
ashik.ali |
59 |
@Value("${web.api.port}")
|
|
|
60 |
private int webApiPort;
|
| 21615 |
kshitij.so |
61 |
|
| 22481 |
ashik.ali |
62 |
@Autowired
|
| 22927 |
ashik.ali |
63 |
private CookiesProcessor cookiesProcessor;
|
| 23923 |
amit.gupta |
64 |
|
| 23568 |
govind |
65 |
@Autowired
|
| 23786 |
amit.gupta |
66 |
private RoleManager roleManager;
|
| 23923 |
amit.gupta |
67 |
|
| 23838 |
ashik.ali |
68 |
@Autowired
|
|
|
69 |
private FofoStoreRepository fofoStoreRepository;
|
| 23884 |
amit.gupta |
70 |
|
|
|
71 |
@Autowired
|
|
|
72 |
private WalletService walletService;
|
| 23923 |
amit.gupta |
73 |
|
| 23884 |
amit.gupta |
74 |
@Autowired
|
|
|
75 |
private InventoryService inventoryService;
|
| 24288 |
amit.gupta |
76 |
|
| 23923 |
amit.gupta |
77 |
|
| 23884 |
amit.gupta |
78 |
@Autowired
|
|
|
79 |
private OrderRepository orderRepository;
|
| 24288 |
amit.gupta |
80 |
|
|
|
81 |
|
|
|
82 |
@Autowired
|
|
|
83 |
private PartnerDailyInvestmentRepository partnerDailyInvestmentRepository;
|
| 24336 |
amit.gupta |
84 |
|
|
|
85 |
@Autowired
|
|
|
86 |
private PartnerInvestmentService partnerInvestmentService;
|
| 24288 |
amit.gupta |
87 |
|
| 23923 |
amit.gupta |
88 |
/*
|
|
|
89 |
* @Autowired private ScanRepository scanRepository;
|
|
|
90 |
*/
|
|
|
91 |
|
| 23884 |
amit.gupta |
92 |
@Autowired
|
|
|
93 |
private TransactionService transactionService;
|
| 24263 |
tejbeer |
94 |
|
| 24098 |
tejbeer |
95 |
@Autowired
|
| 24263 |
tejbeer |
96 |
private MVCResponseSender mvcResponseSender;
|
|
|
97 |
|
|
|
98 |
@Autowired
|
| 24098 |
tejbeer |
99 |
private NotificationPanelRepository notificationPanelRepository;
|
| 23923 |
amit.gupta |
100 |
|
| 24203 |
amit.gupta |
101 |
@Autowired
|
|
|
102 |
private CurrentInventorySnapshotRepository currentInventorySnapshotRepository;
|
|
|
103 |
|
| 23568 |
govind |
104 |
private static final Logger LOGGER = LogManager.getLogger(DashboardController.class);
|
| 23923 |
amit.gupta |
105 |
|
| 21615 |
kshitij.so |
106 |
@RequestMapping(value = "/dashboard", method = RequestMethod.GET)
|
| 24312 |
amit.gupta |
107 |
public String dashboard(HttpServletRequest request, @RequestParam(name = "offset", defaultValue = "0") int offset,
|
| 24098 |
tejbeer |
108 |
@RequestParam(name = "limit", defaultValue = "10") int limit, Model model)
|
| 23923 |
amit.gupta |
109 |
throws ProfitMandiBusinessException, URISyntaxException, IOException {
|
|
|
110 |
// LOGGER.info("scanRepository.selectScansByInventoryItemId(1)",
|
|
|
111 |
// scanRepository.selectScansByInventoryItemId(1));
|
| 23884 |
amit.gupta |
112 |
LOGGER.info("In Dashboard");
|
| 22927 |
ashik.ali |
113 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 23923 |
amit.gupta |
114 |
|
| 22481 |
ashik.ali |
115 |
FofoStore fofoStore = null;
|
|
|
116 |
try {
|
| 22927 |
ashik.ali |
117 |
fofoStore = fofoStoreRepository.selectByRetailerId(loginDetails.getFofoId());
|
| 22481 |
ashik.ali |
118 |
} catch (ProfitMandiBusinessException e) {
|
| 22927 |
ashik.ali |
119 |
LOGGER.error("FofoStore Code not found of fofoId {}", loginDetails.getFofoId());
|
| 22481 |
ashik.ali |
120 |
}
|
| 23884 |
amit.gupta |
121 |
|
| 24312 |
amit.gupta |
122 |
float sale = 0;
|
| 23923 |
amit.gupta |
123 |
if (roleManager.isAdmin(loginDetails.getRoleIds())) {
|
| 24263 |
tejbeer |
124 |
model.addAttribute("sale", sale);
|
|
|
125 |
List<NotificationData> notificationData = null;
|
|
|
126 |
long size = 0;
|
|
|
127 |
|
|
|
128 |
notificationData = notificationPanelRepository.selectAllNotificationData(offset, limit);
|
|
|
129 |
size = notificationPanelRepository.selectAllCount();
|
|
|
130 |
LOGGER.info("notification_data {}", notificationData);
|
|
|
131 |
|
|
|
132 |
LOGGER.info("notification_data {}", size);
|
|
|
133 |
|
|
|
134 |
if (!notificationData.isEmpty()) {
|
|
|
135 |
|
|
|
136 |
model.addAttribute("notificationData", notificationData);
|
|
|
137 |
LOGGER.info("notificationdata", notificationData);
|
|
|
138 |
model.addAttribute("start", offset + 1);
|
|
|
139 |
model.addAttribute("size", size);
|
|
|
140 |
model.addAttribute("url", "/getPaginatedNotificationData");
|
|
|
141 |
|
|
|
142 |
LOGGER.info("start {}", offset + 1);
|
|
|
143 |
LOGGER.info("SIZE {}", size);
|
|
|
144 |
|
|
|
145 |
if (notificationData.size() < limit) {
|
|
|
146 |
model.addAttribute("end", offset + notificationData.size());
|
|
|
147 |
LOGGER.info("SIZE2 {}", offset + notificationData.size());
|
|
|
148 |
} else {
|
|
|
149 |
model.addAttribute("end", offset + limit);
|
|
|
150 |
|
|
|
151 |
LOGGER.info("end {}", size);
|
|
|
152 |
|
|
|
153 |
}
|
|
|
154 |
|
|
|
155 |
} else {
|
|
|
156 |
|
|
|
157 |
model.addAttribute("notificationData", notificationData);
|
|
|
158 |
model.addAttribute("size", size);
|
|
|
159 |
LOGGER.info("sizeOriginal {}", size);
|
|
|
160 |
|
|
|
161 |
}
|
| 23923 |
amit.gupta |
162 |
} else if (roleManager.isPartner(loginDetails.getRoleIds())) {
|
| 24312 |
amit.gupta |
163 |
|
| 24263 |
tejbeer |
164 |
List<NotificationData> notificationData = null;
|
|
|
165 |
long size = 0;
|
|
|
166 |
|
|
|
167 |
notificationData = notificationPanelRepository.selectAllNotificationDataByActiveFlag(offset, limit, true);
|
|
|
168 |
size = notificationPanelRepository.selectCountByActiveFlag(true);
|
|
|
169 |
LOGGER.info("notification_data {}", notificationData);
|
|
|
170 |
|
|
|
171 |
LOGGER.info("notification_data {}", size);
|
|
|
172 |
|
|
|
173 |
if (!notificationData.isEmpty()) {
|
|
|
174 |
|
|
|
175 |
model.addAttribute("notificationData", notificationData);
|
|
|
176 |
LOGGER.info("notificationdata", notificationData);
|
|
|
177 |
model.addAttribute("start", offset + 1);
|
|
|
178 |
model.addAttribute("size", size);
|
|
|
179 |
model.addAttribute("url", "/getPaginatedNotificationData");
|
|
|
180 |
|
|
|
181 |
LOGGER.info("start {}", offset + 1);
|
|
|
182 |
LOGGER.info("SIZE {}", size);
|
|
|
183 |
|
|
|
184 |
if (notificationData.size() < limit) {
|
|
|
185 |
model.addAttribute("end", offset + notificationData.size());
|
|
|
186 |
LOGGER.info("SIZE2 {}", offset + notificationData.size());
|
|
|
187 |
} else {
|
|
|
188 |
model.addAttribute("end", offset + limit);
|
|
|
189 |
|
|
|
190 |
LOGGER.info("end {}", size);
|
|
|
191 |
|
|
|
192 |
}
|
|
|
193 |
|
|
|
194 |
} else {
|
|
|
195 |
|
|
|
196 |
model.addAttribute("notificationData", notificationData);
|
|
|
197 |
model.addAttribute("size", size);
|
|
|
198 |
LOGGER.info("sizeOriginal {}", size);
|
|
|
199 |
|
|
|
200 |
}
|
| 23884 |
amit.gupta |
201 |
}
|
| 24383 |
amit.gupta |
202 |
|
| 24366 |
amit.gupta |
203 |
boolean isInvestmentOk = partnerInvestmentService.isInvestmentOk(loginDetails.getFofoId(), 10, 30);
|
| 24288 |
amit.gupta |
204 |
LocalDate endDate = LocalDate.now().minusDays(1);
|
|
|
205 |
LocalDate weekStartDate = endDate.with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY));
|
| 24336 |
amit.gupta |
206 |
LocalDate startDate = weekStartDate.minusWeeks(2);
|
| 24339 |
amit.gupta |
207 |
List<PartnerDailyInvestment> partnerInvestments = new ArrayList<>();
|
| 24383 |
amit.gupta |
208 |
try
|
|
|
209 |
{
|
| 24441 |
amit.gupta |
210 |
partnerInvestments.add(partnerInvestmentService.getInvestment(loginDetails.getFofoId(), 1));
|
| 24339 |
amit.gupta |
211 |
partnerInvestments.addAll(partnerDailyInvestmentRepository.selectAll(loginDetails.getFofoId(), startDate, endDate));
|
| 24383 |
amit.gupta |
212 |
|
|
|
213 |
}
|
|
|
214 |
catch(Exception e)
|
|
|
215 |
{
|
|
|
216 |
LOGGER.error("partner Investment can't exists");
|
|
|
217 |
}
|
| 24366 |
amit.gupta |
218 |
model.addAttribute("isInvestmentOk", isInvestmentOk || roleManager.isAdmin(loginDetails.getRoleIds()));
|
| 24387 |
amit.gupta |
219 |
model.addAttribute("partnerInvestment", partnerInvestments.get(0));
|
| 24312 |
amit.gupta |
220 |
model.addAttribute("investmentChart", this.getInvestmentChartData(partnerInvestments));
|
| 23848 |
ashik.ali |
221 |
model.addAttribute("fofoStore", fofoStore);
|
| 23918 |
amit.gupta |
222 |
model.addAttribute("walletAmount");
|
| 22086 |
amit.gupta |
223 |
model.addAttribute("appContextPath", request.getContextPath());
|
| 23796 |
amit.gupta |
224 |
model.addAttribute("isAdmin", roleManager.isAdmin(loginDetails.getRoleIds()));
|
| 23379 |
ashik.ali |
225 |
model.addAttribute("webApiHost", webApiHost);
|
|
|
226 |
model.addAttribute("webApiPort", webApiPort);
|
| 24072 |
amit.gupta |
227 |
model.addAttribute("webApiScheme", webApiScheme);
|
| 24077 |
amit.gupta |
228 |
model.addAttribute("webApiRoot", webApiRoot);
|
| 24203 |
amit.gupta |
229 |
model.addAttribute("hasGift", hasGift(loginDetails.getFofoId()));
|
|
|
230 |
model.addAttribute("giftItemId", ProfitMandiConstants.GIFT_ID);
|
| 24248 |
govind |
231 |
model.addAttribute("sale", sale);
|
| 24098 |
tejbeer |
232 |
|
| 23923 |
amit.gupta |
233 |
// LOGGER.info("loginDetails.getFofoId()"+loginDetails.getFofoId());
|
|
|
234 |
// inventoryService.prebookingAvailabilitySendMessage(loginDetails.getFofoId());
|
| 21615 |
kshitij.so |
235 |
return "dashboard";
|
|
|
236 |
}
|
| 23923 |
amit.gupta |
237 |
|
| 24312 |
amit.gupta |
238 |
private String getInvestmentChartData(List<PartnerDailyInvestment> partnerInvestments) {
|
| 24321 |
amit.gupta |
239 |
|
|
|
240 |
|
|
|
241 |
JSONObject scale = new JSONObject().put("scaleLabel", new JSONObject().put("scaleLabel", "Amount in Rs"));
|
|
|
242 |
JSONObject titleObject = new JSONObject()
|
|
|
243 |
.put("display", true)
|
|
|
244 |
.put("text", "Investment Overview").put("display", true);
|
|
|
245 |
|
|
|
246 |
JSONObject barData = new JSONObject();
|
|
|
247 |
|
| 24325 |
amit.gupta |
248 |
JSONObject walletStack = new JSONObject().put("backgroundColor","rgba(255, 99, 132, 0.2)")
|
| 24323 |
amit.gupta |
249 |
.put("label", "Wallet").put("stack", "Stack1").put("data", new JSONArray());
|
| 24321 |
amit.gupta |
250 |
JSONObject inStockStack = new JSONObject().put("label", "In Stock").put("backgroundColor","rgba(54, 162, 235, 0.2)")
|
| 24325 |
amit.gupta |
251 |
.put("stack", "Stack1").put("data", new JSONArray());
|
|
|
252 |
JSONObject salesStack = new JSONObject().put("backgroundColor","rgba(255, 206, 86, 0.2)")
|
| 24323 |
amit.gupta |
253 |
.put("label", "Sales").put("stack", "Stack1").put("data", new JSONArray());
|
| 24325 |
amit.gupta |
254 |
JSONObject grnPendingStack = new JSONObject().put("backgroundColor","rgba(75, 192, 192, 0.2)")
|
| 24323 |
amit.gupta |
255 |
.put("label", "Grn Pending").put("stack", "Stack1").put("data", new JSONArray());
|
| 24325 |
amit.gupta |
256 |
JSONObject billingPendingStack = new JSONObject().put("backgroundColor","rgba(153, 102, 255, 0.2)")
|
| 24323 |
amit.gupta |
257 |
.put("label", "Billing Pending").put("stack", "Stack1").put("data", new JSONArray());
|
| 24325 |
amit.gupta |
258 |
JSONObject inTransitStack = new JSONObject().put("backgroundColor","rgba(255, 159, 64, 0.2)")
|
| 24324 |
amit.gupta |
259 |
.put("label", "Returned").put("stack", "Stack1").put("data", new JSONArray());
|
| 24321 |
amit.gupta |
260 |
|
| 24327 |
amit.gupta |
261 |
JSONObject minInvestmentDataSet = new JSONObject().put("label", "Min. Ivestment").put("data", new JSONArray()).put("type", "line");
|
| 24321 |
amit.gupta |
262 |
JSONArray dateLabels = new JSONArray();
|
|
|
263 |
|
| 24312 |
amit.gupta |
264 |
for (PartnerDailyInvestment pdi : partnerInvestments) {
|
| 24321 |
amit.gupta |
265 |
dateLabels = dateLabels.put(pdi.getDate().toString());
|
|
|
266 |
walletStack.getJSONArray("data").put((int)pdi.getWalletAmount());
|
|
|
267 |
inStockStack.getJSONArray("data").put((int)pdi.getInStockAmount());
|
|
|
268 |
salesStack.getJSONArray("data").put((int)pdi.getSalesAmount());
|
|
|
269 |
grnPendingStack.getJSONArray("data").put((int)pdi.getUnbilledAmount());
|
|
|
270 |
billingPendingStack.getJSONArray("data").put((int)pdi.getGrnPendingAmount());
|
|
|
271 |
inTransitStack.getJSONArray("data").put((int)pdi.getReturnInTransitAmount());
|
| 24327 |
amit.gupta |
272 |
minInvestmentDataSet.getJSONArray("data").put((int)pdi.getMinInvestment());
|
| 24312 |
amit.gupta |
273 |
}
|
|
|
274 |
|
| 24321 |
amit.gupta |
275 |
JSONArray barDataSetsArray = new JSONArray().put(walletStack).put(inStockStack)
|
|
|
276 |
.put(salesStack).put(grnPendingStack).put(billingPendingStack).put(inTransitStack);
|
|
|
277 |
barData.put("labels", dateLabels).put("datasets", barDataSetsArray);
|
|
|
278 |
scale.put("yAxes", new JSONArray().put(new JSONObject().put("stacked", true)))
|
|
|
279 |
.put("xAxes", new JSONArray().put(new JSONObject().put("stacked", true)));
|
|
|
280 |
|
|
|
281 |
JSONObject barOptions = new JSONObject()
|
| 24324 |
amit.gupta |
282 |
.put("title", titleObject).put("responsive", true).put("scales", scale)
|
| 24321 |
amit.gupta |
283 |
.put("tooltips", new JSONObject().put("mode", "index").put("intersect", false));
|
|
|
284 |
|
|
|
285 |
JSONObject chartJSOn = new JSONObject().put("type", "bar").put("data", barData).put("options", barOptions);
|
|
|
286 |
return chartJSOn.toString();
|
| 24312 |
amit.gupta |
287 |
}
|
|
|
288 |
|
| 24288 |
amit.gupta |
289 |
// This method is currently hardcoded to faciliate watches sold as gift.
|
| 24203 |
amit.gupta |
290 |
private boolean hasGift(int fofoId) {
|
|
|
291 |
try {
|
| 24288 |
amit.gupta |
292 |
return currentInventorySnapshotRepository.selectByItemIdAndFofoId(ProfitMandiConstants.GIFT_ID, fofoId)
|
|
|
293 |
.getAvailability() > 0;
|
| 24203 |
amit.gupta |
294 |
} catch (ProfitMandiBusinessException e) {
|
|
|
295 |
return false;
|
|
|
296 |
}
|
|
|
297 |
}
|
| 24288 |
amit.gupta |
298 |
|
| 24098 |
tejbeer |
299 |
@RequestMapping(value = "/getPaginatedNotificationData", method = RequestMethod.GET)
|
|
|
300 |
public String getPaginatedNotificationData(HttpServletRequest request,
|
|
|
301 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
|
|
302 |
@RequestParam(name = "limit", defaultValue = "10") int limit, Model model) throws Exception {
|
| 24263 |
tejbeer |
303 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 24098 |
tejbeer |
304 |
|
| 24263 |
tejbeer |
305 |
if (roleManager.isAdmin(loginDetails.getRoleIds())) {
|
|
|
306 |
List<NotificationData> notificationData = null;
|
| 24098 |
tejbeer |
307 |
|
| 24263 |
tejbeer |
308 |
notificationData = notificationPanelRepository.selectAllNotificationData(offset, limit);
|
| 24098 |
tejbeer |
309 |
|
| 24263 |
tejbeer |
310 |
LOGGER.info("notification_data {}", notificationData);
|
| 24098 |
tejbeer |
311 |
|
| 24263 |
tejbeer |
312 |
if (!notificationData.isEmpty()) {
|
| 24098 |
tejbeer |
313 |
|
| 24263 |
tejbeer |
314 |
model.addAttribute("notificationData", notificationData);
|
|
|
315 |
model.addAttribute("url", "/getPaginatedNotificationData");
|
|
|
316 |
|
|
|
317 |
} else {
|
|
|
318 |
model.addAttribute("notificationData", notificationData);
|
|
|
319 |
|
|
|
320 |
}
|
|
|
321 |
} else if (roleManager.isPartner(loginDetails.getRoleIds())) {
|
|
|
322 |
|
|
|
323 |
List<NotificationData> notificationData = null;
|
|
|
324 |
|
|
|
325 |
notificationData = notificationPanelRepository.selectAllNotificationDataByActiveFlag(offset, limit, true);
|
|
|
326 |
LOGGER.info("notification_data {}", notificationData);
|
|
|
327 |
|
|
|
328 |
if (!notificationData.isEmpty()) {
|
|
|
329 |
|
|
|
330 |
model.addAttribute("notificationData", notificationData);
|
|
|
331 |
model.addAttribute("url", "/getPaginatedNotificationData");
|
|
|
332 |
|
|
|
333 |
} else {
|
|
|
334 |
model.addAttribute("notificationData", notificationData);
|
|
|
335 |
|
|
|
336 |
}
|
| 24098 |
tejbeer |
337 |
}
|
|
|
338 |
|
|
|
339 |
return "dashboard-paginated";
|
|
|
340 |
}
|
| 24288 |
amit.gupta |
341 |
|
| 22354 |
ashik.ali |
342 |
@RequestMapping(value = "/contactUs", method = RequestMethod.GET)
|
| 23923 |
amit.gupta |
343 |
public String contactUs(HttpServletRequest request, Model model) throws Throwable {
|
| 22354 |
ashik.ali |
344 |
model.addAttribute("appContextPath", request.getContextPath());
|
|
|
345 |
return "contact-us";
|
|
|
346 |
}
|
| 23923 |
amit.gupta |
347 |
|
|
|
348 |
/*
|
|
|
349 |
* private List<PaymentOption> getPaymentOptions(int fofoId){ List<Integer>
|
|
|
350 |
* paymentOptionIds =
|
| 24288 |
amit.gupta |
351 |
* fofoPartnerPaymentOptionRepository.selectPaymentOptionIdsByFofoId(fofoId) ;
|
|
|
352 |
* if(paymentOptionIds.isEmpty()){ return new ArrayList<>(); } return
|
| 23923 |
amit.gupta |
353 |
* paymentOptionRepository.selectByIds(new HashSet<>(paymentOptionIds)); }
|
|
|
354 |
*/
|
|
|
355 |
|
| 24263 |
tejbeer |
356 |
@RequestMapping(value = "/inactiveNotificationData", method = RequestMethod.POST)
|
|
|
357 |
public String inactiveNotificationData(HttpServletRequest request,
|
|
|
358 |
@RequestParam(name = "id", defaultValue = "0") int id, Model model) throws Exception {
|
|
|
359 |
|
|
|
360 |
NotificationData notificationData = notificationPanelRepository.selectById(id);
|
|
|
361 |
if (notificationData != null) {
|
|
|
362 |
|
|
|
363 |
notificationData.setActive(false);
|
|
|
364 |
LOGGER.info("notification" + notificationData);
|
|
|
365 |
notificationPanelRepository.persist(notificationData);
|
|
|
366 |
|
|
|
367 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
|
|
368 |
} else {
|
|
|
369 |
model.addAttribute("response", mvcResponseSender.createResponseString(false));
|
|
|
370 |
|
|
|
371 |
}
|
|
|
372 |
return "response";
|
|
|
373 |
}
|
|
|
374 |
|
|
|
375 |
@RequestMapping(value = "/activeNotificationData", method = RequestMethod.POST)
|
|
|
376 |
public String activeNotificationData(HttpServletRequest request,
|
|
|
377 |
@RequestParam(name = "id", defaultValue = "0") int id, Model model) throws Exception {
|
|
|
378 |
|
|
|
379 |
NotificationData notificationData = notificationPanelRepository.selectById(id);
|
|
|
380 |
if (notificationData != null) {
|
|
|
381 |
|
|
|
382 |
notificationData.setActive(true);
|
|
|
383 |
notificationData.setCreated_timestamp(LocalDateTime.now());
|
|
|
384 |
LOGGER.info("notification" + notificationData);
|
|
|
385 |
notificationPanelRepository.persist(notificationData);
|
|
|
386 |
|
|
|
387 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
|
|
388 |
} else {
|
|
|
389 |
model.addAttribute("response", mvcResponseSender.createResponseString(false));
|
|
|
390 |
|
|
|
391 |
}
|
|
|
392 |
return "response";
|
|
|
393 |
}
|
|
|
394 |
|
| 21615 |
kshitij.so |
395 |
}
|