liujie
2 天以前 f15d99d9d4fdaff8b13776e861ce958ec9f26749
诊所erp
14个文件已修改
1个文件已添加
237 ■■■■■ 已修改文件
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TErpGoodsController.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TErpIssueReportingController.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TErpProcurementController.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/mapper/TErpGoodsMapper.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/mapper/TErpMaintenanceReminderMapper.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/query/TErpGoodsAdminQuery.java 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/query/TErpIssueReportingQuery.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/service/TErpGoodsService.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpClinicWarehousingServiceImpl.java 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpGoodsServiceImpl.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpMaintenanceReminderServiceImpl.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/vo/InventoryDetailVo.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/resources/mapper/system/TErpGoodsMapper.xml 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/resources/mapper/system/TErpIssueReportingMapper.xml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/resources/mapper/system/TErpMaintenanceReminderMapper.xml 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TErpGoodsController.java
@@ -22,6 +22,7 @@
import com.ruoyi.system.dto.*;
import com.ruoyi.system.importExcel.TErpGoodsExcel;
import com.ruoyi.system.model.*;
import com.ruoyi.system.query.TErpGoodsAdminQuery;
import com.ruoyi.system.query.TErpGoodsQuery;
import com.ruoyi.system.service.*;
import com.ruoyi.system.vo.TErpGoodsVO;
@@ -115,6 +116,21 @@
            query.setSupplierClinicId(crmClinic.getId());
        }
        return R.ok(erpGoodsService.pageList(query,user));
    }
    /**
     * 获取erp问题上报管理列表
     */
    @ApiOperation(value = "平台获取商品分页列表")
    @PostMapping(value = "/pageAdminList")
    public R<PageInfo<TErpGoodsVO>> pageAdminList(@RequestBody TErpGoodsAdminQuery query) {
        SysUser user = tokenService.getLoginUser().getUser();
        Integer roleType = user.getRoleType();
        if(roleType == 1){
            // 平台
            return R.ok(erpGoodsService.pageAdminList(query));
        }
        return R.ok();
    }
@@ -417,7 +433,7 @@
        return R.ok(erpGoodsService.updateById(goods));
    }
    @ApiOperation(value = "供应商商品详情")
    @ApiOperation(value = "商品详情")
    @GetMapping(value = "/detail/{id}")
    public R<TErpGoods> detail( @PathVariable String  id) {
        TErpGoods goods = erpGoodsService.getById(id);
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TErpIssueReportingController.java
@@ -59,6 +59,22 @@
    @ApiOperation(value = "获取erp问题上报分页列表")
    @PostMapping(value = "/pageList")
    public R<PageInfo<TErpIssueReportingVO>> pageList(@RequestBody TErpIssueReportingQuery query) {
        Integer roleType = tokenService.getLoginUser().getUser().getRoleType();
        Long userId = tokenService.getLoginUser().getUserId();
        if(roleType == 4){
            query.setReportType(1);
            TCrmSupplier crmSupplier = crmSupplierService.getOne(Wrappers.lambdaQuery(TCrmSupplier.class)
                    .eq(TCrmSupplier::getUserId, userId)
                    .last("LIMIT 1"));
            query.setReportUserId(crmSupplier.getId());
        }
        if(roleType == 5){
            query.setReportType(2);
            TCrmClinic crmClinic = crmClinicService.getOne(Wrappers.lambdaQuery(TCrmClinic.class)
                    .eq(TCrmClinic::getUserId, userId)
                    .last("LIMIT 1"));
            query.setReportUserId(crmClinic.getId());
        }
        return R.ok(erpIssueReportingService.pageList(query));
    }
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TErpProcurementController.java
@@ -27,6 +27,7 @@
import javax.validation.Valid;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -54,12 +55,13 @@
    private final TErpClinicWarehousingService erpClinicWarehousingService;
    private final TErpClinicWarehousingBatchService erpClinicWarehousingBatchService;
    private final TCrmSupplierService crmSupplierService;
    private final TErpMaintenanceReminderService erpMaintenanceReminderService;
    @Autowired
    public TErpProcurementController(TErpProcurementService erpProcurementService, TokenService tokenService,TCrmClinicService crmClinicService,TErpProcurementGoodsService erpProcurementGoodsService
    , TErpGoodsService erpGoodsService,TErpClinicWarehousingService erpClinicWarehousingService,TErpClinicWarehousingBatchService erpClinicWarehousingBatchService,
                                     TCrmSupplierService crmSupplierService) {
                                     TCrmSupplierService crmSupplierService,TErpMaintenanceReminderService erpMaintenanceReminderService) {
        this.erpProcurementService = erpProcurementService;
        this.tokenService = tokenService;
        this.crmClinicService = crmClinicService;
@@ -68,6 +70,7 @@
        this.erpClinicWarehousingService = erpClinicWarehousingService;
        this.erpClinicWarehousingBatchService = erpClinicWarehousingBatchService;
        this.crmSupplierService = crmSupplierService;
        this.erpMaintenanceReminderService = erpMaintenanceReminderService;
    }
@@ -248,6 +251,20 @@
            tErpClinicWarehousingGoods.setSalesAmount(tErpProcurementGoods.getSalesAmount());
            erpClinicWarehousingBatchService.save(tErpClinicWarehousingGoods);
            if(erpGoods.getMaintenanceInterval()!=null){
                TErpMaintenanceReminder tErpMaintenanceReminder = new TErpMaintenanceReminder();
                tErpMaintenanceReminder.setClinicSupplierId(clinicSupplierId);
                tErpMaintenanceReminder.setMaintenanceType(2);
                tErpMaintenanceReminder.setWarehousingBatchId(tErpClinicWarehousingGoods.getId());
                Integer day = Integer.valueOf(erpGoods.getMaintenanceInterval());
                // 当前时间+day天
                LocalDateTime time1 = LocalDateTime.now().plusDays(day);
                tErpMaintenanceReminder.setMaintenanceTime(time1);
                erpMaintenanceReminderService.save(tErpMaintenanceReminder);
            }
        }
        return R.ok();
    }
