| Line 60... |
Line 60... |
| 60 |
import org.springframework.http.HttpStatus;
|
60 |
import org.springframework.http.HttpStatus;
|
| 61 |
import org.springframework.http.ResponseEntity;
|
61 |
import org.springframework.http.ResponseEntity;
|
| 62 |
import org.springframework.stereotype.Controller;
|
62 |
import org.springframework.stereotype.Controller;
|
| 63 |
import org.springframework.ui.Model;
|
63 |
import org.springframework.ui.Model;
|
| 64 |
import org.springframework.web.bind.annotation.*;
|
64 |
import org.springframework.web.bind.annotation.*;
|
| - |
|
65 |
|
| 65 |
import javax.servlet.http.HttpServletRequest;
|
66 |
import javax.servlet.http.HttpServletRequest;
|
| 66 |
import javax.transaction.Transactional;
|
67 |
import javax.transaction.Transactional;
|
| 67 |
import java.io.File;
|
68 |
import java.io.File;
|
| 68 |
import java.io.FileInputStream;
|
69 |
import java.io.FileInputStream;
|
| 69 |
import java.io.FileNotFoundException;
|
70 |
import java.io.FileNotFoundException;
|
| Line 73... |
Line 74... |
| 73 |
import java.time.YearMonth;
|
74 |
import java.time.YearMonth;
|
| 74 |
import java.time.format.DateTimeFormatter;
|
75 |
import java.time.format.DateTimeFormatter;
|
| 75 |
import java.util.*;
|
76 |
import java.util.*;
|
| 76 |
import java.util.Map.Entry;
|
77 |
import java.util.Map.Entry;
|
| 77 |
import java.util.stream.Collectors;
|
78 |
import java.util.stream.Collectors;
|
| - |
|
79 |
|
| 78 |
import static in.shop2020.model.v1.order.OrderStatus.*;
|
80 |
import static in.shop2020.model.v1.order.OrderStatus.*;
|
| - |
|
81 |
|
| 79 |
@Controller
|
82 |
@Controller
|
| 80 |
@Transactional(rollbackOn = Throwable.class)
|
83 |
@Transactional(rollbackOn = Throwable.class)
|
| 81 |
public class DashboardController {
|
84 |
public class DashboardController {
|
| 82 |
|
85 |
|
| 83 |
List<String> emails = Arrays.asList("kamini.sharma@smartdukaan.com", "jaihind.yadav@smartdukaan.com", "neeraj.gupta@smartdukaan.com", "amit.gupta@smartdukaan.com", "tejbeer.kaur@smartdukaan.com");
|
86 |
List<String> emails = Arrays.asList("kamini.sharma@smartdukaan.com", "jaihind.yadav@smartdukaan.com", "neeraj.gupta@smartdukaan.com", "amit.gupta@smartdukaan.com", "tejbeer.kaur@smartdukaan.com");
|
| Line 224... |
Line 227... |
| 224 |
private MonthlyTargetRepository monthlyTargetRepository;
|
227 |
private MonthlyTargetRepository monthlyTargetRepository;
|
| 225 |
|
228 |
|
| 226 |
@Autowired
|
229 |
@Autowired
|
| 227 |
private SamsungUpgradeOfferRepository samsungUpgradeOfferRepository;
|
230 |
private SamsungUpgradeOfferRepository samsungUpgradeOfferRepository;
|
| 228 |
private static final Logger LOGGER = LogManager.getLogger(DashboardController.class);
|
231 |
private static final Logger LOGGER = LogManager.getLogger(DashboardController.class);
|
| 229 |
@Autowired
|
232 |
@Autowired
|
| 230 |
private SSHService sshService;
|
233 |
private SSHService sshService;
|
| - |
|
234 |
|
| 231 |
@RequestMapping(value = "/12dashboard34", method = RequestMethod.GET)
|
235 |
@RequestMapping(value = "/12dashboard34", method = RequestMethod.GET)
|
| 232 |
public String dashboard1(HttpServletRequest request, Model model, @RequestParam int fofoId) throws Exception {
|
236 |
public String dashboard1(HttpServletRequest request, Model model, @RequestParam int fofoId) throws Exception {
|
| 233 |
boolean isAdmin = false;
|
237 |
boolean isAdmin = false;
|
| 234 |
model.addAttribute("isAdmin", isAdmin);
|
238 |
model.addAttribute("isAdmin", isAdmin);
|
| 235 |
|
239 |
|
| Line 481... |
Line 485... |
| 481 |
model.addAttribute("hygienePercentage", (hygieneCount * 100) / (invalidHygieneCount + hygieneCount));
|
485 |
model.addAttribute("hygienePercentage", (hygieneCount * 100) / (invalidHygieneCount + hygieneCount));
|
| 482 |
model.addAttribute("monthDays", LocalDate.now().minusDays(1).lengthOfMonth());
|
486 |
model.addAttribute("monthDays", LocalDate.now().minusDays(1).lengthOfMonth());
|
| 483 |
model.addAttribute("dayOfMonth", LocalDate.now().minusDays(1).getDayOfMonth());
|
487 |
model.addAttribute("dayOfMonth", LocalDate.now().minusDays(1).getDayOfMonth());
|
| 484 |
|
488 |
|
| 485 |
} catch (
|
489 |
} catch (
|
| 486 |
ProfitMandiBusinessException e) {
|
490 |
ProfitMandiBusinessException e) {
|
| 487 |
LOGGER.error("FofoStore Code not found of fofoId {}", loginDetails.getFofoId());
|
491 |
LOGGER.error("FofoStore Code not found of fofoId {}", loginDetails.getFofoId());
|
| 488 |
|
492 |
|
| 489 |
}
|
493 |
}
|
| 490 |
return "dashboard1";
|
494 |
return "dashboard1";
|
| 491 |
}
|
495 |
}
|
| Line 2040... |
Line 2044... |
| 2040 |
model.addAttribute("customRetailerMap", customRetailerMap);
|
2044 |
model.addAttribute("customRetailerMap", customRetailerMap);
|
| 2041 |
model.addAttribute("partnerMonthPurchaseMap", partnerMonthPurchaseMap);
|
2045 |
model.addAttribute("partnerMonthPurchaseMap", partnerMonthPurchaseMap);
|
| 2042 |
return "monthly-partner-purchase";
|
2046 |
return "monthly-partner-purchase";
|
| 2043 |
|
2047 |
|
| 2044 |
}
|
2048 |
}
|
| - |
|
2049 |
|
| 2045 |
@GetMapping("/restartServer")
|
2050 |
@GetMapping("/restartServer")
|
| 2046 |
public String RestartServer(HttpServletRequest request,Model model) throws Exception {
|
2051 |
public String RestartServer(HttpServletRequest request, Model model) throws Exception {
|
| - |
|
2052 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| - |
|
2053 |
if (Arrays.asList("amit.gupta@smartdukaan.com", "shivam.gupta@smartdukaan.com", "vinay.p@smartdukaan.com").contains(loginDetails.getEmailId())) {
|
| 2047 |
String ipAddress = "45.79.106.95";
|
2054 |
String ipAddress = "45.79.106.95";
|
| 2048 |
int port = 22;
|
2055 |
int port = 22;
|
| 2049 |
String username = "root";
|
2056 |
String username = "root";
|
| 2050 |
String password = "spic@2015shop2020";
|
2057 |
String password = "spic@2015shop2020";
|
| 2051 |
String remoteDirectoryPath = "/tmp/abc";
|
2058 |
String remoteDirectoryPath = "/tmp/abc";
|
| 2052 |
String command = "./restart-services.sh";
|
2059 |
String command = "./restart-services.sh";
|
| 2053 |
sshService.RestartServer(ipAddress, port, username, password, remoteDirectoryPath, command,null);
|
2060 |
sshService.RestartServer(ipAddress, port, username, password, remoteDirectoryPath, command, null);
|
| 2054 |
model.addAttribute("response1", mvcResponseSender.createResponseString(true));
|
2061 |
model.addAttribute("response1", mvcResponseSender.createResponseString(true));
|
| - |
|
2062 |
} else {
|
| - |
|
2063 |
model.addAttribute("response1", mvcResponseSender.createResponseString(false));
|
| - |
|
2064 |
}
|
| 2055 |
return "response";
|
2065 |
return "response";
|
| 2056 |
}
|
2066 |
}
|
| 2057 |
|
2067 |
|
| 2058 |
@GetMapping("/rebootServer")
|
2068 |
@GetMapping("/rebootServer")
|
| 2059 |
public String rebootServer(HttpServletRequest request,Model model) throws Exception {
|
2069 |
public String rebootServer(HttpServletRequest request, Model model) throws Exception {
|
| - |
|
2070 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| - |
|
2071 |
if (Arrays.asList("amit.gupta@smartdukaan.com", "shivam.gupta@smartdukaan.com", "vinay.p@smartdukaan.com").contains(loginDetails.getEmailId())) {
|
| 2060 |
String ipAddress = "45.79.106.95";
|
2072 |
String ipAddress = "45.79.106.95";
|
| 2061 |
int port = 22;
|
2073 |
int port = 22;
|
| 2062 |
String username = "root";
|
2074 |
String username = "root";
|
| 2063 |
String password = "spic@2015shop2020";
|
2075 |
String password = "spic@2015shop2020";
|
| 2064 |
String remoteDirectoryPath = "/tmp/abc";
|
2076 |
String remoteDirectoryPath = "/tmp/abc";
|
| 2065 |
String rebootCommand = "reboot";
|
2077 |
String rebootCommand = "reboot";
|
| 2066 |
|
2078 |
|
| 2067 |
sshService.RestartServer(ipAddress, port, username, password, remoteDirectoryPath,null, rebootCommand);
|
2079 |
sshService.RestartServer(ipAddress, port, username, password, remoteDirectoryPath, null, rebootCommand);
|
| 2068 |
model.addAttribute("response1", mvcResponseSender.createResponseString(true));
|
2080 |
model.addAttribute("response1", mvcResponseSender.createResponseString(true));
|
| - |
|
2081 |
} else {
|
| - |
|
2082 |
model.addAttribute("response1", mvcResponseSender.createResponseString(false));
|
| - |
|
2083 |
}
|
| 2069 |
return "response";
|
2084 |
return "response";
|
| 2070 |
}
|
2085 |
}
|
| - |
|
2086 |
|
| 2071 |
@GetMapping("/getRestartServer")
|
2087 |
@GetMapping("/getRestartServer")
|
| 2072 |
public String getRestartServer(HttpServletRequest request,Model model) {
|
2088 |
public String getRestartServer(HttpServletRequest request, Model model) {
|
| 2073 |
return "restart-server-page";
|
2089 |
return "restart-server-page";
|
| 2074 |
}
|
2090 |
}
|
| 2075 |
}
|
2091 |
}
|