|
|
|
@ -33,6 +33,7 @@ import com.logpm.basicdata.service.IBasicdataFreightService;
|
|
|
|
|
import com.logpm.basicdata.vo.BasicdataFreightVO; |
|
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
import org.springblade.common.exception.CustomerException; |
|
|
|
|
import org.springblade.core.mp.base.BaseServiceImpl; |
|
|
|
|
import org.springblade.core.mp.support.Condition; |
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
@ -79,14 +80,26 @@ public class BasicdataFreightServiceImpl extends BaseServiceImpl<BasicdataFreigh
|
|
|
|
|
@Override |
|
|
|
|
public Boolean ownSaveOrUpdate(BasicdataFreightDTO basicdataFreight) { |
|
|
|
|
log.info("接收的数据{}", basicdataFreight); |
|
|
|
|
// 校验数据唯一性 名称+品类唯一
|
|
|
|
|
QueryWrapper<BasicdataFreightEntity> query = new QueryWrapper<>(); |
|
|
|
|
query.eq("item_name", basicdataFreight.getItemName()) |
|
|
|
|
.in("category", basicdataFreight.getCategory().split(",")) |
|
|
|
|
.eq("is_deleted", 0); |
|
|
|
|
if (ObjectUtils.isNotNull(basicdataFreight.getId())) { |
|
|
|
|
query.ne("id", basicdataFreight.getId()); |
|
|
|
|
} |
|
|
|
|
List<BasicdataFreightEntity> list = this.list(query); |
|
|
|
|
if (CollectionUtil.isNotEmpty(list)) { |
|
|
|
|
throw new CustomerException(5000, "名称+品类存在其他表单中,请检查。"); |
|
|
|
|
} |
|
|
|
|
BasicdataFreightEntity basicdataFreightEntity = new BasicdataFreightEntity(); |
|
|
|
|
Byte fixedPrice = basicdataFreight.getFixedPrice(); |
|
|
|
|
if(1 == fixedPrice){ |
|
|
|
|
BeanUtil.copyProperties(basicdataFreight, basicdataFreightEntity); |
|
|
|
|
if (1 == fixedPrice) { |
|
|
|
|
basicdataFreightEntity.setIdentification(2); |
|
|
|
|
}else{ |
|
|
|
|
} else { |
|
|
|
|
basicdataFreightEntity.setIdentification(1); |
|
|
|
|
} |
|
|
|
|
BeanUtil.copyProperties(basicdataFreight, basicdataFreightEntity); |
|
|
|
|
//修改
|
|
|
|
|
if (ObjectUtils.isNotNull(basicdataFreight.getId())) { |
|
|
|
|
// 修改主表单
|
|
|
|
@ -119,7 +132,7 @@ public class BasicdataFreightServiceImpl extends BaseServiceImpl<BasicdataFreigh
|
|
|
|
|
if (null != detail) { |
|
|
|
|
BeanUtil.copyProperties(detail, basicdataFreightDTO); |
|
|
|
|
QueryWrapper<BasicdataFreightDetailEntity> objectQueryWrapper = new QueryWrapper<>(); |
|
|
|
|
objectQueryWrapper.eq("freight_id", detail.getId()).ne("is_deleted", 1); |
|
|
|
|
objectQueryWrapper.eq("freight_id", detail.getId()).eq("is_deleted", 0); |
|
|
|
|
List<BasicdataFreightDetailEntity> list = detailService.list(objectQueryWrapper); |
|
|
|
|
if (CollectionUtil.isNotEmpty(list)) { |
|
|
|
|
List<BasicdataFreightDetailDTO> detailDTOS = new ArrayList<>(); |
|
|
|
|