| | |
| | | import com.ruoyi.system.api.domain.poji.member.Member; |
| | | 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 RemoteMemberService remoteMemberService; |
| | | |
| | | @Resource |
| | | private RemoteShopService remoteShopService; |
| | | |
| | | @Resource |
| | | private RemoteGoodsService remoteGoodsService; |
| | |
| | | ConsumerGoods consumerGoods; |
| | | Integer serviceCount = 0; |
| | | Integer cycleService = 0; |
| | | Integer cyclePerson = 0; |
| | | //Integer cyclePerson = 0; |
| | | Integer serviceService = 0; |
| | | Integer servicePerson = 0; |
| | | //Integer servicePerson = 0; |
| | | Integer experienceService = 0; |
| | | Integer experiencePerson = 0; |
| | | //Integer experiencePerson = 0; |
| | | Goods goods; |
| | | GoodsFile goodsFile; |
| | | String consumerGoodsId; |
| | | List<ConsumerGoods> consumerGoodsList = new ArrayList<>(); |
| | | MerMemberConsumerGoodsTotalVo memberConsumerGoodsTotalVo = this.getMemberConsumerGoodsTotalVo(merSureConsumerGoodsDto.getUserId(), merSureConsumerGoodsDto.getShopId()); |
| | | //获取用户各类型订单数 |
| | | //MerMemberConsumerGoodsTotalVo memberConsumerGoodsTotalVo = this.getMemberConsumerGoodsTotalVo(merSureConsumerGoodsDto.getUserId(), merSureConsumerGoodsDto.getShopId()); |
| | | int sureNum = 0; |
| | | for(MerSureConsumerGoodsListDto merSureConsumerGoodsListDto : merSureConsumerGoodsListDtoList){ |
| | | goods = remoteGoodsService.getGoods(merSureConsumerGoodsListDto.getGoodsId()).getData(); |
| | |
| | | } |
| | | } |
| | | } |
| | | //判断商品确认次数 |
| | | if(sureNum>oldConsumerGoods.getSureNum()){ |
| | | throw new ServiceException(AppErrorConstant.GOODS_SURE_FAILED); |
| | | }else{ |
| | |
| | | } |
| | | this.saveBatch(consumerGoodsList); |
| | | //判断是否加人 |
| | | if (cycleService > 0 && memberConsumerGoodsTotalVo.getCycleOrder() == 0) { |
| | | /*if (cycleService > 0 && memberConsumerGoodsTotalVo.getCycleOrder() == 0) { |
| | | cyclePerson = 1; |
| | | } |
| | | if (serviceService > 0 && memberConsumerGoodsTotalVo.getServiceOrder() == 0) { |
| | |
| | | } |
| | | if (experienceService > 0 && memberConsumerGoodsTotalVo.getExperienceOrder() == 0) { |
| | | experiencePerson = 1; |
| | | } |
| | | }*/ |
| | | serviceCount = cycleService + serviceService + experienceService; |
| | | //更新商户和会员服务统计 |
| | | MemberTotalChangeDto memberTotalChangeDto = new MemberTotalChangeDto(); |
| | |
| | | Integer serviceType = 1; |
| | | Integer serviceCount = 0; |
| | | Integer cycleService = 0; |
| | | Integer cyclePerson = 0; |
| | | //Integer cyclePerson = 0; |
| | | Integer serviceService = 0; |
| | | Integer servicePerson = 0; |
| | | //Integer servicePerson = 0; |
| | | Integer experienceService = 0; |
| | | Integer experiencePerson = 0; |
| | | //Integer experiencePerson = 0; |
| | | //获取会员商品总数 |
| | | List<ServiceRecordDetail> serviceRecordDetailList = new ArrayList<>(); |
| | | ServiceRecordDetail serviceRecordDetail; |
| | | MerMemberConsumerGoodsTotalVo memberGoodsTotal = this.getMemberConsumerGoodsTotalVo(merSureConsumerGoodsDto.getMemberUserId(), merSureConsumerGoodsDto.getShopId()); |
| | | //MerMemberConsumerGoodsTotalVo memberGoodsTotal = this.getMemberConsumerGoodsTotalVo(merSureConsumerGoodsDto.getMemberUserId(), merSureConsumerGoodsDto.getShopId()); |
| | | List<String> consumerGoodsList = new ArrayList<>(); |
| | | for (MerSureConsumerGoodsListDto goodsDto : goodsList) { |
| | | consumerGoods = this.getById(goodsDto.getConsumerGoodsId()); |
| | |
| | | } |
| | | |
| | | //判断是否减人 |
| | | if (cycleService > 0 && memberGoodsTotal.getCycleOrder() - cycleService < 1) { |
| | | /*if (cycleService > 0 && memberGoodsTotal.getCycleOrder() - cycleService < 1) { |
| | | cyclePerson = 1; |
| | | } |
| | | if (serviceService > 0 && memberGoodsTotal.getServiceOrder() - serviceService < 1) { |
| | |
| | | } |
| | | if (experienceService > 0 && memberGoodsTotal.getExperienceOrder() - experienceService < 1) { |
| | | experiencePerson = 1; |
| | | } |
| | | }*/ |
| | | serviceCount = cycleService + serviceService + experienceService; |
| | | UserServiceRecord serviceRecord = new UserServiceRecord(); |
| | | serviceRecord.setCreateTime(new Date()); |
| | |
| | | serviceRecord.setConsumerGoodsIds(goodsIds); |
| | | serviceRecord.setConsumerGoodsNames(goodsNames); |
| | | userServiceRecordService.saveOrUpdate(serviceRecord); |
| | | //服务记录详情 |
| | | for(ServiceRecordDetail serviceRecordDetail1 : serviceRecordDetailList){ |
| | | serviceRecordDetail1.setRecordId(serviceRecord.getId()); |
| | | } |
| | |
| | | public boolean saveBatchConsumerGoods(List<ConsumerGoods> consumerGoodsList){ |
| | | Integer serviceCount = 0; |
| | | Integer cycleService = 0; |
| | | Integer cyclePerson = 0; |
| | | //Integer cyclePerson = 0; |
| | | Integer serviceService = 0; |
| | | Integer servicePerson = 0; |
| | | //Integer servicePerson = 0; |
| | | Integer experienceService = 0; |
| | | Integer experiencePerson = 0; |
| | | //Integer experiencePerson = 0; |
| | | Long shopId = consumerGoodsList.get(0).getShopId(); |
| | | Long userId = consumerGoodsList.get(0).getUserId(); |
| | | MerMemberConsumerGoodsTotalVo memberConsumerGoodsTotalVo = this.getMemberConsumerGoodsTotalVo(userId, shopId); |
| | | //MerMemberConsumerGoodsTotalVo memberConsumerGoodsTotalVo = this.getMemberConsumerGoodsTotalVo(userId, shopId); |
| | | for(ConsumerGoods consumerGoods : consumerGoodsList){ |
| | | //处理商品服务次数 |
| | | switch (consumerGoods.getGoodsType()) { |
| | |
| | | } |
| | | } |
| | | //判断是否加人 |
| | | if (cycleService > 0 && memberConsumerGoodsTotalVo.getCycleOrder() == 0) { |
| | | /*if (cycleService > 0 && memberConsumerGoodsTotalVo.getCycleOrder() == 0) { |
| | | cyclePerson = 1; |
| | | } |
| | | if (serviceService > 0 && memberConsumerGoodsTotalVo.getServiceOrder() == 0) { |
| | |
| | | } |
| | | if (experienceService > 0 && memberConsumerGoodsTotalVo.getExperienceOrder() == 0) { |
| | | experiencePerson = 1; |
| | | } |
| | | }*/ |
| | | serviceCount = cycleService + serviceService + experienceService; |
| | | //更新商户和会员服务统计 |
| | | MemberTotalChangeDto memberTotalChangeDto = new MemberTotalChangeDto(); |