UserService/src/main/java/com/java110/user/smo/impl/UserServiceSMOImpl.java
@@ -2,7 +2,9 @@
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.JSONPath;
import com.java110.common.log.LoggerEngine;
import com.java110.common.util.Assert;
import com.java110.common.util.ProtocolUtil;
import com.java110.entity.user.BoCust;
import com.java110.entity.user.BoCustAttr;
@@ -16,6 +18,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
import java.util.Collections;
import java.util.HashMap;
@@ -80,7 +83,15 @@
    /**
     * 所有服务处理类
     * {
     *
     *     'boCust':[{}],
     *     'boCustAttr':[{}]
     * }
     *
     * 返回报文:
     *
     * {'RESULT_CODE':'0000','RESULT_MSG':'成功','RESULT_INFO':{'custId':'7000123,718881991'}}
     * @param userInfoJson
     * @return
     */
@@ -139,6 +150,83 @@
    }
    /**
     *
     * 请求报文为:
     *
     * {
     "data": [
     {
     "actionTypeCd": "C1",
     "boCust": [{},{}],
     "boCustAttr": [{ }, {}]
     },
     {
     "actionTypeCd": "C1",
     "boCust": [{},{}],
     "boCustAttr": [{ }, {}]
     }
     ]
     }
     返回报文 :
     { 'RESULT_CODE': '0000', 'RESULT_MSG': '成功', 'RESULT_INFO': {'cust':[{'oldCustId':'-1','custId':'12345678'},{'oldCustId':'-2','custId':'12345678'}]} }
     * @param userInfoJson
     * @return
     * @throws Exception
     */
    @Override
    public String soUserServiceForOrderService(JSONObject userInfoJson) throws Exception {
        Assert.isNull(userInfoJson,"data","请求报文缺少 data 节点,请检查");
        JSONArray custInfos = userInfoJson.getJSONArray("data");
        Assert.isNull(custInfos,"请求报文中data节点,没有子节点,data子节点应该为JSONArray,custInfos="+custInfos);
        JSONObject custInfoJ = new JSONObject();
        JSONArray resultCustIdArray = new JSONArray();
        for(int custInfoIndex = 0 ;custInfoIndex < custInfos.size();custInfoIndex ++){
            JSONObject custInfoJson = custInfos.getJSONObject(custInfoIndex);
            String soUserServiceResult = this.soUserService(custInfoJson);
            JSONObject resultInfo = new JSONObject();
            if(!ProtocolUtil.validateReturnJson(soUserServiceResult,resultInfo)){
                throw new RuntimeException("客户信息受理失败,原因为:"+resultInfo.getString(ProtocolUtil.RESULT_MSG));
            }
            if(resultInfo.getJSONObject(ProtocolUtil.RESULT_INFO) != null
                    && resultInfo.getJSONObject(ProtocolUtil.RESULT_INFO).containsKey("custId")) {
                String custIds = custInfoJ.getString("custId");
//                custIds += "," + resultInfo.getJSONObject(ProtocolUtil.RESULT_INFO).getString("custId");
//                custIds = custIds.startsWith(",") && custIds.length()>1 ? custIds.substring(1,custIds.length()):custIds;
                //custInfoJ.put("custId", custIds);
                JSONArray boCusts = custInfoJson.getJSONArray("boCust");
                Object custIdObj = JSONPath.eval(custInfoJson,"$.boCust[custId < '0'][0].custId");
                if(StringUtils.isNotBlank(custIds) && !ObjectUtils.isEmpty(custIdObj)) {
                    String[] allNewCustIds = custIds.split(",");
                    JSONObject newCustIdJson = null;
                    for (String custId : allNewCustIds) {
                        newCustIdJson = new JSONObject();
                        newCustIdJson.put("oldCustId",custIdObj);
                        newCustIdJson.put("custId",custId);
                        resultCustIdArray.add(newCustIdJson);
                    }
                }
            }
        }
        custInfoJ.put("cust",resultCustIdArray);
        return ProtocolUtil.createResultMsg(ProtocolUtil.RETURN_MSG_SUCCESS,"成功",custInfoJ);
    }
    /**
     * {
     *     boCust:[{},{}]
     * }
@@ -147,7 +235,7 @@
     *
     * @param boCusts
     * @return 成功 会带上处理客户的客户ID
     * {'RESULT_CODE':'0000','RESULT_MSG':'成功','RESULT_INFO':{'custId':'7000123,718881991}}
     * {'RESULT_CODE':'0000','RESULT_MSG':'成功','RESULT_INFO':{'custId':'7000123,718881991'}}
     * @throws Exception
     */
    public String soBoCust(String boCusts) throws Exception{