diff --git a/bms-back/ruoyi-admin/src/main/java/com/ruoyi/web/controller/price/PriceSetController.java b/bms-back/ruoyi-admin/src/main/java/com/ruoyi/web/controller/price/PriceSetController.java new file mode 100644 index 00000000..a266e676 --- /dev/null +++ b/bms-back/ruoyi-admin/src/main/java/com/ruoyi/web/controller/price/PriceSetController.java @@ -0,0 +1,196 @@ +package com.ruoyi.web.controller.price; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +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 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.PrcCustomerPriceSet; +import com.ruoyi.price.domain.PrcPriceSet; +import com.ruoyi.price.domain.PrcPriceSetDetail; +import com.ruoyi.price.service.IPrcPriceSetService; + +/** + * 价格套餐管理 + * + * @author ruoyi + */ +@RestController +@RequestMapping("/price/set") +public class PriceSetController extends BaseController +{ + @Autowired + private IPrcPriceSetService priceSetService; + + @PreAuthorize("@ss.hasPermi('price:set:list')") + @GetMapping("/list") + public TableDataInfo list(PrcPriceSet set) + { + startPage(); + List list = priceSetService.selectPrcPriceSetList(set); + return getDataTable(list); + } + + @PreAuthorize("@ss.hasPermi('price:set:query')") + @GetMapping("/{priceSetId:[0-9]+}") + public AjaxResult getInfo(@PathVariable Long priceSetId) + { + return success(priceSetService.selectPrcPriceSetById(priceSetId)); + } + + @PreAuthorize("@ss.hasPermi('price:set:add')") + @Log(title = "价格套餐", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@Validated @RequestBody PrcPriceSet set) + { + set.setCreateBy(getUsername()); + set.setUpdateBy(getUsername()); + Long id = priceSetService.savePrcPriceSet(set); + return success(id); + } + + @PreAuthorize("@ss.hasPermi('price:set:edit')") + @Log(title = "价格套餐", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@Validated @RequestBody PrcPriceSet set) + { + set.setUpdateBy(getUsername()); + return toAjax(priceSetService.updatePrcPriceSet(set)); + } + + @PreAuthorize("@ss.hasPermi('price:set:remove')") + @Log(title = "价格套餐", businessType = BusinessType.DELETE) + @DeleteMapping("/{priceSetIds}") + public AjaxResult remove(@PathVariable Long[] priceSetIds) + { + return toAjax(priceSetService.deletePrcPriceSetByIds(priceSetIds)); + } + + @PreAuthorize("@ss.hasPermi('price:set:audit')") + @Log(title = "价格套餐提交审核", businessType = BusinessType.UPDATE) + @PutMapping("/submit/{priceSetId}") + public AjaxResult submit(@PathVariable Long priceSetId) + { + return toAjax(priceSetService.submit(priceSetId, getUsername())); + } + + @PreAuthorize("@ss.hasPermi('price:set:audit')") + @Log(title = "价格套餐生效", businessType = BusinessType.UPDATE) + @PutMapping("/approve/{priceSetId}") + public AjaxResult approve(@PathVariable Long priceSetId) + { + return toAjax(priceSetService.approve(priceSetId, getUsername())); + } + + @PreAuthorize("@ss.hasPermi('price:set:audit')") + @Log(title = "价格套餐驳回", businessType = BusinessType.UPDATE) + @PutMapping("/reject/{priceSetId}") + public AjaxResult reject(@PathVariable Long priceSetId) + { + return toAjax(priceSetService.reject(priceSetId, getUsername())); + } + + @PreAuthorize("@ss.hasPermi('price:set:audit')") + @Log(title = "价格套餐停用", businessType = BusinessType.UPDATE) + @PutMapping("/disable/{priceSetId}") + public AjaxResult disable(@PathVariable Long priceSetId) + { + return toAjax(priceSetService.disable(priceSetId, getUsername())); + } + + @PreAuthorize("@ss.hasPermi('price:set:add')") + @Log(title = "价格套餐复用", businessType = BusinessType.INSERT) + @PostMapping("/copy/{priceSetId}") + public AjaxResult copy(@PathVariable Long priceSetId) + { + Long id = priceSetService.copy(priceSetId, getUsername()); + return success(id); + } + + @PreAuthorize("@ss.hasPermi('price:set:query')") + @PostMapping("/validate") + public AjaxResult validate(@RequestBody PrcPriceSet set) + { + return success(priceSetService.validate(set)); + } + + @PreAuthorize("@ss.hasPermi('price:set:list')") + @GetMapping("/detail/list") + public TableDataInfo detailList(PrcPriceSetDetail detail) + { + startPage(); + List list = priceSetService.selectDetailList(detail); + return getDataTable(list); + } + + @PreAuthorize("@ss.hasPermi('price:set:edit')") + @Log(title = "套餐明细", businessType = BusinessType.INSERT) + @PostMapping("/detail") + public AjaxResult addDetail(@RequestBody PrcPriceSetDetail detail) + { + return toAjax(priceSetService.insertDetail(detail)); + } + + @PreAuthorize("@ss.hasPermi('price:set:edit')") + @Log(title = "套餐明细", businessType = BusinessType.UPDATE) + @PutMapping("/detail") + public AjaxResult editDetail(@RequestBody PrcPriceSetDetail detail) + { + return toAjax(priceSetService.updateDetail(detail)); + } + + @PreAuthorize("@ss.hasPermi('price:set:edit')") + @Log(title = "套餐明细", businessType = BusinessType.DELETE) + @DeleteMapping("/detail/{psdIds}") + public AjaxResult removeDetail(@PathVariable Long[] psdIds) + { + return toAjax(priceSetService.deleteDetailByIds(psdIds)); + } + + @PreAuthorize("@ss.hasPermi('price:set:list')") + @GetMapping("/customer/list") + public TableDataInfo customerList(PrcCustomerPriceSet customer) + { + startPage(); + List list = priceSetService.selectCustomerList(customer); + return getDataTable(list); + } + + @PreAuthorize("@ss.hasPermi('price:set:edit')") + @Log(title = "套餐客户绑定", businessType = BusinessType.INSERT) + @PostMapping("/customer") + public AjaxResult addCustomer(@RequestBody PrcCustomerPriceSet customer) + { + customer.setCreateBy(getUsername()); + return toAjax(priceSetService.insertCustomer(customer)); + } + + @PreAuthorize("@ss.hasPermi('price:set:edit')") + @Log(title = "套餐客户绑定", businessType = BusinessType.UPDATE) + @PutMapping("/customer") + public AjaxResult editCustomer(@RequestBody PrcCustomerPriceSet customer) + { + customer.setUpdateBy(getUsername()); + return toAjax(priceSetService.updateCustomer(customer)); + } + + @PreAuthorize("@ss.hasPermi('price:set:edit')") + @Log(title = "套餐客户绑定", businessType = BusinessType.DELETE) + @DeleteMapping("/customer/{customerPricesetIds}") + public AjaxResult removeCustomer(@PathVariable Long[] customerPricesetIds) + { + return toAjax(priceSetService.deleteCustomerByIds(customerPricesetIds)); + } +} diff --git a/bms-back/ruoyi-admin/src/main/java/com/ruoyi/web/controller/price/WeightController.java b/bms-back/ruoyi-admin/src/main/java/com/ruoyi/web/controller/price/WeightController.java new file mode 100644 index 00000000..4bd0d68e --- /dev/null +++ b/bms-back/ruoyi-admin/src/main/java/com/ruoyi/web/controller/price/WeightController.java @@ -0,0 +1,110 @@ +package com.ruoyi.web.controller.price; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +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 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.PrcWeightSectionDetail; +import com.ruoyi.price.domain.PrcWeightSectionTemplate; +import com.ruoyi.price.service.IPrcWeightService; + +/** + * 重量段管理 + * + * @author ruoyi + */ +@RestController +@RequestMapping("/price/weight") +public class WeightController extends BaseController +{ + @Autowired + private IPrcWeightService weightService; + + @PreAuthorize("@ss.hasPermi('price:weight:list')") + @GetMapping("/template/list") + public TableDataInfo templateList(PrcWeightSectionTemplate template) + { + startPage(); + List list = weightService.selectPrcWeightSectionTemplateList(template); + return getDataTable(list); + } + + @PreAuthorize("@ss.hasPermi('price:weight:query')") + @GetMapping("/template/{wstId}") + public AjaxResult getTemplate(@PathVariable Long wstId) + { + return success(weightService.selectPrcWeightSectionTemplateById(wstId)); + } + + @PreAuthorize("@ss.hasPermi('price:weight:add')") + @Log(title = "重量段模板", businessType = BusinessType.INSERT) + @PostMapping("/template") + public AjaxResult addTemplate(@Validated @RequestBody PrcWeightSectionTemplate template) + { + template.setCreateBy(getUsername()); + return toAjax(weightService.insertPrcWeightSectionTemplate(template)); + } + + @PreAuthorize("@ss.hasPermi('price:weight:edit')") + @Log(title = "重量段模板", businessType = BusinessType.UPDATE) + @PutMapping("/template") + public AjaxResult editTemplate(@Validated @RequestBody PrcWeightSectionTemplate template) + { + template.setUpdateBy(getUsername()); + return toAjax(weightService.updatePrcWeightSectionTemplate(template)); + } + + @PreAuthorize("@ss.hasPermi('price:weight:remove')") + @Log(title = "重量段模板", businessType = BusinessType.DELETE) + @DeleteMapping("/template/{wstIds}") + public AjaxResult removeTemplate(@PathVariable Long[] wstIds) + { + return toAjax(weightService.deletePrcWeightSectionTemplateByIds(wstIds)); + } + + @PreAuthorize("@ss.hasPermi('price:weight:list')") + @GetMapping("/detail/list") + public TableDataInfo detailList(PrcWeightSectionDetail detail) + { + startPage(); + List list = weightService.selectPrcWeightSectionDetailList(detail); + return getDataTable(list); + } + + @PreAuthorize("@ss.hasPermi('price:weight:add')") + @Log(title = "重量段明细", businessType = BusinessType.INSERT) + @PostMapping("/detail") + public AjaxResult addDetail(@Validated @RequestBody PrcWeightSectionDetail detail) + { + return toAjax(weightService.insertPrcWeightSectionDetail(detail)); + } + + @PreAuthorize("@ss.hasPermi('price:weight:edit')") + @Log(title = "重量段明细", businessType = BusinessType.UPDATE) + @PutMapping("/detail") + public AjaxResult editDetail(@Validated @RequestBody PrcWeightSectionDetail detail) + { + return toAjax(weightService.updatePrcWeightSectionDetail(detail)); + } + + @PreAuthorize("@ss.hasPermi('price:weight:remove')") + @Log(title = "重量段明细", businessType = BusinessType.DELETE) + @DeleteMapping("/detail/{wsdIds}") + public AjaxResult removeDetail(@PathVariable Long[] wsdIds) + { + return toAjax(weightService.deletePrcWeightSectionDetailByIds(wsdIds)); + } +} diff --git a/bms-back/ruoyi-admin/src/main/java/com/ruoyi/web/controller/price/ZoneController.java b/bms-back/ruoyi-admin/src/main/java/com/ruoyi/web/controller/price/ZoneController.java new file mode 100644 index 00000000..fefd1550 --- /dev/null +++ b/bms-back/ruoyi-admin/src/main/java/com/ruoyi/web/controller/price/ZoneController.java @@ -0,0 +1,144 @@ +package com.ruoyi.web.controller.price; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +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 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; + +/** + * 分区管理 + * + * @author ruoyi + */ +@RestController +@RequestMapping("/price/zone") +public class ZoneController extends BaseController +{ + @Autowired + private IXtdZoneService zoneService; + + @PreAuthorize("@ss.hasPermi('price:zone:list')") + @GetMapping("/scheme/list") + public TableDataInfo schemeList(XtdZoneScheme scheme) + { + startPage(); + List list = zoneService.selectXtdZoneSchemeList(scheme); + return getDataTable(list); + } + + @PreAuthorize("@ss.hasPermi('price:zone:query')") + @GetMapping("/scheme/{zsId}") + public AjaxResult getScheme(@PathVariable Long zsId) + { + 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)); + } + + @PreAuthorize("@ss.hasPermi('price:zone:remove')") + @Log(title = "分区方案", businessType = BusinessType.DELETE) + @DeleteMapping("/scheme/{zsIds}") + public AjaxResult removeScheme(@PathVariable Long[] zsIds) + { + return toAjax(zoneService.deleteXtdZoneSchemeByIds(zsIds)); + } + + @PreAuthorize("@ss.hasPermi('price:zone:list')") + @GetMapping("/division/list") + public TableDataInfo divisionList(XtdZoneDivision division) + { + startPage(); + List list = zoneService.selectXtdZoneDivisionList(division); + return getDataTable(list); + } + + @PreAuthorize("@ss.hasPermi('price:zone:add')") + @Log(title = "分区区划", businessType = BusinessType.INSERT) + @PostMapping("/division") + public AjaxResult addDivision(@Validated @RequestBody XtdZoneDivision division) + { + return toAjax(zoneService.insertXtdZoneDivision(division)); + } + + @PreAuthorize("@ss.hasPermi('price:zone:edit')") + @Log(title = "分区区划", businessType = BusinessType.UPDATE) + @PutMapping("/division") + public AjaxResult editDivision(@Validated @RequestBody XtdZoneDivision division) + { + return toAjax(zoneService.updateXtdZoneDivision(division)); + } + + @PreAuthorize("@ss.hasPermi('price:zone:remove')") + @Log(title = "分区区划", businessType = BusinessType.DELETE) + @DeleteMapping("/division/{zdIds}") + public AjaxResult removeDivision(@PathVariable Long[] zdIds) + { + return toAjax(zoneService.deleteXtdZoneDivisionByIds(zdIds)); + } + + @PreAuthorize("@ss.hasPermi('price:zone:list')") + @GetMapping("/country/list") + public TableDataInfo countryList(XtdZoneCountry country) + { + startPage(); + List list = zoneService.selectXtdZoneCountryList(country); + return getDataTable(list); + } + + @PreAuthorize("@ss.hasPermi('price:zone:add')") + @Log(title = "分区国家", businessType = BusinessType.INSERT) + @PostMapping("/country") + public AjaxResult addCountry(@Validated @RequestBody XtdZoneCountry country) + { + 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)); + } +} diff --git a/bms-back/ruoyi-system/src/main/java/com/ruoyi/price/domain/PrcCustomerPriceSet.java b/bms-back/ruoyi-system/src/main/java/com/ruoyi/price/domain/PrcCustomerPriceSet.java new file mode 100644 index 00000000..1c60367a --- /dev/null +++ b/bms-back/ruoyi-system/src/main/java/com/ruoyi/price/domain/PrcCustomerPriceSet.java @@ -0,0 +1,57 @@ +package com.ruoyi.price.domain; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 客户套餐 prc_customer_price_set + * + * @author ruoyi + */ +public class PrcCustomerPriceSet extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + private Long customerPricesetId; + private Long priceSetId; + private Long customerId; + private String customerName; + /** 优先级,数字越小越优先 */ + private Integer bindPriority; + @JsonFormat(pattern = "yyyy-MM-dd") + private Date prBegindate; + @JsonFormat(pattern = "yyyy-MM-dd") + private Date prEnddate; + private String priceSetNote; + + public Long getCustomerPricesetId() { return customerPricesetId; } + public void setCustomerPricesetId(Long customerPricesetId) { this.customerPricesetId = customerPricesetId; } + public Long getPriceSetId() { return priceSetId; } + public void setPriceSetId(Long priceSetId) { this.priceSetId = priceSetId; } + public Long getCustomerId() { return customerId; } + public void setCustomerId(Long customerId) { this.customerId = customerId; } + public String getCustomerName() { return customerName; } + public void setCustomerName(String customerName) { this.customerName = customerName; } + public Integer getBindPriority() { return bindPriority; } + public void setBindPriority(Integer bindPriority) { this.bindPriority = bindPriority; } + public Date getPrBegindate() { return prBegindate; } + public void setPrBegindate(Date prBegindate) { this.prBegindate = prBegindate; } + public Date getPrEnddate() { return prEnddate; } + public void setPrEnddate(Date prEnddate) { this.prEnddate = prEnddate; } + public String getPriceSetNote() { return priceSetNote; } + public void setPriceSetNote(String priceSetNote) { this.priceSetNote = priceSetNote; } + + @Override + public String toString() + { + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("customerPricesetId", getCustomerPricesetId()) + .append("priceSetId", getPriceSetId()) + .append("customerId", getCustomerId()) + .append("bindPriority", getBindPriority()) + .toString(); + } +} diff --git a/bms-back/ruoyi-system/src/main/java/com/ruoyi/price/domain/PrcPriceSet.java b/bms-back/ruoyi-system/src/main/java/com/ruoyi/price/domain/PrcPriceSet.java new file mode 100644 index 00000000..48fadc15 --- /dev/null +++ b/bms-back/ruoyi-system/src/main/java/com/ruoyi/price/domain/PrcPriceSet.java @@ -0,0 +1,115 @@ +package com.ruoyi.price.domain; + +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 价格套餐 prc_price_set + * + * @author ruoyi + */ +public class PrcPriceSet extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 价格套餐id */ + private Long priceSetId; + /** 套餐编码 */ + private String priceSetCode; + /** 套餐名称 */ + private String priceSetName; + /** 备注 */ + private String priceSetNote; + /** 计价类型 FIXED / DISCOUNT */ + private String setType; + /** 默认折扣百分数 */ + private BigDecimal defaultDiscount; + /** 默认套餐 Y */ + private String defaultType; + /** 试算标记 Y */ + private String calculateSign; + /** 生效日期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + private Date effectiveDate; + /** 失效日期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + private Date expireDate; + /** 状态 D/A/E/R/S */ + private String status; + /** 租户ID */ + private Long tmsId; + + /** 产品数(列表) */ + private Integer productCount; + /** 客户数(列表) */ + private Integer customerCount; + /** 是否已过期(计算字段) */ + private Boolean expired; + /** 列表搜索关键字 */ + private String keyword; + /** 保存后是否提交审核 Y */ + private String submitFlag; + + /** 套餐明细(向导保存) */ + private List details; + /** 绑定客户(向导保存) */ + private List customers; + + public Long getPriceSetId() { return priceSetId; } + public void setPriceSetId(Long priceSetId) { this.priceSetId = priceSetId; } + public String getPriceSetCode() { return priceSetCode; } + public void setPriceSetCode(String priceSetCode) { this.priceSetCode = priceSetCode; } + public String getPriceSetName() { return priceSetName; } + public void setPriceSetName(String priceSetName) { this.priceSetName = priceSetName; } + public String getPriceSetNote() { return priceSetNote; } + public void setPriceSetNote(String priceSetNote) { this.priceSetNote = priceSetNote; } + public String getSetType() { return setType; } + public void setSetType(String setType) { this.setType = setType; } + public BigDecimal getDefaultDiscount() { return defaultDiscount; } + public void setDefaultDiscount(BigDecimal defaultDiscount) { this.defaultDiscount = defaultDiscount; } + public String getDefaultType() { return defaultType; } + public void setDefaultType(String defaultType) { this.defaultType = defaultType; } + public String getCalculateSign() { return calculateSign; } + public void setCalculateSign(String calculateSign) { this.calculateSign = calculateSign; } + public Date getEffectiveDate() { return effectiveDate; } + public void setEffectiveDate(Date effectiveDate) { this.effectiveDate = effectiveDate; } + public Date getExpireDate() { return expireDate; } + public void setExpireDate(Date expireDate) { this.expireDate = expireDate; } + public String getStatus() { return status; } + public void setStatus(String status) { this.status = status; } + public Long getTmsId() { return tmsId; } + public void setTmsId(Long tmsId) { this.tmsId = tmsId; } + public Integer getProductCount() { return productCount; } + public void setProductCount(Integer productCount) { this.productCount = productCount; } + public Integer getCustomerCount() { return customerCount; } + public void setCustomerCount(Integer customerCount) { this.customerCount = customerCount; } + public Boolean getExpired() { return expired; } + public void setExpired(Boolean expired) { this.expired = expired; } + public String getKeyword() { return keyword; } + public void setKeyword(String keyword) { this.keyword = keyword; } + public String getSubmitFlag() { return submitFlag; } + public void setSubmitFlag(String submitFlag) { this.submitFlag = submitFlag; } + public List getDetails() { return details; } + public void setDetails(List details) { this.details = details; } + public List getCustomers() { return customers; } + public void setCustomers(List customers) { this.customers = customers; } + + @Override + public String toString() + { + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("priceSetId", getPriceSetId()) + .append("priceSetCode", getPriceSetCode()) + .append("priceSetName", getPriceSetName()) + .append("setType", getSetType()) + .append("status", getStatus()) + .append("effectiveDate", getEffectiveDate()) + .append("expireDate", getExpireDate()) + .toString(); + } +} diff --git a/bms-back/ruoyi-system/src/main/java/com/ruoyi/price/domain/PrcPriceSetCheckItem.java b/bms-back/ruoyi-system/src/main/java/com/ruoyi/price/domain/PrcPriceSetCheckItem.java new file mode 100644 index 00000000..b9ec6908 --- /dev/null +++ b/bms-back/ruoyi-system/src/main/java/com/ruoyi/price/domain/PrcPriceSetCheckItem.java @@ -0,0 +1,34 @@ +package com.ruoyi.price.domain; + +/** + * 套餐校验项 + * + * @author ruoyi + */ +public class PrcPriceSetCheckItem +{ + /** 校验项名称 */ + private String item; + /** PASS / WARN / FAIL / INFO */ + private String result; + /** 说明 */ + private String message; + + public PrcPriceSetCheckItem() + { + } + + public PrcPriceSetCheckItem(String item, String result, String message) + { + this.item = item; + this.result = result; + this.message = message; + } + + public String getItem() { return item; } + public void setItem(String item) { this.item = item; } + public String getResult() { return result; } + public void setResult(String result) { this.result = result; } + public String getMessage() { return message; } + public void setMessage(String message) { this.message = message; } +} diff --git a/bms-back/ruoyi-system/src/main/java/com/ruoyi/price/domain/PrcPriceSetDetail.java b/bms-back/ruoyi-system/src/main/java/com/ruoyi/price/domain/PrcPriceSetDetail.java new file mode 100644 index 00000000..359196a9 --- /dev/null +++ b/bms-back/ruoyi-system/src/main/java/com/ruoyi/price/domain/PrcPriceSetDetail.java @@ -0,0 +1,79 @@ +package com.ruoyi.price.domain; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +/** + * 价格套餐明细 prc_price_set_detail + * + * @author ruoyi + */ +public class PrcPriceSetDetail implements Serializable +{ + private static final long serialVersionUID = 1L; + + private Long psdId; + private Long priceSetId; + private String productCode; + private String productName; + private String countryCode; + private String countryName; + private Long zdId; + private Long wsdId; + private String weightLabel; + private BigDecimal fvValue; + private BigDecimal fvRegistrationFee; + private BigDecimal discountValue; + private Integer prId; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date createdAt; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date updatedAt; + + public Long getPsdId() { return psdId; } + public void setPsdId(Long psdId) { this.psdId = psdId; } + public Long getPriceSetId() { return priceSetId; } + public void setPriceSetId(Long priceSetId) { this.priceSetId = priceSetId; } + public String getProductCode() { return productCode; } + public void setProductCode(String productCode) { this.productCode = productCode; } + public String getProductName() { return productName; } + public void setProductName(String productName) { this.productName = productName; } + public String getCountryCode() { return countryCode; } + public void setCountryCode(String countryCode) { this.countryCode = countryCode; } + public String getCountryName() { return countryName; } + public void setCountryName(String countryName) { this.countryName = countryName; } + public Long getZdId() { return zdId; } + public void setZdId(Long zdId) { this.zdId = zdId; } + public Long getWsdId() { return wsdId; } + public void setWsdId(Long wsdId) { this.wsdId = wsdId; } + public String getWeightLabel() { return weightLabel; } + public void setWeightLabel(String weightLabel) { this.weightLabel = weightLabel; } + public BigDecimal getFvValue() { return fvValue; } + public void setFvValue(BigDecimal fvValue) { this.fvValue = fvValue; } + public BigDecimal getFvRegistrationFee() { return fvRegistrationFee; } + public void setFvRegistrationFee(BigDecimal fvRegistrationFee) { this.fvRegistrationFee = fvRegistrationFee; } + public BigDecimal getDiscountValue() { return discountValue; } + public void setDiscountValue(BigDecimal discountValue) { this.discountValue = discountValue; } + public Integer getPrId() { return prId; } + public void setPrId(Integer prId) { this.prId = prId; } + public Date getCreatedAt() { return createdAt; } + public void setCreatedAt(Date createdAt) { this.createdAt = createdAt; } + public Date getUpdatedAt() { return updatedAt; } + public void setUpdatedAt(Date updatedAt) { this.updatedAt = updatedAt; } + + @Override + public String toString() + { + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("psdId", getPsdId()) + .append("priceSetId", getPriceSetId()) + .append("productCode", getProductCode()) + .append("countryCode", getCountryCode()) + .append("wsdId", getWsdId()) + .toString(); + } +} diff --git a/bms-back/ruoyi-system/src/main/java/com/ruoyi/price/domain/PrcWeightSectionDetail.java b/bms-back/ruoyi-system/src/main/java/com/ruoyi/price/domain/PrcWeightSectionDetail.java new file mode 100644 index 00000000..3f06d7cd --- /dev/null +++ b/bms-back/ruoyi-system/src/main/java/com/ruoyi/price/domain/PrcWeightSectionDetail.java @@ -0,0 +1,86 @@ +package com.ruoyi.price.domain; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +/** + * 重量段明细 prc_weight_section_detail + * + * @author ruoyi + */ +public class PrcWeightSectionDetail implements Serializable +{ + private static final long serialVersionUID = 1L; + + /** 重量段明细ID */ + private Long wsdId; + /** 重量段模板ID */ + private Long wstId; + /** 段标题 */ + private String wlTitle; + /** 起始重量 */ + private BigDecimal wlStartweight; + /** 结束重量 */ + private BigDecimal wlEndweight; + /** 计费方式代码 */ + private String weightBillingCode; + /** 单位重量 */ + private BigDecimal fvUnitweight; + /** 生效日期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + private Date effectiveDate; + /** 失效日期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + private Date expireDate; + /** 创建时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date createdAt; + /** 更新时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date updatedAt; + + public Long getWsdId() { return wsdId; } + public void setWsdId(Long wsdId) { this.wsdId = wsdId; } + public Long getWstId() { return wstId; } + public void setWstId(Long wstId) { this.wstId = wstId; } + public String getWlTitle() { return wlTitle; } + public void setWlTitle(String wlTitle) { this.wlTitle = wlTitle; } + public BigDecimal getWlStartweight() { return wlStartweight; } + public void setWlStartweight(BigDecimal wlStartweight) { this.wlStartweight = wlStartweight; } + public BigDecimal getWlEndweight() { return wlEndweight; } + public void setWlEndweight(BigDecimal wlEndweight) { this.wlEndweight = wlEndweight; } + public String getWeightBillingCode() { return weightBillingCode; } + public void setWeightBillingCode(String weightBillingCode) { this.weightBillingCode = weightBillingCode; } + public BigDecimal getFvUnitweight() { return fvUnitweight; } + public void setFvUnitweight(BigDecimal fvUnitweight) { this.fvUnitweight = fvUnitweight; } + public Date getEffectiveDate() { return effectiveDate; } + public void setEffectiveDate(Date effectiveDate) { this.effectiveDate = effectiveDate; } + public Date getExpireDate() { return expireDate; } + public void setExpireDate(Date expireDate) { this.expireDate = expireDate; } + public Date getCreatedAt() { return createdAt; } + public void setCreatedAt(Date createdAt) { this.createdAt = createdAt; } + public Date getUpdatedAt() { return updatedAt; } + public void setUpdatedAt(Date updatedAt) { this.updatedAt = updatedAt; } + + @Override + public String toString() + { + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("wsdId", getWsdId()) + .append("wstId", getWstId()) + .append("wlTitle", getWlTitle()) + .append("wlStartweight", getWlStartweight()) + .append("wlEndweight", getWlEndweight()) + .append("weightBillingCode", getWeightBillingCode()) + .append("fvUnitweight", getFvUnitweight()) + .append("effectiveDate", getEffectiveDate()) + .append("expireDate", getExpireDate()) + .append("createdAt", getCreatedAt()) + .append("updatedAt", getUpdatedAt()) + .toString(); + } +} diff --git a/bms-back/ruoyi-system/src/main/java/com/ruoyi/price/domain/PrcWeightSectionTemplate.java b/bms-back/ruoyi-system/src/main/java/com/ruoyi/price/domain/PrcWeightSectionTemplate.java new file mode 100644 index 00000000..67e5b64e --- /dev/null +++ b/bms-back/ruoyi-system/src/main/java/com/ruoyi/price/domain/PrcWeightSectionTemplate.java @@ -0,0 +1,78 @@ +package com.ruoyi.price.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 重量段模板 prc_weight_section_template + * + * @author ruoyi + */ +public class PrcWeightSectionTemplate extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 重量段模板ID */ + private Long wstId; + /** 模板名称 */ + private String wstName; + /** 状态码(on/off) */ + private String ssCode; + /** 产品组代码 */ + private String pgCode; + /** 服务渠道ID */ + private Long snId; + /** 货物类型代码 */ + private String ctCode; + /** 付款方式代码 */ + private String pmCode; + /** 备注 */ + private String wstNote; + /** 租户ID */ + private Long tmsId; + /** 明细数量(列表展示,非表字段) */ + private Integer detailCount; + + public Long getWstId() { return wstId; } + public void setWstId(Long wstId) { this.wstId = wstId; } + public String getWstName() { return wstName; } + public void setWstName(String wstName) { this.wstName = wstName; } + public String getSsCode() { return ssCode; } + public void setSsCode(String ssCode) { this.ssCode = ssCode; } + public String getPgCode() { return pgCode; } + public void setPgCode(String pgCode) { this.pgCode = pgCode; } + public Long getSnId() { return snId; } + public void setSnId(Long snId) { this.snId = snId; } + public String getCtCode() { return ctCode; } + public void setCtCode(String ctCode) { this.ctCode = ctCode; } + public String getPmCode() { return pmCode; } + public void setPmCode(String pmCode) { this.pmCode = pmCode; } + public String getWstNote() { return wstNote; } + public void setWstNote(String wstNote) { this.wstNote = wstNote; } + public Long getTmsId() { return tmsId; } + public void setTmsId(Long tmsId) { this.tmsId = tmsId; } + public Integer getDetailCount() { return detailCount; } + public void setDetailCount(Integer detailCount) { this.detailCount = detailCount; } + + @Override + public String toString() + { + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("wstId", getWstId()) + .append("wstName", getWstName()) + .append("ssCode", getSsCode()) + .append("pgCode", getPgCode()) + .append("snId", getSnId()) + .append("ctCode", getCtCode()) + .append("pmCode", getPmCode()) + .append("wstNote", getWstNote()) + .append("tmsId", getTmsId()) + .append("detailCount", getDetailCount()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/bms-back/ruoyi-system/src/main/java/com/ruoyi/price/domain/XtdZoneCountry.java b/bms-back/ruoyi-system/src/main/java/com/ruoyi/price/domain/XtdZoneCountry.java new file mode 100644 index 00000000..c1be5e35 --- /dev/null +++ b/bms-back/ruoyi-system/src/main/java/com/ruoyi/price/domain/XtdZoneCountry.java @@ -0,0 +1,58 @@ +package com.ruoyi.price.domain; + +import java.io.Serializable; +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +/** + * 分区国家 xtd_zonecountry + * + * @author ruoyi + */ +public class XtdZoneCountry implements Serializable +{ + private static final long serialVersionUID = 1L; + + /** 分区国家ID */ + private Long zcId; + /** 区划ID */ + private Long zdId; + /** 国家代码(ISO2) */ + private String countryCode; + /** 划分类型(默认C) */ + private String zcDividekind; + /** 创建时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date createdAt; + /** 更新时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date updatedAt; + + public Long getZcId() { return zcId; } + public void setZcId(Long zcId) { this.zcId = zcId; } + public Long getZdId() { return zdId; } + public void setZdId(Long zdId) { this.zdId = zdId; } + public String getCountryCode() { return countryCode; } + public void setCountryCode(String countryCode) { this.countryCode = countryCode; } + public String getZcDividekind() { return zcDividekind; } + public void setZcDividekind(String zcDividekind) { this.zcDividekind = zcDividekind; } + public Date getCreatedAt() { return createdAt; } + public void setCreatedAt(Date createdAt) { this.createdAt = createdAt; } + public Date getUpdatedAt() { return updatedAt; } + public void setUpdatedAt(Date updatedAt) { this.updatedAt = updatedAt; } + + @Override + public String toString() + { + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("zcId", getZcId()) + .append("zdId", getZdId()) + .append("countryCode", getCountryCode()) + .append("zcDividekind", getZcDividekind()) + .append("createdAt", getCreatedAt()) + .append("updatedAt", getUpdatedAt()) + .toString(); + } +} diff --git a/bms-back/ruoyi-system/src/main/java/com/ruoyi/price/domain/XtdZoneDivision.java b/bms-back/ruoyi-system/src/main/java/com/ruoyi/price/domain/XtdZoneDivision.java new file mode 100644 index 00000000..d2680972 --- /dev/null +++ b/bms-back/ruoyi-system/src/main/java/com/ruoyi/price/domain/XtdZoneDivision.java @@ -0,0 +1,78 @@ +package com.ruoyi.price.domain; + +import java.io.Serializable; +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +/** + * 分区区划 xtd_zone_division + * + * @author ruoyi + */ +public class XtdZoneDivision implements Serializable +{ + private static final long serialVersionUID = 1L; + + /** 区划ID */ + private Long zdId; + /** 分区方案ID */ + private Long zsId; + /** 排序 */ + private Integer zdSort; + /** 区划代码 */ + private String zdCode; + /** 区划名称 */ + private String znName; + /** 区划英文名 */ + private String znEname; + /** 备注 */ + private String znNote; + /** 创建时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date createdAt; + /** 更新时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date updatedAt; + /** 国家数量(列表展示,非表字段) */ + private Integer countryCount; + + public Long getZdId() { return zdId; } + public void setZdId(Long zdId) { this.zdId = zdId; } + public Long getZsId() { return zsId; } + public void setZsId(Long zsId) { this.zsId = zsId; } + public Integer getZdSort() { return zdSort; } + public void setZdSort(Integer zdSort) { this.zdSort = zdSort; } + public String getZdCode() { return zdCode; } + public void setZdCode(String zdCode) { this.zdCode = zdCode; } + public String getZnName() { return znName; } + public void setZnName(String znName) { this.znName = znName; } + public String getZnEname() { return znEname; } + public void setZnEname(String znEname) { this.znEname = znEname; } + public String getZnNote() { return znNote; } + public void setZnNote(String znNote) { this.znNote = znNote; } + public Date getCreatedAt() { return createdAt; } + public void setCreatedAt(Date createdAt) { this.createdAt = createdAt; } + public Date getUpdatedAt() { return updatedAt; } + public void setUpdatedAt(Date updatedAt) { this.updatedAt = updatedAt; } + public Integer getCountryCount() { return countryCount; } + public void setCountryCount(Integer countryCount) { this.countryCount = countryCount; } + + @Override + public String toString() + { + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("zdId", getZdId()) + .append("zsId", getZsId()) + .append("zdSort", getZdSort()) + .append("zdCode", getZdCode()) + .append("znName", getZnName()) + .append("znEname", getZnEname()) + .append("znNote", getZnNote()) + .append("createdAt", getCreatedAt()) + .append("updatedAt", getUpdatedAt()) + .append("countryCount", getCountryCount()) + .toString(); + } +} diff --git a/bms-back/ruoyi-system/src/main/java/com/ruoyi/price/domain/XtdZoneScheme.java b/bms-back/ruoyi-system/src/main/java/com/ruoyi/price/domain/XtdZoneScheme.java new file mode 100644 index 00000000..2f85494b --- /dev/null +++ b/bms-back/ruoyi-system/src/main/java/com/ruoyi/price/domain/XtdZoneScheme.java @@ -0,0 +1,75 @@ +package com.ruoyi.price.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 分区方案 xtd_zone_scheme + * + * @author ruoyi + */ +public class XtdZoneScheme extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 分区方案ID */ + private Long zsId; + + /** 方案名称 */ + private String zsName; + + /** 状态码(on/off) */ + private String ssCode; + + /** 产品组代码 */ + private String pgCode; + + /** 服务渠道ID */ + private Long snId; + + /** 备注 */ + private String zsNote; + + /** 租户ID */ + private Long tmsId; + + /** 区划数量(列表展示,非表字段) */ + private Integer divisionCount; + + public Long getZsId() { return zsId; } + public void setZsId(Long zsId) { this.zsId = zsId; } + public String getZsName() { return zsName; } + public void setZsName(String zsName) { this.zsName = zsName; } + public String getSsCode() { return ssCode; } + public void setSsCode(String ssCode) { this.ssCode = ssCode; } + public String getPgCode() { return pgCode; } + public void setPgCode(String pgCode) { this.pgCode = pgCode; } + public Long getSnId() { return snId; } + public void setSnId(Long snId) { this.snId = snId; } + public String getZsNote() { return zsNote; } + public void setZsNote(String zsNote) { this.zsNote = zsNote; } + public Long getTmsId() { return tmsId; } + public void setTmsId(Long tmsId) { this.tmsId = tmsId; } + public Integer getDivisionCount() { return divisionCount; } + public void setDivisionCount(Integer divisionCount) { this.divisionCount = divisionCount; } + + @Override + public String toString() + { + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("zsId", getZsId()) + .append("zsName", getZsName()) + .append("ssCode", getSsCode()) + .append("pgCode", getPgCode()) + .append("snId", getSnId()) + .append("zsNote", getZsNote()) + .append("tmsId", getTmsId()) + .append("divisionCount", getDivisionCount()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/bms-back/ruoyi-system/src/main/java/com/ruoyi/price/mapper/PrcCustomerPriceSetMapper.java b/bms-back/ruoyi-system/src/main/java/com/ruoyi/price/mapper/PrcCustomerPriceSetMapper.java new file mode 100644 index 00000000..8f8f60ba --- /dev/null +++ b/bms-back/ruoyi-system/src/main/java/com/ruoyi/price/mapper/PrcCustomerPriceSetMapper.java @@ -0,0 +1,32 @@ +package com.ruoyi.price.mapper; + +import java.util.List; +import org.apache.ibatis.annotations.Param; +import com.ruoyi.price.domain.PrcCustomerPriceSet; + +/** + * 客户套餐 数据层 + * + * @author ruoyi + */ +public interface PrcCustomerPriceSetMapper +{ + public PrcCustomerPriceSet selectPrcCustomerPriceSetById(Long customerPricesetId); + + public List selectPrcCustomerPriceSetList(PrcCustomerPriceSet customer); + + public int insertPrcCustomerPriceSet(PrcCustomerPriceSet customer); + + public int updatePrcCustomerPriceSet(PrcCustomerPriceSet customer); + + public int deletePrcCustomerPriceSetByIds(Long[] customerPricesetIds); + + public int deletePrcCustomerPriceSetByPriceSetId(Long priceSetId); + + public int countByPriceSetId(Long priceSetId); + + public int countOverlap(@Param("customerId") Long customerId, + @Param("priceSetId") Long priceSetId, + @Param("beginDate") java.util.Date beginDate, + @Param("endDate") java.util.Date endDate); +} diff --git a/bms-back/ruoyi-system/src/main/java/com/ruoyi/price/mapper/PrcPriceSetDetailMapper.java b/bms-back/ruoyi-system/src/main/java/com/ruoyi/price/mapper/PrcPriceSetDetailMapper.java new file mode 100644 index 00000000..1931cf8a --- /dev/null +++ b/bms-back/ruoyi-system/src/main/java/com/ruoyi/price/mapper/PrcPriceSetDetailMapper.java @@ -0,0 +1,28 @@ +package com.ruoyi.price.mapper; + +import java.util.List; +import com.ruoyi.price.domain.PrcPriceSetDetail; + +/** + * 价格套餐明细 数据层 + * + * @author ruoyi + */ +public interface PrcPriceSetDetailMapper +{ + public PrcPriceSetDetail selectPrcPriceSetDetailById(Long psdId); + + public List selectPrcPriceSetDetailList(PrcPriceSetDetail detail); + + public int insertPrcPriceSetDetail(PrcPriceSetDetail detail); + + public int updatePrcPriceSetDetail(PrcPriceSetDetail detail); + + public int deletePrcPriceSetDetailByIds(Long[] psdIds); + + public int deletePrcPriceSetDetailByPriceSetId(Long priceSetId); + + public int countProductByPriceSetId(Long priceSetId); + + public int countByPriceSetId(Long priceSetId); +} diff --git a/bms-back/ruoyi-system/src/main/java/com/ruoyi/price/mapper/PrcPriceSetMapper.java b/bms-back/ruoyi-system/src/main/java/com/ruoyi/price/mapper/PrcPriceSetMapper.java new file mode 100644 index 00000000..7ba25c59 --- /dev/null +++ b/bms-back/ruoyi-system/src/main/java/com/ruoyi/price/mapper/PrcPriceSetMapper.java @@ -0,0 +1,26 @@ +package com.ruoyi.price.mapper; + +import java.util.List; +import com.ruoyi.price.domain.PrcPriceSet; + +/** + * 价格套餐 数据层 + * + * @author ruoyi + */ +public interface PrcPriceSetMapper +{ + public PrcPriceSet selectPrcPriceSetById(Long priceSetId); + + public List selectPrcPriceSetList(PrcPriceSet set); + + public int insertPrcPriceSet(PrcPriceSet set); + + public int updatePrcPriceSet(PrcPriceSet set); + + public int updatePrcPriceSetStatus(PrcPriceSet set); + + public int deletePrcPriceSetByIds(Long[] priceSetIds); + + public int countByName(PrcPriceSet set); +} diff --git a/bms-back/ruoyi-system/src/main/java/com/ruoyi/price/mapper/PrcWeightSectionDetailMapper.java b/bms-back/ruoyi-system/src/main/java/com/ruoyi/price/mapper/PrcWeightSectionDetailMapper.java new file mode 100644 index 00000000..85d41c00 --- /dev/null +++ b/bms-back/ruoyi-system/src/main/java/com/ruoyi/price/mapper/PrcWeightSectionDetailMapper.java @@ -0,0 +1,26 @@ +package com.ruoyi.price.mapper; + +import java.util.List; +import com.ruoyi.price.domain.PrcWeightSectionDetail; + +/** + * 重量段明细 数据层 + * + * @author ruoyi + */ +public interface PrcWeightSectionDetailMapper +{ + public PrcWeightSectionDetail selectPrcWeightSectionDetailById(Long wsdId); + + public List selectPrcWeightSectionDetailListByWstId(Long wstId); + + public List selectPrcWeightSectionDetailList(PrcWeightSectionDetail detail); + + public int insertPrcWeightSectionDetail(PrcWeightSectionDetail detail); + + public int updatePrcWeightSectionDetail(PrcWeightSectionDetail detail); + + public int deletePrcWeightSectionDetailByIds(Long[] wsdIds); + + public int countByWstId(Long wstId); +} diff --git a/bms-back/ruoyi-system/src/main/java/com/ruoyi/price/mapper/PrcWeightSectionTemplateMapper.java b/bms-back/ruoyi-system/src/main/java/com/ruoyi/price/mapper/PrcWeightSectionTemplateMapper.java new file mode 100644 index 00000000..32050f22 --- /dev/null +++ b/bms-back/ruoyi-system/src/main/java/com/ruoyi/price/mapper/PrcWeightSectionTemplateMapper.java @@ -0,0 +1,22 @@ +package com.ruoyi.price.mapper; + +import java.util.List; +import com.ruoyi.price.domain.PrcWeightSectionTemplate; + +/** + * 重量段模板 数据层 + * + * @author ruoyi + */ +public interface PrcWeightSectionTemplateMapper +{ + public PrcWeightSectionTemplate selectPrcWeightSectionTemplateById(Long wstId); + + public List selectPrcWeightSectionTemplateList(PrcWeightSectionTemplate template); + + public int insertPrcWeightSectionTemplate(PrcWeightSectionTemplate template); + + public int updatePrcWeightSectionTemplate(PrcWeightSectionTemplate template); + + public int deletePrcWeightSectionTemplateByIds(Long[] wstIds); +} diff --git a/bms-back/ruoyi-system/src/main/java/com/ruoyi/price/mapper/XtdZoneCountryMapper.java b/bms-back/ruoyi-system/src/main/java/com/ruoyi/price/mapper/XtdZoneCountryMapper.java new file mode 100644 index 00000000..89619f6f --- /dev/null +++ b/bms-back/ruoyi-system/src/main/java/com/ruoyi/price/mapper/XtdZoneCountryMapper.java @@ -0,0 +1,26 @@ +package com.ruoyi.price.mapper; + +import java.util.List; +import com.ruoyi.price.domain.XtdZoneCountry; + +/** + * 分区国家 数据层 + * + * @author ruoyi + */ +public interface XtdZoneCountryMapper +{ + public XtdZoneCountry selectXtdZoneCountryById(Long zcId); + + public List selectXtdZoneCountryListByZdId(Long zdId); + + public List selectXtdZoneCountryList(XtdZoneCountry country); + + public int insertXtdZoneCountry(XtdZoneCountry country); + + public int updateXtdZoneCountry(XtdZoneCountry country); + + public int deleteXtdZoneCountryByIds(Long[] zcIds); + + public int countByZdId(Long zdId); +} diff --git a/bms-back/ruoyi-system/src/main/java/com/ruoyi/price/mapper/XtdZoneDivisionMapper.java b/bms-back/ruoyi-system/src/main/java/com/ruoyi/price/mapper/XtdZoneDivisionMapper.java new file mode 100644 index 00000000..c0f52705 --- /dev/null +++ b/bms-back/ruoyi-system/src/main/java/com/ruoyi/price/mapper/XtdZoneDivisionMapper.java @@ -0,0 +1,26 @@ +package com.ruoyi.price.mapper; + +import java.util.List; +import com.ruoyi.price.domain.XtdZoneDivision; + +/** + * 分区区划 数据层 + * + * @author ruoyi + */ +public interface XtdZoneDivisionMapper +{ + public XtdZoneDivision selectXtdZoneDivisionById(Long zdId); + + public List selectXtdZoneDivisionListByZsId(Long zsId); + + public List selectXtdZoneDivisionList(XtdZoneDivision division); + + public int insertXtdZoneDivision(XtdZoneDivision division); + + public int updateXtdZoneDivision(XtdZoneDivision division); + + public int deleteXtdZoneDivisionByIds(Long[] zdIds); + + public int countByZsId(Long zsId); +} diff --git a/bms-back/ruoyi-system/src/main/java/com/ruoyi/price/mapper/XtdZoneSchemeMapper.java b/bms-back/ruoyi-system/src/main/java/com/ruoyi/price/mapper/XtdZoneSchemeMapper.java new file mode 100644 index 00000000..62573bd4 --- /dev/null +++ b/bms-back/ruoyi-system/src/main/java/com/ruoyi/price/mapper/XtdZoneSchemeMapper.java @@ -0,0 +1,22 @@ +package com.ruoyi.price.mapper; + +import java.util.List; +import com.ruoyi.price.domain.XtdZoneScheme; + +/** + * 分区方案 数据层 + * + * @author ruoyi + */ +public interface XtdZoneSchemeMapper +{ + public XtdZoneScheme selectXtdZoneSchemeById(Long zsId); + + public List selectXtdZoneSchemeList(XtdZoneScheme scheme); + + public int insertXtdZoneScheme(XtdZoneScheme scheme); + + public int updateXtdZoneScheme(XtdZoneScheme scheme); + + public int deleteXtdZoneSchemeByIds(Long[] zsIds); +} diff --git a/bms-back/ruoyi-system/src/main/java/com/ruoyi/price/service/IPrcPriceSetService.java b/bms-back/ruoyi-system/src/main/java/com/ruoyi/price/service/IPrcPriceSetService.java new file mode 100644 index 00000000..7a5f2685 --- /dev/null +++ b/bms-back/ruoyi-system/src/main/java/com/ruoyi/price/service/IPrcPriceSetService.java @@ -0,0 +1,53 @@ +package com.ruoyi.price.service; + +import java.util.List; +import com.ruoyi.price.domain.PrcCustomerPriceSet; +import com.ruoyi.price.domain.PrcPriceSet; +import com.ruoyi.price.domain.PrcPriceSetCheckItem; +import com.ruoyi.price.domain.PrcPriceSetDetail; + +/** + * 价格套餐 服务层 + * + * @author ruoyi + */ +public interface IPrcPriceSetService +{ + public PrcPriceSet selectPrcPriceSetById(Long priceSetId); + + public List selectPrcPriceSetList(PrcPriceSet set); + + public Long savePrcPriceSet(PrcPriceSet set); + + public int updatePrcPriceSet(PrcPriceSet set); + + public int deletePrcPriceSetByIds(Long[] priceSetIds); + + public int submit(Long priceSetId, String updateBy); + + public int approve(Long priceSetId, String updateBy); + + public int reject(Long priceSetId, String updateBy); + + public int disable(Long priceSetId, String updateBy); + + public Long copy(Long priceSetId, String createBy); + + public List validate(PrcPriceSet set); + + public List selectDetailList(PrcPriceSetDetail detail); + + public int insertDetail(PrcPriceSetDetail detail); + + public int updateDetail(PrcPriceSetDetail detail); + + public int deleteDetailByIds(Long[] psdIds); + + public List selectCustomerList(PrcCustomerPriceSet customer); + + public int insertCustomer(PrcCustomerPriceSet customer); + + public int updateCustomer(PrcCustomerPriceSet customer); + + public int deleteCustomerByIds(Long[] customerPricesetIds); +} diff --git a/bms-back/ruoyi-system/src/main/java/com/ruoyi/price/service/IPrcWeightService.java b/bms-back/ruoyi-system/src/main/java/com/ruoyi/price/service/IPrcWeightService.java new file mode 100644 index 00000000..d4b6221e --- /dev/null +++ b/bms-back/ruoyi-system/src/main/java/com/ruoyi/price/service/IPrcWeightService.java @@ -0,0 +1,33 @@ +package com.ruoyi.price.service; + +import java.util.List; +import com.ruoyi.price.domain.PrcWeightSectionDetail; +import com.ruoyi.price.domain.PrcWeightSectionTemplate; + +/** + * 重量段管理 服务层 + * + * @author ruoyi + */ +public interface IPrcWeightService +{ + public PrcWeightSectionTemplate selectPrcWeightSectionTemplateById(Long wstId); + + public List selectPrcWeightSectionTemplateList(PrcWeightSectionTemplate template); + + public int insertPrcWeightSectionTemplate(PrcWeightSectionTemplate template); + + public int updatePrcWeightSectionTemplate(PrcWeightSectionTemplate template); + + public int deletePrcWeightSectionTemplateByIds(Long[] wstIds); + + public PrcWeightSectionDetail selectPrcWeightSectionDetailById(Long wsdId); + + public List selectPrcWeightSectionDetailList(PrcWeightSectionDetail detail); + + public int insertPrcWeightSectionDetail(PrcWeightSectionDetail detail); + + public int updatePrcWeightSectionDetail(PrcWeightSectionDetail detail); + + public int deletePrcWeightSectionDetailByIds(Long[] wsdIds); +} diff --git a/bms-back/ruoyi-system/src/main/java/com/ruoyi/price/service/IXtdZoneService.java b/bms-back/ruoyi-system/src/main/java/com/ruoyi/price/service/IXtdZoneService.java new file mode 100644 index 00000000..6e7e4de8 --- /dev/null +++ b/bms-back/ruoyi-system/src/main/java/com/ruoyi/price/service/IXtdZoneService.java @@ -0,0 +1,44 @@ +package com.ruoyi.price.service; + +import java.util.List; +import com.ruoyi.price.domain.XtdZoneCountry; +import com.ruoyi.price.domain.XtdZoneDivision; +import com.ruoyi.price.domain.XtdZoneScheme; + +/** + * 分区管理 服务层 + * + * @author ruoyi + */ +public interface IXtdZoneService +{ + public XtdZoneScheme selectXtdZoneSchemeById(Long zsId); + + public List selectXtdZoneSchemeList(XtdZoneScheme scheme); + + public int insertXtdZoneScheme(XtdZoneScheme scheme); + + public int updateXtdZoneScheme(XtdZoneScheme scheme); + + public int deleteXtdZoneSchemeByIds(Long[] zsIds); + + public XtdZoneDivision selectXtdZoneDivisionById(Long zdId); + + public List selectXtdZoneDivisionList(XtdZoneDivision division); + + public int insertXtdZoneDivision(XtdZoneDivision division); + + public int updateXtdZoneDivision(XtdZoneDivision division); + + public int deleteXtdZoneDivisionByIds(Long[] zdIds); + + public XtdZoneCountry selectXtdZoneCountryById(Long zcId); + + public List selectXtdZoneCountryList(XtdZoneCountry country); + + public int insertXtdZoneCountry(XtdZoneCountry country); + + public int updateXtdZoneCountry(XtdZoneCountry country); + + public int deleteXtdZoneCountryByIds(Long[] zcIds); +} diff --git a/bms-back/ruoyi-system/src/main/java/com/ruoyi/price/service/impl/PrcPriceSetServiceImpl.java b/bms-back/ruoyi-system/src/main/java/com/ruoyi/price/service/impl/PrcPriceSetServiceImpl.java new file mode 100644 index 00000000..60840c93 --- /dev/null +++ b/bms-back/ruoyi-system/src/main/java/com/ruoyi/price/service/impl/PrcPriceSetServiceImpl.java @@ -0,0 +1,751 @@ +package com.ruoyi.price.service.impl; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.price.domain.PrcCustomerPriceSet; +import com.ruoyi.price.domain.PrcPriceSet; +import com.ruoyi.price.domain.PrcPriceSetCheckItem; +import com.ruoyi.price.domain.PrcPriceSetDetail; +import com.ruoyi.price.mapper.PrcCustomerPriceSetMapper; +import com.ruoyi.price.mapper.PrcPriceSetDetailMapper; +import com.ruoyi.price.mapper.PrcPriceSetMapper; +import com.ruoyi.price.service.IPrcPriceSetService; + +/** + * 价格套餐 服务层实现 + * + * @author ruoyi + */ +@Service +public class PrcPriceSetServiceImpl implements IPrcPriceSetService +{ + private static final String STATUS_DRAFT = "D"; + private static final String STATUS_AUDIT = "A"; + private static final String STATUS_EFFECT = "E"; + private static final String STATUS_REJECT = "R"; + private static final String STATUS_STOP = "S"; + private static final String TYPE_FIXED = "FIXED"; + private static final String TYPE_DISCOUNT = "DISCOUNT"; + + @Autowired + private PrcPriceSetMapper setMapper; + + @Autowired + private PrcPriceSetDetailMapper detailMapper; + + @Autowired + private PrcCustomerPriceSetMapper customerMapper; + + @Override + public PrcPriceSet selectPrcPriceSetById(Long priceSetId) + { + PrcPriceSet set = setMapper.selectPrcPriceSetById(priceSetId); + if (set != null) + { + fillExpired(set); + PrcPriceSetDetail query = new PrcPriceSetDetail(); + query.setPriceSetId(priceSetId); + set.setDetails(detailMapper.selectPrcPriceSetDetailList(query)); + PrcCustomerPriceSet cquery = new PrcCustomerPriceSet(); + cquery.setPriceSetId(priceSetId); + set.setCustomers(customerMapper.selectPrcCustomerPriceSetList(cquery)); + } + return set; + } + + @Override + public List selectPrcPriceSetList(PrcPriceSet set) + { + List list = setMapper.selectPrcPriceSetList(set); + for (PrcPriceSet item : list) + { + fillExpired(item); + } + return list; + } + + @Override + @Transactional + public Long savePrcPriceSet(PrcPriceSet set) + { + validateBasic(set, false); + if (set.getPriceSetId() == null) + { + if (StringUtils.isEmpty(set.getStatus())) + { + set.setStatus(STATUS_DRAFT); + } + if (!STATUS_DRAFT.equals(set.getStatus()) && !STATUS_AUDIT.equals(set.getStatus())) + { + set.setStatus(STATUS_DRAFT); + } + if (StringUtils.isEmpty(set.getSetType())) + { + set.setSetType(TYPE_FIXED); + } + setMapper.insertPrcPriceSet(set); + if (StringUtils.isEmpty(set.getPriceSetCode())) + { + set.setPriceSetCode(String.format("SET%04d", set.getPriceSetId())); + setMapper.updatePrcPriceSet(set); + } + } + else + { + PrcPriceSet db = requireSet(set.getPriceSetId()); + assertBasicEditable(db); + set.setStatus(db.getStatus()); + setMapper.updatePrcPriceSet(set); + } + replaceChildren(set); + if ("Y".equalsIgnoreCase(set.getSubmitFlag())) + { + submit(set.getPriceSetId(), set.getUpdateBy() != null ? set.getUpdateBy() : set.getCreateBy()); + } + return set.getPriceSetId(); + } + + @Override + public int updatePrcPriceSet(PrcPriceSet set) + { + PrcPriceSet db = requireSet(set.getPriceSetId()); + assertBasicEditable(db); + validateBasic(set, false); + set.setStatus(db.getStatus()); + return setMapper.updatePrcPriceSet(set); + } + + @Override + @Transactional + public int deletePrcPriceSetByIds(Long[] priceSetIds) + { + for (Long id : priceSetIds) + { + PrcPriceSet db = requireSet(id); + if (!STATUS_DRAFT.equals(db.getStatus()) && !STATUS_REJECT.equals(db.getStatus())) + { + throw new ServiceException("仅草稿或驳回状态的套餐允许删除:" + displayName(db)); + } + int bound = customerMapper.countByPriceSetId(id); + if (bound > 0) + { + throw new ServiceException("套餐【" + displayName(db) + "】已绑定客户,请先解绑后再删除"); + } + detailMapper.deletePrcPriceSetDetailByPriceSetId(id); + } + return setMapper.deletePrcPriceSetByIds(priceSetIds); + } + + @Override + public int submit(Long priceSetId, String updateBy) + { + PrcPriceSet db = requireSet(priceSetId); + if (!STATUS_DRAFT.equals(db.getStatus()) && !STATUS_REJECT.equals(db.getStatus())) + { + throw new ServiceException("当前状态不允许提交审核"); + } + PrcPriceSet payload = selectPrcPriceSetById(priceSetId); + List items = validate(payload); + assertNoFail(items); + PrcPriceSet upd = new PrcPriceSet(); + upd.setPriceSetId(priceSetId); + upd.setStatus(STATUS_AUDIT); + upd.setUpdateBy(updateBy); + return setMapper.updatePrcPriceSetStatus(upd); + } + + @Override + public int approve(Long priceSetId, String updateBy) + { + PrcPriceSet db = requireSet(priceSetId); + if (!STATUS_AUDIT.equals(db.getStatus())) + { + throw new ServiceException("仅审核中的套餐可以生效"); + } + PrcPriceSet upd = new PrcPriceSet(); + upd.setPriceSetId(priceSetId); + upd.setStatus(STATUS_EFFECT); + upd.setUpdateBy(updateBy); + return setMapper.updatePrcPriceSetStatus(upd); + } + + @Override + public int reject(Long priceSetId, String updateBy) + { + PrcPriceSet db = requireSet(priceSetId); + if (!STATUS_AUDIT.equals(db.getStatus())) + { + throw new ServiceException("仅审核中的套餐可以驳回"); + } + PrcPriceSet upd = new PrcPriceSet(); + upd.setPriceSetId(priceSetId); + upd.setStatus(STATUS_REJECT); + upd.setUpdateBy(updateBy); + return setMapper.updatePrcPriceSetStatus(upd); + } + + @Override + public int disable(Long priceSetId, String updateBy) + { + PrcPriceSet db = requireSet(priceSetId); + if (!STATUS_EFFECT.equals(db.getStatus())) + { + throw new ServiceException("仅生效中的套餐可以停用"); + } + PrcPriceSet upd = new PrcPriceSet(); + upd.setPriceSetId(priceSetId); + upd.setStatus(STATUS_STOP); + upd.setUpdateBy(updateBy); + return setMapper.updatePrcPriceSetStatus(upd); + } + + @Override + @Transactional + public Long copy(Long priceSetId, String createBy) + { + PrcPriceSet src = selectPrcPriceSetById(priceSetId); + if (src == null) + { + throw new ServiceException("套餐不存在"); + } + PrcPriceSet copy = new PrcPriceSet(); + copy.setPriceSetName(src.getPriceSetName() + "-副本"); + copy.setPriceSetNote(src.getPriceSetNote()); + copy.setSetType(src.getSetType()); + copy.setDefaultDiscount(src.getDefaultDiscount()); + copy.setDefaultType(src.getDefaultType()); + copy.setCalculateSign(src.getCalculateSign()); + copy.setEffectiveDate(src.getEffectiveDate()); + copy.setExpireDate(src.getExpireDate()); + copy.setStatus(STATUS_DRAFT); + copy.setTmsId(src.getTmsId()); + copy.setCreateBy(createBy); + List details = new ArrayList(); + if (src.getDetails() != null) + { + for (PrcPriceSetDetail d : src.getDetails()) + { + PrcPriceSetDetail nd = new PrcPriceSetDetail(); + nd.setProductCode(d.getProductCode()); + nd.setProductName(d.getProductName()); + nd.setCountryCode(d.getCountryCode()); + nd.setCountryName(d.getCountryName()); + nd.setZdId(d.getZdId()); + nd.setWsdId(d.getWsdId()); + nd.setWeightLabel(d.getWeightLabel()); + nd.setFvValue(d.getFvValue()); + nd.setFvRegistrationFee(d.getFvRegistrationFee()); + nd.setDiscountValue(d.getDiscountValue()); + nd.setPrId(d.getPrId()); + details.add(nd); + } + } + copy.setDetails(details); + copy.setCustomers(new ArrayList()); + return savePrcPriceSet(copy); + } + + @Override + public List validate(PrcPriceSet set) + { + List items = new ArrayList(); + if (set.getPriceSetId() != null && (set.getDetails() == null || set.getCustomers() == null)) + { + PrcPriceSet db = selectPrcPriceSetById(set.getPriceSetId()); + if (db != null) + { + if (StringUtils.isEmpty(set.getPriceSetName())) + { + set.setPriceSetName(db.getPriceSetName()); + } + if (set.getSetType() == null) + { + set.setSetType(db.getSetType()); + } + if (set.getEffectiveDate() == null) + { + set.setEffectiveDate(db.getEffectiveDate()); + } + if (set.getExpireDate() == null) + { + set.setExpireDate(db.getExpireDate()); + } + if (set.getDefaultDiscount() == null) + { + set.setDefaultDiscount(db.getDefaultDiscount()); + } + if (set.getDetails() == null) + { + set.setDetails(db.getDetails()); + } + if (set.getCustomers() == null) + { + set.setCustomers(db.getCustomers()); + } + } + } + + int nameCount = setMapper.countByName(set); + if (StringUtils.isEmpty(set.getPriceSetName())) + { + items.add(new PrcPriceSetCheckItem("套餐名称是否重复", "FAIL", "套餐名称不能为空")); + } + else if (nameCount > 0) + { + items.add(new PrcPriceSetCheckItem("套餐名称是否重复", "FAIL", "当前名称已被占用")); + } + else + { + items.add(new PrcPriceSetCheckItem("套餐名称是否重复", "PASS", "当前名称未占用")); + } + + if (set.getEffectiveDate() == null) + { + items.add(new PrcPriceSetCheckItem("生效日期 ≤ 失效日期", "FAIL", "生效日期不能为空")); + } + else if (set.getExpireDate() != null && set.getEffectiveDate().after(set.getExpireDate())) + { + items.add(new PrcPriceSetCheckItem("生效日期 ≤ 失效日期", "FAIL", "生效日期不能晚于失效日期")); + } + else + { + String msg = DateUtils.parseDateToStr("yyyy-MM-dd", set.getEffectiveDate()) + + " ≤ " + + (set.getExpireDate() == null ? "长期" : DateUtils.parseDateToStr("yyyy-MM-dd", set.getExpireDate())); + items.add(new PrcPriceSetCheckItem("生效日期 ≤ 失效日期", "PASS", msg)); + } + + String setType = StringUtils.isEmpty(set.getSetType()) ? TYPE_FIXED : set.getSetType(); + List details = filterDetails(set.getDetails()); + if (TYPE_FIXED.equals(setType)) + { + int incomplete = 0; + for (PrcPriceSetDetail d : details) + { + if (StringUtils.isEmpty(d.getProductCode()) || StringUtils.isEmpty(d.getCountryCode()) + || (d.getWsdId() == null && StringUtils.isEmpty(d.getWeightLabel())) + || d.getFvValue() == null || d.getFvRegistrationFee() == null) + { + incomplete++; + } + } + if (details.isEmpty()) + { + items.add(new PrcPriceSetCheckItem("FIXED 明细完整性", "FAIL", "固定价模式至少需要 1 条明细")); + } + else if (incomplete > 0) + { + items.add(new PrcPriceSetCheckItem("FIXED 明细完整性", "FAIL", incomplete + " 条明细缺少产品/国家/重量段/运费/挂号费")); + } + else + { + items.add(new PrcPriceSetCheckItem("FIXED 明细完整性", "PASS", details.size() + " 条明细,运费与挂号费均填写")); + } + } + else + { + if (set.getDefaultDiscount() == null + || set.getDefaultDiscount().compareTo(BigDecimal.ONE) < 0 + || set.getDefaultDiscount().compareTo(new BigDecimal("99")) > 0) + { + items.add(new PrcPriceSetCheckItem("DISCOUNT 默认折扣", "FAIL", "折扣模式默认折扣需在 1~99")); + } + else + { + items.add(new PrcPriceSetCheckItem("DISCOUNT 默认折扣", "PASS", "默认折扣 " + set.getDefaultDiscount().stripTrailingZeros().toPlainString() + "%")); + } + } + + Set uniq = new HashSet(); + boolean dup = false; + for (PrcPriceSetDetail d : details) + { + String key; + if (TYPE_FIXED.equals(setType)) + { + key = nvl(d.getProductCode()) + "|" + nvl(d.getCountryCode()) + "|" + + (d.getWsdId() != null ? d.getWsdId() : nvl(d.getWeightLabel())); + } + else + { + key = nvl(d.getProductCode()); + } + if (!uniq.add(key) && StringUtils.isNotEmpty(d.getProductCode())) + { + dup = true; + break; + } + } + if (dup) + { + items.add(new PrcPriceSetCheckItem("同产品同国家同重量段是否重复", "FAIL", "存在重复明细")); + } + else + { + items.add(new PrcPriceSetCheckItem("同产品同国家同重量段是否重复", "PASS", "无重复明细")); + } + + List customers = filterCustomers(set.getCustomers()); + int overlap = 0; + for (PrcCustomerPriceSet c : customers) + { + overlap += customerMapper.countOverlap(c.getCustomerId(), set.getPriceSetId(), + c.getPrBegindate() != null ? c.getPrBegindate() : set.getEffectiveDate(), + c.getPrEnddate() != null ? c.getPrEnddate() : set.getExpireDate()); + } + if (overlap > 0) + { + items.add(new PrcPriceSetCheckItem("与同客户现有套餐是否冲突", "WARN", "存在 " + overlap + " 条与已生效套餐日期重叠的客户绑定,可共存但需确认优先级")); + } + else if (customers.isEmpty()) + { + items.add(new PrcPriceSetCheckItem("与同客户现有套餐是否冲突", "INFO", "暂未绑定客户,可后续补充")); + } + else + { + items.add(new PrcPriceSetCheckItem("与同客户现有套餐是否冲突", "PASS", "未发现与已生效套餐的日期重叠")); + } + + if (TYPE_FIXED.equals(setType) && !details.isEmpty()) + { + items.add(new PrcPriceSetCheckItem("运费单价 vs 默认等级价偏差", "INFO", "默认等级价对照将在计费试算上线后自动计算")); + } + else if (TYPE_DISCOUNT.equals(setType)) + { + items.add(new PrcPriceSetCheckItem("运费单价 vs 默认等级价偏差", "INFO", "折扣模式按下单时默认等级价 × 折扣计费")); + } + + return items; + } + + @Override + public List selectDetailList(PrcPriceSetDetail detail) + { + return detailMapper.selectPrcPriceSetDetailList(detail); + } + + @Override + public int insertDetail(PrcPriceSetDetail detail) + { + PrcPriceSet db = requireSet(detail.getPriceSetId()); + assertChildEditable(db); + validateDetail(db, detail); + return detailMapper.insertPrcPriceSetDetail(detail); + } + + @Override + public int updateDetail(PrcPriceSetDetail detail) + { + PrcPriceSetDetail old = detailMapper.selectPrcPriceSetDetailById(detail.getPsdId()); + if (old == null) + { + throw new ServiceException("套餐明细不存在"); + } + PrcPriceSet db = requireSet(old.getPriceSetId()); + assertChildEditable(db); + detail.setPriceSetId(old.getPriceSetId()); + validateDetail(db, detail); + return detailMapper.updatePrcPriceSetDetail(detail); + } + + @Override + public int deleteDetailByIds(Long[] psdIds) + { + for (Long id : psdIds) + { + PrcPriceSetDetail old = detailMapper.selectPrcPriceSetDetailById(id); + if (old == null) + { + continue; + } + PrcPriceSet db = requireSet(old.getPriceSetId()); + assertChildEditable(db); + } + return detailMapper.deletePrcPriceSetDetailByIds(psdIds); + } + + @Override + public List selectCustomerList(PrcCustomerPriceSet customer) + { + return customerMapper.selectPrcCustomerPriceSetList(customer); + } + + @Override + public int insertCustomer(PrcCustomerPriceSet customer) + { + PrcPriceSet db = requireSet(customer.getPriceSetId()); + assertChildEditable(db); + validateCustomer(customer, db); + if (customer.getBindPriority() == null) + { + customer.setBindPriority(1); + } + return customerMapper.insertPrcCustomerPriceSet(customer); + } + + @Override + public int updateCustomer(PrcCustomerPriceSet customer) + { + PrcCustomerPriceSet old = customerMapper.selectPrcCustomerPriceSetById(customer.getCustomerPricesetId()); + if (old == null) + { + throw new ServiceException("客户绑定不存在"); + } + PrcPriceSet db = requireSet(old.getPriceSetId()); + assertChildEditable(db); + customer.setPriceSetId(old.getPriceSetId()); + validateCustomer(customer, db); + return customerMapper.updatePrcCustomerPriceSet(customer); + } + + @Override + public int deleteCustomerByIds(Long[] customerPricesetIds) + { + for (Long id : customerPricesetIds) + { + PrcCustomerPriceSet old = customerMapper.selectPrcCustomerPriceSetById(id); + if (old == null) + { + continue; + } + PrcPriceSet db = requireSet(old.getPriceSetId()); + if (STATUS_AUDIT.equals(db.getStatus())) + { + throw new ServiceException("审核中的套餐不允许解绑客户"); + } + } + return customerMapper.deletePrcCustomerPriceSetByIds(customerPricesetIds); + } + + private void replaceChildren(PrcPriceSet set) + { + if (set.getDetails() != null) + { + detailMapper.deletePrcPriceSetDetailByPriceSetId(set.getPriceSetId()); + for (PrcPriceSetDetail d : filterDetails(set.getDetails())) + { + validateDetail(set, d); + d.setPsdId(null); + d.setPriceSetId(set.getPriceSetId()); + detailMapper.insertPrcPriceSetDetail(d); + } + } + if (set.getCustomers() != null) + { + customerMapper.deletePrcCustomerPriceSetByPriceSetId(set.getPriceSetId()); + for (PrcCustomerPriceSet c : filterCustomers(set.getCustomers())) + { + validateCustomer(c, set); + c.setCustomerPricesetId(null); + c.setPriceSetId(set.getPriceSetId()); + c.setCreateBy(set.getCreateBy()); + if (c.getBindPriority() == null) + { + c.setBindPriority(1); + } + customerMapper.insertPrcCustomerPriceSet(c); + } + } + } + + private void validateBasic(PrcPriceSet set, boolean strictSubmit) + { + if (StringUtils.isEmpty(set.getPriceSetName())) + { + throw new ServiceException("套餐名称不能为空"); + } + if (set.getEffectiveDate() == null) + { + throw new ServiceException("生效日期不能为空"); + } + if (set.getExpireDate() != null && set.getEffectiveDate().after(set.getExpireDate())) + { + throw new ServiceException("生效日期不能晚于失效日期"); + } + if (TYPE_DISCOUNT.equals(set.getSetType())) + { + if (set.getDefaultDiscount() == null + || set.getDefaultDiscount().compareTo(BigDecimal.ONE) < 0 + || set.getDefaultDiscount().compareTo(new BigDecimal("99")) > 0) + { + throw new ServiceException("折扣模式默认折扣需在 1~99"); + } + } + if (setMapper.countByName(set) > 0) + { + throw new ServiceException("套餐名称已存在"); + } + if (strictSubmit) + { + assertNoFail(validate(set)); + } + } + + private void validateDetail(PrcPriceSet set, PrcPriceSetDetail detail) + { + if (StringUtils.isEmpty(detail.getProductCode())) + { + throw new ServiceException("明细产品代码不能为空"); + } + if (TYPE_FIXED.equals(set.getSetType())) + { + if (StringUtils.isEmpty(detail.getCountryCode())) + { + throw new ServiceException("固定价明细必须填写国家"); + } + if (detail.getWsdId() == null && StringUtils.isEmpty(detail.getWeightLabel())) + { + throw new ServiceException("固定价明细必须填写重量段"); + } + if (detail.getFvValue() == null) + { + throw new ServiceException("固定价明细必须填写运费单价"); + } + if (detail.getFvRegistrationFee() == null) + { + throw new ServiceException("固定价明细必须填写挂号费"); + } + } + if (StringUtils.isNotEmpty(detail.getCountryCode())) + { + detail.setCountryCode(detail.getCountryCode().toUpperCase()); + } + } + + private void validateCustomer(PrcCustomerPriceSet customer, PrcPriceSet set) + { + if (customer.getCustomerId() == null || customer.getCustomerId().longValue() <= 0) + { + throw new ServiceException("客户ID不能为空"); + } + if (customer.getPrBegindate() == null) + { + customer.setPrBegindate(set.getEffectiveDate()); + } + if (customer.getPrBegindate() == null) + { + throw new ServiceException("客户绑定生效日期不能为空"); + } + if (customer.getPrEnddate() != null && customer.getPrBegindate().after(customer.getPrEnddate())) + { + throw new ServiceException("客户绑定生效日期不能晚于失效日期"); + } + if (customer.getBindPriority() != null && customer.getBindPriority().intValue() < 1) + { + throw new ServiceException("优先级必须大于等于 1"); + } + } + + private void assertBasicEditable(PrcPriceSet db) + { + if (STATUS_AUDIT.equals(db.getStatus())) + { + throw new ServiceException("审核中的套餐不允许修改"); + } + if (STATUS_STOP.equals(db.getStatus())) + { + throw new ServiceException("已停用的套餐不允许修改,请使用复用新建"); + } + } + + private void assertChildEditable(PrcPriceSet db) + { + if (STATUS_AUDIT.equals(db.getStatus())) + { + throw new ServiceException("审核中的套餐不允许改明细或客户"); + } + if (STATUS_STOP.equals(db.getStatus())) + { + throw new ServiceException("已停用的套餐不允许改明细或客户"); + } + } + + private void assertNoFail(List items) + { + for (PrcPriceSetCheckItem item : items) + { + if ("FAIL".equals(item.getResult())) + { + throw new ServiceException(item.getItem() + ":" + item.getMessage()); + } + } + } + + private PrcPriceSet requireSet(Long priceSetId) + { + PrcPriceSet db = setMapper.selectPrcPriceSetById(priceSetId); + if (db == null) + { + throw new ServiceException("套餐不存在"); + } + return db; + } + + private void fillExpired(PrcPriceSet set) + { + Date today = DateUtils.parseDate(DateUtils.getDate()); + boolean expired = STATUS_EFFECT.equals(set.getStatus()) + && set.getExpireDate() != null + && today != null + && set.getExpireDate().before(today); + set.setExpired(Boolean.valueOf(expired)); + } + + private List filterDetails(List details) + { + List list = new ArrayList(); + if (details == null) + { + return list; + } + for (PrcPriceSetDetail d : details) + { + if (d != null && StringUtils.isNotEmpty(d.getProductCode())) + { + list.add(d); + } + } + return list; + } + + private List filterCustomers(List customers) + { + List list = new ArrayList(); + if (customers == null) + { + return list; + } + for (PrcCustomerPriceSet c : customers) + { + if (c != null && c.getCustomerId() != null && c.getCustomerId().longValue() > 0) + { + list.add(c); + } + } + return list; + } + + private String displayName(PrcPriceSet set) + { + if (StringUtils.isNotEmpty(set.getPriceSetCode())) + { + return set.getPriceSetCode() + " " + set.getPriceSetName(); + } + return set.getPriceSetName(); + } + + private String nvl(String val) + { + return val == null ? "" : val; + } +} diff --git a/bms-back/ruoyi-system/src/main/java/com/ruoyi/price/service/impl/PrcWeightServiceImpl.java b/bms-back/ruoyi-system/src/main/java/com/ruoyi/price/service/impl/PrcWeightServiceImpl.java new file mode 100644 index 00000000..5a0e63e4 --- /dev/null +++ b/bms-back/ruoyi-system/src/main/java/com/ruoyi/price/service/impl/PrcWeightServiceImpl.java @@ -0,0 +1,116 @@ +package com.ruoyi.price.service.impl; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.price.domain.PrcWeightSectionDetail; +import com.ruoyi.price.domain.PrcWeightSectionTemplate; +import com.ruoyi.price.mapper.PrcWeightSectionDetailMapper; +import com.ruoyi.price.mapper.PrcWeightSectionTemplateMapper; +import com.ruoyi.price.service.IPrcWeightService; + +/** + * 重量段管理 服务层实现 + * + * @author ruoyi + */ +@Service +public class PrcWeightServiceImpl implements IPrcWeightService +{ + @Autowired + private PrcWeightSectionTemplateMapper templateMapper; + + @Autowired + private PrcWeightSectionDetailMapper detailMapper; + + @Override + public PrcWeightSectionTemplate selectPrcWeightSectionTemplateById(Long wstId) + { + PrcWeightSectionTemplate template = templateMapper.selectPrcWeightSectionTemplateById(wstId); + if (template != null) + { + template.setDetailCount(detailMapper.countByWstId(wstId)); + } + return template; + } + + @Override + public List selectPrcWeightSectionTemplateList(PrcWeightSectionTemplate template) + { + List list = templateMapper.selectPrcWeightSectionTemplateList(template); + for (PrcWeightSectionTemplate item : list) + { + item.setDetailCount(detailMapper.countByWstId(item.getWstId())); + } + return list; + } + + @Override + public int insertPrcWeightSectionTemplate(PrcWeightSectionTemplate template) + { + if (StringUtils.isEmpty(template.getSsCode())) + { + template.setSsCode("on"); + } + return templateMapper.insertPrcWeightSectionTemplate(template); + } + + @Override + public int updatePrcWeightSectionTemplate(PrcWeightSectionTemplate template) + { + // ss_code=on 时仍允许编辑(当前阶段) + return templateMapper.updatePrcWeightSectionTemplate(template); + } + + @Override + public int deletePrcWeightSectionTemplateByIds(Long[] wstIds) + { + return templateMapper.deletePrcWeightSectionTemplateByIds(wstIds); + } + + @Override + public PrcWeightSectionDetail selectPrcWeightSectionDetailById(Long wsdId) + { + return detailMapper.selectPrcWeightSectionDetailById(wsdId); + } + + @Override + public List selectPrcWeightSectionDetailList(PrcWeightSectionDetail detail) + { + return detailMapper.selectPrcWeightSectionDetailList(detail); + } + + @Override + public int insertPrcWeightSectionDetail(PrcWeightSectionDetail detail) + { + validateWeightRange(detail); + return detailMapper.insertPrcWeightSectionDetail(detail); + } + + @Override + public int updatePrcWeightSectionDetail(PrcWeightSectionDetail detail) + { + validateWeightRange(detail); + return detailMapper.updatePrcWeightSectionDetail(detail); + } + + @Override + public int deletePrcWeightSectionDetailByIds(Long[] wsdIds) + { + return detailMapper.deletePrcWeightSectionDetailByIds(wsdIds); + } + + private void validateWeightRange(PrcWeightSectionDetail detail) + { + if (detail.getWlStartweight() == null || detail.getWlEndweight() == null) + { + throw new ServiceException("起始重量和结束重量不能为空"); + } + if (detail.getWlStartweight().compareTo(detail.getWlEndweight()) >= 0) + { + throw new ServiceException("起始重量必须小于结束重量"); + } + } +} diff --git a/bms-back/ruoyi-system/src/main/java/com/ruoyi/price/service/impl/XtdZoneServiceImpl.java b/bms-back/ruoyi-system/src/main/java/com/ruoyi/price/service/impl/XtdZoneServiceImpl.java new file mode 100644 index 00000000..575c7130 --- /dev/null +++ b/bms-back/ruoyi-system/src/main/java/com/ruoyi/price/service/impl/XtdZoneServiceImpl.java @@ -0,0 +1,160 @@ +package com.ruoyi.price.service.impl; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.price.domain.XtdZoneCountry; +import com.ruoyi.price.domain.XtdZoneDivision; +import com.ruoyi.price.domain.XtdZoneScheme; +import com.ruoyi.price.mapper.XtdZoneCountryMapper; +import com.ruoyi.price.mapper.XtdZoneDivisionMapper; +import com.ruoyi.price.mapper.XtdZoneSchemeMapper; +import com.ruoyi.price.service.IXtdZoneService; + +/** + * 分区管理 服务层实现 + * + * @author ruoyi + */ +@Service +public class XtdZoneServiceImpl implements IXtdZoneService +{ + @Autowired + private XtdZoneSchemeMapper schemeMapper; + + @Autowired + private XtdZoneDivisionMapper divisionMapper; + + @Autowired + private XtdZoneCountryMapper countryMapper; + + @Override + public XtdZoneScheme selectXtdZoneSchemeById(Long zsId) + { + XtdZoneScheme scheme = schemeMapper.selectXtdZoneSchemeById(zsId); + if (scheme != null) + { + scheme.setDivisionCount(divisionMapper.countByZsId(zsId)); + } + return scheme; + } + + @Override + public List selectXtdZoneSchemeList(XtdZoneScheme scheme) + { + List list = schemeMapper.selectXtdZoneSchemeList(scheme); + for (XtdZoneScheme item : list) + { + item.setDivisionCount(divisionMapper.countByZsId(item.getZsId())); + } + return list; + } + + @Override + public int insertXtdZoneScheme(XtdZoneScheme scheme) + { + if (StringUtils.isEmpty(scheme.getSsCode())) + { + scheme.setSsCode("on"); + } + return schemeMapper.insertXtdZoneScheme(scheme); + } + + @Override + public int updateXtdZoneScheme(XtdZoneScheme scheme) + { + return schemeMapper.updateXtdZoneScheme(scheme); + } + + @Override + public int deleteXtdZoneSchemeByIds(Long[] zsIds) + { + for (Long zsId : zsIds) + { + int count = divisionMapper.countByZsId(zsId); + if (count > 0) + { + XtdZoneScheme scheme = schemeMapper.selectXtdZoneSchemeById(zsId); + String name = scheme != null ? scheme.getZsName() : String.valueOf(zsId); + throw new ServiceException("分区方案【" + name + "】存在区划明细,不允许删除"); + } + } + return schemeMapper.deleteXtdZoneSchemeByIds(zsIds); + } + + @Override + public XtdZoneDivision selectXtdZoneDivisionById(Long zdId) + { + XtdZoneDivision division = divisionMapper.selectXtdZoneDivisionById(zdId); + if (division != null) + { + division.setCountryCount(countryMapper.countByZdId(zdId)); + } + return division; + } + + @Override + public List selectXtdZoneDivisionList(XtdZoneDivision division) + { + List list = divisionMapper.selectXtdZoneDivisionList(division); + for (XtdZoneDivision item : list) + { + item.setCountryCount(countryMapper.countByZdId(item.getZdId())); + } + return list; + } + + @Override + public int insertXtdZoneDivision(XtdZoneDivision division) + { + return divisionMapper.insertXtdZoneDivision(division); + } + + @Override + public int updateXtdZoneDivision(XtdZoneDivision division) + { + return divisionMapper.updateXtdZoneDivision(division); + } + + @Override + public int deleteXtdZoneDivisionByIds(Long[] zdIds) + { + return divisionMapper.deleteXtdZoneDivisionByIds(zdIds); + } + + @Override + public XtdZoneCountry selectXtdZoneCountryById(Long zcId) + { + return countryMapper.selectXtdZoneCountryById(zcId); + } + + @Override + public List selectXtdZoneCountryList(XtdZoneCountry country) + { + return countryMapper.selectXtdZoneCountryList(country); + } + + @Override + public int insertXtdZoneCountry(XtdZoneCountry country) + { + if (StringUtils.isEmpty(country.getZcDividekind())) + { + country.setZcDividekind("C"); + } + return countryMapper.insertXtdZoneCountry(country); + } + + @Override + public int updateXtdZoneCountry(XtdZoneCountry country) + { + return countryMapper.updateXtdZoneCountry(country); + } + + @Override + public int deleteXtdZoneCountryByIds(Long[] zcIds) + { + return countryMapper.deleteXtdZoneCountryByIds(zcIds); + } +} diff --git a/bms-back/ruoyi-system/src/main/resources/mapper/price/PrcCustomerPriceSetMapper.xml b/bms-back/ruoyi-system/src/main/resources/mapper/price/PrcCustomerPriceSetMapper.xml new file mode 100644 index 00000000..aaeec24c --- /dev/null +++ b/bms-back/ruoyi-system/src/main/resources/mapper/price/PrcCustomerPriceSetMapper.xml @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + select customer_priceset_id, price_set_id, customer_id, customer_name, bind_priority, + pr_begindate, pr_enddate, price_set_note, + created_by, created_at, updated_by, updated_at + from prc_customer_price_set + + + + + + + + + + + + insert into prc_customer_price_set ( + price_set_id, + customer_id, + customer_name, + bind_priority, + pr_begindate, + pr_enddate, + price_set_note, + created_by, + created_at + ) values ( + #{priceSetId}, + #{customerId}, + #{customerName}, + #{bindPriority}, + #{prBegindate}, + #{prEnddate}, + #{priceSetNote}, + #{createBy}, + sysdate() + ) + + + + update prc_customer_price_set + + customer_id = #{customerId}, + customer_name = #{customerName}, + bind_priority = #{bindPriority}, + pr_begindate = #{prBegindate}, + pr_enddate = #{prEnddate}, + price_set_note = #{priceSetNote}, + updated_by = #{updateBy}, + updated_at = sysdate() + + where customer_priceset_id = #{customerPricesetId} + + + + delete from prc_customer_price_set where customer_priceset_id in + + #{id} + + + + + delete from prc_customer_price_set where price_set_id = #{priceSetId} + + + diff --git a/bms-back/ruoyi-system/src/main/resources/mapper/price/PrcPriceSetDetailMapper.xml b/bms-back/ruoyi-system/src/main/resources/mapper/price/PrcPriceSetDetailMapper.xml new file mode 100644 index 00000000..ed08074e --- /dev/null +++ b/bms-back/ruoyi-system/src/main/resources/mapper/price/PrcPriceSetDetailMapper.xml @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + select psd_id, price_set_id, product_code, product_name, country_code, country_name, + zd_id, wsd_id, weight_label, fv_value, fv_registration_fee, discount_value, + pr_id, created_at, updated_at + from prc_price_set_detail + + + + + + + + + + + + insert into prc_price_set_detail ( + price_set_id, + product_code, + product_name, + country_code, + country_name, + zd_id, + wsd_id, + weight_label, + fv_value, + fv_registration_fee, + discount_value, + pr_id, + created_at + ) values ( + #{priceSetId}, + #{productCode}, + #{productName}, + #{countryCode}, + #{countryName}, + #{zdId}, + #{wsdId}, + #{weightLabel}, + #{fvValue}, + #{fvRegistrationFee}, + #{discountValue}, + #{prId}, + sysdate() + ) + + + + update prc_price_set_detail + + product_code = #{productCode}, + product_name = #{productName}, + country_code = #{countryCode}, + country_name = #{countryName}, + zd_id = #{zdId}, + wsd_id = #{wsdId}, + weight_label = #{weightLabel}, + fv_value = #{fvValue}, + fv_registration_fee = #{fvRegistrationFee}, + discount_value = #{discountValue}, + pr_id = #{prId}, + updated_at = sysdate() + + where psd_id = #{psdId} + + + + delete from prc_price_set_detail where psd_id in + + #{psdId} + + + + + delete from prc_price_set_detail where price_set_id = #{priceSetId} + + + diff --git a/bms-back/ruoyi-system/src/main/resources/mapper/price/PrcPriceSetMapper.xml b/bms-back/ruoyi-system/src/main/resources/mapper/price/PrcPriceSetMapper.xml new file mode 100644 index 00000000..6a3c5e0f --- /dev/null +++ b/bms-back/ruoyi-system/src/main/resources/mapper/price/PrcPriceSetMapper.xml @@ -0,0 +1,156 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + select s.price_set_id, s.price_set_code, s.price_set_name, s.price_set_note, + s.set_type, s.default_discount, s.default_type, s.calculate_sign, + s.effective_date, s.expire_date, s.status, s.tms_id, + s.created_by, s.created_at, s.updated_by, s.updated_at, + (select count(distinct d.product_code) from prc_price_set_detail d where d.price_set_id = s.price_set_id) as product_count, + (select count(1) from prc_customer_price_set c where c.price_set_id = s.price_set_id) as customer_count + from prc_price_set s + + + + + + + + + + insert into prc_price_set ( + price_set_code, + price_set_name, + price_set_note, + set_type, + default_discount, + default_type, + calculate_sign, + effective_date, + expire_date, + status, + tms_id, + created_by, + created_at + ) values ( + #{priceSetCode}, + #{priceSetName}, + #{priceSetNote}, + #{setType}, + #{defaultDiscount}, + #{defaultType}, + #{calculateSign}, + #{effectiveDate}, + #{expireDate}, + #{status}, + #{tmsId}, + #{createBy}, + sysdate() + ) + + + + update prc_price_set + + price_set_code = #{priceSetCode}, + price_set_name = #{priceSetName}, + price_set_note = #{priceSetNote}, + set_type = #{setType}, + default_discount = #{defaultDiscount}, + default_type = #{defaultType}, + calculate_sign = #{calculateSign}, + effective_date = #{effectiveDate}, + expire_date = #{expireDate}, + status = #{status}, + tms_id = #{tmsId}, + updated_by = #{updateBy}, + updated_at = sysdate() + + where price_set_id = #{priceSetId} + + + + update prc_price_set + + status = #{status}, + updated_by = #{updateBy}, + updated_at = sysdate() + + where price_set_id = #{priceSetId} + + + + delete from prc_price_set where price_set_id in + + #{priceSetId} + + + + diff --git a/bms-back/ruoyi-system/src/main/resources/mapper/price/PrcWeightSectionDetailMapper.xml b/bms-back/ruoyi-system/src/main/resources/mapper/price/PrcWeightSectionDetailMapper.xml new file mode 100644 index 00000000..50ad2302 --- /dev/null +++ b/bms-back/ruoyi-system/src/main/resources/mapper/price/PrcWeightSectionDetailMapper.xml @@ -0,0 +1,105 @@ + + + + + + + + + + + + + + + + + + + + select wsd_id, wst_id, wl_title, wl_startweight, wl_endweight, weight_billing_code, + fv_unitweight, effective_date, expire_date, created_at, updated_at + from prc_weight_section_detail + + + + + + + + + + + + insert into prc_weight_section_detail ( + wst_id, + wl_title, + wl_startweight, + wl_endweight, + weight_billing_code, + fv_unitweight, + effective_date, + expire_date, + created_at + ) values ( + #{wstId}, + #{wlTitle}, + #{wlStartweight}, + #{wlEndweight}, + #{weightBillingCode}, + #{fvUnitweight}, + #{effectiveDate}, + #{expireDate}, + sysdate() + ) + + + + update prc_weight_section_detail + + wst_id = #{wstId}, + wl_title = #{wlTitle}, + wl_startweight = #{wlStartweight}, + wl_endweight = #{wlEndweight}, + weight_billing_code = #{weightBillingCode}, + fv_unitweight = #{fvUnitweight}, + effective_date = #{effectiveDate}, + expire_date = #{expireDate}, + updated_at = sysdate() + + where wsd_id = #{wsdId} + + + + delete from prc_weight_section_detail where wsd_id in + + #{wsdId} + + + + diff --git a/bms-back/ruoyi-system/src/main/resources/mapper/price/PrcWeightSectionTemplateMapper.xml b/bms-back/ruoyi-system/src/main/resources/mapper/price/PrcWeightSectionTemplateMapper.xml new file mode 100644 index 00000000..d697a501 --- /dev/null +++ b/bms-back/ruoyi-system/src/main/resources/mapper/price/PrcWeightSectionTemplateMapper.xml @@ -0,0 +1,113 @@ + + + + + + + + + + + + + + + + + + + + + + + select wst_id, wst_name, ss_code, pg_code, sn_id, ct_code, pm_code, wst_note, tms_id, + created_by, created_at, updated_by, updated_at + from prc_weight_section_template + + + + + + + + insert into prc_weight_section_template ( + wst_name, + ss_code, + pg_code, + sn_id, + ct_code, + pm_code, + wst_note, + tms_id, + created_by, + created_at + ) values ( + #{wstName}, + #{ssCode}, + #{pgCode}, + #{snId}, + #{ctCode}, + #{pmCode}, + #{wstNote}, + #{tmsId}, + #{createBy}, + sysdate() + ) + + + + update prc_weight_section_template + + wst_name = #{wstName}, + ss_code = #{ssCode}, + pg_code = #{pgCode}, + sn_id = #{snId}, + ct_code = #{ctCode}, + pm_code = #{pmCode}, + wst_note = #{wstNote}, + tms_id = #{tmsId}, + updated_by = #{updateBy}, + updated_at = sysdate() + + where wst_id = #{wstId} + + + + delete from prc_weight_section_template where wst_id in + + #{wstId} + + + + diff --git a/bms-back/ruoyi-system/src/main/resources/mapper/price/XtdZoneCountryMapper.xml b/bms-back/ruoyi-system/src/main/resources/mapper/price/XtdZoneCountryMapper.xml new file mode 100644 index 00000000..f039ca10 --- /dev/null +++ b/bms-back/ruoyi-system/src/main/resources/mapper/price/XtdZoneCountryMapper.xml @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + select zc_id, zd_id, country_code, zc_dividekind, created_at, updated_at + from xtd_zonecountry + + + + + + + + + + + + insert into xtd_zonecountry ( + zd_id, + country_code, + zc_dividekind, + created_at + ) values ( + #{zdId}, + #{countryCode}, + #{zcDividekind}, + sysdate() + ) + + + + update xtd_zonecountry + + zd_id = #{zdId}, + country_code = #{countryCode}, + zc_dividekind = #{zcDividekind}, + updated_at = sysdate() + + where zc_id = #{zcId} + + + + delete from xtd_zonecountry where zc_id in + + #{zcId} + + + + diff --git a/bms-back/ruoyi-system/src/main/resources/mapper/price/XtdZoneDivisionMapper.xml b/bms-back/ruoyi-system/src/main/resources/mapper/price/XtdZoneDivisionMapper.xml new file mode 100644 index 00000000..d9dc5aa6 --- /dev/null +++ b/bms-back/ruoyi-system/src/main/resources/mapper/price/XtdZoneDivisionMapper.xml @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + + + + + select zd_id, zs_id, zd_sort, zd_code, zn_name, zn_ename, zn_note, created_at, updated_at + from xtd_zone_division + + + + + + + + + + + + insert into xtd_zone_division ( + zs_id, + zd_sort, + zd_code, + zn_name, + zn_ename, + zn_note, + created_at + ) values ( + #{zsId}, + #{zdSort}, + #{zdCode}, + #{znName}, + #{znEname}, + #{znNote}, + sysdate() + ) + + + + update xtd_zone_division + + zs_id = #{zsId}, + zd_sort = #{zdSort}, + zd_code = #{zdCode}, + zn_name = #{znName}, + zn_ename = #{znEname}, + zn_note = #{znNote}, + updated_at = sysdate() + + where zd_id = #{zdId} + + + + delete from xtd_zone_division where zd_id in + + #{zdId} + + + + diff --git a/bms-back/ruoyi-system/src/main/resources/mapper/price/XtdZoneSchemeMapper.xml b/bms-back/ruoyi-system/src/main/resources/mapper/price/XtdZoneSchemeMapper.xml new file mode 100644 index 00000000..79e7ece4 --- /dev/null +++ b/bms-back/ruoyi-system/src/main/resources/mapper/price/XtdZoneSchemeMapper.xml @@ -0,0 +1,99 @@ + + + + + + + + + + + + + + + + + + + + + select zs_id, zs_name, ss_code, pg_code, sn_id, zs_note, tms_id, + created_by, created_at, updated_by, updated_at + from xtd_zone_scheme + + + + + + + + insert into xtd_zone_scheme ( + zs_name, + ss_code, + pg_code, + sn_id, + zs_note, + tms_id, + created_by, + created_at + ) values ( + #{zsName}, + #{ssCode}, + #{pgCode}, + #{snId}, + #{zsNote}, + #{tmsId}, + #{createBy}, + sysdate() + ) + + + + update xtd_zone_scheme + + zs_name = #{zsName}, + ss_code = #{ssCode}, + pg_code = #{pgCode}, + sn_id = #{snId}, + zs_note = #{zsNote}, + tms_id = #{tmsId}, + updated_by = #{updateBy}, + updated_at = sysdate() + + where zs_id = #{zsId} + + + + delete from xtd_zone_scheme where zs_id in + + #{zsId} + + + + diff --git a/bms-back/sql/price/price_set.sql b/bms-back/sql/price/price_set.sql new file mode 100644 index 00000000..eef14115 --- /dev/null +++ b/bms-back/sql/price/price_set.sql @@ -0,0 +1,123 @@ +-- ---------------------------- +-- BMS price set: 客户中心 · 价格套餐管理 +-- charset: utf8mb4 +-- menu_id: 2200-2210 +-- 相对 PRD《价格表优化建表.sql》差异: +-- 1. prc_price_set 增加 price_set_code / set_type / default_discount,status 对齐原型 D/A/E/R/S +-- 2. 新增 prc_price_set_detail(原型 FIXED/DISCOUNT 明细,运费+挂号费同行) +-- 3. prc_customer_price_set 增加 customer_name / bind_priority +-- ---------------------------- + +CREATE TABLE IF NOT EXISTS prc_price_set ( + price_set_id BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '价格套餐id', + price_set_code VARCHAR(20) DEFAULT NULL COMMENT '套餐编码 SET0001', + price_set_name VARCHAR(50) NOT NULL COMMENT '报价名称', + price_set_note VARCHAR(200) DEFAULT NULL COMMENT '备注', + set_type VARCHAR(10) NOT NULL DEFAULT 'FIXED' COMMENT '计价类型 FIXED=固定价 DISCOUNT=折扣', + default_discount DECIMAL(5,2) DEFAULT NULL COMMENT '默认折扣百分数 1-99,仅 DISCOUNT', + default_type CHAR(1) DEFAULT NULL COMMENT '默认套餐 Y=默认', + calculate_sign CHAR(1) DEFAULT NULL COMMENT '试算标记 Y=外部试算套餐', + effective_date DATE NOT NULL COMMENT '生效日期', + expire_date DATE DEFAULT NULL COMMENT '失效日期(空=长期)', + status CHAR(1) NOT NULL DEFAULT 'D' COMMENT 'D草稿 A审核中 E生效 R驳回 S停用', + tms_id BIGINT(20) DEFAULT NULL COMMENT '多租户系统ID', + created_by VARCHAR(64) DEFAULT '' COMMENT '创建人', + created_at DATETIME DEFAULT NULL COMMENT '创建时间', + updated_by VARCHAR(64) DEFAULT '' COMMENT '更新人', + updated_at DATETIME DEFAULT NULL COMMENT '更新时间', + PRIMARY KEY (price_set_id), + UNIQUE KEY uk_price_set_code (price_set_code), + INDEX idx_ps_status (status), + INDEX idx_ps_type (set_type), + INDEX idx_ps_tms (tms_id), + INDEX idx_ps_effective (effective_date, expire_date) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='价格方案表-报价基本资料'; + +CREATE TABLE IF NOT EXISTS prc_price_set_detail ( + psd_id BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '套餐明细id', + price_set_id BIGINT(20) NOT NULL COMMENT '价格套餐id', + product_code VARCHAR(10) NOT NULL COMMENT '产品代码', + product_name VARCHAR(50) DEFAULT NULL COMMENT '产品名称', + country_code CHAR(2) DEFAULT NULL COMMENT '国家二字码', + country_name VARCHAR(50) DEFAULT NULL COMMENT '国家名称', + zd_id BIGINT(20) DEFAULT NULL COMMENT '收费区划id', + wsd_id BIGINT(20) DEFAULT NULL COMMENT '重量段明细id', + weight_label VARCHAR(50) DEFAULT NULL COMMENT '重量段展示', + fv_value DECIMAL(10,4) DEFAULT NULL COMMENT '运费单价 RMB/KG', + fv_registration_fee DECIMAL(10,2) DEFAULT NULL COMMENT '挂号费 RMB/票', + discount_value DECIMAL(5,2) DEFAULT NULL COMMENT '明细折扣百分数,DISCOUNT 可覆盖默认', + pr_id INT(11) DEFAULT NULL COMMENT '关联价格规则id', + created_at DATETIME DEFAULT NULL COMMENT '创建时间', + updated_at DATETIME DEFAULT NULL COMMENT '更新时间', + PRIMARY KEY (psd_id), + INDEX idx_psd_set (price_set_id), + INDEX idx_psd_product (price_set_id, product_code, country_code), + CONSTRAINT fk_psd_set FOREIGN KEY (price_set_id) REFERENCES prc_price_set (price_set_id) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='价格套餐明细-固定价/折扣范围'; + +CREATE TABLE IF NOT EXISTS prc_customer_price_set ( + customer_priceset_id BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '客户价格套餐id', + price_set_id BIGINT(20) NOT NULL COMMENT '价格套餐id', + customer_id BIGINT(20) NOT NULL COMMENT '客户id', + customer_name VARCHAR(100) DEFAULT NULL COMMENT '客户名称(展示)', + bind_priority INT(11) NOT NULL DEFAULT 1 COMMENT '优先级,数字越小越优先', + pr_begindate DATETIME NOT NULL COMMENT '价格开始生效日期', + pr_enddate DATETIME DEFAULT NULL COMMENT '价格失效日期(空=长期)', + price_set_note VARCHAR(100) DEFAULT NULL COMMENT '备注', + created_by VARCHAR(64) DEFAULT '' COMMENT '创建人', + created_at DATETIME DEFAULT NULL COMMENT '创建时间', + updated_by VARCHAR(64) DEFAULT '' COMMENT '更新人', + updated_at DATETIME DEFAULT NULL COMMENT '更新时间', + PRIMARY KEY (customer_priceset_id), + INDEX idx_customer_set (customer_id, pr_begindate, pr_enddate), + INDEX idx_cps_set (price_set_id), + CONSTRAINT fk_customer_price_set FOREIGN KEY (price_set_id) REFERENCES prc_price_set (price_set_id) ON DELETE RESTRICT +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='客户套餐表-客户某时间段内使用的套餐'; + +-- 客户中心目录 +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, remark) +SELECT 2200, N'客户中心', 0, 8, 'customer', NULL, '', '', 1, 0, 'M', '0', '0', '', 'peoples', 'admin', sysdate(), N'客户中心目录' +FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_id = 2200); + +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, remark) +SELECT 2201, N'价格套餐管理', 2200, 1, 'set', 'price/set/priceSet', '', 'PriceSet', 1, 0, 'C', '0', '0', 'price:set:list', 'shopping', 'admin', sysdate(), N'价格套餐管理菜单' +FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_id = 2201); + +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, remark) +SELECT 2202, N'套餐查询', 2201, 1, '', NULL, '', '', 1, 0, 'F', '0', '0', 'price:set:query', '#', 'admin', sysdate(), '' +FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_id = 2202); + +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, remark) +SELECT 2203, N'套餐新增', 2201, 2, '', NULL, '', '', 1, 0, 'F', '0', '0', 'price:set:add', '#', 'admin', sysdate(), '' +FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_id = 2203); + +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, remark) +SELECT 2204, N'套餐修改', 2201, 3, '', NULL, '', '', 1, 0, 'F', '0', '0', 'price:set:edit', '#', 'admin', sysdate(), '' +FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_id = 2204); + +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, remark) +SELECT 2205, N'套餐删除', 2201, 4, '', NULL, '', '', 1, 0, 'F', '0', '0', 'price:set:remove', '#', 'admin', sysdate(), '' +FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_id = 2205); + +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, remark) +SELECT 2206, N'套餐审核', 2201, 5, '', NULL, '', '', 1, 0, 'F', '0', '0', 'price:set:audit', '#', 'admin', sysdate(), '' +FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_id = 2206); + +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, remark) +SELECT 2208, N'新建套餐', 2200, 2, 'setCreate', 'price/set/create', '', 'PriceSetCreate', 1, 0, 'C', '1', '0', 'price:set:add', '#', 'admin', sysdate(), N'新建套餐隐藏页' +FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_id = 2208); + +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, remark) +SELECT 2209, N'套餐详情', 2200, 3, 'setDetail', 'price/set/detail', '', 'PriceSetDetail', 1, 0, 'C', '1', '0', 'price:set:query', '#', 'admin', sysdate(), N'套餐详情隐藏页' +FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_id = 2209); + +-- role_id=1 grants +INSERT INTO sys_role_menu (role_id, menu_id) SELECT 1, 2200 FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_role_menu WHERE role_id = 1 AND menu_id = 2200); +INSERT INTO sys_role_menu (role_id, menu_id) SELECT 1, 2201 FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_role_menu WHERE role_id = 1 AND menu_id = 2201); +INSERT INTO sys_role_menu (role_id, menu_id) SELECT 1, 2202 FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_role_menu WHERE role_id = 1 AND menu_id = 2202); +INSERT INTO sys_role_menu (role_id, menu_id) SELECT 1, 2203 FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_role_menu WHERE role_id = 1 AND menu_id = 2203); +INSERT INTO sys_role_menu (role_id, menu_id) SELECT 1, 2204 FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_role_menu WHERE role_id = 1 AND menu_id = 2204); +INSERT INTO sys_role_menu (role_id, menu_id) SELECT 1, 2205 FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_role_menu WHERE role_id = 1 AND menu_id = 2205); +INSERT INTO sys_role_menu (role_id, menu_id) SELECT 1, 2206 FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_role_menu WHERE role_id = 1 AND menu_id = 2206); +INSERT INTO sys_role_menu (role_id, menu_id) SELECT 1, 2208 FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_role_menu WHERE role_id = 1 AND menu_id = 2208); +INSERT INTO sys_role_menu (role_id, menu_id) SELECT 1, 2209 FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_role_menu WHERE role_id = 1 AND menu_id = 2209); diff --git a/bms-back/sql/price/zone_weight.sql b/bms-back/sql/price/zone_weight.sql new file mode 100644 index 00000000..3b962fa9 --- /dev/null +++ b/bms-back/sql/price/zone_weight.sql @@ -0,0 +1,144 @@ +-- ---------------------------- +-- BMS price basic: zone / weight section +-- charset: utf8mb4 +-- menu_id: 2100-2123 (2115-2123 reserved) +-- ---------------------------- + +CREATE TABLE IF NOT EXISTS xtd_zone_scheme ( + zs_id BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT 'zone scheme id', + zs_name VARCHAR(100) NOT NULL COMMENT 'scheme name', + ss_code VARCHAR(20) NOT NULL DEFAULT 'on' COMMENT 'status on/off', + pg_code VARCHAR(50) DEFAULT NULL COMMENT 'product group code', + sn_id BIGINT(20) DEFAULT NULL COMMENT 'service channel id', + zs_note VARCHAR(500) DEFAULT NULL COMMENT 'note', + tms_id BIGINT(20) DEFAULT NULL COMMENT 'tenant id', + created_by VARCHAR(64) DEFAULT '' COMMENT 'created by', + created_at DATETIME DEFAULT NULL COMMENT 'created at', + updated_by VARCHAR(64) DEFAULT '' COMMENT 'updated by', + updated_at DATETIME DEFAULT NULL COMMENT 'updated at', + PRIMARY KEY (zs_id), + INDEX idx_zs_ss_code (ss_code), + INDEX idx_zs_tms_id (tms_id) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='zone scheme'; + +CREATE TABLE IF NOT EXISTS xtd_zone_division ( + zd_id BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT 'division id globally unique', + zs_id BIGINT(20) NOT NULL COMMENT 'scheme id', + zd_sort INT(11) DEFAULT 0 COMMENT 'sort', + zd_code VARCHAR(50) DEFAULT NULL COMMENT 'division code', + zn_name VARCHAR(100) DEFAULT NULL COMMENT 'name', + zn_ename VARCHAR(100) DEFAULT NULL COMMENT 'english name', + zn_note VARCHAR(500) DEFAULT NULL COMMENT 'note', + created_at DATETIME DEFAULT NULL COMMENT 'created at', + updated_at DATETIME DEFAULT NULL COMMENT 'updated at', + PRIMARY KEY (zd_id), + INDEX idx_zd_zs_id (zs_id), + CONSTRAINT fk_zd_zs FOREIGN KEY (zs_id) REFERENCES xtd_zone_scheme (zs_id) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='zone division'; + +CREATE TABLE IF NOT EXISTS xtd_zonecountry ( + zc_id BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT 'zone country id', + zd_id BIGINT(20) NOT NULL COMMENT 'division id', + country_code CHAR(2) NOT NULL COMMENT 'ISO2 country code', + zc_dividekind VARCHAR(10) NOT NULL DEFAULT 'C' COMMENT 'divide kind default C', + created_at DATETIME DEFAULT NULL COMMENT 'created at', + updated_at DATETIME DEFAULT NULL COMMENT 'updated at', + PRIMARY KEY (zc_id), + INDEX idx_zc_zd_id (zd_id), + INDEX idx_zc_country (country_code), + CONSTRAINT fk_zc_zd FOREIGN KEY (zd_id) REFERENCES xtd_zone_division (zd_id) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='zone country'; + +CREATE TABLE IF NOT EXISTS prc_weight_section_template ( + wst_id BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT 'weight template id', + wst_name VARCHAR(100) NOT NULL COMMENT 'template name', + ss_code VARCHAR(20) NOT NULL DEFAULT 'on' COMMENT 'status on/off', + pg_code VARCHAR(50) DEFAULT NULL COMMENT 'product group code', + sn_id BIGINT(20) DEFAULT NULL COMMENT 'service channel id', + ct_code VARCHAR(50) DEFAULT NULL COMMENT 'cargo type code', + pm_code VARCHAR(50) DEFAULT NULL COMMENT 'payment method code', + wst_note VARCHAR(500) DEFAULT NULL COMMENT 'note', + tms_id BIGINT(20) DEFAULT NULL COMMENT 'tenant id', + created_by VARCHAR(64) DEFAULT '' COMMENT 'created by', + created_at DATETIME DEFAULT NULL COMMENT 'created at', + updated_by VARCHAR(64) DEFAULT '' COMMENT 'updated by', + updated_at DATETIME DEFAULT NULL COMMENT 'updated at', + PRIMARY KEY (wst_id), + INDEX idx_wst_ss_code (ss_code), + INDEX idx_wst_tms_id (tms_id) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='weight section template'; + +CREATE TABLE IF NOT EXISTS prc_weight_section_detail ( + wsd_id BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT 'weight detail id globally unique', + wst_id BIGINT(20) NOT NULL COMMENT 'template id', + wl_title VARCHAR(100) DEFAULT NULL COMMENT 'title', + wl_startweight DECIMAL(18,6) NOT NULL COMMENT 'start weight', + wl_endweight DECIMAL(18,6) NOT NULL COMMENT 'end weight', + weight_billing_code VARCHAR(20) DEFAULT NULL COMMENT 'billing code', + fv_unitweight DECIMAL(18,6) DEFAULT NULL COMMENT 'unit weight', + effective_date DATE DEFAULT NULL COMMENT 'effective date', + expire_date DATE DEFAULT NULL COMMENT 'expire date', + created_at DATETIME DEFAULT NULL COMMENT 'created at', + updated_at DATETIME DEFAULT NULL COMMENT 'updated at', + PRIMARY KEY (wsd_id), + INDEX idx_wsd_wst_id (wst_id), + CONSTRAINT fk_wsd_wst FOREIGN KEY (wst_id) REFERENCES prc_weight_section_template (wst_id) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='weight section detail'; + +-- menus 2100-2114 (active); 2115-2123 reserved +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, remark) +SELECT 2100, N'价格基础', 0, 7, 'price', NULL, '', '', 1, 0, 'M', '0', '0', '', 'money', 'admin', sysdate(), N'价格基础数据目录' +FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_id = 2100); + +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, remark) +SELECT 2101, N'分区管理', 2100, 1, 'zone', 'price/basic/zone/index', '', 'PriceZone', 1, 0, 'C', '0', '0', 'price:zone:list', 'international', 'admin', sysdate(), N'分区管理菜单' +FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_id = 2101); + +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, remark) +SELECT 2102, N'分区查询', 2101, 1, '', NULL, '', '', 1, 0, 'F', '0', '0', 'price:zone:query', '#', 'admin', sysdate(), '' +FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_id = 2102); + +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, remark) +SELECT 2103, N'分区新增', 2101, 2, '', NULL, '', '', 1, 0, 'F', '0', '0', 'price:zone:add', '#', 'admin', sysdate(), '' +FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_id = 2103); + +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, remark) +SELECT 2104, N'分区修改', 2101, 3, '', NULL, '', '', 1, 0, 'F', '0', '0', 'price:zone:edit', '#', 'admin', sysdate(), '' +FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_id = 2104); + +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, remark) +SELECT 2105, N'分区删除', 2101, 4, '', NULL, '', '', 1, 0, 'F', '0', '0', 'price:zone:remove', '#', 'admin', sysdate(), '' +FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_id = 2105); + +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, remark) +SELECT 2110, N'重量段管理', 2100, 2, 'weight', 'price/basic/weight/index', '', 'PriceWeight', 1, 0, 'C', '0', '0', 'price:weight:list', 'chart', 'admin', sysdate(), N'重量段管理菜单' +FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_id = 2110); + +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, remark) +SELECT 2111, N'重量段查询', 2110, 1, '', NULL, '', '', 1, 0, 'F', '0', '0', 'price:weight:query', '#', 'admin', sysdate(), '' +FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_id = 2111); + +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, remark) +SELECT 2112, N'重量段新增', 2110, 2, '', NULL, '', '', 1, 0, 'F', '0', '0', 'price:weight:add', '#', 'admin', sysdate(), '' +FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_id = 2112); + +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, remark) +SELECT 2113, N'重量段修改', 2110, 3, '', NULL, '', '', 1, 0, 'F', '0', '0', 'price:weight:edit', '#', 'admin', sysdate(), '' +FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_id = 2113); + +INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, remark) +SELECT 2114, N'重量段删除', 2110, 4, '', NULL, '', '', 1, 0, 'F', '0', '0', 'price:weight:remove', '#', 'admin', sysdate(), '' +FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_id = 2114); + +-- role_id=1 grants +INSERT INTO sys_role_menu (role_id, menu_id) SELECT 1, 2100 FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_role_menu WHERE role_id = 1 AND menu_id = 2100); +INSERT INTO sys_role_menu (role_id, menu_id) SELECT 1, 2101 FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_role_menu WHERE role_id = 1 AND menu_id = 2101); +INSERT INTO sys_role_menu (role_id, menu_id) SELECT 1, 2102 FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_role_menu WHERE role_id = 1 AND menu_id = 2102); +INSERT INTO sys_role_menu (role_id, menu_id) SELECT 1, 2103 FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_role_menu WHERE role_id = 1 AND menu_id = 2103); +INSERT INTO sys_role_menu (role_id, menu_id) SELECT 1, 2104 FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_role_menu WHERE role_id = 1 AND menu_id = 2104); +INSERT INTO sys_role_menu (role_id, menu_id) SELECT 1, 2105 FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_role_menu WHERE role_id = 1 AND menu_id = 2105); +INSERT INTO sys_role_menu (role_id, menu_id) SELECT 1, 2110 FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_role_menu WHERE role_id = 1 AND menu_id = 2110); +INSERT INTO sys_role_menu (role_id, menu_id) SELECT 1, 2111 FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_role_menu WHERE role_id = 1 AND menu_id = 2111); +INSERT INTO sys_role_menu (role_id, menu_id) SELECT 1, 2112 FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_role_menu WHERE role_id = 1 AND menu_id = 2112); +INSERT INTO sys_role_menu (role_id, menu_id) SELECT 1, 2113 FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_role_menu WHERE role_id = 1 AND menu_id = 2113); +INSERT INTO sys_role_menu (role_id, menu_id) SELECT 1, 2114 FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_role_menu WHERE role_id = 1 AND menu_id = 2114); \ No newline at end of file diff --git a/bms-front/src/api/price/set.js b/bms-front/src/api/price/set.js new file mode 100644 index 00000000..ce2cf84c --- /dev/null +++ b/bms-front/src/api/price/set.js @@ -0,0 +1,144 @@ +import request from '@/utils/request' + +export function listPriceSet(query) { + return request({ + url: '/price/set/list', + method: 'get', + params: query + }) +} + +export function getPriceSet(priceSetId) { + return request({ + url: '/price/set/' + priceSetId, + method: 'get' + }) +} + +export function savePriceSet(data) { + return request({ + url: '/price/set', + method: 'post', + data: data + }) +} + +export function updatePriceSet(data) { + return request({ + url: '/price/set', + method: 'put', + data: data + }) +} + +export function delPriceSet(priceSetIds) { + return request({ + url: '/price/set/' + priceSetIds, + method: 'delete' + }) +} + +export function submitPriceSet(priceSetId) { + return request({ + url: '/price/set/submit/' + priceSetId, + method: 'put' + }) +} + +export function approvePriceSet(priceSetId) { + return request({ + url: '/price/set/approve/' + priceSetId, + method: 'put' + }) +} + +export function rejectPriceSet(priceSetId) { + return request({ + url: '/price/set/reject/' + priceSetId, + method: 'put' + }) +} + +export function disablePriceSet(priceSetId) { + return request({ + url: '/price/set/disable/' + priceSetId, + method: 'put' + }) +} + +export function copyPriceSet(priceSetId) { + return request({ + url: '/price/set/copy/' + priceSetId, + method: 'post' + }) +} + +export function validatePriceSet(data) { + return request({ + url: '/price/set/validate', + method: 'post', + data: data + }) +} + +export function listSetDetail(query) { + return request({ + url: '/price/set/detail/list', + method: 'get', + params: query + }) +} + +export function addSetDetail(data) { + return request({ + url: '/price/set/detail', + method: 'post', + data: data + }) +} + +export function updateSetDetail(data) { + return request({ + url: '/price/set/detail', + method: 'put', + data: data + }) +} + +export function delSetDetail(psdIds) { + return request({ + url: '/price/set/detail/' + psdIds, + method: 'delete' + }) +} + +export function listSetCustomer(query) { + return request({ + url: '/price/set/customer/list', + method: 'get', + params: query + }) +} + +export function addSetCustomer(data) { + return request({ + url: '/price/set/customer', + method: 'post', + data: data + }) +} + +export function updateSetCustomer(data) { + return request({ + url: '/price/set/customer', + method: 'put', + data: data + }) +} + +export function delSetCustomer(ids) { + return request({ + url: '/price/set/customer/' + ids, + method: 'delete' + }) +} diff --git a/bms-front/src/api/price/weight.js b/bms-front/src/api/price/weight.js new file mode 100644 index 00000000..7648a13f --- /dev/null +++ b/bms-front/src/api/price/weight.js @@ -0,0 +1,83 @@ +import request from '@/utils/request' + +// ========== 重量段模板 ========== + +/** 查询重量段模板列表 */ +export function listTemplate(query) { + return request({ + url: '/price/weight/template/list', + method: 'get', + params: query + }) +} + +/** 查询重量段模板详细 */ +export function getTemplate(wstId) { + return request({ + url: '/price/weight/template/' + wstId, + method: 'get' + }) +} + +/** 新增重量段模板 */ +export function addTemplate(data) { + return request({ + url: '/price/weight/template', + method: 'post', + data: data + }) +} + +/** 修改重量段模板 */ +export function updateTemplate(data) { + return request({ + url: '/price/weight/template', + method: 'put', + data: data + }) +} + +/** 删除重量段模板 */ +export function delTemplate(wstIds) { + return request({ + url: '/price/weight/template/' + wstIds, + method: 'delete' + }) +} + +// ========== 重量段明细 ========== + +/** 查询重量段明细列表(按 wstId) */ +export function listDetail(query) { + return request({ + url: '/price/weight/detail/list', + method: 'get', + params: query + }) +} + +/** 新增重量段明细 */ +export function addDetail(data) { + return request({ + url: '/price/weight/detail', + method: 'post', + data: data + }) +} + +/** 修改重量段明细 */ +export function updateDetail(data) { + return request({ + url: '/price/weight/detail', + method: 'put', + data: data + }) +} + +/** 删除重量段明细 */ +export function delDetail(wsdIds) { + return request({ + url: '/price/weight/detail/' + wsdIds, + method: 'delete' + }) +} \ No newline at end of file diff --git a/bms-front/src/api/price/zone.js b/bms-front/src/api/price/zone.js new file mode 100644 index 00000000..37e9290c --- /dev/null +++ b/bms-front/src/api/price/zone.js @@ -0,0 +1,120 @@ +import request from '@/utils/request' + +// ========== 分区方案 ========== + +/** 查询分区方案列表 */ +export function listScheme(query) { + return request({ + url: '/price/zone/scheme/list', + method: 'get', + params: query + }) +} + +/** 查询分区方案详细 */ +export function getScheme(zsId) { + return request({ + url: '/price/zone/scheme/' + zsId, + method: 'get' + }) +} + +/** 新增分区方案 */ +export function addScheme(data) { + return request({ + url: '/price/zone/scheme', + method: 'post', + data: data + }) +} + +/** 修改分区方案 */ +export function updateScheme(data) { + return request({ + url: '/price/zone/scheme', + method: 'put', + data: data + }) +} + +/** 删除分区方案 */ +export function delScheme(zsIds) { + return request({ + url: '/price/zone/scheme/' + zsIds, + method: 'delete' + }) +} + +// ========== 区划 ========== + +/** 查询区划列表(按 zsId) */ +export function listDivision(query) { + return request({ + url: '/price/zone/division/list', + method: 'get', + params: query + }) +} + +/** 新增区划 */ +export function addDivision(data) { + return request({ + url: '/price/zone/division', + method: 'post', + data: data + }) +} + +/** 修改区划 */ +export function updateDivision(data) { + return request({ + url: '/price/zone/division', + method: 'put', + data: data + }) +} + +/** 删除区划 */ +export function delDivision(zdIds) { + return request({ + url: '/price/zone/division/' + zdIds, + method: 'delete' + }) +} + +// ========== 国家 ========== + +/** 查询国家列表(按 zdId) */ +export function listCountry(query) { + return request({ + url: '/price/zone/country/list', + method: 'get', + params: query + }) +} + +/** 新增国家 */ +export function addCountry(data) { + return request({ + url: '/price/zone/country', + method: 'post', + data: data + }) +} + +/** 修改国家 */ +export function updateCountry(data) { + return request({ + url: '/price/zone/country', + method: 'put', + data: data + }) +} + +/** 删除国家 */ +export function delCountry(zcIds) { + return request({ + url: '/price/zone/country/' + zcIds, + method: 'delete' + }) +} \ No newline at end of file diff --git a/bms-front/src/permission.js b/bms-front/src/permission.js index 3a3c81b7..8c278981 100644 --- a/bms-front/src/permission.js +++ b/bms-front/src/permission.js @@ -1,4 +1,4 @@ -import router from './router' +import router, { notFoundRoute } from './router' import { ElMessage } from 'element-plus' import NProgress from 'nprogress' import 'nprogress/nprogress.css' @@ -51,6 +51,8 @@ router.beforeEach(async (to, from) => { router.addRoute(route) } }) + // 404 必须在全部动态路由之后注册,否则字典数据等隐藏页会被通配抢走 + router.addRoute(notFoundRoute) // 重新导航到目标路由,确保动态路由已注册 return { ...to, replace: true } } catch (err) { diff --git a/bms-front/src/router/index.js b/bms-front/src/router/index.js index 658a05d0..830d7d1b 100644 --- a/bms-front/src/router/index.js +++ b/bms-front/src/router/index.js @@ -24,7 +24,7 @@ import Layout from '@/layout' } */ -// 公共路由 +// 公共路由(404 不放这里,等动态路由注册后再挂,避免抢先匹配) export const constantRoutes = [ { path: '/redirect', @@ -47,11 +47,6 @@ export const constantRoutes = [ component: () => import('@/views/register'), hidden: true }, - { - path: "/:pathMatch(.*)*", - component: () => import('@/views/error/404'), - hidden: true - }, { path: '/401', component: () => import('@/views/error/401'), @@ -131,7 +126,7 @@ export const dynamicRoutes = [ { path: 'index/:dictId(\\d+)', component: () => import('@/views/system/dict/data'), - name: 'Data', + name: 'DictData', meta: { title: '字典数据', activeMenu: '/system/dict' } } ] @@ -166,6 +161,13 @@ export const dynamicRoutes = [ } ] +// 404 必须在动态路由之后注册,否则会抢先匹配 /system/dict-data 等隐藏页 +export const notFoundRoute = { + path: '/:pathMatch(.*)*', + component: () => import('@/views/error/404'), + hidden: true +} + const router = createRouter({ history: createWebHistory(), routes: constantRoutes, diff --git a/bms-front/src/views/price/basic/weight/index.vue b/bms-front/src/views/price/basic/weight/index.vue new file mode 100644 index 00000000..d6f28bff --- /dev/null +++ b/bms-front/src/views/price/basic/weight/index.vue @@ -0,0 +1,542 @@ + + + + + diff --git a/bms-front/src/views/price/basic/zone/index.vue b/bms-front/src/views/price/basic/zone/index.vue new file mode 100644 index 00000000..19329110 --- /dev/null +++ b/bms-front/src/views/price/basic/zone/index.vue @@ -0,0 +1,548 @@ + + + + + diff --git a/bms-front/src/views/price/set/create.vue b/bms-front/src/views/price/set/create.vue new file mode 100644 index 00000000..3117d086 --- /dev/null +++ b/bms-front/src/views/price/set/create.vue @@ -0,0 +1,490 @@ + + + + + diff --git a/bms-front/src/views/price/set/detail.vue b/bms-front/src/views/price/set/detail.vue new file mode 100644 index 00000000..72bb7201 --- /dev/null +++ b/bms-front/src/views/price/set/detail.vue @@ -0,0 +1,416 @@ + + + + + diff --git a/bms-front/src/views/price/set/priceSet.vue b/bms-front/src/views/price/set/priceSet.vue new file mode 100644 index 00000000..d730a6e0 --- /dev/null +++ b/bms-front/src/views/price/set/priceSet.vue @@ -0,0 +1,251 @@ + + + + + diff --git a/bms-front/src/views/system/dict/data.vue b/bms-front/src/views/system/dict/data.vue index 0ec660bc..dfeec5eb 100644 --- a/bms-front/src/views/system/dict/data.vue +++ b/bms-front/src/views/system/dict/data.vue @@ -120,7 +120,7 @@ -