Browse Source

Merge branch 'develop' of gitadmin/tuoheng_freeway into release

tags/v1.2.0^2
xuziqing 1 year ago
parent
commit
d37b25af88
33 changed files with 895 additions and 95 deletions
  1. +14
    -0
      tuoheng-common/tuoheng-common-core/src/main/java/com/tuoheng/common/core/config/common/CommonConfig.java
  2. +57
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/callback/OidcCallbackController.java
  3. +0
    -5
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/entity/Tenant.java
  4. +10
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/ClientEnum.java
  5. +10
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/oidc/OidcCreateUserRequest.java
  6. +69
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/third/oidc/CreateOidcTenantRequest.java
  7. +19
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/third/oidc/DeletedOidcTenantRequest.java
  8. +69
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/third/oidc/EditOidcTenantRequest.java
  9. +2
    -4
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/update/status/UpdateWaittStatusService.java
  10. +4
    -10
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/airport/ExecuteTaskService.java
  11. +2
    -5
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/airport/GetAirLineListService.java
  12. +2
    -5
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/airport/GetAirportListService.java
  13. +4
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/dsp/DspCallbackServiceImpl.java
  14. +220
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/oidc/AddOidcTenantService.java
  15. +12
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/oidc/AddOidcUserService.java
  16. +83
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/oidc/DeletedOidcTenantService.java
  17. +218
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/oidc/EditOidcTenantService.java
  18. +2
    -2
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/oidc/EditOidcUserPasswordService.java
  19. +9
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/oidc/OidcService.java
  20. +29
    -2
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/oidc/OidcServiceImpl.java
  21. +0
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/user/init/SystemUserInitService.java
  22. +1
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/user/update/UpdateUserPasswordService.java
  23. +2
    -0
      tuoheng-service/tuoheng-admin/src/main/resources/application-dev.yml
  24. +2
    -0
      tuoheng-service/tuoheng-admin/src/main/resources/application-local.yml
  25. +2
    -0
      tuoheng-service/tuoheng-admin/src/main/resources/application-prod.yml
  26. +2
    -0
      tuoheng-service/tuoheng-admin/src/main/resources/application-test.yml
  27. +40
    -41
      tuoheng-service/tuoheng-admin/src/main/resources/mapper/TenantMapper.xml
  28. +0
    -5
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/entity/Tenant.java
  29. +3
    -11
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/impl/AirportServiceImpl.java
  30. +2
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/resources/application-dev.yml
  31. +2
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/resources/application-local.yml
  32. +2
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/resources/application-prod.yml
  33. +2
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/resources/application-test.yml

+ 14
- 0
tuoheng-common/tuoheng-common-core/src/main/java/com/tuoheng/common/core/config/common/CommonConfig.java View File

@@ -43,6 +43,11 @@ public class CommonConfig {
*/
public static String oidcUrl;

/**
* 机场地址
*/
public static String airportURL;

/**
* 图片域名赋值
*
@@ -111,4 +116,13 @@ public class CommonConfig {
oidcUrl = url;
}

/**
* 机场url
* @param url
*/
@Value("${tuoheng.airport-url}")
public void airportURL(String url) {
airportURL = url;
}

}

+ 57
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/callback/OidcCallbackController.java View File

@@ -0,0 +1,57 @@
package com.tuoheng.admin.controller.callback;

import com.alibaba.fastjson.JSONObject;
import com.tuoheng.admin.request.third.oidc.CreateOidcTenantRequest;
import com.tuoheng.admin.request.third.oidc.DeletedOidcTenantRequest;
import com.tuoheng.admin.request.third.oidc.EditOidcTenantRequest;
import com.tuoheng.admin.service.third.oidc.OidcService;
import com.tuoheng.common.core.utils.JsonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
* oidc平台回调前端控制器
*
* @author wanjing
* @team tuoheng
* @date 2023-02-23
*/
@Slf4j
@RestController
@RequestMapping("/oidc/callback")
public class OidcCallbackController {

@Autowired
private OidcService oidcService;

/**
* 创建租户
*/
@PostMapping("/tenant/create")
public JsonResult createTenant(@RequestBody CreateOidcTenantRequest request) {
log.info("被oidc调用,创建租户:{}", JSONObject.toJSONString(request));
return oidcService.createTenant(request);
}

/**
* 创建用户
*/
@PostMapping("/tenant/edit")
public JsonResult editTenant(@RequestBody EditOidcTenantRequest request) {
log.info("被oidc调用,修改租户:{}", JSONObject.toJSONString(request));
return oidcService.editTenant(request);
}

/**
* 删除用户
*/
@PostMapping("/tenant/deleted")
public JsonResult deletedTenant(@RequestBody DeletedOidcTenantRequest request) {
log.info("被oidc调用,删除租户:{}", JSONObject.toJSONString(request));
return oidcService.deletedTenant(request);
}
}

+ 0
- 5
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/entity/Tenant.java View File

@@ -99,11 +99,6 @@ public class Tenant extends BaseEntity implements Serializable {
*/
private String platformName;

/**
* 机场平台url
*/
private String airportUrl;

/**
* 详细地址
*/

+ 10
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/ClientEnum.java View File

@@ -41,4 +41,14 @@ public enum ClientEnum {
}
return null;
}

public static ClientEnum parse(String description) {
ClientEnum[] valueEnums = values();
for (ClientEnum valueEnum : valueEnums) {
if (valueEnum.getDescription().equals(description)) {
return valueEnum;
}
}
return null;
}
}

+ 10
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/oidc/OidcCreateUserRequest.java View File

