Browse Source

基础数据验证修改

master_hella_20240701
chenfang 1 year ago
parent
commit
edc911b684
  1. 2
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/labelBarbasic/BarbasicController.java
  2. 5
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/accountcalendar/AccountcalendarServiceImpl.java
  3. 16
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/areabasic/AreabasicServiceImpl.java
  4. 5
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/carrier/CarrierServiceImpl.java
  5. 7
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/currencyexchange/CurrencyexchangeServiceImpl.java
  6. 5
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/customer/CustomerServiceImpl.java
  7. 6
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/customerdock/CustomerdockServiceImpl.java
  8. 3
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/customeritem/CustomeritemServiceImpl.java
  9. 19
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/dock/DockServiceImpl.java
  10. 1
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/itemwarehouse/ItemwarehouseServiceImpl.java
  11. 4
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/locationgroup/LocationgroupServiceImpl.java
  12. 2
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/owner/OwnerServiceImpl.java
  13. 6
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/process/ProcessServiceImpl.java
  14. 7
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/project/ProjectServiceImpl.java
  15. 7
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/purchaseprice/PurchasepriceServiceImpl.java
  16. 7
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/saleprice/SalepriceServiceImpl.java
  17. 2
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/shift/ShiftServiceImpl.java
  18. 8
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/supplier/SupplierServiceImpl.java
  19. 8
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/supplieritem/SupplieritemServiceImpl.java
  20. 1
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/systemcalendar/SystemcalendarServiceImpl.java
  21. 2
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/team/TeamServiceImpl.java
  22. 1
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/warehouse/WarehouseServiceImpl.java
  23. 1
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/workshop/WorkshopServiceImpl.java
  24. 2
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/workstation/WorkstationServiceImpl.java

2
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/labelBarbasic/BarbasicController.java

@ -31,7 +31,7 @@ import com.win.module.wms.convert.labelBarbasic.BarbasicConvert;
import com.win.module.wms.service.labelBarbasic.BarbasicService; import com.win.module.wms.service.labelBarbasic.BarbasicService;
@Tag(name = "管理后台 - 条码实体基类") @Tag(name = "管理后台 - 采购件标签/制造件标签/器具标签/库位标签/叫料标签")
@RestController @RestController
@RequestMapping("/wms/barbasic") @RequestMapping("/wms/barbasic")
@Validated @Validated

5
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/accountcalendar/AccountcalendarServiceImpl.java

