| 22473 |
ashik.ali |
1 |
package com.spice.profitmandi.web.controller;
|
|
|
2 |
|
|
|
3 |
import javax.servlet.http.HttpServletRequest;
|
|
|
4 |
|
| 23568 |
govind |
5 |
import org.apache.logging.log4j.Logger;
|
|
|
6 |
import org.apache.logging.log4j.LogManager;
|
| 22473 |
ashik.ali |
7 |
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
8 |
import org.springframework.http.ResponseEntity;
|
|
|
9 |
import org.springframework.stereotype.Controller;
|
|
|
10 |
import org.springframework.transaction.annotation.Transactional;
|
|
|
11 |
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
12 |
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
13 |
|
|
|
14 |
import com.spice.profitmandi.common.ResponseCodeHolder;
|
|
|
15 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
|
|
16 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
|
|
17 |
import com.spice.profitmandi.common.web.util.ResponseSender;
|
|
|
18 |
import com.spice.profitmandi.dao.util.MigrationUtil;
|
|
|
19 |
|
|
|
20 |
import io.swagger.annotations.ApiImplicitParam;
|
|
|
21 |
import io.swagger.annotations.ApiImplicitParams;
|
|
|
22 |
|
|
|
23 |
@Controller
|
|
|
24 |
@Transactional(rollbackFor=Throwable.class)
|
|
|
25 |
public class MigrationController {
|
|
|
26 |
|
|
|
27 |
@Autowired
|
| 22931 |
ashik.ali |
28 |
private MigrationUtil migrationUtil;
|
| 22473 |
ashik.ali |
29 |
|
|
|
30 |
@Autowired
|
| 22931 |
ashik.ali |
31 |
private ResponseSender<?> responseSender;
|
| 22473 |
ashik.ali |
32 |
|
| 23568 |
govind |
33 |
private static final Logger LOGGER=LogManager.getLogger(MigrationController.class);
|
| 22473 |
ashik.ali |
34 |
|
|
|
35 |
@RequestMapping(value = ProfitMandiConstants.URL_ADMIN_MIGRATE_USER_TO_RETAILER, method = RequestMethod.GET)
|
|
|
36 |
@ApiImplicitParams({
|
|
|
37 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
|
| 23786 |
amit.gupta |
38 |
public ResponseEntity<?> migrateUserToRetailer(HttpServletRequest request) throws Exception{
|
| 22473 |
ashik.ali |
39 |
LOGGER.info("requested url : " + request.getRequestURL().toString());
|
|
|
40 |
migrationUtil.migrateUserToRetailer();
|
|
|
41 |
return responseSender.ok(ResponseCodeHolder.getMessage("OK_1000"));
|
|
|
42 |
}
|
|
|
43 |
|
|
|
44 |
@RequestMapping(value = ProfitMandiConstants.URL_ADMIN_MIGRATE_MONGO_DOC_TO_RETAILER, method = RequestMethod.GET)
|
|
|
45 |
@ApiImplicitParams({
|
|
|
46 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
|
| 22931 |
ashik.ali |
47 |
public ResponseEntity<?> migrateMongoDocToRetailer(HttpServletRequest request) throws ProfitMandiBusinessException{
|
|
|
48 |
|
| 22473 |
ashik.ali |
49 |
LOGGER.info("requested url : " + request.getRequestURL().toString());
|
| 22931 |
ashik.ali |
50 |
migrationUtil.migrateMongoDocToRetailer();
|
|
|
51 |
return responseSender.ok(ResponseCodeHolder.getMessage("OK_1000"));
|
|
|
52 |
|
| 22473 |
ashik.ali |
53 |
}
|
|
|
54 |
|
|
|
55 |
}
|