Browse Source

fix:增加物料增加的名称和编码的重复判断

2.增加仓库名称和编码的重复判断
fix-sign
pref_mail@163.com 5 months ago
parent
commit
c33e83a6bf
  1. 39
      blade-service/logpm-basic/src/main/java/com/logpm/basic/controller/BasicMaterialController.java
  2. 22
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataWarehouseController.java
  3. 9
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSignforServiceImpl.java

39
blade-service/logpm-basic/src/main/java/com/logpm/basic/controller/BasicMaterialController.java

@ -31,6 +31,7 @@ import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.springblade.common.exception.CustomerException;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.excel.util.ExcelUtil;
import org.springblade.core.mp.support.Condition;
@ -50,6 +51,7 @@ import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 物料基础信息 控制器
@ -147,10 +149,30 @@ public class BasicMaterialController extends BladeController {
return R.fail("添加失败,物料信息为空!");
}
checkBasicMaterialEntity(basicMaterial);
return R.status(basicMaterialService.save(basicMaterial));
}
private void checkBasicMaterialEntity(BasicMaterialEntity basicMaterial) {
// 判断输入的物料编码是否重复
List<BasicMaterialEntity> list = basicMaterialService.list();
List<BasicMaterialEntity> collect2 = list.stream().filter(item -> item.getName().equals(basicMaterial.getName())).collect(Collectors.toList());
if(!collect2.isEmpty()){
throw new CustomerException("物料名称重复,请重新输入");
}
List<BasicMaterialEntity> collect = list.stream().filter(item -> item.getProductCode().equals(basicMaterial.getProductCode())).collect(Collectors.toList());
if(!collect.isEmpty()){
throw new CustomerException("物料编码重复,请重新输入");
}
}
/**
* 物料基础信息 修改
*/
@ -191,12 +213,17 @@ public class BasicMaterialController extends BladeController {
@ApiOperation(value = "逻辑删除", notes = "传入ids")
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
//改为修改隐藏状态
boolean update = basicMaterialService.update(new UpdateWrapper<BasicMaterialEntity>().lambda()
.in(BasicMaterialEntity::getId, Func.toLongList(ids))
.set(BasicMaterialEntity::getHide, 2)
);
// basicMaterialService.deleteLogic(Func.toLongList(ids));
return R.status(update);
// boolean update = basicMaterialService.update(new UpdateWrapper<BasicMaterialEntity>().lambda()
// .in(BasicMaterialEntity::getId, Func.toLongList(ids))
// .set(BasicMaterialEntity::getHide, 2)
// );
try {
basicMaterialService.deleteLogic(Func.toLongList(ids));
} catch (Exception e) {
log.error("删除物料失败", e);
throw new CustomerException("服务器异常,请刷新重试");
}
return R.status(true);
}

22
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataWarehouseController.java

@ -36,6 +36,7 @@ import lombok.extern.log4j.Log4j2;
import org.springblade.common.cache.CacheNames;
import org.springblade.common.cache.CacheObjNames;
import org.springblade.common.constant.common.IsOrNoConstant;
import org.springblade.common.exception.CustomerException;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.cache.utils.CacheUtil;
import org.springblade.core.excel.util.ExcelUtil;
@ -199,6 +200,10 @@ public class BasicdataWarehouseController extends BladeController {
@ApiOperationSupport(order = 4)
@ApiOperation(value = "新增", notes = "传入warehouseWarehouse")
public R save(@Valid @RequestBody BasicdataWarehouseEntity warehouseWarehouse) {
// 验证提交信息内容
checkWarehouseInformation(warehouseWarehouse);
BladeUser user = AuthUtil.getUser();
CacheUtil.evict(CacheObjNames.basic_data_warehourse_list.getCacheName(), CacheObjNames.basic_data_warehourse_list.getKeyPrefix(),user.getUserId());
warehouseWarehouse.setEnableStatus("2");
@ -216,6 +221,23 @@ public class BasicdataWarehouseController extends BladeController {
return R.status(flag);
}
private void checkWarehouseInformation(BasicdataWarehouseEntity warehouseWarehouse) {
// 查询现在数据库已经存在的仓库信息
List<BasicdataWarehouseEntity> warehouseList = warehouseService.list();
List<BasicdataWarehouseEntity> names = warehouseList.stream().filter(warehouseEntity -> warehouseEntity.getName().equals(warehouseWarehouse.getName())).collect(Collectors.toList());
List<BasicdataWarehouseEntity> codes = warehouseList.stream().filter(warehouseEntity -> warehouseEntity.getCode().equals(warehouseWarehouse.getCode())).collect(Collectors.toList());
if(!names.isEmpty()){
throw new CustomerException("仓库名称重复,请重新输入");
}
if(!codes.isEmpty()){
throw new CustomerException("仓库编号重复,请重新输入");
}
}
/**
* 仓库 修改
*/

9
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSignforServiceImpl.java

@ -5440,10 +5440,7 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
return Resp.scanFail("操作失败", "当前操作由司机操作");
}
}
if (deliverySelfEntity == null) {
return Resp.scanFail("当前人无操作权限", "当前人无操作权限");
}
List<JSONObject> jsonObjects = new ArrayList<>();
List<JSONObject> jsonObjects = new ArrayList<>();
if (SignforStatusConstant.yiqianshou.getValue().equals(distributionSignfor.getSigningStatus())) {
return Resp.scanFail("当前客户已完成复核", "当前客户已完成复核");
}
@ -5982,8 +5979,8 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
throw new CustomerException("没有司机的信息");
}
BeanUtils.copyProperties(distributionDeliveryTripartiteEntity, distributionDeliverySelfEntity);
distributionDeliverySelfEntity.setVehicleNub(distributionDeliveryTripartiteEntity.getVehicleNum());
}
distributionDeliverySelfEntity.setVehicleNub(distributionDeliveryTripartiteEntity.getVehicleNum());
}
return distributionDeliverySelfEntity;

Loading…
Cancel
Save