@@ -18,6 +18,16 @@ public class OidcCreateUserRequest {

private List<ClientRoleDto> clientRoleDtoList;

/**
* 租户code
*/
private String code;

/**
* 租户名称
*/
private String name;

/**
* 如果不是租户,传值:用户所属租户名称
*/

+ 69
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/third/oidc/CreateOidcTenantRequest.java View File

@@ -0,0 +1,69 @@
package com.tuoheng.admin.request.third.oidc;

import lombok.Data;

/**
* oidc-新增租户第三方
*
* @Author xiaoying
* @Date 2023/1/9 10:08
*/
@Data
public class CreateOidcTenantRequest {

/**
* 用户名
*/
private String username;

/**
* 租户名称
*/
private String tenantName;

/**
* 平台
*/
private String clientId;

/**
* 密码
*/
private String password;

/**
* 租户code
*/
private String tenantCode;

/**
* 省级编码
*/
private String provinceCode;

/**
* 省份名称
*/
private String provinceName;

/**
* 市区编号
*/
private String cityCode;

/**
* 市区名称
*/
private String cityName;

/**
* 区县编号
*/
private String districtCode;

/**
* 区县名称
*/
private String districtName;

}

+ 19
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/third/oidc/DeletedOidcTenantRequest.java View File

@@ -0,0 +1,19 @@
package com.tuoheng.admin.request.third.oidc;

import lombok.Data;

/**
* oidc-删除租户第三方
*
* @Author xiaoying
* @Date 2023/1/9 10:08
*/
@Data
public class DeletedOidcTenantRequest {

/**
* 用户名
*/
private String username;

}

+ 69
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/third/oidc/EditOidcTenantRequest.java View File

@@ -0,0 +1,69 @@
package com.tuoheng.admin.request.third.oidc;

import lombok.Data;

/**
* oidc-修改租户第三方
*
* @Author xiaoying
* @Date 2023/1/9 10:08
*/
@Data
public class EditOidcTenantRequest {

/**
* 用户名
*/
private String username;

/**
* 租户名称
*/
private String tenantName;

/**
* 平台
*/
private String clientId;

/**
* 密码
*/
private String password;

/**
* 租户code
*/
private String tenantCode;

/**
* 省级编码
*/
private String provinceCode;

/**
* 省份名称
*/
private String provinceName;

/**
* 市区编号
*/
private String cityCode;

/**
* 市区名称
*/
private String cityName;

/**
* 区县编号
*/
private String districtCode;

/**
* 区县名称
*/
private String districtName;

}

+ 2
- 4
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/update/status/UpdateWaittStatusService.java View File

@@ -14,6 +14,7 @@ import com.tuoheng.admin.mapper.*;
import com.tuoheng.admin.service.third.dsp.IDspService;
import com.tuoheng.admin.utils.AirWeatherUtil;
import com.tuoheng.admin.vo.AirWeatherVO;
import com.tuoheng.common.core.config.common.CommonConfig;
import com.tuoheng.common.core.utils.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@@ -65,10 +66,7 @@ public class UpdateWaittStatusService {
dspService.stopAI(businessList.get(0).getMsgId(), inspection.getId());

//获取天气信息
//查询业务对应的租户信息
Tenant tenant = tenantMapper.selectById(inspection.getTenantId());

JsonResult result = this.getWeather(tenant.getAirportUrl(), inspection.getAirportId());
JsonResult result = this.getWeather(CommonConfig.airportURL, inspection.getAirportId());
if (0 != result.getCode()) {
log.info("修改任务状态业务接口:获取天气信息失败:{}", result.getMsg());
inspectionUpdate.setWeather("");

+ 4
- 10
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/airport/ExecuteTaskService.java View File

@@ -8,6 +8,7 @@ import com.tuoheng.admin.entity.Tenant;
import com.tuoheng.admin.enums.code.inspection.ExecuteInspectionCodeEnum;
import com.tuoheng.admin.mapper.InspectionMapper;
import com.tuoheng.admin.mapper.TenantMapper;
import com.tuoheng.common.core.config.common.CommonConfig;
import com.tuoheng.common.core.utils.DateUtils;
import com.tuoheng.common.core.utils.HttpUtils;
import com.tuoheng.common.core.utils.JsonResult;
@@ -34,24 +35,17 @@ public class ExecuteTaskService {
log.info("进入调用机场平台方法: 租户不存在");
return JsonResult.error(ExecuteInspectionCodeEnum.TENANT_IS_NOT_EXIST.getCode(), ExecuteInspectionCodeEnum.TENANT_IS_NOT_EXIST.getMsg());
}

if (StringUtils.isEmpty(tenant.getAirportUrl())) {
log.info("进入调用机场平台方法: 机场平台URL为空");
return JsonResult.error(ExecuteInspectionCodeEnum.AIRPORT_URL_IS_NULL.getCode(), ExecuteInspectionCodeEnum.AIRPORT_URL_IS_NULL.getMsg());
}

String url = tenant.getAirportUrl() + SystemConstant.API_AIRPORT_EXECUTE_TASK;
String url = CommonConfig.airportURL + SystemConstant.API_AIRPORT_EXECUTE_TASK;
JSONObject jsonObject = new JSONObject();
jsonObject.put("taskId", inspection.getInspectionLine());
jsonObject.put("requestId", inspection.getId());
jsonObject.put("code", "gs"); // 与机场平台约定好的
jsonObject.put("tenantCode", tenant.getCode());

log.info("进入调用机场平台方法: url:{}", url);
log.info("进入调用机场平台方法: jsonObject:{}", jsonObject);

String airPortStr = HttpUtils.doSend(url, jsonObject, null, "POST");
if (StringUtils.isEmpty(airPortStr)) {
log.info("进入调用机场平台方法: url:{}", url);
log.info("进入调用机场平台方法: jsonObject:{}", jsonObject);
log.info("立即执行任务业务:机场接口返回数据为空,飞行失败,任务id:{},任务名称:{},机场id:{},机场名称:{}, 路线id:{},路线名称:{}",
inspection.getId(), inspection.getName(), inspection.getAirportId(), inspection.getAirportName(), inspection.getInspectionLine(), inspection.getInspectionLineName());
return JsonResult.error(ExecuteInspectionCodeEnum.AIRPORT_RETURN_DATA_IS_NULL.getCode(), ExecuteInspectionCodeEnum.AIRPORT_RETURN_DATA_IS_NULL.getMsg());

+ 2
- 5
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/airport/GetAirLineListService.java View File

@@ -7,6 +7,7 @@ import com.tuoheng.admin.enums.code.AriportCodeEnum;
import com.tuoheng.admin.mapper.TenantMapper;
import com.tuoheng.admin.utils.CurrentUserUtil;
import com.tuoheng.admin.vo.AirLineVO;
import com.tuoheng.common.core.config.common.CommonConfig;
import com.tuoheng.common.core.utils.HttpUtils;
import com.tuoheng.common.core.utils.JacksonUtil;
import com.tuoheng.common.core.utils.JsonResult;
@@ -30,11 +31,7 @@ public class GetAirLineListService {
if (ObjectUtil.isEmpty(tenant)) {
return JsonResult.error(AriportCodeEnum.GET_NO_TENANT.getCode(), AriportCodeEnum.GET_NO_TENANT.getMsg());
}
if (StringUtils.isEmpty(tenant.getAirportUrl())) {
return JsonResult.error(AriportCodeEnum.GET_NO_TENANT.getCode(), AriportCodeEnum.GET_NO_TENANT.getMsg());
}

String url = tenant.getAirportUrl() + SystemConstant.API_AIRPORT_LINE_LIST;
String url = CommonConfig.airportURL + SystemConstant.API_AIRPORT_LINE_LIST;
String param = "page=1&limit=100&droneId=" + droneId;
String airPortStr = HttpUtils.sendGet(url, param);
JsonResult<AirLineVO> jsonResult = JacksonUtil.json2pojo(airPortStr, JsonResult.class);

+ 2
- 5
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/airport/GetAirportListService.java View File

@@ -6,6 +6,7 @@ import com.tuoheng.admin.entity.Tenant;
import com.tuoheng.admin.enums.code.AriportCodeEnum;
import com.tuoheng.admin.mapper.TenantMapper;
import com.tuoheng.admin.utils.CurrentUserUtil;
import com.tuoheng.common.core.config.common.CommonConfig;
import com.tuoheng.common.core.utils.HttpUtils;
import com.tuoheng.common.core.utils.JacksonUtil;
import com.tuoheng.common.core.utils.JsonResult;
@@ -28,11 +29,7 @@ public class GetAirportListService {
if (ObjectUtil.isEmpty(tenant)) {
return JsonResult.error(AriportCodeEnum.GET_NO_TENANT.getCode(), AriportCodeEnum.GET_NO_TENANT.getMsg());
}

if (StringUtils.isEmpty(tenant.getAirportUrl())) {
return JsonResult.error(AriportCodeEnum.GET_NO_TENANT.getCode(), AriportCodeEnum.GET_NO_TENANT.getMsg());
}
String url = tenant.getAirportUrl() + SystemConstant.API_AIRPORT_LIST;
String url = CommonConfig.airportURL + SystemConstant.API_AIRPORT_LIST;
String param = "page=1&limit=100&tenantCode=" + tenant.getCode();
String airPortStr = HttpUtils.sendGet(url, param);


+ 4
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/dsp/DspCallbackServiceImpl.java View File

@@ -212,7 +212,10 @@ public class DspCallbackServiceImpl implements IDspCallbackService {
String startFrame = frame.substring(0, frame.indexOf("-"));
//统一按照25帧计算
int second = Integer.parseInt(startFrame) / 25;
long shootTime = inspection.getExecutionStartTime().getTime() + second;

// 解决离线视频分析的问题都是一个坐标问题
// long shootTime = inspection.getExecutionStartTime().getTime() + second;
long shootTime = Long.parseLong(flightDataList.get(flightDataList.size() - 1).getTimestamp()) + second * 1000;
FlightData flightData_off = getFlightDataByTime(flightDataList, shootTime);
if (ObjectUtil.isNotNull(flightData_off)) {
inspectionFile.setLongitude(flightData_off.getLng());

+ 220
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/oidc/AddOidcTenantService.java View File

@@ -0,0 +1,220 @@
package com.tuoheng.admin.service.third.oidc;

import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.tuoheng.admin.constant.SystemConstant;
import com.tuoheng.admin.dto.ClientRoleDto;
import com.tuoheng.admin.entity.Role;
import com.tuoheng.admin.entity.Tenant;
import com.tuoheng.admin.entity.User;
import com.tuoheng.admin.enums.ClientEnum;
import com.tuoheng.admin.enums.MarkEnum;
import com.tuoheng.admin.enums.RoleEnum;
import com.tuoheng.admin.mapper.RoleMapper;
import com.tuoheng.admin.mapper.TenantMapper;
import com.tuoheng.admin.mapper.UserMapper;
import com.tuoheng.admin.request.third.oidc.CreateOidcTenantRequest;
import com.tuoheng.admin.request.user.UserInitRequest;
import com.tuoheng.common.core.utils.CommonUtils;
import com.tuoheng.common.core.utils.DateUtils;
import com.tuoheng.common.core.utils.JsonResult;
import com.tuoheng.common.core.utils.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.client.RestTemplate;

@Slf4j
@Service
public class AddOidcTenantService {

@Autowired
private TenantMapper tenantMapper;

@Autowired
private UserMapper userMapper;

@Autowired
private RoleMapper roleMapper;

@Autowired
private AddOidcUserService addOidcUserService;

@Transactional(rollbackFor = Exception.class)
public JsonResult createTenant(CreateOidcTenantRequest request) {
log.info("创建租户业务");
JsonResult result = this.check(request);
if (0 != result.getCode()) {
log.info("创建租户业务:校验失败:{}", result.getMsg());
return result;
}

Tenant tenant = this.buildTenant(request);
User user = this.buildUser(request);

// 添加oidc
result = addOidcUserService.add(user, request.getPassword(), tenant);
if (0 != result.getCode()) {
log.info("创建租户业务:添加oidc数据失败:{}", result.getMsg());
return result;
}

result = this.addTenant(tenant);
if (0 != result.getCode()) {
log.info("创建租户业务:添加租户失败:{}", result.getMsg());
return result;
}

user.setTenantId(tenant.getId());
result = this.addUser(user);
if (0 != result.getCode()) {
log.info("创建租户业务:添加用户失败:{}", result.getMsg());
return result;
}
return JsonResult.success();
}

/**
* 检查参数
*
* @param request
* @param
*
* @return
*/
private JsonResult check(CreateOidcTenantRequest request) {
if (StringUtils.isEmpty(request.getUsername())) {
return JsonResult.error(400, "用户名为空");
}
if (StringUtils.isEmpty(request.getTenantName())) {
return JsonResult.error(400, "租户名称为空");
}
if (StringUtils.isEmpty(request.getPassword())) {
return JsonResult.error(400, "密码为空");
}
if (StringUtils.isEmpty(request.getTenantCode())) {
return JsonResult.error(400, "租户编号");
}
Integer count = tenantMapper.selectCount(new LambdaQueryWrapper<Tenant>()
.eq(Tenant::getUsername, request.getUsername())
.eq(Tenant::getMark, MarkEnum.VALID.getCode()));
if (count > 0) {
return JsonResult.error("系统中已经存在该租户名");
}
count = userMapper.selectCount(new LambdaQueryWrapper<User>()
.eq(User::getUsername, request.getUsername())
.eq(User::getMark, MarkEnum.VALID.getCode()));
if (count > 0) {
return JsonResult.error(400, "系统中已经存在该用户名");
}
count = roleMapper.selectCount(new LambdaQueryWrapper<Role>()
.eq(Role::getId, RoleEnum.SUPER_ADMIN.getCode())
.eq(Role::getMark, MarkEnum.VALID.getCode()));
if (count <= 0) {
return JsonResult.error(400, "角色不存在");
}
return JsonResult.success();
}

private Tenant buildTenant(CreateOidcTenantRequest request) {
// 创建租户数据
Tenant tenant = new Tenant();
tenant.setCode(request.getTenantCode());
tenant.setUsername(request.getUsername());
tenant.setName(request.getTenantName());
tenant.setProvinceCode(request.getProvinceCode());
tenant.setProvinceName(request.getProvinceName());
tenant.setDistrictCode(request.getDistrictCode());
tenant.setDistrictName(request.getDistrictName());
tenant.setCityCode(request.getCityCode());
tenant.setCityName(request.getCityName());
return tenant;
}

/**
* 添加租户
*/
private JsonResult addTenant(Tenant tenant) {
Integer count = tenantMapper.insert(tenant);
if (count <= 0) {
log.info("创建租户失败");
JsonResult.error("创建租户失败");
}
return JsonResult.success(tenant);
}

/**
* 构建实体字段数据
*/
private User buildUser(CreateOidcTenantRequest request) {
// 创建用户数据
User user = new User();
user.setCode(request.getTenantCode());
user.setUsername(request.getUsername());
user.setRealname(request.getTenantName());
user.setNickname(request.getTenantName());
user.setPassword(CommonUtils.password(request.getPassword()));
user.setProvinceCode(request.getProvinceCode());
user.setCityCode(request.getCityCode());
user.setCityName(request.getCityName());
user.setDistrictCode(request.getDistrictCode());
user.setAvatar("imagedir/n1o1j9ndau_1670488066287.png");
user.setClientId(this.getClientId(request.getClientId()));
user.setRoleId(RoleEnum.SUPER_ADMIN.getCode());
user.setDeptId("");
user.setStatus(1);
user.setCreateTime(DateUtils.now());
return user;
}

private String getClientId(String clientId) {
String result = "";
if (StringUtils.isNotEmpty(clientId)) {
String[] clientValueArr = clientId.split(",");
for (String clientValue : clientValueArr) {
ClientEnum clientEnum = ClientEnum.parse(clientValue);
if (null != clientEnum) {
result += clientEnum.getCode() + ",";
}
}
}
if (StringUtils.isNotEmpty(result)) {
result = result.substring(0, result.length() - 1);
} else {
result = "1,2";
}
return result;
}

/**
* 添加用户
*/
private JsonResult addUser(User user) {
User userTmp = userMapper.selectOne(Wrappers.<User>lambdaQuery()
.eq(User::getMark, 1)
.eq(User::getStatus, 1)
.eq(User::getUsername, user.getUsername()));
if (ObjectUtil.isNotNull(userTmp)) {
log.info("创建租户用户,用户已存在,username:{}", user.getUsername());
return JsonResult.error("创建租户用户,用户已存在");
}

// 如果顶级部门存在,将该超级管理员与顶级部门关联
// Dept dept = deptMapper.selectOne(Wrappers.<Dept>lambdaQuery()
// .eq(Dept::getMark, 1)
// .eq(Dept::getTenantId, user.getTenantId())
// .eq(Dept::getPid, SystemConstant.ROOT_DEPT_PID));
// if (ObjectUtil.isNotNull(dept)) {
// user.setDeptId(dept.getId());
// }
Integer rowCount = userMapper.insert(user);
if (rowCount <= 0) {
log.info("创建租户用户失败,username:{}", user.getUsername());
return JsonResult.error("创建租户用户失败");
}
return JsonResult.success();
}
}

+ 12
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/oidc/AddOidcUserService.java View File

@@ -1,12 +1,15 @@
package com.tuoheng.admin.service.third.oidc;

import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tuoheng.admin.constant.OidcUrlConstant;
import com.tuoheng.admin.constant.SystemConstant;
import com.tuoheng.admin.dto.ClientRoleDto;
import com.tuoheng.admin.entity.Tenant;
import com.tuoheng.admin.entity.User;
import com.tuoheng.admin.enums.ClientEnum;
import com.tuoheng.admin.enums.MarkEnum;
import com.tuoheng.admin.mapper.TenantMapper;
import com.tuoheng.admin.request.oidc.OidcCreateUserRequest;
import com.tuoheng.common.core.config.common.CommonConfig;
import com.tuoheng.common.core.utils.JsonResult;
@@ -33,6 +36,9 @@ public class AddOidcUserService {
@Qualifier("restTemplate")
private RestTemplate restTemplate;

@Autowired
private TenantMapper tenantMapper;

public JsonResult add(User user, String password, Tenant tenant) {
OidcCreateUserRequest request = this.buildOidcCreateUserRequest(user, password, tenant);
//设置请求头
@@ -70,10 +76,15 @@ public class AddOidcUserService {
oidcCreateUserRequest.setPassword(password);
if (ObjectUtil.isNull(tenant)) {
// 普通用户新增
Tenant tenantTmp = tenantMapper.selectOne(new LambdaQueryWrapper<Tenant>()
.eq(Tenant::getId, user.getTenantId())
.eq(Tenant::getMark, MarkEnum.VALID.getCode()));
oidcCreateUserRequest.setTenantFlag(0);
oidcCreateUserRequest.setTenantName("");
oidcCreateUserRequest.setTenantName(tenantTmp.getUsername());
} else {
oidcCreateUserRequest.setTenantFlag(1);
oidcCreateUserRequest.setCode(tenant.getCode());
oidcCreateUserRequest.setName(tenant.getName());
oidcCreateUserRequest.setTenantName(tenant.getName());
}
List<ClientRoleDto> clientRoleDtoList = new ArrayList<>();

+ 83
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/oidc/DeletedOidcTenantService.java View File

@@ -0,0 +1,83 @@
package com.tuoheng.admin.service.third.oidc;

import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tuoheng.admin.entity.Tenant;
import com.tuoheng.admin.entity.User;
import com.tuoheng.admin.enums.MarkEnum;
import com.tuoheng.admin.mapper.RoleMapper;
import com.tuoheng.admin.mapper.TenantMapper;
import com.tuoheng.admin.mapper.UserMapper;
import com.tuoheng.admin.request.third.oidc.DeletedOidcTenantRequest;
import com.tuoheng.common.core.utils.JsonResult;
import com.tuoheng.common.core.utils.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Slf4j
@Service
public class DeletedOidcTenantService {

@Autowired
private TenantMapper tenantMapper;

@Autowired
private UserMapper userMapper;

@Transactional(rollbackFor = Exception.class)
public JsonResult deletedTenant(DeletedOidcTenantRequest request) {
log.info("删除租户业务");
JsonResult result = this.check(request);
if (0 != result.getCode()) {
log.info("删除租户业务:校验失败:{}", result.getMsg());
return result;
}
Tenant tenant = tenantMapper.selectOne(new LambdaQueryWrapper<Tenant>()
.eq(Tenant::getUsername, request.getUsername())
.eq(Tenant::getMark, MarkEnum.VALID.getCode()));
if (ObjectUtil.isNull(tenant)) {
return JsonResult.error("系统中不存在该租户");
}
Tenant tenantTmp = new Tenant();
tenantTmp.setId(tenant.getId());
tenantTmp.setMark(MarkEnum.NOTVALID.getCode());
Integer count = tenantMapper.updateById(tenantTmp);
if (count <= 0) {
log.info("删除租户失败,username:{}", request.getUsername());
JsonResult.error("删除租户失败");
}

User user = userMapper.selectOne(new LambdaQueryWrapper<User>()
.eq(User::getUsername, request.getUsername())
.eq(User::getMark, MarkEnum.VALID.getCode()));
if (ObjectUtil.isNull(user)) {
return JsonResult.error(400, "系统中不存在该用户");
}
User userTmp = new User();
userTmp.setId(user.getId());
userTmp.setMark(MarkEnum.NOTVALID.getCode());
Integer rowCount = userMapper.updateById(userTmp);
if (rowCount <= 0) {
log.info("删除租户用户失败,username:{}", request.getUsername());
return JsonResult.error("删除租户用户失败");
}
return JsonResult.success();
}

/**
* 检查参数
*
* @param request
* @param
* @return
*/
private JsonResult check(DeletedOidcTenantRequest request) {
if (StringUtils.isEmpty(request.getUsername())) {
return JsonResult.error(400, "用户名为空");
}
return JsonResult.success();
}

}

+ 218
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/oidc/EditOidcTenantService.java View File

@@ -0,0 +1,218 @@
package com.tuoheng.admin.service.third.oidc;

import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.tuoheng.admin.entity.Tenant;
import com.tuoheng.admin.entity.User;
import com.tuoheng.admin.enums.ClientEnum;
import com.tuoheng.admin.enums.MarkEnum;
import com.tuoheng.admin.mapper.RoleMapper;
import com.tuoheng.admin.mapper.TenantMapper;
import com.tuoheng.admin.mapper.UserMapper;
import com.tuoheng.admin.request.third.oidc.EditOidcTenantRequest;
import com.tuoheng.common.core.utils.CommonUtils;
import com.tuoheng.common.core.utils.DateUtils;
import com.tuoheng.common.core.utils.JsonResult;
import com.tuoheng.common.core.utils.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Slf4j
@Service
public class EditOidcTenantService {

@Autowired
private TenantMapper tenantMapper;

@Autowired
private UserMapper userMapper;

@Autowired
private RoleMapper roleMapper;

@Autowired
private EditOidcUserService editOidcUserService;

@Autowired
private EditOidcUserPasswordService editOidcUserPasswordService;

@Transactional(rollbackFor = Exception.class)
public JsonResult editTenant(EditOidcTenantRequest request) {
log.info("修改租户业务");
JsonResult result = this.check(request);
if (0 != result.getCode()) {
log.info("修改租户业务:校验失败:{}", result.getMsg());
return result;
}
Tenant tenant = (Tenant) result.getData();

User oldUser = userMapper.selectOne(new LambdaQueryWrapper<User>()
.eq(User::getUsername, request.getUsername())
.eq(User::getMark, MarkEnum.VALID.getCode()));
User user = this.buildUser(request);

if (StringUtils.isNotEmpty(request.getClientId()) && !oldUser.getClientId().equals(user.getClientId())) {
// 修改oidc用户
result = editOidcUserService.edit(user);
if (0 != result.getCode()) {
log.info("修改租户业务:修改oidc用户信息失败:{}", result.getMsg());
return result;
}
} else {
log.info("修改租户业务:用户信息不需要修改");
}

if (StringUtils.isNotEmpty(request.getPassword()) && !oldUser.getPassword().equals(user.getPassword())) {
// 修改oidc用户密码由oidc自己处理
// oidc密码不需要业务系统去修改
// log.info("修改租户业务:oidc密码不需要业务系统去修改");
// result = editOidcUserPasswordService.editUserPassword(user, request.getPassword());
// if (0 != result.getCode()) {
// log.info("修改租户业务:修改oidc用户密码失败:{}", result.getMsg());
// return result;
// }
} else {
log.info("修改租户业务:用户密码不需要修改");
}

result = this.updateTenant(tenant, request);
if (0 != result.getCode()) {
log.info("修改租户业务:修改租户失败:{}", result.getMsg());
return result;
}

result = this.editUser(user);
if (0 != result.getCode()) {
log.info("修改租户业务:修改用户失败:{}", result.getMsg());
return result;
}

return JsonResult.success();
}

/**
* 检查参数
*
* @param request
* @param
* @return
*/
private JsonResult check(EditOidcTenantRequest request) {
if (StringUtils.isEmpty(request.getUsername())) {
return JsonResult.error(400, "用户名为空");
}
if (StringUtils.isEmpty(request.getTenantName())) {
return JsonResult.error(400, "租户名称为空");
}
if (StringUtils.isEmpty(request.getTenantCode())) {
return JsonResult.error(400, "租户编号");
}
Tenant tenant = tenantMapper.selectOne(new LambdaQueryWrapper<Tenant>()
.eq(Tenant::getUsername, request.getUsername())
.eq(Tenant::getMark, MarkEnum.VALID.getCode()));
if (ObjectUtil.isNull(tenant)) {
return JsonResult.error("系统中不存在该租户");
}
Integer count = userMapper.selectCount(new LambdaQueryWrapper<User>()
.eq(User::getUsername, request.getUsername())
.eq(User::getMark, MarkEnum.VALID.getCode()));
if (count <= 0) {
return JsonResult.error(400, "系统中不存在该用户");
}
return JsonResult.success(tenant);
}

/**
* 修改租户
*/
private JsonResult updateTenant(Tenant tenant, EditOidcTenantRequest request) {
// 如果是租户先去创建
tenant.setName(request.getTenantName());
tenant.setProvinceCode(request.getProvinceCode());
tenant.setProvinceName(request.getProvinceName());
tenant.setDistrictCode(request.getDistrictCode());
tenant.setDistrictName(request.getDistrictName());
tenant.setCityCode(request.getCityCode());
tenant.setCityName(request.getCityName());
Integer count = tenantMapper.updateById(tenant);
if (count <= 0) {
log.info("修改租户失败");
JsonResult.error("修改租户失败");
}
return JsonResult.success(tenant);
}

/**
* 构建用户数据
*/
private User buildUser(EditOidcTenantRequest request) {
// 创建用户数据
User user = new User();
user.setUsername(request.getUsername());
user.setRealname(request.getTenantName());
user.setNickname(request.getTenantName());
if (StringUtils.isNotEmpty(request.getPassword())) {
user.setPassword(CommonUtils.password(request.getPassword()));
}
if (StringUtils.isNotEmpty(request.getProvinceCode())) {
user.setProvinceCode(request.getProvinceCode());
}
if (StringUtils.isNotEmpty(request.getCityCode())) {
user.setCityCode(request.getCityCode());
}
if (StringUtils.isNotEmpty(request.getCityName())) {
user.setCityName(request.getCityName());
}
if (StringUtils.isNotEmpty(request.getDistrictCode())) {
user.setDistrictCode(request.getDistrictCode());
}
if (StringUtils.isNotEmpty(request.getClientId())) {
user.setClientId(this.getClientId(request.getClientId()));
}
user.setUpdateTime(DateUtils.now());
return user;
}

private String getClientId(String clientId) {
String result = "";
if (StringUtils.isNotEmpty(clientId)) {
String[] clientValueArr = clientId.split(",");
for (String clientValue : clientValueArr) {
ClientEnum clientEnum = ClientEnum.parse(clientValue);
if (null != clientEnum) {
result += clientEnum.getCode() + ",";
}
}
}
if (StringUtils.isNotEmpty(result)) {
result = result.substring(0, result.length() - 1);
} else {
result = "1,2";
}
return result;
}

/**
* 修改用户
*/
private JsonResult editUser(User user) {
User userTmp = userMapper.selectOne(Wrappers.<User>lambdaQuery()
.eq(User::getMark, MarkEnum.VALID.getCode())
.eq(User::getStatus, 1)
.eq(User::getUsername, user.getUsername()));
if (ObjectUtil.isNull(userTmp)) {
log.info("修改租户用户,用户不存在,username:{}", user.getUsername());
return JsonResult.error("修改租户用户,不用户存在");
}
user.setId(userTmp.getId());
Integer rowCount = userMapper.updateById(user);
if (rowCount <= 0) {
log.info("修改租户用户失败,username:{}", user.getUsername());
return JsonResult.error("修改租户用户失败");
}
return JsonResult.success();
}
}

+ 2
- 2
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/oidc/EditOidcUserPasswordService.java View File

@@ -25,11 +25,11 @@ public class EditOidcUserPasswordService {
@Qualifier("restTemplate")
private RestTemplate restTemplate;

public JsonResult editUserPassword(User user) {
public JsonResult editUserPassword(User user, String password) {
OidcUpdateUserPasswordRequest oidcUpdateUserPasswordRequest = new OidcUpdateUserPasswordRequest();
oidcUpdateUserPasswordRequest.setUsername(user.getUsername());
// 重置密码
oidcUpdateUserPasswordRequest.setPassword(SystemConstant.INIT_PASSWORD);
oidcUpdateUserPasswordRequest.setPassword(password);

//设置请求头
org.springframework.http.HttpHeaders resultRequestHeader = new HttpHeaders();

+ 9
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/oidc/OidcService.java View File

@@ -2,6 +2,9 @@ package com.tuoheng.admin.service.third.oidc;

import com.tuoheng.admin.entity.Tenant;
import com.tuoheng.admin.entity.User;
import com.tuoheng.admin.request.third.oidc.CreateOidcTenantRequest;
import com.tuoheng.admin.request.third.oidc.DeletedOidcTenantRequest;
import com.tuoheng.admin.request.third.oidc.EditOidcTenantRequest;
import com.tuoheng.common.core.utils.JsonResult;

public interface OidcService {
@@ -10,6 +13,11 @@ public interface OidcService {

JsonResult editUser(User user);

JsonResult editUserPassword(User user);
JsonResult editUserPassword(User user, String password);

JsonResult createTenant(CreateOidcTenantRequest request);

JsonResult editTenant(EditOidcTenantRequest request);

JsonResult deletedTenant(DeletedOidcTenantRequest request);
}

+ 29
- 2
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/oidc/OidcServiceImpl.java View File

@@ -2,6 +2,9 @@ package com.tuoheng.admin.service.third.oidc;

import com.tuoheng.admin.entity.Tenant;
import com.tuoheng.admin.entity.User;
import com.tuoheng.admin.request.third.oidc.CreateOidcTenantRequest;
import com.tuoheng.admin.request.third.oidc.DeletedOidcTenantRequest;
import com.tuoheng.admin.request.third.oidc.EditOidcTenantRequest;
import com.tuoheng.common.core.utils.JsonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@@ -20,6 +23,15 @@ public class OidcServiceImpl implements OidcService {
@Autowired
private EditOidcUserPasswordService editOidcUserPasswordService;

@Autowired
private AddOidcTenantService addOidcTenantService;

@Autowired
private EditOidcTenantService editOidcTenantService;

@Autowired
private DeletedOidcTenantService deletedOidcTenantService;

public JsonResult addUser(User user, String password, Tenant tenant) {
return addOidcUserService.add(user, password, tenant);
}
@@ -28,7 +40,22 @@ public class OidcServiceImpl implements OidcService {
return editOidcUserService.edit(user);
}

public JsonResult editUserPassword(User user) {
return editOidcUserPasswordService.editUserPassword(user);
public JsonResult editUserPassword(User user, String password) {
return editOidcUserPasswordService.editUserPassword(user, password);
}

@Override
public JsonResult createTenant(CreateOidcTenantRequest request) {
return addOidcTenantService.createTenant(request);
}

@Override
public JsonResult editTenant(EditOidcTenantRequest request) {
return editOidcTenantService.editTenant(request);
}

@Override
public JsonResult deletedTenant(DeletedOidcTenantRequest request) {
return deletedOidcTenantService.deletedTenant(request);
}
}

+ 0
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/user/init/SystemUserInitService.java View File

@@ -150,7 +150,6 @@ public class SystemUserInitService {
tenant.setName(request.getName());
tenant.setUsername(request.getName());
tenant.setCode(request.getTenantCode());
tenant.setAirportUrl(request.getAirportUrl());
tenant.setCreateTime(DateUtils.now());
Tenant tenantTmp = tenantMapper.selectOne(Wrappers.<Tenant>lambdaQuery()
.eq(Tenant::getMark, 1)

+ 1
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/user/update/UpdateUserPasswordService.java View File

@@ -47,7 +47,7 @@ public class UpdateUserPasswordService {
User user = (User) result.getData();

// 修改oidc用户密码
result = oidcService.editUserPassword(user);
result = oidcService.editUserPassword(user, SystemConstant.INIT_PASSWORD);
if (0 != result.getCode()) {
log.info("重置密码业务接口:修改oidc用户密码失败:{}", result.getMsg());
return result;

+ 2
- 0
tuoheng-service/tuoheng-admin/src/main/resources/application-dev.yml View File

@@ -143,6 +143,8 @@ tuoheng:
dsp-callback-url: https://192.168.11.11:9177/dsp/callback/{requestId}
#飞手平台地址
pilot-url: http://192.168.11.11:7011/pilot/web/
#airport配置地址
airport-url: http://192.168.11.22:9060
# 文件配置
uploads:
#上传的服务器上的映射文件夹

+ 2
- 0
tuoheng-service/tuoheng-admin/src/main/resources/application-local.yml View File

@@ -149,6 +149,8 @@ tuoheng:
dsp-callback-url: https://127.0.0.1:9117/dsp/callback/{requestId}
#飞手平台地址
pilot-url: http://192.168.11.241:7011/pilot/web/
#airport配置地址
airport-url: http://192.168.11.22:9060
# 文件配置
uploads:
#上传的服务器上的映射文件夹

+ 2
- 0
tuoheng-service/tuoheng-admin/src/main/resources/application-prod.yml View File

@@ -144,6 +144,8 @@ tuoheng:
dsp-callback-url: https://freeway.t-aaron.com/freeway/admin/dsp/callback/{requestId}
#飞手平台地址
pilot-url: https://pilot.t-aaron.com/pilot/web/
#airport配置地址
airport-url: https://airport.t-aaron.com
# 文件配置
uploads:
#上传的服务器上的映射文件夹

+ 2
- 0
tuoheng-service/tuoheng-admin/src/main/resources/application-test.yml View File

@@ -144,6 +144,8 @@ tuoheng:
dsp-callback-url: https://freeway-test.t-aaron.com/freeway/admin/dsp/callback/{requestId}
#飞手平台地址
pilot-url: http://172.15.1.11:7011/pilot/web/
#airport配置地址
airport-url: https://airport-test.t-aaron.com
# 文件配置
uploads:
#上传的服务器上的映射文件夹

+ 40
- 41
tuoheng-service/tuoheng-admin/src/main/resources/mapper/TenantMapper.xml View File

@@ -1,42 +1,41 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.tuoheng.admin.mapper.TenantMapper">
<resultMap type="com.tuoheng.admin.entity.Tenant" id="TenantResult">
<result property="id" column="id" />
<result property="name" column="name" />
<result property="code" column="code" />
<result property="username" column="username" />
<result property="logo" column="logo" />
<result property="portraitUrl" column="portrait_url" />
<result property="pid" column="pid" />
<result property="type" column="type" />
<result property="phone" column="phone" />
<result property="email" column="email" />
<result property="provinceCode" column="province_code" />
<result property="provinceName" column="province_name" />
<result property="cityCode" column="city_code" />
<result property="cityName" column="city_name" />
<result property="districtCode" column="district_code" />
<result property="districtName" column="district_name" />
<result property="platformName" column="platform_name" />
<result property="airportUrl" column="airport_url" />
<result property="address" column="address" />
<result property="intro" column="intro" />
<result property="status" column="status" />
<result property="note" column="note" />
<result property="sort" column="sort" />
<result property="createUser" column="create_user" />
<result property="createTime" column="create_time" />
<result property="updateUser" column="update_user" />
<result property="updateTime" column="update_time" />
<result property="mark" column="mark" />
</resultMap>
<sql id="selectThTenantVo">
select id, name, code, username, logo, portrait_url, pid, type, phone, email, province_code, province_name, city_code, city_name, district_code, district_name, platform_name, airport_url, address, intro, status, note, sort, create_user, create_time, update_user, update_time, mark from th_tenant
</sql>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.tuoheng.admin.mapper.TenantMapper">
<resultMap type="com.tuoheng.admin.entity.Tenant" id="TenantResult">
<result property="id" column="id" />
<result property="name" column="name" />
<result property="code" column="code" />
<result property="username" column="username" />
<result property="logo" column="logo" />
<result property="portraitUrl" column="portrait_url" />
<result property="pid" column="pid" />
<result property="type" column="type" />
<result property="phone" column="phone" />
<result property="email" column="email" />
<result property="provinceCode" column="province_code" />
<result property="provinceName" column="province_name" />
<result property="cityCode" column="city_code" />
<result property="cityName" column="city_name" />
<result property="districtCode" column="district_code" />
<result property="districtName" column="district_name" />
<result property="platformName" column="platform_name" />
<result property="address" column="address" />
<result property="intro" column="intro" />
<result property="status" column="status" />
<result property="note" column="note" />
<result property="sort" column="sort" />
<result property="createUser" column="create_user" />
<result property="createTime" column="create_time" />
<result property="updateUser" column="update_user" />
<result property="updateTime" column="update_time" />
<result property="mark" column="mark" />
</resultMap>

<sql id="selectThTenantVo">
select id, name, code, username, logo, portrait_url, pid, type, phone, email, province_code, province_name, city_code, city_name, district_code, district_name, platform_name, address, intro, status, note, sort, create_user, create_time, update_user, update_time, mark from th_tenant
</sql>

</mapper>

+ 0
- 5
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/entity/Tenant.java View File

@@ -99,11 +99,6 @@ public class Tenant extends BaseEntity implements Serializable {
*/
private String platformName;

/**
* 机场平台url
*/
private String airportUrl;

/**
* 详细地址
*/

+ 3
- 11
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/impl/AirportServiceImpl.java View File

@@ -1,6 +1,7 @@
package com.tuoheng.miniprogram.service.impl;

import cn.hutool.core.util.ObjectUtil;
import com.tuoheng.common.core.config.common.CommonConfig;
import com.tuoheng.common.core.utils.HttpUtils;
import com.tuoheng.common.core.utils.JacksonUtil;
import com.tuoheng.common.core.utils.JsonResult;
@@ -33,12 +34,7 @@ public class AirportServiceImpl implements AirportService {
if (ObjectUtil.isEmpty(tenant)) {
return JsonResult.error(AriportCodeEnum.GET_NO_TENANT.getCode(), AriportCodeEnum.GET_NO_TENANT.getMsg());
}

if (StringUtils.isEmpty(tenant.getAirportUrl())) {
return JsonResult.error(AriportCodeEnum.GET_NO_TENANT.getCode(), AriportCodeEnum.GET_NO_TENANT.getMsg());
}

String url = tenant.getAirportUrl() + API_AIRPORT_LIST;
String url = CommonConfig.airportURL + API_AIRPORT_LIST;
String param = "page=1&limit=100&tenantCode=" + tenant.getCode();
String airPortStr = HttpUtils.sendGet(url, param);

@@ -57,11 +53,7 @@ public class AirportServiceImpl implements AirportService {
if (ObjectUtil.isEmpty(tenant)) {
return JsonResult.error(AriportCodeEnum.GET_NO_TENANT.getCode(), AriportCodeEnum.GET_NO_TENANT.getMsg());
}
if (StringUtils.isEmpty(tenant.getAirportUrl())) {
return JsonResult.error(AriportCodeEnum.GET_NO_TENANT.getCode(), AriportCodeEnum.GET_NO_TENANT.getMsg());
}

String url = tenant.getAirportUrl() + API_AIRPORT_LINE_LIST;
String url = CommonConfig.airportURL + API_AIRPORT_LINE_LIST;
String param = "page=1&limit=100&droneId=" + droneId;
String airPortStr = HttpUtils.sendGet(url, param);
JsonResult<AirLineVO> jsonResult = JacksonUtil.json2pojo(airPortStr, JsonResult.class);

+ 2
- 0
tuoheng-service/tuoheng-miniprogram/src/main/resources/application-dev.yml View File

@@ -79,6 +79,8 @@ tuoheng:
gaodeKey: c01a978a4a24759282f6e3a9b9a0974d
#飞手平台地址
pilot-url: http://192.168.11.11:7011/pilot/web/
#airport配置地址
airport-url: http://192.168.11.22:9060
# 文件配置
uploads:
#上传的服务器上的映射文件夹

+ 2
- 0
tuoheng-service/tuoheng-miniprogram/src/main/resources/application-local.yml View File

@@ -79,6 +79,8 @@ tuoheng:
gaodeKey: c01a978a4a24759282f6e3a9b9a0974d
#飞手平台地址
pilot-url: http://192.168.11.11:7011/pilot/web/
#airport配置地址
airport-url: http://192.168.11.22:9060
# 文件配置
uploads:
#上传的服务器上的映射文件夹

+ 2
- 0
tuoheng-service/tuoheng-miniprogram/src/main/resources/application-prod.yml View File

@@ -79,6 +79,8 @@ tuoheng:
gaodeKey: c01a978a4a24759282f6e3a9b9a0974d
#飞手平台地址
pilot-url: http://192.168.11.11:7011/pilot/web/
#airport配置地址
airport-url: https://airport.t-aaron.com
# 文件配置
uploads:
#上传的服务器上的映射文件夹

+ 2
- 0
tuoheng-service/tuoheng-miniprogram/src/main/resources/application-test.yml View File

@@ -79,6 +79,8 @@ tuoheng:
gaodeKey: c01a978a4a24759282f6e3a9b9a0974d
#飞手平台地址
pilot-url: http://192.168.11.11:7011/pilot/web/
#airport配置地址
airport-url: https://airport-test.t-aaron.com
# 文件配置
uploads:
#上传的服务器上的映射文件夹

Loading…
Cancel
Save