Helius
2022-05-24 560228ac3c15cccce0b2a5994d44e4e81b5b3b73
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
package com.matrix.system.padApi.action;
 
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.matrix.core.anotations.RemoveRequestToken;
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.DateUtil;
import com.matrix.core.tools.StringUtils;
import com.matrix.core.tools.WebUtil;
import com.matrix.system.common.bean.BusParameterSettings;
import com.matrix.system.common.bean.SysUsers;
import com.matrix.system.common.constance.AppConstance;
import com.matrix.system.common.dao.BusParameterSettingsDao;
import com.matrix.system.common.service.SysUsersService;
import com.matrix.system.common.tools.DataAuthUtil;
import com.matrix.system.constance.Dictionary;
import com.matrix.system.enums.BooleanEnum;
import com.matrix.system.hive.action.BaseController;
import com.matrix.system.hive.action.util.QueryUtil;
import com.matrix.system.hive.bean.*;
import com.matrix.system.hive.dao.*;
import com.matrix.system.hive.service.*;
import com.matrix.system.padApi.dto.PadServiceListDto;
import com.matrix.system.padApi.dto.PadSignServiceDto;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
 
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
 
@CrossOrigin(origins = "*")
@Api(value = "PadServiceAction", tags = "pad端服务单请求")
@RestController
@RequestMapping(value = "/api/pad/service")
public class PadServiceAction extends BaseController {
 
    @Resource
    private SysProjServicesService projServicesSerivce;
    @Resource
    private SysProjUseService projUseService;
    @Resource
    private SysBedInfoService bedInfoService;
    @Autowired
    SysProjGoodsDao sysProjGoodsDao;
    @Resource
    private SysProjServicesService sysProjServicesService;
    @Resource
    private SysVipInfoService sysVipInfoService;
    @Autowired
    private SysBeauticianStateDao beauticianStateDao;
    @Autowired
    AchieveNewService achieveNewService;
    @Autowired
    private SysBedStateDao sysBedStateDao;
    @Autowired
    ShoppingGoodsAssembleDao goodsAssembleDao;
    @Autowired
    SysShopInfoDao shopInfoDao;
    @Resource
    private SysUsersService usersService;
    @Autowired
    private SysProjServicesDao sysProjServicesDao;
    @Autowired
    BusParameterSettingsDao busParameterSettingsDao;
    @Resource
    private SysUsersService sysUsersService;
    @Resource
    private SysWorktimeService sysWorkTimeService;
    @Autowired
    private SysBeauticianStateDao sysBeauticianStateDao;
    @Autowired
    private ShoppingGoodsDao shoppingGoodsDao;
    @Resource
    private SysStoreInfoDao sysStoreInfoDao;
    @Resource
    private SysWorktimeService worktimeService;
 
    /**
     * 获取用户所有可用的项目和套餐
     * @return
     */
    @ApiOperation(value = "获取用户所有可用的项目和套餐", notes = "获取用户所有可用的项目和套餐")
    @GetMapping(value = "/getUserProjInfo/{vipId}")
    public AjaxResult getUserProjInfo(@PathVariable("vipId")Long vipId) {
        AjaxResult result = AjaxResult.buildSuccessInstance("查询成功");
 
        SysProjUse queryUse = new SysProjUse();
        queryUse.setVipId(vipId);
        queryUse.setType(Dictionary.SHOPPING_GOODS_TYPE_XM);
        queryUse.setTaocanId(-1L);
        queryUse.setStatus(Dictionary.TAOCAN_STATUS_YX);
        List<SysProjUse> projList = projUseService.findInPage(queryUse, null);
        //切换到套餐查询条件
        queryUse.setTaocanId(null);
        queryUse.setType(Dictionary.SHOPPING_GOODS_TYPE_TC);
        List<SysProjUse> taoCanList = projUseService.findInPage(queryUse, null);
        taoCanList.forEach(item->{
            item.setTaocanProjUse(projUseService.selectTaocanProjUse(item.getId(), queryUse.getStatus()));
            item.setProjInfo(shoppingGoodsDao.selectById(item.getProjId()));
        });
        result.putInMap("projList", projList);
        result.putInMap("taoCanList", taoCanList);
 
        return result;
    }
 
