|
|
@@ -0,0 +1,254 @@
|
|
|
+package com.dderp.webcore.rest;
|
|
|
+
|
|
|
+import com.dderp.common.api.PlatformService;
|
|
|
+import com.dderp.common.api.StoreService;
|
|
|
+import com.dderp.common.base.BaseService;
|
|
|
+import com.dderp.common.datas.ERPHeader;
|
|
|
+import com.dderp.common.datas.ERPModule;
|
|
|
+import com.dderp.common.datas.HttpCode;
|
|
|
+import com.dderp.common.entity.platform.PlatformInfo;
|
|
|
+import com.dderp.common.entity.platform.PlatformRequire;
|
|
|
+import com.dderp.common.entity.site.ERPTokenUser;
|
|
|
+import com.dderp.common.entity.store.*;
|
|
|
+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;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @Author: xl Created on 2024-02-28
|
|
|
+ * @Content: 门店
|
|
|
+ */
|
|
|
+
|
|
|
+@AutoLoad(false)
|
|
|
+@Local
|
|
|
+@RestService(name = "store", moduleid = 0, comment = "门店档案模块")
|
|
|
+public class StoreRest extends BaseService {
|
|
|
+ @Resource
|
|
|
+ private StoreService storeService;
|
|
|
+
|
|
|
+ //region 门店品牌档案
|
|
|
+ @RestMapping(name = "queryStoreBrandList", auth = true, sort = 1, comment = "获取门店品牌档案列表", methods = {"GET", "POST"})
|
|
|
+ @WebApiBean(result = true, type = StoreBrand.class)
|
|
|
+ public CompletableFuture<RMap> queryStoreBrandList(
|
|
|
+ @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<StoreBrand> resultList = storeService.queryStoreBrandList(searchData, pageFlipper, Long.parseLong(supplierCode));
|
|
|
+ return RMapUtils.successV2(resultList, null, pageFlipper);
|
|
|
+ }, getExecutor()
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ @RestMapping(name = "getStoreBrand", auth = true, sort = 2, comment = "门店品牌档案", methods = {"GET", "POST"})
|
|
|
+ @WebApiBean(result = true, type = PlatformInfo.class)
|
|
|
+ public CompletableFuture<RMap> getStoreBrand(
|
|
|
+ @RestParam(name = "idStoreBrand", comment = "门店品牌档案id") long idStoreBrand,
|
|
|
+ @RestHeader(name = ERPHeader.HTTPHEADER_DATASOURCE) String dataSourceId,
|
|
|
+ @RestHeader(name = ERPHeader.HTTPHEADER_SUPPLIER) String supplierCode) {
|
|
|
+ return CompletableFuture.supplyAsync(
|
|
|
+ () -> {
|
|
|
+ StoreBrand resultObj = storeService.getStoreBrand(idStoreBrand, Long.parseLong(supplierCode));
|
|
|
+ if (resultObj == null) return RMapUtils.error(HttpCode.BAD_REQUEST.value(), "门店品牌档案不存在");
|
|
|
+ return RMapUtils.successV2(resultObj, null, null);
|
|
|
+ }, getExecutor()
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ @RestMapping(name = "addStoreBrand", auth = true, sort = 3, comment = "新增门店品牌", methods = {"POST"})
|
|
|
+ @WebApiBean(result = true, type = StoreBrand.class)
|
|
|
+ public CompletableFuture<RMap> addStoreBrand(
|
|
|
+ @RestParam(name = "storeBrand", comment = "门店品牌档案") StoreBrand storeBrand,
|
|
|
+ @RestParam(name = "&", comment = "当前用户,不需要传入") ERPTokenUser currentUser,
|
|
|
+ @RestHeader(name = ERPHeader.HTTPHEADER_DATASOURCE) String dataSourceId,
|
|
|
+ @RestHeader(name = ERPHeader.HTTPHEADER_SUPPLIER) String supplierCode) {
|
|
|
+ return CompletableFuture.supplyAsync(
|
|
|
+ () -> {
|
|
|
+ RetResult<StoreBrand> result = storeService.addStoreBrand(storeBrand, 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 = "updateStoreBrand", auth = true, sort = 4, comment = "修改门店品牌", methods = {"POST"})
|
|
|
+ @WebApiBean(result = true, type = StoreBrand.class)
|
|
|
+ public CompletableFuture<RMap> updateStoreBrand(
|
|
|
+ @RestParam(name = "storeBrand", comment = "门店品牌档案") StoreBrand storeBrand,
|
|
|
+ @RestParam(name = "&", comment = "当前用户,不需要传入") ERPTokenUser currentUser,
|
|
|
+ @RestHeader(name = ERPHeader.HTTPHEADER_DATASOURCE) String dataSourceId,
|
|
|
+ @RestHeader(name = ERPHeader.HTTPHEADER_SUPPLIER) String supplierCode) {
|
|
|
+ return CompletableFuture.supplyAsync(
|
|
|
+ () -> {
|
|
|
+ RetResult<StoreBrand> result = storeService.updateStoreBrand(storeBrand, 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 = "voidStoreBrand", auth = true, sort = 5, comment = "禁用门店品牌档案", methods = {"POST"})
|
|
|
+ @WebApiBean(result = true, type = StoreBrand.class)
|
|
|
+ public CompletableFuture<RMap> voidStoreBrand(
|
|
|
+ @RestParam(name = "storeBrand", comment = "门店品牌档案") StoreBrand storeBrand,
|
|
|
+ @RestParam(name = "&", comment = "当前用户,不需要传入") ERPTokenUser currentUser,
|
|
|
+ @RestHeader(name = ERPHeader.HTTPHEADER_DATASOURCE) String dataSourceId,
|
|
|
+ @RestHeader(name = ERPHeader.HTTPHEADER_SUPPLIER) String supplierCode) {
|
|
|
+ return CompletableFuture.supplyAsync(
|
|
|
+ () -> {
|
|
|
+ RetResult<StoreBrand> result = storeService.voidStoreBrand(storeBrand, 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 = "queryViewStoreInfo", auth = true, sort = 11, comment = "获取门店档案列表", methods = {"GET", "POST"})
|
|
|
+ @WebApiBean(result = true, type = ViewStoreInfo.class)
|
|
|
+ public CompletableFuture<RMap> queryViewStoreInfo(
|
|
|
+ @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<ViewStoreInfo> platformRequireList = storeService.queryViewStoreInfo(searchData, pageFlipper, Long.parseLong(supplierCode));
|
|
|
+ return RMapUtils.successV2(platformRequireList, null, pageFlipper);
|
|
|
+ }, getExecutor()
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ @RestMapping(name = "getViewStoreInfo", auth = true, sort = 12, comment = "获取门店档案", methods = {"GET", "POST"})
|
|
|
+ @WebApiBean(result = true, type = ViewStoreInfo.class)
|
|
|
+ public CompletableFuture<RMap> getViewStoreInfo(
|
|
|
+ @RestParam(name = "idStore", comment = "平台档案id") long idStore,
|
|
|
+ @RestHeader(name = ERPHeader.HTTPHEADER_DATASOURCE) String dataSourceId,
|
|
|
+ @RestHeader(name = ERPHeader.HTTPHEADER_SUPPLIER) String supplierCode) {
|
|
|
+ return CompletableFuture.supplyAsync(
|
|
|
+ () -> {
|
|
|
+ ViewStoreInfo resultObj = storeService.getViewStoreInfo(idStore, Long.parseLong(supplierCode), true, true, true);
|
|
|
+ if (resultObj == null)
|
|
|
+ return RMapUtils.error(HttpCode.BAD_REQUEST.value(), "门店档案不存在");
|
|
|
+ return RMapUtils.successV2(resultObj, null, null);
|
|
|
+ }, getExecutor()
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ @RestMapping(name = "addStoreInfo", auth = true, sort = 13, comment = "新增门店档案", methods = {"POST"})
|
|
|
+ @WebApiBean(result = true, type = StoreInfo.class)
|
|
|
+ public CompletableFuture<RMap> addStoreInfo(
|
|
|
+ @RestParam(name = "storeInfo", comment = "平台需求条件档案") StoreInfo storeInfo,
|
|
|
+ @RestParam(name = "&", comment = "当前用户,不需要传入") ERPTokenUser currentUser,
|
|
|
+ @RestHeader(name = ERPHeader.HTTPHEADER_DATASOURCE) String dataSourceId,
|
|
|
+ @RestHeader(name = ERPHeader.HTTPHEADER_SUPPLIER) String supplierCode) {
|
|
|
+ return CompletableFuture.supplyAsync(
|
|
|
+ () -> {
|
|
|
+ RetResult<StoreInfo> resultRet = storeService.addStoreInfo(storeInfo, currentUser, dataSourceId, Long.parseLong(supplierCode));
|
|
|
+ if (!resultRet.isSuccess())
|
|
|
+ return RMapUtils.error(HttpCode.BAD_REQUEST.value(), resultRet.getRetinfo());
|
|
|
+ return RMapUtils.successV2(resultRet.getResult(), null, null);
|
|
|
+ }, getExecutor()
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ @RestMapping(name = "configStoreInvoiceInfo", auth = true, sort = 14, comment = "开启与关闭门店开票", methods = {"POST"})
|
|
|
+ @WebApiBean(result = true, type = StoreInvoiceInfo.class)
|
|
|
+ public CompletableFuture<RMap> configStoreInvoiceInfo(
|
|
|
+ @RestParam(name = "storeInvoiceInfo", comment = "门店开票信息") StoreInvoiceInfo storeInvoiceInfo,
|
|
|
+ @RestParam(name = "enableInvoice", comment = "1开启0关闭") int enableInvoice,
|
|
|
+ @RestParam(name = "&", comment = "当前用户,不需要传入") ERPTokenUser currentUser,
|
|
|
+ @RestHeader(name = ERPHeader.HTTPHEADER_DATASOURCE) String dataSourceId,
|
|
|
+ @RestHeader(name = ERPHeader.HTTPHEADER_SUPPLIER) String supplierCode) {
|
|
|
+ return CompletableFuture.supplyAsync(
|
|
|
+ () -> {
|
|
|
+ RetResult<StoreInvoiceInfo> result = storeService.configStoreInvoiceInfo(storeInvoiceInfo, enableInvoice, 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 = "updateStoreInfo", auth = true, sort = 15, comment = "修改门店档案", methods = {"POST"})
|
|
|
+ @WebApiBean(result = true, type = StoreInfo.class)
|
|
|
+ public CompletableFuture<RMap> updateStoreInfo(
|
|
|
+ @RestParam(name = "storeInfo", comment = "门店档案") StoreInfo storeInfo,
|
|
|
+ @RestParam(name = "&", comment = "当前用户,不需要传入") ERPTokenUser currentUser,
|
|
|
+ @RestHeader(name = ERPHeader.HTTPHEADER_DATASOURCE) String dataSourceId,
|
|
|
+ @RestHeader(name = ERPHeader.HTTPHEADER_SUPPLIER) String supplierCode) {
|
|
|
+ return CompletableFuture.supplyAsync(
|
|
|
+ () -> {
|
|
|
+ RetResult<StoreInfo> result = storeService.updateStoreInfo(storeInfo, 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 = "voidStoreInfo", auth = true, sort = 16, comment = "禁用门店档案", methods = {"POST"})
|
|
|
+ @WebApiBean(result = true, type = StoreInfo.class)
|
|
|
+ public CompletableFuture<RMap> voidStoreInfo(
|
|
|
+ @RestParam(name = "storeInfo", comment = "门店档案") StoreInfo storeInfo,
|
|
|
+ @RestParam(name = "&", comment = "当前用户,不需要传入") ERPTokenUser currentUser,
|
|
|
+ @RestHeader(name = ERPHeader.HTTPHEADER_DATASOURCE) String dataSourceId,
|
|
|
+ @RestHeader(name = ERPHeader.HTTPHEADER_SUPPLIER) String supplierCode) {
|
|
|
+ return CompletableFuture.supplyAsync(
|
|
|
+ () -> {
|
|
|
+ RetResult<StoreInfo> result = storeService.voidStoreInfo(storeInfo, 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 = "addStorePlatform", auth = true, sort = 21, comment = "门店开通平台", methods = {"POST"})
|
|
|
+ @WebApiBean(result = true, type = StorePlatform.class)
|
|
|
+ public CompletableFuture<RMap> addStorePlatform(
|
|
|
+ @RestParam(name = "storePlatform", comment = "门店平台信息") StorePlatform storePlatform,
|
|
|
+ @RestParam(name = "&", comment = "当前用户,不需要传入") ERPTokenUser currentUser,
|
|
|
+ @RestHeader(name = ERPHeader.HTTPHEADER_DATASOURCE) String dataSourceId,
|
|
|
+ @RestHeader(name = ERPHeader.HTTPHEADER_SUPPLIER) String supplierCode) {
|
|
|
+ return CompletableFuture.supplyAsync(
|
|
|
+ () -> {
|
|
|
+ RetResult<StorePlatform> result = storeService.addStorePlatform(storePlatform, 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 = "configStorePlatform", auth = true, sort = 22, comment = "修改门店平台", methods = {"POST"})
|
|
|
+ @WebApiBean(result = true, type = StorePlatform.class)
|
|
|
+ public CompletableFuture<RMap> configStorePlatform(
|
|
|
+ @RestParam(name = "storePlatform", comment = "门店平台信息") StorePlatform storePlatform,
|
|
|
+ @RestParam(name = "&", comment = "当前用户,不需要传入") ERPTokenUser currentUser,
|
|
|
+ @RestHeader(name = ERPHeader.HTTPHEADER_DATASOURCE) String dataSourceId,
|
|
|
+ @RestHeader(name = ERPHeader.HTTPHEADER_SUPPLIER) String supplierCode) {
|
|
|
+ return CompletableFuture.supplyAsync(
|
|
|
+ () -> {
|
|
|
+ RetResult<StorePlatform> result = storeService.configStorePlatform(storePlatform, 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
|
|
|
+
|
|
|
+
|
|
|
+}
|
|
|
+
|