mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
数据结构修改
This commit is contained in:
@@ -42,6 +42,10 @@
|
||||
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package com.cf.imes.module.system.api.application;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cf.imes.module.system.enums.ApiConstants;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
@FeignClient(name = ApiConstants.NAME) // TODO 晨丰:fallbackFactory =
|
||||
@Tag(name = "RPC 服务 - 应用管理")
|
||||
public interface ApplicationApi {
|
||||
|
||||
String PREFIX = ApiConstants.PREFIX + "/application";
|
||||
|
||||
@GetMapping(PREFIX + "/login")
|
||||
@Operation(summary = "应用登陆")
|
||||
@Parameter(name = "organId", description = "组织信息", required = true)
|
||||
JSONObject getApplicationByOrganId(@RequestParam("organId") Long organId);
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
package com.cf.imes.module.system.api.application;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cf.imes.module.system.dal.dataobject.application.ApplicationDO;
|
||||
import com.cf.imes.module.system.service.application.ApplicationService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.APPLICATION_NOT_EXISTS;
|
||||
|
||||
@RestController // 提供 RESTful API 接口,给 Feign 调用
|
||||
@Validated
|
||||
public class ApplicationApiImpl implements ApplicationApi{
|
||||
|
||||
@Resource
|
||||
private ApplicationService applicationService;
|
||||
|
||||
@Override
|
||||
public JSONObject getApplicationByOrganId(Long organId) {
|
||||
// 获取数值
|
||||
ApplicationDO applicationDO = applicationService.getApplicationByOrganId(organId);
|
||||
if (applicationDO == null){
|
||||
throw exception(APPLICATION_NOT_EXISTS);
|
||||
}
|
||||
// 数据转json
|
||||
JSONObject jsonObject = (JSONObject) JSONObject.toJSON(applicationDO);
|
||||
System.out.println(" jsonObject " + jsonObject);
|
||||
return jsonObject;
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -16,9 +16,9 @@ public class ApplicationSaveReqVO{
|
||||
@NotNull(message = "应用标识不能为空")
|
||||
private String appId;
|
||||
|
||||
// @Schema(description = "应用密钥", example = "121gfrsg5sb4gs")
|
||||
// @NotNull(message = "应用密钥不能为空")
|
||||
// private String appKey;
|
||||
@Schema(description = "应用密钥", example = "121gfrsg5sb4gs")
|
||||
@NotNull(message = "应用密钥不能为空")
|
||||
private String appKey;
|
||||
|
||||
// private String appSecret;
|
||||
|
||||
|
||||
+4
-1
@@ -62,5 +62,8 @@ public class ApplicationDO extends BaseDO {
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 组织id
|
||||
*/
|
||||
private Long organId;
|
||||
}
|
||||
|
||||
+4
-1
@@ -22,7 +22,6 @@ public interface ApplicationMapper extends BaseMapperX<ApplicationDO> {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<ApplicationDO>()
|
||||
.likeIfPresent(ApplicationDO::getName, reqVO.getName())
|
||||
.eqIfPresent(ApplicationDO::getAppId, reqVO.getAppId())
|
||||
.eqIfPresent(ApplicationDO::getAppKey, reqVO.getAppKey())
|
||||
.eqIfPresent(ApplicationDO::getCode, reqVO.getCode())
|
||||
.eqIfPresent(ApplicationDO::getServerIp, reqVO.getServerIp())
|
||||
.eqIfPresent(ApplicationDO::getCompany, reqVO.getCompany())
|
||||
@@ -35,4 +34,8 @@ public interface ApplicationMapper extends BaseMapperX<ApplicationDO> {
|
||||
default ApplicationDO selectByAppId(String appId) {
|
||||
return selectOne(ApplicationDO::getAppId, appId);
|
||||
}
|
||||
|
||||
default ApplicationDO selectByOrganId(Long organId) {
|
||||
return selectOne(ApplicationDO::getOrganId, organId);
|
||||
}
|
||||
}
|
||||
|
||||
+7
-6
@@ -50,12 +50,6 @@ public interface ApplicationService {
|
||||
*/
|
||||
PageResult<ApplicationDO> getApplicationPage(ApplicationPageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 获得所有应用信息表 application
|
||||
*
|
||||
* @return 工序信息表 application
|
||||
*/
|
||||
List<ApplicationDO> getAllApplication();
|
||||
|
||||
/**
|
||||
* 应用登陆
|
||||
@@ -63,4 +57,11 @@ public interface ApplicationService {
|
||||
* @return 登录结果
|
||||
*/
|
||||
ApplicationLoginRespVO loginApplication(@Valid ApplicationRespVO reqVO);
|
||||
|
||||
/**
|
||||
* 应用信息
|
||||
* @param organId: 组织信息
|
||||
* @return 登录结果
|
||||
*/
|
||||
ApplicationDO getApplicationByOrganId(Long organId);
|
||||
}
|
||||
|
||||
+5
-5
@@ -98,11 +98,6 @@ public class ApplicationServiceImpl implements ApplicationService{
|
||||
return applicationMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ApplicationDO> getAllApplication() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApplicationLoginRespVO loginApplication(ApplicationRespVO reqVO) {
|
||||
ApplicationDO app = applicationMapper.selectByAppId(reqVO.getAppId());
|
||||
@@ -118,6 +113,11 @@ public class ApplicationServiceImpl implements ApplicationService{
|
||||
return BeanUtils.toBean(createTokenAfterLoginSuccess(app.getId(), app.getAppId(), LoginLogTypeEnum.LOGIN_USERNAME), ApplicationLoginRespVO.class).setAppId(app.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApplicationDO getApplicationByOrganId(Long organId) {
|
||||
return applicationMapper.selectByOrganId(organId);
|
||||
}
|
||||
|
||||
private AuthLoginRespVO createTokenAfterLoginSuccess(Integer userId, String username, LoginLogTypeEnum logType) {
|
||||
// Long organId = OrganContextHolder.getOrganId();
|
||||
// OrganizationDO organ = organService.getOrgan(organId);
|
||||
|
||||
Reference in New Issue
Block a user