|
|
|
@ -19,6 +19,7 @@ package com.logpm.basicdata.service.impl;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.Wrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
|
import com.logpm.basicdata.dto.BasicdataTripartiteMallDTO; |
|
|
|
|
import com.logpm.basicdata.entity.BasicdataClientEntity; |
|
|
|
|
import com.logpm.basicdata.entity.BasicdataClientLogEntity; |
|
|
|
@ -31,6 +32,7 @@ import com.logpm.basicdata.service.IBasicdataTripartiteMallService;
|
|
|
|
|
import com.logpm.basicdata.vo.BasicdataTripartiteMallVO; |
|
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
import org.jetbrains.annotations.Nullable; |
|
|
|
|
import org.springblade.core.mp.base.BaseServiceImpl; |
|
|
|
|
import org.springblade.core.secure.utils.AuthUtil; |
|
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
@ -120,13 +122,16 @@ public class BasicdataTripartiteMallServiceImpl extends BaseServiceImpl<Basicdat
|
|
|
|
|
basicdataClientLogEntity.setClientName(clientEntity.getClientName()); |
|
|
|
|
basicdataClientLogEntity.setOperator(AuthUtil.getNickName()); |
|
|
|
|
String content = ""; |
|
|
|
|
R s = checkTripartiteMallEntity(basicdataTripartiteMall); |
|
|
|
|
if (s == null || !Objects.equals(s.getCode(), 200)) { |
|
|
|
|
return s; |
|
|
|
|
} |
|
|
|
|
if (Objects.isNull(basicdataTripartiteMall.getId())) { |
|
|
|
|
String str = Func.isEmpty(basicdataTripartiteMall.getTripartiteCoding()) ? "空" : basicdataTripartiteMall.getTripartiteCoding(); |
|
|
|
|
//新增
|
|
|
|
|
content = "新增三方商场-->[名称:" + basicdataTripartiteMall.getTripartiteMall() + ",编码:" + str + ",品牌:" + basicdataTripartiteMall.getBrandName() + "]"; |
|
|
|
|
basicdataClientLogEntity.setContent(content); |
|
|
|
|
basicdataClientLogService.save(basicdataClientLogEntity); |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
//修改
|
|
|
|
|
BasicdataTripartiteMallEntity entity = this.getById(basicdataTripartiteMall.getId()); |
|
|
|
@ -141,6 +146,29 @@ public class BasicdataTripartiteMallServiceImpl extends BaseServiceImpl<Basicdat
|
|
|
|
|
return R.status(this.saveOrUpdate(basicdataTripartiteMall)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Nullable |
|
|
|
|
private R checkTripartiteMallEntity(BasicdataTripartiteMallEntity basicdataTripartiteMall) { |
|
|
|
|
List<BasicdataTripartiteMallEntity> list = this.list(Wrappers.<BasicdataTripartiteMallEntity>query().lambda() |
|
|
|
|
.eq(BasicdataTripartiteMallEntity::getBrandName, basicdataTripartiteMall.getBrandName()) |
|
|
|
|
.eq(BasicdataTripartiteMallEntity::getTripartiteMall, basicdataTripartiteMall.getTripartiteMall()) |
|
|
|
|
.eq(!Objects.isNull(basicdataTripartiteMall.getTripartiteCoding()), BasicdataTripartiteMallEntity::getTripartiteCoding, basicdataTripartiteMall.getTripartiteCoding()) |
|
|
|
|
); |
|
|
|
|
if (!list.isEmpty()) { |
|
|
|
|
List<Long> collect = list.stream().map(BasicdataTripartiteMallEntity::getClientId).collect(Collectors.toList()); |
|
|
|
|
if (!collect.isEmpty()) { |
|
|
|
|
List<BasicdataClientEntity> basicdataClientEntityList = basicdataClientService.listByIds(collect); |
|
|
|
|
if (!basicdataClientEntityList.isEmpty()) { |
|
|
|
|
String s = basicdataClientEntityList.stream().map(BasicdataClientEntity::getClientName).distinct().collect(Collectors.joining(",")); |
|
|
|
|
return R.fail("当前商城信息已在[" + s + "]客户下存在!!!"); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
return R.fail("当前商城信息已存在!!!"); |
|
|
|
|
} |
|
|
|
|
return R.status(true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private Boolean judgeComparisonBasicdataTripartiteMall(BasicdataTripartiteMallEntity entity, BasicdataTripartiteMallEntity basicdataTripartiteMall) { |
|
|
|
|
String str1 = StringUtil.isBlank(entity.getTripartiteCoding()) ? "空" : entity.getTripartiteCoding(); |
|
|
|
|
String str2 = StringUtil.isBlank(basicdataTripartiteMall.getTripartiteCoding()) ? "空" : basicdataTripartiteMall.getTripartiteCoding(); |
|
|
|
@ -196,6 +224,20 @@ public class BasicdataTripartiteMallServiceImpl extends BaseServiceImpl<Basicdat
|
|
|
|
|
return baseMapper.pageList(page,basicdataTripartiteMall); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public R saveTripartiteMallEntity(BasicdataTripartiteMallEntity basicdataTripartiteMall) { |
|
|
|
|
List<BasicdataTripartiteMallEntity> list = this.list(Wrappers.<BasicdataTripartiteMallEntity>query().lambda() |
|
|
|
|
.eq(BasicdataTripartiteMallEntity::getBrandName, basicdataTripartiteMall.getBrandName()) |
|
|
|
|
.eq(BasicdataTripartiteMallEntity::getTripartiteMall, basicdataTripartiteMall.getTripartiteMall()) |
|
|
|
|
.eq(Objects.isNull(basicdataTripartiteMall.getTripartiteCoding()), BasicdataTripartiteMallEntity::getTripartiteCoding, basicdataTripartiteMall.getTripartiteCoding()) |
|
|
|
|
); |
|
|
|
|
if (!list.isEmpty()) { |
|
|
|
|
return R.fail("当前商城信息已存在!!!"); |
|
|
|
|
} |
|
|
|
|
this.save(basicdataTripartiteMall); |
|
|
|
|
return R.success("操作成功"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private String comparisonBasicdataTripartiteMall(BasicdataTripartiteMallEntity entity, BasicdataTripartiteMallEntity basicdataTripartiteMall) { |
|
|
|
|
StringBuilder builder = new StringBuilder(); |
|
|
|
|
String str1 = entity.getTripartiteCoding().isEmpty() ? "空" : entity.getTripartiteCoding(); |
|
|
|
|