java110
2020-06-05 dab387fb9589dd0ea4b9e89d51079df3713358a8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
package com.java110.api.bmo.org.impl;
 
import com.alibaba.fastjson.JSONObject;
import com.java110.api.bmo.ApiBaseBMO;
import com.java110.api.bmo.org.IOrgBMO;
import com.java110.core.context.DataFlowContext;
import com.java110.core.smo.user.IOrgInnerServiceSMO;
import com.java110.dto.org.OrgDto;
import com.java110.po.community.OrgCommunityPo;
import com.java110.po.org.OrgPo;
import com.java110.utils.constant.BusinessTypeConstant;
import com.java110.utils.util.Assert;
import com.java110.utils.util.BeanConvertUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import java.util.List;
 
/**
 * @ClassName OrgBMOImpl
 * @Description TODO
 * @Author wuxw
 * @Date 2020/3/9 23:10
 * @Version 1.0
 * add by wuxw 2020/3/9
 **/
@Service("orgBMOImpl")
public class OrgBMOImpl extends ApiBaseBMO implements IOrgBMO {
    @Autowired
    private IOrgInnerServiceSMO orgInnerServiceSMOImpl;
 
    /**
     * 添加小区信息
     *
     * @param paramInJson     接口调用放传入入参
     * @param dataFlowContext 数据上下文
     * @return 订单服务能够接受的报文
     */
    public void deleteOrgCommunity(JSONObject paramInJson, DataFlowContext dataFlowContext) {
        OrgCommunityPo orgCommunityPo = BeanConvertUtil.covertBean(paramInJson, OrgCommunityPo.class);
        super.delete(dataFlowContext, orgCommunityPo, BusinessTypeConstant.BUSINESS_TYPE_DELETE_ORG_COMMUNITY);
    }
 
    /**
     * 添加小区信息
     *
     * @param paramInJson     接口调用放传入入参
     * @param dataFlowContext 数据上下文
     * @return 订单服务能够接受的报文
     */
    public void deleteOrg(JSONObject paramInJson, DataFlowContext dataFlowContext) {
 
        OrgPo orgPo = BeanConvertUtil.covertBean(paramInJson, OrgPo.class);
        super.delete(dataFlowContext, orgPo, BusinessTypeConstant.BUSINESS_TYPE_DELETE_ORG);
 
    }
 
    /**
     * 添加小区信息
     *
     * @param paramInJson     接口调用放传入入参
     * @param dataFlowContext 数据上下文
     * @return 订单服务能够接受的报文
     */
    public void addOrgCommunity(JSONObject paramInJson, JSONObject communityObj, int seq, DataFlowContext dataFlowContext) {
 
        JSONObject businessOrg = new JSONObject();
        businessOrg.putAll(paramInJson);
        businessOrg.put("orgCommunityId", "-1");
        businessOrg.put("communityId", communityObj.getString("communityId"));
        businessOrg.put("communityName", communityObj.getString("communityName"));
 
        OrgCommunityPo orgCommunityPo = BeanConvertUtil.covertBean(businessOrg, OrgCommunityPo.class);
        super.insert(dataFlowContext, orgCommunityPo, BusinessTypeConstant.BUSINESS_TYPE_SAVE_ORG_COMMUNITY);
 
    }
 
    /**
     * 添加小区信息
     *
     * @param paramInJson     接口调用放传入入参
     * @param dataFlowContext 数据上下文
     * @return 订单服务能够接受的报文
     */
    public void addOrg(JSONObject paramInJson, DataFlowContext dataFlowContext) {
 
        JSONObject businessOrg = new JSONObject();
        businessOrg.putAll(paramInJson);
        businessOrg.put("orgId", "-1");
        businessOrg.put("allowOperation", "T");
        businessOrg.put("belongCommunityId", "");
 
        OrgPo orgPo = BeanConvertUtil.covertBean(businessOrg, OrgPo.class);
        super.insert(dataFlowContext, orgPo, BusinessTypeConstant.BUSINESS_TYPE_SAVE_ORG);
 
    }
 
 
    /**
     * 添加组织管理信息
     *
     * @param paramInJson     接口调用放传入入参
     * @param dataFlowContext 数据上下文
     * @return 订单服务能够接受的报文
     */
    public void updateOrg(JSONObject paramInJson, DataFlowContext dataFlowContext) {
 
        OrgDto orgDto = new OrgDto();
        orgDto.setOrgId(paramInJson.getString("orgId"));
        orgDto.setStoreId(paramInJson.getString("storeId"));
        List<OrgDto> orgDtos = orgInnerServiceSMOImpl.queryOrgs(orgDto);
 
        Assert.listOnlyOne(orgDtos, "未查询到组织信息 或查询到多条数据");
 
        JSONObject businessOrg = new JSONObject();
        businessOrg.putAll(paramInJson);
        businessOrg.put("allowOperation", orgDtos.get(0).getAllowOperation());
        businessOrg.put("belongCommunityId", orgDtos.get(0).getBelongCommunityId());
        OrgPo orgPo = BeanConvertUtil.covertBean(businessOrg, OrgPo.class);
        super.insert(dataFlowContext, orgPo, BusinessTypeConstant.BUSINESS_TYPE_UPDATE_ORG);
 
    }
}