From 241a49f9653aa83d1dcd9bf646208da3157df35a Mon Sep 17 00:00:00 2001 From: 935090232@qq.com <ak473600000> Date: Mon, 05 Apr 2021 22:48:14 +0800 Subject: [PATCH] 合并BizUser表与SysVipInfo表 大部分逻辑已经修正 可能存在问题的 1、拼团秒杀 2、分享图 3、分销结算 --- zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysProjServicesServiceImpl.java | 380 +++++++++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 321 insertions(+), 59 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 ba5d616..d9831f9 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,31 +1,40 @@ 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; 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.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; import com.matrix.system.common.bean.SysUsers; +import com.matrix.system.common.dao.BusParameterSettingsDao; import com.matrix.system.common.dao.SysUsersDao; import com.matrix.system.constance.Dictionary; import com.matrix.system.hive.bean.*; import com.matrix.system.hive.dao.*; -import com.matrix.core.tools.DateUtil; 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.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.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; import javax.annotation.Resource; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; +import java.util.*; import java.util.stream.Collectors; /** @@ -100,6 +109,23 @@ @Resource private ShoppingGoodsService shoppingGoodsService; + @Autowired + private RabiitMqTemplate rabiitMqTemplate; + + + @Autowired + BusParameterSettingsDao busParameterSettingsDao; + + @Autowired + ScoreVipDetailService scoreVipDetailService; + + @Autowired + SysVipInfoDao sysVipInfoDao; + + @Value("${evn}") + private String evn; + + /** * 新增服务单 jyy * @@ -110,13 +136,15 @@ public SysProjServices addSysProjServices(SysProjServices sysProjServices) throws GlobleException { //创建服务单 - SysUsers user = (SysUsers) WebUtil.getSession().getAttribute(MatrixConstance.LOGIN_KEY); - sysProjServices.setCreateStaffId(user.getSuId()); - sysProjServices.setShopId(user.getShopId()); - sysProjServices.setCompanyId(user.getCompanyId()); + 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()); + } + + sysProjServices.setCreateTime(new Date()); - // 设置状态为待预约 - sysProjServices.setState(Dictionary.SERVICE_STATU_DYY); sysProjServices.setServiceNo(codeService.getServiceOrderCode()); Double hkPrice = 0.0; int i = sysProjServicesDao.insert(sysProjServices); @@ -168,19 +196,27 @@ 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); + } } } // 根据套餐内所有项目查询该套餐是否第一次使用,若第一次使用则更新该套餐有效期 List<SysBeauticianState> taocanHas = beauticianStateDao.selectByProjUse(taocanProjUses, Dictionary.SERVICE_STATU_YYQX); if (CollectionUtils.isEmpty(taocanHas)) { - Date useInvalidTime = shoppingGoodsService.calInvalidTime(sysProjInfo, 2, sysProjUse.getFailTime()); + ShoppingGoods taocanInfo = shoppingGoodsDao.selectById(taocan.getProjId()); + Date useInvalidTime = shoppingGoodsService.calInvalidTime(taocanInfo, 2, sysProjUse.getFailTime()); taocan.setFailTime(useInvalidTime); } sysProjUseDao.updateSurplusCount(taocan); @@ -192,7 +228,7 @@ //插入订单明细 sysBeauticianState.setProjId(sysProjInfo.getId()); sysBeauticianState.setServicesId(sysProjServices.getId()); - sysBeauticianState.setShopId(user.getShopId()); + sysBeauticianState.setShopId(sysProjServices.getShopId()); sysBeauticianState.setState(Dictionary.BEATUI_STATE_DYY); beauticianStateDao.insert(sysBeauticianState); } @@ -279,15 +315,13 @@ */ @Override public VerifyResult checkArrears(SysProjServices sysProjServices) { - //检测欠款 - /* for (SysBeauticianState sysBeauticianState : sysProjServices.getServiceItems()) { - + // 检测欠款 + /*for (SysBeauticianState sysBeauticianState : sysProjServices.getServiceItems()) { SysProjUse sysProjUse = projUseService.findById(sysBeauticianState.getPuseId()); - - ShoppingGoods shoppingGoods = shoppingGoodsDao.selectById(sysProjUse.getProjId()); - SysOrderItem orderItem = sysOrderItemService.findById(sysProjUse.getOrderItemId()); + SysOrderItem item = sysOrderItemService.findById(sysProjUse.getOrderItemId()); + SysOrder orderItem = sysOrderService.findById(item.getOrderId()); if ("购买".equals(sysProjUse.getSource())) { // 如果用户有欠款,服务单总价不能超过已付金额 if (orderItem!=null && orderItem.getArrears() > 0) { @@ -303,13 +337,13 @@ double money = MoneyUtil.sub((bj - orderItem.getArrears()), (yxfje + bcxfje)); // 如果 已付金额 - (已消费金额+本次消费金额)<0 则不能再消费 if (money < 0) { - return new VerifyResult(true, shoppingGoods.getName() + "存在欠款" + orderItem.getArrears() + "元 , 订单编号[ " + sysOrderService.findById(orderItem.getOrderId()).getOrderNo() + " ] "); + return new VerifyResult(true, shoppingGoods.getName() + "存在欠款" + orderItem.getArrears() + "元 , 订单编号[ " + orderItem.getOrderNo() + " ] "); } } } else if ("赠送".equals(sysProjUse.getSource())) { - if (orderItem!=null &&orderItem.getArrears() > 0) { + if (orderItem!=null && orderItem.getArrears()!=null&&orderItem.getArrears() > 0) { return new VerifyResult(true, shoppingGoods.getName() + "存在欠款" + orderItem.getArrears() + "元 , 不能消费赠送项目,订单编号[ " + sysOrderService.findById(orderItem.getOrderId()).getOrderNo() + " ] "); } } @@ -370,6 +404,7 @@ if (beauticianStateDao.checkBeauticianClash(beauticianState) > 0) { throw new GlobleException("该美疗师已被占用,请重新分配!"); } +// beauticianState.setExcTime(beauticianState.getProjInfo().getTimeLength()); beauticianState.setState(Dictionary.BEATUI_STATE_YYY); beauticianStateDao.update(beauticianState); @@ -380,7 +415,7 @@ // 设置成功状态 - projServices.setState(Dictionary.SERVICE_STATU_YYCG); + projServices.setState(Dictionary.SERVICE_STATU_XPL); // 判断当前门店是否有历史美疗师 LastestWorkBeatuistaff lastWorkStaff = new LastestWorkBeatuistaff(); lastWorkStaff.setShopId(checkProjServices.getShopId()); @@ -462,6 +497,9 @@ sysOutStoreDao.deleteById(sysOutStore.getId()); sysOutStoreItemDao.deleteByOrderId(sysOutStore.getId()); } + //删除积分 + scoreVipDetailService.removeByBusinessId(checkProjServices.getVipId(), checkProjServices.getId()); + //更新服务单状态 return sysProjServicesDao.update(checkProjServices); } @@ -473,8 +511,14 @@ */ private void backProjCount(SysProjServices projServices) { List<SysBeauticianState> beauticianStateList = beauticianStateDao.selectBySerIds(projServices.getId()); + + Map<Long, List<SysProjUse>> taocanMap = new HashMap<>(); // 回退项目余额 for (SysBeauticianState beauticianState : beauticianStateList) { + // 该修改为 有效日期判断更新所有 + beauticianState.setState(Dictionary.BEATUI_STATE_YYQX); + beauticianStateDao.update(beauticianState); + SysProjUse sysProjUse = sysProjUseDao.selectById(beauticianState.getPuseId()); if (sysProjUse != null && sysProjUse.getId() != null) { sysProjUse = sysProjUseDao.selectById(sysProjUse.getId()); @@ -487,12 +531,56 @@ 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())); + + // 取消时,判断该项目之前是否有使用过,若使用过则非第一次使用,则不更新有效日期,若未使用表明此次为第一次使用,则更新有效日期为购买日期或统一失效日期 + List<SysBeauticianState> hasBeautician = beauticianStateDao.selectBeauticianStateByPuseIdAndNoStatus(beauticianState.getPuseId(), Dictionary.BEATUI_STATE_YYQX); + if (hasBeautician.isEmpty()) { + ShoppingGoods shoppingGoods = shoppingGoodsDao.selectById(beauticianState.getProjId()); + Date useInvalidTime = shoppingGoodsService.calInvalidTime(shoppingGoods, 1, null); + upProjUse.setFailTime(useInvalidTime); + } + + if (sysProjUse.getTaocanId() != null) { + List<SysProjUse> sysProjUses = taocanMap.get(sysProjUse.getTaocanId()); + if (CollectionUtils.isEmpty(sysProjUses)) { + List<SysProjUse> taocanItems = new ArrayList<>(); + taocanItems.add(sysProjUse); + taocanMap.put(sysProjUse.getTaocanId(), taocanItems); + } else { + sysProjUses.add(sysProjUse); + taocanMap.put(sysProjUse.getTaocanId(), sysProjUses); + } + } sysProjUseDao.updateSurplusCount(upProjUse); + } + } + + if (taocanMap.size() != 0) { + for (Map.Entry<Long, List<SysProjUse>> entry : taocanMap.entrySet()) { + List<SysBeauticianState> taocanUse = beauticianStateDao.selectByProjUse(entry.getValue(), Dictionary.BEATUI_STATE_YYQX); + if (CollectionUtils.isEmpty(taocanUse)) { + SysProjUse taocan = sysProjUseDao.selectById(entry.getKey()); + ShoppingGoods shoppingGoods = shoppingGoodsDao.selectById(taocan.getProjId()); + Date buyInvalidDate = shoppingGoodsService.calInvalidTime(shoppingGoods, 1, null); + taocan.setFailTime(buyInvalidDate); + + sysProjUseDao.update(taocan); + } } } } @@ -505,13 +593,153 @@ 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()); - return sysProjServicesDao.update(projServices); + int result = sysProjServicesDao.update(projServices); + achieveNewService.addAchieveByServiceOrder(projServices); + + //设置会员积分 + addVipScore(projServices); + + //发送微信公众号提醒 + UniformMsgParam uniformMsgParam = new UniformMsgParam(projServices.getCompanyId(), UniformMsgParam.GZH_FWWC); + uniformMsgParam.put("serviceId", projServices.getId()); + rabiitMqTemplate.sendMsg(MQTaskRouting.SEND_UNIFORM_TEMPLATE_MSG + evn, uniformMsgParam.toJSONString()); + + + + + return result; } + + } + /** + * 设置会员消费积分 + */ + private void addVipScore(SysProjServices projServices) { + + SysVipInfo vipInfo =sysVipInfoDao.selectById(projServices.getVipId()); + + List<SysBeauticianState> sysBeauticianStates = beauticianStateDao.selectBySerIds(projServices.getId()); + + + double principalPrice = 0D; + double giftPrice = 0D; + for (SysBeauticianState sysBeauticianState : sysBeauticianStates) { + SysProjUse projUse = sysBeauticianState.getProjUse(); + if (projUse.getSource().equals(Dictionary.TAOCAN_SOURCE_ZS)) { + giftPrice += projUse.getPrice(); + } else { + principalPrice += projUse.getPrice(); + } + } + + int[] principalConsumScore = {0, 0, 0}; + BusParameterSettings principalConsumption = busParameterSettingsDao.selectCompanyParamByCode(ScoreSettingConstant.PRINCIPAL_CONSUMPTION, vipInfo.getCompanyId()); + //本金消耗 + if (principalPrice > 0 + && StringUtils.isNotBlank(principalConsumption.getParamValue())) { + + principalConsumScore[0] = (int) (principalPrice / Double.parseDouble(principalConsumption.getParamValue())); + + if (StringUtils.isNotBlank(principalConsumption.getParamValue1())) { + principalConsumScore[1] = (int) (principalPrice / Double.parseDouble(principalConsumption.getParamValue1())); + } + + if (StringUtils.isNotBlank(principalConsumption.getParamValue2())) { + principalConsumScore[2] = (int) (principalPrice / Double.parseDouble(principalConsumption.getParamValue2())); + } + } + + int[] giveConsumScore = {0, 0, 0}; + BusParameterSettings giveConsumption = busParameterSettingsDao.selectCompanyParamByCode(ScoreSettingConstant.GIVE_CONSUMPTION, vipInfo.getCompanyId()); + //本金消耗 + if (giftPrice > 0 + && StringUtils.isNotBlank(giveConsumption.getParamValue())) { + + giveConsumScore[0] = (int) (giftPrice / Double.parseDouble(giveConsumption.getParamValue())); + + if (StringUtils.isNotBlank(giveConsumption.getParamValue1())) { + giveConsumScore[1] = (int) (giftPrice / Double.parseDouble(giveConsumption.getParamValue1())); + } + + if (StringUtils.isNotBlank(giveConsumption.getParamValue2())) { + giveConsumScore[2] = (int) (giftPrice / Double.parseDouble(giveConsumption.getParamValue2())); + } + } + + int selfScore =principalConsumScore[0]+giveConsumScore[0]; + int parentScore =principalConsumScore[1]+giveConsumScore[1]; + int topParentScore =principalConsumScore[2]+giveConsumScore[2]; + + //添加自己的积分 + if (selfScore > 0) { + scoreVipDetailService.addScore( + vipInfo.getId(), + projServices.getCreateStaffId(), + projServices.getShopId(), + selfScore, + projServices.getId(), + ScoreVipDetail.SCORE_VIP_TYPE_CASH, + "消耗奖励" + ); + } + + if (vipInfo.getRecommendId() != null) { + //推荐注册老带新积分奖励 + SysVipInfo referrerVip = sysVipInfoDao.selectById(vipInfo.getRecommendId()); + if (parentScore > 0) { + scoreVipDetailService.addScore( + referrerVip.getId(), + projServices.getCreateStaffId(), + projServices.getShopId(), + parentScore, + projServices.getId(), + ScoreVipDetail.SCORE_VIP_TYPE_CASH, + "推荐消耗奖励" + ); + } + //推荐注册二级带新积分奖励 + if (referrerVip.getRecommendId() != null) { + SysVipInfo topVipInfo = sysVipInfoDao.selectById(referrerVip.getRecommendId()); + if (topParentScore > 0) { + scoreVipDetailService.addScore( + topVipInfo.getId(), + projServices.getCreateStaffId(), + projServices.getShopId(), + topParentScore, + projServices.getId(), + ScoreVipDetail.SCORE_VIP_TYPE_CASH, + "推荐消耗奖励" + ); + } + } + } + } // 派单 jyy @@ -544,7 +772,7 @@ @Override public int modifyPLProjServices(SysProjServices projServicesVo) throws GlobleException { SysProjServices projServices = sysProjServicesDao.selectById(projServicesVo.getId()); - + SysUsers sysUsers = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); if (!projServices.getState().equals(Dictionary.SERVICE_STATU_XPL)) { throw new GlobleException("该服务单状态为" + projServices.getState() + ",不可以进行当前操作!"); } @@ -556,10 +784,10 @@ outStore.setOutStoreNo(codeService.getOutStoreCode()); outStore.setShopId(projServices.getShopId()); - if(projServices.getDevisionId()!=null){ + if (projServices.getDevisionId() != null) { outStore.setStaffId(projServices.getDevisionId()); - }else{ - SysUsers sysUsers = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); + } else { + outStore.setStaffId(sysUsers.getSuId()); } outStore.setServiceId(projServices.getId()); @@ -583,7 +811,7 @@ double sum = stores.stream().mapToDouble(item2 -> item2.getStoreTotal()).sum(); Double needAmount = MoneyUtil.div(item.getAmount(), Double.valueOf(shoppingGoods.getVolume())); if (sum < needAmount) { - throw new GlobleException("出库失败:【" + shoppingGoods.getName() + "库存不足】"); + throw new GlobleException("出库失败:【" + shoppingGoods.getName() + "-" + shoppingGoods.getCode() + "库存不足】"); } //循环获取所有批次产品,并扣减库存 for (SysStoreInfo storeInfo : stores) { @@ -599,8 +827,6 @@ sysOutStoreItem.setStoreId(storeInfo.getId()); sysOutStoreItem.setAmount(oldStoreTotal - storeInfo.getStoreTotal()); realOutStoreItemList.add(sysOutStoreItem); - - storeInfoDao.update(storeInfo); //扣除后剩余库存大于0则跳出扣除,否则剩余数量的负数的绝对值就是再次扣减的数量 if (surplus > 0) { @@ -614,40 +840,46 @@ LogUtil.debug("未选择配料跳过sku={},amount={}", item.getSkuId(), item.getAmount()); } } - sysOutStoreItemDao.batchInsert(realOutStoreItemList); + } + // 设置服务单状态 +// projServices.setState(Dictionary.SERVICE_STATU_PLWC); + if (projServices.getDevisionId() == null) { + //如果没有设置配料师则默认为操作配料的人为配料师 + projServices.setDevisionId(sysUsers.getSuId()); } - // 设置服务单状态 - projServices.setState(Dictionary.SERVICE_STATU_PLWC); - // 设置服务单操作流水 - // TODO 本功能待完善记录最新的排班员工 - /* List<LastestWorkBeatuistaff> lastList = LastestWorkBeatuistaffDao.selectByModel(null); - LastestWorkBeatuistaff lastWork = new LastestWorkBeatuistaff(); - if (lastList.size() > 0) { - lastWork.setChangeDate(new Date()); - lastWork.setStaffId(projServices.getBeauticianId()); - LastestWorkBeatuistaffDao.insert(lastWork); - } else { - - //TODO 有bug集合为零了 - LastestWorkBeatuistaff modifyObj = lastList.get(0); - modifyObj.setChangeDate(new Date()); - modifyObj.setStaffId(projServices.getBeauticianId()); - LastestWorkBeatuistaffDao.update(modifyObj); - }*/ - + // 判断是否跳过开始/结束服务 + 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); return sysProjServicesDao.update(projServices); } /** * 服务单收费需要生成出库记录 + * * @param projServicesVo * @return */ private boolean isNeedOutStore(SysProjServices projServicesVo) { - if(CollectionUtils.isNotEmpty(projServicesVo.getOutStoreItem())){ + if (CollectionUtils.isNotEmpty(projServicesVo.getOutStoreItem())) { for (SysOutStoreItem item : projServicesVo.getOutStoreItem()) { if (item.getAmount() != null && item.getAmount() > 0) { return true; @@ -704,7 +936,6 @@ SysBeauticianState checkBeauticianState = new SysBeauticianState(); checkBeauticianState.setServicesId(projServices.getId()); checkBeauticianState.setState(Dictionary.BEATUI_STATE_FWJS); - checkBeauticianState.setStaffId(users.getSuId()); int rerunlt = beauticianStateDao.chengItemState(checkBeauticianState); // 验证是否是最后一个美疗师结束服务 @@ -734,7 +965,6 @@ } return rerunlt; - } @Override @@ -749,4 +979,36 @@ } + @Override + public List<ServiceOrderListVo> findApiServiceOrderListInPage(ServiceOrderListDto serviceOrderListDto, PaginationVO pageVo) { + return sysProjServicesDao.selectApiServiceOrderListInPage(serviceOrderListDto, pageVo); + } + + @Override + 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; + } } -- Gitblit v1.9.1