@ -56,6 +56,7 @@ public class AccountcalendarServiceImpl implements AccountcalendarService {
@Override @Override
public void updateAccountcalendar(AccountcalendarUpdateReqVO updateReqVO) { public void updateAccountcalendar(AccountcalendarUpdateReqVO updateReqVO) {
// 校验存在 // 校验存在
validateAccountcalendarExists(updateReqVO.getId());
validateAccountcalendarForCreateOrUpdate(updateReqVO.getId(),updateReqVO.getAvailable()); validateAccountcalendarForCreateOrUpdate(updateReqVO.getId(),updateReqVO.getAvailable());
// 更新 // 更新
AccountcalendarDO updateObj = AccountcalendarConvert.INSTANCE.convert(updateReqVO); AccountcalendarDO updateObj = AccountcalendarConvert.INSTANCE.convert(updateReqVO);
@ -161,16 +162,12 @@ public class AccountcalendarServiceImpl implements AccountcalendarService {
private void validateAccountcalendarForCreateOrUpdate(Long id,String available) { private void validateAccountcalendarForCreateOrUpdate(Long id,String available) {
// 关闭数据权限,避免因为没有数据权限,查询不到数据,进而导致唯一校验不正确 // 关闭数据权限,避免因为没有数据权限,查询不到数据,进而导致唯一校验不正确
DataPermissionUtils.executeIgnore(() -> { DataPermissionUtils.executeIgnore(() -> {
validateAccountcalendarExists(id);
//校验是否可用为空 //校验是否可用为空
validateAvailableExists(available); validateAvailableExists(available);
}); });
} }
@VisibleForTesting @VisibleForTesting
private void validateAccountcalendarExists(Long id) { private void validateAccountcalendarExists(Long id) {
if (id == null) {
return;
}
AccountcalendarDO accountcalendar = accountcalendarMapper.selectById(id); AccountcalendarDO accountcalendar = accountcalendarMapper.selectById(id);
if (accountcalendar == null) { if (accountcalendar == null) {
throw exception(ACCOUNTCALENDAR_NOT_EXISTS); throw exception(ACCOUNTCALENDAR_NOT_EXISTS);

16
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/areabasic/AreabasicServiceImpl.java

@ -60,6 +60,7 @@ public class AreabasicServiceImpl implements AreabasicService {
@Override @Override
public void updateAreabasic(AreabasicUpdateReqVO updateReqVO) { public void updateAreabasic(AreabasicUpdateReqVO updateReqVO) {
// 校验存在 // 校验存在
validateAreabasicExists(updateReqVO.getId());
validateAreabasicForCreateOrUpdate(updateReqVO.getId(),updateReqVO.getCode(),updateReqVO.getWarehouseCode(),updateReqVO.getIsFunctional(),updateReqVO.getAvailable()); validateAreabasicForCreateOrUpdate(updateReqVO.getId(),updateReqVO.getCode(),updateReqVO.getWarehouseCode(),updateReqVO.getIsFunctional(),updateReqVO.getAvailable());
// 更新 // 更新
AreabasicDO updateObj = AreabasicConvert.INSTANCE.convert(updateReqVO); AreabasicDO updateObj = AreabasicConvert.INSTANCE.convert(updateReqVO);
@ -197,16 +198,15 @@ public class AreabasicServiceImpl implements AreabasicService {
private void validateAreabasicForCreateOrUpdate(Long id,String code,String warehouseCode,String isFunctional,String available) { private void validateAreabasicForCreateOrUpdate(Long id,String code,String warehouseCode,String isFunctional,String available) {
// 关闭数据权限,避免因为没有数据权限,查询不到数据,进而导致唯一校验不正确 // 关闭数据权限,避免因为没有数据权限,查询不到数据,进而导致唯一校验不正确
DataPermissionUtils.executeIgnore(() -> { DataPermissionUtils.executeIgnore(() -> {
validateAreabasicExists(id);
// 校验code唯一 // 校验code唯一
validateCodeExists(code); validateCodeExists(code);
validateWarehouseCodeExists(warehouseCode);
validateIsFunctionalExists(isFunctional);
validateAvailableExists(available);
}); });
} }
@VisibleForTesting @VisibleForTesting
private void validateAreabasicExists(Long id) { private void validateAreabasicExists(Long id) {
if (id == null) {
return;
}
AreabasicDO areabasic = areabasicMapper.selectById(id); AreabasicDO areabasic = areabasicMapper.selectById(id);
if (areabasic == null) { if (areabasic == null) {
throw exception(AREABASIC_NOT_EXISTS); throw exception(AREABASIC_NOT_EXISTS);
@ -214,13 +214,13 @@ public class AreabasicServiceImpl implements AreabasicService {
} }
@VisibleForTesting @VisibleForTesting
private void validateCodeExists(String code) { private void validateCodeExists(String code) {
if (code.isEmpty()) { if (code == null) {
throw exception(AREABASIC_CODE_NOT_EXISTS); throw exception(AREABASIC_CODE_NOT_EXISTS);
} }
} }
@VisibleForTesting @VisibleForTesting
private void validateWarehouseCodeExists(String warehouseCode) { private void validateWarehouseCodeExists(String warehouseCode) {
if (warehouseCode.isEmpty()) { if (warehouseCode == null) {
throw exception(AREABASIC_WAREHOUSE_CODE_EXISTS); throw exception(AREABASIC_WAREHOUSE_CODE_EXISTS);
}else { }else {
WarehouseDO warehouseDO = warehouseMapper.selectByCode(warehouseCode); WarehouseDO warehouseDO = warehouseMapper.selectByCode(warehouseCode);
@ -231,13 +231,13 @@ public class AreabasicServiceImpl implements AreabasicService {
} }
@VisibleForTesting @VisibleForTesting
private void validateIsFunctionalExists(String isFunctional) { private void validateIsFunctionalExists(String isFunctional) {
if (isFunctional.isEmpty()) { if (isFunctional == null) {
throw exception(AREABASIC_IS_FUNCTIONAL_EXISTS); throw exception(AREABASIC_IS_FUNCTIONAL_EXISTS);
} }
} }
@VisibleForTesting @VisibleForTesting
private void validateAvailableExists(String available) { private void validateAvailableExists(String available) {
if (available.isEmpty()) { if (available == null) {
throw exception(AREABASIC_AVAIABLE_NOT_EXISTS); throw exception(AREABASIC_AVAIABLE_NOT_EXISTS);
} }
} }

5
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/carrier/CarrierServiceImpl.java

@ -51,8 +51,8 @@ public class CarrierServiceImpl implements CarrierService {
@Override @Override
public void updateCarrier(CarrierUpdateReqVO updateReqVO) { public void updateCarrier(CarrierUpdateReqVO updateReqVO) {
// 校验存在 // 校验存在
validateCarrierExists(updateReqVO.getId());
validateCarrierForCreateOrUpdate(updateReqVO.getCode(), updateReqVO.getShortName(), updateReqVO.getAvailable()); validateCarrierForCreateOrUpdate(updateReqVO.getCode(), updateReqVO.getShortName(), updateReqVO.getAvailable());
// 更新 // 更新
CarrierDO updateObj = CarrierConvert.INSTANCE.convert(updateReqVO); CarrierDO updateObj = CarrierConvert.INSTANCE.convert(updateReqVO);
carrierMapper.updateById(updateObj); carrierMapper.updateById(updateObj);
@ -152,9 +152,6 @@ public class CarrierServiceImpl implements CarrierService {
@VisibleForTesting @VisibleForTesting
private void validateCarrierExists(Long id) { private void validateCarrierExists(Long id) {
if (id == null) {
return;
}
CarrierDO carrier = carrierMapper.selectById(id); CarrierDO carrier = carrierMapper.selectById(id);
if (carrier == null) { if (carrier == null) {
throw exception(CARRIER_NOT_EXISTS); throw exception(CARRIER_NOT_EXISTS);

7
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/currencyexchange/CurrencyexchangeServiceImpl.java

@ -42,7 +42,7 @@ public class CurrencyexchangeServiceImpl implements CurrencyexchangeService {
@Override @Override
public Long createCurrencyexchange(CurrencyexchangeCreateReqVO createReqVO) { public Long createCurrencyexchange(CurrencyexchangeCreateReqVO createReqVO) {
validateCurrencyexchangeForCreateOrUpdate(createReqVO.getId(),createReqVO.getCurrency(),createReqVO.getBasiccurrency(),createReqVO.getRate(),createReqVO.getAvailable()); validateCurrencyexchangeForCreateOrUpdate(createReqVO.getCurrency(),createReqVO.getBasiccurrency(),createReqVO.getRate(),createReqVO.getAvailable());
// 插入 // 插入
CurrencyexchangeDO currencyexchange = CurrencyexchangeConvert.INSTANCE.convert(createReqVO); CurrencyexchangeDO currencyexchange = CurrencyexchangeConvert.INSTANCE.convert(createReqVO);
@ -53,9 +53,9 @@ public class CurrencyexchangeServiceImpl implements CurrencyexchangeService {
@Override @Override
public void updateCurrencyexchange(CurrencyexchangeUpdateReqVO updateReqVO) { public void updateCurrencyexchange(CurrencyexchangeUpdateReqVO updateReqVO) {
validateCurrencyexchangeForCreateOrUpdate(null,updateReqVO.getCurrency(),updateReqVO.getBasiccurrency(),updateReqVO.getRate(),updateReqVO.getAvailable());
// 校验存在 // 校验存在
validateCurrencyexchangeExists(updateReqVO.getId()); validateCurrencyexchangeExists(updateReqVO.getId());
validateCurrencyexchangeForCreateOrUpdate(updateReqVO.getCurrency(),updateReqVO.getBasiccurrency(),updateReqVO.getRate(),updateReqVO.getAvailable());
// 更新 // 更新
CurrencyexchangeDO updateObj = CurrencyexchangeConvert.INSTANCE.convert(updateReqVO); CurrencyexchangeDO updateObj = CurrencyexchangeConvert.INSTANCE.convert(updateReqVO);
currencyexchangeMapper.updateById(updateObj); currencyexchangeMapper.updateById(updateObj);
@ -175,11 +175,10 @@ public class CurrencyexchangeServiceImpl implements CurrencyexchangeService {
return errorList; return errorList;
} }
private void validateCurrencyexchangeForCreateOrUpdate(Long id, String currency, String basiccurrency, private void validateCurrencyexchangeForCreateOrUpdate(String currency, String basiccurrency,
BigDecimal rate, String available) { BigDecimal rate, String available) {
// 关闭数据权限,避免因为没有数据权限,查询不到数据,进而导致唯一校验不正确 // 关闭数据权限,避免因为没有数据权限,查询不到数据,进而导致唯一校验不正确
DataPermissionUtils.executeIgnore(() -> { DataPermissionUtils.executeIgnore(() -> {
validateConfigurationSettingExists(id);
// 校验code唯一 // 校验code唯一
validateCurrencyExists(currency); validateCurrencyExists(currency);
validateBasiccurrencyExists(basiccurrency); validateBasiccurrencyExists(basiccurrency);

5
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/customer/CustomerServiceImpl.java

@ -53,6 +53,7 @@ public class CustomerServiceImpl implements CustomerService {
@Override @Override
public void updateCustomer(CustomerUpdateReqVO updateReqVO) { public void updateCustomer(CustomerUpdateReqVO updateReqVO) {
validateCustomerExists(updateReqVO.getId());
// 校验存在 // 校验存在
validateCurrencyexchangeForCreateOrUpdate(updateReqVO.getId(),updateReqVO.getCode(),updateReqVO.getName(), updateReqVO.getShortName(),updateReqVO.getAvailable()); validateCurrencyexchangeForCreateOrUpdate(updateReqVO.getId(),updateReqVO.getCode(),updateReqVO.getName(), updateReqVO.getShortName(),updateReqVO.getAvailable());
CustomerDO customerDO = customerMapper.selectOne("name", updateReqVO.getName(), "id", updateReqVO.getId()); CustomerDO customerDO = customerMapper.selectOne("name", updateReqVO.getName(), "id", updateReqVO.getId());
@ -166,7 +167,6 @@ public class CustomerServiceImpl implements CustomerService {
private void validateCurrencyexchangeForCreateOrUpdate(Long id, String code, String name, String shortName, String available) { private void validateCurrencyexchangeForCreateOrUpdate(Long id, String code, String name, String shortName, String available) {
// 关闭数据权限,避免因为没有数据权限,查询不到数据,进而导致唯一校验不正确 // 关闭数据权限,避免因为没有数据权限,查询不到数据,进而导致唯一校验不正确
DataPermissionUtils.executeIgnore(() -> { DataPermissionUtils.executeIgnore(() -> {
validateCustomerExists(id);
validateCodeExists(code); validateCodeExists(code);
validateNameExists(name,id); validateNameExists(name,id);
// 校验code唯一 // 校验code唯一
@ -176,9 +176,6 @@ public class CustomerServiceImpl implements CustomerService {
} }
@VisibleForTesting @VisibleForTesting
private void validateCustomerExists(Long id) { private void validateCustomerExists(Long id) {
if (id == null) {
return;
}
CustomerDO customer = customerMapper.selectById(id); CustomerDO customer = customerMapper.selectById(id);
if (customer == null) { if (customer == null) {
throw exception(CUSTOMER_NOT_EXISTS); throw exception(CUSTOMER_NOT_EXISTS);

6
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/customerdock/CustomerdockServiceImpl.java

@ -52,9 +52,9 @@ public class CustomerdockServiceImpl implements CustomerdockService {
@Override @Override
public void updateCustomerdock(CustomerdockUpdateReqVO updateReqVO) { public void updateCustomerdock(CustomerdockUpdateReqVO updateReqVO) {
validateCustomerExists(updateReqVO.getId());
// 校验存在 // 校验存在
validateCurrencyexchangeForCreateOrUpdate(updateReqVO.getId(),updateReqVO.getCode(),updateReqVO.getCustomerCode(),updateReqVO.getDefaultLocationCode(),updateReqVO.getAvailable()); validateCurrencyexchangeForCreateOrUpdate(updateReqVO.getId(),updateReqVO.getCode(),updateReqVO.getCustomerCode(),updateReqVO.getDefaultLocationCode(),updateReqVO.getAvailable());
// 更新 // 更新
CustomerdockDO updateObj = CustomerdockConvert.INSTANCE.convert(updateReqVO); CustomerdockDO updateObj = CustomerdockConvert.INSTANCE.convert(updateReqVO);
customerdockMapper.updateById(updateObj); customerdockMapper.updateById(updateObj);
@ -69,7 +69,8 @@ public class CustomerdockServiceImpl implements CustomerdockService {
} }
private void validateCustomerdockExists(Long id) { private void validateCustomerdockExists(Long id) {
if (customerdockMapper.selectById(id) == null) { CustomerdockDO customerdockDO = customerdockMapper.selectById(id);
if (customerdockDO == null) {
throw exception(CUSTOMERDOCK_NOT_EXISTS); throw exception(CUSTOMERDOCK_NOT_EXISTS);
} }
} }
@ -170,7 +171,6 @@ public class CustomerdockServiceImpl implements CustomerdockService {
private void validateCurrencyexchangeForCreateOrUpdate(Long id, String code, String customerCode,String defaultLocationCode, String available) { private void validateCurrencyexchangeForCreateOrUpdate(Long id, String code, String customerCode,String defaultLocationCode, String available) {
// 关闭数据权限,避免因为没有数据权限,查询不到数据,进而导致唯一校验不正确 // 关闭数据权限,避免因为没有数据权限,查询不到数据,进而导致唯一校验不正确
DataPermissionUtils.executeIgnore(() -> { DataPermissionUtils.executeIgnore(() -> {
validateCustomerExists(id);
validateCodeExists(id,code); validateCodeExists(id,code);
// 校验code唯一 // 校验code唯一
validateCustomerCodeExists(customerCode); validateCustomerCodeExists(customerCode);

3
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/customeritem/CustomeritemServiceImpl.java

@ -62,7 +62,8 @@ public class CustomeritemServiceImpl implements CustomeritemService {
} }
private void validateCustomeritemExists(Long id) { private void validateCustomeritemExists(Long id) {
if (customeritemMapper.selectById(id) == null) { CustomeritemDO customeritemDO = customeritemMapper.selectById(id);
if (customeritemDO == null) {
throw exception(CUSTOMERITEM_NOT_EXISTS); throw exception(CUSTOMERITEM_NOT_EXISTS);
} }
} }

19
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/dock/DockServiceImpl.java

@ -48,7 +48,7 @@ public class DockServiceImpl implements DockService {
@Override @Override
public Long createDock(DockCreateReqVO createReqVO) { public Long createDock(DockCreateReqVO createReqVO) {
validateDockForCreateOrUpdate(createReqVO.getId(), createReqVO.getCode(), createReqVO.getType(), createReqVO.getWarehouseCode(), createReqVO.getDefaultLocationCode(), createReqVO.getAvailable()); validateDockForCreateOrUpdate(createReqVO.getCode(), createReqVO.getType(), createReqVO.getWarehouseCode(), createReqVO.getDefaultLocationCode(), createReqVO.getAvailable());
// 插入 // 插入
DockDO dock = DockConvert.INSTANCE.convert(createReqVO); DockDO dock = DockConvert.INSTANCE.convert(createReqVO);
@ -59,8 +59,9 @@ public class DockServiceImpl implements DockService {
@Override @Override
public void updateDock(DockUpdateReqVO updateReqVO) { public void updateDock(DockUpdateReqVO updateReqVO) {
validateDockExists(updateReqVO.getId());
// 校验存在 // 校验存在
validateDockForCreateOrUpdate(updateReqVO.getId(), updateReqVO.getCode(), updateReqVO.getType(), updateReqVO.getWarehouseCode(), updateReqVO.getDefaultLocationCode(), updateReqVO.getAvailable()); validateDockForCreateOrUpdate( updateReqVO.getCode(), updateReqVO.getType(), updateReqVO.getWarehouseCode(), updateReqVO.getDefaultLocationCode(), updateReqVO.getAvailable());
// 更新 // 更新
DockDO updateObj = DockConvert.INSTANCE.convert(updateReqVO); DockDO updateObj = DockConvert.INSTANCE.convert(updateReqVO);
dockMapper.updateById(updateObj); dockMapper.updateById(updateObj);
@ -102,12 +103,7 @@ public class DockServiceImpl implements DockService {
public String valitedock(DockDO dock) { public String valitedock(DockDO dock) {
StringBuilder message = new StringBuilder(); StringBuilder message = new StringBuilder();
try { try {
validateDockExists(null); validateCodeExists( dock.getCode());
} catch (ServiceException ex) {
message.append(ex.getMessage()).append(",");
}
try {
validateCodeExists(null, dock.getCode());
} catch (ServiceException ex) { } catch (ServiceException ex) {
message.append(ex.getMessage()).append(","); message.append(ex.getMessage()).append(",");
} }
@ -167,12 +163,11 @@ public class DockServiceImpl implements DockService {
} }
private void validateDockForCreateOrUpdate(Long id, String code, String type, String warehouseCode, private void validateDockForCreateOrUpdate(String code, String type, String warehouseCode,
String defaultLocationCode, String available) { String defaultLocationCode, String available) {
// 关闭数据权限,避免因为没有数据权限,查询不到数据,进而导致唯一校验不正确 // 关闭数据权限,避免因为没有数据权限,查询不到数据,进而导致唯一校验不正确
DataPermissionUtils.executeIgnore(() -> { DataPermissionUtils.executeIgnore(() -> {
validateDockExists(id); validateCodeExists(code);
validateCodeExists(id, code);
// 校验code唯一 // 校验code唯一
validateTypeExists(type); validateTypeExists(type);
validateWareHouseCodeExists(warehouseCode); validateWareHouseCodeExists(warehouseCode);
@ -193,7 +188,7 @@ public class DockServiceImpl implements DockService {
} }
@VisibleForTesting @VisibleForTesting
private void validateCodeExists(Long id, String code) { private void validateCodeExists( String code) {
if (code == null) { if (code == null) {
throw exception(DOCK_CODE_NOT_EXISTS); throw exception(DOCK_CODE_NOT_EXISTS);
} }

1
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/itemwarehouse/ItemwarehouseServiceImpl.java

@ -171,6 +171,7 @@ public class ItemwarehouseServiceImpl implements ItemwarehouseService {
}); });
return errorList; return errorList;
} }
private void validateItemWarehouseForCreateOrUpdate(String code, String manageMode, String warehouse, String packUnit, String available) { private void validateItemWarehouseForCreateOrUpdate(String code, String manageMode, String warehouse, String packUnit, String available) {
// 关闭数据权限,避免因为没有数据权限,查询不到数据,进而导致唯一校验不正确 // 关闭数据权限,避免因为没有数据权限,查询不到数据,进而导致唯一校验不正确
DataPermissionUtils.executeIgnore(() -> { DataPermissionUtils.executeIgnore(() -> {

4
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/locationgroup/LocationgroupServiceImpl.java

@ -62,6 +62,7 @@ public class LocationgroupServiceImpl implements LocationgroupService {
@Override @Override
public void updateLocationgroup(LocationgroupUpdateReqVO updateReqVO) { public void updateLocationgroup(LocationgroupUpdateReqVO updateReqVO) {
// 校验存在 // 校验存在
validateLocationgroupExists(updateReqVO.getId());
validateLocationForCreateOrUpdate(updateReqVO.getCode(), updateReqVO.getWarehouseCode(), updateReqVO.getAreaCode(), updateReqVO.getAvailable()); validateLocationForCreateOrUpdate(updateReqVO.getCode(), updateReqVO.getWarehouseCode(), updateReqVO.getAreaCode(), updateReqVO.getAvailable());
// 更新 // 更新
LocationgroupDO updateObj = LocationgroupConvert.INSTANCE.convert(updateReqVO); LocationgroupDO updateObj = LocationgroupConvert.INSTANCE.convert(updateReqVO);
@ -180,9 +181,6 @@ public class LocationgroupServiceImpl implements LocationgroupService {
} }
private void validateLocationgroupExists(Long id) { private void validateLocationgroupExists(Long id) {
if (id == null) {
return;
}
if (locationgroupMapper.selectById(id) == null) { if (locationgroupMapper.selectById(id) == null) {
throw exception(LOCATIONGROUP_NOT_EXISTS); throw exception(LOCATIONGROUP_NOT_EXISTS);
} }

2
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/owner/OwnerServiceImpl.java

@ -55,6 +55,7 @@ public class OwnerServiceImpl implements OwnerService {
@Override @Override
public void updateOwner(OwnerUpdateReqVO updateReqVO) { public void updateOwner(OwnerUpdateReqVO updateReqVO) {
// 校验存在 // 校验存在
validateOwnerExists(updateReqVO.getId());
validateLocationForCreateOrUpdate(updateReqVO.getId(),updateReqVO.getCode(),updateReqVO.getShortName(),updateReqVO.getAvailable()); validateLocationForCreateOrUpdate(updateReqVO.getId(),updateReqVO.getCode(),updateReqVO.getShortName(),updateReqVO.getAvailable());
// 更新 // 更新
OwnerDO updateObj = OwnerConvert.INSTANCE.convert(updateReqVO); OwnerDO updateObj = OwnerConvert.INSTANCE.convert(updateReqVO);
@ -149,7 +150,6 @@ public class OwnerServiceImpl implements OwnerService {
private void validateLocationForCreateOrUpdate(Long id, String code,String shortName,String available) { private void validateLocationForCreateOrUpdate(Long id, String code,String shortName,String available) {
// 关闭数据权限,避免因为没有数据权限,查询不到数据,进而导致唯一校验不正确 // 关闭数据权限,避免因为没有数据权限,查询不到数据,进而导致唯一校验不正确
DataPermissionUtils.executeIgnore(() -> { DataPermissionUtils.executeIgnore(() -> {
validateOwnerExists(id);
validateCodeExists(code); validateCodeExists(code);
// 校验code唯一 // 校验code唯一
validateShortNameExists(shortName); validateShortNameExists(shortName);

6
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/process/ProcessServiceImpl.java

@ -56,7 +56,8 @@ public class ProcessServiceImpl implements ProcessService {
@Override @Override
public void updateProcess(ProcessUpdateReqVO updateReqVO) { public void updateProcess(ProcessUpdateReqVO updateReqVO) {
// 校验存在 // 校验存在
validateProcessForUpdate(updateReqVO.getId(),updateReqVO.getCode(),updateReqVO.getWorkshopCode(), updateReqVO.getProductionLineCode(),updateReqVO.getAvailable()); validateProcessExists(updateReqVO.getId());
validateProcessForUpdate(updateReqVO.getCode(),updateReqVO.getWorkshopCode(), updateReqVO.getProductionLineCode(),updateReqVO.getAvailable());
// 更新 // 更新
ProcessDO updateObj = ProcessConvert.INSTANCE.convert(updateReqVO); ProcessDO updateObj = ProcessConvert.INSTANCE.convert(updateReqVO);
processMapper.updateById(updateObj); processMapper.updateById(updateObj);
@ -152,10 +153,9 @@ public class ProcessServiceImpl implements ProcessService {
}); });
} }
private void validateProcessForUpdate(Long id, String code,String workshopCode,String productionLineCode,String available) { private void validateProcessForUpdate(String code,String workshopCode,String productionLineCode,String available) {
// 关闭数据权限,避免因为没有数据权限,查询不到数据,进而导致唯一校验不正确 // 关闭数据权限,避免因为没有数据权限,查询不到数据,进而导致唯一校验不正确
DataPermissionUtils.executeIgnore(() -> { DataPermissionUtils.executeIgnore(() -> {
validateProcessExists(id);
validateCodeExists(code); validateCodeExists(code);
validateWorkShopeCodeExists(workshopCode); validateWorkShopeCodeExists(workshopCode);
validateProductionLineCodeExists(productionLineCode); validateProductionLineCodeExists(productionLineCode);

7
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/project/ProjectServiceImpl.java

@ -59,6 +59,7 @@ public class ProjectServiceImpl implements ProjectService {
} }
@Override @Override
public void updateProject(ProjectUpdateReqVO updateReqVO) { public void updateProject(ProjectUpdateReqVO updateReqVO) {
validateProjectExists(updateReqVO.getId());
// 校验存在 // 校验存在
validateProjectForCreateOrUpdate(updateReqVO.getCode(),updateReqVO.getCustomerCode(),updateReqVO.getAvailable()); validateProjectForCreateOrUpdate(updateReqVO.getCode(),updateReqVO.getCustomerCode(),updateReqVO.getAvailable());
// 更新 // 更新
@ -155,10 +156,8 @@ public class ProjectServiceImpl implements ProjectService {
}); });
} }
private void validateProjectExists(Long id) { private void validateProjectExists(Long id) {
if (id == null) { ProjectDO projectDO = projectMapper.selectById(id);
return; if (projectDO == null) {
}
if (projectMapper.selectById(id) == null) {
throw exception(PROJECT_NOT_EXISTS); throw exception(PROJECT_NOT_EXISTS);
} }
} }

7
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/purchaseprice/PurchasepriceServiceImpl.java

@ -63,6 +63,7 @@ public class PurchasepriceServiceImpl implements PurchasepriceService {
@Override @Override
public void updatePurchaseprice(PurchasepriceUpdateReqVO updateReqVO) { public void updatePurchaseprice(PurchasepriceUpdateReqVO updateReqVO) {
// 校验存在 // 校验存在
validatePurchasepriceExists(updateReqVO.getId());
validatePurchasepriceForCreateOrUpdate(updateReqVO.getSupplierCode(), updateReqVO.getItemCode() validatePurchasepriceForCreateOrUpdate(updateReqVO.getSupplierCode(), updateReqVO.getItemCode()
, updateReqVO.getCurrency(), updateReqVO.getPrice(), updateReqVO.getAvailable()); , updateReqVO.getCurrency(), updateReqVO.getPrice(), updateReqVO.getAvailable());
// 更新 // 更新
@ -180,10 +181,8 @@ public class PurchasepriceServiceImpl implements PurchasepriceService {
} }
private void validatePurchasepriceExists(Long id) { private void validatePurchasepriceExists(Long id) {
if (id == null) { PurchasepriceDO purchasepriceDO = purchasepriceMapper.selectById(id);
return; if (purchasepriceDO == null) {
}
if (purchasepriceMapper.selectById(id) == null) {
throw exception(PURCHASEPRICE_NOT_EXISTS); throw exception(PURCHASEPRICE_NOT_EXISTS);
} }
} }

7
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/saleprice/SalepriceServiceImpl.java

@ -176,7 +176,6 @@ public class SalepriceServiceImpl implements SalepriceService {
private void validateSalepriceForCreateOrUpdate(Long id, String customercode, String itemcode, String currency, BigDecimal price, String available) { private void validateSalepriceForCreateOrUpdate(Long id, String customercode, String itemcode, String currency, BigDecimal price, String available) {
// 关闭数据权限,避免因为没有数据权限,查询不到数据,进而导致唯一校验不正确 // 关闭数据权限,避免因为没有数据权限,查询不到数据,进而导致唯一校验不正确
DataPermissionUtils.executeIgnore(() -> { DataPermissionUtils.executeIgnore(() -> {
validateSalepriceExists(id);
// 校验code唯一 // 校验code唯一
validateCustomerCodeExists(customercode); validateCustomerCodeExists(customercode);
validateCodeExists(itemcode,customercode); validateCodeExists(itemcode,customercode);
@ -189,10 +188,8 @@ public class SalepriceServiceImpl implements SalepriceService {
@VisibleForTesting @VisibleForTesting
private void validateSalepriceExists(Long id) { private void validateSalepriceExists(Long id) {
if (id == null) { SalepriceDO salepriceDO = salepriceMapper.selectById(id);
return; if (salepriceDO == null) {
}
if (salepriceMapper.selectById(id) == null) {
throw exception(SALEPRICE_NOT_EXISTS); throw exception(SALEPRICE_NOT_EXISTS);
} }
} }

2
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/shift/ShiftServiceImpl.java

@ -53,6 +53,7 @@ public class ShiftServiceImpl implements ShiftService {
@Override @Override
public void updateShift(ShiftUpdateReqVO updateReqVO) { public void updateShift(ShiftUpdateReqVO updateReqVO) {
// 校验存在 // 校验存在
validateShiftExists(updateReqVO.getId());
validateShiftForCreateOrUpdate(updateReqVO.getId(),updateReqVO.getCode(),updateReqVO.getBeginTime(),updateReqVO.getEntTime(),updateReqVO.getEndAtNextDay(), validateShiftForCreateOrUpdate(updateReqVO.getId(),updateReqVO.getCode(),updateReqVO.getBeginTime(),updateReqVO.getEntTime(),updateReqVO.getEndAtNextDay(),
updateReqVO.getAvailable()); updateReqVO.getAvailable());
// 更新 // 更新
@ -175,7 +176,6 @@ public class ShiftServiceImpl implements ShiftService {
String available) { String available) {
// 关闭数据权限,避免因为没有数据权限,查询不到数据,进而导致唯一校验不正确 // 关闭数据权限,避免因为没有数据权限,查询不到数据,进而导致唯一校验不正确
DataPermissionUtils.executeIgnore(() -> { DataPermissionUtils.executeIgnore(() -> {
validateShiftExists(id);
// 校验code唯一 // 校验code唯一
validateCodeExists(code); validateCodeExists(code);
validateBeginTimeExists(begintime); validateBeginTimeExists(begintime);

8
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/supplier/SupplierServiceImpl.java

@ -51,6 +51,7 @@ public class SupplierServiceImpl implements SupplierService {
@Override @Override
public void updateSupplier(SupplierUpdateReqVO updateReqVO) { public void updateSupplier(SupplierUpdateReqVO updateReqVO) {
validateSupplierExists(updateReqVO.getId());
// 校验存在 // 校验存在
//validateSupplierForCreateOrUpdate(updateReqVO.getId(), updateReqVO.getCode(), updateReqVO.getShortName(), updateReqVO.getAvailable()); //validateSupplierForCreateOrUpdate(updateReqVO.getId(), updateReqVO.getCode(), updateReqVO.getShortName(), updateReqVO.getAvailable());
SupplierDO supplierDO = supplierMapper.selectById(updateReqVO.getId()); SupplierDO supplierDO = supplierMapper.selectById(updateReqVO.getId());
@ -155,7 +156,6 @@ public class SupplierServiceImpl implements SupplierService {
private void validateSupplierForCreateOrUpdate(Long id, String code, String shortname, String available) { private void validateSupplierForCreateOrUpdate(Long id, String code, String shortname, String available) {
// 关闭数据权限,避免因为没有数据权限,查询不到数据,进而导致唯一校验不正确 // 关闭数据权限,避免因为没有数据权限,查询不到数据,进而导致唯一校验不正确
DataPermissionUtils.executeIgnore(() -> { DataPermissionUtils.executeIgnore(() -> {
validateSupplierExists(id);
// 校验code唯一 // 校验code唯一
validateCodeExists(code); validateCodeExists(code);
validateShortnameExists(shortname); validateShortnameExists(shortname);
@ -165,10 +165,8 @@ public class SupplierServiceImpl implements SupplierService {
@VisibleForTesting @VisibleForTesting
private void validateSupplierExists(Long id) { private void validateSupplierExists(Long id) {
if (id == null) { SupplierDO supplierDO = supplierMapper.selectById(id);
return; if (supplierDO == null) {
}
if (supplierMapper.selectById(id) == null) {
throw exception(SUPPLIER_NOT_EXISTS); throw exception(SUPPLIER_NOT_EXISTS);
} }
} }

8
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/supplieritem/SupplieritemServiceImpl.java

@ -64,6 +64,7 @@ public class SupplieritemServiceImpl implements SupplieritemService {
@Override @Override
public void updateSupplieritem(SupplieritemUpdateReqVO updateReqVO) { public void updateSupplieritem(SupplieritemUpdateReqVO updateReqVO) {
// 校验存在 // 校验存在
validateSupplieritemExists(updateReqVO.getId());
// validateSupplieriteamForCreateOrUpdate(updateReqVO.getId(),updateReqVO.getSupplierCode(), // validateSupplieriteamForCreateOrUpdate(updateReqVO.getId(),updateReqVO.getSupplierCode(),
// updateReqVO.getItemCode(),updateReqVO.getPackUnit(),updateReqVO.getPackQty(),updateReqVO.getAvailable(),updateReqVO.getPackQtyOfContainer()); // updateReqVO.getItemCode(),updateReqVO.getPackUnit(),updateReqVO.getPackQty(),updateReqVO.getAvailable(),updateReqVO.getPackQtyOfContainer());
SupplieritemDO supplieritemDO = supplieritemMapper.selectById(updateReqVO.getId()); SupplieritemDO supplieritemDO = supplieritemMapper.selectById(updateReqVO.getId());
@ -173,7 +174,6 @@ public class SupplieritemServiceImpl implements SupplieritemService {
String available) { String available) {
// 关闭数据权限,避免因为没有数据权限,查询不到数据,进而导致唯一校验不正确 // 关闭数据权限,避免因为没有数据权限,查询不到数据,进而导致唯一校验不正确
DataPermissionUtils.executeIgnore(() -> { DataPermissionUtils.executeIgnore(() -> {
validateSupplieritemExists(id);
// 校验code唯一 // 校验code唯一
validateItemCodeExists(itemcode); validateItemCodeExists(itemcode);
validateSupperCodeExists(suppliercode); validateSupperCodeExists(suppliercode);
@ -184,10 +184,8 @@ public class SupplieritemServiceImpl implements SupplieritemService {
} }
@VisibleForTesting @VisibleForTesting
private void validateSupplieritemExists(Long id) { private void validateSupplieritemExists(Long id) {
if (id == null) { SupplieritemDO supplieritemDO = supplieritemMapper.selectById(id);
return; if (supplieritemDO == null) {
}
if (supplieritemMapper.selectById(id) == null) {
throw exception(SUPPLIERITEM_NOT_EXISTS); throw exception(SUPPLIERITEM_NOT_EXISTS);
} }
} }

1
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/systemcalendar/SystemcalendarServiceImpl.java

@ -44,6 +44,7 @@ public class SystemcalendarServiceImpl implements SystemcalendarService {
@Override @Override
public void updateSystemcalendar(SystemcalendarUpdateReqVO updateReqVO) { public void updateSystemcalendar(SystemcalendarUpdateReqVO updateReqVO) {
// 校验存在 // 校验存在
validateSystemcalendarExists(updateReqVO.getId());
validateSystemcalendarForCreateOrUpdate(updateReqVO.getId(),updateReqVO.getModule(),updateReqVO.getAvailable()); validateSystemcalendarForCreateOrUpdate(updateReqVO.getId(),updateReqVO.getModule(),updateReqVO.getAvailable());
// 更新 // 更新
SystemcalendarDO updateObj = SystemcalendarConvert.INSTANCE.convert(updateReqVO); SystemcalendarDO updateObj = SystemcalendarConvert.INSTANCE.convert(updateReqVO);

2
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/team/TeamServiceImpl.java

@ -52,6 +52,7 @@ public class TeamServiceImpl implements TeamService {
@Override @Override
public void updateTeam(TeamUpdateReqVO updateReqVO) { public void updateTeam(TeamUpdateReqVO updateReqVO) {
// 校验存在 // 校验存在
validateTeamExists(updateReqVO.getId());
validateTeamForCreateOrUpdate(updateReqVO.getId(),updateReqVO.getCode(),updateReqVO.getAvailable()); validateTeamForCreateOrUpdate(updateReqVO.getId(),updateReqVO.getCode(),updateReqVO.getAvailable());
// 更新 // 更新
TeamDO updateObj = TeamConvert.INSTANCE.convert(updateReqVO); TeamDO updateObj = TeamConvert.INSTANCE.convert(updateReqVO);
@ -157,7 +158,6 @@ public class TeamServiceImpl implements TeamService {
private void validateTeamForCreateOrUpdate(Long id, String code, String available) { private void validateTeamForCreateOrUpdate(Long id, String code, String available) {
// 关闭数据权限,避免因为没有数据权限,查询不到数据,进而导致唯一校验不正确 // 关闭数据权限,避免因为没有数据权限,查询不到数据,进而导致唯一校验不正确
DataPermissionUtils.executeIgnore(() -> { DataPermissionUtils.executeIgnore(() -> {
validateTeamExists(id);
// 校验code唯一 // 校验code唯一
validateCodeExists(id,code); validateCodeExists(id,code);
validateAvailableExists(available); validateAvailableExists(available);

1
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/warehouse/WarehouseServiceImpl.java

@ -55,6 +55,7 @@ public class WarehouseServiceImpl implements WarehouseService {
@Override @Override
public void updateWarehouse(WarehouseUpdateReqVO updateReqVO) { public void updateWarehouse(WarehouseUpdateReqVO updateReqVO) {
// 校验存在 // 校验存在
validateWarehouseExists(updateReqVO.getId());
validateWarehouseForCreateOrUpdate(updateReqVO.getCode(),updateReqVO.getAvailable()); validateWarehouseForCreateOrUpdate(updateReqVO.getCode(),updateReqVO.getAvailable());
// 更新 // 更新
WarehouseDO updateObj = WarehouseConvert.INSTANCE.convert(updateReqVO); WarehouseDO updateObj = WarehouseConvert.INSTANCE.convert(updateReqVO);

1
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/workshop/WorkshopServiceImpl.java

@ -52,6 +52,7 @@ public class WorkshopServiceImpl implements WorkshopService {
@Override @Override
public void updateWorkshop(WorkshopUpdateReqVO updateReqVO) { public void updateWorkshop(WorkshopUpdateReqVO updateReqVO) {
// 校验存在 // 校验存在
validateWorkshopExists(updateReqVO.getId());
validateWorkshopForCreateOrUpdate(updateReqVO.getCode(),updateReqVO.getAvailable()); validateWorkshopForCreateOrUpdate(updateReqVO.getCode(),updateReqVO.getAvailable());
// 更新 // 更新
WorkshopDO updateObj = WorkshopConvert.INSTANCE.convert(updateReqVO); WorkshopDO updateObj = WorkshopConvert.INSTANCE.convert(updateReqVO);

2
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/workstation/WorkstationServiceImpl.java

@ -68,9 +68,9 @@ public class WorkstationServiceImpl implements WorkstationService {
@Override @Override
public void updateWorkstation(WorkstationUpdateReqVO updateReqVO) { public void updateWorkstation(WorkstationUpdateReqVO updateReqVO) {
validateWorkstationForCreateOrUpdate(updateReqVO.getCode(),updateReqVO.getWorkshopCode(),updateReqVO.getProductionLineCode(),updateReqVO.getAvailable(),updateReqVO.getRawLocationCode(),updateReqVO.getFgLocationCode());
// 校验存在 // 校验存在
validateWorkstationExists(updateReqVO.getId()); validateWorkstationExists(updateReqVO.getId());
validateWorkstationForCreateOrUpdate(updateReqVO.getCode(),updateReqVO.getWorkshopCode(),updateReqVO.getProductionLineCode(),updateReqVO.getAvailable(),updateReqVO.getRawLocationCode(),updateReqVO.getFgLocationCode());
// 更新 // 更新
WorkstationDO updateObj = WorkstationConvert.INSTANCE.convert(updateReqVO); WorkstationDO updateObj = WorkstationConvert.INSTANCE.convert(updateReqVO);
workstationMapper.updateById(updateObj); workstationMapper.updateById(updateObj);

Loading…
Cancel
Save