Pārlūkot izejas kodu

合作伙伴角色加入

qzyReal 3 gadi atpakaļ
vecāks
revīzija
32867c3379
28 mainītis faili ar 255 papildinājumiem un 128 dzēšanām
  1. 1 1
      app/pages/business-entering/business-edit.vue
  2. 1 1
      app/pages/business-entering/business-entering.vue
  3. 10 2
      app/pages/business-item/item-detail.vue
  4. 2 2
      app/utils/request.js
  5. 2 2
      sp-admin/sa-frame/menu-list.js
  6. 1 1
      sp-admin/sa-view-sp/sp-role/menu-setup.html
  7. 2 1
      sp-admin/sa-view/tb-business/tb-business-add.html
  8. 2 1
      sp-admin/sa-view/tb-business/tb-business-edit.html
  9. 19 20
      sp-admin/sa-view/tb-item/tb-item-list.html
  10. 46 11
      sp-admin/sa-view/tb-partner/tb-business-item-list.html
  11. 6 5
      sp-admin/sa-view/tb-partner/tb-partner-add.html
  12. 1 1
      sp-admin/static/sa.js
  13. 1 1
      sp-server/app.pid
  14. 5 0
      sp-server/src/main/java/com/pj/api/h5/ApiController.java
  15. 8 16
      sp-server/src/main/java/com/pj/api/service/ApiService.java
  16. 2 2
      sp-server/src/main/java/com/pj/current/SaPlusStartup.java
  17. 13 8
      sp-server/src/main/java/com/pj/project/tb_business/TbBusinessService.java
  18. 3 0
      sp-server/src/main/java/com/pj/project/tb_business_item/TbBusinessItem.java
  19. 12 0
      sp-server/src/main/java/com/pj/project/tb_business_item/TbBusinessItemController.java
  20. 2 0
      sp-server/src/main/java/com/pj/project/tb_business_item/TbBusinessItemMapper.xml
  21. 88 38
      sp-server/src/main/java/com/pj/project/tb_business_item/TbBusinessItemService.java
  22. 5 5
      sp-server/src/main/java/com/pj/project/tb_costomer/TbCostomer.java
  23. 1 1
      sp-server/src/main/java/com/pj/project/tb_costomer/TbCostomerMapper.java
  24. 1 1
      sp-server/src/main/java/com/pj/project/tb_costomer/TbCostomerMapper.xml
  25. 1 1
      sp-server/src/main/java/com/pj/project/tb_costomer/TbCostomerService.java
  26. 1 1
      sp-server/src/main/java/com/pj/project/tb_item_type/TbItemType.java
  27. 18 5
      sp-server/src/main/java/com/pj/project4sp/admin4login/SpAccAdminService.java
  28. 1 1
      sp-server/src/main/resources/application-dev.yml

+ 1 - 1
app/pages/business-entering/business-edit.vue

