增加分区功能
This commit is contained in:
+83
-80
@@ -12,133 +12,136 @@ import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.price.domain.XtdZoneCountry;
|
||||
import com.ruoyi.price.domain.XtdZoneDivision;
|
||||
import com.ruoyi.price.domain.XtdZoneScheme;
|
||||
import com.ruoyi.price.service.IXtdZoneService;
|
||||
import com.ruoyi.price.domain.PrcZone;
|
||||
import com.ruoyi.price.domain.PrcZoneDetail;
|
||||
import com.ruoyi.price.domain.PrcZoneRegion;
|
||||
import com.ruoyi.price.service.IPrcZoneService;
|
||||
|
||||
/**
|
||||
* 分区管理
|
||||
*
|
||||
* @author ruoyi
|
||||
* Zone management: bms_region -> zone -> postcode detail
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/price/zone")
|
||||
public class ZoneController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IXtdZoneService zoneService;
|
||||
private IPrcZoneService zoneService;
|
||||
|
||||
// ========== countries that already have zones (from bms_region) ==========
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('price:zone:list')")
|
||||
@GetMapping("/scheme/list")
|
||||
public TableDataInfo schemeList(XtdZoneScheme scheme)
|
||||
@GetMapping("/country/list")
|
||||
public TableDataInfo countryList(PrcZoneRegion query)
|
||||
{
|
||||
startPage();
|
||||
List<XtdZoneScheme> list = zoneService.selectXtdZoneSchemeList(scheme);
|
||||
List<PrcZoneRegion> list = zoneService.selectZoneRegionList(query);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('price:zone:query')")
|
||||
@GetMapping("/scheme/{zsId}")
|
||||
public AjaxResult getScheme(@PathVariable Long zsId)
|
||||
@GetMapping("/country/{regionId}")
|
||||
public AjaxResult getCountry(@PathVariable Long regionId)
|
||||
{
|
||||
return success(zoneService.selectXtdZoneSchemeById(zsId));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('price:zone:add')")
|
||||
@Log(title = "分区方案", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/scheme")
|
||||
public AjaxResult addScheme(@Validated @RequestBody XtdZoneScheme scheme)
|
||||
{
|
||||
scheme.setCreateBy(getUsername());
|
||||
return toAjax(zoneService.insertXtdZoneScheme(scheme));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('price:zone:edit')")
|
||||
@Log(title = "分区方案", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/scheme")
|
||||
public AjaxResult editScheme(@Validated @RequestBody XtdZoneScheme scheme)
|
||||
{
|
||||
scheme.setUpdateBy(getUsername());
|
||||
return toAjax(zoneService.updateXtdZoneScheme(scheme));
|
||||
return success(zoneService.selectZoneRegionById(regionId));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('price:zone:remove')")
|
||||
@Log(title = "分区方案", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/scheme/{zsIds}")
|
||||
public AjaxResult removeScheme(@PathVariable Long[] zsIds)
|
||||
@Log(title = "ZoneRegion", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/country/{regionIds}")
|
||||
public AjaxResult removeCountryZones(@PathVariable Long[] regionIds)
|
||||
{
|
||||
return toAjax(zoneService.deleteXtdZoneSchemeByIds(zsIds));
|
||||
return toAjax(zoneService.deleteZonesByRegionIds(regionIds));
|
||||
}
|
||||
|
||||
// ========== zone ==========
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('price:zone:list')")
|
||||
@GetMapping("/division/list")
|
||||
public TableDataInfo divisionList(XtdZoneDivision division)
|
||||
@GetMapping("/item/list")
|
||||
public TableDataInfo zoneList(PrcZone zone)
|
||||
{
|
||||
startPage();
|
||||
List<XtdZoneDivision> list = zoneService.selectXtdZoneDivisionList(division);
|
||||
List<PrcZone> list = zoneService.selectPrcZoneList(zone);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('price:zone:query')")
|
||||
@GetMapping("/item/{zoneId}")
|
||||
public AjaxResult getZone(@PathVariable Long zoneId)
|
||||
{
|
||||
return success(zoneService.selectPrcZoneById(zoneId));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('price:zone:add')")
|
||||
@Log(title = "Zone", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/item")
|
||||
public AjaxResult addZone(@Validated @RequestBody PrcZone zone)
|
||||
{
|
||||
return toAjax(zoneService.insertPrcZone(zone));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('price:zone:edit')")
|
||||
@Log(title = "Zone", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/item")
|
||||
public AjaxResult editZone(@Validated @RequestBody PrcZone zone)
|
||||
{
|
||||
return toAjax(zoneService.updatePrcZone(zone));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('price:zone:remove')")
|
||||
@Log(title = "Zone", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/item/{zoneIds}")
|
||||
public AjaxResult removeZone(@PathVariable Long[] zoneIds)
|
||||
{
|
||||
return toAjax(zoneService.deletePrcZoneByIds(zoneIds));
|
||||
}
|
||||
|
||||
// ========== detail ==========
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('price:zone:list')")
|
||||
@GetMapping("/detail/list")
|
||||
public TableDataInfo detailList(PrcZoneDetail detail)
|
||||
{
|
||||
startPage();
|
||||
List<PrcZoneDetail> list = zoneService.selectPrcZoneDetailList(detail);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('price:zone:add')")
|
||||
@Log(title = "分区区划", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/division")
|
||||
public AjaxResult addDivision(@Validated @RequestBody XtdZoneDivision division)
|
||||
@Log(title = "ZoneDetail", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/detail")
|
||||
public AjaxResult addDetail(@Validated @RequestBody PrcZoneDetail detail)
|
||||
{
|
||||
return toAjax(zoneService.insertXtdZoneDivision(division));
|
||||
return toAjax(zoneService.insertPrcZoneDetail(detail));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('price:zone:edit')")
|
||||
@Log(title = "分区区划", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/division")
|
||||
public AjaxResult editDivision(@Validated @RequestBody XtdZoneDivision division)
|
||||
@Log(title = "ZoneDetail", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/detail")
|
||||
public AjaxResult editDetail(@Validated @RequestBody PrcZoneDetail detail)
|
||||
{
|
||||
return toAjax(zoneService.updateXtdZoneDivision(division));
|
||||
return toAjax(zoneService.updatePrcZoneDetail(detail));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('price:zone:remove')")
|
||||
@Log(title = "分区区划", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/division/{zdIds}")
|
||||
public AjaxResult removeDivision(@PathVariable Long[] zdIds)
|
||||
@Log(title = "ZoneDetail", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/detail/{detailIds}")
|
||||
public AjaxResult removeDetail(@PathVariable Long[] detailIds)
|
||||
{
|
||||
return toAjax(zoneService.deleteXtdZoneDivisionByIds(zdIds));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('price:zone:list')")
|
||||
@GetMapping("/country/list")
|
||||
public TableDataInfo countryList(XtdZoneCountry country)
|
||||
{
|
||||
startPage();
|
||||
List<XtdZoneCountry> list = zoneService.selectXtdZoneCountryList(country);
|
||||
return getDataTable(list);
|
||||
return toAjax(zoneService.deletePrcZoneDetailByIds(detailIds));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('price:zone:add')")
|
||||
@Log(title = "分区国家", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/country")
|
||||
public AjaxResult addCountry(@Validated @RequestBody XtdZoneCountry country)
|
||||
@Log(title = "ZoneImport", businessType = BusinessType.IMPORT)
|
||||
@PostMapping("/importData")
|
||||
public AjaxResult importData(MultipartFile file) throws Exception
|
||||
{
|
||||
return toAjax(zoneService.insertXtdZoneCountry(country));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('price:zone:edit')")
|
||||
@Log(title = "分区国家", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/country")
|
||||
public AjaxResult editCountry(@Validated @RequestBody XtdZoneCountry country)
|
||||
{
|
||||
return toAjax(zoneService.updateXtdZoneCountry(country));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('price:zone:remove')")
|
||||
@Log(title = "分区国家", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/country/{zcIds}")
|
||||
public AjaxResult removeCountry(@PathVariable Long[] zcIds)
|
||||
{
|
||||
return toAjax(zoneService.deleteXtdZoneCountryByIds(zcIds));
|
||||
String message = zoneService.importZoneExcel(file, getUsername());
|
||||
return success(message);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user