package com.fzzy.igds; import com.bstek.dorado.annotation.DataProvider; import com.bstek.dorado.annotation.DataResolver; import com.bstek.dorado.annotation.Expose; import com.fzzy.common.constant.BizTypeEnum; import com.fzzy.igds.domain.Depot; import com.fzzy.igds.service.DepotService; import com.fzzy.igds.service.PledgeContractService; import com.fzzy.igds.utils.ContextUtil; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.enums.BusinessType; 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.List; /** * @Description * @Author CZT * @Date 2025/11/27 13:57 */ @Slf4j @Component public class DepotPR { @Resource private DepotService depotService; @Resource private PledgeContractService pledgeContractService; /** * depotPR#getData * * @return */ @DataProvider public List getData(String parentId) { if (StringUtils.isNotEmpty(parentId)) { return depotService.getData(null, parentId, false); } return depotService.getData(null, ContextUtil.subDeptId(null), false); } /** * depotPR#saveOrUpdate * * @param data * @return */ @DataResolver @Transactional public String saveOrUpdate(Depot data) { Depot depot = new Depot(); BeanUtils.copyProperties(data, depot); depotService.saveDepot(depot); return null; } /** * 更新库存信息 * depotPR#saveOrUpdate2 * * @param data * @return */ @DataResolver @Transactional public String saveOrUpdate2(Depot data) { Depot depot = new Depot(); BeanUtils.copyProperties(data, depot); depotService.updateStorageReal(depot); return null; } /** * depotPR#deleteDepot * * @param data */ @Expose @Transactional @Log(title = "库区管理", businessType = BusinessType.DELETE,bizType = BizTypeEnum.SYS) public void deleteDepot(Depot data) { Depot depot = new Depot(); BeanUtils.copyProperties(data, depot); depotService.deleteDepot(depot); } /** * depotPR#flushCache */ @Expose public void flushCache() { depotService.flushCache(null); } /** * ${dorado.getDataProvider("depotPR#getAllCache").getResult()} * * @return */ @DataProvider public List getAllCache() { return depotService.getCacheDepotList(null, ContextUtil.subDeptId(null)); } /** * depotPR#ajaxGetAllCache * * @return */ @Expose public List ajaxGetAllCache() { return depotService.getCacheDepotList(null, ContextUtil.subDeptId(null)); } /** * depotPR#getDataByCompanyId * * @return */ @DataProvider public List getDataByCompanyId() { return depotService.getData(null, null, false); } /** * depotPR#getDepot 获取仓库信息 * * @param depotId * @return */ @Expose public Depot getDepot(String depotId) { return depotService.getCacheDepot(null, depotId); } }