From c0dc765ad93846078718bb15976905c34db7584c Mon Sep 17 00:00:00 2001
From: jyy <935090232@qq.com>
Date: Sat, 16 Jan 2021 14:57:23 +0800
Subject: [PATCH] 小程序端服务单评论

---
 zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/YuyueAction.java |   73 ++++++++++++++++++------------------
 1 files changed, 37 insertions(+), 36 deletions(-)

diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/YuyueAction.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/YuyueAction.java
index ec285b8..1c07d32 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/YuyueAction.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/YuyueAction.java
@@ -10,6 +10,7 @@
 import com.matrix.core.pojo.PaginationVO;
 import com.matrix.core.pojo.VerifyResult;
 import com.matrix.core.tools.DateUtil;
+import com.matrix.core.tools.LogUtil;
 import com.matrix.core.tools.StringUtils;
 import com.matrix.core.tools.WebUtil;
 import com.matrix.system.app.dto.ServiceOrderListDto;
@@ -27,12 +28,17 @@
 import com.matrix.system.hive.dao.*;
 import com.matrix.system.hive.plugin.util.CollectionUtils;
 import com.matrix.system.hive.service.*;
+import com.matrix.system.shopXcx.api.dto.ErpServiceCommentDto;
+import com.matrix.system.shopXcx.api.dto.ErpServiceOrderListDto;
+import com.matrix.system.shopXcx.api.vo.ErpOrderDetailItemVo;
+import com.matrix.system.shopXcx.api.vo.ErpServiceOrderListVo;
 import com.matrix.system.shopXcx.bean.ShopProduct;
 import com.matrix.system.shopXcx.dao.ShopProductDao;
 import com.matrix.system.shopXcx.dao.ShopSkuDao;
 import com.matrix.system.shopXcx.dto.YYDayOfWeek;
 import com.matrix.system.shopXcx.dto.YYmonth;
 import com.matrix.system.shopXcx.mqTask.DTO.UserProjInfo;
