快递费配置
parent
c04893c13c
commit
0023a833bc
|
|
@ -1,17 +1,20 @@
|
|||
package com.ruoyi.web.controller.xkt;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.ruoyi.common.core.controller.XktBaseController;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.page.PageVO;
|
||||
import com.ruoyi.web.controller.xkt.vo.IdVO;
|
||||
import com.ruoyi.web.controller.xkt.vo.express.*;
|
||||
import com.ruoyi.xkt.dto.express.ExpressFeeDTO;
|
||||
import com.ruoyi.xkt.dto.express.ExpressRegionTreeNodeDTO;
|
||||
import com.ruoyi.xkt.dto.express.ExpressStructAddressDTO;
|
||||
import com.ruoyi.xkt.dto.express.ExpressTrackRecordDTO;
|
||||
import com.ruoyi.xkt.dto.express.*;
|
||||
import com.ruoyi.xkt.service.IExpressService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
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.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
|
@ -72,4 +75,46 @@ public class ExpressController extends XktBaseController {
|
|||
return success(voMap);
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('admin,general_admin')")
|
||||
@ApiOperation("创建快递费配置 - 管理员")
|
||||
@PostMapping("/fee-config/create")
|
||||
public R<Long> createFeeConfig(@Valid @RequestBody ExpressFeeConfigEditVO vo) {
|
||||
ExpressFeeConfigEditDTO dto = BeanUtil.toBean(vo, ExpressFeeConfigEditDTO.class);
|
||||
Long id = expressService.createExpressFeeConfig(dto);
|
||||
return success(id);
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('admin,general_admin')")
|
||||
@ApiOperation("修改快递费配置 - 管理员")
|
||||
@PostMapping("/fee-config/edit")
|
||||
public R<Long> editExpressFeeConfig(@Valid @RequestBody ExpressFeeConfigEditVO vo) {
|
||||
ExpressFeeConfigEditDTO dto = BeanUtil.toBean(vo, ExpressFeeConfigEditDTO.class);
|
||||
expressService.modifyExpressFeeConfig(dto);
|
||||
return success(dto.getId());
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('admin,general_admin')")
|
||||
@ApiOperation("删除快递费配置 - 管理员")
|
||||
@PostMapping("/fee-config/remove")
|
||||
public R removeExpressFeeConfigInfo(@Validated @RequestBody IdVO vo) {
|
||||
expressService.deleteExpressFeeConfig(vo.getId());
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "快递费配置详情")
|
||||
@GetMapping(value = "/fee-config/{id}")
|
||||
public R<ExpressFeeConfigVO> getExpressFeeConfigInfo(@PathVariable("id") Long id) {
|
||||
ExpressFeeConfigDTO infoDTO = expressService.getExpressFeeConfigById(id);
|
||||
return success(BeanUtil.toBean(infoDTO, ExpressFeeConfigVO.class));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "快递费配置分页查询")
|
||||
@PostMapping("/fee-config/page")
|
||||
public R<PageVO<ExpressFeeConfigListItemVO>> pageExpressFeeConfig(@Validated @RequestBody ExpressFeeConfigQueryVO vo) {
|
||||
ExpressFeeConfigQueryDTO queryDTO = BeanUtil.toBean(vo, ExpressFeeConfigQueryDTO.class);
|
||||
Page<ExpressFeeConfigListItemDTO> pageDTO = PageHelper.startPage(vo.getPageNum(), vo.getPageSize());
|
||||
expressService.listFeeConfig(queryDTO);
|
||||
return success(PageVO.of(pageDTO, ExpressFeeConfigListItemVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,48 @@
|
|||
package com.ruoyi.web.controller.xkt.vo.express;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 物流费用配置
|
||||
*
|
||||
* @author liangyq
|
||||
* @date 2025-04-02 15:00
|
||||
*/
|
||||
@ApiModel
|
||||
@Data
|
||||
public class ExpressFeeConfigEditVO {
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@ApiModelProperty(value = "ID")
|
||||
private Long id;
|
||||
/**
|
||||
* 物流ID
|
||||
*/
|
||||
@ApiModelProperty(value = "物流ID")
|
||||
private Long expressId;
|
||||
/**
|
||||
* 地区编码,基于行政区划代码做扩展,唯一约束
|
||||
*/
|
||||
@ApiModelProperty(value = "地区编码")
|
||||
private String regionCode;
|
||||
/**
|
||||
* 上级地区编码,没有上级的默认空
|
||||
*/
|
||||
@ApiModelProperty(value = "上级地区编码")
|
||||
private String parentRegionCode;
|
||||
/**
|
||||
* 首件运费
|
||||
*/
|
||||
@ApiModelProperty(value = "首件运费")
|
||||
private BigDecimal firstItemAmount;
|
||||
/**
|
||||
* 续费
|
||||
*/
|
||||
@ApiModelProperty(value = "续费")
|
||||
private BigDecimal nextItemAmount;
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
package com.ruoyi.web.controller.xkt.vo.express;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
/**
|
||||
* @author liangyq
|
||||
* @date 2025-06-11
|
||||
*/
|
||||
@ApiModel
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class ExpressFeeConfigListItemVO extends ExpressFeeConfigVO {
|
||||
|
||||
@ApiModelProperty(value = "地区名称")
|
||||
private String regionName;
|
||||
|
||||
@ApiModelProperty(value = "物流名称")
|
||||
private String expressName;
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
package com.ruoyi.web.controller.xkt.vo.express;
|
||||
|
||||
import com.ruoyi.web.controller.xkt.vo.BasePageVO;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
/**
|
||||
* 物流费用配置
|
||||
*
|
||||
* @author liangyq
|
||||
* @date 2025-04-02 15:00
|
||||
*/
|
||||
@ApiModel
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class ExpressFeeConfigQueryVO extends BasePageVO {
|
||||
/**
|
||||
* 物流ID
|
||||
*/
|
||||
@ApiModelProperty(value = "物流ID")
|
||||
private Long expressId;
|
||||
/**
|
||||
* 地区编码
|
||||
*/
|
||||
@ApiModelProperty(value = "地区编码")
|
||||
private String regionCode;
|
||||
/**
|
||||
* 地区名称
|
||||
*/
|
||||
@ApiModelProperty(value = "地区名称")
|
||||
private String regionName;
|
||||
}
|
||||
|
|
@ -0,0 +1,74 @@
|
|||
package com.ruoyi.web.controller.xkt.vo.express;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 物流费用配置
|
||||
*
|
||||
* @author liangyq
|
||||
* @date 2025-04-02 15:00
|
||||
*/
|
||||
@ApiModel
|
||||
@Data
|
||||
public class ExpressFeeConfigVO {
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@ApiModelProperty(value = "ID")
|
||||
private Long id;
|
||||
/**
|
||||
* 物流ID
|
||||
*/
|
||||
@ApiModelProperty(value = "物流ID")
|
||||
private Long expressId;
|
||||
/**
|
||||
* 地区编码,基于行政区划代码做扩展,唯一约束
|
||||
*/
|
||||
@ApiModelProperty(value = "地区编码")
|
||||
private String regionCode;
|
||||
/**
|
||||
* 上级地区编码,没有上级的默认空
|
||||
*/
|
||||
@ApiModelProperty(value = "上级地区编码")
|
||||
private String parentRegionCode;
|
||||
/**
|
||||
* 首件运费
|
||||
*/
|
||||
@ApiModelProperty(value = "首件运费")
|
||||
private BigDecimal firstItemAmount;
|
||||
/**
|
||||
* 续费
|
||||
*/
|
||||
@ApiModelProperty(value = "续费")
|
||||
private BigDecimal nextItemAmount;
|
||||
/**
|
||||
* 删除标志(0代表存在 2代表删除)
|
||||
*/
|
||||
@ApiModelProperty(value = "删除标志(0代表存在 2代表删除)")
|
||||
private String delFlag;
|
||||
/**
|
||||
* 创建者
|
||||
*/
|
||||
@ApiModelProperty(value = "创建者")
|
||||
private String createBy;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Date createTime;
|
||||
/**
|
||||
* 更新者
|
||||
*/
|
||||
@ApiModelProperty(value = "更新者")
|
||||
private String updateBy;
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private Date updateTime;
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
package com.ruoyi.xkt.dto.express;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 物流费用配置
|
||||
*
|
||||
* @author liangyq
|
||||
* @date 2025-04-02 15:00
|
||||
*/
|
||||
@Data
|
||||
public class ExpressFeeConfigEditDTO {
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
* 物流ID
|
||||
*/
|
||||
private Long expressId;
|
||||
/**
|
||||
* 地区编码,基于行政区划代码做扩展,唯一约束
|
||||
*/
|
||||
private String regionCode;
|
||||
/**
|
||||
* 上级地区编码,没有上级的默认空
|
||||
*/
|
||||
private String parentRegionCode;
|
||||
/**
|
||||
* 首件运费
|
||||
*/
|
||||
private BigDecimal firstItemAmount;
|
||||
/**
|
||||
* 续费
|
||||
*/
|
||||
private BigDecimal nextItemAmount;
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
package com.ruoyi.xkt.dto.express;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
/**
|
||||
* @author liangyq
|
||||
* @date 2025-06-11
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class ExpressFeeConfigListItemDTO extends ExpressFeeConfigDTO {
|
||||
|
||||
private String regionName;
|
||||
|
||||
private String expressName;
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package com.ruoyi.xkt.dto.express;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 物流费用配置
|
||||
*
|
||||
* @author liangyq
|
||||
* @date 2025-04-02 15:00
|
||||
*/
|
||||
@Data
|
||||
public class ExpressFeeConfigQueryDTO {
|
||||
/**
|
||||
* 物流ID
|
||||
*/
|
||||
private Long expressId;
|
||||
/**
|
||||
* 地区编码,基于行政区划代码做扩展,唯一约束
|
||||
*/
|
||||
private String regionCode;
|
||||
/**
|
||||
* 地区名称
|
||||
*/
|
||||
private String regionName;
|
||||
}
|
||||
|
|
@ -2,12 +2,20 @@ package com.ruoyi.xkt.mapper;
|
|||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.ruoyi.xkt.domain.ExpressFeeConfig;
|
||||
import com.ruoyi.xkt.dto.express.ExpressFeeConfigDTO;
|
||||
import com.ruoyi.xkt.dto.express.ExpressFeeConfigListItemDTO;
|
||||
import com.ruoyi.xkt.dto.express.ExpressFeeConfigQueryDTO;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author liangyq
|
||||
* @date 2025-04-02 12:48
|
||||
*/
|
||||
@Repository
|
||||
public interface ExpressFeeConfigMapper extends BaseMapper<ExpressFeeConfig> {
|
||||
|
||||
List<ExpressFeeConfigListItemDTO> listFeeConfig(ExpressFeeConfigQueryDTO queryDTO);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -142,4 +142,44 @@ public interface IExpressService {
|
|||
* @return
|
||||
*/
|
||||
List<ExpressTrackRecordDTO> listTrackRecord(Collection<String> expressWaybillNos);
|
||||
|
||||
/**
|
||||
* 快递费配置列表
|
||||
*
|
||||
* @param queryDTO
|
||||
* @return
|
||||
*/
|
||||
List<ExpressFeeConfigListItemDTO> listFeeConfig(ExpressFeeConfigQueryDTO queryDTO);
|
||||
|
||||
/**
|
||||
* 快递费配置
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
ExpressFeeConfigDTO getExpressFeeConfigById(Long id);
|
||||
|
||||
/**
|
||||
* 删除快递费配置
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
void deleteExpressFeeConfig(Long id);
|
||||
|
||||
/**
|
||||
* 创建快递费配置
|
||||
*
|
||||
* @param editDTO
|
||||
* @return
|
||||
*/
|
||||
Long createExpressFeeConfig(ExpressFeeConfigEditDTO editDTO);
|
||||
|
||||
/**
|
||||
* 修改快递费配置
|
||||
*
|
||||
* @param editDTO
|
||||
*/
|
||||
void modifyExpressFeeConfig(ExpressFeeConfigEditDTO editDTO);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import com.ruoyi.common.constant.Constants;
|
|||
import com.ruoyi.common.core.domain.SimpleEntity;
|
||||
import com.ruoyi.common.core.redis.RedisCache;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.common.utils.bean.BeanValidators;
|
||||
import com.ruoyi.xkt.domain.*;
|
||||
import com.ruoyi.xkt.dto.express.*;
|
||||
|
|
@ -25,6 +26,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
|
|
@ -288,6 +290,8 @@ public class ExpressServiceImpl implements IExpressService {
|
|||
expressTrackRecord.setDescription(addDTO.getDescription());
|
||||
expressTrackRecord.setRemark(addDTO.getRemark());
|
||||
expressTrackRecord.setDelFlag(Constants.UNDELETED);
|
||||
expressTrackRecord.setCreateBy(SecurityUtils.getUsernameSafe());
|
||||
expressTrackRecord.setUpdateBy(SecurityUtils.getUsernameSafe());
|
||||
expressTrackRecordMapper.insert(expressTrackRecord);
|
||||
return expressTrackRecord.getId();
|
||||
}
|
||||
|
|
@ -312,4 +316,67 @@ public class ExpressServiceImpl implements IExpressService {
|
|||
);
|
||||
return BeanUtil.copyToList(expressTrackRecords, ExpressTrackRecordDTO.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ExpressFeeConfigListItemDTO> listFeeConfig(ExpressFeeConfigQueryDTO queryDTO) {
|
||||
return expressFeeConfigMapper.listFeeConfig(queryDTO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExpressFeeConfigDTO getExpressFeeConfigById(Long id) {
|
||||
ExpressFeeConfig config = expressFeeConfigMapper.selectById(id);
|
||||
return BeanUtil.toBean(config, ExpressFeeConfigDTO.class);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void deleteExpressFeeConfig(Long id) {
|
||||
Assert.notNull(id);
|
||||
//物理删除
|
||||
expressFeeConfigMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public Long createExpressFeeConfig(ExpressFeeConfigEditDTO editDTO) {
|
||||
Assert.isNull(editDTO.getId());
|
||||
Assert.notNull(editDTO.getExpressId());
|
||||
Assert.notEmpty(editDTO.getRegionCode());
|
||||
Assert.notNull(editDTO.getFirstItemAmount());
|
||||
Assert.notNull(editDTO.getNextItemAmount());
|
||||
boolean exists = expressFeeConfigMapper.exists(Wrappers.lambdaQuery(ExpressFeeConfig.class)
|
||||
.eq(ExpressFeeConfig::getExpressId, editDTO.getExpressId())
|
||||
.eq(ExpressFeeConfig::getRegionCode, editDTO.getRegionCode()));
|
||||
Assert.isFalse(exists, "地区费用配置已存在");
|
||||
ExpressFeeConfig config = BeanUtil.toBean(editDTO, ExpressFeeConfig.class);
|
||||
config.setCreateBy(SecurityUtils.getUsernameSafe());
|
||||
config.setUpdateBy(SecurityUtils.getUsernameSafe());
|
||||
expressFeeConfigMapper.insert(config);
|
||||
return config.getId();
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void modifyExpressFeeConfig(ExpressFeeConfigEditDTO editDTO) {
|
||||
Assert.notNull(editDTO.getId());
|
||||
Assert.notNull(editDTO.getExpressId());
|
||||
Assert.notEmpty(editDTO.getRegionCode());
|
||||
Assert.notNull(editDTO.getFirstItemAmount());
|
||||
Assert.notNull(editDTO.getNextItemAmount());
|
||||
ExpressFeeConfig config = expressFeeConfigMapper.selectById(editDTO.getId());
|
||||
Assert.notNull(config);
|
||||
boolean exists = expressFeeConfigMapper.exists(Wrappers.lambdaQuery(ExpressFeeConfig.class)
|
||||
.eq(ExpressFeeConfig::getExpressId, editDTO.getExpressId())
|
||||
.eq(ExpressFeeConfig::getRegionCode, editDTO.getRegionCode())
|
||||
.ne(SimpleEntity::getId, editDTO.getId()));
|
||||
Assert.isFalse(exists, "地区费用配置已存在");
|
||||
config.setExpressId(editDTO.getExpressId());
|
||||
config.setRegionCode(editDTO.getRegionCode());
|
||||
config.setParentRegionCode(editDTO.getParentRegionCode());
|
||||
config.setFirstItemAmount(editDTO.getFirstItemAmount());
|
||||
config.setNextItemAmount(editDTO.getNextItemAmount());
|
||||
config.setUpdateBy(SecurityUtils.getUsernameSafe());
|
||||
config.setUpdateTime(new Date());
|
||||
expressFeeConfigMapper.updateById(config);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,4 +2,26 @@
|
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.xkt.mapper.ExpressFeeConfigMapper">
|
||||
|
||||
<select id="listFeeConfig" resultType="com.ruoyi.xkt.dto.express.ExpressFeeConfigListItemDTO"
|
||||
parameterType="com.ruoyi.xkt.dto.express.ExpressFeeConfigQueryDTO">
|
||||
SELECT
|
||||
efc.*,
|
||||
er.region_name,
|
||||
e.express_name
|
||||
FROM
|
||||
express_fee_config efc
|
||||
LEFT JOIN express_region er ON efc.region_code = er.region_code
|
||||
LEFT JOIN express e ON efc.express_id = e.id
|
||||
WHERE
|
||||
efc.del_flag = '0'
|
||||
<if test="expressId != null">
|
||||
AND efc.express_id = #{expressId}
|
||||
</if>
|
||||
<if test="regionCode != null and regionCode != ''">
|
||||
AND efc.region_code = #{regionCode}
|
||||
</if>
|
||||
<if test="regionName != null and regionName != ''">
|
||||
AND er.region_name like concat('%', #{regionName}, '%')
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue