AreaRegionController.java 3.03 KB
Newer Older
frank.xa.zhang's avatar
frank.xa.zhang committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
package pwc.taxtech.atms.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.dto.arearegion.AreaRegionDto;
import pwc.taxtech.atms.dto.arearegion.AreaRegionInfo;
import pwc.taxtech.atms.service.impl.AreaRegionServiceImpl;

import java.util.List;

@RestController
@RequestMapping("/api/v1/areaRegion/")
public class AreaRegionController {

    private static Logger logger = LoggerFactory.getLogger(AreaRegionController.class);

    @Autowired
    private AreaRegionServiceImpl areaRegionService;

    @SuppressWarnings("rawtypes")
//    @ApiOperation(value = "Adds the specified area.")
    @RequestMapping(value = "add", method = RequestMethod.POST)
    public @ResponseBody
    OperationResultDto add(@RequestBody AreaRegionInfo areaRegionInfo) {
        logger.info("/api/v1/areaRegion/add");
        return areaRegionService.add(areaRegionInfo);
    }

    @SuppressWarnings("rawtypes")
//    @ApiOperation(value = "Update the specified area.")
    @RequestMapping(value = "update", method = RequestMethod.POST)
    public @ResponseBody
    OperationResultDto update(@RequestBody AreaRegionInfo areaRegionInfo) {
        logger.info("/api/v1/areaRegion/update");
        return areaRegionService.update(areaRegionInfo);
    }

//    @ApiOperation(value = "Get cities")
    @RequestMapping(value = "getCities", method = RequestMethod.GET)
    public @ResponseBody
    List<AreaRegionDto> getCities(@RequestParam(name = "parentID") String parentId) {
        logger.info("/api/v1/areaRegion/getProvinces");
        return areaRegionService.getCities(parentId);
    }

//    @ApiOperation(value = "Get cities")
    @RequestMapping(value = "getProvincesByCityID", method = RequestMethod.GET)
    public @ResponseBody
    AreaRegionDto getProvincesByCityID(@RequestParam(name = "cityID") String cityID) {
        logger.info("/api/v1/areaRegion/getProvincesByCityID");
        return areaRegionService.getProvincesByCityID(cityID);
    }

//    @ApiOperation(value = "Get Provinces")
    @RequestMapping(value = "getProvinces", method = RequestMethod.GET)
    public @ResponseBody
    List<AreaRegionDto> getProvinces() {
        logger.info("/api/v1/areaRegion/getCities");
        return areaRegionService.getProvinces();
    }

//    @ApiOperation(value = "Get Provinces")
    @RequestMapping(value = "getDistricts", method = RequestMethod.GET)
    public @ResponseBody
    List<AreaRegionDto> getDistricts(@RequestParam(name = "parentID") String parentId) {
        logger.info("/api/v1/areaRegion/getDistricts");
        return areaRegionService.getDistricts(parentId);
    }
}