From f19bca3ce7506e7a8225798e539aca178364aff8 Mon Sep 17 00:00:00 2001
From: 935090232@qq.com <ak473600000>
Date: Wed, 27 Oct 2021 08:12:48 +0800
Subject: [PATCH] 新增pc端服务确认

---
 zq-erp/src/main/java/com/matrix/system/app/action/ApiServiceOrderAction.java            |   13 --
 zq-erp/src/main/java/com/matrix/system/wechart/templateMsg/Task/UniformMsgSentTask.java |    9 +-
 zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysProjServicesServiceImpl.java |   20 ++++
 zq-erp/src/main/java/com/matrix/system/hive/action/ProjServiceController.java           |   19 ++++
 zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/service_all_list.html  |  130 +++++++++++++++++++-------------
 zq-erp/src/main/java/com/matrix/system/hive/service/SysProjServicesService.java         |    7 +
 6 files changed, 126 insertions(+), 72 deletions(-)

diff --git a/zq-erp/src/main/java/com/matrix/system/app/action/ApiServiceOrderAction.java b/zq-erp/src/main/java/com/matrix/system/app/action/ApiServiceOrderAction.java
index c477e5e..6b1d335 100644
--- a/zq-erp/src/main/java/com/matrix/system/app/action/ApiServiceOrderAction.java
+++ b/zq-erp/src/main/java/com/matrix/system/app/action/ApiServiceOrderAction.java
@@ -282,17 +282,8 @@
     @ApiOperation(value = "确认服务", notes = "确认服务")
     @PostMapping(value = "/confirmServiceOrder")
     public AjaxResult confirmServiceOrder(@RequestBody @Validated IdSubmitDto idSubmitDto) {
-        SysProjServices services = new SysProjServices();
-        services.setId(idSubmitDto.getId());
-        services.setState(Dictionary.BEATUI_STATE_DYY);
-        int i = projServicesService.modify(services);
-        if (i > 0) {
-            //发送微信公众号提醒
-            services=projServicesService.findById(services.getId());
-            UniformMsgParam uniformMsgParam=new UniformMsgParam(services.getCompanyId(),UniformMsgParam.GZH_YYCG);
-            uniformMsgParam.put("serviceId",services.getId());
-            asyncMessageManager.sendMsg(AsyncMessageRouting.SEND_UNIFORM_TEMPLATE_MSG ,uniformMsgParam);
-
+        int i=projServicesService.confirmServiceOrder(idSubmitDto.getId());
+        if(i>0){
             return AjaxResult.buildSuccessInstance("确认成功");
         }
         return AjaxResult.buildFailInstance("确认失败");
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..86db596 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
@@ -14,6 +14,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;
@@ -26,10 +27,13 @@
 import com.matrix.system.hive.bean.*;
 import com.matrix.system.hive.dao.*;
 import com.matrix.system.hive.service.*;
+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.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.ResponseBody;
@@ -390,6 +394,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
@@ -496,11 +511,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取消预约
diff --git a/zq-erp/src/main/java/com/matrix/system/hive/service/SysProjServicesService.java b/zq-erp/src/main/java/com/matrix/system/hive/service/SysProjServicesService.java
index bae3726..6383e2d 100644
--- a/zq-erp/src/main/java/com/matrix/system/hive/service/SysProjServicesService.java
+++ b/zq-erp/src/main/java/com/matrix/system/hive/service/SysProjServicesService.java
@@ -113,4 +113,11 @@
     int findApiServiceOrderListTotal(ServiceOrderListDto serviceOrderListDto);
 
     public boolean skipServiceOrderStep(String step);
+
+    /**
+     * 确认服务单
+     * @param id
+     * @return
+     */
+    int confirmServiceOrder(Long id);
 }
\ No newline at end of file
diff --git a/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysProjServicesServiceImpl.java b/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysProjServicesServiceImpl.java
index 1ad9a9c..2001275 100644
--- a/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysProjServicesServiceImpl.java
+++ b/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysProjServicesServiceImpl.java
@@ -4,6 +4,7 @@
 import com.matrix.component.asyncmessage.AsyncMessageManager;
 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;
@@ -259,7 +260,7 @@
             SysProjUse sysProjUse = projUseService.findById(sysBeauticianState.getPuseId());
 
             //检查是否已经处于无效状态
-           if(Dictionary.TAOCAN_STATUS_WX.equals(sysProjUse.getStatus())){
+            if(Dictionary.TAOCAN_STATUS_WX.equals(sysProjUse.getStatus())){
                 return new VerifyResult(true, sysProjUse.getProjName() + "项目已经失效");
             }
 
@@ -1052,4 +1053,21 @@
 
         return flag;
     }
+
+    @Override
+    public int confirmServiceOrder(Long id) {
+        SysProjServices services = new SysProjServices();
+        services.setId(id);
+        services.setState(Dictionary.BEATUI_STATE_DYY);
+        int i = modify(services);
+        if (i > 0) {
+            //发送微信公众号提醒
+            services=findById(services.getId());
+            UniformMsgParam uniformMsgParam=new UniformMsgParam(services.getCompanyId(),UniformMsgParam.GZH_YYCG);
+            uniformMsgParam.put("serviceId",services.getId());
+            asyncMessageManager.sendMsg(AsyncMessageRouting.SEND_UNIFORM_TEMPLATE_MSG ,uniformMsgParam);
+
+        }
+        return i;
+    }
 }
