Java Code Examples for com.alibaba.fastjson.JSONObject#getInteger()

The following examples show how to use com.alibaba.fastjson.JSONObject#getInteger() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
@Override
public void soService(ServiceDataFlowEvent event) {
    DataFlowContext dataFlowContext = event.getDataFlowContext();
    //获取请求数据
    JSONObject reqJson = dataFlowContext.getReqJson();
    validateRoomData(reqJson);

    //将小区楼ID刷入到 请求参数中
    freshFloorIdToParam(reqJson);

    RoomDto roomDto = BeanConvertUtil.covertBean(reqJson, RoomDto.class);

    ApiRoomVo apiRoomVo = new ApiRoomVo();
    //查询总记录数
    int total = roomInnerServiceSMOImpl.queryRoomsWithOutSellCount(BeanConvertUtil.covertBean(reqJson, RoomDto.class));
    apiRoomVo.setTotal(total);
    if (total > 0) {
        List<RoomDto> roomDtoList = roomInnerServiceSMOImpl.queryRoomsWithOutSell(roomDto);
        apiRoomVo.setRooms(BeanConvertUtil.covertBeanList(roomDtoList, ApiRoomDataVo.class));
    }
    int row = reqJson.getInteger("row");
    apiRoomVo.setRecords((int) Math.ceil((double) total / (double) row));

    ResponseEntity<String> responseEntity = new ResponseEntity<String>(JSONObject.toJSONString(apiRoomVo), HttpStatus.OK);
    dataFlowContext.setResponseEntity(responseEntity);
}
 
Example 2
@Override
    protected ResponseEntity<String> doBusinessProcess(IPageData pd, JSONObject paramIn) {
        ComponentValidateResult result = super.validateStoreStaffCommunityRelationship(pd, restTemplate);

//        Map paramMap = BeanConvertUtil.beanCovertMap(result);
//        paramIn.putAll(paramMap);
        int page = paramIn.getInteger("page");
        int row = paramIn.getInteger("row");
        paramIn.put("storeId", result.getStoreId());
        paramIn.put("page", (page - 1) * row);
        paramIn.put("row", page * row);

        String apiUrl = "";

        apiUrl = ServiceConstant.SERVICE_API_URL + "/api/api.getStaffFee" + mapToUrlParam(paramIn);

        ResponseEntity<String> responseEntity = this.callCenterService(restTemplate, pd, "",
                apiUrl,
                HttpMethod.GET);

        return responseEntity;
    }
 
Example 3
Source Project: PeonyFramwork   File: DeployService.java    License: Apache License 2.0 6 votes vote down vote up
public JSONObject delDeployServer(String projectId, int id,int page){

        DeployServer deployServer = dataService.selectObject(DeployServer.class,"projectId=? and id=?",projectId,id);
        if(deployServer == null){
            throw new ToClientException(SysConstantDefine.InvalidParam,"server id is not exist!projectId={}, id={}",projectId,id);
        }
        dataService.delete(deployServer);

        JSONObject ret = getDeployServerList(projectId,page,serverPageSize);
        JSONArray array = ret.getJSONArray("deployServers");
        Iterator<Object> it = array.iterator();
        while (it.hasNext()){
            JSONObject jsonObject = (JSONObject)it.next();
            if(jsonObject.getInteger("id")==id){
                it.remove();
                break;
            }
        }

        return ret;
    }
 
Example 4
Source Project: Almost-Famous   File: CreateRoleRequest.java    License: MIT License 6 votes vote down vote up
@Override
public void completed(HttpResponse result) {
    JSONObject obj = getJSONObject(result);
    int code = obj.getInteger("code");
    if (code == ErrorCode.ROLE_EXIST.value()) {
        log.error("角色已经存在");
    } else if (code == ErrorCode.SERVER_SUCCESS.value()) {
        try {
            RoleListCmd roleListCmd = new RoleListCmd();
            roleListCmd.setCmd(RegisterProtocol.ROLE_LIST_ACTION_REQ);
            roleListCmd.setUid(createRoleCmd.getUid());
            roleListCmd.setToken(createRoleCmd.getToken());
            roleListCmd.setIndex(createRoleCmd.getIndex());
            new RoleListRequest(roleListCmd).execute();
        } catch (Exception e) {
            log.error("Get role list: ", e);
        }
    }
}
 
