| | |
| | | package com.fzzy.igds.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.fzzy.igds.constant.Constant; |
| | | import com.fzzy.igds.data.BaseResp; |
| | | import com.fzzy.igds.data.IgdsBaseParam; |
| | | import com.fzzy.igds.domain.PledgeContract; |
| | |
| | | if (StringUtils.isNotEmpty(param.getBankId())) { |
| | | queryWrapper.eq("pledge_bank", param.getBankId()); |
| | | } |
| | | |
| | | if (StringUtils.isNotEmpty(param.getDeptId())) { |
| | | queryWrapper.eq("pledge_dept", param.getDeptId()); |
| | | } |
| | | |
| | | //根据仓库ID匹配 |
| | | if (StringUtils.isNotEmpty(param.getDepotId())) { |
| | | queryWrapper.like("depot_ids", param.getDepotId()); |
| | | } |
| | | |
| | | queryWrapper.orderByDesc("update_time"); |
| | | |
| | | return pledgeContractMapper.selectList(queryWrapper); |
| | | } |
| | | |
| | | /** |
| | | * 根据条件查询 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | public PledgeContract getOne(String id) { |
| | | |
| | | QueryWrapper<PledgeContract> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("id", id); |
| | | return pledgeContractMapper.selectOne(queryWrapper); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据仓库ID获取质押信息 |
| | | * @param param 参数 |
| | | * @return 质押信息 |
| | | */ |
| | | public PledgeContract getByDepotId(IgdsBaseParam param) { |
| | | if (null == param) return null; |
| | | |
| | | List<PledgeContract> list = listAll(param); |
| | | |
| | | if (null == list || list.isEmpty()) return null; |
| | | |
| | | return list.get(0); |
| | | } |
| | | |
| | | public BaseResp addData(PledgeContract pledgeContract) { |
| | | if(StringUtils.isEmpty(pledgeContract.getId())){ |
| | | if (StringUtils.isEmpty(pledgeContract.getId())) { |
| | | pledgeContract.setId(ContextUtil.generateOrderId("PC")); |
| | | } |
| | | pledgeContract.setCompanyId(ContextUtil.getCompanyId()); |
| | |
| | | return pledgeContractMapper.deleteById(pledgeContract) > 0 ? BaseResp.success() : BaseResp.error("删除失败"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取质押有效期内的合同信息 |
| | | * @param curTime |
| | | * @return |
| | | */ |
| | | public List<PledgeContract> getContractByPledge(Date curTime, String bankId) { |
| | | QueryWrapper<PledgeContract> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("company_id", ContextUtil.getCompanyId()); |
| | | |
| | | //未解押 |
| | | queryWrapper.like("status", Constant.YN_N); |
| | | |
| | | //质押期间 |
| | | queryWrapper.le("pledge_start", curTime); |
| | | queryWrapper.ge("pledge_end", curTime); |
| | | if (StringUtils.isNotBlank(bankId)) { |
| | | queryWrapper.eq("pledge_bank", bankId); |
| | | } |
| | | |
| | | queryWrapper.orderByDesc("update_time"); |
| | | |
| | | return pledgeContractMapper.selectList(queryWrapper); |
| | | } |
| | | } |