    /**
     * 显示所有服务单列表
     */
    @ApiOperation(value = "显示所有服务单列表", notes = "显示所有服务单列表")
    @PostMapping(value = "/showList")
//    public AjaxResult showList(@RequestBody SysProjServices projService, PaginationVO pageVo) {
    public AjaxResult showList(@RequestBody @Validated PadServiceListDto orderListDto) {
        SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY);
        int offset = (orderListDto.getPageNum() - 1) * orderListDto.getPageSize();
        int limit = orderListDto.getPageSize();
        PaginationVO pageVo = new PaginationVO();
        pageVo.setOffset(offset);
        pageVo.setLimit(limit);
 
        if (!DataAuthUtil.hasAllShopAuth()) {
            orderListDto.setShopId(user.getShopId());
        }
        QueryUtil.setQueryLimitCom(orderListDto);
        //默认排序
        if (StringUtils.isBlank(pageVo.getSort())) {
            pageVo.setSort("create_time");
        }
        if (StringUtils.isBlank(pageVo.getOrder())) {
            pageVo.setOrder("desc");
        }
 
        SysProjServices projService = new SysProjServices();
        if (!DataAuthUtil.hasAllShopAuth()) {
            projService.setShopId(getMe().getShopId());
        }
        if(ObjectUtil.isNotEmpty(orderListDto.getBeginTime())){
            projService.setBeginTime(orderListDto.getBeginTime());
        }
        if(ObjectUtil.isNotEmpty(orderListDto.getClosureTime())){
            projService.setClosureTime(orderListDto.getClosureTime());
        }
        if(ObjectUtil.isNotEmpty(orderListDto.getVipId())){
            projService.setVipId(orderListDto.getVipId());
        }
        if(ObjectUtil.isNotEmpty(orderListDto.getQueryKey())){
            projService.setQueryKey(orderListDto.getQueryKey());
        }
        if(StrUtil.isNotEmpty(orderListDto.getState())){
            projService.setState(orderListDto.getState());
        }
        QueryUtil.setQueryLimitCom(projService);
        List<SysProjServices> dataList = projServicesSerivce.findInPage(projService, pageVo);
        AjaxResult result = new AjaxResult(AjaxResult.STATUS_SUCCESS, dataList, projServicesSerivce.findTotal(projService));
        return result;
    }
 
    /**
     * 进入预约排班详情
     */
    @ApiOperation(value = "进入预约排班详情", notes = "进入预约排班详情")
    @PostMapping(value = "/serviceInfo")
    public AjaxResult findPbxq(@RequestBody SysProjServices projServicesVo) {
        QueryUtil.setQueryLimitCom(projServicesVo);
        // 获取服务单信息
        SysProjServices projServices = null;
        if(projServicesVo.getId()!=null){
            projServices=   sysProjServicesService.findById(projServicesVo.getId());
        }else if(StringUtils.isNotBlank(projServicesVo.getServiceNo())) {
            List<SysProjServices> byModel = sysProjServicesService.findByModel(projServicesVo);
            if (byModel.size() == 1) {
                projServices=   sysProjServicesService.findById( byModel.get(0).getId());
            }
        }
        if(projServices==null){
            throw new GlobleException("未查询到单据信息");
        }
        // 获取服务单所有信息
        // 设置会员信息
        projServices.setVipInfo(sysVipInfoService.findById(projServices.getVipId()));
        //补充服务单扩展信息===============
        List<SysBeauticianState> beauticianStateList = beauticianStateDao.selectBySerIds(projServices.getId());
        if (CollUtil.isNotEmpty(beauticianStateList)) {
            for (SysBeauticianState sysBeauticianState : beauticianStateList) {
                if (sysBeauticianState.getProjUse().getTaocanId() != null) {
                    SysProjUse sysProjUse = projUseService.findById(sysBeauticianState.getProjUse().getTaocanId());
                    if(sysProjUse != null) {
                        sysBeauticianState.getProjInfo().setName(sysProjUse.getProjName() + "--" + sysBeauticianState.getProjInfo().getName());
                    }
                }
            }
        }
        projServices.setServiceItems(beauticianStateList);
 
        SysBedState sysBedState = sysBedStateDao.selectBySerIdAndBedId(projServices.getId(), projServices.getBedId());
        projServices.setBedState(sysBedState);
        //补充服务单扩展信息===============END
 
        // 根据岗位名称查询员工
        List<SysUsers> pls = usersService.findByRoleName(true, Dictionary.STAFF_POST_PLS);
        pls.addAll(usersService.findByRoleName(true, Dictionary.STAFF_POST_PLZG));
        List<SysUsers> mls = usersService.findByRoleName(true, Dictionary.STAFF_POST_MLS);
        WebUtil.getRequest().setAttribute("pls", pls);
        WebUtil.getRequest().setAttribute("mls", mls);
 
        SysBedInfo bedInfo = new SysBedInfo();
        bedInfo.setShopId(getMe().getShopId());
        // 显示当前查询的服务订单的项目信息
        AjaxResult result = AjaxResult.buildSuccessInstance("");
        result.putInMap("obj", projServices);
        result.putInMap("serviceId", projServicesVo.getId());
        result.putInMap("pageFlae", projServicesVo.getPageFlae());
        result.putInMap("cw", bedInfoService.findByModel(bedInfo));
        result.putInMap("pls", pls);
        result.putInMap("mls", mls);
        return result;
    }
 
    /**
     * 获取空闲床位
     */
    @ApiOperation(value = "获取空闲床位", notes = "获取空闲床位")
    @PostMapping(value = "/showFreedBed")
    public AjaxResult showFreedBed(@RequestBody SysProjServices sysProjServices) {
        sysProjServices.setShopId(getMe().getShopId());
        List<SysBedInfo> beds = bedInfoService.findFreeBed(sysProjServices);
        return new AjaxResult(AjaxResult.STATUS_SUCCESS, beds, 0);
    }
 
    /**
     * 获取美疗师
     */
    @ApiOperation(value = "获取美疗师", notes = "获取美疗师")
    @PostMapping(value = "/getPaiBanBeauticianList")
    public AjaxResult getPaiBanBeauticianList(@RequestBody SysBeauticianState sysBeauticianState) {
        // 根据时间获取一段排班码
        String panBanCodes = DateUtil.dateToString(sysBeauticianState.getBeginTime(),DateUtil.DATE_FORMAT_NO_SPLITE_DD);
        // 获取登陆的用户
        SysUsers user = (SysUsers) WebUtil.getSession().getAttribute(MatrixConstance.LOGIN_KEY);
        List<SysUsers> staffs=new ArrayList<>();
        if(sysWorkTimeService.isInWorkTime(user.getShopId(),sysBeauticianState.getBeginTime(),sysBeauticianState.getEndTime())){
            staffs= sysUsersService.findByCodeBeaStateShop(user.getShopId(),
                    sysBeauticianState, panBanCodes);
        }
        return new AjaxResult(AjaxResult.STATUS_SUCCESS, staffs, 0);
    }
 
    /**
     * 获取配料师
     */
    @ApiOperation(value = "获取配料师", notes = "获取配料师")
    @GetMapping(value = "/getShopStaffByRoleName")
    public AjaxResult getStaffByRoleName() {
        return new AjaxResult(AjaxResult.STATUS_SUCCESS, sysUsersService.findByRoleName(true, "配料师"));
    }
 
    /**
     * 获取工作时间
     */
    @ApiOperation(value = "获取工作时间", notes = "获取工作时间")
    @GetMapping(value = "/getWorkTime")
    public AjaxResult getWorkTime() {
        Long shopId = getMe().getShopId();
        Date minTime = worktimeService.findMinTime(shopId);
        Date maxTime = worktimeService.findMaxTime(shopId);
        if (minTime == null || maxTime == null) {
            return AjaxResult.buildFailInstance("门店没有班次信息,请先设置门店班次");
        } else {
            return AjaxResult.buildSuccessInstance(java.util.Arrays.asList(
                    DateUtil.dateToString(minTime, "HH:mm"),
                    DateUtil.dateToString(maxTime, "HH:mm")));
        }
    }
 
    /**
     * 新增项目
     */
    @ApiOperation(value = "新增项目", notes = "新增项目")
    @PostMapping(value = "/addService")
    public AjaxResult servicceAdd(@RequestBody SysProjServices sysProjServices) {
        if (CollectionUtils.isEmpty(sysProjServices.getServiceItems())) {
            return new AjaxResult(AjaxResult.STATUS_FAIL, "没有选中可消耗的项目");
        }
        //检测欠款
        VerifyResult arrearsVerifyResult = sysProjServicesService.checkArrears(sysProjServices);
        if (arrearsVerifyResult.isError()) {
            return new AjaxResult(AjaxResult.STATUS_FAIL, arrearsVerifyResult.getMsg());
        }
        //检测余次
        VerifyResult balanceverifyResult = sysProjServicesService.checkBalance(sysProjServices);
        if (balanceverifyResult.isError()) {
            return new AjaxResult(AjaxResult.STATUS_FAIL, balanceverifyResult.getMsg());
        }
        if (StrUtil.isEmpty(sysProjServices.getState())) {
            sysProjServices.setState(Dictionary.SERVICE_STATU_DYY);
        }
        SysProjServices newSysProjServices = sysProjServicesService.addSysProjServices(sysProjServices);
        if (newSysProjServices != null) {
            AjaxResult result = AjaxResult.buildSuccessInstance("下单成功!");
            result.putInMap("newSysProjServices", newSysProjServices);
            return result;
        } else {
            return new AjaxResult(AjaxResult.STATUS_FAIL, "下单失败!");
        }
    }
 
    /**
     * 删除服务单项目/套餐
     * @param id
     * @return
     */
    @ApiOperation(value = "删除服务单项目/套餐", notes = "删除服务单项目/套餐")
    @GetMapping(value = "/delServiceOrderItems/{id}")
    public AjaxResult delServiceOrderItems(@PathVariable("id")Long id) {
        sysProjServicesService.deleteProjServiceItemById(id);
        return AjaxResult.buildSuccessInstance("删除成功");
    }
 
 
    /**
     * 排班
     */
    @ApiOperation(value = "排班", notes = "排班")
    @PostMapping(value = "/servicePaiBan")
    public AjaxResult servicePaiBan(@RequestBody SysProjServices projServices, String dataTime) throws GlobleException {
        int i = sysProjServicesService.paiban(projServices, dataTime);
        if (i > 0) {
            return new AjaxResult(AjaxResult.STATUS_SUCCESS, "排班成功");
        } else {
            return new AjaxResult(AjaxResult.STATUS_FAIL, "排班失败");
        }
    }
 
    /**
     * 根据id取消预约
     */
    @ApiOperation(value = "根据id取消预约", notes = "根据id取消预约")
    @GetMapping(value = "/cancelOrder/{id}")
    public AjaxResult cancelOrder(@PathVariable("id")Long id) {
 
        SysProjServices checkProjServices = sysProjServicesDao.selectById(id);
        QueryUtil.setQueryLimitCom(checkProjServices);
        BusParameterSettings shopManageAbleCancelDfkOrder = busParameterSettingsDao.selectCompanyParamByCode(AppConstance.SHOP_MANAGE_ABLE_CANCEL_DFK_ORDER, checkProjServices.getCompanyId());
        if (StringUtils.isNotBlank(shopManageAbleCancelDfkOrder.getParamValue())
                && BooleanEnum.TRUE.getValue() == shopManageAbleCancelDfkOrder.getIntParamValue()) {
 
            if (!checkProjServices.getState().equals(Dictionary.SERVICE_STATU_DYY)
                    && !checkProjServices.getState().equals(Dictionary.SERVICE_STATU_DQR)) {
                return new AjaxResult(AjaxResult.STATUS_FAIL, "您只能取消待预约订单");
            }
        }else{
            if (checkProjServices.getState().equals(Dictionary.SERVICE_STATU_FWWC)
                    || checkProjServices.getState().equals(Dictionary.SERVICE_STATU_FFJS)) {
                return new AjaxResult(AjaxResult.STATUS_FAIL, "当前状态无法取消订单");
            }
        }
 
        int i = sysProjServicesService.modifyCancelProjServices(checkProjServices);
        if (i > 0) {
            return new AjaxResult(AjaxResult.STATUS_SUCCESS, "取消预约成功");
        } else {
            return new AjaxResult(AjaxResult.STATUS_FAIL, "取消预约失败");
        }
    }
 
    /**
     * 开始配料
     */
    @ApiOperation(value = "开始配料", notes = "开始配料")
    @GetMapping(value = "/startpl/{id}")
    public AjaxResult startpl(@PathVariable("id")Long id) {
        // 将服务状态为待配料的更新为配料中
        SysProjServices sysProjServices = projServicesSerivce.findById(id);
        List<SysBeauticianState> beauticianStateList = sysBeauticianStateDao.selectBySerIds(sysProjServices.getId());
        List<ShoppingGoods> projInfoList = new ArrayList<>();
        for (SysBeauticianState beauticianState : beauticianStateList) {
            ShoppingGoods sysProjInfo = shoppingGoodsDao.selectById(beauticianState.getProjId());
            sysProjInfo.setAssembleGoods(goodsAssembleDao.selectGoodsByShoppingGoodsIdAndType(sysProjInfo.getId(), ShoppingGoods.SHOPPING_GOODS_TYPE_JJCP));
            projInfoList.add(sysProjInfo);
        }
        AjaxResult result = AjaxResult.buildSuccessInstance("");
        result.putInMap("serviceId", id);
        result.putInMap("projInfoList", projInfoList);
        return result;
    }
 
    /**
     * 按产品批次显示选择配料
     */
    @ApiOperation(value = "按产品批次显示选择配料", notes = "按产品批次显示选择配料")
    @PostMapping(value = "/showCountList")
    public AjaxResult showCountList(@RequestBody SysStoreInfo sysStoreInfo, PaginationVO pageVo) {
        SysUsers users = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY);
        sysStoreInfo.setShopId(users.getShopId());
        sysStoreInfo.setCompanyId(users.getCompanyId());
 
        List<SysStoreInfo> dataList = sysStoreInfoDao.selectCountInPage(sysStoreInfo, pageVo);
        AjaxResult result = new AjaxResult(AjaxResult.STATUS_SUCCESS,  dataList, sysStoreInfoDao.selectCountTotalRecord(sysStoreInfo));
        return result;
    }
 
    /**
     * 配料完成
     */
    @ApiOperation(value = "配料完成", notes = "配料完成")
    @PostMapping(value = "/endPl")
    @RemoveRequestToken
    public AjaxResult endPl(@RequestBody SysProjServices projServices) {
        projServicesSerivce.modifyPLProjServices(projServices);
        return new AjaxResult(AjaxResult.STATUS_SUCCESS, "配料成功!");
    }
 
    /**
     * 进入划扣页面
     */
    @ApiOperation(value = "进入划扣页面", notes = "进入划扣页面")
    @GetMapping(value = "/serviceHkPage/{id}")
    public AjaxResult serviceHkPage(@PathVariable("id")Long id) {
        // 获取服务单信息
        SysProjServices projServices = sysProjServicesService.findById(id);
 
        projServices.setVipInfo(sysVipInfoService.findById(projServices.getVipId()));
 
        //补充服务单扩展信息===============
        List<SysBeauticianState> beauticianStateList = beauticianStateDao.selectBySerIds(id);
        projServices.setServiceItems(beauticianStateList);
 
        SysBedState sysBedState = sysBedStateDao.selectBySerIdAndBedId(projServices.getId(), projServices.getBedId());
        projServices.setBedState(sysBedState);
        //补充服务单扩展信息===============END
 
        // 获取服务单所有信息
        WebUtil.getRequest().setAttribute("obj", projServices);
        WebUtil.getRequest().setAttribute("serviceId", id);
 
        // 准备页面数据
        // 根据岗位名称查询员工
        List<SysUsers> pls = usersService.findByRoleName(true, Dictionary.STAFF_POST_PLS);
        pls.addAll(usersService.findByRoleName(true, Dictionary.STAFF_POST_PLZG));
        List<SysUsers> mls = usersService.findByRoleName(true, Dictionary.STAFF_POST_MLS);
        WebUtil.getRequest().setAttribute("pls", pls);
        WebUtil.getRequest().setAttribute("mls", mls);
        SysBedInfo bedInfo = new SysBedInfo();
        bedInfo.setShopId(getMe().getShopId());
        WebUtil.getRequest().setAttribute("cw", bedInfoService.findByModel(bedInfo));
 
 
        AjaxResult result = AjaxResult.buildSuccessInstance("");
        result.putInMap("obj", projServices);
        result.putInMap("serviceId", id);
        result.putInMap("cw", bedInfoService.findByModel(bedInfo));
        result.putInMap("pls", pls);
        result.putInMap("mls", mls);
        return result;
    }
 
    /**
     * 设置客户签名
     */
    @ApiOperation(value = "设置客户签名", notes = "设置客户签名")
    @PostMapping(value = "/signService")
    public AjaxResult signService(@RequestBody PadSignServiceDto padSignServiceDto) {
        SysProjServices services = new SysProjServices();
        services.setId(padSignServiceDto.getId());
        services.setSignPic(padSignServiceDto.getSignPic());
        int i = sysProjServicesService.signService(services);
        if (i > 0) {
            return new AjaxResult(AjaxResult.STATUS_SUCCESS, "签名成功");
        } else {
            return new AjaxResult(AjaxResult.STATUS_FAIL, "签名失败");
        }
    }
 
    /**
     * 设置服务单划扣成功
     */
    @ApiOperation(value = "设置服务单划扣成功", notes = "设置服务单划扣成功")
    @GetMapping(value = "/hkService/{id}")
    public AjaxResult hkService(@PathVariable("id")Long id) {
        SysProjServices services = new SysProjServices();
        services.setId(id);
        int i = sysProjServicesService.modifyHKProjServices(services);
        if (i > 0) {
            return new AjaxResult(AjaxResult.STATUS_SUCCESS, "划扣成功");
        } else {
            return new AjaxResult(AjaxResult.STATUS_FAIL, "划扣失败");
        }
    }
 
    /**
     * 编辑排班详情
     */
    @ApiOperation(value = "编辑排班详情", notes = "编辑排班详情")
    @GetMapping(value = "/yypb/{id}")
    public AjaxResult findProject(@PathVariable("id")Long id) {
        // 获取服务单信息
        SysProjServices projServices = sysProjServicesService.findById(id);
        // 获取操作的用户
        projServices.setVipInfo(sysVipInfoService.findById(projServices.getVipId()));
 
        // 设置排班的默认日期
        String dateTime = null;
        if (dateTime == null || dateTime.equals("")) {
 
            SysBedState sysBedState = sysBedStateDao.selectBySerIdAndBedId(projServices.getBedId(), projServices.getId());
 
            if (sysBedState != null && sysBedState.getStartTime() != null) {
                dateTime = DateUtil.dateToString(sysBedState.getStartTime(), DateUtil.DATE_FORMAT_DD);
            } else {
                dateTime = DateUtil.dateToString(projServices.getYyTime(), DateUtil.DATE_FORMAT_DD);
            }
        }
        WebUtil.getRequest().setAttribute("dateTime", dateTime);
        // 获取服务单所有信息
        WebUtil.getRequest().setAttribute("obj", projServices);
 
        // 获取服务单对一下的项目信息
        // 准备页面数据
        // 根据岗位名称查询员工
        List<SysUsers> pls = usersService.findByRoleName(true, Dictionary.STAFF_POST_PLS);
        pls.addAll(usersService.findByRoleName(true, Dictionary.STAFF_POST_PLZG));
        List<SysUsers> mls = usersService.findByRoleName(true, Dictionary.STAFF_POST_MLS);
        WebUtil.getRequest().setAttribute("pls", pls);
        WebUtil.getRequest().setAttribute("mls", mls);
 
        SysBedInfo bedInfo = new SysBedInfo();
        bedInfo.setShopId(getMe().getShopId());
        // 床位
        WebUtil.getRequest().setAttribute("cw", bedInfoService.findByModel(bedInfo));
 
 
        AjaxResult result = AjaxResult.buildSuccessInstance("");
        result.putInMap("dateTime", dateTime);
        result.putInMap("obj", projServices);
        result.putInMap("cw", bedInfoService.findByModel(bedInfo));
        result.putInMap("pls", pls);
        result.putInMap("mls", mls);
        return result;
        // 显示当前查询的服务订单的项目信息
//        return "admin/hive/beautySalon/yypb-form";
    }
 
 
}