Sfoglia il codice sorgente

Merge remote-tracking branch 'origin/main'

huangjinliang 1 settimana fa
parent
commit
e8b8023c0b
21 ha cambiato i file con 178 aggiunte e 95 eliminazioni
  1. 1 0
      fuintBackend/fuint-application/src/main/java/com/fuint/common/dto/StoreDto.java
  2. 3 0
      fuintBackend/fuint-application/src/main/java/com/fuint/common/param/OrderListParam.java
  3. 3 4
      fuintBackend/fuint-application/src/main/java/com/fuint/common/service/TableInfoService.java
  4. 1 1
      fuintBackend/fuint-application/src/main/java/com/fuint/common/service/impl/AccountServiceImpl.java
  5. 1 1
      fuintBackend/fuint-application/src/main/java/com/fuint/common/service/impl/CateServiceImpl.java
  6. 5 0
      fuintBackend/fuint-application/src/main/java/com/fuint/common/service/impl/MerchantServiceImpl.java
  7. 25 13
      fuintBackend/fuint-application/src/main/java/com/fuint/common/service/impl/OrderServiceImpl.java
  8. 8 4
      fuintBackend/fuint-application/src/main/java/com/fuint/common/service/impl/TableInfoServiceImpl.java
  9. 26 22
      fuintBackend/fuint-application/src/main/java/com/fuint/common/util/ExcelUtil.java
  10. 44 17
      fuintBackend/fuint-application/src/main/java/com/fuint/module/backendApi/controller/BackendAccountController.java
  11. 1 1
      fuintBackend/fuint-application/src/main/java/com/fuint/module/backendApi/controller/BackendBalanceController.java
  12. 6 3
      fuintBackend/fuint-application/src/main/java/com/fuint/module/backendApi/controller/BackendMerchantController.java
  13. 2 5
      fuintBackend/fuint-application/src/main/java/com/fuint/module/backendApi/controller/BackendOrderController.java
  14. 1 1
      fuintBackend/fuint-application/src/main/java/com/fuint/module/backendApi/controller/BackendStaffController.java
  15. 13 4
      fuintBackend/fuint-application/src/main/java/com/fuint/module/backendApi/controller/BackendStoreController.java
  16. 4 4
      fuintBackend/fuint-application/src/main/java/com/fuint/module/backendApi/controller/BackendSubMessageController.java
  17. 8 6
      fuintBackend/fuint-application/src/main/java/com/fuint/module/backendApi/controller/BackendTableInfoController.java
  18. 3 3
      fuintBackend/fuint-application/src/main/java/com/fuint/module/clientApi/controller/ClientOrderController.java
  19. 2 2
      fuintBackend/fuint-application/src/main/java/com/fuint/module/merchantApi/controller/MerchantOrderController.java
  20. 11 1
      fuintBackend/fuint-application/src/main/resources/i18n/messages_en_US.properties
  21. 10 3
      fuintBackend/fuint-application/src/main/resources/i18n/messages_zh_CN.properties

+ 1 - 0
fuintBackend/fuint-application/src/main/java/com/fuint/common/dto/StoreDto.java

