| | |
| | | import com.bstek.dorado.annotation.DataProvider; |
| | | import com.bstek.dorado.annotation.DataResolver; |
| | | import com.bstek.dorado.annotation.Expose; |
| | | import com.fzzy.igds.data.IgdsBaseParam; |
| | | import com.fzzy.igds.domain.Depot; |
| | | import com.fzzy.igds.domain.PledgeContract; |
| | | import com.fzzy.igds.service.DepotService; |
| | | import com.fzzy.igds.service.PledgeContractService; |
| | | import com.fzzy.igds.utils.ContextUtil; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | @Resource |
| | | private DepotService depotService; |
| | | |
| | | @Resource |
| | | private PledgeContractService pledgeContractService; |
| | | |
| | | /** |
| | | * depotPR#getData |
| | | * |
| | | * @return |
| | | */ |
| | | @DataProvider |
| | | public List<Depot> getData(String parentId){ |
| | | if(StringUtils.isNotEmpty(parentId)){ |
| | | return depotService.getData(null,parentId,false); |
| | | public List<Depot> getData(String parentId) { |
| | | if (StringUtils.isNotEmpty(parentId)) { |
| | | return depotService.getData(null, parentId, false); |
| | | } |
| | | return depotService.getData(null, ContextUtil.subDeptId(null) ,false); |
| | | return depotService.getData(null, ContextUtil.subDeptId(null), false); |
| | | } |
| | | |
| | | /** |
| | | * depotPR#getDataByBankId |
| | | * |
| | | * @return |
| | | */ |
| | | @DataProvider |
| | | public List<Depot> getDataByBankId(String bankId) { |
| | | if (StringUtils.isNotEmpty(bankId)) { |
| | | //查询银行对应的监管仓库 |
| | | IgdsBaseParam baseParam = new IgdsBaseParam(); |
| | | baseParam.setBankId(bankId); |
| | | List<PledgeContract> pledgeContracts = pledgeContractService.listAll(baseParam); |
| | | |
| | | // 提取所有 PledgeContract 中 depot_ids 字段包含的 depot ID |
| | | List<String> validDepotIds = new ArrayList<>(); |
| | | for (PledgeContract contract : pledgeContracts) { |
| | | if (StringUtils.isNotEmpty(contract.getDepotIds())) { |
| | | // 将逗号分隔的 depot_ids 转换为 Set |
| | | String[] ids = contract.getDepotIds().split(","); |
| | | for (String id : ids) { |
| | | if (StringUtils.isNotEmpty(id.trim())) { |
| | | validDepotIds.add(id.trim()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | List<Depot> allData = depotService.getData(null, ContextUtil.subDeptId(null), false); |
| | | if (!validDepotIds.isEmpty()) { |
| | | // 过滤出在 PledgeContract.depot_ids 中出现的 depot |
| | | List<Depot> filteredData = new ArrayList<>(); |
| | | |
| | | for (Depot allDatum : allData) { |
| | | if (validDepotIds.contains(allDatum.getId())) { |
| | | filteredData.add(allDatum); |
| | | } |
| | | } |
| | | return filteredData; |
| | | } |
| | | return new ArrayList<>(); |
| | | |
| | | } |
| | | return depotService.getData(null, ContextUtil.subDeptId(null), false); |
| | | } |
| | | |
| | | /** |
| | | * depotPR#saveOrUpdate |
| | | * |
| | | * @param data |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * depotPR#deleteDepot |
| | | * |
| | | * @param data |
| | | */ |
| | | @Expose |
| | | @Transactional |
| | | public void deleteDepot(Depot data) { |
| | | public void deleteDepot(Depot data) { |
| | | Depot depot = new Depot(); |
| | | BeanUtils.copyProperties(data, depot); |
| | | depotService.deleteDepot(depot); |
| | |
| | | |
| | | /** |
| | | * ${dorado.getDataProvider("depotPR#getAllCache").getResult()} |
| | | * |
| | | * @return |
| | | */ |
| | | @DataProvider |
| | |
| | | |
| | | /** |
| | | * depotPR#ajaxGetAllCache |
| | | * |
| | | * @return |
| | | */ |
| | | @Expose |
| | |
| | | |
| | | /** |
| | | * depotPR#getDataByCompanyId |
| | | * |
| | | * @return |
| | | */ |
| | | @DataProvider |
| | | public List<Depot> getDataByCompanyId(){ |
| | | return depotService.getData(null, null ,false); |
| | | public List<Depot> getDataByCompanyId() { |
| | | return depotService.getData(null, null, false); |
| | | } |
| | | |
| | | /** |