Example 5
/**
 * 根据条件查询
 *
 * @param reqJson         查询信息
 * @param dataFlowContext 上下文
 */
private void queryByCondition(JSONObject reqJson, DataFlowContext dataFlowContext) {

    int row = reqJson.getInteger("row");
    ApiOwnerVo apiOwnerVo = new ApiOwnerVo();
    int total = ownerInnerServiceSMOImpl.queryOwnerCountByCondition(BeanConvertUtil.covertBean(reqJson, OwnerDto.class));
    apiOwnerVo.setTotal(total);
    if (total > 0) {
        List<OwnerDto> ownerDtoList = ownerInnerServiceSMOImpl.queryOwnersByCondition(BeanConvertUtil.covertBean(reqJson, OwnerDto.class));
        apiOwnerVo.setOwners(BeanConvertUtil.covertBeanList(ownerDtoList, ApiOwnerDataVo.class));
    }

    apiOwnerVo.setRecords((int) Math.ceil((double) total / (double) row));

    ResponseEntity<String> responseEntity = new ResponseEntity<String>(JSONObject.toJSONString(apiOwnerVo), HttpStatus.OK);
    dataFlowContext.setResponseEntity(responseEntity);
}
 
Example 6
Source Project: Almost-Famous   File: Dispatch.java    License: MIT License 6 votes vote down vote up
@RequestMapping("/a")
public Resoult a(@RequestBody String json, HttpServletRequest request, HttpServletResponse response) {
    Resoult r = null;
    try {
        JSONObject req = FastJsonUtils.parseObject(json);
        Integer cmd = req.getInteger("cmd");
        Long rid = req.getLong("rid");
        Action action = RegisterProtocol.REGISTER_PROTOCOL_MAP.get(cmd);
        if (Objects.isNull(action)) {
            log.error("Dispatch error! Unknown protocol={}", cmd);
            return Resoult.error(cmd, ErrorCode.UNKNOWN_PROTOCOL, "");
        }
        if (Objects.nonNull(rid)) {
            action.setRid(rid);
        }
        action.setCmd(cmd);
        r = action.execute(req, request, response);
    } catch (Exception e) {
        log.error("", e);
    }
    return r;
}
 
Example 7
Source Project: Almost-Famous   File: ProgressRequest.java    License: MIT License 6 votes vote down vote up
@Override
public void completed(HttpResponse result) {
    JSONObject object = getJSONObject(result);
    Integer code = object.getInteger("code");
    String data = object.getString("data");
    if (code == ErrorCode.SERVER_SUCCESS.value()) {
        JSONObject dataObj = FastJsonUtils.parseObject(data);
        Long rid = dataObj.getLong("rid");
        String chapters = dataObj.getString("chapters");
        Map<Integer, ChapterBean> chapterMap = Misc.parseToMap(chapters, Integer.class, ChapterBean.class);
        RobotMgr robotMgr = SpringContextUtils.getBean("robotMgr", RobotMgr.class);
        Robot robot = robotMgr.getRobotMap().get(rid);
        Chapter chapter = new Chapter();
        chapter.setRid(rid);
        chapter.setChapters(chapterMap);
        robot.setChapter(chapter);
        if (log.isInfoEnabled()) {
            log.info("进度列表 {}", chapterMap);
        }
    }
}
 