ruoyi-system/src/main/java/com/ruoyi/system/mapper/TErpGoodsMapper.java
@@ -4,6 +4,7 @@
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.TErpGoodsAdminQuery;
import com.ruoyi.system.query.TErpGoodsInventoryQuery;
import com.ruoyi.system.query.TErpGoodsQuery;
import com.ruoyi.system.vo.TErpGoodsInventoryVO;
@@ -40,4 +41,5 @@
    TErpGoods getGoodsById(@Param("goodsId") String goodsId);
    List<TErpGoodsVO> pageAdminList(@Param("query") TErpGoodsAdminQuery query, @Param("pageInfo") PageInfo<TErpGoodsVO> pageInfo);
}
ruoyi-system/src/main/java/com/ruoyi/system/mapper/TErpMaintenanceReminderMapper.java
@@ -22,4 +22,5 @@
public interface TErpMaintenanceReminderMapper extends BaseMapper<TErpMaintenanceReminder> {
    List<TErpMaintenanceReminderListVo> pageList(@Param("page") PageInfo<TErpMaintenanceReminderListVo> page, @Param("query") TErpMaintenanceReminderQuery query, @Param("user") SysUser user, @Param("supplierClinicId") String supplierClinicId, @Param("tomorrow") LocalDateTime tomorrow );
    List<TErpMaintenanceReminderListVo> pageList1(@Param("page") PageInfo<TErpMaintenanceReminderListVo> page, @Param("query") TErpMaintenanceReminderQuery query, @Param("user") SysUser user, @Param("supplierClinicId") String supplierClinicId, @Param("tomorrow") LocalDateTime tomorrow );
}
ruoyi-system/src/main/java/com/ruoyi/system/query/TErpGoodsAdminQuery.java
New file
@@ -0,0 +1,28 @@
package com.ruoyi.system.query;
import com.ruoyi.common.core.domain.BasePage;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(value = "erp商品平台查询参数query")
public class TErpGoodsAdminQuery extends BasePage {
    @ApiModelProperty(value = "供应商名称")
    private String supplierName;
    @ApiModelProperty(value = "商品名称")
    private String goodsName;
    @ApiModelProperty(value = "商品类型id")
    private String typeId;
    @ApiModelProperty(value = "国药准字号")
    private String quasiNumber;
    @ApiModelProperty(value = "1启用 2禁用")
    private Integer state;
}
ruoyi-system/src/main/java/com/ruoyi/system/query/TErpIssueReportingQuery.java
@@ -30,4 +30,5 @@
    @ApiModelProperty(value = "处理人")
    private String handlerPerson;
    private String reportUserId;
}
ruoyi-system/src/main/java/com/ruoyi/system/service/TErpGoodsService.java
@@ -8,6 +8,7 @@
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.vo.OutboundGoodsDetailVo;
@@ -75,4 +76,7 @@
    PageInfo<TErpGoodsVO> pageList1(TErpGoodsQuery query, SysUser user);
    PageInfo<TErpGoodsVO> pageAdminList(TErpGoodsAdminQuery query);
}
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpClinicWarehousingServiceImpl.java
@@ -13,6 +13,7 @@
import com.ruoyi.system.mapper.*;
import com.ruoyi.system.model.*;
import com.ruoyi.system.query.*;
import com.ruoyi.system.service.TCrmSupplierService;
import com.ruoyi.system.service.TErpClinicWarehousingService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.system.vo.*;
@@ -68,6 +69,11 @@
    @Resource
    private TErpGoodsTypeMapper erpGoodsTypeMapper;
    @Resource
    private TErpMaintenanceReminderMapper erpMaintenanceReminderMapper;
    @Resource
    private TCrmSupplierMapper crmSupplierMapper;
    @Override
