|
|
@@ -0,0 +1,197 @@
|
|
|
+package com.dderp.webcore.rest;
|
|
|
+
|
|
|
+import com.dderp.business.service.PlatformServiceImpl;
|
|
|
+import com.dderp.common.api.PlatformService;
|
|
|
+import com.dderp.common.base.BaseService;
|
|
|
+import com.dderp.common.datas.ERPHeader;
|
|
|
+import com.dderp.common.datas.HttpCode;
|
|
|
+import com.dderp.common.entity.doc.BusinessScript;
|
|
|
+import com.dderp.common.entity.platform.PlatformInfo;
|
|
|
+import com.dderp.common.entity.platform.PlatformRequire;
|
|
|
+import com.dderp.common.entity.site.ERPTokenUser;
|
|
|
+import com.dySweetFishPlugin.sql.RMapUtils;
|
|
|
+import com.sweetfish.net.http.*;
|
|
|
+import com.sweetfish.service.Local;
|
|
|
+import com.sweetfish.service.RetResult;
|
|
|
+import com.sweetfish.source.PageFlipper;
|
|
|
+import com.sweetfish.util.AutoLoad;
|
|
|
+import org.rex.RMap;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+import java.util.List;
|
|
|
+import java.util.concurrent.CompletableFuture;
|
|
|
+
|
|
|
+
|
|
|
+@AutoLoad(false)
|
|
|
+@Local
|
|
|
+@RestService(name = "platform", moduleid = 0, comment = "平台档案模块")
|
|
|
+public class PlatformRest extends BaseService {
|
|
|
+ @Resource
|
|
|
+ private PlatformService platformService;
|
|
|
+
|
|
|
+ //region 平台档案
|
|
|
+ @RestMapping(name = "queryPlatformList", auth = true, sort = 1, comment = "获取平台档案列表", methods = {"GET", "POST"})
|
|
|
+ @WebApiBean(result = true, type = PlatformInfo.class)
|
|
|
+ public CompletableFuture<RMap> queryPlatformList(
|
|
|
+ @RestParam(name = "params", comment = "搜索内容", required = false) RMap searchData,
|
|
|
+ @RestParam(name = "page", comment = "分页信息", required = false) PageFlipper pageFlipper,
|
|
|
+ @RestHeader(name = ERPHeader.HTTPHEADER_DATASOURCE) String dataSourceId,
|
|
|
+ @RestHeader(name = ERPHeader.HTTPHEADER_SUPPLIER) String supplierCode) {
|
|
|
+ return CompletableFuture.supplyAsync(
|
|
|
+ () -> {
|
|
|
+ List<PlatformInfo> platformInfoList = platformService.queryPlatformList(searchData, pageFlipper, Long.parseLong(supplierCode));
|
|
|
+ return RMapUtils.successV2(platformInfoList, null, pageFlipper);
|
|
|
+ }, getExecutor()
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ @RestMapping(name = "getPlatformInfo", auth = true, sort = 2, comment = "获取平台档案", methods = {"GET", "POST"})
|
|
|
+ @WebApiBean(result = true, type = PlatformInfo.class)
|
|
|
+ public CompletableFuture<RMap> getPlatformInfo(
|
|
|
+ @RestParam(name = "idPlatform", comment = "平台档案id") long idPlatform,
|
|
|
+ @RestHeader(name = ERPHeader.HTTPHEADER_DATASOURCE) String dataSourceId,
|
|
|
+ @RestHeader(name = ERPHeader.HTTPHEADER_SUPPLIER) String supplierCode) {
|
|
|
+ return CompletableFuture.supplyAsync(
|
|
|
+ () -> {
|
|
|
+ PlatformInfo platformInfo = platformService.getPlatformInfo(idPlatform, Long.parseLong(supplierCode));
|
|
|
+ if (platformInfo == null) return RMapUtils.error(HttpCode.BAD_REQUEST.value(), "平台档案不存在");
|
|
|
+ return RMapUtils.successV2(platformInfo, null, null);
|
|
|
+ }, getExecutor()
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ @RestMapping(name = "addPlatformInfo", auth = true, sort = 3, comment = "新增平台档案", methods = {"POST"})
|
|
|
+ @WebApiBean(result = true, type = PlatformInfo.class)
|
|
|
+ public CompletableFuture<RMap> addPlatformInfo(
|
|
|
+ @RestParam(name = "platformInfo", comment = "平台档案") PlatformInfo platformInfo,
|
|
|
+ @RestParam(name = "&", comment = "当前用户,不需要传入") ERPTokenUser currentUser,
|
|
|
+ @RestHeader(name = ERPHeader.HTTPHEADER_DATASOURCE) String dataSourceId,
|
|
|
+ @RestHeader(name = ERPHeader.HTTPHEADER_SUPPLIER) String supplierCode) {
|
|
|
+ return CompletableFuture.supplyAsync(
|
|
|
+ () -> {
|
|
|
+ RetResult<PlatformInfo> result = platformService.addPlatformInfo(platformInfo, currentUser, dataSourceId, Long.parseLong(supplierCode));
|
|
|
+ if (!result.isSuccess()) return RMapUtils.error(HttpCode.BAD_REQUEST.value(), result.getRetinfo());
|
|
|
+ return RMapUtils.successV2(result.getResult(), null, null);
|
|
|
+ }, getExecutor()
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @RestMapping(name = "updatePlatformInfo", auth = true, sort = 4, comment = "修改平台档案", methods = {"POST"})
|
|
|
+ @WebApiBean(result = true, type = PlatformInfo.class)
|
|
|
+ public CompletableFuture<RMap> updatePlatformInfo(
|
|
|
+ @RestParam(name = "platformInfo", comment = "平台档案") PlatformInfo platformInfo,
|
|
|
+ @RestParam(name = "&", comment = "当前用户,不需要传入") ERPTokenUser currentUser,
|
|
|
+ @RestHeader(name = ERPHeader.HTTPHEADER_DATASOURCE) String dataSourceId,
|
|
|
+ @RestHeader(name = ERPHeader.HTTPHEADER_SUPPLIER) String supplierCode) {
|
|
|
+ return CompletableFuture.supplyAsync(
|
|
|
+ () -> {
|
|
|
+ RetResult<PlatformInfo> result = platformService.updatePlatformInfo(platformInfo, currentUser, dataSourceId, Long.parseLong(supplierCode));
|
|
|
+ if (!result.isSuccess()) return RMapUtils.error(HttpCode.BAD_REQUEST.value(), result.getRetinfo());
|
|
|
+ return RMapUtils.successV2(result.getResult(), null, null);
|
|
|
+ }, getExecutor()
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ @RestMapping(name = "voidPlatformInfo", auth = true, sort = 5, comment = "禁用平台档案", methods = {"POST"})
|
|
|
+ @WebApiBean(result = true, type = PlatformInfo.class)
|
|
|
+ public CompletableFuture<RMap> voidPlatformInfo(
|
|
|
+ @RestParam(name = "platformInfo", comment = "平台档案") PlatformInfo platformInfo,
|
|
|
+ @RestParam(name = "&", comment = "当前用户,不需要传入") ERPTokenUser currentUser,
|
|
|
+ @RestHeader(name = ERPHeader.HTTPHEADER_DATASOURCE) String dataSourceId,
|
|
|
+ @RestHeader(name = ERPHeader.HTTPHEADER_SUPPLIER) String supplierCode) {
|
|
|
+ return CompletableFuture.supplyAsync(
|
|
|
+ () -> {
|
|
|
+ RetResult<PlatformInfo> result = platformService.voidPlatformInfo(platformInfo, currentUser, dataSourceId, Long.parseLong(supplierCode));
|
|
|
+ if (!result.isSuccess()) return RMapUtils.error(HttpCode.BAD_REQUEST.value(), result.getRetinfo());
|
|
|
+ return RMapUtils.successV2(result.getResult(), null, null);
|
|
|
+ }, getExecutor()
|
|
|
+ );
|
|
|
+ }
|
|
|
+ //endregion
|
|
|
+
|
|
|
+
|
|
|
+ //region 平台需求档案
|
|
|
+ @RestMapping(name = "queryPlatformRequireList", auth = true, sort = 10, comment = "获取平台需求条件档案列表", methods = {"GET", "POST"})
|
|
|
+ @WebApiBean(result = true, type = PlatformRequire.class)
|
|
|
+ public CompletableFuture<RMap> queryPlatformRequireList(
|
|
|
+ @RestParam(name = "params", comment = "搜索内容", required = false) RMap searchData,
|
|
|
+ @RestParam(name = "page", comment = "分页信息", required = false) PageFlipper pageFlipper,
|
|
|
+ @RestHeader(name = ERPHeader.HTTPHEADER_DATASOURCE) String dataSourceId,
|
|
|
+ @RestHeader(name = ERPHeader.HTTPHEADER_SUPPLIER) String supplierCode) {
|
|
|
+ return CompletableFuture.supplyAsync(
|
|
|
+ () -> {
|
|
|
+ List<PlatformRequire> platformRequireList = platformService.queryPlatformRequireList(searchData, pageFlipper, Long.parseLong(supplierCode));
|
|
|
+ return RMapUtils.successV2(platformRequireList, null, pageFlipper);
|
|
|
+ }, getExecutor()
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ @RestMapping(name = "getPlatformRequire", auth = true, sort = 11, comment = "获取平台需求条件档案", methods = {"GET", "POST"})
|
|
|
+ @WebApiBean(result = true, type = PlatformRequire.class)
|
|
|
+ public CompletableFuture<RMap> getPlatformRequire(
|
|
|
+ @RestParam(name = "idRequire", comment = "平台档案id") long idRequire,
|
|
|
+ @RestHeader(name = ERPHeader.HTTPHEADER_DATASOURCE) String dataSourceId,
|
|
|
+ @RestHeader(name = ERPHeader.HTTPHEADER_SUPPLIER) String supplierCode) {
|
|
|
+ return CompletableFuture.supplyAsync(
|
|
|
+ () -> {
|
|
|
+ PlatformRequire platformRequire = platformService.getPlatformRequire(idRequire, Long.parseLong(supplierCode));
|
|
|
+ if (platformRequire == null)
|
|
|
+ return RMapUtils.error(HttpCode.BAD_REQUEST.value(), "平台需求条件档案不存在");
|
|
|
+ return RMapUtils.successV2(platformRequire, null, null);
|
|
|
+ }, getExecutor()
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ @RestMapping(name = "addPlatformRequire", auth = true, sort = 12, comment = "新增平台需求条件档案", methods = {"POST"})
|
|
|
+ @WebApiBean(result = true, type = PlatformRequire.class)
|
|
|
+ public CompletableFuture<RMap> addPlatformRequire(
|
|
|
+ @RestParam(name = "platformRequire", comment = "平台需求条件档案") PlatformRequire platformRequire,
|
|
|
+ @RestParam(name = "&", comment = "当前用户,不需要传入") ERPTokenUser currentUser,
|
|
|
+ @RestHeader(name = ERPHeader.HTTPHEADER_DATASOURCE) String dataSourceId,
|
|
|
+ @RestHeader(name = ERPHeader.HTTPHEADER_SUPPLIER) String supplierCode) {
|
|
|
+ return CompletableFuture.supplyAsync(
|
|
|
+ () -> {
|
|
|
+ RetResult<PlatformRequire> result = platformService.addPlatformRequire(platformRequire, currentUser, dataSourceId, Long.parseLong(supplierCode));
|
|
|
+ if (!result.isSuccess()) return RMapUtils.error(HttpCode.BAD_REQUEST.value(), result.getRetinfo());
|
|
|
+ return RMapUtils.successV2(result.getResult(), null, null);
|
|
|
+ }, getExecutor()
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @RestMapping(name = "updatePlatformRequire", auth = true, sort = 13, comment = "修改平台需求条件档案", methods = {"POST"})
|
|
|
+ @WebApiBean(result = true, type = PlatformRequire.class)
|
|
|
+ public CompletableFuture<RMap> updatePlatformRequire(
|
|
|
+ @RestParam(name = "platformRequire", comment = "平台需求条件档案") PlatformRequire platformRequire,
|
|
|
+ @RestParam(name = "&", comment = "当前用户,不需要传入") ERPTokenUser currentUser,
|
|
|
+ @RestHeader(name = ERPHeader.HTTPHEADER_DATASOURCE) String dataSourceId,
|
|
|
+ @RestHeader(name = ERPHeader.HTTPHEADER_SUPPLIER) String supplierCode) {
|
|
|
+ return CompletableFuture.supplyAsync(
|
|
|
+ () -> {
|
|
|
+ RetResult<PlatformRequire> result = platformService.updatePlatformRequire(platformRequire, currentUser, dataSourceId, Long.parseLong(supplierCode));
|
|
|
+ if (!result.isSuccess()) return RMapUtils.error(HttpCode.BAD_REQUEST.value(), result.getRetinfo());
|
|
|
+ return RMapUtils.successV2(result.getResult(), null, null);
|
|
|
+ }, getExecutor()
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ @RestMapping(name = "voidPlatformRequire", auth = true, sort = 14, comment = "禁用平台需求条件档案", methods = {"POST"})
|
|
|
+ @WebApiBean(result = true, type = PlatformRequire.class)
|
|
|
+ public CompletableFuture<RMap> voidPlatformRequire(
|
|
|
+ @RestParam(name = "platformRequire", comment = "平台档案") PlatformRequire platformRequire,
|
|
|
+ @RestParam(name = "&", comment = "当前用户,不需要传入") ERPTokenUser currentUser,
|
|
|
+ @RestHeader(name = ERPHeader.HTTPHEADER_DATASOURCE) String dataSourceId,
|
|
|
+ @RestHeader(name = ERPHeader.HTTPHEADER_SUPPLIER) String supplierCode) {
|
|
|
+ return CompletableFuture.supplyAsync(
|
|
|
+ () -> {
|
|
|
+ RetResult<PlatformRequire> result = platformService.voidPlatformRequire(platformRequire, currentUser, dataSourceId, Long.parseLong(supplierCode));
|
|
|
+ if (!result.isSuccess()) return RMapUtils.error(HttpCode.BAD_REQUEST.value(), result.getRetinfo());
|
|
|
+ return RMapUtils.successV2(result.getResult(), null, null);
|
|
|
+ }, getExecutor()
|
|
|
+ );
|
|
|
+ }
|
|
|
+ //endregion
|
|
|
+
|
|
|
+
|
|
|
+}
|