zangbin před 2 roky
rodič
revize
e58b3afaaf

+ 9 - 1
tour-module/src/main/java/com/tour/module/domain/MakeCardAllocation.java

@@ -17,7 +17,7 @@ import java.util.Map;
 
 /**
  * 制卡分配情况对象 tour_mark_card_allocation
- * 
+ *
  * @author zoe
  * @date 2023-06-02
  */
@@ -68,4 +68,12 @@ private static final long serialVersionUID=1L;
     @TableField(exist = false)
     private Map<String, Object> params = new HashMap<>();
 
+    @TableField(exist = false)
+    private Integer cardType;
+
+    @TableField(exist = false)
+    private String makeCardName;
+
+    @TableField(exist = false)
+    private String agentName;
 }

+ 3 - 0
tour-module/src/main/java/com/tour/module/mapper/MakeCardAllocationMapper.java

@@ -3,6 +3,8 @@ package com.tour.module.mapper;
 import com.tour.module.domain.MakeCardAllocation;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 
+import java.util.List;
+
 /**
  * 制卡分配情况Mapper接口
  *
@@ -11,4 +13,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 public interface MakeCardAllocationMapper extends BaseMapper<MakeCardAllocation> {
 
+    List<MakeCardAllocation> queryList(MakeCardAllocation markCard);
 }

+ 15 - 11
tour-module/src/main/java/com/tour/module/service/impl/MakeCardAllocationServiceImpl.java

@@ -1,5 +1,7 @@
 package com.tour.module.service.impl;
 
+import com.tour.module.domain.Agent;
+import com.tour.module.service.IAgentService;
 import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -8,7 +10,9 @@ import com.tour.module.mapper.MakeCardAllocationMapper;
 import com.tour.module.domain.MakeCardAllocation;
 import com.tour.module.service.IMakeCardAllocationService;
 
+import javax.annotation.Resource;
 import java.util.List;
+import java.util.Objects;
 
 /**
  * 制卡分配情况Service业务层处理
@@ -19,18 +23,18 @@ import java.util.List;
 @Service
 public class MakeCardAllocationServiceImpl extends ServiceImpl<MakeCardAllocationMapper, MakeCardAllocation> implements IMakeCardAllocationService {
 
+    @Resource
+    private IAgentService iAgentService;
+
     @Override
     public List<MakeCardAllocation> queryList(MakeCardAllocation makeCardAllocation) {
-        LambdaQueryWrapper<MakeCardAllocation> lqw = Wrappers.lambdaQuery();
-        if (makeCardAllocation.getMakeId() != null){
-            lqw.eq(MakeCardAllocation::getMakeId ,makeCardAllocation.getMakeId());
-        }
-        if (makeCardAllocation.getAgentId() != null){
-            lqw.eq(MakeCardAllocation::getAgentId ,makeCardAllocation.getAgentId());
-        }
-        if (makeCardAllocation.getNum() != null){
-            lqw.eq(MakeCardAllocation::getNum ,makeCardAllocation.getNum());
-        }
-        return this.list(lqw);
+        List<MakeCardAllocation> list = baseMapper.queryList(makeCardAllocation);
+        list.stream().forEach(make -> {
+            Agent agent = iAgentService.getById(make.getAgentId());
+            if (Objects.nonNull(agent)) {
+                make.setAgentName(agent.getAgentName());
+            }
+        });
+        return list;
     }
 }

+ 6 - 3
tour-module/src/main/resources/mapper/module/MakeCardMapper.xml

@@ -3,7 +3,7 @@
 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.tour.module.mapper.MakeCardMapper">
-    
+
     <resultMap type="MakeCard" id="MakeCardResult">
         <result property="id"    column="id"    />
         <result property="makeCardName"    column="make_card_name"    />
@@ -15,7 +15,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <select id="getList" resultType="com.tour.module.domain.MakeCard">
         select t.id,t.card_num,t.create_time,t.make_card_name,IFNULL(sum(a.num),0) num,t.card_type
         from tour_make_card  t left join tour_make_card_allocation a on t.id = a.make_id
-        <if test="makeCardName!=null and makeCardName!=''">make_card_name like concat('%', #{makeCardName}, '%')</if>
+        where t.deleted = 0
+        <if test="makeCardName!=null and makeCardName!=''">
+            AND t.make_card_name like concat('%', #{makeCardName}, '%')
+        </if>
         <if test="startTime != null and  startTime != ''">
             AND t.create_time >= #{startTime}
         </if>
@@ -26,4 +29,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </select>
 
 
-</mapper>
+</mapper>

+ 15 - 2
tour-module/src/main/resources/mapper/module/MarkCardAllocationMapper.xml

@@ -3,7 +3,7 @@
 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.tour.module.mapper.MakeCardAllocationMapper">
-    
+
     <resultMap type="MakeCardAllocation" id="MakeCardAllocationResult">
         <result property="id"    column="id"    />
         <result property="makeId"    column="make_id"    />
@@ -13,5 +13,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="updateBy"    column="update_by"    />
     </resultMap>
 
+    <select id="queryList" resultType="com.tour.module.domain.MakeCardAllocation">
+        select
+            ma.*,
+            m.card_type,
+            m.make_card_name
+        from tour_make_card_allocation ma left join tour_make_card m on ma.make_id = m.id
+        where ma.deleted = 0
+        <if test="makeId!=null">
+            AND ma.make_id = #{makeId}
+        </if>
+        ORDER BY ma.id DESC
+    </select>
+
 
-</mapper>
+</mapper>

+ 3 - 3
tour-oms/src/main/java/com/tour/web/controller/MakeCardAllocationController.java

@@ -26,7 +26,7 @@ import com.tour.module.service.IMakeCardAllocationService;
 
 /**
  * 制卡分配情况Controller
- * 
+ *
  * @author zoe
  * @date 2023-06-02
  */
