记得上下班打卡 | git大法好,push需谨慎

Commit f7a76ec1 authored by 胡佳晨's avatar 胡佳晨

1

parent 58a46d74
...@@ -44,11 +44,11 @@ public class DataController { ...@@ -44,11 +44,11 @@ public class DataController {
// Boolean result = data.childAccount(); // Boolean result = data.childAccount();
// return ResponseDto.success(result); // return ResponseDto.success(result);
// } // }
//
@PostMapping("SurplusRedis") // @PostMapping("SurplusRedis")
@ApiOperation("redis库存迁移") // @ApiOperation("redis库存迁移")
public ResponseDto<Boolean> SurplusRedis() { // public ResponseDto<Boolean> SurplusRedis() {
Boolean result = data.SurplusRedis(); // Boolean result = data.SurplusRedis();
return ResponseDto.success(result); // return ResponseDto.success(result);
} // }
} }
...@@ -935,46 +935,48 @@ public class DataImpl { ...@@ -935,46 +935,48 @@ public class DataImpl {
} }
} }
// redis 库存迁移 // // redis 库存迁移
private static final JedisPool jedisPool; // private static final JedisPool jedisPool;
private static final ObjectMapper toObjMapper; // private static final ObjectMapper toObjMapper;
//
static { // static {
// DefaultJedisClientConfig.Builder builder = DefaultJedisClientConfig.builder().password("NBs$%6hW").database(15); //// DefaultJedisClientConfig.Builder builder = DefaultJedisClientConfig.builder().password("NBs$%6hW").database(15);
// jedis = new Jedis(new HostAndPort("zhengzai.redis.rds.aliyuncs.com", 6380), builder.build()); //// jedis = new Jedis(new HostAndPort("zhengzai.redis.rds.aliyuncs.com", 6380), builder.build());
//
jedisPool = new JedisPool("zhengzai.redis.rds.aliyuncs.com", 6380); // jedisPool = new JedisPool("zhengzai.redis.rds.aliyuncs.com", 6380);
//
toObjMapper = new ObjectMapper(); // toObjMapper = new ObjectMapper();
toObjMapper.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY); // toObjMapper.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
toObjMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); // toObjMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
toObjMapper.registerModule(new JavaTimeModule()); // toObjMapper.registerModule(new JavaTimeModule());
toObjMapper.activateDefaultTyping(toObjMapper.getPolymorphicTypeValidator(), ObjectMapper.DefaultTyping.NON_FINAL); // toObjMapper.activateDefaultTyping(toObjMapper.getPolymorphicTypeValidator(), ObjectMapper.DefaultTyping.NON_FINAL);
} // }
@Autowired // public boolean SurplusRedis() {
public boolean SurplusRedis() { // Jedis jedis = null;
// try {
Jedis jedis = null; // jedis = jedisPool.getResource();
try { // jedis.auth("NBs$%6hW");
jedis = jedisPool.getResource(); // jedis.select(15);
jedis.auth("NBs$%6hW"); //
jedis.select(15); // List<KylinTicketStatus> ticketStatus = ticketStatusMapper.selectList(Wrappers.lambdaQuery(KylinTicketStatus.class));
// for (KylinTicketStatus item : ticketStatus) {
List<KylinTicketStatus> ticketStatus = ticketStatusMapper.selectList(Wrappers.lambdaQuery(KylinTicketStatus.class)); // String ticketId = item.getTicketId();
for (KylinTicketStatus item : ticketStatus) { // try {
String ticketId = item.getTicketId(); // dataUtils.setSurplusGeneral(ticketId, toObjMapper.readValue(jedis.get(KylinRedisConst.PERFORMANCES_INVENTORY + ticketId + ":" + KylinRedisConst.SURPLUS_GENERAL), Integer.class));
dataUtils.setSurplusGeneral(ticketId, toObjMapper.readValue(jedis.get(KylinRedisConst.PERFORMANCES_INVENTORY + ticketId + ":" + KylinRedisConst.SURPLUS_GENERAL), Integer.class)); // dataUtils.setSurplusExchange(ticketId, toObjMapper.readValue(jedis.get(KylinRedisConst.PERFORMANCES_INVENTORY + ticketId + ":" + KylinRedisConst.SURPLUS_EXCHANGE), Integer.class));
dataUtils.setSurplusExchange(ticketId, toObjMapper.readValue(jedis.get(KylinRedisConst.PERFORMANCES_INVENTORY + ticketId + ":" + KylinRedisConst.SURPLUS_EXCHANGE), Integer.class)); // } catch (Exception e) {
} // e.printStackTrace();
return true; // }
} catch (Exception e) { // }
e.printStackTrace(); // return true;
return false; // } catch (Exception e) {
} finally { // e.printStackTrace();
if (jedis != null) { // return false;
jedis.close(); // } finally {
} // if (jedis != null) {
} // jedis.close();
} // }
// }
// }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment