| | |
| | | import com.fzzy.igds.constant.Constant; |
| | | import com.fzzy.igds.data.BaseResp; |
| | | import com.fzzy.igds.data.IgdsBaseParam; |
| | | import com.fzzy.igds.domain.InoutNoticeIn; |
| | | import com.fzzy.igds.domain.Depot; |
| | | import com.fzzy.igds.domain.PledgeContract; |
| | | import com.fzzy.igds.domain.PledgeContractDepot; |
| | | import com.fzzy.igds.service.DepotService; |
| | | import com.fzzy.igds.service.PledgeContractDepotService; |
| | | import com.fzzy.igds.service.PledgeContractService; |
| | | import com.fzzy.igds.utils.ContextUtil; |
| | | import com.ruoyi.common.annotation.Log; |
| | |
| | | |
| | | @Resource |
| | | private PledgeContractService pledgeContractService; |
| | | |
| | | @Resource |
| | | private PledgeContractDepotService pledgeContractDepotService; |
| | | |
| | | |
| | | @Resource |
| | | private DepotService depotService; |
| | | |
| | | /** |
| | | * pledgeContractPR#initAdd |
| | |
| | | @Transactional |
| | | @DataResolver |
| | | public BaseResp saveUpdate(PledgeContract pledgeContract) { |
| | | List<PledgeContractDepot> depotData = pledgeContract.getDepotData(); |
| | | if (depotData != null && !depotData.isEmpty()) { |
| | | pledgeContractDepotService.addDataByList(depotData); |
| | | } |
| | | if (null == pledgeContract.getCreateTime()) { |
| | | return pledgeContractService.addData(pledgeContract); |
| | | } else { |
| | |
| | | |
| | | /** |
| | | * 删除 |
| | | * pledgeContractPR#delete |
| | | * |
| | | * @param pledgeContract |
| | | * @return |
| | |
| | | result.add(new SysDictData("已解押", Constant.YN_Y)); |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 删除质押仓库 |
| | | * pledgeContractPR#deleteDepot |
| | | * |
| | | * @param pledgeContractDepot |
| | | * @return |
| | | */ |
| | | @Log(title = "质押合同", businessType = BusinessType.DELETE, bizType = BizTypeEnum.SUPERVISION) |
| | | @Expose |
| | | public BaseResp deleteDepot(PledgeContractDepot pledgeContractDepot) { |
| | | if (StringUtils.isNotEmpty(pledgeContractDepot.getId())) |
| | | return pledgeContractDepotService.deleteData(pledgeContractDepot); |
| | | return BaseResp.success(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * pledgeContractPR#listAllData |
| | | * 质押仓库列表 |
| | | */ |
| | | @DataProvider |
| | | public List<PledgeContractDepot> listAllData(String PledgeId) { |
| | | IgdsBaseParam param = new IgdsBaseParam(); |
| | | param.setCompanyId(ContextUtil.getCompanyId()); |
| | | param.setParentId(PledgeId); |
| | | return pledgeContractDepotService.listAll(param); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * pledgeContractPR#getUnplacedDepotData |
| | | * |
| | | * @return |
| | | */ |
| | | @DataProvider |
| | | public List<Depot> getUnplacedDepotData(String parentId, String PledgeId) { |
| | | List<Depot> result = new ArrayList<>(); |
| | | if (com.ruoyi.common.utils.StringUtils.isBlank(PledgeId) || com.ruoyi.common.utils.StringUtils.isBlank(parentId)) { |
| | | return result; |
| | | } |
| | | //获取收储公司下所有仓库 |
| | | List<Depot> data = depotService.getData(null, parentId, false); |
| | | |
| | | //获取已配置仓库 |
| | | IgdsBaseParam param = new IgdsBaseParam(); |
| | | param.setCompanyId(ContextUtil.getCompanyId()); |
| | | param.setParentId(PledgeId); |
| | | List<PledgeContractDepot> pledgeContractDepots = pledgeContractDepotService.listAll(param); |
| | | //遍历找出所有未配置仓库 |
| | | for (Depot depot : data) { |
| | | boolean flag = true; |
| | | for (PledgeContractDepot pledgeContractDepot : pledgeContractDepots) { |
| | | if (depot.getId().equals(pledgeContractDepot.getPledgeDepot())) { |
| | | flag = false; |
| | | break; |
| | | } |
| | | } |
| | | if (flag) { |
| | | result.add(depot); |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | } |