| | |
| | | package com.matrix.system.app.action; |
| | | |
| | | import com.matrix.core.constance.MatrixConstance; |
| | | import com.matrix.core.exception.GlobleException; |
| | | import com.matrix.core.pojo.AjaxResult; |
| | | import com.matrix.core.pojo.PaginationVO; |
| | | import com.matrix.core.pojo.VerifyResult; |
| | | import com.matrix.core.tools.WebUtil; |
| | | import com.matrix.system.app.dto.CreateServiceOrderDto; |
| | | import com.matrix.system.app.dto.ServiceOrderListDto; |
| | | import com.matrix.system.app.mapper.SysBeauticianStateMapper; |
| | | import com.matrix.system.app.mapper.SysProjUseMapper; |
| | | import com.matrix.system.app.vo.ServiceOrderListVo; |
| | | import com.matrix.system.app.vo.ServiceProductListVo; |
| | | import com.matrix.system.app.vo.ServiceProjVo; |
| | | import com.matrix.system.app.vo.ServiceTcVo; |
| | | import com.matrix.system.common.bean.SysUsers; |
| | | import com.matrix.system.constance.Dictionary; |
| | | import com.matrix.system.hive.bean.SysBeauticianState; |
| | | import com.matrix.system.hive.bean.SysProjServices; |
| | | import com.matrix.system.hive.bean.SysProjUse; |
| | | import com.matrix.system.hive.bean.SysVipInfo; |
| | | import com.matrix.system.hive.plugin.util.CollectionUtils; |
| | |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | |
| | | @ApiOperation(value = "提交服务单", notes = "提交服务单") |
| | | @PostMapping(value = "/createServiceOrder") |
| | | public AjaxResult createServiceOrder() { |
| | | return null; |
| | | public AjaxResult createServiceOrder(@RequestBody @Validated CreateServiceOrderDto serviceOrderDto) { |
| | | if (CollectionUtils.isNotEmpty(serviceOrderDto.getProjItems())) { |
| | | throw new GlobleException("请选择服务"); |
| | | } |
| | | |
| | | SysProjServices sysProjServices = new SysProjServices(); |
| | | sysProjServices.setVipId(serviceOrderDto.getVipId()); |
| | | sysProjServices.setYyTime(serviceOrderDto.getYyTime()); |
| | | sysProjServices.setRemark(serviceOrderDto.getRemark()); |
| | | List<SysBeauticianState> sysBeauticianStates = SysBeauticianStateMapper.INSTANCE.orderItmesVoToEntityList(serviceOrderDto.getProjItems()); |
| | | sysProjServices.setServiceItems(sysBeauticianStates); |
| | | |
| | | //检测欠款 |
| | | VerifyResult arrearsVerifyResult = projServicesService.checkArrears(sysProjServices); |
| | | if (arrearsVerifyResult.isError()) { |
| | | return new AjaxResult(AjaxResult.STATUS_FAIL, arrearsVerifyResult.getMsg()); |
| | | } |
| | | //检测余次 |
| | | VerifyResult balanceverifyResult = projServicesService.checkBalance(sysProjServices); |
| | | if (balanceverifyResult.isError()) { |
| | | return new AjaxResult(AjaxResult.STATUS_FAIL, balanceverifyResult.getMsg()); |
| | | } |
| | | SysProjServices newSysProjServices = projServicesService.addSysProjServices(sysProjServices); |
| | | if (newSysProjServices != null) { |
| | | return AjaxResult.buildSuccessInstance(Arrays.asList(newSysProjServices)); |
| | | } else { |
| | | return new AjaxResult(AjaxResult.STATUS_FAIL, "下单失败!"); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation(value = "查询服务单列表", notes = "查询服务单列表") |