|  |  | 
 |  |  | import com.matrix.core.pojo.PaginationVO; | 
 |  |  | import com.matrix.core.pojo.VerifyResult; | 
 |  |  | import com.matrix.core.tools.DateUtil; | 
 |  |  | import com.matrix.core.tools.StringUtils; | 
 |  |  | 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.dto.ServiceVipProjDto; | 
 |  |  | import com.matrix.system.app.mapper.SysBeauticianStateMapper; | 
 |  |  | import com.matrix.system.app.mapper.SysProjServiceMapper; | 
 |  |  | import com.matrix.system.app.mapper.SysProjUseMapper; | 
 |  |  | import com.matrix.system.app.vo.*; | 
 |  |  | import com.matrix.system.common.bean.SysUsers; | 
 |  |  | import com.matrix.system.common.tools.DataAuthUtil; | 
 |  |  | import com.matrix.system.constance.Dictionary; | 
 |  |  | import com.matrix.system.hive.bean.SysBeauticianState; | 
 |  |  | import com.matrix.system.hive.bean.SysProjServices; | 
 |  |  | 
 |  |  |  | 
 |  |  | import java.util.ArrayList; | 
 |  |  | import java.util.Arrays; | 
 |  |  | import java.util.Date; | 
 |  |  | import java.util.List; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  | 
 |  |  |     @ApiResponses({ | 
 |  |  |             @ApiResponse(code = 200, message = "ok", response = ServiceProductListVo.class) | 
 |  |  |     }) | 
 |  |  |     @GetMapping(value = "/findVipProject/{vipId}") | 
 |  |  |     public AjaxResult findVipProject(@PathVariable("vipId") Long vipId) { | 
 |  |  |         SysVipInfo vipInfo = sysVipInfoService.findById(vipId); | 
 |  |  |     @PostMapping(value = "/findVipProject") | 
 |  |  |     public AjaxResult findVipProject(@RequestBody @Validated ServiceVipProjDto serviceVipProjDto) { | 
 |  |  |         SysVipInfo vipInfo = sysVipInfoService.findById(serviceVipProjDto.getVipId()); | 
 |  |  |  | 
 |  |  |         if (vipInfo == null) { | 
 |  |  |             throw new GlobleException("会员不存在"); | 
 |  |  | 
 |  |  |  | 
 |  |  |         ServiceProductListVo productListVo = new ServiceProductListVo(); | 
 |  |  |         productListVo.setName(vipInfo.getVipName()); | 
 |  |  |         productListVo.setVipId(vipId); | 
 |  |  |         productListVo.setVipId(serviceVipProjDto.getVipId()); | 
 |  |  |  | 
 |  |  |         SysProjUse queryUse = new SysProjUse(); | 
 |  |  |         queryUse.setVipId(vipId); | 
 |  |  |         queryUse.setVipId(serviceVipProjDto.getVipId()); | 
 |  |  |         queryUse.setType(Dictionary.SHOPPING_GOODS_TYPE_XM); | 
 |  |  |         queryUse.setTaocanId(-1L); | 
 |  |  |         queryUse.setStatus(Dictionary.TAOCAN_STATUS_YX); | 
 |  |  |         queryUse.setIsOver(Dictionary.FLAG_NO_N); | 
 |  |  |         if (serviceVipProjDto.getType() != null) { | 
 |  |  |             switch (serviceVipProjDto.getType()) { | 
 |  |  |                 case "0": | 
 |  |  |                     break; | 
 |  |  |                 case "1": | 
 |  |  |                     queryUse.setStatus(Dictionary.TAOCAN_STATUS_YX); | 
 |  |  |                     queryUse.setIsOver(Dictionary.FLAG_NO_N); | 
 |  |  |                     break; | 
 |  |  |                 case "2": | 
 |  |  |                     queryUse.setStatus(Dictionary.TAOCAN_STATUS_WX); | 
 |  |  |                     queryUse.setIsOver(Dictionary.FLAG_YES_Y); | 
 |  |  |                     break; | 
 |  |  |                 case "3": | 
 |  |  |                     queryUse.setTargetFailTime(DateUtil.getDateAfterMonth(new Date(), 1)); | 
 |  |  |                     break; | 
 |  |  |                 default: | 
 |  |  |                     queryUse.setStatus(Dictionary.TAOCAN_STATUS_YX); | 
 |  |  |                     queryUse.setIsOver(Dictionary.FLAG_NO_N); | 
 |  |  |                     break; | 
 |  |  |             } | 
 |  |  |         } else { | 
 |  |  |             queryUse.setStatus(Dictionary.TAOCAN_STATUS_YX); | 
 |  |  |             queryUse.setIsOver(Dictionary.FLAG_NO_N); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         queryUse.setQueryKey(serviceVipProjDto.getQueryKey()); | 
 |  |  |         List<SysProjUse> projList = projUseService.findInPage(queryUse, null); | 
 |  |  |         List<ServiceProjVo> serviceProjVos = SysProjUseMapper.INSTANCE.entityListToProjVoList(projList); | 
 |  |  |  | 
 |  |  | 
 |  |  |     public AjaxResult createServiceOrder(@RequestBody @Validated CreateServiceOrderDto serviceOrderDto) { | 
 |  |  |         if (CollectionUtils.isEmpty(serviceOrderDto.getProjItems())) { | 
 |  |  |             throw new GlobleException("请选择服务"); | 
 |  |  |         } | 
 |  |  |         SysVipInfo vipInfo = sysVipInfoService.findById(serviceOrderDto.getVipId()); | 
 |  |  | //        if (StringUtils.isBlank(vipInfo.getPassWord())) { | 
 |  |  | //            return AjaxResult.buildFailInstance("未设置资金密码"); | 
 |  |  | //        } | 
 |  |  |  | 
 |  |  |         if (StringUtils.isNotBlank(vipInfo.getPassWord())) { | 
 |  |  |             if (!vipInfo.getPassWord().equals(serviceOrderDto.getPassword())) { | 
 |  |  |                 return AjaxResult.buildFailInstance("资金密码错误"); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         SysProjServices sysProjServices = new SysProjServices(); | 
 |  |  | 
 |  |  |         pageVo.setOffset(offset); | 
 |  |  |         pageVo.setLimit(limit); | 
 |  |  |  | 
 |  |  |         SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); | 
 |  |  |         orderListDto.setShopId(user.getShopId()); | 
 |  |  |         if (!DataAuthUtil.hasAllShopAuth()) { | 
 |  |  |             SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); | 
 |  |  |             orderListDto.setShopId(user.getShopId()); | 
 |  |  |             orderListDto.setUserId(user.getSuId()); | 
 |  |  |         } | 
 |  |  |         return AjaxResult.buildSuccessInstance(projServicesService.findApiServiceOrderListInPage(orderListDto, pageVo), projServicesService.findApiServiceOrderListTotal(orderListDto)); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | 
 |  |  |         ajaxResult.putInMap("detail", detailVo); | 
 |  |  |         return ajaxResult; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @ApiOperation(value = "开始服务", notes = "开始服务") | 
 |  |  |     @GetMapping(value = "/startService/{id}") | 
 |  |  |     public AjaxResult startService(@PathVariable("id") Long id) { | 
 |  |  |         SysProjServices sysProjServices = new SysProjServices(); | 
 |  |  |         sysProjServices.setId(id); | 
 |  |  |         int i = projServicesService.modifyFWKSProjServices(sysProjServices); | 
 |  |  |         if (i > 0) { | 
 |  |  |             return AjaxResult.buildSuccessInstance("开始服务成功"); | 
 |  |  |         } | 
 |  |  |         return AjaxResult.buildFailInstance("开始服务失败"); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @ApiOperation(value = "结束服务", notes = "结束服务") | 
 |  |  |     @GetMapping(value = "/stopService/{id}") | 
 |  |  |     public AjaxResult stopService(@PathVariable("id") Long id) { | 
 |  |  |         SysProjServices projServvices = new SysProjServices(); | 
 |  |  |         projServvices.setId(id); | 
 |  |  |         int result = projServicesService.modifyFWJSrojServices(projServvices); | 
 |  |  |         if (result > 0) { | 
 |  |  |             return new AjaxResult(AjaxResult.STATUS_SUCCESS, "结束服务成功"); | 
 |  |  |         } else { | 
 |  |  |             return new AjaxResult(AjaxResult.STATUS_FAIL, "结束服务失败"); | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @ApiOperation(value = "取消服务", notes = "取消服务") | 
 |  |  |     @GetMapping(value = "/cancelService/{id}") | 
 |  |  |     public AjaxResult cancelService(@PathVariable("id") Long id) { | 
 |  |  |         SysProjServices services = new SysProjServices(); | 
 |  |  |         services.setId(id); | 
 |  |  |         int i = projServicesService.modifyCancelProjServices(services); | 
 |  |  |         if (i > 0) { | 
 |  |  |             return new AjaxResult(AjaxResult.STATUS_SUCCESS, "取消预约成功"); | 
 |  |  |         } else { | 
 |  |  |             return new AjaxResult(AjaxResult.STATUS_FAIL, "取消预约失败"); | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  | } |