瀏覽代碼

优化申请放行工鞥呢

Your Name 3 年之前
父節點
當前提交
a706c7c62c

+ 9 - 0
java110-bean/src/main/java/com/java110/dto/itemReleaseRes/ItemReleaseResDto.java

@@ -16,6 +16,7 @@ import java.util.Date;
 public class ItemReleaseResDto extends PageDto implements Serializable {
 public class ItemReleaseResDto extends PageDto implements Serializable {
 
 
     private String resName;
     private String resName;
+    private String amount;
     private String irId;
     private String irId;
     private String communityId;
     private String communityId;
     private String resId;
     private String resId;
@@ -74,4 +75,12 @@ public class ItemReleaseResDto extends PageDto implements Serializable {
     public void setStatusCd(String statusCd) {
     public void setStatusCd(String statusCd) {
         this.statusCd = statusCd;
         this.statusCd = statusCd;
     }
     }
+
+    public String getAmount() {
+        return amount;
+    }
+
+    public void setAmount(String amount) {
+        this.amount = amount;
+    }
 }
 }

+ 1 - 8
java110-bean/src/main/java/com/java110/po/itemRelease/ItemReleasePo.java

@@ -28,7 +28,7 @@ import java.util.Date;
  */
  */
 public class ItemReleasePo implements Serializable {
 public class ItemReleasePo implements Serializable {
 
 
-    private String amount;
+
     private String applyCompany;
     private String applyCompany;
     private String idCard;
     private String idCard;
     private String passTime;
     private String passTime;
@@ -42,13 +42,6 @@ public class ItemReleasePo implements Serializable {
     private String state;
     private String state;
     private String communityId;
     private String communityId;
 
 
-    public String getAmount() {
-        return amount;
-    }
-
-    public void setAmount(String amount) {
-        this.amount = amount;
-    }
 
 
     public String getApplyCompany() {
     public String getApplyCompany() {
         return applyCompany;
         return applyCompany;

+ 32 - 15
java110-bean/src/main/java/com/java110/po/itemReleaseRes/ItemReleaseResPo.java

@@ -17,6 +17,7 @@ package com.java110.po.itemReleaseRes;
 
 
 import java.io.Serializable;
 import java.io.Serializable;
 import java.util.Date;
 import java.util.Date;
+
 /**
 /**
  * 类表述: Po 数据模型实体对象 基本保持与数据库模型一直 用于 增加修改删除 等时的数据载体
  * 类表述: Po 数据模型实体对象 基本保持与数据库模型一直 用于 增加修改删除 等时的数据载体
  * add by 吴学文 at 2023-01-11 15:49:03 mail: 928255095@qq.com
  * add by 吴学文 at 2023-01-11 15:49:03 mail: 928255095@qq.com
@@ -28,41 +29,57 @@ import java.util.Date;
 public class ItemReleaseResPo implements Serializable {
 public class ItemReleaseResPo implements Serializable {
 
 
     private String resName;
     private String resName;
-private String irId;
-private String statusCd = "0";
-private String communityId;
-private String resId;
-public String getResName() {
+    private String amount;
+    private String irId;
+    private String statusCd = "0";
+    private String communityId;
+    private String resId;
+
+    public String getResName() {
         return resName;
         return resName;
     }
     }
-public void setResName(String resName) {
+
+    public void setResName(String resName) {
         this.resName = resName;
         this.resName = resName;
     }
     }
-public String getIrId() {
+
+    public String getIrId() {
         return irId;
         return irId;
     }
     }
-public void setIrId(String irId) {
+
+    public void setIrId(String irId) {
         this.irId = irId;
         this.irId = irId;
     }
     }
-public String getStatusCd() {
+
+    public String getStatusCd() {
         return statusCd;
         return statusCd;
     }
     }
-public void setStatusCd(String statusCd) {
+
+    public void setStatusCd(String statusCd) {
         this.statusCd = statusCd;
         this.statusCd = statusCd;
     }
     }
-public String getCommunityId() {
+
+    public String getCommunityId() {
         return communityId;
         return communityId;
     }
     }
-public void setCommunityId(String communityId) {
+
+    public void setCommunityId(String communityId) {
         this.communityId = communityId;
         this.communityId = communityId;
     }
     }
-public String getResId() {
+
+    public String getResId() {
         return resId;
         return resId;
     }
     }
-public void setResId(String resId) {
+
+    public void setResId(String resId) {
         this.resId = resId;
         this.resId = resId;
     }
     }
 
 
+    public String getAmount() {
+        return amount;
+    }
 
 
-
+    public void setAmount(String amount) {
+        this.amount = amount;
+    }
 }
 }

+ 77 - 67
java110-db/src/main/resources/mapper/common/ItemReleaseResV1ServiceDaoImplMapper.xml

@@ -5,93 +5,103 @@
 <mapper namespace="itemReleaseResV1ServiceDaoImpl">
 <mapper namespace="itemReleaseResV1ServiceDaoImpl">
 
 
 
 
-
-
-
     <!-- 保存放行物品信息 add by wuxw 2018-07-03 -->
     <!-- 保存放行物品信息 add by wuxw 2018-07-03 -->
     <insert id="saveItemReleaseResInfo" parameterType="Map">
     <insert id="saveItemReleaseResInfo" parameterType="Map">
         insert into item_release_res(
         insert into item_release_res(
-res_name,ir_id,community_id,res_id
-) values (
-#{resName},#{irId},#{communityId},#{resId}
-)
+        res_name,ir_id,community_id,res_id,amount
+        ) values (
+        #{resName},#{irId},#{communityId},#{resId},#{amount}
+        )
+    </insert>
+
+    <insert id="saveItemReleaseResesInfo" parameterType="Map">
+        insert into item_release_res(
+        res_name,ir_id,community_id,res_id,amount
+        ) values
+        <foreach collection="itemReleaseResPos" item="item" separator=",">
+            (#{item.resName},#{item.irId},#{item.communityId},#{item.resId},#{item.amount})
+        </foreach>
+
     </insert>
     </insert>
 
 
 
 
 
 
     <!-- 查询放行物品信息 add by wuxw 2018-07-03 -->
     <!-- 查询放行物品信息 add by wuxw 2018-07-03 -->
     <select id="getItemReleaseResInfo" parameterType="Map" resultType="Map">
     <select id="getItemReleaseResInfo" parameterType="Map" resultType="Map">
-        select  t.res_name,t.res_name resName,t.ir_id,t.ir_id irId,t.status_cd,t.status_cd statusCd,t.community_id,t.community_id communityId,t.res_id,t.res_id resId 
-from item_release_res t 
-where 1 =1 
-<if test="resName !=null and resName != ''">
-   and t.res_name= #{resName}
-</if> 
-<if test="irId !=null and irId != ''">
-   and t.ir_id= #{irId}
-</if> 
-<if test="statusCd !=null and statusCd != ''">
-   and t.status_cd= #{statusCd}
-</if> 
-<if test="communityId !=null and communityId != ''">
-   and t.community_id= #{communityId}
-</if> 
-<if test="resId !=null and resId != ''">
-   and t.res_id= #{resId}
-</if> 
-order by t.create_time desc
-<if test="page != -1 and page != null ">
-   limit #{page}, #{row}
-</if> 
+        select t.res_name,t.res_name resName,t.ir_id,t.ir_id irId,t.status_cd,t.status_cd
+        statusCd,t.community_id,t.community_id communityId,t.res_id,t.res_id resId,t.amount
+        from item_release_res t
+        where 1 =1
+        <if test="resName !=null and resName != ''">
+            and t.res_name= #{resName}
+        </if>
+        <if test="irId !=null and irId != ''">
+            and t.ir_id= #{irId}
+        </if>
+        <if test="statusCd !=null and statusCd != ''">
+            and t.status_cd= #{statusCd}
+        </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
+        <if test="resId !=null and resId != ''">
+            and t.res_id= #{resId}
+        </if>
+        order by t.create_time desc
+        <if test="page != -1 and page != null ">
+            limit #{page}, #{row}
+        </if>
 
 
     </select>
     </select>
 
 
 
 
-
-
     <!-- 修改放行物品信息 add by wuxw 2018-07-03 -->
     <!-- 修改放行物品信息 add by wuxw 2018-07-03 -->
     <update id="updateItemReleaseResInfo" parameterType="Map">
     <update id="updateItemReleaseResInfo" parameterType="Map">
-        update  item_release_res t set t.status_cd = #{statusCd}
-<if test="newBId != null and newBId != ''">
-,t.b_id = #{newBId}
-</if> 
-<if test="resName !=null and resName != ''">
-, t.res_name= #{resName}
-</if> 
-<if test="irId !=null and irId != ''">
-, t.ir_id= #{irId}
-</if> 
-<if test="communityId !=null and communityId != ''">
-, t.community_id= #{communityId}
-</if> 
- where 1=1 <if test="resId !=null and resId != ''">
-and t.res_id= #{resId}
-</if> 
+        update item_release_res t set t.status_cd = #{statusCd}
+        <if test="newBId != null and newBId != ''">
+            ,t.b_id = #{newBId}
+        </if>
+        <if test="resName !=null and resName != ''">
+            , t.res_name= #{resName}
+        </if>
+        <if test="amount !=null and amount != ''">
+            , t.amount= #{amount}
+        </if>
+        <if test="irId !=null and irId != ''">
+            , t.ir_id= #{irId}
+        </if>
+        <if test="communityId !=null and communityId != ''">
+            , t.community_id= #{communityId}
+        </if>
+        where 1=1
+        <if test="resId !=null and resId != ''">
+            and t.res_id= #{resId}
+        </if>
 
 
     </update>
     </update>
 
 
     <!-- 查询放行物品数量 add by wuxw 2018-07-03 -->
     <!-- 查询放行物品数量 add by wuxw 2018-07-03 -->
-     <select id="queryItemReleaseRessCount" parameterType="Map" resultType="Map">
-        select  count(1) count 
-from item_release_res t 
-where 1 =1 
-<if test="resName !=null and resName != ''">
-   and t.res_name= #{resName}
-</if> 
-<if test="irId !=null and irId != ''">
-   and t.ir_id= #{irId}
-</if> 
-<if test="statusCd !=null and statusCd != ''">
-   and t.status_cd= #{statusCd}
-</if> 
-<if test="communityId !=null and communityId != ''">
-   and t.community_id= #{communityId}
-</if> 
-<if test="resId !=null and resId != ''">
-   and t.res_id= #{resId}
-</if> 
+    <select id="queryItemReleaseRessCount" parameterType="Map" resultType="Map">
+        select count(1) count
+        from item_release_res t
+        where 1 =1
+        <if test="resName !=null and resName != ''">
+            and t.res_name= #{resName}
+        </if>
+        <if test="irId !=null and irId != ''">
+            and t.ir_id= #{irId}
+        </if>
+        <if test="statusCd !=null and statusCd != ''">
+            and t.status_cd= #{statusCd}
+        </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
+        <if test="resId !=null and resId != ''">
+            and t.res_id= #{resId}
+        </if>
 
 
 
 
-     </select>
+    </select>
 
 
 </mapper>
 </mapper>

+ 7 - 15
java110-db/src/main/resources/mapper/common/ItemReleaseV1ServiceDaoImplMapper.xml

@@ -7,23 +7,20 @@
     <!-- 保存放行管理信息 add by wuxw 2018-07-03 -->
     <!-- 保存放行管理信息 add by wuxw 2018-07-03 -->
     <insert id="saveItemReleaseInfo" parameterType="Map">
     <insert id="saveItemReleaseInfo" parameterType="Map">
         insert into item_release(
         insert into item_release(
-        amount,apply_company,id_card,pass_time,car_num,remark,apply_person,ir_id,apply_tel,type_id,state,community_id
+        apply_company,id_card,pass_time,car_num,remark,apply_person,ir_id,apply_tel,type_id,state,community_id
         ) values (
         ) values (
-        #{amount},#{applyCompany},#{idCard},#{passTime},#{carNum},#{remark},#{applyPerson},#{irId},#{applyTel},#{typeId},#{state},#{communityId}
+        #{applyCompany},#{idCard},#{passTime},#{carNum},#{remark},#{applyPerson},#{irId},#{applyTel},#{typeId},#{state},#{communityId}
         )
         )
     </insert>
     </insert>
 
 
     <!-- 查询放行管理信息 add by wuxw 2018-07-03 -->
     <!-- 查询放行管理信息 add by wuxw 2018-07-03 -->
     <select id="getItemReleaseInfo" parameterType="Map" resultType="Map">
     <select id="getItemReleaseInfo" parameterType="Map" resultType="Map">
-        select t.amount,t.apply_company,t.apply_company applyCompany,t.id_card,t.id_card idCard,t.pass_time,t.pass_time
+        select t.apply_company,t.apply_company applyCompany,t.id_card,t.id_card idCard,t.pass_time,t.pass_time
         passTime,t.car_num,t.car_num carNum,t.remark,t.status_cd,t.status_cd statusCd,t.apply_person,t.apply_person
         passTime,t.car_num,t.car_num carNum,t.remark,t.status_cd,t.status_cd statusCd,t.apply_person,t.apply_person
         applyPerson,t.ir_id,t.ir_id irId,t.apply_tel,t.apply_tel applyTel,t.type_id,t.type_id
         applyPerson,t.ir_id,t.ir_id irId,t.apply_tel,t.apply_tel applyTel,t.type_id,t.type_id
         typeId,t.state,t.community_id,t.community_id communityId
         typeId,t.state,t.community_id,t.community_id communityId
         from item_release t
         from item_release t
         where 1 =1
         where 1 =1
-        <if test="amount !=null and amount != ''">
-            and t.amount= #{amount}
-        </if>
         <if test="applyCompany !=null and applyCompany != ''">
         <if test="applyCompany !=null and applyCompany != ''">
             and t.apply_company= #{applyCompany}
             and t.apply_company= #{applyCompany}
         </if>
         </if>
@@ -71,9 +68,6 @@
     <!-- 修改放行管理信息 add by wuxw 2018-07-03 -->
     <!-- 修改放行管理信息 add by wuxw 2018-07-03 -->
     <update id="updateItemReleaseInfo" parameterType="Map">
     <update id="updateItemReleaseInfo" parameterType="Map">
         update item_release t set t.status_cd = #{statusCd}
         update item_release t set t.status_cd = #{statusCd}
-        <if test="newBId != null and newBId != ''">
-            ,t.b_id = #{newBId}
-        </if>
         <if test="amount !=null and amount != ''">
         <if test="amount !=null and amount != ''">
             , t.amount= #{amount}
             , t.amount= #{amount}
         </if>
         </if>
@@ -104,13 +98,14 @@
         <if test="state !=null and state != ''">
         <if test="state !=null and state != ''">
             , t.state= #{state}
             , t.state= #{state}
         </if>
         </if>
-        <if test="communityId !=null and communityId != ''">
-            , t.community_id= #{communityId}
-        </if>
+
         where 1=1
         where 1=1
         <if test="irId !=null and irId != ''">
         <if test="irId !=null and irId != ''">
             and t.ir_id= #{irId}
             and t.ir_id= #{irId}
         </if>
         </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
     </update>
     </update>
 
 
     <!-- 查询放行管理数量 add by wuxw 2018-07-03 -->
     <!-- 查询放行管理数量 add by wuxw 2018-07-03 -->
@@ -118,9 +113,6 @@
         select count(1) count
         select count(1) count
         from item_release t
         from item_release t
         where 1 =1
         where 1 =1
-        <if test="amount !=null and amount != ''">
-            and t.amount= #{amount}
-        </if>
         <if test="applyCompany !=null and applyCompany != ''">
         <if test="applyCompany !=null and applyCompany != ''">
             and t.apply_company= #{applyCompany}
             and t.apply_company= #{applyCompany}
         </if>
         </if>

+ 4 - 0
java110-interface/src/main/java/com/java110/intf/common/IItemReleaseResV1InnerServiceSMO.java

@@ -41,6 +41,10 @@ public interface IItemReleaseResV1InnerServiceSMO {
     @RequestMapping(value = "/saveItemReleaseRes", method = RequestMethod.POST)
     @RequestMapping(value = "/saveItemReleaseRes", method = RequestMethod.POST)
     public int saveItemReleaseRes(@RequestBody  ItemReleaseResPo itemReleaseResPo);
     public int saveItemReleaseRes(@RequestBody  ItemReleaseResPo itemReleaseResPo);
 
 
+
+    @RequestMapping(value = "/saveItemReleaseReses", method = RequestMethod.POST)
+    public int saveItemReleaseReses(@RequestBody  List<ItemReleaseResPo> itemReleaseResPos);
+
     @RequestMapping(value = "/updateItemReleaseRes", method = RequestMethod.POST)
     @RequestMapping(value = "/updateItemReleaseRes", method = RequestMethod.POST)
     public int updateItemReleaseRes(@RequestBody  ItemReleaseResPo itemReleaseResPo);
     public int updateItemReleaseRes(@RequestBody  ItemReleaseResPo itemReleaseResPo);
 
 

+ 2 - 0
java110-interface/src/main/java/com/java110/intf/common/IOaWorkflowUserInnerServiceSMO.java

@@ -25,6 +25,8 @@ public interface IOaWorkflowUserInnerServiceSMO {
      */
      */
     @RequestMapping(value = "/startProcess", method = RequestMethod.POST)
     @RequestMapping(value = "/startProcess", method = RequestMethod.POST)
     JSONObject startProcess(@RequestBody JSONObject reqJson);
     JSONObject startProcess(@RequestBody JSONObject reqJson);
+    @RequestMapping(value = "/autoFinishFirstTask", method = RequestMethod.POST)
+    boolean autoFinishFirstTask(@RequestBody JSONObject reqJson);
 
 
     /**
     /**
      * 查询用户任务数
      * 查询用户任务数

+ 132 - 2
service-common/src/main/java/com/java110/common/cmd/itemRelease/SaveItemReleaseCmd.java

@@ -15,6 +15,7 @@
  */
  */
 package com.java110.common.cmd.itemRelease;
 package com.java110.common.cmd.itemRelease;
 
 
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
 import com.java110.core.annotation.Java110Cmd;
 import com.java110.core.annotation.Java110Cmd;
 import com.java110.core.annotation.Java110Transactional;
 import com.java110.core.annotation.Java110Transactional;
@@ -23,16 +24,29 @@ import com.java110.core.event.cmd.Cmd;
 import com.java110.core.event.cmd.CmdEvent;
 import com.java110.core.event.cmd.CmdEvent;
 import com.java110.core.factory.GenerateCodeFactory;
 import com.java110.core.factory.GenerateCodeFactory;
 import com.java110.doc.annotation.*;
 import com.java110.doc.annotation.*;
+import com.java110.dto.itemReleaseType.ItemReleaseTypeDto;
+import com.java110.dto.oaWorkflow.OaWorkflowDto;
+import com.java110.dto.user.UserDto;
+import com.java110.intf.common.IItemReleaseResV1InnerServiceSMO;
+import com.java110.intf.common.IItemReleaseTypeV1InnerServiceSMO;
 import com.java110.intf.common.IItemReleaseV1InnerServiceSMO;
 import com.java110.intf.common.IItemReleaseV1InnerServiceSMO;
+import com.java110.intf.common.IOaWorkflowUserInnerServiceSMO;
+import com.java110.intf.oa.IOaWorkflowInnerServiceSMO;
+import com.java110.intf.user.IUserInnerServiceSMO;
 import com.java110.po.itemRelease.ItemReleasePo;
 import com.java110.po.itemRelease.ItemReleasePo;
+import com.java110.po.itemReleaseRes.ItemReleaseResPo;
 import com.java110.utils.exception.CmdException;
 import com.java110.utils.exception.CmdException;
 import com.java110.utils.util.Assert;
 import com.java110.utils.util.Assert;
 import com.java110.utils.util.BeanConvertUtil;
 import com.java110.utils.util.BeanConvertUtil;
+import com.java110.utils.util.StringUtil;
 import com.java110.vo.ResultVo;
 import com.java110.vo.ResultVo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.slf4j.Logger;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.slf4j.LoggerFactory;
 
 
+import java.util.ArrayList;
+import java.util.List;
+
 @Java110CmdDoc(title = "申请物品放行",
 @Java110CmdDoc(title = "申请物品放行",
         description = "申请物品放行",
         description = "申请物品放行",
         httpMethod = "post",
         httpMethod = "post",
@@ -61,7 +75,29 @@ import org.slf4j.LoggerFactory;
 )
 )
 
 
 @Java110ExampleDoc(
 @Java110ExampleDoc(
-        reqBody="{'typeId':'123','communityId':'123','applyCompany':'123','applyPerson':'123','idCard':'123','applyTel':'123','passTime':'123','amount':'123'}",
+        reqBody="{\n" +
+                "\t\"irId\": \"\",\n" +
+                "\t\"typeId\": \"102023011264340006\",\n" +
+                "\t\"applyCompany\": \"123123\",\n" +
+                "\t\"applyPerson\": \"12312\",\n" +
+                "\t\"idCard\": \"12312\",\n" +
+                "\t\"applyTel\": \"18909711443\",\n" +
+                "\t\"passTime\": \"2023-01-13 11:55:00\",\n" +
+                "\t\"resNames\": [{\n" +
+                "\t\t\"resName\": \"123\",\n" +
+                "\t\t\"amount\": \"123\"\n" +
+                "\t}],\n" +
+                "\t\"state\": \"\",\n" +
+                "\t\"carNum\": \"123123\",\n" +
+                "\t\"remark\": \"123\",\n" +
+                "\t\"audit\": {\n" +
+                "\t\t\"assignee\": \"-2\",\n" +
+                "\t\t\"staffId\": \"\",\n" +
+                "\t\t\"staffName\": \"\",\n" +
+                "\t\t\"taskId\": \"\"\n" +
+                "\t},\n" +
+                "\t\"communityId\": \"2022120695590004\"\n" +
+                "}",
         resBody="{'code':0,'msg':'成功'}"
         resBody="{'code':0,'msg':'成功'}"
 )
 )
 /**
 /**
@@ -84,6 +120,22 @@ public class SaveItemReleaseCmd extends Cmd {
     @Autowired
     @Autowired
     private IItemReleaseV1InnerServiceSMO itemReleaseV1InnerServiceSMOImpl;
     private IItemReleaseV1InnerServiceSMO itemReleaseV1InnerServiceSMOImpl;
 
 
+    @Autowired
+    private IItemReleaseResV1InnerServiceSMO itemReleaseResV1InnerServiceSMOImpl;
+
+    @Autowired
+    private IItemReleaseTypeV1InnerServiceSMO itemReleaseTypeV1InnerServiceSMOImpl;
+
+    @Autowired
+    private IOaWorkflowInnerServiceSMO oaWorkflowInnerServiceSMOImpl;
+
+    @Autowired
+    private IUserInnerServiceSMO userInnerServiceSMOImpl;
+
+    @Autowired
+    private IOaWorkflowUserInnerServiceSMO oaWorkflowUserInnerServiceSMOImpl;
+
+
     @Override
     @Override
     public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
     public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
         Assert.hasKeyAndValue(reqJson, "typeId", "请求报文中未包含typeId");
         Assert.hasKeyAndValue(reqJson, "typeId", "请求报文中未包含typeId");
@@ -92,14 +144,52 @@ public class SaveItemReleaseCmd extends Cmd {
         Assert.hasKeyAndValue(reqJson, "idCard", "请求报文中未包含idCard");
         Assert.hasKeyAndValue(reqJson, "idCard", "请求报文中未包含idCard");
         Assert.hasKeyAndValue(reqJson, "applyTel", "请求报文中未包含applyTel");
         Assert.hasKeyAndValue(reqJson, "applyTel", "请求报文中未包含applyTel");
         Assert.hasKeyAndValue(reqJson, "passTime", "请求报文中未包含passTime");
         Assert.hasKeyAndValue(reqJson, "passTime", "请求报文中未包含passTime");
-        Assert.hasKeyAndValue(reqJson, "amount", "请求报文中未包含amount");
         Assert.hasKeyAndValue(reqJson, "communityId", "请求报文中未包含communityId");
         Assert.hasKeyAndValue(reqJson, "communityId", "请求报文中未包含communityId");
+
+        //校验物品是否存在
+        if(!reqJson.containsKey("resNames")){
+            throw new CmdException("未包含物品");
+        }
+
+        JSONArray resNames = reqJson.getJSONArray("resNames");
+        if(resNames == null || resNames.size() < 1){
+            throw new CmdException("未包含物品");
+        }
     }
     }
 
 
     @Override
     @Override
     @Java110Transactional
     @Java110Transactional
     public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
     public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
 
 
+        String storeId = cmdDataFlowContext.getReqHeaders().get("store-id");
+        String userId = cmdDataFlowContext.getReqHeaders().get("user-id");
+
+        ItemReleaseTypeDto itemReleaseTypeDto = new ItemReleaseTypeDto();
+        itemReleaseTypeDto.setTypeId(reqJson.getString("typeId"));
+        itemReleaseTypeDto.setCommunityId(reqJson.getString("communityId"));
+        List<ItemReleaseTypeDto> itemReleaseTypeDtos = itemReleaseTypeV1InnerServiceSMOImpl.queryItemReleaseTypes(itemReleaseTypeDto);
+        Assert.listOnlyOne(itemReleaseTypeDtos,"未包含放行类型");
+
+        OaWorkflowDto oaWorkflowDto = new OaWorkflowDto();
+        oaWorkflowDto.setStoreId(storeId);
+        oaWorkflowDto.setFlowId(itemReleaseTypeDtos.get(0).getFlowId());
+        List<OaWorkflowDto> oaWorkflowDtos = oaWorkflowInnerServiceSMOImpl.queryOaWorkflows(oaWorkflowDto);
+        Assert.listOnlyOne(oaWorkflowDtos, "流程不存在");
+        if (!OaWorkflowDto.STATE_COMPLAINT.equals(oaWorkflowDtos.get(0).getState())) {
+            throw new IllegalArgumentException(oaWorkflowDtos.get(0).getFlowName() + "流程未部署");
+        }
+
+        if (StringUtil.isEmpty(oaWorkflowDtos.get(0).getProcessDefinitionKey())) {
+            throw new IllegalArgumentException(oaWorkflowDtos.get(0).getFlowName() + "流程未部署");
+        }
+
+        //查询用户名称
+        UserDto userDto = new UserDto();
+        userDto.setUserId(userId);
+        List<UserDto> userDtos = userInnerServiceSMOImpl.getUsers(userDto);
+        Assert.listOnlyOne(userDtos, "用户不存在");
+
+
         ItemReleasePo itemReleasePo = BeanConvertUtil.covertBean(reqJson, ItemReleasePo.class);
         ItemReleasePo itemReleasePo = BeanConvertUtil.covertBean(reqJson, ItemReleasePo.class);
         itemReleasePo.setIrId(GenerateCodeFactory.getGeneratorId(CODE_PREFIX_ID));
         itemReleasePo.setIrId(GenerateCodeFactory.getGeneratorId(CODE_PREFIX_ID));
         int flag = itemReleaseV1InnerServiceSMOImpl.saveItemRelease(itemReleasePo);
         int flag = itemReleaseV1InnerServiceSMOImpl.saveItemRelease(itemReleasePo);
@@ -108,6 +198,46 @@ public class SaveItemReleaseCmd extends Cmd {
             throw new CmdException("保存数据失败");
             throw new CmdException("保存数据失败");
         }
         }
 
 
+        JSONArray resNames = reqJson.getJSONArray("resNames");
+        JSONObject resNameObj = null;
+        ItemReleaseResPo itemReleaseResPo = null;
+        List<ItemReleaseResPo> itemReleaseResPos = new ArrayList<>();
+        for(int resNameIndex = 0; resNameIndex< resNames.size(); resNameIndex++){
+            resNameObj = resNames.getJSONObject(resNameIndex);
+            itemReleaseResPo = new ItemReleaseResPo();
+            itemReleaseResPo.setAmount(resNameObj.getString("amount"));
+            itemReleaseResPo.setResName(resNameObj.getString("resName"));
+            itemReleaseResPo.setResId(GenerateCodeFactory.getGeneratorId(CODE_PREFIX_ID));
+            itemReleaseResPo.setIrId(itemReleasePo.getIrId());
+            itemReleaseResPo.setCommunityId(itemReleasePo.getCommunityId());
+            itemReleaseResPos.add(itemReleaseResPo);
+        }
+
+        flag = itemReleaseResV1InnerServiceSMOImpl.saveItemReleaseReses(itemReleaseResPos);
+
+        if (flag < 1) {
+            throw new CmdException("保存数据失败");
+        }
+
+        //启动任务
+        JSONObject flowJson = new JSONObject();
+        flowJson.put("processDefinitionKey", oaWorkflowDtos.get(0).getProcessDefinitionKey());
+        flowJson.put("createUserId",userId);
+        flowJson.put("flowId",oaWorkflowDtos.get(0).getFlowId());
+        flowJson.put("id",itemReleasePo.getIrId());
+        flowJson.put("auditMessage","提交审核");
+        flowJson.put("storeId",storeId);
+        reqJson.put("processDefinitionKey", oaWorkflowDtos.get(0).getProcessDefinitionKey());
+        JSONObject result = oaWorkflowUserInnerServiceSMOImpl.startProcess(flowJson);
+
+        //提交者提交
+        flowJson = new JSONObject();
+        flowJson.put("processInstanceId",result.getString("processInstanceId"));
+        flowJson.put("createUserId",userId);
+        flowJson.put("nextUserId",reqJson.getJSONObject("audit").getString("staffId"));
+        oaWorkflowUserInnerServiceSMOImpl.autoFinishFirstTask(flowJson);
+
+
         cmdDataFlowContext.setResponseEntity(ResultVo.success());
         cmdDataFlowContext.setResponseEntity(ResultVo.success());
     }
     }
 }
 }

+ 1 - 0
service-common/src/main/java/com/java110/common/dao/IItemReleaseResV1ServiceDao.java

@@ -74,4 +74,5 @@ public interface IItemReleaseResV1ServiceDao {
      */
      */
     int queryItemReleaseRessCount(Map info);
     int queryItemReleaseRessCount(Map info);
 
 
+    int saveItemReleaseResesInfo(Map info);
 }
 }

+ 11 - 0
service-common/src/main/java/com/java110/common/dao/impl/ItemReleaseResV1ServiceDaoImpl.java

@@ -61,6 +61,17 @@ public class ItemReleaseResV1ServiceDaoImpl extends BaseServiceDao implements II
     }
     }
 
 
 
 
+    @Override
+    public int saveItemReleaseResesInfo(Map info) {
+        logger.debug("保存 saveItemReleaseResesInfo 入参 info : {}",info);
+
+        int saveFlag = sqlSessionTemplate.insert("itemReleaseResV1ServiceDaoImpl.saveItemReleaseResesInfo",info);
+
+        return saveFlag;
+    }
+
+
+
     /**
     /**
      * 查询放行物品信息(instance)
      * 查询放行物品信息(instance)
      * @param info bId 信息
      * @param info bId 信息

+ 12 - 0
service-common/src/main/java/com/java110/common/smo/impl/ItemReleaseResV1InnerServiceSMOImpl.java

@@ -26,10 +26,14 @@ import com.java110.dto.user.UserDto;
 import com.java110.dto.PageDto;
 import com.java110.dto.PageDto;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.bind.annotation.RestController;
 
 
 import java.util.ArrayList;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
 import java.util.List;
+import java.util.Map;
 
 
 /**
 /**
  * 类表述: 服务之前调用的接口实现类,不对外提供接口能力 只用于接口建调用
  * 类表述: 服务之前调用的接口实现类,不对外提供接口能力 只用于接口建调用
@@ -52,6 +56,14 @@ public class ItemReleaseResV1InnerServiceSMOImpl extends BaseServiceSMO implemen
         return saveFlag;
         return saveFlag;
     }
     }
 
 
+    @RequestMapping(value = "/saveItemReleaseReses", method = RequestMethod.POST)
+    public int saveItemReleaseReses(@RequestBody  List<ItemReleaseResPo> itemReleaseResPos){
+        Map info = new HashMap<>();
+        info.put("itemReleaseResPos",itemReleaseResPos);
+        int saveFlag = itemReleaseResV1ServiceDaoImpl.saveItemReleaseResesInfo(info);
+        return saveFlag;
+    }
+
      @Override
      @Override
     public int updateItemReleaseRes(@RequestBody  ItemReleaseResPo itemReleaseResPo) {
     public int updateItemReleaseRes(@RequestBody  ItemReleaseResPo itemReleaseResPo) {
         int saveFlag = itemReleaseResV1ServiceDaoImpl.updateItemReleaseResInfo(BeanConvertUtil.beanCovertMap(itemReleaseResPo));
         int saveFlag = itemReleaseResV1ServiceDaoImpl.updateItemReleaseResInfo(BeanConvertUtil.beanCovertMap(itemReleaseResPo));

+ 2 - 2
service-common/src/main/java/com/java110/common/smo/impl/OaWorkflowUserInnerServiceSMOImpl.java

@@ -129,7 +129,7 @@ public class OaWorkflowUserInnerServiceSMOImpl extends BaseServiceSMO implements
     /**
     /**
      * 自动提交第一步
      * 自动提交第一步
      */
      */
-    private void autoFinishFirstTask(JSONObject reqJson) {
+    public boolean autoFinishFirstTask(@RequestBody JSONObject reqJson) {
         Task task = null;
         Task task = null;
         TaskQuery query = taskService.createTaskQuery().taskCandidateOrAssigned(reqJson.getString("createUserId")).active();
         TaskQuery query = taskService.createTaskQuery().taskCandidateOrAssigned(reqJson.getString("createUserId")).active();
         List<Task> todoList = query.list();//获取申请人的待办任务列表
         List<Task> todoList = query.list();//获取申请人的待办任务列表
@@ -143,7 +143,7 @@ public class OaWorkflowUserInnerServiceSMOImpl extends BaseServiceSMO implements
         reqJson.put("taskId", task.getId());
         reqJson.put("taskId", task.getId());
         reqJson.put("auditCode", "10000");
         reqJson.put("auditCode", "10000");
         reqJson.put("auditMessage", "提交");
         reqJson.put("auditMessage", "提交");
-        completeTask(reqJson);
+        return completeTask(reqJson);
     }
     }
 
 
     /**
     /**