瀏覽代碼

达达配送商相关bug修复

叶君翔 3 年之前
父節點
當前提交
05ff8401ea

+ 7 - 0
lb-module/src/main/java/com/ydd/module/service/IShopDeviceService.java

@@ -51,4 +51,11 @@ public interface IShopDeviceService extends IService<ShopDevice> {
 
     List<ShopDeviceDto> findUsbPrintList(Long shopId);
 
+    /**
+     * 修改是否打印二维码
+     * @param shopDevice 请求参数
+     * @return 返回结果
+     */
+    int updateOpenQrCodeStatus(ShopDevice shopDevice);
+
 }

+ 8 - 0
lb-module/src/main/java/com/ydd/module/service/impl/ShopDeviceServiceImpl.java

@@ -1,5 +1,6 @@
 package com.ydd.module.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ydd.api.PrintApi;
 import com.ydd.module.domain.Device;
@@ -169,4 +170,11 @@ public class ShopDeviceServiceImpl extends ServiceImpl<ShopDeviceMapper, ShopDev
         return baseMapper.findUsbPrintList(shopId);
     }
 
+    @Override
+    public int updateOpenQrCodeStatus(ShopDevice shopDevice) {
+        return baseMapper.update(null, new UpdateWrapper<ShopDevice>()
+                .set("open_qr_code", shopDevice.getOpenQrCode())
+                .eq("id", shopDevice.getId()));
+    }
+
 }

+ 7 - 2
lb-module/src/main/resources/mapper/module/shopDeviceMapper.xml

@@ -41,8 +41,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         FROM lb_shop_device sd
         LEFT JOIN lb_merchant m on sd.merchant_id = m.id
         WHERE 1=1 AND sd.device_type != 11 AND sd.deleted = 0
-        <if test="params.dadaDspId != null and params.dadaDspId != ''">
-            AND m.dada_dsp_id = #{params.dadaDspId}
+        <if test="params.dadaDspId != null">
+            <if test="params.dadaDspId != 0">
+                AND m.dada_dsp_id = #{params.dadaDspId}
+            </if>
+            <if test="params.dadaDspId == 0">
+                AND m.dada_dsp_id is not null
+            </if>
         </if>
         <if test="params.merchantId != null and params.merchantId != ''">
             AND sd.merchant_id = #{params.merchantId}

+ 20 - 24
lb-web/src/main/java/com/ydd/web/controller/ShopDeviceController.java

@@ -1,42 +1,24 @@
 package com.ydd.web.controller;
 
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Arrays;
-
-import com.ydd.common.core.domain.entity.SysUser;
-import com.ydd.common.enums.UserTypeEnums;
-import com.ydd.module.domain.Coupon;
-import com.ydd.module.domain.Shop;
-import com.ydd.module.enums.ListSizeEnum;
-import com.ydd.module.enums.StatusEnum;
-import com.ydd.module.service.IAgentService;
-import com.ydd.module.service.IMerchantService;
-import lombok.RequiredArgsConstructor;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
 import com.ydd.common.annotation.Log;
 import com.ydd.common.core.controller.BaseController;
 import com.ydd.common.core.domain.Result;
+import com.ydd.common.core.domain.entity.SysUser;
 import com.ydd.common.core.page.TableDataInfo;
 import com.ydd.common.enums.BusinessType;
-import com.ydd.common.utils.poi.ExcelUtil;
+import com.ydd.common.enums.UserTypeEnums;
 import com.ydd.module.domain.ShopDevice;
+import com.ydd.module.enums.ListSizeEnum;
 import com.ydd.module.enums.StatusEnum;
+import com.ydd.module.service.IAgentService;
+import com.ydd.module.service.IMerchantService;
 import com.ydd.module.service.IShopDeviceService;
 import lombok.RequiredArgsConstructor;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
@@ -90,6 +72,8 @@ public class ShopDeviceController extends BaseController {
         if (user.getType().equals(UserTypeEnums.DADA_DELIVERY_RAP.getCode())
                 || user.getType().equals(UserTypeEnums.DADA_DELIVERY.getCode())){
            shopDevice.setDadaDspId(user.getDadaDspId());
+        } else if (user.getType().equals(UserTypeEnums.DADA.getCode())) {
+            shopDevice.setDadaDspId(0L);
         }
         startPage();
         List<ShopDevice> list = iShopDeviceService.queryList(shopDevice,merchantIds);
@@ -134,4 +118,16 @@ public class ShopDeviceController extends BaseController {
     public Result remove(@PathVariable Long[] ids) {
         return toAjax(iShopDeviceService.removeByIds(Arrays.asList(ids)) ? 1 : 0);
     }
+
+    /**
+     * 打印二维码状态修改
+     */
+//    @PreAuthorize("@ss.hasPermi('system:user:edit')")
+    @Log(title = "打印二维码状态修改", businessType = BusinessType.UPDATE)
+    @PutMapping("/changeQrCode")
+    public Result changeQrCode(@RequestBody ShopDevice shopDevice)
+    {
+        return toAjax(iShopDeviceService.updateOpenQrCodeStatus(shopDevice));
+    }
+
 }

+ 14 - 0
web-ui/src/api/module/shopDevice.js

@@ -72,4 +72,18 @@ export function exportShopDevice(query) {
     method: 'get',
     params: query
   })
