java110
2023-08-31 47c4ae89c3efb0efd927b94f7d48c679740a6f03
优化代码权限
7个文件已修改
156 ■■■■■ 已修改文件
java110-bean/src/main/java/com/java110/dto/store/StorehouseDto.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-bean/src/main/java/com/java110/po/store/StorehousePo.java 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-db/src/main/resources/mapper/store/ResourceAuditFlowV1ServiceDaoImplMapper.xml 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-db/src/main/resources/mapper/store/StorehouseServiceDaoImplMapper.xml 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-db/src/main/resources/mapper/store/StorehouseV1ServiceDaoImplMapper.xml 43 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-store/src/main/java/com/java110/store/cmd/purchase/PurchaseApplyCmd.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-store/src/main/java/com/java110/store/cmd/purchase/UrgentPurchaseApplyCmd.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-bean/src/main/java/com/java110/dto/store/StorehouseDto.java
@@ -45,6 +45,12 @@
    private String useFlowName;
    private String allocationFlowName;
    private String communityId;
    private String allowPurchase;
    private String allowUse;
    public String getShDesc() {
        return shDesc;
    }
@@ -207,4 +213,28 @@
    public void setAllocationFlowId(String allocationFlowId) {
        this.allocationFlowId = allocationFlowId;
    }
    public String getCommunityId() {
        return communityId;
    }
    public void setCommunityId(String communityId) {
        this.communityId = communityId;
    }
    public String getAllowPurchase() {
        return allowPurchase;
    }
    public void setAllowPurchase(String allowPurchase) {
        this.allowPurchase = allowPurchase;
    }
    public String getAllowUse() {
        return allowUse;
    }
    public void setAllowUse(String allowUse) {
        this.allowUse = allowUse;
    }
}
java110-bean/src/main/java/com/java110/po/store/StorehousePo.java
@@ -20,6 +20,13 @@
    private String allocationSwitch;
    private String allocationRafId;
    private String communityId;
    private String allowPurchase;
    private String allowUse;
    public String getShDesc() {
        return shDesc;
    }
@@ -117,4 +124,28 @@
    public void setAllocationRafId(String allocationRafId) {
        this.allocationRafId = allocationRafId;
    }
    public String getCommunityId() {
        return communityId;
    }
    public void setCommunityId(String communityId) {
        this.communityId = communityId;
    }
    public String getAllowPurchase() {
        return allowPurchase;
    }
    public void setAllowPurchase(String allowPurchase) {
        this.allowPurchase = allowPurchase;
    }
    public String getAllowUse() {
        return allowUse;
    }
    public void setAllowUse(String allowUse) {
        this.allowUse = allowUse;
    }
}
java110-db/src/main/resources/mapper/store/ResourceAuditFlowV1ServiceDaoImplMapper.xml
@@ -35,7 +35,7 @@
            and t.store_id= #{storeId}
        </if>
        <if test="communityId !=null and communityId != ''">
            and t.community_id= #{storeId}
            and t.community_id= #{communityId}
        </if>
        <if test="flowId !=null and flowId != ''">
            and t.flow_id= #{flowId}
@@ -81,7 +81,7 @@
            and t.store_id= #{storeId}
        </if>
        <if test="communityId !=null and communityId != ''">
            and t.community_id= #{storeId}
            and t.community_id= #{communityId}
        </if>
    </update>
@@ -113,7 +113,7 @@
            and t.audit_type= #{auditType}
        </if>
        <if test="communityId !=null and communityId != ''">
            and t.community_id= #{storeId}
            and t.community_id= #{communityId}
        </if>
java110-db/src/main/resources/mapper/store/StorehouseServiceDaoImplMapper.xml
@@ -11,7 +11,8 @@
        t.purchase_raf_id purchaseRafId,t.use_switch useSwitch,t.use_raf_id useRafId,
        t.allocation_switch allocationSwitch,t.allocation_raf_id allocationRafId,raf.flow_name purchaseFlowName,
        raf.flow_id purchaseFlowId,raf1.flow_id useFlowId,raf2.flow_id allocationFlowId,
        raf1.flow_name useFlowName,raf2.flow_name allocationFlowName
        raf1.flow_name useFlowName,raf2.flow_name allocationFlowName,t.community_id communityId,
        t.allow_purchase allowPurchase,t.allow_use allowUse
        from storehouse t
        left join resource_audit_flow raf on t.purchase_raf_id = raf.raf_id and raf.status_cd = '0'
        left join resource_audit_flow raf1 on t.use_raf_id = raf1.raf_id and raf1.status_cd = '0'
