java110
2021-04-29 ef73a35d0eecb7673a3129c117684300e8ee9e12
优化代码
13个文件已修改
864 ■■■■■ 已修改文件
java110-bean/src/main/java/com/java110/dto/allocationStorehouse/AllocationStorehouseDto.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-bean/src/main/java/com/java110/dto/allocationStorehouseApply/AllocationStorehouseApplyDto.java 133 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-bean/src/main/java/com/java110/po/allocationStorehouse/AllocationStorehousePo.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-db/src/main/resources/mapper/store/AllocationStorehouseApplyServiceDaoImplMapper.xml 348 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-db/src/main/resources/mapper/store/AllocationStorehouseServiceDaoImplMapper.xml 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-interface/src/main/java/com/java110/intf/common/IAllocationStorehouseUserInnerServiceSMO.java 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-api/src/main/java/com/java110/api/listener/resourceStore/AuditAllocationStoreOrderListener.java 92 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-api/src/main/java/com/java110/api/listener/resourceStore/ListAllocationStoreAuditOrdersListener.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-api/src/main/java/com/java110/api/listener/resourceStore/ListAllocationStoreHisAuditOrders.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-api/src/main/java/com/java110/api/listener/resourceStore/SaveAllocationStorehouseListener.java 113 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-common/src/main/java/com/java110/common/smo/impl/AllocationStorehouseUserInnerServiceSMOImpl.java 99 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-store/src/main/java/com/java110/store/dao/impl/AllocationStorehouseApplyServiceDaoImpl.java 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-store/src/main/java/com/java110/store/listener/allocationStorehouse/AbstractAllocationStorehouseBusinessServiceDataFlowListener.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-bean/src/main/java/com/java110/dto/allocationStorehouse/AllocationStorehouseDto.java
@@ -35,6 +35,7 @@
    private String shzName;
    private String resCode;
    private Date createTime;
    private String applyId;
    private String statusCd = "0";
