| | |
| | | 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; |
| | |
| | | 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; |
| | | |
| | |
| | | @Resource |
| | | private ShoppingGoodsService shoppingGoodsService; |
| | | |
| | | @Autowired |
| | | private RabiitMqTemplate rabiitMqTemplate; |
| | | |
| | | @Value("${evn}") |
| | | private String evn; |
| | | |
| | | |
| | | /** |
| | | * 新增服务单 jyy |
| | | * |
| | |
| | | taocan.setSurplusCount(0); |
| | | taocan.setStatus(Dictionary.TAOCAN_STATUS_WX); |
| | | } else if (Dictionary.FLAG_YES_Y.equals(taocan.getIsCourse())) { |
| | | //任选套餐检查套餐整体剩余次数 |
| | | int tcSurplusCount = taocan.getSurplusCount() - sysBeauticianState.getCount(); |
| | | 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); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | if (sysProjUse.getTaocanId() != null) { |
| | | //TODO 更新套餐状态为有效 |
| | | SysProjUse taocanProjUse = sysProjUseDao.selectById(sysProjUse.getTaocanId()); |
| | | if (taocanProjUse.getSurplusCount() == 0) { |
| | | taocanProjUse.setIsOver(Dictionary.DELETED_N); |
| | | taocanProjUse.setStatus(Dictionary.MONEYCARD_STATUS_YX); |
| | | } |
| | | taocanProjUse.setIsOver(Dictionary.DELETED_N); |
| | | taocanProjUse.setStatus(Dictionary.MONEYCARD_STATUS_YX); |
| | | |
| | | if (Dictionary.FLAG_YES_Y.equals(taocanProjUse.getIsCourse())) { |
| | | taocanProjUse.setSurplusCount(taocanProjUse.getSurplusCount() + beauticianState.getCount()); |
| | | if (StringUtils.isBlank(taocanProjUse.getIsInfinite()) || Dictionary.FLAG_NO_N.equals(taocanProjUse.getIsInfinite())) { |
| | | taocanProjUse.setSurplusCount(taocanProjUse.getSurplusCount() + beauticianState.getCount()); |
| | | } |
| | | } |
| | | sysProjUseDao.update(taocanProjUse); |
| | | } |
| | |
| | | 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; |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public List<ServiceOrderListVo> findApiServiceOrderListInPage(ServiceOrderListDto serviceOrderListDto, PaginationVO pageVo) { |
| | | return sysProjServicesDao.selectApiServiceOrderListInPage(serviceOrderListDto, pageVo); |
| | | } |
| | | |
| | | @Override |
| | | public int findApiServiceOrderListTotal(ServiceOrderListDto serviceOrderListDto) { |
| | | return sysProjServicesDao.selectApiServiceOrderListTotal(serviceOrderListDto); |
| | | } |
| | | } |