@@ -34,6 +35,15 @@
        </if>
        <if test="storeId !=null and storeId != ''">
            and t.store_id= #{storeId}
        </if>
        <if test="communityId !=null and communityId != ''">
            and t.community_id= #{communityId}
        </if>
        <if test="allowPurchase !=null and allowPurchase != ''">
            and t.allow_purchase= #{allowPurchase}
        </if>
        <if test="allowUse !=null and allowUse != ''">
            and t.allow_use= #{allowUse}
        </if>
        <if test="isShow !=null and isShow != ''">
            and t.is_show= #{isShow}
@@ -68,6 +78,15 @@
        <if test="storeId !=null and storeId != ''">
            and t.store_id= #{storeId}
        </if>
        <if test="communityId !=null and communityId != ''">
            and t.community_id= #{communityId}
        </if>
        <if test="allowPurchase !=null and allowPurchase != ''">
            and t.allow_purchase= #{allowPurchase}
        </if>
        <if test="allowUse !=null and allowUse != ''">
            and t.allow_use= #{allowUse}
        </if>
        <if test="isShow !=null and isShow != ''">
            and t.is_show= #{isShow}
        </if>
java110-db/src/main/resources/mapper/store/StorehouseV1ServiceDaoImplMapper.xml
@@ -9,10 +9,11 @@
    <insert id="saveStorehouseInfo" parameterType="Map">
        insert into storehouse(
        sh_desc,sh_id,sh_name,store_id,is_show,purchase_switch,purchase_raf_id,
        use_switch,use_raf_id,allocation_switch,allocation_raf_id
        use_switch,use_raf_id,allocation_switch,allocation_raf_id,community_id,allow_purchase,allow_use
        ) values (
        #{shDesc},#{shId},#{shName},#{storeId},#{isShow}
        ,#{purchaseSwitch},#{purchaseRafId},#{useSwitch},#{useRafId},#{allocationSwitch},#{allocationRafId}
        ,#{purchaseSwitch},#{purchaseRafId},#{useSwitch},#{useRafId},#{allocationSwitch},#{allocationRafId},
        #{communityId},#{allowPurchase},#{allowUse}
        )
    </insert>
@@ -26,7 +27,8 @@
        t.allocation_switch allocationSwitch,t.allocation_raf_id allocationRafId,
        raf.flow_name purchaseFlowName,
        raf.flow_id purchaseFlowId,raf1.flow_id useFlowId,raf2.flow_id allocationFlowId,
        raf1.flow_name useFlowName,raf2.flow_name allocationFlowName
        raf1.flow_name useFlowName,raf2.flow_name allocationFlowName,t.community_id communityId,
        t.allow_purchase allowPurchase,t.allow_use allowUse
        from storehouse t
        left join resource_audit_flow raf on t.purchase_raf_id = raf.raf_id and raf.status_cd = '0'
        left join resource_audit_flow raf1 on t.use_raf_id = raf1.raf_id and raf1.status_cd = '0'
@@ -47,6 +49,15 @@
        </if>
        <if test="storeId !=null and storeId != ''">
            and t.store_id= #{storeId}
        </if>
        <if test="communityId !=null and communityId != ''">
            and t.community_id= #{communityId}
        </if>
        <if test="allowPurchase !=null and allowPurchase != ''">
            and t.allow_purchase= #{allowPurchase}
        </if>
        <if test="allowUse !=null and allowUse != ''">
            and t.allow_use= #{allowUse}
        </if>
        <if test="isShow !=null and isShow != ''">
            and t.is_show= #{isShow}
