| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.by4cloud.platformx.common.core.util.R; |
| | | import com.by4cloud.platformx.device.constant.CommonStatusContant; |
| | | import com.by4cloud.platformx.device.constant.MaxSizeContant; |
| | | import com.by4cloud.platformx.device.dto.ReceivingNoteQueryDTO; |
| | | import com.by4cloud.platformx.device.entity.*; |
| | |
| | | for (ReceivingNoteItem item:entity.getNoteItemList() |
| | | ) { |
| | | if (contractItem.getDeviceId().equals(item.getDeviceId())){ |
| | | if (contractItem.getNum()>=item.getNum()) { |
| | | if (contractItem.getNum() < item.getNum()) { |
| | | return R.failed("验收明细中"+item.getDeviceName()+"设备数量不能超过合同明细中签订的设备数量"); |
| | | } |
| | | //查询是否有历史验收 |
| | | QueryWrapper<ReceivingNoteItem> queryWrapperNoteItem = new QueryWrapper<>(); |
| | | queryWrapperNoteItem.eq("contract_id",contract.getId()); |
| | | queryWrapperNoteItem.eq("device_id",contractItem.getDeviceId()); |
| | | List<ReceivingNoteItem> noteItemList = itemMapper.selectList(queryWrapperNoteItem); |
| | | if (noteItemList != null&¬eItemList.size()>0) { |
| | | Integer deviceNum = noteItemList.stream().mapToInt(ReceivingNoteItem::getNum).sum(); |
| | | if (contractItem.getNum()>=(item.getNum()+deviceNum)) { |
| | | return R.failed("合同中"+item.getDeviceName()+"设备数量与实际验收明细中不一致"); |
| | | } |
| | | Integer deviceNum = itemMapper.selectDeviceNumByContractId(contractItem.getContractId(),item.getDeviceId()); |
| | | if (contractItem.getNum()<(deviceNum+item.getNum())){ |
| | | return R.failed("实际验收明细中"+item.getDeviceName()+"设备数量不能超过合同明细中签订的设备数量"); |
| | | } |
| | | } |
| | | //设备序列号检查是否有相同的存在 |
| | |
| | | inventory.setName(device.getName()); |
| | | inventory.setSerialNo(serialNo); |
| | | if (contract!=null&&(contract.getType()==1||contract.getType()==2)){ |
| | | inventory.setSource(1); |
| | | inventory.setInventoryStatus(1); |
| | | inventory.setSource(CommonStatusContant.DEVICE_INVENTORY_RESOURCE_WAREHOUSE); |
| | | inventory.setInventoryStatus(CommonStatusContant.DEVICE_INVENTORY_USABLE); |
| | | } |
| | | if (contract!=null&&contract.getType()==0){ |
| | | inventory.setSource(1); |
| | | inventory.setInventoryStatus(2); |
| | | inventory.setSource(CommonStatusContant.DEVICE_INVENTORY_RESOURCE_WAREHOUSE); |
| | | inventory.setInventoryStatus(CommonStatusContant.DEVICE_INVENTORY_RENTING); |
| | | } |
| | | inventoryMapper.insert(inventory); |
| | | //设备库存流水同步新增 |
| | |
| | | flowWater.setOperateType(2); |
| | | } |
| | | if (contract!=null&&contract.getType()==0){ |
| | | flowWater.setOperateType(1); |
| | | flowWater.setOperateType(CommonStatusContant.DEVICE_INVENTORY_FLOW_WATER_OUT); |
| | | } |
| | | inventoryFlowWaterMapper.insert(flowWater); |
| | | } |
| | |
| | | //合同明细中与实际验收对比 |
| | | for (ContractItem contractItem:list |
| | | ) { |
| | | //查询实际验收情况 |
| | | QueryWrapper<ReceivingNoteItem> queryWrapperNoteItem = new QueryWrapper<>(); |
| | | queryWrapperNoteItem.eq("contract_id",contract.getId()); |
| | | queryWrapperNoteItem.eq("device_id",contractItem.getDeviceId()); |
| | | List<ReceivingNoteItem> noteItemList = itemMapper.selectList(queryWrapperNoteItem); |
| | | if (noteItemList != null&¬eItemList.size()>0) { |
| | | Integer deviceNum = noteItemList.stream().mapToInt(ReceivingNoteItem::getNum).sum(); |
| | | if (contractItem.getNum()!=deviceNum) { |
| | | return R.ok(); |
| | | } |
| | | }else { |
| | | Integer deviceNum = itemMapper.selectDeviceNumByContractId(contractItem.getContractId(),contractItem.getDeviceId()); |
| | | if (contractItem.getNum()!=deviceNum){ |
| | | return R.ok(); |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | Long l1= 1905442028714270722l; |
| | | long l2 = 1905442028714270722l; |
| | | System.out.println(l1==l2); |
| | | int l1= 2; |
| | | int l2 = 3; |
| | | System.out.println(l1>=l2); |
| | | } |
| | | } |