Merge remote-tracking branch 'origin/dev' into test
This commit is contained in:
@@ -10,16 +10,17 @@ import com.zt.plat.framework.common.exception.ErrorCode;
|
||||
public interface ErrorCodeConstants {
|
||||
|
||||
// ========== 示例模块 1-001-000-000 ==========
|
||||
ErrorCode MATERIAL_OTHER_NOT_EXISTS = new ErrorCode(1_001_000_001, "示例不存在");
|
||||
ErrorCode ELEMENT_NOT_EXISTS = new ErrorCode(1_001_000_001, "示例不存在");
|
||||
ErrorCode CONTACT_NOT_EXISTS = new ErrorCode(1_001_000_001, "示例不存在");
|
||||
ErrorCode ACCOUNT_NOT_EXISTS = new ErrorCode(1_001_000_001, "示例不存在");
|
||||
ErrorCode MATERIAL_DESTROY_NOT_EXISTS = new ErrorCode(1_001_000_001, "示例不存在");
|
||||
ErrorCode MATERIAL_INFOMATION_NOT_EXISTS = new ErrorCode(1_001_000_001, "示例不存在");
|
||||
ErrorCode COMPANY_RELATIVITY_NOT_EXISTS = new ErrorCode(1_001_000_001, "示例不存在");
|
||||
ErrorCode WAREHOUSE_NOT_EXISTS = new ErrorCode(1_001_000_001, "示例不存在");
|
||||
ErrorCode FACTORY_NOT_EXISTS = new ErrorCode(1_001_000_001, "示例不存在");
|
||||
ErrorCode TAX_NOT_EXISTS = new ErrorCode(1_001_000_001, "示例不存在");
|
||||
ErrorCode MATERIAL_OTHER_NOT_EXISTS = new ErrorCode(1_001_000_001, "物料不存在");
|
||||
ErrorCode ELEMENT_NOT_EXISTS = new ErrorCode(1_001_000_001, "金属元素不存在");
|
||||
ErrorCode CONTACT_NOT_EXISTS = new ErrorCode(1_001_000_001, "联系人不存在");
|
||||
ErrorCode ACCOUNT_NOT_EXISTS = new ErrorCode(1_001_000_001, "账户条款不存在");
|
||||
ErrorCode MATERIAL_DESTROY_NOT_EXISTS = new ErrorCode(1_001_000_001, "物料回收率不存在");
|
||||
ErrorCode MATERIAL_INFOMATION_NOT_EXISTS = new ErrorCode(1_001_000_001, "物料信息不存在");
|
||||
ErrorCode COMPANY_RELATIVITY_NOT_EXISTS = new ErrorCode(1_001_000_001, "公司关系不存在");
|
||||
ErrorCode WAREHOUSE_NOT_EXISTS = new ErrorCode(1_001_000_001, "库位不存在");
|
||||
ErrorCode WAREHOUSE_CODE_EXISTS = new ErrorCode(1_001_000_002, "库位编码已存在");
|
||||
ErrorCode FACTORY_NOT_EXISTS = new ErrorCode(1_001_000_001, "工厂不存在");
|
||||
ErrorCode TAX_NOT_EXISTS = new ErrorCode(1_001_000_001, "公司关系不存在");
|
||||
|
||||
|
||||
ErrorCode BUSINESS_RULE_NOT_EXISTS = new ErrorCode(1_027_100_001, "规则模型不存在");
|
||||
|
||||
@@ -33,4 +33,10 @@ public interface WarehouseMapper extends BaseMapperX<WarehouseDO> {
|
||||
}
|
||||
|
||||
String selectMaxCode();
|
||||
|
||||
default WarehouseDO selectByCode(String code){
|
||||
return selectOne(new LambdaQueryWrapperX<WarehouseDO>()
|
||||
.eq(WarehouseDO::getCoding, code)
|
||||
.last("LIMIT 1"));
|
||||
};
|
||||
}
|
||||
@@ -16,6 +16,7 @@ import org.springframework.validation.annotation.Validated;
|
||||
import java.util.List;
|
||||
|
||||
import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.zt.plat.module.base.enums.ErrorCodeConstants.WAREHOUSE_CODE_EXISTS;
|
||||
import static com.zt.plat.module.base.enums.ErrorCodeConstants.WAREHOUSE_NOT_EXISTS;
|
||||
|
||||
/**
|
||||
@@ -35,16 +36,17 @@ public class WarehouseServiceImpl implements WarehouseService {
|
||||
// 插入
|
||||
WarehouseDO warehouse = BeanUtils.toBean(createReqVO, WarehouseDO.class);
|
||||
// 库位编码自动生成,格式 KW-0001,依次新增
|
||||
String maxCode = warehouseMapper.selectMaxCode();
|
||||
if (maxCode == null) {
|
||||
warehouse.setCoding("KW-0001");
|
||||
} else {
|
||||
String prefix = "KW-";
|
||||
String numberPart = maxCode.substring(prefix.length());
|
||||
int nextNumber = Integer.parseInt(numberPart) + 1;
|
||||
String nextCode = prefix + String.format("%04d", nextNumber);
|
||||
warehouse.setCoding(nextCode);
|
||||
}
|
||||
// String maxCode = warehouseMapper.selectMaxCode();
|
||||
// if (maxCode == null) {
|
||||
// warehouse.setCoding("KW-0001");
|
||||
// } else {
|
||||
// String prefix = "KW-";
|
||||
// String numberPart = maxCode.substring(prefix.length());
|
||||
// int nextNumber = Integer.parseInt(numberPart) + 1;
|
||||
// String nextCode = prefix + String.format("%04d", nextNumber);
|
||||
// warehouse.setCoding(nextCode);
|
||||
// }
|
||||
validateWarehouseCodeExists(warehouse.getCoding());
|
||||
warehouseMapper.insert(warehouse);
|
||||
// 返回
|
||||
return BeanUtils.toBean(warehouse, WarehouseRespVO.class);
|
||||
@@ -68,12 +70,12 @@ public class WarehouseServiceImpl implements WarehouseService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteWarehouseListByIds(List<Long> ids) {
|
||||
public void deleteWarehouseListByIds(List<Long> ids) {
|
||||
// 校验存在
|
||||
validateWarehouseExists(ids);
|
||||
// 删除
|
||||
warehouseMapper.deleteByIds(ids);
|
||||
}
|
||||
}
|
||||
|
||||
private void validateWarehouseExists(List<Long> ids) {
|
||||
List<WarehouseDO> list = warehouseMapper.selectByIds(ids);
|
||||
@@ -88,6 +90,13 @@ public class WarehouseServiceImpl implements WarehouseService {
|
||||
}
|
||||
}
|
||||
|
||||
private void validateWarehouseCodeExists(String code) {
|
||||
WarehouseDO warehouse = warehouseMapper.selectByCode(code);
|
||||
if (warehouse != null) {
|
||||
throw exception(WAREHOUSE_CODE_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public WarehouseDO getWarehouse(Long id) {
|
||||
return warehouseMapper.selectById(id);
|
||||
@@ -101,7 +110,7 @@ public class WarehouseServiceImpl implements WarehouseService {
|
||||
@Override
|
||||
public void enableWarehouseList(List<WarehouseRespVO> saveReqVOS) {
|
||||
List<WarehouseDO> updateObj = BeanUtils.toBean(saveReqVOS, WarehouseDO.class);
|
||||
List<BatchResult> count = warehouseMapper.updateById(updateObj);
|
||||
List<BatchResult> count = warehouseMapper.updateById(updateObj);
|
||||
if (CollUtil.isEmpty(count)) {
|
||||
throw exception(WAREHOUSE_NOT_EXISTS);
|
||||
}
|
||||
|
||||
@@ -6,8 +6,24 @@ import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class IntContractPageReq extends PageParam {
|
||||
@Schema(description = "合同编号")
|
||||
private String contractCode;
|
||||
|
||||
// 合同名称:模糊搜索
|
||||
@Schema(description = "合同名称")
|
||||
private String contractName;
|
||||
// 合同有效期起:日期选择
|
||||
@Schema(description = "合同有效期起")
|
||||
private String contractStartDate;
|
||||
// 合同有效期止:日期选择
|
||||
@Schema(description = "合同有效期止")
|
||||
private String contractEndDate;
|
||||
// 合同版本号:精确搜索 TODO 不确定
|
||||
// 签约地:模糊搜索
|
||||
@Schema(description = "签约地")
|
||||
private String signSite;
|
||||
// 经办人姓名:模糊搜索
|
||||
@Schema(description = "经办人姓名")
|
||||
private String createdUserName;
|
||||
// 签约日期: 模糊搜索
|
||||
@Schema(description = "签约日期")
|
||||
private String signDate;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -22,10 +22,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
@@ -56,18 +53,18 @@ public class ErpWarehouseServiceImpl implements ErpWarehouseService {
|
||||
// 插入
|
||||
ErpWarehouseDO warehouse = BeanUtils.toBean(createReqVO, ErpWarehouseDO.class);
|
||||
// 库位编码自动生成,格式 KW-0001,依次新增
|
||||
if (warehouse.getNumber() == null) {
|
||||
String maxCode = erpWarehouseMapper.selectMaxCode();
|
||||
if (maxCode == null) {
|
||||
warehouse.setNumber("KW-0001");
|
||||
} else {
|
||||
String prefix = "KW-";
|
||||
String numberPart = maxCode.substring(prefix.length());
|
||||
int nextNumber = Integer.parseInt(numberPart) + 1;
|
||||
String nextCode = prefix + String.format("%04d", nextNumber);
|
||||
warehouse.setNumber(nextCode);
|
||||
}
|
||||
}
|
||||
// if (warehouse.getNumber() == null) {
|
||||
// String maxCode = erpWarehouseMapper.selectMaxCode();
|
||||
// if (maxCode == null) {
|
||||
// warehouse.setNumber("KW-0001");
|
||||
// } else {
|
||||
// String prefix = "KW-";
|
||||
// String numberPart = maxCode.substring(prefix.length());
|
||||
// int nextNumber = Integer.parseInt(numberPart) + 1;
|
||||
// String nextCode = prefix + String.format("%04d", nextNumber);
|
||||
// warehouse.setNumber(nextCode);
|
||||
// }
|
||||
// }
|
||||
warehouse.setType("SPLY");
|
||||
warehouse.setIsEnable("1");
|
||||
erpWarehouseMapper.insert(warehouse);
|
||||
@@ -120,7 +117,7 @@ public class ErpWarehouseServiceImpl implements ErpWarehouseService {
|
||||
private void validateErpFactoryExistsNumber(String number, String factoryNumber) {
|
||||
List<ErpWarehouseDO> list = erpWarehouseMapper.selectList(new LambdaQueryWrapperX<ErpWarehouseDO>()).stream()
|
||||
.filter(erpWarehouseDO -> erpWarehouseDO.getNumber().equals(number))
|
||||
.filter(erpWarehouseDO -> erpWarehouseDO.getFactoryNumber().equals(factoryNumber))
|
||||
.filter(erpWarehouseDO -> Objects.equals(erpWarehouseDO.getFactoryNumber(), factoryNumber))
|
||||
.toList();
|
||||
if (!list.isEmpty()) {
|
||||
throw exception(ERP_WAREHOUSE_EXISTS);
|
||||
|
||||
Reference in New Issue
Block a user