@@ -257,4 +258,12 @@
    public void setResCode(String resCode) {
        this.resCode = resCode;
    }
    public String getApplyId() {
        return applyId;
    }
    public void setApplyId(String applyId) {
        this.applyId = applyId;
    }
}
java110-bean/src/main/java/com/java110/dto/allocationStorehouseApply/AllocationStorehouseApplyDto.java
@@ -1,6 +1,7 @@
package com.java110.dto.allocationStorehouseApply;
import com.java110.dto.PageDto;
import java.io.Serializable;
import java.util.Date;
@@ -15,12 +16,21 @@
public class AllocationStorehouseApplyDto extends PageDto implements Serializable {
    private String applyId;
private String startUserId;
private String startUserName;
private String applyCount;
private String remark;
private String state;
private String storeId;
    private String[] applyIds;
    private String startUserId;
    private String startUserName;
    private String applyCount;
    private String remark;
    private String state;
    private String storeId;
    private String currentUserId;
    private String processInstanceId;
    private String taskId;
    private String auditCode;
    private String auditMessage;
    private String staffId;
    private String staffName;
    private String staffTel;
    private Date createTime;
@@ -31,43 +41,56 @@
    public String getApplyId() {
        return applyId;
    }
public void setApplyId(String applyId) {
    public void setApplyId(String applyId) {
        this.applyId = applyId;
    }
public String getStartUserId() {
    public String getStartUserId() {
        return startUserId;
    }
public void setStartUserId(String startUserId) {
    public void setStartUserId(String startUserId) {
        this.startUserId = startUserId;
    }
public String getStartUserName() {
    public String getStartUserName() {
        return startUserName;
    }
public void setStartUserName(String startUserName) {
    public void setStartUserName(String startUserName) {
        this.startUserName = startUserName;
    }
public String getApplyCount() {
    public String getApplyCount() {
        return applyCount;
    }
public void setApplyCount(String applyCount) {
    public void setApplyCount(String applyCount) {
        this.applyCount = applyCount;
    }
public String getRemark() {
    public String getRemark() {
        return remark;
    }
public void setRemark(String remark) {
    public void setRemark(String remark) {
        this.remark = remark;
    }
public String getState() {
    public String getState() {
        return state;
    }
public void setState(String state) {
    public void setState(String state) {
        this.state = state;
    }
public String getStoreId() {
    public String getStoreId() {
        return storeId;
    }
public void setStoreId(String storeId) {
    public void setStoreId(String storeId) {
        this.storeId = storeId;
    }
@@ -87,4 +110,76 @@
    public void setStatusCd(String statusCd) {
        this.statusCd = statusCd;
    }
    public String getCurrentUserId() {
        return currentUserId;
    }
    public void setCurrentUserId(String currentUserId) {
        this.currentUserId = currentUserId;
    }
    public String getProcessInstanceId() {
        return processInstanceId;
    }
    public void setProcessInstanceId(String processInstanceId) {
        this.processInstanceId = processInstanceId;
    }
    public String getTaskId() {
        return taskId;
    }
    public void setTaskId(String taskId) {
        this.taskId = taskId;
    }
    public String getAuditCode() {
        return auditCode;
    }
    public void setAuditCode(String auditCode) {
        this.auditCode = auditCode;
    }
    public String getAuditMessage() {
        return auditMessage;
    }
    public void setAuditMessage(String auditMessage) {
        this.auditMessage = auditMessage;
    }
    public String getStaffId() {
        return staffId;
    }
    public void setStaffId(String staffId) {
        this.staffId = staffId;
    }
    public String getStaffName() {
        return staffName;
    }
    public void setStaffName(String staffName) {
        this.staffName = staffName;
    }
    public String getStaffTel() {
        return staffTel;
    }
    public void setStaffTel(String staffTel) {
        this.staffTel = staffTel;
    }
    public String[] getApplyIds() {
        return applyIds;
    }
    public void setApplyIds(String[] applyIds) {
        this.applyIds = applyIds;
    }
}
java110-bean/src/main/java/com/java110/po/allocationStorehouse/AllocationStorehousePo.java
@@ -16,6 +16,7 @@
    private String stock;
    private String remark;
    private String statusCd;
    private String applyId;
    public String getAsId() {
        return asId;
@@ -112,4 +113,12 @@
    public void setStatusCd(String statusCd) {
        this.statusCd = statusCd;
    }
    public String getApplyId() {
        return applyId;
    }
    public void setApplyId(String applyId) {
        this.applyId = applyId;
    }
}
java110-db/src/main/resources/mapper/store/AllocationStorehouseApplyServiceDaoImplMapper.xml
@@ -2,201 +2,213 @@
<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="allocationAllocationStorehouseApplyhouseApplyServiceDaoImpl">
<mapper namespace="allocationStorehouseApplyServiceDaoImpl">
    <!-- 保存调拨申请信息 add by wuxw 2018-07-03 -->
       <insert id="saveBusinessAllocationStorehouseApplyInfo" parameterType="Map">
           insert into business_allocation_storehouse_apply(
apply_id,start_user_id,operate,start_user_name,apply_count,remark,state,b_id,store_id
) values (
#{applyId},#{startUserId},#{operate},#{startUserName},#{applyCount},#{remark},#{state},#{bId},#{storeId}
)
       </insert>
    <insert id="saveBusinessAllocationStorehouseApplyInfo" parameterType="Map">
        insert into business_allocation_storehouse_apply(
        apply_id,start_user_id,operate,start_user_name,apply_count,remark,state,b_id,store_id
        ) values (
        #{applyId},#{startUserId},#{operate},#{startUserName},#{applyCount},#{remark},#{state},#{bId},#{storeId}
        )
    </insert>
       <!-- 查询调拨申请信息(Business) add by wuxw 2018-07-03 -->
       <select id="getBusinessAllocationStorehouseApplyInfo" parameterType="Map" resultType="Map">
           select  t.apply_id,t.apply_id applyId,t.start_user_id,t.start_user_id startUserId,t.operate,t.start_user_name,t.start_user_name startUserName,t.apply_count,t.apply_count applyCount,t.remark,t.state,t.b_id,t.b_id bId,t.store_id,t.store_id storeId
from business_allocation_storehouse_apply t
where 1 =1
<if test="applyId !=null and applyId != ''">
   and t.apply_id= #{applyId}
</if>
<if test="startUserId !=null and startUserId != ''">
   and t.start_user_id= #{startUserId}
</if>
<if test="operate !=null and operate != ''">
   and t.operate= #{operate}
</if>
<if test="startUserName !=null and startUserName != ''">
   and t.start_user_name= #{startUserName}
</if>
<if test="applyCount !=null and applyCount != ''">
   and t.apply_count= #{applyCount}
</if>
<if test="remark !=null and remark != ''">
   and t.remark= #{remark}
</if>
<if test="state !=null and state != ''">
   and t.state= #{state}
</if>
<if test="bId !=null and bId != ''">
   and t.b_id= #{bId}
</if>
<if test="storeId !=null and storeId != ''">
   and t.store_id= #{storeId}
</if>
    <!-- 查询调拨申请信息(Business) add by wuxw 2018-07-03 -->
    <select id="getBusinessAllocationStorehouseApplyInfo" parameterType="Map" resultType="Map">
        select t.apply_id,t.apply_id applyId,t.start_user_id,t.start_user_id
        startUserId,t.operate,t.start_user_name,t.start_user_name startUserName,t.apply_count,t.apply_count
        applyCount,t.remark,t.state,t.b_id,t.b_id bId,t.store_id,t.store_id storeId
        from business_allocation_storehouse_apply t
        where 1 =1
        <if test="applyId !=null and applyId != ''">
            and t.apply_id= #{applyId}
        </if>
        <if test="startUserId !=null and startUserId != ''">
            and t.start_user_id= #{startUserId}
        </if>
        <if test="operate !=null and operate != ''">
            and t.operate= #{operate}
        </if>
        <if test="startUserName !=null and startUserName != ''">
            and t.start_user_name= #{startUserName}
        </if>
        <if test="applyCount !=null and applyCount != ''">
            and t.apply_count= #{applyCount}
        </if>
        <if test="remark !=null and remark != ''">
            and t.remark= #{remark}
        </if>
        <if test="state !=null and state != ''">
            and t.state= #{state}
        </if>
        <if test="bId !=null and bId != ''">
            and t.b_id= #{bId}
        </if>
        <if test="storeId !=null and storeId != ''">
            and t.store_id= #{storeId}
        </if>
       </select>
    </select>
    <!-- 保存调拨申请信息至 instance表中 add by wuxw 2018-07-03 -->
    <insert id="saveAllocationStorehouseApplyInfoInstance" parameterType="Map">
        insert into allocation_storehouse_apply(
apply_id,start_user_id,start_user_name,apply_count,remark,status_cd,state,b_id,store_id
) select t.apply_id,t.start_user_id,t.start_user_name,t.apply_count,t.remark,'0',t.state,t.b_id,t.store_id from business_allocation_storehouse_apply t where 1=1
<if test="applyId !=null and applyId != ''">
   and t.apply_id= #{applyId}
</if>
<if test="startUserId !=null and startUserId != ''">
   and t.start_user_id= #{startUserId}
</if>
   and t.operate= 'ADD'
<if test="startUserName !=null and startUserName != ''">
   and t.start_user_name= #{startUserName}
</if>
<if test="applyCount !=null and applyCount != ''">
   and t.apply_count= #{applyCount}
</if>
<if test="remark !=null and remark != ''">
   and t.remark= #{remark}
</if>
<if test="state !=null and state != ''">
   and t.state= #{state}
</if>
<if test="bId !=null and bId != ''">
   and t.b_id= #{bId}
</if>
<if test="storeId !=null and storeId != ''">
   and t.store_id= #{storeId}
</if>
        apply_id,start_user_id,start_user_name,apply_count,remark,status_cd,state,b_id,store_id
        ) select t.apply_id,t.start_user_id,t.start_user_name,t.apply_count,t.remark,'0',t.state,t.b_id,t.store_id from
        business_allocation_storehouse_apply t where 1=1
        <if test="applyId !=null and applyId != ''">
            and t.apply_id= #{applyId}
        </if>
        <if test="startUserId !=null and startUserId != ''">
            and t.start_user_id= #{startUserId}
        </if>
        and t.operate= 'ADD'
        <if test="startUserName !=null and startUserName != ''">
            and t.start_user_name= #{startUserName}
        </if>
        <if test="applyCount !=null and applyCount != ''">
            and t.apply_count= #{applyCount}
        </if>
        <if test="remark !=null and remark != ''">
            and t.remark= #{remark}
        </if>
        <if test="state !=null and state != ''">
            and t.state= #{state}
        </if>
        <if test="bId !=null and bId != ''">
            and t.b_id= #{bId}
        </if>
        <if test="storeId !=null and storeId != ''">
            and t.store_id= #{storeId}
        </if>
    </insert>
    <!-- 查询调拨申请信息 add by wuxw 2018-07-03 -->
    <select id="getAllocationStorehouseApplyInfo" parameterType="Map" resultType="Map">
        select  t.apply_id,t.apply_id applyId,t.start_user_id,t.start_user_id startUserId,t.start_user_name,t.start_user_name startUserName,t.apply_count,t.apply_count applyCount,t.remark,t.status_cd,t.status_cd statusCd,t.state,t.b_id,t.b_id bId,t.store_id,t.store_id storeId
from allocation_storehouse_apply t
where 1 =1
<if test="applyId !=null and applyId != ''">
   and t.apply_id= #{applyId}
</if>
<if test="startUserId !=null and startUserId != ''">
   and t.start_user_id= #{startUserId}
</if>
<if test="startUserName !=null and startUserName != ''">
   and t.start_user_name= #{startUserName}
</if>
<if test="applyCount !=null and applyCount != ''">
   and t.apply_count= #{applyCount}
</if>
<if test="remark !=null and remark != ''">
   and t.remark= #{remark}
</if>
<if test="statusCd !=null and statusCd != ''">
   and t.status_cd= #{statusCd}
</if>
<if test="state !=null and state != ''">
   and t.state= #{state}
</if>
<if test="bId !=null and bId != ''">
   and t.b_id= #{bId}
</if>
<if test="storeId !=null and storeId != ''">
   and t.store_id= #{storeId}
</if>
order by t.create_time desc
<if test="page != -1 and page != null ">
   limit #{page}, #{row}
</if>
        select t.apply_id,t.apply_id applyId,t.start_user_id,t.start_user_id
        startUserId,t.start_user_name,t.start_user_name startUserName,t.apply_count,t.apply_count
        applyCount,t.remark,t.status_cd,t.status_cd statusCd,t.state,t.b_id,t.b_id bId,t.store_id,t.store_id storeId
        from allocation_storehouse_apply t
        where 1 =1
        <if test="applyId !=null and applyId != ''">
            and t.apply_id= #{applyId}
        </if>
        <if test="applyIds !=null ">
            and t.apply_id in
            <foreach collection="applyIds" item="item" open="(" close=")" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="startUserId !=null and startUserId != ''">
            and t.start_user_id= #{startUserId}
        </if>
        <if test="startUserName !=null and startUserName != ''">
            and t.start_user_name= #{startUserName}
        </if>
        <if test="applyCount !=null and applyCount != ''">
            and t.apply_count= #{applyCount}
        </if>
        <if test="remark !=null and remark != ''">
            and t.remark= #{remark}
        </if>
        <if test="statusCd !=null and statusCd != ''">
            and t.status_cd= #{statusCd}
        </if>
        <if test="state !=null and state != ''">
            and t.state= #{state}
        </if>
        <if test="bId !=null and bId != ''">
            and t.b_id= #{bId}
        </if>
        <if test="storeId !=null and storeId != ''">
            and t.store_id= #{storeId}
        </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="updateAllocationStorehouseApplyInfoInstance" parameterType="Map">
        update  allocation_storehouse_apply t set t.status_cd = #{statusCd}
<if test="newBId != null and newBId != ''">
,t.b_id = #{newBId}
</if>
<if test="startUserId !=null and startUserId != ''">
, t.start_user_id= #{startUserId}
</if>
<if test="startUserName !=null and startUserName != ''">
, t.start_user_name= #{startUserName}
</if>
<if test="applyCount !=null and applyCount != ''">
, t.apply_count= #{applyCount}
</if>
<if test="remark !=null and remark != ''">
, t.remark= #{remark}
</if>
<if test="state !=null and state != ''">
, t.state= #{state}
</if>
<if test="storeId !=null and storeId != ''">
, t.store_id= #{storeId}
</if>
 where 1=1 <if test="applyId !=null and applyId != ''">
and t.apply_id= #{applyId}
</if>
<if test="bId !=null and bId != ''">
and t.b_id= #{bId}
</if>
        update allocation_storehouse_apply t set t.status_cd = #{statusCd}
        <if test="newBId != null and newBId != ''">
            ,t.b_id = #{newBId}
        </if>
        <if test="startUserId !=null and startUserId != ''">
            , t.start_user_id= #{startUserId}
        </if>
        <if test="startUserName !=null and startUserName != ''">
            , t.start_user_name= #{startUserName}
        </if>
        <if test="applyCount !=null and applyCount != ''">
            , t.apply_count= #{applyCount}
        </if>
        <if test="remark !=null and remark != ''">
            , t.remark= #{remark}
        </if>
        <if test="state !=null and state != ''">
            , t.state= #{state}
        </if>
        <if test="storeId !=null and storeId != ''">
            , t.store_id= #{storeId}
        </if>
        where 1=1
        <if test="applyId !=null and applyId != ''">
            and t.apply_id= #{applyId}
        </if>
        <if test="bId !=null and bId != ''">
            and t.b_id= #{bId}
        </if>
    </update>
    <!-- 查询调拨申请数量 add by wuxw 2018-07-03 -->
     <select id="queryAllocationStorehouseApplysCount" parameterType="Map" resultType="Map">
        select  count(1) count
from allocation_storehouse_apply t
where 1 =1
<if test="applyId !=null and applyId != ''">
   and t.apply_id= #{applyId}
</if>
<if test="startUserId !=null and startUserId != ''">
   and t.start_user_id= #{startUserId}
</if>
<if test="startUserName !=null and startUserName != ''">
   and t.start_user_name= #{startUserName}
</if>
<if test="applyCount !=null and applyCount != ''">
   and t.apply_count= #{applyCount}
</if>
<if test="remark !=null and remark != ''">
   and t.remark= #{remark}
</if>
<if test="statusCd !=null and statusCd != ''">
   and t.status_cd= #{statusCd}
</if>
<if test="state !=null and state != ''">
   and t.state= #{state}
</if>
<if test="bId !=null and bId != ''">
   and t.b_id= #{bId}
</if>
<if test="storeId !=null and storeId != ''">
   and t.store_id= #{storeId}
</if>
    <select id="queryAllocationStorehouseApplysCount" parameterType="Map" resultType="Map">
        select count(1) count
        from allocation_storehouse_apply t
        where 1 =1
        <if test="applyId !=null and applyId != ''">
            and t.apply_id= #{applyId}
        </if>
        <if test="applyIds !=null ">
            and t.apply_id in
            <foreach collection="applyIds" item="item" open="(" close=")" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="startUserId !=null and startUserId != ''">
            and t.start_user_id= #{startUserId}
        </if>
        <if test="startUserName !=null and startUserName != ''">
            and t.start_user_name= #{startUserName}
        </if>
        <if test="applyCount !=null and applyCount != ''">
            and t.apply_count= #{applyCount}
        </if>
        <if test="remark !=null and remark != ''">
            and t.remark= #{remark}
        </if>
        <if test="statusCd !=null and statusCd != ''">
            and t.status_cd= #{statusCd}
        </if>
        <if test="state !=null and state != ''">
            and t.state= #{state}
        </if>
        <if test="bId !=null and bId != ''">
            and t.b_id= #{bId}
        </if>
        <if test="storeId !=null and storeId != ''">
            and t.store_id= #{storeId}
        </if>
     </select>
    </select>
</mapper>
java110-db/src/main/resources/mapper/store/AllocationStorehouseServiceDaoImplMapper.xml
@@ -7,9 +7,9 @@
    <!-- 保存仓库调拨信息 add by wuxw 2018-07-03 -->
    <insert id="saveBusinessAllocationStorehouseInfo" parameterType="Map">
        insert into business_allocation_storehouse(
        as_id,store_id,res_id,sh_id_z,res_name,start_user_id,operate,sh_id_a,start_user_name,state,b_id,stock,remark
        as_id,store_id,res_id,sh_id_z,res_name,start_user_id,operate,sh_id_a,start_user_name,state,b_id,stock,remark,apply_id
        ) values (
        #{asId},#{storeId},#{resId},#{shIdz},#{resName},#{startUserId},#{operate},#{shIda},#{startUserName},#{state},#{bId},#{stock},#{remark}
        #{asId},#{storeId},#{resId},#{shIdz},#{resName},#{startUserId},#{operate},#{shIda},#{startUserName},#{state},#{bId},#{stock},#{remark},#{applyId}
        )
    </insert>
@@ -17,7 +17,7 @@
    <select id="getBusinessAllocationStorehouseInfo" parameterType="Map" resultType="Map">
        select t.as_id,t.as_id asId,t.store_id,t.store_id storeId,t.res_id,t.res_id resId,t.sh_id_z,t.sh_id_z
        shIdz,t.res_name,t.res_name resName,t.start_user_id,t.start_user_id startUserId,t.operate,t.sh_id_a,t.sh_id_a
        shIda,t.start_user_name,t.start_user_name startUserName,t.state,t.b_id,t.b_id bId,t.stock,t.remark
        shIda,t.start_user_name,t.start_user_name startUserName,t.state,t.b_id,t.b_id bId,t.stock,t.remark,t.apply_id,t.apply_id applyId
        from business_allocation_storehouse t
        where 1 =1
        <if test="asId !=null and asId != ''">
@@ -61,9 +61,9 @@
    <!-- 保存仓库调拨信息至 instance表中 add by wuxw 2018-07-03 -->
    <insert id="saveAllocationStorehouseInfoInstance" parameterType="Map">
        insert into allocation_storehouse(
        as_id,status_cd,store_id,res_id,sh_id_z,res_name,start_user_id,sh_id_a,start_user_name,state,b_id,stock,remark
        as_id,status_cd,store_id,res_id,sh_id_z,res_name,start_user_id,sh_id_a,start_user_name,state,b_id,stock,remark,apply_id
        ) select
        t.as_id,'0',t.store_id,t.res_id,t.sh_id_z,t.res_name,t.start_user_id,t.sh_id_a,t.start_user_name,t.state,t.b_id,t.stock,t.remark
        t.as_id,'0',t.store_id,t.res_id,t.sh_id_z,t.res_name,t.start_user_id,t.sh_id_a,t.start_user_name,t.state,t.b_id,t.stock,t.remark,t.apply_id
        from business_allocation_storehouse t where 1=1
        <if test="asId !=null and asId != ''">
            and t.as_id= #{asId}
@@ -107,7 +107,7 @@
        resId,t.sh_id_z,t.sh_id_z shIdz,t.res_name,t.res_name resName,t.start_user_id,t.start_user_id
        startUserId,t.sh_id_a,t.sh_id_a shIda,t.start_user_name,t.start_user_name startUserName,t.state,t.b_id,t.b_id
        bId,t.stock,t.remark,t.create_time createTime,td.name stateName,a.sh_name shaName,z.sh_name shzName,
        rs.res_code,rs.res_code resCode
        rs.res_code,rs.res_code resCode,t.apply_id,t.apply_id applyId
        from allocation_storehouse t
        left join t_dict td on t.state = td.status_cd and td.table_name = 'allocation_storehouse' and td.table_columns =
        'state'
@@ -126,6 +126,9 @@
        </if>
        <if test="statusCd !=null and statusCd != ''">
            and t.status_cd= #{statusCd}
        </if>
        <if test="applyId !=null and applyId != ''">
            and t.apply_id= #{applyId}
        </if>
        <if test="storeId !=null and storeId != ''">
            and t.store_id= #{storeId}
@@ -230,6 +233,9 @@
        <if test="statusCd !=null and statusCd != ''">
            and t.status_cd= #{statusCd}
        </if>
        <if test="applyId !=null and applyId != ''">
            and t.apply_id= #{applyId}
        </if>
        <if test="storeId !=null and storeId != ''">
            and t.store_id= #{storeId}
        </if>
java110-interface/src/main/java/com/java110/intf/common/IAllocationStorehouseUserInnerServiceSMO.java
@@ -2,6 +2,7 @@
import com.java110.config.feign.FeignConfiguration;
import com.java110.dto.allocationStorehouse.AllocationStorehouseDto;
import com.java110.dto.allocationStorehouseApply.AllocationStorehouseApplyDto;
import com.java110.entity.audit.AuditUser;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
@@ -21,7 +22,7 @@
     * @return CommunityDto 对象数据
     */
    @RequestMapping(value = "/startProcess", method = RequestMethod.POST)
    public AllocationStorehouseDto startProcess(@RequestBody AllocationStorehouseDto allocationStorehouseDto);
    public AllocationStorehouseApplyDto startProcess(@RequestBody AllocationStorehouseApplyDto allocationStorehouseDto);
    /**
@@ -39,7 +40,7 @@
     * @param user 用户信息
     */
    @RequestMapping(value = "/getUserTasks", method = RequestMethod.POST)
    public List<AllocationStorehouseDto> getUserTasks(@RequestBody AuditUser user);
    public List<AllocationStorehouseApplyDto> getUserTasks(@RequestBody AuditUser user);
    /**
     * 同意
@@ -48,7 +49,7 @@
     * @return
     */
    @RequestMapping(value = "/agreeCompleteTask", method = RequestMethod.POST)
    public boolean agreeCompleteTask(@RequestBody AllocationStorehouseDto allocationStorehouseDto);
    public boolean agreeCompleteTask(@RequestBody AllocationStorehouseApplyDto allocationStorehouseDto);
    /**
@@ -58,7 +59,7 @@
     * @return
     */
    @RequestMapping(value = "/refuteCompleteTask", method = RequestMethod.POST)
    public boolean refuteCompleteTask(@RequestBody AllocationStorehouseDto allocationStorehouseDto);
    public boolean refuteCompleteTask(@RequestBody AllocationStorehouseApplyDto allocationStorehouseDto);
    /**
     * 完成任务
@@ -66,7 +67,7 @@
     * @param
     */
    @RequestMapping(value = "/complete", method = RequestMethod.GET)
    public boolean complete(@RequestBody AllocationStorehouseDto allocationStorehouseDto);
    public boolean complete(@RequestBody AllocationStorehouseApplyDto allocationStorehouseDto);
    /**
     * 查询用户任务数
@@ -83,7 +84,7 @@
     * @param user 用户信息
     */
    @RequestMapping(value = "/getUserHistoryTasks", method = RequestMethod.POST)
    public List<AllocationStorehouseDto> getUserHistoryTasks(@RequestBody AuditUser user);
    public List<AllocationStorehouseApplyDto> getUserHistoryTasks(@RequestBody AuditUser user);
    /**
     * 处理任务
@@ -91,7 +92,7 @@
     * @return true 为流程结束 false 为流程没有结束
     */
    @RequestMapping(value = "/completeTask", method = RequestMethod.POST)
    public boolean completeTask(@RequestBody AllocationStorehouseDto allocationStorehouseDto);
    public boolean completeTask(@RequestBody AllocationStorehouseApplyDto allocationStorehouseDto);
}
service-api/src/main/java/com/java110/api/listener/resourceStore/AuditAllocationStoreOrderListener.java
@@ -8,11 +8,14 @@
import com.java110.core.event.service.api.ServiceDataFlowEvent;
import com.java110.core.factory.GenerateCodeFactory;
import com.java110.dto.allocationStorehouse.AllocationStorehouseDto;
import com.java110.dto.allocationStorehouseApply.AllocationStorehouseApplyDto;
import com.java110.dto.resourceStore.ResourceStoreDto;
import com.java110.intf.common.IAllocationStorehouseUserInnerServiceSMO;
import com.java110.intf.store.IAllocationStorehouseApplyInnerServiceSMO;
import com.java110.intf.store.IAllocationStorehouseInnerServiceSMO;
import com.java110.intf.store.IResourceStoreInnerServiceSMO;
import com.java110.po.allocationStorehouse.AllocationStorehousePo;
import com.java110.po.allocationStorehouseApply.AllocationStorehouseApplyPo;
import com.java110.po.purchase.ResourceStorePo;
import com.java110.utils.constant.BusinessTypeConstant;
import com.java110.utils.constant.ServiceCodePurchaseApplyConstant;
@@ -41,6 +44,10 @@
    @Autowired
    private IAllocationStorehouseInnerServiceSMO allocationStorehouseInnerServiceSMOImpl;
    @Autowired
    private IAllocationStorehouseApplyInnerServiceSMO allocationStorehouseApplyInnerServiceSMOImpl;
    @Autowired
    private IResourceStoreInnerServiceSMO resourceStoreInnerServiceSMOImpl;
@@ -72,19 +79,19 @@
    @Override
    protected void doSoService(ServiceDataFlowEvent event, DataFlowContext context, JSONObject reqJson) {
        AllocationStorehouseDto allocationStorehouseDto = new AllocationStorehouseDto();
        AllocationStorehouseApplyDto allocationStorehouseDto = new AllocationStorehouseApplyDto();
        allocationStorehouseDto.setTaskId(reqJson.getString("taskId"));
        allocationStorehouseDto.setAsId(reqJson.getString("asId"));
        allocationStorehouseDto.setApplyId(reqJson.getString("applyId"));
        allocationStorehouseDto.setStoreId(reqJson.getString("storeId"));
        allocationStorehouseDto.setAuditCode(reqJson.getString("state"));
        allocationStorehouseDto.setAuditMessage(reqJson.getString("remark"));
        allocationStorehouseDto.setCurrentUserId(reqJson.getString("userId"));
        AllocationStorehouseDto tmpAllocationStorehouseDto = new AllocationStorehouseDto();
        tmpAllocationStorehouseDto.setAsId(reqJson.getString("asId"));
        AllocationStorehouseApplyDto tmpAllocationStorehouseDto = new AllocationStorehouseApplyDto();
        tmpAllocationStorehouseDto.setApplyId(reqJson.getString("applyId"));
        tmpAllocationStorehouseDto.setStoreId(reqJson.getString("storeId"));
        List<AllocationStorehouseDto> allocationStorehouseDtos = allocationStorehouseInnerServiceSMOImpl.queryAllocationStorehouses(tmpAllocationStorehouseDto);
        Assert.listOnlyOne(allocationStorehouseDtos, "采购申请单存在多条");
        List<AllocationStorehouseApplyDto> allocationStorehouseDtos = allocationStorehouseApplyInnerServiceSMOImpl.queryAllocationStorehouseApplys(tmpAllocationStorehouseDto);
        Assert.listOnlyOne(allocationStorehouseDtos, "调拨申请单存在多条");
        allocationStorehouseDto.setStartUserId(allocationStorehouseDtos.get(0).getStartUserId());
        boolean isLastTask = allocationStorehouseUserInnerServiceSMOImpl.completeTask(allocationStorehouseDto);
@@ -103,46 +110,53 @@
     */
    private void updateAllocationStorehouse(JSONObject paramInJson, DataFlowContext dataFlowContext) {
        AllocationStorehouseApplyDto tmpAllocationStorehouseApplyDto = new AllocationStorehouseApplyDto();
        tmpAllocationStorehouseApplyDto.setApplyId(paramInJson.getString("applyId"));
        tmpAllocationStorehouseApplyDto.setStoreId(paramInJson.getString("storeId"));
        List<AllocationStorehouseApplyDto> allocationStorehouseApplyDtos = allocationStorehouseApplyInnerServiceSMOImpl.queryAllocationStorehouseApplys(tmpAllocationStorehouseApplyDto);
        Assert.listOnlyOne(allocationStorehouseApplyDtos, "存在多条记录,或不存在数据" + tmpAllocationStorehouseApplyDto.getApplyId());
        JSONObject businessComplaint = new JSONObject();
        businessComplaint.putAll(BeanConvertUtil.beanCovertMap(allocationStorehouseApplyDtos.get(0)));
        businessComplaint.put("state", AllocationStorehouseDto.STATE_SUCCESS);
        AllocationStorehouseApplyPo allocationStorehouseApplyPo = BeanConvertUtil.covertBean(businessComplaint, AllocationStorehouseApplyPo.class);
        super.update(dataFlowContext, allocationStorehouseApplyPo, BusinessTypeConstant.BUSINESS_TYPE_UPDATE_ALLOCATION_STOREHOUSE_APPLY);
        AllocationStorehouseDto tmpAllocationStorehouseDto = new AllocationStorehouseDto();
        tmpAllocationStorehouseDto.setAsId(paramInJson.getString("asId"));
        tmpAllocationStorehouseDto.setApplyId(paramInJson.getString("applyId"));
        tmpAllocationStorehouseDto.setStoreId(paramInJson.getString("storeId"));
        List<AllocationStorehouseDto> allocationStorehouseDtos = allocationStorehouseInnerServiceSMOImpl.queryAllocationStorehouses(tmpAllocationStorehouseDto);
        Assert.listOnlyOne(allocationStorehouseDtos, "存在多条记录,或不存在数据" + tmpAllocationStorehouseDto.getAsId());
        JSONObject businessComplaint = new JSONObject();
        businessComplaint.putAll(BeanConvertUtil.beanCovertMap(allocationStorehouseDtos.get(0)));
        businessComplaint.put("state", AllocationStorehouseDto.STATE_SUCCESS);
        AllocationStorehousePo allocationStorehousePo = BeanConvertUtil.covertBean(businessComplaint, AllocationStorehousePo.class);
        super.update(dataFlowContext, allocationStorehousePo, BusinessTypeConstant.BUSINESS_TYPE_UPDATE_ALLOCATION_STOREHOUSE);
        //查询是否新仓库有此物品
        ResourceStoreDto resourceStoreDto = new ResourceStoreDto();
        resourceStoreDto.setShId(allocationStorehouseDtos.get(0).getShIdz());
        resourceStoreDto.setResName(allocationStorehouseDtos.get(0).getResName());
        List<ResourceStoreDto> resourceStoreDtos = resourceStoreInnerServiceSMOImpl.queryResourceStores(resourceStoreDto);
        ResourceStorePo resourceStorePo = new ResourceStorePo();
        if (resourceStoreDtos != null && resourceStoreDtos.size() > 0) {
            resourceStorePo.setShId(allocationStorehouseDtos.get(0).getShIdz());
            resourceStorePo.setResId(resourceStoreDtos.get(0).getResId());
            resourceStorePo.setStock((Integer.parseInt(resourceStoreDtos.get(0).getStock()) + Integer.parseInt(allocationStorehouseDtos.get(0).getStock())) + "");
            super.update(dataFlowContext, resourceStorePo, BusinessTypeConstant.BUSINESS_TYPE_UPDATE_RESOURCE_STORE);
        } else {
        for(AllocationStorehouseDto allocationStorehouseDto : allocationStorehouseDtos) {
            //查询是否新仓库有此物品
            resourceStoreDto = new ResourceStoreDto();
            resourceStoreDto.setShId(allocationStorehouseDtos.get(0).getShIda());
            resourceStoreDto.setResId(allocationStorehouseDtos.get(0).getResId());
            resourceStoreDtos = resourceStoreInnerServiceSMOImpl.queryResourceStores(resourceStoreDto);
            Assert.listOnlyOne(resourceStoreDtos, "原仓库记录不存在");
            resourceStorePo = BeanConvertUtil.covertBean(resourceStoreDtos.get(0), resourceStorePo);
            ResourceStoreDto resourceStoreDto = new ResourceStoreDto();
            resourceStoreDto.setShId(allocationStorehouseDto.getShIdz());
            resourceStoreDto.setResName(allocationStorehouseDto.getResName());
            List<ResourceStoreDto> resourceStoreDtos = resourceStoreInnerServiceSMOImpl.queryResourceStores(resourceStoreDto);
            ResourceStorePo resourceStorePo = new ResourceStorePo();
            resourceStorePo.setResId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_resId));
            resourceStorePo.setStock(allocationStorehouseDtos.get(0).getStock());
            resourceStorePo.setShId(allocationStorehouseDtos.get(0).getShIdz());
            if (resourceStoreDtos != null && resourceStoreDtos.size() > 0) {
                resourceStorePo.setShId(allocationStorehouseDto.getShIdz());
                resourceStorePo.setResId(allocationStorehouseDto.getResId());
                resourceStorePo.setStock((Integer.parseInt(allocationStorehouseDto.getStock()) + Integer.parseInt(allocationStorehouseDto.getStock())) + "");
                super.update(dataFlowContext, resourceStorePo, BusinessTypeConstant.BUSINESS_TYPE_UPDATE_RESOURCE_STORE);
            } else {
                //查询是否新仓库有此物品
                resourceStoreDto = new ResourceStoreDto();
                resourceStoreDto.setShId(allocationStorehouseDto.getShIda());
                resourceStoreDto.setResId(allocationStorehouseDto.getResId());
                resourceStoreDtos = resourceStoreInnerServiceSMOImpl.queryResourceStores(resourceStoreDto);
                Assert.listOnlyOne(resourceStoreDtos, "原仓库记录不存在");
                resourceStorePo = BeanConvertUtil.covertBean(allocationStorehouseDto, resourceStorePo);
            super.insert(dataFlowContext, resourceStorePo, BusinessTypeConstant.BUSINESS_TYPE_SAVE_RESOURCE_STORE);
                resourceStorePo.setResId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_resId));
                resourceStorePo.setStock(allocationStorehouseDto.getStock());
                resourceStorePo.setShId(allocationStorehouseDto.getShIdz());
                super.insert(dataFlowContext, resourceStorePo, BusinessTypeConstant.BUSINESS_TYPE_SAVE_RESOURCE_STORE);
            }
        }
    }
service-api/src/main/java/com/java110/api/listener/resourceStore/ListAllocationStoreAuditOrdersListener.java
@@ -6,6 +6,7 @@
import com.java110.core.context.DataFlowContext;
import com.java110.core.event.service.api.ServiceDataFlowEvent;
import com.java110.dto.allocationStorehouse.AllocationStorehouseDto;
import com.java110.dto.allocationStorehouseApply.AllocationStorehouseApplyDto;
import com.java110.entity.audit.AuditUser;
import com.java110.intf.common.IAllocationStorehouseUserInnerServiceSMO;
import com.java110.utils.constant.ServiceCodeAuditUserConstant;
@@ -66,18 +67,18 @@
        //调拨待办(默认只查询和当前登录用户相关并且是审批或者结束待办事项)
        long count = allocationStorehouseUserInnerServiceSMOImpl.getUserTaskCount(auditUser);
        List<AllocationStorehouseDto> purchaseApplyDtos = null;
        List<AllocationStorehouseApplyDto> allocationStorehouseApplyDtos = null;
        if (count > 0) {
            purchaseApplyDtos = allocationStorehouseUserInnerServiceSMOImpl.getUserTasks(auditUser);
            allocationStorehouseApplyDtos = allocationStorehouseUserInnerServiceSMOImpl.getUserTasks(auditUser);
        } else {
            purchaseApplyDtos = new ArrayList<>();
            allocationStorehouseApplyDtos = new ArrayList<>();
        }
        ResponseEntity responseEntity
                = ResultVo.createResponseEntity((int) Math.ceil((double) count / (double) reqJson.getInteger("row")),
                (int) count,
                purchaseApplyDtos);
                allocationStorehouseApplyDtos);
        context.setResponseEntity(responseEntity);
    }
}
service-api/src/main/java/com/java110/api/listener/resourceStore/ListAllocationStoreHisAuditOrders.java
@@ -6,6 +6,7 @@
import com.java110.core.context.DataFlowContext;
import com.java110.core.event.service.api.ServiceDataFlowEvent;
import com.java110.dto.allocationStorehouse.AllocationStorehouseDto;
import com.java110.dto.allocationStorehouseApply.AllocationStorehouseApplyDto;
import com.java110.entity.audit.AuditUser;
import com.java110.intf.common.IAllocationStorehouseUserInnerServiceSMO;
import com.java110.utils.constant.ServiceCodeAuditUserConstant;
@@ -66,7 +67,7 @@
        //调拨已办((默认只查询和当前登录用户相关并且是参与流程审批或者自己提交已经结束的审批数据))
        long count = allocationStorehouseUserInnerServiceSMOImpl.getUserHistoryTaskCount(auditUser);
        List<AllocationStorehouseDto> purchaseApplyDtos = null;
        List<AllocationStorehouseApplyDto> purchaseApplyDtos = null;
        if (count > 0) {
            purchaseApplyDtos = allocationStorehouseUserInnerServiceSMOImpl.getUserHistoryTasks(auditUser);
service-api/src/main/java/com/java110/api/listener/resourceStore/SaveAllocationStorehouseListener.java
@@ -1,5 +1,6 @@
package com.java110.api.listener.resourceStore;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.java110.api.bmo.allocationStorehouse.IAllocationStorehouseBMO;
import com.java110.api.listener.AbstractServiceApiPlusListener;
@@ -8,11 +9,12 @@
import com.java110.core.event.service.api.ServiceDataFlowEvent;
import com.java110.core.factory.GenerateCodeFactory;
import com.java110.dto.allocationStorehouse.AllocationStorehouseDto;
import com.java110.dto.purchaseApply.PurchaseApplyDto;
import com.java110.dto.allocationStorehouseApply.AllocationStorehouseApplyDto;
import com.java110.dto.resourceStore.ResourceStoreDto;
import com.java110.intf.common.IAllocationStorehouseUserInnerServiceSMO;
import com.java110.intf.store.IResourceStoreInnerServiceSMO;
import com.java110.po.allocationStorehouse.AllocationStorehousePo;
import com.java110.po.allocationStorehouseApply.AllocationStorehouseApplyPo;
import com.java110.po.purchase.ResourceStorePo;
import com.java110.utils.constant.BusinessTypeConstant;
import com.java110.utils.constant.ServiceCodeAllocationStorehouseConstant;
@@ -45,62 +47,95 @@
    protected void validate(ServiceDataFlowEvent event, JSONObject reqJson) {
        //Assert.hasKeyAndValue(reqJson, "xxx", "xxx");
        Assert.hasKeyAndValue(reqJson, "shIda", "请求报文中未包含shIda");
        Assert.hasKeyAndValue(reqJson, "shIdz", "请求报文中未包含shIdz");
        Assert.hasKeyAndValue(reqJson, "resId", "请求报文中未包含resId");
        Assert.hasKeyAndValue(reqJson, "stock", "请求报文中未包含stock");
        Assert.hasKeyAndValue(reqJson, "remark", "请求报文中未包含申请信息");
        Assert.hasKeyAndValue(reqJson, "storeId", "请求报文中未包含storeId");
        //校验 物品是否存在
        ResourceStoreDto resourceStoreDto = new ResourceStoreDto();
        resourceStoreDto.setStoreId(reqJson.getString("storeId"));
        resourceStoreDto.setResId(reqJson.getString("resId"));
        resourceStoreDto.setShId(reqJson.getString("shIda"));
        List<ResourceStoreDto> resourceStoreDtos = resourceStoreInnerServiceSMOImpl.queryResourceStores(resourceStoreDto);
        Assert.listOnlyOne(resourceStoreDtos, "未包含 物品信息");
        int stockA = Integer.parseInt(resourceStoreDtos.get(0).getStock());
        int stockB = Integer.parseInt(reqJson.getString("stock"));
        if (stockA < stockB) {
            throw new IllegalArgumentException("库存不足");
        if (!reqJson.containsKey("resourceStores")) {
            throw new IllegalArgumentException("请求报文中未包含物品信息");
        }
        reqJson.put("resName", resourceStoreDtos.get(0).getResName());
        reqJson.put("stockA", stockA);
        JSONArray resourceStores = reqJson.getJSONArray("resourceStores");
        if (resourceStores == null || resourceStores.size() < 1) {
            throw new IllegalArgumentException("请求报文中未包含物品信息");
        }
        //校验 物品是否存在
        for (int resIndex = 0; resIndex < resourceStores.size(); resIndex++) {
            ResourceStoreDto resourceStoreDto = new ResourceStoreDto();
            resourceStoreDto.setStoreId(reqJson.getString("storeId"));
            resourceStoreDto.setResId(resourceStores.getJSONObject(resIndex).getString("resId"));
            resourceStoreDto.setShId(resourceStores.getJSONObject(resIndex).getString("shId"));
            List<ResourceStoreDto> resourceStoreDtos = resourceStoreInnerServiceSMOImpl.queryResourceStores(resourceStoreDto);
            Assert.listOnlyOne(resourceStoreDtos, "未包含 物品信息");
            int stockA = Integer.parseInt(resourceStoreDtos.get(0).getStock());
            int stockB = Integer.parseInt(reqJson.getString("stock"));
            if (stockA < stockB) {
                throw new IllegalArgumentException("库存不足");
            }
            resourceStores.getJSONObject(resIndex).put("resName", resourceStoreDtos.get(0).getResName());
            resourceStores.getJSONObject(resIndex).put("stockA", stockA);
        }
        reqJson.put("resourceStores", resourceStores);
//
//        reqJson.put("resName", resourceStoreDtos.get(0).getResName());
//        reqJson.put("stockA", stockA);
    }
    @Override
    protected void doSoService(ServiceDataFlowEvent event, DataFlowContext context, JSONObject reqJson) {
        AllocationStorehouseApplyPo allocationStorehouseApplyPo = new AllocationStorehouseApplyPo();
        allocationStorehouseApplyPo.setApplyId(GenerateCodeFactory.CODE_PREFIX_applyId);
        allocationStorehouseApplyPo.setApplyCount("1");
        allocationStorehouseApplyPo.setRemark(reqJson.getString("remark"));
        allocationStorehouseApplyPo.setStartUserId(reqJson.getString("userId"));
        allocationStorehouseApplyPo.setStartUserName(reqJson.getString("userName"));
        allocationStorehouseApplyPo.setStoreId(reqJson.getString("storeId"));
        allocationStorehouseApplyPo.setState(AllocationStorehouseDto.STATE_AUDIT);
        reqJson.put("asId", GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_allocationStorehouseId));
        AllocationStorehousePo allocationStorehousePo = BeanConvertUtil.covertBean(reqJson, AllocationStorehousePo.class);
        allocationStorehousePo.setRemark(reqJson.getString("remark"));
        allocationStorehousePo.setStartUserId(reqJson.getString("userId"));
        allocationStorehousePo.setStartUserName(reqJson.getString("userName"));
        allocationStorehousePo.setState(AllocationStorehouseDto.STATE_AUDIT);
        super.insert(context, allocationStorehousePo, BusinessTypeConstant.BUSINESS_TYPE_SAVE_ALLOCATION_STOREHOUSE);
        JSONArray resourceStores = reqJson.getJSONArray("resourceStores");
        JSONObject resObj = null;
        for (int resIndex = 0; resIndex < resourceStores.size(); resIndex++) {
            resObj = resourceStores.getJSONObject(resIndex);
            AllocationStorehousePo allocationStorehousePo = new AllocationStorehousePo();
            allocationStorehousePo.setAsId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_allocationStorehouseId));
            allocationStorehousePo.setApplyId(allocationStorehouseApplyPo.getApplyId());
            allocationStorehousePo.setResId(resObj.getString("resId"));
            allocationStorehousePo.setResName(resObj.getString("resName"));
            allocationStorehousePo.setShIda(resObj.getString("shId"));
            allocationStorehousePo.setShIdz(resObj.getString("shzId"));
            allocationStorehousePo.setState(AllocationStorehouseDto.STATE_SUCCESS);
            allocationStorehousePo.setStoreId(reqJson.getString("storeId"));
            allocationStorehousePo.setStock(resObj.getString("curStock"));
            allocationStorehousePo.setRemark(reqJson.getString("remark"));
            allocationStorehousePo.setStartUserId(reqJson.getString("userId"));
            allocationStorehousePo.setStartUserName(reqJson.getString("userName"));
            super.insert(context, allocationStorehousePo, BusinessTypeConstant.BUSINESS_TYPE_SAVE_ALLOCATION_STOREHOUSE);
        // 减去去库存
        ResourceStorePo resourceStorePo = new ResourceStorePo();
        resourceStorePo.setResId(reqJson.getString("resId"));
        resourceStorePo.setStoreId(reqJson.getString("storeId"));
        resourceStorePo.setShId(reqJson.getString("shIda"));
        int stockA = Integer.parseInt(reqJson.getString("stockA"));
        int stockB = Integer.parseInt(reqJson.getString("stock"));
        resourceStorePo.setStock((stockA - stockB) + "");
        super.update(context, resourceStorePo, BusinessTypeConstant.BUSINESS_TYPE_UPDATE_RESOURCE_STORE);
            // 减去去库存
            ResourceStorePo resourceStorePo = new ResourceStorePo();
            resourceStorePo.setResId(resObj.getString("resId"));
            resourceStorePo.setStoreId(reqJson.getString("storeId"));
            resourceStorePo.setShId(resObj.getString("shId"));
            int stockA = Integer.parseInt(resObj.getString("stockA"));
            int stockB = Integer.parseInt(resObj.getString("stock"));
            resourceStorePo.setStock((stockA - stockB) + "");
            super.update(context, resourceStorePo, BusinessTypeConstant.BUSINESS_TYPE_UPDATE_RESOURCE_STORE);
        }
        super.insert(context, allocationStorehouseApplyPo, BusinessTypeConstant.BUSINESS_TYPE_SAVE_ALLOCATION_STOREHOUSE_APPLY);
        commit(context);
        ResponseEntity<String> responseEntity = context.getResponseEntity();
        //开始流程
        if (HttpStatus.OK == responseEntity.getStatusCode()) {
            AllocationStorehouseDto allocationStorehouseDto = BeanConvertUtil.covertBean(reqJson, AllocationStorehouseDto.class);
            AllocationStorehouseApplyDto allocationStorehouseDto = BeanConvertUtil.covertBean(allocationStorehouseApplyPo, AllocationStorehouseApplyDto.class);
            allocationStorehouseDto.setCurrentUserId(reqJson.getString("userId"));
            allocationStorehouseUserInnerServiceSMOImpl.startProcess(allocationStorehouseDto);
        }
service-common/src/main/java/com/java110/common/smo/impl/AllocationStorehouseUserInnerServiceSMOImpl.java
@@ -3,13 +3,13 @@
import com.java110.core.base.smo.BaseServiceSMO;
import com.java110.dto.PageDto;
import com.java110.dto.allocationStorehouse.AllocationStorehouseDto;
import com.java110.dto.allocationStorehouseApply.AllocationStorehouseApplyDto;
import com.java110.dto.workflow.WorkflowDto;
import com.java110.entity.audit.AuditUser;
import com.java110.intf.common.IAllocationStorehouseUserInnerServiceSMO;
import com.java110.intf.common.IWorkflowInnerServiceSMO;
import com.java110.intf.store.IAllocationStorehouseApplyInnerServiceSMO;
import com.java110.intf.store.IAllocationStorehouseInnerServiceSMO;
import com.java110.intf.store.IContractInnerServiceSMO;
import com.java110.utils.util.Assert;
import com.java110.utils.util.StringUtil;
import org.activiti.engine.HistoryService;
@@ -50,6 +50,9 @@
    private IAllocationStorehouseInnerServiceSMO allocationStorehouseInnerServiceSMOImpl;
    @Autowired
    private IAllocationStorehouseApplyInnerServiceSMO allocationStorehouseApplyInnerServiceSMOImpl;
    @Autowired
    private IWorkflowInnerServiceSMO workflowInnerServiceSMOImpl;
@@ -58,21 +61,21 @@
     *
     * @return
     */
    public AllocationStorehouseDto startProcess(@RequestBody AllocationStorehouseDto allocationStorehouseDto) {
    public AllocationStorehouseApplyDto startProcess(@RequestBody AllocationStorehouseApplyDto allocationStorehouseApplyDto) {
        //将信息加入map,以便传入流程中
        Map<String, Object> variables = new HashMap<String, Object>();
        variables.put("allocationStorehouseDto", allocationStorehouseDto);
        variables.put("userId", allocationStorehouseDto.getCurrentUserId());
        variables.put("startUserId", allocationStorehouseDto.getCurrentUserId());
        variables.put("allocationStorehouseApplyDto", allocationStorehouseApplyDto);
        variables.put("userId", allocationStorehouseApplyDto.getCurrentUserId());
        variables.put("startUserId", allocationStorehouseApplyDto.getCurrentUserId());
        //开启流程
        ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(getWorkflowDto(allocationStorehouseDto.getStoreId()), allocationStorehouseDto.getAsId(), variables);
        ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(getWorkflowDto(allocationStorehouseApplyDto.getStoreId()), allocationStorehouseApplyDto.getApplyId(), variables);
        //将得到的实例流程id值赋给之前设置的变量
        String processInstanceId = processInstance.getId();
        // System.out.println("流程开启成功.......实例流程id:" + processInstanceId);
        allocationStorehouseDto.setProcessInstanceId(processInstanceId);
        allocationStorehouseApplyDto.setProcessInstanceId(processInstanceId);
        return allocationStorehouseDto;
        return allocationStorehouseApplyDto;
    }
@@ -94,7 +97,7 @@
     *
     * @param user 用户信息
     */
    public List<AllocationStorehouseDto> getUserTasks(@RequestBody AuditUser user) {
    public List<AllocationStorehouseApplyDto> getUserTasks(@RequestBody AuditUser user) {
        TaskService taskService = processEngine.getTaskService();
        TaskQuery query = taskService.createTaskQuery().processDefinitionKey(getWorkflowDto(user.getStoreId()));
        query.taskAssignee(user.getUserId());
@@ -109,7 +112,7 @@
            list = query.list();
        }
        List<String> asIds = new ArrayList<>();
        List<String> appIyIds = new ArrayList<>();
        Map<String, String> taskBusinessKeyMap = new HashMap<>();
        for (Task task : list) {
            String processInstanceId = task.getProcessInstanceId();
@@ -117,52 +120,52 @@
            ProcessInstance pi = runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
            //4.使用流程实例对象获取BusinessKey
            String business_key = pi.getBusinessKey();
            asIds.add(business_key);
            appIyIds.add(business_key);
            taskBusinessKeyMap.put(business_key, task.getId());
        }
        if (asIds == null || asIds.size() == 0) {
        if (appIyIds == null || appIyIds.size() == 0) {
            return new ArrayList<>();
        }
        //查询 投诉信息
        AllocationStorehouseDto allocationStorehouseDto = new AllocationStorehouseDto();
        allocationStorehouseDto.setStoreId(user.getStoreId());
        allocationStorehouseDto.setAsIds(asIds.toArray(new String[asIds.size()]));
        List<AllocationStorehouseDto> tmpAllocationStorehouseDtos = allocationStorehouseInnerServiceSMOImpl.queryAllocationStorehouses(allocationStorehouseDto);
        AllocationStorehouseApplyDto allocationStorehouseApplyDto = new AllocationStorehouseApplyDto();
        allocationStorehouseApplyDto.setStoreId(user.getStoreId());
        allocationStorehouseApplyDto.setApplyIds(appIyIds.toArray(new String[appIyIds.size()]));
        List<AllocationStorehouseApplyDto> tmpAllocationStorehouseApplyDtos = allocationStorehouseApplyInnerServiceSMOImpl.queryAllocationStorehouseApplys(allocationStorehouseApplyDto);
        for (AllocationStorehouseDto tmpAllocationStorehouseDto : tmpAllocationStorehouseDtos) {
            tmpAllocationStorehouseDto.setTaskId(taskBusinessKeyMap.get(tmpAllocationStorehouseDto.getAsId()));
        for (AllocationStorehouseApplyDto tmpAllocationStorehouseApplyDto : tmpAllocationStorehouseApplyDtos) {
            tmpAllocationStorehouseApplyDto.setTaskId(taskBusinessKeyMap.get(tmpAllocationStorehouseApplyDto.getApplyId()));
        }
        return tmpAllocationStorehouseDtos;
        return tmpAllocationStorehouseApplyDtos;
    }
    public boolean agreeCompleteTask(@RequestBody AllocationStorehouseDto allocationStorehouseDto) {
    public boolean agreeCompleteTask(@RequestBody AllocationStorehouseApplyDto allocationStorehouseApplyDto) {
        TaskService taskService = processEngine.getTaskService();
        Map<String, Object> variables = new HashMap<String, Object>();
        variables.put("auditCode", allocationStorehouseDto.getAuditCode());
        taskService.complete(allocationStorehouseDto.getTaskId(), variables);
        variables.put("auditCode", allocationStorehouseApplyDto.getAuditCode());
        taskService.complete(allocationStorehouseApplyDto.getTaskId(), variables);
        return true;
    }
    public boolean refuteCompleteTask(@RequestBody AllocationStorehouseDto allocationStorehouseDto) {
    public boolean refuteCompleteTask(@RequestBody AllocationStorehouseApplyDto allocationStorehouseApplyDto) {
        TaskService taskService = processEngine.getTaskService();
        Map<String, Object> variables = new HashMap<String, Object>();
        variables.put("auditCode", allocationStorehouseDto.getAuditCode());
        taskService.complete(allocationStorehouseDto.getTaskId(), variables);
        variables.put("auditCode", allocationStorehouseApplyDto.getAuditCode());
        taskService.complete(allocationStorehouseApplyDto.getTaskId(), variables);
        return true;
    }
    /**
     * 审核 当前任务
     *
     * @param allocationStorehouseDto 资源订单
     * @param allocationStorehouseApplyDto 资源订单
     * @return
     */
    public boolean complete(@RequestBody AllocationStorehouseDto allocationStorehouseDto) {
    public boolean complete(@RequestBody AllocationStorehouseApplyDto allocationStorehouseApplyDto) {
        TaskService taskService = processEngine.getTaskService();
        taskService.complete(allocationStorehouseDto.getTaskId());
        taskService.complete(allocationStorehouseApplyDto.getTaskId());
        return true;
@@ -216,7 +219,7 @@
     *
     * @param user 用户信息
     */
    public List<AllocationStorehouseDto> getUserHistoryTasks(@RequestBody AuditUser user) {
    public List<AllocationStorehouseApplyDto> getUserHistoryTasks(@RequestBody AuditUser user) {
        HistoryService historyService = processEngine.getHistoryService();
        HistoricTaskInstanceQuery historicTaskInstanceQuery = historyService.createHistoricTaskInstanceQuery()
@@ -238,7 +241,7 @@
            list = query.list();
        }
        List<String> asIds = new ArrayList<>();
        List<String> appIyIds = new ArrayList<>();
        Map<String, String> taskBusinessKeyMap = new HashMap<>();
        for (HistoricTaskInstance task : list) {
@@ -247,35 +250,35 @@
            HistoricProcessInstance pi = historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
            //4.使用流程实例对象获取BusinessKey
            String business_key = pi.getBusinessKey();
            asIds.add(business_key);
            appIyIds.add(business_key);
            taskBusinessKeyMap.put(business_key, task.getId());
        }
        //查询 投诉信息
        AllocationStorehouseDto allocationStorehouseDto = new AllocationStorehouseDto();
        allocationStorehouseDto.setStoreId(user.getStoreId());
        allocationStorehouseDto.setAsIds(asIds.toArray(new String[asIds.size()]));
        List<AllocationStorehouseDto> tmpAllocationStorehouseDtos = allocationStorehouseInnerServiceSMOImpl.queryAllocationStorehouses(allocationStorehouseDto);
        AllocationStorehouseApplyDto allocationStorehouseApplyDto = new AllocationStorehouseApplyDto();
        allocationStorehouseApplyDto.setStoreId(user.getStoreId());
        allocationStorehouseApplyDto.setApplyIds(appIyIds.toArray(new String[appIyIds.size()]));
        List<AllocationStorehouseApplyDto> tmpAllocationStorehouseApplyDtos = allocationStorehouseApplyInnerServiceSMOImpl.queryAllocationStorehouseApplys(allocationStorehouseApplyDto);
        for (AllocationStorehouseDto tmpAllocationStorehouseDto : tmpAllocationStorehouseDtos) {
            tmpAllocationStorehouseDto.setTaskId(taskBusinessKeyMap.get(tmpAllocationStorehouseDto.getAsId()));
        for (AllocationStorehouseApplyDto tmpAllocationStorehouseApplyDto : tmpAllocationStorehouseApplyDtos) {
            tmpAllocationStorehouseApplyDto.setTaskId(taskBusinessKeyMap.get(tmpAllocationStorehouseApplyDto.getApplyId()));
        }
        return tmpAllocationStorehouseDtos;
        return tmpAllocationStorehouseApplyDtos;
    }
    public boolean completeTask(@RequestBody AllocationStorehouseDto allocationStorehouseDto) {
    public boolean completeTask(@RequestBody AllocationStorehouseApplyDto allocationStorehouseApplyDto) {
        TaskService taskService = processEngine.getTaskService();
        Task task = taskService.createTaskQuery().taskId(allocationStorehouseDto.getTaskId()).singleResult();
        Task task = taskService.createTaskQuery().taskId(allocationStorehouseApplyDto.getTaskId()).singleResult();
        String processInstanceId = task.getProcessInstanceId();
        Authentication.setAuthenticatedUserId(allocationStorehouseDto.getCurrentUserId());
        taskService.addComment(allocationStorehouseDto.getTaskId(), processInstanceId, allocationStorehouseDto.getAuditMessage());
        Authentication.setAuthenticatedUserId(allocationStorehouseApplyDto.getCurrentUserId());
        taskService.addComment(allocationStorehouseApplyDto.getTaskId(), processInstanceId, allocationStorehouseApplyDto.getAuditMessage());
        Map<String, Object> variables = new HashMap<String, Object>();
        variables.put("auditCode", allocationStorehouseDto.getAuditCode());
        variables.put("currentUserId", allocationStorehouseDto.getCurrentUserId());
        variables.put("flag", "1200".equals(allocationStorehouseDto.getAuditCode()) ? "false" : "true");
        variables.put("startUserId", allocationStorehouseDto.getStartUserId());
        taskService.complete(allocationStorehouseDto.getTaskId(), variables);
        variables.put("auditCode", allocationStorehouseApplyDto.getAuditCode());
        variables.put("currentUserId", allocationStorehouseApplyDto.getCurrentUserId());
        variables.put("flag", "1200".equals(allocationStorehouseApplyDto.getAuditCode()) ? "false" : "true");
        variables.put("startUserId", allocationStorehouseApplyDto.getStartUserId());
        taskService.complete(allocationStorehouseApplyDto.getTaskId(), variables);
        ProcessInstance pi = runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
        if (pi == null) {
service-store/src/main/java/com/java110/store/dao/impl/AllocationStorehouseApplyServiceDaoImpl.java
@@ -18,7 +18,7 @@
 * 调拨申请服务 与数据库交互
 * Created by wuxw on 2017/4/5.
 */
@Service("allocationAllocationStorehouseApplyhouseApplyServiceDaoImpl")
@Service("allocationStorehouseApplyServiceDaoImpl")
//@Transactional
public class AllocationStorehouseApplyServiceDaoImpl extends BaseServiceDao implements IAllocationStorehouseApplyServiceDao {
@@ -34,7 +34,7 @@
        businessAllocationStorehouseApplyInfo.put("month", DateUtil.getCurrentMonth());
        // 查询business_user 数据是否已经存在
        logger.debug("保存调拨申请信息 入参 businessAllocationStorehouseApplyInfo : {}",businessAllocationStorehouseApplyInfo);
        int saveFlag = sqlSessionTemplate.insert("allocationAllocationStorehouseApplyhouseApplyServiceDaoImpl.saveBusinessAllocationStorehouseApplyInfo",businessAllocationStorehouseApplyInfo);
        int saveFlag = sqlSessionTemplate.insert("allocationStorehouseApplyServiceDaoImpl.saveBusinessAllocationStorehouseApplyInfo",businessAllocationStorehouseApplyInfo);
        if(saveFlag < 1){
            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存调拨申请数据失败:"+ JSONObject.toJSONString(businessAllocationStorehouseApplyInfo));
@@ -53,7 +53,7 @@
        logger.debug("查询调拨申请信息 入参 info : {}",info);
        List<Map> businessAllocationStorehouseApplyInfos = sqlSessionTemplate.selectList("allocationAllocationStorehouseApplyhouseApplyServiceDaoImpl.getBusinessAllocationStorehouseApplyInfo",info);
        List<Map> businessAllocationStorehouseApplyInfos = sqlSessionTemplate.selectList("allocationStorehouseApplyServiceDaoImpl.getBusinessAllocationStorehouseApplyInfo",info);
        return businessAllocationStorehouseApplyInfos;
    }
@@ -69,7 +69,7 @@
    public void saveAllocationStorehouseApplyInfoInstance(Map info) throws DAOException {
        logger.debug("保存调拨申请信息Instance 入参 info : {}",info);
        int saveFlag = sqlSessionTemplate.insert("allocationAllocationStorehouseApplyhouseApplyServiceDaoImpl.saveAllocationStorehouseApplyInfoInstance",info);
        int saveFlag = sqlSessionTemplate.insert("allocationStorehouseApplyServiceDaoImpl.saveAllocationStorehouseApplyInfoInstance",info);
        if(saveFlag < 1){
            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存调拨申请信息Instance数据失败:"+ JSONObject.toJSONString(info));
@@ -87,7 +87,7 @@
    public List<Map> getAllocationStorehouseApplyInfo(Map info) throws DAOException {
        logger.debug("查询调拨申请信息 入参 info : {}",info);
        List<Map> businessAllocationStorehouseApplyInfos = sqlSessionTemplate.selectList("allocationAllocationStorehouseApplyhouseApplyServiceDaoImpl.getAllocationStorehouseApplyInfo",info);
        List<Map> businessAllocationStorehouseApplyInfos = sqlSessionTemplate.selectList("allocationStorehouseApplyServiceDaoImpl.getAllocationStorehouseApplyInfo",info);
        return businessAllocationStorehouseApplyInfos;
    }
@@ -102,7 +102,7 @@
    public void updateAllocationStorehouseApplyInfoInstance(Map info) throws DAOException {
        logger.debug("修改调拨申请信息Instance 入参 info : {}",info);
        int saveFlag = sqlSessionTemplate.update("allocationAllocationStorehouseApplyhouseApplyServiceDaoImpl.updateAllocationStorehouseApplyInfoInstance",info);
        int saveFlag = sqlSessionTemplate.update("allocationStorehouseApplyServiceDaoImpl.updateAllocationStorehouseApplyInfoInstance",info);
        if(saveFlag < 1){
            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"修改调拨申请信息Instance数据失败:"+ JSONObject.toJSONString(info));
@@ -118,7 +118,7 @@
    public int queryAllocationStorehouseApplysCount(Map info) {
        logger.debug("查询调拨申请数据 入参 info : {}",info);
        List<Map> businessAllocationStorehouseApplyInfos = sqlSessionTemplate.selectList("allocationAllocationStorehouseApplyhouseApplyServiceDaoImpl.queryAllocationStorehouseApplysCount", info);
        List<Map> businessAllocationStorehouseApplyInfos = sqlSessionTemplate.selectList("allocationStorehouseApplyServiceDaoImpl.queryAllocationStorehouseApplysCount", info);
        if (businessAllocationStorehouseApplyInfos.size() < 1) {
            return 0;
        }
service-store/src/main/java/com/java110/store/listener/allocationStorehouse/AbstractAllocationStorehouseBusinessServiceDataFlowListener.java
@@ -49,6 +49,7 @@
        businessAllocationStorehouseInfo.put("state", businessAllocationStorehouseInfo.get("state"));
        businessAllocationStorehouseInfo.put("stock", businessAllocationStorehouseInfo.get("stock"));
        businessAllocationStorehouseInfo.put("remark", businessAllocationStorehouseInfo.get("remark"));
        businessAllocationStorehouseInfo.put("applyId", businessAllocationStorehouseInfo.get("apply_id"));
        businessAllocationStorehouseInfo.remove("bId");
        businessAllocationStorehouseInfo.put("statusCd", statusCd);
    }
@@ -85,6 +86,7 @@
        currentAllocationStorehouseInfo.put("state", currentAllocationStorehouseInfo.get("state"));
        currentAllocationStorehouseInfo.put("stock", currentAllocationStorehouseInfo.get("stock"));
        currentAllocationStorehouseInfo.put("remark", currentAllocationStorehouseInfo.get("remark"));
        currentAllocationStorehouseInfo.put("applyId", currentAllocationStorehouseInfo.get("apply_id"));
        currentAllocationStorehouseInfo.put("operate", StatusConstant.OPERATE_DEL);