| | |
| | | @Autowired |
| | | SysErrorService sysErrorService; |
| | | |
| | | public Boolean saveMaterialStore(Map<String,Object> object) { |
| | | boolean saveState = true; |
| | | public String saveMaterialStore(Map<String,Object> object) { |
| | | String saveState = "true"; |
| | | //设置回滚点 |
| | | Object savePoint = TransactionAspectSupport.currentTransactionStatus().createSavepoint(); |
| | | try { |
| | |
| | | } |
| | | DecimalFormat decimalFormat = new DecimalFormat("#0.00"); |
| | | singlePieceArea= Double.parseDouble(decimalFormat.format(width * height / 100000)); |
| | | if(Long.parseLong(id)>0){ |
| | | materialStoreMapper.updateMaterialStore(type,json, Long.valueOf(id)); |
| | | if (Objects.equals(type, "原片")){ |
| | | materialInventoryMapper.updateMaterialInventoryArea(Long.valueOf(id),singlePieceArea); |
| | | Integer jsonCount=materialStoreMapper.selectMaterialStoreJson(json); |
| | | if(jsonCount==0){ |
| | | if(Long.parseLong(id)>0){ |
| | | materialStoreMapper.updateMaterialStore(type,json, Long.valueOf(id)); |
| | | if (Objects.equals(type, "原片")){ |
| | | materialInventoryMapper.updateMaterialInventoryArea(Long.valueOf(id),singlePieceArea); |
| | | } |
| | | }else{ |
| | | materialStoreMapper.insertMaterialStore(type,json); |
| | | } |
| | | }else{ |
| | | materialStoreMapper.insertMaterialStore(type,json); |
| | | saveState = "false1"; |
| | | } |
| | | |
| | | } catch (Exception e) { |
| | | TransactionAspectSupport.currentTransactionStatus().rollbackToSavepoint(savePoint); |
| | | //将异常传入数据库 |
| | |
| | | sysError.setError(e+Arrays.toString(e.getStackTrace())); |
| | | sysError.setFunc("saveMaterialStore"); |
| | | sysErrorService.insert(sysError); |
| | | saveState = false; |
| | | saveState = "false"; |
| | | |
| | | } |
| | | return saveState; |
| | |
| | | return map; |
| | | } |
| | | |
| | | public Boolean deleteMaterialStore(Map<String,Object> object) { |
| | | boolean saveState = true; |
| | | public String deleteMaterialStore(Map<String,Object> object) { |
| | | String saveState = "true"; |
| | | //设置回滚点 |
| | | Object savePoint = TransactionAspectSupport.currentTransactionStatus().createSavepoint(); |
| | | try { |
| | |
| | | id = object.get("id").toString(); |
| | | } |
| | | if(id!=null){ |
| | | materialStoreMapper.deleteMaterialStore(Long.valueOf(id)); |
| | | Integer materialCount=materialStoreMapper.selectMaterialStore(Long.valueOf(id)); |
| | | if(materialCount==0){ |
| | | materialStoreMapper.deleteMaterialStore(Long.valueOf(id)); |
| | | }else{ |
| | | saveState="false1"; |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | sysError.setError(e+Arrays.toString(e.getStackTrace())); |
| | | sysError.setFunc("deleteMaterialStore"); |
| | | sysErrorService.insert(sysError); |
| | | saveState = false; |
| | | saveState = "false"; |
| | | |
| | | } |
| | | return saveState; |