@@ -29,6 +29,7 @@ public class StoreDto implements Serializable {
     @ApiModelProperty("货币名称")
     private String currencyName;
 
+
     @ApiModelProperty("货币符号")
     private String currencySymbol;
 

+ 3 - 0
fuintBackend/fuint-application/src/main/java/com/fuint/common/param/OrderListParam.java

@@ -52,6 +52,9 @@ public class OrderListParam extends PageParam implements Serializable {
     @ApiModelProperty(value="桌码", name="tableCode")
     private String tableCode;
 
+    @ApiModelProperty(value="桌号", name="tableCode")
+    private String tableNumber;
+
     @ApiModelProperty(value="会员手机号", name="mobile")
     private String mobile;
 

+ 3 - 4
fuintBackend/fuint-application/src/main/java/com/fuint/common/service/TableInfoService.java

@@ -2,12 +2,11 @@ package com.fuint.common.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.fuint.common.param.PageParam;
-import com.fuint.framework.pagination.PaginationRequest;
-import com.fuint.framework.pagination.PaginationResponse;
+import com.fuint.framework.exception.BusinessCheckException;
 import com.fuint.framework.web.PageResult;
 import com.fuint.repository.bean.TableInfoBean;
 import com.fuint.repository.model.MtTableInfo;
-import com.fuint.framework.exception.BusinessCheckException;
+
 import java.util.List;
 import java.util.Map;
 
@@ -98,5 +97,5 @@ public interface TableInfoService extends IService<MtTableInfo> {
      */
     boolean updateTable(MtTableInfo updateEntity) throws BusinessCheckException;
 
-    PageResult<TableInfoBean> selectTableList(String tableName, PageParam param) throws BusinessCheckException;
+    PageResult<TableInfoBean> selectTableList(String tableName, Integer tableStatus, PageParam param) throws BusinessCheckException;
 }

+ 1 - 1
fuintBackend/fuint-application/src/main/java/com/fuint/common/service/impl/AccountServiceImpl.java

@@ -198,7 +198,7 @@ public class AccountServiceImpl extends ServiceImpl<TAccountMapper, TAccount> im
         TAccount account = new TAccount();
         account.setAccountKey(tAccount.getAccountKey());
         account.setAccountName(tAccount.getAccountName().toLowerCase());
-        account.setAccountStatus(1);
+        account.setAccountStatus(tAccount.getAccountStatus()==null?1:tAccount.getAccountStatus());
         account.setRealName(tAccount.getRealName());
         account.setRoleIds(tAccount.getRoleIds());
         account.setStaffId(tAccount.getStaffId());

+ 1 - 1
fuintBackend/fuint-application/src/main/java/com/fuint/common/service/impl/CateServiceImpl.java

@@ -133,7 +133,7 @@ public class CateServiceImpl extends ServiceImpl<MtGoodsCateMapper, MtGoodsCate>
         }
         AccountInfo accountInfo = AuthUserUtil.get();
         if (accountInfo.getStoreId() == null || accountInfo.getStoreId() < 1) {
-            throw new BusinessCheckException("超级管理员方帐号无法执行该操作,请使用商户帐号操作");
+            throw new BusinessCheckException(I18nUtil.getMessage("superAdminNotAllowedUseMerchantAccount"));
         }
         mtCate.setName(reqDto.getName());
         mtCate.setStatus(reqDto.getStatus()!=null?reqDto.getStatus():StatusEnum.ENABLED.getKey());

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

@@ -68,6 +68,11 @@ public class MerchantServiceImpl extends ServiceImpl<MtMerchantMapper, MtMerchan
         if (StringUtils.isNotBlank(status)) {
             lambdaQueryWrapper.eq(MtMerchant::getStatus, status);
         }
+
+        String no = paginationRequest.getSearchParams().get("no") == null ? "" : paginationRequest.getSearchParams().get("no").toString();
+        if (StringUtils.isNotBlank(no)) {
+            lambdaQueryWrapper.likeRight(MtMerchant::getNo, no);
+        }
         String id = paginationRequest.getSearchParams().get("id") == null ? "" : paginationRequest.getSearchParams().get("id").toString();
         if (StringUtils.isNotBlank(id)) {
             lambdaQueryWrapper.eq(MtMerchant::getId, id);

+ 25 - 13
fuintBackend/fuint-application/src/main/java/com/fuint/common/service/impl/OrderServiceImpl.java

@@ -222,21 +222,24 @@ public class OrderServiceImpl extends ServiceImpl<MtOrderMapper, MtOrder> implem
             status = OrderStatusEnum.CANCEL.getKey();  // 已取消
         }
 
-        Page<MtOpenGift> pageHelper = PageHelper.startPage(pageNumber, pageSize);
+
         LambdaQueryWrapper<MtOrder> lambdaQueryWrapper = Wrappers.lambdaQuery();
         lambdaQueryWrapper.ne(MtOrder::getStatus, OrderStatusEnum.DELETED.getKey());
 
         if (StringUtil.isNotEmpty(tableCode)) {
-            Map<String, Object> params = new HashMap<>();
-            params.put("code", tableCode);
-            params.put("status", StatusEnum.ENABLED.getKey());
-            List<MtTable> tables = tableService.queryTableListByParams(params);
-            if (tables != null && tables.size() > 0) {
-                lambdaQueryWrapper.eq(MtOrder::getTableId, tables.get(0).getId());
+            //不允许重复
+            List<Long> tableInfoIds = tableInfoService.list(new LambdaQueryWrapper<MtTableInfo>()
+                            .select(MtTableInfo::getId)
+                            .eq(MtTableInfo::getTableNumber, tableCode)
+                            .eq((storeId != null && storeId > 0), MtTableInfo::getStoreId, storeId))
+                    .stream().map(MtTableInfo::getId).collect(Collectors.toList());
+            if (tableInfoIds.size()>0) {
+                lambdaQueryWrapper.in(MtOrder::getTableId, tableInfoIds);
             } else {
                 lambdaQueryWrapper.eq(MtOrder::getTableId, "00");
             }
         }
+        Page<MtOpenGift> pageHelper = PageHelper.startPage(pageNumber, pageSize);
         if (StringUtil.isNotEmpty(orderSn)) {
             lambdaQueryWrapper.eq(MtOrder::getOrderSn, orderSn);
         }
@@ -351,11 +354,18 @@ public class OrderServiceImpl extends ServiceImpl<MtOrderMapper, MtOrder> implem
         } else {
             orderSn = mtOrder.getOrderSn();
         }
-
+        //从购物车获取餐桌号
+        String cartIds = orderDto.getCartIds();
+        if (StringUtils.isNotBlank(cartIds)){
+            String[] split = cartIds.split(",");
+            MtCart mtCart = mtCartMapper.selectById(Long.parseLong(split[0]));
+            mtOrder.setTableId(mtCart.getTableId());
+        }else{
+            mtOrder.setTableId(orderDto.getTableId());
+        }
         mtOrder.setUserId(orderDto.getUserId());
         mtOrder.setMerchantId(orderDto.getMerchantId());
         mtOrder.setStoreId(orderDto.getStoreId());
-        mtOrder.setTableId(orderDto.getTableId());
         mtOrder.setCouponId(orderDto.getCouponId());
         mtOrder.setParam(orderDto.getParam());
         mtOrder.setRemark(orderDto.getRemark());
@@ -530,6 +540,7 @@ public class OrderServiceImpl extends ServiceImpl<MtOrderMapper, MtOrder> implem
             }
         }
 
