增加分区功能
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,8 +82,18 @@ price.set.customer.priority.invalid=优先级必须大于等于 1
|
||||
# 重量段 PrcWeight
|
||||
price.weight.range.empty=起始重量和结束重量不能为空
|
||||
price.weight.range.invalid=起始重量必须小于结束重量
|
||||
# 分区 XtdZone
|
||||
price.zone.delete.hasDivision=分区方案【{0}】存在区划明细,不允许删除
|
||||
# Zone PrcZone (country -> zone -> postcode)
|
||||
price.zone.import.fileEmpty=上传文件不能为空
|
||||
price.zone.import.fileType=仅支持 xls / xlsx 文件
|
||||
price.zone.import.noSheet=未找到分区 sheet(sheet 名需以「分区」结尾,如「澳大利亚分区」)
|
||||
price.zone.import.noData=分区 sheet 无有效邮编/分区数据
|
||||
price.zone.import.success=导入成功:{0} 个国家,{1} 个分区,{2} 条邮编明细({3})
|
||||
price.zone.import.unmatched=;未匹配国家已跳过:{0}
|
||||
price.zone.import.regionNotFound=未在 bms_region 匹配到国家:{0}
|
||||
price.zone.import.regionEmpty=bms_region 无可用国家数据,请先同步/维护国家表
|
||||
price.zone.region.notFound=国家不存在或已删除
|
||||
price.zone.region.required=请选择国家(bms_region)
|
||||
price.zone.countryCode.empty=国家编码不能为空,请检查 bms_region.country_code_2
|
||||
# 产品导入 BmsProduct
|
||||
price.product.codeDate.exists=同一产品代码与生效日期已存在,不能覆盖历史数据
|
||||
price.product.effectiveDate.empty=生效日期不能为空
|
||||
|
||||
Reference in New Issue
Block a user