diff --git a/zq-erp/src/main/java/com/matrix/system/wechart/templateMsg/Task/UniformMsgSentTask.java b/zq-erp/src/main/java/com/matrix/system/wechart/templateMsg/Task/UniformMsgSentTask.java
index c662a65..9680fbb 100644
--- a/zq-erp/src/main/java/com/matrix/system/wechart/templateMsg/Task/UniformMsgSentTask.java
+++ b/zq-erp/src/main/java/com/matrix/system/wechart/templateMsg/Task/UniformMsgSentTask.java
@@ -55,14 +55,13 @@
     public void handle(Map<String,Object> param){
         try {
 
-            JSONObject messageJsonParam=JSONObject.parseObject(param.get("messages").toString());
 
-            if(!messageJsonParam.containsKey("companyId")||(!messageJsonParam.containsKey("templateCode"))){
+            if(!param.containsKey("companyId")||(!param.containsKey("templateCode"))){
                 LogUtil.error("小程序消息推送参数格式异常发送模板消息需要传JSONO字符串作为格式 例如:{\"companyId\":17,\"templateCode\":10000} companyId 、templateCode 是必须属性");
                 return;
             }
-            Long companyId = Long.parseLong( messageJsonParam.get("companyId").toString());
-            Integer templateCode = Integer.parseInt( messageJsonParam.get("templateCode").toString());
+            Long companyId = Long.parseLong( param.get("companyId").toString());
+            Integer templateCode = Integer.parseInt( param.get("templateCode").toString());
 
             //获取公司微信配置参数
             BusParameterSettings xcxAppId = busParameterSettingsDao.selectCompanyParamByCode(AppConstance.MINIPROGRAM_APPID, companyId);
@@ -82,7 +81,7 @@
             bulderParam.put("xcxAppId", xcxAppId.getParamValue());
             bulderParam.put("gzhAppid", gzhAppid.getParamValue());
             bulderParam.put("template_id", template.getUuid());
-            bulderParam.put("messageJsonParam", messageJsonParam);
+            bulderParam.put("messageJsonParam", param);
             //调用模板计算出消息体
             Map msgResult = templateMessageBulder.buildMsg(bulderParam);
 
diff --git a/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/service_all_list.html b/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/service_all_list.html
index cfcf888..106f1be 100644
--- a/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/service_all_list.html
+++ b/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/service_all_list.html
@@ -82,7 +82,7 @@
             <div class="form-group mr-20">
                 <button type="button" class="btn btn-my btn-sm" id="btn4" value="">全部</button>
                 <button type="button" class="btn btn-my btn-sm active" id="btn1" value="待预约">待预约</button>
-<!--                <button type="button" class="btn btn-my btn-sm" id="btn2" value="预约成功待处理">待派单</button>-->
+                <!--                <button type="button" class="btn btn-my btn-sm" id="btn2" value="预约成功待处理">待派单</button>-->
                 <button type="button" class="btn btn-my btn-sm" id="btn3" value="需配料">待配料</button>
                 <button type="button" class="btn btn-my btn-sm" id="btn3" value="配料完成">待服务</button>
                 <button type="button" class="btn btn-my btn-sm" id="btn6" value="服务中">服务中</button>
@@ -132,22 +132,22 @@
 <script type="text/javascript" th:src="@{/js/systools/MJsBase.js}"></script>
 <script type="text/javascript">
 
-   $("#vipPhone").val($.query.get('vipPhone'));
-   var _initParam = {format : 'yyyy-mm-dd hh:ii',
-       todayBtn : true,
-       autoclose : true,
-       startView : 2,
-       maxView : 3,
-       minView : 0};
-   MTools.ininDatetimepicker(_initParam);
-   //限制结束时间不小于开始时间
-   var initParam = {format : 'yyyy-mm-dd hh:ii',
-       todayBtn : true,
-       autoclose : true,
-       startView : 2,
-       maxView : 3,
-       minView : 0};
-   MTools.limitStartEndTime(initParam);
+    $("#vipPhone").val($.query.get('vipPhone'));
+    var _initParam = {format : 'yyyy-mm-dd hh:ii',
+        todayBtn : true,
+        autoclose : true,
+        startView : 2,
+        maxView : 3,
+        minView : 0};
+    MTools.ininDatetimepicker(_initParam);
+    //限制结束时间不小于开始时间
+    var initParam = {format : 'yyyy-mm-dd hh:ii',
+        todayBtn : true,
+        autoclose : true,
+        startView : 2,
+        maxView : 3,
+        minView : 0};
+    MTools.limitStartEndTime(initParam);
 
     var myGrid;
     $(function () {
@@ -179,9 +179,9 @@
 
         }
     }
-   var btns=[];
-   btns[0]="",btns[1]="",btns[2]="",btns[3]="",btns[4]="",btns[5]="",btns[6]="";
-   function buidOperate(value, row, index) {
+    var btns=[];
+    btns[0]="",btns[1]="",btns[2]="",btns[3]="",btns[4]="",btns[5]="",btns[6]="";
+    function buidOperate(value, row, index) {
         var status = row.state;
         var html ='<a class="text-primary mr-5" onClick="selectFwz(' + value + ')"  title="查看"><i class="fa fa-eye">查看</i></a>&nbsp;'
         switch (status) {
@@ -201,6 +201,9 @@
             case '服务完成':
                 html +=btns[4].replace('VALUE',value);
                 html += btns[2].replace('VALUE',value);
+                break;
+            case '待确认':
+                html +=btns[7].replace('VALUE',value);
                 break;
         }
         html += btns[5].replace('VALUE',value);
@@ -272,42 +275,60 @@
 
 
 
-   function removeOrder(id) {
-       var id=myGrid.getSelectItemId();
-       layer.confirm('确定取消此订单?', {
-           btn: ['确认', '取消'] //可以无限个按钮
-       }, function(index, layero){
-           $.post(basePath+'/admin/projService/cancelOrder?id='+id, {}, function(data){
-               parent.layer.msg(data.info,{icon: 1});
-               layer.closeAll();
-               myGrid.serchData();
-           });
-           //按钮【按钮一】的回调
-       }, function(index){
-           // alert("2 = "+index);
-           //按钮【按钮二】的回调
-       });
+    function removeOrder(id) {
+        var id=myGrid.getSelectItemId();
+        layer.confirm('确定取消此订单?', {
+            btn: ['确认', '取消'] //可以无限个按钮
+        }, function(index, layero){
+            $.post(basePath+'/admin/projService/cancelOrder?id='+id, {}, function(data){
+                parent.layer.msg(data.info,{icon: 1});
+                layer.closeAll();
+                myGrid.serchData();
+            });
+            //按钮【按钮一】的回调
+        }, function(index){
+            // alert("2 = "+index);
+            //按钮【按钮二】的回调
+        });
 
-   }
+    }
 
-   //打开查看界面
-   function openEdit2() {
-       var id=myGrid.getSelectItemId();
-       layer.open({
-           type : 2,
-           title : "查看服务单详情",
-           area :   MUI.SIZE_M,
-           maxmin : true,
-           content : [ basePath+'/admin/projService/serviceInfo?pageFlae=pc&id=' + id]
-       });
-   }
+    function confirmServiceOrder(id) {
+        layer.confirm('确定确认订单吗?', {
+            btn: ['确认', '取消'] //可以无限个按钮
+        }, function(index, layero){
+            $.post(basePath+'/admin/projService/confirmServiceOrder?id='+id, {}, function(data){
+                parent.layer.msg(data.info,{icon: 1});
+                layer.closeAll();
+                myGrid.serchData();
+            });
+            //按钮【按钮一】的回调
+        }, function(index){
+            // alert("2 = "+index);
+            //按钮【按钮二】的回调
+        });
 
-   //导出
-   //导出
-   function exportExcel(){
-       var param=MForm.toUrlParam("#serchform");
-       window.location.href=basePath+"/admin/projService/exportExcel?"+param;
-   }
+    }
+
+
+    //打开查看界面
+    function openEdit2() {
+        var id=myGrid.getSelectItemId();
+        layer.open({
+            type : 2,
+            title : "查看服务单详情",
+            area :   MUI.SIZE_M,
+            maxmin : true,
+            content : [ basePath+'/admin/projService/serviceInfo?pageFlae=pc&id=' + id]
+        });
+    }
+
+    //导出
+    //导出
+    function exportExcel(){
+        var param=MForm.toUrlParam("#serchform");
+        window.location.href=basePath+"/admin/projService/exportExcel?"+param;
+    }
 
 </script>
 
@@ -337,5 +358,8 @@
 <script matrix:btn="serviceClub-edit">
     btns[6]='<a  class="text-primary mr-5" onclick="updateTime(\'VALUE\')" title="修改时间"><i class="fa fa-edit">修改时间</i></a>&nbsp;'
 </script>
+<script matrix:btn="serviceClub-edit">
+    btns[7]='<a  class="text-primary mr-5" onclick="confirmServiceOrder(\'VALUE\')" title="确认服务单"><i class="fa fa-edit">确认服务单</i></a>&nbsp;'
+</script>
 
 </html>

--
Gitblit v1.9.1