Example 8
Source Project: Almost-Famous   File: ChallengeOverRequest.java    License: MIT License 5 votes vote down vote up
@Override
public void completed(HttpResponse result) {
    JSONObject object = getJSONObject(result);
    Integer code = object.getInteger("code");
    String data = object.getString("data");
    if (code == ErrorCode.SERVER_SUCCESS.value()) {
        JSONObject dataObj = FastJsonUtils.parseObject(data);
        String drop = dataObj.getString("drop");
        List<PropBean> propList = FastJsonUtils.toList(drop, PropBean.class);
        if (log.isDebugEnabled()) {
            log.debug("通关后的奖励信息, {}", propList);
        }
        // 通关后再次调用关卡进度列表 刷新jvm中内存的值
        ProgressCmd progressCmd = new ProgressCmd();
        progressCmd.setCmd(RegisterProtocol.CHAPTER_PROGRESS_REQ);
        progressCmd.setRid(challengeOverCmd.getRid());

        SchoolListCmd schoolListCmd = new SchoolListCmd();
        schoolListCmd.setCmd(RegisterProtocol.SCHOOL_LIST_REQ);
        schoolListCmd.setRid(challengeOverCmd.getRid());
        try {
            new ProgressRequest(progressCmd).execute();
            new SchoolListRequest(schoolListCmd).execute();
        } catch (Exception e) {
            log.error("获取玩家章节列表失败: ", e);
        }
    }
}
 
Example 9
Source Project: evt4j   File: Permission.java    License: MIT License 5 votes vote down vote up
@NotNull
public static Permission ofRaw(@NotNull JSONObject raw) {
    Objects.requireNonNull(raw);
    String name = raw.getString("name");
    int threshold = raw.getInteger("threshold");
    List<AuthorizerWeight> authorizers = new ArrayList<>();
    JSONArray authorizersArray = raw.getJSONArray("authorizers");

    for (int i = 0; i < authorizersArray.size(); i++) {
        authorizers.add(AuthorizerWeight.ofRaw((JSONObject) authorizersArray.get(i)));
    }

    return new Permission(name, threshold, authorizers);
}
 
Example 10
@Override
    public Resoult execute(JSONObject jsonObject, HttpServletRequest request, HttpServletResponse response) {
        Integer chapterId = jsonObject.getInteger("chapterId");
        Integer schoolId = jsonObject.getInteger("schoolId");
        Integer state = jsonObject.getInteger("state"); //失败 0

        JSONObject object = chapterService.challengeOver(rid, schoolId, chapterId, state);
        ErrorCode code = object.getObject("code", ErrorCode.class);
        String drop = object.getString("drop");
        if (code != ErrorCode.SERVER_SUCCESS) {
            return Resoult.error(RegisterProtocol.CHAPTER_CHALLENGE_OVER_RESP, code, "");
        }

        JSONObject data = new JSONObject();
        ConcurrentHashMap<Integer, Integer> map = new ConcurrentHashMap<>();
        String cutQuotes = Misc.cutQuotes(drop);
        List<HoldItem> holdItems = ItemMgr.dropItem(cutQuotes);
        List<PropBean> propList = GameUtils.getPropList(holdItems);
        data.put("drop", propList);

        //推送GM
        Resoult result = GameUtils.getActorCurrency(roleService.selectByRoleId(rid), rid);
        sendMessage.send(rid, result);
//        sendMessage.sendNow(rid);

        missionService.actorMissionMgr(missionService.getActorMissionById(rid), roleService.selectByRoleId(rid));
        //任务推送
//        missionService.noticeMission(rid);
        return Resoult.ok(RegisterProtocol.CHAPTER_CHALLENGE_OVER_RESP).responseBody(data);
    }
 
Example 11
Source Project: DBus   File: DBusRouterKafkaWriteBolt.java    License: Apache License 2.0 5 votes vote down vote up
private void startTopologyTable(JSONObject ctrl) throws Exception {
    effectTopologyTable(ctrl, true);
    JSONObject payload = ctrl.getJSONObject("payload");
    Integer projectTopoTableId = payload.getInteger("projectTopoTableId");
    inner.dbHelper.toggleProjectTopologyTableStatus(projectTopoTableId, DBusRouterConstants.PROJECT_TOPOLOGY_TABLE_STATUS_START);
    logger.info("kafka write bolt start topology table completed.");
}
 
