浏览代码

Merge remote-tracking branch 'origin/feature/relation_type_item' into feature/relation_type_item

lzm 3 年之前
父节点
当前提交
847280e31c

+ 12 - 1
sp-admin/sa-frame/menu-list.js

@@ -243,7 +243,18 @@ var menuList = [{
 		name: '作业管理',
 		icon: 'el-icon-edit-outline',
 		parent: true,
-		childList: [{
+		childList: [
+			{
+				id: 'tb-business-item-pick-list',
+				name: '我要接单',
+				url: 'sa-view/tb-partner/tb-business-pick-list.html',
+				childList: [{
+					id: 'tb-business-item-pick',
+					name: '接单',
+					isShow: false,
+				}]
+			},
+			{
 				id: 'tb-business-item-list',
 				name: '作业订单',
 				url: 'sa-view/tb-partner/tb-business-item-list.html',

+ 30 - 19
sp-admin/sa-view/tb-partner/tb-business-item-list.html

@@ -21,44 +21,44 @@
 				<!-- ------------- 检索参数 ------------- -->
 				<div class="c-title">检索参数</div>
 				<el-form ref="form" :model='p' @submit.native.prevent>
-<!--					<div class="c-item">-->
-<!--						<label class="c-label">业务类型:</label>-->
-<!--						<el-select v-model="p.businessType">-->
-<!--							<el-option label="消杀业务" value="1"></el-option>-->
-<!--							<el-option label="核酸业务" value="3"></el-option>-->
-<!--							<el-option label="整车业务" value="2"></el-option>-->
-<!--						</el-select>-->
-<!--					</div>-->
+
 					<sa-item type="text" name="项目名称" v-model="p.itemName"></sa-item>
 					<sa-item type="text" name="越南车" v-model="p.cardNo"></sa-item>
 					<sa-item type="text" name="中国车" v-model="p.chinaCarNo"></sa-item>
 					<sa-item type="text" name="货物" v-model="p.goodsName"></sa-item>
+					<div class="c-item">
+						<label class="c-label">业务项:</label>
+						<el-select v-model="p.goodsId" placeholder="请选择" filterable>
+							<el-option v-for="item in goodsList" :key="item.id" :label="item.name" :value="item.id">
+							</el-option>
+						</el-select>
+					</div>
 					<el-button type="primary" icon="el-icon-search" @click="p.pageNo = 1; f5()">查询</el-button>
-					<el-button style="display: inline;" type="info" icon="el-icon-refresh" @click="sa.f5()">刷新</el-button>
-					<br>
+					<el-button style="display: inline;" type="info" icon="el-icon-refresh" @click="sa.f5()">刷新
+					</el-button>
+					<el-button type="warning" icon="el-icon-download" @click="exportFn()">导出</el-button>
 
+					<br>
 				</el-form>
 				<!-- ------------- 快捷按钮 ------------- -->
 				<div class="fast-btn">
 
-					<el-button type="warning" icon="el-icon-download" @click="exportFn()">导出</el-button>
-					<slot></slot>
 				</div>
 				<!-- ------------- 数据列表 ------------- -->
 				<el-table class="data-table" ref="data-table" :data="dataList">
 					<sa-td name="单号" prop="no" width="160"></sa-td>
-					<sa-td name="货物" prop="goodsName"></sa-td>
+					<sa-td name="业务项" prop="goodsName" width="120"></sa-td>
+					<sa-td name="收费类型" prop="itemTypeName" width="120"></sa-td>
+					<sa-td name="收费项" prop="itemName" width="140"></sa-td>
 					<sa-td name="越南车" prop="cardNo"></sa-td>
 					<sa-td name="中国车" prop="chinaCarNo"></sa-td>
 					<sa-td name="作业公司" prop="pickCustomerName"></sa-td>
-					<sa-td name="车型" prop="itemName" width="120"></sa-td>
-					<sa-td name="类型" prop="itemTypeName" width="120"></sa-td>
 					<sa-td name="计费标准" prop="unit">
 						<template slot-scope="s">
 							{{s.row.itemPrice}}{{s.row.unit}}
 						</template>
 					</sa-td>
-				<!-- 	<sa-td name="状态" prop="status" type="enum" :jv="{0: '未完成', 1: '已完成'}"></sa-td>
+					<!-- 	<sa-td name="状态" prop="status" type="enum" :jv="{0: '未完成', 1: '已完成'}"></sa-td>
 					<sa-td name="作业时间" prop="operateTime"></sa-td> -->
 					<sa-td name="创建时间" prop="createTime" width="160"></sa-td>
 					<sa-td name="接单时间" prop="pickTime" width="160"></sa-td>
@@ -112,6 +112,7 @@
 						cardNo: '',
 						chinaCarNo: '',
 						businessType: '',
+						goodsId: '',
 						goodsName: '',
 						pageNo: 1, // 当前页 
 						pageSize: 10, // 页大小 
@@ -119,7 +120,9 @@
 					},
 					dataCount: 0,
 					dataList: [], // 数据集合 
+					goodsList:[],
 					currentCustomerId: '1',
+					itemTypeList: [],
 					confirm: {
 						visible: false,
 						form: {
@@ -136,6 +139,13 @@
 					dataTime: [],
 				},
 				methods: {
+					getGoods: function() {
+						sa.ajax('/TbGoods/all', sa.removeNull(this.p), function(res) {
+							let list=[{id:'',name:'全部'}];
+							list=list.concat(res.data)
+							this.goodsList =list ; // 数据
+						}.bind(this));
+					},
 					exportFn() {
 						Object.assign(this.emodel, {
 							visible: true,
@@ -145,11 +155,11 @@
 						if (this.dataTime.length != 0) {
 							this.emodel.form.beginTime = this.dataTime[0];
 							this.emodel.form.endTime = this.dataTime[1];
-						} else{
+						} else {
 							sa.msg("请选择日期范围");
 							return;
 						}
-						sa.ajax('/TbBusinessItem/export/items', this.emodel.form,  function(resp) {
+						sa.ajax('/TbBusinessItem/export/items', this.emodel.form, function(resp) {
 							window.open(resp.data);
 							this.emodel.visible = false;
 						}.bind(this));
@@ -216,7 +226,8 @@
 					},
 				},
 				created: function() {
-					this.getCustomer()
+					this.getCustomer();
+					this.getGoods();
 					this.f5();
 					sa.onInputEnter();
 				}

+ 215 - 0
sp-admin/sa-view/tb-partner/tb-business-pick-list.html

@@ -0,0 +1,215 @@
+<!DOCTYPE html>
+<html>
+	<head>
+		<title>业务作业项-列表</title>
+		<meta charset="utf-8">
+		<meta name="viewport"
+			content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
+		<!-- 所有的 css & js 资源 -->
+		<link rel="stylesheet" href="../../static/kj/element-ui/theme-chalk/index.css">
+		<link rel="stylesheet" href="../../static/sa.css">
+		<script src="../../static/kj/vue.min.js"></script>
+		<script src="../../static/kj/element-ui/index.js"></script>
+		<script src="../../static/kj/httpVueLoader.js"></script>
+		<script src="../../static/kj/jquery.min.js"></script>
+		<script src="../../static/kj/layer/layer.js"></script>
+		<script src="../../static/sa.js"></script>
+	</head>
+	<body>
+		<div class="vue-box" style="display: none;" :style="'display: block;'">
+			<div class="c-panel">
+				<!-- ------------- 检索参数 ------------- -->
+				<div class="c-title">检索参数</div>
+				<el-form ref="form" :model='p' @submit.native.prevent>
+					<sa-item type="text" name="项目名称" v-model="p.itemName"></sa-item>
+					<sa-item type="text" name="越南车" v-model="p.cardNo"></sa-item>
+					<sa-item type="text" name="中国车" v-model="p.chinaCarNo"></sa-item>
+					<sa-item type="text" name="货物" v-model="p.goodsName"></sa-item>
+					<div class="c-item">
+						<label class="c-label">业务项:</label>
+						<el-select v-model="p.goodsId" placeholder="请选择" filterable>
+							<el-option v-for="item in goodsList" :key="item.id" :label="item.name" :value="item.id">
+							</el-option>
+						</el-select>
+					</div>
+					<el-button type="primary" icon="el-icon-search" @click="p.pageNo = 1; f5()">查询</el-button>
+					<el-button style="display: inline;" type="info" icon="el-icon-refresh" @click="sa.f5()">刷新
+					</el-button>
+					<br>
+				</el-form>
+				<!-- ------------- 快捷按钮 ------------- -->
+				<div class="fast-btn">
+
+				</div>
+				<!-- ------------- 数据列表 ------------- -->
+				<el-table class="data-table" ref="data-table" :data="dataList">
+					<sa-td name="单号" prop="no" width="160"></sa-td>
+					<sa-td name="业务项" prop="goodsName" width="120"></sa-td>
+					<sa-td name="收费类型" prop="itemTypeName" width="120"></sa-td>
+					<sa-td name="收费项" prop="itemName" width="140"></sa-td>
+					<sa-td name="越南车" prop="cardNo"></sa-td>
+					<sa-td name="中国车" prop="chinaCarNo"></sa-td>
+					<sa-td name="计费标准" prop="unit">
+						<template slot-scope="s">
+							{{s.row.itemPrice}}{{s.row.unit}}
+						</template>
+					</sa-td>
+					<sa-td name="创建时间" prop="createTime" width="160"></sa-td>
+					<el-table-column label="操作" fixed="right" width="200px">
+						<template slot-scope="s">
+							<el-button v-if="s.row.pick==0" class="c-btn" type="success" icon="el-icon-edit"
+								@click="confirmFn(s.row)">接单
+							</el-button>
+						</template>
+					</el-table-column>
+				</el-table>
+				<!-- ------------- 分页 ------------- -->
+				<sa-item type="page" :curr.sync="p.pageNo" :size.sync="p.pageSize" :total="dataCount" @change="f5()">
+				</sa-item>
+			</div>
+			<el-dialog title="提示" :visible.sync="confirm.visible" width="30%">
+				<span>是否确认接单?</span>
+				<span slot="footer" class="dialog-footer">
+					<el-button @click="confirm.visible = false">取 消</el-button>
+					<el-button type="primary" @click="sureConfirm">确 定</el-button>
+				</span>
+			</el-dialog>
+
+		</div>
+		<script>
+			var app = new Vue({
+				components: {
+					"sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue'),
+					"sa-td": httpVueLoader('../../sa-frame/com/sa-td.vue'),
+				},
+				el: '.vue-box',
+				data: {
+					p: { // 查询参数  
+						id: '', // 主键 
+						itemName: '', // 项目名称
+						cardNo: '',
+						chinaCarNo: '',
+						goodsId: '',
+						goodsName: '',
+						pageNo: 1, // 当前页 
+						pageSize: 10, // 页大小 
+						sortType: 10 // 排序方式
+					},
+					dataCount: 0,
+					dataList: [], // 数据集合 
+					currentCustomerId: '1',
+					goodsList: [],
+					confirm: {
+						visible: false,
+						form: {
+							id: ''
+						}
+					},
+					emodel: {
+						visible: false,
+						form: {
+							beginTime: '',
+							endTime: ''
+						}
+					},
+					dataTime: [],
+				},
+				methods: {
+					exportFn() {
+						Object.assign(this.emodel, {
+							visible: true,
+						})
+					},
+					sureExport() {
+						if (this.dataTime.length != 0) {
+							this.emodel.form.beginTime = this.dataTime[0];
+							this.emodel.form.endTime = this.dataTime[1];
+						} else {
+							sa.msg("请选择日期范围");
+							return;
+						}
+						sa.ajax('/TbBusinessItem/export/items', this.emodel.form, function(resp) {
+							window.open(resp.data);
+							this.emodel.visible = false;
+						}.bind(this));
+					},
+					confirmFn(data) {
+						Object.assign(this.confirm, {
+							visible: true,
+							form: {
+								id: data.id
+							}
+						})
+					},
+					sureConfirm() {
+						sa.ajax('/TbBusinessItem/pick', {
+							id: this.confirm.form.id
+						}, function(resp) {
+							this.confirm.visible = false;
+							sa.alert(resp.msg, this.f5);
+						}.bind(this));
+					},
+					getGoods: function() {
+						sa.ajax('/TbGoods/all', sa.removeNull(this.p), function(res) {
+							let list = [{
+								id: '',
+								name: '全部'
+							}];
+							list = list.concat(res.data)
+							this.goodsList = list; // 数据
+						}.bind(this));
+					},
+					getCustomer() {
+						sa.ajax('/TbCostomer/getCurrentCustomerId', function(resp) {
+							this.currentCustomerId = resp.data;
+						}.bind(this));
+					},
+					// 刷新
+					f5: function() {
+						sa.ajax('/TbBusinessItem/pickList', sa.removeNull(this.p), function(res) {
+							this.dataList = res.data; // 数据
+							this.dataCount = res.dataCount; // 数据总数 
+							sa.f5TableHeight(); // 刷新表格高度 
+						}.bind(this));
+					},
+					// 查看
+					get: function(data) {
+						sa.showIframe('数据详情', 'tb-business-item-info.html?id=' + data.id, '1050px', '90%');
+					},
+					// 查看 - 根据选中的
+					getBySelect: function(data) {
+						var selection = this.$refs['data-table'].selection;
+						if (selection.length == 0) {
+							return sa.msg('请选择一条数据')
+						}
+						this.get(selection[0]);
+					},
+					// 批量删除
+					deleteByIds: function() {
+						// 获取选中元素的id列表 
+						let selection = this.$refs['data-table'].selection;
+						let ids = sa.getArrayField(selection, 'id');
+						if (selection.length == 0) {
+							return sa.msg('请至少选择一条数据')
+						}
+						// 提交删除 
+						sa.confirm('是否批量删除选中数据?此操作不可撤销', function() {
+							sa.ajax('/TbBusinessItem/deleteByIds', {
+								ids: ids.join(',')
+							}, function(res) {
+								sa.arrayDelete(this.dataList, selection);
+								sa.ok('删除成功');
+								sa.f5TableHeight(); // 刷新表格高度 
+							}.bind(this))
+						}.bind(this));
+					},
+				},
+				created: function() {
+					this.getGoods()
+					this.f5();
+					sa.onInputEnter();
+				}
+			})
+		</script>
+	</body>
+</html>

+ 1 - 0
sp-server/pom.xml

@@ -154,6 +154,7 @@
 
 	<!-- 构建配置 -->
 	<build>
+		<finalName>server</finalName>
 		<!-- 配置资源目录  -->
 		<resources>
 			<resource>

+ 1 - 1
sp-server/src/main/java/com/pj/api/service/ApiService.java

@@ -262,7 +262,7 @@ public class ApiService {
         TbBusiness tbBusiness = tbBusinessService.getById(tbBusinessItem.getBusinessId());
         MsgDataBO msgDataBO = new MsgDataBO("订单号:" + tbBusinessItem.getNo(), tbCostomer.getName(), DateUtil.now(), tbBusiness.getGoodsName() + "(" + tbBusinessItem.getItemTypeName() + tbBusinessItem.getItemName() + ")");
         spAdminList.stream().filter(admin -> StrUtil.isNotEmpty(admin.getOpenid())).forEach(admin -> {
-            String detailUrl = myConfig.getWebDomain() + "/pages/business-order/business-item?id=" + tbBusiness.getId() + "&itemId=" + tbBusinessItem.getId() + "&openid=" + openid;
+            String detailUrl = myConfig.getWebDomain() + "/pages/business-order/business-item?id=" + tbBusiness.getId() + "&itemId=" + tbBusinessItem.getId() + "&openid=" + admin.getOpenid();
             log.info("admin confirm business:[{}]", detailUrl);
             wxService.sendTemplateMsg(wxConfig.getBusinessPickTemplate(), admin.getOpenid(), msgDataBO, detailUrl);
         });

+ 32 - 8
sp-server/src/main/java/com/pj/project/tb_business_item/TbBusinessItemController.java

@@ -5,6 +5,8 @@ import java.util.List;
 import cn.hutool.core.util.StrUtil;
 import com.pj.constants.UserTypeEnum;
 import com.pj.project.tb_business.TbBusiness;
+import com.pj.project.tb_costomer.TbCostomer;
+import com.pj.project.tb_costomer.TbCostomerService;
 import com.pj.utils.so.SoMap;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
@@ -16,6 +18,7 @@ import com.pj.project4sp.SP;
 import com.pj.current.satoken.StpUserUtil;
 import cn.dev33.satoken.annotation.SaCheckPermission;
 
+import javax.annotation.Resource;
 import javax.servlet.http.HttpServletResponse;
 
 
@@ -33,6 +36,8 @@ public class TbBusinessItemController {
      */
     @Autowired
     TbBusinessItemService tbBusinessItemService;
+    @Resource
+    private TbCostomerService tbCostomerService;
 
     /**
      * 改
@@ -51,15 +56,16 @@ public class TbBusinessItemController {
         TbBusinessItem t = tbBusinessItemService.getById(id);
         return AjaxJson.getSuccessData(t);
     }
+
     /**
      * 查 - 根据id
      */
     @RequestMapping("confirm")
     public AjaxJson confirm(Long id) {
-        if (!StrUtil.equals(UserTypeEnum.PLATFORM_ADMIN.getCustomerId(),StpUserUtil.getCustomerId())){
+        if (!StrUtil.equals(UserTypeEnum.PLATFORM_ADMIN.getCustomerId(), StpUserUtil.getCustomerId())) {
             return AjaxJson.getError("无确认权限");
         }
-         tbBusinessItemService.confirmBusinessItem(id);
+        tbBusinessItemService.confirmBusinessItem(id);
         return AjaxJson.getSuccess();
     }
 
@@ -69,23 +75,43 @@ public class TbBusinessItemController {
     @RequestMapping("getList")
     public AjaxJson getList() {
         SoMap so = SoMap.getRequestSoMap();
-        if (StrUtil.isEmpty(so.getString("businessId"))){
-            so.put("typeFlag",1);
+        if (StrUtil.isEmpty(so.getString("businessId"))) {
+            so.put("typeFlag", 1);
         }
         String customerId = StpUserUtil.getCustomerId();
         if (!StrUtil.equals(customerId, UserTypeEnum.PLATFORM_ADMIN.getCustomerId())) {
             so.put("pickCustomerId", customerId);
+            so.put("sortType", "12");
+        }
+        List<TbBusinessItem> list = tbBusinessItemService.getList(so.startPage());
+        return AjaxJson.getPageData(so.getDataCount(), list);
+    }
+
+    @RequestMapping("pickList")
+    public AjaxJson pickList() {
+        SoMap so = SoMap.getRequestSoMap();
+        String customerId = StpUserUtil.getCustomerId();
+        if (!StrUtil.equals(customerId, UserTypeEnum.PLATFORM_ADMIN.getCustomerId())) {
+            TbCostomer tbCostomer = tbCostomerService.getById(customerId);
+            List<String> typeList = StrUtil.splitTrim(tbCostomer.getType(), ",");
+            so.put("typeList", typeList);
+            so.put("sortType", 10);
         }
         List<TbBusinessItem> list = tbBusinessItemService.getList(so.startPage());
         return AjaxJson.getPageData(so.getDataCount(), list);
     }
 
 
+    @RequestMapping("pick")
+    public AjaxJson pick() {
+        SoMap soMap = SoMap.getRequestSoMap();
+        return tbBusinessItemService.pick(soMap.getLong("id"), StpUserUtil.getCustomerId());
+    }
 
     @RequestMapping("export/items")
-    public AjaxJson exportItems(HttpServletResponse response) throws Exception{
+    public AjaxJson exportItems(HttpServletResponse response) throws Exception {
         SoMap so = SoMap.getRequestSoMap();
-        so.put("typeFlag",1);
+        so.put("typeFlag", 1);
         String customerId = StpUserUtil.getCustomerId();
         if (!StrUtil.equals(customerId, UserTypeEnum.PLATFORM_ADMIN.getCustomerId())) {
             so.put("pickCustomerId", customerId);
@@ -95,6 +121,4 @@ public class TbBusinessItemController {
     }
 
 
-
-
 }

+ 74 - 71
sp-server/src/main/java/com/pj/project/tb_business_item/TbBusinessItemMapper.xml

@@ -2,17 +2,16 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.pj.project.tb_business_item.TbBusinessItemMapper">
 
-	<!-- 增 [G] -->
-	<insert id="add">
+    <!-- 增 [G] -->
+    <insert id="add">
 		insert into 
 		tb_business_item (id, business_id, item_code, item_price, item_name, status, operate_time, operaror) 
 		values (#{id}, #{businessId}, #{itemCode}, #{itemPrice}, #{itemName}, #{status}, #{operateTime}, #{operaror}) 
 	</insert>
 
 
-
-	<!-- 改 [G] -->
-	<update id="update">
+    <!-- 改 [G] -->
+    <update id="update">
 		update tb_business_item set
 		id = #{id}, 
 		business_id = #{businessId}, 
@@ -26,78 +25,82 @@
 	</update>
 
 
-	<!-- ================================== 查询相关 ================================== -->
+    <!-- ================================== 查询相关 ================================== -->
+
 
-	
-	<!-- 通用映射:手动模式 -->
-	<resultMap id="model" type="com.pj.project.tb_business_item.TbBusinessItem">
-		<result property="id" column="id" />
-		<result property="businessId" column="business_id" />
-		<result property="itemCode" column="item_code" />
-		<result property="itemPrice" column="item_price" />
-		<result property="itemName" column="item_name" />
-		<result property="status" column="status" />
-		<result property="operateTime" column="operate_time" />
-		<result property="operaror" column="operaror" />
-	</resultMap>
-	
-	<!-- 公共查询sql片段 -->
-	<sql id="select_sql">
+    <!-- 通用映射:手动模式 -->
+    <resultMap id="model" type="com.pj.project.tb_business_item.TbBusinessItem">
+        <result property="id" column="id"/>
+        <result property="businessId" column="business_id"/>
+        <result property="itemCode" column="item_code"/>
+        <result property="itemPrice" column="item_price"/>
+        <result property="itemName" column="item_name"/>
+        <result property="status" column="status"/>
+        <result property="operateTime" column="operate_time"/>
+        <result property="operaror" column="operaror"/>
+    </resultMap>
+
+    <!-- 公共查询sql片段 -->
+    <sql id="select_sql">
 		select a.*,b.goods_name,b.card_no,b.china_car_no
 		from tb_business_item a,tb_business b where a.business_id=b.id
 	</sql>
-	
-	<!-- 查 - 根据id -->
-	<select id="getById" resultMap="model">
+
+    <!-- 查 - 根据id -->
+    <select id="getById" resultMap="model">
 		select * from tb_busness
 		where id = #{id}
 	</select>
-	
-	<!-- 查集合 - 根据条件(参数为空时代表忽略指定条件) [G] -->
-	<select id="getList" resultType="com.pj.project.tb_business_item.TbBusinessItem">
-		select a.*,b.goods_name,b.card_no,b.china_car_no,b.business_type
-		from tb_business_item a,tb_business b where a.business_id=b.id
-			<if test=' this.has("id") '> and a.id = #{id} </if>
-			<if test=' this.has("businessId") '> and a.business_id = #{businessId} </if>
-			<if test=' this.has("pickCustomerId") '> and a.pick_customer_id = #{pickCustomerId} </if>
-			<if test=' this.has("itemCode") '> and a.item_code = #{itemCode} </if>
-			<if test=' this.has("itemPrice") '> and a.item_price = #{itemPrice} </if>
-			<if test=' this.has("itemName") '> and a.item_name like concat('%',#{itemName},'%') </if>
-			<if test=' this.has("status") '> and a.status = #{status} </if>
-			<if test=' this.has("operateTime") '> and a.operate_time = #{operateTime} </if>
-			<if test=' this.has("operaror") '> and a.operaror = #{operaror} </if>
-			<if test=' this.has("typeFlag") '> and a.business_type !='0' </if>
-            <if test=' this.has("beginTime") and this.has("endTime") '>
-                 and date_format(a.create_time,'%Y-%m-%d') >= #{beginTime}
-                 and date_format(a.create_time,'%Y-%m-%d')  &lt;= #{endTime}
-            </if>
-        <if test=' this.has("cardNo") '> and b.card_no like concat('%',#{cardNo},'%') </if>
-        <if test=' this.has("chinaCarNo") '> and b.china_car_no like concat('%',#{chinaCarNo},'%') </if>
-        <if test=' this.has("businessType") '> and b.business_type = #{businessType} </if>
-        <if test=' this.has("goodsName") '> and b.goods_name like concat('%',#{goodsName},'%') </if>
-		order by
-		<choose>
-			<when test='sortType == 1'> a.id desc </when>
-			<when test='sortType == 2'> a.business_id desc </when>
-			<when test='sortType == 3'> a.item_code desc </when>
-			<when test='sortType == 4'> a.item_price desc </when>
-			<when test='sortType == 5'> a.item_name desc </when>
-			<when test='sortType == 6'> a.status desc </when>
-			<when test='sortType == 7'> a.operate_time desc </when>
-			<when test='sortType == 8'> a.operaror desc </when>
-			<when test='sortType == 9'> a.pick_time desc </when>
-			<when test='sortType == 10'> a.create_time desc </when>
-			<otherwise> a.id desc </otherwise>
-		</choose>
-	</select>
-	
-	
-	
-	
-	
-	
-	
-	
-	
+
+    <!-- 查集合 - 根据条件(参数为空时代表忽略指定条件) [G] -->
+    <select id="getList" resultType="com.pj.project.tb_business_item.TbBusinessItem">
+        select a.*,b.goods_name,b.card_no,b.china_car_no,b.business_type
+        from tb_business_item a,tb_business b where a.business_id=b.id
+        <if test=' this.has("id") '>and a.id = #{id}</if>
+        <if test=' this.has("goodsId") '>and b.goods_id = #{goodsId}</if>
+        <if test=' this.has("businessId") '>and a.business_id = #{businessId}</if>
+        <if test=' this.has("pickCustomerId") '>and a.pick_customer_id = #{pickCustomerId}</if>
+        <if test=' this.has("itemCode") '>and a.item_code = #{itemCode}</if>
+        <if test=' this.has("itemPrice") '>and a.item_price = #{itemPrice}</if>
+        <if test=' this.has("itemName") '>and a.item_name like concat('%',#{itemName},'%')</if>
+        <if test=' this.has("status") '>and a.status = #{status}</if>
+        <if test=' this.has("operateTime") '>and a.operate_time = #{operateTime}</if>
+        <if test=' this.has("operaror") '>and a.operaror = #{operaror}</if>
+        <if test=' this.has("typeFlag") '>and a.business_type !='0'</if>
+        <if test=' this.has("beginTime") and this.has("endTime") '>
+            and date_format(a.create_time,'%Y-%m-%d') >= #{beginTime}
+            and date_format(a.create_time,'%Y-%m-%d') &lt;= #{endTime}
+        </if>
+        <if test=' this.has("cardNo") '>and b.card_no like concat('%',#{cardNo},'%')</if>
+        <if test=' this.has("chinaCarNo") '>and b.china_car_no like concat('%',#{chinaCarNo},'%')</if>
+        <if test=' this.has("itemTypeId") '>and a.item_type_id = #{itemTypeId}</if>
+        <if test=' this.has("businessType") '>and b.business_type = #{businessType}</if>
+        <if test=' this.has("goodsName") '>and b.goods_name like concat('%',#{goodsName},'%')</if>
+        <if test="typeList !=null and typeList.size>0">
+            and a.pick=0
+            and b.confirm_input=1
+            and a.business_type in
+            <foreach collection="typeList" item="type" open="(" close=")" separator=",">
+                    #{type}
+            </foreach>
+        </if>
+        order by
+        <choose>
+            <when test='sortType == 1'>a.id desc</when>
+            <when test='sortType == 2'>a.business_id desc</when>
+            <when test='sortType == 3'>a.item_code desc</when>
+            <when test='sortType == 4'>a.item_price desc</when>
+            <when test='sortType == 5'>a.item_name desc</when>
+            <when test='sortType == 6'>a.status desc</when>
+            <when test='sortType == 7'>a.operate_time desc</when>
+            <when test='sortType == 8'>a.operaror desc</when>
+            <when test='sortType == 9'>a.pick_time desc</when>
+            <when test='sortType == 10'>a.create_time desc</when>
+            <when test='sortType == 11'>a.pick asc</when>
+            <when test='sortType == 12'>a.pick_time desc</when>
+            <otherwise>a.id desc</otherwise>
+        </choose>
+    </select>
+
 
 </mapper>

+ 34 - 2
sp-server/src/main/java/com/pj/project/tb_business_item/TbBusinessItemService.java

@@ -15,17 +15,21 @@ import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.pj.api.wx.bo.MsgDataBO;
 import com.pj.api.wx.service.WxService;
+import com.pj.constants.UserTypeEnum;
 import com.pj.current.config.MyConfig;
 import com.pj.current.config.WxConfig;
 import com.pj.current.task.TaskService;
 import com.pj.project.tb_business.TbBusiness;
 import com.pj.project.tb_business.TbBusinessService;
+import com.pj.project.tb_costomer.TbCostomer;
+import com.pj.project.tb_costomer.TbCostomerService;
 import com.pj.project.tb_fee_details.TbFeeDetails;
 import com.pj.project.tb_fee_details.TbFeeDetailsService;
 import com.pj.project4sp.admin.SpAdmin;
 import com.pj.project4sp.admin.SpAdminService;
 import com.pj.project4sp.uploadfile.UploadUtil;
 import com.pj.utils.so.SoMap;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
@@ -42,6 +46,7 @@ import javax.annotation.Resource;
  */
 @Service
 @Transactional
+@Slf4j
 public class TbBusinessItemService extends ServiceImpl<TbBusinessItemMapper, TbBusinessItem> implements IService<TbBusinessItem> {
 
     /**
@@ -67,6 +72,8 @@ public class TbBusinessItemService extends ServiceImpl<TbBusinessItemMapper, TbB
 
     @Resource
     TbFeeDetailsService tbFeeDetailsService;
+    @Resource
+    private TbCostomerService tbCostomerService;
 
     /**
      * 增
@@ -113,7 +120,6 @@ public class TbBusinessItemService extends ServiceImpl<TbBusinessItemMapper, TbB
     }
 
 
-
     public void confirmBusinessItem(long id) {
         TbBusinessItem tbBusinessItem = this.getById(id);
         tbBusinessItem.setConfirm(1).setConfirmTime(new Date());
@@ -166,11 +172,37 @@ public class TbBusinessItemService extends ServiceImpl<TbBusinessItemMapper, TbB
     }
 
     public List<TbBusinessItem> findByBusinessIdList(List<String> businessIdList) {
-        if (businessIdList.isEmpty()){
+        if (businessIdList.isEmpty()) {
             return Collections.emptyList();
         }
         QueryWrapper<TbBusinessItem> ew = new QueryWrapper<>();
         ew.in("business_id", businessIdList);
         return list(ew);
     }
+
+    public AjaxJson pick(long id, String customerId) {
+        log.info("pc 端接单:{},{}",id,customerId);
+        TbBusinessItem tbBusinessItem = this.getById(id);
+        if (tbBusinessItem == null) {
+            return AjaxJson.getError("业务项目或已被删除");
+        }
+        if (tbBusinessItem.getPick() == 1) {
+            return AjaxJson.getError("您慢了一步,其他用户已接单");
+        }
+        TbCostomer tbCostomer = tbCostomerService.getById(customerId);
+        tbBusinessItem.setPick(1).setPickTime(new Date())
+                .setPickCustomerId(tbCostomer.getId())
+                .setPickCustomerName(tbCostomer.getName());
+        this.updateById(tbBusinessItem);
+        //todo 通知录入人员 已接单
+        List<SpAdmin> spAdminList = spAdminService.findByCustomerId(UserTypeEnum.PLATFORM_ADMIN.getCustomerId());
+        TbBusiness tbBusiness = tbBusinessService.getById(tbBusinessItem.getBusinessId());
+        MsgDataBO msgDataBO = new MsgDataBO("订单号:" + tbBusinessItem.getNo(), tbCostomer.getName(), DateUtil.now(), tbBusiness.getGoodsName() + "(" + tbBusinessItem.getItemTypeName() + tbBusinessItem.getItemName() + ")");
+        spAdminList.stream().filter(admin -> StrUtil.isNotEmpty(admin.getOpenid())).forEach(admin -> {
+            String detailUrl = myConfig.getWebDomain() + "/pages/business-order/business-item?id=" + tbBusiness.getId() + "&itemId=" + tbBusinessItem.getId() + "&openid=" + admin.getOpenid();
+            log.info("admin confirm business:[{}]", detailUrl);
+            wxService.sendTemplateMsg(wxConfig.getBusinessPickTemplate(), admin.getOpenid(), msgDataBO, detailUrl);
+        });
+        return AjaxJson.getSuccess("接单成功");
+    }
 }

+ 7 - 0
sp-server/src/main/java/com/pj/project/tb_goods/TbGoodsController.java

@@ -97,6 +97,13 @@ public class TbGoodsController {
         list=  list.stream().filter(tbGoods -> StrUtil.splitTrim(tbCostomer.getBusinessType(),",").contains(tbGoods.getId())).collect(Collectors.toList());
         return AjaxJson.getPageData(so.getDataCount(), list);
     }
+    /**
+     * 查集合 - 根据条件(参数为空时代表忽略指定条件)
+     */
+    @RequestMapping("all")
+    public AjaxJson getAll() {
+        return AjaxJson.getSuccessData( tbGoodsService.list());
+    }
 
 
     /**

+ 0 - 1
sp-server/src/main/java/com/pj/project4sp/role4permission/SpRolePermissionService.java

@@ -41,7 +41,6 @@ public class SpRolePermissionService {
      * [T] 修改角色的一组权限关系	【清除缓存 】
      */
     @Transactional(rollbackFor = Exception.class)
-    @CacheEvict(value= {"api_pcode_list", "api_pcode_list2"}, key="#roleId")	
     public int updateRoleMenu(long roleId, String[] pcodeArray){
 
     	// 万一为空