This commit is contained in:
PQZ 2024-10-30 14:33:47 +08:00
parent 0548422b4b
commit a3fc41ec8c

View File

@ -34,6 +34,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
@ -171,7 +172,29 @@ public class CustomerMainServiceImpl extends ServiceImpl<CustomerMainMapper, Cus
/*3、保存客户主表信息*/ /*3、保存客户主表信息*/
//暂时写死会员id TODO //暂时写死会员id TODO
main.setMemberLevelId("9d4567b7e68803933f4917a4aab6b745"); main.setMemberLevelId("9d4567b7e68803933f4917a4aab6b745");
this.saveOrUpdate(main);
//解决重复用户校验
if (StringUtils.isEmpty(main.getId())){
//通过手机号匹配是否存在当前用户
LambdaQueryWrapper<CustomerMain> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(CustomerMain::getPhoneNumber,main.getPhoneNumber());
List<CustomerMain> list = list(lambdaQueryWrapper);
if (list.isEmpty()){
//如不存在插入
this.save(main);
} else {
if (StringUtils.isNotEmpty(main.getCusName())) {
//如存在更新用户名称
CustomerMain updateCust = list.get(0);
updateCust.setCusName(main.getCusName());
this.updateById(updateCust);
}
}
} else {
//存在id直接更行
this.updateById(main);
}
/*4、保存扩展表信息*/ /*4、保存扩展表信息*/
if ( null!=saveReqVO.getItemList() && !saveReqVO.getItemList().isEmpty()) { if ( null!=saveReqVO.getItemList() && !saveReqVO.getItemList().isEmpty()) {