Example 12
Source Project: PeonyFramwork   File: FruitService.java    License: Apache License 2.0 5 votes vote down vote up
@EventListener(event = SysConstantDefine.Event_AccountRegister)
public void Event_AccountRegister(List regEventData) {
    JSONObject lginParams = (JSONObject)regEventData.get(1);
    if(lginParams.containsKey("shareQuery")){
        JSONObject shareQuery = lginParams.getJSONObject("shareQuery");
        if(shareQuery.containsKey("posId")){
            int posId = shareQuery.getInteger("posId");
            String uid = shareQuery.getString("uid");
            if(!PosConfig.datas.get(posId).isShare()){
                logger.error("pos is not open for share!!!!!posid={}",posId);
                return;
            }
            System.out.println(shareQuery);
            UserFruit userFruit = dataService.selectObject(UserFruit.class,"uid=? and posId=?",uid,posId);
            // J解锁
            if(userFruit == null){
                userFruit = new UserFruit();
                userFruit.setUid(uid);
                userFruit.setPosId(posId);
                userFruit.setState(FruitState.Idle.getId());
                dataService.insert(userFruit);
                sendMessageService.sendMessage(uid,Cmd.Push_UnlockByShare,toJson(userFruit));
            }else{
                if(userFruit.getState() == FruitState.Locked.getId()){
                    userFruit.setState(FruitState.Idle.getId());
                    dataService.update(userFruit);
                    sendMessageService.sendMessage(uid,Cmd.Push_UnlockByShare,toJson(userFruit));
                }
            }
        }
    }

}
 
Example 13
Source Project: evt4j   File: TransactionDetail.java    License: MIT License 5 votes vote down vote up
private TransactionDetail(@NotNull JSONObject raw) throws JSONException {
    blockNum = raw.getInteger("block_num");
    packedTrx = raw.getString("packed_trx");
    id = raw.getString("id");
    compression = raw.getString("compression");
    JSONArray signaturesArray = raw.getJSONArray("signatures");

    for (int i = 0; i < signaturesArray.size(); i++) {
        signatures.add(Signature.of((String) signaturesArray.get(i)));
    }

    transaction = raw.getJSONObject("transaction");
    blockId = raw.getString("block_id");
}
 
Example 14
@Override
public void initialize(Litchi litchi) {
    JSONObject config = litchi.config(Constants.Component.DATA_CONFIG);
    if (config == null) {
        LOGGER.error("'dataConfig' node not found in litchi.json");
        return;
    }

    String dataSourceKey = config.getString("dataSource");
    JSONObject fileConfig = config.getJSONObject(dataSourceKey);

    if (fileConfig == null || fileConfig.isEmpty()) {
        LOGGER.error("'dataConfig' node is null. check litchi.json please.");
        return;
    }

    this.filePath = FileUtils.combine(litchi.getRootConfigPath(), fileConfig.getString("filePath"));

    this.reloadFlushTime = fileConfig.getInteger("reloadFlushTime");

    this.litchi = litchi;

    this.fileDir = new File(this.filePath);
    if (!this.fileDir.isDirectory()) {
        LOGGER.error("current data config path is not directory: path:{}", this.filePath);
        return;
    }

    try {
        reloadMonitor = new FileAlterationMonitor(this.reloadFlushTime, createFileObserver());
        reloadMonitor.start();

        LOGGER.info("local data config flush monitor is start!");
        LOGGER.info("path:{}, flushTime:{}ms", this.filePath, this.reloadFlushTime);
    } catch (Exception ex) {
        LOGGER.error("{}", ex);
    }
}
 
Example 15
Source Project: EserKnife   File: BulkResultItem.java    License: Apache License 2.0 5 votes vote down vote up
public BulkResultItem(String action, JSONObject values) {
    this.action = action;
    this.index = values.getString(ParseHandler.INDEX_NAME);
    this.type = values.getString(ParseHandler.TYPE_NAME);
    this.id = values.getString(ParseHandler.ID_NAME);
    this.status = values.getIntValue(ParseHandler.STATUS_NAME);
    this.error = values.getString(ParseHandler.ERROR_NAME);
    this.version = values.getInteger(ParseHandler.VERSION_NAME);
    setRealAction(action, status);
}
 
