20220905-zc1

zhc4dev
lenovo 2 years ago
parent 027b79f53a
commit 11ce9857b9
  1. 52
      jeecg-boot/jeecg-boot-module-erp/src/main/java/org/jeecg/modules/demo/fabric/service/impl/ZyFabricServiceImpl.java

@ -344,7 +344,7 @@ public class ZyFabricServiceImpl extends ServiceImpl<ZyFabricMapper, ZyFabric> i
String fabricId = zyAddFabricVo.getZyFabricId(); String fabricId = zyAddFabricVo.getZyFabricId();
Integer count = zyAddFabricVo.getCount(); Integer count = zyAddFabricVo.getCount();
ZyFabric zyFabric = this.getById(fabricId); ZyFabric zyFabric = this.getById(fabricId);
zyFabric.setStore(zyFabric.getStore()+count); // zyFabric.setStore(zyFabric.getStore()+count);
// zyFabricMapper.addFabricCount(fabricId, count); // zyFabricMapper.addFabricCount(fabricId, count);
UpdateWrapper<ZyFabric> updateWrapper = new UpdateWrapper<>(); UpdateWrapper<ZyFabric> updateWrapper = new UpdateWrapper<>();
updateWrapper.eq("id", fabricId); updateWrapper.eq("id", fabricId);
@ -362,18 +362,18 @@ public class ZyFabricServiceImpl extends ServiceImpl<ZyFabricMapper, ZyFabric> i
Integer count = zyAddFabricVo.getCount(); Integer count = zyAddFabricVo.getCount();
// zyFabricMapper.deleteFabricCount(fabricId, count); // zyFabricMapper.deleteFabricCount(fabricId, count);
ZyFabric zyFabric = this.getById(fabricId); ZyFabric zyFabric = this.getById(fabricId);
zyFabric.setStore(zyFabric.getStore()-count); // zyFabric.setStore(zyFabric.getStore()-count);
if (zyFabric.getStore() < 0) { // if (zyFabric.getStore() < 0) {
try { // try {
throw new Exception(); // throw new Exception();
} catch (Exception e) { // } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); // TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return false; // return false;
} finally { // } finally {
return false; // return false;
} // }
} // }
UpdateWrapper<ZyFabric> updateWrapper = new UpdateWrapper<>(); UpdateWrapper<ZyFabric> updateWrapper = new UpdateWrapper<>();
updateWrapper.eq("id", fabricId); updateWrapper.eq("id", fabricId);
@ -389,7 +389,7 @@ public class ZyFabricServiceImpl extends ServiceImpl<ZyFabricMapper, ZyFabric> i
String fabricId = zyOrderFabric.getFabricId(); String fabricId = zyOrderFabric.getFabricId();
Integer count = zyOrderFabric.getOrderCount(); Integer count = zyOrderFabric.getOrderCount();
ZyFabric zyFabric = this.getById(fabricId); ZyFabric zyFabric = this.getById(fabricId);
zyFabric.setStore(zyFabric.getStore()+count); // zyFabric.setStore(zyFabric.getStore()+count);
// zyFabricMapper.addFabricCount(fabricId, count); // zyFabricMapper.addFabricCount(fabricId, count);
UpdateWrapper<ZyFabric> updateWrapper = new UpdateWrapper<>(); UpdateWrapper<ZyFabric> updateWrapper = new UpdateWrapper<>();
updateWrapper.eq("id", fabricId); updateWrapper.eq("id", fabricId);
@ -407,18 +407,18 @@ public class ZyFabricServiceImpl extends ServiceImpl<ZyFabricMapper, ZyFabric> i
Integer count = zyOrderFabric.getOrderCount(); Integer count = zyOrderFabric.getOrderCount();
// zyFabricMapper.deleteFabricCount(fabricId, count); // zyFabricMapper.deleteFabricCount(fabricId, count);
ZyFabric zyFabric = this.getById(fabricId); ZyFabric zyFabric = this.getById(fabricId);
zyFabric.setStore(zyFabric.getStore()-count); // zyFabric.setStore(zyFabric.getStore()-count);
if (zyFabric.getStore() < 0) { // if (zyFabric.getStore() < 0) {
try { // try {
throw new Exception(); // throw new Exception();
} catch (Exception e) { // } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); // TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return false; // return false;
} finally { // } finally {
return false; // return false;
} // }
} // }
UpdateWrapper<ZyFabric> updateWrapper = new UpdateWrapper<>(); UpdateWrapper<ZyFabric> updateWrapper = new UpdateWrapper<>();
updateWrapper.eq("id", fabricId); updateWrapper.eq("id", fabricId);

Loading…
Cancel
Save