| | |
| | | import org.apache.poi.ss.util.CellRangeAddressList; |
| | | import org.apache.poi.xssf.usermodel.XSSFWorkbook; |
| | | import org.apache.rocketmq.spring.core.RocketMQTemplate; |
| | | import org.redisson.api.RedissonClient; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.ApplicationEventPublisher; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.ServletOutputStream; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.InputStream; |
| | | import java.net.URLEncoder; |
| | | import java.util.*; |
| | | import java.util.concurrent.TimeUnit; |
| | | import java.util.stream.Collectors; |
| | | import cn.lili.modules.permission.entity.dos.Role; |
| | | /** |
| | |
| | | @Autowired |
| | | private AdminUserService adminUserService; |
| | | |
| | | @Resource |
| | | private RedisTemplate<Object,Object> redisTemplate; |
| | | |
| | | private final static String LOCK_ORDER_NO_MQ="lock_order_no_mq:"; |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void intoDB(TradeDTO tradeDTO) { |
| | |
| | | @Override |
| | | @Transactional |
| | | public String sendMqMessage(String snNo) { |
| | | //限制30秒只能请求一次避免出现重新提交问题 |
| | | Boolean b = redisTemplate.opsForValue().setIfAbsent(LOCK_ORDER_NO_MQ + snNo, snNo,30, TimeUnit.SECONDS); |
| | | if ( Boolean.FALSE.equals(b)){ |
| | | throw new ServiceException("请在30秒后重试"); |
| | | } |
| | | Order order = this.getBySn(snNo); |
| | | if (order == null) { |
| | | throw new ServiceException(ResultCode.ORDER_NOT_EXIST); |