提交附加费配置功能

This commit is contained in:
wuweihua
2026-09-07 16:50:59 +08:00
parent ea2bc6f33e
commit 3994bd7998
13 changed files with 947 additions and 0 deletions
@@ -0,0 +1,22 @@
package com.ruoyi.price.service;
import java.util.List;
import com.ruoyi.price.domain.PrcSurcharge;
/**
* 附加费配置 服务层
*
* @author ruoyi
*/
public interface IPrcSurchargeService
{
public PrcSurcharge selectPrcSurchargeById(Long scId);
public List<PrcSurcharge> selectPrcSurchargeList(PrcSurcharge surcharge);
public int insertPrcSurcharge(PrcSurcharge surcharge);
public int updatePrcSurcharge(PrcSurcharge surcharge);
public int deletePrcSurchargeByIds(Long[] scIds);
}
@@ -0,0 +1,86 @@
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.PrcSurcharge;
import com.ruoyi.price.mapper.PrcSurchargeMapper;
import com.ruoyi.price.service.IPrcSurchargeService;
/**
* 附加费配置 服务层实现
*
* @author ruoyi
*/
@Service
public class PrcSurchargeServiceImpl implements IPrcSurchargeService
{
@Autowired
private PrcSurchargeMapper surchargeMapper;
@Override
public PrcSurcharge selectPrcSurchargeById(Long scId)
{
return surchargeMapper.selectPrcSurchargeById(scId);
}
@Override
public List<PrcSurcharge> selectPrcSurchargeList(PrcSurcharge surcharge)
{
return surchargeMapper.selectPrcSurchargeList(surcharge);
}
@Override
public int insertPrcSurcharge(PrcSurcharge surcharge)
{
validate(surcharge);
if (StringUtils.isEmpty(surcharge.getSsCode()))
{
surcharge.setSsCode("on");
}
if (StringUtils.isEmpty(surcharge.getFeeType()))
{
surcharge.setFeeType("SURCHARGE");
}
if (StringUtils.isEmpty(surcharge.getRoundMode()))
{
surcharge.setRoundMode("HALF_UP");
}
return surchargeMapper.insertPrcSurcharge(surcharge);
}
@Override
public int updatePrcSurcharge(PrcSurcharge surcharge)
{
validate(surcharge);
return surchargeMapper.updatePrcSurcharge(surcharge);
}
@Override
public int deletePrcSurchargeByIds(Long[] scIds)
{
return surchargeMapper.deletePrcSurchargeByIds(scIds);
}
private void validate(PrcSurcharge surcharge)
{
if (StringUtils.isEmpty(surcharge.getScName()))
{
throw new ServiceException("附加费名称不能为空");
}
if (StringUtils.isEmpty(surcharge.getChargeType()))
{
throw new ServiceException("计费方式不能为空");
}
if (surcharge.getChargeValue() == null)
{
throw new ServiceException("计费数值不能为空");
}
if (surcharge.getChargeValue().compareTo(java.math.BigDecimal.ZERO) < 0)
{
throw new ServiceException("计费数值不能为负数");
}
}
}