From f83b62252df79afbfa19f4cf1be0487d9e37a123 Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Thu, 05 May 2022 18:48:09 +0800
Subject: [PATCH] 20220505
---
zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysProjServicesServiceImpl.java | 180 +++++++++++++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 160 insertions(+), 20 deletions(-)
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 efb59fb..0b3ffe4 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,12 +1,16 @@
package com.matrix.system.hive.service.imp;
import cn.hutool.core.collection.CollUtil;
+import com.google.common.collect.Lists;
import com.matrix.component.asyncmessage.AsyncMessageManager;
import com.matrix.core.constance.MatrixConstance;
import com.matrix.core.exception.GlobleException;
import com.matrix.core.pojo.PaginationVO;
import com.matrix.core.pojo.VerifyResult;
-import com.matrix.core.tools.*;
+import com.matrix.core.tools.DateUtil;
+import com.matrix.core.tools.LogUtil;
+import com.matrix.core.tools.StringUtils;
+import com.matrix.core.tools.WebUtil;
import com.matrix.system.app.dto.ServiceOrderListDto;
import com.matrix.system.app.vo.ServiceOrderListVo;
import com.matrix.system.common.bean.BusParameterSettings;
@@ -14,7 +18,12 @@
import com.matrix.system.common.constance.AppConstance;
import com.matrix.system.common.dao.BusParameterSettingsDao;
import com.matrix.system.common.dao.SysUsersDao;
+import com.matrix.system.common.service.BusParameterSettingService;
+import com.matrix.system.common.service.OperationLogService;
import com.matrix.system.constance.Dictionary;
+import com.matrix.system.enums.BooleanEnum;
+import com.matrix.system.enums.OperationButtonEnum;
+import com.matrix.system.enums.OperationFunctionEnum;
import com.matrix.system.hive.bean.*;
import com.matrix.system.hive.dao.*;
import com.matrix.system.hive.plugin.util.MoneyUtil;
@@ -56,7 +65,8 @@
@Autowired
private SysProjUseDao sysProjUseDao;
-
+ @Autowired
+ private OperationLogService operationLogService;
@Autowired
private SysOutStoreDao sysOutStoreDao;
@@ -116,12 +126,17 @@
BusParameterSettingsDao busParameterSettingsDao;
@Autowired
+ BusParameterSettingService busParameterSettingService;
+
+ @Autowired
ScoreVipDetailService scoreVipDetailService;
@Autowired
SysVipInfoDao sysVipInfoDao;
+ @Autowired
+ ShoppingGoodsAssembleDao goodsAssembleDao;
/**
* 新增服务单 jyy
@@ -131,10 +146,10 @@
@Transactional(rollbackFor = Exception.class)
@Override
public SysProjServices addSysProjServices(SysProjServices sysProjServices) throws GlobleException {
-
+ SysUsers user = (SysUsers) WebUtil.getSession().getAttribute(MatrixConstance.LOGIN_KEY);
//创建服务单
if (WebUtil.getSession().getAttribute(MatrixConstance.LOGIN_KEY) != null) {
- SysUsers user = (SysUsers) WebUtil.getSession().getAttribute(MatrixConstance.LOGIN_KEY);
+
sysProjServices.setCreateStaffId(user.getSuId());
sysProjServices.setShopId(user.getShopId());
sysProjServices.setCompanyId(user.getCompanyId());
@@ -239,6 +254,15 @@
sysProjServices.setTotalTime(totalTime);
sysProjServices.setMoney(new BigDecimal(hkPrice).setScale(2, BigDecimal.ROUND_HALF_DOWN).doubleValue());
sysProjServicesDao.update(sysProjServices);
+
+ //保存单据日志
+ operationLogService.saveOperation(sysProjServices.getCompanyId(), sysProjServices.getShopId(),user.getSuId(),
+ OperationFunctionEnum.SERVICE_ORDER,
+ OperationButtonEnum.CREATE,
+ sysProjServices.getId(),
+ sysProjServices.getServiceNo(),
+ sysProjServices.getVipId());
+
return sysProjServices;
}
@@ -257,7 +281,7 @@
SysProjUse sysProjUse = projUseService.findById(sysBeauticianState.getPuseId());
//检查是否已经处于无效状态
- if(Dictionary.TAOCAN_STATUS_WX.equals(sysProjUse.getStatus())){
+ if (Dictionary.TAOCAN_STATUS_WX.equals(sysProjUse.getStatus())) {
return new VerifyResult(true, sysProjUse.getProjName() + "项目已经失效");
}
@@ -447,7 +471,62 @@
lastList.add(lastWork);
}
LastestWorkBeatuistaffDao.batchInsert(lastList);
- return sysProjServicesDao.update(projServices);
+ int i = sysProjServicesDao.update(projServices);
+
+ //根据配置是否完成自动配料
+ if (busParameterSettingService.isSettingOpen(AppConstance.OPEN_SERVICE_ORDER_AUTO_BATCHING, checkProjServices.getCompanyId())){
+ autoBatching(projServices);
+ }
+
+ SysUsers users = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY);
+ //保存单据日志
+ operationLogService.saveOperation(checkProjServices.getCompanyId(), checkProjServices.getShopId(),users.getSuId(),
+ OperationFunctionEnum.SERVICE_ORDER,
+ OperationButtonEnum.SERVICE_ORDER_PB,
+ checkProjServices.getId(),
+ checkProjServices.getServiceNo(),
+ checkProjServices.getVipId());
+
+ return i;
+ }
+
+
+ /**
+ * 根据配置是否完成自动配料
+ *
+ * @param projServices
+ */
+ private void autoBatching(SysProjServices projServices) {
+
+ //获取最新的服务单信息
+ projServices=findById(projServices.getId());
+ List<SysBeauticianState> beauticianStateList = beauticianStateDao.selectBySerIds(projServices.getId());
+
+
+ List<SysOutStoreItem> outStoreItemList = Lists.newLinkedList();
+ beauticianStateList.stream().forEach(item -> {
+
+ List<ShoppingGoodsAssemble> shoppingGoodsAssembles = goodsAssembleDao.selectGoodsByShoppingGoodsIdAndType(item.getProjId(), ShoppingGoods.SHOPPING_GOODS_TYPE_JJCP);
+
+ if (CollUtil.isNotEmpty(shoppingGoodsAssembles)) {
+ outStoreItemList.addAll(shoppingGoodsAssembles.stream().map(assemble -> {
+ SysOutStoreItem outStoreItem = new SysOutStoreItem();
+ outStoreItem.setSkuId(assemble.getAssembleGoodId());
+ outStoreItem.setAmount(Double.parseDouble(assemble.getTotal()+""));
+ outStoreItem.setRemark("自动配料");
+ return outStoreItem;
+ }).collect(Collectors.toList()));
+ }
+ });
+ //组合配料参数
+ projServices.setOutStoreItem(outStoreItemList);
+ //调用配料出库方法
+ try {
+ modifyPLProjServices(projServices);
+ }catch (GlobleException e){
+ LogUtil.debug("配料失败:{}",e.getMessage());
+ }
+
}
@@ -511,6 +590,16 @@
//删除积分
scoreVipDetailService.removeByBusinessId(checkProjServices.getVipId(), checkProjServices.getId());
+ SysUsers users = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY);
+ //保存单据日志
+ operationLogService.saveOperation(checkProjServices.getCompanyId(), checkProjServices.getShopId(),users.getSuId(),
+ OperationFunctionEnum.SERVICE_ORDER,
+ OperationButtonEnum.CANCEL,
+ checkProjServices.getId(),
+ checkProjServices.getServiceNo(),
+ checkProjServices.getVipId());
+
+
//更新服务单状态
return sysProjServicesDao.update(checkProjServices);
}
@@ -562,11 +651,11 @@
taocanProjUse.setIsOver(Dictionary.DELETED_N);
taocanProjUse.setStatus(Dictionary.MONEYCARD_STATUS_YX);
taocanProjUse.setBalance(MoneyUtil.add(taocanProjUse.getBalance(), backBlance.doubleValue()));
- if (Dictionary.FLAG_YES_Y.equals(taocanProjUse.getIsCourse())) {
+// if (Dictionary.FLAG_YES_Y.equals(taocanProjUse.getIsCourse())) {
if (StringUtils.isBlank(taocanProjUse.getIsInfinite()) || Dictionary.FLAG_NO_N.equals(taocanProjUse.getIsInfinite())) {
taocanProjUse.setSurplusCount(taocanProjUse.getSurplusCount() + beauticianState.getCount());
}
- }
+// }
sysProjUseDao.update(taocanProjUse);
}
@@ -623,6 +712,7 @@
@Transactional(rollbackFor = Exception.class)
@Override
public int modifyHKProjServices(SysProjServices projServices) throws GlobleException {
+ SysUsers sysUsers = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY);
projServices = sysProjServicesDao.selectById(projServices.getId());
if (!projServices.getState().equals(Dictionary.SERVICE_STATU_FWWC)) {
throw new GlobleException("该服务单状态为" + projServices.getState() + ",不可以进行当前操作!");
@@ -651,6 +741,7 @@
projServices.setState(Dictionary.SERVICE_STATU_FFJS);
projServices.setConsumeTime(new Date());
+ projServices.setCashierId(sysUsers.getSuId());
int result = sysProjServicesDao.update(projServices);
achieveNewService.addAchieveByServiceOrder(projServices);
@@ -660,9 +751,17 @@
//发送微信公众号提醒
UniformMsgParam uniformMsgParam = new UniformMsgParam(projServices.getCompanyId(), UniformMsgParam.GZH_FWWC);
uniformMsgParam.put("serviceId", projServices.getId());
- asyncMessageManager.sendMsg(AsyncMessageRouting.SEND_UNIFORM_TEMPLATE_MSG ,uniformMsgParam);
+ asyncMessageManager.sendMsg(AsyncMessageRouting.SEND_UNIFORM_TEMPLATE_MSG, uniformMsgParam);
//发送划扣短信提醒
taiYanAliyunSmsService.sendHkNotice(projServices);
+
+ //保存单据日志
+ operationLogService.saveOperation(projServices.getCompanyId(), projServices.getShopId(),users.getSuId(),
+ OperationFunctionEnum.SERVICE_ORDER,
+ OperationButtonEnum.SERVICE_ORDER_HK,
+ projServices.getId(),
+ projServices.getServiceNo(),
+ projServices.getVipId());
return result;
}
@@ -905,6 +1004,15 @@
// // 判断是服务超时还是服务提前结束,如果minspace大于0则是超时服务,小于0则是提前结束服务
// projServices.setIsOverTime(minspace + "");
// projServices.setState(Dictionary.SERVICE_STATU_FWWC);
+ //保存单据日志
+ operationLogService.saveOperation(projServices.getCompanyId(), projServices.getShopId(),sysUsers.getSuId(),
+ OperationFunctionEnum.SERVICE_ORDER,
+ OperationButtonEnum.SERVICE_ORDER_PL,
+ projServices.getId(),
+ projServices.getServiceNo(),
+ projServices.getVipId());
+
+
return sysProjServicesDao.update(projServices);
}
@@ -918,7 +1026,8 @@
if (CollectionUtils.isNotEmpty(projServicesVo.getOutStoreItem())) {
BusParameterSettings manageStockSetting = busParameterSettingsDao.selectCompanyParamByCode(AppConstance.WAREHOUSE_MANAGE_STOCK, projServicesVo.getCompanyId());
- if (AppConstance.IS_Y.equals(manageStockSetting.getParamValue())) {
+// if (AppConstance.IS_Y.equals(manageStockSetting.getParamValue())) {
+ if (BooleanEnum.TRUE.getValue() == manageStockSetting.getIntParamValue()) {
for (SysOutStoreItem item : projServicesVo.getOutStoreItem()) {
if (item.getAmount() != null && item.getAmount() > 0) {
return true;
@@ -961,6 +1070,14 @@
// 设置美疗师实际开始时间
checkBeauticianState.setState(Dictionary.BEATUI_STATE_SYZ);
projServices.getVipId();
+ //保存单据日志
+ operationLogService.saveOperation(projServices.getCompanyId(), projServices.getShopId(),users.getSuId(),
+ OperationFunctionEnum.SERVICE_ORDER,
+ OperationButtonEnum.SERVICE_ORDER_BEGIN,
+ projServices.getId(),
+ projServices.getServiceNo(),
+ projServices.getVipId());
+
return beauticianStateDao.update(checkBeauticianState);
}
@@ -1003,7 +1120,19 @@
checkprojServices.setState(Dictionary.SERVICE_STATU_FWWC);
sysProjServicesDao.update(checkprojServices);
}
-
+ //保存单据日志
+// operationLogService.saveOperation(projServices.getCompanyId(), projServices.getShopId(),users.getSuId(),
+// OperationFunctionEnum.SERVICE_ORDER,
+// OperationButtonEnum.SERVICE_ORDER_END,
+// projServices.getId(),
+// projServices.getServiceNo(),
+// projServices.getVipId());
+ operationLogService.saveOperation(checkprojServices.getCompanyId(), checkprojServices.getShopId(),users.getSuId(),
+ OperationFunctionEnum.SERVICE_ORDER,
+ OperationButtonEnum.SERVICE_ORDER_END,
+ checkprojServices.getId(),
+ checkprojServices.getServiceNo(),
+ checkprojServices.getVipId());
return rerunlt;
}
@@ -1043,7 +1172,11 @@
boolean flag = false;
if (CollUtil.isNotEmpty(settings)) {
for (ParameterSettings setting : settings) {
- if (step.equals(setting.getCode()) && Dictionary.FLAG_YES.equals(setting.getUserValue())) {
+// if (step.equals(setting.getCode()) && Dictionary.FLAG_YES.equals(setting.getUserValue())) {
+// flag = true;
+// break;
+// }
+ if (step.equals(setting.getCode()) && BooleanEnum.TRUE.getValue() == Integer.parseInt(setting.getUserValue())) {
flag = true;
break;
}
@@ -1055,17 +1188,28 @@
@Override
+ @Transactional(rollbackFor = Exception.class)
public int confirmServiceOrder(Long id) {
+ SysUsers users = (SysUsers) WebUtil.getSession().getAttribute(MatrixConstance.LOGIN_KEY);
SysProjServices services = new SysProjServices();
services.setId(id);
services.setState(Dictionary.BEATUI_STATE_DYY);
int i = modify(services);
+ SysProjServices projServices =findById(id);
+ //保存单据日志
+ operationLogService.saveOperation(projServices.getCompanyId(), projServices.getShopId(),users.getSuId(),
+ OperationFunctionEnum.SERVICE_ORDER,
+ OperationButtonEnum.SERVICE_ORDER_QRYY,
+ projServices.getId(),
+ projServices.getServiceNo(),
+ projServices.getVipId());
+
if (i > 0) {
//发送微信公众号提醒
- services=findById(services.getId());
- UniformMsgParam uniformMsgParam=new UniformMsgParam(services.getCompanyId(),UniformMsgParam.GZH_YYCG);
- uniformMsgParam.put("serviceId",services.getId());
- asyncMessageManager.sendMsg(AsyncMessageRouting.SEND_UNIFORM_TEMPLATE_MSG ,uniformMsgParam);
+ services = findById(services.getId());
+ UniformMsgParam uniformMsgParam = new UniformMsgParam(services.getCompanyId(), UniformMsgParam.GZH_YYCG);
+ uniformMsgParam.put("serviceId", services.getId());
+ asyncMessageManager.sendMsg(AsyncMessageRouting.SEND_UNIFORM_TEMPLATE_MSG, uniformMsgParam);
taiYanAliyunSmsService.sendYycgNotice(services);
@@ -1073,10 +1217,6 @@
}
return i;
}
-
-
-
-
}
--
Gitblit v1.9.1