Browse Source

客户导入取消编码、客户修改联系人BUG修复、配送列表统计数据BUG修复

dist.1.3.0
汤建军 6 months ago
parent
commit
743e5e339e
  1. 12
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataClientController.java
  2. 3
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataStoreContactController.java
  3. 3
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/excel/BasicDataClienImporter.java
  4. 12
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/excel/BasicdataClientExcel.java
  5. 9
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataClientService.java
  6. 7
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataStoreContactService.java
  7. 103
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataClientServiceImpl.java
  8. 11
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataStoreContactServiceImpl.java
  9. 6
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryListMapper.xml

12
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataClientController.java

@ -245,4 +245,16 @@ public class BasicdataClientController extends BladeController {
return R.success("操作成功");
}
/**
* 校验导入数据
*/
@PostMapping("/checkImportBasicDataClient")
@ApiOperationSupport(order = 9)
@ApiOperation(value = "导入数据", notes = "传入basicDataClient")
public R checkImportBasicDataClient(MultipartFile file) {
R r = basicdataClientService.checkImportBasicDataClient(file);
return r;
}
}

3
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataStoreContactController.java

@ -123,7 +123,8 @@ public class BasicdataStoreContactController extends BladeController {
@ApiOperationSupport(order = 6)
@ApiOperation(value = "新增或修改", notes = "传入basicdataStoreContact")
public R submit(@Valid @RequestBody BasicdataStoreContactEntity basicdataStoreContact) {
return R.status(basicdataStoreContactService.saveOrUpdate(basicdataStoreContact));
return R.status(basicdataStoreContactService.saveOrUpdateBasicdataStoreContact(basicdataStoreContact));
}
/**

3
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/excel/BasicDataClienImporter.java

@ -18,4 +18,7 @@ public class BasicDataClienImporter implements ExcelImporter<BasicdataClientExc
service.importClient(data, isCovered);
}
}

12
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/excel/BasicdataClientExcel.java

@ -48,12 +48,12 @@ public class BasicdataClientExcel implements Serializable {
@ColumnWidth(20)
@ExcelProperty("客户名称")
private String clientName;
/**
* 客户编码
*/
@ColumnWidth(20)
@ExcelProperty("客户编码")
private String clientCode;
// /**
// * 客户编码
// */
// @ColumnWidth(20)
// @ExcelProperty("客户编码")
// private String clientCode;
/**
* 服务类型 暂无用
*/

9
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataClientService.java

@ -25,6 +25,8 @@ import com.logpm.basicdata.excel.BasicdataClientExcel;
import com.logpm.basicdata.vo.BasicdataClientVO;
import org.springblade.common.model.dto.NameDTO;
import org.springblade.core.mp.base.BaseService;
import org.springblade.core.tool.api.R;
import org.springframework.web.multipart.MultipartFile;
import java.security.NoSuchAlgorithmException;
import java.util.List;
@ -123,4 +125,11 @@ public interface IBasicdataClientService extends BaseService<BasicdataClientEnti
* @return
*/
boolean saveClient(BasicdataClientEntity basicdataClient);
/**
* 校验客户上传是否成功
* @param file
* @return
*/
R checkImportBasicDataClient(MultipartFile file);
}

7
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataStoreContactService.java

@ -61,4 +61,11 @@ public interface IBasicdataStoreContactService extends BaseService<BasicdataStor
*/
IPage<BasicdataStoreContactVO> pageList(IPage<BasicdataStoreContactEntity> page, Map<String, Object> basicdataStoreContact);
/**
* 修改客户联系人
* @param basicdataStoreContact
* @return
*/
boolean saveOrUpdateBasicdataStoreContact(BasicdataStoreContactEntity basicdataStoreContact);
}

103
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataClientServiceImpl.java