+}
+
+// 打印二维码状态修改
+export function changeQrCode(id, openQrCode, qrCodeType) {
+  const data = {
+    id,
+    openQrCode,
+    qrCodeType
+  }
+  return request({
+    url: '/module/shopDevice/changeQrCode',
+    method: 'put',
+    data: data
+  })
 }

+ 2 - 2
web-ui/src/views/module/dadaDsp/index.vue

@@ -83,7 +83,7 @@
           </template>
       </el-table-column>
       <el-table-column label="创建时间" align="center" prop="createTime" />
-      <el-table-column label="打印二维码" align="center" prop="status">
+      <!-- <el-table-column label="打印二维码" align="center" prop="status">
         <template slot-scope="scope">
           <el-switch 
             v-model="scope.row.openQrCode"
@@ -94,7 +94,7 @@
             :inactive-value="0"
             ></el-switch>
         </template>
-      </el-table-column>
+      </el-table-column> -->
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
         <template slot-scope="scope">
           <el-button

+ 2 - 2
web-ui/src/views/module/dadaDspMerchant/index.vue

@@ -162,7 +162,7 @@
             v-model="scope.row.status" active-color="#13ce66" inactive-color="#ff4949"></el-switch>
         </template>
       </el-table-column> -->
-      <el-table-column label="打印二维码" align="center" prop="status">
+      <!-- <el-table-column label="打印二维码" align="center" prop="status">
         <template slot-scope="scope">
           <el-switch 
             v-model="scope.row.openQrCode"
@@ -173,7 +173,7 @@
             inactive-value="0"
             ></el-switch>
         </template>
-      </el-table-column>
+      </el-table-column> -->
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
         <template slot-scope="scope">
           <el-button

+ 35 - 3
web-ui/src/views/module/shopDevice/index.vue

@@ -98,6 +98,18 @@
           <el-tag v-if="scope.row.openOrderPrint == 0" type="danger">关闭</el-tag>
         </template>
       </el-table-column>
+      <el-table-column label="打印二维码" align="center" prop="openQrCode" v-if="this.userType == 3 || this.userType == 4 || this.userType == 5">
+        <template slot-scope="scope">
+          <el-switch 
+            v-model="scope.row.openQrCode"
+            @change="updateQrCode(scope.row)" 
+            active-color="#13ce66"
+            inactive-color="#ff4949"
+            :active-value="1"
+            :inactive-value="0"
+            ></el-switch>
+        </template>
+      </el-table-column>
       <el-table-column label="打印客户联数量" align="center" prop="printCustomerCount"/>
       <el-table-column label="打印商家联数量" align="center" prop="printMerchantCount"/>
       <el-table-column label="打印厨房联数量" align="center" prop="printKitchenCount"/>
@@ -260,7 +272,8 @@ import {
   exportShopDevice,
   getShopDeviceList,
   getMerchantList,
-  getShopList
+  getShopList,
+  changeQrCode
 } from "@/api/module/shopDevice";
 
 export default {
@@ -354,7 +367,8 @@ export default {
         printCustomerCount: undefined,
         printMerchantCount: undefined,
         printKitchenCount: undefined,
-        status: undefined
+        status: undefined,
+        openQrCode: undefined
       },
       // 表单参数
       form: {},
@@ -409,6 +423,7 @@ export default {
     };
   },
   created() {
+    this.userType = localStorage.getItem("SYS_USER_TYPE");
     this.getList();
     getShopDeviceList().then(response => {
       this.deviceList = response.data
@@ -417,6 +432,22 @@ export default {
     this.getMerchantOption()
   },
   methods: {
+    // 是否打印二维码
+    updateQrCode(row) {
+      console.log('row', row)
+      let text = row.openQrCode === 1 ? "开启打印" : "关闭打印";
+      this.$confirm('确认要' + text + '二维码?', "警告", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(function () {
+        return changeQrCode(row.id, row.openQrCode);       
+      }).then(() => {
+         this.msgSuccess(text + "成功");
+      }).catch(function () {
+        row.openQrCode = row.openQrCode === 1 ? 0: 1;
+      });
+    },
     // 选择商户
     selectMerchant() {
       if (this.form.merchantId) {
@@ -507,7 +538,8 @@ export default {
         printCustomerCount: 0,
         printMerchantCount: 0,
         printKitchenCount: 0,
-        status: 0
+        status: 0,
+        openQrCode: 0
       };
       this.resetForm("form");
     },