+
         // 再次更新订单
         try {
              orderInfo = updateOrder(mtOrder);
@@ -612,6 +623,7 @@ public class OrderServiceImpl extends ServiceImpl<MtOrderMapper, MtOrder> implem
                      }
                  }
                  if (cart.getId() > 0) {
+                     //删除购物车
                      mtCartMapper.deleteById(cart.getId());
                  }
             }
@@ -1722,8 +1734,8 @@ public class OrderServiceImpl extends ServiceImpl<MtOrderMapper, MtOrder> implem
 
         // 订单所属桌码
         if (orderInfo.getTableId() != null && orderInfo.getTableId() > 0) {
-            MtTable tableInfo = tableService.queryTableById(orderInfo.getTableId());
-            userOrderDto.setTableInfo(tableInfo);
+            MtTableInfo infoServiceById = tableInfoService.getById(orderInfo.getTableId());
+            userOrderDto.setNewTableInfo(infoServiceById);
         }
 
         // 所属员工
@@ -1785,8 +1797,8 @@ public class OrderServiceImpl extends ServiceImpl<MtOrderMapper, MtOrder> implem
                     OrderGoodsDto orderGoodsDto = new OrderGoodsDto();
                     orderGoodsDto.setId(orderGoods.getId());
                     orderGoodsDto.setName(goodsInfo.getName());
-                    if (goodsInfo.getLogo().indexOf(baseImage) == -1) {
-                        orderGoodsDto.setImage(baseImage + goodsInfo.getLogo());
+                    if (goodsInfo.getLogo()!=null) {
+                        orderGoodsDto.setImage(goodsInfo.getLogo());
                     }
                     orderGoodsDto.setType(OrderTypeEnum.GOOGS.getKey());
                     orderGoodsDto.setNum(orderGoods.getNum());

+ 8 - 4
fuintBackend/fuint-application/src/main/java/com/fuint/common/service/impl/TableInfoServiceImpl.java

@@ -217,18 +217,19 @@ public class TableInfoServiceImpl extends ServiceImpl<MtTableInfoMapper, MtTable
     }
 
     @Override
