Merge remote-tracking branch 'origin/master'
| | |
| | | import com.ruoyi.system.dto.*; |
| | | import com.ruoyi.system.importExcel.TErpGoodsExcel; |
| | | import com.ruoyi.system.model.*; |
| | | import com.ruoyi.system.query.PageAddListQuery; |
| | | import com.ruoyi.system.query.TErpGoodsAdminQuery; |
| | | import com.ruoyi.system.query.TErpGoodsQuery; |
| | | import com.ruoyi.system.service.*; |
| | |
| | | */ |
| | | @ApiOperation(value = "诊所 一键获取商品分页列表") |
| | | @PostMapping(value = "/pageAddList") |
| | | public R<Page<TErpGoods>> pageAddList(@RequestBody BasePage query) { |
| | | public R<Page<TErpGoods>> pageAddList(@RequestBody PageAddListQuery query) { |
| | | SysUser user = tokenService.getLoginUser().getUser(); |
| | | Integer roleType = user.getRoleType(); |
| | | String clinicSupplierId=null; |
| | |
| | | } |
| | | Page<TErpGoods> tErpGoodsPage = new Page<>(query.getPageNum(), query.getPageSize()); |
| | | |
| | | Page<TErpGoods> page = erpGoodsService.page(tErpGoodsPage, new LambdaQueryWrapper<TErpGoods>().eq(TErpGoods::getGoodsSource, 1).eq(TErpGoods::getState,1).eq(BaseModel::getDisabled, 0).isNotNull(TErpGoods::getPlatformCommissionPrice).last("and (NOT FIND_IN_SET(" + clinicSupplierId + ",clinic_ids) or clinic_ids is null)")); |
| | | for (TErpGoods record : page.getRecords()) { |
| | | TCrmSupplier byId = crmSupplierService.getById(record.getSupplierClinicId()); |
| | | record.setSupplierName(byId.getSupplierName()); |
| | | |
| | | |
| | | TErpGoodsType byId1 = erpGoodsTypeService.getById(record.getTypeId()); |
| | | record.setTypeName(byId1.getTypeName()); |
| | | |
| | | } |
| | | return R.ok(page); |
| | | List<TErpGoods> page = erpGoodsService.pageAddList(tErpGoodsPage,clinicSupplierId,query); |
| | | tErpGoodsPage.setRecords(page); |
| | | return R.ok(tErpGoodsPage); |
| | | } |
| | | |
| | | /** |
| | |
| | | package com.ruoyi.system.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.system.model.TErpGoods; |
| | | import com.ruoyi.system.query.PageAddListQuery; |
| | | import com.ruoyi.system.query.TErpGoodsAdminQuery; |
| | | import com.ruoyi.system.query.TErpGoodsInventoryQuery; |
| | | import com.ruoyi.system.query.TErpGoodsQuery; |
| | |
| | | |
| | | |
| | | List<TErpGoodsVO> pageAdminList(@Param("query") TErpGoodsAdminQuery query, @Param("pageInfo") PageInfo<TErpGoodsVO> pageInfo); |
| | | |
| | | List<TErpGoods> pageAddList(@Param("tErpGoodsPage") Page<TErpGoods> tErpGoodsPage, @Param("clinicSupplierId") String clinicSupplierId, @Param("query") PageAddListQuery query); |
| | | |
| | | } |
| New file |
| | |
| | | package com.ruoyi.system.query; |
| | | |
| | | import com.ruoyi.common.core.domain.BasePage; |
| | | import io.swagger.annotations.ApiModel; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel("一键获取商品分页列表 Query") |
| | | public class PageAddListQuery extends BasePage { |
| | | private String goodsName; |
| | | |
| | | private String supplierName; |
| | | |
| | | private String typeId; |
| | | |
| | | private String quasiNumber; |
| | | } |
| | |
| | | import com.ruoyi.system.dto.InventoryDto; |
| | | import com.ruoyi.system.dto.InventoryGoodsDto; |
| | | import com.ruoyi.system.model.TErpGoods; |
| | | import com.ruoyi.system.query.TClinicGoodsWarehouseQuery; |
| | | import com.ruoyi.system.query.TErpGoodsAdminQuery; |
| | | import com.ruoyi.system.query.TErpGoodsInventoryQuery; |
| | | import com.ruoyi.system.query.TErpGoodsQuery; |
| | | import com.ruoyi.system.query.*; |
| | | import com.ruoyi.system.vo.OutboundGoodsDetailVo; |
| | | import com.ruoyi.system.vo.TErpGoodsInventoryVO; |
| | | import com.ruoyi.system.vo.TErpGoodsVO; |
| | |
| | | PageInfo<TErpGoodsVO> pageAdminList(TErpGoodsAdminQuery query); |
| | | |
| | | |
| | | List<TErpGoods> pageAddList(Page<TErpGoods> tErpGoodsPage, String clinicSupplierId, PageAddListQuery query); |
| | | |
| | | } |
| | |
| | | import com.ruoyi.system.dto.InventoryGoodsDto; |
| | | import com.ruoyi.system.mapper.*; |
| | | import com.ruoyi.system.model.*; |
| | | import com.ruoyi.system.query.TClinicGoodsWarehouseQuery; |
| | | import com.ruoyi.system.query.TErpGoodsAdminQuery; |
| | | import com.ruoyi.system.query.TErpGoodsInventoryQuery; |
| | | import com.ruoyi.system.query.TErpGoodsQuery; |
| | | import com.ruoyi.system.query.*; |
| | | import com.ruoyi.system.service.TErpGoodsService; |
| | | import com.ruoyi.system.service.TErpSupplierInventoryGoodsService; |
| | | import com.ruoyi.system.vo.*; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<TErpGoods> pageAddList(Page<TErpGoods> tErpGoodsPage, String clinicSupplierId, PageAddListQuery query) { |
| | | return this.baseMapper.pageAddList(tErpGoodsPage, clinicSupplierId, query); |
| | | } |
| | | |
| | | @Override |
| | | public List<TErpGoodsVO> listExport(TErpGoodsQuery query, SysUser user) { |
| | | List<TErpGoodsVO> list = this.baseMapper.listExport(query, user); |
| | | if (list.isEmpty()) { |
| | |
| | | |
| | | @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).and(q -> q.eq(TErpGoods::getGoodsIdCode, goodsIdCode).or().eq(TErpGoods::getQuasiNumber, quasiNumber))); |
| | | Long size = this.baseMapper.selectCount(new LambdaQueryWrapper<>(TErpGoods.class).eq(TErpGoods::getGoodsSource,1).ne(id!=null,TErpGoods::getId, id).and(q -> q.eq(TErpGoods::getGoodsIdCode, goodsIdCode).or().eq(TErpGoods::getQuasiNumber, quasiNumber))); |
| | | if (size > 0) { |
| | | return true; |
| | | } |
| | |
| | | List<String> ids = list.stream().map(TErpProcurementVo::getId).collect(Collectors.toList()); |
| | | List<TErpProcurementGoods> tErpProcurementGoods = erpProcurementGoodsMapper.selectList |
| | | (new LambdaQueryWrapper<TErpProcurementGoods>().in(TErpProcurementGoods::getProcurementId, ids)); |
| | | List<TSysCommission> tSysCommissions = new ArrayList<>(); |
| | | if (!tErpProcurementGoods.isEmpty()) { |
| | | List<String> collect = tErpProcurementGoods.stream().map(TErpProcurementGoods::getId).collect(Collectors.toList()); |
| | | tSysCommissions = sysCommissionMapper.selectList(new LambdaQueryWrapper<TSysCommission>().in(TSysCommission::getTErpProcurementGoodsId, collect)); |
| | | } |
| | | //// List<TSysCommission> tSysCommissions = new ArrayList<>(); |
| | | // if (!tErpProcurementGoods.isEmpty()) { |
| | | //// List<String> collect = tErpProcurementGoods.stream().map(TErpProcurementGoods::getId).collect(Collectors.toList()); |
| | | //// tSysCommissions = sysCommissionMapper.selectList(new LambdaQueryWrapper<TSysCommission>().in(TSysCommission::getTErpProcurementGoodsId, collect)); |
| | | // } |
| | | for (TErpProcurementVo tErpProcurementVo : list) { |
| | | List<TErpProcurementGoods> collect = tErpProcurementGoods.stream().filter(e -> e.getProcurementId().equals(tErpProcurementVo.getId())).collect(Collectors.toList()); |
| | | int size = collect.stream().map(TErpProcurementGoods::getGoodsId).collect(Collectors.toSet()).size(); |
| | | tErpProcurementVo.setTypeNum(size); |
| | | BigDecimal reduce = collect.stream().map(TErpProcurementGoods::getTotalPrice).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | tErpProcurementVo.setTotalPrice(reduce); |
| | | if (!collect.isEmpty()) { |
| | | List<String> collect1 = collect.stream().map(TErpProcurementGoods::getId).collect(Collectors.toList()); |
| | | List<TSysCommission> collect2 = tSysCommissions.stream().filter(e -> collect1.contains(e.getTErpProcurementGoodsId())).collect(Collectors.toList()); |
| | | BigDecimal reduce1 = collect2.stream().filter(e -> e.getType() == 1).map(TSysCommission::getMoney).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal reduce2 = collect2.stream().filter(e -> e.getType() == 2).map(TSysCommission::getMoney).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | tErpProcurementVo.setPlatformMoney(reduce1); |
| | | tErpProcurementVo.setSupplierMoney(reduce2); |
| | | } |
| | | // if (!collect.isEmpty()) { |
| | | //// List<String> collect1 = collect.stream().map(TErpProcurementGoods::getId).collect(Collectors.toList()); |
| | | //// List<TSysCommission> collect2 = tSysCommissions.stream().filter(e -> collect1.contains(e.getTErpProcurementGoodsId())).collect(Collectors.toList()); |
| | | //// BigDecimal reduce1 = collect2.stream().filter(e -> e.getType() == 1).map(TSysCommission::getMoney).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | //// BigDecimal reduce2 = collect2.stream().filter(e -> e.getType() == 2).map(TSysCommission::getMoney).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | //// tErpProcurementVo.setPlatformMoney(reduce1); |
| | | //// tErpProcurementVo.setSupplierMoney(reduce2); |
| | | // } |
| | | |
| | | } |
| | | |
| | |
| | | tErpSupplierOutboundGoods1.setTotalPrice(multiply); |
| | | arrayList.add(tErpSupplierOutboundGoods1); |
| | | add = add.add(multiply); |
| | | |
| | | TErpSupplierOutbound tErpSupplierOutbound = new TErpSupplierOutbound(); |
| | | tErpSupplierOutbound.setOutboundType(dto.getOutboundType()); |
| | | tErpSupplierOutbound.setOutboundReason(dto.getOutboundReason()); |
| | | tErpSupplierOutbound.setWarehouseId(dto.getWarehouseId()); |
| | | tErpSupplierOutbound.setSupplierId(supplierClinicId); |
| | | tErpSupplierOutbound.setTotalMoney(add); |
| | | String s = DateUtils.dateTimeNow(); |
| | | tErpSupplierOutbound.setOutboundNumber("G" + s); |
| | | tErpSupplierOutbound.setGoodsId(tErpSupplierWarehousing.getGoodsId()); |
| | | erpSupplierOutboundMapper.insert(tErpSupplierOutbound); |
| | | |
| | | for (TErpSupplierOutboundGoods tErpSupplierOutboundGoods2 : arrayList) { |
| | | tErpSupplierOutboundGoods2.setOutboundId(tErpSupplierOutbound.getId()); |
| | | erpSupplierOutboundGoodsMapper.insert(tErpSupplierOutboundGoods2); |
| | | } |
| | | |
| | | } |
| | | |
| | | TErpSupplierOutbound tErpSupplierOutbound = new TErpSupplierOutbound(); |
| | | tErpSupplierOutbound.setOutboundType(dto.getOutboundType()); |
| | | tErpSupplierOutbound.setOutboundReason(dto.getOutboundReason()); |
| | | tErpSupplierOutbound.setWarehouseId(dto.getWarehouseId()); |
| | | tErpSupplierOutbound.setSupplierId(supplierClinicId); |
| | | tErpSupplierOutbound.setTotalMoney(add); |
| | | String s = DateUtils.dateTimeNow(); |
| | | tErpSupplierOutbound.setOutboundNumber("G" + s); |
| | | erpSupplierOutboundMapper.insert(tErpSupplierOutbound); |
| | | |
| | | for (TErpSupplierOutboundGoods tErpSupplierOutboundGoods : arrayList) { |
| | | tErpSupplierOutboundGoods.setOutboundId(tErpSupplierOutbound.getId()); |
| | | erpSupplierOutboundGoodsMapper.insert(tErpSupplierOutboundGoods); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | </if> |
| | | order by t1.create_time desc |
| | | </select> |
| | | <select id="pageAddList" resultType="com.ruoyi.system.model.TErpGoods"> |
| | | SELECT t1.id, |
| | | t1.supplier_clinic_id, |
| | | t1.goods_source, |
| | | t1.goods_name, |
| | | t1.goods_id_code, |
| | | t1.quasi_number, |
| | | t1.manufacturer, |
| | | t1.formulation_spec, |
| | | t1.packing_spec, |
| | | t1.clinic_purchase_price, |
| | | t1.warning_inventory, |
| | | t1.type_id, |
| | | t1.goods_yards, |
| | | t1.maintenance_interval, |
| | | t1.maintenance_interval_unit, |
| | | t1.low_purchase_quantity, |
| | | t1.low_unit_id, |
| | | t1.is_prescription_drug, |
| | | t1.goods_spec, |
| | | t1.sales_amount, |
| | | t1.packing_unit_id, |
| | | t1.instructions_use, |
| | | t1.side_effect, |
| | | t1.platform_commission_price, |
| | | t1.state, |
| | | t1.simplified_code, |
| | | t1.dosage_form, |
| | | t1.usage_classification, |
| | | t1.product_brand, |
| | | t1.place_of_origin, |
| | | t1.ingredient, |
| | | t1.trait, |
| | | t1.indication, |
| | | t1.taboo, |
| | | t1.precautions, |
| | | t1.interaction, |
| | | t1.storage, |
| | | t1.barcode, |
| | | t2.supplier_name, |
| | | t1.clinic_ids, |
| | | t1.create_by, |
| | | t1.update_by, |
| | | t1.`disabled`, |
| | | t1.create_time, |
| | | t1.update_time, |
| | | t1.create_id, |
| | | t3.type_name |
| | | FROM t_erp_goods t1 |
| | | LEFT JOIN t_crm_supplier t2 ON t1.supplier_clinic_id = t2.id |
| | | left join t_erp_goods_type t3 on t1.type_id = t3.id |
| | | WHERE t1.`disabled` = 0 |
| | | AND (t1.goods_source = 1 AND t1.state = 1 AND t1.`disabled` = 0 AND t1.platform_commission_price IS NOT NULL) |
| | | and (NOT FIND_IN_SET(#{clinicSupplierId}, t1.clinic_ids) or t1.clinic_ids is null) |
| | | <if test="query.goodsName != null and query.goodsName != ''"> |
| | | and t1.goods_name like concat('%',#{query.goodsName},'%') |
| | | </if> |
| | | <if test="query.typeId != null and query.typeId != ''"> |
| | | and t1.type_id = #{query.typeId} |
| | | </if> |
| | | <if test="query.quasiNumber != null and query.quasiNumber != ''"> |
| | | and t1.quasi_number like concat('%',#{query.quasiNumber},'%') |
| | | </if> |
| | | <if test="query.quasiNumber != null and query.quasiNumber != ''"> |
| | | and t2.supplier_name like concat('%',#{query.supplierName},'%') |
| | | </if> |
| | | order by t1.create_time desc |
| | | |
| | | |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | SUM(t2.unit_amount * (t2.goods_count - COALESCE(t3.outbound_count, 0))) as allTotalPrice, |
| | | |
| | | COALESCE(sum(t3.outbound_count), 0) as outNum |
| | | from t_erp_goods t1 left join t_erp_supplier_warehousing t2 on t1.id = t2.goods_id |
| | | left join t_erp_supplier_outbound_goods t3 on t2.id = t3.warehousing_id |
| | | from t_erp_goods t1 |
| | | left join t_erp_supplier_warehousing t2 on t1.id = t2.goods_id |
| | | left join ( |
| | | select warehousing_id, sum(outbound_count) as outbound_count |
| | | from t_erp_supplier_outbound_goods |
| | | group by warehousing_id |
| | | ) t3 on t2.id = t3.warehousing_id |
| | | where t1.disabled = 0 and t2.id is not null |
| | | <if test="query.goodsName != null and query.goodsName != ''"> |
| | | and t1.goods_name like concat('%',#{query.goodsName},'%') |
| | |
| | | <if test="user.roleType !=null and user.roleType ==4"> and t2.supplier_id =#{supplierClinicId} |
| | | </if> |
| | | <if test="query.name != null and query.name != ''"> |
| | | and t4.goods_name like concat('%',#{query.goodsName},'%') |
| | | and t4.goods_name like concat('%',#{query.name},'%') |
| | | </if> |
| | | <if test="query.quasiNumber != null and query.quasiNumber != ''"> |
| | | and t4.quasi_number like concat('%',#{query.quasiNumber},'%') |