Subversion Repositories SmartDukaan

Rev

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

Rev 34554 Rev 35610
Line 1... Line 1...
1
package com.smartdukaan.cron.controller;
1
package com.smartdukaan.cron.controller;
2
 
2
 
-
 
3
import com.smartdukaan.cron.migrations.RunOnceTasks;
-
 
4
import org.apache.logging.log4j.LogManager;
-
 
5
import org.apache.logging.log4j.Logger;
-
 
6
import org.springframework.beans.factory.annotation.Autowired;
3
import org.springframework.http.ResponseEntity;
7
import org.springframework.http.ResponseEntity;
4
import org.springframework.web.bind.annotation.GetMapping;
8
import org.springframework.web.bind.annotation.GetMapping;
-
 
9
import org.springframework.web.bind.annotation.RequestParam;
5
import org.springframework.web.bind.annotation.RestController;
10
import org.springframework.web.bind.annotation.RestController;
6
 
11
 
7
@RestController
12
@RestController
8
public class ExposeController {
13
public class ExposeController {
9
 
14
 
-
 
15
    private static final Logger LOGGER = LogManager.getLogger(ExposeController.class);
-
 
16
 
-
 
17
    @Autowired
-
 
18
    private RunOnceTasks runOnceTasks;
-
 
19
 
10
    @GetMapping("/expose")
20
    @GetMapping("/expose")
11
    public ResponseEntity<?> expose() {
21
    public ResponseEntity<?> expose() {
12
        return ResponseEntity.ok("This is use for Expose");
22
        return ResponseEntity.ok("This is use for Expose");
13
    }
23
    }
-
 
24
 
-
 
25
    /**
-
 
26
     * Resolve old Sales/RBM Escalation tickets created before September 30, 2025.
-
 
27
     * Usage: GET /resolveOldEscalationTickets?dryRun=true (preview only)
-
 
28
     *        GET /resolveOldEscalationTickets?dryRun=false (actual execution)
-
 
29
     */
-
 
30
    @GetMapping("/resolveOldEscalationTickets")
-
 
31
    public ResponseEntity<?> resolveOldEscalationTickets(@RequestParam(defaultValue = "true") boolean dryRun) {
-
 
32
        try {
-
 
33
            LOGGER.info("resolveOldEscalationTickets called with dryRun={}", dryRun);
-
 
34
            String result = runOnceTasks.resolveOldEscalationTickets(dryRun);
-
 
35
            return ResponseEntity.ok(result);
-
 
36
        } catch (Exception e) {
-
 
37
            LOGGER.error("Error in resolveOldEscalationTickets", e);
-
 
38
            return ResponseEntity.internalServerError().body("Error: " + e.getMessage());
-
 
39
        }
-
 
40
    }
14
}
41
}