Example 16
Source Project: redtorch   File: AuthServiceImpl.java    License: MIT License 4 votes vote down vote up
@Override
public boolean login(String username, String password) {

	if (StringUtils.isBlank(username) || StringUtils.isBlank(password)) {
		return false;
	}

	JSONObject reqDataJsonObject = new JSONObject();
	reqDataJsonObject.put("username", username);
	reqDataJsonObject.put("password", password);

	RestTemplate rest = new RestTemplate();
	HttpHeaders requestHeaders = new HttpHeaders();
	requestHeaders.add("Content-Type", "application/json");
	requestHeaders.add("Accept", "*/*");
	HttpEntity<String> requestEntity = new HttpEntity<String>(reqDataJsonObject.toJSONString(), requestHeaders);

	loginStatus = false;
	responseHttpHeaders = null;
	this.username = "";
	try {
		ResponseEntity<String> responseEntity = rest.exchange(loginUri, HttpMethod.POST, requestEntity, String.class);
		System.out.println(responseEntity.toString());
		if (responseEntity.getStatusCode().is2xxSuccessful()) {
			JSONObject resultJSONObject = JSON.parseObject(responseEntity.getBody());
			if (resultJSONObject.getBooleanValue("status")) {
				JSONObject voData = resultJSONObject.getJSONObject("voData");

				nodeId = voData.getInteger("recentlyNodeId");
				operatorId = voData.getString("operatorId");
				this.username = username;
				loginStatus = true;
				responseHttpHeaders = responseEntity.getHeaders();
				logger.info("登录成功!");
				return true;
			} else {
				logger.error("登录失败!服务器返回错误!");
				return false;
			}

		} else {
			logger.info("登录失败!");
			return false;
		}

	} catch (Exception e) {
		logger.error("登录请求错误!", e);
		return false;
	}
}
 
Example 17
@Override
public SearchResultVo parseData(JSONObject json) {
	
	SearchResultVo resultVo = new SearchResultVo();
	
	List<SearchResultDetailVO> list = new ArrayList<SearchResultDetailVO>();
	
	if(json == null) {
		return resultVo;
	}
	
	resultVo.setOriginalData(json);
	
	resultVo.setResults(list);
	
	JSONObject hits = json.getJSONObject(HITS_NAME);
	
	if(hits == null) {
		return resultVo;
	}
	
	Integer total = hits.getInteger(TOTAL_NAME);
	
	if(total != null) {
		resultVo.setTotal(total);
	}

       String scrollId = json.getString("_scroll_id");

       if(scrollId != null) {
           resultVo.setScrollId(scrollId);
       }

	JSONArray results = hits.getJSONArray(HITS_NAME);
	
	if(results == null) {
		return resultVo;
	}
	
	for(Object obj : results) {
		JSONObject jb = (JSONObject)obj;
		SearchResultDetailVO detailVo = new SearchResultDetailVO();
		detailVo.setIndex(jb.getString(INDEX_NAME));
		detailVo.setType(jb.getString(TYPE_NAME));
		detailVo.setId(jb.getString(ID_NAME));
		detailVo.setScore(jb.getFloat(SCORE_NAME));
		detailVo.setVersion(jb.getLong(VERSION_NAME));
		detailVo.setHighlight(jb.getString(HIGHLIGHT));
		String fields = jb.getString(SOURCE_NAME);
		if(fields == null) {
			fields = jb.getString(FIELDS_NAME);
		}
	    detailVo.setResult(fields);
	    list.add(detailVo);
	}
	
	return resultVo;
}
 
