From 7e08f7cd8079fa3b9f276aca7140b0afdb3d144d Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Mon, 15 Mar 2021 15:51:21 +0800
Subject: [PATCH] modify
---
zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysProjServicesServiceImpl.java | 86 ++++++++++++++++++++++------
zq-erp/src/main/resources/mybatis/mapper/hive/SysBeauticianStateDao.xml | 12 ++-
zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/vip.html | 4
zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/yypb-form.html | 20 +++++-
zq-erp/src/main/java/com/matrix/system/constance/Dictionary.java | 2
zq-erp/src/main/java/com/matrix/system/hive/service/imp/AchieveNewServiceImpl.java | 13 ++--
6 files changed, 101 insertions(+), 36 deletions(-)
diff --git a/zq-erp/src/main/java/com/matrix/system/constance/Dictionary.java b/zq-erp/src/main/java/com/matrix/system/constance/Dictionary.java
index d2e2e47..0ff4047 100644
--- a/zq-erp/src/main/java/com/matrix/system/constance/Dictionary.java
+++ b/zq-erp/src/main/java/com/matrix/system/constance/Dictionary.java
@@ -569,4 +569,6 @@
String SEX_WOMAN ="女";
String[] COLORS = { "#57c5d2", "#e3565e", "#2f343a", "#4d98db", "#4fbc9d", "#be9d4c"};
+
+ String SERVICE_OVER_BEGIN_END = "SERVICE_OVER_BEGIN_END";
}
diff --git a/zq-erp/src/main/java/com/matrix/system/hive/service/imp/AchieveNewServiceImpl.java b/zq-erp/src/main/java/com/matrix/system/hive/service/imp/AchieveNewServiceImpl.java
index 2c4978c..268665d 100644
--- a/zq-erp/src/main/java/com/matrix/system/hive/service/imp/AchieveNewServiceImpl.java
+++ b/zq-erp/src/main/java/com/matrix/system/hive/service/imp/AchieveNewServiceImpl.java
@@ -190,12 +190,13 @@
achieveNew.setProjPercentage(Double.parseDouble(beauticianState.getExtract()));
}
if (isFirst && beauticianState.getEndTime() != null && beauticianState.getBeginTime() != null) {
- long timeSpace = beauticianState.getEndTime().getTime() - beauticianState.getBeginTime().getTime();
- if (timeSpace > 0) {
- achieveNew.setProjTime((int) (timeSpace / 1000 / 60));
- } else {
- achieveNew.setProjTime(1);
- }
+// long timeSpace = beauticianState.getEndTime().getTime() - beauticianState.getBeginTime().getTime();
+// if (timeSpace > 0) {
+// achieveNew.setProjTime((int) (timeSpace / 1000 / 60));
+// } else {
+// achieveNew.setProjTime(1);
+// }
+ achieveNew.setProjTime(beauticianState.getExcTime());
isFirst = false;
}
achieveNewList.add(achieveNew);
diff --git a/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysProjServicesServiceImpl.java b/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysProjServicesServiceImpl.java
index cf0ae5a..1e81817 100644
--- a/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysProjServicesServiceImpl.java
+++ b/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysProjServicesServiceImpl.java
@@ -1,5 +1,6 @@
package com.matrix.system.hive.service.imp;
+import cn.hutool.core.collection.CollUtil;
import com.matrix.component.rabbitmq.RabiitMqTemplate;
import com.matrix.core.constance.MatrixConstance;
import com.matrix.core.exception.GlobleException;
@@ -304,8 +305,8 @@
SysProjUse sysProjUse = projUseService.findById(sysBeauticianState.getPuseId());
ShoppingGoods shoppingGoods = shoppingGoodsDao.selectById(sysProjUse.getProjId());
- SysOrderItem item = sysOrderItemService.findById(sysProjUse.getOrderItemId());
- SysOrder orderItem = sysOrderService.findById(item.getOrderId());
+ SysOrderItem item = sysOrderItemService.findById(sysProjUse.getOrderItemId());
+ SysOrder orderItem = sysOrderService.findById(item.getOrderId());
if ("购买".equals(sysProjUse.getSource())) {
// 如果用户有欠款,服务单总价不能超过已付金额
if (orderItem!=null && orderItem.getArrears() > 0) {
@@ -388,6 +389,7 @@
if (beauticianStateDao.checkBeauticianClash(beauticianState) > 0) {
throw new GlobleException("该美疗师已被占用,请重新分配!");
}
+// beauticianState.setExcTime(beauticianState.getProjInfo().getTimeLength());
beauticianState.setState(Dictionary.BEATUI_STATE_YYY);
beauticianStateDao.update(beauticianState);
@@ -573,6 +575,28 @@
if (!projServices.getState().equals(Dictionary.SERVICE_STATU_FWWC)) {
throw new GlobleException("该服务单状态为" + projServices.getState() + ",不可以进行当前操作!");
} else {
+ SysUsers users = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY);
+ if (skipServiceOrderStep(Dictionary.SERVICE_OVER_BEGIN_END)) {
+ SysBeauticianState checkBeauticianState = new SysBeauticianState();
+ checkBeauticianState.setServicesId(projServices.getId());
+ checkBeauticianState.setState(Dictionary.BEATUI_STATE_FWJS);
+ beauticianStateDao.chengItemState(checkBeauticianState);
+
+ // 释放床位资源
+ SysBedState checkBedState = sysBedStateDao.selectBySerIdAndBedId(projServices.getId(), projServices.getBedId());
+ if (checkBedState != null) {
+ checkBedState.setBedState(Dictionary.BED_STATE_SYJS);
+ bedStateDao.update(checkBedState);
+ }
+ projServices.setEndTime(new Date());
+ // 计算时差
+ long minspace = DateUtil.getDifTimeMin(projServices.getStartTime(), projServices.getEndTime()) - projServices.getTotalTime();
+ // 判断是服务超时还是服务提前结束,如果minspace大于0则是超时服务,小于0则是提前结束服务
+ projServices.setIsOverTime(minspace + "");
+ projServices.setState(Dictionary.SERVICE_STATU_FWWC);
+ sysProjServicesDao.update(projServices);
+ }
+
projServices.setState(Dictionary.SERVICE_STATU_FFJS);
projServices.setConsumeTime(new Date());
int result=sysProjServicesDao.update(projServices);
@@ -692,27 +716,30 @@
// 设置服务单状态
// projServices.setState(Dictionary.SERVICE_STATU_PLWC);
- projServices.setState(Dictionary.SERVICE_STATU_FWWC);
if(projServices.getDevisionId()==null){
//如果没有设置配料师则默认为操作配料的人为配料师
projServices.setDevisionId(sysUsers.getSuId());
-
}
+ // 判断是否跳过开始/结束服务
+ if (skipServiceOrderStep(Dictionary.SERVICE_OVER_BEGIN_END)) {
+ projServices.setStartTime(new Date());
+ projServices.setState(Dictionary.SERVICE_STATU_FWWC);
+ }
// 释放床位资源
- SysBedState checkBedState = sysBedStateDao.selectBySerIdAndBedId(projServices.getBedId(), projServices.getId());
- if (checkBedState != null) {
- checkBedState.setBedState(Dictionary.BED_STATE_SYJS);
- bedStateDao.update(checkBedState);
- }
- projServices.setStartTime(new Date());
- projServices.setEndTime(new Date());
- // 计算时差
- long minspace = DateUtil.getDifTimeMin(projServices.getStartTime(), projServices.getEndTime())
- - projServices.getTotalTime();
- // 判断是服务超时还是服务提前结束,如果minspace大于0则是超时服务,小于0则是提前结束服务
- projServices.setIsOverTime(minspace + "");
- projServices.setState(Dictionary.SERVICE_STATU_FWWC);
+// SysBedState checkBedState = sysBedStateDao.selectBySerIdAndBedId(projServices.getBedId(), projServices.getId());
+// if (checkBedState != null) {
+// checkBedState.setBedState(Dictionary.BED_STATE_SYJS);
+// bedStateDao.update(checkBedState);
+// }
+// projServices.setStartTime(new Date());
+// projServices.setEndTime(new Date());
+// // 计算时差
+// long minspace = DateUtil.getDifTimeMin(projServices.getStartTime(), projServices.getEndTime())
+// - projServices.getTotalTime();
+// // 判断是服务超时还是服务提前结束,如果minspace大于0则是超时服务,小于0则是提前结束服务
+// projServices.setIsOverTime(minspace + "");
+// projServices.setState(Dictionary.SERVICE_STATU_FWWC);
return sysProjServicesDao.update(projServices);
}
@@ -779,7 +806,6 @@
SysBeauticianState checkBeauticianState = new SysBeauticianState();
checkBeauticianState.setServicesId(projServices.getId());
checkBeauticianState.setState(Dictionary.BEATUI_STATE_FWJS);
- checkBeauticianState.setStaffId(users.getSuId());
int rerunlt = beauticianStateDao.chengItemState(checkBeauticianState);
// 验证是否是最后一个美疗师结束服务
@@ -809,7 +835,6 @@
}
return rerunlt;
-
}
@Override
@@ -833,4 +858,27 @@
public int findApiServiceOrderListTotal(ServiceOrderListDto serviceOrderListDto) {
return sysProjServicesDao.selectApiServiceOrderListTotal(serviceOrderListDto);
}
+
+ /**
+ * 跳过服务单某步骤
+ */
+ private boolean skipServiceOrderStep(String step) {
+ SysUsers users = (SysUsers) WebUtil.getSession().getAttribute(MatrixConstance.LOGIN_KEY);
+ ParameterSettings ps = new ParameterSettings();
+ ps.setCompanyId(users.getCompanyId());
+ ps.setCategory("店务配置");
+ List<ParameterSettings> settings = parameterSettingsDao.getByCategory(ps);
+
+ boolean flag = false;
+ if (CollUtil.isNotEmpty(settings)) {
+ for (ParameterSettings setting : settings) {
+ if (step.equals(setting.getCode()) && Dictionary.FLAG_YES.equals(setting.getUserValue())) {
+ flag = true;
+ break;
+ }
+ }
+ }
+
+ return flag;
+ }
}
diff --git a/zq-erp/src/main/resources/mybatis/mapper/hive/SysBeauticianStateDao.xml b/zq-erp/src/main/resources/mybatis/mapper/hive/SysBeauticianStateDao.xml
index b74ebeb..41b07c4 100644
--- a/zq-erp/src/main/resources/mybatis/mapper/hive/SysBeauticianStateDao.xml
+++ b/zq-erp/src/main/resources/mybatis/mapper/hive/SysBeauticianStateDao.xml
@@ -148,10 +148,14 @@
where a.SERVICES_ID =#{serId}
</select>
+ <!-- EXC_TIME =TIMESTAMPDIFF(MINUTE,BEGIN_TIME,now()) -->
<update id="chengItemState">
- update sys_beautician_state set state=#{record.state},
- EXC_TIME =TIMESTAMPDIFF(MINUTE,BEGIN_TIME,now())
- where STAFF_ID=#{record.staffId} and SERVICES_ID =#{record.servicesId}
+ update sys_beautician_state set state=#{record.state}
+ where 1=1
+ <if test="record.staffId != null">
+ and STAFF_ID=#{record.staffId}
+ </if>
+ and SERVICES_ID =#{record.servicesId}
</update>
<!-- 根据id更新 部分更新 -->
@@ -173,7 +177,7 @@
<if test="servicesId != null and servicesId !='' ">
SERVICES_ID = #{servicesId},
</if>
- <if test="servicesId != null and servicesId !='' ">
+ <if test="excTime != null and excTime !='' ">
EXC_TIME = #{excTime},
</if>
diff --git a/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/vip.html b/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/vip.html
index 77fec4b..60178c4 100644
--- a/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/vip.html
+++ b/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/vip.html
@@ -457,9 +457,9 @@
<el-table-column fixed="right" label="操作" width="200">
<template slot-scope="scope">
<el-button type="text" size="small" @click="lookServiceOrder(scope.$index, scope.row)">查看</el-button>
- <el-button matrix:btn="serviceClub-paiban" type="text" size="small" v-if="scope.row.state=='预约成功待处理'" @click="paiban(scope.$index, scope.row)">排班</el-button>
+ <el-button matrix:btn="serviceClub-paiban" type="text" size="small" v-if="scope.row.state=='待预约'" @click="paiban(scope.$index, scope.row)">排班</el-button>
<!-- <el-button matrix:btn="serviceClub-paidan" type="text" size="small" v-if="scope.row.state=='预约成功待处理'" @click="giveServiceOrder(scope.$index, scope.row)">派单</el-button>-->
- <el-button matrix:btn="serviceClub-edit" type="text" size="small" v-if="scope.row.state=='预约成功待处理'" @click="modifyServiceOrder(scope.$index, scope.row)">修改</el-button>
+ <el-button matrix:btn="serviceClub-edit" type="text" size="small" v-if="scope.row.state=='待预约'" @click="modifyServiceOrder(scope.$index, scope.row)">修改</el-button>
<el-button matrix:btn="serviceClub-peiliao" type="text" size="small" v-if="scope.row.state=='需配料'" @click="peiliao(scope.$index, scope.row)">配料</el-button>
<el-button matrix:btn="serviceClub-huakou" type="text" size="small" v-if="scope.row.state=='服务完成'" @click="hkService(scope.$index, scope.row)">划扣</el-button>
<el-button matrix:btn="serviceClub-edit" type="text" size="small" @click="modifyTime(scope.$index, scope.row)">修改时间</el-button>
diff --git a/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/yypb-form.html b/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/yypb-form.html
index c8421ac..4ee39fd 100644
--- a/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/yypb-form.html
+++ b/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/yypb-form.html
@@ -48,7 +48,8 @@
</div>
<label class="col-md-1 control-label">服务时长</label>
<div class="col-md-3">
- <el-input @change="changeYyTime()" v-model="projService.totalTime"></el-input>
+<!-- <el-input @change="changeYyTime()" v-model="projService.totalTime"></el-input>-->
+ <label class="control-label">{{projService.totalTime}}</label>
</div>
</div>
<div class="form-group">
@@ -105,7 +106,7 @@
<table class="table table-bordered">
<tr>
<th>项目名称</th>
- <th width="50px">服务时长</th>
+ <th width="100px">服务时长(分钟)</th>
<th>服务时间</th>
<th width="300px">美疗师</th>
<th style="width: 100px;">提成</th>
@@ -113,7 +114,7 @@
<tr v-for="(item,index) in projService.serviceItems">
<td>{{item.projInfo.name}}</td>
- <td>{{item.projInfo.timeLength}}(分钟)</td>
+ <td><el-input @change="changeTimeLength" v-model="item.projInfo.timeLength"></el-input></td>
<td>
<div style="display: flex;">
@@ -323,6 +324,7 @@
endTime: endTime,
staffId: beStates.staffId,
extract: beStates.extract,
+ excTime : beStates.projInfo.timeLength,
id: beStates.id,
});
@@ -465,9 +467,17 @@
});
- }
- ,
+ },
+ changeTimeLength:function() {
+ let _this = this;
+ var totalTime = 0;
+ _this.projService.serviceItems.forEach(item => {
+ totalTime += parseInt(item.projInfo.timeLength);
+ });
+ _this.projService.totalTime = totalTime;
+ _this.changeYyTime();
+ }
},
filters:
--
Gitblit v1.9.1