| | |
| | | import com.moral.constant.ResultMessage; |
| | | import com.moral.redis.RedisUtil; |
| | | import com.moral.util.PageResult; |
| | | import com.moral.util.TokenEncryptUtils; |
| | | import com.moral.util.TokenUtils; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.kafka.core.KafkaTemplate; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.*; |
| | | |
| | | |
| | | @Slf4j |
| | |
| | | kafkaTemplate.send("test_topic","test111111111111111"); |
| | | } |
| | | |
| | | @GetMapping("testToken") |
| | | public void testToken(){ |
| | | String decoded = TokenEncryptUtils.decoded("5b53480d4e570b54565f555775"); |
| | | String decoded2 = TokenEncryptUtils.decoded("584f560a49510f5453515453"); |
| | | System.out.println(decoded); |
| | | System.out.println(decoded2); |
| | | } |
| | | |
| | | public static void main(String[] args) throws IOException { |
| | | String path = "C:\\Users\\cdl\\Desktop\\province.txt"; |
| | | BufferedReader fis = new BufferedReader(new FileReader(path)); |
| | | BufferedWriter writer = new BufferedWriter(new FileWriter("C:\\Users\\cdl\\Desktop\\provin1ce.txt")); |
| | | String line = ""; |
| | | while((line = fis.readLine())!=null){ |
| | | //获取code |
| | | StringBuilder str = new StringBuilder(line); |
| | | String code = str.substring(31, 37); |
| | | |
| | | //获取名称 |
| | | char[] chars = line.toCharArray(); |
| | | int i = 0; |
| | | StringBuilder buffered = new StringBuilder(); |
| | | for (char aChar : chars) { |
| | | if(aChar=='\'') |
| | | i ++; |
| | | if(i==1){ |
| | | buffered.append(aChar); |
| | | } |
| | | } |
| | | buffered.append('\''); |
| | | String name = buffered.toString(); |
| | | |
| | | //获取父级code |
| | | line.trim(); |
| | | char[] chars1 = line.toCharArray(); |
| | | int j = 0; |
| | | StringBuilder buffered2 = new StringBuilder(); |
| | | for (char c : chars1) { |
| | | if(j==6){ |
| | | buffered2.append(c); |
| | | } |
| | | if(c==',') |
| | | j++; |
| | | } |
| | | StringBuilder parentCode = buffered2.deleteCharAt(buffered2.length() - 1); |
| | | //写入 |
| | | writer.write("INSERT INTO `sys_area` VALUES ("+code+","+name+","+parentCode+");"); |
| | | writer.newLine(); |
| | | } |
| | | |
| | | writer.close(); |
| | | fis.close(); |
| | | } |
| | | } |