diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/express/vo/ShippingTemplatesFreeRespVO.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/express/vo/ShippingTemplatesFreeRespVO.java index 5a037a619..b535a5a8b 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/express/vo/ShippingTemplatesFreeRespVO.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/express/vo/ShippingTemplatesFreeRespVO.java @@ -48,4 +48,7 @@ public class ShippingTemplatesFreeRespVO implements Serializable { @NotNull(message = "请填写包邮金额") @DecimalMin(value = "0", message = "包邮金额不能低于0") private BigDecimal price; + + @Schema(description = "分组唯一值", required = true) + private String uniqid; } diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/express/vo/ShippingTemplatesNoDeliveryRespVO.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/express/vo/ShippingTemplatesNoDeliveryRespVO.java index 07e9f152a..2dbd2744c 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/express/vo/ShippingTemplatesNoDeliveryRespVO.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/express/vo/ShippingTemplatesNoDeliveryRespVO.java @@ -34,7 +34,8 @@ public class ShippingTemplatesNoDeliveryRespVO implements Serializable { @NotNull(message = "请选择城市") private String cityId; - + @Schema(description = "分组唯一值", required = true) + private String uniqid; @Schema(description = "省ID, 多个逗号分割。 全国 all", required = true, example = "1,2,3,4") private String provinceId; diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/express/vo/ShippingTemplatesRegionRespVO.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/express/vo/ShippingTemplatesRegionRespVO.java index d02fb3fd7..4bd4be343 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/express/vo/ShippingTemplatesRegionRespVO.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/express/vo/ShippingTemplatesRegionRespVO.java @@ -55,4 +55,7 @@ public class ShippingTemplatesRegionRespVO implements Serializable { @DecimalMin(value = "0.1", message = "续件运费金额不能低于0.1") private BigDecimal renewalPrice; + @Schema(description = "分组唯一值", required = true) + private String uniqid; + } diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/express/vo/ShippingTemplatesReqVO.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/express/vo/ShippingTemplatesReqVO.java index 0bfe99592..6c1394473 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/express/vo/ShippingTemplatesReqVO.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/express/vo/ShippingTemplatesReqVO.java @@ -57,7 +57,7 @@ public class ShippingTemplatesReqVO implements Serializable { private Boolean noDelivery; @Schema(description = "指定不送设置", required = true) - private List shippingTemplatesNoDeliveryRespVOS; + private ShippingTemplatesNoDeliveryRespVO shippingTemplatesNoDeliveryRespVOS; @Schema(description = "排序", example = "0") @NotNull(message = "排序数字必须填写") diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/dal/dataobject/express/ShippingTemplatesDO.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/dal/dataobject/express/ShippingTemplatesDO.java index 90184ac0c..8a38f241e 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/dal/dataobject/express/ShippingTemplatesDO.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/dal/dataobject/express/ShippingTemplatesDO.java @@ -1,7 +1,6 @@ package cn.iocoder.yudao.module.shop.dal.dataobject.express; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; -import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/dal/dataobject/express/ShippingTemplatesNoDeliveryDO.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/dal/dataobject/express/ShippingTemplatesNoDeliveryDO.java index c43abbdc1..8dcbcb291 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/dal/dataobject/express/ShippingTemplatesNoDeliveryDO.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/dal/dataobject/express/ShippingTemplatesNoDeliveryDO.java @@ -45,5 +45,10 @@ public class ShippingTemplatesNoDeliveryDO implements Serializable { private Integer provinceId; + /** + * 分组唯一值 + */ + private String uniqid; + } diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/dal/dataobject/express/ShippingTemplatesRegionDO.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/dal/dataobject/express/ShippingTemplatesRegionDO.java index 91d6e49a7..efcf7d02c 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/dal/dataobject/express/ShippingTemplatesRegionDO.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/dal/dataobject/express/ShippingTemplatesRegionDO.java @@ -43,6 +43,11 @@ public class ShippingTemplatesRegionDO implements Serializable { */ private Integer cityId; + /** + * 分组唯一值 + */ + private String uniqid; + private Integer provinceId; diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/express/ShippingTemplatesNoDeliveryService.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/express/ShippingTemplatesNoDeliveryService.java index ba98b4d93..a911950b4 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/express/ShippingTemplatesNoDeliveryService.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/express/ShippingTemplatesNoDeliveryService.java @@ -25,7 +25,7 @@ import java.util.List; @Validated public interface ShippingTemplatesNoDeliveryService extends IService { - void saveAll(List shippingTemplatesFreeRespVOList, Integer id); + void saveAll(ShippingTemplatesNoDeliveryRespVO shippingTemplatesFreeRespVOList, Integer id); List getListGroup(Integer tempId); diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/express/impl/ShippingTemplatesNoDeliveryServiceImpl.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/express/impl/ShippingTemplatesNoDeliveryServiceImpl.java index 726d42337..aaf34226f 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/express/impl/ShippingTemplatesNoDeliveryServiceImpl.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/express/impl/ShippingTemplatesNoDeliveryServiceImpl.java @@ -11,6 +11,7 @@ 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.apache.commons.codec.digest.DigestUtils; import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; @@ -36,22 +37,22 @@ public class ShippingTemplatesNoDeliveryServiceImpl extends ServiceImpl shippingTemplatesNoDeliveryRespVOS, Integer tempId) { + public void saveAll(ShippingTemplatesNoDeliveryRespVO shippingTemplatesNoDeliveryRespVOS, Integer tempId) { ArrayList shippingTemplatesNoDeliveryDOS = new ArrayList<>(); delete(tempId); - for (ShippingTemplatesNoDeliveryRespVO shippingTemplatesNoDeliveryRespVO : shippingTemplatesNoDeliveryRespVOS) { - if(shippingTemplatesNoDeliveryRespVO.getCityId().equals("all") || shippingTemplatesNoDeliveryRespVO.getCityId().equals("0")){ - cityIdList = getCityIdList(); - }else{ - cityIdList = StrUtils.stringToArray(shippingTemplatesNoDeliveryRespVO.getCityId()); - } - for (Integer cityId: cityIdList) { - ShippingTemplatesNoDeliveryDO shippingTemplatesNoDeliveryDO = new ShippingTemplatesNoDeliveryDO(); - shippingTemplatesNoDeliveryDO.setCityId(cityId); - shippingTemplatesNoDeliveryDO.setTempId(tempId); - shippingTemplatesNoDeliveryDOS.add(shippingTemplatesNoDeliveryDO); - } + String uniqueKey = DigestUtils.md5Hex(shippingTemplatesNoDeliveryRespVOS.toString()); + if(shippingTemplatesNoDeliveryRespVOS.getCityId().equals("all") || shippingTemplatesNoDeliveryRespVOS.getCityId().equals("0")){ + cityIdList = getCityIdList(); + }else{ + cityIdList = StrUtils.stringToArray(shippingTemplatesNoDeliveryRespVOS.getCityId()); + } + for (Integer cityId: cityIdList) { + ShippingTemplatesNoDeliveryDO shippingTemplatesNoDeliveryDO = new ShippingTemplatesNoDeliveryDO(); + shippingTemplatesNoDeliveryDO.setCityId(cityId); + shippingTemplatesNoDeliveryDO.setUniqid(uniqueKey); + shippingTemplatesNoDeliveryDO.setTempId(tempId); + shippingTemplatesNoDeliveryDOS.add(shippingTemplatesNoDeliveryDO); } //批量保存模板数据 saveBatch(shippingTemplatesNoDeliveryDOS); diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/express/impl/ShippingTemplatesRegionServiceImpl.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/express/impl/ShippingTemplatesRegionServiceImpl.java index dbacf1fce..1ddad2340 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/express/impl/ShippingTemplatesRegionServiceImpl.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/express/impl/ShippingTemplatesRegionServiceImpl.java @@ -78,6 +78,7 @@ public class ShippingTemplatesRegionServiceImpl extends ServiceImpl shippingTemplatesNoDeliveryRespVOList = request.getShippingTemplatesNoDeliveryRespVOS(); - if(null != shippingTemplatesNoDeliveryRespVOList && shippingTemplatesNoDeliveryRespVOList.size() > 0){ - shippingTemplatesNoDeliveryService.saveAll(shippingTemplatesNoDeliveryRespVOList, shippingTemplatesDO.getId()); + ShippingTemplatesNoDeliveryRespVO shippingTemplatesNoDeliveryRespVO = request.getShippingTemplatesNoDeliveryRespVOS(); + if(!ObjectUtil.isNull(shippingTemplatesNoDeliveryRespVO)){ + shippingTemplatesNoDeliveryService.saveAll(shippingTemplatesNoDeliveryRespVO, shippingTemplatesDO.getId()); } - return true; } @@ -169,9 +168,9 @@ public class ShippingTemplatesServiceImpl extends ServiceImpl shippingTemplatesNoDeliveryRespVOList = request.getShippingTemplatesNoDeliveryRespVOS(); - if(CollUtil.isNotEmpty(shippingTemplatesNoDeliveryRespVOList)){ - shippingTemplatesNoDeliveryService.saveAll(shippingTemplatesNoDeliveryRespVOList, shippingTemplatesDO.getId()); + ShippingTemplatesNoDeliveryRespVO shippingTemplatesNoDeliveryRespVO= request.getShippingTemplatesNoDeliveryRespVOS(); + if(ObjectUtil.isNotNull(shippingTemplatesNoDeliveryRespVO)){ + shippingTemplatesNoDeliveryService.saveAll(shippingTemplatesNoDeliveryRespVO, shippingTemplatesDO.getId()); } return true; diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/resources/mapper/express/ShippingTemplatesFreeMapper.xml b/yudao-module-mall/yudao-module-shop-biz/src/main/resources/mapper/express/ShippingTemplatesFreeMapper.xml index d27a6d8f0..76ef60c67 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/resources/mapper/express/ShippingTemplatesFreeMapper.xml +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/resources/mapper/express/ShippingTemplatesFreeMapper.xml @@ -3,6 +3,6 @@ diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/resources/mapper/express/ShippingTemplatesNoDeliveryMapper.xml b/yudao-module-mall/yudao-module-shop-biz/src/main/resources/mapper/express/ShippingTemplatesNoDeliveryMapper.xml index 06da0e77c..680a2f38a 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/resources/mapper/express/ShippingTemplatesNoDeliveryMapper.xml +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/resources/mapper/express/ShippingTemplatesNoDeliveryMapper.xml @@ -3,6 +3,6 @@ diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/resources/mapper/express/ShippingTemplatesRegionMapper.xml b/yudao-module-mall/yudao-module-shop-biz/src/main/resources/mapper/express/ShippingTemplatesRegionMapper.xml index d31a41ad7..063f68943 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/resources/mapper/express/ShippingTemplatesRegionMapper.xml +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/resources/mapper/express/ShippingTemplatesRegionMapper.xml @@ -3,6 +3,6 @@