| | |
| | | package com.matrix.system.hive.service; |
| | | |
| | | import com.google.common.collect.Maps; |
| | | import com.matrix.core.tools.DateUtil; |
| | | import com.matrix.core.tools.LogUtil; |
| | | import com.matrix.core.tools.SmsUtils; |
| | | import com.matrix.core.tools.StringUtils; |
| | | import com.matrix.system.common.bean.BusParameterSettings; |
| | | import com.matrix.system.common.constance.AppConstance; |
| | | import com.matrix.system.common.dao.BusParameterSettingsDao; |
| | | import com.matrix.system.common.service.BusParameterSettingService; |
| | | import com.matrix.system.hive.bean.SysBeauticianState; |
| | | import com.matrix.system.hive.bean.SysProjServices; |
| | | import com.matrix.system.hive.bean.SysShopInfo; |
| | | import com.matrix.system.hive.bean.SysVipInfo; |
| | | import com.matrix.system.hive.dao.SysVipInfoDao; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.scheduling.annotation.Async; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @version: V1.0 |
| | |
| | | |
| | | SmsUtils smsUtils; |
| | | |
| | | SysShopInfoService shopInfoService; |
| | | |
| | | SysBeauticianStateService sysBeauticianStateService; |
| | | |
| | | BusParameterSettingService busParameterSettingService; |
| | | /** |
| | | * 预约成功短信提醒 |
| | | * |
| | | * @param services |
| | | */ |
| | | @Async |
| | | public void sendYycgNotice(SysProjServices services) { |
| | | |
| | | //短信接口为肽妍公司定制,暂时写死 |
| | | if(services.getCompanyId()!=17L){ |
| | | return; |
| | | } |
| | | if (chackSetting(services)) return; |
| | | |
| | | SysVipInfo sysVipInfo = vipInfoDao.selectById(services.getVipId()); |
| | | |
| | | HashMap<String, String> param = Maps.newHashMap(); |
| | | |
| | | List<SysBeauticianState> sysBeauticianStates = sysBeauticianStateService.findBySerId(services.getId()); |
| | | |
| | | String projNames = sysBeauticianStates.stream().map(item -> { |
| | | if(item.getProjInfo()!=null){ |
| | | return item.getProjInfo().getName(); |
| | | }else{ |
| | | return ""; |
| | | } |
| | | } ).collect(Collectors.joining(",")); |
| | | |
| | | LogUtil.debug("发送阿里云短信手机号{},项目{}",sysVipInfo.getPhone(), projNames); |
| | | if(StringUtils.isNotBlank(projNames) |
| | | && StringUtils.isNotBlank(sysVipInfo.getPhone())){ |
| | | param.put("projName",projNames); |
| | | smsUtils.sendSms(sysVipInfo.getPhone(),"SMS_227005614",param); |
| | | SysShopInfo shopInfo = shopInfoService.findById(services.getShopId()); |
| | | String date = DateUtil.dateFormatStr(new Date(), "yyyy年MM月dd日"); |
| | | LogUtil.debug("发送阿里云预约成功短信,手机号={}", sysVipInfo.getPhone()); |
| | | if (StringUtils.isNotBlank(sysVipInfo.getPhone())) { |
| | | HashMap<String, String> param = Maps.newHashMap(); |
| | | param.put("date", date); |
| | | param.put("tel", shopInfo.getShopTel()); |
| | | param.put("shopName", shopInfo.getShopName()); |
| | | smsUtils.sendSms(sysVipInfo.getPhone(), "SMS_226995798", param); |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 项目划扣短信提醒 |
| | | * |
| | | * @param services |
| | | */ |
| | | @Async |
| | | public void sendHkNotice(SysProjServices services) { |
| | | if (chackSetting(services)) return; |
| | | |
| | | SysVipInfo sysVipInfo = vipInfoDao.selectById(services.getVipId()); |
| | | SysShopInfo shopInfo = shopInfoService.findById(services.getShopId()); |
| | | String date = DateUtil.dateFormatStr(new Date(), "yyyy年MM月dd日"); |
| | | |
| | | List<SysBeauticianState> items = sysBeauticianStateService.findBySerId(services.getId()); |
| | | for (SysBeauticianState item : items) { |
| | | if (item.getProjInfo() != null) { |
| | | String projName = item.getProjInfo().getName(); |
| | | LogUtil.debug("发送阿里云项目划扣短信,手机号={}", sysVipInfo.getPhone()); |
| | | if (StringUtils.isNotBlank(sysVipInfo.getPhone())) { |
| | | HashMap<String, String> param = Maps.newHashMap(); |
| | | param.put("date", date); |
| | | param.put("projName", projName); |
| | | param.put("count", item.getCount() + ""); |
| | | param.put("balanceCount", item.getProjUse().getSurplusCount() + ""); |
| | | param.put("tel", shopInfo.getShopTel()); |
| | | param.put("shopName", shopInfo.getShopName()); |
| | | smsUtils.sendSms(sysVipInfo.getPhone(), "SMS_226995796", param); |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | private boolean chackSetting(SysProjServices services) { |
| | | //短信接口为肽妍公司定制,暂时写死 |
| | | if (services.getCompanyId() != 17L) { |
| | | return true; |
| | | } |
| | | if (!busParameterSettingService.isSettingOpen(AppConstance.OPEN_SMS_NOTICE, services.getCompanyId())) { |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | |
| | | } |