From 85dce973eb29eb2372c76d5b95b30354da9c41c8 Mon Sep 17 00:00:00 2001 From: 935090232@qq.com <ak473600000> Date: Tue, 22 Feb 2022 23:08:51 +0800 Subject: [PATCH] fead:新增收银员字段 --- zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysProjServicesServiceImpl.java | 102 ++++++++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 92 insertions(+), 10 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 5b10922..51fea08 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,7 +1,8 @@ package com.matrix.system.hive.service.imp; import cn.hutool.core.collection.CollUtil; -import com.matrix.component.rabbitmq.RabiitMqTemplate; +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; @@ -17,6 +18,7 @@ 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.constance.Dictionary; import com.matrix.system.hive.bean.*; import com.matrix.system.hive.dao.*; @@ -25,12 +27,11 @@ import com.matrix.system.score.constant.ScoreSettingConstant; import com.matrix.system.score.entity.ScoreVipDetail; import com.matrix.system.score.service.ScoreVipDetailService; -import com.matrix.system.shopXcx.mqTask.MQTaskRouting; +import com.matrix.system.shopXcx.mqTask.AsyncMessageRouting; import com.matrix.system.wechart.templateMsg.UniformMsgParam; import org.apache.commons.collections.CollectionUtils; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -68,7 +69,8 @@ private SysOutStoreItemDao sysOutStoreItemDao; @Autowired private SysBedInfoDao sysBedInfoDao; - + @Autowired + TaiYanAliyunSmsService taiYanAliyunSmsService; @Autowired private SysStoreInfoDao storeInfoDao; @@ -112,11 +114,14 @@ private ShoppingGoodsService shoppingGoodsService; @Autowired - private RabiitMqTemplate rabiitMqTemplate; + private AsyncMessageManager asyncMessageManager; @Autowired BusParameterSettingsDao busParameterSettingsDao; + + @Autowired + BusParameterSettingService busParameterSettingService; @Autowired ScoreVipDetailService scoreVipDetailService; @@ -124,9 +129,9 @@ @Autowired SysVipInfoDao sysVipInfoDao; - @Value("${evn}") - private String evn; + @Autowired + ShoppingGoodsAssembleDao goodsAssembleDao; /** * 新增服务单 jyy @@ -260,6 +265,12 @@ for (SysBeauticianState sysBeauticianState : sysProjServices.getServiceItems()) { SysProjUse sysProjUse = projUseService.findById(sysBeauticianState.getPuseId()); + + //检查是否已经处于无效状态 + if (Dictionary.TAOCAN_STATUS_WX.equals(sysProjUse.getStatus())) { + return new VerifyResult(true, sysProjUse.getProjName() + "项目已经失效"); + } + int kjcs = 1; if (sysProjUse.getTaocanId() != null) { kjcs = sysBeauticianState.getCount() * sysProjUse.getDeductionNum(); @@ -446,7 +457,54 @@ 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); + } + + + 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()); + } + } @@ -659,8 +717,9 @@ //发送微信公众号提醒 UniformMsgParam uniformMsgParam = new UniformMsgParam(projServices.getCompanyId(), UniformMsgParam.GZH_FWWC); uniformMsgParam.put("serviceId", projServices.getId()); - rabiitMqTemplate.sendMsg(MQTaskRouting.SEND_UNIFORM_TEMPLATE_MSG + evn, uniformMsgParam.toJSONString()); - + asyncMessageManager.sendMsg(AsyncMessageRouting.SEND_UNIFORM_TEMPLATE_MSG, uniformMsgParam); + //发送划扣短信提醒 + taiYanAliyunSmsService.sendHkNotice(projServices); return result; } @@ -1050,4 +1109,27 @@ return flag; } + + + @Override + public int confirmServiceOrder(Long id) { + SysProjServices services = new SysProjServices(); + services.setId(id); + services.setState(Dictionary.BEATUI_STATE_DYY); + int i = modify(services); + 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); + + taiYanAliyunSmsService.sendYycgNotice(services); + + + } + return i; + } + + } -- Gitblit v1.9.1