wuxw před 3 roky
rodič
revize
5f60a8a8b6

+ 38 - 16
java110-bean/src/main/java/com/java110/dto/resourceStoreTimes/ResourceStoreTimesDto.java

@@ -1,6 +1,7 @@
 package com.java110.dto.resourceStoreTimes;
 
 import com.java110.dto.PageDto;
+
 import java.io.Serializable;
 import java.util.Date;
 
@@ -15,11 +16,13 @@ import java.util.Date;
 public class ResourceStoreTimesDto extends PageDto implements Serializable {
 
     private String price;
-private String applyOrderId;
-private String storeId;
-private String stock;
-private String resId;
-private String timesId;
+    private String applyOrderId;
+    private String storeId;
+    private String stock;
+
+    private String hasStock;
+    private String resId;
+    private String timesId;
 
 
     private Date createTime;
@@ -30,37 +33,48 @@ private String timesId;
     public String getPrice() {
         return price;
     }
-public void setPrice(String price) {
+
+    public void setPrice(String price) {
         this.price = price;
     }
-public String getApplyOrderId() {
+
+    public String getApplyOrderId() {
         return applyOrderId;
     }
-public void setApplyOrderId(String applyOrderId) {
+
+    public void setApplyOrderId(String applyOrderId) {
         this.applyOrderId = applyOrderId;
     }
-public String getStoreId() {
+
+    public String getStoreId() {
         return storeId;
     }
-public void setStoreId(String storeId) {
+
+    public void setStoreId(String storeId) {
         this.storeId = storeId;
     }
-public String getStock() {
+
+    public String getStock() {
         return stock;
     }
-public void setStock(String stock) {
+
+    public void setStock(String stock) {
         this.stock = stock;
     }
-public String getResId() {
+
+    public String getResId() {
         return resId;
     }
-public void setResId(String resId) {
+
+    public void setResId(String resId) {
         this.resId = resId;
     }
-public String getTimesId() {
+
+    public String getTimesId() {
         return timesId;
     }
-public void setTimesId(String timesId) {
+
+    public void setTimesId(String timesId) {
         this.timesId = timesId;
     }
 
@@ -80,4 +94,12 @@ public void setTimesId(String timesId) {
     public void setStatusCd(String statusCd) {
         this.statusCd = statusCd;
     }
+
+    public String getHasStock() {
+        return hasStock;
+    }
+
+    public void setHasStock(String hasStock) {
+        this.hasStock = hasStock;
+    }
 }

+ 88 - 86
java110-db/src/main/resources/mapper/store/ResourceStoreTimesV1ServiceDaoImplMapper.xml

@@ -5,111 +5,113 @@
 <mapper namespace="resourceStoreTimesV1ServiceDaoImpl">
 
 
-
-
-
     <!-- 保存物品次数信息 add by wuxw 2018-07-03 -->
     <insert id="saveResourceStoreTimesInfo" parameterType="Map">
         insert into resource_store_times(
-price,apply_order_id,store_id,stock,res_id,times_id
-) values (
-#{price},#{applyOrderId},#{storeId},#{stock},#{resId},#{timesId}
-)
+        price,apply_order_id,store_id,stock,res_id,times_id
+        ) values (
+        #{price},#{applyOrderId},#{storeId},#{stock},#{resId},#{timesId}
+        )
     </insert>
 
 
-
     <!-- 查询物品次数信息 add by wuxw 2018-07-03 -->
     <select id="getResourceStoreTimesInfo" parameterType="Map" resultType="Map">
-        select  t.price,t.apply_order_id,t.apply_order_id applyOrderId,t.status_cd,t.status_cd statusCd,t.store_id,t.store_id storeId,t.stock,t.res_id,t.res_id resId,t.times_id,t.times_id timesId 
-from resource_store_times t 
-where 1 =1 
-<if test="price !=null and price != ''">
-   and t.price= #{price}
-</if> 
-<if test="applyOrderId !=null and applyOrderId != ''">
-   and t.apply_order_id= #{applyOrderId}
-</if> 
-<if test="statusCd !=null and statusCd != ''">
-   and t.status_cd= #{statusCd}
-</if> 
-<if test="storeId !=null and storeId != ''">
-   and t.store_id= #{storeId}
-</if> 
-<if test="stock !=null and stock != ''">
-   and t.stock= #{stock}
-</if> 
-<if test="resId !=null and resId != ''">
-   and t.res_id= #{resId}
-</if> 
-<if test="timesId !=null and timesId != ''">
-   and t.times_id= #{timesId}
-</if> 
-order by t.create_time desc
-<if test="page != -1 and page != null ">
-   limit #{page}, #{row}
-</if> 
+        select t.price,t.apply_order_id,t.apply_order_id applyOrderId,t.status_cd,t.status_cd
+        statusCd,t.store_id,t.store_id storeId,t.stock,t.res_id,t.res_id resId,t.times_id,t.times_id timesId
+        from resource_store_times t
+        where 1 =1
+        <if test="price !=null and price != ''">
+            and t.price= #{price}
+        </if>
+        <if test="applyOrderId !=null and applyOrderId != ''">
+            and t.apply_order_id= #{applyOrderId}
+        </if>
+        <if test="statusCd !=null and statusCd != ''">
+            and t.status_cd= #{statusCd}
+        </if>
+        <if test="storeId !=null and storeId != ''">
+            and t.store_id= #{storeId}
+        </if>
+        <if test="stock !=null and stock != ''">
+            and t.stock= #{stock}
+        </if>
+        <if test="hasStock !=null and hasStock != ''">
+            and t.stock > 0
+        </if>
+        <if test="resId !=null and resId != ''">
+            and t.res_id= #{resId}
+        </if>
+        <if test="timesId !=null and timesId != ''">
+            and t.times_id= #{timesId}
+        </if>
+        order by t.create_time desc
+        <if test="page != -1 and page != null ">
+            limit #{page}, #{row}
+        </if>
 
     </select>
 
 
-
-
     <!-- 修改物品次数信息 add by wuxw 2018-07-03 -->
     <update id="updateResourceStoreTimesInfo" parameterType="Map">
-        update  resource_store_times t set t.status_cd = #{statusCd}
-<if test="newBId != null and newBId != ''">
-,t.b_id = #{newBId}
-</if> 
-<if test="price !=null and price != ''">
-, t.price= #{price}
-</if> 
-<if test="applyOrderId !=null and applyOrderId != ''">
-, t.apply_order_id= #{applyOrderId}
-</if> 
-<if test="storeId !=null and storeId != ''">
-, t.store_id= #{storeId}
-</if> 
-<if test="stock !=null and stock != ''">
-, t.stock= #{stock}
-</if> 
-<if test="resId !=null and resId != ''">
-, t.res_id= #{resId}
-</if> 
- where 1=1 <if test="timesId !=null and timesId != ''">
-and t.times_id= #{timesId}
-</if> 
+        update resource_store_times t set t.status_cd = #{statusCd}
+        <if test="newBId != null and newBId != ''">
+            ,t.b_id = #{newBId}
+        </if>
+        <if test="price !=null and price != ''">
+            , t.price= #{price}
+        </if>
+        <if test="applyOrderId !=null and applyOrderId != ''">
+            , t.apply_order_id= #{applyOrderId}
+        </if>
+        <if test="storeId !=null and storeId != ''">
+            , t.store_id= #{storeId}
+        </if>
+        <if test="stock !=null and stock != ''">
+            , t.stock= #{stock}
+        </if>
+        <if test="resId !=null and resId != ''">
+            , t.res_id= #{resId}
+        </if>
+        where 1=1
+        <if test="timesId !=null and timesId != ''">
+            and t.times_id= #{timesId}
+        </if>
 
     </update>
 
     <!-- 查询物品次数数量 add by wuxw 2018-07-03 -->
-     <select id="queryResourceStoreTimessCount" parameterType="Map" resultType="Map">
-        select  count(1) count 
-from resource_store_times t 
-where 1 =1 
-<if test="price !=null and price != ''">
-   and t.price= #{price}
-</if> 
-<if test="applyOrderId !=null and applyOrderId != ''">
-   and t.apply_order_id= #{applyOrderId}
-</if> 
-<if test="statusCd !=null and statusCd != ''">
-   and t.status_cd= #{statusCd}
-</if> 
-<if test="storeId !=null and storeId != ''">
-   and t.store_id= #{storeId}
-</if> 
-<if test="stock !=null and stock != ''">
-   and t.stock= #{stock}
-</if> 
-<if test="resId !=null and resId != ''">
-   and t.res_id= #{resId}
-</if> 
-<if test="timesId !=null and timesId != ''">
-   and t.times_id= #{timesId}
-</if> 
+    <select id="queryResourceStoreTimessCount" parameterType="Map" resultType="Map">
+        select count(1) count
+        from resource_store_times t
+        where 1 =1
+        <if test="price !=null and price != ''">
+            and t.price= #{price}
+        </if>
+        <if test="applyOrderId !=null and applyOrderId != ''">
+            and t.apply_order_id= #{applyOrderId}
+        </if>
+        <if test="statusCd !=null and statusCd != ''">
+            and t.status_cd= #{statusCd}
+        </if>
+        <if test="storeId !=null and storeId != ''">
+            and t.store_id= #{storeId}
+        </if>
+        <if test="stock !=null and stock != ''">
+            and t.stock= #{stock}
+        </if>
+        <if test="hasStock !=null and hasStock != ''">
+            and t.stock > 0
+        </if>
+        <if test="resId !=null and resId != ''">
+            and t.res_id= #{resId}
+        </if>
+        <if test="timesId !=null and timesId != ''">
+            and t.times_id= #{timesId}
+        </if>
 
 
-     </select>
+    </select>
 
 </mapper>

+ 269 - 0
service-store/src/main/java/com/java110/store/cmd/collection/ResourceOutCmd.java

@@ -0,0 +1,269 @@
+package com.java110.store.cmd.collection;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.java110.core.annotation.Java110Cmd;
+import com.java110.core.context.ICmdDataFlowContext;
+import com.java110.core.event.cmd.Cmd;
+import com.java110.core.event.cmd.CmdEvent;
+import com.java110.core.factory.GenerateCodeFactory;
+import com.java110.doc.annotation.*;
+import com.java110.dto.purchaseApply.PurchaseApplyDto;
+import com.java110.dto.resourceStore.ResourceStoreDto;
+import com.java110.dto.resourceStoreTimes.ResourceStoreTimesDto;
+import com.java110.dto.userStorehouse.UserStorehouseDto;
+import com.java110.intf.store.*;
+import com.java110.po.purchase.PurchaseApplyDetailPo;
+import com.java110.po.purchase.PurchaseApplyPo;
+import com.java110.po.purchase.ResourceStorePo;
+import com.java110.po.resourceStoreTimes.ResourceStoreTimesPo;
+import com.java110.po.userStorehouse.UserStorehousePo;
+import com.java110.utils.exception.CmdException;
+import com.java110.utils.util.Assert;
+import com.java110.utils.util.BeanConvertUtil;
+import com.java110.utils.util.StringUtil;
+import com.java110.vo.ResultVo;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.math.BigDecimal;
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.List;
+
+
+/**
+ * 采购人员入库 功能
+ * 请求地址为/app/purchase/resourceEnter
+ */
+
+@Java110CmdDoc(title = "仓库管理员 领用出库",
+        description = "主要用于 仓库管理员领用出库",
+        httpMethod = "post",
+        url = "http://{ip}:{port}/app/collection/resourceOut",
+        resource = "storeDoc",
+        author = "吴学文",
+        serviceCode = "collection.resourceOut"
+)
+
+@Java110ParamsDoc(params = {
+        @Java110ParamDoc(name = "applyOrderId", length = 30, remark = "采购申请单订单ID"),
+        @Java110ParamDoc(name = "purchaseApplyDetailVo", type = "Array",length = 30, remark = "采购物品信息"),
+        @Java110ParamDoc(parentNodeName = "-", name = "purchaseQuantity", type = "Int",length = 30, remark = "数量"),
+        @Java110ParamDoc(parentNodeName = "-", name = "id", type = "String",length = 30, remark = "采购明细ID"),
+        @Java110ParamDoc(parentNodeName = "-", name = "resId", type = "String",length = 30, remark = "物品ID"),
+})
+
+@Java110ResponseDoc(
+        params = {
+                @Java110ParamDoc(name = "code", type = "int", length = 11, defaultValue = "0", remark = "返回编号,0 成功 其他失败"),
+                @Java110ParamDoc(name = "msg", type = "String", length = 250, defaultValue = "成功", remark = "描述"),
+        }
+)
+
+@Java110ExampleDoc(
+        reqBody="{'applyOrderId':'123123','purchaseApplyDetailVo':[{'purchaseQuantity':'10','id':'123123','resId':'343434'}]}",
+        resBody="{'code':0,'msg':'成功'}"
+)
+
+/**
+ * 物品领用
+ */
+@Java110Cmd(serviceCode = "/collection/resourceOut")
+public class ResourceOutCmd extends Cmd {
+
+    @Autowired
+    private IPurchaseApplyInnerServiceSMO purchaseApplyInnerServiceSMOImpl;
+
+    @Autowired
+    private IPurchaseApplyDetailInnerServiceSMO purchaseApplyDetailInnerServiceSMOImpl;
+
+    @Autowired
+    private IResourceStoreInnerServiceSMO resourceStoreInnerServiceSMOImpl;
+
+    @Autowired
+    private IUserStorehouseInnerServiceSMO userStorehouseInnerServiceSMOImpl;
+
+    @Autowired
+    private IResourceStoreTimesV1InnerServiceSMO resourceStoreTimesV1InnerServiceSMOImpl;
+
+    @Override
+    public void validate(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException {
+        Assert.hasKeyAndValue(reqJson, "applyOrderId", "订单ID为空");
+        JSONArray purchaseApplyDetails = reqJson.getJSONArray("purchaseApplyDetailVo");
+        List<PurchaseApplyDetailPo> purchaseApplyDetailPos = new ArrayList<>();
+        for (int detailIndex = 0; detailIndex < purchaseApplyDetails.size(); detailIndex++) {
+            JSONObject purchaseApplyDetail = purchaseApplyDetails.getJSONObject(detailIndex);
+            Assert.hasKeyAndValue(purchaseApplyDetail, "purchaseQuantity", "采购数量未填写");
+            Assert.hasKeyAndValue(purchaseApplyDetail, "id", "明细ID为空");
+
+        }
+    }
+
+    @Override
+    public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException, ParseException {
+
+        JSONArray purchaseApplyDetails = reqJson.getJSONArray("purchaseApplyDetailVo");
+        List<PurchaseApplyDetailPo> purchaseApplyDetailPos = new ArrayList<>();
+        for (int detailIndex = 0; detailIndex < purchaseApplyDetails.size(); detailIndex++) {
+            JSONObject purchaseApplyDetail = purchaseApplyDetails.getJSONObject(detailIndex);
+            PurchaseApplyDetailPo purchaseApplyDetailPo = BeanConvertUtil.covertBean(purchaseApplyDetail, PurchaseApplyDetailPo.class);
+            purchaseApplyDetailPos.add(purchaseApplyDetailPo);
+        }
+        PurchaseApplyPo purchaseApplyPo = new PurchaseApplyPo();
+        purchaseApplyPo.setApplyOrderId(reqJson.getString("applyOrderId"));
+        purchaseApplyPo.setPurchaseApplyDetailPos(purchaseApplyDetailPos);
+
+        PurchaseApplyDto purchaseApplyDto = new PurchaseApplyDto();
+        purchaseApplyDto.setApplyOrderId(purchaseApplyPo.getApplyOrderId());
+        List<PurchaseApplyDto> purchaseApplyDtos = purchaseApplyInnerServiceSMOImpl.queryPurchaseApplys(purchaseApplyDto);
+        Assert.listOnlyOne(purchaseApplyDtos, "出库单不存在");
+        purchaseApplyDetailPos = purchaseApplyPo.getPurchaseApplyDetailPos();
+        for (PurchaseApplyDetailPo purchaseApplyDetailPo : purchaseApplyDetailPos) {
+            purchaseApplyDetailInnerServiceSMOImpl.updatePurchaseApplyDetail(purchaseApplyDetailPo);
+            //查询物品资源信息
+            ResourceStoreDto resourceStore = new ResourceStoreDto();
+            resourceStore.setResId(purchaseApplyDetailPo.getResId());
+            List<ResourceStoreDto> resourceStores = resourceStoreInnerServiceSMOImpl.queryResourceStores(resourceStore);
+            Assert.listOnlyOne(resourceStores, "查询物品资源信息错误!");
+            ResourceStorePo resourceStorePo = new ResourceStorePo();
+            resourceStorePo.setResId(purchaseApplyDetailPo.getResId());
+            resourceStorePo.setStock("-" + purchaseApplyDetailPo.getPurchaseQuantity());
+            resourceStorePo.setResOrderType(PurchaseApplyDto.RES_ORDER_TYPE_OUT);
+            //获取原物品最小计量总数
+            if (StringUtil.isEmpty(resourceStores.get(0).getMiniStock())) {
+                throw new IllegalArgumentException("最小计量总数不能为空!");
+            }
+            BigDecimal miniStock1 = new BigDecimal(resourceStores.get(0).getMiniStock());
+            BigDecimal purchaseQuantity = new BigDecimal(purchaseApplyDetailPo.getPurchaseQuantity());
+            if (StringUtil.isEmpty(resourceStores.get(0).getMiniUnitStock())) {
+                throw new IllegalArgumentException("最小计量单位数量不能为空!");
+            }
+            //获取物品最小计量单位数量
+            BigDecimal miniUnitStock1 = new BigDecimal(resourceStores.get(0).getMiniUnitStock());
+            //计算领用物品的最小计量总数
+            BigDecimal applyQuantity = purchaseQuantity.multiply(miniUnitStock1);
+            //计算物品领用后剩余的最小计量总数
+            BigDecimal newMiniStock = miniStock1.subtract(applyQuantity);
+            if (newMiniStock.compareTo(BigDecimal.ZERO) == -1) {
+                throw new IllegalArgumentException("物品库存已经不足,请确认物品库存!");
+            }
+            resourceStorePo.setMiniStock(String.valueOf(newMiniStock));
+            resourceStoreInnerServiceSMOImpl.updateResourceStore(resourceStorePo);
+
+            //加入 从库存中扣减
+            subResourceStoreTimesStock(purchaseApplyDetailPo.getResId(), purchaseApplyDetailPo.getPurchaseQuantity());
+
+            ResourceStoreDto resourceStoreDto = new ResourceStoreDto();
+            resourceStoreDto.setResId(purchaseApplyDetailPo.getResId());
+            //查询物品资源
+            List<ResourceStoreDto> resourceStoreDtos = resourceStoreInnerServiceSMOImpl.queryResourceStores(resourceStoreDto);
+            if (resourceStoreDtos == null || resourceStoreDtos.size() < 1) {
+                continue;
+            }
+            //获取物品单位
+            String unitCode = resourceStoreDtos.get(0).getUnitCode();
+            //获取物品最小计量单位
+            String miniUnitCode = resourceStoreDtos.get(0).getMiniUnitCode();
+            //获取物品最小计量单位数量
+            String miniUnitStock = resourceStoreDtos.get(0).getMiniUnitStock();
+            //入库到个人仓库中
+            UserStorehousePo userStorehousePo = new UserStorehousePo();
+            userStorehousePo.setUsId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_usId));
+            userStorehousePo.setResId(resourceStoreDtos.get(0).getResId());
+            userStorehousePo.setResCode(resourceStoreDtos.get(0).getResCode());
+            userStorehousePo.setResName(resourceStoreDtos.get(0).getResName());
+            userStorehousePo.setStoreId(resourceStoreDtos.get(0).getStoreId());
+            userStorehousePo.setUserId(purchaseApplyDtos.get(0).getUserId());
+            //查询物品 是否已经存在
+            UserStorehouseDto userStorehouseDto = new UserStorehouseDto();
+            userStorehouseDto.setResCode(resourceStoreDtos.get(0).getResCode());
+            userStorehouseDto.setUserId(purchaseApplyDtos.get(0).getUserId());
+            userStorehouseDto.setStoreId(resourceStoreDtos.get(0).getStoreId());
+            List<UserStorehouseDto> userStorehouseDtos = userStorehouseInnerServiceSMOImpl.queryUserStorehouses(userStorehouseDto);
+            if (userStorehouseDtos == null || userStorehouseDtos.size() < 1) {
+                userStorehousePo.setStock(purchaseApplyDetailPo.getPurchaseQuantity());
+                if (!StringUtil.isEmpty(unitCode) && !StringUtil.isEmpty(miniUnitCode) && !StringUtil.isEmpty(miniUnitStock) && !unitCode.equals(miniUnitCode)) {
+                    //获取领取数量
+                    BigDecimal purchaseQuantity2 = new BigDecimal(purchaseApplyDetailPo.getPurchaseQuantity());
+                    BigDecimal miniUnitStock2 = new BigDecimal(miniUnitStock);
+                    //计算个人物品最小计量总数
+                    BigDecimal quantity = purchaseQuantity2.multiply(miniUnitStock2);
+                    userStorehousePo.setMiniStock(String.valueOf(quantity));
+                } else {
+                    userStorehousePo.setMiniStock(purchaseApplyDetailPo.getPurchaseQuantity());
+                }
+                userStorehouseInnerServiceSMOImpl.saveUserStorehouses(userStorehousePo);
+            } else {
+                //获取个人物品领用后的库存
+                BigDecimal purchaseQuantity3 = new BigDecimal(purchaseApplyDetailPo.getPurchaseQuantity());
+                BigDecimal stock3 = new BigDecimal(userStorehouseDtos.get(0).getStock());
+                BigDecimal total = purchaseQuantity3.add(stock3);
+                userStorehousePo.setStock(total.toString());
+                userStorehousePo.setUsId(userStorehouseDtos.get(0).getUsId());
+                if (!StringUtil.isEmpty(unitCode) && !StringUtil.isEmpty(miniUnitCode) && !StringUtil.isEmpty(miniUnitStock) && !unitCode.equals(miniUnitCode)) {
+                    //获取本次领取数量
+                    BigDecimal miniUnitStock3 = new BigDecimal(miniUnitStock);
+                    //计算本次领取的个人物品最小计量总数
+                    BigDecimal quantity = purchaseQuantity3.multiply(miniUnitStock3);
+                    BigDecimal miniStock = new BigDecimal(0);
+                    //获取个人物品原先的最小计量总数
+                    if (StringUtil.isEmpty(userStorehouseDtos.get(0).getMiniStock())) {
+                        throw new IllegalArgumentException("信息错误,个人物品最小计量总数不能为空!");
+                    } else {
+                        miniStock = new BigDecimal(userStorehouseDtos.get(0).getMiniStock());
+                    }
+                    //计算领用后个人物品总的最小计量总数
+                    BigDecimal miniQuantity = quantity.add(miniStock);
+                    userStorehousePo.setMiniStock(String.valueOf(miniQuantity));
+                } else {
+                    userStorehousePo.setMiniStock(String.valueOf(total));
+                }
+                userStorehouseInnerServiceSMOImpl.updateUserStorehouses(userStorehousePo);
+            }
+        }
+        //获取订单号
+        String applyOrderId = purchaseApplyPo.getApplyOrderId();
+        PurchaseApplyPo purchaseApply = new PurchaseApplyPo();
+        purchaseApply.setApplyOrderId(applyOrderId);
+        purchaseApply.setState(PurchaseApplyDto.STATE_AUDITED);
+        purchaseApply.setStatusCd("0");
+        purchaseApplyInnerServiceSMOImpl.updatePurchaseApply(purchaseApply);
+        context.setResponseEntity(ResultVo.createResponseEntity(ResultVo.CODE_OK, "出库成功"));
+    }
+
+    /**
+     * 从times中扣减
+     * @param resId
+     * @param applyQuantity
+     */
+    private void subResourceStoreTimesStock(String resId, String applyQuantity) {
+
+        ResourceStoreTimesDto resourceStoreTimesDto = new ResourceStoreTimesDto();
+        resourceStoreTimesDto.setResId(resId);
+        resourceStoreTimesDto.setHasStock("Y");
+        List<ResourceStoreTimesDto> resourceStoreTimesDtos = resourceStoreTimesV1InnerServiceSMOImpl.queryResourceStoreTimess(resourceStoreTimesDto);
+
+        if (resourceStoreTimesDtos == null || resourceStoreTimesDtos.size() < 1) {
+            return;
+        }
+        int stock = 0;
+        int quantity = Integer.parseInt(applyQuantity);
+        ResourceStoreTimesPo resourceStoreTimesPo = null;
+        for (ResourceStoreTimesDto resourceStoreTimesDto1 : resourceStoreTimesDtos) {
+            stock = Integer.parseInt(resourceStoreTimesDto1.getStock());
+            if (stock > quantity) {
+                stock = stock - quantity;
+                resourceStoreTimesPo = new ResourceStoreTimesPo();
+                resourceStoreTimesPo.setTimesId(resourceStoreTimesDto1.getTimesId());
+                resourceStoreTimesPo.setStock(stock + "");
+                resourceStoreTimesV1InnerServiceSMOImpl.updateResourceStoreTimes(resourceStoreTimesPo);
+                break;
+            }
+            quantity = quantity - stock;
+            resourceStoreTimesPo = new ResourceStoreTimesPo();
+            resourceStoreTimesPo.setTimesId(resourceStoreTimesDto1.getTimesId());
+            resourceStoreTimesPo.setStock("0");
+            resourceStoreTimesV1InnerServiceSMOImpl.updateResourceStoreTimes(resourceStoreTimesPo);
+        }
+    }
+}

+ 1 - 1
service-store/src/main/java/com/java110/store/cmd/purchase/ResourceEnterCmd.java

@@ -42,7 +42,7 @@ import java.util.List;
         url = "http://{ip}:{port}/app/purchase/resourceEnter",
         resource = "storeDoc",
         author = "吴学文",
-        serviceCode = "/purchase/resourceEnter"
+        serviceCode = "purchase.resourceEnter"
 )
 
 @Java110ParamsDoc(params = {