|
|
|
@ -18,6 +18,7 @@ package com.logpm.basicdata.service.impl;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
|
|
import cn.hutool.core.collection.CollectionUtil; |
|
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.Wrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
@ -83,8 +84,13 @@ public class BasicdataFreightServiceImpl extends BaseServiceImpl<BasicdataFreigh
|
|
|
|
|
// 校验数据唯一性 名称+品类唯一
|
|
|
|
|
QueryWrapper<BasicdataFreightEntity> query = new QueryWrapper<>(); |
|
|
|
|
query.eq("item_name", basicdataFreight.getItemName()) |
|
|
|
|
.in("category", basicdataFreight.getCategory().split(",")) |
|
|
|
|
.eq("is_deleted", 0); |
|
|
|
|
if(0 == basicdataFreight.getFixedPrice()){ |
|
|
|
|
if(StrUtil.isBlank(basicdataFreight.getCategory())){ |
|
|
|
|
throw new ServiceException("品类必填"); |
|
|
|
|
} |
|
|
|
|
query.in("category", basicdataFreight.getCategory().split(",")); |
|
|
|
|
} |
|
|
|
|
if (ObjectUtils.isNotNull(basicdataFreight.getId())) { |
|
|
|
|
query.ne("id", basicdataFreight.getId()); |
|
|
|
|
} |
|
|
|
@ -95,6 +101,10 @@ public class BasicdataFreightServiceImpl extends BaseServiceImpl<BasicdataFreigh
|
|
|
|
|
BasicdataFreightEntity basicdataFreightEntity = new BasicdataFreightEntity(); |
|
|
|
|
Byte fixedPrice = basicdataFreight.getFixedPrice(); |
|
|
|
|
BeanUtil.copyProperties(basicdataFreight, basicdataFreightEntity); |
|
|
|
|
if(CollectionUtil.isNotEmpty(basicdataFreight.getTypeService())){ |
|
|
|
|
List<String> typeService = basicdataFreight.getTypeService(); |
|
|
|
|
basicdataFreightEntity.setType(String.join(",", typeService)); |
|
|
|
|
} |
|
|
|
|
if (1 == fixedPrice) { |
|
|
|
|
basicdataFreightEntity.setIdentification(2); |
|
|
|
|
} else { |
|
|
|
|