wuxw
2019-10-18 8ed3f59308f7d40b9bd1c4a20a16d4cba6bd042b
添加公司时 默认生成 1级组织
2个文件已修改
85 ■■■■■ 已修改文件
Api/src/main/java/com/java110/api/listener/store/SaveStoreServiceListener.java 39 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebService/src/main/resources/components/orgPackage/choose-org/chooseOrg.html 46 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Api/src/main/java/com/java110/api/listener/store/SaveStoreServiceListener.java
@@ -3,6 +3,7 @@
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.java110.api.listener.AbstractServiceApiDataFlowListener;
import com.java110.core.factory.GenerateCodeFactory;
import com.java110.utils.cache.MappingCache;
import com.java110.utils.constant.*;
import com.java110.utils.util.Assert;
@@ -96,6 +97,8 @@
        businesses.add(addStore(paramObj));
        //添加员工
        businesses.add(addStaff(paramObj));
        //添加公司级组织
        businesses.add(addOrg(paramObj));
        String paramInObj = super.restToCenterProtocol(businesses, dataFlowContext.getRequestCurrentHeaders()).toJSONString();
@@ -188,7 +191,7 @@
        business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S);
        JSONArray businessStoreUsers = new JSONArray();
        JSONObject businessStoreUser = new JSONObject();
        businessStoreUser.put("storeId", "-1");
        businessStoreUser.put("storeId", paramInJson.getString("storeId"));
        businessStoreUser.put("storeUserId", "-1");
        businessStoreUser.put("userId", paramInJson.getJSONObject("businessStore").getString("userId"));
        businessStoreUser.put("relCd", StoreUserRelConstant.REL_ADMIN);
@@ -206,9 +209,11 @@
     */
    private JSONObject refreshParamIn(JSONObject paramObj) {
        String storeId = GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_storeId);
        paramObj.put("storeId",storeId);
        if (paramObj.containsKey("businessStore")) {
            JSONObject businessStoreObj = paramObj.getJSONObject("businessStore");
            businessStoreObj.put("storeId", "-1");
            businessStoreObj.put("storeId", storeId);
            if (!businessStoreObj.containsKey("password")) {
                String staffDefaultPassword = MappingCache.getValue(MappingConstant.KEY_STAFF_DEFAULT_PASSWORD);
                Assert.hasLength(staffDefaultPassword, "映射表中未设置员工默认密码,请检查" + MappingConstant.KEY_STAFF_DEFAULT_PASSWORD);
@@ -229,7 +234,7 @@
            for (int businessStoreAttrIndex = 0; businessStoreAttrIndex < attrs.size(); businessStoreAttrIndex++) {
                JSONObject attr = attrs.getJSONObject(businessStoreAttrIndex);
                attr.put("storeId", "-1");
                attr.put("storeId", storeId);
                attr.put("attrId", "-" + (businessStoreAttrIndex + 1));
            }
        }
@@ -239,7 +244,7 @@
            for (int businessStorePhotoIndex = 0; businessStorePhotoIndex < photos.size(); businessStorePhotoIndex++) {
                JSONObject attr = photos.getJSONObject(businessStorePhotoIndex);
                attr.put("storeId", "-1");
                attr.put("storeId", storeId);
                attr.put("storePhotoId", "-" + (businessStorePhotoIndex + 1));
            }
        }
@@ -249,7 +254,7 @@
            for (int businessStoreCerdentialsIndex = 0; businessStoreCerdentialsIndex < cerdentials.size(); businessStoreCerdentialsIndex++) {
                JSONObject attr = cerdentials.getJSONObject(businessStoreCerdentialsIndex);
                attr.put("storeId", "-1");
                attr.put("storeId", storeId);
                attr.put("storeCerdentialsId", "-" + (businessStoreCerdentialsIndex + 1));
            }
        }