@@ -590,7 +590,7 @@
 
 			},
 			getCustomerList() {
-				this.$api.getCustomerList().then(resp => {
+				this.$api.getCustomerList({type:0}).then(resp => {
 					this.customer.customerList = resp.data;
 				})
 			},

+ 1 - 1
app/pages/business-entering/business-entering.vue

@@ -537,7 +537,7 @@
 
 			},
 			getCustomerList() {
-				this.$api.getCustomerList().then(resp => {
+				this.$api.getCustomerList({type:0}).then(resp => {
 					this.customer.customerList = resp.data;
 				})
 			},

+ 10 - 2
app/pages/business-item/item-detail.vue

@@ -40,7 +40,7 @@
 					</view>
 				</view>
 				<view class="c" v-if="businessItem.pick==1">
-					<view class="item" >
+					<view class="item">
 						<text class="p1">确认状态:</text>
 						<text class="p2">
 							<text v-if="businessItem.confirm==1">已确认</text>
@@ -49,7 +49,7 @@
 					</view>
 				</view>
 				<view class="c" v-if="businessItem.confirm==1">
-					<view class="item" >
+					<view class="item">
 						<text class="p1">确认时间:</text>
 						<text class="p2">
 							<text>{{businessItem.confirmTime}}</text>
@@ -88,6 +88,14 @@
 				this.$api.getBusinessItem({
 					id: this.businessItem.id
 				}).then(resp => {
+					let data = resp.data;
+					if (!data) {
+						this.$common.toast('该业务已取消或删除');
+						setTimeout(() => {
+							this.$common.to('/pages/index/index')
+						}, 2000)
+						return;
+					}
 					this.businessItem = resp.data;
 				})
 			},

+ 2 - 2
app/utils/request.js

@@ -1,6 +1,6 @@
-const server = 'http://127.0.0.1:8099/pro';
+// const server = 'http://127.0.0.1:8099/pro';
 // const server = 'http://47.101.143.145/pro';
-// const server = 'https://dxkaa1.bgigc.com/pro';
+const server = 'https://dxkaa1.bgigc.com/pro';
 
 import common from '../common/js/common.js';
 

+ 2 - 2
sp-admin/sa-frame/menu-list.js

@@ -39,9 +39,9 @@ var menuList =	[
 		id: 'tb-business-item',
 		name: '业务管理',
 		icon: 'el-icon-edit-outline',
-		info: '我的业务',
+		info: '业务订单',
 		childList: [
-			{id: 'tb-business-item-list', name: '我的业务', url: 'sa-view/tb-partner/tb-business-item-list.html'},
+			{id: 'tb-business-item-list', name: '业务订单', url: 'sa-view/tb-partner/tb-business-item-list.html'},
 		]
 	},
 	{

+ 1 - 1
sp-admin/sa-view-sp/sp-role/menu-setup.html

@@ -58,7 +58,7 @@
 				<el-button @click="sa.closeCurrIframe()">取消</el-button>
 			</div>
 		</div>
-		<script src="../../sa-frame/menu-list.js?v=232167483"></script> 
+		<script src="../../sa-frame/menu-list.js?v=32648732"></script> 
 		<script src="../../sa-frame/menu-list-sp.js"></script> 
 		<script src="../../sa-frame/index/admin-util.js"></script>
         <script>

+ 2 - 1
sp-admin/sa-view/tb-business/tb-business-add.html

@@ -681,7 +681,8 @@
 						sa.ajax('/TbCostomer/getList', {
 							pageNo: 1,
 							pageSize: 100,
-							judgeStatus: 2
+							judgeStatus: 2,
+							type:0
 						}, function(resp) {
 							this.customerList = resp.data;
 							if (resp.data.length > 0) {

+ 2 - 1
sp-admin/sa-view/tb-business/tb-business-edit.html

@@ -581,7 +581,8 @@
 						sa.ajax('/TbCostomer/getList', {
 							pageNo: 1,
 							pageSize: 100,
-							judgeStatus: 2
+							judgeStatus: 2,
+							type:0
 						}, function(resp) {
 							this.customerList = resp.data;
 							if (resp.data.length > 0) {

+ 19 - 20
sp-admin/sa-view/tb-item/tb-item-list.html

@@ -29,31 +29,25 @@
 				<!-- ------------- 数据列表 ------------- -->
 				<el-table class="data-table" ref="data-table" :data="dataList">
 					<sa-td name="项目名称" prop="name" width="300px"></sa-td>
-					<sa-td name="项目编号" prop="code"></sa-td>
-					<sa-td name="收费项" prop="code">
-						<template slot-scope="s">
-							<el-select v-model="s.row.items[0].id" placeholder="收费项">
-								<el-option v-for="item in s.row.items" :key="item.id" :value="item.id"
-									:label="item.itemName+' '+item.price+item.unit">
-								</el-option>
-							</el-select>
-						</template>
-					</sa-td>
 					<sa-td name="业务类型" prop="businessType">
 						<template slot-scope="s">
-							<el-select v-model="s.row.businessType" placeholder="收费项" @change="businessChange(s.row)">
+							<el-select multiple v-model="s.row.type" placeholder="收费项" @change="businessChange(s.row)">
 								<el-option v-for="item in businessTypeList" :key="item.value" :value="item.value"
 									:label="item.name">
 								</el-option>
 							</el-select>
 						</template>
 					</sa-td>
-					<!-- <el-table-column label="操作" fixed="right" width="240px">
+					<!-- <sa-td name="项目编号" prop="code"></sa-td> -->
+					<sa-td name="收费项" prop="code">
 						<template slot-scope="s">
-							<el-button class="c-btn" type="primary" icon="el-icon-edit" @click="update(s.row)">详细
-							</el-button>
+							<el-select v-model="s.row.items[0].id" placeholder="收费项">
+								<el-option v-for="item in s.row.items" :key="item.id" :value="item.id"
+									:label="item.itemName+' '+item.price+item.unit">
+								</el-option>
+							</el-select>
 						</template>
-					</el-table-column> -->
+					</sa-td>
 				</el-table>
 				<!-- ------------- 分页 ------------- -->
 				<sa-item type="page" :curr.sync="p.pageNo" :size.sync="p.pageSize" :total="dataCount" @change="f5()">
@@ -79,15 +73,15 @@
 					dataList: [], // 数据集合
 					itemTypeList: [],
 					businessTypeList: [{
-							value: 0,
+							value: '0',
 							name: '默认'
 						},
 						{
-							value: 1,
+							value: '1',
 							name: '消杀'
 						},
 						{
-							value: 2,
+							value: '2',
 							name: '装卸'
 						},
 					]
@@ -96,7 +90,7 @@
 					businessChange(data) {
 						let obj={
 							id:data.id,
-							businessType:data.businessType
+							businessType:data.type.join(',')
 						}
 						sa.ajax('/TbItemType/update', obj, function(res) {
 							this.f5();
@@ -105,7 +99,12 @@
 					// 刷新
 					f5: function() {
 						sa.ajax('/TbItemType/getList', sa.removeNull(this.p), function(res) {
-							this.dataList = res.data; // 数据
+							let list=res.data;
+							for(let i in list){
+								let obj=list[i];
+								obj.type=obj.businessType.split(',')
+							}
+							this.dataList = list; // 数据
 							this.dataCount = res.dataCount; // 数据总数 
 							sa.f5TableHeight(); // 刷新表格高度 
 						}.bind(this));

+ 46 - 11
sp-admin/sa-view/tb-partner/tb-business-item-list.html

@@ -30,30 +30,38 @@
 
 				<!-- ------------- 数据列表 ------------- -->
 				<el-table class="data-table" ref="data-table" :data="dataList">
-					<sa-td name="项目类型" prop="itemTypeName"></sa-td>
-					<sa-td name="具体项目" prop="itemName"></sa-td>
+					<sa-td name="单号" prop="no" width="160"></sa-td>
+					<sa-td name="作业公司" prop="pickCustomerName"></sa-td>
+						<sa-td name="项目" prop="itemName"></sa-td>
+					<sa-td name="类型" prop="itemTypeName"></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"></sa-td>
-					<sa-td name="接单时间" prop="pickTime"></sa-td>
-					<!-- <el-table-column label="操作" fixed="right" width="200px">
+					<sa-td name="创建时间" prop="createTime" width="160"></sa-td>
+					<sa-td name="接单时间" prop="pickTime" width="160"></sa-td>
+					<sa-td name="确认时间" prop="confirmTime" width="160"></sa-td>
+					<el-table-column label="操作" fixed="right" width="200px" v-if="currentCustomerId=='1'">
 						<template slot-scope="s">
-							<el-button class="c-btn" type="success" icon="el-icon-view" @click="get(s.row)">查看
-							</el-button>
-							<el-button class="c-btn" type="primary" icon="el-icon-edit" @click="update(s.row)">修改
+							<el-button v-if="s.row.pickTime&&!s.row.confirmTime" class="c-btn" type="success" icon="el-icon-edit" @click="confirmFn(s.row)">确认
 							</el-button>
 						</template>
-					</el-table-column> -->
+					</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({
@@ -68,12 +76,38 @@
 						itemName: '', // 项目名称 
 						pageNo: 1, // 当前页 
 						pageSize: 10, // 页大小 
-						sortType: 9 // 排序方式 
+						sortType: 10 // 排序方式 
 					},
 					dataCount: 0,
 					dataList: [], // 数据集合 
+					currentCustomerId: '1',
+					confirm: {
+						visible: false,
+						form: {
+							id: ''
+						}
+					}
 				},
 				methods: {
+					confirmFn(data) {
+						Object.assign(this.confirm, {
+							visible: true,
+							form: {
+								id: data.id
+							}
+						})
+					},
+					sureConfirm() {
+						sa.ajax('/TbBusinessItem/confirm',{id:this.confirm.form.id}, function(resp) {
+							this.confirm.visible = false;
+							this.f5();
+						}.bind(this));
+					},
+					getCustomer() {
+						sa.ajax('/TbCostomer/getCurrentCustomerId', function(resp) {
+							this.currentCustomerId = resp.data;
+						}.bind(this));
+					},
 					// 刷新
 					f5: function() {
 						sa.ajax('/TbBusinessItem/getList', sa.removeNull(this.p), function(res) {
@@ -115,6 +149,7 @@
 					},
 				},
 				created: function() {
+					this.getCustomer()
 					this.f5();
 					sa.onInputEnter();
 				}

+ 6 - 5
sp-admin/sa-view/tb-partner/tb-partner-add.html

@@ -40,9 +40,9 @@
 							<sa-item type="text" name="联系电话" v-model="m.phone" placeholder="请输入联系号码" br></sa-item>
 							<div class="c-item">
 								<label class="c-label">类型:</label>
-								<el-select v-model="m.type" :disabled="currentCustomerId!=='1'">
-									<el-option label="消杀公司" :value="1"></el-option>
-										<el-option label="装卸公司" :value="2"></el-option>
+								<el-select v-model="type" multiple :disabled="currentCustomerId!=='1'">
+									<el-option label="消杀公司" value="1"></el-option>
+										<el-option label="装卸公司" value="2"></el-option>
 								</el-select>
 							</div>
 							<sa-item type="img" name="营业执照" v-model="m.businessLicence" br></sa-item>
@@ -70,6 +70,7 @@
 					m: null, // 实体对象 
 					options: [],
 					currentCustomerId: '1',
+					type:[]
 				},
 				methods: {
 					getCurrendCustomer() {
@@ -103,6 +104,7 @@
 							return;
 						}
 						sa.checkNull(m.dutyPeople, '请输入 [联系人]');
+						m.type=this.type.join(",")
 						if (this.id <= 0) { // 添加
 							sa.ajax('/TbCostomer/add', m, function(res) {
 								sa.alert('增加成功', this.clean);
@@ -131,8 +133,7 @@
 					} else {
 						sa.ajax('/TbCostomer/getById?id=' + this.id, function(res) {
 							this.m = res.data;
-							this.m.address_arry = res.data ? res.data.addressIds.split(",").map(id =>
-								parseInt(id)) : [];
+							this.type=this.m.type.split(',')
 							if (res.data == null) {
 								sa.alert('未能查找到 id=' + this.id + " 详细数据");
 							}

+ 1 - 1
sp-admin/static/sa.js

@@ -22,7 +22,7 @@ var sa = {
 		api_url: 'https://dxkaa1.bgigc.com/pro',
 		web_url: 'http://www.baidu.com'
 	}
-	sa.cfg = cfg_dev; // 最终环境 , 上线前请选择正确的环境
+	sa.cfg = cfg_prod; // 最终环境 , 上线前请选择正确的环境
 })();
 
 

+ 1 - 1
sp-server/app.pid

@@ -1 +1 @@
-18200
+45144

+ 5 - 0
sp-server/src/main/java/com/pj/api/h5/ApiController.java

@@ -52,6 +52,11 @@ public class ApiController {
         return spAccAdminService.doLogin(key, password, openid);
     }
 
+    @RequestMapping("doLoginByOpenid")
+    AjaxJson doLoginByOpenid(String openid) {
+        return spAccAdminService.doLoginByOpenid(openid);
+    }
+
     @PostMapping(value = "register")
     public AjaxJson register(TbCostomer costomer) {
         tbCostomerService.register(costomer);

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

@@ -8,6 +8,7 @@ import cn.hutool.core.util.StrUtil;
 import com.pj.api.bo.InOutRecordBO;
 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.satoken.StpUserUtil;
@@ -204,35 +205,26 @@ public class ApiService {
         if (spAdmin == null) {
             return AjaxJson.getError("用户已被删除或解绑");
         }
+        if (tbBusinessItem.getPick()==1){
+            return AjaxJson.getError("您慢了一步,其他用户已接单");
+        }
         String customerId = spAdmin.getCustomerId();
         TbCostomer tbCostomer = tbCostomerService.getById(customerId);
         tbBusinessItem.setPick(1).setPickTime(new Date()).setPickCustomerId(tbCostomer.getId()).setPickCustomerName(tbCostomer.getName());
         tbBusinessItemService.updateById(tbBusinessItem);
         //todo 通知录入人员 已接单
-        String businessId = tbBusinessItem.getBusinessId();
-        TbBusiness tbBusiness = tbBusinessService.getById(businessId);
-        String businessCustomerId = tbBusiness.getCustomerId();
-        List<SpAdmin> spAdminList = spAdminService.findByCustomerId(businessCustomerId);
+        List<SpAdmin> spAdminList = spAdminService.findByCustomerId(UserTypeEnum.PLATFORM_ADMIN.getCustomerId());
         MsgDataBO msgDataBO=new MsgDataBO("您有一条新的接单通知",tbCostomer.getName(), DateUtil.now(),tbBusinessItem.getItemTypeName()+"("+tbBusinessItem.getItemName()+")");
         spAdminList.stream().filter(admin -> StrUtil.isNotEmpty(admin.getOpenid())).forEach(admin -> {
-            String detailUrl = myConfig.getWebDomain() + "/pages/business-order/business-item?id=" + tbBusinessItem.getId();
+            String detailUrl = myConfig.getWebDomain() + "/pages/business-order/business-item?id=" + tbBusinessItem.getId()+"&openid="+openid;
+            log.info("admin confirm business:[{}]",detailUrl);
             wxService.sendTemplateMsg(wxConfig.getBusinessPickTemplate(),admin.getOpenid(),msgDataBO,detailUrl);
         });
         return AjaxJson.getSuccess();
     }
 
     public void confirmBusinessItem(long id) {
-        TbBusinessItem tbBusinessItem = tbBusinessItemService.getById(id);
-        tbBusinessItem.setConfirm(1).setConfirmTime(new Date());
-        tbBusinessItemService.updateById(tbBusinessItem);
-        TbBusiness tbBusiness=tbBusinessService.getById(tbBusinessItem.getBusinessId());
-        //todo 通知作业方
-        List<SpAdmin> spAdminList = spAdminService.findByCustomerId(tbBusinessItem.getPickCustomerId());
-        MsgDataBO msgDataBO=new MsgDataBO("您有一条新的业务确认提醒",tbBusiness.getCustomerName(), DateUtil.now(),tbBusinessItem.getItemTypeName()+"("+tbBusinessItem.getItemName()+")");
-        spAdminList.stream().filter(admin -> StrUtil.isNotEmpty(admin.getOpenid())).forEach(admin -> {
-            String detailUrl = myConfig.getWebDomain() + "/pages/business-order/business-item?id=" + id;
-            wxService.sendTemplateMsg(wxConfig.getBusinessPickTemplate(),admin.getOpenid(),msgDataBO,detailUrl);
-        });
+        tbBusinessItemService.confirmBusinessItem(id);
     }
 
     public List<TbBusinessItem> getPartnerBusinessItem(SoMap startPage) {

+ 2 - 2
sp-server/src/main/java/com/pj/current/SaPlusStartup.java

@@ -43,8 +43,8 @@ public class SaPlusStartup implements CommandLineRunner {
 
     @Override
     public void run(String... args) throws Exception {
-       // tokenTask.run();
-        //threadPoolTaskScheduler.scheduleAtFixedRate(tokenTask, wxConfig.getFlushSecond() * 1000);
+        tokenTask.run();
+        threadPoolTaskScheduler.scheduleAtFixedRate(tokenTask, wxConfig.getFlushSecond() * 1000);
         String ip = InetAddress.getLocalHost().getHostAddress();
         String str = "\n------------- " + applicationName + " (" + active + ") 启动成功 --by " + getNow() + " -------------\n" +
                 "\t- Local:   http://localhost:" + port + path + "\n" +

+ 13 - 8
sp-server/src/main/java/com/pj/project/tb_business/TbBusinessService.java

@@ -175,6 +175,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
         tbBusinessItemService.removeByBusinessId(t.getId());
         BigDecimal price = new BigDecimal(0);
         List<TbBusinessItem> items = JSONUtil.toList(t.getItemJson(), TbBusinessItem.class);
+        int index=1;
         for (TbBusinessItem item : items) {
             Double num = NumberUtil.parseDouble(item.getNum());
             TbItem tbItem = tbItemService.getById(item.getItemId());
@@ -183,18 +184,22 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
             TbItemType tbItemType = tbItemTypeService.getById(typeId);
             item.setBusinessId(t.getId()).setItemCode(tbItem.getItemCode())
                     .setItemName(tbItem.getItemName()).setItemPrice(tbItem.getPrice())
-                    .setItemTypeId(typeId).setItemTypeName(tbItemType.getName())
-                    .setUnit(tbItem.getUnit()).setTotal(NumberUtil.mul(num, tbItem.getPrice())).setCreateTime(new Date());
+                    .setItemTypeId(typeId).setItemTypeName(tbItemType.getName()).setBusinessType(tbItemType.getBusinessType())
+                    .setUnit(tbItem.getUnit()).setTotal(NumberUtil.mul(num, tbItem.getPrice())).setCreateTime(new Date())
+                    .setNo(t.getNo()+"0"+index);
             tbBusinessItemService.save(item);
-            Integer businessType = tbItemType.getBusinessType();
-            if (businessType != null && businessType != 0) {
+            String businessType = tbItemType.getBusinessType();
+            if (!StrUtil.equals(businessType,TbCostomer.CustomerEnum.BUSINESS_TYPE.getType())) {
                 MsgDataBO msgDataBO=new MsgDataBO("您收到一条新的作业提醒",tbItemType.getName(),tbItem.getItemName(),t.getGoodsName(),DateUtil.today(),"点击进入详情进行接单");
-                List<String> openidList = tbCostomerService.findByBusinessTypeOpenid(businessType);
-                openidList.forEach(openid-> {
-                    String detailUrl = myConfig.getWebDomain() + "/pages/business-item/item-detail?itemId=" + item.getId()+"&openid="+openid;
-                    wxService.sendTemplateMsg(wxConfig.getBusinessNoticeTemplate(),openid,msgDataBO,detailUrl);
+                StrUtil.splitTrim(businessType,",").forEach(type->{
+                    List<String> openidList = tbCostomerService.findByBusinessTypeOpenid(type);
+                    openidList.forEach(openid-> {
+                        String detailUrl = myConfig.getWebDomain() + "/pages/business-item/item-detail?itemId=" + item.getId()+"&openid="+openid;
+                        wxService.sendTemplateMsg(wxConfig.getBusinessNoticeTemplate(),openid,msgDataBO,detailUrl);
+                    });
                 });
             }
+            index++;
         }
         List<TbBusinessCar> carList = JSONUtil.toList(t.getCarJson(), TbBusinessCar.class);
         String chinaCarNo = carList.stream().map(TbBusinessCar::getCarNo).collect(Collectors.joining("、"));

+ 3 - 0
sp-server/src/main/java/com/pj/project/tb_business_item/TbBusinessItem.java

@@ -99,6 +99,9 @@ public class TbBusinessItem extends Model<TbBusinessItem> implements Serializabl
 	private Date confirmTime;
 	private String pickCustomerId;
 	private String pickCustomerName;
+	private String businessType;
+	private String no;
+
 
 
 

+ 12 - 0
sp-server/src/main/java/com/pj/project/tb_business_item/TbBusinessItemController.java

@@ -49,6 +49,17 @@ 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())){
+            return AjaxJson.getError("无确认权限");
+        }
+         tbBusinessItemService.confirmBusinessItem(id);
+        return AjaxJson.getSuccess();
+    }
 
     /**
      * 查集合 - 根据条件(参数为空时代表忽略指定条件)
@@ -56,6 +67,7 @@ public class TbBusinessItemController {
     @RequestMapping("getList")
     public AjaxJson getList() {
         SoMap so = SoMap.getRequestSoMap();
+        so.put("typeFlag",1);
         String customerId = StpUserUtil.getCustomerId();
         if (!StrUtil.equals(customerId, UserTypeEnum.PLATFORM_ADMIN.getCustomerId())) {
             so.put("pickCustomerId", customerId);

+ 2 - 0
sp-server/src/main/java/com/pj/project/tb_business_item/TbBusinessItemMapper.xml

@@ -66,6 +66,7 @@
 			<if test=' this.has("status") '> and status = #{status} </if>
 			<if test=' this.has("operateTime") '> and operate_time = #{operateTime} </if>
 			<if test=' this.has("operaror") '> and operaror = #{operaror} </if>
+			<if test=' this.has("typeFlag") '> and business_type !='0' </if>
 		</where>
 		order by
 		<choose>
@@ -78,6 +79,7 @@
 			<when test='sortType == 7'> operate_time desc </when>
 			<when test='sortType == 8'> operaror desc </when>
 			<when test='sortType == 9'> pick_time desc </when>
+			<when test='sortType == 10'> create_time desc </when>
 			<otherwise> id desc </otherwise>
 		</choose>
 	</select>

+ 88 - 38
sp-server/src/main/java/com/pj/project/tb_business_item/TbBusinessItemService.java

@@ -1,70 +1,120 @@
 package com.pj.project.tb_business_item;
 
+import java.util.Date;
 import java.util.List;
 
+import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 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.current.config.MyConfig;
+import com.pj.current.config.WxConfig;
+import com.pj.project.tb_business.TbBusiness;
+import com.pj.project.tb_business.TbBusinessService;
+import com.pj.project4sp.admin.SpAdmin;
+import com.pj.project4sp.admin.SpAdminService;
 import com.pj.utils.so.SoMap;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
 
 import com.pj.utils.sg.*;
 import org.springframework.transaction.annotation.Transactional;
 
+import javax.annotation.Resource;
+
 /**
  * Service: tb_business_item -- 业务作业项
- * @author qzy 
+ *
+ * @author qzy
  */
 @Service
 @Transactional
-public class TbBusinessItemService extends ServiceImpl<TbBusinessItemMapper,TbBusinessItem> implements IService<TbBusinessItem> {
-
-	/** 底层 Mapper 对象 */
-	@Autowired
-	TbBusinessItemMapper tbBusinessItemMapper;
+public class TbBusinessItemService extends ServiceImpl<TbBusinessItemMapper, TbBusinessItem> implements IService<TbBusinessItem> {
 
-	/** 增 */
-	int add(TbBusinessItem t){
-		return tbBusinessItemMapper.add(t);
-	}
+    /**
+     * 底层 Mapper 对象
+     */
+    @Autowired
+    TbBusinessItemMapper tbBusinessItemMapper;
+    @Resource
+    @Lazy
+    private TbBusinessService tbBusinessService;
+    @Resource
+    @Lazy
+    private SpAdminService spAdminService;
+    @Resource
+    private WxConfig wxConfig;
+    @Resource
+    private MyConfig myConfig;
+    @Resource
+    @Lazy
+    private WxService wxService;
 
+    /**
+     * 增
+     */
+    int add(TbBusinessItem t) {
+        return tbBusinessItemMapper.add(t);
+    }
 
 
-	/** 改 */
-	int update(TbBusinessItem t){
-		return tbBusinessItemMapper.update(t);
-	}
+    /**
+     * 改
+     */
+    int update(TbBusinessItem t) {
+        return tbBusinessItemMapper.update(t);
+    }
 
-	/** 查 */
-	TbBusinessItem getById(String id){
-		return tbBusinessItemMapper.getById(id);
-	}
+    /**
+     * 查
+     */
+    TbBusinessItem getById(String id) {
+        return tbBusinessItemMapper.getById(id);
+    }
 
-	/** 查集合 - 根据条件(参数为空时代表忽略指定条件) */  
-	public List<TbBusinessItem> getList(SoMap so) {
-		return tbBusinessItemMapper.getList(so);	
-	}
+    /**
+     * 查集合 - 根据条件(参数为空时代表忽略指定条件)
+     */
+    public List<TbBusinessItem> getList(SoMap so) {
+        return tbBusinessItemMapper.getList(so);
+    }
 
 
-	public void removeByBusinessId(String businessId) {
-		QueryWrapper<TbBusinessItem>ew=new QueryWrapper<>();
-		ew.eq("business_id",businessId);
-		this.remove(ew);
-	}
+    public void removeByBusinessId(String businessId) {
+        QueryWrapper<TbBusinessItem> ew = new QueryWrapper<>();
+        ew.eq("business_id", businessId);
+        this.remove(ew);
+    }
 
     public List<TbBusinessItem> findByBusinessId(String businessId) {
-		QueryWrapper<TbBusinessItem>ew=new QueryWrapper<>();
-		ew.eq("business_id",businessId);
-		ew.orderByDesc("pick");
-		ew.orderByAsc("confirm");
-		return list(ew);
+        QueryWrapper<TbBusinessItem> ew = new QueryWrapper<>();
+        ew.eq("business_id", businessId);
+        ew.orderByDesc("pick");
+        ew.orderByAsc("confirm");
+        return list(ew);
     }
 
-	public TbBusinessItem findByBusinessIdAndTypeName(String businessId, String itemTypeName) {
-		QueryWrapper<TbBusinessItem>ew=new QueryWrapper<>();
-		ew.eq("business_id",businessId);
-		ew.eq("item_type_name",itemTypeName);
-		return getOne(ew);
-	}
+    public TbBusinessItem findByBusinessIdAndTypeName(String businessId, String itemTypeName) {
+        QueryWrapper<TbBusinessItem> ew = new QueryWrapper<>();
+        ew.eq("business_id", businessId);
+        ew.eq("item_type_name", itemTypeName);
+        return getOne(ew);
+    }
+
+    public void confirmBusinessItem(long id) {
+        TbBusinessItem tbBusinessItem = this.getById(id);
+        tbBusinessItem.setConfirm(1).setConfirmTime(new Date());
+        this.updateById(tbBusinessItem);
+        //todo 通知作业方
+        List<SpAdmin> spAdminList = spAdminService.findByCustomerId(tbBusinessItem.getPickCustomerId());
+        MsgDataBO msgDataBO = new MsgDataBO("业务确认提醒", "系统管理人员", DateUtil.now(), tbBusinessItem.getItemTypeName() + "(" + tbBusinessItem.getItemName() + ")");
+        spAdminList.stream().filter(admin -> StrUtil.isNotEmpty(admin.getOpenid())).forEach(admin -> {
+            String detailUrl = myConfig.getWebDomain() + "/pages/business-item/item-detail?itemId=" + id+"&openid="+admin.getOpenid();
+            wxService.sendTemplateMsg(wxConfig.getBusinessConfirmTemplate(), admin.getOpenid(), msgDataBO, detailUrl);
+        });
+    }
 }

+ 5 - 5
sp-server/src/main/java/com/pj/project/tb_costomer/TbCostomer.java

@@ -105,15 +105,15 @@ public class TbCostomer extends Model<TbCostomer> implements Serializable {
 	/**
 	 * 类型0、理货员;1、消杀;2、装卸
 	 */
-	private Integer type;
+	private String type;
 
 	@Getter
 	@AllArgsConstructor
 	public static enum CustomerEnum{
-		BUSINESS_TYPE(0,"理货员"),
-		DISINFECT_TYPE(1,"消杀"),
-		TAKE_TYPE(2,"装卸");
-		private int type;
+		BUSINESS_TYPE("0","理货员"),
+		DISINFECT_TYPE("1","消杀"),
+		TAKE_TYPE("2","装卸");
+		private String type;
 		private String desc;
 	}
 

+ 1 - 1
sp-server/src/main/java/com/pj/project/tb_costomer/TbCostomerMapper.java

@@ -54,5 +54,5 @@ public interface TbCostomerMapper extends BaseMapper <TbCostomer> {
 	List<TbCostomer> getList(SoMap so);
 
 
-    List<String> findByBusinessTypeOpenid(@Param("businessType") Integer businessType);
+    List<String> findByBusinessTypeOpenid(@Param("businessType") String businessType);
 }

+ 1 - 1
sp-server/src/main/java/com/pj/project/tb_costomer/TbCostomerMapper.xml

@@ -104,7 +104,7 @@
     </select>
     <select id="findByBusinessTypeOpenid" resultType="java.lang.String">
 		SELECT b.openid from tb_costomer a LEFT JOIN sp_admin b on a.id=b.customer_id
-        WHERE a.type=#{businessType} and b.openid !='' and b.openid is not null
+        WHERE a.type like concat('%',#{businessType},'%') and b.openid !='' and b.openid is not null
 	</select>
 
 

+ 1 - 1
sp-server/src/main/java/com/pj/project/tb_costomer/TbCostomerService.java

@@ -176,7 +176,7 @@ public class TbCostomerService extends ServiceImpl<TbCostomerMapper, TbCostomer>
         spAdminMapper.updateCustomerAdmin(costomer.getId(), 2);
     }
 
-    public List<String> findByBusinessTypeOpenid(Integer businessType) {
+    public List<String> findByBusinessTypeOpenid(String businessType) {
         return  tbCostomerMapper.findByBusinessTypeOpenid(businessType);
 
     }

+ 1 - 1
sp-server/src/main/java/com/pj/project/tb_item_type/TbItemType.java

@@ -58,7 +58,7 @@ public class TbItemType extends Model<TbItemType> implements Serializable {
 	/**
 	 * 业务类型1,消杀;2装卸;0默认
 	 */
-	private Integer businessType=0;
+	private String businessType="0";
 
 	@TableField(exist = false)
 	private List<TbItem>items=new ArrayList<>();

+ 18 - 5
sp-server/src/main/java/com/pj/project4sp/admin4login/SpAccAdminService.java

@@ -54,7 +54,6 @@ public class SpAccAdminService {
     }
 
     public AjaxJson doLogin(String key, String password, String openid) {
-
         // 0、判断 way (1=ID, 2=昵称,3=手机号  )
         int way = 2;
         if (NbUtil.isNumber(key)) {
@@ -75,8 +74,6 @@ public class SpAccAdminService {
         if (way == 3) {
             admin = spAdminMapper.getByPhone(key);
         }
-
-
         // 3、开始验证
         if (admin == null) {
             return AjaxJson.getError("无此账号");
@@ -88,12 +85,10 @@ public class SpAccAdminService {
         if (!admin.getPassword2().equals(md5Password)) {
             return AjaxJson.getError("密码错误");
         }
-
         // 4、是否禁用
         if (admin.getStatus() == 2) {
             return AjaxJson.getError("此账号已被禁用,如有疑问,请联系管理员");
         }
-
         // =========== 至此, 已登录成功 ============
         successLogin(admin);
         StpUtil.login(admin.getId());
@@ -148,4 +143,22 @@ public class SpAccAdminService {
     }
 
 
+    public AjaxJson doLoginByOpenid(String openid) {
+      SpAdmin admin=  spAdminMapper.findByOpenid(openid);
+        // 4、是否禁用
+        if (admin.getStatus() == 2) {
+            return AjaxJson.getError("此账号已被禁用,如有疑问,请联系管理员");
+        }
+        // =========== 至此, 已登录成功 ============
+        successLogin(admin);
+        StpUtil.login(admin.getId());
+        StpUserUtil.saveAdmin(admin.getId(), admin);
+
+        // 组织返回参数
+        SoMap map = new SoMap();
+        map.put("admin", admin);
+        map.put("per_list", spRolePermissionService.getPcodeByRid2(admin.getRoleId()));
+        map.put("tokenInfo", StpUtil.getTokenInfo());
+        return AjaxJson.getSuccessData(map);
+    }
 }

+ 1 - 1
sp-server/src/main/resources/application-dev.yml

@@ -74,4 +74,4 @@ wx-config:
     send-msg-url: https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=ACCESS_TOKEN
     business-notice-template: x-uh28Okx9_Wl1ZXsmx_r2vn3KIixZrZqUw-18R0cqY
     business-pick-template: M2f0xbVnQNujOCbtDZ6kBGnTK8Uc2Hm7dMguU-dPH9Q
-    business-confirm-template: x-uh28Okx9_Wl1ZXsmx_r2vn3KIixZrZqUw-18R0cqY
+    business-confirm-template: aOOyH-wldRhNviL-AKGZUl2g5uj6NXUaW8otkJJio90