From 04f9d0857969531f13ccd296717a718f2cd702cf Mon Sep 17 00:00:00 2001 From: Helius <wangdoubleone@gmail.com> Date: Tue, 12 Jan 2021 16:34:24 +0800 Subject: [PATCH] modify --- zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysProjServicesServiceImpl.java | 64 ++++++++++++++++++++++++++----- 1 files changed, 53 insertions(+), 11 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 a32253b..cfb58f7 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,14 @@ package com.matrix.system.hive.service.imp; +import com.alibaba.fastjson.JSONObject; +import com.matrix.component.rabbitmq.RabiitMqTemplate; 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.DateUtil; -import com.matrix.core.tools.LogUtil; -import com.matrix.core.tools.WebUtil; +import com.matrix.core.tools.*; +import com.matrix.system.app.dto.ServiceOrderListDto; +import com.matrix.system.app.vo.ServiceOrderListVo; import com.matrix.system.common.bean.SysUsers; import com.matrix.system.common.dao.SysUsersDao; import com.matrix.system.constance.Dictionary; @@ -16,9 +18,11 @@ import com.matrix.system.hive.plugin.util.MoneyUtil; import com.matrix.system.hive.pojo.MyBeauticianCount; import com.matrix.system.hive.service.*; +import com.matrix.system.shopXcx.mqTask.MQTaskRouting; 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; @@ -98,6 +102,13 @@ @Resource private ShoppingGoodsService shoppingGoodsService; + @Autowired + private RabiitMqTemplate rabiitMqTemplate; + + @Value("${evn}") + private String evn; + + /** * 新增服务单 jyy * @@ -166,12 +177,19 @@ taocan.setSurplusCount(0); taocan.setStatus(Dictionary.TAOCAN_STATUS_WX); } else if (Dictionary.FLAG_YES_Y.equals(taocan.getIsCourse())) { - //任选套餐检查套餐整体剩余次数 - int tcSurplusCount = taocan.getSurplusCount() - sysProjUse.getDeductionNum(); - if (tcSurplusCount < 0) { - throw new GlobleException(taocan.getProjName() + "已经达到最大使用次数"); - } else { - taocan.setSurplusCount(tcSurplusCount); + if (StringUtils.isBlank(taocan.getIsInfinite()) || Dictionary.FLAG_NO_N.equals(taocan.getIsInfinite())) { + //任选套餐检查套餐整体剩余次数 + int tcSurplusCount = taocan.getSurplusCount() - sysBeauticianState.getCount(); + if (tcSurplusCount < 0) { + throw new GlobleException(taocan.getProjName() + "已经达到最大使用次数"); + } else { + taocan.setSurplusCount(tcSurplusCount); + } + + if (tcSurplusCount == 0) { + taocan.setIsOver(Dictionary.FLAG_YES_Y); + taocan.setStatus(Dictionary.TAOCAN_STATUS_WX); + } } } @@ -492,6 +510,16 @@ upProjUse.setStatus(Dictionary.MONEYCARD_STATUS_YX); if (sysProjUse.getTaocanId() != null) { //TODO 更新套餐状态为有效 + SysProjUse taocanProjUse = sysProjUseDao.selectById(sysProjUse.getTaocanId()); + taocanProjUse.setIsOver(Dictionary.DELETED_N); + taocanProjUse.setStatus(Dictionary.MONEYCARD_STATUS_YX); + + 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); } } int surplus = sysProjUse.getSurplusCount() + beauticianState.getCount(); @@ -544,10 +572,15 @@ if (!projServices.getState().equals(Dictionary.SERVICE_STATU_FWWC)) { throw new GlobleException("该服务单状态为" + projServices.getState() + ",不可以进行当前操作!"); } else { - projServices.setState(Dictionary.SERVICE_STATU_FFJS); projServices.setConsumeTime(new Date()); - return sysProjServicesDao.update(projServices); + int result=sysProjServicesDao.update(projServices); + //发送微信公众号提醒 + JSONObject param=new JSONObject(); + param.put("companyId",projServices.getCompanyId()); + param.put("serviceId",projServices.getId()); + rabiitMqTemplate.sendMsg(MQTaskRouting.SEND_UNIFORM_TEMPLATE_MSG+evn,param.toJSONString()); + return result; } } @@ -788,4 +821,13 @@ } + @Override + public List<ServiceOrderListVo> findApiServiceOrderListInPage(ServiceOrderListDto serviceOrderListDto, PaginationVO pageVo) { + return sysProjServicesDao.selectApiServiceOrderListInPage(serviceOrderListDto, pageVo); + } + + @Override + public int findApiServiceOrderListTotal(ServiceOrderListDto serviceOrderListDto) { + return sysProjServicesDao.selectApiServiceOrderListTotal(serviceOrderListDto); + } } -- Gitblit v1.9.1