liujie
15 小时以前 7e47eb88973dda29fdce1fae755e5ce899bcc504
诊所erp
3个文件已修改
56 ■■■■ 已修改文件
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpGoodsServiceImpl.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpProcurementServiceImpl.java 31 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/resources/mapper/system/TErpClinicWarehousingMapper.xml 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpGoodsServiceImpl.java
@@ -164,7 +164,7 @@
    @Override
    public boolean isExit(String goodsIdCode, String quasiNumber,String id) {
        Long size = this.baseMapper.selectCount(new LambdaQueryWrapper<>(TErpGoods.class).ne(id!=null,TErpGoods::getId, id).eq(TErpGoods::getGoodsIdCode, goodsIdCode).or().eq(TErpGoods::getQuasiNumber, quasiNumber));
        Long size = this.baseMapper.selectCount(new LambdaQueryWrapper<>(TErpGoods.class).ne(id!=null,TErpGoods::getId, id).and(q -> q.eq(TErpGoods::getGoodsIdCode, goodsIdCode).or().eq(TErpGoods::getQuasiNumber, quasiNumber)));
        if (size > 0) {
            return true;
        }
@@ -367,6 +367,18 @@
        }
        wrapper.orderByDesc(BaseModel::getCreateTime);
        Page<TErpGoods> page = this.page(new Page<>(query.getPageNum(), query.getPageSize()), wrapper);
        List<TErpGoods> records = page.getRecords();
        if(records.isEmpty()){
            return page;
        }
        List<String> packingUnitId = records.stream().map(TErpGoods::getPackingUnitId).collect(Collectors.toList());
        if(!packingUnitId.isEmpty()){
            List<TErpGoodsUnit> tErpGoodsUnits = erpGoodsUnitMapper.selectBatchIds(packingUnitId);
            for (TErpGoods tErpGoods : records) {
                tErpGoodsUnits.stream().filter(t -> t.getId().equals(tErpGoods.getPackingUnitId())).findFirst().ifPresent(t -> tErpGoods.setPackingUnitName(t.getUnitName()));
            }
        }
        page.setRecords( records);
        return page;
    }
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpProcurementServiceImpl.java
@@ -242,9 +242,9 @@
        }
        List<String> supplierClinicId = list.stream().filter(e->e.getGoodsSource()==1).map(TErpGoods::getSupplierClinicId).collect(Collectors.toList());
        if(!supplierClinicId.isEmpty()){
            List<TCrmClinic> crmClinics = crmClinicMapper.selectBatchIds(supplierClinicId);
            List<TCrmSupplier> crmClinics = crmSupplierMapper.selectBatchIds(supplierClinicId);
            for (TErpGoods tErpGoodsVO : list) {
                crmClinics.stream().filter(t -> t.getId().equals(tErpGoodsVO.getSupplierClinicId())).findFirst().ifPresent(t -> tErpGoodsVO.setSupplierName(t.getClinicName()));
                crmClinics.stream().filter(t -> t.getId().equals(tErpGoodsVO.getSupplierClinicId())).findFirst().ifPresent(t -> tErpGoodsVO.setSupplierName(t.getSupplierName()));
            }
        }
        pageInfo.setRecords( list);
@@ -254,6 +254,21 @@
    @Override
    public List<TErpGoodsVO> inventoryNotEnoughList(SysUser user) {
        List<TErpGoodsVO> list =  this.baseMapper.inventoryNotEnoughList(user);
        List<String> typeIds = list.stream().map(TErpGoodsVO::getTypeId).collect(Collectors.toList());
        if(!typeIds.isEmpty()){
            List<TErpGoodsType> typeList = erpGoodsTypeMapper.selectBatchIds(typeIds);
            for (TErpGoodsVO tErpGoodsVO : list) {
                typeList.stream().filter(t -> t.getId().equals(tErpGoodsVO.getTypeId())).findFirst().ifPresent(t -> tErpGoodsVO.setTypeName(t.getTypeName()));
            }
        }
        List<String> supplierClinicId = list.stream().filter(e->e.getGoodsSource()==1).map(TErpGoodsVO::getSupplierClinicId).collect(Collectors.toList());
        if(!supplierClinicId.isEmpty()){
            List<TCrmSupplier> crmSuppliers = crmSupplierMapper.selectBatchIds(supplierClinicId);
            for (TErpGoodsVO tErpGoodsVO : list) {
                crmSuppliers.stream().filter(t -> t.getId().equals(tErpGoodsVO.getSupplierClinicId())).findFirst().ifPresent(t -> tErpGoodsVO.setSupplierName(t.getSupplierName()));
            }
        }
        return list;
    }
@@ -284,7 +299,15 @@
            tErpProcurement.setTermNo(supplier.getTermNo());
            tErpProcurement.setMerchantNo(supplier.getRecvMerchantNo());
            tErpProcurement.setPayMoney(value.stream().map(AddProcurementDto::getSalesAmount).reduce(BigDecimal.ZERO, BigDecimal::add));
            tErpProcurement.setCreateId(user.getUserId().toString());
            BigDecimal all = BigDecimal.ZERO;
            for (AddProcurementDto addProcurementDto : value) {
                BigDecimal multiply = addProcurementDto.getSalesAmount().multiply(BigDecimal.valueOf(addProcurementDto.getPurchaseCount()));
                all = all.add(multiply);
            }
            tErpProcurement.setPayMoney(all);
            AddProcurementDto addProcurementDto = value.get(0);
            if(addProcurementDto.getState()!=null && addProcurementDto.getState()==1){
                tErpProcurement.setStatus(1);
@@ -317,7 +340,7 @@
                if(tErpProcurementGoods.getSupplierMoney().doubleValue()<0){
                    throw new RuntimeException("平台抽成不能大于售卖价格");
                }
                add = add.add(dto.getPlatformCommissionPrice());
                add = add.add(dto.getPlatformCommissionPrice().multiply(BigDecimal.valueOf(dto.getPurchaseCount())));
                tErpProcurementGoods1.add(tErpProcurementGoods);
            }
            BigDecimal bigDecimal = tErpProcurement.getPayMoney().multiply(BigDecimal.valueOf(0.0038)).setScale(2, RoundingMode.HALF_UP);
ruoyi-system/src/main/resources/mapper/system/TErpClinicWarehousingMapper.xml
@@ -120,15 +120,20 @@
    </select>
    <select id="warehousePageList" resultType="com.ruoyi.system.vo.TErpClinicWarehousePageListVO">
        select t1.id,t1.warehouse_no,t2.supplier_name,t3.procurement_code,t3.pay_money allTotalPrice,t1.create_time warehouseTime,t1.type
        select t1.id,t1.warehouse_no,
               case when t1.type =1 then  t2.supplier_name else t4.supplier_name end as supplierName,
              t3.procurement_code,
              case when t1.type =1 then     t3.pay_money else t1.total_price end as allTotalPrice,
            t1.create_time warehouseTime,t1.type
        from t_erp_clinic_warehousing t1 left join t_erp_procurement t3 on t1.procurement_id = t3.id
        left join t_crm_supplier t2 on t3.supplier_id = t2.id
        left join t_crm_supplier t2 on t3.supplier_id = t2.id and t1.type =1
        left join t_crm_supplier t4 on t1.supplier_id = t4.id and t1.type !=1
        where t1.disabled = 0 and t1.clinic_id = #{supplierClinicId}
        <if test="query.warehouseNo != null and query.warehouseNo != ''">
            and t1.warehouse_no like concat('%',#{query.warehouseNo},'%')
        </if>
        <if test="query.supplierName != null and query.supplierName != ''">
            and t2.supplier_name like concat('%',#{query.supplierName},'%')
            and (t2.supplier_name like concat('%',#{query.supplierName},'%') or t4.supplier_name like concat('%',#{query.supplierName},'%'))
        </if>
        <if test="sTime != null">
            and t1.create_time between #{sTime} and #{eTime}