Example 18
Source Project: Almost-Famous   File: RoleListRequest.java    License: MIT License 4 votes vote down vote up
@Override
public void completed(HttpResponse result) {
    JSONObject obj = getJSONObject(result);
    int code = obj.getInteger("code");
    if (code == ErrorCode.SERVER_SUCCESS.value()) {
        String data = obj.getString("data");
        if (data == null) {
            CreateRoleCmd createRoleCmd = new CreateRoleCmd();
            createRoleCmd.setCmd(RegisterProtocol.CREATE_ROLE_ACTION_REQ);
            createRoleCmd.setUid(roleListCmd.getUid());
            createRoleCmd.setToken(roleListCmd.getToken());
            createRoleCmd.setIndex(roleListCmd.getIndex());
            try {
                new CreateRoleRequest(createRoleCmd).execute();
            } catch (Exception e) {
                log.error("Create role error: ", e);
            }
            return;
        }
        JSONObject dataObj = FastJsonUtils.parseObject(data);
        long rid = dataObj.getLong("rid");
        if (rid > 0) {
            Robot robot = new Robot();
            robot.setUid(roleListCmd.getUid());
            robot.setToken(roleListCmd.getToken());
            robot.setRid(rid);
            robot.setRoleName(dataObj.getString("roleName"));
            robot.setSchool(dataObj.getString("school"));
            robot.setGold(dataObj.getLong("gold"));
            robot.setSilver(dataObj.getLong("silver"));
            robot.setDiamond(dataObj.getLong("diamond"));
            RobotMgr.getInstance().addRobot(robot);

            FamousRobotApplication.pool.execute(robot, roleListCmd.getIndex());


        } else {
            log.error("没有角色信息??");
        }
    }
}
 
