| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.utils.uuid.IdUtils; |
| | |
| | | import com.ruoyi.system.api.domain.poji.goods.GoodsFile; |
| | | import com.ruoyi.system.api.domain.poji.goods.ShopGoods; |
| | | import com.ruoyi.system.api.domain.poji.member.Member; |
| | | import com.ruoyi.system.api.domain.poji.shop.Shop; |
| | | import com.ruoyi.system.api.service.RemoteGoodsService; |
| | | import com.ruoyi.system.api.service.RemoteMemberService; |
| | | import com.ruoyi.system.api.service.RemoteShopService; |
| | | import io.seata.spring.annotation.GlobalTransactional; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | |
| | | @Resource |
| | | private ServiceRecordDetailService serviceRecordDetailService; |
| | | |
| | | @Resource |
| | | private RemoteShopService remoteShopService; |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取用户服务 |
| | |
| | | ServiceRecordDetail serviceRecordDetail; |
| | | //MerMemberConsumerGoodsTotalVo memberGoodsTotal = this.getMemberConsumerGoodsTotalVo(merSureConsumerGoodsDto.getMemberUserId(), merSureConsumerGoodsDto.getShopId()); |
| | | List<String> consumerGoodsList = new ArrayList<>(); |
| | | List<Map<String, Object>> sendData = new ArrayList<>(); |
| | | for (MerSureConsumerGoodsListDto goodsDto : goodsList) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | consumerGoods = this.getById(goodsDto.getConsumerGoodsId()); |
| | | serviceRecordDetail = new ServiceRecordDetail(); |
| | | serviceNum = consumerGoods.getServiceNum(); |
| | |
| | | consumerGoods.setCompleteTime(new Date()); |
| | | } |
| | | this.saveOrUpdate(consumerGoods); |
| | | |
| | | int number = consumerGoods.getServiceNum() - consumerGoods.getUsedNum(); |
| | | if(number < 3){ |
| | | map.put("product", consumerGoods.getGoodsName()); |
| | | map.put("number", number); |
| | | sendData.add(map); |
| | | } |
| | | |
| | | shopId = consumerGoods.getShopId(); |
| | | userId = consumerGoods.getUserId(); |
| | | serviceType = consumerGoods.getGoodsType(); |
| | |
| | | shopTotalChange.setExperienceService(experienceService); |
| | | shopTotalChange.setExperiencePerson(experiencePerson); |
| | | remoteShopService.changeShopTotal(shopTotalChange);*/ |
| | | if(!consumerGoodsList.isEmpty()){ |
| | | if(!sendData.isEmpty()){ |
| | | Member member = remoteMemberService.getMember(userId).getData(); |
| | | R<Shop> r = remoteShopService.getShop(shopId); |
| | | if(r.getCode() != 200){ |
| | | throw new ServiceException(r.getMsg()); |
| | | } |
| | | Shop shop = r.getData(); |
| | | try { |
| | | MsgUtils.sendMsg(member.getMobile(),null,null); |
| | | for (Map<String, Object> sendDatum : sendData) { |
| | | String product = sendDatum.get("product").toString(); |
| | | Integer number = Integer.valueOf(sendDatum.get("number").toString()); |
| | | String msg = "{\"name\":\"" + (StringUtils.isEmpty(member.getRealName()) ? member.getNickName() : member.getRealName()) + "\"," + |
| | | "\"store\":\"" + shop.getShopName() + "\",\"product\":\"" + product + "\"}"; |
| | | if(number == 2){ |
| | | MsgUtils.sendMsg(member.getMobile(),"SMS_464376210",msg); |
| | | } |
| | | if(number == 0){ |
| | | MsgUtils.sendMsg(member.getMobile(),"SMS_464321234",msg); |
| | | } |
| | | } |
| | | |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |