|
@@ -5,6 +5,7 @@ import cn.hutool.crypto.digest.BCrypt;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import org.apache.dubbo.config.annotation.DubboReference;
|
|
import org.apache.dubbo.config.annotation.DubboReference;
|
|
|
|
|
+import org.dromara.common.core.exception.ServiceException;
|
|
|
import org.dromara.common.core.utils.MapstructUtils;
|
|
import org.dromara.common.core.utils.MapstructUtils;
|
|
|
import org.dromara.common.core.utils.StringUtils;
|
|
import org.dromara.common.core.utils.StringUtils;
|
|
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|
@@ -44,7 +45,7 @@ import java.util.stream.Collectors;
|
|
|
@Slf4j
|
|
@Slf4j
|
|
|
@RequiredArgsConstructor
|
|
@RequiredArgsConstructor
|
|
|
@Service
|
|
@Service
|
|
|
-public class SupplierContactServiceImpl extends ServiceImpl<SupplierContactMapper, SupplierContact> implements ISupplierContactService {
|
|
|
|
|
|
|
+public class SupplierContactServiceImpl extends ServiceImpl<SupplierContactMapper, SupplierContact> implements ISupplierContactService {
|
|
|
|
|
|
|
|
private final SupplierContactMapper baseMapper;
|
|
private final SupplierContactMapper baseMapper;
|
|
|
|
|
|
|
@@ -60,7 +61,7 @@ public class SupplierContactServiceImpl extends ServiceImpl<SupplierContactMapp
|
|
|
* @return 联系人
|
|
* @return 联系人
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
- public SupplierContactVo queryById(Long id){
|
|
|
|
|
|
|
+ public SupplierContactVo queryById(Long id) {
|
|
|
SupplierContactVo supplierContactVo = baseMapper.selectVoById(id);
|
|
SupplierContactVo supplierContactVo = baseMapper.selectVoById(id);
|
|
|
SupplierInfo one = supplierInfoService.getOne(new LambdaQueryWrapper<SupplierInfo>().eq(SupplierInfo::getId, supplierContactVo.getSupplierId()));
|
|
SupplierInfo one = supplierInfoService.getOne(new LambdaQueryWrapper<SupplierInfo>().eq(SupplierInfo::getId, supplierContactVo.getSupplierId()));
|
|
|
one.getEnterpriseName();
|
|
one.getEnterpriseName();
|
|
@@ -77,7 +78,7 @@ public class SupplierContactServiceImpl extends ServiceImpl<SupplierContactMapp
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
public TableDataInfo<SupplierContactVo> queryPageList(SupplierContactBo bo, PageQuery pageQuery) {
|
|
public TableDataInfo<SupplierContactVo> queryPageList(SupplierContactBo bo, PageQuery pageQuery) {
|
|
|
- if (bo.getSupplierName()!= null){
|
|
|
|
|
|
|
+ if (bo.getSupplierName() != null) {
|
|
|
SupplierInfo one = supplierInfoService.getOne(new LambdaQueryWrapper<SupplierInfo>().eq(SupplierInfo::getEnterpriseName, bo.getSupplierName()));
|
|
SupplierInfo one = supplierInfoService.getOne(new LambdaQueryWrapper<SupplierInfo>().eq(SupplierInfo::getEnterpriseName, bo.getSupplierName()));
|
|
|
bo.setSupplierId(one.getId());
|
|
bo.setSupplierId(one.getId());
|
|
|
}
|
|
}
|
|
@@ -86,6 +87,7 @@ public class SupplierContactServiceImpl extends ServiceImpl<SupplierContactMapp
|
|
|
setSupplierNames(result.getRecords());
|
|
setSupplierNames(result.getRecords());
|
|
|
return TableDataInfo.build(result);
|
|
return TableDataInfo.build(result);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
private void setSupplierNames(List<SupplierContactVo> records) {
|
|
private void setSupplierNames(List<SupplierContactVo> records) {
|
|
|
if (records == null || records.isEmpty()) {
|
|
if (records == null || records.isEmpty()) {
|
|
|
return;
|
|
return;
|
|
@@ -123,8 +125,8 @@ public class SupplierContactServiceImpl extends ServiceImpl<SupplierContactMapp
|
|
|
@Override
|
|
@Override
|
|
|
public TableDataInfo<SupplierContactVo> queryPageListById(SupplierContactBo bo, PageQuery pageQuery) {
|
|
public TableDataInfo<SupplierContactVo> queryPageListById(SupplierContactBo bo, PageQuery pageQuery) {
|
|
|
LambdaQueryWrapper<SupplierContact> lqw = buildQueryWrapper(bo);
|
|
LambdaQueryWrapper<SupplierContact> lqw = buildQueryWrapper(bo);
|
|
|
- lqw.eq(bo.getSupplierId()!=null , SupplierContact::getSupplierId , bo.getSupplierId());
|
|
|
|
|
- lqw.eq(bo.getUserId()!=null , SupplierContact::getUserId , bo.getUserId());
|
|
|
|
|
|
|
+ lqw.eq(bo.getSupplierId() != null, SupplierContact::getSupplierId, bo.getSupplierId());
|
|
|
|
|
+ lqw.eq(bo.getUserId() != null, SupplierContact::getUserId, bo.getUserId());
|
|
|
Page<SupplierContactVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
|
Page<SupplierContactVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
|
|
setSupplierNames(result.getRecords());
|
|
setSupplierNames(result.getRecords());
|
|
|
return TableDataInfo.build(result);
|
|
return TableDataInfo.build(result);
|
|
@@ -144,7 +146,6 @@ public class SupplierContactServiceImpl extends ServiceImpl<SupplierContactMapp
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
private LambdaQueryWrapper<SupplierContact> buildQueryWrapper(SupplierContactBo bo) {
|
|
private LambdaQueryWrapper<SupplierContact> buildQueryWrapper(SupplierContactBo bo) {
|
|
|
Map<String, Object> params = bo.getParams();
|
|
Map<String, Object> params = bo.getParams();
|
|
|
LambdaQueryWrapper<SupplierContact> lqw = Wrappers.lambdaQuery();
|
|
LambdaQueryWrapper<SupplierContact> lqw = Wrappers.lambdaQuery();
|
|
@@ -154,7 +155,7 @@ public class SupplierContactServiceImpl extends ServiceImpl<SupplierContactMapp
|
|
|
lqw.like(StringUtils.isNotBlank(bo.getUserName()), SupplierContact::getUserName, bo.getUserName());
|
|
lqw.like(StringUtils.isNotBlank(bo.getUserName()), SupplierContact::getUserName, bo.getUserName());
|
|
|
lqw.eq(StringUtils.isNotBlank(bo.getPhone()), SupplierContact::getPhone, bo.getPhone());
|
|
lqw.eq(StringUtils.isNotBlank(bo.getPhone()), SupplierContact::getPhone, bo.getPhone());
|
|
|
lqw.eq(StringUtils.isNotBlank(bo.getStatus()), SupplierContact::getStatus, bo.getStatus());
|
|
lqw.eq(StringUtils.isNotBlank(bo.getStatus()), SupplierContact::getStatus, bo.getStatus());
|
|
|
- lqw.eq(StringUtils.isNotBlank(bo.getUserNo()),SupplierContact::getUserNo,bo.getUserNo());
|
|
|
|
|
|
|
+ lqw.eq(StringUtils.isNotBlank(bo.getUserNo()), SupplierContact::getUserNo, bo.getUserNo());
|
|
|
return lqw;
|
|
return lqw;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -194,6 +195,11 @@ public class SupplierContactServiceImpl extends ServiceImpl<SupplierContactMapp
|
|
|
remoteUserBo.setTenantId(LoginHelper.getTenantId());
|
|
remoteUserBo.setTenantId(LoginHelper.getTenantId());
|
|
|
Long userId = remoteUserService.addUser(remoteUserBo);
|
|
Long userId = remoteUserService.addUser(remoteUserBo);
|
|
|
|
|
|
|
|
|
|
+ remoteUserBo.setUserId(userId);
|
|
|
|
|
+ if (remoteUserService.addUserRole(remoteUserBo) <= 0) {
|
|
|
|
|
+ throw new ServiceException("供应商角色信息新增失败");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// 查询最大的用户编号
|
|
// 查询最大的用户编号
|
|
|
LambdaQueryWrapper<SupplierContact> lqw = Wrappers.lambdaQuery();
|
|
LambdaQueryWrapper<SupplierContact> lqw = Wrappers.lambdaQuery();
|
|
|
lqw.select(SupplierContact::getUserNo)
|
|
lqw.select(SupplierContact::getUserNo)
|
|
@@ -229,7 +235,7 @@ public class SupplierContactServiceImpl extends ServiceImpl<SupplierContactMapp
|
|
|
|
|
|
|
|
baseMapper.update(null, updateWrapper);
|
|
baseMapper.update(null, updateWrapper);
|
|
|
}
|
|
}
|
|
|
- if (update.getUserId() != null){
|
|
|
|
|
|
|
+ if (update.getUserId() != null) {
|
|
|
RemoteUserBo remoteUserBo = new RemoteUserBo();
|
|
RemoteUserBo remoteUserBo = new RemoteUserBo();
|
|
|
remoteUserBo.setNickName(bo.getUserName());
|
|
remoteUserBo.setNickName(bo.getUserName());
|
|
|
remoteUserBo.setUserName(bo.getPhone());
|
|
remoteUserBo.setUserName(bo.getPhone());
|
|
@@ -255,7 +261,7 @@ public class SupplierContactServiceImpl extends ServiceImpl<SupplierContactMapp
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
|
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
|
|
- if(isValid){
|
|
|
|
|
|
|
+ if (isValid) {
|
|
|
//TODO 做一些业务上的校验,判断是否需要校验
|
|
//TODO 做一些业务上的校验,判断是否需要校验
|
|
|
}
|
|
}
|
|
|
return baseMapper.deleteByIds(ids) > 0;
|
|
return baseMapper.deleteByIds(ids) > 0;
|