From 6c235963d6fc46b38ea59d9b19c6519b892e080b Mon Sep 17 00:00:00 2001 From: xiaoyong931011 <15274802129@163.com> Date: Mon, 16 May 2022 09:42:06 +0800 Subject: [PATCH] 20220516 逻辑删除,更新字段IS_Delete字段为已删除,默认为空,删除后其余信息从查询中过滤了 --- zq-erp/src/main/java/com/matrix/system/hive/action/ProjServiceController.java | 193 +++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 158 insertions(+), 35 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 bfe6257..968cd07 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,6 +1,9 @@ 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.alibaba.fastjson.JSON; import com.matrix.core.anotations.RemoveRequestToken; import com.matrix.core.constance.MatrixConstance; import com.matrix.core.exception.GlobleException; @@ -13,20 +16,32 @@ 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.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.dao.SysCompanyDao; +import com.matrix.system.common.service.OperationLogService; import com.matrix.system.common.service.SysUsersService; +import com.matrix.system.common.tools.DataAuthUtil; import com.matrix.system.common.tools.ResponseHeadUtil; import com.matrix.system.constance.Dictionary; +import com.matrix.system.enums.OperationButtonEnum; +import com.matrix.system.enums.OperationFunctionEnum; +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.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.transaction.annotation.Transactional; 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.web.bind.annotation.*; +import org.springframework.web.servlet.ModelAndView; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; @@ -34,7 +49,9 @@ import java.io.IOException; import java.io.OutputStream; import java.net.URLEncoder; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; /** @@ -95,6 +112,10 @@ @Autowired SysShopInfoDao shopInfoDao; + @Autowired + private OperationLogService operationLogService; + + /** * 根据id查询服务单信息 */ @@ -111,9 +132,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); + } } } } @@ -132,6 +172,20 @@ 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); + } + /** * 分页显示所有的订单服务信息 @@ -146,7 +200,10 @@ if (StringUtils.isBlank(pageVo.getOrder())) { pageVo.setOrder("desc"); } - projService.setShopId(getMe().getShopId()); + if (!DataAuthUtil.hasAllShopAuth()) { + projService.setShopId(getMe().getShopId()); + } + QueryUtil.setQueryLimitCom(projService); List<SysProjServices> dataList = projServicesSerivce.findInPage(projService, pageVo); AjaxResult result = new AjaxResult(AjaxResult.STATUS_SUCCESS, dataList, projServicesSerivce.findTotal(projService)); return result; @@ -186,17 +243,10 @@ AjaxResult result = AjaxResult.buildSuccessInstance("查询成功"); SysProjUse queryUse = new SysProjUse(); - if(Objects.nonNull(vipId)){ - queryUse.setVipId(vipId); - }else{ - SysVipInfo vipInfo = getCurrentVioInfo(); - queryUse.setVipId(vipInfo.getId()); - } - + queryUse.setVipId(vipId); queryUse.setType(Dictionary.SHOPPING_GOODS_TYPE_XM); queryUse.setTaocanId(-1L); queryUse.setStatus(Dictionary.TAOCAN_STATUS_YX); - queryUse.setIsOver(Dictionary.FLAG_NO_N); List<SysProjUse> projList = projUseService.findInPage(queryUse, null); //切换到套餐查询条件 queryUse.setTaocanId(null); @@ -282,6 +332,7 @@ return "admin/hive/beautySalon/yypb-form"; } + /** * 进入预约排班详情 * @@ -316,7 +367,9 @@ for (SysBeauticianState sysBeauticianState : beauticianStateList) { if (sysBeauticianState.getProjUse().getTaocanId() != null) { SysProjUse sysProjUse = projUseService.findById(sysBeauticianState.getProjUse().getTaocanId()); - sysBeauticianState.getProjInfo().setName(sysProjUse.getProjName()+"--"+sysBeauticianState.getProjInfo().getName()); + if(sysProjUse != null) { + sysBeauticianState.getProjInfo().setName(sysProjUse.getProjName() + "--" + sysBeauticianState.getProjInfo().getName()); + } } } } @@ -383,6 +436,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 @@ -407,14 +471,23 @@ */ @RequestMapping(value = "/updateOrderTime") public @ResponseBody - AjaxResult updateOrderTime(SysProjServices serviceQuery) { - SysProjServices services = sysProjServicesDao.selectById(serviceQuery.getId()); - sysProjServicesDao.updateOrderTime(serviceQuery.getConsumeTime(), serviceQuery.getId()); + @Transactional(rollbackFor = Exception.class) + 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); + SysProjServices projServices = sysProjServicesDao.selectById(serviceOrderTimeDto.getId()); + //保存单据日志 + operationLogService.saveOperation(projServices.getCompanyId(), projServices.getShopId(),getMe().getSuId(), + OperationFunctionEnum.SERVICE_ORDER, + OperationButtonEnum.ORDER_UPDATE_TIME, + projServices.getId(), + projServices.getServiceNo(), + projServices.getVipId(), + "更新参数: "+JSON.toJSONString(serviceOrderTimeDto)); return new AjaxResult(AjaxResult.STATUS_SUCCESS, "修改成功"); } @@ -439,21 +512,30 @@ return new AjaxResult(AjaxResult.STATUS_SUCCESS, "成功"); } + @Autowired + private SysCompanyDao sysCompanyDao; /** - * 根据id对服务单进行派单 + * 服务单打印 */ - @RequestMapping(value = "/paidan") + @RequestMapping(value = "/printOrder") public @ResponseBody - AjaxResult paidan(Long id) { - SysProjServices services = sysProjServicesService.findById(id); - int i = sysProjServicesService.modifyPDProjServices(services); - if (i > 0) { - return new AjaxResult(AjaxResult.STATUS_SUCCESS, "派单成功"); - } else { - return new AjaxResult(AjaxResult.STATUS_FAIL, "派单失败"); + ModelAndView printOrder() throws GlobleException { + ModelAndView mv = new ModelAndView("admin/hive/beautySalon/print-service"); + SysUsers user=(SysUsers)WebUtil.getSession().getAttribute(MatrixConstance.LOGIN_KEY); + String comRegisterCode = sysCompanyDao.selectById(user.getCompanyId()).getComRegisterCode(); + if(StringUtils.isNotBlank(comRegisterCode)){ + mv.addObject("page",comRegisterCode); + }else { + mv.addObject("page","taiyan"); } + return mv; } + + + + @Autowired + BusParameterSettingsDao busParameterSettingsDao; /** * 根据id取消预约 @@ -461,6 +543,24 @@ @RequestMapping(value = "/cancelOrder") public @ResponseBody AjaxResult cancelOrder(SysProjServices services) { + + SysProjServices checkProjServices = sysProjServicesDao.selectById(services.getId()); + BusParameterSettings shopManageAbleCancelDfkOrder = busParameterSettingsDao.selectCompanyParamByCode(AppConstance.SHOP_MANAGE_ABLE_CANCEL_DFK_ORDER, checkProjServices.getCompanyId()); + 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)) { + return new AjaxResult(AjaxResult.STATUS_FAIL, "您只能取消待预约订单"); + } + } + return erpCancelOrder(services); + } + /** + * 根据id取消预约 + */ + @RequestMapping(value = "/erpCancelOrder") + public @ResponseBody + AjaxResult erpCancelOrder(SysProjServices services) { int i = sysProjServicesService.modifyCancelProjServices(services); if (i > 0) { return new AjaxResult(AjaxResult.STATUS_SUCCESS, "取消预约成功"); @@ -468,7 +568,6 @@ return new AjaxResult(AjaxResult.STATUS_FAIL, "取消预约失败"); } } - /** * 设置服务单划扣成功 @@ -493,8 +592,7 @@ @RequestMapping(value = "/addService") public @ResponseBody AjaxResult servicceAdd(@RequestBody SysProjServices sysProjServices) { - SysVipInfo vipInfo = getCurrentVioInfo(); - sysProjServices.setVipId(vipInfo.getId()); + if (CollectionUtils.isEmpty(sysProjServices.getServiceItems())) { return new AjaxResult(AjaxResult.STATUS_FAIL, "没有选中可消耗的项目"); @@ -509,7 +607,9 @@ if (balanceverifyResult.isError()) { return new AjaxResult(AjaxResult.STATUS_FAIL, balanceverifyResult.getMsg()); } - sysProjServices.setState(Dictionary.SERVICE_STATU_YYCG); + if (StrUtil.isEmpty(sysProjServices.getState())) { + sysProjServices.setState(Dictionary.SERVICE_STATU_DYY); + } SysProjServices newSysProjServices = sysProjServicesService.addSysProjServices(sysProjServices); if (newSysProjServices != null) { return AjaxResult.buildSuccessInstance(Arrays.asList(newSysProjServices)); @@ -524,8 +624,8 @@ @RequestMapping(value = "/addServiceForForm") public @ResponseBody AjaxResult servicceAddForForm(SysProjServices sysProjServices) { - SysVipInfo vipInfo = getCurrentVioInfo(); - sysProjServices.setVipId(vipInfo.getId()); + + if (CollectionUtils.isEmpty(sysProjServices.getServiceItems())) { return new AjaxResult(AjaxResult.STATUS_FAIL, "没有选中可消耗的项目"); @@ -561,6 +661,20 @@ } else { return new AjaxResult(AjaxResult.STATUS_FAIL, "排班失败"); } + } + + + + /** + * 删除服务单项目/套餐 + * @param id + * @return + */ + @RequestMapping(value = "/delServiceOrderItems") + @ResponseBody + public AjaxResult delServiceOrderItems(Long id) { + sysProjServicesService.deleteProjServiceItemById(id); + return AjaxResult.buildSuccessInstance("删除成功"); } @@ -609,12 +723,20 @@ private void doExportServiceOrder(HttpServletResponse response, SysProjServices projServices) throws IOException { + + //保存单据日志 + operationLogService.saveOperation(getMe().getCompanyId(), getMe().getShopId(),getMe().getSuId(), + OperationFunctionEnum.SERVICE_ORDER, + OperationButtonEnum.EXPORT, + String.format("导出参数:%s" , JSON.toJSONString(projServices))); + + List<ExcelSheetPO> res = new ArrayList<>(); ExcelSheetPO orderSheet = new ExcelSheetPO(); String title = "服务订单明细"; orderSheet.setSheetName(title); orderSheet.setTitle(title); - String[] header = {"服务单号","会员名称", "会员手机号", "消耗金额","服务状态", "下单时间","预约时间","是否超时(超时分钟)", "床位", "美疗师", "配料师", "健康顾问", "所属门店"}; + String[] header = {"服务单号","会员名称", "会员手机号", "消耗金额","服务状态", "下单时间","预约时间","状态","是否超时(超时分钟)", "床位", "美疗师", "配料师", "健康顾问", "划扣人", "所属门店"}; orderSheet.setHeaders(header); List<SysProjServices> dataList = projServicesSerivce.findByModel(projServices); @@ -635,6 +757,7 @@ temp.add(item.getBeautiName()); temp.add(item.getPlsName()); temp.add(item.getCreateStaffName()); + temp.add(item.getCashierName()); temp.add(item.getShopName()); list.add(temp); } -- Gitblit v1.9.1