From f3f5481dba09ddf9e7a83ba83abb5a3250914a2a Mon Sep 17 00:00:00 2001
From: 935090232@qq.com <ak473600000>
Date: Mon, 24 Jan 2022 19:33:12 +0800
Subject: [PATCH] fead:优化功能

---
 zq-erp/src/main/java/com/matrix/system/hive/action/ProjServiceController.java |   67 ++++++++++++++++++++++++++++-----
 1 files changed, 57 insertions(+), 10 deletions(-)

diff --git a/zq-erp/src/main/java/com/matrix/system/hive/action/ProjServiceController.java b/zq-erp/src/main/java/com/matrix/system/hive/action/ProjServiceController.java
index 8c82ce0..020b110 100644
--- a/zq-erp/src/main/java/com/matrix/system/hive/action/ProjServiceController.java
+++ b/zq-erp/src/main/java/com/matrix/system/hive/action/ProjServiceController.java
@@ -1,5 +1,6 @@
 package com.matrix.system.hive.action;
 
+import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.util.StrUtil;
 import com.matrix.core.anotations.RemoveRequestToken;
@@ -14,6 +15,7 @@
 import com.matrix.core.tools.excl.ExcelSheetPO;
 import com.matrix.core.tools.excl.ExcelUtil;
 import com.matrix.core.tools.excl.ExcelVersion;
+import com.matrix.system.app.dto.IdSubmitDto;
 import com.matrix.system.common.bean.BusParameterSettings;
 import com.matrix.system.common.bean.SysUsers;
 import com.matrix.system.common.constance.AppConstance;
@@ -25,14 +27,16 @@
 import com.matrix.system.constance.Dictionary;
 import com.matrix.system.hive.bean.*;
 import com.matrix.system.hive.dao.*;
+import com.matrix.system.hive.dto.ServiceOrderTimeDto;
 import com.matrix.system.hive.service.*;
+import com.matrix.system.hive.vo.ServiceOrderInfoVo;
+import io.swagger.annotations.ApiOperation;
 import org.apache.commons.collections.CollectionUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.ui.ModelMap;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
 import org.springframework.web.servlet.ModelAndView;
 
 import javax.annotation.Resource;
@@ -120,9 +124,28 @@
         List<SysBeauticianState> beauticianStateList = beauticianStateDao.selectBySerIds(id);
         if (CollUtil.isNotEmpty(beauticianStateList)) {
             for (SysBeauticianState sysBeauticianState : beauticianStateList) {
+                SysProjUse item = sysBeauticianState.getProjUse();
+
+                // 若项目/套餐无效,则打印时,不显示余次
+                if (!"无效".equals(item.getStatus())) {
+                    item.setRemainCount(item.getSurplusCount());
+                } else {
+                    item.setRemainCount(null);
+                }
+
                 if (sysBeauticianState.getProjUse().getTaocanId() != null) {
                     SysProjUse sysProjUse = projUseService.findById(sysBeauticianState.getProjUse().getTaocanId());
+                    if (!"无效".equals(sysProjUse.getStatus())) {
+                        item.setRemainCount(sysProjUse.getSurplusCount());
+                    } else {
+                        item.setRemainCount(null);
+                    }
+
                     sysBeauticianState.getProjInfo().setName(sysProjUse.getProjName()+"--"+sysBeauticianState.getProjInfo().getName());
+                    if ("Y".equals(sysProjUse.getIsCourse()) && "Y".equals(sysProjUse.getIsInfinite())) {
+                        int count = projUseService.findTaocanCountForCourseAndInfinite(sysBeauticianState.getProjUse().getTaocanId(), projServices.getVipId());
+                        item.setRemainCount(count);
+                    }
                 }
             }
         }
@@ -139,6 +162,20 @@
 
         result.setStatus(AjaxResult.STATUS_SUCCESS);
         return result;
+    }
+
+    /**
+     * 根据id查询服务单简单信息
+     */
+    @RequestMapping(value = "/findServiceOrderInfoVo/{id}")
+    public @ResponseBody
+    AjaxResult findServiceOrderInfoVo(@PathVariable Long id) {
+        // 获取服务单信息
+        SysProjServices projServices = sysProjServicesService.findById(id);
+
+        ServiceOrderInfoVo serviceOrderInfoVo= BeanUtil.copyProperties(projServices,ServiceOrderInfoVo.class);
+
+        return AjaxResult.buildSuccessInstance(serviceOrderInfoVo);
     }
 
 
@@ -390,6 +427,17 @@
         }
     }
 
+    @ApiOperation(value = "确认服务", notes = "确认服务")
+    @PostMapping(value = "/confirmServiceOrder")
+    public @ResponseBody AjaxResult confirmServiceOrder(Long id) {
+        int i=sysProjServicesService.confirmServiceOrder(id);
+        if(i>0){
+            return AjaxResult.buildSuccessInstance("确认成功");
+        }
+        return AjaxResult.buildFailInstance("确认失败");
+    }
+
+
 
     /**
      * @author jiangyouyao
@@ -414,13 +462,12 @@
      */
     @RequestMapping(value = "/updateOrderTime")
     public @ResponseBody
-    AjaxResult updateOrderTime(SysProjServices serviceQuery) {
-        SysProjServices services = sysProjServicesDao.selectById(serviceQuery.getId());
-        sysProjServicesDao.updateOrderTime(serviceQuery.getConsumeTime(), serviceQuery.getId());
+    AjaxResult updateOrderTime(@RequestBody  ServiceOrderTimeDto serviceOrderTimeDto) {
+        sysProjServicesDao.updateOrderTime(serviceOrderTimeDto);
         // 更新业绩时间
         AchieveNew achieveNew = new AchieveNew();
-        achieveNew.setServiceOrderId(serviceQuery.getId());
-        achieveNew.setDatatime(serviceQuery.getConsumeTime());
+        achieveNew.setServiceOrderId(serviceOrderTimeDto.getId());
+        achieveNew.setDatatime(serviceOrderTimeDto.getConsumeTime());
         achieveNewService.modifyAchieveTime(achieveNew);
         return new AjaxResult(AjaxResult.STATUS_SUCCESS, "修改成功");
     }
@@ -496,11 +543,11 @@
         if (StringUtils.isNotBlank(shopManageAbleCancelDfkOrder.getParamValue())
                 && shopManageAbleCancelDfkOrder.getParamValue().equals(Dictionary.FLAG_YES)) {
             if (!checkProjServices.getState().equals(Dictionary.SERVICE_STATU_DYY)
-            && !checkProjServices.getState().equals(Dictionary.SERVICE_STATU_DQR)) {
+                    && !checkProjServices.getState().equals(Dictionary.SERVICE_STATU_DQR)) {
                 return new AjaxResult(AjaxResult.STATUS_FAIL, "您只能取消待预约订单");
             }
         }
-       return erpCancelOrder(services);
+        return erpCancelOrder(services);
     }
     /**
      * 根据id取消预约

--
Gitblit v1.9.1