From 179c4d64313c9b7572778da4aaaf6c6584fe457d Mon Sep 17 00:00:00 2001
From: mitao <2763622819@qq.com>
Date: 星期二, 20 五月 2025 23:48:08 +0800
Subject: [PATCH] 修改文件上传类型限制

---
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActWarehouseApplyServiceImpl.java |   72 ++++++++++++++++++++++++++++++++++-
 1 files changed, 69 insertions(+), 3 deletions(-)

diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActWarehouseApplyServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActWarehouseApplyServiceImpl.java
index 02cfb1e..420fa25 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActWarehouseApplyServiceImpl.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActWarehouseApplyServiceImpl.java
@@ -1,13 +1,28 @@
 package com.panzhihua.service_community.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.panzhihua.common.model.dtos.property.CommonPage;
 import com.panzhihua.common.model.vos.R;
-import com.panzhihua.service_community.entity.ComActWarehouseApply;
+import com.panzhihua.common.model.vos.community.warehouse.ComActWarehouseApplyVO;
+import com.panzhihua.common.model.vos.community.warehouse.ComActWarehouseOperationVO;
+import com.panzhihua.service_community.dao.ComActWarehouseDonatesDao;
+import com.panzhihua.service_community.dao.ComActWarehouseOperationDao;
+import com.panzhihua.service_community.dao.ComPbServiceTeamDao;
 import com.panzhihua.service_community.dao.ComActWarehouseApplyDao;
+import com.panzhihua.service_community.entity.ComActWarehouseApply;
+import com.panzhihua.service_community.entity.ComActWarehouseDonates;
+import com.panzhihua.service_community.entity.ComActWarehouseOperation;
+import com.panzhihua.service_community.entity.ComPbServiceTeam;
 import com.panzhihua.service_community.service.ComActWarehouseApplyService;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import java.util.Date;
 
 /**
  * 物品申请表(ComActWarehouseApply)表服务实现类
@@ -18,9 +33,60 @@
 @Slf4j
 @Service
 public class ComActWarehouseApplyServiceImpl extends ServiceImpl<ComActWarehouseApplyDao, ComActWarehouseApply> implements ComActWarehouseApplyService {
-
+    @Resource
+    private ComActWarehouseApplyDao comActWarehouseApplyDao;
+    @Resource
+    private ComPbServiceTeamDao comPbServiceTeamDao;
+    @Resource
+    private ComActWarehouseDonatesDao comActWarehouseDonatesDao;
+    @Resource
+    private ComActWarehouseOperationDao comActWarehouseOperationDao;
     @Override
     public R pageList(CommonPage commonPage) {
-        return null;
+        IPage<ComActWarehouseApplyVO> iPage=this.comActWarehouseApplyDao.queryAll(new Page<>(commonPage.getPage(),commonPage.getSize()),commonPage);
+        return R.ok(iPage);
+    }
+
+    @Override
+    public R selectStatics(Long communityId) {
+        return R.ok(this.comActWarehouseApplyDao.selectStatics(communityId));
+    }
+
+    @Override
+    public R selectById(Integer id) {
+        return R.ok(this.comActWarehouseApplyDao.selectById(id));
+    }
+
+    @Override
+    public R check(String phone) {
+        Integer count=comPbServiceTeamDao.selectCount(new QueryWrapper<ComPbServiceTeam>().lambda().eq(ComPbServiceTeam::getPhone,phone));
+        return count>0? R.ok():R.fail("无权限");
+    }
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public R update(ComActWarehouseApply comActWarehouseApply) {
+        ComActWarehouseApply comActWarehouseApply1=this.comActWarehouseApplyDao.selectById(comActWarehouseApply.getId());
+        if(comActWarehouseApply.getStatus().equals(ComActWarehouseApplyVO.status.ylq)){
+            ComActWarehouseDonates comActWarehouseDonates=this.comActWarehouseDonatesDao.selectById(comActWarehouseApply1.getGoodsId());
+            if(comActWarehouseDonates!=null&&comActWarehouseDonates.getSurplusQuantity()>=comActWarehouseApply1.getGoodsNum()){
+                comActWarehouseDonates.setSurplusQuantity(comActWarehouseDonates.getSurplusQuantity()-comActWarehouseApply1.getGoodsNum());
+                this.comActWarehouseDonatesDao.updateById(comActWarehouseDonates);
+                ComActWarehouseOperation comActWarehouseOperation=new ComActWarehouseOperation();
+                comActWarehouseOperation.setGoodsId(comActWarehouseApply1.getGoodsId());
+                comActWarehouseOperation.setCreateTime(new Date());
+                comActWarehouseOperation.setType(ComActWarehouseOperation.type.xs);
+                comActWarehouseOperation.setApplyId(comActWarehouseApply.getId());
+                this.comActWarehouseOperationDao.insert(comActWarehouseOperation);
+            }
+            else {
+                return R.fail("库存不足");
+            }
+        }
+        return R.ok(this.comActWarehouseApplyDao.updateById(comActWarehouseApply));
+    }
+
+    @Override
+    public R export(CommonPage commonPage) {
+        return R.ok(this.comActWarehouseApplyDao.queryAll(commonPage));
     }
 }

--
Gitblit v1.7.1