@@ -257,4 +262,28 @@
        return paramObj;
    }
    /**
     * 添加一级组织信息
     *
     * @param paramInJson     接口调用放传入入参
     * @return 订单服务能够接受的报文
     */
    private JSONObject addOrg(JSONObject paramInJson) {
        String orgId = GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_orgId);
        JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
        business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_SAVE_ORG);
        business.put(CommonConstant.HTTP_SEQ, DEFAULT_SEQ);
        business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S);
        JSONObject businessOrg = new JSONObject();
        businessOrg.put("orgName",paramInJson.getJSONObject("businessStore").getString("name"));
        businessOrg.put("orgLevel","1");
        businessOrg.put("parentOrgId",orgId);
        businessOrg.put("orgId", orgId);
        businessOrg.put("storeId", paramInJson.getString("storeId"));
        //计算 应收金额
        business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessOrg", businessOrg);
        return business;
    }
}
WebService/src/main/resources/components/orgPackage/choose-org/chooseOrg.html
@@ -1,8 +1,9 @@
<div id = "chooseOrgModel" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="chooseOrgModelLabel" aria-hidden="true" >
<div id="chooseOrgModel" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="chooseOrgModelLabel"
     aria-hidden="true">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <div class="modal-header">
                <h3 class="modal-title" id="chooseOrgModelLabel">选择组织管理</h3>
                <h3 class="modal-title" id="chooseOrgModelLabel">选择组织</h3>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
@@ -17,9 +18,11 @@
                                </div>
                                <div class="col-sm-5">
                                    <div class="input-group">
                                        <input placeholder="输入组织管理名称" type="text" v-model="chooseOrgInfo._currentOrgName" class="form-control form-control-sm">
                                        <input placeholder="输入组织名称" type="text" v-model="chooseOrgInfo._currentOrgName"
                                               class="form-control form-control-sm">
                                        <span class="input-group-append">
                                                <button type="button" class="btn btn-sm btn-primary" v-on:click="queryOrgs()">查询</button>
                                                <button type="button" class="btn btn-sm btn-primary"
                                                        v-on:click="queryOrgs()">查询</button>
                                            </span>
                                    </div>
                                </div>
@@ -27,28 +30,27 @@
                            <div class="table-responsive" style="margin-top:15px">
                                <table class="table table-striped">
                                    <thead>
                                        <tr>
                                                                        <th class="text-center">组织ID</th>
                            <th class="text-center">组织名称</th>
                            <th class="text-center">组织级别</th>
                            <th class="text-center">上级ID</th>
                            <th class="text-center">描述</th>
                            <th class="text-center">操作</th>
                                    <tr>
                                        <th class="text-center">组织ID</th>
                                        <th class="text-center">组织名称</th>
                                        <th class="text-center">组织级别</th>
                                        <th class="text-center">上级ID</th>
                                        <th class="text-center">操作</th>
                                        </tr>
                                    </tr>
                                    </thead>
                                    <tbody>
                                        <tr v-for="org in chooseOrgInfo.orgs">
                                                                        <td class="text-center">{{org.orgId}}</td>
                            <td class="text-center">{{org.orgName}}</td>
                            <td class="text-center">{{org.orgLevel}}</td>
                            <td class="text-center">{{org.parentOrgId}}</td>
                            <td class="text-center">{{org.description}}</td>
                                    <tr v-for="org in chooseOrgInfo.orgs">
                                        <td class="text-center">{{org.orgId}}</td>
                                        <td class="text-center">{{org.orgName}}</td>
                                        <td class="text-center">{{org.orgLevelName}}</td>
                                        <td class="text-center">{{org.parentOrgName}}</td>
                                            <td>
                                                <button class="btn btn-primary btn-xs" v-on:click="chooseOrg(org)">选择</button>
                                            </td>
                                        </tr>
                                        <td>
                                            <button class="btn btn-primary btn-xs" v-on:click="chooseOrg(org)">选择
                                            </button>
                                        </td>
                                    </tr>
                                    </tbody>
                                </table>
                            </div>