提交附加费配置功能
This commit is contained in:
@@ -0,0 +1,84 @@
|
||||
package com.ruoyi.price.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 附加费配置 prc_surcharge
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class PrcSurcharge extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 附加费配置ID */
|
||||
private Long scId;
|
||||
/** 附加费名称 */
|
||||
private String scName;
|
||||
/** 费用类型(字典 bms_fee_type) */
|
||||
private String feeType;
|
||||
/** 计费方式 FIXED固定金额/WEIGHT按重量/RATE按比例 */
|
||||
private String chargeType;
|
||||
/** 计费数值 */
|
||||
private BigDecimal chargeValue;
|
||||
/** 币种 */
|
||||
private String currency;
|
||||
/** 取值方式(字典 bms_round_mode)UP/DOWN/HALF_UP */
|
||||
private String roundMode;
|
||||
/** 状态码 on/of */
|
||||
private String ssCode;
|
||||
/** 适用国家ISO2(空=全部) */
|
||||
private String countryCode;
|
||||
/** 备注 */
|
||||
private String scNote;
|
||||
/** 租户ID */
|
||||
private Long tmsId;
|
||||
|
||||
public Long getScId() { return scId; }
|
||||
public void setScId(Long scId) { this.scId = scId; }
|
||||
public String getScName() { return scName; }
|
||||
public void setScName(String scName) { this.scName = scName; }
|
||||
public String getFeeType() { return feeType; }
|
||||
public void setFeeType(String feeType) { this.feeType = feeType; }
|
||||
public String getChargeType() { return chargeType; }
|
||||
public void setChargeType(String chargeType) { this.chargeType = chargeType; }
|
||||
public BigDecimal getChargeValue() { return chargeValue; }
|
||||
public void setChargeValue(BigDecimal chargeValue) { this.chargeValue = chargeValue; }
|
||||
public String getCurrency() { return currency; }
|
||||
public void setCurrency(String currency) { this.currency = currency; }
|
||||
public String getRoundMode() { return roundMode; }
|
||||
public void setRoundMode(String roundMode) { this.roundMode = roundMode; }
|
||||
public String getSsCode() { return ssCode; }
|
||||
public void setSsCode(String ssCode) { this.ssCode = ssCode; }
|
||||
public String getCountryCode() { return countryCode; }
|
||||
public void setCountryCode(String countryCode) { this.countryCode = countryCode; }
|
||||
public String getScNote() { return scNote; }
|
||||
public void setScNote(String scNote) { this.scNote = scNote; }
|
||||
public Long getTmsId() { return tmsId; }
|
||||
public void setTmsId(Long tmsId) { this.tmsId = tmsId; }
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("scId", getScId())
|
||||
.append("scName", getScName())
|
||||
.append("feeType", getFeeType())
|
||||
.append("chargeType", getChargeType())
|
||||
.append("chargeValue", getChargeValue())
|
||||
.append("currency", getCurrency())
|
||||
.append("roundMode", getRoundMode())
|
||||
.append("ssCode", getSsCode())
|
||||
.append("countryCode", getCountryCode())
|
||||
.append("scNote", getScNote())
|
||||
.append("tmsId", getTmsId())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.ruoyi.price.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.price.domain.PrcSurcharge;
|
||||
|
||||
/**
|
||||
* 附加费配置 数据层
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public interface PrcSurchargeMapper
|
||||
{
|
||||
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,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);
|
||||
}
|
||||
+86
@@ -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("计费数值不能为负数");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.price.mapper.PrcSurchargeMapper">
|
||||
|
||||
<resultMap type="PrcSurcharge" id="PrcSurchargeResult">
|
||||
<id property="scId" column="sc_id" />
|
||||
<result property="scName" column="sc_name" />
|
||||
<result property="feeType" column="fee_type" />
|
||||
<result property="chargeType" column="charge_type" />
|
||||
<result property="chargeValue" column="charge_value" />
|
||||
<result property="currency" column="currency" />
|
||||
<result property="roundMode" column="round_mode" />
|
||||
<result property="ssCode" column="ss_code" />
|
||||
<result property="countryCode" column="country_code" />
|
||||
<result property="scNote" column="sc_note" />
|
||||
<result property="tmsId" column="tms_id" />
|
||||
<result property="createBy" column="created_by" />
|
||||
<result property="createTime" column="created_at" />
|
||||
<result property="updateBy" column="updated_by" />
|
||||
<result property="updateTime" column="updated_at" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectPrcSurchargeVo">
|
||||
select sc_id, sc_name, fee_type, charge_type, charge_value, currency, round_mode, ss_code,
|
||||
country_code, sc_note, tms_id, created_by, created_at, updated_by, updated_at
|
||||
from prc_surcharge
|
||||
</sql>
|
||||
|
||||
<select id="selectPrcSurchargeById" parameterType="Long" resultMap="PrcSurchargeResult">
|
||||
<include refid="selectPrcSurchargeVo"/>
|
||||
where sc_id = #{scId}
|
||||
</select>
|
||||
|
||||
<select id="selectPrcSurchargeList" parameterType="PrcSurcharge" resultMap="PrcSurchargeResult">
|
||||
<include refid="selectPrcSurchargeVo"/>
|
||||
<where>
|
||||
<if test="scName != null and scName != ''">
|
||||
AND sc_name like concat('%', #{scName}, '%')
|
||||
</if>
|
||||
<if test="feeType != null and feeType != ''">
|
||||
AND fee_type = #{feeType}
|
||||
</if>
|
||||
<if test="chargeType != null and chargeType != ''">
|
||||
AND charge_type = #{chargeType}
|
||||
</if>
|
||||
<if test="roundMode != null and roundMode != ''">
|
||||
AND round_mode = #{roundMode}
|
||||
</if>
|
||||
<if test="ssCode != null and ssCode != ''">
|
||||
AND ss_code = #{ssCode}
|
||||
</if>
|
||||
<if test="countryCode != null and countryCode != ''">
|
||||
AND country_code = #{countryCode}
|
||||
</if>
|
||||
<if test="tmsId != null">
|
||||
AND tms_id = #{tmsId}
|
||||
</if>
|
||||
</where>
|
||||
order by sc_id desc
|
||||
</select>
|
||||
|
||||
<insert id="insertPrcSurcharge" parameterType="PrcSurcharge" useGeneratedKeys="true" keyProperty="scId">
|
||||
insert into prc_surcharge (
|
||||
<if test="scName != null and scName != ''">sc_name,</if>
|
||||
<if test="feeType != null and feeType != ''">fee_type,</if>
|
||||
<if test="chargeType != null and chargeType != ''">charge_type,</if>
|
||||
<if test="chargeValue != null">charge_value,</if>
|
||||
<if test="currency != null and currency != ''">currency,</if>
|
||||
<if test="roundMode != null and roundMode != ''">round_mode,</if>
|
||||
<if test="ssCode != null and ssCode != ''">ss_code,</if>
|
||||
<if test="countryCode != null">country_code,</if>
|
||||
<if test="scNote != null">sc_note,</if>
|
||||
<if test="tmsId != null">tms_id,</if>
|
||||
<if test="createBy != null and createBy != ''">created_by,</if>
|
||||
created_at
|
||||
) values (
|
||||
<if test="scName != null and scName != ''">#{scName},</if>
|
||||
<if test="feeType != null and feeType != ''">#{feeType},</if>
|
||||
<if test="chargeType != null and chargeType != ''">#{chargeType},</if>
|
||||
<if test="chargeValue != null">#{chargeValue},</if>
|
||||
<if test="currency != null and currency != ''">#{currency},</if>
|
||||
<if test="roundMode != null and roundMode != ''">#{roundMode},</if>
|
||||
<if test="ssCode != null and ssCode != ''">#{ssCode},</if>
|
||||
<if test="countryCode != null">#{countryCode},</if>
|
||||
<if test="scNote != null">#{scNote},</if>
|
||||
<if test="tmsId != null">#{tmsId},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="updatePrcSurcharge" parameterType="PrcSurcharge">
|
||||
update prc_surcharge
|
||||
<set>
|
||||
<if test="scName != null and scName != ''">sc_name = #{scName},</if>
|
||||
<if test="feeType != null and feeType != ''">fee_type = #{feeType},</if>
|
||||
<if test="chargeType != null and chargeType != ''">charge_type = #{chargeType},</if>
|
||||
<if test="chargeValue != null">charge_value = #{chargeValue},</if>
|
||||
<if test="currency != null and currency != ''">currency = #{currency},</if>
|
||||
<if test="roundMode != null and roundMode != ''">round_mode = #{roundMode},</if>
|
||||
<if test="ssCode != null and ssCode != ''">ss_code = #{ssCode},</if>
|
||||
country_code = #{countryCode},
|
||||
<if test="scNote != null">sc_note = #{scNote},</if>
|
||||
<if test="tmsId != null">tms_id = #{tmsId},</if>
|
||||
<if test="updateBy != null and updateBy != ''">updated_by = #{updateBy},</if>
|
||||
updated_at = sysdate()
|
||||
</set>
|
||||
where sc_id = #{scId}
|
||||
</update>
|
||||
|
||||
<delete id="deletePrcSurchargeByIds" parameterType="Long">
|
||||
delete from prc_surcharge where sc_id in
|
||||
<foreach item="scId" collection="array" open="(" separator="," close=")">
|
||||
#{scId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user