| | |
| | | package com.matrix.system.shopXcx.api.action; |
| | | |
| | | import com.matrix.biz.bean.BizUser; |
| | | import com.matrix.biz.dao.BizUserDao; |
| | | import com.matrix.component.rabbitmq.RabiitMqTemplate; |
| | | import com.matrix.component.redis.RedisUserLoginUtils; |
| | | import com.matrix.core.constance.MatrixConstance; |
| | | import com.matrix.system.common.init.UserCacheManager; |
| | | 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.app.dto.ServiceOrderListDto; |
| | | import com.matrix.system.app.mapper.SysBeauticianStateMapper; |
| | | import com.matrix.system.app.mapper.SysProjServiceMapper; |
| | | import com.matrix.system.app.mapper.SysProjUseMapper; |
| | | import com.matrix.system.app.vo.*; |
| | | import com.matrix.system.app.vo.ServiceProductListVo; |
| | | import com.matrix.system.app.vo.ServiceProjVo; |
| | | import com.matrix.system.app.vo.ServiceTcVo; |
| | | import com.matrix.system.common.bean.BusParameterSettings; |
| | | import com.matrix.system.common.bean.SysUsers; |
| | | import com.matrix.system.common.dao.BusParameterSettingsDao; |
| | | import com.matrix.system.common.dao.SysUsersDao; |
| | | import com.matrix.system.common.interceptor.HostInterceptor; |
| | | import com.matrix.system.common.tools.DataAuthUtil; |
| | | import com.matrix.system.common.tools.LocationUtil; |
| | | import com.matrix.system.constance.Dictionary; |
| | | import com.matrix.system.hive.bean.*; |
| | | 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.bean.ShopProduct; |
| | | import com.matrix.system.score.constant.ScoreSettingConstant; |
| | | import com.matrix.system.score.entity.ScoreVipDetail; |
| | | import com.matrix.system.score.service.ScoreVipDetailService; |
| | | import com.matrix.system.shopXcx.api.dto.ErpServiceCommentDto; |
| | | import com.matrix.system.shopXcx.api.dto.ErpServiceOrderListDto; |
| | | import com.matrix.system.shopXcx.api.vo.ErpServiceOrderListVo; |
| | | 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.ApiOperation; |
| | | import io.swagger.annotations.ApiResponse; |
| | | import io.swagger.annotations.ApiResponses; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Controller; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.util.*; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author jiangyouyao |
| | |
| | | private SysBeauticianStateService sysBeauticianStateService; |
| | | |
| | | @Autowired |
| | | RedisUserLoginUtils redisUserLoginUtils; |
| | | private UserCacheManager userCacheManager; |
| | | |
| | | @Autowired |
| | | ShopProductDao productDao; |
| | |
| | | SysUsersDao staffInfoDao; |
| | | |
| | | @Autowired |
| | | BizUserDao bizUserDao; |
| | | SysVipInfoDao sysVipInfoDao; |
| | | |
| | | @Autowired |
| | | RabiitMqTemplate rabiitMqTemplate; |
| | | |
| | | @Autowired |
| | | SysProjUseDao projUseDao; |
| | |
| | | |
| | | @Autowired |
| | | ShoppingGoodsDao shoppingGoodsDao; |
| | | @Autowired |
| | | ScoreVipDetailService scoreVipDetailService; |
| | | |
| | | @Autowired |
| | | private BusParameterSettingsDao busParameterSettingsDao; |
| | | |
| | | @Value("${evn}") |
| | | private String evn; |
| | |
| | | @ResponseBody |
| | | public |
| | | AjaxResult getUserPro(@PathVariable String phone) { |
| | | SysVipInfo vipInfo = vipInfoDao.selectByPhone(phone); |
| | | SysVipInfo vipInfo = vipInfoDao.selectByPhone(phone,HostInterceptor.getCompanyId()); |
| | | |
| | | if (vipInfo == null) { |
| | | throw new GlobleException("会员不存在"); |
| | |
| | | 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); |
| | | List<ServiceProjVo> serviceProjVos = SysProjUseMapper.INSTANCE.entityListToProjVoList(projList); |
| | | |
| | |
| | | |
| | | if (CollectionUtils.isNotEmpty(serviceTcVos)) { |
| | | serviceTcVos.forEach(item -> { |
| | | List<SysProjUse> sysProjUses = projUseService.selectTaocanProjUse(item.getId()); |
| | | List<SysProjUse> sysProjUses = projUseService.selectTaocanProjUse(item.getId(), queryUse.getStatus()); |
| | | List<ServiceProjVo> taocanProj = SysProjUseMapper.INSTANCE.entityListToProjVoList(sysProjUses); |
| | | item.setProj(taocanProj); |
| | | }); |
| | |
| | | @RequestMapping(value = "/createServiceOrder") |
| | | public @ResponseBody |
| | | AjaxResult createServiceOrder(@RequestBody Onlinebooking onlinebooking) { |
| | | BizUser bizUser = redisUserLoginUtils.getLoginUser(BizUser.class); |
| | | bizUser = bizUserDao.findByOpenId(bizUser.getOpenId()); |
| | | SysVipInfo vipInfo = vipInfoDao.selectByPhone(bizUser.getPhoneNumber()); |
| | | |
| | | |
| | | SysVipInfo sysVipInfo = userCacheManager.getLoginUser(); |
| | | SysVipInfo vipInfo = vipInfoDao.selectByPhone(sysVipInfo.getPhone(),HostInterceptor.getCompanyId()); |
| | | 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()); |
| | | |
| | |
| | | sysProjServices.setState(Dictionary.SERVICE_STATU_DQR); |
| | | SysProjServices newSysProjServices = projServicesService.addSysProjServices(sysProjServices); |
| | | if (newSysProjServices != null) { |
| | | |
| | | //添加用户积分 |
| | | BusParameterSettings parameterSetting = busParameterSettingsDao.selectCompanyParamByCode(ScoreSettingConstant.RESERVATION_SERVICE_SHOP, sysVipInfo.getCompanyId()); |
| | | scoreVipDetailService.addScoreByParamSetting(sysVipInfo.getId(), null,null, newSysProjServices.getId(), |
| | | ScoreVipDetail.SCORE_VIP_TYPE_JOIN_ACTIVE,"预约送积分", parameterSetting); |
| | | |
| | | |
| | | return AjaxResult.buildSuccessInstance("下单成功"); |
| | | } else { |
| | | return new AjaxResult(AjaxResult.STATUS_FAIL, "下单失败!"); |
| | |
| | | * @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) { |
| | |
| | | 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; |
| | | } |
| | | |
| | |
| | | * @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) { |
| | | 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)); |
| | | public AjaxResult findServiceOrderList(@RequestBody @Validated ErpServiceOrderListDto orderListDto) { |
| | | SysVipInfo sysVipInfo = userCacheManager.getLoginUser(); |
| | | orderListDto.setVipId(sysVipInfo.getId()); |
| | | List<ErpServiceOrderListVo> apiServiceOrderListInPage = projServicesDao.findWxServiceOrderList(orderListDto); |
| | | return AjaxResult.buildSuccessInstance(apiServiceOrderListInPage,"查询成功"); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @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); |
| | |
| | | } 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)); |
| | | } |
| | | |
| | | |
| | | } |