You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
56 lines
2.2 KiB
56 lines
2.2 KiB
import com.dxhy.order.constant.ConfigureConstant;
|
|
import com.dxhy.order.utils.AesEncryptUtil;
|
|
import com.dxhy.order.utils.HttpUtils;
|
|
import com.dxhy.order.utils.JsonUtils;
|
|
import com.dxhy.order.consumer.model.page.PageInterfaceUpdateRedis;
|
|
import org.apache.commons.io.FileUtils;
|
|
|
|
import java.io.File;
|
|
import java.io.IOException;
|
|
import java.nio.charset.StandardCharsets;
|
|
import java.util.ArrayList;
|
|
import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
|
|
/**
|
|
* 线上数据redis
|
|
*
|
|
* @author ZSC-DXHY-PC
|
|
* @date 创建时间: 2018/12/24 22:55
|
|
*/
|
|
public class sims_api_processRedis {
|
|
public static void main(String[] args) throws IOException {
|
|
|
|
/*
|
|
* 格式:xxfp:cache:order:operate:发票请求流水号
|
|
*/
|
|
List<String> gbk = FileUtils.readLines(new File("d://test/processRedis.txt"), StandardCharsets.UTF_8);
|
|
List<String> resultList = new ArrayList<>();
|
|
for (int i = 0; i < gbk.size(); i++) {
|
|
String[] split = gbk.get(i).split(",");
|
|
|
|
String url = "https://sims.ele-cloud.com/order-api/api/updateRedis";
|
|
Map<String, String> headMap = new HashMap<>(2);
|
|
headMap.put("Content-Type", ConfigureConstant.STRING_APPLICATION_JSON);
|
|
PageInterfaceUpdateRedis pageInterfaceUpdateRedis = new PageInterfaceUpdateRedis();
|
|
//操作类型(0:查询;1:更新;2:删除;3:模糊删除)
|
|
pageInterfaceUpdateRedis.setType("3");
|
|
pageInterfaceUpdateRedis.setRedisKey(split[0]);
|
|
pageInterfaceUpdateRedis.setRedisValue("88");
|
|
|
|
String content = AesEncryptUtil.encrypt(JsonUtils.getInstance().toJsonString(pageInterfaceUpdateRedis), "dtfbjpqla0dn7pmb");
|
|
|
|
String result = "{\"type\":\"0\",\"content\":\"" + content + "\"}";
|
|
String post = HttpUtils.doPostWithHeader(url, result, headMap);
|
|
Map map = JsonUtils.getInstance().parseObject(post, Map.class);
|
|
System.out.println(post);
|
|
System.out.println("执行了:" + (i + 1));
|
|
resultList.add(split[0] + "," + map.get("msg"));
|
|
}
|
|
|
|
for (String s : resultList) {
|
|
System.out.println(s);
|
|
}
|
|
}
|
|
}
|
|
|