-    public PageResult<TableInfoBean> selectTableList(String tableName, PageParam param) throws BusinessCheckException {
+    public PageResult<TableInfoBean> selectTableList(String tableName, Integer tableStatus, PageParam param) throws BusinessCheckException {
         AccountInfo accountInfo = AuthUserUtil.get();
         //检查是否登入
         if (accountInfo == null){
             throw new BusinessCheckException(I18nUtil.getMessage("notAuthenticated"));
         }
-        if (accountInfo.getStoreId() == null || accountInfo.getStoreId() <=0){
+       /* if (accountInfo.getStoreId() == null || accountInfo.getStoreId() <=0){
             throw new BusinessCheckException(I18nUtil.getMessage("superAdminNotAllowedUseMerchantAccount"));
-        }
+        }*/
         //分页查询
         IPage<MtTableInfo> mtTableInfoIPage = this.baseMapper.selectPage(new Page<>(param.getPage(), param.getPageSize()), new LambdaQueryWrapper<MtTableInfo>()
                  .eq((accountInfo.getStoreId()!=null && accountInfo.getStoreId()>0),MtTableInfo::getStoreId,accountInfo.getStoreId())
+                 .eq(tableStatus!=null,MtTableInfo::getTableStatus,tableStatus)
                 .likeRight(StringUtils.isNotEmpty(tableName), MtTableInfo::getTableNumber, tableName));
         //补全字段
         List<TableInfoBean> beanList = mtTableInfoIPage.getRecords().stream().map(mtTableInfo -> {
@@ -238,7 +239,10 @@ public class TableInfoServiceImpl extends ServiceImpl<MtTableInfoMapper, MtTable
             BeanUtils.copyProperties(mtTableInfo, tableInfoBean);
             //获取店铺信息
             MtStore mtStore = storeMapper.selectById(storeId);
-            tableInfoBean.setStoreName(mtStore.getName());
+            if (mtStore!=null){
+                tableInfoBean.setStoreName(mtStore.getName());
+            }
+
             return tableInfoBean;
         }).collect(Collectors.toList());
         //返回

+ 26 - 22
fuintBackend/fuint-application/src/main/java/com/fuint/common/util/ExcelUtil.java

@@ -1,13 +1,11 @@
 package com.fuint.common.util;
 
-import org.apache.poi.hssf.usermodel.HSSFCell;
-import org.apache.poi.hssf.usermodel.HSSFCellStyle;
-import org.apache.poi.hssf.usermodel.HSSFRow;
-import org.apache.poi.hssf.usermodel.HSSFSheet;
-import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+import org.apache.poi.hssf.usermodel.*;
+
 import javax.servlet.http.HttpServletResponse;
 import java.io.OutputStream;
 import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
 
 /**
  * Excel工具
@@ -73,28 +71,34 @@ public class ExcelUtil {
      * */
     public static void setResponseHeader(HttpServletResponse response, String fileName, HSSFWorkbook wb) {
         try {
-            try {
-                fileName = new String(fileName.getBytes(), "ISO8859-1");
-            } catch (UnsupportedEncodingException e) {
-                e.printStackTrace();
-            }
-            response.setContentType("application/octet-stream;charset=ISO8859-1");
-            response.setHeader("Content-Disposition", "attachment;filename=" + fileName);
-            response.addHeader("Pargam", "no-cache");
-            response.addHeader("Cache-Control", "no-cache");
-        } catch (Exception ex) {
-            ex.printStackTrace();
+            // 编码文件名以适应RFC 5987标准
+            String encodedFileName = URLEncoder.encode(fileName, "UTF-8").replaceAll("\\+", "%20");
+
+            // 设置响应内容类型(HSSFWorkbook对应.xls格式)
+            response.setContentType("application/vnd.ms-excel");
+
+            // 设置支持多浏览器UTF-8编码的文件名
+            response.setHeader("Content-Disposition",
+                    "attachment; filename=\"" + encodedFileName + "\"; filename*=UTF-8''" + encodedFileName);
+
+            // 修正缓存控制头(修正拼写错误)
+            response.setHeader("Pragma", "no-cache");
+            response.setHeader("Cache-Control", "no-cache");
+            response.setDateHeader("Expires", 0);
+        } catch (UnsupportedEncodingException e) {
+            // 处理编码异常(实际上UTF-8在Java标准中总是可用,此catch块为保险起见)
+            response.setHeader("Content-Disposition", "attachment; filename=" + fileName);
+            e.printStackTrace();
         }
 
-        try {
-            OutputStream os = response.getOutputStream();
+        // 使用try-with-resources确保流关闭(需要Java7+)
+        try (OutputStream os = response.getOutputStream()) {
             wb.write(os);
             os.flush();
-            os.close();
         } catch (Exception e) {
+            // 记录异常并处理(实际生产环境应使用日志框架)
             e.printStackTrace();
+            throw new RuntimeException("导出Excel失败", e);
         }
-
-        return;
     }
-}
+}

+ 44 - 17
fuintBackend/fuint-application/src/main/java/com/fuint/module/backendApi/controller/BackendAccountController.java

@@ -1,6 +1,5 @@
 package com.fuint.module.backendApi.controller;
 
-import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.fuint.common.Constants;
 import com.fuint.common.dto.AccountDto;
 import com.fuint.common.dto.AccountInfo;
@@ -28,6 +27,7 @@ import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
+
 import javax.servlet.http.HttpServletRequest;
 import java.util.*;
 
@@ -40,6 +40,7 @@ import java.util.*;
 @Api(tags="管理端-管理员相关接口")
 @RestController
 @AllArgsConstructor
+@SuppressWarnings("all")
 @RequestMapping(value = "/backendApi/account")
 public class BackendAccountController extends BaseController {
 
@@ -135,10 +136,10 @@ public class BackendAccountController extends BaseController {
 
         List<TDuty> roleList = tDutyService.getAvailableRoles(accountInfo.getMerchantId(), accountInfo.getId());
         List<RoleDto> roles = new ArrayList<>();
-        if (roleList.size() > 0) {
+        if (!roleList.isEmpty()) {
             for (TDuty duty : roleList) {
                 RoleDto e = new RoleDto();
-                e.setId(duty.getDutyId().longValue());
+                e.setId(duty.getDutyId());
                 e.setName(duty.getDutyName());
                 e.setStatus(duty.getStatus());
                 roles.add(e);
@@ -182,10 +183,8 @@ public class BackendAccountController extends BaseController {
                     accountDto.setStoreName(mtStore.getName());
                 }
             }
-            if (tAccount != null) {
-                List<Long> roleIds = tAccountService.getRoleIdsByAccountId(tAccount.getAcctId());
-                result.put("roleIds", roleIds);
-            }
+	        List<Long> roleIds = tAccountService.getRoleIdsByAccountId(tAccount.getAcctId());
+	        result.put("roleIds", roleIds);
         } else {
             result.put("roleIds", "");
         }
@@ -226,10 +225,10 @@ public class BackendAccountController extends BaseController {
         }
 
         List<TDuty> duties = new ArrayList<>();
-        if (roleIds.size() > 0) {
+        if (!roleIds.isEmpty()) {
             String[] ids = new String[roleIds.size()];
             for (int i = 0; i < roleIds.size(); i++) {
-                ids[i] = roleIds.get(i).toString();
+                ids[i] = roleIds.get(i);
             }
             duties = tDutyService.findDatasByIds(ids);
             if (duties.size() < roleIds.size()) {
@@ -287,13 +286,13 @@ public class BackendAccountController extends BaseController {
         }
 
         if (id == loginAccount.getId()) {
-            return getFailureResult(201, "不能修改自己的权限");
+            return getFailureResult(201, I18nUtil.getMessage("selfPermissionImmutable"));
         }
 
         TAccount tAccount = tAccountService.getAccountInfoById(id);
 
         if ("admin".equals(tAccount.getAccountName())){
-            return getFailureResult(201, "抱歉,不能修改超级管理员的信息");
+            return getFailureResult(201, I18nUtil.getMessage("adminInfoUnmodifiable"));
         }
 
         tAccount.setAcctId(id);
@@ -324,7 +323,7 @@ public class BackendAccountController extends BaseController {
         if (!roleIds.isEmpty()) {
             String[] ids = new String[roleIds.size()];
             for (int i = 0; i < roleIds.size(); i++) {
-                ids[i] = roleIds.get(i).toString();
+                ids[i] = roleIds.get(i);
             }
             duties = tDutyService.findDatasByIds(ids);
             if (duties.size() < roleIds.size()) {
@@ -361,12 +360,12 @@ public class BackendAccountController extends BaseController {
                  if (StringUtil.isNotEmpty(ids[i])) {
                      Long userId = Long.parseLong(ids[i]);
                      TAccount tAccount = tAccountService.getAccountInfoById(userId);
-                     if (StringUtil.equals("admin", tAccount.getAccountName())) {
-                         return getFailureResult(201, "抱歉,不能删除超级管理员");
-                     }
                      if (tAccount == null) {
                          return getFailureResult(201, I18nUtil.getMessage("accountNonexistent"));
                      }
+                     if (StringUtil.equals("admin", tAccount.getAccountName())) {
+                         return getFailureResult(201, "抱歉,不能删除超级管理员");
+                     }
                      if (StringUtil.equals(accountInfo.getAccountName(), tAccount.getAccountName())) {
                          return getFailureResult(201, "您不能删除自己");
                      }
@@ -439,13 +438,41 @@ public class BackendAccountController extends BaseController {
         }
 
         if (!StringUtil.equals(accountDto.getAccountName(), "admin")) {
-            return getFailureResult(201, "不能修改超级管理员密码");
+            return getFailureResult(201, I18nUtil.getMessage("noPwdChangeAcct"));
         }
 
         TAccount tAccount = tAccountService.getAccountInfoById(userId);
-        tAccount.setPassword(password);
+        if (tAccount != null) {
+            tAccount.setPassword(password);
+            tAccountService.entryptPassword(tAccount);
+            tAccountService.updateAccount(tAccount);
+        }
+
+        return getSuccessResult(true);
+    }
 
+
+    /**
+     * 自己修改账户密码
+     *
+     * @return
+     */
+    @ApiOperation(value = "自己修改自己的账户密码")
+    @RequestMapping(value = "/mySelfResetPwd", method = RequestMethod.POST)
+    @CrossOrigin
+    @PreAuthorize("@pms.hasPermission('system:account:edit')")
+    public ResponseObject mySelfResetPwd(HttpServletRequest request, @RequestBody Map<String, Object> param) {
+        String token = request.getHeader("Access-Token");
+        Long userId = param.get("userId") == null ? 0 : Long.parseLong(param.get("userId").toString());
+        String password = param.get("password") == null ? "" : param.get("password").toString();
+
+        AccountInfo accountDto = TokenUtil.getAccountInfoByToken(token);
+        if (accountDto == null) {
+            return getFailureResult(1001, I18nUtil.getMessage("notAuthenticated"));
+        }
+        TAccount tAccount = tAccountService.getAccountInfoById(userId);
         if (tAccount != null) {
+            tAccount.setPassword(password);
             tAccountService.entryptPassword(tAccount);
             tAccountService.updateAccount(tAccount);
         }

+ 1 - 1
fuintBackend/fuint-application/src/main/java/com/fuint/module/backendApi/controller/BackendBalanceController.java

@@ -274,7 +274,7 @@ public class BackendBalanceController extends BaseController {
             return getFailureResult(201, "充值规则设置不能为空");
         }
         if (accountInfo.getMerchantId() == null || accountInfo.getMerchantId() <= 0) {
-            return getFailureResult(201, "平台方帐号无法执行该操作,请使用商户帐号操作");
+            return getFailureResult(201, I18nUtil.getMessage("superAdminNotAllowedUseMerchantAccount"));
         }
 
         String rechargeRule = "";

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

@@ -57,7 +57,7 @@ public class BackendMerchantController extends BaseController {
      * @return 商户列表
      */
     @ApiOperation(value = "分页查询商户列表")
-    @RequestMapping(value = "/list")
+    @GetMapping(value = "/list")
     @CrossOrigin
     @PreAuthorize("@pms.hasPermission('merchant:index')")
     public ResponseObject list(HttpServletRequest request) throws BusinessCheckException {
@@ -68,7 +68,7 @@ public class BackendMerchantController extends BaseController {
         String merchantId = request.getParameter("id");
         String merchantName = request.getParameter("name");
         String status = request.getParameter("status");
-
+        String no = request.getParameter("no");
         AccountInfo accountInfo = TokenUtil.getAccountInfoByToken(token);
         if (accountInfo == null) {
             return getFailureResult(1001, I18nUtil.getMessage("notAuthenticated"));
@@ -91,6 +91,9 @@ public class BackendMerchantController extends BaseController {
         if (StringUtil.isNotEmpty(status)) {
             params.put("status", status);
         }
+        if (StringUtil.isNotEmpty(no)){
+            params.put("no", no);
+        }
         paginationRequest.setSearchParams(params);
         PaginationResponse<MtMerchant> paginationResponse = merchantService.queryMerchantListByPagination(paginationRequest);
 
@@ -187,7 +190,7 @@ public class BackendMerchantController extends BaseController {
             return getFailureResult(1001, I18nUtil.getMessage("notAuthenticated"));
         }
 
-        Long merchantId = StringUtil.isEmpty(params.get("id").toString()) ? Long.parseLong("0") : Integer.parseInt(params.get("id").toString());
+        Long merchantId = StringUtil.isEmpty(params.get("id").toString()) ? Long.parseLong("0") : Long.parseLong(params.get("id").toString());
         String name = CommonUtil.replaceXSS(params.get("name").toString());
         String merchantNo = CommonUtil.replaceXSS(params.get("no").toString());
         String contact = params.get("contact") == null ? "" : CommonUtil.replaceXSS(params.get("contact").toString());

+ 2 - 5
fuintBackend/fuint-application/src/main/java/com/fuint/module/backendApi/controller/BackendOrderController.java

@@ -5,15 +5,12 @@ import com.fuint.common.dto.*;
 import com.fuint.common.enums.*;
 import com.fuint.common.param.OrderListParam;
 import com.fuint.common.service.*;
-import com.fuint.common.util.ExcelUtil;
-import com.fuint.common.util.I18nUtil;
-import com.fuint.common.util.TokenUtil;
+import com.fuint.common.util.*;
 import com.fuint.framework.exception.BusinessCheckException;
 import com.fuint.framework.pagination.PaginationResponse;
 import com.fuint.framework.web.BaseController;
 import com.fuint.framework.web.ResponseObject;
 import com.fuint.repository.model.*;
-import com.fuint.common.util.DateUtil;
 import com.fuint.utils.StringUtil;
 import com.fuint.utils.TimeUtils;
 import io.swagger.annotations.Api;
@@ -563,7 +560,7 @@ public class BackendOrderController extends BaseController {
         String startTime = request.getParameter("startTime") == null ? "" : request.getParameter("startTime");
         String endTime = request.getParameter("endTime") == null ? "" : request.getParameter("endTime");
 
-        AccountInfo accountInfo = TokenUtil.getAccountInfoByToken(token);
+        AccountInfo accountInfo = AuthUserUtil.get();
         if (accountInfo == null) {
             logger.error("导出订单失败:token = {}", token);
             return;

+ 1 - 1
fuintBackend/fuint-application/src/main/java/com/fuint/module/backendApi/controller/BackendStaffController.java

@@ -122,7 +122,7 @@ public class BackendStaffController extends BaseController {
     @ApiOperation(value = "更新员工状态")
     @RequestMapping(value = "/updateStatus", method = RequestMethod.POST)
     @CrossOrigin
-    @PreAuthorize("@pms.hasPermission('staff:list')")
+    @PreAuthorize("@pms.hasPermission('staff:edit')")
     public ResponseObject updateStatus(HttpServletRequest request, @RequestBody Map<String, Object> params) throws BusinessCheckException {
         String token = request.getHeader("Access-Token");
         String status = params.get("status") != null ? params.get("status").toString() : StatusEnum.ENABLED.getKey();

+ 13 - 4
fuintBackend/fuint-application/src/main/java/com/fuint/module/backendApi/controller/BackendStoreController.java

@@ -243,7 +243,7 @@ public class BackendStoreController extends BaseController {
 
 		if (accountInfo.getStoreId() != null && accountInfo.getStoreId() > 0) {
 			if (StringUtil.isEmpty(storeId)) {
-				return getFailureResult(201, "店铺帐号不能新增店铺,请使用商户帐号添加!");
+				return getFailureResult(201, I18nUtil.getMessage("superAdminNotAllowedUseMerchantAccount"));
 			}
 			storeId = accountInfo.getStoreId().toString();
 		}
@@ -253,14 +253,23 @@ public class BackendStoreController extends BaseController {
 
 		storeInfo.setName(storeName);
 		storeInfo.setLogo(logo);
+		//国家id
 		if (StringUtil.isNotBlank(countryId)){
 			storeInfo.setCountryId(Long.valueOf(countryId));
 		}
+		//货币id
 		if (StringUtil.isNotBlank(currencyId)){
 			storeInfo.setCurrencyId(Long.valueOf(currencyId));
 		}
 		if (StringUtil.isNotBlank(serviceFeeRate)){
-			storeInfo.setServiceFeeRate(new BigDecimal(serviceFeeRate));
+			BigDecimal zero = BigDecimal.ZERO;
+			BigDecimal one = BigDecimal.ONE;
+			BigDecimal serviceFeeRateBigDecimal = new BigDecimal(serviceFeeRate);
+			// 服务费必须在0-1之间
+			if (serviceFeeRateBigDecimal.compareTo(zero) < 0 || serviceFeeRateBigDecimal.compareTo(one) > 0) {
+				throw new IllegalArgumentException(I18nUtil.getMessage("serviceFeeRateRange"));
+			}
+			storeInfo.setServiceFeeRate(serviceFeeRateBigDecimal);
 		}
 		storeInfo.setContact(contact);
 		storeInfo.setPhone(phone);
@@ -286,12 +295,12 @@ public class BackendStoreController extends BaseController {
 			storeInfo.setMerchantId(Long.valueOf(merchantId));
 		}
 		if (StringUtil.isEmpty(storeName)) {
-			return getFailureResult(201, "店铺名称不能为空");
+			return getFailureResult(201, I18nUtil.getMessage("shopNameReq"));
 		} else {
 			if (!StringUtil.isNotEmpty(storeName)) {
 				StoreDto storeDto = storeService.queryStoreByName(storeName);
 				if (null != storeDto && storeDto.getName().equals(storeName) && !storeDto.getId().equals(storeId)) {
-					return getFailureResult(201, "该店铺名称已经存在");
+					return getFailureResult(201, I18nUtil.getMessage("shopNameExists"));
 				}
 			}
 		}

+ 4 - 4
fuintBackend/fuint-application/src/main/java/com/fuint/module/backendApi/controller/BackendSubMessageController.java

@@ -189,11 +189,11 @@ public class BackendSubMessageController extends BaseController {
                 result.put("tid", tid);
                 return getSuccessResult(result);
             } catch (Exception e) {
-                return getFailureResult(201, "操作失败");
+                return getFailureResult(201, I18nUtil.getMessage("operationFailed"));
             }
         }
 
-        return getFailureResult(201, "操作失败");
+        return getFailureResult(201, I18nUtil.getMessage("operationFailed"));
     }
 
     /**
@@ -218,7 +218,7 @@ public class BackendSubMessageController extends BaseController {
             return getFailureResult(1001, I18nUtil.getMessage("notAuthenticated"));
         }
         if (accountInfo.getMerchantId() == null || accountInfo.getMerchantId() <= 0) {
-            return getFailureResult(201, "请使用商户账号操作");
+            return getFailureResult(201, I18nUtil.getMessage("superAdminNotAllowedUseMerchantAccount"));
         }
 
         SubMessageDto subMessageDto = new SubMessageDto();
@@ -272,7 +272,7 @@ public class BackendSubMessageController extends BaseController {
             info.setUpdateTime(new Date());
             settingService.saveSetting(info);
         }  catch (Exception e) {
-            return getFailureResult(201, "操作失败");
+            return getFailureResult(201, I18nUtil.getMessage("operationFailed"));
         }
 
         return getSuccessResult(true);

+ 8 - 6
fuintBackend/fuint-application/src/main/java/com/fuint/module/backendApi/controller/BackendTableInfoController.java

@@ -59,9 +59,9 @@ public class BackendTableInfoController extends BaseController {
     @RequestMapping(value = "/list", method = RequestMethod.GET)
     @CrossOrigin
     @PreAuthorize("@pms.hasPermission('table:index')")
-    public PageResult<TableInfoBean> list(@RequestParam(value = "tableName",defaultValue = "") String tableName, PageParam param) throws BusinessCheckException {
-        return  tableInfoService.selectTableList(tableName,param);
-
+    public PageResult<TableInfoBean> list(@RequestParam(value = "tableNumber",defaultValue = "") String tableNumber,
+                                          @RequestParam(value = "tableStatus",required = false) Integer tableStatus, PageParam param) throws BusinessCheckException {
+        return  tableInfoService.selectTableList(tableNumber,tableStatus,param);
 
     }
 
@@ -76,7 +76,7 @@ public class BackendTableInfoController extends BaseController {
     @PreAuthorize("@pms.hasPermission('table:edit')")
     public ResponseObject updateStatus(HttpServletRequest request, @RequestBody Map<String, Object> params) throws BusinessCheckException {
         String token = request.getHeader("Access-Token");
-        String status = params.get("status") != null ? params.get("status").toString() : StatusEnum.ENABLED.getKey();
+        String status = params.get("tableStatus") != null ? params.get("tableStatus").toString() : StatusEnum.ENABLED.getKey();
         Long id = params.get("id") == null ? 0 : Long.parseLong(params.get("id").toString());
 
         AccountInfo accountInfo = TokenUtil.getAccountInfoByToken(token);
@@ -88,7 +88,9 @@ public class BackendTableInfoController extends BaseController {
         if (mtTableInfo == null) {
             return getFailureResult(201);
         }
-        if (Integer.parseInt(status)==1){
+        int count = cartService.count(new LambdaQueryWrapper<MtCart>()
+                .eq(MtCart::getTableId, id));
+        if (Integer.parseInt(status)==1 && count>0){
             return getFailureResult(1001, I18nUtil.getMessage("inUseTable"));
         }
         mtTableInfo.setTableStatus(Integer.parseInt(status));
@@ -321,7 +323,7 @@ public class BackendTableInfoController extends BaseController {
         BeanUtils.copyProperties(dto, entity);
         entity.setCreateUserId(account.getAccountName());
         entity.setUpdateUserId(account.getAccountName());
-        entity.setTableStatus(0); // 默认空闲状态
+        entity.setTableStatus(dto.getTableStatus()==null?0:dto.getTableStatus()); // 默认空闲状态
         entity.setDeleteFlag(0);
         entity.setStoreId(storeId);
         // 保存数据

+ 3 - 3
fuintBackend/fuint-application/src/main/java/com/fuint/module/clientApi/controller/ClientOrderController.java

@@ -92,7 +92,7 @@ public class ClientOrderController extends BaseController {
 
         String orderId = request.getParameter("orderId");
         if (StringUtil.isEmpty(orderId)) {
-            return getFailureResult(2000, "订单不能为空");
+            return getFailureResult(2000, I18nUtil.getMessage("orderCannotBeEmpty"));
         }
 
         UserOrderDto orderInfo = orderService.getMyOrderById(Long.valueOf(orderId));
@@ -115,7 +115,7 @@ public class ClientOrderController extends BaseController {
 
         String orderId = request.getParameter("orderId");
         if (StringUtil.isEmpty(orderId)) {
-            return getFailureResult(2000, "订单不能为空");
+            return getFailureResult(2000, I18nUtil.getMessage("orderCannotBeEmpty"));
         }
 
         UserOrderDto order = orderService.getOrderById(Long.valueOf(orderId));
@@ -144,7 +144,7 @@ public class ClientOrderController extends BaseController {
 
         String orderId = request.getParameter("orderId");
         if (StringUtil.isEmpty(orderId)) {
-            return getFailureResult(2000, "订单不能为空");
+            return getFailureResult(2000, I18nUtil.getMessage("orderCannotBeEmpty"));
         }
 
         UserOrderDto order = orderService.getOrderById(Long.valueOf(orderId));

+ 2 - 2
fuintBackend/fuint-application/src/main/java/com/fuint/module/merchantApi/controller/MerchantOrderController.java

@@ -95,7 +95,7 @@ public class MerchantOrderController extends BaseController {
 
         String orderId = orderDetailParam.getOrderId();
         if (orderId == null || StringUtil.isEmpty(orderId)) {
-            return getFailureResult(2000, "订单不能为空");
+            return getFailureResult(2000, I18nUtil.getMessage("orderCannotBeEmpty"));
         }
 
         UserOrderDto orderInfo = orderService.getMyOrderById(Long.valueOf(orderDetailParam.getOrderId()));
@@ -119,7 +119,7 @@ public class MerchantOrderController extends BaseController {
 
         String orderId = orderDetailParam.getOrderId();
         if (orderId == null || StringUtil.isEmpty(orderId)) {
-            return getFailureResult(201, "订单不能为空");
+            return getFailureResult(201, I18nUtil.getMessage("orderCannotBeEmpty"));
         }
 
         UserOrderDto orderDto = orderService.getOrderById(Long.valueOf(orderId));

+ 11 - 1
fuintBackend/fuint-application/src/main/resources/i18n/messages_en_US.properties

@@ -31,7 +31,7 @@ submissionError=Information submission error
 noEditPermission=Sorry, you have no edit permission
 noPermissionToAddMerchant=Sorry, you have no permission to add merchants
 productIDNotEmptyRequired=Product ID cannot be empty
-superAdminNotAllowedUseMerchantAccount=Super admin account cannot perform this operation, please use merchant account
+superAdminNotAllowedUseMerchantAccount=please use merchant account
 merchantNameCannotBeEmpty=Merchant name cannot be empty
 merchantNameAlreadyExists=Merchant name already exists
 rechargePointsMustBeNumeric=Recharge points must be numeric
@@ -101,3 +101,13 @@ cyclicDependencyDetected=Cyclic dependency detected
 existCat = Category Name Exists
 unrmvTblRef = Table Reference Exists, Cannot Delete
 nonEmptyCategoryName = Category Name Cannot Be Empty
+inUseTable=Table is in use
+tableDeletedOrNonExistent=Table does not exist or has b een deleted
+tableInUseAlready=Table is already in use
+nonExistentCategory=Category does not exist
+serviceFeeRateRange=Service fee rate must be between 0 and 1 inclusive
+shopNameReq=Shop name cannot be empty
+shopNameExists=The shop name already exists
+operationFailed=Operation failed
+selfPermissionImmutable=Cannot modify one's own permissions
+adminInfoUnmodifiable=Sorry, cannot modify super admin information

+ 10 - 3
fuintBackend/fuint-application/src/main/resources/i18n/messages_zh_CN.properties

@@ -31,7 +31,7 @@ submissionError=信息提交有误
 noEditPermission=抱歉,您没有修改权限
 noPermissionToAddMerchant=抱歉,您没有添加商户的权限
 productIDNotEmptyRequired=商品ID不能为空
-superAdminNotAllowedUseMerchantAccount=超级管理员帐号无法执行该操作,请使用商户帐号操作
+superAdminNotAllowedUseMerchantAccount=请使用门店帐号操作
 merchantNameCannotBeEmpty=商户名称不能为空
 merchantNameAlreadyExists=商户名称已经存在
 rechargePointsMustBeNumeric=充值积分必须是数字
@@ -101,10 +101,17 @@ cyclicDependencyDetected=检测到循环依赖
 existCat=分类名称已存在
 unrmvTblRef=有餐桌引用不能删除
 nonEmptyCategoryName=分类名称不能为空
-
-
 inUseTable=餐桌正在被使用
 tableDeletedOrNonExistent=餐桌不存在或已被删除
 tableInUseAlready=餐桌已被使用
 nonExistentCategory=分类不存在
+serviceFeeRateRange=服务费率必须在0到1之间(包括0和1)
+shopNameReq=店铺名称不能为空
+shopNameExists=该店铺名称已经存在
+operationFailed=操作失败
+selfPermissionImmutable=不能修改自己的权限
+adminInfoUnmodifiable=抱歉,不能修改超级管理员的信息
+
+
+noPwdChangeAcct=此账号无权限修改密码