+import io.swagger.annotations.*;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Controller;
@@ -266,17 +272,13 @@
     public @ResponseBody
     AjaxResult createServiceOrder(@RequestBody Onlinebooking onlinebooking) {
         BizUser bizUser = redisUserLoginUtils.getLoginUser(BizUser.class);
-        bizUser = bizUserDao.findByOpenId(bizUser.getOpenId());
         SysVipInfo vipInfo = vipInfoDao.selectByPhone(bizUser.getPhoneNumber());
-
-
         SysProjUse sysProjUse = projUseDao.selectById(Long.parseLong(onlinebooking.getProductId() + ""));
         Date yyTime = DateUtil.stringToDate(onlinebooking.getTimeStr(), DateUtil.DATE_FORMAT_MM);
         SysProjServices sysProjServices = new SysProjServices();
         sysProjServices.setCompanyId(vipInfo.getCompanyId());
         sysProjServices.setShopId(onlinebooking.getShopId());
         sysProjServices.setVipId(vipInfo.getId());
-
         sysProjServices.setYyTime(yyTime);
         sysProjServices.setRemark(onlinebooking.getRemark());
 
@@ -325,6 +327,10 @@
      * @param id
      * @return
      */
+    @ApiOperation(value = " 根据id查询预约订单的详情", notes = " 根据id查询预约订单的详情")
+    @ApiResponses({
+            @ApiResponse(code = 200, message = "ok", response = ErpServiceOrderListVo.class)
+    })
     @RequestMapping(value = "/getServiceOrderById/{id}")
     public @ResponseBody
     AjaxResult getServiceOrderById(@PathVariable("id") Long id) {
@@ -332,13 +338,9 @@
         if (projServices == null) {
             return AjaxResult.buildFailInstance("服务单不存在");
         }
-        ServiceOrderDetailVo detailVo = SysProjServiceMapper.INSTANCE.projServiceToDetailVo(projServices);
-        List<SysBeauticianState> beauticianStates = sysBeauticianStateService.findBySerId(projServices.getId());
-        List<ServiceOrderDetailItemVo> items = SysBeauticianStateMapper.INSTANCE.entitiesToDetailItemsVo(beauticianStates);
-        detailVo.setItems(items);
+        ErpServiceOrderListVo serviceOrder = projServicesDao.findWxServiceOrderById(id);
         AjaxResult ajaxResult = AjaxResult.buildSuccessInstance("获取成功");
-        ajaxResult.putInMap("detail", detailVo);
-        ajaxResult.putInMap("shopInfo", shopInfoDao.selectById(projServices.getShopId()));
+        ajaxResult.putInMap("detail", serviceOrder);
         return ajaxResult;
     }
 
@@ -349,20 +351,18 @@
      * @param orderListDto
      * @return
      */
+    @ApiOperation(value = "查询服务单列表", notes = "查询服务单列表")
+    @ApiResponses({
+            @ApiResponse(code = 200, message = "ok", response = ErpServiceOrderListVo.class)
+    })
     @PostMapping(value = "/getServiceOrderList")
     @ResponseBody
-    public AjaxResult findServiceOrderList(@RequestBody @Validated ServiceOrderListDto orderListDto) {
+    public AjaxResult findServiceOrderList(@RequestBody @Validated ErpServiceOrderListDto orderListDto) {
         BizUser bizUser = redisUserLoginUtils.getLoginUser(BizUser.class);
         SysVipInfo vipInfo= vipInfoDao.selectByPhone(bizUser.getPhoneNumber());
-
-        PaginationVO pageVo = new PaginationVO();
-        int offset = (orderListDto.getPageNum() - 1) * orderListDto.getPageSize();
-        int limit = orderListDto.getPageSize();
-        pageVo.setOffset(offset);
-        pageVo.setLimit(limit);
         orderListDto.setVipId(vipInfo.getId());
-        List<ServiceOrderListVo> apiServiceOrderListInPage = projServicesService.findApiServiceOrderListInPage(orderListDto, pageVo);
-        return AjaxResult.buildSuccessInstance(apiServiceOrderListInPage, projServicesService.findApiServiceOrderListTotal(orderListDto));
+        List<ErpServiceOrderListVo> apiServiceOrderListInPage = projServicesDao.findWxServiceOrderList(orderListDto);
+        return AjaxResult.buildSuccessInstance(apiServiceOrderListInPage,"查询成功");
     }
 
     /**
@@ -371,10 +371,10 @@
      * @param
      * @return
      */
-    @RequestMapping(value = "/cancelOrderById/{id}")
+    @ApiOperation(value = "取消预约", notes = "取消预约")
+    @GetMapping(value = "/cancelOrderById/{id}")
     public @ResponseBody
-    AjaxResult cancelOrderById(@PathVariable("id") Long id) {
-
+    AjaxResult cancelOrderById(@PathVariable Long id) {
         SysProjServices services = new SysProjServices();
         services.setId(id);
         int i = projServicesService.modifyCancelProjServices(services);
@@ -383,25 +383,26 @@
         } else {
             return new AjaxResult(AjaxResult.STATUS_FAIL, "取消预约失败");
         }
+    }
 
+
+    @ApiOperation(value = "服务单评论", notes = "服务单评论")
+    @PostMapping(value = "/commentService")
+    public @ResponseBody
+    AjaxResult commentService(@RequestBody @Validated ErpServiceCommentDto commentDto) {
+        SysProjServices services = new SysProjServices();
+        services.setId(commentDto.getId());
+        services.setComment(commentDto.getComment());
+        int i = projServicesDao.update(services);
+        if (i > 0) {
+            return new AjaxResult(AjaxResult.STATUS_SUCCESS, "评论成功");
+        } else {
+            return new AjaxResult(AjaxResult.STATUS_FAIL, "评论失败");
+        }
     }
 
 
 
-
-    private UserProjInfo coversion(SysProjUse pUse) {
-        UserProjInfo projInfo = new UserProjInfo();
-        projInfo.setId(pUse.getId());
-        projInfo.setName(shoppingGoodsDao.selectById(pUse.getProjId()).getName());
-        projInfo.setSurplusCount(pUse.getSurplusCount() + "");
-        projInfo.setType(pUse.getType());
-        return projInfo;
-    }
-
-
-    private int dateToCodeInt(Date date) {
-        return Integer.parseInt(DateUtil.dateToString(date, DateUtil.HHmm));
-    }
 
 
 }

--
Gitblit v1.9.1