@@ -75,8 +75,8 @@ public class MakeCardAllocationController extends BaseController {
     @PreAuthorize("@ss.hasPermi('module:MakeCardAllocation:add')" )
     @Log(title = "制卡分配情况" , businessType = BusinessType.INSERT)
     @PostMapping
-    public Result add(@RequestBody MakeCardAllocation MakeCardAllocation) {
-        return toAjax(iMakeCardAllocationService.save(MakeCardAllocation) ? 1 : 0);
+    public Result add(@RequestBody List<MakeCardAllocation> list) {
+        return toAjax(iMakeCardAllocationService.saveBatch(list) ? 1 : 0);
     }
 
     /**

+ 18 - 1
web-ui/src/api/module/makeCard.js

@@ -43,4 +43,21 @@ export function sendCard(id) {
       url: '/module/markCard/sendCard',
       method: 'get',
     })
-  }
+  }
+
+// 发卡
+export function addMakeCard(data) {
+  return request({
+    url: '/module/MakeCardAllocation',
+    method: 'post',
+    data: data
+  })
+}
+
+export function getMakeCardList(query) {
+  return request({
+    url: '/module/MakeCardAllocation/list',
+    method: 'get',
+    params: query
+  })
+}

+ 56 - 29
web-ui/src/views/module/card/index.vue

@@ -1,9 +1,9 @@
 <template>
   <div class="app-container">
     <el-form :model="queryParams" ref="couponForm" :inline="true" v-show="showCouponSearch">
-      <el-form-item label="批次" prop="name">
+      <el-form-item label="批次" prop="make_card_name">
         <el-input
-          v-model="queryParams.name"
+          v-model="queryParams.makeCardName"
           placeholder="请输入批次"
           clearable
           @keyup.enter.native="handleQuery"
@@ -11,7 +11,7 @@
       </el-form-item>
     
       <el-form-item>
-        <!-- <el-button type="primary" icon="el-icon-search"  @click="handleCouponQuery">搜索</el-button> -->
+        <el-button type="primary" icon="el-icon-search"  @click="handleCouponQuery">搜索</el-button>
         <!-- <el-button icon="el-icon-refresh"  @click="resetCouponQuery">重置</el-button> -->
       </el-form-item>
     </el-form>
@@ -113,7 +113,7 @@
           <el-table-column label="代理商" align="center" prop="agentName">
             <template slot-scope="scope">
               <el-select
-                  v-model="scope.row.agentId" filterable   clearable placeholder="请选择代理" @change="changeLocationValue">
+                  v-model="scope.row.agentId" filterable   clearable placeholder="请选择代理">
                   <el-option
                   v-for="item in agentList"
                   :key="item.id"
@@ -144,7 +144,7 @@
         </el-form-item>
       </el-form>
       <template>已发卡代理商</template>
-      <el-table  v-loading="loading"  :data="makeCardList"  stripe   border  highlight-current-row style="width: 100%" >
+      <el-table  v-loading="cardLoading"  :data="makeCardList"  stripe   border  highlight-current-row style="width: 100%" >
         <el-table-column label="名称" align="center" prop="makeCardName" />
         <el-table-column label="代理商" align="center" prop="agentName"/>
 
@@ -155,15 +155,23 @@
           </template>
         </el-table-column>
         <el-table-column label="发卡数量" align="center" prop="num"/>
-        <el-table-column label="发卡时间" align="center" prop="createtime"/>
+        <el-table-column label="发卡时间" align="center" prop="createTime"/>
       </el-table>
 
+      <pagination
+        v-show="total>0"
+        :total="total"
+        :page.sync="cardParams.pageNum"
+        :limit.sync="cardParams.pageSize"
+        @pagination="getList"
+      />
+
     </el-dialog>
   </div>
 </template>
 
 <script>
-import { getList,addCard1,getInfo,sendCard } from "@/api/module/makeCard";
+import { getList,addCard1,getInfo,sendCard, addMakeCard, getMakeCardList } from "@/api/module/makeCard";
 
 export default {
   name: "makeCard",
@@ -187,6 +195,7 @@ export default {
       agentList: [],
       // 遮罩层
       loading: true,
+      cardLoading: true,
       // 选中数组
       ids: [],
       // 非单个禁用
@@ -215,6 +224,11 @@ export default {
         reciveNum: undefined,
         makeCardName: undefined
       },
+      cardParams: {
+        pageNum: 1,
+        pageSize: 10,
+        makeId: undefined
+      },
       // 表单参数
       form: {
       },
@@ -247,16 +261,26 @@ export default {
       const index = this.sendCardList.indexOf(row);
       this.sendCardList.splice(index, 1);
     },
-
+    handleCouponQuery() {
+      this.getList();
+    },
     /** 查询列表 */
     getList() {
       this.loading = true;
-      getList(this.couponParams).then(response => {
+      getList(this.queryParams).then(response => {
         this.makeList = response.rows;
         this.totalMakeCard = response.total;
         this.loading = false;
       });
     },
+    getCardList() {
+      this.cardLoading = true;
+      getMakeCardList(this.cardParams).then(response => {
+        this.makeCardList = response.rows;
+        this.total = response.total;
+        this.cardLoading = false;
+      });
+    },
     // 取消按钮
     cancel() {
       this.open = false;
@@ -307,14 +331,19 @@ export default {
           flag = true;
         }
       });
-      if(sum > this.maxCardNum) {
-        this.$message.error('发卡数量超过总数量' + this.maxCardNum + '张!');
-        return;
-      }
       if(flag) {
         this.$message.error('参数不能为空!');
         return;
       }
+      if(sum > this.maxCardNum) {
+        this.$message.error('发卡数量超过总数量' + this.maxCardNum + '张!');
+        return;
+      }
+
+      addMakeCard(this.sendCardList).then(response => {
+        this.msgSuccess("新增成功");
+        this.getCardList();
+      });
     },
     gotoInfo(row){
       this.reset();
@@ -322,33 +351,31 @@ export default {
       this.title = "制卡";
       this.maxCardNum = row.cardNum - row.num
       this.sendCardList = [],
-      this.sendCardList.push(this.form1);
+      this.form1.makeId = row.id
+      this.cardParams.makeId = row.id
+      this.sendCardList.push(JSON.parse(JSON.stringify(this.form1)));
       getInfo(row.id).then(response => {
         this.cardType1 = response.data.cardType;
         this.cardName1 = response.data.makeCardName;
       });
+      this.getCardList();
     },
 
     addf(row){
-      //  form1.sendFormCardList =null;
+        //  form1.sendFormCardList =null;
         // form1.agentName = this.agentLable;
-        this.form1 = {
-          agentId: '',
-          num: '',
-          agentName: ''
-        };
         console.log(JSON.stringify(this.sendCardList));
-        this.sendCardList.push(this.form1);
+        this.sendCardList.push(JSON.parse(JSON.stringify(this.form1)));
     },
-    changeLocationValue(val){
-      //locations是v-for里面的也是datas里面的值
-      let obj = {};
-      obj = this.agentList.find((item)=>{
-        return item.id === val;
-      });
-       this.agentLable = obj.agentName;
+    // changeLocationValue(val){
+    //   //locations是v-for里面的也是datas里面的值
+    //   let obj = {};
+    //   obj = this.agentList.find((item)=>{
+    //     return item.id === val;
+    //   });
+    //    this.agentLable = obj.agentName;
 
-    },
+    // },
   }
 };
 </script>