@@ -162,6 +168,16 @@
                    TErpClinicWarehousing tErpSupplierWarehousing = erpClinicWarehousingMapper.selectById(tErpSupplierInventoryGood.getWarehousingId());
                    String goodsId = tErpSupplierInventoryGood.getGoodsId();
                    TErpGoods goods = erpGoodsMapper.selectById(goodsId);
                    if(goods.getGoodsSource()==1){
                        TCrmSupplier supplier = crmSupplierMapper.selectById(goods.getSupplierClinicId());
                        if(supplier!=null){
                            inventoryDetailVo.setSupplierName(supplier.getSupplierName());
                        }
                    }else {
                        inventoryDetailVo.setSupplierName(goods.getSupplierName());
                    }
                    inventoryDetailVo.setGoodsName(goods.getGoodsName());
                    TErpGoodsUnit tErpGoodsUnit = erpGoodsUnitMapper.selectById(goods.getPackingUnitId());
                    inventoryDetailVo.setUnitName(tErpGoodsUnit.getUnitName());
@@ -191,6 +207,15 @@
                        TErpClinicWarehousing tErpSupplierWarehousing = erpClinicWarehousingMapper.selectById(warehousingId);
                        String goodsId = tErpSupplierInventoryGood.getGoodsId();
                        TErpGoods goods = erpGoodsMapper.selectById(goodsId);
                        if(goods.getGoodsSource()==1){
                            TCrmSupplier supplier = crmSupplierMapper.selectById(goods.getSupplierClinicId());
                            if(supplier!=null){
                                inventoryDetailVo.setSupplierName(supplier.getSupplierName());
                            }
                        }else {
                            inventoryDetailVo.setSupplierName(goods.getSupplierName());
                        }
                        inventoryDetailVo.setGoodsName(goods.getGoodsName());
                        TErpGoodsUnit tErpGoodsUnit = erpGoodsUnitMapper.selectById(goods.getPackingUnitId());
                        inventoryDetailVo.setUnitName(tErpGoodsUnit.getUnitName());
