| | |
| | | import com.panzhihua.common.model.dtos.property.CommonPage; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.community.warehouse.ComActWarehouseApplyVO; |
| | | import com.panzhihua.common.model.vos.community.warehouse.ComActWarehouseOperationVO; |
| | | import com.panzhihua.service_community.dao.ComActWarehouseDonatesDao; |
| | | import com.panzhihua.service_community.dao.ComActWarehouseOperationDao; |
| | | import com.panzhihua.service_community.dao.ComPbServiceTeamDao; |
| | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Override |
| | | public R update(ComActWarehouseApply comActWarehouseApply) { |
| | | ComActWarehouseApplyVO comActWarehouseApply1=this.comActWarehouseApplyDao.selectById(comActWarehouseApply.getId()); |
| | | if(comActWarehouseApply.getStatus().equals(ComActWarehouseApplyVO.status.ylq)){ |
| | | ComActWarehouseDonates comActWarehouseDonates=this.comActWarehouseDonatesDao.selectById(comActWarehouseApply.getGoodsId()); |
| | | if(comActWarehouseDonates!=null&&comActWarehouseDonates.getSurplusQuantity()>0){ |
| | | comActWarehouseDonates.setSurplusQuantity(comActWarehouseDonates.getSurplusQuantity()-1); |
| | | ComActWarehouseDonates comActWarehouseDonates=this.comActWarehouseDonatesDao.selectById(comActWarehouseApply1.getGoodsId()); |
| | | if(comActWarehouseDonates!=null&&comActWarehouseDonates.getSurplusQuantity()>=comActWarehouseApply1.getGoodsNum()){ |
| | | comActWarehouseDonates.setSurplusQuantity(comActWarehouseDonates.getSurplusQuantity()-comActWarehouseApply1.getGoodsNum()); |
| | | this.comActWarehouseDonatesDao.updateById(comActWarehouseDonates); |
| | | ComActWarehouseOperation comActWarehouseOperation=new ComActWarehouseOperation(); |
| | | comActWarehouseOperation.setGoodsId(comActWarehouseApply.getGoodsId()); |
| | | comActWarehouseOperation.setGoodsId(comActWarehouseApply1.getGoodsId()); |
| | | comActWarehouseOperation.setCreateTime(new Date()); |
| | | comActWarehouseOperation.setContent("爱心传递给了"+comActWarehouseApply.getApplyName().charAt(0)+"**,"+"减少了"+comActWarehouseApply.getReason()+"的困难,谢谢你的帮助"); |
| | | comActWarehouseOperation.setType(ComActWarehouseOperation.type.xs); |
| | | comActWarehouseOperation.setApplyId(comActWarehouseApply.getId()); |
| | | this.comActWarehouseOperationDao.insert(comActWarehouseOperation); |
| | | } |
| | | else { |