@@ -89,15 +100,26 @@
        <if test="shName !=null and shName != ''">
            , t.sh_name= #{shName}
        </if>
        <if test="storeId !=null and storeId != ''">
            , t.store_id= #{storeId}
        </if>
        <if test="isShow !=null and isShow != ''">
            , t.is_show= #{isShow}
        </if>
        <if test="allowPurchase !=null and allowPurchase != ''">
            , t.allow_purchase= #{allowPurchase}
        </if>
        <if test="allowUse !=null and allowUse != ''">
            , t.allow_use= #{allowUse}
        </if>
        where 1=1
        <if test="shId !=null and shId != ''">
            and t.sh_id= #{shId}
        </if>
        <if test="communityId !=null and communityId != ''">
            and t.community_id= #{communityId}
        </if>
        <if test="storeId !=null and storeId != ''">
            and t.store_id= #{storeId}
        </if>
    </update>
@@ -126,6 +148,15 @@
        <if test="isShow !=null and isShow != ''">
            and t.is_show= #{isShow}
        </if>
        <if test="communityId !=null and communityId != ''">
            and t.community_id= #{communityId}
        </if>
        <if test="allowPurchase !=null and allowPurchase != ''">
            and t.allow_purchase= #{allowPurchase}
        </if>
        <if test="allowUse !=null and allowUse != ''">
            and t.allow_use= #{allowUse}
        </if>
    </select>
service-store/src/main/java/com/java110/store/cmd/purchase/PurchaseApplyCmd.java
@@ -97,6 +97,11 @@
        List<StorehouseDto> storehouseDtos = storehouseV1InnerServiceSMOImpl.queryStorehouses(storehouseDto);
        Assert.listOnlyOne(storehouseDtos, "仓库不存在");
        //todo 不允许采购
        if (!"ON".equals(storehouseDtos.get(0).getAllowPurchase())) {
            throw new CmdException(storehouseDtos.get(0).getShName() + "不允许采购");
        }
        if (!StorehouseDto.SWITCH_ON.equals(storehouseDtos.get(0).getPurchaseSwitch())) {
            return;
        }
service-store/src/main/java/com/java110/store/cmd/purchase/UrgentPurchaseApplyCmd.java
@@ -13,6 +13,7 @@
import com.java110.dto.purchase.AllocationStorehouseApplyDto;
import com.java110.dto.purchase.PurchaseApplyDto;
import com.java110.dto.resource.ResourceStoreDto;
import com.java110.dto.store.StorehouseDto;
import com.java110.dto.user.UserDto;
import com.java110.intf.store.*;
import com.java110.intf.user.IUserV1InnerServiceSMO;
@@ -72,11 +73,30 @@
    @Autowired
    private IResourceStoreTimesV1InnerServiceSMO resourceStoreTimesV1InnerServiceSMOImpl;
    @Autowired
    private IStorehouseV1InnerServiceSMO storehouseV1InnerServiceSMOImpl;
    @Override
    public void validate(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException {
        Assert.hasKeyAndValue(reqJson, "resourceStores", "必填,请填写申请采购的物资");
        Assert.hasKeyAndValue(reqJson, "description", "必填,请填写采购申请说明");
        Assert.hasKeyAndValue(reqJson, "resOrderType", "必填,请填写申请类型");
        Assert.hasKeyAndValue(reqJson, "shId", "必填,请填写仓库");
        JSONArray resourceStores = reqJson.getJSONArray("resourceStores");
        if (resourceStores == null || resourceStores.size() < 1) {
            throw new CmdException("未包含采购物品");
        }
        //todo 查询仓库是否存在
        StorehouseDto storehouseDto = new StorehouseDto();
        storehouseDto.setShId(reqJson.getString("shId"));
        List<StorehouseDto> storehouseDtos = storehouseV1InnerServiceSMOImpl.queryStorehouses(storehouseDto);
        Assert.listOnlyOne(storehouseDtos, "仓库不存在");
        //todo 不允许采购
        if (!"ON".equals(storehouseDtos.get(0).getAllowPurchase())) {
            throw new CmdException(storehouseDtos.get(0).getShName() + "不允许采购");
        }
    }
    /**