@@ -370,6 +395,20 @@
                tErpClinicWarehousingBatch.setPurchaseCount(dto.getPurchaseCount());
                erpClinicWarehousingBatchMapper.insert(tErpClinicWarehousingBatch);
                if(goods.getMaintenanceInterval()!=null){
                    TErpMaintenanceReminder tErpMaintenanceReminder = new TErpMaintenanceReminder();
                    tErpMaintenanceReminder.setClinicSupplierId(supplierClinicId);
                    tErpMaintenanceReminder.setMaintenanceType(2);
                    tErpMaintenanceReminder.setWarehousingBatchId(tErpClinicWarehousingBatch.getId());
                    Integer day = Integer.valueOf(goods.getMaintenanceInterval());
                    // 当前时间+day天
                    LocalDateTime time1 = LocalDateTime.now().plusDays(day);
                    tErpMaintenanceReminder.setMaintenanceTime(time1);
                    erpMaintenanceReminderMapper.insert(tErpMaintenanceReminder);
                }
                totalPrice = totalPrice.add(dto.getSalesAmount().multiply(new BigDecimal(dto.getPurchaseCount())));
            }
            tErpClinicWarehousing.setTotalPrice(totalPrice);
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpGoodsServiceImpl.java
@@ -14,6 +14,7 @@
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.service.TErpGoodsService;
@@ -132,6 +133,24 @@
    }
    @Override
    public PageInfo<TErpGoodsVO> pageAdminList(TErpGoodsAdminQuery query) {
        PageInfo<TErpGoodsVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize());
        List<TErpGoodsVO> list = this.baseMapper.pageAdminList(query, pageInfo);
        if (list.isEmpty()) {
            return pageInfo;
        }
        List<String> typeIds = list.stream().map(TErpGoods::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()));
            }
        }
        pageInfo.setRecords( list);
        return pageInfo;
    }
    @Override
    public List<TErpGoodsVO> listExport(TErpGoodsQuery query, SysUser user) {
        List<TErpGoodsVO> list = this.baseMapper.listExport(query, user);
        if (list.isEmpty()) {
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpMaintenanceReminderServiceImpl.java
@@ -15,6 +15,7 @@
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
@@ -79,8 +80,13 @@
        // 获取明天的时间
        LocalDateTime tomorrow = LocalDateTime.now().plusDays(1);
        List<TErpMaintenanceReminderListVo> list=new ArrayList<>();
        if(roleType==4){
           list = baseMapper.pageList(page, query, user,supplierClinicId,tomorrow);
        }else {
           list = baseMapper.pageList1(page, query, user,supplierClinicId,tomorrow);
        }
        List<TErpMaintenanceReminderListVo> list = baseMapper.pageList(page, query, user,supplierClinicId,tomorrow);
        if(list.isEmpty()){
            return page;
        }
ruoyi-system/src/main/java/com/ruoyi/system/vo/InventoryDetailVo.java
@@ -39,5 +39,8 @@
    @ApiModelProperty(value = "破损数量")
    private Integer damagedCount;
    @ApiModelProperty(value = "供应商名称")
    private String supplierName;
}
ruoyi-system/src/main/resources/mapper/system/TErpGoodsMapper.xml
@@ -286,5 +286,44 @@
    <select id="getGoodsById" resultType="com.ruoyi.system.model.TErpGoods">
        select <include refid="Base_Column_List"/> from t_erp_goods where id = #{goodsId}
    </select>
    <select id="pageAdminList" resultType="com.ruoyi.system.vo.TErpGoodsVO">
        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.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.warning_inventory,
        t1.sales_amount, t1.packing_unit_id, t1.instructions_use, t1.side_effect, t1.clinic_purchase_price, t1.platform_commission_price, t1.create_time, t1.update_time, t1.create_by,
        t1.`state`, t1.update_by, t1.disabled,
        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,
        t2.supplier_name
        from t_erp_goods t1 left join t_crm_supplier t2 on t1.supplier_clinic_id = t2.id and t1.goods_source =1
        where t1.disabled = 0 and t1.goods_source =1
        <if test="query.supplierName != null and query.supplierName != ''">
            and t2.supplier_name like concat('%',#{query.supplierName},'%')
        </if>
        <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.state != null ">
            and t1.state = #{query.state}
        </if>
        order by t1.create_time desc
    </select>
</mapper>
ruoyi-system/src/main/resources/mapper/system/TErpIssueReportingMapper.xml
@@ -38,8 +38,8 @@
            <if test="query.status != null">
                AND status = #{query.status}
            </if>
            <if test="query.reportType != null">
                AND report_type = #{query.reportType}
            <if test="query.reportType != null and query.query.reportUserId !=null">
                AND report_type = #{query.reportType} and report_user_id =#{query.reportUserId}
            </if>
            <if test="query.createBy != null and query.createBy != ''">
                AND create_by LIKE concat('%',#{query.createBy},'%')
ruoyi-system/src/main/resources/mapper/system/TErpMaintenanceReminderMapper.xml
@@ -59,5 +59,41 @@
            and t1.`status` = #{query.status}
        </if>
    </select>
    <select id="pageList1" resultType="com.ruoyi.system.vo.TErpMaintenanceReminderListVo">
        select t1.id,
               t4.goods_name,
               t4.type_id,
               t2.batch_number,
               t1.maintenance_person_id,
               t1.maintenance_time,
               t1.`status`,
               t3.warehouse_no
        from t_erp_maintenance_reminder t1
                 LEFT JOIN t_erp_clinic_warehousing_batch t2 on t1.warehousing_batch_id = t2.id
                 left join t_erp_clinic_warehousing t3 on t2.warehousing_id = t3.id
                 left join t_erp_goods t4 on t2.goods_id = t4.id
        where t1.disabled = 0 and #{tomorrow} >= t1.maintenance_time
          <if test="user.roleType !=null and user.roleType==4">
              and t1.clinic_supplier_id = #{supplierClinicId} and t1.maintenance_type=1
          </if>
          <if test="user.roleType !=null and user.roleType==5">
              and t1.clinic_supplier_id = #{supplierClinicId} and t1.maintenance_type=2
          </if>
         <if test="query.warehouseNo != null and query.warehouseNo != ''">
            and t3.warehouse_no =#{query.warehouseNo}
        </if>
        <if test="query.goodsName != null and query.goodsName != ''">
            and t4.goods_name like concat('%',#{query.goodsName},'%')
        </if>
        <if test="query.typeId != null and query.typeId != '' ">
            and t4.type_id = #{query.typeId}
        </if>
        <if test="query.batchNumber != null and query.batchNumber != ''">
            and t2.batch_number = #{query.batchNumber}
        </if>
        <if test="query.status != null ">
            and t1.`status` = #{query.status}
        </if>
    </select>
</mapper>