| | |
| | | package com.matrix.system.hive.service.imp; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import com.matrix.component.rabbitmq.RabiitMqTemplate; |
| | | 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.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; |
| | | |
| | |
| | | private ShoppingGoodsService shoppingGoodsService; |
| | | |
| | | @Autowired |
| | | private RabiitMqTemplate rabiitMqTemplate; |
| | | private AsyncMessageManager asyncMessageManager; |
| | | |
| | | |
| | | @Autowired |
| | |
| | | @Autowired |
| | | SysVipInfoDao sysVipInfoDao; |
| | | |
| | | @Value("${evn}") |
| | | private String evn; |
| | | |
| | | |
| | | /** |
| | |
| | | taocan.setIsOver(Dictionary.FLAG_YES_Y); |
| | | taocan.setSurplusCount(0); |
| | | taocan.setStatus(Dictionary.TAOCAN_STATUS_WX); |
| | | } else if (Dictionary.FLAG_YES_Y.equals(taocan.getIsCourse())) { |
| | | 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); |
| | | } |
| | | } else if ( |
| | | Dictionary.FLAG_NO_N.equals(taocan.getIsCourse()) |
| | | || (Dictionary.FLAG_YES_Y.equals(taocan.getIsCourse()) |
| | | && (StringUtils.isBlank(taocan.getIsInfinite()) || Dictionary.FLAG_NO_N.equals(taocan.getIsInfinite())))) { |
| | | |
| | | if (tcSurplusCount == 0) { |
| | | taocan.setIsOver(Dictionary.FLAG_YES_Y); |
| | | taocan.setStatus(Dictionary.TAOCAN_STATUS_WX); |
| | | } |
| | | //任选套餐检查套餐整体剩余次数 |
| | | 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); |
| | | } |
| | | } |
| | | |
| | |
| | | Date useInvalidTime = shoppingGoodsService.calInvalidTime(taocanInfo, 2, sysProjUse.getFailTime()); |
| | | taocan.setFailTime(useInvalidTime); |
| | | } |
| | | taocan.setBalance(MoneyUtil.sub(taocan.getBalance(), bcxfje)); |
| | | sysProjUseDao.updateSurplusCount(taocan); |
| | | } |
| | | |
| | |
| | | if (sysProjUse.getSurplusCount() == 0) { |
| | | upProjUse.setIsOver(Dictionary.DELETED_N); |
| | | 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(); |
| | | upProjUse.setSurplusCount(surplus); |
| | | upProjUse.setBalance(MoneyUtil.add(sysProjUse.getBalance(), sysProjUse.getPrice())); |
| | | |
| | | BigDecimal backBlance = new BigDecimal(sysProjUse.getPrice() * beauticianState.getCount()); |
| | | |
| | | upProjUse.setBalance(MoneyUtil.add(sysProjUse.getBalance(), backBlance.doubleValue())); |
| | | |
| | | |
| | | if (sysProjUse.getTaocanId() != null) { |
| | | SysProjUse taocanProjUse = sysProjUseDao.selectById(sysProjUse.getTaocanId()); |
| | | 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 (StringUtils.isBlank(taocanProjUse.getIsInfinite()) || Dictionary.FLAG_NO_N.equals(taocanProjUse.getIsInfinite())) { |
| | | taocanProjUse.setSurplusCount(taocanProjUse.getSurplusCount() + beauticianState.getCount()); |
| | | } |
| | | } |
| | | sysProjUseDao.update(taocanProjUse); |
| | | } |
| | | |
| | | |
| | | // 取消时,判断该项目之前是否有使用过,若使用过则非第一次使用,则不更新有效日期,若未使用表明此次为第一次使用,则更新有效日期为购买日期或统一失效日期 |
| | | List<SysBeauticianState> hasBeautician = beauticianStateDao.selectBeauticianStateByPuseIdAndNoStatus(beauticianState.getPuseId(), Dictionary.BEATUI_STATE_YYQX); |
| | |
| | | //发送微信公众号提醒 |
| | | 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); |
| | | |
| | | return result; |
| | | } |
| | |
| | | */ |
| | | private void addVipScore(SysProjServices projServices) { |
| | | |
| | | SysVipInfo vipInfo =sysVipInfoDao.selectById(projServices.getVipId()); |
| | | SysVipInfo vipInfo = sysVipInfoDao.selectById(projServices.getVipId()); |
| | | |
| | | List<SysBeauticianState> sysBeauticianStates = beauticianStateDao.selectBySerIds(projServices.getId()); |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | int selfScore =principalConsumScore[0]+giveConsumScore[0]; |
| | | int parentScore =principalConsumScore[1]+giveConsumScore[1]; |
| | | int topParentScore =principalConsumScore[2]+giveConsumScore[2]; |
| | | int selfScore = principalConsumScore[0] + giveConsumScore[0]; |
| | | int parentScore = principalConsumScore[1] + giveConsumScore[1]; |
| | | int topParentScore = principalConsumScore[2] + giveConsumScore[2]; |
| | | |
| | | //添加自己的积分 |
| | | if (selfScore > 0) { |
| | |
| | | |
| | | 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())) { |
| | | for (SysOutStoreItem item : projServicesVo.getOutStoreItem()) { |
| | | if (item.getAmount() != null && item.getAmount() > 0) { |
| | | return true; |