@ -56,20 +56,25 @@ import org.springblade.common.constant.RedisKeyConstant;
import org.springblade.common.constant.basiccode.BasicCodeShowConstant;
import org.springblade.common.constant.basiccode.BasicCodeTypeConstant;
import org.springblade.common.model.dto.NameDTO;
import org.springblade.core.excel.util.ExcelUtil;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.redis.cache.BladeRedis;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.system.cache.DictBizCache;
import org.springblade.system.entity.DictBiz;
import org.springblade.system.feign.IUserClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.security.NoSuchAlgorithmException;
import java.util.*;
import java.util.stream.Collectors;
@ -206,7 +211,7 @@ public class BasicdataClientServiceImpl extends BaseServiceImpl<BasicdataClientM
}
//添加
boolean save = this.save(basicdataClient);
if (save){
if (save) {
//进行redis的设置
redis.set(RedisKeyConstant.FINAL_CLIENT_CODE + AuthUtil.getTenantId(), basicdataClient.getClientCode());
}
@ -372,23 +377,29 @@ public class BasicdataClientServiceImpl extends BaseServiceImpl<BasicdataClientM
// 处理下空格 换行
i.setClientName(i.getClientName().trim());
i.setClientCode(i.getClientCode().trim());
// i.setClientCode(i.getClientCode().trim());
log.info("导入数据《》《》{}", i);
if (set.isEmpty()) {
set.add(i.getClientCode());
} else {
boolean b = set.stream().anyMatch(a -> a.equals(i.getClientCode()));
if (b) {
continue;
}
}
if (ObjectUtils.isNull(i.getClientCode()) || ObjectUtils.isNull(i.getClientName())) {
// if (set.isEmpty()) {
// set.add(i.getClientCode());
// } else {
// boolean b = set.stream().anyMatch(a -> a.equals(i.getClientCode()));
// if (b) {
// continue;
// }
// }
// if (ObjectUtils.isNull(i.getClientCode()) || ObjectUtils.isNull(i.getClientName())) {
// throw new ServiceException("客户编码或客户名称不能为空!");
// }
if (ObjectUtils.isNull(i.getClientName())) {
throw new ServiceException("客户编码或客户名称不能为空!");
}
BasicdataClientEntity basicdataClient = new BasicdataClientEntity();
BeanUtil.copyProperties(i, basicdataClient);
//系统生成码值
String finallyClientCode = this.getFinallyClientCode();
basicdataClient.setClientCode(finallyClientCode);
//将这个最新的防止缓存中
log.info(">>>>>> basicdataClient.getClientCode() {}", basicdataClient.getClientCode());
//查询客户编码和客户名称是否存在
@ -397,15 +408,14 @@ public class BasicdataClientServiceImpl extends BaseServiceImpl<BasicdataClientM
log.info(">>>>>>>>>>>>> 1{}", ii.getClientCode());
log.info(">>>>>>>>>>>>> 2{}", ii.getClientName());
return ii.getClientCode().equals(basicdataClient.getClientCode())
|| ii.getClientName().equals(basicdataClient.getClientName().trim());
return ii.getClientCode().equals(basicdataClient.getClientCode())
|| ii.getClientName().equals(basicdataClient.getClientName().trim());
}
return false;
});
if (b) {
List<BasicdataClientEntity> basicdataClientEntities = basicdataClients.stream().filter(ii -> ii.getClientCode().equals(basicdataClient.getClientCode())
|| ii.getClientName().equals(basicdataClient.getClientName())).collect(Collectors.toList());
List<BasicdataClientEntity> basicdataClientEntities = basicdataClients.stream().filter(ii -> ii.getClientName().equals(basicdataClient.getClientName())).collect(Collectors.toList());
log.info("###############basicdataClientEntities重复客户:{}", basicdataClientEntities);
throw new ServiceException("客户编码或客户名称已存在");
}
@ -413,8 +423,10 @@ public class BasicdataClientServiceImpl extends BaseServiceImpl<BasicdataClientM
Optional<DictBiz> clientFirst = clientBiz.stream().filter(ii -> ii.getDictValue().equals(i.getClientType())).findFirst();
// i.setTypeService(first.get().getDictValue());
basicdataClient.setClientType(clientFirst.get().getDictKey());
//查询是不是重复
List<BasicdataClientEntity> basicdataClientEntities = baseMapper.selectList(Wrappers.<BasicdataClientEntity>query().lambda().eq(BasicdataClientEntity::getClientCode, i.getClientCode()));
//查询客户名称是不是重复
List<BasicdataClientEntity> basicdataClientEntities = baseMapper.selectList(Wrappers.<BasicdataClientEntity>query().lambda()
.eq(BasicdataClientEntity::getClientName, i.getClientName())
);
if (basicdataClientEntities.isEmpty()) {
BladeUser user = AuthUtil.getUser();
basicdataClient.setPid(0L);
@ -430,6 +442,7 @@ public class BasicdataClientServiceImpl extends BaseServiceImpl<BasicdataClientM
basicdataClient.setDefaultPaymentMethods(keyValue);
baseMapper.insert(basicdataClient);
redis.set(RedisKeyConstant.FINAL_CLIENT_CODE + AuthUtil.getTenantId(), basicdataClient.getClientCode());
if (ObjectUtils.isNull(basicdataClient.getId())) {
throw new ServiceException("客户ID不存在");
}
@ -678,21 +691,21 @@ public class BasicdataClientServiceImpl extends BaseServiceImpl<BasicdataClientM
@Override
public String getFinallyClientCode() {
String tenantCode ="HT";
String tenantCode = "HT";
BasicTenantCodeEntity basicTenantCodeByCodeAndShowType = basicTenantCodeClient.findBasicTenantCodeByCodeAndShowType(BasicCodeTypeConstant.CLIENT_CODE.getValue(), BasicCodeShowConstant.QR_CODE.getValue());
if (ObjectUtils.isNull(basicTenantCodeByCodeAndShowType)) {
log.error("获取货区码失败");
}else{
} else {
tenantCode = basicTenantCodeByCodeAndShowType.getCode();
}
String finaClientCode = redis.get(RedisKeyConstant.FINAL_CLIENT_CODE + AuthUtil.getTenantId());
if (StringUtils.isBlank(finaClientCode)) {
List<String> str = baseMapper.getFinallyClientCode(tenantCode);
if(!str.isEmpty()){
if (!str.isEmpty()) {
finaClientCode = str.get(0);
}else{
finaClientCode =tenantCode+"0000000";
} else {
finaClientCode = tenantCode + "0000000";
}
redis.set(RedisKeyConstant.FINAL_CLIENT_CODE + AuthUtil.getTenantId(), finaClientCode);
@ -706,12 +719,54 @@ public class BasicdataClientServiceImpl extends BaseServiceImpl<BasicdataClientM
@Override
public boolean saveClient(BasicdataClientEntity basicdataClient) {
boolean save = this.save(basicdataClient);
if (save){
if (save) {
//进行redis的设置
redis.set(RedisKeyConstant.FINAL_CLIENT_CODE + AuthUtil.getTenantId(), basicdataClient.getClientCode());
}
return true;
}
@Override
public R checkImportBasicDataClient(MultipartFile file) {
List<BasicdataClientExcel> clientExcels = ExcelUtil.read(file, BasicdataClientExcel.class);
if (!clientExcels.isEmpty()) {
log.info("客户导入数据");
//查询仓库信息
QueryWrapper<BasicdataClientEntity> queryWrapper = new QueryWrapper<>();
List<BasicdataClientEntity> basicdataClients = baseMapper.selectList(queryWrapper);
LambdaQueryWrapper<BasicdataBrandEntity> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(BasicdataBrandEntity::getIsDeleted, 0);
List<BasicdataBrandEntity> basicdataBrandEntityList = basicdataBrandService.list(lambdaQueryWrapper);
for (BasicdataClientExcel data : clientExcels) {
if (!basicdataClients.isEmpty()) {
//查询客户编码和客户名称是否存在
boolean b = basicdataClients.stream().anyMatch(ii -> {
if (ii.getClientName() != null && !ii.getClientName().isEmpty()) {
return ii.getClientName().equals(data.getClientName().trim());
}
return false;
});
if (b) {
String repeatClientName = basicdataClients.stream().filter(ii -> ii.getClientName().equals(data.getClientName())).map(BasicdataClientEntity::getClientName).collect(Collectors.joining(","));
return R.fail(repeatClientName+"客户名称已存在");
}
}
//添加品牌
if (ObjectUtils.isNotNull(data.getBrandName())) {
String[] ars = data.getBrandName().split(",");
for (String ar : ars) {
BasicdataBrandEntity one = matchBasicdataBrandEntityListValue(basicdataBrandEntityList, ar);
if (ObjectUtils.isNull(one)) {
return R.fail(data.getClientName()+"品牌信息不存在");
}
}
}
}
}
return R.success("校验成功");
}
}

11
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataStoreContactServiceImpl.java

@ -107,4 +107,15 @@ public class BasicdataStoreContactServiceImpl extends BaseServiceImpl<BasicdataS
return baseMapper.pageList(page,basicdataStoreContact);
}
@Override
public boolean saveOrUpdateBasicdataStoreContact(BasicdataStoreContactEntity basicdataStoreContact) {
//进行客户列表的联系人修改
Long shopId = basicdataStoreContact.getShopId();
BasicdataClientEntity basicdataClientEntity = new BasicdataClientEntity();
basicdataClientEntity.setId(shopId);
basicdataClientEntity.setLinkman(basicdataStoreContact.getLinkman());
basicdataClientEntity.setPhone(basicdataStoreContact.getPhone());
return this.saveOrUpdate(basicdataStoreContact);
}
}

6
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryListMapper.xml

@ -600,7 +600,7 @@
<select id="selectBycommercialNub" resultType="java.lang.Integer">
SELECT COALESCE(COUNT(*), 0) FROM logpm_distribution_delivery_list lddl
<where>
lddl.type = '1' AND lddl.customers_number > 0
lddl.type = '1' AND lddl.customers_number > 0 AND lddl.is_deleted = 0
<if test="param.trainNumber != null and param.trainNumber!=''">
and lddl.train_number like concat('%',#{param.trainNumber},'%')
</if>
@ -645,7 +645,7 @@
logpm_distribution_delivery_list lddl join logpm_distribution_signfor lds on lddl.id = lds.delivery_id
join logpm_distribution_reservation ldr on lds.reservation_id =ldr.id
<where>
lddl.type = '1'
lddl.type = '1' AND lddl.is_deleted = 0 AND lddl.customers_number > 0
<if test="param.trainNumber != null and param.trainNumber!=''">
and lddl.train_number like concat('%',#{param.trainNumber},'%')
</if>
@ -687,7 +687,7 @@
<select id="selectmarketNub" resultType="java.lang.Integer">
SELECT COALESCE(COUNT(*), 0) FROM logpm_distribution_delivery_list lddl
<where>
lddl.type = '2'
lddl.type = '2' AND lddl.is_deleted = 0 AND lddl.customers_number > 0
<if test="param.trainNumber != null and param.trainNumber!=''">
and lddl.train_number like concat('%',#{param.trainNumber},'%')
</if>

Loading…
Cancel
Save