后台--调试物流、规格
parent
a4246b55b9
commit
80e679a751
|
@ -2,11 +2,12 @@ package cn.iocoder.yudao.module.shop.controller.admin.express;
|
|||
|
||||
import cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.module.shop.controller.admin.express.vo.ShippingTemplatesReqVO;
|
||||
import cn.iocoder.yudao.module.shop.controller.admin.express.vo.ShippingTemplatesSearchReqVO;
|
||||
import cn.iocoder.yudao.module.shop.dal.dataobject.express.ShippingTemplatesDO;
|
||||
import cn.iocoder.yudao.module.shop.service.express.ShippingTemplatesService;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
|
@ -46,8 +47,8 @@ public class ShippingTemplatesController {
|
|||
@PreAuthorize("@ss.hasPermission('admin:shipping:templates:list')")
|
||||
@Operation(summary = "分页列表")
|
||||
@GetMapping(value = "/list")
|
||||
public CommonResult<PageResult<ShippingTemplatesDO>> getList(@Validated ShippingTemplatesSearchReqVO request){
|
||||
PageResult<ShippingTemplatesDO> shippingTemplatesCommonPage = shippingTemplatesService.getList(request);
|
||||
public CommonResult<PageInfo<ShippingTemplatesDO>> getList(@Validated ShippingTemplatesSearchReqVO request, @Validated PageParam pageParamRequest){
|
||||
PageInfo<ShippingTemplatesDO> shippingTemplatesCommonPage = shippingTemplatesService.getList(request, pageParamRequest);
|
||||
return CommonResult.success(shippingTemplatesCommonPage);
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ import java.util.List;
|
|||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("admin/express/shipping/no_delivery")
|
||||
@Tag(name = "设置 -- 物流 -- 免费")
|
||||
@Tag(name = "设置 -- 物流 -- 不送达")
|
||||
public class ShippingTemplatesNoDeliveryController {
|
||||
|
||||
@Autowired
|
||||
|
|
|
@ -39,9 +39,6 @@ public class ShippingTemplatesFreeRespVO implements Serializable {
|
|||
@Schema(description = "省ID, 多个逗号分割。 全国 all", required = true, example = "1,2,3,4")
|
||||
private String provinceId;
|
||||
|
||||
@Schema(description = "城市名称描述")
|
||||
private String title;
|
||||
|
||||
@Schema(description = "包邮件数", required = true, example = "1")
|
||||
// @Min(value = 1, message = "请填写包邮件数")
|
||||
@DecimalMin(value = "0.1", message = "包邮不能低于0.1")
|
||||
|
|
|
@ -38,8 +38,6 @@ public class ShippingTemplatesRegionRespVO implements Serializable {
|
|||
|
||||
@Schema(description = "省ID, 多个逗号分割。 全国 all", required = true, example = "1,2,3,4")
|
||||
private String provinceId;
|
||||
@Schema(description = "城市名称描述")
|
||||
private String title;
|
||||
|
||||
@Schema(description = "首件", required = true, example = "0.1")
|
||||
@DecimalMin(value = "0.1", message = "首件金额不能低于0.1")
|
||||
|
@ -57,6 +55,4 @@ public class ShippingTemplatesRegionRespVO implements Serializable {
|
|||
@DecimalMin(value = "0.1", message = "续件运费金额不能低于0.1")
|
||||
private BigDecimal renewalPrice;
|
||||
|
||||
@Schema(description = "分组唯一值")
|
||||
private String uniqid;
|
||||
}
|
||||
|
|
|
@ -45,11 +45,6 @@ public class ShippingTemplatesFreeDO implements Serializable {
|
|||
*/
|
||||
private Integer cityId;
|
||||
|
||||
/**
|
||||
*描述
|
||||
*/
|
||||
private String title;
|
||||
|
||||
/**
|
||||
*包邮件数
|
||||
*/
|
||||
|
|
|
@ -46,11 +46,6 @@ public class ShippingTemplatesRegionDO implements Serializable {
|
|||
|
||||
private Integer provinceId;
|
||||
|
||||
/**
|
||||
*描述
|
||||
*/
|
||||
private String title;
|
||||
|
||||
/**
|
||||
*首件
|
||||
*/
|
||||
|
@ -76,11 +71,6 @@ public class ShippingTemplatesRegionDO implements Serializable {
|
|||
*/
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
*分组唯一值
|
||||
*/
|
||||
private String uniqid;
|
||||
|
||||
/**
|
||||
*是否无效
|
||||
*/
|
||||
|
|
|
@ -36,4 +36,6 @@ public interface ShippingTemplatesNoDeliveryService extends IService<ShippingTem
|
|||
* @return 运费模板
|
||||
*/
|
||||
ShippingTemplatesNoDeliveryDO getByTempIdAndCityId(Integer tempId, Integer cityId);
|
||||
|
||||
public Boolean delete(Integer tempId);
|
||||
}
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
package cn.iocoder.yudao.module.shop.service.express;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.module.shop.controller.admin.express.vo.ShippingTemplatesReqVO;
|
||||
import cn.iocoder.yudao.module.shop.controller.admin.express.vo.ShippingTemplatesSearchReqVO;
|
||||
import cn.iocoder.yudao.module.shop.dal.dataobject.express.ShippingTemplatesDO;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
|
@ -25,7 +26,7 @@ import org.springframework.validation.annotation.Validated;
|
|||
@Validated
|
||||
public interface ShippingTemplatesService extends IService<ShippingTemplatesDO> {
|
||||
|
||||
PageResult<ShippingTemplatesDO> getList(ShippingTemplatesSearchReqVO request);
|
||||
PageInfo<ShippingTemplatesDO> getList(ShippingTemplatesSearchReqVO request, PageParam pageParamRequest);
|
||||
|
||||
/**
|
||||
* 新增运费模板
|
||||
|
|
|
@ -18,7 +18,6 @@ import org.springframework.stereotype.Service;
|
|||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* ShippingTemplatesFreeServiceImpl 接口实现
|
||||
|
@ -68,7 +67,7 @@ public class ShippingTemplatesFreeServiceImpl extends ServiceImpl<ShippingTempla
|
|||
for (Integer cityId: cityIdList) {
|
||||
ShippingTemplatesFreeDO shippingTemplatesFreeDO = new ShippingTemplatesFreeDO();
|
||||
shippingTemplatesFreeDO.setCityId(cityId);
|
||||
shippingTemplatesFreeDO.setTitle(shippingTemplatesFreeRespVO.getTitle());
|
||||
// shippingTemplatesFreeDO.setTitle(shippingTemplatesFreeRespVO.getTitle());
|
||||
shippingTemplatesFreeDO.setUniqid(uniqueKey);
|
||||
shippingTemplatesFreeDO.setTempId(tempId);
|
||||
shippingTemplatesFreeDO.setType(type);
|
||||
|
@ -82,7 +81,7 @@ public class ShippingTemplatesFreeServiceImpl extends ServiceImpl<ShippingTempla
|
|||
saveBatch(shippingTemplatesFreesListDO);
|
||||
|
||||
//删除模板下的无效数据
|
||||
delete(tempId);
|
||||
deleteStatusFalse(tempId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -116,11 +115,21 @@ public class ShippingTemplatesFreeServiceImpl extends ServiceImpl<ShippingTempla
|
|||
}
|
||||
|
||||
/**
|
||||
* 删除模板下的无效数据
|
||||
* 删除模板下的数据
|
||||
* @param tempId Integer 运费模板id
|
||||
*/
|
||||
@Override
|
||||
public Boolean delete(Integer tempId) {
|
||||
LambdaQueryWrapper<ShippingTemplatesFreeDO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(ShippingTemplatesFreeDO::getTempId, tempId);
|
||||
return dao.delete(lambdaQueryWrapper) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除模板下的无效数据
|
||||
* @param tempId Integer 运费模板id
|
||||
*/
|
||||
public Boolean deleteStatusFalse(Integer tempId) {
|
||||
LambdaQueryWrapper<ShippingTemplatesFreeDO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(ShippingTemplatesFreeDO::getTempId, tempId);
|
||||
lambdaQueryWrapper.eq(ShippingTemplatesFreeDO::getStatus, false);
|
||||
|
|
|
@ -11,14 +11,12 @@ import cn.iocoder.yudao.module.shop.dal.mysql.express.ShippingTemplatesNoDeliver
|
|||
import cn.iocoder.yudao.module.shop.service.express.ShippingTemplatesNoDeliveryService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@Validated
|
||||
|
@ -41,6 +39,7 @@ public class ShippingTemplatesNoDeliveryServiceImpl extends ServiceImpl<Shipping
|
|||
public void saveAll(List<ShippingTemplatesNoDeliveryRespVO> shippingTemplatesNoDeliveryRespVOS, Integer tempId) {
|
||||
ArrayList<ShippingTemplatesNoDeliveryDO> shippingTemplatesNoDeliveryDOS = new ArrayList<>();
|
||||
|
||||
delete(tempId);
|
||||
for (ShippingTemplatesNoDeliveryRespVO shippingTemplatesNoDeliveryRespVO : shippingTemplatesNoDeliveryRespVOS) {
|
||||
if(shippingTemplatesNoDeliveryRespVO.getCityId().equals("all") || shippingTemplatesNoDeliveryRespVO.getCityId().equals("0")){
|
||||
cityIdList = getCityIdList();
|
||||
|
@ -58,6 +57,17 @@ public class ShippingTemplatesNoDeliveryServiceImpl extends ServiceImpl<Shipping
|
|||
saveBatch(shippingTemplatesNoDeliveryDOS);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除模板下的无效数据
|
||||
* @param tempId Integer 运费模板id
|
||||
*/
|
||||
@Override
|
||||
public Boolean delete(Integer tempId) {
|
||||
LambdaQueryWrapper<ShippingTemplatesNoDeliveryDO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(ShippingTemplatesNoDeliveryDO::getTempId, tempId);
|
||||
return shippingTemplatesNoDeliveryMapper.delete(lambdaQueryWrapper) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有城市cityId
|
||||
* @author Mr.Zhang
|
||||
|
|
|
@ -20,7 +20,6 @@ import java.io.Serializable;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* ShippingTemplatesRegionServiceImpl 接口实现
|
||||
|
@ -79,8 +78,7 @@ public class ShippingTemplatesRegionServiceImpl extends ServiceImpl<ShippingTemp
|
|||
for (Integer cityId: cityIdList) {
|
||||
ShippingTemplatesRegionDO shippingTemplatesRegionDO = new ShippingTemplatesRegionDO();
|
||||
shippingTemplatesRegionDO.setCityId(cityId);
|
||||
shippingTemplatesRegionDO.setTitle(shippingTemplatesRegionRespVO.getTitle());
|
||||
shippingTemplatesRegionDO.setUniqid(uniqueKey);
|
||||
// shippingTemplatesRegionDO.setTitle(shippingTemplatesRegionRespVO.getTitle());
|
||||
shippingTemplatesRegionDO.setRenewal(shippingTemplatesRegionRespVO.getRenewal());
|
||||
shippingTemplatesRegionDO.setRenewalPrice(shippingTemplatesRegionRespVO.getRenewalPrice());
|
||||
shippingTemplatesRegionDO.setFirst(shippingTemplatesRegionRespVO.getFirst());
|
||||
|
@ -95,7 +93,7 @@ public class ShippingTemplatesRegionServiceImpl extends ServiceImpl<ShippingTemp
|
|||
saveBatch(shippingTemplatesRegionDOList);
|
||||
|
||||
//删除模板下的无效数据
|
||||
delete(tempId);
|
||||
deleteStatusFalse(tempId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -133,8 +131,7 @@ public class ShippingTemplatesRegionServiceImpl extends ServiceImpl<ShippingTemp
|
|||
* @param tempId Integer 运费模板id
|
||||
* @return Boolean
|
||||
*/
|
||||
@Override
|
||||
public Boolean delete(Integer tempId) {
|
||||
public Boolean deleteStatusFalse(Integer tempId) {
|
||||
LambdaQueryWrapper<ShippingTemplatesRegionDO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(ShippingTemplatesRegionDO::getTempId, tempId);
|
||||
lambdaQueryWrapper.eq(ShippingTemplatesRegionDO::getStatus, false);
|
||||
|
@ -152,7 +149,6 @@ public class ShippingTemplatesRegionServiceImpl extends ServiceImpl<ShippingTemp
|
|||
LambdaQueryWrapper<ShippingTemplatesRegionDO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(ShippingTemplatesRegionDO::getTempId, tempId);
|
||||
lambdaQueryWrapper.eq(ShippingTemplatesRegionDO::getCityId, cityId);
|
||||
lambdaQueryWrapper.eq(ShippingTemplatesRegionDO::getStatus, true);
|
||||
lambdaQueryWrapper.orderByDesc(ShippingTemplatesRegionDO::getId);
|
||||
lambdaQueryWrapper.last(" limit 1");
|
||||
return dao.selectOne(lambdaQueryWrapper);
|
||||
|
@ -167,5 +163,12 @@ public class ShippingTemplatesRegionServiceImpl extends ServiceImpl<ShippingTemp
|
|||
public List<ShippingTemplatesRegionRespVO> getListGroup(Integer tempId) {
|
||||
return dao.getListGroup(tempId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean delete(Integer tempId) {
|
||||
LambdaQueryWrapper<ShippingTemplatesRegionDO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(ShippingTemplatesRegionDO::getTempId, tempId);
|
||||
return dao.delete(lambdaQueryWrapper) > 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ package cn.iocoder.yudao.module.shop.service.express.impl;
|
|||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.iocoder.yudao.framework.common.exception.ServiceException;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.module.shop.controller.admin.express.vo.*;
|
||||
import cn.iocoder.yudao.module.shop.dal.dataobject.express.ShippingTemplatesDO;
|
||||
import cn.iocoder.yudao.module.shop.dal.mysql.express.ShippingTemplatesMapper;
|
||||
|
@ -13,6 +13,8 @@ import cn.iocoder.yudao.module.shop.service.express.ShippingTemplatesRegionServi
|
|||
import cn.iocoder.yudao.module.shop.service.express.ShippingTemplatesService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
@ -59,15 +61,16 @@ public class ShippingTemplatesServiceImpl extends ServiceImpl<ShippingTemplatesM
|
|||
* @return List<ShippingTemplates>
|
||||
*/
|
||||
@Override
|
||||
public PageResult<ShippingTemplatesDO> getList(ShippingTemplatesSearchReqVO request) {
|
||||
public PageInfo<ShippingTemplatesDO> getList(ShippingTemplatesSearchReqVO request, PageParam pageParamRequest) {
|
||||
PageHelper.startPage(pageParamRequest.getPageNo(), pageParamRequest.getPageSize());
|
||||
|
||||
LambdaQueryWrapper<ShippingTemplatesDO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
if(!StringUtils.isBlank(request.getKeywords())){
|
||||
lambdaQueryWrapper.like(ShippingTemplatesDO::getName, request.getKeywords());
|
||||
}
|
||||
lambdaQueryWrapper.orderByDesc(ShippingTemplatesDO::getSort).orderByDesc(ShippingTemplatesDO::getId);
|
||||
|
||||
return dao.selectPage(request, lambdaQueryWrapper);
|
||||
lambdaQueryWrapper.orderByDesc(ShippingTemplatesDO::getSort).orderByDesc(ShippingTemplatesDO::getId);
|
||||
return new PageInfo<>(dao.selectList(lambdaQueryWrapper));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -92,6 +95,7 @@ public class ShippingTemplatesServiceImpl extends ServiceImpl<ShippingTemplatesM
|
|||
shippingTemplatesDO.setName(request.getName());
|
||||
shippingTemplatesDO.setSort(request.getSort());
|
||||
shippingTemplatesDO.setType(request.getType());
|
||||
shippingTemplatesDO.setDeleted(false);
|
||||
shippingTemplatesDO.setAppoint(request.getAppoint());
|
||||
|
||||
save(shippingTemplatesDO);
|
||||
|
@ -183,7 +187,8 @@ public class ShippingTemplatesServiceImpl extends ServiceImpl<ShippingTemplatesM
|
|||
return transactionTemplate.execute(e -> {
|
||||
shippingTemplatesRegionService.delete(id);
|
||||
shippingTemplatesFreeService.delete(id);
|
||||
removeById(id);
|
||||
shippingTemplatesNoDeliveryService.delete(id);
|
||||
dao.deleteById(id);
|
||||
return Boolean.TRUE;
|
||||
});
|
||||
}
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
<mapper namespace="cn.iocoder.yudao.module.shop.dal.mysql.express.ShippingTemplatesFreeMapper">
|
||||
|
||||
<select id="getListGroup" resultType="cn.iocoder.yudao.module.shop.controller.admin.express.vo.ShippingTemplatesFreeRespVO" parameterType="integer">
|
||||
SELECT group_concat(`city_id`) AS city_id, title, `number`, price, uniqid FROM eb_shipping_templates_free where temp_id = #{tempId, jdbcType=INTEGER} GROUP BY `uniqid` ORDER BY id ASC
|
||||
SELECT group_concat(`city_id`) AS city_id, province_id, `number`, price FROM eb_shipping_templates_free where temp_id = #{tempId, jdbcType=INTEGER} GROUP BY `id` ORDER BY id ASC
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
<mapper namespace="cn.iocoder.yudao.module.shop.dal.mysql.express.ShippingTemplatesNoDeliveryMapper">
|
||||
|
||||
<select id="getList" resultType="cn.iocoder.yudao.module.shop.controller.admin.express.vo.ShippingTemplatesNoDeliveryRespVO" parameterType="integer">
|
||||
SELECT group_concat(`city_id`) AS city_id, temp_id FROM eb_shipping_templates_no_delivery where temp_id = #{tempId, jdbcType=INTEGER} ORDER BY id ASC
|
||||
SELECT group_concat(`city_id`) AS city_id, province_id FROM eb_shipping_templates_no_delivery WHERE temp_id = #{tempId, jdbcType=INTEGER} GROUP BY `id` ORDER BY id ASC
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
<mapper namespace="cn.iocoder.yudao.module.shop.dal.mysql.express.ShippingTemplatesRegionMapper">
|
||||
|
||||
<select id="getListGroup" resultType="cn.iocoder.yudao.module.shop.controller.admin.express.vo.ShippingTemplatesRegionRespVO" parameterType="integer">
|
||||
SELECT group_concat(`city_id`) AS city_id, title, `first`, first_price, `renewal`, renewal_price, uniqid FROM eb_shipping_templates_region where temp_id = #{tempId, jdbcType=INTEGER} GROUP BY `uniqid` ORDER BY id ASC
|
||||
SELECT group_concat(`city_id`) AS city_id, `first`, first_price, `renewal`, renewal_price FROM eb_shipping_templates_region where temp_id = #{tempId, jdbcType=INTEGER} GROUP BY `id` ORDER BY id ASC
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
Loading…
Reference in New Issue