| | |
| | | import org.apache.commons.lang.time.DateFormatUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Isolation; |
| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.File; |
| | | import java.io.FileWriter; |
| | | import java.io.PrintWriter; |
| | | import java.math.BigDecimal; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | |
| | | @Autowired |
| | | private IOrderPositionService orderPositionService; |
| | | |
| | | @Autowired |
| | | private PushMinistryOfTransportUtil pushMinistryOfTransportUtil; |
| | | @Resource |
| | | private MongoTemplate mongoTemplate; |
| | | |
| | | @Autowired |
| | | private IOrderCancelService orderCancelService; |
| | |
| | | @Autowired |
| | | private IOrderAdditionalFeeService orderAdditionalFeeService; |
| | | |
| | | @Autowired |
| | | private RedisTemplate redisTemplate; |
| | | @Resource |
| | | private RedisTemplate<String, Object> redisTemplate; |
| | | |
| | | @Autowired |
| | | private IMerchantActivityService merchantActivityService; |
| | |
| | | private IMerchantCouponService merchantCouponService; |
| | | @Autowired |
| | | private QrCodeConfiguration qrCodeConfiguration; |
| | | @Value("${filePath}") |
| | | private String filePath; |
| | | |
| | | @Value("${pushMinistryOfTransport}") |
| | | private boolean pushMinistryOfTransport; |
| | |
| | | orderPosition.setInsertTime(new Date()); |
| | | //将数据存储到文件中 |
| | | List<OrderPosition> orderPositions = orderPositionService.queryPosition(orderCrossCity.getId(), 3); |
| | | File file = new File(filePath + orderCrossCity.getId() + "_3" + ".txt"); |
| | | if(!file.exists()){ |
| | | file.getParentFile().mkdirs(); |
| | | file.createNewFile(); |
| | | } |
| | | //写入相应的文件 |
| | | PrintWriter out = new PrintWriter(new FileWriter(file)); |
| | | orderPositions.add(orderPosition); |
| | | System.err.println("存储新数据:" + JSON.toJSONString(orderPositions)); |
| | | out.write(JSON.toJSONString(orderPositions)); |
| | | out.flush(); |
| | | out.close(); |
| | | mongoTemplate.save(orderPositions); |
| | | } |
| | | } |
| | | return false;//上层不需要处理 |