|
@@ -1,19 +1,3 @@
|
|
|
-/*
|
|
|
|
|
- * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
|
|
|
|
|
- *
|
|
|
|
|
- * Redistribution and use in source and binary forms, with or without
|
|
|
|
|
- * modification, are permitted provided that the following conditions are met:
|
|
|
|
|
- *
|
|
|
|
|
- * Redistributions of source code must retain the above copyright notice,
|
|
|
|
|
- * this list of conditions and the following disclaimer.
|
|
|
|
|
- * Redistributions in binary form must reproduce the above copyright
|
|
|
|
|
- * notice, this list of conditions and the following disclaimer in the
|
|
|
|
|
- * documentation and/or other materials provided with the distribution.
|
|
|
|
|
- * Neither the name of the dreamlu.net developer nor the names of its
|
|
|
|
|
- * contributors may be used to endorse or promote products derived from
|
|
|
|
|
- * this software without specific prior written permission.
|
|
|
|
|
- * Author: Chill 庄骞 (smallchill@163.com)
|
|
|
|
|
- */
|
|
|
|
|
package org.springblade.salesPart.corps.service.impl;
|
|
package org.springblade.salesPart.corps.service.impl;
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
@@ -28,11 +12,13 @@ import org.springblade.client.entity.CorpsDesc;
|
|
|
import org.springblade.core.secure.utils.AuthUtil;
|
|
import org.springblade.core.secure.utils.AuthUtil;
|
|
|
import org.springblade.core.secure.utils.SecureUtil;
|
|
import org.springblade.core.secure.utils.SecureUtil;
|
|
|
import org.springblade.core.tool.api.R;
|
|
import org.springblade.core.tool.api.R;
|
|
|
|
|
+import org.springblade.core.tool.utils.CollectionUtil;
|
|
|
import org.springblade.core.tool.utils.ObjectUtil;
|
|
import org.springblade.core.tool.utils.ObjectUtil;
|
|
|
import org.springblade.salesPart.brand.service.IBrandDescService;
|
|
import org.springblade.salesPart.brand.service.IBrandDescService;
|
|
|
import org.springblade.salesPart.corps.mapper.CorpsDescMapper;
|
|
import org.springblade.salesPart.corps.mapper.CorpsDescMapper;
|
|
|
import org.springblade.salesPart.corps.mapper.CorpsTypeDescMapper;
|
|
import org.springblade.salesPart.corps.mapper.CorpsTypeDescMapper;
|
|
|
import org.springblade.salesPart.corps.mapper.CorpsTypeMapper;
|
|
import org.springblade.salesPart.corps.mapper.CorpsTypeMapper;
|
|
|
|
|
+import org.springblade.salesPart.corps.mapper.CorpsVisitMapper;
|
|
|
import org.springblade.salesPart.corps.service.ICorpsDescService;
|
|
import org.springblade.salesPart.corps.service.ICorpsDescService;
|
|
|
import org.springblade.salesPart.entity.*;
|
|
import org.springblade.salesPart.entity.*;
|
|
|
import org.springblade.salesPart.excel.CorpsDescImportExcel;
|
|
import org.springblade.salesPart.excel.CorpsDescImportExcel;
|
|
@@ -43,6 +29,7 @@ import org.springblade.salesPart.settlement.mapper.SettlementMapper;
|
|
|
import org.springblade.salesPart.ship.mapper.ShipMapper;
|
|
import org.springblade.salesPart.ship.mapper.ShipMapper;
|
|
|
import org.springblade.salesPart.storage.service.IStorageDescService;
|
|
import org.springblade.salesPart.storage.service.IStorageDescService;
|
|
|
import org.springblade.salesPart.vo.CorpsDescVO;
|
|
import org.springblade.salesPart.vo.CorpsDescVO;
|
|
|
|
|
+import org.springblade.salesPart.vo.CustomerTypeKeyValueVo;
|
|
|
import org.springblade.system.entity.Dept;
|
|
import org.springblade.system.entity.Dept;
|
|
|
import org.springblade.system.feign.ISysClient;
|
|
import org.springblade.system.feign.ISysClient;
|
|
|
import org.springblade.system.user.entity.User;
|
|
import org.springblade.system.user.entity.User;
|
|
@@ -81,6 +68,8 @@ public class CorpsDescServiceImpl extends ServiceImpl<CorpsDescMapper, PjCorpsDe
|
|
|
|
|
|
|
|
private final IBrandDescService brandDescService;
|
|
private final IBrandDescService brandDescService;
|
|
|
|
|
|
|
|
|
|
+ private final CorpsVisitMapper corpsVisitMapper;
|
|
|
|
|
+
|
|
|
|
|
|
|
|
static final int GB_SP_DIFF = 160;
|
|
static final int GB_SP_DIFF = 160;
|
|
|
// 存放国标一级汉字不同读音的起始区位码
|
|
// 存放国标一级汉字不同读音的起始区位码
|
|
@@ -99,28 +88,25 @@ public class CorpsDescServiceImpl extends ServiceImpl<CorpsDescMapper, PjCorpsDe
|
|
|
@Override
|
|
@Override
|
|
|
public PjCorpsDesc getMessageByID(PjCorpsDesc corpsDesc) {
|
|
public PjCorpsDesc getMessageByID(PjCorpsDesc corpsDesc) {
|
|
|
PjCorpsDesc desc = baseMapper.selectById(corpsDesc.getId());
|
|
PjCorpsDesc desc = baseMapper.selectById(corpsDesc.getId());
|
|
|
- if (desc != null) {
|
|
|
|
|
- //获取客户联系人
|
|
|
|
|
- desc.setCorpsAttnList(corpsAttnService.list(new QueryWrapper<PjCorpsAttn>().eq("pid", corpsDesc.getId()).eq("is_deleted", 0)));
|
|
|
|
|
- //获取客户地址
|
|
|
|
|
- desc.setCorpsAddrList(corpsAddrService.list(new QueryWrapper<PjCorpsAddr>().eq("pid", corpsDesc.getId()).eq("is_deleted", 0)));
|
|
|
|
|
- //获取客户附件
|
|
|
|
|
- desc.setCorpsFilesList(corpsFilesService.list(new QueryWrapper<PjCorpsFiles>().eq("pid", corpsDesc.getId()).eq("is_deleted", 0)));
|
|
|
|
|
- //获取客户类别
|
|
|
|
|
- List<String> longs = corpsTypeDescMapper.selectTypeId(corpsDesc.getId());
|
|
|
|
|
- desc.setCorpsTypeId(String.join(",", longs));
|
|
|
|
|
- StringBuilder corpsTypeName = new StringBuilder();
|
|
|
|
|
- if (ObjectUtils.isNotNull(longs)) {
|
|
|
|
|
- for (String id : longs) {
|
|
|
|
|
- String name = corpsTypeMapper.selectById(Long.parseLong(id)) == null ? "" : corpsTypeMapper.selectById(Long.parseLong(id)).getCname();
|
|
|
|
|
- corpsTypeName.append(name).append(",");
|
|
|
|
|
- }
|
|
|
|
|
- String corpsName = corpsTypeName.substring(0, corpsTypeName.length() - 1);
|
|
|
|
|
- desc.setCorpsTypeName(corpsName);
|
|
|
|
|
- } else {
|
|
|
|
|
- desc.setCorpsTypeName("");
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if (Objects.isNull(desc)){
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ //获取客户联系人
|
|
|
|
|
+ desc.setCorpsAttnList(corpsAttnService.list(new QueryWrapper<PjCorpsAttn>().eq("pid", corpsDesc.getId()).eq("is_deleted", 0)));
|
|
|
|
|
+ //获取客户地址
|
|
|
|
|
+ desc.setCorpsAddrList(corpsAddrService.list(new QueryWrapper<PjCorpsAddr>().eq("pid", corpsDesc.getId()).eq("is_deleted", 0)));
|
|
|
|
|
+ //获取客户附件
|
|
|
|
|
+ desc.setCorpsFilesList(corpsFilesService.list(new QueryWrapper<PjCorpsFiles>().eq("pid", corpsDesc.getId()).eq("is_deleted", 0)));
|
|
|
|
|
+ //获取客户类别
|
|
|
|
|
+ List<String> customerTypeIdList = corpsTypeDescMapper.selectTypeId(corpsDesc.getId());
|
|
|
|
|
+ List<CustomerTypeKeyValueVo> customerTypeKeyValueVoList = corpsTypeDescMapper.getCustomerTypeKeyValueVoList(corpsDesc.getId());
|
|
|
|
|
+ if (CollectionUtil.isNotEmpty(customerTypeKeyValueVoList)) {
|
|
|
|
|
+ desc.setCorpsTypeId(String.join(",", customerTypeIdList));
|
|
|
|
|
+ desc.setCorpsTypeId(customerTypeKeyValueVoList.stream().filter(ck -> Objects.nonNull(ck.getId())).map(ctk -> String.valueOf(ctk.getId())).collect(Collectors.joining(",")));
|
|
|
|
|
+ desc.setCorpsTypeName(customerTypeKeyValueVoList.stream().map(CustomerTypeKeyValueVo::getCname).filter(Objects::nonNull).collect(Collectors.joining(",")));
|
|
|
}
|
|
}
|
|
|
|
|
+ List<CorpsVisit> corpsVisitList = corpsVisitMapper.selectList(new LambdaQueryWrapper<CorpsVisit>().eq(CorpsVisit::getCustomerId, corpsDesc.getId()).eq(CorpsVisit::getIsDeleted, 0));
|
|
|
|
|
+ desc.setCorpsVisitList(corpsVisitList);
|
|
|
return desc;
|
|
return desc;
|
|
|
}
|
|
}
|
|
|
|
|
|