Example 19
Source Project: yue-library   File: DbUpdate.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * <h1>更新-排序</h1><br>
 * <i>使用限制:见</i> {@linkplain DbInsert#insertWithSortIdxAutoIncrement(String, JSONObject, String...)}
 * <p>
 * @param tableName 表名
 * @param id 主键ID
 * @param move sort_idx移动位数(值不可等于零,正整数表示:向后移动几位,负整数表示:向前移动几位)
 * @param uniqueKeys 同sort_idx字段组合的唯一约束keys(表中不建议建立sort_idx字段的唯一约束,但可以建立普通索引,以便于提高查询性能),<b>可选参数</b>
 */
@Transactional
public void updateSort(String tableName, Long id, Integer move, @Nullable String... uniqueKeys) {
	// 1. 参数验证
	paramValidate(tableName);
	if (move == 0) {
		throw new DbException("move <= 0");
	}
	
	// 2. 获得当前排序索引
	String id_key = "id";
	String sort_idx_key = "sort_idx";
	JSONObject sortJson = getById(tableName, id);
	int sortIdx = sortJson.getInteger(sort_idx_key);
	int updateSortIdx = sortIdx + move;
	if (updateSortIdx < 1) {
		throw new DbException("排序后的索引值不能小于1");
	}
	
	// 3. 确认排序方式
	List<Integer> updateSortList = new ArrayList<>();
	boolean isASC = false;
	if (updateSortIdx > sortIdx) {// 升序
		isASC = true;
		for (int i = updateSortIdx; i > sortIdx; i--) {
			updateSortList.add(i);
		}
	} else {// 降序
		for (int i = updateSortIdx; i < sortIdx; i++) {
			updateSortList.add(i);
		}
	}
	
	// 4. 查询需要跟随移动的数据ID
	JSONObject paramJson = new JSONObject();
	if (ArrayUtil.isNotEmpty(uniqueKeys)) {
		for (String uniqueKey : uniqueKeys) {
			var uniqueValue = sortJson.get(uniqueKey);
			paramJson.put(uniqueKey, uniqueValue);
		}
	}
	paramJson.put(sort_idx_key, updateSortList);
	List<JSONObject> list = list(tableName, paramJson);
	
	// 5. 组装跟随移动参数到参数列表
	JSONArray paramJsonArray = new JSONArray();
	for (JSONObject actionJSON : list) {
		Long actionId = actionJSON.getLong(id_key);
		Integer actionSort = actionJSON.getInteger(sort_idx_key);
		if (isASC) {
			actionSort -= 1;
		} else {
			actionSort += 1;
		}
		JSONObject actionParamJSON = new JSONObject();
		actionParamJSON.put(id_key, actionId);
		actionParamJSON.put(sort_idx_key, actionSort);
		paramJsonArray.add(actionParamJSON);
	}
	
	// 6. 添加排序更新参数到参数列表
	JSONObject updateSortParam = new JSONObject();
	updateSortParam.put(id_key, id);
	updateSortParam.put(sort_idx_key, updateSortIdx);
	paramJsonArray.add(updateSortParam);
	
	// 7. 排序更新
	updateById(tableName, ListUtils.toJsons(paramJsonArray), DbUpdateEnum.NORMAL);
}
 
Example 20
Source Project: unimall   File: UserServiceImpl.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * 微信第三方登录 抽取接口(目前只有小程序)
 *
 * @param loginType
 * @param ip
 * @param raw
 * @return
 * @throws Exception
 */
private UserDTO wechatLogin(Integer loginType, String ip, String raw) throws Exception {
    //微信第三方登录
    JSONObject thirdPartJsonObject = JSONObject.parseObject(raw);
    String code = thirdPartJsonObject.getString("code");
    String body = okHttpClient.newCall(new Request.Builder()
            .url("https://api.weixin.qq.com/sns/jscode2session?appid=" + (UserLoginType.MP_WEIXIN.getCode() == loginType ? wxMiNiAppid : wxAppAppid) +
                    "&secret=" + (UserLoginType.MP_WEIXIN.getCode() == loginType ? wxMiNiSecret : wxAppSecret) +
                    "&grant_type=authorization_code&js_code=" + code).get().build()).execute().body().string();
    JSONObject jsonObject = JSONObject.parseObject(body);
    Integer errcode = jsonObject.getInteger("errcode");
    if (errcode == null || errcode == 0) {
        String miniOpenId = jsonObject.getString("openid");
        List<UserDO> userDOS = userMapper.selectList(new EntityWrapper<UserDO>().eq("open_id", miniOpenId).eq("login_type", loginType));
        UserDO userDO;
        if (CollectionUtils.isEmpty(userDOS)) {
            //若用户为空,则注册此用户
            Date now = new Date();
            UserDO newUserDO = new UserDO();
            newUserDO.setLoginType(loginType);
            newUserDO.setOpenId(miniOpenId);
            newUserDO.setLastLoginIp(ip);
            newUserDO.setGmtLastLogin(now);
            newUserDO.setGmtUpdate(now);
            newUserDO.setGmtCreate(now);
            userMapper.insert(newUserDO);
            //这一步是为了封装上数据库上配置的默认值
            userDO = userMapper.selectById(newUserDO.getId());
        } else {
            userDO = userDOS.get(0);
            UserDO userUpdateDO = new UserDO();
            userUpdateDO.setId(userDO.getId());
            userUpdateDO.setGmtLastLogin(new Date());
            userUpdateDO.setLastLoginIp(ip);
            userMapper.updateById(userUpdateDO);
        }
        //检查帐号是否已经冻结
        if (userDO.getStatus() == 0) {
            throw new AppServiceException(ExceptionDefinition.USER_CAN_NOT_ACTICE);
        }
        String accessToken = GeneratorUtil.genSessionId();
        UserDTO userDTO = new UserDTO();
        BeanUtils.copyProperties(userDO, userDTO);
        userRedisTemplate.opsForValue().set(Const.USER_REDIS_PREFIX + accessToken, JSONObject.toJSONString(userDTO));
        userDTO.setAccessToken(accessToken);
        return userDTO;
    } else {
        logger.info("[微信登录] 回复失败 回复报文:" + body);
        throw new AppServiceException(ExceptionDefinition.USER_THIRD_UNEXPECT_RESPONSE);
    }

}