Browse Source

fixed 更新最新表结构,优化商户相服务关接口

fushengqian 1 month ago
parent
commit
1347608656

+ 12 - 10
db/fuint-db.sql

@@ -164,12 +164,12 @@ CREATE TABLE `mt_cart` (
   `HANG_NO` varchar(10) DEFAULT '' COMMENT '挂单号',
   `SKU_ID` int DEFAULT '0' COMMENT 'skuID',
   `GOODS_ID` int DEFAULT '0' COMMENT '商品ID',
-  `NUM` int DEFAULT '1' COMMENT '数量',
+  `NUM` double(10,2) DEFAULT '1.00' COMMENT '数量',
   `CREATE_TIME` datetime DEFAULT NULL COMMENT '创建时间',
   `UPDATE_TIME` datetime DEFAULT NULL COMMENT '更新时间',
   `STATUS` char(1) DEFAULT 'A' COMMENT '状态',
   PRIMARY KEY (`ID`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='购物车';
+) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8 COMMENT='购物车';
 
 /*Table structure for table `mt_commission_cash` */
 
@@ -478,11 +478,12 @@ CREATE TABLE `mt_goods` (
   `IMAGES` varchar(1000) DEFAULT '' COMMENT '图片地址',
   `PRICE` decimal(10,2) unsigned DEFAULT '0.00' COMMENT '价格',
   `LINE_PRICE` decimal(10,2) unsigned DEFAULT '0.00' COMMENT '划线价格',
-  `STOCK` int unsigned DEFAULT '0' COMMENT '库存',
+  `COST_PRICE` decimal(10,2) DEFAULT '0.00' COMMENT '成本价格',
+  `STOCK` double(10,2) unsigned DEFAULT '0.00' COMMENT '库存',
   `WEIGHT` decimal(10,2) DEFAULT '0.00' COMMENT '重量',
   `COUPON_IDS` varchar(500) DEFAULT '' COMMENT '关联卡券ID',
   `SERVICE_TIME` int DEFAULT '0' COMMENT '服务时长,单位:分钟',
-  `INIT_SALE` int DEFAULT '0' COMMENT '初始销量',
+  `INIT_SALE` double(10,2) DEFAULT '0.00' COMMENT '初始销量',
   `SALE_POINT` varchar(100) DEFAULT '' COMMENT '商品卖点',
   `CAN_USE_POINT` char(1) DEFAULT 'N' COMMENT '可否使用积分抵扣',
   `IS_MEMBER_DISCOUNT` char(1) DEFAULT 'Y' COMMENT '会员是否有折扣',
@@ -493,7 +494,7 @@ CREATE TABLE `mt_goods` (
   `OPERATOR` varchar(30) DEFAULT NULL COMMENT '最后操作人',
   `STATUS` char(1) DEFAULT 'A' COMMENT 'A:正常;D:删除',
   PRIMARY KEY (`ID`)
-) ENGINE=InnoDB AUTO_INCREMENT=388 DEFAULT CHARSET=utf8 COMMENT='商品表';
+) ENGINE=InnoDB AUTO_INCREMENT=386 DEFAULT CHARSET=utf8 COMMENT='商品表';
 
 /*Table structure for table `mt_goods_cate` */
 
@@ -524,9 +525,10 @@ CREATE TABLE `mt_goods_sku` (
   `LOGO` varchar(255) DEFAULT '' COMMENT '图片',
   `GOODS_ID` int NOT NULL DEFAULT '0' COMMENT '商品ID',
   `SPEC_IDS` varchar(100) NOT NULL DEFAULT '' COMMENT '规格ID',
-  `STOCK` int NOT NULL DEFAULT '0' COMMENT '库存',
+  `STOCK` double(10,2) NOT NULL DEFAULT '0.00' COMMENT '库存',
   `PRICE` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '价格',
   `LINE_PRICE` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '划线价格',
+  `COST_PRICE` decimal(10,2) DEFAULT '0.00' COMMENT '成本价格',
   `WEIGHT` decimal(10,2) DEFAULT '0.00' COMMENT '重量',
   `STATUS` char(1) NOT NULL DEFAULT 'A' COMMENT '状态',
   PRIMARY KEY (`ID`)
@@ -660,8 +662,8 @@ CREATE TABLE `mt_order` (
   `CONFIRM_STATUS` char(1) DEFAULT 'N' COMMENT '核销状态',
   `CONFIRM_TIME` datetime DEFAULT NULL COMMENT '核销时间',
   `CONFIRM_REMARK` varchar(500) DEFAULT NULL COMMENT '核销备注',
-  `COMMISSION_USER_ID` int DEFAULT '0' COMMENT '分佣用户ID',
   `COMMISSION_STATUS` char(1) DEFAULT 'A' COMMENT '分佣提成计算状态',
+  `COMMISSION_USER_ID` int DEFAULT '0' COMMENT '分佣提成用户ID',
   `OPERATOR` varchar(30) DEFAULT '' COMMENT '最后操作人',
   PRIMARY KEY (`ID`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='订单表';
@@ -696,7 +698,7 @@ CREATE TABLE `mt_order_goods` (
   `SKU_ID` int DEFAULT '0' COMMENT 'skuID',
   `PRICE` decimal(10,2) DEFAULT '0.00' COMMENT '价格',
   `DISCOUNT` decimal(10,2) DEFAULT '0.00' COMMENT '优惠价',
-  `NUM` int NOT NULL DEFAULT '0' COMMENT '商品数量',
+  `NUM` double(10,2) NOT NULL DEFAULT '0.00' COMMENT '商品数量',
   `CREATE_TIME` datetime DEFAULT NULL COMMENT '创建时间',
   `UPDATE_TIME` datetime DEFAULT NULL COMMENT '更新时间',
   `STATUS` char(1) DEFAULT 'A' COMMENT 'A:正常;D:删除',
@@ -1028,7 +1030,7 @@ DROP TABLE IF EXISTS `mt_user`;
 
 CREATE TABLE `mt_user` (
   `ID` int NOT NULL AUTO_INCREMENT COMMENT '会员ID',
-  `MOBILE` varchar(20) DEFAULT '' COMMENT '手机号码',
+  `MOBILE` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT '' COMMENT '手机号码',
   `GROUP_ID` int DEFAULT '0' COMMENT '分组ID',
   `USER_NO` varchar(30) DEFAULT '' COMMENT '会员号',
   `AVATAR` varchar(255) DEFAULT '' COMMENT '头像',
@@ -1058,7 +1060,7 @@ CREATE TABLE `mt_user` (
   `OPERATOR` varchar(30) DEFAULT '' COMMENT '最后操作人',
   PRIMARY KEY (`ID`),
   KEY `index_phone` (`MOBILE`)
-) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COMMENT='会员个人信息';
+) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COMMENT='会员个人信息';
 
 /*Table structure for table `mt_user_action` */
 

+ 10 - 0
fuint-application/src/main/java/com/fuint/common/service/MerchantService.java

@@ -86,4 +86,14 @@ public interface MerchantService extends IService<MtMerchant> {
      * */
     List<MtMerchant> queryMerchantByParams(Map<String, Object> params) throws BusinessCheckException;
 
+    /**
+     * 查询我的商户列表
+     *
+     * @param merchantId 商户ID
+     * @param storeId 店铺ID
+     * @param status 状态
+     * @return
+     * */
+    List<MtMerchant> getMyMerchantList(Integer merchantId, Integer storeId, String status) throws BusinessCheckException;
+
 }

+ 23 - 0
fuint-application/src/main/java/com/fuint/common/service/impl/MerchantServiceImpl.java

@@ -278,4 +278,27 @@ public class MerchantServiceImpl extends ServiceImpl<MtMerchantMapper, MtMerchan
         lambdaQueryWrapper.orderByAsc(MtMerchant::getStatus).orderByDesc(MtMerchant::getId);
         return mtMerchantMapper.selectList(lambdaQueryWrapper);
     }
+
+    /**
+     * 查询我的商户列表
+     *
+     * @param merchantId 商户ID
+     * @param storeId 店铺ID
+     * @param status 状态
+     * @return
+     * */
+    @Override
+    public List<MtMerchant> getMyMerchantList(Integer merchantId, Integer storeId, String status) {
+        Map<String, Object> param = new HashMap<>();
+        if (merchantId != null && merchantId > 0) {
+            param.put("merchantId", merchantId);
+        }
+        if (storeId != null && storeId > 0) {
+            param.put("storeId", storeId);
+        }
+        if (StringUtils.isNotBlank(status)) {
+            param.put("status", status);
+        }
+        return queryMerchantByParams(param);
+    }
 }

+ 6 - 23
fuint-application/src/main/java/com/fuint/module/backendApi/controller/BackendAccountController.java

@@ -24,6 +24,7 @@ import com.fuint.utils.StringUtil;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
+import org.springframework.beans.BeanUtils;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 import javax.servlet.http.HttpServletRequest;
@@ -131,7 +132,7 @@ public class BackendAccountController extends BaseController {
      *
      * @param  request
      * @param  userId 账号ID
-     * @return 账户详情
+     * @return
      */
     @ApiOperation(value = "获取账户详情")
     @RequestMapping(value = "/info/{userId}", method = RequestMethod.GET)
@@ -157,15 +158,7 @@ public class BackendAccountController extends BaseController {
         List<MtStore> stores = storeService.getMyStoreList(accountInfo.getMerchantId(),accountInfo.getStoreId(), StatusEnum.ENABLED.getKey());
         result.put("stores", stores);
 
-        Map<String, Object> params = new HashMap<>();
-        params.put("status", StatusEnum.ENABLED.getKey());
-        if (accountInfo.getStoreId() != null && accountInfo.getStoreId() > 0) {
-            params.put("storeId", accountInfo.getStoreId());
-        }
-        if (accountInfo.getMerchantId() != null && accountInfo.getMerchantId() > 0) {
-            params.put("merchantId", accountInfo.getMerchantId());
-        }
-        List<MtMerchant> merchants = merchantService.queryMerchantByParams(params);
+        List<MtMerchant> merchants = merchantService.getMyMerchantList(accountInfo.getMerchantId(), accountInfo.getStoreId(), StatusEnum.ENABLED.getKey());
         result.put("merchants", merchants);
 
         AccountDto accountDto = null;
@@ -173,24 +166,14 @@ public class BackendAccountController extends BaseController {
             TAccount tAccount = tAccountService.getAccountInfoById(userId.intValue());
             accountDto = new AccountDto();
             accountDto.setId(tAccount.getAcctId());
-            accountDto.setAccountKey(tAccount.getAccountKey());
-            accountDto.setAccountName(tAccount.getAccountName());
-            accountDto.setAccountStatus(tAccount.getAccountStatus());
-            accountDto.setCreateDate(tAccount.getCreateDate());
-            accountDto.setRealName(tAccount.getRealName());
-            accountDto.setModifyDate(tAccount.getModifyDate());
-            accountDto.setStaffId(tAccount.getStaffId());
-            accountDto.setMerchantId(tAccount.getMerchantId());
-            if (tAccount.getStoreId() > 0) {
-                accountDto.setStoreId(tAccount.getStoreId());
-            }
-            if (tAccount.getStoreId() > 0) {
+            BeanUtils.copyProperties(tAccount, accountDto);
+            if (tAccount.getStoreId() != null && tAccount.getStoreId() > 0) {
                 MtStore mtStore = storeService.queryStoreById(tAccount.getStoreId());
                 if (mtStore != null) {
                     accountDto.setStoreName(mtStore.getName());
                 }
             }
-            if (tAccount != null) {
+            if (tAccount.getAcctId() != null) {
                 List<Long> roleIds = tAccountService.getRoleIdsByAccountId(tAccount.getAcctId());
                 result.put("roleIds", roleIds);
             }

+ 3 - 11
fuint-application/src/main/java/com/fuint/module/backendApi/controller/BackendMerchantController.java

@@ -89,14 +89,12 @@ public class BackendMerchantController extends BaseController {
         paginationRequest.setSearchParams(params);
         PaginationResponse<MtMerchant> paginationResponse = merchantService.queryMerchantListByPagination(paginationRequest);
 
-        String imagePath = settingService.getUploadBasePath();
-
         // 商户类型列表
         List<ParamDto> typeList = MerchantTypeEnum.getMerchantTypeList();
 
         Map<String, Object> result = new HashMap<>();
         result.put("dataList", paginationResponse);
-        result.put("imagePath", imagePath);
+        result.put("imagePath", settingService.getUploadBasePath());
         result.put("typeList", typeList);
 
         return getSuccessResult(result);
@@ -119,7 +117,6 @@ public class BackendMerchantController extends BaseController {
         if (StringUtil.isNotEmpty(name)) {
             params.put("name", name);
         }
-
         params.put("status", StatusEnum.ENABLED.getKey());
         List<MtMerchant> merchantList = merchantService.queryMerchantByParams(params);
         Map<String, Object> result = new HashMap<>();
@@ -147,10 +144,7 @@ public class BackendMerchantController extends BaseController {
         if (accountInfo.getMerchantId() != null && accountInfo.getMerchantId() > 0) {
             merchantId = accountInfo.getMerchantId();
         }
-
-        String operator = accountInfo.getAccountName();
-        merchantService.updateStatus(merchantId, operator, status);
-
+        merchantService.updateStatus(merchantId, accountInfo.getAccountName(), status);
         return getSuccessResult(true);
     }
 
@@ -218,9 +212,7 @@ public class BackendMerchantController extends BaseController {
             merchantInfo.setId(merchantId);
         }
 
-        String operator = accountInfo.getAccountName();
-        merchantInfo.setOperator(operator);
-
+        merchantInfo.setOperator(accountInfo.getAccountName());
         merchantService.saveMerchant(merchantInfo);
         return getSuccessResult(true);
     }

+ 2 - 10
fuint-application/src/main/java/com/fuint/module/backendApi/controller/BackendSettlementController.java

@@ -93,16 +93,8 @@ public class BackendSettlementController extends BaseController {
             searchParams.put("merchantId", accountInfo.getMerchantId());
         }
 
-        Map<String, Object> params = new HashMap<>();
-        params.put("status", StatusEnum.ENABLED.getKey());
-        if (accountInfo.getStoreId() != null && accountInfo.getStoreId() > 0) {
-            params.put("storeId", accountInfo.getStoreId());
-        }
-        if (accountInfo.getMerchantId() != null && accountInfo.getMerchantId() > 0) {
-            params.put("merchantId", accountInfo.getMerchantId());
-        }
-        List<MtStore> storeList = storeService.queryStoresByParams(params);
-        List<MtMerchant> merchantList = merchantService.queryMerchantByParams(params);
+        List<MtStore> storeList = storeService.getMyStoreList(accountInfo.getMerchantId(), accountInfo.getStoreId(), StatusEnum.ENABLED.getKey());
+        List<MtMerchant> merchantList = merchantService.getMyMerchantList(accountInfo.getMerchantId(), accountInfo.getStoreId(), StatusEnum.ENABLED.getKey());
 
         PaginationRequest paginationRequest = new PaginationRequest();
         paginationRequest.setCurrentPage(page);

+ 2 - 11
fuint-application/src/main/java/com/fuint/module/backendApi/controller/BackendStoreController.java

@@ -95,21 +95,12 @@ public class BackendStoreController extends BaseController {
         paginationRequest.setSearchParams(params);
         PaginationResponse<StoreDto> paginationResponse = storeService.queryStoreListByPagination(paginationRequest);
 
-        Map<String, Object> param = new HashMap<>();
-        param.put("status", StatusEnum.ENABLED.getKey());
-        if (accountInfo.getMerchantId() != null && accountInfo.getMerchantId() > 0) {
-            param.put("merchantId", accountInfo.getMerchantId());
-        }
-        if (accountInfo.getStoreId() != null && accountInfo.getStoreId() > 0) {
-            param.put("storeId", accountInfo.getStoreId());
-        }
-        List<MtMerchant> merchantList = merchantService.queryMerchantByParams(param);
-        String imagePath = settingService.getUploadBasePath();
+        List<MtMerchant> merchantList = merchantService.getMyMerchantList(accountInfo.getMerchantId(), accountInfo.getStoreId(), StatusEnum.ENABLED.getKey());
 
         Map<String, Object> result = new HashMap<>();
         result.put("paginationResponse", paginationResponse);
         result.put("merchantList", merchantList);
-        result.put("imagePath", imagePath);
+        result.put("imagePath", settingService.getUploadBasePath());
 
         return getSuccessResult(result);
     }